Commit Graph

20006 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult f6d63f96cd dix: unexport and document GetXIDRange()
Not used by any drivers (just the xcmisc extension), so no need
to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:54:09 +02:00
Enrico Weigelt, metux IT consult 2556900be7 dix: unexport and document GetXIDList()
Not used by any drivers (just the xcmisc extension), so no need
to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:54:06 +02:00
Enrico Weigelt, metux IT consult 727e8bcb09 dix: unexport and document HashResourceID()
Not used by any drivers/modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:54:03 +02:00
Enrico Weigelt, metux IT consult 6588a74c15 dix: make CLIENTOFFSET macro private
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:54:00 +02:00
Enrico Weigelt, metux IT consult ec8b5379b8 dix: make RESOURCE_ID_MASK private
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:53:56 +02:00
Enrico Weigelt, metux IT consult bd29dc5adf dix: make RESOURCE_CLIENT_MASK macro private
Not used in any external modules, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:53:53 +02:00
Enrico Weigelt, metux IT consult 46bc6335c5 dix: make CLIENT_BITS() macro private
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:53:50 +02:00
Enrico Weigelt, metux IT consult 706d3336ec dix: make SERVER_BIT define private
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:53:47 +02:00
Enrico Weigelt, metux IT consult 1ae30998d5 dix: make SameClient() macro private
Not used in any external modules, so need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:53:43 +02:00
Enrico Weigelt, metux IT consult 4ae7dca761 dix: add dixResouceIsServerOwned()
Little helper function for checking whether a resource XID
belongs to the server itself.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:53:40 +02:00
Enrico Weigelt, metux IT consult 1cbfe67a5a dix: let CreateGrab operate on ClientPtr instead of array index
Almost all callers have ClientPtr anyways, so we're just doing duplicate
array lookups. Just using ClientPtr directly is easier anyways.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:53:37 +02:00
Enrico Weigelt, metux IT consult a09805f675 dix: add dixClientForXID()
Retrieves the ClientPtr for the owner of given resource.
This way reducing the sites directly accessing clients[] array.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:53:34 +02:00
Enrico Weigelt, metux IT consult ed7f0bb0aa include/resource.h: replace RESOURCE_CLIENT_BITS by ResourceClientBits()
We can write down the function name directly. Nobody else than a few
define's in here using that macro.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:53:30 +02:00
Enrico Weigelt, metux IT consult 0a315e45dd dix: replace CLIENT_ID() macro by dixClientIdForXID() inline function
Make it type-safe and a bit more obvious what it really does,
also adding some inline documentation. Since it's just some
bit shifting magic, it's qualified for inlining.

The CLIENT_ID() macro isn't used by any external modules, so the
new function doesn't need to be in a public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:53:27 +02:00
Enrico Weigelt, metux IT consult d80866e764 dix: add dixClientForOtherClients()
Helper function for retrieving the owning client of an OtherClients.

It's an actual function, so callers don't need access to internal
knowledge (definition of struct _OtherClients, clients[] array, ...)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:53:24 +02:00
Enrico Weigelt, metux IT consult e1f8794b1d dix: add dixClientForInputClients()
Helper function for retrieving the owning client of an InputClients.

It's an actual function, so callers don't need access to internal
knowledge (definition of struct _InputClients, clients[] array, ...)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:53:21 +02:00
Enrico Weigelt, metux IT consult 0ca0c334d8 dix: add dixClientForGrab()
Helper function for retrieving the owning client of a grab.

