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

Mouse Events weird when using DisplayServer.window_set_window_event_callback #81830

Closed
mournguard opened this issue Sep 17, 2023 · 6 comments · Fixed by #84669
Closed

Mouse Events weird when using DisplayServer.window_set_window_event_callback #81830

mournguard opened this issue Sep 17, 2023 · 6 comments · Fixed by #84669

Comments

@mournguard
Copy link

Godot version

4.2 dev 4

System information

Godot v4.2.dev4 - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 (NVIDIA; 31.0.15.3699) - 12th Gen Intel(R) Core(TM) i7-12700KF (20 Threads)

Issue description

I have an issue that starts from 4.2 dev 4 and up where the mouse_entered/exited events just not trigger and after a bit of initial confusion I understand it comes from using DisplayServer.window_set_window_event_callback.

Now I might just be using that wrong but yeah basically it seems like you can't use your own callback anymore, I'm not sure.

It might be related to #80334 ?

Steps to reproduce

Check the script and toggle line 4.

Minimal reproduction project

mrp.zip

@mournguard
Copy link
Author

Note that the mrp doesn't even add any mouse_entered/exited events because this also breaks the base mouse over style switch from button.

@mournguard mournguard changed the title Window Events weird when using DisplayServer.window_set_window_event_callback Mouse Events weird when using DisplayServer.window_set_window_event_callback Sep 17, 2023
@Calinou
Copy link
Member

Calinou commented Sep 17, 2023

cc @Sauermann

@mrTag
Copy link
Contributor

mrTag commented Sep 18, 2023

We are having a similar problem with our game after we updated to 4.2 dev 4. So I tried reverting #80334 but it didn't fix our "mouse_enter/exit not being triggered" problem. BUT it did fix your mrp! The buttons can be hovered and change their appearance correctly (which they didn't with the PR included). So #80334 surely has something to do with this issue!

@Sauermann
Copy link
Contributor

Sauermann commented Sep 19, 2023

Can confirm this on Linux.

As a workaround, instead of using DisplayServer.window_set_window_event_callback for accessing the window-events, you could overwrite the _notification function in the Window.
A demo for how to do that for the root-window is available in: RootSizeChange.zip

@mrTag You seem to experience a different bug. If you can provide a minimal reproduction project for that bug, it would be good, if you could open another bug-report for it.

@mournguard
Copy link
Author

As a workaround, instead of using DisplayServer.window_set_window_event_callback for accessing the window-events, you could overwrite the _notification function in the Window. A demo for how to do that for the root-window is available in: RootSizeChange.zip

Thanks I'll try to set that up. Looks like it's a much better way to do it anyway.

@mrTag
Copy link
Contributor

mrTag commented Sep 19, 2023

@mrTag You seem to experience a different bug. If you can provide a minimal reproduction project for that bug, it would be good, if you could open another bug-report for it.

That was also what I thought and I could easily reproduce it in a simple fresh project. Here is the issue, @Sauermann : #81909

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment