Commit Graph

356 Commits

Author SHA1 Message Date
dasha_uwu 7c64a06ba4 treewide: remove "lib" prefix in static_library names (meson)
this was producing static libraries named "liblibsomething.a"

Signed-off-by: dasha_uwu <dasha@linuxping.win>
2025-07-03 12:01:52 +02:00
Enrico Weigelt, metux IT consult 96be335fd3 miext: damage: use dixScreenHookPostClose() instead of dixScreenHookClose()
Some drivers need to call into damage from within their CloseScreen proc,
so damage teardown needs to be done after that, instead of before.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-02 15:41:37 +02:00
Enrico Weigelt, metux IT consult 6a10d96761 rootless: fix missing include of dix/screen_hooks_priv.h
We're using XorgScreenWindowPositionParamRec here, so need to include
that header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-27 13:59:13 +02:00
Mike Gelfand 565309bb33 miext: add/fix include guards where missing/broken
Skipped headers designed for multiple or non-trivial inclusion:
* miext/shadow/shrotpack.h
* miext/shadow/shrotpackYX.h

Signed-off-by: Mike Gelfand <mikedld@mikedld.com>
2025-06-27 13:58:05 +02:00
Enrico Weigelt, metux IT consult c8b81fdbc5 drop Xwayland
It always had it's own lifecycle (not been part of Xorg releases),
doesn't make sense to maintain a competing implementation that we
won't use anyways.

Once that's gone, we can also drop few things in core/dix that had
been added just for xwayland only.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-17 12:51:36 +02:00
dasha_uwu a776156b54 treewide: preemptively revert !1714 where it affects ABI compatibility
this adds dummy pointers in place of removed fields in some structs, only for
SDK headers, to preserve ABI
some of these fix segfaults for nvidia driver, some are preemptive

Signed-off-by: dasha_uwu <dasha@linuxping.win>
2025-06-16 10:32:48 +02:00
Enrico Weigelt, metux IT consult f790bae8dc Xnamespace: initial config loader
This loads the configuration (simple text file) passed via command line.
For now just supporting static configuration, that's loaded on server
startup.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 4379f7cc87 Xnamespace: namespace extension skeleton
Add tiny skeleton for the namespace extension. Disabled by default,
can be enabled via +extension arg, but doesn't actually do something yet.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult 3c028a8cc0 miext: move over extinit_priv.h from include
Since most of the extension init logic (and on/off switches for them)
is driven from miext, this seems the appropriate place for the header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:46 +02:00
Enrico Weigelt, metux IT consult 9a1c502865 miext: replace xallocarray() by calloc()
Only key difference that calloc(), in contrast to rellocarray(),
is zero-initializing. The overhead is hard to measure on today's
machines, and it's safer programming practise to always allocate
zero-initialized, so one can't forget to do it explicitly.

Cocci rule:

    @@
    expression COUNT;
    expression LEN;
    @@
    - xallocarray(COUNT,LEN)
    + calloc(COUNT,LEN)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:43 +02:00
Enrico Weigelt, metux IT consult adc27c5220 dix: move ColormapRec declaration out of public header
Not used by any external module/driver, so no need to keep it in
public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:43 +02:00
Enrico Weigelt, metux IT consult 46eeeec810 fix name clash on 'GC' between Xlib and Xserver
Both xlib as well as the Xserver use the same identifier "GC" for
different types. While on xlib it's just the numerical ID of a GC,
the xserver defines a struct for it by the same name. This is this
ugly and needs ridiculous hacks for Xserver code that needs xlib.

Easy to solve by just renaming the GC typedef to GCRec (consistent
with how we're naming other structs) and replacing GC* by GCPtr.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:52:25 +02:00
Enrico Weigelt, metux IT consult 7501ca09b9 dix: rename dixLookupClient() to dixLookupResourceOwner()
Choose a bit more precise / descriptive name for that function.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:52:07 +02:00
Enrico Weigelt, metux IT consult a6ec907b22 miext: use calloc() instead of malloc()
Using calloc() instead of malloc() as preventive measure, so there
never can be any hidden bugs or leaks due uninitialized memory.

The extra cost of using this compiler intrinsic should be practically
impossible to measure - in many cases a good compiler can even deduce
if certain areas really don't need to be zero'd (because they're written
to right after allocation) and create more efficient machine code.

The code pathes in question are pretty cold anyways, so it's probably
not worth even thinking about potential extra runtime costs.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:49:32 +02:00
Enrico Weigelt, metux IT consult d708b28adc treewide: drop COMPOSITE symbol
It's always enabled for very long time now (at least since meson transition),
there doesn't seem to be any need to ever disable it again. So we can reduce
code complexity by removing all the ifdef's.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:47:01 +02:00
Enrico Weigelt, metux IT consult 88455524fe miext: rootless: use PostCreateResources screen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new PostCreateScreenResources screen hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:46:58 +02:00
Enrico Weigelt, metux IT consult 60dd47abda damage: use PixmapDestroy hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new pixmap destroy notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:46:39 +02:00
Enrico Weigelt, metux IT consult 0a516b5690 miext: rootless: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:45:49 +02:00
Enrico Weigelt, metux IT consult 1bc857d30f miext: shadow: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:45:46 +02:00
Enrico Weigelt, metux IT consult 46f2a97c18 miext: damage: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:45:43 +02:00
Enrico Weigelt, metux IT consult eca6201e98 rootless: use window position notify hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new window position notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:44:39 +02:00
Enrico Weigelt, metux IT consult f061315afa rootless: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:44:19 +02:00
Enrico Weigelt, metux IT consult c335d5a92e damage: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:44:11 +02:00
Enrico Weigelt, metux IT consult 05e5ee3671 miext: sync: drop useless CloseScreen wrapping
This wrapped CloseScreen function doesn't do anything actually useful,
so no need to keep it around any longer. It used to do a free() on the
private data (which had been wrong in the first place) but this had
been removed and so the whole function became useless, it had been
forgotten to be swept away.

Fixes: 469d5bf8b7
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:43:17 +02:00
Enrico Weigelt, metux IT consult 31548e3705 fb: unexport fbValidateDrawable()
Not used by any drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:39:59 +02:00
Enrico Weigelt, metux IT consult 346d5f5c35 os: move BUG_*() macros to own private header
These macros aren't used by any external modules, so no need
to keep them public. Moving them into private header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1804>
2025-02-17 19:32:48 +00:00
Enrico Weigelt, metux IT consult 372a510ef0 miext: use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
2025-02-12 17:48:30 +01:00
Aki Sakurai da0de21b72 xquartz: fix compilation
Fixes #1788

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1777>
2025-02-10 19:37:18 +08:00
Enrico Weigelt, metux IT consult 143a6a21e1 miext: rootless: fix unused variables
Compiling w/ -Werror (which our CI does) breaks compile due a buch of
unused variables.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1703>
2025-02-08 15:15:57 +00:00
Enrico Weigelt, metux IT consult ef62929f58 treewide: NULL-protect ScreenRec->DestroyPixmap() calls
Right now, we're assuming that even when deep nesting involved, the proc
vector is always set to a valid function. One the one hand it requires
extra dummy procs in some cases, OTOH it's making upcoming refactoring
of the code flow unnecessarily complex.

The big plot (of subsequent commits) is splitting out the extension's
(and possibly subsystem's) special logic out of the wrapping chain and
let them be executed independently from the DDX/drivers - when applicable
even only when the pixmap is really destroyed (not just unref'ed).
(At some later point, it might even become be actually a valid situation
that DestroyPixmap vector really being NULL.)

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754
See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1755

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1709>
2025-02-06 23:02:06 +00:00
Enrico Weigelt, metux IT consult c2ee74c523 mi: unexport miShapedWindowIn()
Not used by any drivers/modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult 8d07450904 mi: unexport miSendExposures()
Not used by any drivers/modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1727>
2025-02-06 16:45:20 +02:00
Enrico Weigelt, metux IT consult a917f6a8a8 drop obsolete HAVE_DIX_CONFIG_H
The symbol controls whether to include dix-config.h, and it's always set,
thus we don't need it (and dozens of ifdef's) anymore.

This commit only removes them from our own source files, where we can
guarantee that dix-config.h is present - leaving the (potentially exported)
headers untouched.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-10-10 13:38:31 +00:00
Enrico Weigelt, metux IT consult 5eca51a5d2 dix: unexport StoreColors()
Not used by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1581>
2024-09-01 22:06:50 +00:00
Enrico Weigelt, metux IT consult 2cec3cfbf1 include: move private definitions out of input.h
It's not good having the public server api headers clobbered with private
definitions, so cleaning them up.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1354>
2024-09-01 17:59:23 +00:00
Enrico Weigelt, metux IT consult be4c8444eb os: unexport Os*() functions
These aren't called (and suited for being called) by drivers,
thus drop them from the public module API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1381>
2024-04-16 14:20:30 +02:00
Enrico Weigelt, metux IT consult 15d3c1a6f1 os: move os_move_fd() out of public API
This function isn't used by any driver and doesn't seem to be useful for them,
thus move it out of the public module API, in order to tidy it up a bit.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1366>
2024-03-09 17:12:46 +00:00
Enrico Weigelt, metux IT consult 0acba54e54 miext: move private definitions out of public headers
public server module API headers shouldn't be clobbered with non-exported
definitions, so move them out to private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1293>
2024-03-03 22:58:24 +00:00
Enrico Weigelt, metux IT consult 368055d3f1 render: move private definitions out of public glyphstr.h
Public module API headers don't need / shouldn't to contain anything that
isn't part of the API (non-exported functions, etc).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1287>
2024-03-03 22:54:16 +00:00
Enrico Weigelt, metux IT consult 6e90c5430a miext: sync: drop duplicate _X_EXPORT from .c sources
There are already defined in misyncshm.h / misyncfd.h.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1274>
2024-03-03 22:34:26 +00:00
Peter Hutterer eaa92ea422 Revert "include: move BUG_*() macros to separate header"
This breaks the xf86-input-synaptics driver:

  synaptics.c: In function 'clickpad_guess_clickfingers':
  synaptics.c:2638:5: error: implicit declaration of function 'BUG_RETURN_VAL' [-Werror=implicit-function-declaration]
   2638 |     BUG_RETURN_VAL(hw->num_mt_mask > sizeof(close_point) * 8, 0);

This reverts commit 442aec2219.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1316>
2024-02-23 23:11:01 +00:00
Enrico Weigelt 442aec2219 include: move BUG_*() macros to separate header
Yet another step of uncluttering includes: move out the BUG_* macros
into a separate header, which then is included as-needed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-02-15 23:33:46 +00:00
Jeremy Huddleston Sequoia 16e7cdba48 rootless: Use screen_x and screen_y instead of pixmap pointer hacks
This updates rootless to treat pixmaps consistently with COMPOSITE,
using the screen_x and screen_y values rather than doing hacky math.

This will allow for proper bounds checking on a given PixmapRec.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2023-01-20 17:10:54 +00:00
Jeremy Huddleston Sequoia 820b1dc461 rootless: Dead code removal (RootlessResizeCopyWindow)
This should no longer be necessary since we only support implementations
that handle preserving the bits across resize.  We can use
RootlessNoCopyWindow instead.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2023-01-20 17:10:54 +00:00
Jeremy Huddleston Sequoia 40c56932a5 rootless: Remove an unnecessary memory copy when handling resize with gravity RL_GRAVITY_NONE (border width changes)
This should no longer be necessary since we only support implementations that handle preserving the bits across resize

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2023-01-20 17:10:54 +00:00
Jeremy Huddleston Sequoia a06cea245b rootless: Dead code removal (resize_after in StartFrameResize / FinishFrameResize)
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2023-01-20 17:10:54 +00:00
Jeremy Huddleston Sequoia 1b36a10bd4 rootless: Remove the special case for northwest gravity in StartFrameResize
I don't see a reason why we would want to preserve pixels that are going to
not be visible anyways.  The rootless implementation already handles
preserving the relevant bits for us.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2023-01-20 17:10:54 +00:00
Jeremy Huddleston Sequoia 305e627c01 rootless: Use RL_GRAVITY_NORTH_WEST for min/max/zoom resizing
If none of the four corners is fixed, we can use RL_GRAVITY_NORTH_WEST weighting
for the operation to let the implementation presetve the window bits for us.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2023-01-20 17:10:54 +00:00
Jeremy Huddleston Sequoia 65ee3248f5 rootless: Ensure gResizeDeathPix is stored in locally-managed memory rather than re-using the implementation's backing store
The implementation owns the pointer during RootlessStopDrawing and
RootlessStartDrawing and is free to (does) change it.  Rootless
cannot assume ownership of this memory region.  This is possibly
the cause of some hard to diagnose crashes in XQuartz over the
years.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2023-01-20 17:10:54 +00:00
Jeremy Huddleston Sequoia f71ef2f02f rootless: Remove option to disable ROOTLESS_RESIZE_GRAVITY
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2023-01-20 17:10:54 +00:00