mirror of https://github.com/godotengine/godot
Merge pull request #101987 from Riteo/imagine-using-rids
Wayland: Check custom cursor resource reference for cache invalidation
This commit is contained in:
commit
4f3dddbbff
|
|
@ -1071,7 +1071,7 @@ void DisplayServerWayland::cursor_set_custom_image(const Ref<Resource> &p_cursor
|
||||||
HashMap<CursorShape, CustomCursor>::Iterator cursor_c = custom_cursors.find(p_shape);
|
HashMap<CursorShape, CustomCursor>::Iterator cursor_c = custom_cursors.find(p_shape);
|
||||||
|
|
||||||
if (cursor_c) {
|
if (cursor_c) {
|
||||||
if (cursor_c->value.rid == p_cursor->get_rid() && cursor_c->value.hotspot == p_hotspot) {
|
if (cursor_c->value.resource == p_cursor && cursor_c->value.hotspot == p_hotspot) {
|
||||||
// We have a cached cursor. Nice.
|
// We have a cached cursor. Nice.
|
||||||
wayland_thread.cursor_set_shape(p_shape);
|
wayland_thread.cursor_set_shape(p_shape);
|
||||||
return;
|
return;
|
||||||
|
|
@ -1087,7 +1087,7 @@ void DisplayServerWayland::cursor_set_custom_image(const Ref<Resource> &p_cursor
|
||||||
|
|
||||||
CustomCursor &cursor = custom_cursors[p_shape];
|
CustomCursor &cursor = custom_cursors[p_shape];
|
||||||
|
|
||||||
cursor.rid = p_cursor->get_rid();
|
cursor.resource = p_cursor;
|
||||||
cursor.hotspot = p_hotspot;
|
cursor.hotspot = p_hotspot;
|
||||||
|
|
||||||
wayland_thread.cursor_shape_set_custom_image(p_shape, image, p_hotspot);
|
wayland_thread.cursor_shape_set_custom_image(p_shape, image, p_hotspot);
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ class DisplayServerWayland : public DisplayServer {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CustomCursor {
|
struct CustomCursor {
|
||||||
RID rid;
|
Ref<Resource> resource;
|
||||||
Point2i hotspot;
|
Point2i hotspot;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue