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 4 editor window disappears on BSPWM tilling manager when changing the workspace #68471

Closed
Evimilly opened this issue Nov 10, 2022 · 26 comments

Comments

@Evimilly
Copy link

Godot version

v4.0.beta4.official [e675154]

System information

ArchLinux, BSPWM

Issue description

When i open the Godot 4.0 editor using BSPWM tiling window manager sometimes when switching between workspaces Godot editor window disappears.
It seems to happen more often when there's another window open on the same workspace as the editor.
Reproducible on beta 1, 2 and 4, didn't test on beta 3.
Reproducible on old alpha Godot 4.0 build (alpha 5).
Can't reproduce it on other TWM's like sway.
Never had this problem on 3.x, works as expected on 3.5.1
https://user-images.githubusercontent.com/28687947/201021555-70ac4d4e-36a4-46f8-8e4e-50d6cef18d62.mp4

Steps to reproduce

  1. Open the editor
  2. Rapidly switch a workspace from where Godot window is located to another and back
  3. Window should disappear after awhile.

Minimal reproduction project

Not needed, can be reproduced on startup or/and on a new empty project.

@permelin
Copy link
Contributor

I have a similar issue #65425 with the XMonad tiling window manager, but in my case Godot crashes and terminates. There's clearly a race condition when the Godot window is hidden/shown. And it doesn't just happen to the editor but also games.

@Evimilly
Copy link
Author

Tried other TWM's, here are the results:
sway (1:1.7) - can't reproduce
dwm (6.3-1) - can't reproduce
awesome (4.3) - can't reproduce
i3 (4.21.1) - can't reproduce
XMonad (0.17.1 & 0.17.0) - can't reproduce
Seems to be a BSPWM issue.

@Calinou
Copy link
Member

Calinou commented Nov 16, 2022

Can you reproduce this when starting the editor with the --single-window command line argument? Note that starting the project manager with this argument won't carry it over to the editor, so you have to enable the Single Window Mode editor setting instead if you're going through the project manager.

@Evimilly
Copy link
Author

v4.0.beta5.official [89a33d2]
./Godot_v4.0-beta5_linux.x86_64 --single-window or/and interface/editor/single_window_mode property enabled
Still reproducible.

@ryze312
Copy link

ryze312 commented Dec 11, 2022

For me it's seems to be happening only when sending Godot to a different workspace using
bspc node -d {1-9}

@ryze312
Copy link

ryze312 commented Dec 12, 2022

The problem seems to be with the order of events sent by BSPWM.

When changing workspaces, it sets WM_STATE_NORMAL and sends MapNotify before sending ConfigureNotify, causing wd.minimized to have an outdated value (true), while _window_minimize_check returns proper value (false) , since it checks for WM_STATE_ICONIC

} else if (wd.minimized && !_window_minimize_check(p_window)) {
_set_wm_minimized(p_window, true);
}

This causes execution of _set_wm_minimized, which tells BSPWM to hide window, by setting it's internal hidden flag to 1

node_flag 0x00200006 0x0020000D 0x02E00003 hidden on

Logs with DISPLAY_SERVER_X11_DEBUG_LOGS_ENABLED and my additions to monitor this two values show, that indeed is the case

[471] MapNotify window=48234499 (0) 
MAP VALIDATE:
wd.minimized: true
minimize_check: false
[471] VisibilityNotify window=48234499 (0), state=0 
[471] Expose window=48234499 (0), count='0' 
[471] FocusIn window=48234499 (0), mode='3' 
[471] EnterNotify window=48234499 (0), mode='0' 
[471] ConfigureNotify window=48234499 (0), event=48234499, above=37748750, override_redirect=0 
WINDOW CHANGED:
wd.minimized: 1

This could be fixed by working around and calling _window_changed before mode validation here

// Have we failed to set fullscreen while the window was unmapped?
_validate_mode_on_map(window_id);

Or by calling show_desktop after stack in the focus_node in BSPWM source code

if (m->desk != d) {
    show_desktop(d);
    set_input_focus(n);
    has_input_focus = true;
    hide_desktop(m->desk);
    m->desk = d;
}

// ...

stack(d, n, true);
// <-- Somewhere here 
	 

