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

Wrong cursor detection when changing buttons default cursor shape while using a stretch mode other then disabled #93131

Closed
Lortemanden opened this issue Jun 13, 2024 · 5 comments · Fixed by #94987

Comments

@Lortemanden
Copy link

Lortemanden commented Jun 13, 2024

Tested versions

  • Produced in: Godot_v4.3-beta1, Godot_v4.3-beta2, Godot_v4.3-beta3, Godot_v4.3.rc1

System information

windows 10 compatibility and forward+

Issue description

When changing a buttons default cursor in the code when hovering or clicking it, the mouse_entered() signal is called on other buttons in the scene. Afterwards it then calls the correct button's mouse_entered again. It should not call any mouse_entered() signal because you are changing the default cursor. I have not tested this with other nodes that have a mouse_entered signal but it might also affect them.

This only works if any of the stretch modes in project settings -> window -> stretch -> mode are turned on and you resize the window. The video show how it works and then how it breaks after resizing.

2024-06-13.16-24-39.mp4

Steps to reproduce

  1. Create a bunch of buttons in a scene
  2. Make them change the default cursor when the mouse is entered and print their name to the consol
  3. Make them change the default cursor when the mouse is exited
  4. change the projects stretch mode to anything but disabled
  5. Run the program and move the mouse in and out of the buttons
  6. Then resize the window and repeat step 5

Minimal reproduction project (MRP)

Just run the project and follow step 5 and 6 to reproduce.
cursor_change_bug.zip

@Lortemanden
Copy link
Author

Lortemanden commented Jul 3, 2024

This bug is still a problem in 4.3.beta2 and also halts the node signal. So if you have touch control and click on a button with both mouse_entered and mouse_pressed signals, where the mouse_entered changes the cursor, it will not call the mouse_pressed signal.

I have found a solution for the signal not being called, which is to change the cursor deferred. This does not fix the other problem originally descripted in the issue.
So instead of this:

button.mouse_default_cursor_shape = Button.CURSOR_ARROW

You have to do this:

button.set_deferred("mouse_default_cursor_shape", Button.CURSOR_ARROW)

@Lortemanden
Copy link
Author

I can still reproduce this bug in 4.3.beta3

@Lortemanden
Copy link
Author

Can still be reproduced in 4.3.rc1

@akien-mga
Copy link
Member

@Lortemanden It's fine to retest on every dev snapshot to see if there's been changes, but please avoid bumping the issue each time. Editing the OP is sufficient. In most cases, if this had been fixed, the issue would have been closed already and there would be a linked PR.

Now, it's also important to make clear if the issue is a regression. It wasn't clear in the OP and I had to infer from your (apparent) eagerness to get this fixed that this might be a regression that broke your project that would work in 4.2?

So I tested and indeed the MRP behaves differently in 4.2-stable and 4.3-rc1.

The behavior in 4.2-stable also seems broken to me, but differently. It highlights two tiles at once after stretching, as if it was sending events both to the unscaled location and the scaled one.

image

The change in behavior seems to have been introduced in 4.3.dev1, and also got backported to the 4.2 branch as it's reproducible in 4.2.2.stable (but not 4.2.stable and 4.2.1.stable).

Would be worth bisecting to identify which commit changed the behavior.

@akien-mga
Copy link
Member

Bisected on the 4.2 branch between 4.2.1-stable and 4.2.2-stable as that's faster (less changes so faster rebuilds). The first bad commit is 2981135, i.e. the cherry-pick of 78e1702 / #85313.

CC @kitbdev

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

Successfully merging a pull request may close this issue.

3 participants