ch11ng / exwm

Emacs X Window Manager
2.85k stars 136 forks source link

Some fullscreen games have a black window on top #565

Open Ambrevar opened 5 years ago

Ambrevar commented 5 years ago

When starting some video games full screen, the game

Because the input is captured, it is often not possible to move the black window. Thus those games are unplayable fullscreen with EXWM. I've tried in StumpWM and they work alright.

A work-around is to run the game in "windowed" mode, if supported.

I can produce this issue with Arx Libertatis (you'll need the original game data to play) and Streets of Rage Remake (available for free on Arch Linux and Guix at least).

Ambrevar commented 5 years ago

Some EXWM data:

exwm-window-type nil
exwm--mwm-hints-decorations t
exwm--hints-input t
exwm-transient-for nil
exwm--fixed-size t
ch11ng commented 5 years ago

I downloaded Arx Libertatis with its English demo data and managed to reproduce this issue. I noticed with (setq exwm-manage-force-tiling t) (or exwm-manage-configurations for finer granularity) the problem disappears so this seems to be a problem with floating X windows. I have not found much differences except for a slightly different geometry, an additional floating frame, some irrelevant properties set/unset. Also Arx Libertatis itself does not give much log even started with -g debug.

Perhaps this is a common problem when running SDL programs on EXWM. Could you confirm if exwm-manage-configurations works for sorr (my system lacks lots of share libs) and wine programs?

Ambrevar commented 5 years ago

Thanks for looking into this!

Perhaps this is a common problem when running SDL programs on EXWM.

Could be.

Could you confirm if exwm-manage-configurations works

What do you mean? Which value?

for sorr (my system lacks lots of share libs) and wine programs?

If you can install Guix (you can install it on any GNU/Linux distribution), then SORR will run out of the box.

I tried running SORR with (setq exwm-manage-force-tiling t) and it does not create the black window, but it does not stretch the window to fullscreen.

If I run exwm-layout-toggle-fullscreen, then the SORR window occupies the fullscreen, but since the game runs in 640x480 unstretched, it's rendered in the top left corner and the rest of the screen is black.

ch11ng commented 5 years ago

Could you confirm if exwm-manage-configurations works

What do you mean? Which value?

I meant forcing the X windows tiling (or simply with exwm-manage-force-tiling just forget about it).

for sorr (my system lacks lots of share libs) and wine programs?

If you can install Guix (you can install it on any GNU/Linux distribution), then SORR will run out of the box.

Thanks for the info. I just tried until it started to download kernel. Perhaps something went wrong with my installation.

I tried running SORR with (setq exwm-manage-force-tiling t) and it does not create the black window, but it does not stretch the window to fullscreen.

If I run exwm-layout-toggle-fullscreen, then the SORR window occupies the fullscreen, but since the game runs in 640x480 unstretched, it's rendered in the top left corner and the rest of the screen is black.

I noticed SDL programs don't go full screen the normal way by installing the _NET_WM_STATE_FULLSCREEN property. I seems they always assume WMs will respect their choices of window geometry.

Speaking of SORR, have you noticed anything special set on its window?

Ambrevar commented 5 years ago

Chris Feng notifications@github.com writes:

Thanks for the info. I just tried until it started to download kernel. Perhaps something went wrong with my installation.

You mean linux-libre? Maybe it's a build dependency for something else. Leave it be until it finishes. If space is your concern, you can clean up the store once you've got SORR installed with

guix gc

What's your distribution?

Speaking of SORR, have you noticed anything special set on its window?

What do you mean? With xprop?

ch11ng commented 5 years ago

Got it. I'm running Debian Sid.

What do you mean? With xprop?

Yes, and perhaps others tools you can think of.

Ambrevar commented 5 years ago

Here is the xprop for SORR:

_NET_WM_STATE(ATOM) = 
_NET_WM_ICON_NAME(UTF8_STRING) = 
WM_ICON_NAME(STRING) = 
_NET_WM_NAME(UTF8_STRING) = "Streets of Rage Remake - v5.1"
WM_NAME(STRING) = "Streets of Rage Remake - v5.1"
_NET_WM_DESKTOP(CARDINAL) = 0
WM_STATE(WM_STATE):
        window state: Normal
        icon window: 0x0
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE
WM_NORMAL_HINTS(WM_SIZE_HINTS):
        user specified location: 0, 0
        program specified minimum size: 640 by 480
        program specified maximum size: 640 by 480
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW
WM_CLIENT_MACHINE(STRING) = "bababa"
_NET_WM_PID(CARDINAL) = 16283
WM_CLASS(STRING) = "bgdi", "bgdi"
WM_HINTS(WM_HINTS):
        Client accepts input or input focus: True
        bitmap id # to use for icon: 0x2a00018
        bitmap id # of mask for icon: 0x2a00016

Something else: when SORR exists, every key/mouse press produces lines of noise on the screen (the look like interference or distortions on good ol' VHS).

ch11ng commented 5 years ago
  program specified minimum size: 640 by 480
  program specified maximum size: 640 by 480

This basically tells WMs never to resize it into something other than 640x480.

I'll try to investigate issues with SDL applications when I get some time in early May.

Ambrevar commented 5 years ago

Thanks!

-- Pierre Neidhardt https://ambrevar.xyz/

ch11ng commented 5 years ago

I've finally reproduced the full screen issue with SORR on a 32-bit virtual machine. It appears other tiling/stacking/compositing WMs also suffer from it. In all cases SORR creates a useless X window but always has its content rendered at top-left not scaled. Could you tell me which WM works with SORR (perhaps with some workarounds)?

Ambrevar commented 5 years ago

Thanks for looking into this. SORR works with AwesomeWM and I'm pretty sure it works with StumpWM.

ch11ng commented 5 years ago

The result seems to be the same with awesomewm. Perhaps you made some tweaks? I've not got stumpwm working on this VM though.

Ambrevar commented 5 years ago

Just tried again with vanilla StumpWM: SORR goes fullscreen like a charm with no config. I can't test on AwesomeWM right now.

ch11ng commented 5 years ago

I have no much understanding about SDL yet but is it possible that SDL circumvents nearly all X stuffs and draws on the screen directly? So the problem would be how SDL detects the screen size and how to correct it.

Ambrevar commented 5 years ago

Yes, it's possible. I've tried with AwesomeWM: it also goes fullscreen properly on a vanilla config. So far I could only produce this issue with EXWM.

ch11ng commented 5 years ago

This is strange. I tested on a Ubuntu 16.04 i386 virtual machine and SORR just won't scale. Perhaps there are other system-specific configs involved. Would you make a VM image for this (preferably one runs on KVM) so I can reproduce it locally?

Ambrevar commented 5 years ago

I suspect the VM to be the culprit. I've successfully run SORR on a number of different hardware (4 off the top of my head) and distributions (3 or 4).

What's your OS?

You can run SORR on a x64 system too (that's what I do). There is an Arch Linux package and a Guix package. You can install Guix (Guix is awesome!) on any distribution, thus installing SORR is as simple as

guix install streets-of-rage-remake

Let me know if you need help.

ch11ng commented 5 years ago

Sorry but I got no time (re)trying Guix yet. I will report back once I get it working.

The multiarch mechanism of my system (Debian) does not allow installing different architectures of the same library simultaneously IIUC. That's why I tried a virtual machine.

Ambrevar commented 5 years ago

If I'm not mistaken Debian puts x86 libs into /lib32 and x86_64 libs into /lib. I believe it is possible to install multiarch libs at the same time.

A quick search gave me this: https://wiki.debian.org/Multiarch/HOWTO

ch11ng commented 5 years ago

Sorry I actually meant 'binaries'. I remember there was some 32-bit binaries involved when resolving dependencies (which is strange).

Ambrevar commented 5 years ago

Which dependencies and where did you install it from?

ch11ng commented 5 years ago

Finally got SORR running on my system after cross-compiling all missing libs. Unfortunately the game runs full height so the problem doesn't seem to be present here. I also tried other WMs and the results seem to be the same. Any ideas?

ch11ng commented 5 years ago

Also I noticed there was a step asking me to choose which mode (some combinations of fast/slow normal/fullscreen I think) to run SORR in but I can't figure out where to reconfigure it. Cleaning up local cache doesn't seem to help. Does this matter?

Ambrevar commented 5 years ago

Hmm, this is strange.

So maybe this has to do with Xorg version. I run 1.20.4, basically I'm following upstream on Guix.

Also I noticed there was a step asking me to choose which mode (some combinations of fast/slow normal/fullscreen I think) to run SORR in but I can't figure out where to reconfigure it. Cleaning up local cache doesn't seem to help. Does this matter?

I don't think the settings matter. You can change them anytime in the "Video" options.

The settings are saved in savegame.sor.

With the Guix package, it's located in

~/.config/sorr/savegame/savegame.sor

ch11ng commented 5 years ago

I run 1.20.4

Same here.

You can change them anytime in the "Video" options.

It seems the "graphic mode" doesn't matter so long as the "display" option is set to "full screen". And toggling between "window" and "full screen" display options works.

With the Guix package, it's located in ~/.config/sorr/savegame/savegame.sor

I didn't use the Guix package but simply unpacked the tarball and made necessary changes. The location is ~/.sorr/savegame/savegame.sor here.

Ambrevar commented 5 years ago

Also note that on the same machine, StumpWM runs SORR just fine.

With EXWM, if I run the game in windowed mode, it does not scale either in the sense that as I enlarge the window it fills the void with black instead of scaling the picture.

ch11ng commented 5 years ago

Also note that on the same machine, StumpWM runs SORR just fine.

Not sure what else we can do to its X window other than resizing it full screen. Have you got any new finding?

With EXWM, if I run the game in windowed mode, it does not scale either in the sense that as I enlarge the window it fills the void with black instead of scaling the picture.

I tried other WMs and found this not even allowed. Perhaps we should follow their practice.

Ambrevar commented 5 years ago

Same issue with World of Goo: it does not scale to full screen.

$ xprop
> xprop
_NET_WM_DESKTOP(CARDINAL) = 0
WM_STATE(WM_STATE):
        window state: Normal
        icon window: 0x0
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE
WM_NORMAL_HINTS(WM_SIZE_HINTS):
        user specified location: 0, 0
        program specified minimum size: 800 by 600
        program specified maximum size: 800 by 600
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW
WM_CLIENT_MACHINE(STRING) = "bababa"
_NET_WM_PID(CARDINAL) = 14229
WM_CLASS(STRING) = "WorldOfGoo.bin64", "WorldOfGoo.bin64"
_NET_WM_NAME(UTF8_STRING) = "World of Goo"
WM_NAME(STRING) = "World of Goo"
WM_HINTS(WM_HINTS):
        Client accepts input or input focus: True

Hints:

Ambrevar commented 5 years ago

For World of Goo, a workaround is to create the following file:

$ cat ~/.WorldOfGoo/config.txt
<config>
  <!-- Graphics display -->
  <param name="screen_width" value="1920" />
  <param name="screen_height" value="1200" />
  <param name="color_depth" value="0" />
  <param name="fullscreen" value="false" />
  <param name="ui_inset" value="10" />
</config>

And the game will start in windows mode in the right resolution. Then I can call exwm-layout-toggle-fullscreen to go fullscreen.

ch11ng commented 5 years ago

It seems this game is no freeware. A debug log may help. Could you prepare one?