Commit Graph

2814 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult
36facd71b5 dix: move request/response related functions to new request_priv.h header
Move functions/macros dealing with request parsing or reply assembly/write
out of the big dix_priv.h into their own headers. This new header will also
get more of those function/macros soon (yet still in the pipeline).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-24 11:32:50 +02:00
Enrico Weigelt, metux IT consult
96b5da5a0d dix: replace XACE_EXT_ACCESS and XACE_EXT_DISPATCH by direct callback
Move the callbacks directly into DIX, since it's actually core infrastructure.
Also simplifying the whole machinery, by just using a simpel CallbackListPtr.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-23 11:37:50 +02:00
Enrico Weigelt, metux IT consult
9a920b8fc5 dix: make ProcBadRequest() static
Nobody outside tables.c is actually using it, so can be static.

The function used to be _X_EXPORT'ed, but there's no indication that any
external driver (not even proprietary NVidia) ever using it, so we can
get away w/o ABI version bump.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-22 12:49:22 +02:00
Enrico Weigelt, metux IT consult
bb591fb1fd dix: AllocGlyphCursor(): make color parameters unsigned short
These values are assigned to `unsigned short` fields, and we're only
getting in smaller numbers that fit well into it. So fixing compiler
warning on type size mismatch by using short args.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-22 12:18:15 +02:00
Enrico Weigelt, metux IT consult
9856372932 dix: add callback before ClientRec is being destroyed
Existing client-state hook isn't sufficient for this, and so easy to
be extended cleanly (*1). Adding a new callback is trivial and cheap,
so preferring this way, instead of trying to tweak the existing hook
for something it's never been designed for.

*1) see discussion here: https://github.com/X11Libre/xserver/pull/1077

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-22 12:15:31 +02:00
Enrico Weigelt, metux IT consult
a6b880a368 dix: Xi: use return value of X_SEND_REPLY_SIMPLE()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-22 12:06:04 +02:00
Enrico Weigelt, metux IT consult
4edc5ceaf7 dix: dixutils: fix signedness of numHandlers and sizeHandlers
These are used as counters / sizes, and we're getting lots of warnings
on signedness mismatches. So use size_t instead of (signed) int here.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-18 20:27:02 +02:00
Enrico Weigelt, metux IT consult
12b003a975 dix: dixutils: fix signedness of numCallbackListsToCleanup
It's a counter and size value - we're getting lots of signedness warnings,
so use size_t instead of (signed) int.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-18 20:26:49 +02:00
Enrico Weigelt, metux IT consult
55140c469d dix: fix parameter types of SetClipRects()
Use the X11 protocol types where possible and fix signedness warnings.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-18 20:26:13 +02:00
Enrico Weigelt, metux IT consult
1bc760156f dix: dix_priv.h: cast size sequenceNumber value
The X11 protocol defines the sequenceNumber reply fields as `CARD16`, but the
Xserver is traditionally sloppy and using just `int`. Need to explicitly cast,
in order to silence compiler warnings.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-17 09:37:53 +02:00
Enrico Weigelt, metux IT consult
f8950412e2 dix: rpcbuf: x_rpcbuf_write_counted_string_pad() silence size mismatch warning
strlen() returns an size_t, but the string lengths here is limited to 16bit,
so we need to explictly cast, in order to shut down compiler warning.
Strings longer than 64k really shouldn't ever happen.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-17 09:37:31 +02:00
Enrico Weigelt, metux IT consult
ce69e8a520 dix: fix ClientRec->numSaved to unsigned
this field is used a counter, thus should be unsigned, instead of having
dozens of signess warnings or adding casts to suppress them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-16 19:13:46 +02:00
Enrico Weigelt, metux IT consult
e55281e2a5 dix: ValidateGC(): fix serialNumber assignment
GC's serialNumber field is unsigned int, but DrawableRec's is unsigned long,
so we need to typecast.

