joewing / jwm

Joe's Window Manager
http://joewing.net/projects/jwm
MIT License
531 stars 86 forks source link

Bug with native fullscreen games #339

Open mac1202 opened 8 years ago

mac1202 commented 8 years ago

Hi i got a problem with steam and native games, here s a link to a video made by another guy but the bug is the same. Tested on current git and 2.3.6.

technosaurus commented 8 years ago

could you elaborate?

mac1202 commented 8 years ago

Fullscreen games arent properly managed by jwm. On my htpc i launch kodi, then steam in fullscreen big picture then games in fullscreen. The game doesnt show up on top, and using alt+tab doesnt work in only affecting kodi bringing it on top but steam and games are ignored. Sometime the games come in top but It doesnt have focus so gamepad input are ignored.

joewing commented 8 years ago

I’m not sure if SDL is involved, but it might be the same as #101.

mac1202 commented 8 years ago

Don't know but in the other issue you mention that openbox have the same issue. Concerning steam games I ve used openbox previously and never had issue with it. Edit if I launch steam big picture in windowed mode the game start in foreground and I can play it. But if I press alt+tab the game disapear behind the other program and cannot be bring back in foreground.

joewing commented 8 years ago

Things might have changed since I last looked into this (I can’t verify as I don’t have Steam, but it looks like the same or at least a related problem).

Assuming the issue is the same, the underlying cause was that the game changes the display settings (resolution most likely). This causes an event to be delivered to JWM indicating that the resolution has changed. JWM then restarts so that it can resize trays properly, etc. When JWM restarts, it re-queries all the windows, including the game window. Unfortunately, the game window doesn’t have any indication that it wants to be full screen or on top of other windows, so JWM reparents the window (potentially resizing and/or moving it) and displays it as a normal window.

If you can get me the properties set on the window (run xprop from a terminal and click on the window), maybe there’s some way to determine that the window wants to be full screen. If so, I can make it work. Otherwise, I don’t know of a clean solution.

If there is (still) no obvious way to determine that the window wants to be fullscreen, one option would be to make JWM’s handling of the XRandR events a compile-time option. The reason JWM handles these events is because they may indicate that a laptop was connected to an external monitor or that a screen was rotated. If you don’t need that ability, JWM could just ignore the events and everything should work. If you want to try that out, you can recompile JWM with lines 761 through 766 of event.c commented out.

A possible work-around would be to change to the display settings that the game desires before starting the game, which may or may not work since the game may resize the display multiple times (for a splash screen or whatever).

mac1202 commented 8 years ago

I will try the xprop thing. I play on my tv so games are set to display at native resolution of my tv. Don't thing resolution change occurs because when the resolution or refresh rate change i got a popup on top corner of the tv that show the new resolution edit : here's the xprop output

mac1202 commented 8 years ago

Any more useful info in can provide ?

joewing commented 8 years ago

Thanks, the output of xwininfo -all might be useful too.

A couple of interesting things I noticed. One in particular is that WM_NORMAL_HINTS appears to have the same min/max size, which I assume match size of your display (1366x768)?

WM_NORMAL_HINTS(WM_SIZE_HINTS):
        user specified location: 341, 192
        program specified minimum size: 1366 by 768
        program specified maximum size: 1366 by 768

Using the min/max size might be good enough for JWM to assume a fullscreen application. If the size of your display matches, that means that window does not want to be resized and would take up the whole screen anyway, so why not just make it a full screen application.

Also, _NET_WM_BYPASS_COMPOSITOR(CARDINAL) = 1, which would imply that perhaps the application wants to be fullscreen, but probably isn’t sufficient.

Finally, it appears that the window is minimized (according to WM_STATE and _NET_WM_STATE). I’m not sure if that’s because JWM minimized it for some reason or if it actually set those properties. If it set those properties, that could be annoying, though that might be in response to JWM reparenting the window (which would be avoided if the window were treated as fullscreen).

In any case, I think the thing to do is to check if the application has a fixed size that matches the size of the root window, and treat the window as fullscreen if so. I’ll give that a shot.

joewing commented 8 years ago

Snapshot 1563 might help with this (though it probably won’t work for multi-display setups).

mac1202 commented 8 years ago

Didn't see an improvement with the latest commit. Here the output of xwinfo

joewing commented 8 years ago

From the output of xwininfo, it looks like it's working (it’s mapped, marked fullscreen, has the right size, and is positioned at 0, 0). It also appears to have input focus. So is the problem keyboard input or?

mac1202 commented 8 years ago

Sorry it's not easy to describe. After some more testing the input focus seems to be fixed. The remaining issue is when I have a fullscreen app (steam or game) if i use alt+tab to switch to another window, the fullscreen app stay in background. Clicking on it or using alt+tab doesnt bring it on top of other windows. The only way to regain access to it it s to minimize all the others windows. And when you have several app in fullscreen it's a mess :)

joewing commented 8 years ago

JWM doesn’t minimize or otherwise hide full screen applications when switching away from them (though maybe it should?), but it should pull it to the front if you click or alt+tab back to it. This works for me with multiple fullscreen xterms (ctrl+left click, select full screen... even xterm gets this right!).

Are your xprop and xwininfo -all results from when the program was focused or not focused? Would it be possible to get output when the window is not working?

mac1202 commented 8 years ago

I join the output of xprop and xwininfo -all of steam in fullscreen mode stuck behind my terminal window after I use alt+tab. xprop.txt xwinfo.txt

funghetto commented 7 years ago

I have a similar problem, when I start Counter Strike Global Offensive and alt-tab the application becomes "inaccessible", even its entry on the panel disappeared

XPROP.txt XWININFO.txt

. csgo