[gtk/matthiasc/for-master] wayland: Fall back to an unthemed default cursor



commit e1b25eaf5a1fe0a3994f01f221f0ea4b991c8e1c
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Apr 26 14:42:45 2020 -0400

    wayland: Fall back to an unthemed default cursor
    
    In the absence of icon themes (such as in a freshly
    created toolbox container), we should not just fall back
    to "no cursor", since that makes it hard even to close
    the application. Fall back to an included default cursor
    of last resort.

 gdk/wayland/gdkcursor-wayland.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/gdk/wayland/gdkcursor-wayland.c b/gdk/wayland/gdkcursor-wayland.c
index f880b9da2d..66a461dd6c 100644
--- a/gdk/wayland/gdkcursor-wayland.c
+++ b/gdk/wayland/gdkcursor-wayland.c
@@ -162,6 +162,8 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
                                 int               *height,
                                 int               *scale)
 {
+  GdkTexture *texture;
+
   if (gdk_cursor_get_name (cursor))
     {
       struct wl_cursor *c;
@@ -199,10 +201,12 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
     }
   else
     {
-      GdkTexture *texture = gdk_cursor_get_texture (cursor);
       cairo_surface_t *surface;
       struct wl_buffer *buffer;
 
+      texture = gdk_cursor_get_texture (cursor);
+
+from_texture:
       surface = g_hash_table_lookup (display->cursor_surface_cache, cursor);
       if (surface == NULL)
         {
@@ -241,6 +245,11 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
                                            hotspot_x, hotspot_y,
                                            width, height,
                                            scale);
+  else
+    {
+      texture = gdk_texture_new_from_resource ("/org/gtk/libgdk/cursor/default");
+      goto from_texture;
+    }
 
 none:
   *hotspot_x = 0;


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