[mutter/wip/carlosg/pad-ring-strip-action-labels: 3/3] core: Mark both directions in rings/strips as (un)handled altogether
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/pad-ring-strip-action-labels: 3/3] core: Mark both directions in rings/strips as (un)handled altogether
- Date: Thu, 16 Sep 2021 11:33:00 +0000 (UTC)
commit c5f960be623e3692852a170932e91b01f6df6378
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Jul 16 13:10:48 2021 +0200
core: Mark both directions in rings/strips as (un)handled altogether
If going on a direction has a keycombo associated and the other does
not, it does not make sense to let the wayland bits handle pad
ring/strip events that only go in one direction.
Ensure that's the case, and also while figuring out the ring/strip
direction based on the initial events.
Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1889
src/core/meta-pad-action-mapper.c | 55 ++++++++++++++++++++++++++++-----------
1 file changed, 40 insertions(+), 15 deletions(-)
---
diff --git a/src/core/meta-pad-action-mapper.c b/src/core/meta-pad-action-mapper.c
index e93b592532..e94507eb38 100644
--- a/src/core/meta-pad-action-mapper.c
+++ b/src/core/meta-pad-action-mapper.c
@@ -640,27 +640,52 @@ meta_pad_action_mapper_handle_action (MetaPadActionMapper *mapper,
guint number,
guint mode)
{
- MetaPadDirection direction = = META_PAD_DIRECTION_NONE;
- GSettings *settings;
- gboolean handled = FALSE;
- char *accel;
+ MetaPadDirection direction = META_PAD_DIRECTION_NONE;
+ GSettings *settings1, *settings2;
+ gboolean handled;
+ char *accel1, *accel2;
- if (!meta_pad_action_mapper_get_action_direction (mapper,
- event, &direction))
- return FALSE;
+ if (action == META_PAD_ACTION_RING)
+ {
+ settings1 = lookup_pad_action_settings (pad, action, number, META_PAD_DIRECTION_CW, mode);
+ settings2 = lookup_pad_action_settings (pad, action, number, META_PAD_DIRECTION_CCW, mode);
+ }
+ else if (action == META_PAD_ACTION_STRIP)
+ {
+ settings1 = lookup_pad_action_settings (pad, action, number, META_PAD_DIRECTION_UP, mode);
+ settings2 = lookup_pad_action_settings (pad, action, number, META_PAD_DIRECTION_DOWN, mode);
+ }
+ else
+ {
+ return FALSE;
+ }
- settings = lookup_pad_action_settings (pad, action, number, direction, mode);
- accel = g_settings_get_string (settings, "keybinding");
+ accel1 = g_settings_get_string (settings1, "keybinding");
+ accel2 = g_settings_get_string (settings2, "keybinding");
+ handled = ((accel1 && *accel1) || (accel2 && *accel2));
- if (accel && *accel)
+ if (meta_pad_action_mapper_get_action_direction (mapper, event, &direction))
{
- meta_pad_action_mapper_emulate_keybinding (mapper, accel, TRUE);
- meta_pad_action_mapper_emulate_keybinding (mapper, accel, FALSE);
- handled = TRUE;
+ const gchar *accel;
+
+ if (direction == META_PAD_DIRECTION_UP ||
+ direction == META_PAD_DIRECTION_CW)
+ accel = accel1;
+ else if (direction == META_PAD_DIRECTION_DOWN ||
+ direction == META_PAD_DIRECTION_CCW)
+ accel = accel2;
+
+ if (accel && *accel)
+ {
+ meta_pad_action_mapper_emulate_keybinding (mapper, accel, TRUE);
+ meta_pad_action_mapper_emulate_keybinding (mapper, accel, FALSE);
+ }
}
- g_object_unref (settings);
- g_free (accel);
+ g_object_unref (settings1);
+ g_object_unref (settings2);
+ g_free (accel1);
+ g_free (accel2);
return handled;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]