include/vcl/customweld.hxx    |    2 ++
 vcl/source/app/customweld.cxx |    9 +++++++++
 2 files changed, 11 insertions(+)

New commits:
commit cb42d9e8a5246973921cfbd43d2e76afde85798a
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sun Mar 9 23:19:11 2025 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon Mar 10 09:21:15 2025 +0100

    Resolves: tdf#143909 some gtk im need to see key release
    
    e.g. GTK_IM_MODULE="gtk-im-context-simple" GDK_BACKEND=x11 and
    ctrl+shift+u followed by hex digits in writer comments
    
    Change-Id: I0da17b8e18b088789cb6359610473da22c9c70af
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182703
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/include/vcl/customweld.hxx b/include/vcl/customweld.hxx
index 92e287231980..ca50afbd23e0 100644
--- a/include/vcl/customweld.hxx
+++ b/include/vcl/customweld.hxx
@@ -39,6 +39,7 @@ public:
     virtual void StyleUpdated() { Invalidate(); }
     virtual bool Command(const CommandEvent&) { return false; }
     virtual bool KeyInput(const KeyEvent&) { return false; }
+    virtual bool KeyUp(const KeyEvent&) { return false; }
     virtual tools::Rectangle GetFocusRect() { return tools::Rectangle(); }
     virtual FactoryFunction GetUITestFactory() const { return nullptr; }
     virtual OUString RequestHelp(tools::Rectangle&) { return OUString(); }
@@ -160,6 +161,7 @@ private:
     DECL_DLLPRIVATE_LINK(DoGetFocus, weld::Widget&, void);
     DECL_DLLPRIVATE_LINK(DoLoseFocus, weld::Widget&, void);
     DECL_DLLPRIVATE_LINK(DoKeyPress, const KeyEvent&, bool);
+    DECL_DLLPRIVATE_LINK(DoKeyRelease, const KeyEvent&, bool);
     DECL_DLLPRIVATE_LINK(DoFocusRect, weld::Widget&, tools::Rectangle);
     DECL_DLLPRIVATE_LINK(DoCommand, const CommandEvent&, bool);
     DECL_DLLPRIVATE_LINK(DoStyleUpdated, weld::Widget&, void);
diff --git a/vcl/source/app/customweld.cxx b/vcl/source/app/customweld.cxx
index 675373aa5f31..c34c0a2ae0ab 100644
--- a/vcl/source/app/customweld.cxx
+++ b/vcl/source/app/customweld.cxx
@@ -34,6 +34,10 @@ CustomWeld::CustomWeld(weld::Builder& rBuilder, const 
OUString& rDrawingId,
     m_xDrawingArea->connect_focus_in(LINK(this, CustomWeld, DoGetFocus));
     m_xDrawingArea->connect_focus_out(LINK(this, CustomWeld, DoLoseFocus));
     m_xDrawingArea->connect_key_press(LINK(this, CustomWeld, DoKeyPress));
+    // tdf#143909 if we accept input, then we need to listen for key releases 
as well
+    // so that they are forwarded to any potential input methods that 
activated on
+    // key press.
+    m_xDrawingArea->connect_key_release(LINK(this, CustomWeld, DoKeyRelease));
     m_xDrawingArea->connect_focus_rect(LINK(this, CustomWeld, DoFocusRect));
     m_xDrawingArea->connect_style_updated(LINK(this, CustomWeld, 
DoStyleUpdated));
     m_xDrawingArea->connect_command(LINK(this, CustomWeld, DoCommand));
@@ -78,6 +82,11 @@ IMPL_LINK(CustomWeld, DoKeyPress, const KeyEvent&, rKEvt, 
bool)
     return m_rWidgetController.KeyInput(rKEvt);
 }
 
+IMPL_LINK(CustomWeld, DoKeyRelease, const KeyEvent&, rKEvt, bool)
+{
+    return m_rWidgetController.KeyUp(rKEvt);
+}
+
 IMPL_LINK_NOARG(CustomWeld, DoFocusRect, weld::Widget&, tools::Rectangle)
 {
     return m_rWidgetController.GetFocusRect();

Reply via email to