gdk/wayland: Don't fall back directly to 1 for mismatched cursor sizes.
Try to find a lower scale that still works. In most cases this will end up with a 2-scaled cursor rather than 3-scaled cursor. Fixes #5567
This commit is contained in:
parent
292893f9d7
commit
c06c7bdc6a
@ -224,6 +224,7 @@ _gdk_wayland_cursor_get_buffer (GdkCursor *cursor,
|
||||
{
|
||||
struct wl_cursor_image *image;
|
||||
int cursor_scale;
|
||||
gboolean warned = FALSE;
|
||||
|
||||
if (image_index >= wayland_cursor->wl_cursor->image_count)
|
||||
{
|
||||
@ -236,13 +237,17 @@ _gdk_wayland_cursor_get_buffer (GdkCursor *cursor,
|
||||
image = wayland_cursor->wl_cursor->images[image_index];
|
||||
|
||||
cursor_scale = wayland_cursor->scale;
|
||||
if ((image->width % cursor_scale != 0) ||
|
||||
(image->height % cursor_scale != 0))
|
||||
while ((image->width % cursor_scale != 0) ||
|
||||
(image->height % cursor_scale != 0))
|
||||
{
|
||||
g_warning (G_STRLOC " cursor image size (%dx%d) not an integer"
|
||||
"multiple of scale (%d)", image->width, image->height,
|
||||
cursor_scale);
|
||||
cursor_scale = 1;
|
||||
if (!warned)
|
||||
{
|
||||
g_warning (G_STRLOC " cursor image size (%dx%d) not an integer"
|
||||
"multiple of scale (%d)", image->width, image->height,
|
||||
cursor_scale);
|
||||
warned = TRUE;
|
||||
}
|
||||
cursor_scale--;
|
||||
}
|
||||
|
||||
*hotspot_x = image->hotspot_x / cursor_scale;
|
||||
|
Loading…
Reference in New Issue
Block a user