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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Nov 12 16:29:46 UTC 2018


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

New commits:
commit 7eb71f84db2f2d9a6e79a42d25bb676cf1018a90
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Nov 12 13:31:13 2018 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Nov 12 17:29:24 2018 +0100

    honor getNumDecimalSep for keypad input in native gtk3 dialogs
    
    Change-Id: Ibbd37f18ee97eb6ded0ab90cd70b777ffd20f91d
    Reviewed-on: https://gerrit.libreoffice.org/63291
    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 3c3e5d25588f..86a6f4882a94 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1187,6 +1187,7 @@ private:
     bool m_bFrozen;
     gulong m_nFocusInSignalId;
     gulong m_nFocusOutSignalId;
+    gulong m_nKeyPressSignalId;
 
     static void signalFocusIn(GtkWidget*, GdkEvent*, gpointer widget)
     {
@@ -1202,6 +1203,17 @@ private:
         pThis->signal_focus_out();
     }
 
+    static gboolean signalKeyPress(GtkWidget*, GdkEventKey* pEvent, gpointer)
+    {
+        // #i1820# use locale specific decimal separator
+        if (pEvent->keyval == GDK_KEY_KP_Decimal)
+        {
+            OUString aSep(Application::GetSettings().GetLocaleDataWrapper().getNumDecimalSep());
+            pEvent->keyval = aSep[0];
+        }
+        return false;
+    }
+
 public:
     GtkInstanceWidget(GtkWidget* pWidget, bool bTakeOwnership)
         : m_pWidget(pWidget)
@@ -1209,6 +1221,7 @@ public:
         , m_bFrozen(false)
         , m_nFocusInSignalId(0)
         , m_nFocusOutSignalId(0)
+        , m_nKeyPressSignalId(g_signal_connect(pWidget, "key-press-event", G_CALLBACK(signalKeyPress), this))
     {
     }
 
@@ -1509,6 +1522,7 @@ public:
 
     virtual ~GtkInstanceWidget() override
     {
+        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