Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wayland Cursor custom image doesn't update when using Image instead of Texture2D #101929

Open
wakeofluna opened this issue Jan 22, 2025 · 0 comments

Comments

@wakeofluna
Copy link

wakeofluna commented Jan 22, 2025

Tested versions

System information

Linux Gentoo using Wayland

Issue description

When using the Wayland DisplayServer you can only update the custom mouse cursor once if you are using Image instead of Texture2D resources and the images have the same hotspot.

The function Input.set_custom_mouse_cursor claims that it is okay to use either an Image or a Texture2D as a custom cursor image. The caching code in DisplayServerWayland::cursor_set_custom_image checks for cursor reuse using "get_rid()" on the provided resource. Since an Image does not have a RID, any image will always enter the branch // We have a cached cursor. Nice..

Bug is visible since #96647 was fixed, although the underlying bug was already older than that.

Workarounds

  • Use Texture2D instead of image resources - may cause undesired overhead to convert back to image
  • Reset the cursor in between - may cause cursor flickering
  • Move the hotspot locations to force a cache miss - unwanted extra work to make images suitable with different hotspots

Steps to reproduce

  • Force editor and game to use the Wayland display server
  • Make sure the referenced img1 and img2 are imported as Image and not as Texture.
Input.set_custom_mouse_cursor(img1, Input.CURSOR_ARROW)
# Correctly shows img1 as the cursor
Input.set_custom_mouse_cursor(img2, Input.CURSOR_ARROW)
# Still shows img1 as the cursor

Minimal reproduction project (MRP)

wayland-cursor-reproducer.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: For team assessment
Development

No branches or pull requests

2 participants