Commit graph

22,419 commits

Author SHA1 Message Date
Michel Dänzer
dce46884f9 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-03 15:03:50 +02:00
Leandro Nini
4f3b7f7a64 modesetting: perform null check before pointer is dereferenced
Some checks failed
Build X servers / xserver-build-ubuntu (push) Has been cancelled
Build X servers / drivers-build-ubuntu (push) Has been cancelled
Build X servers / xserver-build-mingw32-ubuntu (push) Has been cancelled
Build X servers / xserver-build-macos (push) Has been cancelled
Build X servers / xserver-build-freebsd (push) Has been cancelled
Build X servers / xserver-build-dragonflybsd (push) Has been cancelled
Build X servers / xserver-build-netbsd (push) Has been cancelled
Build X servers / xserver-build-cygwin (push) Has been cancelled
Build X servers / Release pushed tag (push) Has been cancelled
Signed-off-by: Leandro Nini <drfiemost@users.sourceforge.net>
2026-05-11 10:14:30 +02:00
Enrico Weigelt, metux IT consult
ff683048eb dix: events: SetInputFocus(): handle memory allocation failure
Some checks failed
Build X servers / xserver-build-ubuntu (push) Has been cancelled
Build X servers / drivers-build-ubuntu (push) Has been cancelled
Build X servers / xserver-build-mingw32-ubuntu (push) Has been cancelled
Build X servers / xserver-build-macos (push) Has been cancelled
Build X servers / xserver-build-freebsd (push) Has been cancelled
Build X servers / xserver-build-dragonflybsd (push) Has been cancelled
Build X servers / xserver-build-netbsd (push) Has been cancelled
Build X servers / xserver-build-cygwin (push) Has been cancelled
Build X servers / Release pushed tag (push) Has been cancelled
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-05-07 10:07:39 +02:00
Enrico Weigelt, metux IT consult
0b7b85a8c7 Xi: xigrabdev: fix FTBS on *BSD
Some checks are pending
Build X servers / xserver-build-ubuntu (push) Waiting to run
Build X servers / drivers-build-ubuntu (push) Waiting to run
Build X servers / xserver-build-mingw32-ubuntu (push) Waiting to run
Build X servers / xserver-build-macos (push) Waiting to run
Build X servers / xserver-build-freebsd (push) Waiting to run
Build X servers / xserver-build-dragonflybsd (push) Waiting to run
Build X servers / xserver-build-netbsd (push) Waiting to run
Build X servers / xserver-build-cygwin (push) Waiting to run
Build X servers / Release pushed tag (push) Blocked by required conditions
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-05-06 19:20:08 +02:00
Peter Hutterer
10d2d1a7ae Xi: Fix XIPassiveGrab handling of keycodes > 255
Some checks are pending
Build X servers / xserver-build-ubuntu (push) Waiting to run
Build X servers / drivers-build-ubuntu (push) Waiting to run
Build X servers / xserver-build-mingw32-ubuntu (push) Waiting to run
Build X servers / xserver-build-macos (push) Waiting to run
Build X servers / xserver-build-freebsd (push) Waiting to run
Build X servers / xserver-build-dragonflybsd (push) Waiting to run
Build X servers / xserver-build-netbsd (push) Waiting to run
Build X servers / xserver-build-cygwin (push) Waiting to run
Build X servers / Release pushed tag (push) Blocked by required conditions
This was fixed in commit 51eb63b0ee but woefully badly. Instead of returning
XIAlreadyGrabbed via the Reply, it simply returned the value from the
request handler - causing the server to interpret it as BadRequest.

Fix it and do what we intended to do instead.

Fixes: 51eb63b0ee ("Xi: disallow passive grabs with a detail > 255")
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2186>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-05-06 13:46:05 +02:00
Peter Hutterer
6e2ee6ab51 Xi: fix ProcXIGrabDevice returning AlreadyGrabbed as X error code
When the target device is disabled, ProcXIGrabDevice returns
AlreadyGrabbed directly as the request handler return value.
AlreadyGrabbed (1) is a grab status code, not an X error code. The
server dispatch loop interprets any non-zero return value as an X
protocol error, so the client receives BadRequest (error code 1)
instead of a proper XIGrabDevice reply with status=AlreadyGrabbed.