@ryze312
Copy link

ryze312 commented Dec 13, 2022

Just adding _window_changed is not enough. Looking at _validate_mode_on_map it seems, that it only applies window properties to true. Why is that?

if (wd.fullscreen && !_window_fullscreen_check(p_window)) {
_set_wm_fullscreen(p_window, true, wd.exclusive_fullscreen);
} else if (wd.maximized && !_window_maximize_check(p_window, "_NET_WM_STATE")) {
_set_wm_maximized(p_window, true);
} else if (wd.minimized && !_window_minimize_check(p_window)) {
_set_wm_minimized(p_window, true);
}

Shouldn't there be a check like this?

bool desiredFullscreen = _window_fullscreen_check(p_window);
bool desiredMaximized = _window_maximize_check(p_window, "_NET_WM_STATE");
bool desiredMinimized = _window_minimize_check(p_window);

if (wd.fullscreen != desiredFullscreen) {
	_set_wm_fullscreen(p_window, desiredFullscreen, wd.exclusive_fullscreen);
} else if (wd.maximized != desiredMaximized) {
	_set_wm_maximized(p_window, desiredMaximized);
} else if (wd.minimized != desiredMinimized) {
	_set_wm_minimized(p_window, desiredMinimized);
}

@ana-rchy
Copy link
Contributor

is there any workaround to this for now? its very tedious having to manually find and kill off the right godot process and reopen my project just to start working on it again every 5-10 mins

@wnelson01
Copy link

is there any workaround to this for now? its very tedious having to manually find and kill off the right godot process and reopen my project just to start working on it again every 5-10 mins

#69995 seemed to have fixed it for me

mxnemu pushed a commit to mxnemu/godot that referenced this issue Jun 5, 2023
The default behaviour for X11 is to crash even on non-fatal errors
when there is no error handler set. This change allows the window to
stay open and may enable users to save their work when things go
wrong.

This acts as a workaround for godotengine#65425 and godotengine#68471
@ana-rchy
Copy link
Contributor

ana-rchy commented Jun 18, 2023

is this still gonna be worked on? the issue persists in the current godot version

@wearepixelated
Copy link

Confirmed - v4.0.3 on bspwm, switching the active workspace, still blackholes the Editor

@ana-rchy
Copy link
Contributor

Confirmed - v4.0.3 on bspwm, switching the active workspace, still blackholes the Editor

same with latest master branch compile (v4.1 beta), which includes a commit that conflicts with ryze312's branch

@ana-rchy
Copy link
Contributor

latest master branch + accepting ryze312's commits for merging fixes the issue

@YuriSizov YuriSizov modified the milestones: 4.1, 4.2 Jun 26, 2023
@ana-rchy
Copy link
Contributor

ana-rchy commented Jul 6, 2023

latest master branch + accepting ryze312's commits for merging fixes the issue

nvm

@AntonioDell
Copy link
Contributor

AntonioDell commented Jul 14, 2023

The issue also happens on Pop Shell (an i3-like tiling window management in Pop OS) and can be reproduced reliably like this:

  1. Enable windows tiling (SUPER+Y or from the default app bar)
  2. From any project, click "Run Project" (F5)
  3. Move the running project window to a different workspace (SUPER+Shift+Down)
  4. Close the running project window and return to the workspace with the editor (SUPER+Cmd+Up)
  5. The editor window is minimized and cannot be made to stay open anymore when focusing it

I found one workaround which let's me quickly solve the issue again:

  1. Follow instructions above to reproduce the issue
  2. Open another Godot instance, such that a new Godot Project window opens on the same workspace, where the buggy editor is
  3. Focus the buggy editor window (SUPER key to open the launcher and navigate with arrow buttons to the editor then click Enter)
  4. Close the new Godot Project window again
  5. The editor window will stay open

Hopefully this helps in tackling this annoying issue.

@ana-rchy
Copy link
Contributor

The issue also happens on Pop Shell (an i3-like tiling window management in Pop OS) and can be reproduced reliably like this:

1. Enable windows tiling (SUPER+Y or from the default app bar)

2. From any project, click "Run Project" (F5)

3. Move the running project window to a different workspace (SUPER+Shift+Down)

