Commit graph

9297 commits

Author SHA1 Message Date
Mikhail Dmitrichenko
c017c9ffeb vfb: use snprintf when writing XWD window name
The window name buffer after XWDFileHeader is fixed at
XWD_WINDOW_NAME_LEN (60 bytes).  sprintf could overflow when
hostname is close to maximum length and combined with the
prefix "Xvfb " + display + screen number.

Switch to snprintf to guarantee we never write beyond the
allocated buffer.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2172>
2026-04-15 23:38:29 +00:00
Alan Coopersmith
fea1757a58 xf86: drop no longer needed entries from default driver list for Intel
Now that the Intel driver is no longer the default case, we don't
need to maintain a long list of entries to override the default.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2168>
2026-04-11 18:05:19 +00:00
Olivier Fourdan
48bda9deb8 xwayland: Commit surface on configure event
Commit f5d8e112 introduced a regression, removing the call to
wl_surface_commit() except for the initial configure event.

That causes a massive GPU memory leak.

Fix the issue by restoring the wl_surface_commit() for all configure
events, as before commit f5d8e112.

Fixes: f5d8e112 ("xwayland: Avoid premature surface commit running rootfull")
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1877
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2153>
2026-04-09 08:52:39 +00:00
Pavel Ondračka
1c2e42c706 modesetting: byte-swap ARGB cursor uploads on big-endian
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2156>
2026-04-04 16:38:24 +00:00
Alan Coopersmith
c8655a856a Xvfb: handle allocation failure in vfbInstallColormap()
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../hw/vfb/InitOutput.c:416:13:
 warning[-Wanalyzer-possible-null-dereference]:
  dereference of possibly-NULL ‘ppix’

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2161>
2026-04-04 15:49:20 +00:00
Alan Coopersmith
a174db79e9 xf86: fix hotplug header include in platform_noop.c
In this branch, only hotplug.h exists, not hotplug_priv.h

Fixes: 79d39eabd ("xfree86: platform_noop: add missing functions")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2157>
2026-04-04 15:36:26 +00:00
Alan Coopersmith
5106461e31 meson: replace join_paths() with / operator
Requires meson 0.49.0, well below our current minimum of 0.60.0

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2150>
2026-03-28 10:02:41 -07:00
Alan Coopersmith
16ca2c7a11 meson: add install_tags to files meson couldnt guess on its own
Clears up a number of "Failed to guess install tag" messages from
meson-logs/meson-log.txt

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2149>
2026-03-28 16:54:18 +00:00
Jeremy Huddleston Sequoia
fbff1312ce xquartz: Bump copyrights in Info.plist to 2026
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2026-03-25 23:47:00 -07:00
Olivier Fourdan
0e580872b0 xwayland: Use viewport scale for warping coordinates
When Xwayland is used rootful with hidpi, a viewport is in effect and a
scale applied.

This is however "transparent" to the Xserver which uses unscaled
coordinates, so to set the fake cursor position with a viewport and a
scale applied, we need to factor the scale to the coordinates before
passing the coordinate to the Wayland compositor through the method
zwp_locked_pointer_v1_set_cursor_position_hint().

Failing to do that will introduce a shift when warping the cursor
position.

