[gtk+/wip/wayland-dnd-actions: 671/674] gtkdnd: Disable cursor + drag-icon merging on Wayland



commit 69f3b7dbc54dbfbc7bc9e0deb903845d1186f219
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Jun 29 18:08:42 2015 +0200

    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.

 gtk/gtkdnd.c |   25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index 3f63d5b..5777fe4 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;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]