wayland: Add update() phase to MetaWaylandTabletPad

This will be needed to update internal state of pad groups.
This commit is contained in:
Carlos Garnacho 2016-06-22 18:40:23 +02:00
parent 499851d404
commit b68247d51e
3 changed files with 44 additions and 7 deletions

View File

@ -368,3 +368,27 @@ meta_wayland_tablet_pad_set_focus (MetaWaylandTabletPad *pad,
meta_wayland_tablet_pad_update_groups_focus (pad); meta_wayland_tablet_pad_update_groups_focus (pad);
} }
void
meta_wayland_tablet_pad_update (MetaWaylandTabletPad *pad,
const ClutterEvent *event)
{
MetaWaylandTabletPadGroup *group;
guint n_group;
n_group = clutter_event_get_mode_group (event);
group = g_list_nth_data (pad->groups, n_group);
if (group)
meta_wayland_tablet_pad_group_update (group, event);
switch (event->type)
{
case CLUTTER_PAD_BUTTON_PRESS:
case CLUTTER_PAD_BUTTON_RELEASE:
case CLUTTER_PAD_RING:
case CLUTTER_PAD_STRIP:
default:
break;
}
}

View File

@ -65,6 +65,8 @@ struct wl_resource *
void meta_wayland_tablet_pad_notify (MetaWaylandTabletPad *pad, void meta_wayland_tablet_pad_notify (MetaWaylandTabletPad *pad,
struct wl_resource *resource); struct wl_resource *resource);
void meta_wayland_tablet_pad_update (MetaWaylandTabletPad *pad,
const ClutterEvent *event);
gboolean meta_wayland_tablet_pad_handle_event (MetaWaylandTabletPad *pad, gboolean meta_wayland_tablet_pad_handle_event (MetaWaylandTabletPad *pad,
const ClutterEvent *event); const ClutterEvent *event);

View File

@ -386,15 +386,9 @@ meta_wayland_tablet_seat_update (MetaWaylandTabletSeat *tablet_seat,
ClutterInputDevice *device; ClutterInputDevice *device;
ClutterInputDeviceTool *device_tool; ClutterInputDeviceTool *device_tool;
MetaWaylandTabletTool *tool = NULL; MetaWaylandTabletTool *tool = NULL;
MetaWaylandTabletPad *pad = NULL;
device = clutter_event_get_source_device (event); device = clutter_event_get_source_device (event);
device_tool = clutter_event_get_device_tool (event);
if (device && device_tool)
tool = meta_wayland_tablet_seat_ensure_tool (tablet_seat, device, device_tool);
if (!tool)
return;
switch (event->type) switch (event->type)
{ {
@ -403,8 +397,25 @@ meta_wayland_tablet_seat_update (MetaWaylandTabletSeat *tablet_seat,
case CLUTTER_BUTTON_PRESS: case CLUTTER_BUTTON_PRESS:
case CLUTTER_BUTTON_RELEASE: case CLUTTER_BUTTON_RELEASE:
case CLUTTER_MOTION: case CLUTTER_MOTION:
device_tool = clutter_event_get_device_tool (event);
if (device && device_tool)
tool = meta_wayland_tablet_seat_ensure_tool (tablet_seat, device, device_tool);
if (!tool)
return;
meta_wayland_tablet_tool_update (tool, event); meta_wayland_tablet_tool_update (tool, event);
break; break;
case CLUTTER_PAD_BUTTON_PRESS:
case CLUTTER_PAD_BUTTON_RELEASE:
case CLUTTER_PAD_RING:
case CLUTTER_PAD_STRIP:
pad = g_hash_table_lookup (tablet_seat->pads, device);
if (!pad)
return;
return meta_wayland_tablet_pad_update (pad, event);
default: default:
break; break;
} }