v2: Use an xwl_window instead of an xwl_seat to improve readability
(Michel)

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1875
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2145>
2026-03-23 08:19:50 +00:00
Diego Viola
7e7d1f027f treewide: fix typos
Signed-off-by: Diego Viola <diego.viola@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2138>
2026-03-14 16:52:19 +00:00
Alan Coopersmith
94acecdeaf ephyr: show that -name & -title take non-optional arguments in usage output
Fixes: f028e245a ("Bug #10016: Implement WM_CLASS hints in Xephyr.")
Fixes: e3c65cf1d ("xephyr: Add -title option.")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2137>
2026-03-09 18:35:44 -07:00
Alan Coopersmith
0df19c5001 ephyr: add -name to Xephyr man page
Fixes: f028e245a ("Bug #10016: Implement WM_CLASS hints in Xephyr.")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2137>
2026-03-09 18:35:33 -07:00
Alan Coopersmith
45607067cf ephyr: add -title to Xephyr man page
Fixes: e3c65cf1d ("xephyr: Add -title option.")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2137>
2026-03-09 18:35:20 -07:00
Diego Viola
67c82078fe Restore correct spelling of "Avance Logic"
Fixes: e8f452231 ("Fix typos")
Signed-off-by: Diego Viola <diego.viola@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2136>
2026-03-03 09:13:24 -08:00
Michel Dänzer
c76d495612 Revert "xwayland: Call register_damage depending on ensure_surface_for_window"
There've been reports downstream of Xwayland segfaulting in the function
xwl_present_execute() because xwl_window_get_damage_region() returned an
invalid pointer:

 #10 RegionUninit at ../include/regionstr.h:165
 #11 RegionEmpty at ../include/regionstr.h:194
 #12 xwl_present_execute at ../hw/xwayland/xwayland-present.c:1138
 #13 xwl_present_pixmap at ../hw/xwayland/xwayland-present.c:1274
 #14 present_pixmap at ../present/present.c:249
 #15 proc_present_pixmap_common at ../present/present_request.c:166
 #16 proc_present_pixmap at ../present/present_request.c:186
 #17 Dispatch at ../dix/dispatch.c:550
 #18 dix_main at ../dix/main.c:277

The most likely reason for this is that window_get_damage() returned
NULL, which might happen if xwl_window_update_surface_window() didn't
call register_damage().

To avoid that issue, move the call to register_damage() back to
xwl_realize_window before calling ensure_surface_for_window().

This reverts commit 07f6032627.

See-also: https://bugzilla.redhat.com/2329815
See-also: https://bugzilla.redhat.com/2428249
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1862
Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2135>
2026-03-03 14:05:15 +01:00
Michel Dänzer
0472d7389e xwayland: Use WindowPtr for damage closure again
This reverts commit d3448f7aad.

Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2135>
2026-03-03 14:02:49 +01:00
Michel Dänzer
ceb313f277 xwayland: Update surface window from xwl_unrealize_window
Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2135>
2026-03-03 14:02:49 +01:00
Diego Viola
e8f4522312 Fix typos
Signed-off-by: Diego Viola <diego.viola@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2134>
2026-03-03 06:50:01 -03:00
Thomas Zimmermann
c12cf4f585 xf86: Accept devices with the kernel's corebootdrm driver
Add a workaround to accept devices of the kernel's corebootdrm
driver. Makes Xorg work on pre-configured displays with coreboot
and the DRM graphics stack. Review of the corebootdrm driver
happens at [1].

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/series/159820/ # [1]
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2132>
2026-02-28 02:09:35 +00:00
Alan Coopersmith
2e338890ee os: add a generic -verbose option instead of making each server add its own
Replaces Xwayland's server-specific implementation, but leaves Xorg's
since it sets global variables in the xfree86 ddx layer.  Also leaves
Xephyr's differently-spelled "-verbosity" for backwards compatibility.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2131>
2026-02-28 02:03:10 +00:00
Alan Coopersmith
12791f5027 xfree86: issue error if too many clocks entries are listed in config
Changes message issued for too many clocks from the confusing:
    "29.0" is not a valid keyword in this section.
to the more obvious:
    More than 128 Clocks defined.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2130>
2026-02-22 13:23:45 -08:00
Mario Limonciello
4ba1df3ce6 Add compatibility define for pci_device_is_boot_display()
It will take some time for a new libpciaccess to be released and
even then bumping the dependency for libpciaccess isn't attractive.
If an older libpciaccess is used just add a static inline define.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2038>
2026-02-22 07:36:50 -06:00
Mario Limonciello
41c58693c3 Add check for pci_device_linux_sysfs_boot_display()
In the case of multiple display devices that are not VGA devices
the 'boot_display' attribute read by libpciaccess can disambiguate.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2038>
2026-02-22 07:36:45 -06:00
Julian Orth
aaa8d5a955 xwayland: don't allow clients to modify the keymap
Xwayland has no way to affect the keymap of the compositor. If clients
modify the keymap, it will stay out of sync with the compositor until
some unspecified time in the future when the compositor sends the keymap
again, which might be never, requiring Xwayland to be restarted.

