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.
This commit is contained in:
Matthias Clasen 2020-04-26 14:42:45 -04:00
parent 7eeeb3f229
commit e1b25eaf5a

View File

@ -162,6 +162,8 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
int *height, int *height,
int *scale) int *scale)
{ {
GdkTexture *texture;
if (gdk_cursor_get_name (cursor)) if (gdk_cursor_get_name (cursor))
{ {
struct wl_cursor *c; struct wl_cursor *c;
@ -199,10 +201,12 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
} }
else else
{ {
GdkTexture *texture = gdk_cursor_get_texture (cursor);
cairo_surface_t *surface; cairo_surface_t *surface;
struct wl_buffer *buffer; struct wl_buffer *buffer;
texture = gdk_cursor_get_texture (cursor);
from_texture:
surface = g_hash_table_lookup (display->cursor_surface_cache, cursor); surface = g_hash_table_lookup (display->cursor_surface_cache, cursor);
if (surface == NULL) if (surface == NULL)
{ {
@ -241,6 +245,11 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
hotspot_x, hotspot_y, hotspot_x, hotspot_y,
width, height, width, height,
scale); scale);
else
{
texture = gdk_texture_new_from_resource ("/org/gtk/libgdk/cursor/default");
goto from_texture;
}
none: none:
*hotspot_x = 0; *hotspot_x = 0;