diff options
author | Wolfgang Ulbrich <[email protected]> | 2016-01-15 23:26:05 +0100 |
---|---|---|
committer | Wolfgang Ulbrich <[email protected]> | 2016-01-15 23:26:05 +0100 |
commit | 3c796cdf6020ac59cbcaca103453501292423c71 (patch) | |
tree | 1cb80a4771c7df62438a7d77f68ce9cfed8284b3 | |
parent | 50970d1bb15d1f9c682e92dda345e59cfcf5330f (diff) | |
download | caja-3c796cdf6020ac59cbcaca103453501292423c71.tar.bz2 caja-3c796cdf6020ac59cbcaca103453501292423c71.tar.xz |
GTK3 all: don't use deprecated GDK pointer methods
Use the new GdkDevice methods instead.
taken from:
https://git.gnome.org/browse/nautilus/commit/?h=gnome-3-4&id=a816e00
https://git.gnome.org/browse/nautilus/commit/?h=gnome-3-4&id=cdf858f
-rw-r--r-- | eel/eel-art-gtk-extensions.c | 13 | ||||
-rw-r--r-- | eel/eel-editable-label.c | 6 | ||||
-rw-r--r-- | libcaja-private/caja-dnd.c | 11 | ||||
-rw-r--r-- | libcaja-private/caja-icon-container.c | 8 | ||||
-rw-r--r-- | libcaja-private/caja-tree-view-drag-dest.c | 11 | ||||
-rw-r--r-- | src/caja-notebook.c | 11 |
6 files changed, 59 insertions, 1 deletions
diff --git a/eel/eel-art-gtk-extensions.c b/eel/eel-art-gtk-extensions.c index f7009991..5e7f4dab 100644 --- a/eel/eel-art-gtk-extensions.c +++ b/eel/eel-art-gtk-extensions.c @@ -327,11 +327,24 @@ eel_gdk_get_pointer_position (void) { EelIPoint position; +#if GTK_CHECK_VERSION (3, 0, 0) + GdkDeviceManager *manager; + GdkDevice *pointer; + + manager = gdk_display_get_device_manager (gdk_window_get_display (gdk_get_default_root_window ())); + pointer = gdk_device_manager_get_client_pointer (manager); + gdk_window_get_device_position (gdk_get_default_root_window (), + pointer, + &position.x, + &position.y, + NULL); +#else gdk_window_get_pointer (gdk_get_default_root_window (), &position.x, &position.y, NULL); +#endif return position; } diff --git a/eel/eel-editable-label.c b/eel/eel-editable-label.c index 21dfd673..6f66c120 100644 --- a/eel/eel-editable-label.c +++ b/eel/eel-editable-label.c @@ -2162,8 +2162,14 @@ eel_editable_label_motion (GtkWidget *widget, if ((event->state & GDK_BUTTON1_MASK) == 0) return FALSE; +#if GTK_CHECK_VERSION (3, 0, 0) + gdk_window_get_device_position (gtk_widget_get_window (widget), + event->device, + &x, &y, NULL); +#else gdk_window_get_pointer (gtk_widget_get_window (widget), &x, &y, NULL); +#endif get_layout_index (label, x, y, &index); diff --git a/libcaja-private/caja-dnd.c b/libcaja-private/caja-dnd.c index 9cfbcbc5..f1e3bb70 100644 --- a/libcaja-private/caja-dnd.c +++ b/libcaja-private/caja-dnd.c @@ -957,11 +957,22 @@ void caja_drag_autoscroll_calculate_delta (GtkWidget *widget, float *x_scroll_delta, float *y_scroll_delta) { GtkAllocation allocation; +#if GTK_CHECK_VERSION (3, 0, 0) + GdkDeviceManager *manager; + GdkDevice *pointer; +#endif int x, y; g_assert (GTK_IS_WIDGET (widget)); +#if GTK_CHECK_VERSION (3, 0, 0) + manager = gdk_display_get_device_manager (gtk_widget_get_display (widget)); + pointer = gdk_device_manager_get_client_pointer (manager); + gdk_window_get_device_position (gtk_widget_get_window (widget), pointer, + &x, &y, NULL); +#else gdk_window_get_pointer (gtk_widget_get_window (widget), &x, &y, NULL); +#endif /* Find out if we are anywhere close to the tree view edges * to see if we need to autoscroll. diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c index 049f2fc2..8dcda910 100644 --- a/libcaja-private/caja-icon-container.c +++ b/libcaja-private/caja-icon-container.c @@ -2785,7 +2785,15 @@ rubberband_timeout_callback (gpointer data) adj_changed = TRUE; } +#if GTK_CHECK_VERSION (3, 0, 0) + gdk_window_get_device_position (gtk_widget_get_window (widget), + gdk_device_manager_get_client_pointer ( + gdk_display_get_device_manager ( + gtk_widget_get_display (widget))), + &x, &y, NULL); +#else gtk_widget_get_pointer (widget, &x, &y); +#endif if (x < 0) { diff --git a/libcaja-private/caja-tree-view-drag-dest.c b/libcaja-private/caja-tree-view-drag-dest.c index accf7bb5..405ec141 100644 --- a/libcaja-private/caja-tree-view-drag-dest.c +++ b/libcaja-private/caja-tree-view-drag-dest.c @@ -102,6 +102,10 @@ gtk_tree_view_vertical_autoscroll (GtkTreeView *tree_view) { GdkRectangle visible_rect; GtkAdjustment *vadjustment; +#if GTK_CHECK_VERSION(3, 0, 0) + GdkDeviceManager *manager; + GdkDevice *pointer; +#endif GdkWindow *window; int y; int offset; @@ -111,11 +115,16 @@ gtk_tree_view_vertical_autoscroll (GtkTreeView *tree_view) #if GTK_CHECK_VERSION(3, 0, 0) vadjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE(tree_view)); + + manager = gdk_display_get_device_manager (gtk_widget_get_display (GTK_WIDGET (tree_view))); + pointer = gdk_device_manager_get_client_pointer (manager); + gdk_window_get_device_position (window, pointer, + NULL, &y, NULL); #else vadjustment = gtk_tree_view_get_vadjustment (tree_view); -#endif gdk_window_get_pointer (window, NULL, &y, NULL); +#endif y += gtk_adjustment_get_value (vadjustment); diff --git a/src/caja-notebook.c b/src/caja-notebook.c index 2bd6a208..ccfa751f 100644 --- a/src/caja-notebook.c +++ b/src/caja-notebook.c @@ -110,12 +110,23 @@ caja_notebook_class_init (CajaNotebookClass *klass) static CajaNotebook * find_notebook_at_pointer (gint abs_x, gint abs_y) { +#if GTK_CHECK_VERSION(3, 0, 0) + GdkDeviceManager *manager; + GdkDevice *pointer; +#endif GdkWindow *win_at_pointer, *toplevel_win; gpointer toplevel = NULL; gint x, y; /* FIXME multi-head */ +#if GTK_CHECK_VERSION(3, 0, 0) + manager = gdk_display_get_device_manager (gdk_display_get_default ()); + pointer = gdk_device_manager_get_client_pointer (manager); + win_at_pointer = gdk_device_get_window_at_position (pointer, &x, &y); +#else win_at_pointer = gdk_window_at_pointer (&x, &y); +#endif + if (win_at_pointer == NULL) { /* We are outside all windows containing a notebook */ |