summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-11-12 13:31:13 +0000
committerEike Rathke <erack@redhat.com>2018-11-23 12:33:49 +0100
commit3760cfe1cb146bf99077579a5d3939a6b668a7d4 (patch)
tree39da3fdfc38cd5dd0d9596e1632e7ab7f13198d2
parentb3af23568f9b9b444ae09f2a1ab4a61d212b422a (diff)
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@redhat.com>
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx19
1 files changed, 19 insertions, 0 deletions
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)