bbidulock / icewm

A window manager designed for speed, usability, and consistency
Other
585 stars 98 forks source link

Alt+Tab while fullscreened in new icewm versions #611

Closed plomari closed 8 months ago

plomari commented 2 years ago

This is about fullscreened windows (Alt+F11), not maximized windows.

Issue 1:

This is weird, I'd expect it to behave like any other non-fullscreened window. The z-order of a window should not change while the window list is shown. It should happen when alt is released and the newly selected window is focused.

Issue 2:

Again, this is weird, and the window's z-order shouldn't change until alt is released.

Suggested behavior: the z-order/focus state of fullscreened windows is changed to be exactly the same as normal windows. Only releasing alt should select the window and move it to highest z-order.

By the way: if you create a non-fullscreened window while a fullscreened window is focused, the z-order of the fullscreened window doesn't change relative to the other windows (except the new window and the task bar have a higher z-order). I think this is correct and good, but inconsistent with alt+tab behavior.

The two issues are changes in recent versions. I don't quite remember whether the behavior was as expected in versions before these changes, but (on a positive note) some related bugs got fixed. I'm using the debian packaged 2.7.0 release (I don't know if it's exactly the same as the release).

plomari commented 2 years ago

PS: I completely missed that even normal windows do get focus during alt+tab, so please ignore the remarks about focus.

gijsbers commented 2 years ago

Yeah, thanks for the reminder. The fullscreen code is not so easy to understand. Notably the code around YWindowManager::updateFullscreenLayerEnable. So there is a tradeoff between fixing and regressions. Without fullscreen windows it should be OK.

gijsbers commented 2 years ago

There were some changes made to the quick switch, as requested by users. See issues #558 and #579.

gijsbers commented 2 years ago

Commit b3d48996dad7590ffb10ce9a0a13b077a812277d removes all the YWindowManager::updateFullscreenLayerEnable code, but at the moment when a fullscreen window is shown and a new window appears, the new window doesn't get input focus. What should happen when this occurs? What do other WMs do?

plomari commented 2 years ago

A new window from a different process? I actually do this often, like when using icewm's alt+tab popup window, or when using a keyboard binding to show a terminal. I'd expect that they get focus, while the fullscreened window is still visible behind the new window. I don't have much experience with other WMs.

Code7R commented 1 year ago

This issue still bothers me even in v3.0. Repro:

