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

Godot project manager continuously steals focus on i3 #95824

Closed
voylin opened this issue Aug 19, 2024 · 12 comments · Fixed by #96829
Closed

Godot project manager continuously steals focus on i3 #95824

voylin opened this issue Aug 19, 2024 · 12 comments · Fixed by #96829

Comments

@voylin
Copy link
Contributor

voylin commented Aug 19, 2024

Tested versions

Happens in 4.3, didn't happen in 4.2

System information

Arch Linux, linux-lts kernel, i3-wm

Issue description

https://youtu.be/pEWb0VJnhkQ
I filmed what exactly happens, basically when using the mouse to focus other windows, or my keyboard shortcuts, Godot keeps taking/stealing the focus for itself. There is also quite a lot of lag when using the startup screen of Godot, the focus on buttons and presses takes a long second or 2 to actually register, but I think this might be a separate issue?

Edit: This does not happen when inside a project, only on the project select screen.

Steps to reproduce

Open the editor, and try to use other windows.

Minimal reproduction project (MRP)

Not needed

@Calinou Calinou changed the title Godot stealing focus Godot project manager continuously steals focus on i3 Aug 20, 2024
@Rindbee
Copy link
Contributor

Rindbee commented Aug 24, 2024

After git bisect, it was found that it was a regression introduced by #93682.

@Calinou
Copy link
Member

Calinou commented Aug 25, 2024

cc @dsnopek

@Rindbee
Copy link
Contributor

Rindbee commented Aug 25, 2024

The issue seems to be related to the following code:

godot/scene/gui/line_edit.cpp

Lines 1090 to 1093 in e3550cb

if (has_focus()) {
DisplayServer::WindowID wid = get_window() ? get_window()->get_window_id() : DisplayServer::INVALID_WINDOW_ID;
if (wid != DisplayServer::INVALID_WINDOW_ID && DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_IME)) {
DisplayServer::get_singleton()->window_set_ime_active(true, wid);

has_focus() does not check if the viewport(window) still has focus, and NOTIFICATION_APPLICATION_FOCUS_OUT does not clear gui.key_focus.

This causes the LineEdit to constantly grab focus during NOTIFICATION_DRAW.

@dsnopek dsnopek self-assigned this Aug 26, 2024
@dsnopek
Copy link
Contributor

dsnopek commented Aug 27, 2024

Thanks for the report!

What version of i3 are you using? I'm using v4.22, and can't seem to reproduce the issue.

@bluisblu
Copy link

bluisblu commented Aug 28, 2024

I'm getting this on windows v4.2.2 when importing a ton of assets

@Rindbee
Copy link
Contributor

Rindbee commented Aug 28, 2024

I'm using v4.23, it's easy to reproduce.

@Zireael07
Copy link
Contributor

@Naynuza This is linux AND i3 specific, whatever you're experiencing is not this

@voylin
Copy link
Contributor Author

voylin commented Aug 28, 2024

Thanks for the report!

What version of i3 are you using? I'm using v4.22, and can't seem to reproduce the issue.

I'm using version 4.23-4.
Already updated Godot to the 4.3-3 package and still experiencing the same bug.

@dsnopek
Copy link
Contributor

dsnopek commented Aug 28, 2024

Thanks!

I updated to i3 v4.23 and still can't reproduce it on my main machine, which is Ubuntu 22.04.

However, I just tried in a Fedora 40 VM, and I can reproduce it there! So, that's a start. :-) I'll dig into it and see what I can figure out.

@voylin
Copy link
Contributor Author

voylin commented Aug 28, 2024

However, I just tried in a Fedora 40 VM, and I can reproduce it there! So, that's a start. :-) I'll dig into it and see what I can figure out.

If you need more information or help, feel free to ask ^^

@dsnopek
Copy link
Contributor

dsnopek commented Sep 10, 2024

I just posted PR #96829 which fixes this issue in my testing. Please test and let me know if it works for you!

@voylin
Copy link
Contributor Author

voylin commented Sep 18, 2024

Your PR #96829 seems to fix the issue for me as well ^^

@akien-mga akien-mga added this to the 4.4 milestone Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants