[Libreoffice-commits] core.git: vcl/unx

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Nov 14 14:39:25 UTC 2018


 vcl/unx/gtk3/gtk3gtkinst.cxx |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 7374b8aceba8e7f6a89982844bcdc3a861bf0b49
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Nov 13 21:29:31 2018 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Nov 14 15:39:00 2018 +0100

    Resolves: tdf#121394 listen to key strokes only if GDK_BUTTON_PRESS_MASK set
    
    Change-Id: I5471ed2f4243f79fd0bcb4f65079318c4dd65e26
    Reviewed-on: https://gerrit.libreoffice.org/63345
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 86a6f4882a94..05b622c24015 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1221,8 +1221,12 @@ public:
         , m_bFrozen(false)
         , m_nFocusInSignalId(0)
         , m_nFocusOutSignalId(0)
-        , m_nKeyPressSignalId(g_signal_connect(pWidget, "key-press-event", G_CALLBACK(signalKeyPress), this))
     {
+        GdkEventMask eEventMask(static_cast<GdkEventMask>(gtk_widget_get_events(pWidget)));
+        if (eEventMask & GDK_BUTTON_PRESS_MASK)
+            m_nKeyPressSignalId = g_signal_connect(pWidget, "key-press-event", G_CALLBACK(signalKeyPress), this);
+        else
+            m_nKeyPressSignalId = 0;
     }
 
     virtual void set_sensitive(bool sensitive) override
@@ -1522,7 +1526,8 @@ public:
 
     virtual ~GtkInstanceWidget() override
     {
-        g_signal_handler_disconnect(m_pWidget, m_nKeyPressSignalId);
+        if (m_nKeyPressSignalId)
+            g_signal_handler_disconnect(m_pWidget, m_nKeyPressSignalId);
         if (m_nFocusInSignalId)
             g_signal_handler_disconnect(m_pWidget, m_nFocusInSignalId);
         if (m_nFocusOutSignalId)


More information about the Libreoffice-commits mailing list