diff --git a/src/core/meta-cursor-tracker.c b/src/core/meta-cursor-tracker.c index c51a827de..bfe35d5a5 100644 --- a/src/core/meta-cursor-tracker.c +++ b/src/core/meta-cursor-tracker.c @@ -35,6 +35,8 @@ #include #include +#include + #include #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 c59c6cefb..8862e4345 100644 --- a/src/meta/meta-cursor-tracker.h +++ b/src/meta/meta-cursor-tracker.h @@ -28,6 +28,7 @@ #include #include #include +#include #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