vcl/unx/gtk3/gtkinst.cxx |   43 +++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 41 insertions(+), 2 deletions(-)

New commits:
commit 8badc2314961e87e0b2cc01164442d97e20f9419
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Mar 1 16:50:37 2022 +0000
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Wed Mar 2 04:30:00 2022 +0100

    Resolves: tdf#145580 need to use gtk_im_context_filter_keypress
    
    for at least xim, ibus works fine. To reproduce under Fedora with gtk3
    can use a keyboard layout of "US International with dead keys" with
    export GDK_BACKEND=x11
    export GTK_IM_MODULE=xim
    
    and 'a in writer comment or calc header/footer dialog
    
    Change-Id: I49425887dccc23c4fadf2bc007b6e83fc7993f7a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130775
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index fad6ad3846fa..31935aea6102 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -4017,7 +4017,8 @@ public:
         return false;
     }
 #else
-    bool signal_key_press(const GdkEventKey* pEvent)
+
+    virtual bool do_signal_key_press(const GdkEventKey* pEvent)
     {
         if (m_aKeyPressHdl.IsSet())
         {
@@ -4027,7 +4028,7 @@ public:
         return false;
     }
 
-    bool signal_key_release(const GdkEventKey* pEvent)
+    virtual bool do_signal_key_release(const GdkEventKey* pEvent)
     {
         if (m_aKeyReleaseHdl.IsSet())
         {
@@ -4036,6 +4037,16 @@ public:
         }
         return false;
     }
+
+    bool signal_key_press(const GdkEventKey* pEvent)
+    {
+        return do_signal_key_press(pEvent);
+    }
+
+    bool signal_key_release(const GdkEventKey* pEvent)
+    {
+        return do_signal_key_release(pEvent);
+    }
 #endif
 
     virtual void grab_add() override
@@ -17424,6 +17435,11 @@ public:
         return signal_im_context_delete_surrounding(rRange);
     }
 
+#if !GTK_CHECK_VERSION(4, 0, 0)
+    virtual bool do_signal_key_press(const GdkEventKey* pEvent) override;
+    virtual bool do_signal_key_release(const GdkEventKey* pEvent) override;
+#endif
+
     virtual void queue_draw() override
     {
         gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea));
@@ -17805,8 +17821,31 @@ public:
         pThis->updateIMSpotLocation();
         pThis->EndExtTextInput();
     }
+
+#if !GTK_CHECK_VERSION(4, 0, 0)
+    bool im_context_filter_keypress(const GdkEventKey* pEvent)
+    {
+        return gtk_im_context_filter_keypress(m_pIMContext, 
const_cast<GdkEventKey*>(pEvent));
+    }
+#endif
 };
 
+#if !GTK_CHECK_VERSION(4, 0, 0)
+bool GtkInstanceDrawingArea::do_signal_key_press(const GdkEventKey* pEvent)
+{
+    if (m_xIMHandler && m_xIMHandler->im_context_filter_keypress(pEvent))
+        return true;
+    return GtkInstanceWidget::do_signal_key_press(pEvent);
+}
+
+bool GtkInstanceDrawingArea::do_signal_key_release(const GdkEventKey* pEvent)
+{
+    if (m_xIMHandler && m_xIMHandler->im_context_filter_keypress(pEvent))
+        return true;
+    return GtkInstanceWidget::do_signal_key_release(pEvent);
+}
+#endif
+
 void GtkInstanceDrawingArea::set_input_context(const InputContext& 
rInputContext)
 {
     bool bUseIm(rInputContext.GetOptions() & InputContextFlags::Text);

Reply via email to