godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.92k stars 20.17k forks source link

Godot project manager continuously steals focus on i3 #95824

Open voylin opened 3 weeks ago

voylin commented 3 weeks ago

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

Rindbee commented 3 weeks ago

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

Calinou commented 3 weeks ago

cc @dsnopek

Rindbee commented 3 weeks ago

The issue seems to be related to the following code:

https://github.com/godotengine/godot/blob/e3550cb20f5d6a61befaafb7d9cbdb57b24870e4/scene/gui/line_edit.cpp#L1090-L1093

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 commented 2 weeks ago

Thanks for the report!

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

Naynuza commented 2 weeks ago

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

Rindbee commented 2 weeks ago

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

Zireael07 commented 2 weeks ago

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

voylin commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

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 commented 4 days ago

I just posted PR https://github.com/godotengine/godot/pull/96829 which fixes this issue in my testing. Please test and let me know if it works for you!