898 Commits

Author SHA1 Message Date
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
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
a72972274e mi: drop intToCoord() macro
Not used anywhere, no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-27 18:25:12 +01:00
Herman Semenov
4689dfb21f mi: fix missing braces for expected logical condition 'if-else if'
Without missing braces, logical behavior 'if-else if' block works as two 'if' independent blocks.
2025-11-26 16:45:55 +01:00
Mike Gelfand
770c21c947 mi: 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
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
962580a15a treewide: macros lambda-esque screen iteration
iterating over screen list via lambda-esque macros calls like this

    DIX_FOR_EACH_SCREEN({
        do_something
    });

withing the body, the iterator variables `walkScreenIdx` and `walkScreen`
are defined and can be directly used (read-only). the code inside the body
is running in a separate scope.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-10-01 11:40:34 +02:00
Enrico Weigelt, metux IT consult
0ade4aef80 mi: fix missing includes of extinit.h
Don't rely on this file just being included indirectly by somebody else
just by accident.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-25 13:48:41 +02:00
Enrico Weigelt, metux IT consult
b0ffa7b286 treewide: rename dixGetFirstScreenPtr() to dixGetMasterScreen() for correct semantics
In Xinerama/Panoramix configuration there's one screen that's having special
meaning - it's used for simulating as the frontend for all client operations:
the clients (should) only talk to that screen, while panoramix subsystem is
proxying those operations to all the other screens (with certain changed
applied, eg. coordinate transformations).

Historically, this screen happens to be the first one in the system (some of
it's proc's are hooked up in order to achieve desired behaviour). That's why it
used to be accessed via screenInfo.screens[0] - that already had been encapsulated
into a tiny helper `dixGetFirstScreen()`.

a) the correct terminus technicus for a situation where one device (or SW entity)
   entirely controlling others is a master-slave-relationship: the controlling
   device/entity is `master`, the controlled ones are `slave` (to that specific
   master).

b) the term "first screen" is inacurate and misleading here: what the caller's are
   actually interest in isn't the first entry in the screen array, but the screen
   that's controlling the others. With upcoming refactoring of the Xinerama/Panoramix
   subsystem, this might well be a different array index than 0.

c) the term `default` also wouldn't match: `default` implies there's a real practical
   choice, and such value applies when no explicit choice has been made. But in this
   case, it practically doesn't make sense (except perhaps for debugging purpose)
   for a client to use any different screen.

Therefore fixing the function name to the correct technical terminology.
(for sake of patch readability, renaming corresponding variables is left to
subsequent patches).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-12 11:44:05 +02:00
Enrico Weigelt, metux IT consult
6bc438ab5a treewide: use inline helper for accessing first screen
Instead of everybody directly accessing the (internal) screenInfo struct,
let those consumers only interested in first screen use a little helper.

Also caching the value if it's needed several times.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-10 13:45:05 +02:00
Enrico Weigelt, metux IT consult
a324351f67 treewide: drop unnecessary includes of Xi/eglobals.h
Dropping include by sources that don't use anything from this header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-09 14:41:10 +02:00
Enrico Weigelt, metux IT consult
40473404e4 mi: miDCDeviceCleanup(): little loop simplification
skip cycle via `continue` instead of having a big if{} block.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-04 19:13:14 +02:00
Enrico Weigelt, metux IT consult
d438dfc677 mi: tiny cosmetic cleanup in miDCDeviceCleanup()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-04 17:33:36 +02:00
Enrico Weigelt, metux IT consult
edc5cfa711 mi: simplify miDCDeviceCleanup()
Return out earlier and scope the index variable.
Also a preparation for upcoming screen walk macros.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-04 11:22:39 +02:00
Enrico Weigelt, metux IT consult
37ebc7d74b treewide: explicitly cast %p printf parameters to void*
Do it the ISO C way, so -pendantic is shouting a little bit less.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-31 10:03:34 +02:00
Enrico Weigelt, metux IT consult
17bf4e677e mi: canonical walkScreen variable on screen list iterations
When iterating screen lists, consistently use the same variable name
`walkScreen` for holding current screen pointer everywhere.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-18 10:52:49 +02:00
Enrico Weigelt, metux IT consult
35a43252ca treewide: replace PICT_a8r8g8b8 by PIXMAN_a8r8g8b8
Try not to use old compat macros anymore, use the real ones instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-11 20:23:43 +02:00
Enrico Weigelt, metux IT consult
bbabd96e6c meson: rename symbol MITSHM to CONFIG_MITSHM
some bit better naming for config symbols.
Yet leaving the old one defined, until all drivers have kept up.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-05 11:39:28 +02:00
Enrico Weigelt, metux IT consult
91d20b0cb9 mi: use %lu instead of %zu in ErrorF() call
mingw doens't support `%zu` printf pattern yet.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 15:21:24 +02:00
Oleh Nykyforchyn
3fd14fdb12 mi: midispcur.c.: move miDCCloseScreen to post-hooks
This change is necessary to fix a segfault in intel driver at CloseScreen.
sna_early_close_screen() releases the cursor using FreeCursor(), which needs
miDCScreen private of pScreen. It has already been released by miDCCloseScreen(),
which is a pre-hook, and segfault occurs. Hence it is necessary to move
miDCCloseScreen() to post-hooks.