It would be better if they all had the same type, but we can't change them easily,
as that might cause ABI break.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-16 14:38:21 +02:00
Enrico Weigelt, metux IT consult
a449d5950e dix: AllocARGBCursor(): make color parameters unsigned short
These values are assigned to `unsigned short` fields, and we're only
getting in smaller numbers that fit well into it. So fixing compiler
warning on type size mismatch by using short args.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-15 19:38:25 +02:00
Enrico Weigelt, metux IT consult
32f6ac7dbf dix: dix_priv.h: cast size value on WriteToClient() calls
We're trying to use size_t for sizes whereever possible, but WriteToClient()
is part of ABI, so we can't fix it's parameter types - need to explicitly
cast, in order to silence the compiler warnings.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-15 19:04:44 +02:00
Enrico Weigelt, metux IT consult
56c4d68140 treewide: drop ScreenInfoPtr parameter from InitOutput()
Nobody's using this pointer anymore, everybody's using the global
screenInfo structure.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-12 19:49:23 +02:00
sesankm
5a0b736952 dix: rpcbuf: exporting x_rpcbuf_write_string_0t_pad for glx
Signed-off-by: sesankm <26676400+sesankm@users.noreply.github.com>
2025-09-12 19:36:21 +02:00
Enrico Weigelt, metux IT consult
358f76f2ad treewide: fix misleading firstScreen variable naming to masterScreen
Follow-up on renaming dixGetFirstScreenPtr() to dixGetMasterScreen():
also rename the target variables for correct technical terminology.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-12 11:44:05 +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
79841c8293 dix: XineramaSetCursorPosition() declare and initialize variable in one shot
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-12 09:51:50 +02:00
Enrico Weigelt, metux IT consult
2b875e18bc Xi: consolidate request handler prototypes
Instead of having huge number of micro-headers, consolidate all the
request handler prototypes in one file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-12 09:25:29 +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
b5210be9eb Xi: helper for private structure retrieval
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-10 13:41:47 +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
eb17b34362 Xinerama: lambda-esque macro for walking Xinerama screens
Move the walking loops on Xinerama screens into lambda-esque macros:
the callers look quite like we've been using lambda functions and
closures, but actually are just fancy macro trickery.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-09 14:12:40 +02:00
Enrico Weigelt, metux IT consult
93d1a2681f dix: enterleave: split out big looped code into separate functions
* make the code easier to read
* preparation for moving the looping into lambda-esque macros
  (the code inside the loops doesn't compile in here, but does when
  moved to separate functions)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-08 09:58:58 +02:00
