diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2016-06-29 18:39:31 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2016-07-20 19:27:24 +0200 |
commit | ec5d127cd2efffe5e0194b9a354d635d9954c37a (patch) | |
tree | 71cbafff43cc698ba82e28c530c75561763ac685 /src/wayland/meta-wayland-tablet-pad-group.c | |
parent | 1c1785ea6e00e89f2b47392bae8f7536ebeb7f30 (diff) | |
download | mutter-wip/tablet-protocol-v2.tar.gz |
wayland: Emit wp_tablet_pad_group.buttons after focus changeswip/tablet-protocol-v2
The buttons grabbed by the compositor might have changed in between,
so just broadcast the button array again.
Diffstat (limited to 'src/wayland/meta-wayland-tablet-pad-group.c')
-rw-r--r-- | src/wayland/meta-wayland-tablet-pad-group.c | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/src/wayland/meta-wayland-tablet-pad-group.c b/src/wayland/meta-wayland-tablet-pad-group.c index f97c44774..e224ac2ce 100644 --- a/src/wayland/meta-wayland-tablet-pad-group.c +++ b/src/wayland/meta-wayland-tablet-pad-group.c @@ -190,18 +190,15 @@ meta_wayland_tablet_pad_group_has_button (MetaWaylandTabletPadGroup *group, } } -void -meta_wayland_tablet_pad_group_notify (MetaWaylandTabletPadGroup *group, - struct wl_resource *resource) +static void +meta_wayland_tablet_pad_group_send_buttons (MetaWaylandTabletPadGroup *group, + struct wl_resource *resource) { - struct wl_client *client = wl_resource_get_client (resource); struct wl_array buttons; - guint i, n_modes; - GList *l; + guint i; wl_array_init (&buttons); - /* Buttons */ for (i = 0; i < group->pad->n_buttons; i++) { uint32_t *pos; @@ -215,6 +212,21 @@ meta_wayland_tablet_pad_group_notify (MetaWaylandTabletPadGroup *group, zwp_tablet_pad_group_v2_send_buttons (resource, &buttons); wl_array_release (&buttons); +} + +void +meta_wayland_tablet_pad_group_notify (MetaWaylandTabletPadGroup *group, + struct wl_resource *resource) +{ + struct wl_client *client = wl_resource_get_client (resource); + struct wl_array buttons; + guint n_modes; + GList *l; + + wl_array_init (&buttons); + + /* Buttons */ + meta_wayland_tablet_pad_group_send_buttons (group, resource); /* Rings */ for (l = group->rings; l; l = l->next) @@ -315,6 +327,18 @@ broadcast_group_mode (MetaWaylandTabletPadGroup *group, } } +static void +broadcast_group_buttons (MetaWaylandTabletPadGroup *group) +{ + struct wl_list *l = &group->focus_resource_list; + struct wl_resource *resource; + + wl_resource_for_each (resource, l) + { + meta_wayland_tablet_pad_group_send_buttons (group, resource); + } +} + gboolean meta_wayland_tablet_pad_group_handle_event (MetaWaylandTabletPadGroup *group, const ClutterEvent *event) @@ -406,6 +430,7 @@ meta_wayland_tablet_pad_group_sync_focus (MetaWaylandTabletPadGroup *group) meta_wayland_tablet_pad_group_update_strips_focus (group); broadcast_group_mode (group, clutter_get_current_event_time ()); + broadcast_group_buttons (group); } gboolean |