[mutter/wip/tablet-protocol-v2: 25/65] wayland: Wire up pad device event management
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/tablet-protocol-v2: 25/65] wayland: Wire up pad device event management
- Date: Wed, 29 Jun 2016 12:22:26 +0000 (UTC)
commit 1095f615395dbd8208ac402f0989c3d3f8794d53
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue May 10 17:28:29 2016 +0200
wayland: Wire up pad device event management
The tablet manager will now lookup the correct MetaWaylandTabletSeat,
and forward the events through it.
src/wayland/meta-wayland-tablet-manager.c | 14 ++++++++++-
src/wayland/meta-wayland-tablet-seat.c | 34 ++++++++++++++++++++++------
src/wayland/meta-wayland-tablet-seat.h | 3 ++
3 files changed, 41 insertions(+), 10 deletions(-)
---
diff --git a/src/wayland/meta-wayland-tablet-manager.c b/src/wayland/meta-wayland-tablet-manager.c
index 5e5faf0..fa1b906 100644
--- a/src/wayland/meta-wayland-tablet-manager.c
+++ b/src/wayland/meta-wayland-tablet-manager.c
@@ -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;
diff --git a/src/wayland/meta-wayland-tablet-seat.c b/src/wayland/meta-wayland-tablet-seat.c
index e73ec99..6a0e564 100644
--- a/src/wayland/meta-wayland-tablet-seat.c
+++ b/src/wayland/meta-wayland-tablet-seat.c
@@ -330,6 +330,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,
@@ -385,14 +392,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)
{
@@ -401,8 +401,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;
}
diff --git a/src/wayland/meta-wayland-tablet-seat.h b/src/wayland/meta-wayland-tablet-seat.h
index 6dac9b0..fc3be0f 100644
--- a/src/wayland/meta-wayland-tablet-seat.h
+++ b/src/wayland/meta-wayland-tablet-seat.h
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]