[gtk+/gtk-3-18] wayland: Only do cursor name fallback for standard names



commit 81a287478a4db9ce650cc764474b9c173b137dee
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jan 6 14:56:06 2016 -0500

    wayland: Only do cursor name fallback for standard names
    
    Always returning a left_ptr if we can't find anything better
    broke firefox application-specific fallback for missing cursors.
    Keep that working by only doing the fallback for the CSS cursor
    names, not for things like hashes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=760141

 gdk/wayland/gdkcursor-wayland.c |   29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/gdk/wayland/gdkcursor-wayland.c b/gdk/wayland/gdkcursor-wayland.c
index 8aee5ae..bdfa316 100644
--- a/gdk/wayland/gdkcursor-wayland.c
+++ b/gdk/wayland/gdkcursor-wayland.c
@@ -87,17 +87,23 @@ static const struct {
   const gchar *css_name, *traditional_name;
 } name_map[] = {
   { "default",      "left_ptr" },
+  { "help",         "left_ptr" },
+  { "context-menu", "left_ptr" },
   { "pointer",      "hand" },
   { "progress",     "left_ptr_watch" },
   { "wait",         "watch" },
   { "cell",         "crosshair" },
   { "crosshair",    "cross" },
   { "text",         "xterm" },
+  { "vertical-text","xterm" },
   { "alias",        "dnd-link" },
   { "copy",         "dnd-copy" },
+  { "move",         "dnd-move" },
   { "no-drop",      "dnd-none" },
   { "not-allowed",  "crossed_circle" },
   { "grab",         "hand2" },
+  { "grabbing",     "hand2" },
+  { "all-scroll",   "left_ptr" },
   { "col-resize",   "h_double_arrow" },
   { "row-resize",   "v_double_arrow" },
   { "n-resize",     "top_side" },
@@ -112,6 +118,8 @@ static const struct {
   { "ns-resize",    "v_double_arrow" },
   { "nesw-resize",  "fd_double_arrow" },
   { "nwse-resize",  "bd_double_arrow" },
+  { "zoom-in",      "left_ptr" },
+  { "zoom-out",     "left_ptr" },
   { NULL, NULL }
 };
 
@@ -126,7 +134,7 @@ name_fallback (const gchar *name)
         return name_map[i].traditional_name;
     }
 
-  return "left_ptr";
+  return NULL;
 }
 
 static gboolean
@@ -144,17 +152,22 @@ _gdk_wayland_cursor_update (GdkWaylandDisplay *wayland_display,
                                                         cursor->scale);
   c = wl_cursor_theme_get_cursor (theme, cursor->name);
   if (!c)
-    c = wl_cursor_theme_get_cursor (theme, name_fallback (cursor->name));
+    {
+      const char *fallback;
+
+      fallback = name_fallback (cursor->name);
+      if (fallback)
+        {
+          c = wl_cursor_theme_get_cursor (theme, name_fallback (cursor->name));
+          if (!c)
+            c = wl_cursor_theme_get_cursor (theme, "left_ptr");
+        }
+    }
 
   if (!c)
     {
       g_warning (G_STRLOC ": Unable to load %s from the cursor theme", cursor->name);
-
-      /* return the left_ptr cursor as a fallback */
-      c = wl_cursor_theme_get_cursor (theme, "left_ptr");
-
-      if (!c)
-        return FALSE;
+      return FALSE;
     }
 
   cursor->wl_cursor = c;


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