diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2022-04-04 14:28:15 +0200 |
---|---|---|
committer | Olivier Fourdan <ofourdan@redhat.com> | 2022-05-25 09:43:17 +0200 |
commit | cae60591d2f2e82732fd8e116cd109ab6c568fd5 (patch) | |
tree | 6391d8356404193d66926c7ecb438d109443720e | |
parent | 8ddac82f214a17382eb0824c4c8b875a81253441 (diff) |
xwayland/output: Set the "RANDR Emulation" property
Xwayland does not change the actual XRANDR setup for real, it just
emulates the resolution changes using viewports in Wayland.
With a single output, if an X11 applications tries to change the CRTC
back to the native mode, RRCrtcSet() will simply ignore the request as
no actual change is induced by this.
Set the property "RANDR Emulation" on all Xwayland outputs to make sure
the optimizations in RRCrtcSet() get skipped and Xwayland can receive
and act upon the client request.
Also make sure we do not allow that property to be changed by X11
clients.
v2: Prevent X11 clients from changing the property value
(Pekka Paalanen <pekka.paalanen@collabora.com>)
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1305
(cherry picked from commit 7b7170ecd636ae1110622e2430549f79598750ca)
-rw-r--r-- | hw/xwayland/xwayland-output.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c index d2fa4e0bb..3ad8adc8b 100644 --- a/hw/xwayland/xwayland-output.c +++ b/hw/xwayland/xwayland-output.c @@ -720,6 +720,27 @@ static const struct zxdg_output_v1_listener xdg_output_listener = { xdg_output_handle_description, }; +#define XRANDR_EMULATION_PROP "RANDR Emulation" +static Atom +get_rand_emulation_property(void) +{ + const char *emulStr = XRANDR_EMULATION_PROP; + + return MakeAtom(emulStr, strlen(emulStr), TRUE); +} + +static void +xwl_output_set_emulated(struct xwl_output *xwl_output) +{ + int32_t val = TRUE; + + RRChangeOutputProperty(xwl_output->randr_output, + get_rand_emulation_property(), + XA_INTEGER, + 32, PropModeReplace, 1, + &val, FALSE, FALSE); +} + struct xwl_output * xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id) { @@ -758,6 +779,7 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id) ErrorF("Failed creating RandR Output\n"); goto err; } + xwl_output_set_emulated(xwl_output); RRCrtcGammaSetSize(xwl_output->randr_crtc, 256); RROutputSetCrtcs(xwl_output->randr_output, &xwl_output->randr_crtc, 1); @@ -896,6 +918,10 @@ xwl_randr_output_set_property(ScreenPtr pScreen, Atom property, RRPropertyValuePtr value) { + /* RANDR Emulation property is read-only. */ + if (get_rand_emulation_property() == property) + return FALSE; + return TRUE; } |