1467 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult
080413fe1f Xext: damage: DamageExtSetCritical() replace Bool by bool
Prefer C standard stdbool over Xlib's own type.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-22 08:58:36 +01:00
Aggelos Tselios
2683973d51 Xext: namespace: Allow using tabs as delimeters
Allow the parseLine() function to use tabs alongside spaces to separate
tokens. Without this patch, using tabs in the config file actually
confuses the parser and makes it think that the tab is part of the
option's name.

Signed-off-by: Aggelos Tselios <aggelostselios777@gmail.com>
2026-01-22 08:57:15 +01:00
Aggelos Tselios
f9ddcbd9ae Xext: namespace: Properly document parseLine() function
The previous comment made no sense. Add a proper comment to document the
function instead.

Signed-off-by: Aggelos Tselios <aggelostselios777@gmail.com>
2026-01-22 08:57:15 +01:00
squishypinkelephant
02f1efe2bc Xext: shape: replace ShapeEventType resource by devPrivate
Instead of abusing resource types, use the standard devPrivate
mechanism for assigning auxillary data to windows.

Signed-off-by: squishypinkelephant <squishypinkelephant@gmail.com>
2026-01-12 10:11:55 +01:00
stefan11111
5d3490d135 Xext/dri2: Fix small memory leak.
Fixes: https://github.com/X11Libre/xserver/pull/1414
Fixes: https://github.com/X11Libre/xserver/issues/1413
(Fixes the small leak that was mentioned there,
not sure if there isn't a bigger one somewhere else)

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-12 09:13:24 +01:00
stefan11111
65d4e5e081 Xext/dri2: Fix message logging
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-06 19:23:34 +01:00
stefan11111
dc39eda42b treewide: Move the dri2 extension to Xext and use it for all X servers
This is needed to get proton working in Xfbdev, but is probably useful in other places too.

Xephyr has some unrelated issues regaring Xinput, so steam doesn't work there.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2026-01-02 17:51:43 +01:00
Enrico Weigelt, metux IT consult
05fe0b519f Xext: selinux: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-01 13:23:22 +01:00
Enrico Weigelt, metux IT consult
8ff401cde1 Xext: xres: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-01 13:23:22 +01:00
Enrico Weigelt, metux IT consult
a0cd40d5af Xext: xvmc: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-01 13:23:22 +01:00
Enrico Weigelt, metux IT consult
f122e2bb86 Xext: shm: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-01 13:23:22 +01:00
Enrico Weigelt, metux IT consult
dcb9329b37 Xext: saver: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-01 13:23:22 +01:00
Enrico Weigelt, metux IT consult
2a6b886563 Xext: dpms: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-01 13:23:22 +01:00
b-aaz
8368df64d1 Xext: xf86bigfont: Include osdep.h for OsSignal.
osdep.h holds the definition for OsSignal, and it was not included in
xf86bigfont which used it. This lead to build errors on Cygwin.

Signed-off-by: b-aaz <b-aazbsd@proton.me>
2025-12-21 12:59:03 +01:00
b-aaz
7f7efe8195 Revert 9a82f5c, bring back Cygwin support.
Brought back the code removed in that commit so that we can bring back
Cygwin support.
Small changes are done in the process of resolving conflicts against the
current head.

Some checks have not been reverted, because they were not necessary
anymore.

Signed-off-by: b-aaz <b-aazbsd@proton.me>
2025-12-21 12:59:03 +01:00
Enrico Weigelt, metux IT consult
9bd66fc97d Xext: security: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-21 12:04:33 +01:00
Enrico Weigelt, metux IT consult
e85db86ced Xext: damage: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-21 12:01:33 +01:00
Enrico Weigelt, metux IT consult
ec973853c9 Xext: xtest: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-21 11:57:12 +01:00
Enrico Weigelt, metux IT consult
6f7aa46c51 Xext: geext: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-21 11:54:29 +01:00
Enrico Weigelt, metux IT consult
2e6a9a1fbc Xext: bigreq: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-21 11:54:12 +01:00
Enrico Weigelt, metux IT consult
7b15c8a9b4 xext: xvdisp: fix printf format
> ../Xext/xvdisp.c: In function ‘ProcXvListImageFormats’:
> ../Xext/xvdisp.c:1017:81: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘size_t’ {aka ‘unsigned int’} [-Wformat=]
>  1017 |         LogMessage(X_WARNING, "ProcXvListImageFormats() payload_len mismatch: %ld but shoud be %d\n",
>       |                                                                               ~~^
>       |                                                                                 |
>       |                                                                                 long int
>       |                                                                               %d
>  1018 |                    rpcbuf.wpos, (pPort->pAdaptor->nImages*sz_xvImageFormatInfo));
>       |                    ~~~~~~~~~~~
>       |                          |
>       |                          size_t {aka unsigned int}

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-11 10:28:49 +01:00
Enrico Weigelt, metux IT consult
980385e2ec xext: namespace: fix printf format string
../Xext/namespace/hook-init-rootwindow.c: In function ‘hookInitRootWindow’:
../Xext/namespace/hook-init-rootwindow.c:38:21: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘XID’ {aka ‘long unsigned int’} [-Wformat=]
   38 |             XNS_LOG("<%s> actual root 0x%0" PRIx32 "\n", walk->name, walk->rootWindow->drawable.id);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                                |
      |                                                                                                XID {aka long unsigned int}
../Xext/namespace/namespace.h:71:50: note: in definition of macro ‘XNS_LOG’
   71 | #define XNS_LOG(...) do { printf("XNS "); printf(__VA_ARGS__); } while (0)
      |                                                  ^~~~~~~~~~~
../Xext/namespace/hook-init-rootwindow.c:38:43: note: format string is defined here
   38 |             XNS_LOG("<%s> actual root 0x%0" PRIx32 "\n", walk->name, walk->rootWindow->drawable.id);
      |                                         ~~^
      |                                           |
      |                                           unsigned int
      |                                         %0lx
../Xext/namespace/hook-init-rootwindow.c:70:17: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘XID’ {aka ‘long unsigned int’} [-Wformat=]
   70 |         XNS_LOG("<%s> virtual root 0x%0" PRIx32 "\n", walk->name, walk->rootWindow->drawable.id);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                             |
      |                                                                                             XID {aka long unsigned int}
../Xext/namespace/namespace.h:71:50: note: in definition of macro ‘XNS_LOG’
   71 | #define XNS_LOG(...) do { printf("XNS "); printf(__VA_ARGS__); } while (0)
      |                                                  ^~~~~~~~~~~
../Xext/namespace/hook-init-rootwindow.c:70:40: note: format string is defined here
   70 |         XNS_LOG("<%s> virtual root 0x%0" PRIx32 "\n", walk->name, walk->rootWindow->drawable.id);
      |                                      ~~^
      |                                        |
      |                                        unsigned int
      |                                      %0lx

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-10 19:58:21 +01:00
Enrico Weigelt, metux IT consult
e097ea8a83 Xext: xf86bigfont: add missing include of os/osdep.h
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-10 14:53:52 +01:00
Enrico Weigelt, metux IT consult
b08b8d6256 namespace: hook-resource: fix printf formats
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-10 11:09:48 +01:00
Enrico Weigelt, metux IT consult
090c68e13d Xext: consistenly name reply structs "reply" instead of "rep"
Preparation for future use of generic reply assembly macros.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-03 14:29:29 +01:00
Enrico Weigelt, metux IT consult
33729b1361 include: windowstr.h: unexport w*() macros
These aren't used by any drivers, so no need to keep them public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 19:54:42 +01:00
Enrico Weigelt, metux IT consult
9b8d7d1eb9 treewide: don't include <region.h> anymore
Nothing in there that we need, include <regionstr.h> instead.
But keeping the file in place, until all external consumer have
been migrated.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 19:27:27 +01:00
Enrico Weigelt, metux IT consult
bddf4ae8e8 xfree86: move over xf86vidmode extension to hw/xfree86
This extension is private to the xfree86 DDX, no other one supports it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 14:03:37 +01:00
Enrico Weigelt, metux IT consult
b7e9544318 Xext: xvmc: drop dead SHM code path
Xvmc isn't using SHM for over 20 years now. There's still a code path for it
that could be enabled explicitly by manually setting HAS_XVMCSHM, but no
indication whatsoever that this ever has been done.

Considering that Xvmc in general already is obsolete for very long time now,
we can safely assume this code path is really dead and can be removed.

Fixes: 9a26d6f39e199bad287d4e538ef75700a0102788
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 13:50:11 +01:00
Enrico Weigelt, metux IT consult
c503343a6b Xext: Xvmc: drop XvMCScreenKey macro
Directly use the actual field instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 13:47:59 +01:00
Enrico Weigelt, metux IT consult
85fae9bffb dix: inline SProcAllocColor()
Now that we have untwisted Xinerama side, it's trivial to inline
the few lines for byte-swapping into the actual handlers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 13:46:37 +01:00
Enrico Weigelt, metux IT consult
fda3695872 os: move MILLI_PER_MIN and MILLI_PER_SECOND to osdep.h
Not needed in public SDK, so move them into a private header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 11:58:45 +01:00
Herman Semenov
50037a450d Xext: remove excess dobule-check pointer (IsSystemCounter already have) 2025-11-26 16:47:14 +01:00
Mike Gelfand
d7e0b9e5c2 xext: move include guards up to wrap the whole file
See: https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html
Signed-off-by: Mike Gelfand <mikedld@mikedld.com>
2025-11-21 15:20:11 +01:00
Enrico Weigelt, metux IT consult
0bfa59e601 Xext: sleepuntil: drop obsolete support for internal server reset
Not used anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-20 19:26:00 +01:00
Enrico Weigelt, metux IT consult
f0347e249c Xext: panoramiX: drop server reset support
Not needed anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-20 19:22:55 +01:00
Enrico Weigelt, metux IT consult
44077ee11c dix: unexport screenIsSaved and HasSaverWindow()
These aren't used by any external drivers, so no need to keep them public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-20 17:52:23 +01:00
Enrico Weigelt, metux IT consult
b0ac921156 dix: unexport GrabInProgress
Only internally within OS layer and screen saver logic,
so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-20 17:42:29 +01:00
Enrico Weigelt, metux IT consult
cf105bc990 dix/Xinerama: untwist X_AllocColor request handling
Instead of internally faking requests, factor out the actual logic
into separate function, which is getting everything it needs as
parameters, so no need to fiddle with request buffer anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-03 17:24:24 +01:00
Enrico Weigelt, metux IT consult
0fbb681fce treewide: use helper dixGetScreenPtr() for retrieving ScreenPtr's
Instead of directly accessing the global screenInfo.screens[] array,
let everybody go through a little inline helper. This one also checks
for array bounds - if the screen doesn't exist, return NULL.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-10-30 09:44:24 +01:00
stefan11111
5b8ab55702 shm: Don't mark the globally-initialized privates as uninitialized in a CloseScreen hook.
No need to mark anything, because duplicate dixRegisterPrivateKey() calls with same parameters are perfectly valid.
See: https://github.com/X11Libre/xserver/pull/1300

Fixes: https://github.com/X11Libre/xserver/commit/d220a0a9f0473c15d5001f4730613b482eb0e39

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-29 11:23:33 +01:00
Enrico Weigelt, metux IT consult
04d4986004 dix: split ProcCreateWindow() into upper and lower half
In order to reduce complexity of wrapped core request handlers with PanoramiX,
split the ProcCreateWindow() function into two pieces: the upper half is the
usual (non-PanoramiX) handler, while the lower one is what's called by both
the usual handler, as well as the PanoramiX' one.

We're already passing in the request parameters as separate pointers, so
follow-up commits can easily change PanoramiX handler to not tweaking the
request buffer directly anymore. Another one is letting PanoramiXCreateWindow()
be called by ProcCreateWindow explicitly (when enabled), so we don't need to
wrap the core request proc vector anymore. Once that's done, the swapping can
also be moved into ProcCreateWindow().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-10-29 11:03:19 +01:00
stefan11111
d220a0a9f0 shm: Fix segfault when the last X client closes
Fixes: https://github.com/X11Libre/xserver/pull/1236

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-10-27 09:27:52 +01:00
Enrico Weigelt, metux IT consult
7a0efe7da5 xv: use embedded private instead of pointer
The private struct is pretty small and it needs to be allocated anyways,
so save an extra allocation by directly embedding it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-10-26 13:57:49 +01:00
Enrico Weigelt, metux IT consult
fc14d32a1a dix: replace XACE_SCREEN_ACCESS by direct callback
Replace complicated xace hook by simple and cheap callback.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-10-22 13:53:25 +02:00
Enrico Weigelt, metux IT consult
38eedc3de5 Xext: shm: move ShmDescRec definition into shm.c
Only used inside shm.c, not anywhere else, so no need to keep it
in a public header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-10-21 20:36:44 +02:00
Enrico Weigelt, metux IT consult
a2068d6662 Xext: shm: drop obsolete ShmScreenClose()
Since it's now doing nothing more than unhooking itself, we really
don't need it anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-10-21 13:53:41 +02:00
Alan Coopersmith
238c1ccf4b Xext/xtest: avoid null dereference in ProcXTestFakeInput()
Reported in https://gitlab.freedesktop.org/xorg/xserver/-/issues/1817:

xwayland-24.1.6/redhat-linux-build/../Xext/xtest.c:383:14: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘dev’
xwayland-24.1.6/redhat-linux-build/../Xext/xtest.c:348:9: release_memory: ‘dev’ is NULL
xwayland-24.1.6/redhat-linux-build/../Xext/xtest.c:383:14: danger: dereference of NULL ‘dev’

xwayland-24.1.6/redhat-linux-build/../Xext/xtest.c:395:14: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘dev’
xwayland-24.1.6/redhat-linux-build/../Xext/xtest.c:348:9: release_memory: ‘dev’ is NULL
xwayland-24.1.6/redhat-linux-build/../Xext/xtest.c:395:14: danger: dereference of NULL ‘dev’

xwayland-24.1.6/redhat-linux-build/../Xext/xtest.c:426:14: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘dev’
xwayland-24.1.6/redhat-linux-build/../Xext
/xtest.c:348:9: release_memory: ‘dev’ is NULL
xwayland-24.1.6/redhat-linux-build/../Xext/xtest.c:426:14: danger: dereference of NULL ...
2025-10-21 13:02:04 +02:00
Alan Coopersmith
640a9cf51e Xext/xselinux: avoid memory leak in SELinuxAtomToSID()
Reported in https://gitlab.freedesktop.org/xorg/xserver/-/issues/1817:

xwayland-24.1.6/redhat-linux-build/../Xext/xselinux_label.c:142:13: warning[-Wanalyzer-malloc-leak]: leak of ‘rec’
xwayland-24.1.6/redhat-linux-build/../Xext/xselinux_label.c:133:1: enter_function: entry to ‘SELinuxAtomToSID’
xwayland-24.1.6/redhat-linux-build/../Xext/xselinux_label.c:141:15: acquire_memory: allocated here
xwayland-24.1.6/redhat-linux-build/../Xext/xselinux_label.c:69:12: branch_true: following ‘true’ branch...
xwayland-24.1.6/redhat-linux-build/../Xext/xselinux_label.c:142:13: danger: ‘rec’ leaks here; was allocated at [(2)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/1)
  140|       if (!rec) {
  141|           rec = calloc(1, sizeof(SELinuxAtomRec));
  142|->         if (!rec || !SELinuxArraySet(&arr_atoms, atom, rec))
  143|               return BadAlloc;
  144|       }

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2072>
2025-10-21 13:02:04 +02:00
Alan Coopersmith
c45edc0c51 Xext/xselinux: add fast path to ProcSELinuxListSelections()
If there's nothing to send, skip over a bunch of code to make a list
that won't be used, and hopefully make the code path clearer to both
humans and static analyzers, who raise errors as seen in https://gitlab.freedesktop.org/xorg/xserver/-/issues/1817 of
dereferencing NULL pointers when count == 0.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2072>
2025-10-21 13:02:04 +02:00