Enrico Weigelt, metux IT consult
638f8e16ac dix: PrintWindowTree(): move locally-used variabes into local scope
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-08 09:58:47 +02:00
Enrico Weigelt, metux IT consult
8ac6a39c7f xkb: move WriteToClient() calls on Events into DIX macro
WriteToClient() shouldn't be called directly anymore, unless there's
no other way.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-05 20:25:02 +02:00
Enrico Weigelt, metux IT consult
e268101b64 dix: canonical walkScreenIdx variable on screen list iterations
When iterating screen lists, consistently use the same variable name
`walkScreenIdx` for holding current screen index everywhere.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-05 08:48:42 +02:00
Enrico Weigelt, metux IT consult
a7811ea424 dix: ProcGetFontPath(): use x_rpcbuf_t
Use x_rpcbuf_t for payload assembly and X_SEND_REPLY_WITH_RPCBUF()
for sending it all out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-05 08:44:49 +02:00
Enrico Weigelt, metux IT consult
d734b75a37 dix: ProcAllocColorPlanes(): use x_rpcbuf_t
Use x_rpcbuf_t for payload assembly and X_SEND_REPLY_WITH_RPCBUF()
for sending it all out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-05 08:44:38 +02:00
Enrico Weigelt, metux IT consult
0ca53c6908 dix: ProcAllocColorCells(): use x_rpcbuf_t
Use x_rpcbuf_t for payload assembly and X_SEND_REPLY_WITH_RPCBUF()
for sending it all out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-05 08:44:27 +02:00
Enrico Weigelt, metux IT consult
59e74c0a1b dix: ProcGetAtomName(): use x_rpcbuf_t
Use x_rpcbuf_t for reply payload assembly and X_SEND_REPLY_WITH_RPCBUF()
for sending it all out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-05 08:44:15 +02:00
Enrico Weigelt, metux IT consult
f32d06a101 dix: drop obsolete SGenericReply()
Not used anywhere, neither exported, so no need to keep it around
any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-04 17:23:16 +02:00
Enrico Weigelt, metux IT consult
f6bd4ab3d3 dix: drop obsolete CopySwap16Write()
Not used anywhere, neither exported, so no need to keep it
around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-04 11:39:16 +02:00
Enrico Weigelt, metux IT consult
7c114a30bc dix: XineramaConstrainCursor(): assign and declara variables in one shot
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-04 11:07:44 +02:00
Enrico Weigelt, metux IT consult
975436f535 dix: rpcbuf: _X_EXPORT x_rpcbuf_write_CARD8s() for internal use
_X_EXPORT'ing x_rpcbuf_write_CARD8s() just for internal use (eg. glx),
it's *NOT* supposed to be called by any external modules/drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-04 11:10:23 +02:00
Enrico Weigelt, metux IT consult
0d152c44f0 dix: ProcListExtensions(): use x_rpcbuf_t
Use x_rpcbuf_t for payload assembly and X_SEND_REPLY_WITH_RPCBUF()
for sending it all out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-04 10:41:38 +02:00
Enrico Weigelt, metux IT consult
8cfcb072d2 dix: ProcListHosts(): use x_rpcbuf_t
Use x_rpcbuf_t for payload assembly and X_SEND_REPLY_WITH_RPCBUF()
for sending it all out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-04 10:22:12 +02:00
Enrico Weigelt, metux IT consult
15340ce053 dix: ProcQueryColors(): use x_rpcbuf_t
Use x_rpcbuf_t for payload assembly and X_SEND_REPLY_WITH_RPCBUF()
for sending it all out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-04 10:22:00 +02:00
Enrico Weigelt, metux IT consult
a41114cbe7 dix: ProcListInstalledColormaps(): use x_rpcbuf_t
Use x_rpcbuf_t for payload assembly and X_SEND_REPLY_WITH_RPCBUF()
for sending it all out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-03 17:12:11 +02:00
Enrico Weigelt, metux IT consult
c3df0f0ed5 dix: DoGetImage(): use x_rpcbuf_t
Use x_rpcbuf_t for payload assembly and X_SEND_REPLY_WITH_RPCBUF()
for sending it all out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-03 15:11:26 +02:00
Enrico Weigelt, metux IT consult
61f9234ee8 dix: rpcbuf: _X_EXPORT some functions for internal use
_X_EXPORT'ing some x_rpcbuf_clear() and x_rpcbuf_write_CARD8s() just for
internal use (eg. glx) - those are *NOT* supposed to be called by any
external modules/drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-03 11:20:59 +02:00
Enrico Weigelt, metux IT consult
065f8d4d75 dix: unexport internal QueryFont() function
This function is internal to DIX (used for assembling XQueryFont replies
and not used by any drivers (not even proprietary NVidia), and really
shouldn't ever called by them at all. It's been one the many victims of a
really unthoughtful mass export back 17 years ago.

That'S a necessary step for refactoring the RPC reply mechanics.

Since it's never used by any driver at all, we can easily to this change
within the current ABI level.

Fixes: d6cbd4511e
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-03 09:31:44 +02:00
Enrico Weigelt, metux IT consult
2aec9a0b73 dix: rpcbuf: add x_rpcbuf_write_CARD64() and x_rpcbuf_write_CARD64s()
Add functions for writing (and byte-swapping) CARD64 values.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-03 09:31:30 +02:00
Enrico Weigelt, metux IT consult
7655ee2631 dix: drop unused CopySwap32Write()
Not used anywhere, neither exported, so no need to keep it
around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-03 09:29:35 +02:00
Enrico Weigelt, metux IT consult
3107056193 dix: doListFontsWithInfo(): inline SwapFonts() call
As preparation for moving doListFontsWithInfo() (and it's callers) to
x_rpcbuf_t, inline the SwapFonts() call into the caller function.

SwapFonts() has several problems, eg. directly operating on a buffer that's
holding xQueryFontReply struct (which isn't the correct one, just happens to
match) as well as the whole payload.

We first need to get them out of the way, before we can split off the reply
into the (statically declared) header struct and the (x_rpcbuf_t-filled)
payload.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-03 09:29:17 +02:00
Enrico Weigelt, metux IT consult
4ca0274f3e dix: cursor: NULL check in ScreenRec->UnrealizeCursor calls
just for being cautious.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-03 09:28:58 +02:00
Enrico Weigelt, metux IT consult
f8ad69698a treewide return code of X_SEND_REPLY_WITH_RPCBUF()
The macro will automatically return BadAlloc if the buffer is broken,
otherwise Success. Thus, we don't need extra prior rpcbuf check.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-02 12:48:50 +02:00
Enrico Weigelt, metux IT consult
ea3ef55be1 dix: dixfonts: doListFontsWithInfo(): use X_SEND_REPLY_SIMPLE()
Use X_SEND_REPLY_SIMPLE() for writing out the trivial empty reply.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-01 15:28:05 +02:00