And use XIAlreadyGrabbed since this is an XI2 request. It's the same
value anyway.

This is the same class of bug that was fixed in ProcXIPassiveGrabDevice
by commit 'Xi: Fix XIPassiveGrab handling of keycodes > 255'

Fix by jumping to the reply path with status=AlreadyGrabbed instead of
returning the status code directly.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2186>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-05-06 13:45:42 +02:00
Oleh Nykyforchyn
e7af4b04bc (release) xserver: config: split 10-nvidia.conf file
Some checks failed
Build X servers / xserver-build-ubuntu (push) Has been cancelled
Build X servers / drivers-build-ubuntu (push) Has been cancelled
Build X servers / xserver-build-mingw32-ubuntu (push) Has been cancelled
Build X servers / xserver-build-macos (push) Has been cancelled
Build X servers / xserver-build-freebsd (push) Has been cancelled
Build X servers / xserver-build-dragonflybsd (push) Has been cancelled
Build X servers / xserver-build-netbsd (push) Has been cancelled
Build X servers / xserver-build-cygwin (push) Has been cancelled
Build X servers / Release pushed tag (push) Has been cancelled
XLibre 10-nvidia.conf is extended w.r.t. XOrg version and can be overwritten by
NVidia installers or packages, hence it is safer to split it into 10-nvidia.conf
(a common part) and 10-nvidia-modules.conf (an extra part).

This patch also provides /etc/X11/xorg.conf.d/10-nvidia.conf.debian and
/etc/X11/xorg.conf.d/10-nvidia-modules.conf.debian files that, when .debian
suffix is removed, shadow the respective files in /usr/share/X11/xorg.conf.d
and set Debian specific search directories for drivers and modules.

Signed-off-by: Oleh Nykyforchyn <oleh.nyk@gmail.com>
2026-05-04 16:58:37 +02:00
Peter Hutterer
83fa3ba427 xkb: fail if we can't strdup our default rules
If we fail to set up the default rules our keymap is likely going to end
up messed up, which means the client/user can't work correctly anyway.
And if we're that low on memory that we can't allocate these rules,
we're about to fall over anyway so why bother.

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2184>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-05-04 16:54:38 +02:00
Enrico Weigelt, metux IT consult
d569df1197 Xext: sync: NULL pointer protection in FreeCounter()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-05-04 16:54:28 +02:00
John Studnicka
3e204961dd modesetting: Handle reflected/rotated cursors better
Some checks are pending
Build X servers / xserver-build-ubuntu (push) Waiting to run
Build X servers / drivers-build-ubuntu (push) Waiting to run
Build X servers / xserver-build-mingw32-ubuntu (push) Waiting to run
Build X servers / xserver-build-macos (push) Waiting to run
Build X servers / xserver-build-freebsd (push) Waiting to run
Build X servers / xserver-build-dragonflybsd (push) Waiting to run
Build X servers / xserver-build-netbsd (push) Waiting to run
Build X servers / xserver-build-cygwin (push) Waiting to run
Build X servers / Release pushed tag (push) Blocked by required conditions
Moved the cursor glyph cropping into a separate function that handles reflections and rotations.

Also, x/y are indexes into the buffer, so they should be clamped to width/height len - 1 for correctness.

Signed-off-by: John Studnicka <contact@zentec.dev>
2026-05-04 16:51:47 +02:00
John Studnicka
317d553de9 modesetting: Clamp image dims to avoid OOB reads
Signed-off-by: John Studnicka <contact@zentec.dev>
2026-05-04 16:51:47 +02:00
John Studnicka
3211e80553 modesetting: Rotate cursor to match screen
Signed-off-by: John Studnicka <contact@zentec.dev>
2026-05-04 16:51:47 +02:00
John Studnicka
05d549c847 modesetting: Fall back to SW cursor for OOB dims
Signed-off-by: John Studnicka <contact@zentec.dev>
2026-05-04 16:51:47 +02:00
Peter Hutterer
a8f1cb636a modesetting: add NULL check for drmModeObjectGetProperties in VRR check
Some checks failed
Build X servers / xserver-build-ubuntu (push) Has been cancelled
Build X servers / drivers-build-ubuntu (push) Has been cancelled
Build X servers / xserver-build-mingw32-ubuntu (push) Has been cancelled
Build X servers / xserver-build-macos (push) Has been cancelled
Build X servers / xserver-build-freebsd (push) Has been cancelled
Build X servers / xserver-build-dragonflybsd (push) Has been cancelled
Build X servers / xserver-build-netbsd (push) Has been cancelled
Build X servers / xserver-build-cygwin (push) Has been cancelled
Build X servers / Release pushed tag (push) Has been cancelled
Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2184>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-05-01 18:52:44 +02:00
Enrico Weigelt, metux IT consult
0b99755ee7 dix: AddInputDevice(): fix missing dixFreePrivates() on allocation failure
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-05-01 18:52:31 +02:00
Peter Hutterer
b1da4365ce glx: handle strdup allocation failures
Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2184>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-05-01 18:51:49 +02:00
Enrico Weigelt, metux IT consult
3598633f87 dix: devices: fix missing free in AddInputDevice()
When dixCallDeviceAccessCallback() rejects, we need to really clean up.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-05-01 18:51:35 +02:00
Peter Hutterer
3012bac741 glx: fail if we can't init a screen
Not worth figuring out the perfect cleanup path here

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2184>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-05-01 18:50:44 +02:00
Peter Hutterer
532bf8243a mi: fail on reallocarray failure in miAppendSpans
Use the XNF version for this and simply bail out if it fails. Clearly
this hasn't been a problem in over 20 years and I can't be bothered
finding the perfect cleanup path.

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2184>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-05-01 18:50:37 +02:00
Peter Hutterer
f8cba41b4e xkb: fix client-triggerable memory leak in ProcXkbGetKbdByName
CHK_MASK_LEGAL expands to 'return BadValue' when the check fails and
doesn't clean up the already allocated names.keycodes, names.types, etc.

