[mutter/bilelmoussaoui/gdk-x11-only: 3/4] core: Replace gtk_accelerator_parse usage




commit 86a3ac75724597167b07cfc2aa1738cd2280062d
Author: Bilal Elmoussaoui <belmouss redhat com>
Date:   Mon May 9 11:38:06 2022 +0200

    core: Replace gtk_accelerator_parse usage

 src/core/meta-pad-action-mapper.c | 14 +++++++++-----
 src/core/util.c                   |  2 +-
 2 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/core/meta-pad-action-mapper.c b/src/core/meta-pad-action-mapper.c
index dc43924b55..7c92a7185a 100644
--- a/src/core/meta-pad-action-mapper.c
+++ b/src/core/meta-pad-action-mapper.c
@@ -480,13 +480,17 @@ meta_pad_action_mapper_emulate_keybinding (MetaPadActionMapper *mapper,
                                            gboolean             is_press)
 {
   ClutterKeyState state;
-  guint key, mods;
+  MetaKeyCombo combo = { 0 };
 
   if (!accel || !*accel)
     return;
 
   /* FIXME: This is appalling */
-  gtk_accelerator_parse (accel, &key, &mods);
+  if (!meta_parse_accelerator (accel, &combo)) 
+    {
+      g_warning ("\"%s\" is not a valid accelerator", accel);
+      return;
+    }
 
   if (!mapper->virtual_pad_keyboard)
     {
@@ -504,13 +508,13 @@ meta_pad_action_mapper_emulate_keybinding (MetaPadActionMapper *mapper,
   state = is_press ? CLUTTER_KEY_STATE_PRESSED : CLUTTER_KEY_STATE_RELEASED;
 
   if (is_press)
-    emulate_modifiers (mapper->virtual_pad_keyboard, mods, state);
+    emulate_modifiers (mapper->virtual_pad_keyboard, combo.modifiers, state);
 
   clutter_virtual_input_device_notify_keyval (mapper->virtual_pad_keyboard,
                                               clutter_get_current_event_time (),
-                                              key, state);
+                                              combo.keysym, state);
   if (!is_press)
-    emulate_modifiers (mapper->virtual_pad_keyboard, mods, state);
+    emulate_modifiers (mapper->virtual_pad_keyboard, combo.modifiers, state);
 }
 
 static gboolean
diff --git a/src/core/util.c b/src/core/util.c
index 1eaaefa82e..40abf5d9a7 100644
--- a/src/core/util.c
+++ b/src/core/util.c
@@ -510,7 +510,7 @@ meta_get_locale_direction (void)
    * Do *not* translate it to "predefinito:LTR", if it
    * it isn't default:LTR or default:RTL it will not work
    */
-  char                *e   = _("default:LTR");
+  char *e = _("default:LTR");
   MetaLocaleDirection  dir = META_LOCALE_DIRECTION_LTR;
 
   if (g_strcmp0 (e, "default:RTL") == 0)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]