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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Aug 2 20:07:22 UTC 2020


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

New commits:
commit 36f5265b038b610c61ebc459465c5c58b1d9dc28
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Aug 2 16:32:09 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Aug 2 22:06:36 2020 +0200

    tdf#135368 change the mnemonic to point to our combobox replacement
    
    Change-Id: Ib53b787399954e5be7e4b4080366fe64cc937de3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99958
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 20078e3950bb..fba1fa52fec8 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1768,6 +1768,17 @@ namespace
             gtk_size_group_add_widget(pSizeGroup, pReplacement);
         }
 
+        // tdf#135368 change the mnemonic to point to our replacement
+        GList* pLabels = gtk_widget_list_mnemonic_labels(pWidget);
+        for (GList* pLabel = g_list_first(pLabels); pLabel; pLabel = g_list_next(pLabel))
+        {
+            GtkWidget* pLabelWidget = static_cast<GtkWidget*>(pLabel->data);
+            if (!GTK_IS_LABEL(pLabelWidget))
+                continue;
+            gtk_label_set_mnemonic_widget(GTK_LABEL(pLabelWidget), pReplacement);
+        }
+        g_list_free(pLabels);
+
         gtk_container_add(GTK_CONTAINER(pParent), pReplacement);
 
         if (GTK_IS_GRID(pParent))
@@ -14169,6 +14180,21 @@ private:
         }
     }
 
+    void signal_combo_mnemonic_activate()
+    {
+        if (m_pEntry)
+            gtk_widget_grab_focus(m_pEntry);
+        else
+            gtk_widget_grab_focus(m_pToggleButton);
+    }
+
+    static gboolean signalComboMnemonicActivate(GtkWidget*, gboolean, gpointer widget)
+    {
+        GtkInstanceComboBox* pThis = static_cast<GtkInstanceComboBox*>(widget);
+        pThis->signal_combo_mnemonic_activate();
+        return true;
+    }
+
 public:
     GtkInstanceComboBox(GtkBuilder* pComboBuilder, GtkComboBox* pComboBox, GtkInstanceBuilder* pBuilder, bool bTakeOwnership)
         : GtkInstanceContainer(GTK_CONTAINER(gtk_builder_get_object(pComboBuilder, "box")), pBuilder, bTakeOwnership)
@@ -14297,6 +14323,8 @@ public:
         if (nActive != -1)
             tree_view_set_cursor(nActive);
 
+        g_signal_connect(getContainer(), "mnemonic-activate", G_CALLBACK(signalComboMnemonicActivate), this);
+
         g_signal_connect(m_pMenuWindow, "grab-broken-event", G_CALLBACK(signalGrabBroken), this);
         g_signal_connect(m_pMenuWindow, "button-press-event", G_CALLBACK(signalButtonPress), this);
         g_signal_connect(m_pMenuWindow, "motion-notify-event", G_CALLBACK(signalMotion), this);


More information about the Libreoffice-commits mailing list