Move the check up so we don't need any cleanup code.

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2184>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-05-01 18:50:27 +02:00
Enrico Weigelt, metux IT consult
044e6b6fc2 dix: AllocDevicePair(): clean up on allocation failure
On allocation error, also have to remove devices and possibly
clear out some other pointers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-05-01 18:49:52 +02:00
Enrico Weigelt, metux IT consult
c1fa47d465 Xext: sync: handle strdup() alloc fail in SyncCreateSystemCounter()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-05-01 18:47:17 +02:00
Enrico Weigelt, metux IT consult
0b66a0bd64 dix: InitTouchClassDeviceStruct(): clear touch pointer in device on error
Some checks are pending
Build X servers / xserver-build-ubuntu (push) Waiting to run
Build X servers / drivers-build-ubuntu (push) Waiting to run
Build X servers / xserver-build-mingw32-ubuntu (push) Waiting to run
Build X servers / xserver-build-macos (push) Waiting to run
Build X servers / xserver-build-freebsd (push) Waiting to run
Build X servers / xserver-build-dragonflybsd (push) Waiting to run
Build X servers / xserver-build-netbsd (push) Waiting to run
Build X servers / xserver-build-cygwin (push) Waiting to run
Build X servers / Release pushed tag (push) Blocked by required conditions
Clear the pointer to touch structure on error path

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-05-01 18:43:39 +02:00
Peter Hutterer
9d57bb7c36 xkb: Handle allocation failures in _XkbNextFreeFilter()
Finally, after 33 years something deals with the allocation failure. Put
on a party hat!

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2184>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-05-01 18:43:16 +02:00
Peter Hutterer
eed70d2451 Xi: fail if we can't assign device names
Some checks are pending
Build X servers / xserver-build-ubuntu (push) Waiting to run
Build X servers / drivers-build-ubuntu (push) Waiting to run
Build X servers / xserver-build-mingw32-ubuntu (push) Waiting to run
Build X servers / xserver-build-macos (push) Waiting to run
Build X servers / xserver-build-freebsd (push) Waiting to run
Build X servers / xserver-build-dragonflybsd (push) Waiting to run
Build X servers / xserver-build-netbsd (push) Waiting to run
Build X servers / xserver-build-cygwin (push) Waiting to run
Build X servers / Release pushed tag (push) Blocked by required conditions
During extension init this makes sense, failing to assign a name to a
new device is more controversial but none of the paths handle
this situation correctly right now so we're just as likely to introduce
an exploit if the name remains NULL.

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2184>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-30 19:35:01 +02:00
Olivier Fourdan
5b4ad0ddc3 dix: Silent static analyzer warning
Some checks are pending
Build X servers / xserver-build-ubuntu (push) Waiting to run
Build X servers / drivers-build-ubuntu (push) Waiting to run
Build X servers / xserver-build-mingw32-ubuntu (push) Waiting to run
Build X servers / xserver-build-macos (push) Waiting to run
Build X servers / xserver-build-freebsd (push) Waiting to run
Build X servers / xserver-build-dragonflybsd (push) Waiting to run
Build X servers / xserver-build-netbsd (push) Waiting to run
Build X servers / xserver-build-cygwin (push) Waiting to run
Build X servers / Release pushed tag (push) Blocked by required conditions
| dix/dixfonts.c:849:5: var_decl: Declaring variable "namelen" without initializer.
 | dix/dixfonts.c:932:17: uninit_use: Using uninitialized value "namelen".
 |    930|                   c->savedNumFonts = numFonts;
 |    931|                   free(c->savedName);
 |    932|->                 c->savedName = XNFalloc(namelen + 1);
 |    933|                   memcpy(c->savedName

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2195>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-30 19:30:56 +02:00
Peter Hutterer
4f9fab1ff3 panoramiX: fail if we can't allocate our visual arrays
This code has failed for decades by triggering a segfault, let's not
bother figuring out the perfect cleanup path.

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2184>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-30 19:19:20 +02:00
Enrico Weigelt, metux IT consult
9c53edbec2 xkb: XkbAddGeomProperty(): handle OOM on strdup()
Some checks are pending
Build X servers / xserver-build-ubuntu (push) Waiting to run
Build X servers / drivers-build-ubuntu (push) Waiting to run
Build X servers / xserver-build-mingw32-ubuntu (push) Waiting to run
Build X servers / xserver-build-macos (push) Waiting to run
Build X servers / xserver-build-freebsd (push) Waiting to run
Build X servers / xserver-build-dragonflybsd (push) Waiting to run
Build X servers / xserver-build-netbsd (push) Waiting to run
Build X servers / xserver-build-cygwin (push) Waiting to run
Build X servers / Release pushed tag (push) Blocked by required conditions
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-30 18:43:18 +02:00
Peter Hutterer
438cc358b2 mi: Handle allocation failure in XYToWindow() spriteTrace realloc
Some checks are pending
Build X servers / xserver-build-ubuntu (push) Waiting to run
Build X servers / drivers-build-ubuntu (push) Waiting to run
Build X servers / xserver-build-mingw32-ubuntu (push) Waiting to run
Build X servers / xserver-build-macos (push) Waiting to run
Build X servers / xserver-build-freebsd (push) Waiting to run
Build X servers / xserver-build-dragonflybsd (push) Waiting to run
Build X servers / xserver-build-netbsd (push) Waiting to run
Build X servers / xserver-build-cygwin (push) Waiting to run
Build X servers / Release pushed tag (push) Blocked by required conditions
Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2184>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-30 18:21:40 +02:00
Peter Hutterer
ea34fd5510 Xi: add NULL checks to handle malloc failures
Some checks are pending
Build X servers / xserver-build-ubuntu (push) Waiting to run
Build X servers / drivers-build-ubuntu (push) Waiting to run
Build X servers / xserver-build-mingw32-ubuntu (push) Waiting to run
Build X servers / xserver-build-macos (push) Waiting to run
Build X servers / xserver-build-freebsd (push) Waiting to run
Build X servers / xserver-build-dragonflybsd (push) Waiting to run
Build X servers / xserver-build-netbsd (push) Waiting to run
Build X servers / xserver-build-cygwin (push) Waiting to run
Build X servers / Release pushed tag (push) Blocked by required conditions
Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2184>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-30 18:04:26 +02:00
Peter Hutterer
cbf83e8928 os/client: fix kvm handle leak and NULL dereferences on OpenBSD
And remove a redundant argv == NULL check

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2184>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-30 17:57:41 +02:00
Enrico Weigelt, metux IT consult
b2f32ff5fc xkb: zero out structs and arrays
Some checks are pending
Build X servers / xserver-build-ubuntu (push) Waiting to run
Build X servers / drivers-build-ubuntu (push) Waiting to run
Build X servers / xserver-build-mingw32-ubuntu (push) Waiting to run
Build X servers / xserver-build-macos (push) Waiting to run
Build X servers / xserver-build-freebsd (push) Waiting to run
Build X servers / xserver-build-dragonflybsd (push) Waiting to run
Build X servers / xserver-build-netbsd (push) Waiting to run
Build X servers / xserver-build-cygwin (push) Waiting to run
Build X servers / Release pushed tag (push) Blocked by required conditions
Just to be on the safe side: prevent potential leaks.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-30 15:20:49 +02:00
Enrico Weigelt, metux IT consult
f9bfa45ff9 hotfix release xlibre-xserver-25.1.5
Some checks failed
Build X servers / xserver-build-ubuntu (push) Has been cancelled
Build X servers / drivers-build-ubuntu (push) Has been cancelled
Build X servers / xserver-build-mingw32-ubuntu (push) Has been cancelled
Build X servers / xserver-build-macos (push) Has been cancelled
Build X servers / xserver-build-freebsd (push) Has been cancelled
Build X servers / xserver-build-dragonflybsd (push) Has been cancelled
Build X servers / xserver-build-netbsd (push) Has been cancelled
Build X servers / xserver-build-cygwin (push) Has been cancelled
Build X servers / Release pushed tag (push) Has been cancelled
xlibre-xserver-25.1.5
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-28 19:12:28 +02:00
Enrico Weigelt, metux IT consult
0842210f93 xfixes: region: fix duplicate reply field swapping
Some checks are pending
Build X servers / xserver-build-ubuntu (push) Waiting to run
Build X servers / drivers-build-ubuntu (push) Waiting to run
Build X servers / xserver-build-mingw32-ubuntu (push) Waiting to run
Build X servers / xserver-build-macos (push) Waiting to run
Build X servers / xserver-build-freebsd (push) Waiting to run
Build X servers / xserver-build-dragonflybsd (push) Waiting to run
Build X servers / xserver-build-netbsd (push) Waiting to run
Build X servers / xserver-build-cygwin (push) Waiting to run
Build X servers / Release pushed tag (push) Blocked by required conditions
The sequenceNumber and length fields are already swapped behind the scenes
by X_SEND_REPLY*() macros, so we must not swap them here a second time.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-28 18:53:26 +02:00
Peter Hutterer
88caad6a7d Xext/xres: fix undefined behavior in ConstructClientIdValue
Some checks are pending
Build X servers / xserver-build-ubuntu (push) Waiting to run
Build X servers / drivers-build-ubuntu (push) Waiting to run
Build X servers / xserver-build-mingw32-ubuntu (push) Waiting to run
Build X servers / xserver-build-macos (push) Waiting to run
Build X servers / xserver-build-freebsd (push) Waiting to run
Build X servers / xserver-build-dragonflybsd (push) Waiting to run
Build X servers / xserver-build-netbsd (push) Waiting to run
Build X servers / xserver-build-cygwin (push) Waiting to run
Build X servers / Release pushed tag (push) Blocked by required conditions
The CARD32 *value pointer was computed as (ptr + sizeof(rep))
BEFORE the NULL check for ptr. If AddFragment returns NULL, this
performs pointer arithmetic on a null pointer, which is undefined
behavior per C11 section 6.5.6 paragraph 8. With aggressive compiler
optimizations (e.g., GCC -O2 with LTO), the compiler could reason
that since ptr was used in arithmetic, it must be non-NULL, and
optimize away the NULL check entirely. This would then cause a
write to an invalid address on OOM.

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2181>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-28 11:02:51 +02:00
Peter Hutterer
6d02f4516b present: add missing byte swapping for various fields
Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2181>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-28 11:02:39 +02:00
Enrico Weigelt, metux IT consult
952ac17ca8 randr: fix missing byte swaps
Some fields have been forgotten to be byte-swapped.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-28 11:02:31 +02:00
Enrico Weigelt, metux IT consult
c27f7f6794 randr: ProcRRSetMonitor(): fix request size check
We have to check against xRRSetMonitorsReq instead of xRRGetMonitorsReq.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-28 11:02:20 +02:00
b-aaz
024cfddd57 glamor: export some glamor APIs used by xorgxrdp.
Some checks are pending
Build X servers / xserver-build-ubuntu (push) Waiting to run
Build X servers / drivers-build-ubuntu (push) Waiting to run
Build X servers / xserver-build-mingw32-ubuntu (push) Waiting to run
Build X servers / xserver-build-macos (push) Waiting to run
Build X servers / xserver-build-freebsd (push) Waiting to run
Build X servers / xserver-build-dragonflybsd (push) Waiting to run
Build X servers / xserver-build-netbsd (push) Waiting to run
Build X servers / xserver-build-cygwin (push) Waiting to run
Build X servers / Release pushed tag (push) Blocked by required conditions
The recent development versions of xorgxrdp require these 5 glamor_*
functions that were made private in the past:

glamor_fds_from_pixmap:        Made private in ea232c7
glamor_pixmap_from_fds:        Made private in 81c1479
glamor_get_formats:            Made private in 6f6aab8
glamor_get_modifiers:          Made private in 0644764
glamor_get_drawable_modifiers: Made private in 800ab10

Exporting them again to make xorgxrdp compilable with XLibre.

Signed-off-by: b-aaz <b-aazbsd@proton.me>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-28 10:30:08 +02:00
Peter Hutterer
73d7d57111 Xext/xres: fix wrong swap check
Some checks are pending
Build X servers / xserver-build-ubuntu (push) Waiting to run
Build X servers / drivers-build-ubuntu (push) Waiting to run
Build X servers / xserver-build-mingw32-ubuntu (push) Waiting to run
Build X servers / xserver-build-macos (push) Waiting to run
Build X servers / xserver-build-freebsd (push) Waiting to run
Build X servers / xserver-build-dragonflybsd (push) Waiting to run
Build X servers / xserver-build-netbsd (push) Waiting to run
Build X servers / xserver-build-cygwin (push) Waiting to run
Build X servers / Release pushed tag (push) Blocked by required conditions
The byte-swap check for rep.spec.client used 'client->swapped'
(the queried client) instead of 'sendClient->swapped' (the
requesting client). The reply is sent to sendClient, so swapping
must be based on sendClient's byte order. When a byte-swapped
client queries a native-byte-order client (or vice versa), the
spec.client field in the reply has the wrong byte order, causing
the client library to misinterpret the XID. Lines 504 and later
correctly use sendClient->swapped, so this was an oversight.

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2181>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-27 19:08:36 +02:00
Peter Hutterer
2f32fa61ed glx: fix wrong pointer passed to non-swap handlers in TexImage/CopySubBuffer
Three GLX byte-swap dispatch functions advance the pc pointer past the
vendor private header (pc += __GLX_VENDPRIV_HDR_SIZE) for local field
swapping, then pass the ADVANCED pc to the non-swap handler. But the
non-swap handlers expect pc to point to the start of the
xGLXVendorPrivateReq — they cast pc to xGLXVendorPrivateReq* to access
req->contextTag, then do their own pc += __GLX_VENDPRIV_HDR_SIZE.

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2181>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-27 19:08:21 +02:00
Peter Hutterer
c36700e418 Zero out structs to avoid leaking information via padding
Structs that are sent to the client may leak data via unititialized
padding bytes. Let's not do that.

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2185>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-27 19:08:06 +02:00
Enrico Weigelt, metux IT consult
be90583c46 randr: ProcRRSetMonitor(): fix missing request field swaps
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-27 19:07:21 +02:00
Enrico Weigelt, metux IT consult
cd1d456a08 Xi: XProcXChangeDeviceControl(): fix missing request parameter bytewap
Some checks are pending
Build X servers / xserver-build-ubuntu (push) Waiting to run
Build X servers / drivers-build-ubuntu (push) Waiting to run
Build X servers / xserver-build-mingw32-ubuntu (push) Waiting to run
Build X servers / xserver-build-macos (push) Waiting to run
Build X servers / xserver-build-freebsd (push) Waiting to run
Build X servers / xserver-build-dragonflybsd (push) Waiting to run
Build X servers / xserver-build-netbsd (push) Waiting to run
Build X servers / xserver-build-cygwin (push) Waiting to run
Build X servers / Release pushed tag (push) Blocked by required conditions
Unlikely that those operations ever coming from a remote client,
let alone one with different endianess, but nevertheless let's be
correct here :)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-27 17:21:57 +02:00
Enrico Weigelt, metux IT consult
d718e0e6dc Xext: sync: fix missing byte swap in ProcSyncQueryAlarm()
The reply's `value_type` field had been forgotten.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-27 17:07:19 +02:00
Enrico Weigelt, metux IT consult
9980166f74 glx: __glXDispSwap_CopyContext(): fix missing byte swap
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-27 17:06:58 +02:00
Enrico Weigelt, metux IT consult
3e28306e8e Xext: xres: ProcXResQueryClientIds() fix request field wapping
Some checks are pending
Build X servers / xserver-build-ubuntu (push) Waiting to run
Build X servers / drivers-build-ubuntu (push) Waiting to run
Build X servers / xserver-build-mingw32-ubuntu (push) Waiting to run
Build X servers / xserver-build-macos (push) Waiting to run
Build X servers / xserver-build-freebsd (push) Waiting to run
Build X servers / xserver-build-dragonflybsd (push) Waiting to run
Build X servers / xserver-build-netbsd (push) Waiting to run
Build X servers / xserver-build-cygwin (push) Waiting to run
Build X servers / Release pushed tag (push) Blocked by required conditions
The individual spec entries' fields also need to be swapped.
Each is made of two CARD32's.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-27 17:02:04 +02:00
Jon Turney
795b523b93 hw/xwin: Use revert-to-parent X focus mode in multiwindow WM
Some checks are pending
Build X servers / xserver-build-ubuntu (push) Waiting to run
Build X servers / drivers-build-ubuntu (push) Waiting to run
Build X servers / xserver-build-mingw32-ubuntu (push) Waiting to run
Build X servers / xserver-build-macos (push) Waiting to run
Build X servers / xserver-build-freebsd (push) Waiting to run
Build X servers / xserver-build-dragonflybsd (push) Waiting to run
Build X servers / xserver-build-netbsd (push) Waiting to run
Build X servers / xserver-build-cygwin (push) Waiting to run
Build X servers / Release pushed tag (push) Blocked by required conditions
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>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-27 15:26:26 +02:00
Jon Turney
3860a2add2 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>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-27 15:26:05 +02:00
Jon Turney
7900c7e30a 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>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-04-27 15:25:49 +02:00