diff options
author | Wolfgang Ulbrich <[email protected]> | 2015-11-16 14:13:22 +0100 |
---|---|---|
committer | Wolfgang Ulbrich <[email protected]> | 2015-12-02 12:56:36 +0100 |
commit | 1c202058b5ad04b0947e2f00029d09f50fcc868b (patch) | |
tree | ea14ebe8ccadfe71ab80a4e368944befe2f9bafa | |
parent | 8ea8868b6e6cfa626905b52b4b94b10b60d43139 (diff) | |
download | mate-settings-daemon-1c202058b5ad04b0947e2f00029d09f50fcc868b.tar.bz2 mate-settings-daemon-1c202058b5ad04b0947e2f00029d09f50fcc868b.tar.xz |
GTK3 mouse: don't use deprecated gdk_window_get_pointer
-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, |