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

Track hovered Window in DisplayServerX11 #80279

Merged

Conversation

Sauermann
Copy link
Contributor

@Sauermann Sauermann commented Aug 5, 2023

Send mouse-entered/exited window-events only when necessary

fix crash of comment #79325 (comment)
resolve for linux #80335

@Rindbee
Copy link
Contributor

Rindbee commented Aug 6, 2023

I tested this PR and it resolves #80335. One small problem: the mouse may teleport occasionally.

@Sauermann
Copy link
Contributor Author

Can you provide more detail, in which situations cursor-teleports happen?
I have tested for several minutes to cause this, but was not able to.
Perhaps this is WM-related: I am using X11-Xfce.

@Rindbee
Copy link
Contributor

Rindbee commented Aug 7, 2023

A mouse icon appears in the center of the window when the left mouse button is released (drag to modify the value). I tried to record the screen, but failed.

This problem is reproduced in both Cinnamon and i3wm. I rebase it on 16a9356, then build with the following command: pyston-scons -j4 use_llvm=yes linker=mold dev_build=yes

@Rindbee
Copy link
Contributor

Rindbee commented Aug 7, 2023

This PR seems to cause a new crash:

ERROR: FATAL: DEV_ASSERT failed  "!root->gui.windowmanager_window_over" is false.
   at: _event_callback (scene/main/window.cpp:675)

================================================================
handle_crash: Program crashed with signal 4
Engine version: Godot Engine v4.2.dev.custom_build (0d54d2ba0830d18e8b0bc7d7cd9857b8fc9450c4)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7f02d7442520] (??:0)
[2] Window::_event_callback(DisplayServer::WindowEvent) (/opt/godot/godot-editor-l10n/godot/scene/main/window.cpp:675)
[3] void call_with_variant_args_helper<Window, DisplayServer::WindowEvent, 0ul>(Window*, void (Window::*)(DisplayServer::WindowEvent), Variant const**, Callable::CallError&, IndexSequence<0ul>) (/opt/godot/godot-editor-l10n/godot/./core/variant/binder_common.h:308)
[4] void call_with_variant_args<Window, DisplayServer::WindowEvent>(Window*, void (Window::*)(DisplayServer::WindowEvent), Variant const**, int, Callable::CallError&) (/opt/godot/godot-editor-l10n/godot/./core/variant/binder_common.h:418)
[5] CallableCustomMethodPointer<Window, DisplayServer::WindowEvent>::call(Variant const**, int, Variant&, Callable::CallError&) const (/opt/godot/godot-editor-l10n/godot/./core/object/callable_method_pointer.h:105)
[6] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (/opt/godot/godot-editor-l10n/godot/core/variant/callable.cpp:51)
[7] DisplayServerX11::_send_window_event(DisplayServerX11::WindowData const&, DisplayServer::WindowEvent) (/opt/godot/godot-editor-l10n/godot/platform/linuxbsd/x11/display_server_x11.cpp:3775)
[8] DisplayServerX11::process_events() (/opt/godot/godot-editor-l10n/godot/platform/linuxbsd/x11/display_server_x11.cpp:4316)
[9] OS_LinuxBSD::run() (/opt/godot/godot-editor-l10n/godot/platform/linuxbsd/os_linuxbsd.cpp:908)
[10] /opt/godot/godot-editor-l10n/godot/bin/godot.linuxbsd.editor.dev.x86_64.llvm(main+0x1fe) [0x55e79797386e] (/opt/godot/godot-editor-l10n/godot/platform/linuxbsd/godot_linuxbsd.cpp:74)
[11] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f02d7429d90] (??:0)
[12] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7f02d7429e40] (??:0)
[13] /opt/godot/godot-editor-l10n/godot/bin/godot.linuxbsd.editor.dev.x86_64.llvm(_start+0x25) [0x55e7979735a5] (??:?)
-- END OF BACKTRACE --
================================================================
0.mp4

@Sauermann
Copy link
Contributor Author

This crash is also tied to the same issue and gets resolved by #80187.

I have tried to cause the crash on Cinnamon, but even after several minutes of testing and experimenting, I was unable to replicate it.

@Rindbee
Copy link
Contributor

Rindbee commented Aug 8, 2023

Maybe it's due to the better performance of your device. These issues are easier to reproduce with slower builds.

A build compiled with pyston-scons -j4 keeps outputting messages similar to:

ERROR: Unhandled XServer error: BadWindow (invalid Window parameter)
   Major opcode of failed request: 2
   Serial number of failed request: 0
   Current serial number in output stream: 7914
   at: default_window_error_handler (platform/linuxbsd/x11/display_server_x11.cpp:873)

Maybe you can try a slower build, e.g. build with pyston-scons -j4 use_llvm=yes linker=mold use_ubsan=yes use_asan=yes dev_build=yes.

Send mouse-entered/exited window-events only when necessary
@Sauermann Sauermann force-pushed the fix-x11-mouse-window-event-crash branch from 0d54d2b to a7c5849 Compare August 9, 2023 10:20
@Sauermann
Copy link
Contributor Author

Sauermann commented Aug 9, 2023

Finally I was able to track down the crash, that you experience @Rindbee. Updated PR is available.

@akien-mga
Copy link
Member

Did a brief test of the PR on KDE / X11, didn't notice any issue when testing with sub-windows (detached script editor, editor settings, create dialog).

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine, and I didn't notice any obvious regression on KDE / X11.

This code can be tricky though so tests on more DEs / Wayland may be useful.

@akien-mga akien-mga merged commit 49f0d8c into godotengine:master Aug 9, 2023
15 checks passed
@Sauermann Sauermann deleted the fix-x11-mouse-window-event-crash branch August 9, 2023 22:45
@akien-mga
Copy link
Member

Thanks!

@gnuchanos
Copy link

x11 i just add pressed() signal
platform/linuxbsd/x11/display_server_x11.cpp:869 - Unhandled XServer error: BadWindow (invalid Window parameter)
Major opcode of failed request: 2
Serial number of failed request: 0
Current serial number in output stream: 118771
platform/linuxbsd/x11/display_server_x11.cpp:869 - Unhandled XServer error: BadWindow (invalid Window parameter)

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

Successfully merging this pull request may close these issues.

4 participants