[gtk/gtk-3-24: 2/3] wayland/cursor: Make sure the cached cursor has the right size
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 2/3] wayland/cursor: Make sure the cached cursor has the right size
- Date: Tue, 8 Jan 2019 18:11:45 +0000 (UTC)
commit a907552df9066fd9aacbd8182b53c4ee068d23ed
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Tue Jan 8 18:43:29 2019 +0100
wayland/cursor: Make sure the cached cursor has the right size
The cache key is just the name of the cursor, so if a previously added
cursor had e.g. scale == 1, if we ask for a new cursor with scale == 2,
we might still fetch the scale == 1 cursor from the cache. Avoid this by
making sure the scale of the cached one is correct.
If it isn't, load the cursor as normal, and update the cache entry with
the new properly scaled cursor.
Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/1183
gdk/wayland/gdkcursor-wayland.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gdk/wayland/gdkcursor-wayland.c b/gdk/wayland/gdkcursor-wayland.c
index 33d81f9c43..0212d70a7e 100644
--- a/gdk/wayland/gdkcursor-wayland.c
+++ b/gdk/wayland/gdkcursor-wayland.c
@@ -342,7 +342,7 @@ _gdk_wayland_display_get_cursor_for_name_with_scale (GdkDisplay *display,
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
wayland_cursor = g_hash_table_lookup (display_wayland->cursor_cache, name);
- if (wayland_cursor)
+ if (wayland_cursor && wayland_cursor->scale == scale)
return GDK_CURSOR (g_object_ref (wayland_cursor));
wayland_cursor = g_object_new (GDK_TYPE_WAYLAND_CURSOR,
@@ -369,9 +369,9 @@ _gdk_wayland_display_get_cursor_for_name_with_scale (GdkDisplay *display,
}
/* Insert into cache. */
- g_hash_table_insert (display_wayland->cursor_cache,
- wayland_cursor->name,
- g_object_ref (wayland_cursor));
+ g_hash_table_replace (display_wayland->cursor_cache,
+ wayland_cursor->name,
+ g_object_ref (wayland_cursor));
return GDK_CURSOR (wayland_cursor);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]