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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Nov 23 11:34:23 UTC 2018


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

New commits:
commit 3760cfe1cb146bf99077579a5d3939a6b668a7d4
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Nov 12 13:31:13 2018 +0000
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Fri Nov 23 12:33:49 2018 +0100

    honor getNumDecimalSep for keypad input in native gtk3 dialogs
    
    Change-Id: Ibbd37f18ee97eb6ded0ab90cd70b777ffd20f91d
    Reviewed-on: https://gerrit.libreoffice.org/63292
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index ee3dc615243a..e5b1cdf4f1d6 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1182,6 +1182,7 @@ private:
     bool m_bTakeOwnership;
     gulong m_nFocusInSignalId;
     gulong m_nFocusOutSignalId;
+    gulong m_nKeyPressSignalId;
 
     static void signalFocusIn(GtkWidget*, GdkEvent*, gpointer widget)
     {
@@ -1197,6 +1198,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 && Application::GetSettings().GetMiscSettings().GetEnableLocalizedDecimalSep())
+        {
+            OUString aSep(Application::GetSettings().GetLocaleDataWrapper().getNumDecimalSep());
+            pEvent->keyval = aSep[0];
+        }
+        return false;
+    }
+
 public:
     GtkInstanceWidget(GtkWidget* pWidget, bool bTakeOwnership)
         : m_pWidget(pWidget)
@@ -1204,6 +1216,11 @@ public:
         , m_nFocusInSignalId(0)
         , m_nFocusOutSignalId(0)
     {
+        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
@@ -1474,6 +1491,8 @@ public:
 
     virtual ~GtkInstanceWidget() override
     {
+        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