-
-
Notifications
You must be signed in to change notification settings - Fork 22.1k
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
Fix input_event
signal on Android
#89914
Conversation
I believe, that the PR in its current form will introduce for focused Windows could now receive delayed input events from the OS after the mouse has left the window, leading to Edit: Corrected: it was |
Everything seems to be ok on MacOS, or how should I test?
void Window::_update_mouse_over(Vector2 p_pos) {
print_line("void Window::_update_mouse_over: mouse_in_window:", mouse_in_window, "focused:", focused);
if (!mouse_in_window) {
if (is_embedded()) {
mouse_in_window = true;
_propagate_window_notification(this, NOTIFICATION_WM_MOUSE_ENTER);
} else if (!focused) {
// Prevent update based on delayed InputEvents from DisplayServer.
// Also check whether the window is not focused.
// Android and iOS do not send 'WINDOW_EVENT_MOUSE_*' events, 'mouse_in_window' is always false.
return;
}
} Screen-2024-03-26-184939.mp4 |
I have tested the PR (rebased on 7d151c8) on Linux X11 and can confirm my previously mentioned problematic behavior. MRP: area2d-oob.zip Move the mouse from inside the Window to outside the window. Afterwards (not always, but in about 25% of my tests) one of the labels tells "in vp", indicating, that the mouse is over the viewport, contradicting the fact, that the mouse is outside of the window. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR needs to address the above mentioned problem.
91daa37
to
af42fcc
Compare
I could not reproduce The new solution now forces I think if multi-window-support is introduced at some point, the events will have to be revised again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I'm not familiar with Android loop callbacks, the usage of WINDOW_EVENT_MOUSE_*
looks correct: It takes care of setting mouse-over states.
Haven't tested the PR though.
I agree, that revisiting these events will become necessary, if multi window support gets implemented.
For reference: #89920 approaches the problem from a different side, that is more aligned with the initial implementation of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if multi-window-support is introduced at some point, the events will have to be revised again.
Multi-window support is on the roadmap (Godot 4.4), and we are already experimenting with it for the Godot XR Editor, so this PR will need to be revised to account for it.
If I'm reading right, in a multi-window world each window will fire the WINDOW_EVENT_MOUSE_ENTER
event causing input focus to randomly switch back and forth between each window; is that correct?
@Sauermann @Alex2782 It seems the regression on Android is caused by Also, how is that change affecting iOS platforms? I'd imagine they would run into a similar issue. cc @bruvzg |
@m4gr3d While setting |
This PR is no longer necessary if |
Fixes: #89683
Test: Area2DInputTestAndroid-4.3-dev5.zip
Screen_recording_20240326_173058.mp4