You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reproducible in Godot master (9d1cbab), Godot v4.2.1 and v4.1.3
(I've had this problem on all Godot 4.x versions since switching to i3 -- I used to use notion, another tiling window manager, but I don't recall if it had the same problem)
System information
Ubuntu 22.04, X11 with i3 window manager
Issue description
I have Godot configured to use VS Code as an external editor. When Godot opens VS Code, most of the time (like 1% of the time this doesn't happen), it refuses to give up input focus, even though VS Code's title bar is highlighted in the way that usually indicates that it has input focus (and Godot's is greyed out in the way that usually indicates it doesn't have input focus).
So, if I press any keys, including shortcuts, they are received by Godot rather than VS Code. This happens when Godot and VS Code are on the same screen, or on different screens. (When on different screens, it's very easy to see that my keyboard input is really going to Godot, because I can see my actions happening there.)
In order to get VS Code to have focus, I need to first switch focus back to Godot, and then switch again to VS Code (either using the mouse, or the i3 keyboard shortcuts that I have configured). Sometimes I have to do this more than once, although, usually once will do it.
(Note: switching to single window mode makes no difference, in fact, I usually have the editor in single window mode because there's other weirdnesses with i3 without single window mode.)
(Note 2: this problem doesn't happen for me with Godot 3 -- only with Godot 4.)
This seems sort of similar to these other X11 input focus issues:
However, it's not exactly the same, and, unfortunately, the PRs that fix those issues for others don't seem to fix my issue. :-/ So, I've decided to make a new issue here!
When I try using Gnome instead (on the same computer with the same Godot, VS Code and configurations of them both), this problem doesn't happen. When the external editor is opened by Godot in Gnome, it immediately has input focus and receives my key presses.
Steps to reproduce
Start a session with the i3 window manager
Open a Godot project
Change your editor settings to use VS Code as an external editor
Click the "Open Script" icon next to a node in your scene tree
After VS Code opens and it's title bar is highlighted blue and Godot's title bar is greyed out (indicating the VS Code should have focus and Godot should not), press some keys and see that Godot is receiving them rather than VS Code (this is easiest to see with shortcuts like Ctrl+N)
Minimal reproduction project (MRP)
n/a - this isn't project specific
The text was updated successfully, but these errors were encountered:
I did a little bit more investigation and it turns out that the problem goes away if I comment out the XSetInputFocus() line in this code in DisplayServerX11::process_events():
if (event.type == ButtonPress) {
DEBUG_LOG_X11("[%u] ButtonPress window=%lu (%u), button_index=%u \n", frame, event.xbutton.window, window_id, mb->get_button_index());
// Ensure window focus on click.
// RevertToPointerRoot is used to make sure we don't lose all focus in case
// a subwindow and its parent are both destroyed.
if (!wd.no_focus && !wd.is_popup) {
XSetInputFocus(x11_display, wd.x11_window, RevertToPointerRoot, CurrentTime);
}
If I were to guess, it seems like clicking the "Open Script" icon leads to setting the input focus to Godot, but that message is somehow received or acted upon later, after VS Code has already opened, leading to input focus snapping back to Godot.
I wonder if maybe we should check if the window we are clicking is already focused, and if so, don't bother setting it to be the input focus again?
If I were to guess, it seems like clicking the "Open Script" icon leads to setting the input focus to Godot, but that message is somehow received or acted upon later, after VS Code has already opened, leading to input focus snapping back to Godot.
I wonder if maybe we should check if the window we are clicking is already focused, and if so, don't bother setting it to be the input focus again?
I just posted PR #86671 which does this, and it fixes the issue for me!
Tested versions
Reproducible in Godot
master
(9d1cbab), Godot v4.2.1 and v4.1.3(I've had this problem on all Godot 4.x versions since switching to i3 -- I used to use notion, another tiling window manager, but I don't recall if it had the same problem)
System information
Ubuntu 22.04, X11 with i3 window manager
Issue description
I have Godot configured to use VS Code as an external editor. When Godot opens VS Code, most of the time (like 1% of the time this doesn't happen), it refuses to give up input focus, even though VS Code's title bar is highlighted in the way that usually indicates that it has input focus (and Godot's is greyed out in the way that usually indicates it doesn't have input focus).
So, if I press any keys, including shortcuts, they are received by Godot rather than VS Code. This happens when Godot and VS Code are on the same screen, or on different screens. (When on different screens, it's very easy to see that my keyboard input is really going to Godot, because I can see my actions happening there.)
In order to get VS Code to have focus, I need to first switch focus back to Godot, and then switch again to VS Code (either using the mouse, or the i3 keyboard shortcuts that I have configured). Sometimes I have to do this more than once, although, usually once will do it.
(Note: switching to single window mode makes no difference, in fact, I usually have the editor in single window mode because there's other weirdnesses with i3 without single window mode.)
(Note 2: this problem doesn't happen for me with Godot 3 -- only with Godot 4.)
This seems sort of similar to these other X11 input focus issues:
However, it's not exactly the same, and, unfortunately, the PRs that fix those issues for others don't seem to fix my issue. :-/ So, I've decided to make a new issue here!
When I try using Gnome instead (on the same computer with the same Godot, VS Code and configurations of them both), this problem doesn't happen. When the external editor is opened by Godot in Gnome, it immediately has input focus and receives my key presses.
Steps to reproduce
Minimal reproduction project (MRP)
n/a - this isn't project specific
The text was updated successfully, but these errors were encountered: