diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-03-01 16:50:37 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-03-01 22:20:38 +0100 |
commit | dc99d27f04b47c173de934a19b6d6a3cc572c20a (patch) | |
tree | 6762ce99f1397b04ac55498374fdd4a907cc07df | |
parent | 684e0b742aa611e684cfdf1f7ddff711bf6ab513 (diff) |
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/+/130801
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 125c58808bf3..b0566791d4f1 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -3996,7 +3996,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()) { @@ -4006,7 +4007,7 @@ public: return false; } - bool signal_key_release(const GdkEventKey* pEvent) + virtual bool do_signal_key_release(const GdkEventKey* pEvent) { if (m_aKeyReleaseHdl.IsSet()) { @@ -4015,6 +4016,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 @@ -17551,6 +17562,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)); @@ -17932,8 +17948,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); |