Signed-off-by: Julian Orth <ju.orth@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1953>
2026-02-19 13:52:28 +01:00
Jon Turney
9c35efe978 hw/xwin: Allow DefWindowProc to SetFocus() as needed after WM_ACTIVE
Don't indicate we've processed WM_ACTIVATE, so DefWindowProc can do
not-clearly specified default things with the focus.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/736>
2026-02-15 18:58:01 +00:00
Jon Turney
64d7a6b4a0 hw/xwin: More adjustments to multiwindow mode focus handling
The previous change is not enough, as WM_KILLFOCUS can apparently be
sent to the window losing focus after WM_ACTIVATE has been sent to
the window gaining focus.

Try using WM_SETFOCUS instead, as that has the correct ordering and seems
more logical.

The test "!pWin || !pWin->overrideRedirect" is confusingly written: It's
true if:

(a) pWin is NULL (= X window doesn't exist, shouldn't happen), or
(b) pWin->overrideRedirect is FALSE

i.e. the intended effect is "don't give focus to override redirect windows"

There seem to be some cases where this still isn't quite correct: A
reproduction isn't known, but it seems to be related to minimizing a
maximized Windows window, and having window activation move to a
maximized X window beneath it.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/736>
2026-02-15 18:58:01 +00:00
Jon Turney
d7d2dd8286 hw/xwin: Always set the X input focus to none when an X window loses focus
In the multiwindow WM, we need to cancel the X input focus if the
Windows input focus has gone to the desktop, or another application's
window.

We could maybe avoid some unneeded work by not doing this if the
WM_KILLFOCUS wParam is another window owned by us, which is immediately
going to be given the X input focus.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/736>
2026-02-15 18:58:00 +00:00
Jon Turney
1afb9c6a7c hw/xwin: Use revert-to-parent X focus mode in multiwindow WM
Use revert-to-parent X focus mode, as recommended in ICCCM 4.1.7

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/736>
2026-02-15 18:58:00 +00:00
Benjamin Valentin
907c501926 xf86: check return value of XF86_CRTC_CONFIG_PTR in xf86CompatOutput()
If privates[xf86CrtcConfigPrivateIndex].ptr is NULL, this will cause
a segfault.

Possible fix for !1241

Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/835>
2026-02-15 18:34:26 +00:00
Edênis Freindorfer Azevedo
444822f7c1 Support XDG Base Dir Spec 0.8.
This version of the spec (latest as of 27.12.2021) adds a variable
`$XDG_STATE_HOME` that may be used for log files, as described:

```
...
$XDG_STATE_HOME defines the base directory relative to which user-specific
state files should be stored. If $XDG_STATE_HOME is either not set or
empty, a default equal to $HOME/.local/state should be used.

The $XDG_STATE_HOME contains state data that should persist between
(application) restarts, but that is not important or portable enough to
the user that it should be stored in $XDG_DATA_HOME. It may contain:

actions history (logs, history, recently used files, …)
...
```

- https://specifications.freedesktop.org/basedir/0.8/

Signed-off-by: Edênis Freindorfer Azevedo <edenisfa@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/836>
2026-02-15 10:15:19 -08:00
Dongwon Kim
2114016ea0 modesetting: Empty damage once dispatch is done
This commit is to fix some regression caused by

commit 995e60a919

where DamageEmpty on damage was missing in several
places.

Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1486>
2026-02-15 01:28:48 +00:00
Patrick Lerda
5582e45d94 modesetting: find the first compatible dri device as default
This change replaces the default "/dev/dri/card0" by a loop which
searches for the first compatible device.

This change avoids the error below which happens on some ARM boards:
(EE) No devices detected.
(EE)
Fatal server error:
(EE) no screens found(EE)
(EE)

Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1496>
2026-02-14 17:19:52 -08:00
Sultan Alsawaf
4689e5744e modesetting: Don't recursively force present to unflip
Present calls drmmode_set_mode_major() as part of ms_present_unflip(),
which leads to a crash due to the recursive attempt to force present to
unflip when it already is.

