[mutter/bilelmoussaoui/gdk-x11-only: 436/442] core: Replace gtk_accelerator_parse usage
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/bilelmoussaoui/gdk-x11-only: 436/442] core: Replace gtk_accelerator_parse usage
- Date: Thu, 22 Sep 2022 16:04:11 +0000 (UTC)
commit daf5486c9f8e89ee2d5fc1d45d1271924a4ef56a
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 | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/src/core/meta-pad-action-mapper.c b/src/core/meta-pad-action-mapper.c
index 1a9408e6e4..1e31c60386 100644
--- a/src/core/meta-pad-action-mapper.c
+++ b/src/core/meta-pad-action-mapper.c
@@ -456,17 +456,17 @@ meta_pad_action_mapper_is_button_grabbed (MetaPadActionMapper *mapper,
static void
emulate_modifiers (ClutterVirtualInputDevice *device,
- ClutterModifierType mods,
+ MetaVirtualModifier mods,
ClutterKeyState state)
{
guint i;
struct {
- ClutterModifierType mod;
+ MetaVirtualModifier mod;
guint keyval;
} mod_map[] = {
- { CLUTTER_SHIFT_MASK, CLUTTER_KEY_Shift_L },
- { CLUTTER_CONTROL_MASK, CLUTTER_KEY_Control_L },
- { CLUTTER_MOD1_MASK, CLUTTER_KEY_Meta_L }
+ { META_VIRTUAL_SHIFT_MASK, CLUTTER_KEY_Shift_L },
+ { META_VIRTUAL_CONTROL_MASK, CLUTTER_KEY_Control_L },
+ { META_VIRTUAL_META_MASK, CLUTTER_KEY_Meta_L }
};
for (i = 0; i < G_N_ELEMENTS (mod_map); i++)
@@ -486,13 +486,16 @@ 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)
{
@@ -510,13 +513,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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]