Commit graph

9319 commits

Author SHA1 Message Date
Pavel Ondračka
9192583ed5 Merge branch 'xwayland_leaks' into 'main'
xwayland: leak fixes

See merge request xorg/xserver!2170
2026-06-02 05:13:22 +02:00
Michel Dänzer
339c279514 dri2: Deduplicate attachments in do_get_buffer
It was always the intention of the DRI2 protocol that there's at most
one instance of each attachment, and that's how it was implemented in
Mesa.

Since that wasn't enforced though, there might be other clients in the
wild which (e.g. accidentally) request the same attachment multiple
times. So starting to a raise a protocol error in this case now risks
breaking such clients.

Instead, just deduplicate the attachments using a bit-set.

This has a couple of desirable side effects:

* destroy_buffer cannot be called multiple times for the same
  DRI2BufferPtr.
* The client cannot cause the server to allocate a buffers array with
  more entries than there are attachments (currently 11).

Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2228>
2026-06-01 08:31:59 +10:00
Michel Dänzer
b7aa65cc3b dri2: Use booleans for (fake) front buffer tracking in do_get_buffers
This works as intended — the (fake) front buffer needs to be added
only if the client didn't request it in the first place — even if the
client requests the same attachment multiple times. This ensures we
never try to access more than (count + 1) entries of the buffers array.

Fixes: ff6c7764c2 ("DRI2: Implement protocol for DRI2GetBuffersWithFormat")
Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2228>
2026-06-01 08:31:59 +10:00
Olivier Fourdan
5348d7d792 xwayland: Add have_clipboard flag in pkgconfig file
We use the pkgconfig file to indicate the availability of the command
line options, add the newly added clipboard option there as well.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2223>
2026-05-27 10:04:50 +00:00
Olivier Fourdan
c3198080fc Revert "xwayland: Do not pretend leaving the X11 surface if buttons are down"
Kwin may send button events to Xwayland even when there is no Xwayland
surface with input focus.

With this change applied, that causes spurious input focus changes.

And even with that change reverted, I fail to reproduce the bug from
issue #1811.

This reverts commit 8cb078f8b6.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/work_items/1883
See-also: https://gitlab.freedesktop.org/xorg/xserver/-/work_items/1811
See-also: https://gitlab.freedesktop.org/xorg/xserver/-/work_items/1818
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2194>
2026-05-27 09:36:31 +00:00
Mikhail Dmitrichenko
872ece04f9 xwayland: check queued DRM lease allocation
registry_global() queues DRM lease devices before the root window is
available and initializes the queued entry immediately after malloc().
Return early on allocation failure to avoid dereferencing a NULL
pointer.

Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2217>
2026-05-23 16:30:21 +00:00
Peter Hutterer
2e4a5aecef meson: give the xorg executable an actual name
Matches e.g. xvfb_server and xwayland_server.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2187>
2026-05-10 23:42:43 +00:00
Peter Hutterer
44938d4818 modesetting: Fix double increment in cursor buffer cleanup loop
Fixes: 1f41320e1c ("modesetting: Use a more optimal hw cursor size")
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2201>
2026-05-09 19:14:26 +00:00
Pavel Ondračka
83dc5453c6 xwayland: clean up glamor EGL state on fatal exits
Xwayland initializes glamor on top of an EGL display, but some fatal
exit paths bypass the normal screen close sequence. In particular, this
can happen through xwl_give_up() after the Wayland compositor goes away,
or through ddxGiveUp() after early startup failures such as keymap
compilation failure.

A relevant excerpt from the ASan report:
  Direct leak of 368 byte(s) in 1 object(s) allocated from:
    #0 in calloc
    #1 in dri2_display_create ../src/egl/drivers/dri2/egl_dri2.c:1014
    #2 in dri2_initialize ../src/egl/drivers/dri2/egl_dri2.c:874
    #3 in eglInitialize ../src/egl/main/eglapi.c:697
    #4 in xwl_glamor_gbm_init_egl ../hw/xwayland/xwayland-glamor-gbm.c:1739
    #5 in xwl_glamor_init ../hw/xwayland/xwayland-glamor.c:242
    #6 in xwl_screen_init ../hw/xwayland/xwayland-screen.c:1121
    #7 in AddScreen ../dix/dispatch.c:3999
    #8 in InitOutput ../hw/xwayland/xwayland.c:437
    #9 in dix_main ../dix/main.c:190
    ...
  Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 in calloc
    #1 in _eglCreateArray ../src/egl/main/eglarray.c:69
    #2 in _eglLinkConfig ../src/egl/main/eglconfig.c:85
    #3 in dri2_add_config ../src/egl/drivers/dri2/egl_dri2.c:457
    #4 in drm_add_configs_for_visuals ../src/egl/drivers/dri2/platform_drm.c:563
    #5 in dri2_initialize_drm ../src/egl/drivers/dri2/platform_drm.c:706
    #6 in dri2_initialize ../src/egl/drivers/dri2/egl_dri2.c:892
    #7 in eglInitialize ../src/egl/main/eglapi.c:697
    ...
2026-05-05 11:43:13 +02:00
Olivier Fourdan
598bc33cfa xwayland: Use output geometry by default when fullscreen
Currently, when started fullscreen, Xwayland rootful would use a default
resolution of "640x480" and apply a viewport to match the actual output
resolution.

