vcl/unx/gtk3/gtkinst.cxx |   27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

New commits:
commit e388a4d6d7ab355fc7aa5fca05e06070693847e9
Author:     Caolán McNamara <[email protected]>
AuthorDate: Tue Mar 1 16:50:37 2022 +0000
Commit:     Adolfo Jayme Barrientos <[email protected]>
CommitDate: Wed Mar 2 04:30:47 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/+/130802
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <[email protected]>

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index aa5b0685aa21..d106aaf92c78 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -3911,7 +3911,7 @@ public:
     }
 
 #if !GTK_CHECK_VERSION(4, 0, 0)
-    bool signal_key(const GdkEventKey* pEvent)
+    virtual bool do_signal_key(const GdkEventKey* pEvent)
     {
         if (pEvent->type == GDK_KEY_PRESS && m_aKeyPressHdl.IsSet())
         {
@@ -3925,6 +3925,11 @@ public:
         }
         return false;
     }
+
+    bool signal_key(const GdkEventKey* pEvent)
+    {
+        return do_signal_key(pEvent);
+    }
 #endif
 
     virtual void grab_add() override
@@ -16855,6 +16860,10 @@ public:
         return signal_im_context_delete_surrounding(rRange);
     }
 
+#if !GTK_CHECK_VERSION(4, 0, 0)
+    virtual bool do_signal_key(const GdkEventKey* pEvent) override;
+#endif
+
     virtual void queue_draw() override
     {
         gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea));
@@ -17206,8 +17215,24 @@ 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(const GdkEventKey* pEvent)
+{
+    if (m_xIMHandler && m_xIMHandler->im_context_filter_keypress(pEvent))
+        return true;
+    return GtkInstanceWidget::do_signal_key(pEvent);
+}
+#endif
+
 void GtkInstanceDrawingArea::set_input_context(const InputContext& 
rInputContext)
 {
     bool bUseIm(rInputContext.GetOptions() & InputContextFlags::Text);

Reply via email to