[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Dec 15 16:30:06 UTC 2020
vcl/unx/gtk3/gtk3gtkinst.cxx | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
New commits:
commit b163f838c79118809d880c76f943fdd2fc0288ed
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Dec 15 13:10:02 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Dec 15 17:29:27 2020 +0100
use locale specific decimal separator in GtkComboBoxText replacement too
Change-Id: I384362443baa386507935a76142f70ebf092d72f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107767
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 6abc74d4f9ed..cbbbe12a05a2 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1922,6 +1922,21 @@ GtkWindow* get_focus_window()
return pFocus;
}
+void LocalizeDecimalSeparator(GdkEventKey* pEvent)
+{
+ // #i1820# use locale specific decimal separator
+ if (pEvent->keyval == GDK_KEY_KP_Decimal && Application::GetSettings().GetMiscSettings().GetEnableLocalizedDecimalSep())
+ {
+ GtkWindow* pFocusWin = get_focus_window();
+ GtkWidget* pFocus = pFocusWin ? gtk_window_get_focus(pFocusWin) : nullptr;
+ // tdf#138932 except if the target is a GtkEntry used for passwords
+ if (!pFocus || !GTK_IS_ENTRY(pFocus) || gtk_entry_get_visibility(GTK_ENTRY(pFocus)))
+ {
+ OUString aSep(Application::GetSettings().GetLocaleDataWrapper().getNumDecimalSep());
+ pEvent->keyval = aSep[0];
+ }
+ }
+}
class GtkInstanceWidget : public virtual weld::Widget
{
@@ -2114,19 +2129,7 @@ private:
static gboolean signalKey(GtkWidget*, GdkEventKey* pEvent, gpointer widget)
{
- // #i1820# use locale specific decimal separator
- if (pEvent->keyval == GDK_KEY_KP_Decimal && Application::GetSettings().GetMiscSettings().GetEnableLocalizedDecimalSep())
- {
- GtkWindow* pFocusWin = get_focus_window();
- GtkWidget* pFocus = pFocusWin ? gtk_window_get_focus(pFocusWin) : nullptr;
- // tdf#138932 except if the target is a GtkEntry used for passwords
- if (!pFocus || !GTK_IS_ENTRY(pFocus) || gtk_entry_get_visibility(GTK_ENTRY(pFocus)))
- {
- OUString aSep(Application::GetSettings().GetLocaleDataWrapper().getNumDecimalSep());
- pEvent->keyval = aSep[0];
- }
- }
-
+ LocalizeDecimalSeparator(pEvent);
GtkInstanceWidget* pThis = static_cast<GtkInstanceWidget*>(widget);
return pThis->signal_key(pEvent);
}
@@ -14605,6 +14608,7 @@ private:
static gboolean signalEntryKeyPress(GtkWidget*, GdkEventKey* pEvent, gpointer widget)
{
GtkInstanceComboBox* pThis = static_cast<GtkInstanceComboBox*>(widget);
+ LocalizeDecimalSeparator(pEvent);
return pThis->signal_entry_key_press(pEvent);
}
More information about the Libreoffice-commits
mailing list