[mutter/wip/tablet-protocol: 51/57] wayland: Add method to update wl_tablet cursors out of events



commit 6aa28f2557a43807563d44e6a6d76d373c906668
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Feb 5 11:52:06 2015 +0100

    wayland: Add method to update wl_tablet cursors out of events
    
    This MetaWaylandTabletManager method looks up the corresponding
    MetaWaylandTablet for a given event, and updates the cursor coordinates out
    of it.

 src/wayland/meta-wayland-tablet-manager.c |   22 ++++++++++++++++++++++
 src/wayland/meta-wayland-tablet-manager.h |    3 +++
 2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/wayland/meta-wayland-tablet-manager.c b/src/wayland/meta-wayland-tablet-manager.c
index 6340023..87787b3 100644
--- a/src/wayland/meta-wayland-tablet-manager.c
+++ b/src/wayland/meta-wayland-tablet-manager.c
@@ -249,3 +249,25 @@ meta_wayland_tablet_manager_handle_event (MetaWaylandTabletManager *manager,
 
   return meta_wayland_tablet_handle_event (tablet, event);
 }
+
+void
+meta_wayland_tablet_manager_update_cursor_position (MetaWaylandTabletManager *manager,
+                                                    const ClutterEvent       *event)
+{
+  ClutterInputDevice *device;
+  MetaWaylandTablet *tablet;
+  gfloat new_x, new_y;
+
+  device = clutter_event_get_source_device (event);
+
+  if (!device)
+    return;
+
+  tablet = meta_wayland_tablet_manager_lookup_from_event (manager, event);
+
+  if (!tablet)
+    return;
+
+  clutter_event_get_coords (event, &new_x, &new_y);
+  meta_wayland_tablet_update_cursor_position (tablet, new_x, new_y);
+}
diff --git a/src/wayland/meta-wayland-tablet-manager.h b/src/wayland/meta-wayland-tablet-manager.h
index 75408ed..204a603 100644
--- a/src/wayland/meta-wayland-tablet-manager.h
+++ b/src/wayland/meta-wayland-tablet-manager.h
@@ -47,4 +47,7 @@ void     meta_wayland_tablet_manager_update         (MetaWaylandTabletManager *m
 gboolean meta_wayland_tablet_manager_handle_event   (MetaWaylandTabletManager *manager,
                                                      const ClutterEvent       *event);
 
+void     meta_wayland_tablet_manager_update_cursor_position (MetaWaylandTabletManager *manager,
+                                                             const ClutterEvent       *event);
+
 #endif /* META_WAYLAND_TABLET_MANAGER_H */


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