It's an actual function, so callers don't need access to internal
knowledge (definition of GrabRec, clients[] array, ...)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:53:16 +02:00
Enrico Weigelt, metux IT consult d697618c16 dix: replace wClient() macro by dixClientForWindow() inline function
Hide internals (drop the need to include windowstr.h), make it typesafe
as well as the naming easier to understand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:53:13 +02:00
Enrico Weigelt, metux IT consult 261c49b4c2 dix: events: clean up XaceHookSendAccess() client arg
Use NullClient macro instead of NULL or 0.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:53:10 +02:00
Enrico Weigelt, metux IT consult 6f675e4d01 os: auth: protect against duplicate auth keys
Protect the Add() proto funcs from adding duplicate auth keys.
If adding a duplicate is attempted, the XID of the already
existing one is returned instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:53:06 +02:00
Enrico Weigelt, metux IT consult 1629400be5 os: xdmcp: simplify AddAuth handler call
No need for loading the address into temporary variable and later doing
indirect call, since we can easily do direct call in each branch.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:53:03 +02:00
Enrico Weigelt, metux IT consult 6c6e0b09a1 os: auth: let GenerateAuthorization() return 0 on error
XID = 0 already is used as sign for error in several places,
so let's use that here, too.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:52:59 +02:00
Enrico Weigelt, metux IT consult a68f5c125c os: auth: generate XIDs in proto funcs only on success
Generate the auth object XIDs inside the proto funcs and only
on success, so we don't unnecessarily allocate XIDs.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:52:56 +02:00
Enrico Weigelt, metux IT consult e536c2035c os: auth: move GenerateRandomData() and make it static
Only used in mitauth.c, so we can move it there and make it static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:52:53 +02:00
Enrico Weigelt, metux IT consult e89006d015 os: auth: factor out auth proto names into defines
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:52:49 +02:00
Enrico Weigelt, metux IT consult 73abb7150d os: auth: consolidate GenerateAuthorization()
No need for having two implementations in os/ vs xwin.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:52:45 +02:00
Enrico Weigelt, metux IT consult 0da8fc466d os: auth: use strlen() for auth proto name length
No need to explicitly hard-code strings lengths when we can use
standard strlen(). Those code pathes are so cold that trying to
spare a few cycled for an (usually inlined) strlen() doesn't seem
to justify any extra care.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:52:41 +02:00
Enrico Weigelt, metux IT consult 58e661e1cc os: auth: improve readability and robustness of auth proto list
The code is easier to understand, but also more robust (eg. against struct
layout changes) if structs are initialized with explicit field names
instead of as lists.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:52:37 +02:00
Enrico Weigelt, metux IT consult 030b441e21 dix: resource: protect FakeClientID() from returning 0
Some callers treating XID = 0 as a sign for non-existing resource.
Practically should not happen, but nevertheless adding extra
protection, just in case.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:52:34 +02:00
Enrico Weigelt, metux IT consult eb95982b2a bsd: drop PCCONS support
The old PCCONS driver only seems to be used on minimal install disks and
cannot coexist with newer ones (at least that's the feedback I've gotten
from BSD community), so there's probably no practical use case for
supporting it in Xorg anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:52:31 +02:00
Enrico Weigelt, metux IT consult bef80a0db9 Xnest: drop special hack for Xlib's GC type
Now that the name clash on GC type between Xserver and xlib has been fixed,
there's no need to do the special renaming hack anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:52:28 +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 1c8ef6d44d dix: colormap: let AllocColorCells() operate on ClientPtr instead of index
It's only caller already has a pointer to client struct, so no need to
let this function look it up again in the global clients array.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:52:19 +02:00
Enrico Weigelt, metux IT consult b9df6ed8a2 Xv: fix segfault on shutdown
Protect against adaptor having NULL port list in XvStopAdaptors()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:52:16 +02:00
Enrico Weigelt, metux IT consult 96523e64f3 xfixes: consolidate ProcXFixesSelectSelectionInput()
No need to have it ripped into two pieces, just making upcoming
changes more complicated.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:52:13 +02:00
Enrico Weigelt, metux IT consult 69078b1d15 include: document the meaning of SERVER_BIT
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:52:10 +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 a48b83b9a2 dix: dixLookupClient() align parameter naming with prototype
Align the function's parameter names with those defined in the prototype.
Especially it makes code easier to understand if the result parameter
is also named "result" here, as in the prototype.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:52:04 +02:00
Enrico Weigelt, metux IT consult 8e161ae771 Xext: sync: a bit of request handler documentation
Improve in-code docs of some request handlers, so it becomes a bit
more obvious what they're doing.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:52:01 +02:00
Enrico Weigelt, metux IT consult 098008879b Xres: XResQueryClientIds: enable security filtering
Pass each client we're considering to report through XaceHookClientAccess(),
so security extensions have a chance to filter them out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:51:58 +02:00
Enrico Weigelt, metux IT consult 750b65de69 Xres: XResQueryClientPixmapBytes: enable security filtering
Pass each client we're considering to report through XaceHookClientAccess(),
so security extensions have a chance to filter them out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:51:44 +02:00
Enrico Weigelt, metux IT consult 146b04f4e2 Xres: XResQueryClientResources: enable security filtering
Pass each client we're considering to report through XaceHookClientAccess(),
so security extensions have a chance to filter them out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:51:41 +02:00
Enrico Weigelt, metux IT consult 1594bad1f8 Xres: XResQueryClients: enable security filtering
Pass each client we're considering to report through XaceHookClientAccess(),
so security extensions have a chance to filter them out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:51:38 +02:00
Enrico Weigelt, metux IT consult 2be400cd99 Xext: hashtable.h: unexport functions not used by drivers
This header isn't part of SDK and no external module using those functions,
so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:51:36 +02:00
Enrico Weigelt, metux IT consult 8060c995f5 panoramix: unexport XineramaVisualsEqualPtr and make it static
There's no user outside of panoramiX.c, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:51:33 +02:00
Enrico Weigelt, metux IT consult 1741809555 panoramix: unexport XineramaGetImageData()
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:51:29 +02:00
Enrico Weigelt, metux IT consult 9f538c4f40 panoramix: unexport resource types
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:51:26 +02:00
Enrico Weigelt, metux IT consult b13f5e19c3 panoramix: unexport XineramaDeleteResource()
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:51:22 +02:00
Enrico Weigelt, metux IT consult 78cb102e64 panoramix: unexport XineramaRegisterConnectionBlockCallback()
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:51:20 +02:00