diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2015-06-29 18:08:42 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2015-06-29 18:43:51 +0200 |
commit | 69f3b7dbc54dbfbc7bc9e0deb903845d1186f219 (patch) | |
tree | d4a75c92c3c9c38e6cf0105a23f892c7062abccb | |
parent | de68968f89a5e9b987ff441cc127010c12d8f606 (diff) | |
download | gtk+-69f3b7dbc54dbfbc7bc9e0deb903845d1186f219.tar.gz |
gtkdnd: Disable cursor + drag-icon merging on Wayland
There, we always want to use the surface given on wl_data_device_start_drag
so the compositor can freely run its "drag cancelled" animations. Besides,
the only benefit for this merge on X11 was sync-draw, which the compositor
should guarantee for us.
-rw-r--r-- | gtk/gtkdnd.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c index 3f63d5b363..5777fe4da9 100644 --- a/gtk/gtkdnd.c +++ b/gtk/gtkdnd.c @@ -786,7 +786,7 @@ gtk_drag_can_use_rgba_cursor (GdkDisplay *display, gint height) { guint max_width, max_height; - + if (!gdk_display_supports_cursor_color (display)) return FALSE; @@ -805,6 +805,25 @@ gtk_drag_can_use_rgba_cursor (GdkDisplay *display, return TRUE; } +static gboolean +gtk_drag_cursor_can_merge_drag_icon (GdkDisplay *display, + gint width, + gint height) +{ +#ifdef GDK_WINDOWING_WAYLAND + /* On wayland all benefits from merging the drag icon into + * the cursor are moot, and furthermore the compositor is + * responsible of running any "drag cancelled" animations, + * which we won't get for free unless we use the drag + * surface. + */ + if (GDK_IS_WAYLAND_DISPLAY (display)) + return FALSE; +#endif + + return gtk_drag_can_use_rgba_cursor (display, width, height); +} + static void ensure_drag_cursor_pixbuf (int i) { @@ -927,7 +946,7 @@ gtk_drag_get_cursor (GtkWidget *widget, width = ref_x + MAX (cursor_width - hot_x, icon_width - icon_x); height = ref_y + MAX (cursor_height - hot_y, icon_height - icon_y); - if (gtk_drag_can_use_rgba_cursor (display, width * scale, height * scale)) + if (gtk_drag_cursor_can_merge_drag_icon (display, width * scale, height * scale)) { cairo_surface_t *surface; cairo_t *cr; @@ -3128,7 +3147,7 @@ set_icon_helper (GdkDragContext *context, &width, &height); if (!force_window && - gtk_drag_can_use_rgba_cursor (display, width + 2, height + 2)) + gtk_drag_cursor_can_merge_drag_icon (display, width + 2, height + 2)) { GtkDragSourceInfo *info; |