[mutter] MetaCursorTracker: extend with query pointer abilities
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] MetaCursorTracker: extend with query pointer abilities
- Date: Wed, 4 Sep 2013 15:21:22 +0000 (UTC)
commit 3053cc0de4e6f25402293bd36da30638f143d204
Author: Giovanni Campagna <gcampagn redhat com>
Date: Wed Sep 4 16:50:19 2013 +0200
MetaCursorTracker: extend with query pointer abilities
We need an abstraction in gnome-shell for XQueryPointer, and
MetaCursorTracker seems a good place for it.
https://bugzilla.gnome.org/show_bug.cgi?id=707474
src/core/meta-cursor-tracker.c | 21 +++++++++++++++++++++
src/meta/meta-cursor-tracker.h | 6 ++++++
2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/src/core/meta-cursor-tracker.c b/src/core/meta-cursor-tracker.c
index c51a827..bfe35d5 100644
--- a/src/core/meta-cursor-tracker.c
+++ b/src/core/meta-cursor-tracker.c
@@ -35,6 +35,8 @@
#include <cogl/cogl.h>
#include <clutter/clutter.h>
+#include <gdk/gdk.h>
+
#include <X11/extensions/Xfixes.h>
#include "meta-cursor-tracker-private.h"
@@ -273,3 +275,22 @@ meta_cursor_tracker_set_root_cursor (MetaCursorTracker *tracker,
XFlush (display->xdisplay);
XFreeCursor (display->xdisplay, xcursor);
}
+
+void
+meta_cursor_tracker_get_pointer (MetaCursorTracker *tracker,
+ int *x,
+ int *y,
+ ClutterModifierType *mods)
+{
+ GdkDeviceManager *gmanager;
+ GdkDevice *gdevice;
+ GdkScreen *gscreen;
+
+ gmanager = gdk_display_get_device_manager (gdk_display_get_default ());
+ gdevice = gdk_device_manager_get_client_pointer (gmanager);
+
+ gdk_device_get_position (gdevice, &gscreen, x, y);
+ gdk_device_get_state (gdevice,
+ gdk_screen_get_root_window (gscreen),
+ NULL, (GdkModifierType*)mods);
+}
diff --git a/src/meta/meta-cursor-tracker.h b/src/meta/meta-cursor-tracker.h
index c59c6ce..8862e43 100644
--- a/src/meta/meta-cursor-tracker.h
+++ b/src/meta/meta-cursor-tracker.h
@@ -28,6 +28,7 @@
#include <meta/types.h>
#include <meta/workspace.h>
#include <cogl/cogl.h>
+#include <clutter/clutter.h>
#define META_TYPE_CURSOR_TRACKER (meta_cursor_tracker_get_type ())
#define META_CURSOR_TRACKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_CURSOR_TRACKER,
MetaCursorTracker))
@@ -47,4 +48,9 @@ void meta_cursor_tracker_get_hot (MetaCursorTracker *tracker,
int *y);
CoglTexture *meta_cursor_tracker_get_sprite (MetaCursorTracker *tracker);
+void meta_cursor_tracker_get_pointer (MetaCursorTracker *tracker,
+ int *x,
+ int *y,
+ ClutterModifierType *mods);
+
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]