xwayland: Add support for randr-resolution change emulation using viewport

Graphics / X.Org / X.Org Server - Hans de Goede [redhat.com] - 12 October 2019 10:19 EDT

Add support for per client randr-resolution change emulation using viewport, for apps which want to change the resolution when going fullscreen.

Partly based on earlier work on this by Robert Mader

Note SDL2 and SFML do not restore randr resolution when going from fullscreen -> windowed, I believe this is caused by us still reporting the desktop resolution when they query the resolution. This is not a problem because when windowed the toplevel window size includes the window-decorations so it never matches the emulated resolution.

One exception would be the window being resizable in Windowed mode and the user resizing the window so that including decorations it matches the emulated resolution *and* the window being at pos 0x0. But this is an extreme corner case. Still I will submit patches upstream to SDL2 and SFML to always restore the desktop resolution under Xwayland, disabling resolution emulation all together when going windowed.

d99b9ff0f xwayland: Add support for randr-resolution change emulation using viewport
hw/xwayland/xwayland-input.c | 5 ++
hw/xwayland/xwayland-output.c | 63 +++++++++++--
hw/xwayland/xwayland.c | 199 ++++++++++++++++++++++++++++++++++++++++++
hw/xwayland/xwayland.h | 15 ++++
4 files changed, 276 insertions(+), 6 deletions(-)

Upstream: cgit.freedesktop.org


  • Share