summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-11-12 13:31:13 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-11-12 17:29:24 +0100
commit7eb71f84db2f2d9a6e79a42d25bb676cf1018a90 (patch)
treed889b3460402badb036c654cec4c166d9be5d2a6
parentc846e85f03b635c88e043166a352a42eeae39304 (diff)
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@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx14
1 files changed, 14 insertions, 0 deletions
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)