wayland: Emit wp_tablet_pad_group.buttons after focus changes

The buttons grabbed by the compositor might have changed in between,
so just broadcast the button array again.
This commit is contained in:
Carlos Garnacho 2016-06-29 18:39:31 +02:00
parent b34fe72bb7
commit c6beb1cfc5

View File

@ -191,18 +191,15 @@ meta_wayland_tablet_pad_group_has_button (MetaWaylandTabletPadGroup *group,
} }
} }
void static void
meta_wayland_tablet_pad_group_notify (MetaWaylandTabletPadGroup *group, meta_wayland_tablet_pad_group_send_buttons (MetaWaylandTabletPadGroup *group,
struct wl_resource *resource) struct wl_resource *resource)
{ {
struct wl_client *client = wl_resource_get_client (resource);
struct wl_array buttons; struct wl_array buttons;
guint i, n_modes; guint i;
GList *l;
wl_array_init (&buttons); wl_array_init (&buttons);
/* Buttons */
for (i = 0; i < group->pad->n_buttons; i++) for (i = 0; i < group->pad->n_buttons; i++)
{ {
uint32_t *pos; uint32_t *pos;
@ -216,6 +213,21 @@ meta_wayland_tablet_pad_group_notify (MetaWaylandTabletPadGroup *group,
zwp_tablet_pad_group_v2_send_buttons (resource, &buttons); zwp_tablet_pad_group_v2_send_buttons (resource, &buttons);
wl_array_release (&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 */ /* Rings */
for (l = group->rings; l; l = l->next) for (l = group->rings; l; l = l->next)
@ -315,6 +327,17 @@ broadcast_group_mode (MetaWaylandTabletPadGroup *group,
} }
} }
static void
broadcast_group_buttons (MetaWaylandTabletPadGroup *group)
{
struct wl_resource *resource;
wl_resource_for_each (resource, &group->focus_resource_list)
{
meta_wayland_tablet_pad_group_send_buttons (group, resource);
}
}
gboolean gboolean
meta_wayland_tablet_pad_group_handle_event (MetaWaylandTabletPadGroup *group, meta_wayland_tablet_pad_group_handle_event (MetaWaylandTabletPadGroup *group,
const ClutterEvent *event) const ClutterEvent *event)
@ -406,6 +429,7 @@ meta_wayland_tablet_pad_group_sync_focus (MetaWaylandTabletPadGroup *group)
if (!wl_list_empty (&group->focus_resource_list)) if (!wl_list_empty (&group->focus_resource_list))
{ {
broadcast_group_mode (group, clutter_get_current_event_time ()); broadcast_group_mode (group, clutter_get_current_event_time ());
broadcast_group_buttons (group);
} }
} }