diff options
-rw-r--r-- | plugins/mouse/msd-locate-pointer.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/plugins/mouse/msd-locate-pointer.c b/plugins/mouse/msd-locate-pointer.c index 076fccc..c370496 100644 --- a/plugins/mouse/msd-locate-pointer.c +++ b/plugins/mouse/msd-locate-pointer.c @@ -190,6 +190,10 @@ timeline_frame_cb (MsdTimeline *timeline, { MsdLocatePointerData *data = (MsdLocatePointerData *) user_data; GdkScreen *screen; +#if GTK_CHECK_VERSION (3, 0, 0) + GdkDeviceManager *device_manager; + GdkDevice *pointer; +#endif gint cursor_x, cursor_y; if (gtk_widget_is_composited (data->widget)) @@ -206,8 +210,18 @@ timeline_frame_cb (MsdTimeline *timeline, } screen = gdk_window_get_screen (data->window); +#if GTK_CHECK_VERSION (3, 0, 0) + device_manager = gdk_display_get_device_manager (gdk_window_get_display (gdk_screen_get_root_window (screen))); + pointer = gdk_device_manager_get_client_pointer (device_manager); + gdk_window_get_device_position (gdk_screen_get_root_window (screen), + pointer, + &cursor_x, + &cursor_y, + NULL); +#else gdk_window_get_pointer (gdk_screen_get_root_window (screen), - &cursor_x, &cursor_y, NULL); + &cursor_x, &cursor_y, NULL); +#endif gdk_window_move (data->window, cursor_x - WINDOW_SIZE / 2, cursor_y - WINDOW_SIZE / 2); @@ -358,13 +372,27 @@ static void move_locate_pointer_window (MsdLocatePointerData *data, GdkScreen *screen) { +#if GTK_CHECK_VERSION (3, 0, 0) + GdkDeviceManager *device_manager; + GdkDevice *pointer; +#endif gint cursor_x, cursor_y; #if !GTK_CHECK_VERSION (3, 0, 0) GdkBitmap *mask; cairo_t *cr; #endif +#if GTK_CHECK_VERSION (3, 0, 0) + device_manager = gdk_display_get_device_manager (gdk_window_get_display (gdk_screen_get_root_window (screen))); + pointer = gdk_device_manager_get_client_pointer (device_manager); + gdk_window_get_device_position (gdk_screen_get_root_window (screen), + pointer, + &cursor_x, + &cursor_y, + NULL); +#else gdk_window_get_pointer (gdk_screen_get_root_window (screen), &cursor_x, &cursor_y, NULL); +#endif gdk_window_move_resize (data->window, cursor_x - WINDOW_SIZE / 2, |