Signed-off-by: Oleh Nykyforchyn <oleh.nyk@gmail.com>
2025-07-23 15:25:37 +02:00
Enrico Weigelt, metux IT consult
236e8e4656 mi: use NULL instead of NullClient
No need to have another name for NULL, we can use NULL directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:24:55 +02:00
Enrico Weigelt, metux IT consult
030745a0e7 dix: move inpututils.h and rename it to inpututil_privs.h
it's a private header, thus should not be in public include directory.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 04:51:30 +02:00
stefan11111
160ab343ea mi: move miPointerCloseScreen to hookPostClose
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-07-03 18:46:58 +02:00
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
Mike Gelfand
32b26ccf9e mi: add/fix include guards where missing/broken
Signed-off-by: Mike Gelfand <mikedld@mikedld.com>
2025-06-27 13:58:05 +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
e6467895f9 dix: add dixAllocServerXID()
Adding a separate function for allocating server-client's XIDs.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult
7b801906c5 mi: mark miWindowExposures() and miExpandDirectColors() exported
These are used by the in-tree libwfb.so module. As long as this an shared
object, instead of being directly linked into the executable, these symbols
need to be in the executable's symbol table. Nevertheless, they're not making
them part of the public SDK/module ABI, unless there's a really hard reason.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:48 +02:00
Enrico Weigelt, metux IT consult
deee51a5ff mi: miInitVisuals: clean up variable declarations
The code is easier to understand when variables are declared where they're
used for the first time, scoped to where they're needed and not reused
for separate things.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:47 +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
b6c72bc9f5 treewide: clean up remaining consumers of extinit.h
Several sources including it without need. For consistency, those who still
need someting from there should include exitinit_priv.h (which also pulls
in extinit.h)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:46 +02:00
Enrico Weigelt, metux IT consult
bdcf8d200f mi: 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
e6292bb8ae mi: clean up including panoramix headers
* use their actual path instead of relying this to be in compiler's
  include path list.
* no need to do it only conditionally, no #ifdef needed

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:43 +02:00
Enrico Weigelt, metux IT consult
21d040a439 (1832) mi: micmap: drop unused miInitVisualsProcPtr type
It's last users gone about 15 years ago with commit
a715de7f11afeda7798f0882148a94d4db2291e6, so no need
to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:43 +02:00
Enrico Weigelt, metux IT consult
539ed037b4 mi: move StaticGrayMask and GrayScaleMask into micmap.c
micmap.c is the only consumer of these, so move them into there,
instead of maintaining them in the public API w/o any practical need.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:43 +02:00
Enrico Weigelt, metux IT consult
5ef99b0a2d mi: move MIN_TRUE_DEPTH define into micmap.c
This .c file is the only consumer of that define, so move it
there instead of carrying it around in public API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:43 +02:00
Enrico Weigelt, metux IT consult
f244180eba mi: make SetInstalledmiColormap() a static inline function
Add some type safety by converting the macro into static inline function.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 17:21:43 +02:00
Enrico Weigelt, metux IT consult
4be15a7207 mi: unexport GetInstalledmiColormap and make it static inline function
Not used by any external drivers, so no need to keep it public.
Also add some type-safety by implementing it as static inline function.

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
f0bf6919ca mi: micmap.h: clean up include statements
* not using anything from colormapst.h
* but several other includes have been missing (consumers had to
  include them separately before that file)

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
38d62bcc08 dix: CreateColormap() pass in ClientPtr instead of client index
The function actually operates on ClientRec, so we can pass it in
directly, so it doesn't need to fetch it from clients[] array itself.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:52:22 +02:00
Enrico Weigelt, metux IT consult
8c05f4db0a mi: 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:27 +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
56aad1434b mi: 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:32 +02:00
Enrico Weigelt, metux IT consult
479484b631 dix: add per-screen window position notify hook
Right now, extension specific actions on window positioning are implemented
by wrapping the ScreenRec's PositionWindow() proc pointer: the extensions are
storing the original pointer in their private data and putting in their own one.
On each call, their proc restores the original one, calls it, and switches back
again. When multiple extensions doing so, they're forming a kind of daisy chain.
(the same is done for lots of other procs)

While that approach is looking nice and elegant on the drawing board, it's
complicated, dangerous like a chainsaw and makes debugging hard, leading to
pretty blurred API borders.

This commit introduces a simple approach for letting extension hook into the
window positioning path safely, w/o having to care much about side effects
with the call chain. Extensions now can simply register their hook proc
(and an opaque pointer) and get called back - w/o ever having to mess with
the ScreenRec's internal structures. These hooks are called before the original
vector (usually handled by DDX/screen driver directly) is called.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:44:33 +02:00
Enrico Weigelt, metux IT consult
66e1b34a88 xfree86: modeset: call miCreateScreenResources() directly
No need for complicated wrapping/unwrapping: it's always just
miCreateResources() anyway - so we can call it directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:41:39 +02:00
Enrico Weigelt, metux IT consult
a1d1ee930d mi: miwideline: fix uninitialized fields in miWideLine()
| ../mi/miwideline.c: In function ‘miRoundCapClip’:
| ../mi/miwideline.c:1404:15: warning: use of uninitialized value ‘*face.dy’ [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
|  1404 |     dx = -face->dy;
|       |           ~~~~^~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:31:32 +02:00
Enrico Weigelt, metux IT consult
3b9ca877a4 mi: NULL-protect miFillGeneralPoly()
| In file included from ../mi/mipoly.c:59:
| ../mi/mipoly.c: In function ‘miFillGeneralPoly’:
| ../mi/mipoly.h:162:12: warning: dereference of NULL ‘pAET’ [CWE-476] [-Wanalyzer-null-dereference]
|   162 |    if (pAET->ymax == y) {          /* leaving this edge */ \
| ../mi/mipoly.c:591:17: note: in expansion of macro ‘EVALUATEEDGEEVENODD’
|   591 |                 EVALUATEEDGEEVENODD(pAET, pPrevAET, y);
|       |                 ^~~~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:31:29 +02:00