Fix it by simply skipping the forced present unflip when present itself is
unflipping. This also speeds up drmmmode_prepare_modeset() when present
isn't even flipping to begin with.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1791
Fixes: 899c87af1 ("modesetting: unflip before any setcrtc() calls")
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1793>
2026-02-14 16:04:01 -08:00
Thomas Zimmermann
34a53a5746 xf86: Accept devices with the kernel's vesadrm driver
Add a workaround to accept devices of the kernel's vesadrm driver.
Makes Xorg work on pre-configured displays with VESA and the DRM
graphics stack. Review of the vesadrm driver happens at [1].

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/series/146477/ # 1
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1879>
2026-02-14 23:39:34 +00:00
Thomas Zimmermann
b6b7218aed xf86: Accept devices with the kernel's efidrm driver
Add a workaround to accept devices of the kernel's efidrm driver.
Makes Xorg work on pre-configured displays with UEFI and the DRM
graphics stack. Review of the efidrm driver happens at [1].

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/series/146477/ # 1
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1879>
2026-02-14 23:39:34 +00:00
Timo Aaltonen
e45516afa6 xf86pciBus.c: use Intel ddx only for pre-gen3 hardware
Use intel ddx only on pre-gen4 hw, newer ones will fall back to modesetting.

Instead of defaulting to the Intel driver for all Intel hardware, only
default it for older hardware for which it has shown to be better for.

Note that Debian/Fedora and their derivatives, as well as the yocto project
have been carrying this patch for many years:
192254841a
ee515e44b0

so this simply aligns xserver upstream with Linux distributions.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Co-authored-by: Balló György <ballogyor@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1887>
2026-02-14 23:33:49 +00:00
Icenowy Zheng
febc30a75b modesetting: properly use fb_id of front_bo for reverse PRIME CRTC
When doing reverse PRIME, the buffer being scaned out is still the front
BO.

Properly reuse its fb_id, to prevent adding a FB for the front_bo each
time the fb_id is requested.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2064>
2026-02-14 14:28:20 -08:00
Qiang Yu
3d5c955337 modesetting: fix PRESENT_FLIP_REASON_BUFFER_FORMAT gets overwritten
When dmabuf_capable is enabled, ms_present_check_unflip may return
with reason PRESENT_FLIP_REASON_BUFFER_FORMAT to be reported back
to client by PresentCompleteModeSuboptimalCopy. We should not
overwrite it by page flip reasons anyway when exit.

This fix also avoid changing vblank->exec_msc in present_scmd_pixmap()
which caused by page flip reasons to prevent a present to be executed
immediatly. So that we can cancel pending vblanks when new vblanks with
same msc arrive. This happens when application just starts.

This problem can be observed at least using radeonsi OGL driver, start
xserver with dmabuf_capable enabled, no window manager, glxgears will
stuck for the first several seconds. If using a composite window manager
like Mutter, we can't observe the glxgears stuck, but the prensent
complete event still shows unexpected Copy mode instead of
PresentCompleteModeSuboptimalCopy or Skip mode.

glxgears window msc is 0 at the beginning, it will send present request
with target msc = 1, 2, 3, ... N before server send back the complete
event for target msc = 1. But server side window msc is way bigger than N,
so it will think all these present requests are outdated and just show the
Nth request at the next vblank. [1 .. N-1] requests should be skipped.
But without this fix, all [1 .. N] presents will be executed with Copy
mode which causes stuck.

Fixes: a94dd9536 ("modesetting: add support for TearFree page flips")
Reviewed-by: Sultan Alsawaf <sultan@kerneltoast.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2091>
2026-02-14 20:48:29 +00:00
Alan Coopersmith
3eaaa35849 xfree86: remove leftover ev56.c source files
Commit 166ac294a replaced the function calls in these files with inline
functions in compiler.h and updated the configure scripts & meson builds
to stop compiling them, but missed actually removing the now unused sources.

Fixes: 166ac294a ("xfree86: Inline xf86{Read,Write}Mmio{8,16,32} on alpha")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2122>
2026-02-14 10:00:51 -08:00
Yixue Wang
6a37e21ca4 xwayland: wrong expecting_event
According to

https://wayland.app/protocols/wayland#wl_seat:event:capabilities

Compositor might send capabilities when its capabilities change.
Decrease expecting_event here without any check might cause a
negative expecting_count.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2123>
(cherry picked from commit 6bf6a9bff2)
2026-02-08 11:44:42 -08:00
Liu Heng
6bef11002f xwayland: prevent X11 get enter event when pointer is over Wayland client
In Wayland, mouse coordinates are not updated after all x11 clients have left,
causing the mouse information to remain at the position left by the last x11
client. However, if CheckMotion is called at this point for other reasons
(such as window mapped, reactive, etc.), xwayland might continue to send enter
events to x11 clients, even if the mouse is actually on a Wayland client.