That's quite counter intuitive, because when started fullscreen, one
would expect the default Xwayland root size to match the logical size
of the output where it is placed, unless of course, a geometry is
explicitly specified from the command line.

Fix the default resolution to be driven from the window size instead,
even when started fullscreen, so that one can start Xwayland rootful
and fullscreen and get the optimal resolution by default.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2196>
2026-04-29 11:50:19 +02:00
Olivier Fourdan
b192c66e05 xwayland: Refuse to start with indirect GLX enabled
Xwayland does not support indirect GLX contexts and enabling them will
crash the xserver.

Refuse to start if indirect GLX contexts are enabled on the command
line.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1745>
2026-04-28 07:38:18 +00:00
Olivier Fourdan
8e8c0e54c4 xwayland: Validate command line options separately
The design document hw/xfree86/doc/ddxDesign.xml states that:

 | AddScreen() should only fail because of programming errors or
 | failure to allocate resources (like memory).
 | All configuration problems should be detected BEFORE this point.

Different command line options errors are detected in xwl_screen_init()
and can cause AddScreen() to fail, which is not compliant with the
specification.

Move all command line checks out of xwl_screen_init() in a separate
function that will take care of verifying the command line options and
bail out with meaningful error messages.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1745>
2026-04-28 07:38:18 +00:00
Peter Hutterer
a29c8a352c modesetting: add NULL check for drmModeObjectGetProperties in VRR check
Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2184>
2026-04-28 02:37:43 +00:00
Peter Hutterer
b67e0233e6 hw/xwayland: fix missing NULL checks in DRM lease allocation paths
Allocate first, then request so the cleanup path is simpler.

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2184>
2026-04-28 02:37:43 +00:00
Peter Hutterer
47002f8efc hw/xwayland: handle wl_array_add failure in keyboard_handle_key
wl_array_add() can return NULL, if that happens bail out and discard the
key event.

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2184>
2026-04-28 02:37:43 +00:00
Olivier Fourdan
756ccb5730 xwayland: Add a new command line option to enable selection bridge
Add a new commmand line option to enable the Xwayland
clipboard selection bridge when running in rootful mode.

By default, clipboard selection bridge is disabled to keep the default
of having Xwayland rootful running isolated from the rest of the
applications.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2139>
2026-04-27 14:24:04 +02:00
Olivier Fourdan
13b3930491 xwayland: Implement clipboard and primary selection
So that it is possible to copy and paste between Xwayland rootful and
other Wayland or even X11 clients outside of Xwayland.

Limitation: It does not support incremental transfer.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1873
Assisted-by: Cursor AI
Assisted-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2139>
2026-04-27 14:24:04 +02:00
Olivier Fourdan
36ffe2b6e7 xwayland: Add primary selection and data device protocols
This is preparation work for the next commit.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2139>
2026-04-27 14:24:04 +02:00
Olivier Fourdan
b9f55422db xwayland: Add xwl_seat to the Xwayland types
For some reason, xwl_seat wasn't listed in the Xwayland types.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2139>
2026-04-27 14:24:04 +02:00
Olivier Fourdan
36f53145e4 xwayland: Avoid NULL pointer dereference in damage_report()
Commit 34934c37d6 restored calling register_damage() in
xwl_realize_window() before ensure_surface_for_window().

However if register_damage() succeeds and ensure_surface_for_window()
returns NULL, it would exit without "unregistering" the damage hook.

The X11 window, however, may still get damages reports, in which case
xwl_window_from_window() would return NULL, causing a NULL pointer
dereference in damage_report().

To avoid the issue, make sure we unregister the damage report if
ensure_surface_for_window() has failed, and add an early exit in
damage_report() if xwl_window is NULL.

v2: unregister_damage() unconditionally if ensure_surface_for_window()
    failed (Michel Dänzer)

Fixes: commit 34934c37d6 ("revert: register damage before ensure_surface_for_window")
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/work_items/1886
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2190>
2026-04-24 07:16:12 +00:00
Michel Dänzer
6357c9afce xwayland: Handle GetCurrentClient returning NULL in xwl_reparent_window
It's not the WM client in that case.

Fixes crash.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/work_items/1885
Fixes: 6aacf04f51 ("xwayland: Add heuristic for WM windows based on reparenting")
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2188>
2026-04-21 11:28:17 +00:00
Olivier Fourdan
c39b1591b2 xwayland: Do not use pointer crossing count for slave devices
Commit 0e08e5083 ("xwayland: prevent X11 get enter event when pointer is
over Wayland client") introduced a pointer crossing count to avoid
sending spurious pointer enter events when the pointer is withing a
Wayland native surface.

However, that change breaks tablet devices, as the pointer enter count
is only updated from the wl_pointer enter/leave events, a slave X11
device such as a tablet pointer would report a lost focus and the event
wrongly sent to the root window.

To avoid the issue, revert partially commit 0e08e5083 to return FALSE
as before for the slave devices. The rest of the logic from commit
0e08e5083 remains unchanged, so that we do not send spurious
XCrossingEvents for the pointer device when it's within a native Wayland
surface.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/work_items/1884
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2180>
2026-04-21 06:19:05 +00:00
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