mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
wayland: Wire up pad device event management
The tablet manager will now lookup the correct MetaWaylandTabletSeat, and forward the events through it.
This commit is contained in:
parent
b8808ca24d
commit
fd62a1f6ce
@ -54,7 +54,8 @@ is_tablet_device (ClutterInputDevice *device)
|
||||
return (device_type == CLUTTER_TABLET_DEVICE ||
|
||||
device_type == CLUTTER_PEN_DEVICE ||
|
||||
device_type == CLUTTER_ERASER_DEVICE ||
|
||||
device_type == CLUTTER_CURSOR_DEVICE);
|
||||
device_type == CLUTTER_CURSOR_DEVICE ||
|
||||
device_type == CLUTTER_PAD_DEVICE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -155,7 +156,8 @@ meta_wayland_tablet_manager_lookup_seat (MetaWaylandTabletManager *manager,
|
||||
|
||||
while (g_hash_table_iter_next (&iter, (gpointer*) &seat, (gpointer*) &tablet_seat))
|
||||
{
|
||||
if (meta_wayland_tablet_seat_lookup_tablet (tablet_seat, device))
|
||||
if (meta_wayland_tablet_seat_lookup_tablet (tablet_seat, device) ||
|
||||
meta_wayland_tablet_seat_lookup_pad (tablet_seat, device))
|
||||
return tablet_seat;
|
||||
}
|
||||
|
||||
@ -190,6 +192,10 @@ meta_wayland_tablet_manager_update (MetaWaylandTabletManager *manager,
|
||||
case CLUTTER_BUTTON_PRESS:
|
||||
case CLUTTER_BUTTON_RELEASE:
|
||||
case CLUTTER_MOTION:
|
||||
case CLUTTER_PAD_BUTTON_PRESS:
|
||||
case CLUTTER_PAD_BUTTON_RELEASE:
|
||||
case CLUTTER_PAD_RING:
|
||||
case CLUTTER_PAD_STRIP:
|
||||
meta_wayland_tablet_seat_update (tablet_seat, event);
|
||||
break;
|
||||
default:
|
||||
@ -216,6 +222,10 @@ meta_wayland_tablet_manager_handle_event (MetaWaylandTabletManager *manager,
|
||||
case CLUTTER_BUTTON_PRESS:
|
||||
case CLUTTER_BUTTON_RELEASE:
|
||||
case CLUTTER_MOTION:
|
||||
case CLUTTER_PAD_BUTTON_PRESS:
|
||||
case CLUTTER_PAD_BUTTON_RELEASE:
|
||||
case CLUTTER_PAD_RING:
|
||||
case CLUTTER_PAD_STRIP:
|
||||
return meta_wayland_tablet_seat_handle_event (tablet_seat, event);
|
||||
default:
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
|
@ -331,6 +331,13 @@ meta_wayland_tablet_seat_lookup_tool (MetaWaylandTabletSeat *tablet_seat,
|
||||
return g_hash_table_lookup (tablet_seat->tools, tool);
|
||||
}
|
||||
|
||||
MetaWaylandTabletPad *
|
||||
meta_wayland_tablet_seat_lookup_pad (MetaWaylandTabletSeat *tablet_seat,
|
||||
ClutterInputDevice *device)
|
||||
{
|
||||
return g_hash_table_lookup (tablet_seat->pads, device);
|
||||
}
|
||||
|
||||
static MetaWaylandTabletTool *
|
||||
meta_wayland_tablet_seat_ensure_tool (MetaWaylandTabletSeat *tablet_seat,
|
||||
ClutterInputDevice *device,
|
||||
@ -386,14 +393,7 @@ meta_wayland_tablet_seat_handle_event (MetaWaylandTabletSeat *tablet_seat,
|
||||
{
|
||||
ClutterInputDeviceTool *device_tool;
|
||||
MetaWaylandTabletTool *tool = NULL;
|
||||
|
||||
device_tool = clutter_event_get_device_tool (event);
|
||||
|
||||
if (device_tool)
|
||||
tool = g_hash_table_lookup (tablet_seat->tools, device_tool);
|
||||
|
||||
if (!tool)
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
MetaWaylandTabletPad *pad = NULL;
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
@ -402,8 +402,26 @@ meta_wayland_tablet_seat_handle_event (MetaWaylandTabletSeat *tablet_seat,
|
||||
case CLUTTER_BUTTON_PRESS:
|
||||
case CLUTTER_BUTTON_RELEASE:
|
||||
case CLUTTER_MOTION:
|
||||
device_tool = clutter_event_get_device_tool (event);
|
||||
|
||||
if (device_tool)
|
||||
tool = g_hash_table_lookup (tablet_seat->tools, device_tool);
|
||||
|
||||
if (!tool)
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
|
||||
meta_wayland_tablet_tool_handle_event (tool, event);
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
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,
|
||||
clutter_event_get_source_device (event));
|
||||
if (!pad)
|
||||
return CLUTTER_EVENT_PROPAGATE;
|
||||
|
||||
return meta_wayland_tablet_pad_handle_event (pad, event);
|
||||
default:
|
||||
return CLUTTER_EVENT_STOP;
|
||||
}
|
||||
|
@ -55,6 +55,9 @@ MetaWaylandTablet *meta_wayland_tablet_seat_lookup_tablet (MetaWayland
|
||||
MetaWaylandTabletTool *meta_wayland_tablet_seat_lookup_tool (MetaWaylandTabletSeat *tablet_seat,
|
||||
ClutterInputDeviceTool *tool);
|
||||
|
||||
MetaWaylandTabletPad *meta_wayland_tablet_seat_lookup_pad (MetaWaylandTabletSeat *tablet_seat,
|
||||
ClutterInputDevice *device);
|
||||
|
||||
void meta_wayland_tablet_seat_update (MetaWaylandTabletSeat *tablet_seat,
|
||||
const ClutterEvent *event);
|
||||
gboolean meta_wayland_tablet_seat_handle_event (MetaWaylandTabletSeat *tablet_seat,
|
||||
|
Loading…
Reference in New Issue
Block a user