This MR introduces and checks pointer_enter_count to determine if the mouse
has left an x11 client and is now on a Wayland client. When it's confirmed
that the mouse is no longer on an x11 client but on a Wayland client,
returning TRUE in sprite_check_lost_focus causes XYToWindow to return to the
root window, preventing further enter events from being sent to x11 clients.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2112>
(cherry picked from commit e673a4bda0)
2026-02-01 17:53:16 -08:00
Olivier Fourdan
22dcaf44d4 xwayland: Clean-up stray newlines
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2121>
(cherry picked from commit 5a78e5f1e9)
2026-01-25 11:47:31 -08:00
Olivier Fourdan
3df29994ec xwayland: Expand tab characters
Over time, some sneaky tab characters have found their way in the
Xwayland code, even though they were not allowed:

  https://www.x.org/wiki/CodingStyle/

Simply expand the tabs to get rid of these...

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2121>
(cherry picked from commit 904cdb0d11)
2026-01-25 11:47:31 -08:00
Olivier Fourdan
f5d8e11288 xwayland: Avoid premature surface commit running rootfull
When running rootful, i.e. as a regular Wayland client, Xwayland needs
to wait for the initial configure event before posting its initial
buffer and commit the surface.

Not doing so may cause mutter to log a warning when Xwayland is started
rootful:

 | Buggy client (org.freedesktop.Xwayland) committed initial non-empty
 | content without acknowledging configuration, working around.

Or running rootful with libdecor:

 | Client provided invalid window geometry for xdg_surface#nn
 | (org.freedesktop.Xwayland - Wnn (Xwayland on :nn)). Working around.
 |
 | Buggy client (org.freedesktop.Xwayland) committed initial non-empty
 | content without acknowledging configuration, working around.

This is actually mutter being nice, as this should be treated as a
protocol error and Xwayland would be terminated.

To avoid the issue, we need to hold on attaching a buffer and committing
the surface until we actually get the first configure event from the
compositor.

That, however, only applies to rootful mode, so we can leave the default
code path for rootless untouched.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1853
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>

v2: commit the surface after attaching the first buffer on configure
event only for the initial configure (Michel Dänzer).
v3: return early in present flip if we didn't get the initial configure
event (Michel Dänzer).

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2110>
(cherry picked from commit 37f59e1a4d)
2026-01-25 11:47:31 -08:00
Michel Dänzer
cdb2cb6cbc xwayland: Adjust RandR emulation for rotation
Need to use the extents of the output in screen cordinates, instead of
the canonical mode size.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2095>
(cherry picked from commit 44dea3a8bd)
2026-01-25 11:47:26 -08:00
Michel Dänzer
297e29f8c1 xwayland: Add emulated modes larger than the logical mode
Up to the native mode, as reported by the wl_output protocol.

This ensures that fullscreen apps can always use the native mode.

Also ensure the root window is large enough for the output at its
current position with the native mode.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2095>
(cherry picked from commit d339284006)
2026-01-25 11:46:10 -08:00
Michel Dänzer
c859dce96d xwayland: Clear ConstrainCursorHarder in xwl_screen_init_output
In the rootless case, Xwayland receives pointer motion events only while
the pointer is over one of its Wayland surfaces, so there's no need for
constraining them to RandR boundaries.

This also avoids them getting spuriously constrained when using RandR
emulation for modes larger than the default one.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2095>
(cherry picked from commit dcfba8a9bd)
2026-01-25 11:46:10 -08:00
Michel Dänzer
ff641acc65 xwayland: Add RandR mode for the native resolution if it fits in logical
Always add it as the first mode, which makes it considered the preferred
mode per the RandR protocol.

Mark the logical mode as currently set.

v2:
* Drop change in xwl_window_should_enable_viewport which seems
  unnecessary and coult result in a crash. (Olivier Fourdan)
* Use 'native' instead of 'actual'.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2095>
(cherry picked from commit 288dcb3128)
2026-01-25 11:46:10 -08:00
Michel Dänzer
0268f28aea xwayland: Do not assume the first RandR mode is the logical mode
It currently always is, it won't be with the next commit though.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2095>
(cherry picked from commit 4ea088f9e2)
2026-01-25 11:46:10 -08:00