So this looks explicitly bad. The issue does not happen when video is not running in fullscreen (i.e. the other window stay below although it's taskbar entry gets highlighted).

Doing the same with Chromium instead of Firefox is also bad, but differently. When quickswitch cursor hits Chromium (in fullscreen playback), the window gets to foreground and covers everything (why? When another window is covering then it should still be visible). And when the cursor jumps to another entry, the fullscreen window goes completely to background (again, why?).

Here the icesh-spy log from Chromium fullscreen video when this happens:


10:04.564: 0x4a00002: Leave Normal Nonlinear Nofocus
10:07.087: 0x4a00002: Enter Normal Nonlinear Nofocus
10:07.741: 0x4a00002: Leave Grab Ancestor Nofocus
10:07.742: 0x4a00002: _NET_WM_STATE = _NET_WM_STATE_FOCUSED
10:07.743: 0x4a00002: Focus Normal Nonlinear
10:07.743: 0x4a00002: Enter Ungrab Ancestor Focus
10:07.744: 0x4a00002: _NET_WM_USER_TIME = 32683313
10:07.895: 0x4a00002: _NET_WM_USER_TIME = 32683467
10:07.988: 0x4a00002: Configure 0x4a00002 2560x1600+0+0
10:07.988: 0x4a00002: _NET_WM_STATE = _NET_WM_STATE_FOCUSED, _NET_WM_STATE_FULLSCREEN
10:07.989: 0x4a00002: _WIN_LAYER = 14
10:07.989: 0x4a00002: WM_NORMAL_HINTS PPos(326,461) MinSize(485,32)
10:08.012: 0x4a00002: Visibility PartiallyObscured 
10:08.969: 0x4a00002: Leave Normal Nonlinear Focus
10:09.597: 0x4a00002: _NET_WM_STATE = _NET_WM_STATE_FULLSCREEN
10:09.598: 0x4a00002: _WIN_LAYER = 4
10:09.598: 0x4a00002: Defocus Normal Nonlinear
10:12.511: 0x4a00002: Visibility Unobscured 
10:15.804: 0x4a00002: _NET_WM_STATE = _NET_WM_STATE_FOCUSED, _NET_WM_STATE_FULLSCREEN
10:15.806: 0x4a00002: _WIN_LAYER = 14
10:15.810: 0x4a00002: Focus WhileGrabbed Nonlinear
10:18.426: 0x4a00002: _NET_WM_STATE = _NET_WM_STATE_FULLSCREEN
10:18.430: 0x4a00002: _WIN_LAYER = 4
10:18.430: 0x4a00002: Defocus WhileGrabbed Nonlinear
10:18.430: 0x4a00002: Visibility FullyObscured 
10:21.303: 0x4a00002: _NET_WM_STATE = _NET_WM_STATE_FOCUSED, _NET_WM_STATE_FULLSCREEN
10:21.306: 0x4a00002: _WIN_LAYER = 14
10:21.306: 0x4a00002: Focus WhileGrabbed Nonlinear
10:21.306: 0x4a00002: Visibility Unobscured 
10:22.372: 0x4a00002: Focus Ungrab Nonlinear
10:23.593: 0x4a00002: _NET_WM_USER_TIME = 32699164
10:24.406: 0x4a00002: Defocus Grab Ancestor
10:24.406: 0x4a00002: Visibility PartiallyObscured 
10:24.407: 0x4a00002: _NET_WM_STATE = _NET_WM_STATE_FULLSCREEN
10:24.411: 0x4a00002: _WIN_LAYER = 4
10:24.411: 0x4a00002: Defocus WhileGrabbed Nonlinear
10:24.411: 0x4a00002: Visibility FullyObscured 
10:25.300: 0x4a00002: _NET_WM_STATE = _NET_WM_STATE_FOCUSED, _NET_WM_STATE_FULLSCREEN
10:25.308: 0x4a00002: _WIN_LAYER = 14
10:25.308: 0x4a00002: Focus WhileGrabbed Nonlinear
10:25.308: 0x4a00002: Visibility Unobscured 
10:25.436: 0x4a00002: Focus Ungrab Nonlinear
10:26.826: 0x4a00002: _WIN_LAYER = 4
10:26.827: 0x4a00002: _NET_WM_STATE = _NET_WM_STATE_FULLSCREEN
10:26.827: 0x4a00002: Defocus Normal Nonlinear
gijsbers commented 1 year ago

If it is focused and it has the fullscreen bit set in _NET_WM_STATE then it is raised, which shows as _WIN_LAYER = 14. I assume that if Firefox is defocused, that it gets layer 4 and is put at the bottom of the layer=4 stack. To learn about stacking, observe the _NET_WM_WINDOW_TYPE, the _NET_WM_STATE and the _WIN_LAYER in all involved applications. Also the _NET_CLIENT_LIST_STACKING property on the root window (desktop) should reflect everything (maybe not fullscreen?). Receiving focus usually (settings) means go to top of the layer. Defocus means bottom of layer.

gijsbers commented 1 year ago

@plomari This issue may have been solved. What is your opinion?

plomari commented 1 year ago

@gijsbers I tried 3.3.1. Should be the latest release. The behavior doesn't seem to have changed.

To summarize it (and this is probably the same as my first post, but more concise): while cycling through the window list with alt+tab, the fullscreened window gets the highest z-order when you switch to it, and the lowest z-order when you switch away.

How it should work: the fullscreen behaves like a normal window, as far as z-order is concerned.

I normally don't fullscreen browser windows, and I don't use multiple monitors. I don't know if anything changed in Code7R's case.

gijsbers commented 1 year ago

I looked into it and it is just very complicated to do.

plomari commented 1 year ago

I understand. The behavior is a bit inconvenient, but it's not a deal breaker. Maybe something to keep in mind when that code gets touched again.

gijsbers commented 1 year ago

I was wondering if focusing a candidate is really needed. If the focusing could be omitted then it may be easy.

plomari commented 1 year ago

If by focus you mean real focus (X11 level - keyboard input? application program logic?) then maybe it's not. Of course the window should still be highlighted when cycling through the window list. The real issue is that cycling through the window list - when a fullscreen window is in focus - puts other windows on top. Although it seems convenient, I could do without it, if the issue at hand is fixed.

To summarize... Before: if you start alt+tab while you see a fullscreen window, you can actually see the windows you switch to (because then fullscreen window is lowered in z-order) After: you can't see the window you switch to, only the icewm window list.

gijsbers commented 1 year ago

There may be one easy solution after all. In src/wmswitch.cc add this is the first line of the function void changeFocusTo(ZItem to):

    YFullscreenLock lock;

Consider this change for either setting of QuickSwitchRaiseCandidate.

gijsbers commented 1 year ago

I believe this addresses your issue.

plomari commented 1 year ago

Thanks, sorry for taking a while to test this. It fixes issue 2, but not 1. That means everything seems OK, except tabbing out from a fullscreened window (while not releasing the tab key) puts all other windows on top of it.

gijsbers commented 1 year ago

Issue 1 looks difficult to fix. I think we just need to accept this as an icewm-ism.