Skip to content

Xwayland randr and vidmode resolution change emulation

This series adds support for emulation of resolution changes through the randr and vidmode extensions. The resolution is not actually changed, instead Xwayland will use WPviewport to make a (fullscreen) window at the requested resolution fill the entire monitor, as the window would if the resolution was actually changed.

Note aspect-ratio is ignored, I checked what real 16:9 / 16:10 monitors do when set to a 4:3 resolution and the ones I have access to all simply stretch the image to fill the entire monitor. So we do the same here which is the KISS way of handling aspect-ratio, so I like it.

The main goal of this series is to make games, which may very well be hardcoded to render at only a specific resolution, work properly under Xwayland instead of showing a small image with a big black letterbox around it, or in some cases showing a small image in the left top or bottom (glx) corner of the monitor.

This series has been successfully tested with the following games:

  • SDL 1.2 2d game: lbrickbuster2
  • SDL 1.2 relmouse: d1x-rebirth-sdl
  • SDL 1.2 3d game: d1x-rebirth-gl
  • SDL 2.0 2d game: "SDL_RENDER_DRIVER=software shippy"
  • SDL 2.0 3d game: shippy, supertux2
  • SFML: etr, marshooter
  • Clanlib-0.6 game: auriferous, clanbomber
  • Clanlib-1.0 game: trophy
  • Clanlib-2.3 game: methane, does not seem to do resolution changes for fs
  • allegro4 2d game: worminator, lacewing
  • allegro4 3d game: machineball

It has also been successfully tested with mixed HiDPI setups using gnome-shell in both classic HiDPI mode and in the new fractional scaling HiDPI mode.

This is partly based on earlier work on this by Robert Mader.

Edited by Aaron Plattner

Merge request reports