[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 11 15:57:36 UTC 2020


 vcl/unx/gtk3/gtk3gtkinst.cxx |   29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

New commits:
commit bba1c767617e38f2bafd4ba67aa1be95f47a9103
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Feb 19 12:35:56 2020 +0000
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Wed Mar 11 16:57:05 2020 +0100

    Resolves: tdf#130400 reserve ctrl+page_up and ctrl+page_down for notebooks
    
    Change-Id: I627298cb844967eeb1e166720e3951be732a4dc5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89016
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89481
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 41af4ee7cf62..541b3356b203 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -12020,6 +12020,9 @@ private:
 
     bool signal_key_press(GdkEventKey* pEvent)
     {
+        if (pEvent->state) // only with no modifiers held
+            return false;
+
         if (pEvent->keyval == GDK_KEY_KP_Up || pEvent->keyval == GDK_KEY_Up || pEvent->keyval == GDK_KEY_KP_Page_Up || pEvent->keyval == GDK_KEY_Page_Up ||
             pEvent->keyval == GDK_KEY_KP_Down || pEvent->keyval == GDK_KEY_Down || pEvent->keyval == GDK_KEY_KP_Page_Down || pEvent->keyval == GDK_KEY_Page_Down)
         {
@@ -12338,6 +12341,31 @@ void ensure_intercept_drawing_area_accessibility()
     }
 }
 
+void ensure_disable_ctrl_page_up_down(GType eType)
+{
+    gpointer pClass = g_type_class_ref(eType);
+    GtkWidgetClass* pWidgetClass = GTK_WIDGET_CLASS(pClass);
+    GtkBindingSet* pBindingSet = gtk_binding_set_by_class(pWidgetClass);
+    gtk_binding_entry_remove(pBindingSet, GDK_KEY_Page_Up, GDK_CONTROL_MASK);
+    gtk_binding_entry_remove(pBindingSet, GDK_KEY_Page_Up, static_cast<GdkModifierType>(GDK_SHIFT_MASK|GDK_CONTROL_MASK));
+    gtk_binding_entry_remove(pBindingSet, GDK_KEY_Page_Down, GDK_CONTROL_MASK);
+    gtk_binding_entry_remove(pBindingSet, GDK_KEY_Page_Down, static_cast<GdkModifierType>(GDK_SHIFT_MASK|GDK_CONTROL_MASK));
+    g_type_class_unref(pClass);
+}
+
+// tdf#130400 disable ctrl+page_up and ctrl+page_down bindings so the
+// keystrokes are consumed by the surrounding notebook bindings instead
+void ensure_disable_ctrl_page_up_down_bindings()
+{
+    static bool bDone;
+    if (!bDone)
+    {
+        ensure_disable_ctrl_page_up_down(GTK_TYPE_TREE_VIEW);
+        ensure_disable_ctrl_page_up_down(GTK_TYPE_SPIN_BUTTON);
+        bDone = true;
+    }
+}
+
 }
 
 class GtkInstanceBuilder : public weld::Builder
@@ -12544,6 +12572,7 @@ public:
         , m_nNotifySignalId(0)
     {
         ensure_intercept_drawing_area_accessibility();
+        ensure_disable_ctrl_page_up_down_bindings();
 
         sal_Int32 nIdx = m_sHelpRoot.lastIndexOf('.');
         if (nIdx != -1)


More information about the Libreoffice-commits mailing list