4. Close the running project window and return to the workspace with the editor (SUPER+Cmd+Up)

5. The editor window is minimized and cannot be made to stay open anymore when focusing it

I found one workaround which let's me quickly solve the issue again:

1. Follow instructions above to reproduce the issue

2. Open another Godot instance, such that a new Godot Project window opens on the same workspace, where the buggy editor is

3. Focus the buggy editor window  (SUPER key to open the launcher and navigate with arrow buttons to the editor then click Enter)

4. Close the new Godot Project window again

5. The editor window will stay open

Hopefully this helps in tackling this annoying issue.

can confirm this works on latest AUR release of godot-mono-bin on bspwm, this some black magic shit

@Evimilly Evimilly closed this as completed Aug 1, 2023
@Evimilly
Copy link
Author

Evimilly commented Aug 1, 2023

Accidentally closed the issue, sorry.

@Evimilly Evimilly reopened this Aug 1, 2023
@Lense
Copy link

Lense commented Aug 8, 2023

With Godot 4.1.1 and bspwm, a temp fix is unsetting the node's hidden value: bspc node any.hidden -g hidden=off (sometimes I have to run that twice)

@andro404-MC
Copy link

With Godot 4.1.1 and bspwm, a temp fix is unsetting the node's hidden value: bspc node any.hidden -g hidden=off (sometimes I have to run that twice)

Thank you for the workaround, it's enough for me, but this issue should be fixed.

@Evimilly
Copy link
Author

Evimilly commented Oct 18, 2023

I can't seem to reproduce the issue anymore, can anyone else check if they're still experiencing it? Maybe other TWM's are still plagued by the issue?
On Godot 4.1.2 stable the issue is reproducible.
BSPWM 0.9.10-3 from Arch repos
Godot latest git compiled (7f884b4)
scons p=linuxbsd target=editor tools=yes optimize=speed use_lto=yes use_llvm=yes linker=mold -j12

@permelin
Copy link
Contributor

Just tried it on a fresh git pull. I'm using the XMonad window manager and Godot used to randomly crash when switching workspaces. Not anymore. The error that caused the crash now seems to be caught and logged instead.

Switching between workspaces will now sometimes show this in the editor's console:

  platform/linuxbsd/x11/display_server_x11.cpp:887 - Unhandled XServer error: BadMatch (invalid parameter attributes)
     Major opcode of failed request: 42
     Serial number of failed request: 0
     Current serial number in output stream: 29854

That error is what I used to see in gdb/lldb when it crashed before.

@permelin
Copy link
Contributor

#75099 seems to be what fixed it for me. But that was merged already in 4.1 so if you still had the problem in 4.1.2 then that can't be relevant for you.

@ana-rchy
Copy link
Contributor

ana-rchy commented Oct 19, 2023

#75099 seems to be what fixed it for me. But that was merged already in 4.1 so if you still had the problem in 4.1.2 then that can't be relevant for you.

i can now move godot windows to a different workspace, but if i am loading up godot or a project, and switch workspaces while thats happening, the window becomes hidden

@YuriSizov YuriSizov modified the milestones: 4.2, 4.3 Nov 15, 2023
@Evimilly
Copy link
Author

#75099 seems to be what fixed it for me. But that was merged already in 4.1 so if you still had the problem in 4.1.2 then that can't be relevant for you.

i can now move godot windows to a different workspace, but if i am loading up godot or a project, and switch workspaces while thats happening, the window becomes hidden

Can you please try it on stable 4.2? It is fixed for me, so if you don't have any issues either I'm closing this issue.

@AntonioDell
Copy link
Contributor

AntonioDell commented Dec 1, 2023

I cannot trigger the behavior anymore in 4.2 by following my previously posted procedure. So it seems to be fixed.
Very happy about that :D

@Evimilly
Copy link
Author

Evimilly commented Dec 7, 2023

Well, it's fixed for me on Godot 4.2.
As there have been no reports saying otherwise from anyone else, I'm closing this issue.

@Evimilly Evimilly closed this as completed Dec 7, 2023
@AThousandShips AThousandShips modified the milestones: 4.3, 4.2 Dec 7, 2023
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.