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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sat May 29 18:48:42 UTC 2021


 vcl/unx/gtk3/gtkinst.cxx |   17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

New commits:
commit 782b189045b571c841d7124a8d753797a108a6f5
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat May 29 16:36:38 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat May 29 20:48:04 2021 +0200

    gtk[3|4] make LocalizeDecimalSeparator take just a keyval as arg
    
    Change-Id: Id37a275d56fdbcc0f18f6a322810966f4269f501
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116392
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 653a2e0073d8..951468d66c20 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -2180,23 +2180,22 @@ GtkWindow* get_active_window()
     return pFocus;
 }
 
-#if !GTK_CHECK_VERSION(4, 0, 0)
-void LocalizeDecimalSeparator(GdkEventKey* pEvent)
+void LocalizeDecimalSeparator(guint& keyval)
 {
     // #i1820# use locale specific decimal separator
-    if (pEvent->keyval == GDK_KEY_KP_Decimal && Application::GetSettings().GetMiscSettings().GetEnableLocalizedDecimalSep())
+    if (keyval == GDK_KEY_KP_Decimal && Application::GetSettings().GetMiscSettings().GetEnableLocalizedDecimalSep())
     {
         GtkWindow* pFocusWin = get_active_window();
         GtkWidget* pFocus = pFocusWin ? gtk_window_get_focus(pFocusWin) : nullptr;
         // tdf#138932 except if the target is a GtkEntry used for passwords
+        // GTK4: TODO is it a GtkEntry or a child GtkText that has the focus in this situation?
         if (!pFocus || !GTK_IS_ENTRY(pFocus) || gtk_entry_get_visibility(GTK_ENTRY(pFocus)))
         {
             OUString aSep(Application::GetSettings().GetLocaleDataWrapper().getNumDecimalSep());
-            pEvent->keyval = aSep[0];
+            keyval = aSep[0];
         }
     }
 }
-#endif
 
 void set_cursor(GtkWidget* pWidget, const char *pName)
 {
@@ -2482,7 +2481,7 @@ private:
 #if !GTK_CHECK_VERSION(4, 0, 0)
     static gboolean signalKey(GtkWidget*, GdkEventKey* pEvent, gpointer widget)
     {
-        LocalizeDecimalSeparator(pEvent);
+        LocalizeDecimalSeparator(pEvent->keyval);
         GtkInstanceWidget* pThis = static_cast<GtkInstanceWidget*>(widget);
         return pThis->signal_key(pEvent);
     }
@@ -16672,9 +16671,7 @@ private:
     static gboolean signalEntryKeyPress(GtkEventControllerKey*, guint keyval, guint keycode, GdkModifierType state, gpointer widget)
     {
         GtkInstanceComboBox* pThis = static_cast<GtkInstanceComboBox*>(widget);
-#if 0
-        LocalizeDecimalSeparator(pEvent);
-#endif
+        LocalizeDecimalSeparator(keyval);
         return pThis->signal_entry_key_press(CreateKeyEvent(keyval, keycode, state, 0));
     }
 
@@ -18401,7 +18398,7 @@ private:
     static gboolean signalEntryKeyPress(GtkWidget*, GdkEventKey* pEvent, gpointer widget)
     {
         GtkInstanceComboBox* pThis = static_cast<GtkInstanceComboBox*>(widget);
-        LocalizeDecimalSeparator(pEvent);
+        LocalizeDecimalSeparator(pEvent->keyval);
         return pThis->signal_entry_key_press(pEvent);
     }
 


More information about the Libreoffice-commits mailing list