[mutter] wayland: Check serial on wp_tablet_pad.set_feedback
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland: Check serial on wp_tablet_pad.set_feedback
- Date: Fri, 22 Jul 2016 12:03:28 +0000 (UTC)
commit b34fe72bb7b536f314803a7612e5f6218aeb8e61
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Jun 29 18:31:24 2016 +0200
wayland: Check serial on wp_tablet_pad.set_feedback
We must lookup the mode switch serial for the group where the button
belongs to. Also, avoid the changes if the client requests setting
the feedback for buttons owned by the compositor.
src/wayland/meta-wayland-tablet-pad.c | 31 ++++++++++++++++++++++++++++++-
1 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/src/wayland/meta-wayland-tablet-pad.c b/src/wayland/meta-wayland-tablet-pad.c
index 6f55729..9995692 100644
--- a/src/wayland/meta-wayland-tablet-pad.c
+++ b/src/wayland/meta-wayland-tablet-pad.c
@@ -217,6 +217,23 @@ meta_wayland_tablet_pad_free (MetaWaylandTabletPad *pad)
g_slice_free (MetaWaylandTabletPad, pad);
}
+static MetaWaylandTabletPadGroup *
+tablet_pad_lookup_button_group (MetaWaylandTabletPad *pad,
+ guint button)
+{
+ GList *l;
+
+ for (l = pad->groups; l; l = l->next)
+ {
+ MetaWaylandTabletPadGroup *group = l->data;
+
+ if (meta_wayland_tablet_pad_group_has_button (group, button))
+ return group;
+ }
+
+ return NULL;
+}
+
static void
tablet_pad_set_feedback (struct wl_client *client,
struct wl_resource *resource,
@@ -225,8 +242,20 @@ tablet_pad_set_feedback (struct wl_client *client,
uint32_t serial)
{
MetaWaylandTabletPad *pad = wl_resource_get_user_data (resource);
+ MetaWaylandTabletPadGroup *group = tablet_pad_lookup_button_group (pad, button);
+ MetaInputSettings *input_settings;
+
+ if (!group || group->mode_switch_serial != serial)
+ return;
+
+ input_settings = meta_backend_get_input_settings (meta_get_backend ());
- /* FIXME: check serial */
+ if (input_settings &&
+ meta_input_settings_is_pad_button_grabbed (input_settings, pad->device, button))
+ return;
+
+ if (meta_wayland_tablet_pad_group_is_mode_switch_button (group, button))
+ return;
g_hash_table_insert (pad->feedback, GUINT_TO_POINTER (button), g_strdup (str));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]