[mutter/wip/tablet-protocol-v2: 44/48] wayland: Add update() phase to MetaWaylandTabletPad



commit cee96b7a74980cbfbd19efb3f62c5652a5ed331f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri May 13 16:21:05 2016 +0200

    wayland: Add update() phase to MetaWaylandTabletPad
    
    It was not necessary till now. Scheduled to change with
    button actions and other persistent data.

 src/wayland/meta-wayland-tablet-pad.c  |   15 +++++++++++++++
 src/wayland/meta-wayland-tablet-pad.h  |    2 ++
 src/wayland/meta-wayland-tablet-seat.c |   25 ++++++++++++++++++-------
 3 files changed, 35 insertions(+), 7 deletions(-)
---
diff --git a/src/wayland/meta-wayland-tablet-pad.c b/src/wayland/meta-wayland-tablet-pad.c
index 0e4af32..8c938e9 100644
--- a/src/wayland/meta-wayland-tablet-pad.c
+++ b/src/wayland/meta-wayland-tablet-pad.c
@@ -470,3 +470,18 @@ meta_wayland_tablet_pad_set_focus (MetaWaylandTabletPad *pad,
   meta_wayland_tablet_pad_update_rings_focus (pad);
   meta_wayland_tablet_pad_update_strips_focus (pad);
 }
+
+void
+meta_wayland_tablet_pad_update (MetaWaylandTabletPad *pad,
+                                const ClutterEvent   *event)
+{
+  switch (event->type)
+    {
+    case CLUTTER_PAD_BUTTON_PRESS:
+    case CLUTTER_PAD_BUTTON_RELEASE:
+    case CLUTTER_PAD_RING:
+    case CLUTTER_PAD_STRIP:
+    default:
+      break;
+    }
+}
diff --git a/src/wayland/meta-wayland-tablet-pad.h b/src/wayland/meta-wayland-tablet-pad.h
index 3a9f419..e322664 100644
--- a/src/wayland/meta-wayland-tablet-pad.h
+++ b/src/wayland/meta-wayland-tablet-pad.h
@@ -67,6 +67,8 @@ struct wl_resource *
 void         meta_wayland_tablet_pad_notify              (MetaWaylandTabletPad *pad,
                                                           struct wl_resource   *resource);
 
+void         meta_wayland_tablet_pad_update              (MetaWaylandTabletPad *pad,
+                                                          const ClutterEvent   *event);
 gboolean     meta_wayland_tablet_pad_handle_event        (MetaWaylandTabletPad *pad,
                                                           const ClutterEvent   *event);
 
diff --git a/src/wayland/meta-wayland-tablet-seat.c b/src/wayland/meta-wayland-tablet-seat.c
index a709562..abab2a3 100644
--- a/src/wayland/meta-wayland-tablet-seat.c
+++ b/src/wayland/meta-wayland-tablet-seat.c
@@ -386,15 +386,9 @@ meta_wayland_tablet_seat_update (MetaWaylandTabletSeat *tablet_seat,
   ClutterInputDevice *device;
   ClutterInputDeviceTool *device_tool;
   MetaWaylandTabletTool *tool = NULL;
+  MetaWaylandTabletPad *pad = NULL;
 
   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)
     {
@@ -403,8 +397,25 @@ meta_wayland_tablet_seat_update (MetaWaylandTabletSeat *tablet_seat,
     case CLUTTER_BUTTON_PRESS:
     case CLUTTER_BUTTON_RELEASE:
     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);
       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:
       break;
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]