Compare commits

...

1269 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult 942b0e96c4 Xext: xf86bigfont: fix FTBS on wrong packet length variable.
The `buflength` variable doesn't exist anymore, it's `rlength`.
And even if the reply struct might have the same size as XGenericReply,
it's cleaner to let the compiler compute it explicitly, just in case.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:11:00 +02:00
Enrico Weigelt, metux IT consult e5c3e138d9 Xext: xf86bigfont: fix typo in ProcXF86BigfontQueryFont()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:11:00 +02:00
Enrico Weigelt, metux IT consult 9453eaa1dc Xext: xf86bigfont: fix missing includes
It seems xf86bigfont hasn't been compile-tested for long time,
some includes were missing.

Note that fontstruct.h needs to come before libxfont2.h, because X11
headers tend to be not self-consistent :(

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:11:00 +02:00
Enrico Weigelt, metux IT consult e1282e8078 os: fix missing include of Xext/xf86bigfontsrv.h
We're calling XF86BigfontCleanup() from AbortServer(), so we need
it's prototype.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:11:00 +02:00
Thomas Debesse 24e978b1f1 README.md: fix video drivers being mistakenly named as input drivers 2025-06-11 12:55:05 +02:00
Enrico Weigelt, metux IT consult 0cafe943a9 README.md: formatting contact list as table
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-11 11:58:20 +02:00
catfromplan9 735b4e29b6 Add matrix room to README.md 2025-06-11 11:49:00 +02:00
Felipe Contreras 2eca1414db xkb: fix regression in GetDeviceInfo
This fixes a regression in 5499a2999 (xkb: let SendDeviceLedFBs() fill buffer instead of writing directly, 2024-07-16).

We need to write the whole buffer, and the updated length has to take
into consideration that `sz` now contains `led_len` so we need to
subtract that or properly calculate the remaining size.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2025-06-10 21:16:19 +02:00
Enrico Weigelt, metux IT consult 0ee4908052 COPYING: add myself
I believe I have contributed enough to be mentioned here ;-)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-10 20:29:38 +02:00
Enrico Weigelt, metux IT consult af649598eb README.md: update driver repo URLs
Since Redhat deleted everything related to Xlibre from freedesktop.org,
the driver repos had to be moved to github.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-10 20:19:38 +02:00
Enrico Weigelt, metux IT consult 610e91dc5f README.md: update due recent events of Redhat's censorship
Add update on recent censorship by Redhat employees on freedesktop.org.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-06 18:57:04 +02:00
Enrico Weigelt, metux IT consult 7c114b00d1 dix: add RootWindowFinalizeCallback() to symbol table for legacy Nvidia.
Nvidia has a strange habit of messing with really internal stuff,
so need to add it to the executable's symbol table.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 17:50:09 +02:00
Enrico Weigelt, metux IT consult 73d2d90329 dix: add AllocColormap() to symbol table for internal wfb module
As long as the wfb module is still a separate shared object, this
function needs to be in the symbol table.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:25:14 +02:00
Enrico Weigelt, metux IT consult 0dbcde06a2 xfree86: mark xf86configptr exported for Nvidia legacy
Nvidia has a strange habit of messing with really internal stuff,
so need to add it to the executable's symbol table.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:23:13 +02:00
Enrico Weigelt, metux IT consult ad55e24173 panoramix: export XRC_DRAWABLE for Nvidia legacy
Yet another temporary re-export for Nvidia's proprietary driver.
This symbol really shouldn't be used at all by drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:11:41 +02:00
Enrico Weigelt, metux IT consult baa7187bcc Xnamespace: add some documentation
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:57 +02:00
Enrico Weigelt, metux IT consult b7155bf86d Xnamespace: add support for multiple auth tokens per namespace
Support having more than one auth token per namespace, so separate tokens
can be handed out to clients that are still landing in the same namespace.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:57 +02:00
Enrico Weigelt, metux IT consult c9ac021203 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-05 16:06:57 +02:00
Enrico Weigelt, metux IT consult 0349f669a8 Xnamespace: property access hook
Filter property access. Right now just allowed inside same namespace,
or when caller is in root namespace.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:57 +02:00
Enrico Weigelt, metux IT consult f5f45fae5e Xnamespace: whitelist access to some server resources
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:57 +02:00
Enrico Weigelt, metux IT consult 0de8d77da5 Xnamespace: whitelist some XI operations
Whitelisting some XI operations in various hooks.

Note that some additional filtering needs to be done in send or
receive hook in order to prevent clients to receive possibly sensible
input data from the root window.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:57 +02:00
Enrico Weigelt, metux IT consult b215e1b11c Xnamespace: filter access on other clients
Restrict access to other clients within same namespace.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:57 +02:00
Enrico Weigelt, metux IT consult c78f53baa4 Xnamespace: filter client-to-client message sending
Filter message sending by clients. Only sending within the same
namespace is allowed (except for clients in a NS with superpowers,
e.g. root)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:57 +02:00
Enrico Weigelt, metux IT consult 179952577f Xnamespace: filter server access
Whitelisting several server access calls that are safe, rejecting the rest.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:57 +02:00
Enrico Weigelt, metux IT consult 856656fa2b Xnamespace: filter device access
Filter device access, whitelist several commonly used operations that
should be safe (eg. query keyboard layout).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult b8e375641a Xnamespace: whitelist access to namespace virtual root window
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult 797bb1fc02 Xnamespace: whitelist certain operations on (real) root window
CreateWindow() needs access to root window, in order to create
top level windows. Whitelisting this operation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult d00e191dcd Xnamespace: whitelist resource access for serverClient
The server itself is allowed to access anything w/o restrictions.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult d9d47ec8a1 Xnamespace: whitelist resource access within same namespace
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult 140105dcf0 Xnamespace: filter transparency
Silently drop transparency flag if namespace isn't allowed to use it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult bc3c3481c1 Xnamespace: filter extension access
Whitelist several extension calls that are safe. Also allow namespaces
to be configured for unrestricted access.

TBD: doesn't actually reject yet

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult 42f7918a23 Xnamespace: filter raw mouse motion and keyboard access
Only namespaces with allowMouseOption flag enabled can receive
raw mouse motion events. Raw key press events are always blocked.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult d158f18a31 Xnamespace: isolate root window property access
Redirecting access to root window properties to the per-namespace
virtual root windows. This isolates a lot of communication via root
window, e.g. the cut buffers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult a3307c656b Xnamespace: create per-namespace fake root windows
For each namespace creating a fake (invisible) root window, which can be
used for storing per-namespace properties (eg. cut buffers), etc.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult 2edc4e39fc Xnamespace: add selection isolation
Selection names (as seen by the client) are internally prefixed with the
namespace ID, so each client can only access those within it's namespace.

If a client within namespace "foo" want's to operate on "PRIMARY",
it actually will be doing so on "<foo>PRIMARY", w/o ever noticing it.
Events will sent back to the client still pointing to "PRIMARY".

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult 500ad18ebe Xnamespace: assign incoming clients to namespaces
The association is done by matching client's and namespace's
authentication token.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult 7ba5730550 Xnamespace: add basic namespace config structures
Adding data structure and initial data for namespace configuration.

Built-in namespaces are ROOT and ANONYMOUS.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult 8ff782af40 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-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult 62ae266841 Xi: allow hooks to silently ignore SelectEvents request
When looking up the window to select on and security hook returns
BadAccess, the request is just silently ignored, instead of rejected.

This way, security hook can prevent untrusted clients to listen on
arbitrary windows, without the client even noticing. The client won't
get this BadAccess error, but instead thinking everything's fine,
just not getting the actual events.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult 79157e95d9 include: list.h: add duplicate checking add/append functions
Simplify cases where callers need to check whether an entry already is
in a list before adding / appending.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult c09748c0c9 include: list.h: add xorg_list_present()
This function walks through the list and checks whether an entry is already
present. This check sometimes is neccessary, since trying to add an entry
twice has catastrophic consequences: iteration will become endless loop.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult 765c034845 include: list.h: allow zero-initialization of struct xorg_list
Up until now, xorg_list's always need to be explicitly initialized by
calling xorg_list_init(), otherwise next access attempt will segfault.
This is adding extra complexity and risk of subtle bugs.

Adding some extra NULL check are trivial and their cost is so tiny
that it's even hard to practically measure.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult 64f16b4c22 include: list.h: document things that must not be done
Add some warnings that list entries must not be added twice.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult af579756e9 include: list.h: fix inline docs for xorg_list_append()
The docs stated it's prepending, while it's actually appending.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult 3c228e9e91 dix: helper for checking whether window ID belongs to a root window
This helper checks whether a given XID belongs to some screen's
root window. It does so by looking up the window and comparing that
with the window's screen's root window pointer. The resource lookup
is intentionally being on behalf of the serverClient, so the fired
XACE hook doesn't treat it as an actual client's request.

It's explicitly designed for being used by callback handlers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult a11d62d51f dix: helper for retrieving client owning a XID
Add a little helper that's looking up the ClientPtr to the client
of the owner of given XID. The lookup is solely done on the ID space,
the actual resource doesn't even need to exist.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult 16461ea12a dix: add selection filtering hooks
Add hooks for filtering and fully rewrite rewrite selection requests
and events (what existing XACE hooks cannot do), e.g. for supporting
separate selection name spaces.

The hook can change individual fields in the parameter struct, so
operation continues with these changed values (eg. replace the original
selection name atom by a different one). It's also possible to stop
operations completely (with given result code) - in that case the
hook needs to take care of the remaining work to do (eg. sending events)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult 3dd9ac31d9 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-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult 7eed2c1bb7 dix: refine docs on DeliverDeviceEvents()
Adding a bit more explaination on how events are passed upwards.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult e2a374074c dix: hook for intercepting window property calls
This hook allows extensions to intercept client requests for changing
window attributes. It can either change the parameters or skip the
entire call (eg. handle all itself) so just the hook provided result
code is returned to the client.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult 2cc51aaf5f dix: clean up MakeWindowOptional() calls and add alloc fault checks
a) no need to checking for win->optional == NULL before calling
   MakeWindowOptional(), because it checks itself
   (except some cases where it's presence has it's own semantics,
   or prevent unnecessary allocations)
b) lots of call sites didn't check for allocation failure.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult 1cd1170599 dix: unexport MakeWindowOptional()
Really internal, should not be used by drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult 47b9e71ab3 dix: registry: add LookupDixAccessName()
Helper for converting Xace access masks to human-readable text.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult 7dda656db7 dix: add callback for post root window init
Allow extensions to catch in right after a screen's root window has
been finally initialized

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 16:06:56 +02:00
Enrico Weigelt, metux IT consult 709b2d005a 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-05 16:06:50 +02:00
Enrico Weigelt, metux IT consult 65034050f6 meson_options: disable Xwayland by default
Xwayland is a separate project/team and has it's own releases, so it's better
trying to to intefer with them and disable it by default.

It still can be easily enabled via meson arguments, and it's still enabled
in the CI. Let distros and operators decide on their own whether they want it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 15:36:09 +02:00
Enrico Weigelt, metux IT consult 018703ce07 randr: re-export RRTransformSetFilter() for Nvidia legacy
NVidia's proprietary driver does it's own randr implementation (why ?)
and needs this function for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 15:36:04 +02:00
Enrico Weigelt, metux IT consult 71242d24bc randr: re-export RRClientKnowsRates() for Nvidia legacy
NVidia's proprietary driver does it's own randr implementation (why ?)
and needs this function for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 15:36:00 +02:00
Enrico Weigelt, metux IT consult bebc7c0f8e randr: re-export RRProviderSetCapabilities() for Nvidia legacy
NVidia's proprietary driver does it's own randr implementation (why ?)
and needs this function for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 15:35:55 +02:00
Enrico Weigelt, metux IT consult 0523adf6d0 randr: re-export RRProviderCreate() for Nvidia legacy
NVidia's proprietary driver does it's own randr implementation (why ?)
and needs this function for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 15:35:50 +02:00
Enrico Weigelt, metux IT consult 358853f35d randr: re-export RRCrtcDetachScanoutPixmap() for Nvidia legacy
NVidia's proprietary driver does it's own randr implementation (why ?)
and needs this function for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 15:35:45 +02:00
Enrico Weigelt, metux IT consult 8141970be4 randr: re-export RRCrtcGetTransform() for Nvidia legacy
NVidia's proprietary driver does it's own randr implementation (why ?)
and needs this function for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-05 15:35:41 +02:00
Enrico Weigelt, metux IT consult 30e59a9f4f xfree86: add per major-version driver/module subdirectories
Modules are now placed into a sub-directory by major Xserver release,
so we have less hassle with trying to load drivers w/ incompatible ABI.

The legacy directories are still searched (after the versioned ones)
for backwards compat with badly maintained proprietary drivers (Nvidia).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-04 20:08:14 +02:00
Enrico Weigelt, metux IT consult c4b0a77713 Revert "(!1991) xfree86: xf86Option: unexport xf86MarkOptionUsedByName()"
Reverting commit 63c8a689c3 on request by Nvidia
(proprietary driver)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-04 20:08:14 +02:00
Enrico Weigelt, metux IT consult ae632dac9b randr: re-export RRCrtcGetScanoutSize() for Nvidia legacy
NVidia's proprietary driver does it's own randr implementation (why ?)
and needs this function for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-04 20:08:14 +02:00
Enrico Weigelt, metux IT consult 15716c7a9b randr: re-export RROutputSetNonDesktop() for Nvidia legacy
NVidia's proprietary driver does it's own randr implementation (why ?)
and needs this function for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-04 20:08:14 +02:00
Enrico Weigelt, metux IT consult 683691ff85 randr: re-export some resource type fields for NVidia legacy
NVidia's proprietary driver does it's own randr implementation (why ?)
and needs those fields for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-04 20:08:14 +02:00
Enrico Weigelt, metux IT consult 085ca43c0c xfree86: compat: re-export MarkClientException() for horryibly maintained Nvidia
NVidia yet again doing crazy shit in their proprietary drivers:

This is an DIX-*internal* function for triggering client teardown when
connection broke or somehow lack of resources to accept new connections.
Video drivers have no business with that whatsoever - having them messing
with client client connections is just insane.

But still trying to be kind with Nvidia victims, thus adding a little wrapper
function under the old name. It spills out a log warning calling users to file
bug reports their driver vendor.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-04 20:08:14 +02:00
Enrico Weigelt, metux IT consult 76c976eda6 dix: rename MarkClientException() to dixMarkClientException()
DIX functions should have proper naming.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-04 20:08:14 +02:00
Enrico Weigelt, metux IT consult 96fa99d3b0 xfree86: increase ABI versions
Since *a lot* has changed since last Xserver release, need to increase
the ABI version.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-04 20:08:14 +02:00
Enrico Weigelt, metux IT consult 21b980a617 dix: fix guards in dix/window_priv.h
Renaming the guard define to _XSERVER_DIX_WINDOW_PRIV_H

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-04 20:08:14 +02:00
Enrico Weigelt, metux IT consult 847fd0eccc README.md: add upgrade notice
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-04 20:08:12 +02:00
Enrico Weigelt, metux IT consult 668ee9b2b4 xfree86: compat: re-add xf86Msg() for badly maintained drivers.
NVidia yet again lagging behind a year with trivial cleanups,
even though they're informed about this function being deprecated
and dropped.

It spills out a log warning calling users to file bug reports their
driver vendor.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-04 14:02:47 +02:00
Enrico Weigelt, metux IT consult c4da97eb69 Revert "(!1987) glamor: unexport GLAMOR_CREATE_PIXMAP_* defines"
This reverts commit 85267d38ac.

These are needed by the RDP module (www.xrdp.org).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-04 14:02:35 +02:00
Enrico Weigelt, metux IT consult 1e4faee4e5 xfree86: fix possible buffer overflow in xf86PrintBanner()
There's chance of buffer overflow happending due lack of zero-termination
of printed string. Making sure the buffer is always propertly terminated.

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 19:26:12 +02:00
Enrico Weigelt, metux IT consult d10204372b xfree86: xf86Priv.h: unexport xf86HasTTYs()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:10 +02:00
Enrico Weigelt, metux IT consult 25744d6646 xfree86: xf86Priv.h: unexport xf86CallDriverProbe()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:10 +02:00
Enrico Weigelt, metux IT consult d421a618be xfree86: xf86Priv.h: unexport xf86LoadModules()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:10 +02:00
Enrico Weigelt, metux IT consult 266792630b xfree86: xf86Priv.h: unexport xf86CloseLog()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:10 +02:00
Enrico Weigelt, metux IT consult fd654c2967 xfree86: xf86Priv.h: unexport xf86LogInit()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:10 +02:00
Enrico Weigelt, metux IT consult 29a5ddd295 xfree86: xf86Priv.h: unexport xf86PMConfirmEventToOs field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:10 +02:00
Enrico Weigelt, metux IT consult ddb8441012 xfree86: xf86Priv.h: unexport xf86PMGetEventFromOs field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult b5878c8f22 xfree86: xf86Priv.h: unexport xf86HandlePMEvents()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 6e2d8285cb xfree86: xf86Priv.h: unexport xf86Wakeup()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 47a6466355 xfree86: xf86Priv.h: unexport DoShowOptions()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult c9527a0732 xfree86: xf86Priv.h: unexport DoConfigure()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 377761bebd xfree86: xf86Priv.h: unexport xf86PathIsSafe()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 469ba47fa0 xfree86: xf86Priv.h: unexport xf86RemoveDevFromEntity()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 9759c400d4 xfree86: xf86Priv.h: unexport xf86ClearEntityListForScreen()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 191123be66 xfree86: xf86Priv.h: unexport xf86PostProbe()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult e13e3f53fb xfree86: xf86Priv.h: unexport xf86BusConfig()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 1e6dd800e7 xfree86: xf86Priv.h: unexport xf86DefaultModes field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 0fbfe338a1 xfree86: xf86Priv.h: drop DEFAULT_VERBOSE and DEFAULT_LOG_VERBOSE defines
Not used by any external drivers, so we can use their values directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 25b26d3a5d xfree86: xf86Priv.h: unexport xf86LogVerbose field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult d0b446e2af xfree86: xf86Priv.h: unexport xf86Verbose field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult a6f335d337 xfree86: xf86Priv.h: unexport xf86VisualNames field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 396e52a324 xfree86: xf86Priv.h: unexport xf86Initialising field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult ee5f9aa670 xfree86: xf86Priv.h: unexport xf86Resetting field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 329cd977cf xfree86: xf86Priv.h: unexport xf86NumDrivers field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 9d911f3e99 xfree86: xf86Priv.h: xf86LogFileWasOpened fields
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 1d86f70389 xfree86: xf86Priv.h: xf86LogFileFrom field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 8c724fe61d xfree86: xf86Priv.h: xf86LogFile field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 8d8da27198 xfree86: xf86Priv.h: unexport xf86ModPathFrom
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult a13d93c392 xfree86: xf86Priv.h: unexport xf86ModulePath field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 16f2e214b5 xfree86: xf86Priv.h: unexport xf86Gamma field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult a53a50bc6e xfree86: xf86Priv.h: unexport xf86FlipPixels()
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-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 0a69533a96 xfree86: xf86Priv.h: unexport xf86Weight field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult bc299ff36e xfree86: xf86Priv.h: unexport xf86KeyboardName field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 613822e2ff xfree86: xf86Priv.h: unexport xf86PointerName field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult b982cdc5ff xfree86: xf86Priv.h: unexport xf86ScreenName field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 1aa90a394c xfree86: xf86Priv.h: unexport xf86LayoutName field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 014377ad56 xfree86: xf86Priv.h: unexport xf86acpiDisableFlag field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 2a0222d790 xfree86: xf86Priv.h: unexport xf86xkbdirFlag field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult d734af1f6c xfree86: xf86Priv.h: unexport xf86silkenMouseDisableFlag field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 0b638cb900 xfree86: xf86Priv.h: unexport xf86bsDisableFlag field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 41c1a60208 xfree86: xf86Priv.h: unexport xf86bsEnableFlag field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult afbfdc1b81 xfree86: xf86Priv.h: drop unused xf86sFlag field
Not actually used, so no need to keep it anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 8b0597cbd1 xfree86: xf86Priv.h: unexport xf86fpFlag field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult f4975b3793 xfree86: xf86Priv.h: unexport xf86VidModeAllowNonLocal field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 3b78bfd50d xfree86: xf86Priv.h: unexport xf86VidModeDisabled field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 644c459630 xfree86: xf86Priv.h: unexport xf86AutoBindGPUDisabled field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 3dcfa8a77f xfree86: xf86Priv.h: unexport xf86AllowMouseOpenFail field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 6b3015cf9d xfree86: xf86Priv.h: unexport xf86ConfigDir field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 828d5c825f xfree86: xf86Priv.h: unexport xf86ConfigFile field
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 9d0919544b xfree86: xf86.h: unexport xf86ExtensionInit()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 900504540d xfree86: xf86.h: unexport xf86RandRInit()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult f056d6998e xfree86: xf86.h: unexport xf86CheckModeForDriver()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult fb729a5761 xfree86: xf86.h: unexport xf86ModeStatusToString()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 44c89d57e6 xfree86: xf86.h: unexport xf86DeleteScreen()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 746de0bfc8 xfree86: xf86.h: unexport xf86DeleteDriver()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 33ae3840af xfree86: xf86.h: unexport xf86EnableInputDeviceForVTSwitch()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 79e135d98a xfree86: xf86.h: unexport xf86VTEnter()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult d34cb15c8a xfree86: xf86.h: unexport xf86VTOwner()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 346df2eb40 xfree86: xf86.h: unexport xf86ProcessActionEvent()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 6d1a382659 xfree86: xf86.h: unexport xf86SetConsoleHandler()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult d64d75778f xfree86: xf86.h: unexport xf86InitOrigins()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 19fecd3645 xfree86: xf86.h: unexport xf86ZoomViewport()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 079f4155f4 xfree86: xf86.h: unexport xf86InitViewport()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult a5fc0ab4cb xfree86: xf86.h: unexport xf86LockZoom()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult afdca4322e xfree86: xf86.h: unexport xf86FindScreenForEntity()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 786f74c1e9 xfree86: xf86.h: unexport xf86IsEntityPrimary()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult d7a6ab7d11 xfree86: xf86.h: unexport xf86RemoveEntityFromScreen()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 4bfec2a35f xfree86: xf86.h: unexport xf86DriverHasEntities()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 410427289f xfree86: xf86.h: unexport xf86ComparePciBusString()
Not used by any external drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult fd40eef031 xfree86: xf86.h: unexport pciSlotClaimed field
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-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult cf767574da xfree86: xf86.h: unexport platformSlotClaimed field
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-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult f6a94d77ea xfree86: xf86.h: unexport sbusSlotClaimed field
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-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 88f6a1fbe5 xfree86: xf86.h: unexport fbSlotClaimed field
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-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 62737ec408 xfree86: xf86.h: unexport xf86ProbeIgnorePrimary field
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-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 8b5a578447 xfree86: xf86.h: unexport xf86DoConfigurePass1 field
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-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult df8d2b2040 xfree86: xf86.h: unexport xf86DoConfigure()
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-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 1c78d70d0b xfree86: xf86.h: make xf86VTLeave() static
Only used locally in xf86Events.c

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 90dd3400eb xfree86: xf86.h: make xf86ShowClockRanges() static
Only used locally inside xf86Mode.c.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 540c312170 xfree86: xf86.h: make xf86AddPixFormat() static
Only used locally inside xf86Helper.c.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 5b3d64b0a6 xfree86: xf86.h: make xf86DisableInputDeviceForVTSwitch() static
Only used locally inside xf86Events.c

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 6eb2976851 xfree86: xf86.h: make xf86EnableGeneralHandler() static
Only used inside xf86Events.c

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult b26357643c xfree86: xf86.h: make xf86DisableGeneralHandler() static
Only used internally inside of xf86Events.c

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 3c5de64deb xfree86: xf86.h: make xf86EnableInputHandler() static
Only used locally inside xf86Events.c, so can be made static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 15e8056d43 xfree86: xf86.h: make xf86DisableInputHandler() static
Only used locally inside xf86Events.c.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult d690bf10be xfree86: xf86.h: make xf86DoShowOptions field static
Only used inside xf86Init, so can be made static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 21898dd22b xfree86: xf86.h: drop xf86GetVidModeEnabled()
Not used externally, and not actually necessary - we can use the
xf86Info.vidModeEnabled field directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult f0b7a9f6ae xfree86: xf86.h: drop xf86GetVidModeAllowNonLocal()
Not used externally, and not actually necessary - we can use the
xf86Info.vidModeAllowNonLocal field directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 6dbb891b6b xfree86: xf86.h: drop xf86GetFlipPixels()
Not used externally, and not actually necessary - we can use the
xf86FlipPixels field directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 1e88c805d4 xfree86: xf86.h: drop unused xf86UpdateDesktopDimensions()
Not used anywhere, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 44d8184b48 xfree86: xf86.h: drop unused xf86RandRSetNewVirtualAndDimensions()
Not used anywhere, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 11f51f0756 xfree86: xf86.h: drop unused xf86GetRotation()
Not used anywhere, so no need to keep it anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 9f3721a90b xfree86: xf86.h: drop unused xf86IsScreenPrimary()
Not used anywhere, so no need to keep it anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 0b2e4ea2d5 xfree86: xf86.h: drop unused xf86FindXvOptions()
Not used anywhere, so no need to keep it anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult d2b4210716 xfree86: xf86.h: drop unused xf86GetModInDevEnabled()
Not used anywhere, so no need to keep it anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 37b713056a xfree86: xf86.h: drop unused xf86GetModInDevAllowNonLocal()
Not used anywhere, so no need to keep it anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 3d3f9e0365 xfree86: xf86.h: drop unused xf86ServerIsResetting()
Not used anywhere, so no need to keep it anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 581cd9e00f xfree86: xf86.h: drop unused xf86GetWeight()
Not used anywhere, so no need to keep it anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 28e2acffc3 xfree86: xf86.h: drop unused xf86GetDepth()
Not used anywhere, so no need to keep it anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 5ded534a54 xfree86: xf86.h: drop unused xf86PrintBacktrace()
Not used anywhere, so no need to keep it anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 4466a20311 xfree86: xf86.h: drop unused xf86RemoveInputHandler()
Not used anywhere, so no need to keep it anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult c8a9919053 xfree86: xf86.h: drop unused xf86AddInputHandler()
Not used anywhere, so no need to keep it anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 9e1903b49e xfree86: xf86.h: drop unused xf86GetFbInfoForScreen()
Not used anywhere, so no need to keep it anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 54339f7078 xfree86: xf86.h: drop BOOLTOSTRING
Not used anywhere, so no need to keep it any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult d24983873f xfree86: xf86.h: drop XF86FLIP_PIXELS
Not used anywhere, so no need to keep it any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 8b4dd36dc5 xfree86: xf86.h: unexport xf86ConfigDRI field
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-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 2fea2d683e xfree86: xf86Config: drop unused xf86DRI2Enabled()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult fe9662435d xfree86: xf86Config: consolidate xf86configptr declarations
Instead of having several separate exern declarations in various
source files, using one central one xf86Config.h

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 7bf63fdf55 xfree86: xf86Config: unexport xf86configptr
Not used by any external drivers, and this header isn't even installed
in the SDK, so no need to keep this field exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 715a6335dc Update README.md for Xlibre
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult e0d8f19f3a os: move xdm function vector types from osdep.h to xdmcp.h
These are only needed in xdmcp.h, so move them there.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 1c2d0703f9 xkb: unexport XkbRF_VarDefsRec struct
No used outside of xkb, so no need to keep it in public API header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 4695b9ff6f it's time to add a CoC (code of conduct)
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult add8556fb7 xwin: fix NULL parameter in printf arguments
> ../hw/xwin/winprefs.c:625:9: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
>  625 |         ErrorF("LoadPreferences: %s not found\n", path);
>      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult a4c5cd77d2 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-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult b4c6ad48cc xnest: add pixmap depths to global depth list
Right now, we're only registering the depths of our visuals, which are
mirroring upstream's visuals. But forgotten to register the pixmap depths
that don't have an assiocated visual.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 06b8728f51 ci: add driver: xf86-video-xgi (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 86ea51f503 ci: add driver: xf86-video-voodoo (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult da34d6fb84 ci: add driver: xf86-video-vbox (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 7e094d8e9d ci: add driver: xf86-video-v4l (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 19b92b5d0d ci: add driver: xf86-video-trident (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 529d5e96dc ci: add driver: xf86-video-tdfx (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult d2349c52f5 ci: add driver: xf86-video-suntcx (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 787742ca82 ci: add driver: xf86-video-sunleo (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 4b9b8a2716 ci: add driver: xf86-video-sunffb (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult ed01a70918 ci: add driver: xf86-video-suncg6 (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 50d303b6a6 ci: add driver: xf86-video-suncg3 (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 621f3a719a ci: add driver: xf86-video-suncg14 (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult b47334545b ci: add driver: xf86-video-sisusb (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 3c272b83f4 ci: add driver: xf86-video-sis (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 2db9750949 ci: add driver: xf86-video-siliconmotion (incubate)
Need to use Xlibre incubate branch, since upstream lacks vital bugfixes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 5b2969d93b ci: add driver: xf86-video-savage (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult f73bce2621 ci: add driver: xf86-video-s3virge (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 2094842965 ci: add driver: xf86-video-rendition (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult d84210fa41 ci: add driver: xf86-video-r128 (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult a8cf325b4d ci: add driver: xf86-video-nv (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult e688073b2c ci: add driver: xf86-video-nouveau (1.0.18)
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 055ea367f9 ci: add driver: xf86-video-neomagic (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult a6efbd9596 ci: add driver: xf86-video-mga (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 846c8077d5 ci: add driver: xf86-video-mach (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 3eb558b0b8 ci: add driver: xf86-video-i740 (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:09 +02:00
Enrico Weigelt, metux IT consult 65e24defd0 ci: add driver: xf86-video-i128 (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 867aa8518e ci: add driver: xf86-video-fbdev (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 38bd4100de ci: add driver: xf86-video-dummy (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult c15731761d ci: add driver: xf86-video-cirrus (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult bdd06710fb ci: add driver: xf86-video-chips (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult b238e8022a ci: add driver: xf86-video-ast (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 40eae4d31c ci: add driver: xf86-video-ark (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 26fcabe126 ci: add driver: xf86-video-apm (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult d0e8557531 ci: add driver: xf86-input-void (master)
Last release is too old.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult cddd782115 ci: add driver: xf86-input-vmmouse (master)
Needs bugfixes not released yet.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult a715138004 ci: add driver: xf86-input-joystick (master)
Add building the joystick input driver.
Needs bugfixes not released yet.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 5fbbeeb0a0 ci: add driver: xf86-input-elographics (1.4.4)
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult b886b0af02 ci: always build with drivers
Make sure drivers are always build-tested.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult ae05aba178 ci: driver update: xf86-video-vesa (master)
No release yet, so we have to use a specific commit (latest master).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult dfe61aef0c ci: driver update: xf86-video-vmware (master)
No release yet, so we have to use a specific commit (latest master).
Desperately need some bug fixes not in last release yet.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 912e732729 ci: driver update: xf86-video-ati (master)
No release yet, so we have to use a specific commit (latest master).
Desperately need some bug fixes not in last release yet.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult dbf903f93a ci: driver update: xf86-video-amdgpu (master)
No release yet, so we have to use a specific commit (latest master).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult e6165bc73f ci: driver update: xf86-input-synaptics-1.10.0
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult cadaa8d261 ci: driver update: xf86-input-libinput-1.5.0
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 4c4f522201 ci: driver update: xf86-input-evdev-2.11.0
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult fa1e597cd4 ci: use xlibre branch of xf86-video-qxl
Desperately need some bug fixes, that aren't in upstream yet.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult b506ab4284 ci: use xlibre branch for xf86-video-intel driver
It's needs a bunch of fixes that still aren't upstreamed yet.
Intel driver team seems to be in sleeping beauty's coma :o

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 1aec55e863 ci: update libdrm to 2.4.121
Needed for newer version of amdgpu driver.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult e4a3dde190 ci: drop useless `check-commits` stage
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 1446927aac (!1853) dix: unexport ResizeVisualArray()
Not used by any drivers, and shouldn't be used by them.
Needs to _X_EXPORT'ed, as long as glx is a separate module.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 50f88ceef3 (!1854) Xi: unexport AssignTypeAndName()
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-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult ada50facb2 (!1792) os: drop own implementation of strcasecmp() and strncasecmp()
These are POSIX standard since 2001, so shouldn't be needed anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult a85800ab9a (!1690) pseudoramiX: fix warning from unused REQUEST() macro calls
In the SProc*()s, lots of REQUEST() macro calls aren't needed and causing
warnings on unused variables:

    ../pseudoramiX/pseudoramiX.c: In function ‘SProcPseudoramiXQueryVersion’:
    ../include/dix.h:66:12: warning: unused variable ‘stuff’ [-Wunused-variable]
       66 |     type * stuff = (type *)client->requestBuffer;
          |            ^~~~~
    ../pseudoramiX/pseudoramiX.c:408:5: note: in expansion of macro ‘REQUEST’
      408 |     REQUEST(xPanoramiXQueryVersionReq);
          |     ^~~~~~~
    ../pseudoramiX/pseudoramiX.c: In function ‘SProcPseudoramiXGetState’:
    ../include/dix.h:66:12: warning: unused variable ‘stuff’ [-Wunused-variable]
       66 |     type * stuff = (type *)client->requestBuffer;
          |            ^~~~~
    ../pseudoramiX/pseudoramiX.c:419:5: note: in expansion of macro ‘REQUEST’
      419 |     REQUEST(xPanoramiXGetStateReq);
          |     ^~~~~~~
    ../pseudoramiX/pseudoramiX.c: In function ‘SProcPseudoramiXGetScreenCount’:
    ../include/dix.h:66:12: warning: unused variable ‘stuff’ [-Wunused-variable]
       66 |     type * stuff = (type *)client->requestBuffer;
          |            ^~~~~
    ../pseudoramiX/pseudoramiX.c:430:5: note: in expansion of macro ‘REQUEST’
      430 |     REQUEST(xPanoramiXGetScreenCountReq);
          |     ^~~~~~~
    ../pseudoramiX/pseudoramiX.c: In function ‘SProcPseudoramiXGetScreenSize’:
    ../include/dix.h:66:12: warning: unused variable ‘stuff’ [-Wunused-variable]
       66 |     type * stuff = (type *)client->requestBuffer;
          |            ^~~~~
    ../pseudoramiX/pseudoramiX.c:441:5: note: in expansion of macro ‘REQUEST’
      441 |     REQUEST(xPanoramiXGetScreenSizeReq);
          |     ^~~~~~~
    ../pseudoramiX/pseudoramiX.c: In function ‘SProcPseudoramiXIsActive’:
    ../include/dix.h:66:12: warning: unused variable ‘stuff’ [-Wunused-variable]
       66 |     type * stuff = (type *)client->requestBuffer;
          |            ^~~~~
    ../pseudoramiX/pseudoramiX.c:452:5: note: in expansion of macro ‘REQUEST’
      452 |     REQUEST(xXineramaIsActiveReq);
          |     ^~~~~~~
    ../pseudoramiX/pseudoramiX.c: In function ‘SProcPseudoramiXQueryScreens’:
    ../include/dix.h:66:12: warning: unused variable ‘stuff’ [-Wunused-variable]
       66 |     type * stuff = (type *)client->requestBuffer;
          |            ^~~~~
    ../pseudoramiX/pseudoramiX.c:463:5: note: in expansion of macro ‘REQUEST’
      463 |     REQUEST(xXineramaQueryScreensReq);
          |     ^~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult fbc2bf9aa7 (!1688) xfree86: man: add -syslogverbse flag
Document the newly added -syslogverbose command line flag.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult a406c71576 (!1688) os: log: add syslog support
Add support for logging to syslog.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 1fbf6d9b21 (!1688) os: helper for parsing an counting-flag or value-flag option
Parses an option that may either be used for setting an integer value or
given one or multiple times (without argument) to increase an value

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 424ddcd66a (!1688) meson.build: move writing conf_data into tail of main meson file
This allows us to do further probing in the included meson files:
Individual subdirectories (eg. DDXes, extensions, OS layer, ...)
can now probe things that are only relevant to them - no need to fill
the already too fat includes/meson.build with even more things.

Preparation for upcoming commits that'll make us of that.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 11e5dfa409 (!1688) os: log: drop obsolete LogSetParameter()
The variables that can be set via this function are all now being
accessed directly. Not callers left, so drop it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 41f214b6fb (!1688) os: directly set log file sync flag, instead of using LogSetParameter()
No need for extra call to some demuxer function for nothing but setting a
simple bool variable. Setting the sync flag really is nothing more than just
writing some value into a variable, so it's trivial to just to do that, instead
of having an unncessarily complex "universal setter" for that.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult b1d99b385a (!1688) os: directly set log file verbosity level, instead of using LogSetParameter()
No need for extra call to some demuxer function for nothing but setting a
simple int variable. Setting verbosity level really is nothing more than just
writing some value into a variable, so it's trivial to just to do that, instead
of having an unncessarily complex "universal setter" for that.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 5e6c583ab1 (!1688) os: directly set console verbosity level, instead of using LogSetParameter()
No need for extra call to some demuxer function for nothing but setting a
simple int variable. Setting verbosity level really is nothing more than just
writing some value into a variable, so it's trivial to just to do that, instead
of having an unncessarily complex "universal setter" for that.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 9a92034ef5 (!1688) os: unexport internal logging functions
Lots of logging functions, especially init and teardown aren't called
by any drivers/modules, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 0641d9b8fe (!1434) drop remains of cygwin support
Cygwin support doesn't seem to be used anymore, so it can be dropped.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 103ade3892 (!1390) move systemd-logind.h to hw/xfree86/os-support/linux
systemd is linux specific and the actual implementation is under the
os-support layer of xfree86 ddx. Thus no need to keep it in global
include directory, putting it onto the linux specific os-support instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult e80df6a75f (submit/xf86-parser v2) xfree86: parser: rename STRING for fixing name conflict
Resolve name conflict with Sun's <sys/kbd.h> by renaming STRING enum
value to XF86_TOKEN_STRING.

This way, don't need the special #undef hack anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult f2b0a2b080 (submit/meson-sdk.pc) meson.build: fix missing dependencies in xorg-server.pc
xorg-server.pc missed a few dependencies, so consumers might not
get them and break build.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 3537792b4a (!1578) os: fix link failure on Illumos
On SunOS, the BSD socket API as well as hostname lookups isn't
implemented in libc, but separate libraries. We need to link them
explicitly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 09d5626584 (!1578) os: fix FTBS on Illumos due missing symbols
Several feature defines need to be set before including system headers,
otherwise build breaks:

> /usr/include/X11/Xtrans/Xtranssock.c: In function '_XSERVTransSocketRead':
> /usr/include/X11/Xtrans/Xtranssock.c:2161:14: error: 'struct msghdr' has no member named 'msg_control'
>  2161 |             .msg_control = cmsgbuf.buf,
>       |              ^~~~~~~~~~~
> /usr/include/X11/Xtrans/Xtranssock.c:2162:14: error: 'struct msghdr' has no member named 'msg_controllen'
>  2162 |             .msg_controllen = CMSG_LEN(MAX_FDS * sizeof(int))
>       |              ^~~~~~~~~~~~~~
>
> ../os/access.c:339:14: error: implicit declaration of function 'asprintf'; did you mean 'Xasprintf'? [-Werror=implicit-function-declaration]
>   339 |     length = asprintf(addr, "%s%c%s", type, delimiter, value);
>       |              ^~~~~~~~
>       |              Xasprintf

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:34:08 +02:00
Enrico Weigelt, metux IT consult 2d6c80f7d4 dix: move over private defintions from selection.h to private header
Move over private definitions to a new private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:32:11 +02:00
Enrico Weigelt, metux IT consult 0d1c488d1a dix: unexport selection functions
No driver needs them, so no reason to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:28:05 +02:00
Enrico Weigelt, metux IT consult 37a81c5c40 dix: don't install selection.h anymore
This file isn't included by any driver - not even indirectly, and hard
to imagine any driver ever needs it, so no need to keep it installed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 17:28:00 +02:00
Enrico Weigelt, metux IT consult 72c4646fa1 (submit/miext-extinit) xfree86: vidmode: unexport noXFree86VidModeExtension and move into extension
This isn't needed by any external module, so no need to export it.
And those flags are better off in the corresponding extension,
instead of the OS layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 397e2fe6ee (submit/miext-extinit) xfree86: dga: unexport noXFree86DGAExtension and move into extension
This isn't needed by any external module, so no need to export it.
And those flags are better off in the corresponding extension,
instead of the OS layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 50fde10c27 (submit/miext-extinit) xfree86: dri2: unexport noXFree86DRI2Extension and move into extension
This isn't needed by any external module, so no need to export it.
And those flags are better off in the corresponding extension,
instead of the OS layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 63bd2b6aae (submit/miext-extinit) xfree86: dri: unexport noXFree86DRIExtension and move into extension
This isn't needed by any external module, so no need to export it.
And those flags are better off in the corresponding extension,
instead of the OS layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult f571b8cba2 (submit/miext-extinit) 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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 588d2a0820 (submit/miext-extinit) 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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 86e8484970 (submit/miext-extinit) Xext: xf86bigfont: unexport noXFree86BigfontExtension
This field isn't used by any drivers, and also better belongs into
the corresponding extension instead of OS adaption layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult ccfa8e36fe (submit/miext-extinit) Xext: security: unexport noSecurityExtension
This field isn't used by any drivers, and also better belongs into
the corresponding extension instead of OS adaption layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult ad2d336cce (submit/miext-extinit) Xext: saver: unexport noScreenSaverExtension
This field isn't used by any drivers, and also better belongs into
the corresponding extension instead of OS adaption layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 3dd2f17525 (submit/miext-extinit) present: unexport present_extension_init()
It's not called by drivers/modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 37b2d617cb (submit/miext-extinit) xtest: unexport noTestExtensions field
This field isn't used by any drivers, and also better belongs into
the corresponding extension instead of OS adaption layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult df1e8e597c (submit/cleanup-damageext) damage: hand in request struct into doDamageCreate() and PanoramiXDamageCreate()
Saves us a little bit of duplicate request checking.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 3c705cd060 (submit/cleanup-damageext) damage: simplify dispatcher
These dispatcher functions are much more complex than they're usually are
(just switch/case statement). Bring them in line with the standard scheme
used in the Xserver, so further steps become easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult c52564adcd (submit/cleanup-damageext) damage: don't block requests when version not requested yet
The original intention was negotiating versions before any further requests
can be processed, so requests that might become incompatible in future versions
still can be dispatched correctly. But practically that's never been the case:
there's just one major version, and it's unlikely that a new *major* version
(that might be incompatible with the current one, using same request codes for
different things) will come in the forseeable future.

So this extra logic isn't practically needed and just complicates dispatching.
Dropping it clears the road for further simplification of the dispatcher.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 0757ae7b39 (submit/cleanup-damageext) damage: untwist Xinerma handling
The diffenciation between Xinerama and single screen version is by tweaking
call vectors unncessarily complicated: it the only reason why these are
needed in the first place. Finally, it's just about one function, so it's
much easier just branching off in ProcDamageCreate() in case of Xinerama
is enabled.

This also clears the road for further simplification of the dispatcher.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 81e0e13c9c (submit/cleanup-damageext) damage: minor code formatting cleanups
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 76db0ab965 (submit/cleanup-shm-dispatch) Xext: shm: move client local check into procs
Move extra complexity out of the dispatch functions, so they're
really just switch/case statements calling the actual handler procs.
Preparation for further steps.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 65e0b2cd1b (submit/cleanup-shm-dispatch) Xext: shm: simplify dispatcher
These dispatcher functions are much more complex than they're usually are
(just switch/case statement). Bring them in line with the standard scheme
used in the Xserver, so further steps become easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult d148fd3c02 (submit/modset-fix-vrr-hook) xace: export XaceRegisterCallback() and XaceDeleteCallback()
Allow drivers to use Xace as a clean way for retrieving property updates.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult f79b89241d (submit/vrr-driver-api) modesetting: use new VRR mode signaling DDX/driver API
Instead of highjacking core request handlers, use the recently introduced
DDX/driver API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 0f38f8c2b6 (submit/vrr-driver-api) dix: add generic Xinerama capable VRR infrastructure
We don't have a standard protocol for enabling VRR yet, but some time ago an
ad-hoc had been made in the amdgpu driver (later also copied to modsetting),
which works by client setting the _VARIABLE_REFRESH window property.

The way it's currently done - driver is highjacking the X_ChangeProperty and
X_DeleteProperty request handlers - is pretty fragile, and is also a violation
of layers: drivers never should be twisted with core protocol details. (And in
the future, this should be done by some suitable extension).

Another problem is Xinerama: when it's enabled, this only works on the first
screen - the others won't ever see this signal, no matter on which one(s) the
Window is physically placed (for the wire protocol, all windows are on screen 0,
unless the client explicitly creates them on another one)

This commit adds a generic Screen proc for telling the DDX, whether the VRR mode
shall be changed (for now, it's only DISABLED and ENABLED). Drivers can hook into
here in order to receive this signal, w/o having to highjack any core request
handlers. Catching the property change is now entirely done in the DIX.

The (non-standard) status qou of (ab)using window properties is kept, but it's
now also easy to add a new signaling mechanism, in case a standard is agreed on.

Yet a quite naive implementation (eg. not acting on moving windows between screens),
but enough to fix the most pressing problems supporting extra screens in general,
as well as stopping the highjacking of core request handlers by drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 3d306af69c (submit/fix-1741-window-depth) dix: don't refuse creating windows with different color depths and w/o border
XServer refuses the create windows with different color depth than the parent's,
just in the special case that neither border pixmap nor border pixel is given,
even if the screen supports it. (that's also one of the reasons why Xnest fails
to run with different color depths than the default one)

it really doesn't make sense to deny this, while it's allowed when having a
border color or pixmap set.

Fixes: ded6147b - R6.6 is the Xorg base-line
Closes:https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1644
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 0acb9f595d (!1654) Xnest: dont use VLA
Replace VLA usage by calloc()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult e686bc2336 (!1654) Xnest: use xcb_window_t instead of Window
Since we're now using xcb for upstream X11 connection, it's cleaner to
use it's type for the window IDs.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 3159f2cb92 (!1654) Xnest: dont link Xlib anymore
Now that we completely ported from Xlib to XCB, we can finally stop
importing Xlib :)

FIN.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 23c2ebff6f (!1654) Xnest: use XCB for upstream connection
Now that no Xlib operations (besides opening and closing connection)
aren't used anymore, we can move over the last pieces and use XCB
instead of Xlib for connecting the upstream Xserver.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult c5d5d63e3b (!1654) Xnest: use XCB for event loop
Now that no X11 calls are being done via Xlib anymore, we're free to
also move over event receiving, leaving Xlib pretty much unused.

Also need to add a simple event queue mechanism, because we've go a
screen operation (see xnestBitBlitHelper) that needs to collect up
certain events for it's return value.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 1a5eb7752b (!1654) Xnest: drop xnestWindowExposures micro-optimization
xnestWindowExposures() is a micro-optimization for the specific case that
a newly created window receives exposure events (from our upstream server)
inside the region we're already exposing on our own (miWindowExposures()):
it peeks the Xlib event queue for all expose events, checks whether their
areas are inside our exposure region and requeue's those that aren't.

Unfortunately, this depends on Xlib's internal queue mechamism, thus standing
in the way of moving to XCB (which doesn't have that).

Removing this doens't seem to make any practical difference, even with
demanding applications like GIMP. The only cost is potentially having some
initial window content painted twice, *if* the application really draws
something complicated right after creating the window.

*If* there'll really be a demand for such an optimization some day, it can
be reimplemented without any message queue: just redirecting all expose events
into recording them in a region, which is flushed out later. But for now,
there really doesn't seem to be any practical need for that.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult b155017c8e (!1654) Xnest: replace XConnectionNumber() by xcb_get_file_descriptor()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 3fb0ad0c48 (!1654) Xnest: replace XReparentWindow() by xcb_reparent_window()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 3a3e41678c (!1654) Xnest: drop using XLoadQueryFont()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 2dd391f527 (!1654) Xnest: replace XTextWidth[16]() by own implementation
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult cd5a580c56 (!1654) Xnest: load fonts via xcb
FIXME: support xf86bigfont extension
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult e0aa804354 (!1654) Xnest: replace XQueryBestSize() by xcb_query_best_size()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult b27fd4039e (!1654) Xnest: replace X(Un)InstallColormap() by xcb_(un)install_colormap()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 8489fd6166 (!1654) Xnest: drop obsolete XGetVisualInfo() call and reundant colormaps
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult a303769a49 (!1654) Xnest: use new lookup table for visuals and cmaps mappings
Use the visuals lookup table introduced by previous commit for
looking up local vs upstream visuals and their colormaps.
Replacing the the old Xlib visuals table.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 1879b61643 (!1654) Xnest: screen: record visuals and cmaps in separate table
Record the associations between host's and our visuals as well their
corresponding cmaps in a global table, which's used later for lookups.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 194d3adf17 (!1654) Xnest: fetch visuals from XCB setup data instead of Xlib
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult b173b478c2 (!1654) Xnest: screen move assigment between depths and visual assignment to own function
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult e4ee9a2a9e (!1654) Xnest: replace XParseGeometry() by own implementation
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult e29fe1a86a (!1654) Xnest: replace XGetWindowAttributes() by xcb_get_geometry()
Use xcb function instead of Xlib, and also spare one additional
(unused) request.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 1bcfc40a16 (!1654) Xnest: collect upstream window geometry in one xRectangle struct
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult af5dfed95e (!1654) Xnest: replace XGetKeyboardControl() by xcb_get_keyboard_control()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult f55a2ce5d4 (!1654) Xnest: replace XGetPointerMapping() by xcb_get_pointer_mapping()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult a4c7daf61b (!1654) Xnest: replace XGetPointerControl() by xcb_get_pointer_control()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult a03e39525e (!1654) Xnest: replace XGetModifierMapping() by xcb_get_modifier_mapping()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult ea0605d28e (!1654) Xnest: fetch keyboard mapping via xcb
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult b95ed60be0 (!1654) Xnest: add own copy of fixed xcb_xkb_get_kbd_by_name()
This is a temporary measure, until xcbproto / libxcb is fixed:
keep an own copy of the fixed xcb_xkb_get_kbd_by_name(), renamed
as xcb_xkb_get_kbd_by_name_1().

Once xcbproto/libxcb is fixed (and new xcb release is out), this
commit can be reverted.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 8d367e1f48 (!1654) Xnest: use xcb for retrieving keymap controls
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 19524534b5 (!1654) Xnest: replace XSelectInput() by xcb_change_window_attributes()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult d55900ade6 (!1654) Xnest: replace XSetStandardProperties() by xcb functions
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult ae44aaa61d (!1654) Xnest: fetch supported pixmap formats from xcb setup data
There's even no need to keep our own copies, since we can ask XCB's
copy any time.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult d88ae96439 (!1654) Xnest: fetch allowed screen depths from xcb screen info
There's even no need to keep our own copies, since we can ask XCB's
copy any time.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 790c268dbb (!1654) Xnest: Pixmap: replace XGetImage() by xcb_get_image()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 8ae264dc6b (!1654) Xnest: GC: replace XGetImage() by xcb_get_image()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 64868aca8f (!1654) Xnest: replace XDestroyWindow() by xnest_destroy_window()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 30d0b16c87 (!1654) Xnest: replace XCreatePixmapFromBitmapData() by xcb_put_image()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 30e163a92a (!1654) Xnest: replace XCreateBitmapFromData() by xcb_put_image()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult f456d11fce (!1654) Xnest: replace XDefineCursor() by xcb_change_window_attributes()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 851cfa3d80 (!1654) Xnest: replace xnestRecolorCursor() by xcb_recolor_cursor()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 1544199ab5 (!1654) Xnest: replace XFreeCursor() by xcb_free_cursor()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 8ac51df8b0 (!1654) Xnest: replace XStoreColors() by xcb_store_colors()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 1a7ea374b4 (!1654) Xnest: replace XQueryColors() by xcb_query_colors()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 159e4be499 (!1654) Xnest: replace XSetWindowColormap() by xcb_change_window_attributes()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult eb780f9103 (!1654) Xnest: replace XSetWMColormapWindows() by xcb_icccm_set_wm_colormap_windows_checked()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult e675544c2b (!1654) Xnest: use XIDs directly, instead of Xlib's GC
Now that no Xlib drawing functions used anymore, we can finally switch over
to using GC XID's directly, instead of Xlib's GC struct.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 673822fc4a (!1654) Xnest: GC: set stipple filling via xcb_change_gc
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 9dea9b4766 (!1654) Xnest: replace XSetClipMask() by xcb_change_gc()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult ba05e5cf08 (!1654) Xnest: replace XSetClipRectangles() by xnset_set_clip_rectangles()
Use XCB for setting clip rectangles.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 752753f32d (!1654) Xnest: replace XSetDashes() by xnest_set_dashes()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 5d2964cade (!1654) Xnest: replace XChangeGC() by xcb_change_gc()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult c4e45678f9 (!1654) Xnest: replace XChangeKeyboardControl() by xcb_change_keyboard_control()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 6aa4a648c9 (!1654) Xnest: replace XChangePointerControl() by xcb_change_pointer_control
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 5e2102c114 (!1654) Xnest: replace XChangeWindowAttributes() by xcb_aux_change_window_attributes()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 37fef0283f (!1654) Xnest: replace XDrawImageString() by xcb_image_text_8()
Replace XDrawImageString() by xcb_image_text_8(), as well as their 16-bit
counterparts.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult ee178f6c0f (!1654) Xnest: replace XDrawString[8|16]() by xcb_poly_text_[8|16]()
Replace XDrawString8() by xcb_poly_text_8(), as well as XDrawString16()
by xcb_poly_text_16(). Some care needs to be taken to prepend the xTextElt
header before sending the request out.

GC operation handlers don't need to care about poly-strings or length
above 254, as this is already handled by their caller, doPolyText().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 285891937e (!1654) Xnest: replace XFillRectangles() by xcb_poly_fill_rectangle()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 4ead7aae1a (!1654) Xnest: directly pass ClearArea request to upstream server
Instead of going through mi machinery, just pass the ClearArea
request to the upstream window.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult d68173ae88 (!1654) Xnest: replace XFillArcs() by xcb_poly_fill_arc()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 931986df82 (!1654) Xnest: replace XFillPolygon() by xcb_fill_poly()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult d51ce21309 (!1654) Xnest: replace XCopyPlane() by xcb_copy_plane()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 41bb4090f3 (!1654) Xnest: replace XCopyArea() by xcb_copy_area()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult d502a711b5 (!1654) Xnest: replace XDrawArcs() by xcb_poly_arc()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 91c736f83a (!1654) Xnest: replace XDrawRectangles() by xcb_poly_rectangle()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 31e9a5fa88 (!1654) Xnest: replace XDrawSegments() by xcb_poly_segment()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 640644517f (!1654) Xnest: replace XDrawLines() by xcb_poly_line()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult f41ab0f811 (!1654) Xnest: replace XDrawPoints() by xcb_poly_point()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult f244df81e6 (!1654) Xnest: replace XCreateColormap() / XFreeColormap() by xcb
Use xcb_create_colormap() and XFreeColormap() instead of XCreateColormap()
and XFreeColormap().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult fbf3001ee6 (!1654) Xnest: use xcb instead of XShapeCombineRegion() and XShapeCombineMask()
Using xcb_shape_rectangles() and xcb_shape_mask() instead of Xlib's
XShapeCombineRegion() and XShapeCombineMask().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 024dd0964d (!1654) Xnest: use xcb_put_image() for PutImage requests
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 51534064a5 (!1654) Xnest: use xcb_put_image() for creating cursors
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 71c9cfee23 (!1654) Xnest: replace XCreatePixmapCursor() by xcb_create_cursor()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 7e88fea331 (!1654) Xnest: replace XConfigureWindow() calls by xcb_configure_window()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 3b05bcb799 (!1654) Xnest: use xcb for creating / destroying pixmaps
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult da3d670140 (!1654) Xnest: replace XBell() by xcb_bell()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 6569ea80c4 (!1654) Xnest: use xcb for (un)mapping windows
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 0b299452a4 (!1654) Xnest: replace XCreateWindow() by use xcb_create_window()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult e4b6534a16 (!1654) Xnest: fetch root visual ID from screen data
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 05eb0c0d40 (!1654) Xnest: fetch keycode min/max from setup data
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 3518acebfe (!1654) Xnest: fetch image metrics from xcb connection setup data
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 0399be750e (!1654) Xnest: fetch default screen's root window from screen info
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 0adf2195a2 (!1654) Xnest: add helper for retrieving GC XID on upstream connection
Upcoming patches will need to retieve GC's XIDs on the upstream connection.
Moving this out into separate .c file, in order to not creating more
dependencies on Xlib headers, which we wanna get rid of.

For now, looking at the Xlib GC structure, attached to our DDX GCs.
When all users of the Xlib GC have gone (ie. moved all consumers to xcb),
we'll create the GC via xcb directly, thus replacing the Xlib GC struct
by XID - the interface of this helper will remain the same.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 03466f7719 (!1654) Xnest: fetch default colormap from xcb screen info
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 8490dd628d (!1654) Xnest: fetch root window depth from screen info
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult c10da6f93a (!1654) Xnest: fetch display size from xcb setup data
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 9bd118d1f3 (!1654) Xnest: fetch BlackPixel and WhitePixel from xcb setup data
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 1c3b7afc6b (!1654) Xnest: fetch xcb setup data
Fetching the setup data from xcb instead of Xlib, storing in our own struct,
holding all information needed for one particular upstream connection.
For now, there's only one, but future multi-upstream implementation will
change this to an array (and storing pointers to particular upstream in
various places).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult cf2e610b9d (!1654) Xnest: use XCB_EVENT_MASK_* defines
Use xcb's defines instead of Xlib's ones.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 88881f85f3 (!1654) Xnest: use XCB*_NONE instead of None
Use xcb's defines instead of Xlib's ones.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult f1344b3800 (!1654) Xnest: use XCB_BACK_PIXMAP_* defines
Use xcb's defines instead of Xlib's ones.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 6b640844fc (!1654) xnest: replace ExposureMask by XCB_EVENT_MASK_EXPOSURE
Use xcb's defines instead of Xlib's ones.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 5b55c927f7 (!1654) Xnest: replace NotUseful by XCB_BACKING_STORE_NOT_USEFUL
Use xcb's defines instead of Xlib's ones.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult e274f6d8f7 (!1654) Xnest: use XCB_CONFIG_WINDOW_* defines instead of CW*
Use xcb's defines instead of Xlib's ones.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 549018f099 (!1654) Xnest: use XCB_CW_* defines instead of CW*
Use XCB's defines instead of Xlib's ones.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 810e55893e (!1654) Xnest: add xcb and x11-xcb as dependency
In order to transition to XCB, we need to link xcb, but temporarily
also x11-xcb.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 8c5153f0f8 (!1600) Xext: xf86bigfont: drop unncessary zero assignments
When using static struct initialization, fields not explicitly
stated are automatically zero.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 628c054f40 (!1675) ci: enable xv and xvmc
Needed for the xf86-video-intel driver, so we should build-test it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 4db414be39 (!1681) xfree86: common: use LogMessageVerb() instead of xf86Msg()
Both are doing same job, so no need to keep using an duplicated implementation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult bb8b4ba25d (!1682) os: log: consolidate OS specific fsync() call into helper
Instead of having lots of #ifdef's, consolidating the conditionally
compiled fsync() call into a tiny inline helper.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 9901de8070 (!1682) os: log: drop now meaningless XLOG_FLUSH option
Since we're not indirectly writing via FILE anymore, this option has
become meaningless: it meant flushing out our in-process buffer to
the kernel, but we're now doing direct write() calls anyways.

xf86 still accepts the "flush" config file flag for backwards compatibility,
but it hasn't any practical meaning anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult c1da07e616 (!1682) os: log via fd instead of FILE
Instead of maintaining both the logfile fd, as well as ANSI FILE pointer,
simplify it to just a fd.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult de5c3ae4db (!1799) xkb: unexport XkbCopyControls()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 4b82050060 (!1799) xkb: unexport XkbDeviceApplyKeymap()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 820d19c1e3 (!1799) xkb: unexport XkbSendNewKeyboardNotify()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 9919a560a3 (!1799) xkb: unexport XkbApplyVirtualModChanges()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 748467b17f (!1799) xkb: unexport XkbApplyCompatMapToKey()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 3ee623dd50 (!1799) xkb: unexport XkbKeyTypesForCoreSymbols()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 95e9f652b5 (!1799) xkb: unexport XkbChangeTypesOfKey()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 76175880d9 (!1799) xkb: unexport XkbFreeInfo()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 12f5c076e4 (!1799) xkb: unexport XkbChangeKeycodeRange()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult ed0dd2e8df (!1799) xkb: unexport XkbConvertCase()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 054b4983fd (!1799) xkb: unexport XkbLookupNamedGeometry()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult c5e8145aac (!1799) xkb: unexport XkbDisableComputedAutoRepeats()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 6b611ac5d1 (!1799) xkb: unexport XkbEnableDisableControls()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 0178386c4a (!1799) xkb: unexport XkbProcessKeyboardEvent()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 38d37c1d31 (!1799) xkb: unexport XkbHandleActions()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult e06bf1e14c (!1799) xkb: unexport XkbHandleBell()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 4ab42a4474 (!1799) xkb: unexport XkbStateChangedFlags()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 8f42c51879 (!1799) xkb: unexport XkbCheckIndicatorMaps()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 251a1f2620 (!1799) xkb: unexport XkbCheckSecondaryEffects()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult a8ba58af12 (!1799) xkb: unexport XkbComputeDerivedState()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 313c012360 (!1799) xkb: unexport XkbIndicatorsToUpdate()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 2c0bcc274d (!1799) xkb: unexport XkbUpdateAllDeviceIndicators()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult f329c21596 (!1799) xkb: unexport XkbUpdateIndicators()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult b7818bd988 (!1799) xkb: unexport XkbSetIndicators()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult e34eb52b74 (!1799) xkb: unexport XkbUpdateActions()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 4d0007c6d1 (!1799) xkb: unexport XkbUpdateDescActions()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult fe1769468d (!1799) xkb: unexport XkbResizeKeyActions()
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-03 11:37:38 +02:00
Enrico Weigelt, metux IT consult 79fd3491ed (!1799) xkb: unexport XkbResizeKeySyms()
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 4a458747ed (!1799) xkb: unexport XkbAdjustGroup()
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 04e356ffae (!1799) xkb: unexport XkbVirtualModsToReal()
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 8eb59aed54 (!1799) xkb: unexport XkbMaskForVMask()
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 259a8770af (!1799) xkb: unexport XkbSetActionKeyMods()
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 4e9dbda2ac (!1799) xkb: unexport XkbFreeComponentNames()
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult dad1e6a572 (!1799) xkb: unexport XkbResizeKeyType()
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 461a4a921b (!1799) xkb: unexport XkbCopyKeyTypes()
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 92a1178c19 (!1799) xkb: unexport XkbAllocControls()
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 02392ebfde (!1799) xkb: unexport XkbAllocNames()
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 793b7a8071 (!1799) xkb: unexport XkbAllocCompatMap()
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 6ee95f95c5 (!1799) xkb: unexport XkbAllocIndicatorMaps()
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 66dbc27f56 (!1799) xkb: unexport XkbAllocKeyboard()
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult e164c5b9a9 (!1799) xkb: unexport XkbFreeNames()
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 8572634b7d (!1799) xkb: unexport XkbFreeCompatMap()
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult d71a64b4a3 (!1799) xkb: unexport XkbSetExtension
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 26c058ae37 (!1799) xkb: unexport XkbInitPrivates()
This isn't supposed to be called by drivers, so unexport it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult b55461b616 (!1799) xkb: unexport XkbProcessArguments()
Neither used by any drivers, nor makes sense doing so, thus no need
to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 4d7c544298 (!1799) xkb: unexport XkbUseMsg()
Not used by any drivers, and wouldn't even make sense doing so,
thus no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult d0ca9ef5a7 (!1799) xkb: unexport XkbDDX*() functions
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 31c3270714 (!1799) xkb: unexport led functions
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult e21a7a5a91 (!1799) xkb: unexport server/client map alloc/free funtions
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 444a40f1a3 (!1799) xkb: unexport keymap compile functions
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 48dfb9b188 (!1799) xkb: unexport XkbSrvLedInfo functions
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-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 3685547b9a (!1799) xkb: unexport _XkbLookup*() functions
Not used by any drivers, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 8118c2a98c (!1799) xkb: unexport notification sender functions
These aren't used by any drivers, so no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult be0f82ceed (!1799) xkb: unexport rules management functions
These aren't called by any driver, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult e77aa6e41a (!1799) xkb: unexport key latch functions
These aren't used by drivers, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult c91ebfcaad (!1799) xkb: unexport DDX entry points
These functions are entry points of the DDX (or stubs thereof), not supposed
to be called by any drivers, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult b251761e6c (!1799) xkb: unexport client resource functions
These aren't used by any drivers, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 1c441d8dde (!1799) xkb: unexport AccessX* functions
These aren't used by any drivers, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult fdb47fa524 (!1799) xkb: unexport internal variables
These aren't used by any drivers/modules, and it doesn't seem make much
sense doing so, thus no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 51844ba169 (!1799) xkb: unexport XKBDEVICEINFO() and xkbDevicePrivateKeyRec
These aren't used by any drivers/modules, so no need to keep 'em exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult a040843af0 (!1799) xkb: move XkbFilterEvents() into private header
No need to keep non-exported functions in public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 1e6f533790 (!1799) xkb: move event mask defines int private header
These are only used inside xkb internally, no need to keep them public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 154395897c (!1799) xkb: move *WRAP*() macros into private header
These are only used inside xkb internally, so no need to keep them
in a public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 6ca16e33ac (!1799) xkb: move _XkbErrCode*() macros into private header
These are only used internally in xkb, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 5e00e96d9a (!1799) xkb: move _XkbLibError macro into private header
It's only used internally in xkb.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 250ab907ff (!1799) xkb: move _XkbStateNotifyInProgress define into private header
It's only used in xkb internally.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult f40b0f3769 (!1799) xkb: move _XkbClient* flags into private header
These are only used by xkb internally.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult e97ed4b111 (!1799) xkb: move XkbSLI_IsDefault() and XkbSLI_HasOwnState() into private header
These macros aren't used by any drivers, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 2dc1fff342 (!1799) xkb: move XkbSetCause* macros into private header.
These aren't used by any drivers/modules, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 50ba3a644d (!1799) xkb: move _BEEP_* defines into private header
These are only used inside xkb, not by any drivers, so no need to
keep them in public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 0cec109aa2 (!1799) xkb: xkbsrv_priv.h: make includes self contained
Make sure everything it needs is explicitly included, so we don't need
to rely on some specific include order.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 988f1422f4 (!1801) os: unexport xstrtokenize()
Not used by any external drivers/modules, so no need to keep it public.
Since modesetting is using it, still needs _X_EXPORT, as long as it's
a module.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult ba0395a4f8 (1599) Xext: vidmode: untwist ProcVidModeGetAllModeLines() and use stack buffer
The ProcVidModeGetAllModeLines() is a bit complicated, because reply structs
differ depending the active protocol version. In order to make it easier to
understand and allow further simplification of the request/reply marshalling
(see ticket #1701), splitting the two protocol versions into separate functions.

Also collecting the whole payload in a stack buffer (size is already known
anyways), in order to save arbirary number of individual WriteToClient() calls,
but send out the whole reply in one pass, which in turn allows further
simplifications in the sending path.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult d78b7b992d (1599) Xext: vidmode: ProcVidModeSetGammaRamp() simplify payload write out
WriteToClient() already checks for zero-length buffer and does nothing
in that case. So we can make the code a bit easier to read and also
allow further simplification of reply submission by upcoming commits.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 0022530d9a (1599) Xext: vidmode: ProcVidModeSetGammaRamp() clean up length computation
Make computation of reply length a bit easier to understand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 07a80fdcee (1599) Xext: vidmode: ProcVidModeSetGammaRamp() declare variables where needed
Make the code a bit easier to understand by declaring the variables
where they're first used instead of at the very top of the function.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult befe2bf21b (1599) Xext: vidmode: ProcVidModeGetMonitor(): write reply payload at once.
Collect up the puzzle piezes of the reply payload into to a temporary buffer,
so we can send it as one block. This allows for further simplifications by
subsequent commits, as well as packet based transports and message based
compression.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult c3fb0614ab (1599) Xext: vidmode: ProcVidModeGetMonitor() simplify swapping/writing
We can simply call SwapLongs() before writing out the CARD32 arrays.
No need using for complicated call back logic.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 6cdbb3c2a9 (1599) Xext: vidmode: ProcVidModeModModeLine(): move len variable into branch scope
Semantically these are separate values in each branch any only used there,
so it's a bit more clean to move the declaration into the branches.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 46c98178f2 (1599) Xext: vidmode: drop unnecessary if (client->swapped)
The WriteSwappedDataToClient() already checks whether client is swapped
and directly calls WriteToClient() if it's not.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult fa7ac4513d (1599) Xext: vidmode: simplify reply struct initialization
Coherently moving all reply struct decls and assignments into static
initialization right at declaration, just before it is getting byte-
swapped and sent out. Zero-assignments can be dropped here, since the
compiler automatically initializes all other fields to zero.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 0cb7d954c7 (1599) Xext: vidmode: tidy up multi-version request control flow, part 3
Some requests using different structs dependending on which protocol version
(v1 vs. v2) had been selected. That's is handled by coverting v1 structs into v2,
before proceeding with the actual handling.

The code flow of this is very complex and hard to understand. Cleaning this up
in several smaller steps, that are easier to digest.

This part moves the request payload structs (or pointers to them) into the
per-version branches. Within each branch following our usual scheme for
extension request handlers (eg. using the REQUEST*() macros and having a
pointer named `stuff` to the current request struct)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 6d966ec707 (1599) Xext: vidmode: tidy up multi-version request control flow, part 2
Some requests using different structs dependending on which protocol version
(v1 vs. v2) had been selected. That's is handled by coverting v1 structs into v2,
before proceeding with the actual handling.

The code flow of this is very complex and hard to understand. Cleaning this up
in several smaller steps, that are easier to digest.

This part is splitting the huge request handlers into upper and lower half,
where the upper is doing the version check and converting v1 requests into v2,
while the lower one is doing the actual request processing, operating on the
struct pointer passed in from the upper one, instead of the client struct's
request buffer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 9b05c087da (1599) Xext: vidmode: tidy up multi-version request control flow, part 1
Some requests using different structs dependending on which protocol version
(v1 vs. v2) had been selected. That's is handled by coverting v1 structs into v2,
before proceeding with the actual handling.

The code flow of this is very complex and hard to understand. Cleaning this up
in several smaller steps, that are easier to digest.

This moving the request size check into the if-version-X branches, to make it
some bit easier to undertand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult f7d7381c8e (1599) Xext: vidmode: simplify dispatcher
These dispatcher functions are much more complex than they're usually are
(just switch/case statement). Bring them in line with the standard scheme
used in the Xserver, so further steps become easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 40351aef17 (1601) Xext: xres: ProcXResQueryClientIds() collect reply in one buffer
In order to allow simplifying the reply send path, collect the reply
fragments into one buffer, instead of arbitrary number of WriteToClient()
calls. This also makes it much easier for potentially new purely packet-based
transports which (eg. binder) that would need their own stream parsing logic.

This xres function is an exceptionally hard case, since payload is constructed
step by step, and it's size only known when finished. The current way of the
fragment handling still has lots of room for improvement (eg. using very small
number of allocations), but leaving this for later exercise.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 8b514efb7c (1601) Xext: xres: ProcXResQueryClientResources() simplify payload write out
Collect the few bits in a local array, so one WriteToClient() call is
sufficient. That's also easing further simplifications in upcoming commits.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult ca267daf13 (1601) Xext: xres: ProcXResQueryClients() simplify payload write out
Collect the few bits in a local array, so one WriteToClient() call is
sufficient. That's also easing further simplifications in upcoming commits.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult fae8573fe4 (1601) Xext: xres: drop duplicate include
Drop duplicated #include <string.h>.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult c054135899 (1601) Xext: xres: use static initialization and scoped ars
* use static initialization where applicable
* drop unneeded setting of zero values
* use scoped variables

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 9be5799689 (1796) dri3: simplify dispatcher
The dispatcher functions are much more complex than they're usually are
(just switch/case statement). Bring them in line with the standard scheme
used in the Xserver, so further steps become easier.

It's also much cleaner to use the defines from proto headers instead of
raw numbers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 97166b6527 (1796) dri3: consolidate reply buffers
Allocate reply buffers on stack and put multiple fragments into one buffer,
in order to make it easier doing write out by generic macros, in subsequent
commits.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 290f50772b (1796) dri3: use static reply struct init on declaration
Make the code a bit easier to read by using initialization of the reply
structs, at the point of declaration. Most of them aren't written to later,
just passed into WriteReplyToClient(). Also dropping some useless zero
assignments (struct initializers automatically zero-out unmentioned fields).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult fe540c901e (1614) xfixes: XFixesSelectCursorInput() use calloc()
In general safer coding practise to always use calloc() instead of risking
forgetting to zero-out some fields.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 08bacc793b (1614) xfixes: canonicalize reply structures
Canonicalize all reply structs onto stack allocation and static
initialization, like already done in most other extension. So make
the code easier to understand and allow further simplifications by
subsequent commits (we can then use generic macros for doing the
actual sending, as well as byteorder swapping, size computation, etc),
Also gaining a little bit efficiency by skipping some heap allocations.

Dynamically sized payload buffers (where the upper bound isn't known),
are still allocated on heap.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult a956e0d8bc (1614) xfixes: simplify dispatcher
The dispatcher functions are much more complex than they're usually are
(just switch/case statement). Bring them in line with the standard scheme
used in the Xserver, so further steps become easier.

It's also much cleaner to use the defines from proto headers instead of
raw numbers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 8b03c7109e (1614) xfixes: untwist Xinerama handling
The current way of switching between Xinerama and single-screen handlers
is quite complicated and needs call vector tables that are changed on
the fly, which in turn makes dispatching more complicated.

Reworking this into a simple and straight code flow, where individual request
procs just look at a flag to decide whether to call the Xinerama or single
screen version.

This isn't just much easier to understand (and debug), but also removes the need
or the call vectors, thus allowing further simplification of the dispatcher.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 9cd895530c (1820) xkb: xkbgeom.h: drop stale forward declarations
There're lots of forward declarations for functions that don't exist
at all (possibly have been removed, but forgotten their prototypes).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult d1b669cf1e (1820) xkb: drop unused XkbFreeGeomOverlayKeys()
Not called anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 64c690b7cc (1820) xkb: xkbgeom.h: drop unused XkbSetKey(Shape|Color) macros
Not used anywhere, so no need to keep them any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult b5f3b7a1b0 (1820) xkb: xkbgeom.h: drop unused XkbSetLogoDoodad(Color|Shape) macros
Not used anywhere, so no need to keep them any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 736b47316f (1820) xkb: xkbgeom.h: drop some unused XkbSetIndicatorDoodad*() macros
These macros aren't used anywhere:

* XkbSetIndicatorDoodadOnColor()
* XkbSetIndicatorDoodadOffColor()
* XkbSetIndicatorDoodadShape()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 4eebd65d96 (1820) xkb: xkbgeom: drop unused XkbSetTextDoodadColor() macro
Not used anywhere, so no need to keep it any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 0677bca738 (1820) xkb: xkbgeom: drop unused XkbSetShapeDoodad(Color|Shape) macros
These aren't used anywhere, so no need to keep them any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult f1bafb46fb (1820) xkb: xkbgeom.h: drop unused XkbBounds(Width|Height) macros
These aren't used anywhere, so no need to keep them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 20e3519615 (1820) xkb: xkbgeom: need to include <X11/Xdefs.h>
Using the type "Bool", which is defined in Xdefs.h, therefore this
header should be include, so we don't need to rely on it being
included indirectly by somebody else.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 545d765d9b (1820) xkb: xkbgeom.h: drop #define's on function names
There's no use in redefining function names via preprocessor this
funny ways. Perhaps there once was back when that header used to
live outside the server tree, but that's decades ago.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 363d4d58e7 (1625) composite: simplify dispatcher
The dispatcher functions are much more complex than they're usually are
(just switch/case statement). Bring them in line with the standard scheme
used in the Xserver, so further steps become easier.

It's also much cleaner to use the defines from proto headers instead of
raw numbers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 8a94163448 (1625) composite: untwist Xinerama handling
The current way of switching between Xinerama and single-screen handlers
is quite complicated and needs call vector tables that are changed on
the fly, which in turn makes dispatching more complicated.

Reworking this into a simple and straight code flow, where individual request
procs just look at a flag to decide whether to call the Xinerama or single
screen version.

This isn't just much easier to understand (and debug), but also removes the need
or the call vectors, thus allowing further simplification of the dispatcher.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 111af967cc (!1626) Xext: xvmc: skip reply payload assembly when no data to send
Instead of trying to calloc() zero-size blocks when there's no actual payload
to send, skip the whole part. This also helps reducing analyzer noise.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 88ac2ad566 (1626) Xext: xvmc: simplify reply struct initialization
* use static initialization where possible
* put the lists into one one block, so they can be written in one pass
* simplify size computations

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 593468f027 (1626) Xext: xvmc: use locally scoped counter variables
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 7a64dadeb8 (1626) Xext: xvmc: simplify dispatcher
The dispatcher functions are much more complex than they're usually are
(just switch/case statement). Bring them in line with the standard scheme
used in the Xserver, so further steps become easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 7a706b5e1e (1613) test: Xi: make sure client swapped flag is reset
Some test cases are recycling the ClientRec between swapped/unwapped runs.
Make sure the Client's swapped flag is always reset in those cases.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 7f43b09aa3 (1613) Xi: use static reply struct init on declaration
Make the code a bit easier to read by using initialization of the reply
structs, at the point of declaration. Most of them aren't written to later,
just passed into WriteReplyToClient(). Also dropping some useless zero
assignments (struct initializers automatically zero-out unmentioned fields).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult f912b1f722 (1613) Xi: simplify dispatcher
The dispatcher functions are much more complex than they're usually are
(just switch/case statement). Bring them in line with the standard scheme
used in the Xserver, so further steps become easier.

It's also much cleaner to use the defines from proto headers instead of
raw numbers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult f83b8cceb6 (1623) xkb: ProcXkbGetKbdByName(): collect sub-replies in buffer and write at once
Instead of dozens of little WriteToClient() calls, collect the sub-replies in
a buffer and send the whole reply out at once. This also allows more upcoming
simplifications in the send path.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 8ba5c85fa2 (1623) xkb: split XkbSendGeometry()
This function is a funny beast: it assembles and writes out an xkbGetGeometryReply,
called in two different cases, ProcXkbGetGeometry() as well as ProcXkbGetKbdByName().
In the latter case the whole reply is contained in another one. That's the reason
why it's payload size is computed separately - the caller must know that in order
to set up the container's reply size correctly.

As preparation for upcoming simplifications of the reply send path, splitting off
this function into pieces: XkbAssembleGeometry() just assembles the reply payload,
while it's callers now responsible for preparing the request header and writing
out both pieces.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult c340ebb4c8 (1623) xkb: split XkbSendIndicatorMap()
This function is a funny beast: it assembles and writes out an xkbGetIndicatorMapReply,
called in two different cases, ProcXkbGetIndicatorMap() as well as ProcXkbGetKbdByName().
In the latter case the whole reply is contained in another one. That's the reason
why it's payload size is computed separately - the caller must know that in order
to set up the container's reply size correctly.

As preparation for upcoming simplifications of the reply send path, splitting off
this function into pieces: XkbAssembleIndicatorMap() just assembles the reply payload,
while it's callers now responsible for preparing the request header and writing
out both pieces.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 8226f51303 (1623) xkb: split XkbSendCompatMap()
This function is a funny beast: it assembles and writes out an xkbGetCompatMapReply,
called in two different cases, ProcXkbGetCompatMap() as well as ProcXkbGetKbdByName().
In the latter case the whole reply is contained in another one. That's the reason
why it's payload size is computed separately - the caller must know that in order
to set up the container's reply size correctly.

As preparation for upcoming simplifications of the reply send path, splitting off
this function into pieces: XkbAssembleCompatMap() just assembles the reply payload,
while it's callers now responsible for preparing the request header and writing
out both pieces.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 60288107ba (1623) xkb: split XkbSendMap()
This function is a funny beast: it assembles and writes out an xkbGetMapReply,
called in two different cases, ProcXkbGetMap() as well as ProcXkbGetKbdByName().
In the latter case the whole reply is contained in another one. That's the reason
why it's payload size is computed separately - the caller must know that in order
to set up the container's reply size correctly.

As preparation for upcoming simplifications of the reply send path, splitting off
this function into pieces: XkbAssembleMap() just assembles the reply payload,
while it's callers now responsible for preparing the request header and writing
out both pieces.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult a1a114c0a9 (1623) xkb: ProcXkbGetKbdByName(): static initialization of sub-reply structs
For easier reading, move th sub-reply structs down to where they're used
first and use static initialization for the common fields.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 8dd361b642 (1623) xkb: ProcXkbGetKbdByName() simplify reply struct initialization
Move down the declaration of the reply struct, right before swapping and sending
and use static initialization.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 42f4f2abb3 (1623) xkb: XkbSendGeometry(): pass in struct as value instead of pointer
The function doesn't need to pass anything back via this pointer, it's
the last consumer of this struct. Make understanding the code a bit easier
and clear the road for further simplifications by passing the struct as
value instead of pointer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 1932110c5f (1623) xkb: XkbSendNames(): move common code into a helper macro
A little bit of simplification by putting repeated statements into macro.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult e01b9d1fcb (1623) xkb: XkbSendNames(): pass in struct as value instead of pointer
The function doesn't need to pass anything back via this pointer, it's
the last consumer of this struct. Make understanding the code a bit easier
and clear the road for further simplifications by passing the struct as
value instead of pointer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 5499a2999a (1623) xkb: let SendDeviceLedFBs() fill buffer instead of writing directly
Make the code flow a bit easier to understand and allow further simplification
by now just having to write out one additional payload as one block.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult d624638fed (1623) xkb: ProcXkbGetDeviceInfo(): consolidate buffers to reduce writes
Putting both payload pieces into one buffer, so it can be written out
with only one call.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult faf3f2a3e0 (1623) xkb: CheckDeviceLedFBs(): untwist parameters
It's hard to see which fields of the xkbGetDeviceInfoReply struct it's
reading or writing, and that complicates further simplifications of the
caller. So instead let the caller pass in the relevant fields and do the
modifications on the reply structs on its own.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult b95fba219c (1623) xkb: XkbSendIndicatorMap(): little simplification
A bit simplification in code flow.
The extra length check (did we write as much as intended?) isn't necessary,
since the buffer size is computed by the very same data before this
function is called.

Hint: the size computation must be done before calling this one, because
the reply might be encapsulated in another one (xkbGetKbdByName).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult b91113bb79 (1623) xkb: XkbSendIndicatorMap() pass in reply struct as value instead of pointer
It's not passing back any data via that pointer and actually the last
consumer of it. Changing it to value instead of pointer clears the
road for further simplifications by subsequent patches.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 5fffb7871f (1623) xkb: XkbSendCompatMap(): little cleanup and simplification
Make it a bit simpler and easier to read.

calloc() and WriteToClient() can handle zero lengths very well.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult c4b755e5d6 (1623) xkb: XkbSendCompatMap(): pass xkbGetCompatMapReply as value instead of pointer
It's not passing back any data via that pointer and actually the last
consumer of it. Changing it to value instead of pointer clears the
road for further simplifications by subsequent patches.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 3e4df9becd (1623) xkb: XkbSendMap(): some little variable decl cleanups
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 3ddf939b58 (1623) xkb: XkbSendMap() pass in reply struct as value instead of pointer
It's not passing back any data via that pointer and actually the last
consumer of it. Changing it to value instead of pointer clears the
road for further simplifications by subsequent patches.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult eefa72875c (1623) xkb: XkbWriteVirtualModMap(): only pass in the needed data
We don't need the whole struct here, especially do we not wanna change it.
Therefore only pass in what's really needed, so it gets easier to understand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 200777d8e2 (1623) xkb: XkbWriteModifierMap(): only pass in the needed data
We don't need the whole struct here, especially do we not wanna change it.
Therefore only pass in what's really needed, so it gets easier to understand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult d5c20e53fd (1623) xkb: XkbWriteExplicit(): only pass in the needed data
We don't need the whole struct here, especially do we not wanna change it.
Therefore only pass in what's really needed, so it gets easier to understand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 8060c04864 (1623) xkb: XkbWriteKeyBehaviors(): only pass in the needed data
We don't need the whole struct here, especially do we not wanna change it.
Therefore only pass in what's really needed, so it gets easier to understand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 6ea761494a (1623) xkb: XkbWriteKeyActions(): only pass in the needed data
We don't need the whole struct here, especially do we not wanna change it.
Therefore only pass in what's really needed, so it gets easier to understand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult c472eb7992 (1623) xkb: XkbWriteKeyTypes(): only pass in the needed data
We don't need the whole struct here, especially do we not wanna change it.
Therefore only pass in what's really needed, so it gets easier to understand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 53a4a81f74 (1623) xkb: XkbWriteKeySyms(): only pass in the needed data
We don't need the whole struct here, especially do we not wanna change it.
Therefore only pass in what's really needed, so it gets easier to understand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 8727a55103 (1623) xkb: SProcXkbSelectEvents(): simplify swapping
The swapping logic isn't entirely trivial to understand and can be
simplified.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult 48393b4ec8 (1623) xkb: simplify reply struct initialization
Use static initializaton as much as possible and drop unnecessary
or duplicate zero assignments.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult e24a7463a5 (1823) (1823) os.h: drop obsolete xallocarray()
This macro isn't used anywhere (also not in drivers), so no need
to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:37 +02:00
Enrico Weigelt, metux IT consult ff74d31382 (1823) panoramix: protect against allocaton failure
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 666bfbb882 (1823) xwayland: protect from memory allocation failure
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 4ffd62bba9 (1823) xwayland: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 53c52da7d4 (1823) xnest: protect from memory allocation failure
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult ba902d7885 (1823) xnest: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult d0b0877600 (1823) xfree86: protect from memory allocation failure
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult acec916223 (1823) xfree86: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult c435109314 (1823) xvfb: protect from memory allocation failure
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult eaae1fda47 (1823) xvfb: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 3e7eea1f76 (1823) kdrive: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 44bd9a210e (1823) xkb: protect from memory allocation failure
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult bd6716f863 (1823) xkb: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 23f279cabe (1823) xfixes: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 042604abe9 (1823) render: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult bd9df5b62c (1823) record: protect from memory allocation failure
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 162cb6e18d (1823) record: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult aea4ae46f6 (1823) randr: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 9fe0a77df0 (1823) os: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult a80d0488bd (1823) 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 73966618d6 (1823) 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 34d42a47df (1823) glamor: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 90f32aa77b (1823) fb: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult a1ff7094e8 (1823) exa: protect from allocation failure
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult ea079267cb (1823) exa: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 0ecd4d93d9 (1823) dix: protect from allocation failure
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult c15cc14185 (1823) dix: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 273baf9956 (1823) dbe: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 9602cfa6fd (1823) xi: protect from allocation failure
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult a395c5fa70 (1823) xi: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult f2dad7aa0a (1823) xext: xres: protect from allocation failure
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 4e837788d9 (1823) xext: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 2bdfe4da5d (1825) os: move LIMITCLIENTS define into private header
Not used by any external modules, and an implementation
detail anyways, so no need to keep it in public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult fb9f9807e1 (1826) include: misc: drop unused defines
USE_BACKGROUND_PIXEL and USE_BORDER_PIXEL aren't used anywhere,
neither in Xserver nor any drivers, so can be dropped now.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 529683fc53 (1827) xwin: drop redundant declaration of winValidateArgs()
../hw/xwin/InitOutput.c:89:2: warning: redundant redeclaration of ‘winValidateArgs’ [-Wredundant-decls]
   89 |  winValidateArgs(void);
      |  ^~~~~~~~~~~~~~~

In file included from ../hw/xwin/InitOutput.c:35:
../hw/xwin/win.h:1008:1: note: previous declaration of ‘winValidateArgs’ was here

 1008 | winValidateArgs(void);
      | ^~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult bb567fc76f (1829) xfixes: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 7f01ae2263 (1829) render: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 1c508e4c4a (1829) 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 76e64b23ca (1829) record: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 662ab1c5dd (1829) damageext: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult ee40278763 (1829) composite: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 39bb21b019 (1829) Xi: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 01d052c536 (1829) Xext: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 0a920da2a1 (1829) dix: 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult d9a077656f (1832) mi: micmap: drop unused miInitVisualsProcPtr type
It's last users gone about 15 years ago with commit
a715de7f11, so no need
to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult e46b3d4773 (1833) 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult d566267b81 (1833) 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult e2ec61c70b (1834) 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 0e066a4735 (1834) 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 44b7e1f6a8 (1836) dix: make MasksPerDetailMask define private
It's only ever used inside dix/grabs.c, no outside users,
no no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult a3e02a8de7 (1841) dix: move SHAREDCOLOR struct 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult ba169467ed (1841) dix: move SHCO struct 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult db2593545e (1841) dix: move Entry (struct _CMEntry) 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult bf5a0258ca (1841) 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 424369cd67 (1841) 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-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 3d45a6a4ae (1841) xquartz: drop unused includes of colormapst.h
Not referring to any type from that file, so no actual need
to include it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult a18ba65db6 (1841) xnest: drop not needed include of colormapst.h
We don't need anything from this file here, so no need to include it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult f3c059cf3d (1841) xfree86: drop unused imports of colormapst.h
Drop a several includes of colormapst where we don't actually
need something from that file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult c132f426fb (1841) glx: drop unused include of colormapst.h
We don't need anything from this file, so no need to include it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 6b62f4ea9c (1841) exa: drop unused import of colormapst.h
We don't need anything from that file, so no need to include it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 32c487b74e (1841) dix: drop unneeded include of colormapst.h and colormap.h
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 2ba2fe45dc (1841) composite: drop obsolete including of colormapst.h
All relevant things are now in dix/colormap_priv.h, so no need
to include colormapst.h anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult fa9964dd6e (1841) Xext: drop obsolete including of colormapst.h
All relevant things are now in dix/colormap_priv.h, so no need
to include colormapst.h anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 0f170d0e86 (1841) render: drop obsolete including of colormapst.h
All relevant things are now in dix/colormap_priv.h, so no need
to include colormapst.h anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 85d704aac1 (submit/cleanup-xv-dispatch) Xext: xv: more obvious size computations in ProcXvQueryImageAttributes()
Formulate the buffer/field size computations a bit more verbose in
ProcXvQueryImageAttributes(), so they're easier to understand on
reading the code.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 559fe589cc (submit/cleanup-xv-dispatch) Xext: xv: use int32_t in ProcXvQueryImageAttributes()
Make sure it's really a 32bit integer, since we're hard-casting since
we're relying on the buffer being made of 32bit integers (and treating
it like CARD32's). If we encounter an arch, where int isn't 32bits,
the compiler should shout out loud now.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult c4e3772198 (submit/cleanup-xv-dispatch) Xext: xv: simplify dispatcher
These dispatcher functions are much more complex than they're usually are
(just switch/case statement). Bring them in line with the standard scheme
used in the Xserver, so further steps become easier.

It's also much cleaner to use the defines from proto headers instead of
raw numbers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 00f2cfb077 (submit/cleanup-xv-dispatch) Xext: xv: untwist Xinerama handling
The current way of switching between Xinerama and single-screen handlers
is quite complicated and needs call vector tables that are changed on
the fly, which in turn makes dispatching more complicated.

Reworking this into a simple and straight code flow, where individual request
procs just look at a flag to decide whether to call the Xinerama or single
screen version.

This isn't just much easier to understand (and debug), but also removes the need
or the call vectors, thus allowing further simplification of the dispatcher.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 3535732044 (submit/cleanup-xv-dispatch) Xext: xv: use static struct initialization on declaration
A little bit of code simplification by using static initialization
of struct right at the point of declaration. Also dropping a few now
unneccessary zero assignments.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:36 +02:00
Enrico Weigelt, metux IT consult 904c001a92 (1855) include/resource.sh: drop unused INVALID define
Nowhere used, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 09cfc0fcec (1859) dix: make LEGAL_NEW_RESOURCE() macro private
Not used by any external driver, so no need to keep it in public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 41ae677b8b (1861) dix: make DDXTouchPointInfoRec private
This type isn't used by any external drivers, so no need to
keep it in public API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 986556b23a (1866) dix: use calloc() in _dixAllocateScreenObjectWithPrivates()
We're clearing the whole object size anyways, so we can directly
use calloc() instead of malloc() plus memset().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 9fc27414fd (1867) dix: unexport and rename CreateWindow()
a) an internal function that's not used by any drivers
b) conflicting with function/define of same name on win32

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult fffa9aa8b0 (1871) damage: fix resource access flag on destroy
When destroying a resource, the lookup needs to be done with
DixDestroyAccess (instead of DixWriteAccess) flag - otherwise
xace hooks can't properly differenciate what's happening.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Fixes: 6c46645cfc
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 4420c97a7b (1880) Xi: use fixed define for extenion base opcode
Several places outside Xi (eg. dix, security hooks, ...) need to know the
actual XI base opcode. This formerly had been done by a global variable,
which is filled on XI init. This has some drawbacks, eg. requires that
XI really is initialized before anybody else attempting to access this
variable - changes in extension init order could be dangerous.

Since extension opcodes are now (compile-time) fixed for all known
extensions (including XI), this isn't needed anymore. We can really
rely on the XI extension always having the same opcode base. So we
can drop that variable entirely and use the corresponding define instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 8237e265af (1880) dix: reserve fixed extension opcodes for known extensions
Assign fixed opcodes for known (in-tree) extensions and add
defines for them. Other places (eg. security extensions) that
need to know those opcodes now can directly use those defines
not having to look them up at runtime.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 1b878feef0 (1880) dix: add support for reserved extension slots
In order to allow extensions being registered at fixed opcodes,
there need to be a reserved slot range. Thus `NumExtensions` needs
to start out with the upper ceiling of the reserved slot space.
Thus it cannot tell whether the array already had been allocated,
and some slots now may be NULL, so we need some extra checks.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 96d22ac9aa (1880) dix: AddExtension: simplify error return path
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 659abbadc8 (1880) dix: simplify extension query
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 08c6bbf32b (1881) Xace: remove remains of XACE_CORE_DISPATCH
There's no actual caller of this hook - removed almost a decade ago
(see commit 6cb34816af), but some remains
had been forgotten to clean up.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 7e7ca1b5ae (1882) xwin: drop unused variable WindowsDRIReqCode
This variable is assigned once, but never used.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 673dc8fb18 (1883) Xquartz: drop unused variable DRIReqCode
This variable is assigned once, but never used.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 8c2b016ae9 (1884) xfree86: dri: drop unused variable DRIReqCode
This variable is assigned once, but never used.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 88304840c1 (1886) XI: drop now obsolete SReplyIDispatch()
nothing else to do for it anymore, since all previous callers now have been
migrated to do the byte-swapping directly, so it can be dropped entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 3d2d9c4495 (1886) XI: directly write out X_XIGetFocus reply
Write out the X_XIGetFocus reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 9b80c56198 (1886) XI: directly write out X_XIGetSelectedEvents reply
Write out the X_XIGetSelectedEvents reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 5a5dddbdec (1886) XI: directly write out X_XIGetProperty reply
Write out the X_XIGetProperty reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult f968077100 (1886) XI: directly write out X_XIListProperties reply
Write out the X_XIListProperties reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult d0de2cdf4d (1886) XI: directly write out X_XIPassiveGrabDevice reply
Write out the X_XIPassiveGrabDevice reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 2dbe9854e9 (1886) XI: directly write out X_XIGrabDevice reply
Write out the X_XIGrabDevice reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 02f9aef5ee (1886) XI: directly write out X_XIQueryDevice reply
Write out the X_XIQueryDevice  reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 9aca1a404e (1886) XI: directly write out X_XIQueryVersion reply
Write out the X_XIQueryVersion reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult ab84bed41c (1886) XI: directly write out X_XIGetClientPointer reply
Write out the X_XIGetClientPointer reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 0ac34c0c44 (1886) XI: directly write out X_XIQueryPointer reply
Write out the X_XIQueryPointer reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult b294a16845 (1886) XI: directly write out X_GetDeviceProperty reply
Write out the X_GetDeviceProperty reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult dc58917c5c (1886) XI: directly write out X_ListDeviceProperties reply
Write out the X_ListDeviceProperties reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult ce001bc635 (1886) XI: directly write out X_ChangeDeviceControl reply
Write out the X_ChangeDeviceControl reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult f0b358a3b9 (1886) XI: directly write out X_GetDeviceControl reply
Write out the X_GetDeviceControl reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult e87f7b4c7a (1886) XI: directly write out X_SetDeviceValuators reply
Write out the X_SetDeviceValuators reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 2f66205552 (1886) XI: directly write out X_QueryDeviceState reply
Write out the X_QueryDeviceState reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 6ac6ace79d (1886) XI: directly write out X_SetDeviceButtonMapping reply
Write out the X_SetDeviceButtonMapping reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 2d9b3175c9 (1886) XI: directly write out X_GetDeviceButtonMapping reply
Write out the X_GetDeviceButtonMapping reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 2b790ff842 (1886) XI: directly write out X_SetDeviceModifierMapping reply
Write out X_SetDeviceModifierMapping the reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 356e0a5f03 (1886) XI: directly write out X_GetDeviceModifierMapping reply
Write out X_GetDeviceModifierMapping the reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 1a3dd73155 (1886) XI: directly write out X_GetDeviceKeyMapping reply
Write out X_GetDeviceKeyMapping the reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 81b5b6f379 (1886) XI: directly write out X_GetFeedbackControl reply
Write out X_GetFeedbackControl the reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 690dcd25e7 (1886) XI: directly write out X_GetDeviceFocus reply
Write out X_GetDeviceFocus the reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult ad8333683f (1886) XI: directly write out X_GrabDevice reply
Write out X_GrabDevice the reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult ccca3bd2bf (1886) XI: directly write out X_GetDeviceMotionEvents reply
Write out X_GetDeviceMotionEvents the reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 4bc7f7d953 (1886) Xi: declare variables where needed in ProcXGetDeviceMotionEvents()
Improve code readability by moving variable declarations to where
they're actually needed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 6355930427 (1886) XI: drop extra temp variable in ProcXGetDeviceMotionEvents()
The value is only checked once, so no need to copy it to a temporary
variable first.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 504b7cb86a (1886) XI: use SwapLongs() in ProcXGetDeviceMotionEvents()
We already have a standard function for swapping 32 bit ints,
so let's use this one instead of rolling our own loop.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 7afacdf1b2 (1886) XI: directly write out X_GetDeviceDontPropagateList reply
Write out X_GetDeviceDontPropagateList the reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 4d16420692 (1886) XI: directly write out X_GetSelectedExtensionEvents reply
Write out X_GetSelectedExtensionEvents the reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 0c5c4f9f89 (1886) XI: directly write out X_SetDeviceMode reply
Write out X_SetDeviceMode the reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 91bfcb98fd (1886) XI: directly write out X_OpenDevice reply
Write out X_OpenDevice the reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 5f94953789 (1886) XI: directly write out X_ListInputDevices reply
Write out X_ListInputDevices the reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 476ef09ce8 (1886) XI: directly write out X_GetExtensionVersion reply
Write out the X_GetExtensionVersion reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult ece1ac6a9a (1886) XI: canonicalize reply struct declarations and naming
* name all of them "rep", as throughout most of the Xserver codebase
* always declare them where initialized

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult d82380613e (1886) dix: let change_modmap() return BadValue instead of -1
The function returns X result codes, but -1 isn't a valid value here.
Therefore all callers explicitly translate -1 to BadValue, so we can return
that directly instead of -1.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult dda861fb39 (1888) present: simplify dispatching
Using simple case statements with actual opcode define's instead
of call vector arrays where the exact order matters.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 233203007b (1890) xfixes: write out GetCursorName reply directly
The request handler already does byte-swapping on its own, and
there's no extra reply-swap handler for it, so no need to call
into callbacks here.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 547d38448d (1889) xwin: fix int size mismatch
> ../hw/xwin/winshadgdi.c: In function ‘winBltExposedWindowRegionShadowGDI’:
> ../hw/xwin/winshadgdi.c:866:78: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘DWORD’ {aka ‘long unsigned int’} [-Wformat=]
>   866 |             ErrorF("winBltExposedWindowRegionShadowGDI - BitBlt failed: 0x%08x\n",
>       |                                                                           ~~~^
>       |                                                                              |
>       |                                                                              unsigned int
>       |                                                                           %08lx
>   867 |                    GetLastError());
>       |                    ~~~~~~~~~~~~~~
>       |                    |
>       |                    DWORD {aka long unsigned int}

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 11c1cbcb23 (1889) xwin: fix name clash between Xserver and Windows headers
> ../hw/xwin/winscrinit.c: In function ‘winFinishScreenInitFB’:
> ../hw/xwin/winscrinit.c:381:18: error: ‘struct _Screen’ has no member named ‘CreateWindowA’; did you mean ‘CreateWindow’?
>   381 |         pScreen->CreateWindow = winCreateWindowRootless;
>       |                  ^~~~~~~~~~~~
> ../hw/xwin/winscrinit.c:405:18: error: ‘struct _Screen’ has no member named ‘CreateWindowA’; did you mean ‘CreateWindow’?
>   405 |         pScreen->CreateWindow = winCreateWindowMultiWindow;
>       |                  ^~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 2e77f0fc41 (1889) xwin: fix unitialized variables
> ../hw/xwin/winclipboard/xevents.c: In function ‘winClipboardSelectionNotifyData.constprop’:
> ../hw/xwin/winclipboard/xevents.c:313:23: warning: ‘codepage’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>   313 |     int iUnicodeLen = MultiByteToWideChar(codepage, 0,
>       |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   314 |                                           pszReturnData, -1, NULL, 0);
>       |                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> ../hw/xwin/winclipboard/xevents.c: In function ‘winClipboardFlushXEvents’:
> ../hw/xwin/winclipboard/xevents.c:550:35: warning: ‘codepage’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>   550 |             int iConvertDataLen = WideCharToMultiByte(codepage, 0,
>       |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   551 |                                                       (LPCWSTR) pszGlobalData, -1,
>       |                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   552 |                                                       NULL, 0, NULL, NULL);
>       |                                                       ~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 086c081375 (1889) xkb: fix printf conversion error on Windows
> ../xkb/xkb.c: In function ‘_XkbSetMapCheckLength’:
> ../xkb/xkb.c:2440:53: warning: unknown conversion type character ‘z’ in format [-Wformat=]
>  2440 |     ErrorF("[xkb] BOGUS LENGTH in SetMap: expected %zd got %zd\n", len, req_len);
>       |                                                     ^
> ../xkb/xkb.c:2440:61: warning: unknown conversion type character ‘z’ in format [-Wformat=]
>  2440 |     ErrorF("[xkb] BOGUS LENGTH in SetMap: expected %zd got %zd\n", len, req_len);
>       |                                                             ^
> ../xkb/xkb.c:2440:12: warning: too many arguments for format [-Wformat-extra-args]
>  2440 |     ErrorF("[xkb] BOGUS LENGTH in SetMap: expected %zd got %zd\n", len, req_len);
>       |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 7728c50050 (1889) xwin: fix missing include of windsock2.h
Windows headers are pretty nitpicking about include order:

> In file included from /usr/i686-w64-mingw32/include/X11/Xwinsock.h:57,
>                  from /usr/i686-w64-mingw32/include/xcb/xcb_windefs.h:34,
>                  from /usr/i686-w64-mingw32/include/xcb/xcb.h:41,
>                  from ../hw/xwin/winmultiwindowicons.c:43:
> /usr/share/mingw-w64/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp]

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult f1bc7745ab (1892) xkb: XkbInitRules() don't hard-crash the server on strdup() fail
No need to hard-crash the whole server if some strdup() calls failing,
those fields already may be NULL, so consumers can handle that situation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 9284d82d03 (1892) xkb: ddxLoad: don't crash the server when strcpy() fails
No need for RunXkbComp() to hard-crash (by calling XNFstrdup()) the server
if strdup() fails to allocate more memory - it's callers already handling
the situation gracefully.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult a80fdc9c7d (!1893) dix: write out X_ListInstalledColormaps reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 81fb2b054a (!1893) dix: write out X_ListProperties reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult f1d497845f (!1893) dix: write out X_GetProperty reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult cd7622f2df (!1893) dix: write out X_ListExtensions reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult e36c650f75 (!1893) dix: write out X_QueryExtension reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 67dc16f6d3 (!1893) dix: write out X_QueryPointer reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 5475acc408 (!1893) dix: write out X_GrabKeyboard reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult b66f86f41e (!1893) dix: write out X_GrabPointer reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult d52652d5f9 (!1893) dix: write out X_GetInputFocus reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 21cb2ca5f5 (!1893) dix: write out X_GetFontPath reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 357ec6acb6 (!1893) dix: write out X_ListHosts reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult ca5105ad98 (!1893) dix: write out X_GetScreenSaver reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult b88b04f912 (!1893) dix: write out X_QueryBestSize reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult bfb1b56691 (!1893) dix: write out X_LookupColor reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 5375a46321 (!1893) dix: write out X_QueryColors reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult e2037e0f41 (!1893) dix: write out X_AllocColorPlanes reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 869dbaaa9d (!1893) dix: write out X-AllocColorCells reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult b62ddcc645 (!1893) dix: write out X_AllocNamedColor reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 6cc541f674 (!1893) dix: write out X_AllocColor reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 177b5f6f1d (!1893) dix: write out X_ListInstalledColormaps reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 418bfc2d5c (!1893) dix: write out X_QueryTextExtents reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 03ebc34754 (!1893) dix: write out X_ListFontsWithInfo reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 6457464108 (!1893) dix: write out X_ListFonts reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 37295d2ff4 (!1893) dix: write out X_QueryFont reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 53301fc265 (!1893) dix: write out X_GetAtomName reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 4e5c48b48f (!1893) dix: write out X_InternAtom reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 5682ffe50d (!1893) dix: write out X_QueryTree reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 38b451e7c1 (!1893) dix: write out X_GetWindowAttributes reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult bee110beb1 (!1893) dix: write out X_QueryKeymap reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 0f99a3a878 (!1893) dix: write out X_GetPointerControl reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult db8ca026ea (!1893) dix: write out X_GetPointerControl reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 678bf06bed (!1893) dix: write out X_GetKeyboardControl reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 94b91e6bbe (!1893) dix: write out X_GetKeyboardMapping reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult df32ca5488 (!1893) dix: write out X_GetPointerMapping reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 113ca97a67 (!1893) dix: write out X_SetPointerMapping reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult a1c593307f (!1893) dix: write out X_GetModifierMapping reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 35d97a229b (!1893) dix: write out X_SetModifierMapping reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:35 +02:00
Enrico Weigelt, metux IT consult 231a38e6ba (!1893) dix: write out X_GetSelectionOwner reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 2f167eb21d (!1893) dix: write out X_GetImage reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 2c5ee1dca7 (!1893) dix: write out X_TranslateCoords reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 40c97db3f0 (!1893) dix: write out X_GetGeometry reply directly
No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult d00d40343d (!1893) dix: consolidate ProcGetGeometry()
No need to have it split into two functions one just wrapping
another, so move it all into one.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult d3a22bca2b (!1896) os-support: systemd-logind: don't hard-crash Xserver on strdup() fail
No need to directly hard-crash the Xserver when strdup() fails, instead
try to handle the situation gracefully.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 11af1b975c (!1897) dix: make CountBits() inline
The function is small enough for easily being inlined.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 683f99f850 (!1897) dix: unexport and document CountBits()
Not used by any drivers/modules, so no need to keep it exported.
Also adding a bit of documentation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 4bd3746a28 (!1898) os: drop deprecated Xprintf()
Not used anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 902f7ab683 (!1898) os: drop deprecated XNFvprintf()
Nobody using it anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult f10a1192d9 (!1898) os: drop deprecated XNFprintf()
Nobody using it anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult e07c7fb91a (!1898) os: drop deprecated Xvprintf()
Nobody using it anymore, so no need for keeping it around.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult a771532ac2 (!1898) os: drop Xasprintf() and Xvasprintf()
The supported platforms already have asprintf() and vasprintf(),
so there's no need for having our own implementation anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 43e91e033c (!1899) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult ba9a4a80f7 (!1899) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 13a4ffbbd7 (!1899) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult fafbc95fb6 (!1899) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 45037d03cc (!1899) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult d1de8ccda0 (!1899) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult b50d0a74b3 (!1899) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult f86433028d (!1899) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult d4f3088f5c (!1899) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 9b13bf4ed4 (!1899) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 3ddf21e8b7 (!1899) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 9f4b1c608c (!1899) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult e3f91dc24a (!1899) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult bf204fcacf (!1899) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult a072c68aad (!1899) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 550b2cade8 (!1899) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 7fa70bf1d5 (!1899) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 695ad6e264 (!1899) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 39585e9eb7 (!1900) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 168dee1533 (!1901) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult b010bd7d57 (!1901) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 0eaa95e2e6 (!1901) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult bd43cc7d72 (!1901) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult ceb2d5f240 (!1901) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult df9497bf18 (!1901) os: auth: factor out auth proto names into defines
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult c8ba68be80 (!1901) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 9422a6c034 (!1901) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 6b5ce6a11a (!1901) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult d2b662f9b0 (!1901) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 2c1030b188 (!1902) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 0fee33c257 (!1393) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 13921fbd25 (!1393) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult e663f4f7a4 (!1903) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult e83b5eb4e0 (!1904) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult adcf95b8b5 (!1916) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult e2c457756b (!1912) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult adb6c827a1 (!1917) include: document the meaning of SERVER_BIT
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 8f1e22e394 (!1918) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult e480104bff (!1918) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 075478e760 (!1919) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 0bbb3cab6b (!1920) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 3f8c936db7 (!1920) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 182e8d0052 (!1920) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 7d7c6ff5c9 (!1920) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult a003e6e273 (!1921) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult b2ac0bb4b6 (!1922) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult dbc8d2b640 (!1922) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 04e1383541 (!1922) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 2ee4863557 (!1922) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 94ffe4e965 (!1922) 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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 30b8ccf0f3 (!1922) panoramix: unexport PanoramiXFindIDByScrnum()
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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult c027da8db4 (!1922) panoramix: unexport PanoramiXCreateConnectionBlock()
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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult f5eaebad4e (!1922) panoramix: unexport PanoramiXConsolidate()
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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult f72bc95fcf (!1922) panoramix: unexport PanoramiXTranslateVisualID()
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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 15712cb087 (!1922) panoramix: unexport screen dimension fields
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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 26ca6a4e98 (!1922) panoramix: drop unused XineramaReinitData()
Not used anywhere (also not in drivers), so no need to keep it around
any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult e75b533211 (!1923) Xace: drop obsolete XaceHook() prototype
The prototype had been forgetten when removing the function.

Fixes: facdaae4e8
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 784f8d9e04 (!1924) Xi: unexport PointerBarrierType field
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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 8e8c58c010 (!1925) compext: drop unused function CompositeRegisterImplicitRedirectionException()
Not used anywhere, neither internal nor drivers, so no need to keep it around.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 76611d5e72 (!1926) dri: unexport drm_format_for_depth()
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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 4922298c8a (!1926) dri: unexport dri3_send_open_reply()
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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult a8835aa0a5 (!1927) dri: fix missing include of dix-config.h
This header needs to be included first, otherwise things can easily get really
messed up. The current code only works by accident, because some other header
already including it early enough - but a subtle change in include order
can easy break it.

Thus, always make sure the header is really included first.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 33ef1779dc (!1928) exa: fix missing include of dix-config.h
This header needs to be included first, otherwise things can easily get really
messed up. The current code only works by accident, because some other header
already including it early enough - but a subtle change in include order
can easy break it.

Thus, always make sure the header is really included first.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 5e3beb5ac2 (!1929) exa: drop ifdef on HAVE_DIX_CONFIG
We always have dix-config.h, so no need for extra guard.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 862343dccd (!1930) glamor: fix missing include of dix-config.h
This header needs to be included first, otherwise things can easily get really
messed up. The current code only works by accident, because some other header
already including it early enough - but a subtle change in include order
can easy break it.

Thus, always make sure the header is really included first.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult ba892a70be (!1931) glx: fix missing include of dix-config.h
This header needs to be included first, otherwise things can easily get really
messed up. The current code only works by accident, because some other header
already including it early enough - but a subtle change in include order
can easy break it.

Thus, always make sure the header is really included first.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 4e69d747f5 (!1931) glx: drop autogen marker from indirect_table.c
This file had been changed manually several times or at least a decode now,
so the claim it's being auto-generated isn't valid anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 529d4c8f92 (!1931) glx: drop autogen marker from indirect_size_get.c
This file had been changed manually several times or at least a decode now,
so the claim it's being auto-generated isn't valid anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult f095034423 (!1932) Xext: drop checking for HAVE_DIX_CONFIG_H
Within the Xserver build, there's always dix-config.h

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 3ab353a708 (!1933) extinit: document why no*Extension fields need to be exported.
Usually no*Extension fields shouldn't be needed by drivers, but there
are a few exceptions: some drivers need to know whether composite or
Xinerama are active.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 4fb1853050 (!1934) exa: unexport ExaOffscreenMarkUsed()
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-03 11:37:34 +02:00
Enrico Weigelt, metux IT consult 50b41ab706 (!1934) exa: unexport exaMoveOutPixmap()
Only used inside EXA code, not used by any drivers, so no need to
keep it exported any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult e209b66e18 (!1935) exa: drop exaGetPixmapSize()
Not used by anybody, neither Xserver nor drivers, so no need to
keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult e9afb9a4da (!1909) xwayland: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult e2e0af3224 (!1909) xwin: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 2442862477 (!1909) xnest: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult f759a7eee7 (!1909) xfree86: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult fc803e03b9 (!1909) vfb: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 1b43399daa (!1909) kdrive: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult dc596e14db (!1909) include: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 9cfb86f916 (!1909) os: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 34347c4466 (!1909) dix: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 8287b73ea7 (!1909) render: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 3d93092c93 (!1909) randr: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 7c4f4ef872 (!1909) record: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult ff6d9a9f46 (!1909) 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 7bef3a021e (!1909) glamor: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 01b7b37752 (!1909) 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult a034c89161 (!1909) Xi: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult fec93d19ac (!1909) glx: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 789f7adcba (!1909) dbe: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 894b56a6c4 (!1909) exa: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 996e79463d (!1909) composite: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult e64a51188a (!1909) fb: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 3fb4415fd8 (!1909) damageext: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult e27a5d290d (!1909) Xext: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 78be6acd7a (!1909) xfixes: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult b815ee41f0 (!1909) xkb: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult f0442781a9 (!1939) xfree86: drop obsolete xf86GetEntityForSbusInfo()
Not used anywhere, neither Xserver nor drivers, so no need to keep it anymore.

According to git history, it had been introduced introduced in 2003 (*1),
but never called (inside the Xserver) - unclear whether it ever had been
actually used somewhere.

*1) 9508a382f8
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 240fe45d96 (!1940) xfree86: sbus: drop SBUS_DEVICE_MGX
There doesn't seem to be any driver for these cards anymore,
so no need for trying to probe them anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 389f9eed91 (!1940) xfree86: sbus: drop SBUS_DEVICE_GT
There doesn't seem to be any sungt driver anymore, so no need for
trying to probe those cards any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 3978a1c26a (!1940) xfree86: sbus: drop SBUS_DEVICE_CG12
There doesn't seem to be any suncg12 driver anymore, so no need for
trying to probe those cards any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 692387f520 (!1940) xfree86: sbus: drop SBUS_DEVICE_CG8
There doesn't seem to be any suncg8 driver anymore, so no need for
trying to probe those cards any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 823336efbe (!1940) xfree86: sbus: drop SBUS_DEVICE_CG4
There doesn't seem to be any suncg4 driver anymore, so no need for
trying to probe those cards any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult bd37bd46b8 (!1940) xfree86: sbus: drop SBUS_DEVICE_CG2
There doesn't seem to be any suncg2 driver anymore, no need for trying
to probe those cards any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 6c88cf61a7 (!1940) xfree86: sbus: drop SBUS_DEVICE_BW2
There doesn't seem to be any sunbw2 driver anymore, so no need for trying
to probe those cards any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 3eae1904a4 (!1941) xfree86: sbus: make promRootNode field static
Only used internally inside Sbus.c, so no need to keep it public any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 9084c14e3f (!1941) xfree86: sbus: make promGetBool() static
Only used internally inside Sbus.c, so no need to keep it public any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 4932dd034c (!1941) xfree86: sbus: make promGetProperty() static
Only used internally inside Sbus.c, so no need to keep it public any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 6d2d0fb479 (!1941) xfree86: sbus: make promGetChild() static
Only used internally inside Sbus.c, so no need to keep it public any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 3dab9f6a53 (!1941) xfree86: sbus: make promGetSibling() static
Only used internally inside Sbus.c, so no need to keep it public any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 2ea2d98e58 (!1942) xfree86: sbus: unexport struct sbus_devtable
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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 29da211eb9 (!1942) xfree86: sbus: unexport sbusDeviceTable field
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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 1c21a7eb9c (!1942) xfree86: sbus: unexport xf86SbusInfo field
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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 8cdd5499b2 (!1942) xfree86: sbus: unexport sparcDriverName()
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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult ad1379acd6 (!1942) xfree86: sbus: unexport sparcPromPathname2Node()
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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 1d67fbbf13 (!1942) xfree86: sbus: unexport sparcPromNode2Pathname()
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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 11c491d6cf (!1942) xfree86: sbus: unexport sparcPromAssignNodes()
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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 6cd5932745 (!1942) xfree86: sbus: unexport sparcPromGetProperty()
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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 815286a689 (!1942) xfree86: sbus: unexport xf86SbusProbe()
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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 5757308f7a (!1944) 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 793f114ed1 (!1714) 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 2561ed5337 (!1714) xfree86: crtc: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 1a3c4c48f1 (!1714) exa: use PostCreateScreenResources 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 5a5ef53966 (!1714) dix: add CreateScreenResources callback mechanism
Right now, extensions that need to be called after the CreateScreenResources
proc had been run, must wrap the screen proc vector directly (all of them
forming kind of daisy chain), and so - when called - temporarily restore the
previous one, call it, wrap again, and if the call was successful finally
doing it's own stuff. (same is done for many 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.

Instead introducing a simple approach for letting extension hook into a
post-CreateScreenResources callback list safely, w/o having to care much
about side effects with the call chain. Extensions now can simply register
their business logic and get called back - w/o ever having to mess with the
ScreenRec's internal structures.

Note that these hooks are executed *AFTER* the original CreateScreenResources()
proc had been called SUCCESSFULLY (returned TRUE), so callees can rely on
the DDX/driver had already done it's job.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 6845fa2dde (!1714) glamor: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 9f1639cb92 (!1714) exa: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult cd81554aa5 (!1714) 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 2c5a51e7ef (!1714) Xext: xv: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 92ba1519c0 (!1714) Xext: shm: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 5736d3e8e6 (!1714) dix: add per-screen pixmap destructor mechanism
Right now, extension specific pixmap destruction procedures are implemented
by wrapping the ScreenRec's DestroyPixmap() 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.

It's even getting worse: the proc also has to do ref counting, and only destroy
the pixmap if refconter reaching zero - that's all done in the individual screen
drivers. Therefore, all extensions must check for refcnt == 1, in order to know
when to really act.

This commit introduces a simple approach for letting extension hook into the
pixmap destruction safely, w/o having to care much about side effects with
the call chain. Extensions now can simply register their destructor proc
(and an opaque pointer) and get called back - w/o ever having to mess with
the ScreenRec's internal structures.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult d92591614f (!1714) xfree86: shadowfb: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult dad86b509e (!1714) xfree86: cursor: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 5dbab63f56 (!1714) xfree86: crtc: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

This one doesn't look so trivial at first glance, but I've checked that
other functions called by xf86CrtcCloseScreen() just free'ing up some
memory and removing the CRTCs from some lists - thus a change in
execution order really shouldn't matter at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 2e7c653c7b (!1714) xfree86: exa: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 54fec99bd6 (!1714) xfree86: xvmc: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult c4268d9782 (!1714) xfree86: xv: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 271d77b75d (!1714) xfree86: sbus: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 31b0f7cd80 (!1714) xfree86: fbman: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 246a0113bf (!1714) xfree86: cmap: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 51137b7e0d (!1714) xfree86: randr: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 3ac2c9f20a (!1714) xfree86: dga: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult c76128e87b (!1714) panoramiX: 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 44f40b07aa (!1714) 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult 0790f2c92a (!1714) 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-03 11:37:33 +02:00
Enrico Weigelt, metux IT consult b99c4ccae8 (!1714) 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 4b6da2cdea (!1714) present: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 959ed0ff34 (!1714) xwayland: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 4b335dad1b (!1714) 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 68cadc9269 (!1714) 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 775d119491 (!1714) randr: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult ab156eb63b (!1714) glamor: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 02a227a47a (!1714) exa: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 5e005be667 (!1714) compext: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult e7aedb05bd (!1714) dri3: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult c159e56d1d (!1714) render: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult d93b4dd225 (!1714) xvmc: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 3dc3fa8154 (!1714) xv: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult a0c0bf08ef (!1714) xfixes: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 1a03a2eef1 (!1714) Xext: shm: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult e615668020 (!1714) dix: add per-screen close notify hook
Right now, extension specific actions on screen closing 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
screen closing 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 7eba5d733b (!1714) 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 43a3f720a8 (!1714) dbe: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 11da36f317 (!1714) composite: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult ab7139ff95 (!1714) 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 7982442337 (!1714) xwayland: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult c38ac237ed (!1714) xfree86: dri: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult bb77211dd4 (!1714) xfree86: xv: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult e2a7b15cd5 (!1714) kdrive: xv: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 0c50dbee17 (!1714) 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult eefeaaf29f (!1714) composite: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 65cd91dfb8 (!1714) xv: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 679fecceca (!1714) 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult e8aec6c563 (!1714) render: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 9590b34c8e (!1714) present: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 83d9fdcb42 (!1714) dbe: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult f2d9eac1a1 (!1714) dix: add per-screen window destructor hook
Right now, extension specific window destruction procedures are implemented
by wrapping the ScreenRec's DestroyWindow() 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 destruction safely, w/o having to care much about side effects with
the call chain. Extensions now can simply register their destructor proc
(and an opaque pointer) and get called back - w/o ever having to mess with
the ScreenRec's internal structures.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 3f9cbebcdf (!1714) dix: make DeleteCallbackList() non-static and document it
Allow using it by other places outside this file, so we can also support
callback lists in dynamically allocated structures:

Those cases need to explicitly call DeleteCallbackList() before free()ing
the structures - otherwise we're getting heap corruptions, because the
actual deletion can happen asynchronously.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 5cef2bc833 (!1905) dix: consolidate screen destruction in dixFreeScreen()
Consolidate duplicated screen destruction logic into new function
dixFreeScreen().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult eeee0f095b (!1905) dix: replace FreeDefaultStipple()
It's just a one-liner only called once, so no actual need for it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult f237658af8 (!1905) dix: let FreeGCperDepth() operate on ScreenPtr and NULL protect it
Instead of retrieving the screen index from ScreenRec and passing this,
so the ScreenRec is looked up again, just pass in the ScreenPtr that
already have anyways.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult a580a2e913 (!1905) dix: NULL-protect FreeGC()
Make it possible to call FreeGC() w/o prior NULL checks.
In case of NULL, BadMatch is returned.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult ebecf5635f (!1936) xwin: fix missing include of mi/mi_priv.h
xwin relies on mi_priv.h being included indirectly, thus depending
on exact include within other header files. This can easily break if
something in other headers slightly changes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 50deeaa134 (!1937) 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 332c975ddd (!1943) xfree86: unexport xf86RandR12CreateScreenResources()
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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 9ee71d3446 (!1943) xfree86: unexport xf86RandR12CloseScreen()
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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 8c8fad049f (!1945) egl: drop unused CreateScreenResources pointer
This field hasn't been actually used, so no need to keep it any longer.

Fixes: 60f14d60f6
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult c005224770 (!1946) kdrive: drop obsolete ifndef PHOENIX
The symbol isn't set anywhere, and git history didn't show anything
were it ever had been set, thus no need to keep this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 0394739223 (!1947) kdrive: call miCreateScreenResources() drectly
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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult c66a2f8a79 (!1947) kdrive: directly calling KdCloseScreen() instead of wrapping
No need to wrap CloseScreen proc vector, we can call KdCloseScreen() from
KdXVCloseScreen() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 77d04f45a9 (!1947) kdrive: directly calling fbCloseScreen instead of wrapping
No need to wrap CloseScreen proc vector, we can call fbCloseScreen() from
KdCloseScreen() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 539fe51848 (!1948) xwayland: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 9a6a1cd7ff (!1705) xwin: 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult c0a1c9f53f (!1705) xwin: drop wrapping on ScreenRec->ModifyPixmapHeader()
Instead of complicated wrapping, just call fbModifyPixmapHeader() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult bc2482f57e (!1705) xwin: drop winResizeWindowMultiWindow()
This wrapping function for Screen->ResizeWindow() is does nothing more than
just call the original functions. So no need to keep wrapping it at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 8fd847c2f5 (!1705) xwin: drop wrapping on ScreenRec->MoveWindow()
Instead of complicated wrapping, just call fbMoveWindow() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult eb55549376 (!1705) xwin: drop wrapping on ScreenRec->RestackWindow()
This proc vector is optional (callers check for non-null) and neither fb nor
mi set it, so we can just assign our function directly. No need for wrapping.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult b2c3e4d3a9 (!1705) xwin: drop wrapping on ScreenRec->ReparentWindow()
This proc vector is optional (callers check for non-null) and neither fb nor
mi set it, so we can just assign our function directly. No need for wrapping.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 488c70eb75 (!1705) xwin: drop wrapping on ScreenRec->UnrealizeWindow()
Instead of complicated wrapping, just call fbUnrealizeWindow() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult a6f05514fc (!1705) xwin: drop wrapping on ScreenRec->RealizeWindow()
Instead of complicated wrapping, just call fbRealizeWindow() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 5c25eac5bf (!1705) xwin: drop wrapping on ScreenRec->SetShape()
Instead of complicated wrapping, just call fbSetShape() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 68b4627973 (!1705) xwin: drop winCopyWindowMultiWindow()
This wrapping function for Screen->CopyWindow() is does nothing more than
just call the original functions. So no need to keep wrapping it at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult a19219eb48 (!1705) xwin: call winFinishScreenInitFB() directly
Both engines, GDI as well as DirectDraw, using the same screen init finish function,
so no need to keep indirection via per-engine callback pointer.

The winFinishScreenInitFB() can also be made static now.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 71f1eed501 (!1705) xwin: glx: drop glxWinUnrealizeWindow()
It does nothing more than just calling the original/wrapped function,
so we don't need that at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 814824a134 (!1705) xwin: glx: drop glxWinRealizeWindow()
It does nothing more than just calling the original/wrapped function,
so we don't need that at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult fbca68ad7a (!1705) xwin: drop wrapping on ScreenRec->ChangeWindowAttributes()
Instead of complicated wrapping, just call fbCreateWindow directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 57a7253fd2 (!1705) xwin: drop wrapping on ScreenRec->CreateWindow()
Instead of complicated wrapping, just call fbCreateWindow directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 467b254497 (!1705) xwin: drop wrapping on ScreenRec->PositionWindow()
Instead of complicated wrapping, just call fbPositionWindow directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 390e3aa0d4 (!1705) xwin: drop wrapping on ScreenRec->DestroyWindow()
Instead of complicated wrapping, just call fbDestroyWindow directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 6329391415 (!1949) 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 2c90bc5ab6 (!1950) xfixes: 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-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult b9d7c4dd42 (!1952) xfree86: fbdevhw: drop unused FBDEVHW_PLANES
Not used anywhere, neither internal nor external.

(BTW, those defines are only used within xf86-video-fbdev, so they maybe
could be moved over there.)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 5ac0ed1e8a (!1952) xfree86: fbdevhw: drop unused fbdevHWSaveScreenWeak()
Not used anywhere, neither internal nor external (drivers), so no need
to keep it any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 9a99a5bd5e (!1952) xfree86: fbdevhw: drop unused fbdevHWEnterVTWeak()
Not used anywhere, neither internal nor external (drivers), so no need
to keep it any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 9f5d3ae282 (!1952) xfree86: fbdevhw: drop unused fbdevHWGetBuildinMode()
Not used anywhere, neither internal nor external (drivers), so no need
to keep it any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 141b8aecdf (!1952) xfree86: fbdevhw: drop unused fbdevHWGetFD()
Not used anywhere, neither internal nor external (drivers), so no need
to keep it any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 292bd173fc (!1952) xfree86: fbdevhw: drop unused fbdevHWFreeRec()
Not used anywhere, neither internal nor external (drivers), so no need
to keep it any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult fa9ec23054 (!1952) xfree86: fbdevhw: make fbdevHWGetRec() static
Not used by any external consumers, only within the same source file,
so can become static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult f3de3f669d (!1954) fb: unexport fbGetScreenPixmap() macro
No external users, so no need to keep it exported any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult f1439509b4 (!1954) fb: unexport fbGetGCPrivate() macro
Not used by drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 91aa8fe959 (!1954) fb: unexport FbDash*() macros
No external users, so no need to keep them exported.

(note that xf86-video-intel has it's own copies of them)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 4b5815f147 (!1954) fb: unexport FbMaskBits() macro
No external users, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 6af649e47e (!1954) fb: unexport FB_HEAD_BITS and FB_TAIL_BITS macros
Not used by any driver, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 57f44edaae (!1954) fb: unexport FbBitsStrideToStipStride() macro
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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult d8ea47aefa (!1954) fb: move FbStipStrideToBitsStride() to fbblt.c
It's only consumer is fbblt.c, so move it there.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 803da17903 (!1954) fb: move MEMCPY_WRAPPED() and MEMSET_WRAPPED() into fbblt.c
Only used inside fbblt.c, so we can move them into there.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult a51a624d80 (!1954) fb: unexport fbListInstalledColormaps()
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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 94beaee763 (!1954) fb: unexport fbAllocatePrivates()
Only used inside fb/, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 8c4ea8a0c0 (!1954) fb: unexport fbSetBits()
Only used within fb/, not by any driver, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult b827c9d1f1 (!1954) fb: unexport fbInitializeDrawable() and make it static
Only used inside fbpixmap.c (where it's defined), so can be static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult ee55cce7bf (!1954) 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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 7f7aeb250b (!1954) fb: make fbGCFuncs static
Not used outside fbgc.c, so can be made static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 6ad16e7ee9 (!1954) fb: make fbGCOps static
Not used anywhere outside fbgc.c, so can be static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult f16747ecc8 (!1954) fb: drop obsolete fbPolyFillArc and fbPolyRectangle defines
Those aliases haven't been used (outside fb core itself), since XAA removal
back 17 years ago, no no need to carry them in public interface any longer.

See: 703a9645f3
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 6c14b6c00e (!1954) fb: drop obsolete fbGetExpose() macro
Hasn't been used since 15 years so, probably should was forgotten to clean up.

See: bbbf795e6b
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 54c7518f29 (!1954) fb: drop obsolete FbLaneCase*() macros
They haven't been used for over a decade now, so no need to keem'em any longer.
(note: xf86-video-intel has it's own copy of them)
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 302fe77714 (!1954) fb: drop obsolete FbMaskStip macro
Hasn't been used since 24bpp support was dropped, almost a decade ago.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 5c0d729702 (!1954) fb: drop obsolete fbFillPolygon define
Hasn't been used since XAA removal, back 17 years ago. Probably just had been
forgotten to clean up.

See: 703a9645f3
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult f7039fa5ed (!1954) fb: drop FbRotStipLeft, FbRotRight, FbRotStipRight macros
Not used anywhere, so can be dropped. Doesn't seem to be ever used
since added over two decades ago.

See: 9508a382f8
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 702db19fd9 (!1954) fb: drop commented-out FbLeftBits and FbLeftBits macros
Not used anywhere, so can be dropped. They always have been commented-out
since added over two decades ago.

See: 9508a382f8

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult fe9e806629 (!1954) fb: drop obsolete FB_STIP_ODDSTRIDE and FB_STIP_ODDPTR macro()
Those haven't been used for over a decade now, so no need to keep
it around any longer.

See: a198373685

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 0ffb306357 (!1955) Xext: geext: drop obsolete geext.h
This header has now become obsolete. There're also no external consumers
(drivers, etc) left, so it now finally can be dropped entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 0dcd2c9692 (!1955) Xext: geext: unexport GERegisterExtension() and document it
Not used by any external module (eg drivers), so no need to keep it
exported. Also documenting it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 7236406761 (!1956) dri3: unexport VERIFY_DRI3_SYNCOBJ() macro
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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 66b17a99cc (!1956) dri3: move dri3_syncobj_type to non-public header
The symbol isn't exported, thus not accessible to modules.
No need to keep it in public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult fac193d471 (!1957) fb: overlay: drop unused fbOverlaySetupScreen()
Not used anywhere, neither internal nor drivers, so no need to keep
it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 0ee9f0ada6 (!1957) fb: overlay: make fbOverlayWindowExposures() static
Not used anywhere outside fboverlay.c, so can become static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 7d9a5d7487 (!1957) fb: overlay: make fbOverlayCopyWindow() static
Not used anywhere outside fboverlay.c, so can become static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 357a6f813e (!1957) fb: overlay: make fbOverlayUpdateLayerRegion() static
Not used anywhere outside fboverlay.c, so can become static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult ec8d204884 (!1957) fb: overlay: make fbOverlayPaintKey() static
Not used anywhere outside fboverlay.c, so can become static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 160da1abc8 (!1957) fb: overlay: make fbOverlayCreateScreenResources() static
Not used anywhere outside fboverlay.c, so can become static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult d81fba92f4 (!1957) fb: overlay: make fbOverlayWindowLayer() static
Not used anywhere outside fboverlay.c, so can become static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 0cbb7976a9 (!1957) fb: overlay: make fbOverlayCloseScreen() static
Not used anywhere outside fboverlay.c, so can become static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 28a63f6394 (!1957) fb: overlay: make fbOverlayCreateWindow() static
Not used anywhere outside fboverlay.c, so can become static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult ca0ef0ce1e (!1958) os: xdmcp: handle allocation failure
| ../os/xdmcp.c: In function ‘get_mcast_options’:
| ../os/xdmcp.c:1527:27: warning: dereference of possibly-NULL ‘mcastinfo’ [CWE-690] [-Wanalyzer-possible-null-dereference]
|  1527 |             mcastinfo->ai = firstai;
|       |             ~~~~~~~~~~~~~~^~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 9a1302e8ba (!1958) os: util: protect set_font_authorizations() from allocation failure
| ../os/utils.c: In function ‘set_font_authorizations’:
| ../os/utils.c:863:14: warning: dereference of possibly-NULL ‘result’ [CWE-690] [-Wanalyzer-possible-null-dereference]
|   863 |         *p++ = sizeof(AUTHORIZATION_NAME) >> 8;
|       |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 3ba100184f (!1958) os: ospoll_create(): protect from allocation failure
| ../os/ospoll.c: In function ‘ospoll_create’:
| ../os/ospoll.c:229:22: warning: dereference of possibly-NULL ‘ospoll’ [CWE-690] [-Wanalyzer-possible-null-dereference]
|   229 |     ospoll->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
|       |     ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult a25d63e542 (!1959) composite: silence some warnings on possible NULL dereference
Unlikely to practically happen, but still safer to just check for sure.
A simple zero-value test doesn't cost us much (on modern CPUs perhaps
not even a full clock cycle).

| ../composite/compalloc.c: In function ‘compRedirectWindow’:
| ../composite/compalloc.c:167:35: warning: dereference of NULL ‘pClient’ [CWE-476] [-Wanalyzer-null-dereference]
|   167 |     ccw->id = FakeClientID(pClient->index);
|       |                            ~~~~~~~^~~~~~~

| ../composite/compalloc.c: In function ‘compUnredirectWindow’:
| ../composite/compalloc.c:331:75: warning: dereference of NULL ‘pClient’ [CWE-476] [-Wanalyzer-null-dereference]
|   331 |         if (ccw->update == update && dixClientIdForXID(ccw->id) == pClient->index) {
|       |                                                                    ~~~~~~~^~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 6dc4afe936 (!1960) exa: protect against NULL pointer dereference
Since GetPictureScreenIfSet() explicitly can return NULL, better be
prepared for that to happen (instead of hard crash)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult ba12b3b5bb (!1961) kdrive: protect against allocation failures and NULL pointers
Even if those situations shouldn't practically happen, it's better to have
some sanity checks just in case.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult a38d8cd99e (!1962) fb: pict: make fbGlyphs() static
Not used anywhere outside fbpict.c, so can become static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult eb560a71a4 (!1962) fb: pict: unexport fbTriangles()
Not used by drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 11165bd4df (!1962) fb: pict: unexport fbTrapezoids()
Not used by drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 3cd412fb1a (!1962) fb: pict: unexport fbAddTriangles()
Not used by drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult bab697274f (!1962) fb: pict: unexport fbRasterizeTrapezoid()
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-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult d0b739df0c (!1963) render: NULL-protect SetPicturePictFilter()
Even though it shouldn't practically happen, better adding a trivial check,
just in case. The check is really cheap and possibly optimized-out.

| ../render/filter.c: In function ‘SetPicturePictFilter’:
| ../render/filter.c:388:36: warning: dereference of possibly-NULL ‘new_params’ [CWE-690] [-Wanalyzer-possible-null-dereference]
|   388 |         pPicture->filter_params[i] = params[i];
|       |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 66eea71100 (!1963) render: NULL protect cpAlphaMap()
Even though it practically should never happen, but just in case, and
for silencing the analyzer, add an extra check here (which doesn't
cost us much).

| ../render/picture.c: In function ‘cpAlphaMap’:
| ../render/picture.c:1002:30: warning: dereference of NULL ‘screen’ [CWE-476] [-Wanalyzer-null-dereference]
|  1002 |         id = res->info[screen->myNum].id;
|       |                        ~~~~~~^~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 1bffdaad2a (!1963) render: glyph: extra NULL pointer protection
Even though it's probably never happening, but still better to protect from it,
just in case. The extra cost of it hard to measure on today's machines.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:32 +02:00
Enrico Weigelt, metux IT consult 520cce7227 (!1964) test: add assert()s to fix analyzer warnings
Reduce the analyzer spam a bit by adding some extra asserts.
Since it's test code, we can't have enough of them anyways ;-)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 7f2a84ccf5 (!1964) test: fix FILE pointer leak
Fix leaking open FILE*.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult d9a32056ca (!1965) record: protect from NULL pointers
Even though the situation probably never happens, but better being extra
cautious, just in case.

| ../record/set.c: In function ‘IntervalListCreateSet’:
| ../record/set.c:364:5: warning: use of NULL ‘stackIntervals’ where non-null expected [CWE-476] [-Wanalyzer-null-argument]
|   364 |     memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval));
|       |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 45e7a34335 (!1966) dix: a little bit more startup logging
Adding a little bit more logging to the startup process, eg. telling
when outputs or inputs have been initialized. Serving as a little aid for
debugging driver problems.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult b8209d0342 (!1967) dix: protect input_option_set_value() from NULL pointer
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 36d533f830 (!1967) dix: extra NULL safety check in SetClipRects()
Even though it might never be actually hit, it's better to have an
(really cheap) extra check, just in case.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 9b76094c53 (!1967) dix: extra NULL protection in UnmapSubwindows()
Even though it probably won't be hit ever, it's still better to be
really sure instead of some remote chance for hard segfault.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 34360efebc (!1967) dix: clear free()ed pointers on CloseDownExtensions()
As safety precaution, clear the pointers to extion records that just
have been free()ed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult ed84f43274 (!1967) dix: NULL-protect AllocGlyphCursor()
Return error to the client if sourcefont turns out to be NULL for
whatever reason.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 709db0833e (!1967) dix: devices: refine NULL checks in GetMaster()
The checking / branchin isn't entirely trivial to understand, and the
analyzer also gets confused. So rewrite it in an simpler way that's
easier to understand both the human reader as well as the analyzer.
(and so get rid of yet another false alarm)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 8c1b6212e1 (!1967) dix: region: turn xfreeData() into inline func and add checks
For type-safety turn xfreeData() macro into an inline function.
Also adding some checks against accidentially free()'ing global data.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult fe301f124a (!1967) dix: make DeviceEnterLeaveEvent() anaylzer-friendly
The analyzer giving a false alarm on potential NULL-pointer deref here.
Even though that case can't happen, it's also not immediately clear
to the human reader.

To make both the analyzer as well human reader happier, reformulating
this function to by using fast-return pattern.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 1014867436 (!1967) dix: protect ChangeWindowDeviceCursor() from allocation failure
On memory allocation failure, return BadAlloc instead of crashing.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult fdefa80256 (!1967) include: regionstr.h: protect RegionUninit() from free()ing on .data
There might be a chance that RegionUninit() is trying to free() some
struct that's actually coming from .data segment.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 83445aa080 (!1967) dix: dixfonts: explain analyzer false alarm on alleged free() of stack chunk
The analyzer is wrong here, because the free'd closure pointer really points
to some calloc()'d chunk, instead of the PolyText()'s stack frame.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 7dd92b77bc (!1967) dix: NULL-protection in GestureAddRegularListener()
protect against the (unlikely) case that inputMasks == NULL.

| ../dix/gestures.c: In function ‘GestureAddRegularListener’:
| ../include/list.h:376:21: warning: dereference of NULL ‘0’ [CWE-476] [-Wanalyzer-null-dereference]
|   376 |         for (_entry = _list; _entry; _entry = (_entry)->_member)
| ../dix/gestures.c:241:9: note: in expansion of macro ‘nt_list_for_each_entry’
|   241 |         nt_list_for_each_entry(iclients, inputMasks->inputClients, next) {
|       |         ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult be470cbf46 (!1967) dix: protect from pScreen->SetCursorPosition == NULL
It's safer not relying on all ScreenProc's actually filled.

../dix/events.c: In function ‘CheckPhysLimits’:
../dix/events.c:780:14: warning: dereference of NULL ‘pScreen’ [CWE-476] [-Wanalyzer-null-dereference]
  780 |             (*pScreen->SetCursorPosition)
      |             ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 6d22e94cb4 (!1967) dix: touch: NULL-protection in TouchAddRegularListener()
protect against the (unlikely) case that inputMasks == NULL.

| ../dix/touch.c: In function ‘TouchAddRegularListener’:
| ../include/list.h:376:21: warning: dereference of NULL ‘0’ [CWE-476] [-Wanalyzer-null-dereference]
|   376 |         for (_entry = _list; _entry; _entry = (_entry)->_member)
| ../dix/touch.c:766:9: note: in expansion of macro ‘nt_list_for_each_entry’
|   766 |         nt_list_for_each_entry(iclients, inputMasks->inputClients, next) {
|       |         ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 8ab10dd316 (!1967) dix: region: add comments on xfreeData()
Commenting a few aspects need to be considered when using this macro.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 830b37f863 (!1967) dix: protect against alloc failure in ‘DeviceFocusEvent()
Fixes analyzer warning:

| ../dix/enterleave.c: In function ‘DeviceFocusEvent’:
| ../dix/enterleave.c:788:20: warning: dereference of possibly-NULL ‘xi2event’ [CWE-690] [-Wanalyzer-possible-null-dereference]
|   788 |     xi2event->type = GenericEvent;
|   ‘DoFocusEvents’: events 1-4

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 709e8e04b5 (!1967) dix: move props into WindowRec and fix potential NULL deref
The pointer to the window properties is currently inside the WindowOptional
structure, which may or may not exist at any given time. Thus, before accessing
those fields, at least need to check whether it exists, potentially need to
create it first.

Since a pointer is small (in relation to WindowRec) and windows having properties
is a pretty common, we can make our life much simpler here by moving the pointer
directly into WindowRec, so we don't need extra WindowOptionalRec allocation.

This also fixes an analyzer warning on potential NULL dereference issue:

| ../dix/property.c: In function ‘dixChangeWindowProperty’:
|../dix/property.c:343:37: warning: dereference of NULL ‘*pWin.optional’ [CWE-476] [-Wanalyzer-null-dereference]
|  343 |         pProp->next = pWin->optional->userProps;
|      |                       ~~~~~~~~~~~~~~^~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult a74b264aa0 (!1967) dix: protect doPolyText() from potential NULL dereference
There's a (theoretical) chance that origGC might be NULL, so better
be cautious and check for this - doesn't cost us much, probably just
another JZ instruction.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult b6f7ede94b (!1969) xfree86: parser: fix possible use-after-free xf86freeOutputClassList()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 8520dcf013 (!1969) xfree86: dri: extra safety checks for NULL pointers / disabled extension
Be more cautious on possible NULL pointers or not yet registered
devPrivates. Better a gracefully fail instead of hard segfault.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 646b669ba1 (!1969) xfree86: ddc: safety check for NULL pointer
Even though it *should* never be actually hit, it's still safer
to check for NULL instead of letting us crash with segfault.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 70a6634b6a (!1969) xfree86: common: extra safety checks for NULL pointers
Even though it's unlikely ever getting it, still safer to have some
extra checks / asserts than unexpected segfault.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 9af37ca4db (!1969) xfree86: common: fix not-found check in xf86platformAddDevice()
Safer (and easier to understand) if we look at the result pointer
instead of the counter for testing whether device wasn't found.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult d542b2b21e (!1969) xfree86: common: gracefully handle allocation failure
Better try to handle memory allocation gracefully than just hard
crashing by segfault.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 5806d06a80 (!1969) xfree86: utils: gracefully handle allocation failure.
Better failing gracefully instead of hard crash via segfault.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 3a9cf89434 (!1969) xfree86: int10: extra NULL protection
Even though chances are really low it's ever getting hit, it's still safer
to have some sanity checks (which don't cost us much) than risking segfault.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult e4a0829a56 (!1969) xfree86: modes: fix uninitialized variables
| ../hw/xfree86/modes/xf86RandR12.c: In function ‘xf86ComputeCrtcPan’:
| ../hw/xfree86/modes/xf86RandR12.c:310:54: warning: use of uninitialized value ‘r[1]’ [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
|   310 |             q[i] = m->m[1][i] * r[0] - m->m[0][i] * r[1];
|       |                                                     ~^~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 80accc08cb (!1969) xfree86: loader: add assert() in LoadModule()
There's (remote) chance that the (internal) module name could become
NULL (eg. allocation failure). Even though chances to hit it are very
low, it's still better to have a check here (that doesn't cost us much),
just in case. Assert fail is still better than segfault, since we're
at least getting some hint what might have happened.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 873f4c36e9 (!1969) xfree86: parser: check for alloc failure and possible NULL pointers
Adding paranoid extra checks against allocation failure and NULL pointers.
Even though might not be actually hit in practise, it's still better to
be cautious, just in case. And reducing analyzer noise this way.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 0f7fb5e338 (!1969) xfree86: x86emu: add extra assert()'s
The analyzer warnings (possible NULL dereference) are probably just
false alarms. But for safety adding assert()'s, which don't cost us
anything in non-debug builds.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult f89cf0c03b (!1968) glx: fix warning on potentially uninitialized variable in xorgGlxMakeCurrent()
| ../glx/glxcmds.c: In function ‘xorgGlxMakeCurrent’:
| ../glx/glxcmds.c:621:24: warning: use of uninitialized value ‘status’ [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
|   621 |                 return status;
|       |                        ^~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 4c9312a8aa (!1968) glx: NULL-protect validGlxFBConfigForWindow()
If this ever happens, we clearly have a bug, so print out proper warning,
instead of silently crashing the Xserver.

| ../glx/glxcmds.c: In function ‘validGlxFBConfigForWindow’:
| ../glx/glxcmds.c:127:16: warning: dereference of NULL ‘pVisual’ [CWE-476] [-Wanalyzer-null-dereference]
|   127 |     if (pVisual->class != glxConvertToXVisualType(config->visualType) ||
|       |         ~~~~~~~^~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 2b54cada8e (!1968) glx: protect createModeFromConfig() from allocation failure
| ../glx/glxdricommon.c: In function ‘createModeFromConfig’:
| ../glx/glxdricommon.c:142:23: warning: dereference of possibly-NULL ‘config’ [CWE-690] [-Wanalyzer-possible-null-dereference]
|   142 |     config->driConfig = driConfig;

Consumers can already handle returning NULL, so this seems the best compromise.
It will look like we don't have any modes at all. Certainly not nice, but at
least better than completely crashing the Xserver.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 4a505a8a0e (!1968) glx: createcontext: silence analyzer warning and make code easier to understand
This warning is probably a false alarm, but it's trivial to fix.

| ../glx/createcontext.c: In function ‘__glXDisp_CreateContextAttribsARB’:
| ../glx/createcontext.c:172:24: warning: dereference of NULL ‘0’ [CWE-476] [-Wanalyzer-null-dereference]
|   172 |         switch (attribs[i * 2]) {
|       |                 ~~~~~~~^~~~~~~

The situation is too complex for the analyzer to handle:
(but also not immediately clear for the human reader)

* `attribs` is only NULL when req->numAttribs is 0
* in that case, the for loop is no-op, so `attribs` won't ever be deref'ed.

We can make it easier for both analyzer as well as human reader by just putting
the whole loop into an `if (req->numAttribs)` and assigning it inside there.
There shouldn't be any (practically measurable) extra cost.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 66b9c32fd5 (!1970) Xext: panoramix: extra safety checks
Even though risk of being actually hit is minimal, better having some extra
safety checks instead of segfaulting, just in case.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult f39873ed90 (!1970) Xext: panoramix: protect from allocation failures
Handle memory allocations gracefully, instead of just segfaulting.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult f956ea43c8 (!1970) Xext: panoramix: fix uninitialized variable
| ../Xext/panoramiXprocs.c: In function ‘PanoramiXCopyArea’:
| ../Xext/panoramiXprocs.c:1152:13: warning: use of uninitialized value ‘pGC’ [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
|  1152 |         if (pGC && pGC->graphicsExposures) {
|       |             ^~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 0df0f70436 (!1970) Xext: xtest: extra NULL checks
Even though these probably never happen, it's still better having some
(really cheap) extra checks, just in case.

| ../Xext/xtest.c: In function ‘ProcXTestFakeInput’:
| ../Xext/xtest.c:385:17: warning: dereference of NULL ‘dev’ [CWE-476] [-Wanalyzer-null-dereference]
|   385 |         if (!dev->key)
|       |              ~~~^~~~~

| ../Xext/xtest.c:442:12: warning: dereference of NULL ‘dev’ [CWE-476] [-Wanalyzer-null-dereference]
|   442 |     if (dev->sendEventsProc)
|       |         ~~~^~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 34ff1371e7 (!1970) Xext: shape: fix warning on possible NULL dereference
Try not to rely on deep black magic of calloc(), instead skip the whole
part of nrects is zero.

| ../Xext/shape.c: In function ‘ProcShapeGetRectangles’:
| ../Xext/shape.c:995:24: warning: dereference of possibly-NULL ‘rects’ [CWE-690] [-Wanalyzer-possible-null-dereference]
|   995 |             rects[i].x = box->x1;
|       |             ~~~~~~~~~~~^~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult a7214d3462 (!1970) Xext: shm: protect against possible NULL dereference
| ../Xext/shm.c: In function ‘ShmExtensionInit’:
| ../Xext/shm.c:1534:29: warning: dereference of possibly-NULL ‘screen_priv’ [CWE-690] [-Wanalyzer-possible-null-dereference]
|  1534 |             if (!screen_priv->shmFuncs)
|       |                  ~~~~~~~~~~~^~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult ae0f6f02bd (!1970) Xext: vidmode: protect against alloc failures and NULL pointers
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult c9d14817cd (!1970) Xext: selinux: fix possible NULL dereference
> ../Xext/xselinux_ext.c: In function ‘SELinuxSendItemsToClient’:
> ../Xext/xselinux_ext.c:358:18: warning: dereference of possibly-NULL ‘buf’ [CWE-690] [-Wanalyzer-possible-null-dereference]
>   358 |         buf[pos] = items[k].id;
>       |         ~~~~~~~~~^~~~~~~~~~~~~

> ../Xext/xselinux_ext.c: In function ‘SELinuxFreeItems’:
> ../Xext/xselinux_ext.c:335:9: warning: dereference of possibly-NULL ‘items’ [CWE-690] [-Wanalyzer-possible-null-dereference]
>   335 |         freecon(items[k].octx);
>       |         ^~~~~~~~~~~~~~~~~~~~~~

> ../Xext/xselinux_ext.c: In function ‘SELinuxPopulateItem’:
> ../Xext/xselinux_ext.c:321:11: warning: dereference of possibly-NULL ‘i’ [CWE-690] [-Wanalyzer-possible-null-dereference]
>   321 |     i->id = id;
>       |     ~~~~~~^~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 1fff8fc432 (!1970) Xext: sync: protect from NULL pointer dereference
> ../Xext/sync.c: In function ‘IdleTimeQueryValue’:
> ../Xext/sync.c:2654:18: warning: dereference of NULL ‘priv’ [CWE-476] [-Wanalyzer-null-dereference]
>  2654 |         deviceid = priv->deviceid;
>       |         ~~~~~~~~~^~~~~~~~~~~~~~~~

> ../Xext/sync.c: In function ‘IdleTimeBlockHandler’:
> ../Xext/sync.c:2666:14: warning: dereference of NULL ‘priv’ [CWE-476] [-Wanalyzer-null-dereference]
>  2666 |     int64_t *less = priv->value_less;
>       |              ^~~~

> ../Xext/sync.c:2773:9: warning: dereference of NULL ‘priv’ [CWE-476] [-Wanalyzer-null-dereference]
>  2773 |     if (LastEventTimeWasReset(priv->deviceid)) {
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> ../Xext/sync.c: In function ‘IdleTimeBracketValues’:
> ../Xext/sync.c:2791:14: warning: dereference of NULL ‘priv’ [CWE-476] [-Wanalyzer-null-dereference]
>  2791 |     int64_t *less = priv->value_less;
>       |              ^~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult ea2749496b (!1970) Xext: sync: protect init_system_idle_counter() from allocation failure
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 4bb65785c2 (!1970) Xext: xres: protect against free()ing from non-heap
> ../Xext/xres.c: In function ‘DestroyFragments’:
> ../Xext/xres.c:124:9: warning: ‘free’ of ‘it’ which points to memory on the stack [CWE-590] [-Wanalyzer-free-of-non-heap]
>   124 |         free(it);
>      |         ^~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult e9e11a595e (!1972) randr: add BUG_* checks for possible NULL pointer issue
The ‘RRCrtcNotify() and RRCrtcSet() functions are exported, so there's chance
that a buggy driver could call them with NULL parameter, leading to segfault.
Those are hard to trace, so it's better having a BUG_* check here.

| ../randr/rrcrtc.c: In function ‘RRCrtcNotify’:
| ../randr/rrcrtc.c:187:5: warning: use of NULL ‘outputs’ where non-null expected [CWE-476] [-Wanalyzer-null-argument]
|   187 |     memcpy(crtc->outputs, outputs, numOutputs * sizeof(RROutputPtr));
|       |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

| ../randr/rrcrtc.c: In function ‘RRCrtcSet’:
| ../randr/rrcrtc.c:742:20: warning: dereference of NULL ‘outputs’ [CWE-476] [-Wanalyzer-null-dereference]
|   742 |         if (outputs[o]) {
|       |             ~~~~~~~^~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 8044988fc7 (!1972) randr: skip payload assembly in ProcRRGetScreenInfo() no data to send
If there's no data to send, the whole reply payload can be skipped entirely.
This can also ease the whole code flow, and we don't need to rely on the
individual copy loops never trying to dereference a NULL pointer.
(what the analyzer can't proof). Also scoping several some variables that
are only used when there actually is data to send.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 2ac3cacf91 (!1972) randr: skip payload assembly in rrGetScreenResources() no data to send
If there's no data to send, the whole reply payload can be skipped entirely.
This can also ease the whole code flow, and we don't need to rely on the
individual copy loops never trying to dereference a NULL pointer.
(what the analyzer can't proof). Also scoping several some variables that
are only used when there actually is data to send.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 727da90141 (!1972) randr: simplify reply assembly in ProcRRListProviderProperties()
Moving payload buffer assembly right into the same branch where the buffer is
allocated, so making the whole code flow easier to understand. Also moving the
byteswap there (when the fields should still be in CPU cache), instead of having
some callback doing it much later, so even more simplication.

As a nice by-product, that's also reducing some analyzer noise.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 2b5ad4a9ba (!1972) randr: no need to for local temp buffer in ProcRRQueryProviderProperty()
The code can be much simpler by just using CopySwap32Write().
And we also don't need the callback in WriteSwappedDataToClient(),
just call the corresponding write function directly.

This also makes some analyzer warnings go away.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult b57d486d95 (!1972) randr: ProcRRGetOutputInfo() skip payload assembly when nothing to do
If there's no extra payload to send, we can skip the whole payload
assembly chain.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 4ef82bc89e (!1972) randr: simplify extra payload copying in ProcRRGetOutputInfo()
Make it a bit easier to understand how exactly the name string is copied into
the reply payload: just do the little memcpy() right where the target position
is decided any the rest of the payload is filled.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 6e3f70b5ce (!1972) randr: RROutputSetCrtcs(): simplify buffer allocation / copying
Instead of relying on memcpy() coping with NULL buffer when size == 0,
move the call to the branch where we actually have things to copy.

This also silences yet another analyzer warning.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult f608231431 (!1972) randr: RROutputSetModes(): simplify buffer allocation / copying
Instead of relying on memcpy() coping with NULL buffer when size == 0,
move the call to the branch where we actually have things to copy.

This also silences yet another analyzer warning.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 824fe9609f (!1972) randr: RROutputSetClones(): simplify buffer allocation / copying
Instead of relying on memcpy() coping with NULL buffer when size == 0,
move the call to the branch where we actually have things to copy.

This also silences yet another analyzer warning.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult a2c4ed2744 (!1972) randr: refine allocation and copying of optional buffers
Simplifying the code flow allocating/checking/copying some buffers in
RRConfigureOutputProperty() and RRConfigureProviderProperty() so it's
easier to understand for both the human reader as well as the analyzer.

Depending on whether we have elements to process, a temporary buffer needs
to be allocated, checked for successful allocation and copy over data. The
way it's currently done is technically correct, but unnecessarily complex to
understand: instead of just branching on whether there are elements and doing
all the buffer-related things only then, the branching is done just somewhere
in the middle, only on checking for allocation failure, and relying on both
calloc() and memcpy() not doing weird things when size is zero.

It's easy to simplify by putting it all behind one if statement and so make
things easier for both human reader as well as the analyzer (so it's not
spilling out false alarms here anymore) and also drops unnecessary calls
in the zero-size case.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 073f52f1e9 (!1973) os: don't ever try to mess with stderr / fd 2
1. We've got some ancient code here that's trying to open stderr (fd 2) itself,
   in case it cannot write there for strange reason. POSIX defines the three
   standard streams (and associated fd's) to be available on program startup
   (when main() is reached). One needs a sledgehammer for breaking a system
   so much that this doesn't work anymore - even calling a program directly
   from /etc/inittab does provide them.

2. The current implementation is not POSIX conformant - it should use freopen(),
   and it leaks FILE structure.

3. stderr is set to buffered mode, quite the opposite of POSIX - it states
   stderr shall NOT be buffered. Simple and obvious reason: not risking vital
   error information getting lost.

4. Placing The logfile in /usr/adm - an ancient, pre-FHS, directory that rarely
   exists on modern systems. That's even hardcoded, instead of derived from
   build-time given installation pathes.

Conculusio: obsolete and broken, thus removing it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 75d9472812 (!1974) os: drop self-limiting resources
It's only rarely used and can be easily achieved by generic means,
eg. via ulimit or supervisor settings.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 6e72ba51b6 (!1975) glamor: fix segfault on calloc() failure
calloc() can always fail, so we need to prepared for this,
instead of just blindly segfault'ing.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 12b4ea88d7 (!1975) glamor: BUG_* checks on NULL atlas
If this happens, we really have a bug, so better spit out a warning
instead of just segfault'ing.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult a3eae0f568 (!1975) glamor: BUG_RETURN*() on pixmap private data
Usually shouldn't happen trying to accessing pixmap's glamor private
data w/o having it initialized first. But just in case there's some
subtle bug, adding extra checks, which don't cost us much.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 9060792354 (!1975) glamor: protect from NULL return of GetPictureScreenIfSet()
GetPictureScreenIfSet() is designed that NULL can be returned.
Even though it should not happen in this particular case,
better be prepared for that, instead of just segfault'ing.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 4ce8b57431 (!1975) glamor: NULL-protect GLAMOR_PIXMAP_PRIV_HAS_FBO()
It could potentially be called with NULL pointer, but can't handle it,
so when that happens, it's a bug. Adding a BUG_RETURN_VAL() call here,
so it's giving us a hint where to look at.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 2ef1ab766a (!1976) xkb: fix uninitialized variables in XkmReadFile()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult c618915f78 (!1976) xkb: maprules: fix potential NULL pointer dereference warnings
Even though the cases might be hypothetical, it's still better having some
tiny extra checks (that might be even optimized-out) and reduce the analyzer
noise a bit.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 4f7467dae5 (!1976) xkb: fix NULL pointer dereference in XkbDDXLoadKeymapByNames()
In the rare case that NULL kbd is passed and also no components provided,
the corresponding error message code crashes on NULL pointer dereference.

| ../xkb/ddxLoad.c: In function ‘XkbDDXLoadKeymapByNames’:
| ../xkb/ddxLoad.c:393:25: warning: dereference of NULL ‘keybd’ [CWE-476] [-Wanalyzer-null-dereference]
|   393 |                    keybd->name ? keybd->name : "(unnamed keyboard)");
|       |                    ~~~~~^~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 4d1ceae2c7 (!1980) 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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 4ec17968f4 (!1980) 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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult a94baada20 (!1980) mi: NULL-protection in ‘miInitVisuals()
NULL-Protect just against 'vid' might remain NULL.

| ../mi/micmap.c: In function ‘miInitVisuals’:
| ../mi/micmap.c:505:32: warning: dereference of NULL ‘vid’ [CWE-476] [-Wanalyzer-null-dereference]
|  505 |             visual->vid = *vid = FakeClientID(0);
|      |                           ~~~~~^~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult f461ccdfaf (!1981) Xi: exevents: extra asserts on NULL pointers
Even though shouldn't be practically hit, better have some asserts,
giving us an idea of the point of cause, instead of segfaulting,
just in case.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 77e55693e7 (!1981) Xi: xibarriers: protect add_master_func() from allocation failure
Try to gracefully handle OOM situation, at not hard crashing.

| ../Xi/xibarriers.c: In function ‘add_master_func’:
| ../Xi/xibarriers.c:729:19: warning: dereference of NULL ‘pbd’ [CWE-476] [-Wanalyzer-null-dereference]
|  729 |     pbd->deviceid = *deviceid;
|       |     ~~~~~~~~~~~~~~^~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult a66426d7ea (!1981) Xi: exevents: NULL protection in ‘DeviceEventSuppressForWindow()
Protect against `inputMasks` could be NULL.

| ../Xi/exevents.c: In function ‘DeviceEventSuppressForWindow’:
| ../Xi/exevents.c:3246:32: warning: dereference of NULL ‘inputMasks’ [CWE-476] [-Wanalyzer-null-dereference]
|  3246 |         FreeResource(inputMasks->inputClients->resource, X11_RESTYPE_NONE);
|       |                      ~~~~~~~~~~^~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult faed002022 (!1981) Xi: fix double-free warning in FreePointerBarrierClient()
| ../Xi/xibarriers.c: In function ‘FreePointerBarrierClient’:
| ../Xi/xibarriers.c:127:9: warning: double-‘free’ of ‘pbd’ [CWE-415] [-Wanalyzer-double-free]
|   127 |         free(pbd);
|       |         ^~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 2efc33cf34 (!1982) include: don't install propertyst.h
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 687d73e44e (!1982) xfree86: xf86Priv.h: dont include propertyst.h
Nothing in here needs anything from that include file, so no need for
including it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult b68b119aaa (!1982) xfree86: xf86.h: dont include propertyst.h
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult e00b6cb3c9 (!1982) xfree86: xf86Events.c: add missing include of property.h
the file calls some functions from property.h, so it needs to be included.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult f73e08afb5 (!1983) Xext: security: drop not needed include
Not needed in that header file, so drop it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 4617324be0 (!1985) randr: unexport and document RRTransformCopy()
Not used by any external drivers, so no neeed to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 2ba9cd7b6f (!1985) randr: unexport and document RRTransformSetFilter()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 228f885cdb (!1985) randr: unexport and document RRTransformEqual()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 6ce266f647 (!1985) randr: unexport and document RRTransformInit()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult c1d9f22c4a (!1985) randr: unexport and document RRXineramaExtensionInit()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 19b2e62b46 (!1985) randr: unexport and document RRQueryOutputProperty()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 5dbb5a4128 (!1985) randr: unexport and document RRGetOutputProperty()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult dec43ae3ba (!1985) randr: unexport resource type IDs
Not used by any external drivers, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 82063dd005 (!1985) randr: unexport and document RRConfigureProviderProperty()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult f7f815c721 (!1985) randr: unexport and document RRChangeProviderProperty()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 4dcfb44898 (!1985) randr: unexport and document RRDeleteProviderProperty()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 4b4f68a2ff (!1985) randr: unexport and document RRQueryProviderProperty()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult af92da8704 (!1985) randr: unexport and document RRGetProviderProperty()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 2b892280fe (!1985) randr: unexport and document RRProviderAutoConfigGpuScreen()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 46a306b3d6 (!1985) randr: unexport and document RRDeliverProviderEvent()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult c81124ef1f (!1985) randr: unexport and document RRProviderDestroy()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult a232e938ee (!1985) randr: unexport and document RRProviderSetCapabilities()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 9e544fe72d (!1985) randr: unexport and document RRProviderCreate()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 0d640c10f1 (!1985) randr: unexport and document RRProviderInitErrorValue()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 89e3479095 (!1985) randr: unexport and document RRProviderInit()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult f58b133261 (!1985) randr: unexport and document RRDeleteAllOutputProperties()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 4e0a419b1d (!1985) randr: unexport and document RRPointerScreenConfigured()
Not usde by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult a1b3e8963e (!1985) randr: unexport and document RROutputInitErrorValue()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult 448d211831 (!1985) randr: unexport and document RROutputInit()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult eacae306f6 (!1985) randr: unexport and document RRDeliverOutputEvent()
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-03 11:37:31 +02:00
Enrico Weigelt, metux IT consult c79d3a3443 (!1985) randr: unexport and document RROutputSetSubpixelOrder()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 9be2c7e9ac (!1985) randr: unexport and document RROutputDeleteUserMode()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult f9b87e3099 (!1985) randr: unexport and document RROutputAddUserMode()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 587c110f6a (!1985) randr: unexport and document RRModeInitErrorValue()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 0b0d10b669 (!1985) randr: unexport and document RRModeInit()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult ee1225a724 (!1985) randr: unexport and document RRModesForScreen()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult ae02bddbdc (!1985) randr: unexport and document RROutputIsLeased()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 182952435b (!1985) randr: unexport and document RRCrtcIsLeased()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 99326140d7 (!1985) randr: unexport and document RRLeaseFree()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult f863ef92c2 (!1985) randr: unexport and document RRLeaseTerminated()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 4190e55858 (!1985) randr: unexport and document RRClientKnowsRates()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 23483872ac (!1985) randr: unexport and document RRHasScanoutPixmap()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 4d2207b3a5 (!1985) randr: unexport and document RRReplaceScanoutPixmap()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 794c3b320c (!1985) randr: unexport and document RRCrtcDetachScanoutPixmap()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 5fa57c17f4 (!1985) randr: unexport and document RRCrtcInitErrorValue()
Not supposed to be called by drivers, just internal to the randr extsnsion,
so shouldn't have been exported in the first place.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 866cd5a356 (!1985) randr: unexport and document RRCrtcInit()
Not supposed to be called by any driver, just internal to the extension,
so shouldn't have been exported in the first place.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 9db6fbba3e (!1985) randr: unexport and document RRCrtcDestroy()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 2e12c4fe6b (!1985) randr: unexport and document RRCrtcGetTransform()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 15abedb2a3 (!1985) randr: unexport and document RRCrtcGetScanoutSize()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 22c56e62a9 (!1985) randr: unexport and document RRDeliverCrtcEvent()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 566655523e (!1985) randr: unexport and document RRCrtcSetTransformSupport()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 5ae84c4d06 (!1985) randr: unexport and document RRCrtcExists()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 61dabc4a09 (!1985) randr: unexport and document RRVerticalRefresh()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult c21ac20dc1 (!1985) randr: unexport and document RROutputSetNonDesktop()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 5eb69db927 (!1985) randr: unexport and document RRFirstEnabledCrtc()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 2eafa1aafd (!1985) randr: unexport and document RRInit()
Not called, and should not be called, by drivers, so no need to
keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult b6f71c8fef (!1985) randr: unexport and document RRResourcesChanged()
Not used by external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult ef3fc1836e (!1985) randr: unexport and document RRDeliverScreenEvent()
Not used by external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 4b77fc54ee (!1985) randr: move remaining dispatch prototypes to rrdispatch.h
Since we now have a separate header for them, move them all over to there.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 10af15ae7b (!1985) randr: unexport provider related request handlers
Those aren't used by any drivers and never should so, thus no need to
keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 2d3dd30a2e (!1985) randr: unexport output related request handlers
Those aren't used by any drivers and never should so, thus no need to
keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 781e25ce2f (!1985) randr: unexport mode related request handlers
Those aren't used by any drivers and never should so, thus no need to
keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 8f07e534dd (!1985) randr: unexport crtc related request handlers
Those aren't used by any drivers and never should so, thus no need to
keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 47871c6377 (!1985) randr: unexport screen related request handlers
Those aren't used by any drivers and never should so, thus no need to
keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 93c615b1b4 (!1985) randr: make RRCrtcTransformSet() static
Only used locally inside rrcrtc.c, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult adda091997 (!1985) randr: make RRCrtcPendingTransform() static
only used locally inside rrcrtc.c, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 8e7a7fa6b6 (!1985) randr: make RRCrtcGammaGet() static
Only used locally inside rrcrtc.c, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 2474723822 (!1985) randr: make RRCrtcChanged() static
Only used locally inside rrcrtc.c, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult f2a32b6455 (!1985) randr: drop obsolete RRTransformFini()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult c28c95810f (!1985) randr: drop obsolete RRPostProviderPendingProperties()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 7b341ffc99 (!1985) randr: drop obsolete RRDeleteAllProviderProperties()
Not used by anybody, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult de8ab1ffe6 (!1985) randr: drop obsolete RRProviderLookup()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult cbdbd14bd6 (!1985) randr: drop unused RRPointerMoved()
Not used anywhere, so no need to keep it any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult d7f4e9530a (!1985) randr: drop unused dummy RRCrtcGammaNotify()
Not called by anybody and been just a dummy for quite a while,
so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 87c657aad5 (!1985) randr: drop obsolete RRGetRotation()
Not used anymore, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult ccd7366687 (!1986) XI: unexport XIPropToInt() and XIPropToFloat()
Not used by any drivers, and subject to upcoming changes, so no need
to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 85267d38ac (!1987) glamor: unexport GLAMOR_CREATE_PIXMAP_* defines
Not used by any external drivers, so no need to keep it in public API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult b808db1d17 (!1987) glamor: unexport glamor_copy_window()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 1bfe6d6255 (!1987) glamor: unexport glamor_change_window_attributes()
Not needed by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult f8c06740d3 (!1987) glamor: unexport glamor_egl_screen_init()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult cbe0210f8e (!1987) glamor: unexport glamor_get_drawable_modifiers()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult db249f4e0b (!1987) glamor: unexport glamor_get_modifiers()
Not used by any external driveres, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult efb8f86ff3 (!1987) glamor: unexport glamor_get_formats()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 43d1b5f0b6 (!1987) glamor: unexport glamor_pixmap_from_fds()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 5880c65923 (!1987) glamor: unexport glamor_fds_from_pixmap()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 4d27eea143 (!1987) glamor: unexport glamor_egl_fd_from_pixmap()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult be9e596556 (!1987) glamor: unexport glamor_egl_fd_name_from_pixmap()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 01af39e34d (!1987) glamor: unexport glamor_egl_fds_from_pixmap()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult cf98ce47b6 (!1987) glamor: unexport glamor_enable_dri3()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 7bcb7c45b2 (!1987) glamor: unexport glamor_pixmap_exchange_fbos()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 820719193e (!1987) glamor: unexport glamor_set_glvnd_vendor()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 52e8f4ec68 (!1987) glamor: unexport glamor_set_pixmap_type()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult baa5f44dc8 (!1987) glamor: unexport glamor_set_pixmap_texture()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 74cff15411 (!1987) glamor: make glamor_destroy_gc() static
Only needed inside glamor_core.c, no external callers, so it can be static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 74a47b4de3 (!1987) glamor: drop glamor_egl_create_textured_screen()
Not used anymore, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 51dc49ebf4 (!1987) glamor: drop glamor_egl_create_textured_screen_ext() macro
Not used anymore, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 26cb3ff60d (!1987) glamor: drop glamor_get_glvnd_vendor()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 8ae0a2d2ab (!1987) ephyr: workaround for name clash between Xlib and Xserver
A slight change in include order can cause Xlib to be included and defining
"GC" type, which is conflicting with Xserver's own type by same name.

As long as MR !1393 hasn't merged yet, we need to do an ugly workaround
using some preprocessor black magic.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 4543a5d5e2 (!1988) xfree86: drop xf86VGAarbiter.h
It doesn't serve any practical purpose anymore and also isn't included
by any external driver, thus also no need to keep it in SDK.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 27da186e56 (!1988) xfree86: unexport xf86VGAarbiterAllowDRI()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 7ae4797cfb (!1988) xfree86: drop obsolete xf86VGAarbiterDeviceDecodes()
Not used by anybody, so no need to keep it anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 96d9bdc394 (!1979) xwayland: protect against alloc failures and NULL pointers
Protecting against NULL pointers and allocation failures.
Printing out a bug warning in those cases.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 3f175efe19 (!1989) panoramix: replace FOR_NSCREENS() by FOR_NSCREENS_BACKWARD(i)
FOR_NSCREENS() is just alias for FOR_NSCREENS_BACKWARD(). In many cases
it really matters that we're going backwards and the last iteration visited
the screen #0, and that one is panoramix-wrapped.

Thus directly calling FOR_NSCREENS_BACKWARD() here and dropping the alias.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult ad8e4dcbe3 (!1990) xfree86: unexport xf86RemoveInputEventDrainCallback()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 24230163e0 (!1990) xfree86: unexport xf86AddInputEventDrainCallback()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 050d3ae66f (!1990) xfree86: unexport xf86LookupInput()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 7c14701626 (!1990) xfree86: unexport xf86LookupInputDriver()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 33b2edf140 (!1990) xfree86: unexport xf86InputEnableVTProbe()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult e72b365cb6 (!1990) xfree86: unexport xf86PostButtonEventM()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult ba9b9a7263 (!1990) xfree86: make xf86VIDrvMsgVerb() static
Only used inside xf86Helper.c, so can be made static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult f589e42aa1 (!1990) xfree86: make xf86PostKeyEvent() static
Only used inside xf86Xinput.c, so can be made static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 409cf467df (!1990) xfree86: drop obsolete xf86PostKeyEventM()
It's now only a wrapper calling xf86PostKeyEvent(), and no external driver
using it anymore, so we can drop it entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 78924a55cf (!1990) xfree86: drop unused xf86DeleteInputDriver()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 69789f4937 (!1990) xfree86: drop unused xf86EnableDevice()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult d9d72267fa (!1990) xfree86: drop unused xf86PostKeyEventP()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 949df66f5e (!1990) xfree86: drop unused xf86PostProximityEventP()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 257a27c8da (!1990) xfree86: drop unused xf86PostMotionEventP()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 63c8a689c3 (!1991) xfree86: xf86Option: unexport xf86MarkOptionUsedByName()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 4fb733f3cb (!1991) xfree86: xf86Option: unexport xf86MarkOptionUsed()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 085a25ec43 (!1991) xfree86: xf86Option: unexport xf86OptionListReport()
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-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult d4a7b3ff0a (!1991) xfree86: xf86Option: make xf86CheckIfOptionUsedByName() static
Only used inside of xf86Option.c, so can be made static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 0f2f4e1788 (!1991) xfree86: xf86Option: drop unused xf86CheckIfOptionUsed()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 20eb29406c (!1991) xfree86: xf86Option: drop unused xf86ReplacePercentOption()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 01d3d0a05d (!1991) xfree86: xf86Option: drop unused xf86ReplaceRealOption()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 4030ad8374 (!1991) xfree86: xf86Option: drop unused xf86GetOptValReal()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 66edee2b99 (!1991) xfree86: xf86Option: drop unused xf86NewOption()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult c8dcff34e4 (!1991) xfree86: xf86Option: drop unused xf86CheckRealOption()
Not used anywhere, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:30 +02:00
Enrico Weigelt, metux IT consult 4a5d46ae59 (!1992) xfree86: i2c: drop unused xf86I2CWriteWord()
Not used anywhere, so no need to keep around it any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult db5ebdb62e (!1992) xfree86: i2c: drop unused xf86I2CWriteBytes()
Not used anywhere, so no need to keep around it any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 13cc04204e (!1992) xfree86: i2c: drop unused xf86I2CReadWord()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 6623b87458 (!1992) xfree86: i2c: drop unused xf86I2CReadStatus()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 176acac354 (!1993) xfree86: vbe: drop dead code
This never seemed to be actually enabled, just ifdef'ed out, so no
need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult d150ee378f (!1993) xfree86: vbe: drop unused VBEGetVBEpmi()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 5f8286f1cb (!1993) xfree86: vbe: drop unused VBEGetDisplayStart()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult fb4ad60b30 (!1994) xfree86: ddc: make DMTModes[] static
Only used inside xf86EdidModes.c, so can be made static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 7a619cbabb (!1994) xfree86: ddc: make FindDMTMode() static
Only used inside xf86EdidModes.c, so can be made static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 87ce3fe1dd (!1994) xfree86: ddc: unexport gtf_supported()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult d2ebc1fcd9 (!1994) xfree86: ddc: drop unused xf86MonitorIsHDMI()
Not used anywhere, so no need to keep it anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 48baad1ee7 (!1994) xfree86: ddc: unexport xf86EdidMonitorSet()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult eb32f90157 (!1995) xfree86: xisb: drop unused XisbTrace()
Not used anywhere, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult c77dcceeac (!1995) xfree86: xisb: drop unused XisbWrite()
Not used anywhere, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 5524def6d3 (!1996) xfree86: xv: unexport XF86XvScreenKey
Not used by any drivers, and the include is private anyways.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 357064d87d (!1996) xfree86: xv: don't install xf86xvpriv.h
Not included by any drivers, and it's supposed to be private anyways.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult f6d2950844 (!1996) xfree86: xv: drop unused xf86XVFillKeyHelperPort()
Not used anywhere, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult c589e10b3c (!1997) xfree86: fbman: move FBManagerFuncs into x86fbman.c
Only used here, so no need to keep it in public API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult aa656c5000 (!1997) xfree86: fbman: make xf86InitFBManagerRegion() static
Only called locally within xf86fbman.c, so can be made static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 00addfdcc4 (!1997) xfree86: fbman: make xf86RegisterOffscreenManager()
Only called locally within xf86fbman.c, so can be made static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult e11135776e (!1997) xfree86: fbman: drop FreeBoxesUpdateCallback
Nobody fills it anymore, so not needed at all anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 3676dc9bc5 (!1997) xfree86: fbman: drop RegisterFreeBoxCallback proc pointer
Nobody calls it anymore, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 845c09a567 (!1997) xfree86: fbman: drop unused xf86RegisterFreeBoxCallback()
Not used anywhere, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 563f28f914 (!1997) xfree86: fbman: drop unused xf86AllocateLinearOffscreenArea()
Not used anywhere, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult d193ebb804 (!1997) xfree86: fbman: drop unused xf86FBManagerRunning()
Not used anywhere, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult f28044edf0 (!1997) xfree86: fbman: drop unused xf86InitFBManagerArea()
Not used anywhere, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 53f74df9a1 (!1988) xfree86: loader: drop unused MODULETEARDOWNPROTO() macro
Not used anywhere, so no need to keep it in public API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 1cac2bc730 (!1998) xfree86: loader: drop unused GET_MODULE_*_VERSION macros
Not used anywhere, so no need to keep them around in public API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 2349e65b95 (!1999) include: os: add returns_nonnull attribute to XNFalloc/XNFcallocarray
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult b2d5800ac9 (!2000) xfree86: drop ifdefs on _NO_XF86_PROTOTYPES
Nothing ever sets this symbol, so can be dropped.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult c26ce7f661 (!2001) Xi: exevents: drop unused retvals on TryClientEvents() calls
The return values aren't used anywhere, so the assignment is not necessary.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 20df0ce063 (!2002) dix: drop unused SetVendorRelease()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 3c40cdd159 (!2003) dix: unexport InitAtoms() and FreeAllAtoms()
Not used by any drivers, very DIX-internal, so should not be part
of public API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 1e0e81fc28 (!2003) dix: replace AtomError() by better messages
Not used by any exteral drivers (and really should not be used by them),
so can be replaced by more fitting error messages.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult eeb619271a (!2004) dix: unexport SetInputCheck() and make it inline
Not used by any drivers, so no need to keep it exported.
It's also so simple (and rarely called) that easily can be inlined.

Also unexport HWEventQueueType and HWEventQueuePtr, since they're
not used by any drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 0797de679d (!2007) dix: unexport LastEventTimeToggleResetAll()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 8df7a46548 (!2007) dix: unexport LastEventTimeToggleResetFlag()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 4d263f8b34 (!2007) dix: unexport LastEventTimeWasReset()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult fb68d06d87 (!2007) dix: unexport LastEventTime()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 04fce17213 (!2007) dix: unexport NoticeEventTime()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult dae93e5ec9 (!2007) dix: unexport NoticeTime()
Not used by any external drivers, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult f21650545a (!2007) dix: unexport InitBlockAndWakeupHandlers()
Not supposed to be called by drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 2a4b4930aa (!2007) dix: unexport WakeupHandler()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 33a5e41819 (!2007) dix: unexport BlockHandler()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 92e70b1909 (!2007) dix: rename IsFloating() to InputDevIsFloating()
Give it a better fitting name.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 3bd547df4c (!2007) dix: unexport and document IsFloating()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 1bb3a74608 (!2007) dix: rename IsMaster to InputDevIsMaster()
Give it a better fitting name.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 39e8ebe710 (!2007) dix: unexport IsMaster()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult b2670ee7a7 (!2007) dix: unexport IsKeyboardDevice()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 9d11af1f8b (!2007) dix: unexport IsPointerDevice()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 4ff7046fa4 (!2007) dix: rename IsParent() to WindowIsParent()
Spending it a more fitting name.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult dc57d512cf (!2007) dix: unexport IsParent()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult d820eb6599 (!2007) dix: unexport PickKeyboard()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 90ad705c2c (!2007) dix: unexport PickPointer()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 7cda1acb69 (!2007) dix: unexport OtherClientGone()
Just an internal resource destructor, 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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 2519cb6f96 (!2007) dix: unexport and document ScreenRestructured()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 38c186fdba (!2007) dix: unexport and document WindowsRestructured()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 0506d1155b (!2007) dix: unexport and document WindowHasNewCursor()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult c95bf971bb (!2007) dix: unexport RootWindowFinalizeCallback field
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult f6d3f6a82a (!2007) dix: unexport DeviceEventCallback field
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 63f59be11f (!2007) dix: unexport DeliverRawEvent()
Not used by any external drivers, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 74c7015586 (!2007) dix: unexport DeliverEventsToWindow()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 3d410ff186 (!2007) dix: unexport DeliverEvents() and fix return type
* not needed by any drivers, so no need to keep it exported
* correct return type is `enum EventDeliveryState`

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 9b9f64e264 (!2007) dix: unexport TryClientEvents()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 319b096d9c (!2007) dix: unexport, document and rename GetSpriteWindow()
Not used by any drivers, so no need to keep it exported.
Also spending it for a better fitter name.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult bed72a9cfe (!2007) dix: unexport, document and rename GetCurrentRootWindow()
Not used by any drivers, so no need to keep it exported.
Also spending it for a better fitter name.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult d9ddaa85b6 (!2007) dix: unexport and document AlterSaveSetForClient()
Not used by any external drivers, so no need to keep it exported.
Also using XRetCode and marking paremters where NULL isn't allowed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 081a1184b7 (!2007) dix: drop unused parameter from ConfineToShape()
The device parameter is never used, so no point in passing it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 6040c10693 (!2007) dix: unexport and document ConfineToShape()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 67d1beef2d (!2007) dix: unexport SendGraphicsExpose() and fix parameter types
* not used by any drivers, so no need to keep it exported
* fix parameter types to matching the protocol types

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult fa56b55ad7 (!2007) dix: unexport SendErrorToClient() and fix parameter types
* not used by any drivers, so no need to keep it exported
* fix parameter types to matching the protocol types

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 2665deee5c (!2007) dix: unexport and document ClientIsAsleep()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult ab323fc9ff (!2007) dix: unexport and document ClientWakeup()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 89f7021ed8 (!2007) dix: unexport and document ClientSignalAll()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 267d4349ab (!2007) dix: unexport and document ClientSignal()
Not used by any external drivers, so no need to keep it exported.

Also renamed to dixClientSignal(), since there's a conflicting prototype
in fontsproto.h.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult dd8313eab8 (!2007) dix: unexport and document ClientSleep()
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-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult 8101eec819 (!2007) dix: unexport and document MarkClientException()
Not supposed to be used by external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:29 +02:00
Enrico Weigelt, metux IT consult f5fe831a60 (!2007) dix: unexport and document NextAvailableClient()
Only called from OS layer, thus should not be exported at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:28 +02:00
Enrico Weigelt, metux IT consult a962fbb29e (!2007) include: drop obsolete dixevents.h
The include has become empty now. Not used by any external drivers,
so it can be dropped now.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:28 +02:00
Enrico Weigelt, metux IT consult b12c005c4b (!2007) dix: unexport and document EventSuppressForWindow()
Not used by any external drivers, and not supposed to be used by them,
so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:28 +02:00
Enrico Weigelt, metux IT consult c2f295f097 (!2007) dix: unexport and document EventSelectForWindow()
Not used by any external drivers, and not supposed to be used by them,
so no need to keep it in public API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:28 +02:00
Enrico Weigelt, metux IT consult e7efd95cd7 (!2007) dix: XineramaTryClientEventsResult() change return type to Bool
Callers are only interested in whether event was actually sent
(retval==1) or not, so Bool is sufficient and easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:28 +02:00
Enrico Weigelt, metux IT consult 86a3f0e0c3 (!2007) dix: MaybeDeliverEventToClient(): change return type to Bool
Callers are only interesed in whether event was actually sent
(retval==1) or not, so Bool is suffient and easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:28 +02:00
Enrico Weigelt, metux IT consult 0856fcf75d (!2007) dix: MaybeDeliverEventToClient() drop count parameter
It's always called with just a single event, so no need for the count
parameter. Also renaming it in order to better fit it's new semantics.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:28 +02:00
Enrico Weigelt, metux IT consult 5c185a0e45 (!2007) dix: unexport and document MaybeDeliverEventsToClient()
Not used by any external drivers, and only supposed to be DIX internal,
so shouldn't be exported at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:28 +02:00
Enrico Weigelt, metux IT consult 763a0cef4f (!2007) dix: unexport, rename and document GetSpriteCursor()
* not used by any external drivers, so no need to keep it exported
* choose better fitting name: InputDevGetSpriteCursor()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:28 +02:00
Enrico Weigelt, metux IT consult 07dc34a9e4 (!2007) dix: unexport and document SetCriticalEvent()
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-03 11:37:28 +02:00
Enrico Weigelt, metux IT consult e91d5bde2f (!2007) dix: unexport events related request handlers
Request handlers aren't supposed to be called by external drivers directly,
so no need to keep them in the public SDK API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:28 +02:00
Enrico Weigelt, metux IT consult 8754ce0d5f (!2006) sdk: add generic X return code
This type is should be used instead of plain int for all functions
returning and X error code (that's possibly sent to the client),
in order to make return value semantics clear to the humen reader.
(for the compiler, it still will be just an int)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:28 +02:00
Enrico Weigelt, metux IT consult 6215978f94 (!2005) sdk: add _X_ATTRIBUTE_NONNULL_ARGS() macro
Adding a macro for specifying nonnull attributes, for easier future
transition to new C23 attributes or supporting strange compilers that
don't understand this attribute.

The purpose of using those attributes is aiding compiler warnings and
potential optimizations.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-03 11:37:28 +02:00
753 changed files with 15316 additions and 15076 deletions

View File

@ -21,10 +21,10 @@ variables:
REPO_URL_XORGPROTO: 'https://gitlab.freedesktop.org/xorg/proto/xorgproto.git'
XORG_DEBIAN_VERSION: 'bullseye-slim'
XORG_DEBIAN_EXEC: 'env FDO_CI_CONCURRENT=${FDO_CI_CONCURRENT} bash .gitlab-ci/debian-install.sh'
XORG_DEBIAN_TAG: '2025-02-26-xcb-deps'
XORG_DEBIAN_TAG: '2025-03-07-libdrm.1'
XORG_FREEBSD_VERSION: '14.2'
XORG_FREEBSD_EXEC: ''
XORG_FREEBSD_TAG: '2025-02-18-vm-image'
XORG_FREEBSD_TAG: '2025-05-27-xcb'
include:
- project: 'freedesktop/ci-templates'
@ -111,7 +111,7 @@ stages:
FDO_DISTRIBUTION_TAG: '$XORG_FREEBSD_TAG'
FDO_DISTRIBUTION_VERSION: '$XORG_FREEBSD_VERSION'
FDO_DISTRIBUTION_EXEC: ''
FDO_DISTRIBUTION_PACKAGES: 'git gcc pkgconf autoconf automake libtool xorg-macros xorgproto bash meson ninja pixman xtrans libXau libXdmcp libXfont2 libxkbfile libxcvt libpciaccess font-util libepoll-shim'
FDO_DISTRIBUTION_PACKAGES: 'git gcc pkgconf autoconf automake libtool xorg-macros xorgproto bash meson ninja pixman xtrans libXau libXdmcp libXfont2 libxkbfile libxcvt libpciaccess font-util libepoll-shim libxvmc xcb-util xcb-util-wm'
FDO_IMAGE_SIZE: '30G'
debian-bullseye:
@ -155,7 +155,7 @@ freebsd-image:
- $MESON_BUILDDIR/meson-logs/
- $MESON_BUILDDIR/test/piglit-results/
variables:
MESON_ARGS: -Dc_args="-fno-common" -Dprefix=/usr -Dxephyr=true -Dwerror=true -Dxcsecurity=true
MESON_ARGS: -Dc_args="-fno-common" -Dprefix=/usr -Dxephyr=true -Dwerror=true -Dxcsecurity=true -Dxv=true -Dxvmc=true
CCACHE_COMPILERCHECK: content
CCACHE_DIR: /cache/xserver/cache
LC_ALL: C.UTF-8
@ -205,14 +205,14 @@ mingw-cross-build:
script:
- .gitlab-ci/meson-build.sh --run-install
variables:
MESON_ARGS: --cross-file=.gitlab-ci/cross-i686-w64-mingw32.txt -Dglx=false -Dlisten_tcp=true
MESON_ARGS: --cross-file=.gitlab-ci/cross-i686-w64-mingw32.txt -Dglx=false -Dlisten_tcp=true -Dxvmc=true -Dxv=true
freebsd:
stage: build-and-test
extends:
- .xorg-image@freebsd
variables:
MESON_ARGS: -Dglx=false -Dglamor=false -Dudev=false -Dudev_kms=false
MESON_ARGS: -Dglx=false -Dglamor=false -Dudev=false -Dudev_kms=false -Dxvmc=true -Dxv=true
script:
# running of of disk space without this
# needed until https://gitlab.freedesktop.org/freedesktop/ci-templates/-/issues/67 is fixed
@ -221,6 +221,8 @@ freebsd:
- /app/vmctl start
- set +e
- scp -r $PWD "vm:"
# need to install extra packages, as long as image cant be rebuilt
- /app/vmctl exec "pkg update && pkg add libxvmc xcb-util xcb-util-wm"
# need to install newer xorgproto
- /app/vmctl exec "cd $CI_PROJECT_NAME/dep.xorgproto && ./autogen.sh --prefix=/usr && make && make install"
- /app/vmctl exec "cd $CI_PROJECT_NAME && PKG_CONFIG_PATH=\"$PKG_CONFIG_PATH\" MESON_ARGS=\"$MESON_ARGS\" MESON_BUILDDIR=\"$MESON_BUILDDIR\" .gitlab-ci/meson-build.sh --skip-test" && touch .success
@ -254,26 +256,102 @@ xf86-driver-build-test:
stage: drivers
parallel:
matrix:
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-input-elographics
SHA: xf86-input-elographics-1.4.4
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev
SHA: xf86-input-evdev-2.10.6
SHA: xf86-input-evdev-2.11.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-input-joystick
SHA: fa296d27fb479107fa6328a7565f665de2de98d3 # 5 commits ahead of 1.6.4
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-input-libinput
SHA: xf86-input-libinput-1.4.0
SHA: xf86-input-libinput-1.5.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-input-mouse
SHA: xf86-input-mouse-1.9.5
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-input-synaptics
SHA: xf86-input-synaptics-1.9.2
SHA: xf86-input-synaptics-1.10.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-input-vmmouse
SHA: 3bbcb6a143bb3f53e5b776fb70a4933229c1781a # 2 commits ahead of 13.2.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-input-void
SHA: b43e11eeb8b96aa87da910991da8b005d9847783 # 4 commits ahead of 1.4.2
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu
SHA: xf86-video-amdgpu-23.0.0
SHA: 2cb59a92de4a19909682a35e4f31f3c02de2899f # 18 commits ahead of 23.0.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-apm
SHA: 196784e691b8f8739792439434ffa002e9f5cdfa # 14 commits ahead of 1.3.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-ark
SHA: 109745d5c7e6982ee0dabbc5a233c1f2667ad5c9 # 9 commits ahead of 0.7.4
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-ast
SHA: db56de34bdf70f1904dba50d98774aaa950a2ca5 # 10 commits ahead of 1.1.6
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati
SHA: xf86-video-ati-22.0.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-intel
SHA: e6a4c4740c15ace9dd79dc7c18955f2eb413a6a5 # no release yet
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-qxl
SHA: 989ff620220e8d0555cec38c1508b57dfbcfb0c6 # no release yet
SHA: c610c037369500089baddd86aa3cf8046f3dc48b # 11 commits ahead of 22.0.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-chips
SHA: 4503aece04cc8860df18ce946633b5449a0cb47b # 7 commits ahead of 1.5.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-cirrus
SHA: 15d68316524c593bd67a6ea59b5c746a94c6c1f6 # 10 commits ahead of 1.6.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-dummy
SHA: 3a407a34c4a2b6b263a535b6aa7b49dd70784fdf # 9 commits ahead of 0.4.1
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-fbdev
SHA: c8d9f3be7e95689d793bb2f45a5dddf409e46811 # 15 commits ahead of 0.5.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-i128
SHA: 4fd0309834deca78e5ef6cad5ecba8864a308ba5 # 7 commits ahead of 1.4.1
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-i740
SHA: d610334264e82a18477b9a5c3a4095c49c18f47b # 11 commits ahead of 1.4.0
- REPO: https://gitlab.freedesktop.org/metux/xf86-video-intel
SHA: submit/fixes-for-xserver # temporary
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-mach64
SHA: 878048e3aec04c6bb8034f21afdfff37e3528c5f # 20 commits ahead of 6.9.7
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-mga
SHA: 66ee371516c48c30b67684317a8e3c24ba7f1f4e # 11 commits ahead of 2.0.1
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-neomagic
SHA: 69cafdeebf7c338ede076424f9bcb97f26ede7a8 # 8 commits ahead of 1.3.1
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-nested
SHA: 86b6dc3bb6d78f40905ecc63df3635b284214836 # no release yet
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-nouveau
SHA: xf86-video-nouveau-1.0.18
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-nv
SHA: a8608636da97fdd880edb1bce919a0d3029f24dd # 15 commits ahead of 2.1.23
- REPO: https://gitlab.freedesktop.org/metux/xf86-video-qxl
SHA: incubate # temporary
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-r128
SHA: bc21fcdffa623bb8e7150e1da69aeaed6cd7c5d2 # 1 commits ahead of 6.13.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-rendition
SHA: 49d50f1fdeb4dc81895fec81be9fae1dc78e5974 # 14 commits ahead of 4.2.7
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-s3virge
SHA: 8834f100114ba136d52590e711054ab063306421 # 11 commits ahead of 1.11.1
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-savage
SHA: 09f6c06f0a793c7d297f152227b551c128f20875 # 8 commits ahead of 2.4.1
- REPO: https://gitlab.freedesktop.org/metux/xf86-video-siliconmotion
SHA: incubate # temporary
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-sis
SHA: ee451146c0afd735b50488588f82f3f158e9da03 # 68 commits ahead of 0.12.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-sisusb
SHA: ccff93b681968463d00793a9a7c5c2db8301634f # 30 commits ahead of 0.12.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-suncg14
SHA: 471e04fe84abaf2f868fb85566d99495142692a9 # 9 commits ahead of 1.1.3
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-suncg3
SHA: 8162844221f6d59e540c3c3a146a9c581d413949 # 9 commits ahead of 1.1.3
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-suncg6
SHA: 37a28d0d9dbb9b0c6631aa7b09d558d5f552c627 # 10 commits ahead of 1.1.3
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-sunffb
SHA: 6100635debdda392ca420e87c5b0d70bd22dfed8 # 14 commits ahead of 1.2.3
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-sunleo
SHA: 6d56a007f3d47fa43e95f1a0c8619be00b0c1c97 # 10 commits ahead of 1.2.3
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-suntcx
SHA: c1c0e384b95da18b81793612b90f693891f2e476 # 9 commits ahead of 1.1.3
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-tdfx
SHA: 5253278119a4db07b5a01856f0de34e576f4dcdd # 9 commits ahead of 1.5.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-trident
SHA: fddaa2084b9aac51a845ee1ede8c498cbc9330cf # 13 commits ahead of 1.4.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-v4l
SHA: eb1e55874cbacf7455f70269581a877e88e3bf37 # 15 commits ahead of 0.3.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-vbox
SHA: ec4bc6b8e9d1a83526573d27afd099debbd5b86b # 7 commits ahead of 1.0.1
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-vesa
SHA: xf86-video-vesa-2.6.0
SHA: 5b33e95acb831768c52d491de079a1adcae762e0 # 10 commits ahead of 2.6.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-vmware
SHA: xf86-video-vmware-13.4.0
SHA: 92cc4534146dd84c0d843759cdb30f75abddddd6 # 6 commits ahead 13.4.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-voodoo
SHA: c70353ddf49d557c596a47b835b6b8d8bbe35ebe # 15 commits ahead of 1.2.6
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-xgi
SHA: e73ff14a7f1b7562ff447aad527641cc35f557ae # 49 commits ahead 1.6.1
script:
# built xserver is taken from meson-dist job
- export PKG_CONFIG_PATH=$(pwd)/xserver-tarball/install/lib/x86_64-linux-gnu/pkgconfig
@ -297,32 +375,6 @@ xf86-driver-build-test:
GIT_DEPTH: 1
MESON_ARGS: -Dprefix=/usr/
MESON_EXTRA_ARGS: -Dxwayland=false -Dxnest=false -Dxvfb=false -Dxquartz=false -Ddocs=false
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
*dix_paths
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
*xorg_paths
#
# Verify that commit messages are as expected
#
check-commits:
extends:
- .fdo.ci-fairy
needs: []
stage: test
script:
- ci-fairy check-commits --junit-xml=results.xml
except:
- master@xorg/xserver
variables:
GIT_DEPTH: 100
artifacts:
reports:
junit: results.xml
allow_failure: true
#
# Verify that the merge request has the allow-collaboration checkbox ticked

View File

@ -132,7 +132,7 @@ apt-get install -y \
cd /root
# Xwayland requires drm 2.4.116 for drmSyncobjEventfd
git clone https://gitlab.freedesktop.org/mesa/drm --depth 1 --branch=libdrm-2.4.116
git clone https://gitlab.freedesktop.org/mesa/drm --depth 1 --branch=libdrm-2.4.121
cd drm
meson _build
ninja -C _build -j${FDO_CI_CONCURRENT:-4} install

1
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1 @@
404

View File

@ -8,6 +8,7 @@ possible, and insert their name to this list. Please sort by surname
for people, and by the full name for other entities (e.g. Juliusz
Chroboczek sorts before Intel Corporation sorts before Daniel Stone).
Copyright © 2025 Enrico Weigelt, metux IT consult
Copyright © 2011 Dave Airlie
Copyright © 2000-2001 Juliusz Chroboczek
Copyright © 1998 Egbert Eich

1
CoC.md Normal file
View File

@ -0,0 +1 @@
-ENOENT

133
README.md
View File

@ -1,35 +1,120 @@
X Server
--------
XLibre Xserver
===============
The X server accepts requests from client applications to create windows,
which are (normally rectangular) "virtual screens" that the client program
can draw into.
Xlibre project's fork of the Xorg xserver, with lots of code cleanups
and enhanced functionality.
Windows are then composed on the actual screen by the X server
(or by a separate composite manager) as directed by the window manager,
which usually communicates with the user via graphical controls such as buttons
and draggable titlebars and borders.
That fork was necessary since toxic elements within Xorg projects, moles
from BigTech, are boycotting any substantial work on Xorg, in order to
destroy the project, to elimitate competition of their own products.
Classic "embrace, extend, extinguish" tactics.
For a comprehensive overview of X Server and X Window System, consult the
following article:
https://en.wikipedia.org/wiki/X_server
Right after first journalists began covering the planned fork Xlibre,
on June 6th 2025, Redhat employees started a purge on the Xlibre founder's
gitlab account on freedesktop.org: deleted the git repo, tickets, merge
requests, etc, and so fired the shot that the whole world heared.
All questions regarding this software should be directed at the
Xorg mailing list:
This is an independent project, not at all affiliated with BigTech or any
of their subsidiaries or tax evasion tools, nor any political activists
groups, state actors, etc. It's explicitly free of any "DEI" or similar
discriminatory policies. Anybody who's treating others nicely is welcomed.
https://lists.freedesktop.org/mailman/listinfo/xorg
It doesn't matter which country you're coming from, your politicial views,
your race, your sex, your age, your food menu, whether you wear boots or
heels, whether you're furry or fairy, Conan or McKay, comic character, a
small furry creature from Alpha Centauri, or just an boring average person.
Anybody's welcomed, who's interested in bringing X forward.
The primary development code repository can be found at:
Together we'll make X great again!
https://gitlab.freedesktop.org/xorg/xserver
Upgrade notice
--------------
For patch submission instructions, see:
* Module ABIs have changed - drivers MUST be recompiled against this Xserver
verison, otherwise the Xserver can crash or not even start up correctly.
https://www.x.org/wiki/Development/Documentation/SubmittingPatches
* If your console is locked up (no input possible, not even VT switch), then
most likely the input driver couldn't be loaded due version mismatch.
When unsure, Better be prepared to ssh into your machine from another one
or set a timer that's calling `chvt 1` after certain time, so you'll don't
need a cold reboot.
As with other projects hosted on freedesktop.org, X.Org follows its
Code of Conduct, based on the Contributor Covenant. Please conduct
yourself in a respectful and civilized manner when using the above
mailing lists, bug trackers, etc:
* Proprietary NVidia drivers might break: they still haven't managed to do
do even simple cleanups to catch up with Xorg master for about a year.
All attempts to get into direct mail contact have failed. We're trying to
work around this, but cannot give any guarantees.
https://www.freedesktop.org/wiki/CodeOfConduct
* Most xorg drivers should run as-is (need recompile!), with some exceptions.
See .gitlab-ci.yml for the versions/branches built along w/ Xlibre.
Driver repositories
-------------------
Since Redhat had deleted and banned all X11Libre repositories from freedesktop.org,
the driver repositories are now moved to github:
| Driver | Git repository |
| --- | --- |
| xf86-input-elographics: | https://github.com/X11Libre/xf86-input-elographics |
| xf86-input-evdev: | https://github.com/X11Libre/xf86-input-evdev |
| xf86-input-joystick: | https://github.com/X11Libre/xf86-input-joystick |
| xf86-input-keyboard: | https://github.com/X11Libre/xf86-input-keyboard |
| xf86-input-libinput: | https://github.com/X11Libre/xf86-input-libinput |
| xf86-input-mouse: | https://github.com/X11Libre/xf86-input-mouse |
| xf86-input-synaptics: | https://github.com/X11Libre/xf86-input-synaptics |
| xf86-input-vmmouse: | https://github.com/X11Libre/xf86-input-vmmouse |
| xf86-video-amdgpu: | https://github.com/X11Libre/xf86-video-amdgpu |
| xf86-video-apm: | https://github.com/X11Libre/xf86-video-apm |
| xf86-video-ark: | https://github.com/X11Libre/xf86-video-ark |
| xf86-video-ast: | https://github.com/X11Libre/xf86-video-ast |
| xf86-video-ati: | https://github.com/X11Libre/xf86-video-ati |
| xf86-video-chips: | https://github.com/X11Libre/xf86-video-chips |
| xf86-video-cirrus: | https://github.com/X11Libre/xf86-video-cirrus |
| xf86-video-dummy: | https://github.com/X11Libre/xf86-video-dummy |
| xf86-video-fbdev: | https://github.com/X11Libre/xf86-video-fbdev |
| xf86-video-freedreno: | https://github.com/X11Libre/xf86-video-freedreno |
| xf86-video-geode: | https://github.com/X11Libre/xf86-video-geode |
| xf86-video-i128: | https://github.com/X11Libre/xf86-video-i128 |
| xf86-video-i740: | https://github.com/X11Libre/xf86-video-i740 |
| xf86-video-i740: | https://github.com/X11Libre/xf86-video-i740 |
| xf86-video-intel: | https://github.com/X11Libre/xf86-video-intel |
| xf86-video-mach64: | https://github.com/X11Libre/xf86-video-mach64 |
| xf86-video-mga: | https://github.com/X11Libre/xf86-video-mga |
| xf86-video-neomagic: | https://github.com/X11Libre/xf86-video-neomagic |
| xf86-video-nested: | https://github.com/X11Libre/xf86-video-nested |
| xf86-video-nouveau: | https://github.com/X11Libre/xf86-video-nouveau |
| xf86-video-nv: | https://github.com/X11Libre/xf86-video-nv |
| xf86-video-omap: | https://github.com/X11Libre/xf86-video-omap |
| xf86-video-qxl: | https://github.com/X11Libre/xf86-video-qxl |
| xf86-video-r128: | https://github.com/X11Libre/xf86-video-r128 |
| xf86-video-rendition: | https://github.com/X11Libre/xf86-video-rendition |
| xf86-video-s3virge: | https://github.com/X11Libre/xf86-video-s3virge |
| xf86-video-savage: | https://github.com/X11Libre/xf86-video-savage |
| xf86-video-siliconmotion: | https://github.com/X11Libre/xf86-video-siliconmotion |
| xf86-video-sis: | https://github.com/X11Libre/xf86-video-sis |
| xf86-video-sisusb: | https://github.com/X11Libre/xf86-video-sisusb |
| xf86-video-suncg14: | https://github.com/X11Libre/xf86-video-suncg14 |
| xf86-video-suncg3: | https://github.com/X11Libre/xf86-video-suncg3 |
| xf86-video-suncg6: | https://github.com/X11Libre/xf86-video-suncg6 |
| xf86-video-sunffb: | https://github.com/X11Libre/xf86-video-sunffb |
| xf86-video-sunleo: | https://github.com/X11Libre/xf86-video-sunleo |
| xf86-video-suntcx: | https://github.com/X11Libre/xf86-video-suntcx |
| xf86-video-tdfx: | https://github.com/X11Libre/xf86-video-tdfx |
| xf86-video-trident: | https://github.com/X11Libre/xf86-video-trident |
| xf86-video-v4l: | https://github.com/X11Libre/xf86-video-v4l |
| xf86-video-vesa: | https://github.com/X11Libre/xf86-video-vesa |
| xf86-video-vmware: | https://github.com/X11Libre/xf86-video-vmware |
| xf86-video-voodoo: | https://github.com/X11Libre/xf86-video-voodoo |
| xf86-video-wsfb: | https://github.com/X11Libre/xf86-video-wsfb |
| xf86-video-xgi: | https://github.com/X11Libre/xf86-video-xgi |
Contact
-------
| | |
| --- | --- |
| Mailing list: | https://www.freelists.org/list/xlibre |
| Telegram channel: | https://t.me/x11dev |
| Matrix room (mirror of tg group): | https://matrix.to/#/#xlibre:matrix.org |

View File

@ -33,13 +33,13 @@ from The Open Group.
#include <X11/extensions/bigreqsproto.h>
#include "dix/dix_priv.h"
#include "miext/extinit_priv.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "opaque.h"
#include "extinit_priv.h"
static int
ProcBigReqDispatch(ClientPtr client)

View File

@ -30,18 +30,18 @@ Equipment Corporation.
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/dpmsproto.h>
#include "miext/extinit_priv.h"
#include "os/screensaver.h"
#include "Xext/geext.h"
#include "Xext/geext_priv.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "opaque.h"
#include <X11/extensions/dpmsproto.h>
#include "dpmsproc.h"
#include "extinit_priv.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "protocol-versions.h"
@ -145,10 +145,9 @@ ProcDPMSSelectInput(register ClientPtr client)
}
/* build the entry */
pNewEvent = (DPMSEventPtr)malloc(sizeof(DPMSEventRec));
pNewEvent = calloc(1, sizeof(DPMSEventRec));
if (!pNewEvent)
return BadAlloc;
pNewEvent->next = 0;
pNewEvent->client = client;
pNewEvent->mask = stuff->eventMask;
/*
@ -164,7 +163,7 @@ ProcDPMSSelectInput(register ClientPtr client)
* of clients selecting input
*/
if (i != Success || !pHead) {
pHead = (DPMSEventPtr *)malloc(sizeof(DPMSEventPtr));
pHead = calloc(1, sizeof(DPMSEventPtr));
if (!pHead ||
!AddResource(eventResource, DPMSEventType, (void *)pHead)) {
FreeResource(clientResource, X11_RESTYPE_NONE);
@ -589,7 +588,7 @@ DPMSExtensionInit(void)
ClientType = CreateNewResourceType(DPMSFreeClient, "DPMSClient");
DPMSEventType = CreateNewResourceType(DPMSFreeEvents, "DPMSEvent");
eventResource = FakeClientID(0);
eventResource = dixAllocServerXID();
if (DPMSEnabled && ClientType && DPMSEventType &&
(extEntry = AddExtension(DPMSExtensionName, 0, 0,

View File

@ -1,8 +1,6 @@
/* Prototypes for functions that the DDX must provide */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _DPMSPROC_H_
#define _DPMSPROC_H_

View File

@ -24,12 +24,15 @@
*/
#include <dix-config.h>
#include "windowstr.h"
#include <X11/extensions/ge.h>
#include "geext.h"
#include <X11/extensions/ge.h>
#include <X11/extensions/geproto.h>
#include "miext/extinit_priv.h"
#include "Xext/geext_priv.h"
#include "windowstr.h"
#include "protocol-versions.h"
#include "extinit_priv.h"
#define MAXEXTENSIONS 128

View File

@ -1,41 +0,0 @@
/*
Copyright 2007 Peter Hutterer <peter@cs.unisa.edu.au>
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the author shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the author.
*/
#ifndef _GEEXT_H_
#define _GEEXT_H_
#include <X11/Xfuncproto.h>
#include <X11/extensions/geproto.h>
/* Interface for other extensions */
extern _X_EXPORT void GERegisterExtension(int extension,
void (*ev_dispatch) (xGenericEvent
*from,
xGenericEvent
*to));
#endif /* _GEEXT_H_ */

19
Xext/geext_priv.h Normal file
View File

@ -0,0 +1,19 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*/
#ifndef _XORG_GEEXT_PRIV_H
#include <X11/Xproto.h>
typedef void (*XorgGESwapProcPtr) (xGenericEvent *from, xGenericEvent *to);
/*
* Register generic event extension dispatch handler
*
* @param extension base opcode
* @param event swap handler function
*/
void GERegisterExtension(int extension, XorgGESwapProcPtr swap_handler);
#endif /* _XORG_GEEXT_PRIV_H */

View File

@ -1,6 +1,9 @@
#include <dix-config.h>
#include <stdlib.h>
#include "dix/resource_priv.h"
#include "misc.h"
#include "hashtable.h"
@ -39,7 +42,7 @@ ht_create(int keySize,
{
int c;
int numBuckets;
HashTable ht = malloc(sizeof(struct HashTableRec));
HashTable ht = calloc(1, sizeof(struct HashTableRec));
if (!ht) {
return NULL;
@ -52,7 +55,7 @@ ht_create(int keySize,
ht->elements = 0;
ht->bucketBits = INITHASHSIZE;
numBuckets = 1 << ht->bucketBits;
ht->buckets = xallocarray(numBuckets, sizeof(*ht->buckets));
ht->buckets = calloc(numBuckets, sizeof(*ht->buckets));
ht->cdata = cdata;
if (ht->buckets) {
@ -93,7 +96,7 @@ double_size(HashTable ht)
int newNumBuckets = 1 << newBucketBits;
int c;
newBuckets = xallocarray(newNumBuckets, sizeof(*ht->buckets));
newBuckets = calloc(newNumBuckets, sizeof(*ht->buckets));
if (newBuckets) {
for (c = 0; c < newNumBuckets; ++c) {
xorg_list_init(&newBuckets[c]);
@ -127,7 +130,7 @@ ht_add(HashTable ht, const void *key)
if (!elem) {
goto outOfMemory;
}
elem->key = malloc(ht->keySize);
elem->key = calloc(1, ht->keySize);
if (!elem->key) {
goto outOfMemory;
}

View File

@ -51,7 +51,7 @@ typedef struct {
@param[in] cdata Opaque data that will be passed to hash and
comparison functions
*/
extern _X_EXPORT HashTable ht_create(int keySize,
HashTable ht_create(int keySize,
int dataSize,
HashFunc hash,
HashCompareFunc compare,
@ -59,7 +59,7 @@ extern _X_EXPORT HashTable ht_create(int keySize,
/** @brief HtDestruct deinitializes the structure. It does not free the
memory allocated to HashTableRec
*/
extern _X_EXPORT void ht_destroy(HashTable ht);
void ht_destroy(HashTable ht);
/** @brief Adds a new key to the hash table. The key will be copied
and a pointer to the value will be returned. The data will
@ -75,12 +75,12 @@ extern _X_EXPORT void ht_destroy(HashTable ht);
to avoid returning NULL. Obviously the data pointed cannot be
modified, as implied by dataSize being 0.
*/
extern _X_EXPORT void *ht_add(HashTable ht, const void *key);
void *ht_add(HashTable ht, const void *key);
/** @brief Removes a key from the hash table along with its
associated data, which will be free'd.
*/
extern _X_EXPORT void ht_remove(HashTable ht, const void *key);
void ht_remove(HashTable ht, const void *key);
/** @brief Finds the associated data of a key from the hash table.
@ -93,27 +93,27 @@ extern _X_EXPORT void ht_remove(HashTable ht, const void *key);
use HtMember instead to determine if a key has been
inserted.
*/
extern _X_EXPORT void *ht_find(HashTable ht, const void *key);
void *ht_find(HashTable ht, const void *key);
/** @brief A generic hash function */
extern _X_EXPORT unsigned ht_generic_hash(void *cdata,
unsigned ht_generic_hash(void *cdata,
const void *ptr,
int numBits);
/** @brief A generic comparison function. It compares data byte-wise. */
extern _X_EXPORT int ht_generic_compare(void *cdata,
int ht_generic_compare(void *cdata,
const void *l,
const void *r);
/** @brief A debugging function that dumps the distribution of the
hash table: for each bucket, list the number of elements
contained within. */
extern _X_EXPORT void ht_dump_distribution(HashTable ht);
void ht_dump_distribution(HashTable ht);
/** @brief A debugging function that dumps the contents of the hash
table: for each bucket, list the elements contained
within. */
extern _X_EXPORT void ht_dump_contents(HashTable ht,
void ht_dump_contents(HashTable ht,
void (*print_key)(void *opaque, void *key),
void (*print_value)(void *opaque, void *value),
void* opaque);
@ -123,14 +123,14 @@ extern _X_EXPORT void ht_dump_contents(HashTable ht,
be NULL. It uses HashXID underneath, and should HashXID be
unable to hash the value, it switches into using the generic
hash function. */
extern _X_EXPORT unsigned ht_resourceid_hash(void *cdata,
unsigned ht_resourceid_hash(void *cdata,
const void * data,
int numBits);
/** @brief A comparison function to be used for comparing resource
IDs when used with HashTables. It makes no use of cdata,
so that can be NULL. */
extern _X_EXPORT int ht_resourceid_compare(void *cdata,
int ht_resourceid_compare(void *cdata,
const void *a,
const void *b);

View File

@ -9,7 +9,6 @@ srcs_xext = [
]
hdrs_xext = [
'geext.h',
'syncsdk.h',
]

208
Xext/namespace/config.c Normal file
View File

@ -0,0 +1,208 @@
#include <dix-config.h>
#include <string.h>
#include <X11/Xdefs.h>
#include "os/auth.h"
#include "namespace.h"
struct Xnamespace ns_root = {
.allowMouseMotion = TRUE,
.allowShape = TRUE,
.allowTransparency = TRUE,
.allowXInput = TRUE,
.allowXKeyboard = TRUE,
.builtin = TRUE,
.name = NS_NAME_ROOT,
.refcnt = 1,
.superPower = TRUE,
};
struct Xnamespace ns_anon = {
.builtin = TRUE,
.name = NS_NAME_ANONYMOUS,
.refcnt = 1,
};
struct xorg_list ns_list = { 0 };
char *namespaceConfigFile = NULL;
static struct Xnamespace* select_ns(const char* name)
{
struct Xnamespace *walk;
xorg_list_for_each_entry(walk, &ns_list, entry) {
if (strcmp(walk->name, name)==0)
return walk;
}
struct Xnamespace *newns = calloc(1, sizeof(struct Xnamespace));
newns->name = strdup(name);
xorg_list_append(&newns->entry, &ns_list);
return newns;
}
#define atox(c) ('0' <= c && c <= '9' ? c - '0' : \
'a' <= c && c <= 'f' ? c - 'a' + 10 : \
'A' <= c && c <= 'F' ? c - 'A' + 10 : -1)
// warning: no error checking, no buffer clearing
static int hex2bin(const char *in, char *out)
{
while (in[0] && in[1]) {
int top = atox(in[0]);
if (top == -1)
return 0;
int bottom = atox(in[1]);
if (bottom == -1)
return 0;
*out++ = (top << 4) | bottom;
in += 2;
}
return 1;
}
/*
* loadConfig
*
* Load the container config
*/
static void parseLine(char *line, struct Xnamespace **walk_ns)
{
// trim newline and comments
char *c1 = strchr(line, '\n');
if (c1 != NULL)
*c1 = 0;
c1 = strchr(line, '#');
if (c1 != NULL)
*c1 = 0;
/* get the first token */
char *token = strtok(line, " ");
if (token == NULL)
return;
// if no "container" statement hasn't been issued yet, use root NS
struct Xnamespace * curr = (*walk_ns ? *walk_ns : &ns_root);
if (strcmp(token, "container") == 0)
{
if ((token = strtok(NULL, " ")) == NULL)
{
XNS_LOG("container missing id\n");
return;
}
curr = *walk_ns = select_ns(token);
return;
}
if (strcmp(token, "auth") == 0)
{
token = strtok(NULL, " ");
if (token == NULL)
return;
struct auth_token *new_token = calloc(1, sizeof(struct auth_token));
if (new_token == NULL)
FatalError("Xnamespace: failed allocating token\n");
new_token->authProto = strdup(token);
token = strtok(NULL, " ");
new_token->authTokenLen = strlen(token)/2;
new_token->authTokenData = calloc(1, new_token->authTokenLen);
if (!new_token->authTokenData) {
free(new_token);
return;
}
hex2bin(token, new_token->authTokenData);
new_token->authId = AddAuthorization(strlen(new_token->authProto),
new_token->authProto,
new_token->authTokenLen,
new_token->authTokenData);
xorg_list_append(&new_token->entry, &curr->auth_tokens);
return;
}
if (strcmp(token, "allow") == 0)
{
while ((token = strtok(NULL, " ")) != NULL)
{
if (strcmp(token, "mouse-motion") == 0)
curr->allowMouseMotion = TRUE;
else if (strcmp(token, "shape") == 0)
curr->allowShape = TRUE;
else if (strcmp(token, "transparency") == 0)
curr->allowTransparency = TRUE;
else if (strcmp(token, "xinput") == 0)
curr->allowXInput = TRUE;
else if (strcmp(token, "xkeyboard") == 0)
curr->allowXKeyboard = TRUE;
else
XNS_LOG("unknown allow: %s\n", token);
}
return;
}
if (strcmp(token, "superpower") == 0)
{
curr->superPower = TRUE;
return;
}
XNS_LOG("unknown token \"%s\"\n", token);
}
Bool XnsLoadConfig(void)
{
xorg_list_append_ndup(&ns_root.entry, &ns_list);
xorg_list_append_ndup(&ns_anon.entry, &ns_list);
if (!namespaceConfigFile) {
XNS_LOG("no namespace config given - Xnamespace disabled\n");
return FALSE;
}
FILE *fp = fopen(namespaceConfigFile, "r");
if (fp == NULL) {
FatalError("failed loading container config: %s\n", namespaceConfigFile);
return FALSE;
}
struct Xnamespace *walk_ns = NULL;
char linebuf[1024];
while (fgets(linebuf, sizeof(linebuf), fp) != NULL)
parseLine(linebuf, &walk_ns);
fclose(fp);
XNS_LOG("loaded namespace config file: %s\n", namespaceConfigFile);
struct Xnamespace *ns;
xorg_list_for_each_entry(ns, &ns_list, entry) {
XNS_LOG("namespace: \"%s\" \n", ns->name);
struct auth_token *at;
xorg_list_for_each_entry(at, &ns->auth_tokens, entry) {
XNS_LOG(" auth: \"%s\" \"", at->authProto);
for (int i=0; i<at->authTokenLen; i++)
printf("%02X", (unsigned char)at->authTokenData[i]);
printf("\"\n");
}
}
return TRUE;
}
struct Xnamespace *XnsFindByName(const char* name) {
struct Xnamespace *walk;
xorg_list_for_each_entry(walk, &ns_list, entry) {
if (strcmp(walk->name, name)==0)
return walk;
}
return NULL;
}

View File

@ -0,0 +1,34 @@
#define HOOK_NAME "client"
#include <dix-config.h>
#include "dix/dix_priv.h"
#include "dix/extension_priv.h"
#include "dix/registry_priv.h"
#include "mi/miinitext.h"
#include "include/extinit.h"
#include "include/extnsionst.h"
#include "include/propertyst.h"
#include "include/protocol-versions.h"
#include "include/windowstr.h"
#include "Xext/xacestr.h"
#include "namespace.h"
#include "hooks.h"
void hookClient(CallbackListPtr *pcbl, void *unused, void *calldata)
{
XNS_HOOK_HEAD(XaceClientAccessRec);
struct XnamespaceClientPriv *obj = XnsClientPriv(param->target);
if (subj->ns->superPower || XnsClientSameNS(subj, obj))
return;
XNS_HOOK_LOG("BLOCKED access on client %d\n", param->target->index);
/* returning BadValue instead of BadAccess, because we're pretending
the requested client doens't even exist at all. */
param->status = BadValue;
}

View File

@ -0,0 +1,45 @@
#define HOOK_NAME "clienstate"
#include <dix-config.h>
#include "dix/registry_priv.h"
#include "os/client_priv.h"
#include "os/auth.h"
#include "namespace.h"
#include "hooks.h"
void hookClientState(CallbackListPtr *pcbl, void *unused, void *calldata)
{
XNS_HOOK_HEAD(NewClientInfoRec);
switch (client->clientState) {
case ClientStateInitial:
// better assign *someting* than null -- clients can't do anything yet anyways
XnamespaceAssignClient(subj, &ns_anon);
break;
case ClientStateRunning:
subj->authId = AuthorizationIDOfClient(client);
short unsigned int name_len = 0, data_len = 0;
const char * name = NULL;
char * data = NULL;
if (AuthorizationFromID(subj->authId, &name_len, &name, &data_len, &data)) {
XnamespaceAssignClient(subj, XnsFindByAuth(name_len, name, data_len, data));
} else {
XNS_HOOK_LOG("no auth data - assuming anon\n");
}
break;
case ClientStateRetained:
XnamespaceAssignClient(subj, NULL);
break;
case ClientStateGone:
XnamespaceAssignClient(subj, NULL);
break;
default:
XNS_HOOK_LOG("unknown state =%d\n", client->clientState);
break;
}
}

View File

@ -0,0 +1,64 @@
#define HOOK_NAME "device"
#include <dix-config.h>
#include <X11/extensions/XIproto.h>
#include <X11/extensions/XI2proto.h>
#include <X11/extensions/XKB.h>
#include "dix/dix_priv.h"
#include "dix/extension_priv.h"
#include "dix/registry_priv.h"
#include "Xext/xacestr.h"
#include "namespace.h"
#include "hooks.h"
void hookDevice(CallbackListPtr *pcbl, void *unused, void *calldata)
{
XNS_HOOK_HEAD(XaceDeviceAccessRec);
if (subj->ns->superPower)
goto pass;
// should be safe to pass for anybody
switch (client->majorOp) {
case X_QueryPointer:
case X_GetInputFocus:
case X_GetKeyboardMapping:
case X_GetModifierMapping:
case X_GrabButton: // needed by xterm -- should be safe
goto pass;
case EXTENSION_MAJOR_XKEYBOARD:
switch(client->minorOp) {
case X_kbSelectEvents: // needed by xterm
case X_kbGetMap: // needed by xterm
case X_kbBell: // needed by GIMP
case X_kbPerClientFlags: // needed by firefox
case X_kbGetState: // needed by firefox
case X_kbGetNames: // needed by firefox
case X_kbGetControls: // needed by firefox
goto pass;
default:
XNS_HOOK_LOG("BLOCKED unhandled XKEYBOARD %s\n", LookupRequestName(client->majorOp, client->minorOp));
goto block;
}
case EXTENSION_MAJOR_XINPUT:
switch (client->minorOp) {
case X_ListInputDevices:
case X_XIQueryDevice:
goto pass;
default:
XNS_HOOK_LOG("BLOCKED unhandled Xinput request\n");
goto block;
}
}
block:
param->status = BadAccess;
return;
pass:
param->status = Success;
return;
}

View File

@ -0,0 +1,67 @@
#define HOOK_NAME "ext-access"
#include <dix-config.h>
#include "dix/dix_priv.h"
#include "dix/extension_priv.h"
#include "dix/registry_priv.h"
#include "Xext/xacestr.h"
#include "namespace.h"
#include "hooks.h"
/* called on X_QueryExtension */
void hookExtAccess(CallbackListPtr *pcbl, void *unused, void *calldata)
{
XNS_HOOK_HEAD(XaceExtAccessRec);
/* root NS has super powers */
if (subj->ns->superPower)
goto pass;
switch (param->ext->index + EXTENSION_BASE) {
/* unrestricted access */
case EXTENSION_MAJOR_BIG_REQUESTS:
case EXTENSION_MAJOR_DAMAGE:
case EXTENSION_MAJOR_DOUBLE_BUFFER:
case EXTENSION_MAJOR_GENERIC_EVENT:
case EXTENSION_MAJOR_PRESENT:
case EXTENSION_MAJOR_SYNC:
case EXTENSION_MAJOR_XC_MISC:
case EXTENSION_MAJOR_XFIXES:
case EXTENSION_MAJOR_XKEYBOARD:
case EXTENSION_MAJOR_XRESOURCE:
goto pass;
/* really blacklisted */
case EXTENSION_MAJOR_MIT_SCREEN_SAVER:
case EXTENSION_MAJOR_RECORD:
case EXTENSION_MAJOR_SECURITY:
case EXTENSION_MAJOR_XTEST:
case EXTENSION_MAJOR_XVIDEO:
goto reject;
/* only allowed if namespace has flag set */
case EXTENSION_MAJOR_SHAPE:
if (subj->ns->allowShape)
goto pass;
goto reject;
/* only allowed if namespace has flag set */
case EXTENSION_MAJOR_XINPUT:
if (subj->ns->allowXInput)
goto pass;
goto reject;
}
XNS_HOOK_LOG("unhandled extension query: %s (%d)\n", param->ext->name, param->ext->index);
return;
reject:
param->status = BadAccess;
return;
pass:
param->status = Success;
return;
}

View File

@ -0,0 +1,115 @@
#define HOOK_NAME "ext-dispatch"
#include <dix-config.h>
#include <stdio.h>
#include <X11/Xdefs.h> // syncproto.h is broken
#include <X11/Xmd.h>
#include <X11/extensions/syncproto.h>
#include <X11/extensions/XIproto.h>
#include <X11/extensions/XKB.h>
#include <X11/extensions/xfixeswire.h>
#include "dix/dix_priv.h"
#include "dix/extension_priv.h"
#include "dix/registry_priv.h"
#include "Xext/xacestr.h"
#include "namespace.h"
#include "hooks.h"
void hookExtDispatch(CallbackListPtr *pcbl, void *unused, void *calldata)
{
XNS_HOOK_HEAD(XaceExtAccessRec);
/* root NS has super powers */
if (subj->ns->superPower)
goto pass;
switch (client->majorOp) {
/* unrestricted access to these */
case EXTENSION_MAJOR_BIG_REQUESTS:
case EXTENSION_MAJOR_DAMAGE:
case EXTENSION_MAJOR_DOUBLE_BUFFER:
case EXTENSION_MAJOR_GENERIC_EVENT:
case EXTENSION_MAJOR_PRESENT:
case EXTENSION_MAJOR_XC_MISC:
case EXTENSION_MAJOR_XRESOURCE:
goto pass;
/* allow several operations */
case EXTENSION_MAJOR_XKEYBOARD:
if (subj->ns->allowXKeyboard)
goto pass;
switch (client->minorOp) {
case X_kbUseExtension:
case X_kbGetMap:
case X_kbSelectEvents: // fixme: might need special filtering
case X_kbGetState:
case X_kbGetNames:
case X_kbGetControls:
case X_kbPerClientFlags:
goto pass;
}
XNS_HOOK_LOG("BLOCKED unhandled XKEYBOARD call: %s\n", param->ext->name);
goto reject;
/* allow if namespace has flag set */
case EXTENSION_MAJOR_SHAPE:
if (subj->ns->allowShape)
goto pass;
break;
case EXTENSION_MAJOR_XINPUT:
if (subj->ns->allowXInput)
goto pass;
switch (client->minorOp) {
case X_ListInputDevices:
goto pass;
}
break;
case EXTENSION_MAJOR_XFIXES:
switch (client->minorOp) {
case X_XFixesQueryVersion:
case X_XFixesCreateRegion:
case X_XFixesSetCursorName:
case X_XFixesSelectSelectionInput:
goto pass;
}
XNS_HOOK_LOG("BLOCKED unhandled XFIXES call: %s\n", param->ext->name);
goto reject;
break;
case EXTENSION_MAJOR_SYNC:
switch (client->minorOp) {
case X_SyncCreateCounter:
case X_SyncDestroyCounter:
case X_SyncInitialize:
case X_SyncSetCounter:
goto pass;
}
XNS_HOOK_LOG("REJECT unhandled SYNC call: %s\n", param->ext->name);
goto reject;
break;
/* really blacklisted */
case EXTENSION_MAJOR_MIT_SCREEN_SAVER:
case EXTENSION_MAJOR_RECORD:
case EXTENSION_MAJOR_SECURITY:
case EXTENSION_MAJOR_XTEST:
goto reject;
break;
}
XNS_HOOK_LOG("unhandled extension call: %s\n", param->ext->name);
return;
reject:
XNS_HOOK_LOG("rejecting extension call: %s\n", param->ext->name);
param->status = BadAccess;
return;
pass:
param->status = Success;
return;
}

View File

@ -0,0 +1,71 @@
#define HOOK_NAME "initroot"
#include <dix-config.h>
#include <stdio.h>
#include <X11/Xatom.h>
#include <X11/Xmd.h>
#include "dix/window_priv.h"
#include "namespace.h"
#include "hooks.h"
static inline int setWinStrProp(WindowPtr pWin, Atom name, const char *text) {
return dixChangeWindowProperty(serverClient, pWin, name, XA_STRING,
8, PropModeReplace, strlen(text), text, TRUE);
}
void hookInitRootWindow(CallbackListPtr *pcbl, void *data, void *screen)
{
ScreenPtr pScreen = (ScreenPtr)screen;
// only act on first screen
if (pScreen->myNum)
return;
/* create the virtual root windows */
WindowPtr realRoot = pScreen->root;
assert(realRoot);
struct Xnamespace *walk;
xorg_list_for_each_entry(walk, &ns_list, entry) {
if (strcmp(walk->name, NS_NAME_ROOT)==0) {
walk->rootWindow = realRoot;
XNS_LOG("<%s> actual root 0x%0x\n", walk->name, walk->rootWindow->drawable.id);
continue;
}
int rc = 0;
WindowPtr pWin = dixCreateWindow(
FakeClientID(0), realRoot, 0, 0, 23, 23,
0, /* bw */
InputOutput,
0, /* vmask */
NULL, /* vlist */
0, /* depth */
serverClient,
wVisual(realRoot), /* visual */
&rc);
if (!pWin)
FatalError("hookInitRootWindow: cant create per-namespace root window for %s\n", walk->name);
Mask mask = pWin->eventMask;
pWin->eventMask = 0; /* subterfuge in case AddResource fails */
if (!AddResource(pWin->drawable.id, X11_RESTYPE_WINDOW, (void *) pWin))
FatalError("hookInitRootWindow: cant add per-namespace root window as resource\n");
pWin->eventMask = mask;
walk->rootWindow = pWin;
// set window name
char buf[PATH_MAX] = { 0 };
snprintf(buf, sizeof(buf)-1, "XNS-ROOT:%s", walk->name);
setWinStrProp(pWin, XA_WM_NAME, buf);
XNS_LOG("<%s> virtual root 0x%0x\n", walk->name, walk->rootWindow->drawable.id);
}
}

View File

@ -0,0 +1,47 @@
#define HOOK_NAME "property"
#include <dix-config.h>
#include <stdio.h>
#include "dix/dix_priv.h"
#include "dix/registry_priv.h"
#include "include/propertyst.h"
#include "Xext/xacestr.h"
#include "namespace.h"
#include "hooks.h"
static inline Bool winIsRoot(WindowPtr pWin) {
if (!pWin)
return FALSE;
if (pWin->drawable.pScreen->root == pWin)
return TRUE;
return FALSE;
}
void hookPropertyAccess(CallbackListPtr *pcbl, void *unused, void *calldata)
{
XNS_HOOK_HEAD(XacePropertyAccessRec);
struct XnamespaceClientPriv *obj = XnsClientPriv(dixClientForWindow(param->pWin));
ATOM name = (*param->ppProp)->propertyName;
if (XnsClientSameNS(subj, obj))
return;
if (param->pWin == subj->ns->rootWindow)
return;
if (winIsRoot(param->pWin)) {
XNS_HOOK_LOG("window is the screen's root window\n");
} else {
XNS_HOOK_LOG("not a root window\n");
}
XNS_HOOK_LOG("access to property %s (atom 0x%x) window 0x%lx of client %d\n",
NameForAtom(name),
name,
(unsigned long)param->pWin->drawable.id,
dixClientForWindow(param->pWin)->index);
}

View File

@ -0,0 +1,75 @@
#define HOOK_NAME "recieve"
#include <dix-config.h>
#include <X11/Xmd.h>
#include "dix/extension_priv.h"
#include "dix/registry_priv.h"
#include "dix/resource_priv.h"
#include "Xext/xacestr.h"
#include "Xi/exglobals.h"
#include "namespace.h"
#include "hooks.h"
static inline Bool isRootWin(WindowPtr pWin) {
return (pWin->parent == NullWindow && dixClientForWindow(pWin) == serverClient);
}
void
hookReceive(CallbackListPtr *pcbl, void *unused, void *calldata)
{
XNS_HOOK_HEAD(XaceReceiveAccessRec);
struct XnamespaceClientPriv *obj = XnsClientPriv(dixClientForWindow(param->pWin));
// send and receive within same namespace permitted without restrictions
if (XnsClientSameNS(subj, obj))
goto pass;
for (int i=0; i<param->count; i++) {
const int type = param->events[i].u.u.type;
switch (type) {
case GenericEvent: {
xGenericEvent *gev = (xGenericEvent*)&param->events[i].u;
if (gev->extension == EXTENSION_MAJOR_XINPUT) {
switch (gev->evtype) {
case XI_RawMotion:
if ((!subj->ns->allowMouseMotion) || !isRootWin(param->pWin))
goto reject;
continue;
case XI_RawKeyPress:
case XI_RawKeyRelease:
goto reject;
default:
XNS_HOOK_LOG("XI unknown %d\n", gev->evtype);
goto reject;
}
}
XNS_HOOK_LOG("BLOCKED #%d generic event extension=%d\n", i, gev->extension);
goto reject;
}
break;
default:
XNS_HOOK_LOG("BLOCKED event type #%d 0%0x 0%0x %s %s%s\n", i, type, param->events[i].u.u.detail,
LookupEventName(type), (type & 128) ? "fake" : "",
isRootWin(param->pWin) ? " (root window)" : "");
goto reject;
break;
}
}
pass:
return;
reject:
param->status = BadAccess;
XNS_HOOK_LOG("BLOCKED client %d [NS %s] receiving event sent to window 0x%lx of client %d [NS %s]\n",
client->index,
subj->ns->name,
(unsigned long)param->pWin->drawable.id,
dixClientForWindow(param->pWin)->index,
obj->ns->name);
return;
}

View File

@ -0,0 +1,142 @@
#define HOOK_NAME "resource"
#include <dix-config.h>
#include <X11/extensions/XI2proto.h>
#include "dix/dix_priv.h"
#include "dix/extension_priv.h"
#include "dix/registry_priv.h"
#include "dix/window_priv.h"
#include "Xext/xacestr.h"
#include "namespace.h"
#include "hooks.h"
static int checkAllowed(Mask requested, Mask allowed) {
return ((requested & allowed) == requested);
}
void hookResourceAccess(CallbackListPtr *pcbl, void *unused, void *calldata)
{
XNS_HOOK_HEAD(XaceResourceAccessRec);
ClientPtr owner = dixLookupXIDOwner(param->id);
struct XnamespaceClientPriv *obj = XnsClientPriv(owner);
// server can do anything
if (param->client == serverClient)
goto pass;
// special filtering for windows: block transparency for untrusted clients
if (param->rtype == X11_RESTYPE_WINDOW) {
WindowPtr pWindow = (WindowPtr) param->res;
if (param->access_mode & DixCreateAccess) {
if (!subj->ns->allowTransparency) {
pWindow->forcedBG = TRUE;
}
}
}
// resource access inside same container is always permitted
if (XnsClientSameNS(subj, obj))
goto pass;
// check for root windows (screen or ns-virtual)
if (param->rtype == X11_RESTYPE_WINDOW) {
WindowPtr pWindow = (WindowPtr) param->res;
/* white-listed operations on namespace's virtual root window */
if (pWindow == subj->ns->rootWindow) {
switch (client->majorOp) {
case X_DeleteProperty:
case X_ChangeProperty:
case X_GetProperty:
case X_RotateProperties:
case X_QueryTree:
goto pass;
}
XNS_HOOK_LOG("unhandled access to NS' virtual root window 0x%0x\n", pWindow->drawable.id);
}
/* white-listed operations on actual root window */
if (pWindow && (pWindow == pWindow->drawable.pScreen->root)) {
switch (client->majorOp) {
case X_CreateWindow:
if (checkAllowed(param->access_mode, DixAddAccess))
goto pass;
break;
case X_CreateGC:
case X_CreatePixmap:
if (checkAllowed(param->access_mode, DixGetAttrAccess))
goto pass;
break;
// we reach here when destroying a top-level window:
// ProcDestroyWindow() checks whether one may remove a child
// from it's parent.
case X_DestroyWindow:
if (param->access_mode == DixRemoveAccess)
goto pass;
break;
case X_TranslateCoords:
case X_QueryTree:
goto pass;
case X_ChangeWindowAttributes:
case X_QueryPointer:
goto reject;
case X_SendEvent:
/* send hook needs to take care of this */
goto pass;
case EXTENSION_MAJOR_XINPUT:
switch(client->minorOp) {
// needed by xeyes. we should filter the mask
case X_XISelectEvents:
goto pass;
}
XNS_HOOK_LOG("unhandled XI operation on (real) root window\n");
goto reject;
}
}
}
/* server resources */
if (obj->isServer) {
if (param->rtype == X11_RESTYPE_COLORMAP) {
if (checkAllowed(param->access_mode, DixReadAccess | DixGetPropAccess | DixUseAccess | DixGetAttrAccess | DixAddAccess))
goto pass;
}
if (param->rtype == X11_RESTYPE_WINDOW) {
/* allowed ones should already been catched above */
XNS_HOOK_LOG("REJECT server owned window 0x%0x!\n", ((WindowPtr)param->res)->drawable.id);
goto reject;
}
if (checkAllowed(param->access_mode, DixReadAccess))
goto pass;
}
reject: ;
char accModeStr[128];
LookupDixAccessName(param->access_mode, (char*)&accModeStr, sizeof(accModeStr));
XNS_HOOK_LOG("BLOCKED access 0x%07lx %s to %s 0x%06lx of client %d @ %s\n",
(unsigned long)param->access_mode,
accModeStr,
LookupResourceName(param->rtype),
(unsigned long)param->id,
owner->index, // resource owner
obj->ns->name);
param->status = BadAccess;
return;
pass:
// request is passed as it is (or already had been rewritten)
param->status = Success;
}

View File

@ -0,0 +1,67 @@
#define HOOK_NAME "selection"
#include <dix-config.h>
#include <stdio.h>
#include "dix/selection_priv.h"
#include "namespace.h"
#include "hooks.h"
static inline const char *stripNS(const char* name) {
if ((!name) || (name[0] != '<'))
return name; // can this ever happen ?
const char *got = strchr(name, '>');
if (!got)
return name;
return ++got;
}
/*
* This hook is rewriting the client visible selection names to internally used,
* per namespace ones. Whenever a client is asking for a selection, it's name
* is replaced by a namespaced one, e.g. asking for "PRIMARY" while being in
* namespace "foo" will become "<foo>PRIMARY"
*
* A malicious client could still send specially crafted messages to others,
* asking them to send their selection data to him. This needs to be solved
* separately, by a send hook.
*/
void hookSelectionFilter(CallbackListPtr *pcbl, void *unused, void *calldata)
{
XNS_HOOK_HEAD(SelectionFilterParamRec);
/* no rewrite if client is in root namespace */
if (subj->ns->superPower)
return;
const char *origSelectionName = NameForAtom(param->selection);
char selname[PATH_MAX] = { 0 };
snprintf(selname, sizeof(selname)-1, "<%s>%s", subj->ns->name, origSelectionName);
Atom realSelection = MakeAtom(selname, strlen(selname), TRUE);
switch (param->op) {
case SELECTION_FILTER_GETOWNER:
case SELECTION_FILTER_SETOWNER:
case SELECTION_FILTER_CONVERT:
case SELECTION_FILTER_LISTEN:
// TODO: check whether window really belongs to the client
param->selection = realSelection;
break;
case SELECTION_FILTER_NOTIFY:
{
// need to translate back, since we're having the ns-prefixed name here
const char *stripped = stripNS(origSelectionName);
param->selection = MakeAtom(stripped, strlen(stripped), TRUE);
break;
}
// nothing to do here: already having the client visible name
case SELECTION_FILTER_EV_REQUEST:
case SELECTION_FILTER_EV_CLEAR:
break;
}
}

View File

@ -0,0 +1,53 @@
#define HOOK_NAME "send"
#include <dix-config.h>
#include "dix/registry_priv.h"
#include "dix/resource_priv.h"
#include "Xext/xacestr.h"
#include "namespace.h"
#include "hooks.h"
/* TRUE if subj client is allowed to do things on obj)
* usually if they're in the same namespace or subj is in a parent
* namespace of obj
*/
static Bool clientAllowedOnClient(ClientPtr subj, ClientPtr obj) {
struct XnamespaceClientPriv *subjPriv = XnsClientPriv(subj);
struct XnamespaceClientPriv *objPriv = XnsClientPriv(obj);
if (subjPriv && subjPriv->ns->superPower)
return TRUE;
return XnsClientSameNS(subjPriv, objPriv);
}
void hookSend(CallbackListPtr *pcbl, void *unused, void *calldata)
{
XNS_HOOK_HEAD(XaceSendAccessRec);
/* if no sending client, then it's coming internally from the server itself */
if (!client)
goto pass;
ClientPtr targetClient = dixClientForWindow(param->pWin);
struct XnamespaceClientPriv *obj = XnsClientPriv(targetClient);
if (clientAllowedOnClient(client, targetClient))
goto pass;
XNS_HOOK_LOG("BLOCK target @ %s\n", obj->ns->name);
for (int i = 0; i < param->count; i++) {
XNS_HOOK_LOG("sending event of type %s to window 0x%lx of client %d\n",
LookupEventName(param->events[i].u.u.type),
(unsigned long)param->pWin->drawable.id,
targetClient->index);
}
param->status = BadAccess;
return;
pass:
param->status = Success;
return;
}

View File

@ -0,0 +1,37 @@
#define HOOK_NAME "server"
#include <dix-config.h>
#include "dix/dix_priv.h"
#include "dix/registry_priv.h"
#include "Xext/xacestr.h"
#include "namespace.h"
#include "hooks.h"
void hookServerAccess(CallbackListPtr *pcbl, void *unused, void *calldata)
{
XNS_HOOK_HEAD(XaceServerAccessRec);
if (subj->ns->superPower)
goto pass;
switch (client->majorOp) {
case X_ListFonts:
case X_ListFontsWithInfo:
goto pass;
case X_GrabServer:
goto reject;
}
XNS_HOOK_LOG("BLOCKED access to server configuration request %s\n",
LookupRequestName(client->majorOp, client->minorOp));
reject:
param->status = BadAccess;
return;
pass:
param->status = Success;
}

View File

@ -0,0 +1,52 @@
#define HOOK_NAME "windowproperty"
#include <dix-config.h>
#include <X11/Xmd.h>
#include "dix/dix_priv.h"
#include "dix/property_priv.h"
#include "dix/window_priv.h"
#include "namespace.h"
#include "hooks.h"
static inline Bool winIsRoot(WindowPtr pWin) {
if (!pWin)
return FALSE;
if (pWin->drawable.pScreen->root == pWin)
return TRUE;
return FALSE;
}
void hookWindowProperty(CallbackListPtr *pcbl, void *unused, void *calldata)
{
XNS_HOOK_HEAD(PropertyFilterParam);
// no redirect on super power
if (subj->ns->superPower)
return;
const ClientPtr owner = dixLookupXIDOwner(param->window);
if (!owner) {
param->status = BadWindow;
param->skip = TRUE;
XNS_HOOK_LOG("owner of window 0x%0x doesn't exist\n", param->window);
return;
}
// whitelist anything that goes to caller's own namespace
struct XnamespaceClientPriv *obj = XnsClientPriv(owner);
if (XnsClientSameNS(subj, obj))
return;
// allow access to namespace virtual root
if (param->window == subj->ns->rootWindow->drawable.id)
return;
// redirect root window access to namespace's virtual root
if (dixWindowIsRoot(param->window)) {
param->window = subj->ns->rootWindow->drawable.id;
return;
}
}

41
Xext/namespace/hooks.h Normal file
View File

@ -0,0 +1,41 @@
#ifndef __XSERVER_NAMESPACE_HOOKS_H
#define __XSERVER_NAMESPACE_HOOKS_H
#include "dix/registry_priv.h"
#include "include/misc.h"
#include "namespace.h"
#define XNS_HOOK_LOG(...) do { \
printf("XNS [" HOOK_NAME "] (#%d@%d) {%s} <%s>: ", \
(client ? client->index : -1), \
(client ? client->sequence : -1), \
(subj ? (subj->ns ? subj->ns->name : "(no ns)") : "<no client>"), \
LookupRequestName(client ? client->majorOp : 0, \
client ? client->minorOp : 0)); \
printf(__VA_ARGS__); \
} while (0)
#define XNS_HOOK_HEAD(t) \
t *param = calldata; \
ClientPtr client = param->client; \
if (!client) { \
/* XNS_LOG("hook %s NULL client\n", HOOK_NAME); */ \
} \
struct XnamespaceClientPriv *subj = XnsClientPriv(client);
void hookClient(CallbackListPtr *pcbl, void *unused, void *calldata);
void hookClientState(CallbackListPtr *pcbl, void *unused, void *calldata);
void hookDevice(CallbackListPtr *pcbl, void *unused, void *calldata);
void hookExtAccess(CallbackListPtr *pcbl, void *unused, void *calldata);
void hookExtDispatch(CallbackListPtr *pcbl, void *unused, void *calldata);
void hookInitRootWindow(CallbackListPtr *pcbl, void *unused, void *calldata);
void hookPropertyAccess(CallbackListPtr *pcbl, void *unused, void *calldata);
void hookReceive(CallbackListPtr *pcbl, void *unused, void *calldata);
void hookResourceAccess(CallbackListPtr *pcbl, void *unused, void *calldata);
void hookSelectionFilter(CallbackListPtr *pcbl, void *unused, void *calldata);
void hookSend(CallbackListPtr *pcbl, void *unused, void *calldata);
void hookServerAccess(CallbackListPtr *pcbl, void *unused, void *calldata);
void hookWindowProperty(CallbackListPtr *pcbl, void *unused, void *calldata);
#endif /* __XSERVER_NAMESPACE_HOOKS_H */

View File

@ -0,0 +1,22 @@
libxserver_namespace = static_library(
'libxserver_namespace',
[
'config.c',
'hook-client.c',
'hook-clientstate.c',
'hook-device.c',
'hook-ext-access.c',
'hook-ext-dispatch.c',
'hook-init-rootwindow.c',
'hook-property.c',
'hook-receive.c',
'hook-resource.c',
'hook-selection.c',
'hook-send.c',
'hook-server.c',
'hook-windowproperty.c',
'namespace.c',
],
include_directories: inc,
dependencies: common_dep,
)

View File

@ -0,0 +1,92 @@
#include <dix-config.h>
#include <stdio.h>
#include <X11/Xmd.h>
#include "dix/dix_priv.h"
#include "dix/property_priv.h"
#include "dix/selection_priv.h"
#include "include/os.h"
#include "miext/extinit_priv.h"
#include "Xext/xacestr.h"
#include "namespace.h"
#include "hooks.h"
Bool noNamespaceExtension = TRUE;
DevPrivateKeyRec namespaceClientPrivKeyRec = { 0 };
void
NamespaceExtensionInit(void)
{
XNS_LOG("initializing namespace extension ...\n");
/* load configuration */
if (!XnsLoadConfig()) {
XNS_LOG("No config file. disabling Xns extension\n");
return;
}
if (!(dixRegisterPrivateKey(&namespaceClientPrivKeyRec, PRIVATE_CLIENT,
sizeof(struct XnamespaceClientPriv)) &&
AddCallback(&ClientStateCallback, hookClientState, NULL) &&
AddCallback(&PostInitRootWindowCallback, hookInitRootWindow, NULL) &&
AddCallback(&PropertyFilterCallback, hookWindowProperty, NULL) &&
AddCallback(&SelectionFilterCallback, hookSelectionFilter, NULL) &&
XaceRegisterCallback(XACE_CLIENT_ACCESS, hookClient, NULL) &&
XaceRegisterCallback(XACE_DEVICE_ACCESS, hookDevice, NULL) &&
XaceRegisterCallback(XACE_EXT_DISPATCH, hookExtDispatch, NULL) &&
XaceRegisterCallback(XACE_EXT_ACCESS, hookExtAccess, NULL) &&
XaceRegisterCallback(XACE_PROPERTY_ACCESS, hookPropertyAccess, NULL) &&
XaceRegisterCallback(XACE_RECEIVE_ACCESS, hookReceive, NULL) &&
XaceRegisterCallback(XACE_RESOURCE_ACCESS, hookResourceAccess, NULL) &&
XaceRegisterCallback(XACE_SEND_ACCESS, hookSend, NULL) &&
XaceRegisterCallback(XACE_SERVER_ACCESS, hookServerAccess, NULL)))
FatalError("NamespaceExtensionInit: allocation failure\n");
/* Do the serverClient */
struct XnamespaceClientPriv *srv = XnsClientPriv(serverClient);
*srv = (struct XnamespaceClientPriv) { .isServer = TRUE };
XnamespaceAssignClient(srv, &ns_root);
}
void XnamespaceAssignClient(struct XnamespaceClientPriv *priv, struct Xnamespace *newns)
{
if (priv->ns != NULL)
priv->ns->refcnt--;
priv->ns = newns;
if (newns != NULL)
newns->refcnt++;
}
void XnamespaceAssignClientByName(struct XnamespaceClientPriv *priv, const char *name)
{
struct Xnamespace *newns = XnsFindByName(name);
if (newns == NULL)
newns = &ns_anon;
XnamespaceAssignClient(priv, newns);
}
struct Xnamespace* XnsFindByAuth(size_t szAuthProto, const char* authProto, size_t szAuthToken, const char* authToken)
{
struct Xnamespace *walk;
xorg_list_for_each_entry(walk, &ns_list, entry) {
struct auth_token *at;
xorg_list_for_each_entry(at, &walk->auth_tokens, entry) {
int protoLen = at->authProto ? strlen(at->authProto) : 0;
if ((protoLen == szAuthProto) &&
(at->authTokenLen == szAuthToken) &&
(memcmp(at->authTokenData, authToken, szAuthToken)==0) &&
(memcmp(at->authProto, authProto, szAuthProto)==0))
return walk;
}
}
// default to anonymous if credentials aren't assigned to specific NS
return &ns_anon;
}

View File

@ -0,0 +1,82 @@
#ifndef __XSERVER_NAMESPACE_H
#define __XSERVER_NAMESPACE_H
#include <stdio.h>
#include <X11/Xmd.h>
#include "include/dixstruct.h"
#include "include/list.h"
#include "include/privates.h"
#include "include/window.h"
#include "include/windowstr.h"
struct auth_token {
struct xorg_list entry;
const char *authProto;
char *authTokenData;
size_t authTokenLen;
XID authId;
};
struct Xnamespace {
struct xorg_list entry;
const char *name;
Bool builtin;
Bool allowMouseMotion;
Bool allowShape;
Bool allowTransparency;
Bool allowXInput;
Bool allowXKeyboard;
Bool superPower;
struct xorg_list auth_tokens;
size_t refcnt;
WindowPtr rootWindow;
};
extern struct xorg_list ns_list;
extern struct Xnamespace ns_root;
extern struct Xnamespace ns_anon;
struct XnamespaceClientPriv {
Bool isServer;
XID authId;
struct Xnamespace* ns;
};
#define NS_NAME_ROOT "root"
#define NS_NAME_ANONYMOUS "anon"
extern DevPrivateKeyRec namespaceClientPrivKeyRec;
Bool XnsLoadConfig(void);
struct Xnamespace *XnsFindByName(const char* name);
struct Xnamespace* XnsFindByAuth(size_t szAuthProto, const char* authProto, size_t szAuthToken, const char* authToken);
void XnamespaceAssignClient(struct XnamespaceClientPriv *priv, struct Xnamespace *ns);
void XnamespaceAssignClientByName(struct XnamespaceClientPriv *priv, const char *name);
static inline struct XnamespaceClientPriv *XnsClientPriv(ClientPtr client) {
if (client == NULL) return NULL;
return dixLookupPrivate(&client->devPrivates, &namespaceClientPrivKeyRec);
}
static inline Bool XnsClientSameNS(struct XnamespaceClientPriv *p1, struct XnamespaceClientPriv *p2)
{
if (!p1 && !p2)
return TRUE;
if (!p1 || !p2)
return FALSE;
return (p1->ns == p2->ns);
}
#define XNS_LOG(...) do { printf("XNS "); printf(__VA_ARGS__); } while (0)
static inline Bool streq(const char *a, const char *b)
{
if (!a && !b)
return TRUE;
if (!a || !b)
return FALSE;
return (strcmp(a,b) == 0);
}
#endif /* __XSERVER_NAMESPACE_H */

View File

@ -0,0 +1,18 @@
# auth <proto> <hex-key>
auth MIT-MAGIC-COOKIE-1 46f8e62b78e58962de0ceefc05ad90b0
auth MIT-MAGIC-COOKIE-1 56f8e62b78e58962de0ceefc05ad90b0
# container <name> <parent_name>
container xeyes root
auth MIT-MAGIC-COOKIE-1 46f8e62b78e58962de0ceefc05ad90b8
auth MIT-MAGIC-COOKIE-1 46f8e62b78e58962de0ceefc05ad90a8
allow mouse-motion
allow shape
allow xinput
container xclock root
auth MIT-MAGIC-COOKIE-1 46f8e62b78e58962de0ceefc05ad90b7
auth MIT-MAGIC-COOKIE-1 46f8e62b78e58962de0ceefc05ad91b7
auth MIT-MAGIC-COOKIE-1 46f8e62b78e58962de0ceefc05ad92b7
auth MIT-MAGIC-COOKIE-1 46f8e62b78e58962de0ceefc05ad93b7

View File

@ -32,6 +32,11 @@ Equipment Corporation.
#include <X11/extensions/panoramiXproto.h>
#include "dix/dix_priv.h"
#include "dix/resource_priv.h"
#include "dix/screen_hooks_priv.h"
#include "miext/extinit_priv.h"
#include "Xext/panoramiX.h"
#include "Xext/panoramiXsrv.h"
#include "misc.h"
#include "cursor.h"
@ -44,18 +49,13 @@ Equipment Corporation.
#include "window.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "panoramiX.h"
#include "panoramiXsrv.h"
#include "globals.h"
#include "servermd.h"
#include "resource.h"
#include "picturestr_priv.h"
#include "xfixesint.h"
#include "damageextint.h"
#ifdef COMPOSITE
#include "compint.h"
#endif
#include "extinit_priv.h"
#include "protocol-versions.h"
#ifdef GLXPROXY
@ -74,7 +74,7 @@ int PanoramiXPixWidth = 0;
int PanoramiXPixHeight = 0;
int PanoramiXNumScreens = 0;
_X_EXPORT RegionRec PanoramiXScreenRegion = { {0, 0, 0, 0}, NULL };
RegionRec PanoramiXScreenRegion = { {0, 0, 0, 0}, NULL };
static int PanoramiXNumDepths;
static DepthPtr PanoramiXDepths;
@ -88,7 +88,7 @@ RESTYPE XRT_GC;
RESTYPE XRT_COLORMAP;
static Bool VisualsEqual(VisualPtr, ScreenPtr, VisualPtr);
XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr = &VisualsEqual;
static XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr = &VisualsEqual;
/*
* Function prototypes
@ -123,7 +123,6 @@ typedef struct {
typedef struct {
CreateGCProcPtr CreateGC;
CloseScreenProcPtr CloseScreen;
} PanoramiXScreenRec, *PanoramiXScreenPtr;
static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr);
@ -148,21 +147,23 @@ static const GCFuncs XineramaGCFuncs = {
pGCPriv->wrapFuncs = (pGC)->funcs;\
(pGC)->funcs = &XineramaGCFuncs;
static Bool
XineramaCloseScreen(ScreenPtr pScreen)
static void XineramaCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unsused)
{
dixScreenUnhookClose(pScreen, XineramaCloseScreen);
PanoramiXScreenPtr pScreenPriv = (PanoramiXScreenPtr)
dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
if (!pScreenPriv)
return;
pScreen->CreateGC = pScreenPriv->CreateGC;
if (pScreen->myNum == 0)
RegionUninit(&PanoramiXScreenRegion);
free(pScreenPriv);
return (*pScreen->CloseScreen) (pScreen);
dixSetPrivate(&pScreen->devPrivates, PanoramiXScreenKey, NULL);
}
static Bool
@ -352,7 +353,7 @@ PanoramiXFindIDByScrnum(RESTYPE type, XID id, int screen)
data.screen = screen;
data.id = id;
return LookupClientResourceComplex(clients[CLIENT_ID(id)], type,
return LookupClientResourceComplex(dixClientForXID(id), type,
XineramaFindIDByScrnum, &data);
}
@ -368,7 +369,7 @@ XineramaRegisterConnectionBlockCallback(void (*func) (void))
{
XineramaConnectionCallbackList *newlist;
if (!(newlist = malloc(sizeof(XineramaConnectionCallbackList))))
if (!(newlist = calloc(1, sizeof(XineramaConnectionCallbackList))))
return FALSE;
newlist->next = ConnectionCallbackList;
@ -384,7 +385,7 @@ XineramaInitData(void)
int i, w, h;
RegionNull(&PanoramiXScreenRegion);
FOR_NSCREENS(i) {
FOR_NSCREENS_BACKWARD(i) {
BoxRec TheBox;
RegionRec ScreenRegion;
@ -418,13 +419,6 @@ XineramaInitData(void)
}
}
void
XineramaReinitData(void)
{
RegionUninit(&PanoramiXScreenRegion);
XineramaInitData();
}
/*
* PanoramiXExtensionInit():
* Called from InitExtensions in main().
@ -439,7 +433,6 @@ PanoramiXExtensionInit(void)
Bool success = FALSE;
ExtensionEntry *extEntry;
ScreenPtr pScreen = screenInfo.screens[0];
PanoramiXScreenPtr pScreenPriv;
if (noPanoramiXExtension)
return;
@ -474,9 +467,9 @@ PanoramiXExtensionInit(void)
* run in non-PanoramiXeen mode.
*/
FOR_NSCREENS(i) {
FOR_NSCREENS_BACKWARD(i) {
pScreen = screenInfo.screens[i];
pScreenPriv = malloc(sizeof(PanoramiXScreenRec));
PanoramiXScreenPtr pScreenPriv = calloc(1, sizeof(PanoramiXScreenRec));
dixSetPrivate(&pScreen->devPrivates, PanoramiXScreenKey,
pScreenPriv);
if (!pScreenPriv) {
@ -484,11 +477,10 @@ PanoramiXExtensionInit(void)
return;
}
pScreenPriv->CreateGC = pScreen->CreateGC;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
dixScreenHookClose(pScreen, XineramaCloseScreen);
pScreenPriv->CreateGC = pScreen->CreateGC;
pScreen->CreateGC = XineramaCreateGC;
pScreen->CloseScreen = XineramaCloseScreen;
}
XRC_DRAWABLE = CreateNewResourceClass();
@ -584,10 +576,7 @@ PanoramiXExtensionInit(void)
PanoramiXRenderInit();
PanoramiXFixesInit();
PanoramiXDamageInit();
#ifdef COMPOSITE
PanoramiXCompositeInit();
#endif
}
Bool
@ -806,7 +795,6 @@ extern void
PanoramiXConsolidate(void)
{
int i;
PanoramiXRes *root, *defmap, *saver;
ScreenPtr pScreen = screenInfo.screens[0];
DepthPtr pDepth = pScreen->allowedDepths;
VisualPtr pVisual = pScreen->visuals;
@ -820,14 +808,26 @@ PanoramiXConsolidate(void)
for (i = 0; i < pScreen->numVisuals; i++)
PanoramiXMaybeAddVisual(pVisual++);
root = malloc(sizeof(PanoramiXRes));
PanoramiXRes *root = calloc(1, sizeof(PanoramiXRes));
if (!root)
return;
root->type = XRT_WINDOW;
defmap = malloc(sizeof(PanoramiXRes));
PanoramiXRes *defmap = calloc(1, sizeof(PanoramiXRes));
if (!defmap) {
free(root);
return;
}
defmap->type = XRT_COLORMAP;
saver = malloc(sizeof(PanoramiXRes));
PanoramiXRes *saver = calloc(1, sizeof(PanoramiXRes));
if (!saver) {
free(root);
free(defmap);
return;
}
saver->type = XRT_WINDOW;
FOR_NSCREENS(i) {
FOR_NSCREENS_BACKWARD(i) {
ScreenPtr scr = screenInfo.screens[i];
root->info[i].id = scr->root->drawable.id;
@ -889,9 +889,7 @@ PanoramiXResetProc(ExtensionEntry * extEntry)
PanoramiXRenderReset();
PanoramiXFixesReset();
PanoramiXDamageReset();
#ifdef COMPOSITE
PanoramiXCompositeReset ();
#endif
screenInfo.numScreens = PanoramiXNumScreens;
for (i = 256; i--;)
ProcVector[i] = SavedProcVector[i];
@ -1072,7 +1070,7 @@ ProcXineramaQueryScreens(ClientPtr client)
xXineramaScreenInfo scratch;
int i;
FOR_NSCREENS(i) {
FOR_NSCREENS_BACKWARD(i) {
scratch.x_org = screenInfo.screens[i]->x;
scratch.y_org = screenInfo.screens[i]->y;
scratch.width = screenInfo.screens[i]->width;
@ -1171,7 +1169,7 @@ XineramaGetImageData(DrawablePtr *pDrawables,
depth = (format == XYPixmap) ? 1 : pDraw->depth;
FOR_NSCREENS(i) {
FOR_NSCREENS_BACKWARD(i) {
BoxRec TheBox;
ScreenPtr pScreen;
@ -1253,12 +1251,16 @@ XineramaGetImageData(DrawablePtr *pDrawables,
for (j = 0, index = (pitch * y) + x, index2 = 0; j < h;
j++, index += pitch, index2 += ScratchPitch) {
if (w) {
if (!shift)
if (!shift) {
assert(ScratchMem);
memcpy(data + index, ScratchMem + index2, w);
else
}
else {
assert(ScratchMem);
CopyBits(data + index, shift,
ScratchMem + index2, w);
}
}
if (leftover) {
data[index + w] |=
@ -1277,6 +1279,7 @@ XineramaGetImageData(DrawablePtr *pDrawables,
w *= j;
for (j = 0; j < h; j++) {
assert(ScratchMem);
memcpy(data + (pitch * (y + j)) + x,
ScratchMem + (ScratchPitch * j), w);
}

View File

@ -32,13 +32,12 @@ Equipment Corporation.
* PanoramiX definitions
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _PANORAMIX_H_
#define _PANORAMIX_H_
#include <X11/Xmd.h>
#include <X11/extensions/panoramiXproto.h>
#include "gcstruct.h"
@ -70,7 +69,6 @@ typedef struct {
#define FOR_NSCREENS_FORWARD(j) for(j = 0; j < PanoramiXNumScreens; j++)
#define FOR_NSCREENS_FORWARD_SKIP(j) for(j = 1; j < PanoramiXNumScreens; j++)
#define FOR_NSCREENS_BACKWARD(j) for(j = PanoramiXNumScreens - 1; j >= 0; j--)
#define FOR_NSCREENS(j) FOR_NSCREENS_FORWARD(j)
#define IS_SHARED_PIXMAP(r) (((r)->type == XRT_PIXMAP) && (r)->u.pix.shared)

View File

@ -28,6 +28,11 @@ Equipment Corporation.
#include <stdio.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/panoramiXproto.h>
#include "Xext/panoramiX.h"
#include "Xext/panoramiXsrv.h"
#include "misc.h"
#include "cursor.h"
#include "cursorstr.h"
@ -39,9 +44,6 @@ Equipment Corporation.
#include "window.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "panoramiX.h"
#include <X11/extensions/panoramiXproto.h>
#include "panoramiXsrv.h"
#include "globals.h"
#include "panoramiXh.h"

View File

@ -33,19 +33,18 @@ Equipment Corporation.
#include "dix/dix_priv.h"
#include "os/osdep.h"
#include "Xext/panoramiX.h"
#include "Xext/panoramiXsrv.h"
#include "windowstr.h"
#include "dixfontstr.h"
#include "gcstruct.h"
#include "colormapst.h"
#include "scrnintstr.h"
#include "opaque.h"
#include "inputstr.h"
#include "migc.h"
#include "misc.h"
#include "dixstruct.h"
#include "panoramiX.h"
#include "panoramiXsrv.h"
#include "resource.h"
#include "panoramiXh.h"
@ -117,7 +116,7 @@ PanoramiXCreateWindow(ClientPtr client)
}
}
if (!(newWin = malloc(sizeof(PanoramiXRes))))
if (!(newWin = calloc(1, sizeof(PanoramiXRes))))
return BadAlloc;
newWin->type = XRT_WINDOW;
@ -557,7 +556,6 @@ PanoramiXCirculateWindow(ClientPtr client)
int
PanoramiXGetGeometry(ClientPtr client)
{
xGetGeometryReply rep;
DrawablePtr pDraw;
int rc;
@ -568,7 +566,7 @@ PanoramiXGetGeometry(ClientPtr client)
if (rc != Success)
return rc;
rep = (xGetGeometryReply) {
xGetGeometryReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
@ -602,7 +600,16 @@ PanoramiXGetGeometry(ClientPtr client)
rep.borderWidth = pWin->borderWidth;
}
WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.root);
swaps(&rep.x);
swaps(&rep.y);
swaps(&rep.width);
swaps(&rep.height);
swaps(&rep.borderWidth);
}
WriteToClient(client, sizeof(xGetGeometryReply), &rep);
return Success;
}
@ -614,7 +621,6 @@ PanoramiXTranslateCoords(ClientPtr client)
REQUEST(xTranslateCoordsReq);
int rc;
WindowPtr pWin, pDst;
xTranslateCoordsReply rep;
REQUEST_SIZE_MATCH(xTranslateCoordsReq);
rc = dixLookupWindow(&pWin, stuff->srcWid, client, DixReadAccess);
@ -623,7 +629,8 @@ PanoramiXTranslateCoords(ClientPtr client)
rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess);
if (rc != Success)
return rc;
rep = (xTranslateCoordsReply) {
xTranslateCoordsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
@ -674,7 +681,13 @@ PanoramiXTranslateCoords(ClientPtr client)
rep.dstY += screenInfo.screens[0]->y;
}
WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.child);
swaps(&rep.dstX);
swaps(&rep.dstY);
}
WriteToClient(client, sizeof(rep), &rep);
return Success;
}
@ -694,7 +707,7 @@ PanoramiXCreatePixmap(ClientPtr client)
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
if (!(newPix = malloc(sizeof(PanoramiXRes))))
if (!(newPix = calloc(1, sizeof(PanoramiXRes))))
return BadAlloc;
newPix->type = XRT_PIXMAP;
@ -801,7 +814,7 @@ PanoramiXCreateGC(ClientPtr client)
}
}
if (!(newGC = malloc(sizeof(PanoramiXRes))))
if (!(newGC = calloc(1, sizeof(PanoramiXRes))))
return BadAlloc;
newGC->type = XRT_GC;
@ -917,7 +930,7 @@ PanoramiXCopyGC(ClientPtr client)
if (result != Success)
return result;
FOR_NSCREENS(j) {
FOR_NSCREENS_BACKWARD(j) {
stuff->srcGC = srcGC->info[j].id;
stuff->dstGC = dstGC->info[j].id;
result = (*SavedProcVector[X_CopyGC]) (client);
@ -1098,11 +1111,11 @@ PanoramiXCopyArea(ClientPtr client)
if ((dst->type == XRT_PIXMAP) && (src->type == XRT_WINDOW)) {
DrawablePtr drawables[MAXSCREENS];
DrawablePtr pDst;
GCPtr pGC;
GCPtr pGC = NULL;
char *data;
int pitch, rc;
FOR_NSCREENS(j) {
FOR_NSCREENS_BACKWARD(j) {
rc = dixLookupDrawable(drawables + j, src->info[j].id, client, 0,
DixGetAttrAccess);
if (rc != Success)
@ -1136,7 +1149,7 @@ PanoramiXCopyArea(ClientPtr client)
}
free(data);
if (pGC->graphicsExposures) {
if (pGC && pGC->graphicsExposures) {
RegionRec rgn;
int dx, dy;
BoxRec sourceBox;
@ -1156,7 +1169,7 @@ PanoramiXCopyArea(ClientPtr client)
RegionInit(&rgn, &sourceBox, 1);
/* subtract the (screen-space) clips of the source drawables */
FOR_NSCREENS(j) {
FOR_NSCREENS_BACKWARD(j) {
ScreenPtr screen = screenInfo.screens[j];
RegionPtr sd;
@ -1374,7 +1387,6 @@ PanoramiXPolyPoint(ClientPtr client)
{
PanoramiXRes *gc, *draw;
int result, npoint, j;
xPoint *origPts;
Bool isRoot;
REQUEST(xPolyPointReq);
@ -1397,7 +1409,10 @@ PanoramiXPolyPoint(ClientPtr client)
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyPointReq));
if (npoint > 0) {
origPts = xallocarray(npoint, sizeof(xPoint));
xPoint *origPts = calloc(npoint, sizeof(xPoint));
if (!origPts)
return BadAlloc;
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
FOR_NSCREENS_FORWARD(j) {
@ -1439,7 +1454,6 @@ PanoramiXPolyLine(ClientPtr client)
{
PanoramiXRes *gc, *draw;
int result, npoint, j;
xPoint *origPts;
Bool isRoot;
REQUEST(xPolyLineReq);
@ -1462,7 +1476,9 @@ PanoramiXPolyLine(ClientPtr client)
isRoot = IS_ROOT_DRAWABLE(draw);
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq));
if (npoint > 0) {
origPts = xallocarray(npoint, sizeof(xPoint));
xPoint *origPts = calloc(npoint, sizeof(xPoint));
if (!origPts)
return BadAlloc;
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
FOR_NSCREENS_FORWARD(j) {
@ -1504,7 +1520,6 @@ PanoramiXPolySegment(ClientPtr client)
{
int result, nsegs, i, j;
PanoramiXRes *gc, *draw;
xSegment *origSegs;
Bool isRoot;
REQUEST(xPolySegmentReq);
@ -1531,7 +1546,9 @@ PanoramiXPolySegment(ClientPtr client)
return BadLength;
nsegs >>= 3;
if (nsegs > 0) {
origSegs = xallocarray(nsegs, sizeof(xSegment));
xSegment *origSegs = calloc(nsegs, sizeof(xSegment));
if (!origSegs)
return BadAlloc;
memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
FOR_NSCREENS_FORWARD(j) {
@ -1573,7 +1590,6 @@ PanoramiXPolyRectangle(ClientPtr client)
int result, nrects, i, j;
PanoramiXRes *gc, *draw;
Bool isRoot;
xRectangle *origRecs;
REQUEST(xPolyRectangleReq);
@ -1599,7 +1615,9 @@ PanoramiXPolyRectangle(ClientPtr client)
return BadLength;
nrects >>= 3;
if (nrects > 0) {
origRecs = xallocarray(nrects, sizeof(xRectangle));
xRectangle *origRecs = calloc(nrects, sizeof(xRectangle));
if (!origRecs)
return BadAlloc;
memcpy((char *) origRecs, (char *) &stuff[1],
nrects * sizeof(xRectangle));
FOR_NSCREENS_FORWARD(j) {
@ -1640,7 +1658,6 @@ PanoramiXPolyArc(ClientPtr client)
int result, narcs, i, j;
PanoramiXRes *gc, *draw;
Bool isRoot;
xArc *origArcs;
REQUEST(xPolyArcReq);
@ -1666,7 +1683,9 @@ PanoramiXPolyArc(ClientPtr client)
return BadLength;
narcs /= sizeof(xArc);
if (narcs > 0) {
origArcs = xallocarray(narcs, sizeof(xArc));
xArc *origArcs = calloc(narcs, sizeof(xArc));
if (!origArcs)
return BadAlloc;
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
FOR_NSCREENS_FORWARD(j) {
@ -1705,7 +1724,6 @@ PanoramiXFillPoly(ClientPtr client)
int result, count, j;
PanoramiXRes *gc, *draw;
Bool isRoot;
DDXPointPtr locPts;
REQUEST(xFillPolyReq);
@ -1728,7 +1746,9 @@ PanoramiXFillPoly(ClientPtr client)
count = bytes_to_int32((client->req_len << 2) - sizeof(xFillPolyReq));
if (count > 0) {
locPts = xallocarray(count, sizeof(DDXPointRec));
DDXPointPtr locPts = calloc(count, sizeof(DDXPointRec));
if (!locPts)
return BadAlloc;
memcpy((char *) locPts, (char *) &stuff[1],
count * sizeof(DDXPointRec));
FOR_NSCREENS_FORWARD(j) {
@ -1771,8 +1791,6 @@ PanoramiXPolyFillRectangle(ClientPtr client)
int result, things, i, j;
PanoramiXRes *gc, *draw;
Bool isRoot;
xRectangle *origRects;
REQUEST(xPolyFillRectangleReq);
REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
@ -1797,7 +1815,9 @@ PanoramiXPolyFillRectangle(ClientPtr client)
return BadLength;
things >>= 3;
if (things > 0) {
origRects = xallocarray(things, sizeof(xRectangle));
xRectangle *origRects = calloc(things, sizeof(xRectangle));
if (!origRects)
return BadAlloc;
memcpy((char *) origRects, (char *) &stuff[1],
things * sizeof(xRectangle));
FOR_NSCREENS_FORWARD(j) {
@ -1838,7 +1858,6 @@ PanoramiXPolyFillArc(ClientPtr client)
PanoramiXRes *gc, *draw;
Bool isRoot;
int result, narcs, i, j;
xArc *origArcs;
REQUEST(xPolyFillArcReq);
@ -1864,7 +1883,9 @@ PanoramiXPolyFillArc(ClientPtr client)
return BadLength;
narcs /= sizeof(xArc);
if (narcs > 0) {
origArcs = xallocarray(narcs, sizeof(xArc));
xArc *origArcs = calloc(narcs, sizeof(xArc));
if (!origArcs)
return BadAlloc;
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
FOR_NSCREENS_FORWARD(j) {
@ -1946,7 +1967,6 @@ PanoramiXGetImage(ClientPtr client)
DrawablePtr drawables[MAXSCREENS];
DrawablePtr pDraw;
PanoramiXRes *draw;
xGetImageReply xgi;
Bool isRoot;
char *pBuf;
int i, x, y, w, h, format, rc;
@ -2020,12 +2040,7 @@ PanoramiXGetImage(ClientPtr client)
IncludeInferiors);
}
xgi = (xGetImageReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.visual = wVisual(((WindowPtr) pDraw)),
.depth = pDraw->depth
};
if (format == ZPixmap) {
widthBytesLine = PixmapBytePad(w, pDraw->depth);
length = widthBytesLine * h;
@ -2039,7 +2054,13 @@ PanoramiXGetImage(ClientPtr client)
}
xgi.length = bytes_to_int32(length);
xGetImageReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.visual = wVisual(((WindowPtr) pDraw)),
.depth = pDraw->depth,
.length = bytes_to_int32(length),
};
if (widthBytesLine == 0 || h == 0)
linesPerBuf = 0;
@ -2050,10 +2071,15 @@ PanoramiXGetImage(ClientPtr client)
if (linesPerBuf > h)
linesPerBuf = h;
}
if (!(pBuf = xallocarray(linesPerBuf, widthBytesLine)))
if (!(pBuf = calloc(linesPerBuf, widthBytesLine)))
return BadAlloc;
WriteReplyToClient(client, sizeof(xGetImageReply), &xgi);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.visual);
}
WriteToClient(client, sizeof(rep), &rep);
if (linesPerBuf == 0) {
/* nothing to do */
@ -2289,7 +2315,7 @@ PanoramiXCreateColormap(ClientPtr client)
if (result != Success)
return result;
if (!(newCmap = malloc(sizeof(PanoramiXRes))))
if (!(newCmap = calloc(1, sizeof(PanoramiXRes))))
return BadAlloc;
newCmap->type = XRT_COLORMAP;
@ -2361,7 +2387,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
if (result != Success)
return result;
if (!(newCmap = malloc(sizeof(PanoramiXRes))))
if (!(newCmap = calloc(1, sizeof(PanoramiXRes))))
return BadAlloc;
newCmap->type = XRT_COLORMAP;

View File

@ -1,34 +1,31 @@
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _PANORAMIXSRV_H_
#define _PANORAMIXSRV_H_
#include "panoramiX.h"
extern _X_EXPORT int PanoramiXNumScreens;
extern _X_EXPORT int PanoramiXPixWidth;
extern _X_EXPORT int PanoramiXPixHeight;
extern _X_EXPORT RegionRec PanoramiXScreenRegion;
extern int PanoramiXNumScreens;
extern int PanoramiXPixWidth;
extern int PanoramiXPixHeight;
extern RegionRec PanoramiXScreenRegion;
extern _X_EXPORT VisualID PanoramiXTranslateVisualID(int screen, VisualID orig);
extern _X_EXPORT void PanoramiXConsolidate(void);
extern _X_EXPORT Bool PanoramiXCreateConnectionBlock(void);
extern _X_EXPORT PanoramiXRes *PanoramiXFindIDByScrnum(RESTYPE, XID, int);
extern _X_EXPORT Bool
XineramaRegisterConnectionBlockCallback(void (*func) (void));
extern _X_EXPORT int XineramaDeleteResource(void *, XID);
extern _X_EXPORT void XineramaReinitData(void);
VisualID PanoramiXTranslateVisualID(int screen, VisualID orig);
void PanoramiXConsolidate(void);
Bool PanoramiXCreateConnectionBlock(void);
PanoramiXRes *PanoramiXFindIDByScrnum(RESTYPE, XID, int);
Bool XineramaRegisterConnectionBlockCallback(void (*func) (void));
int XineramaDeleteResource(void *, XID);
/* only exported for Nvidia legacy. This really shouldn't be used by drivers */
extern _X_EXPORT RESTYPE XRC_DRAWABLE;
extern _X_EXPORT RESTYPE XRT_WINDOW;
extern _X_EXPORT RESTYPE XRT_PIXMAP;
extern _X_EXPORT RESTYPE XRT_GC;
extern _X_EXPORT RESTYPE XRT_COLORMAP;
extern _X_EXPORT RESTYPE XRT_PICTURE;
extern RESTYPE XRT_WINDOW;
extern RESTYPE XRT_PIXMAP;
extern RESTYPE XRT_GC;
extern RESTYPE XRT_COLORMAP;
extern RESTYPE XRT_PICTURE;
/*
* Drivers are allowed to wrap this function. Each wrapper can decide that the
@ -38,9 +35,8 @@ extern _X_EXPORT RESTYPE XRT_PICTURE;
* screen 0.
*/
typedef Bool (*XineramaVisualsEqualProcPtr) (VisualPtr, ScreenPtr, VisualPtr);
extern _X_EXPORT XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr;
extern _X_EXPORT void XineramaGetImageData(DrawablePtr *pDrawables,
void XineramaGetImageData(DrawablePtr *pDrawables,
int left,
int top,
int width,

View File

@ -36,8 +36,12 @@ in this Software without prior written authorization from the X Consortium.
#include "dix/colormap_priv.h"
#include "dix/cursor_priv.h"
#include "dix/dix_priv.h"
#include "dix/window_priv.h"
#include "miext/extinit_priv.h"
#include "os/osdep.h"
#include "os/screensaver.h"
#include "Xext/panoramiX.h"
#include "Xext/panoramiXsrv.h"
#include "misc.h"
#include "os.h"
@ -49,23 +53,13 @@ in this Software without prior written authorization from the X Consortium.
#include "resource.h"
#include "gcstruct.h"
#include "cursorstr.h"
#include "colormapst.h"
#include "xace.h"
#include "inputstr.h"
#ifdef XINERAMA
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
#ifdef DPMSExtension
#include <X11/extensions/dpmsconst.h>
#include "dpmsproc.h"
#endif
#include "protocol-versions.h"
#include "extinit_priv.h"
// temporary workaround for win32/mingw32 name clash
// see: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355
#undef CreateWindow
Bool noScreenSaverExtension = FALSE;
@ -476,7 +470,7 @@ CreateSaverWindow(ScreenPtr pScreen)
if (GrabInProgress && GrabInProgress != pAttr->client->index)
return FALSE;
pWin = CreateWindow(pSaver->wid, pScreen->root,
pWin = dixCreateWindow(pSaver->wid, pScreen->root,
pAttr->x, pAttr->y, pAttr->width, pAttr->height,
pAttr->borderWidth, pAttr->class,
pAttr->mask, (XID *) pAttr->values,
@ -501,13 +495,11 @@ CreateSaverWindow(ScreenPtr pScreen)
mask |= CWBorderPixmap;
}
if (pAttr->pCursor) {
CursorPtr cursor;
if (!pWin->optional)
if (!MakeWindowOptional(pWin)) {
FreeResource(pWin->drawable.id, X11_RESTYPE_NONE);
return FALSE;
}
cursor = RefCursor(pAttr->pCursor);
CursorPtr cursor = RefCursor(pAttr->pCursor);
if (pWin->optional->cursor)
FreeCursor(pWin->optional->cursor, (Cursor) 0);
pWin->optional->cursor = cursor;
@ -757,7 +749,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
depth = stuff->depth;
visual = stuff->visualID;
/* copied directly from CreateWindow */
/* copied directly from dixCreateWindow */
if (class == CopyFromParent)
class = pParent->drawable.class;
@ -810,7 +802,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
return BadMatch;
}
/* end of errors from CreateWindow */
/* end of errors from dixCreateWindow */
pPriv = GetScreenPrivate(pScreen);
if (pPriv && pPriv->attr) {
@ -828,7 +820,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
goto bail;
}
/* over allocate for override redirect */
pAttr->values = values = xallocarray(len + 1, sizeof(unsigned long));
pAttr->values = values = calloc(len + 1, sizeof(unsigned long));
if (!values) {
ret = BadAlloc;
goto bail;
@ -1217,7 +1209,7 @@ ProcScreenSaverSuspend(ClientPtr client)
* to the record, so the screensaver will be re-enabled and the record freed
* if the client disconnects without reenabling it first.
*/
this = malloc(sizeof(ScreenSaverSuspensionRec));
this = calloc(1, sizeof(ScreenSaverSuspensionRec));
if (!this)
return BadAlloc;

View File

@ -32,7 +32,8 @@ in this Software without prior written authorization from The Open Group.
#include "dix/dix_priv.h"
#include "dix/registry_priv.h"
#include "include/extinit_priv.h"
#include "dix/resource_priv.h"
#include "miext/extinit_priv.h"
#include "os/audit.h"
#include "os/auth.h"
#include "os/client_priv.h"
@ -42,11 +43,9 @@ in this Software without prior written authorization from The Open Group.
#include "inputstr.h"
#include "windowstr.h"
#include "propertyst.h"
#include "colormapst.h"
#include "privates.h"
#include "xacestr.h"
#include "securitysrv.h"
#include "extinit.h"
#include "protocol-versions.h"
Bool noSecurityExtension = FALSE;
@ -207,7 +206,7 @@ SecurityDeleteAuthorization(void *value, XID id)
.type = SecurityEventBase + XSecurityAuthorizationRevoked,
.authId = pAuth->id
};
WriteEventsToClient(rClient(pEventClient), 1, (xEvent *) &are);
WriteEventsToClient(dixClientForOtherClients(pEventClient), 1, (xEvent *) &are);
FreeResource(pEventClient->resource, X11_RESTYPE_NONE);
}
@ -385,7 +384,7 @@ SecurityEventSelectForAuthorization(SecurityAuthorizationPtr pAuth,
}
}
pEventClient = malloc(sizeof(OtherClients));
pEventClient = calloc(1, sizeof(OtherClients));
if (!pEventClient)
return BadAlloc;
pEventClient->mask = mask;
@ -406,7 +405,6 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
REQUEST(xSecurityGenerateAuthorizationReq);
int len; /* request length in CARD32s */
Bool removeAuth = FALSE; /* if bailout, call RemoveAuthorization? */
SecurityAuthorizationPtr pAuth = NULL; /* auth we are creating */
int err; /* error to return from this function */
XID authId; /* authorization ID assigned by os layer */
xSecurityGenerateAuthorizationReply rep; /* reply struct */
@ -492,9 +490,8 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
authId = GenerateAuthorization(stuff->nbytesAuthProto, protoname,
stuff->nbytesAuthData, protodata,
&authdata_len, &pAuthdata);
if ((XID) ~0L == authId) {
err = SecurityErrorBase + XSecurityBadAuthorizationProtocol;
goto bailout;
if (!authId) {
return SecurityErrorBase + XSecurityBadAuthorizationProtocol;
}
/* now that we've added the auth, remember to remove it if we have to
@ -504,7 +501,7 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
/* associate additional information with this auth ID */
pAuth = malloc(sizeof(SecurityAuthorizationRec));
SecurityAuthorizationPtr pAuth = calloc(1, sizeof(SecurityAuthorizationRec));
if (!pAuth) {
err = BadAlloc;
goto bailout;
@ -744,7 +741,6 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
{
XaceResourceAccessRec *rec = calldata;
SecurityStateRec *subj, *obj;
int cid = CLIENT_ID(rec->id);
Mask requested = rec->access_mode;
Mask allowed = SecurityResourceMask;
@ -759,8 +755,12 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
if (rec->rtype == X11_RESTYPE_WINDOW)
allowed |= SecurityWindowExtraMask;
ClientPtr owner = dixClientForXID(rec->id);
if (!owner)
goto denied;
/* special checks for server-owned resources */
if (cid == 0) {
if (dixResouceIsServerOwned(rec->id)) {
if (rec->rtype & RC_DRAWABLE)
/* additional operations allowed on root windows */
allowed |= SecurityRootWindowExtraMask;
@ -774,15 +774,15 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
allowed |= DixReadAccess;
}
if (clients[cid] != NULL) {
obj = dixLookupPrivate(&clients[cid]->devPrivates, stateKey);
obj = dixLookupPrivate(&owner->devPrivates, stateKey);
if (SecurityDoCheck(subj, obj, requested, allowed) == Success)
return;
}
denied:
SecurityAudit("Security: denied client %d access %lx to resource 0x%lx "
"of client %d on request %s\n", rec->client->index,
(unsigned long)requested, (unsigned long)rec->id, cid,
(unsigned long)requested, (unsigned long)rec->id,
dixClientIdForXID(rec->id),
SecurityLookupRequestName(rec->client));
rec->status = BadAccess; /* deny access */
}
@ -858,13 +858,13 @@ SecurityProperty(CallbackListPtr *pcbl, void *unused, void *calldata)
Mask allowed = SecurityResourceMask | DixReadAccess;
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
obj = dixLookupPrivate(&wClient(rec->pWin)->devPrivates, stateKey);
obj = dixLookupPrivate(&dixClientForWindow(rec->pWin)->devPrivates, stateKey);
if (SecurityDoCheck(subj, obj, requested, allowed) != Success) {
SecurityAudit("Security: denied client %d access to property %s "
"(atom 0x%x) window 0x%lx of client %d on request %s\n",
rec->client->index, NameForAtom(name), name,
(unsigned long)rec->pWin->drawable.id, wClient(rec->pWin)->index,
(unsigned long)rec->pWin->drawable.id, dixClientForWindow(rec->pWin)->index,
SecurityLookupRequestName(rec->client));
rec->status = BadAccess;
}
@ -880,7 +880,7 @@ SecuritySend(CallbackListPtr *pcbl, void *unused, void *calldata)
int i;
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
obj = dixLookupPrivate(&wClient(rec->pWin)->devPrivates, stateKey);
obj = dixLookupPrivate(&dixClientForWindow(rec->pWin)->devPrivates, stateKey);
if (SecurityDoCheck(subj, obj, DixSendAccess, 0) == Success)
return;
@ -895,7 +895,7 @@ SecuritySend(CallbackListPtr *pcbl, void *unused, void *calldata)
rec->client->index,
LookupEventName(rec->events[i].u.u.type),
(unsigned long)rec->pWin->drawable.id,
wClient(rec->pWin)->index);
dixClientForWindow(rec->pWin)->index);
rec->status = BadAccess;
return;
}
@ -909,7 +909,7 @@ SecurityReceive(CallbackListPtr *pcbl, void *unused, void *calldata)
SecurityStateRec *subj, *obj;
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
obj = dixLookupPrivate(&wClient(rec->pWin)->devPrivates, stateKey);
obj = dixLookupPrivate(&dixClientForWindow(rec->pWin)->devPrivates, stateKey);
if (SecurityDoCheck(subj, obj, DixReceiveAccess, 0) == Success)
return;
@ -917,7 +917,7 @@ SecurityReceive(CallbackListPtr *pcbl, void *unused, void *calldata)
SecurityAudit("Security: denied client %d from receiving an event "
"sent to window 0x%lx of client %d\n",
rec->client->index, (unsigned long)rec->pWin->drawable.id,
wClient(rec->pWin)->index);
dixClientForWindow(rec->pWin)->index);
rec->status = BadAccess;
}

View File

@ -33,7 +33,6 @@ from The Open Group.
#include <X11/extensions/secur.h>
#include "input.h" /* for DeviceIntPtr */
#include "property.h" /* for PropertyPtr */
#include "pixmap.h" /* for DrawablePtr */
#include "resource.h" /* for RESTYPE */

View File

@ -33,6 +33,10 @@ in this Software without prior written authorization from The Open Group.
#include "dix/dix_priv.h"
#include "dix/gc_priv.h"
#include "dix/window_priv.h"
#include "miext/extinit_priv.h"
#include "Xext/panoramiX.h"
#include "Xext/panoramiXsrv.h"
#include "misc.h"
#include "os.h"
@ -45,7 +49,6 @@ in this Software without prior written authorization from The Open Group.
#include "opaque.h"
#include "regionstr.h"
#include "gcstruct.h"
#include "extinit_priv.h"
#include "protocol-versions.h"
Bool noShapeExtension = FALSE;
@ -67,11 +70,6 @@ static void SShapeNotifyEvent(xShapeNotifyEvent * /* from */ ,
* externally by the Xfixes extension and are now defined in window.h
*/
#ifdef XINERAMA
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
static int ShapeEventBase = 0;
static RESTYPE ClientType, ShapeEventType; /* resource types for event masks */
@ -270,8 +268,9 @@ ShapeRectangles(ClientPtr client, xShapeRectanglesReq *stuff)
return BadMatch;
srcRgn = RegionFromRects(nrects, prects, ctype);
if (!pWin->optional)
MakeWindowOptional(pWin);
if (!MakeWindowOptional(pWin))
return BadAlloc;
switch (stuff->destKind) {
case ShapeBounding:
destRgn = &pWin->optional->boundingShape;
@ -309,7 +308,7 @@ ProcShapeRectangles(ClientPtr client)
if (result != Success)
return result;
FOR_NSCREENS(j) {
FOR_NSCREENS_BACKWARD(j) {
stuff->dest = win->info[j].id;
result = ShapeRectangles(client, stuff);
if (result != Success)
@ -366,8 +365,9 @@ ShapeMask(ClientPtr client, xShapeMaskReq *stuff)
return BadAlloc;
}
if (!pWin->optional)
MakeWindowOptional(pWin);
if (!MakeWindowOptional(pWin))
return BadAlloc;
switch (stuff->destKind) {
case ShapeBounding:
destRgn = &pWin->optional->boundingShape;
@ -414,7 +414,7 @@ ProcShapeMask(ClientPtr client)
else
pmap = NULL;
FOR_NSCREENS(j) {
FOR_NSCREENS_BACKWARD(j) {
stuff->dest = win->info[j].id;
if (pmap)
stuff->src = pmap->info[j].id;
@ -443,8 +443,9 @@ ShapeCombine(ClientPtr client, xShapeCombineReq *stuff)
rc = dixLookupWindow(&pDestWin, stuff->dest, client, DixSetAttrAccess);
if (rc != Success)
return rc;
if (!pDestWin->optional)
MakeWindowOptional(pDestWin);
if (!MakeWindowOptional(pDestWin))
return BadAlloc;
switch (stuff->destKind) {
case ShapeBounding:
createDefault = CreateBoundingShape;
@ -492,8 +493,9 @@ ShapeCombine(ClientPtr client, xShapeCombineReq *stuff)
else
srcRgn = (*createSrc) (pSrcWin);
if (!pDestWin->optional)
MakeWindowOptional(pDestWin);
if (!MakeWindowOptional(pDestWin))
return BadAlloc;
switch (stuff->destKind) {
case ShapeBounding:
destRgn = &pDestWin->optional->boundingShape;
@ -536,7 +538,7 @@ ProcShapeCombine(ClientPtr client)
if (result != Success)
return result;
FOR_NSCREENS(j) {
FOR_NSCREENS_BACKWARD(j) {
stuff->dest = win->info[j].id;
stuff->src = win2->info[j].id;
result = ShapeCombine(client, stuff);
@ -600,7 +602,7 @@ ProcShapeOffset(ClientPtr client)
if (result != Success)
return result;
FOR_NSCREENS(j) {
FOR_NSCREENS_BACKWARD(j) {
stuff->dest = win->info[j].id;
result = ShapeOffset(client, stuff);
if (result != Success)
@ -752,7 +754,7 @@ ProcShapeSelectInput(ClientPtr client)
}
/* build the entry */
pNewShapeEvent = malloc(sizeof(ShapeEventRec));
pNewShapeEvent = calloc(1, sizeof(ShapeEventRec));
if (!pNewShapeEvent)
return BadAlloc;
pNewShapeEvent->next = 0;
@ -773,7 +775,7 @@ ProcShapeSelectInput(ClientPtr client)
* done through the resource database.
*/
if (!pHead) {
pHead = malloc(sizeof(ShapeEventPtr));
pHead = calloc(1, sizeof(ShapeEventPtr));
if (!pHead ||
!AddResource(pWin->drawable.id, ShapeEventType,
(void *) pHead)) {
@ -938,7 +940,7 @@ ProcShapeGetRectangles(ClientPtr client)
REQUEST(xShapeGetRectanglesReq);
WindowPtr pWin;
xShapeGetRectanglesReply rep;
xRectangle *rects;
xRectangle *rects = NULL;
int nrects, i, rc;
RegionPtr region;
@ -962,7 +964,7 @@ ProcShapeGetRectangles(ClientPtr client)
}
if (!region) {
nrects = 1;
rects = malloc(sizeof(xRectangle));
rects = calloc(1, sizeof(xRectangle));
if (!rects)
return BadAlloc;
switch (stuff->kind) {
@ -991,8 +993,9 @@ ProcShapeGetRectangles(ClientPtr client)
nrects = RegionNumRects(region);
box = RegionRects(region);
rects = xallocarray(nrects, sizeof(xRectangle));
if (!rects && nrects)
if (nrects) {
rects = calloc(nrects, sizeof(xRectangle));
if (!rects)
return BadAlloc;
for (i = 0; i < nrects; i++, box++) {
rects[i].x = box->x1;
@ -1001,6 +1004,7 @@ ProcShapeGetRectangles(ClientPtr client)
rects[i].height = box->y2 - box->y1;
}
}
}
rep = (xShapeGetRectanglesReply) {
.type = X_Reply,
.ordering = YXBanded,

View File

@ -43,10 +43,15 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xfuncproto.h>
#include "dix/dix_priv.h"
#include "dix/screen_hooks_priv.h"
#include "miext/extinit_priv.h"
#include "os/auth.h"
#include "os/busfault.h"
#include "os/client_priv.h"
#include "os/log_priv.h"
#include "os/osdep.h"
#include "Xext/panoramiX.h"
#include "Xext/panoramiXsrv.h"
#include "misc.h"
#include "os.h"
@ -60,7 +65,6 @@ in this Software without prior written authorization from The Open Group.
#include "servermd.h"
#include "shmint.h"
#include "xace.h"
#include "extinit_priv.h"
#include "protocol-versions.h"
/* Needed for Solaris cross-zone shared memory extension */
@ -90,15 +94,9 @@ in this Software without prior written authorization from The Open Group.
#define SHMPERM_MODE(p) p->mode
#endif
#ifdef XINERAMA
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
typedef struct _ShmScrPrivateRec {
CloseScreenProcPtr CloseScreen;
ShmFuncsPtr shmFuncs;
DestroyPixmapProcPtr destroyPixmap;
} ShmScrPrivateRec;
Bool noMITShmExtension = FALSE;
@ -109,7 +107,7 @@ static void ShmResetProc(ExtensionEntry *extEntry);
static void SShmCompletionEvent(xShmCompletionEvent *from,
xShmCompletionEvent *to);
static Bool ShmDestroyPixmap(PixmapPtr pPixmap);
static int ShmCreatePixmap(ClientPtr client, xShmCreatePixmapReq *stuff);
static unsigned char ShmReqCode;
int ShmCompletionCode;
@ -157,7 +155,7 @@ static ShmFuncs fbFuncs = { fbShmCreatePixmap, NULL };
} \
}
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
static Bool badSysCall = FALSE;
@ -195,15 +193,13 @@ CheckForShmSyscall(void)
#endif
static Bool
ShmCloseScreen(ScreenPtr pScreen)
static void
ShmScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
pScreen->CloseScreen = screen_priv->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL);
free(screen_priv);
return (*pScreen->CloseScreen) (pScreen);
}
static ShmScrPrivateRec *
@ -213,9 +209,8 @@ ShmInitScreenPriv(ScreenPtr pScreen)
if (!screen_priv) {
screen_priv = calloc(1, sizeof(ShmScrPrivateRec));
screen_priv->CloseScreen = pScreen->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
pScreen->CloseScreen = ShmCloseScreen;
dixScreenHookClose(pScreen, ShmScreenClose);
}
return screen_priv;
}
@ -247,28 +242,6 @@ ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs)
ShmInitScreenPriv(pScreen)->shmFuncs = funcs;
}
static Bool
ShmDestroyPixmap(PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
void *shmdesc = NULL;
Bool ret = TRUE;
if (pPixmap->refcnt == 1)
shmdesc = dixLookupPrivate(&pPixmap->devPrivates, shmPixmapPrivateKey);
pScreen->DestroyPixmap = screen_priv->destroyPixmap;
if (pScreen->DestroyPixmap)
ret = pScreen->DestroyPixmap(pPixmap);
screen_priv->destroyPixmap = pScreen->DestroyPixmap;
pScreen->DestroyPixmap = ShmDestroyPixmap;
if (shmdesc)
ShmDetachSegment(shmdesc, 0);
return ret;
}
void
ShmRegisterFbFuncs(ScreenPtr pScreen)
@ -374,12 +347,15 @@ shm_access(ClientPtr client, SHMPERM_TYPE * perm, int readonly)
static int
ProcShmAttach(ClientPtr client)
{
REQUEST(xShmAttachReq);
REQUEST_SIZE_MATCH(xShmAttachReq);
if (!client->local)
return BadRequest;
SHMSTAT_TYPE buf;
ShmDescPtr shmdesc;
REQUEST(xShmAttachReq);
REQUEST_SIZE_MATCH(xShmAttachReq);
LEGAL_NEW_RESOURCE(stuff->shmseg, client);
if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse)) {
client->errorValue = stuff->readOnly;
@ -395,7 +371,7 @@ ProcShmAttach(ClientPtr client)
shmdesc->refcnt++;
}
else {
shmdesc = malloc(sizeof(ShmDescRec));
shmdesc = calloc(1, sizeof(ShmDescRec));
if (!shmdesc)
return BadAlloc;
#ifdef SHM_FD_PASSING
@ -437,6 +413,9 @@ ShmDetachSegment(void *value, /* must conform to DeleteType */
ShmDescPtr shmdesc = (ShmDescPtr) value;
ShmDescPtr *prev;
if (!shmdesc)
return Success;
if (--shmdesc->refcnt)
return TRUE;
#if SHM_FD_PASSING
@ -456,11 +435,14 @@ ShmDetachSegment(void *value, /* must conform to DeleteType */
static int
ProcShmDetach(ClientPtr client)
{
REQUEST(xShmDetachReq);
REQUEST_SIZE_MATCH(xShmDetachReq);
if (!client->local)
return BadRequest;
ShmDescPtr shmdesc;
REQUEST(xShmDetachReq);
REQUEST_SIZE_MATCH(xShmDetachReq);
VERIFY_SHMSEG(stuff->shmseg, shmdesc, client);
FreeResource(stuff->shmseg, X11_RESTYPE_NONE);
return Success;
@ -517,16 +499,13 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
}
static int
ProcShmPutImage(ClientPtr client)
ShmPutImage(ClientPtr client, xShmPutImageReq *stuff)
{
GCPtr pGC;
DrawablePtr pDraw;
long length;
ShmDescPtr shmdesc;
REQUEST(xShmPutImageReq);
REQUEST_SIZE_MATCH(xShmPutImageReq);
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, FALSE, shmdesc, client);
if ((stuff->sendEvent != xTrue) && (stuff->sendEvent != xFalse))
@ -616,7 +595,7 @@ ProcShmPutImage(ClientPtr client)
}
static int
ProcShmGetImage(ClientPtr client)
ShmGetImage(ClientPtr client, xShmGetImageReq *stuff)
{
DrawablePtr pDraw;
long lenPer = 0, length;
@ -627,9 +606,6 @@ ProcShmGetImage(ClientPtr client)
RegionPtr pVisibleRegion = NULL;
int rc;
REQUEST(xShmGetImageReq);
REQUEST_SIZE_MATCH(xShmGetImageReq);
if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) {
client->errorValue = stuff->format;
return BadValue;
@ -734,16 +710,22 @@ ProcShmGetImage(ClientPtr client)
return Success;
}
#ifdef XINERAMA
static int
ProcPanoramiXShmPutImage(ClientPtr client)
ProcShmPutImage(ClientPtr client)
{
REQUEST(xShmPutImageReq);
REQUEST_SIZE_MATCH(xShmPutImageReq);
if (!client->local)
return BadRequest;
#ifdef XINERAMA
int j, result, orig_x, orig_y;
PanoramiXRes *draw, *gc;
Bool sendEvent, isRoot;
REQUEST(xShmPutImageReq);
REQUEST_SIZE_MATCH(xShmPutImageReq);
if (noPanoramiXExtension)
return ShmPutImage(client, stuff);
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
@ -761,7 +743,7 @@ ProcPanoramiXShmPutImage(ClientPtr client)
orig_y = stuff->dstY;
sendEvent = stuff->sendEvent;
stuff->sendEvent = 0;
FOR_NSCREENS(j) {
FOR_NSCREENS_BACKWARD(j) {
if (!j)
stuff->sendEvent = sendEvent;
stuff->drawable = draw->info[j].id;
@ -770,18 +752,27 @@ ProcPanoramiXShmPutImage(ClientPtr client)
stuff->dstX = orig_x - screenInfo.screens[j]->x;
stuff->dstY = orig_y - screenInfo.screens[j]->y;
}
result = ProcShmPutImage(client);
result = ShmPutImage(client, stuff);
if (result != Success)
break;
}
return result;
#else
return ShmPutImage(client, stuff);
#endif /* XINERAMA */
}
static int
ProcPanoramiXShmGetImage(ClientPtr client)
ProcShmGetImage(ClientPtr client)
{
REQUEST(xShmGetImageReq);
REQUEST_SIZE_MATCH(xShmGetImageReq);
if (!client->local)
return BadRequest;
#ifdef XINERAMA
PanoramiXRes *draw;
DrawablePtr *drawables;
DrawablePtr pDraw;
xShmGetImageReply xgi;
ShmDescPtr shmdesc;
@ -790,9 +781,8 @@ ProcPanoramiXShmGetImage(ClientPtr client)
long lenPer = 0, length, widthBytesLine;
Bool isRoot;
REQUEST(xShmGetImageReq);
REQUEST_SIZE_MATCH(xShmGetImageReq);
if (noPanoramiXExtension)
return ShmGetImage(client, stuff);
if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) {
client->errorValue = stuff->format;
@ -805,7 +795,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
return (rc == BadValue) ? BadDrawable : rc;
if (draw->type == XRT_PIXMAP)
return ProcShmGetImage(client);
return ShmGetImage(client, stuff);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixReadAccess);
if (rc != Success)
@ -856,7 +846,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
drawables = calloc(PanoramiXNumScreens, sizeof(DrawablePtr));
DrawablePtr *drawables = calloc(PanoramiXNumScreens, sizeof(DrawablePtr));
if (!drawables)
return BadAlloc;
@ -916,24 +906,34 @@ ProcPanoramiXShmGetImage(ClientPtr client)
WriteToClient(client, sizeof(xShmGetImageReply), &xgi);
return Success;
#else
return ShmGetImage(client, stuff);
#endif /* XINERAMA */
}
static int
ProcPanoramiXShmCreatePixmap(ClientPtr client)
ProcShmCreatePixmap(ClientPtr client)
{
REQUEST(xShmCreatePixmapReq);
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
if (!client->local)
return BadRequest;
#ifdef XINERAMA
if (noPanoramiXExtension)
return ShmCreatePixmap(client, stuff);
ScreenPtr pScreen = NULL;
PixmapPtr pMap = NULL;
DrawablePtr pDraw;
DepthPtr pDepth;
int i, j, result, rc;
ShmDescPtr shmdesc;
REQUEST(xShmCreatePixmapReq);
unsigned int width, height, depth;
unsigned long size;
PanoramiXRes *newPix;
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
client->errorValue = stuff->pid;
if (!sharedPixmaps)
return BadImplementation;
@ -976,7 +976,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
if (!(newPix = malloc(sizeof(PanoramiXRes))))
if (!(newPix = calloc(1, sizeof(PanoramiXRes))))
return BadAlloc;
newPix->type = XRT_PIXMAP;
@ -985,7 +985,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
result = Success;
FOR_NSCREENS(j) {
FOR_NSCREENS_BACKWARD(j) {
ShmScrPrivateRec *screen_priv;
pScreen = screenInfo.screens[j];
@ -1029,8 +1029,10 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
AddResource(stuff->pid, XRT_PIXMAP, newPix);
return result;
}
#else
return ShmCreatePixmap(client, stuff);
#endif /* XINERAMA */
}
static PixmapPtr
fbShmCreatePixmap(ScreenPtr pScreen,
@ -1053,7 +1055,7 @@ fbShmCreatePixmap(ScreenPtr pScreen,
}
static int
ProcShmCreatePixmap(ClientPtr client)
ShmCreatePixmap(ClientPtr client, xShmCreatePixmapReq *stuff)
{
PixmapPtr pMap;
DrawablePtr pDraw;
@ -1061,12 +1063,9 @@ ProcShmCreatePixmap(ClientPtr client)
int i, rc;
ShmDescPtr shmdesc;
ShmScrPrivateRec *screen_priv;
REQUEST(xShmCreatePixmapReq);
unsigned int width, height, depth;
unsigned long size;
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
client->errorValue = stuff->pid;
if (!sharedPixmaps)
return BadImplementation;
@ -1148,13 +1147,17 @@ ShmBusfaultNotify(void *context)
static int
ProcShmAttachFd(ClientPtr client)
{
REQUEST(xShmAttachFdReq);
REQUEST_SIZE_MATCH(xShmAttachFdReq);
if (!client->local)
return BadRequest;
int fd;
ShmDescPtr shmdesc;
REQUEST(xShmAttachFdReq);
struct stat statb;
SetReqFds(client, 1);
REQUEST_SIZE_MATCH(xShmAttachFdReq);
LEGAL_NEW_RESOURCE(stuff->shmseg, client);
if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse)) {
client->errorValue = stuff->readOnly;
@ -1169,7 +1172,7 @@ ProcShmAttachFd(ClientPtr client)
return BadMatch;
}
shmdesc = malloc(sizeof(ShmDescRec));
shmdesc = calloc(1, sizeof(ShmDescRec));
if (!shmdesc) {
close(fd);
return BadAlloc;
@ -1263,9 +1266,14 @@ shm_tmpfile(void)
static int
ProcShmCreateSegment(ClientPtr client)
{
REQUEST(xShmCreateSegmentReq);
REQUEST_SIZE_MATCH(xShmCreateSegmentReq);
if (!client->local)
return BadRequest;
int fd;
ShmDescPtr shmdesc;
REQUEST(xShmCreateSegmentReq);
xShmCreateSegmentReply rep = {
.type = X_Reply,
.nfd = 1,
@ -1273,7 +1281,6 @@ ProcShmCreateSegment(ClientPtr client)
.length = 0,
};
REQUEST_SIZE_MATCH(xShmCreateSegmentReq);
LEGAL_NEW_RESOURCE(stuff->shmseg, client);
if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse)) {
client->errorValue = stuff->readOnly;
@ -1286,7 +1293,7 @@ ProcShmCreateSegment(ClientPtr client)
close(fd);
return BadAlloc;
}
shmdesc = malloc(sizeof(ShmDescRec));
shmdesc = calloc(1, sizeof(ShmDescRec));
if (!shmdesc) {
close(fd);
return BadAlloc;
@ -1338,34 +1345,18 @@ ProcShmDispatch(ClientPtr client)
{
REQUEST(xReq);
if (stuff->data == X_ShmQueryVersion)
return ProcShmQueryVersion(client);
if (!client->local)
return BadRequest;
switch (stuff->data) {
case X_ShmQueryVersion:
return ProcShmQueryVersion(client);
case X_ShmAttach:
return ProcShmAttach(client);
case X_ShmDetach:
return ProcShmDetach(client);
case X_ShmPutImage:
#ifdef XINERAMA
if (!noPanoramiXExtension)
return ProcPanoramiXShmPutImage(client);
#endif /* XINERAMA */
return ProcShmPutImage(client);
case X_ShmGetImage:
#ifdef XINERAMA
if (!noPanoramiXExtension)
return ProcPanoramiXShmGetImage(client);
#endif /* XINERAMA */
return ProcShmGetImage(client);
case X_ShmCreatePixmap:
#ifdef XINERAMA
if (!noPanoramiXExtension)
return ProcPanoramiXShmCreatePixmap(client);
#endif /* XINERAMA */
return ProcShmCreatePixmap(client);
#ifdef SHM_FD_PASSING
case X_ShmAttachFd:
@ -1486,13 +1477,9 @@ SProcShmDispatch(ClientPtr client)
{
REQUEST(xReq);
if (stuff->data == X_ShmQueryVersion)
return ProcShmQueryVersion(client);
if (!client->local)
return BadRequest;
switch (stuff->data) {
case X_ShmQueryVersion:
return ProcShmQueryVersion(client);
case X_ShmAttach:
return SProcShmAttach(client);
case X_ShmDetach:
@ -1514,6 +1501,14 @@ SProcShmDispatch(ClientPtr client)
}
}
static void ShmPixmapDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
{
ShmDetachSegment(
dixLookupPrivate(&pPixmap->devPrivates, shmPixmapPrivateKey),
0);
dixSetPrivate(&pPixmap->devPrivates, shmPixmapPrivateKey, NULL);
}
void
ShmExtensionInit(void)
{
@ -1536,19 +1531,16 @@ ShmExtensionInit(void)
for (i = 0; i < screenInfo.numScreens; i++) {
ShmScrPrivateRec *screen_priv =
ShmInitScreenPriv(screenInfo.screens[i]);
if (!screen_priv)
continue;
if (!screen_priv->shmFuncs)
screen_priv->shmFuncs = &miFuncs;
if (!screen_priv->shmFuncs->CreatePixmap)
sharedPixmaps = xFalse;
}
if (sharedPixmaps)
for (i = 0; i < screenInfo.numScreens; i++) {
ShmScrPrivateRec *screen_priv =
ShmGetScreenPriv(screenInfo.screens[i]);
screen_priv->destroyPixmap =
screenInfo.screens[i]->DestroyPixmap;
screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap;
}
for (i = 0; i < screenInfo.numScreens; i++)
dixScreenHookPixmapDestroy(screenInfo.screens[i], ShmPixmapDestroy);
}
ShmSegType = CreateNewResourceType(ShmDetachSegment, "ShmSeg");
if (ShmSegType &&

View File

@ -72,7 +72,7 @@ ClientSleepUntil(ClientPtr client,
TimeStamp *revive,
void (*notifyFunc) (ClientPtr, void *), void *closure)
{
SertafiedPtr pRequest, pReq, pPrev;
SertafiedPtr pReq, pPrev;
if (SertafiedGeneration != serverGeneration) {
SertafiedResType = CreateNewResourceType(SertafiedDelete,
@ -82,7 +82,8 @@ ClientSleepUntil(ClientPtr client,
SertafiedGeneration = serverGeneration;
BlockHandlerRegistered = FALSE;
}
pRequest = malloc(sizeof(SertafiedRec));
SertafiedPtr pRequest = calloc(1, sizeof(SertafiedRec));
if (!pRequest)
return FALSE;
pRequest->pClient = client;

View File

@ -24,9 +24,7 @@
* XFree86 Project.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _SLEEPUNTIL_H_
#define _SLEEPUNTIL_H_ 1

View File

@ -59,6 +59,7 @@ PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/syncproto.h>
#include "dix/dix_priv.h"
#include "miext/extinit_priv.h"
#include "os/bug_priv.h"
#include "os/osdep.h"
@ -78,8 +79,6 @@ PERFORMANCE OF THIS SOFTWARE.
#include <sys/time.h>
#endif
#include "extinit_priv.h"
/*
* Local Global Variables
*/
@ -650,7 +649,7 @@ SyncAwaitTriggerFired(SyncTrigger * pTrigger)
pAwaitUnion = (SyncAwaitUnion *) pAwait->pHeader;
numwaits = pAwaitUnion->header.num_waitconditions;
ppAwait = xallocarray(numwaits, sizeof(SyncAwait *));
ppAwait = calloc(numwaits, sizeof(SyncAwait *));
if (!ppAwait)
goto bail;
@ -764,8 +763,6 @@ SyncChangeCounter(SyncCounter * pCounter, int64_t newval)
static Bool
SyncEventSelectForAlarm(SyncAlarm * pAlarm, ClientPtr client, Bool wantevents)
{
SyncAlarmClientList *pClients;
if (client == pAlarm->client) { /* alarm owner */
pAlarm->events = wantevents;
return Success;
@ -773,7 +770,8 @@ SyncEventSelectForAlarm(SyncAlarm * pAlarm, ClientPtr client, Bool wantevents)
/* see if the client is already on the list (has events selected) */
for (pClients = pAlarm->pEventClients; pClients; pClients = pClients->next) {
for (SyncAlarmClientList *pClients = pClients = pAlarm->pEventClients;
pClients; pClients = pClients->next) {
if (pClients->client == client) {
/* client's presence on the list indicates desire for
* events. If the client doesn't want events, remove it
@ -799,7 +797,7 @@ SyncEventSelectForAlarm(SyncAlarm * pAlarm, ClientPtr client, Bool wantevents)
/* add new client to pAlarm->pEventClients */
pClients = malloc(sizeof(SyncAlarmClientList));
SyncAlarmClientList *pClients = calloc(1, sizeof(SyncAlarmClientList));
if (!pClients)
return BadAlloc;
@ -934,7 +932,7 @@ SyncCreate(ClientPtr client, XID id, unsigned char type)
switch (type) {
case SYNC_COUNTER:
pSync = malloc(sizeof(SyncCounter));
pSync = calloc(1, sizeof(SyncCounter));
resType = RTCounter;
break;
case SYNC_FENCE:
@ -1027,12 +1025,10 @@ SyncCreateSystemCounter(const char *name,
SyncSystemCounterBracketValues BracketValues
)
{
SyncCounter *pCounter = SyncCreateCounter(NULL, FakeClientID(0), initial);
SyncCounter *pCounter = SyncCreateCounter(NULL, dixAllocServerXID(), initial);
if (pCounter) {
SysCounterInfo *psci;
psci = malloc(sizeof(SysCounterInfo));
SysCounterInfo *psci = calloc(1, sizeof(SysCounterInfo));
if (!psci) {
FreeResource(pCounter->sync.id, X11_RESTYPE_NONE);
return pCounter;
@ -1311,7 +1307,7 @@ ProcSyncListSystemCounters(ClientPtr client)
}
if (len) {
walklist = list = malloc(len);
walklist = list = calloc(1, len);
if (!list)
return BadAlloc;
}
@ -1358,7 +1354,8 @@ ProcSyncListSystemCounters(ClientPtr client)
}
/*
* ** Set client Priority
* Set the priority of the client owning given resource.
* If the resource ID is None then set the priority of calling client.
*/
static int
ProcSyncSetPriority(ClientPtr client)
@ -1372,7 +1369,7 @@ ProcSyncSetPriority(ClientPtr client)
if (stuff->id == None)
priorityclient = client;
else {
rc = dixLookupClient(&priorityclient, stuff->id, client,
rc = dixLookupResourceOwner(&priorityclient, stuff->id, client,
DixSetAttrAccess);
if (rc != Success)
return rc;
@ -1392,7 +1389,8 @@ ProcSyncSetPriority(ClientPtr client)
}
/*
* ** Get client Priority
* Retrieve the priority of the client owning given resource.
* If the resource ID is None then retrieve the priority of calling client.
*/
static int
ProcSyncGetPriority(ClientPtr client)
@ -1407,7 +1405,7 @@ ProcSyncGetPriority(ClientPtr client)
if (stuff->id == None)
priorityclient = client;
else {
rc = dixLookupClient(&priorityclient, stuff->id, client,
rc = dixLookupResourceOwner(&priorityclient, stuff->id, client,
DixGetAttrAccess);
if (rc != Success)
return rc;
@ -1547,7 +1545,7 @@ SyncAwaitPrologue(ClientPtr client, int items)
/* all the memory for the entire await list is allocated
* here in one chunk
*/
pAwaitUnion = xallocarray(items + 1, sizeof(SyncAwaitUnion));
pAwaitUnion = calloc(items + 1, sizeof(SyncAwaitUnion));
if (!pAwaitUnion)
return NULL;
@ -1739,7 +1737,7 @@ ProcSyncCreateAlarm(ClientPtr client)
if (len != (Ones(vmask) + Ones(vmask & (XSyncCAValue | XSyncCADelta))))
return BadLength;
if (!(pAlarm = malloc(sizeof(SyncAlarm)))) {
if (!(pAlarm = calloc(1, sizeof(SyncAlarm)))) {
return BadAlloc;
}
@ -2647,16 +2645,15 @@ typedef struct {
static void
IdleTimeQueryValue(void *pCounter, int64_t *pValue_return)
{
int deviceid;
int deviceid = XIAllDevices;
CARD32 idle;
if (pCounter) {
SyncCounter *counter = pCounter;
IdleCounterPriv *priv = SysCounterGetPrivate(counter);
if (priv)
deviceid = priv->deviceid;
}
else
deviceid = XIAllDevices;
idle = GetTimeInMillis() - LastEventTime(deviceid).milliseconds;
*pValue_return = idle;
}
@ -2666,6 +2663,8 @@ IdleTimeBlockHandler(void *pCounter, void *wt)
{
SyncCounter *counter = pCounter;
IdleCounterPriv *priv = SysCounterGetPrivate(counter);
if (!priv)
return;
int64_t *less = priv->value_less;
int64_t *greater = priv->value_greater;
int64_t idle, old_idle;
@ -2756,6 +2755,8 @@ IdleTimeWakeupHandler(void *pCounter, int rc)
{
SyncCounter *counter = pCounter;
IdleCounterPriv *priv = SysCounterGetPrivate(counter);
if (!priv)
return;
int64_t *less = priv->value_less;
int64_t *greater = priv->value_greater;
int64_t idle;
@ -2789,6 +2790,8 @@ IdleTimeBracketValues(void *pCounter, int64_t *pbracket_less,
{
SyncCounter *counter = pCounter;
IdleCounterPriv *priv = SysCounterGetPrivate(counter);
if (!priv)
return;
int64_t *less = priv->value_less;
int64_t *greater = priv->value_greater;
Bool registered = (less || greater);
@ -2818,20 +2821,24 @@ init_system_idle_counter(const char *name, int deviceid)
IdleTimeQueryValue(NULL, &idle);
IdleCounterPriv *priv = calloc(1, sizeof(IdleCounterPriv));
if (!priv)
return NULL;
idle_time_counter = SyncCreateSystemCounter(name, idle, resolution,
XSyncCounterUnrestricted,
IdleTimeQueryValue,
IdleTimeBracketValues);
if (idle_time_counter != NULL) {
IdleCounterPriv *priv = malloc(sizeof(IdleCounterPriv));
if (!idle_time_counter) {
free(priv);
return NULL;
}
priv->value_less = priv->value_greater = NULL;
priv->deviceid = deviceid;
idle_time_counter->pSysCounterInfo->private = priv;
}
return idle_time_counter;
}

File diff suppressed because it is too large Load Diff

View File

@ -204,7 +204,6 @@ XaceCensorImage(ClientPtr client,
if (nRects > 0) { /* we have something to censor */
GCPtr pScratchGC = NULL;
PixmapPtr pPix = NULL;
xRectangle *pRects = NULL;
Bool failed = FALSE;
int depth = 1;
int bitsPerPixel = 1;
@ -213,7 +212,7 @@ XaceCensorImage(ClientPtr client,
/* convert region to list-of-rectangles for PolyFillRect */
pRects = malloc(nRects * sizeof(xRectangle));
xRectangle *pRects = calloc(1, nRects * sizeof(xRectangle));
if (!pRects) {
failed = TRUE;
goto failSafe;
@ -281,3 +280,15 @@ XaceIsLocal(ClientPtr client)
{
return ClientIsLocal(client);
}
Bool
XaceRegisterCallback(int hook, CallbackProcPtr callback, void *data)
{
return AddCallback(XaceHooks+(hook), callback, data);
}
Bool
XaceDeleteCallback(int hook, CallbackProcPtr callback, void *data)
{
return DeleteCallback(XaceHooks+(hook), callback, data);
}

View File

@ -25,12 +25,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define XACE_MAJOR_VERSION 2
#define XACE_MINOR_VERSION 0
#include "dix/selection_priv.h"
#include "extnsionst.h"
#include "pixmap.h"
#include "region.h"
#include "window.h"
#include "property.h"
#include "selection.h"
/* Default window background */
#define XaceBackgroundNoneState(w) ((w)->forcedBG ? BackgroundPixel : None)
@ -38,7 +39,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/* security hooks */
/* Constants used to identify the available security hooks
*/
#define XACE_CORE_DISPATCH 0
#define XACE_EXT_DISPATCH 1
#define XACE_RESOURCE_ACCESS 2
#define XACE_DEVICE_ACCESS 3
@ -58,11 +58,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
extern CallbackListPtr XaceHooks[XACE_NUM_HOOKS];
/* Entry point for hook functions. Called by Xserver.
* Required by libdbe and libextmod
* Required by several modules
*/
/* needs to be exported for in-tree modsetting driver, but not part
of public API for external modules */
_X_EXPORT int XaceHook(int hook, ... /* appropriate args for hook */);
_X_EXPORT Bool XaceRegisterCallback(int hook, CallbackProcPtr callback, void *data);
_X_EXPORT Bool XaceDeleteCallback(int hook, CallbackProcPtr callback, void *data);
/* determine whether any callbacks are present for the XACE hook */
int XaceHookIsSet(int hook);
@ -96,16 +95,7 @@ int XaceHookScreensaverAccess(ClientPtr client, ScreenPtr screen, Mask access_mo
int XaceHookAuthAvail(ClientPtr client, XID authId);
int XaceHookKeyAvail(xEventPtr ev, DeviceIntPtr dev, int count);
/* Register a callback for a given hook.
*/
#define XaceRegisterCallback(hook,callback,data) \
AddCallback(XaceHooks+(hook), callback, data)
/* Unregister an existing callback for a given hook.
*/
#define XaceDeleteCallback(hook,callback,data) \
DeleteCallback(XaceHooks+(hook), callback, data)
/* Register / unregister a callback for a given hook. */
/* XTrans wrappers for use by security modules
*/

View File

@ -20,21 +20,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef _XACESTR_H
#define _XACESTR_H
#include "dix/selection_priv.h"
#include "dix.h"
#include "resource.h"
#include "extnsionst.h"
#include "window.h"
#include "input.h"
#include "property.h"
#include "selection.h"
#include "xace.h"
/* XACE_CORE_DISPATCH */
typedef struct {
ClientPtr client;
int status;
} XaceCoreDispatchRec;
/* XACE_RESOURCE_ACCESS */
typedef struct {
ClientPtr client;

View File

@ -28,17 +28,19 @@ from The Open Group.
#include <dix-config.h>
#include <stdint.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/xcmiscproto.h>
#include "dix/resource_priv.h"
#include "miext/extinit_priv.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "swaprep.h"
#include <X11/extensions/xcmiscproto.h>
#include "extinit_priv.h"
#include <stdint.h>
static int
ProcXCMiscGetVersion(ClientPtr client)
@ -99,7 +101,7 @@ ProcXCMiscGetXIDList(ClientPtr client)
if (stuff->count > UINT32_MAX / sizeof(XID))
return BadAlloc;
pids = xallocarray(stuff->count, sizeof(XID));
pids = calloc(stuff->count, sizeof(XID));
if (!pids) {
return BadAlloc;
}

View File

@ -41,10 +41,6 @@
#ifdef SVR4
#include <sys/sysmacros.h>
#endif
#if defined(__CYGWIN__)
#include <sys/param.h>
#include <sys/sysmacros.h>
#endif
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/stat.h>
@ -57,6 +53,10 @@
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/xf86bigfproto.h>
#include <X11/fonts/fontstruct.h>
#include <X11/fonts/libxfont2.h>
#include "miext/extinit_priv.h"
#include "misc.h"
#include "os.h"
@ -64,7 +64,6 @@
#include "gcstruct.h"
#include "dixfontstr.h"
#include "extnsionst.h"
#include "extinit.h"
#include "protocol-versions.h"
#include "xf86bigfontsrv.h"
@ -87,7 +86,7 @@ static unsigned int pagesize;
static Bool badSysCall = FALSE;
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
static void
SigSysHandler(int signo)
@ -147,7 +146,6 @@ static ShmDescPtr ShmList = (ShmDescPtr) NULL;
static ShmDescPtr
shmalloc(unsigned int size)
{
ShmDescPtr pDesc;
int shmid;
char *addr;
@ -165,7 +163,7 @@ shmalloc(unsigned int size)
if (size < 3500)
return (ShmDescPtr) NULL;
pDesc = malloc(sizeof(ShmDescRec));
ShmDescPtr pDesc = calloc(1, sizeof(ShmDescRec));
if (!pDesc)
return (ShmDescPtr) NULL;
@ -266,13 +264,11 @@ XF86BigfontResetProc(ExtensionEntry * extEntry)
static int
ProcXF86BigfontQueryVersion(ClientPtr client)
{
xXF86BigfontQueryVersionReply reply;
REQUEST_SIZE_MATCH(xXF86BigfontQueryVersionReq);
reply = (xXF86BigfontQueryVersionReply) {
xXF86BigfontQueryVersionReply reply = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION,
.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION,
.uid = geteuid(),
@ -281,9 +277,6 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
.signature = signature,
.capabilities = (client->local && !client->swapped)
? XF86Bigfont_CAP_LocalShm : 0
#else
.signature = 0,
.capabilities = 0
#endif
};
if (client->swapped) {
@ -390,7 +383,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
}
else {
#endif
pCI = xallocarray(nCharInfos, sizeof(xCharInfo));
pCI = calloc(nCharInfos, sizeof(xCharInfo));
if (!pCI)
return BadAlloc;
#ifdef MITSHM
@ -452,7 +445,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
if (hashModulus > nCharInfos + 1)
hashModulus = nCharInfos + 1;
tmp = xallocarray(4 * nCharInfos + 1, sizeof(CARD16));
tmp = calloc(4 * nCharInfos + 1, sizeof(CARD16));
if (!tmp) {
if (!pDesc)
free(pCI);
@ -539,8 +532,9 @@ ProcXF86BigfontQueryFont(ClientPtr client)
: 0);
xXF86BigfontQueryFontReply rep = {
.type = X_Reply;
.length = bytes_to_int32(buflength),
.type = X_Reply,
.length = bytes_to_int32(sizeof(xXF86BigfontQueryFontReply)
- sizeof(xGenericReply) + rlength),
.sequenceNumber = client->sequence,
.minBounds = pFont->info.ink_minbounds,
.maxBounds = pFont->info.ink_maxbounds,
@ -712,7 +706,7 @@ XFree86BigfontExtensionInit(void)
FontShmdescIndex = xfont2_allocate_font_private_index();
#if !defined(CSRG_BASED) && !defined(__CYGWIN__)
#if !defined(CSRG_BASED)
pagesize = SHMLBA;
#else
#ifdef _SC_PAGESIZE

View File

@ -12,7 +12,10 @@
#include <X11/extensions/XResproto.h>
#include "dix/registry_priv.h"
#include "dix/resource_priv.h"
#include "os/client_priv.h"
#include "miext/extinit_priv.h"
#include "Xext/xace.h"
#include "misc.h"
#include "os.h"
@ -22,17 +25,12 @@
#include "pixmapstr.h"
#include "windowstr.h"
#include "gcstruct.h"
#include "extinit_priv.h"
#include "protocol-versions.h"
#include "list.h"
#include "misc.h"
#include <string.h>
#include "hashtable.h"
#include "picturestr.h"
#ifdef COMPOSITE
#include "compint.h"
#endif
Bool noResExtension = FALSE;
@ -103,7 +101,7 @@ typedef struct {
static void *
AddFragment(struct xorg_list *frags, int bytes)
{
FragmentList *f = malloc(sizeof(FragmentList) + bytes);
FragmentList *f = calloc(1, sizeof(FragmentList) + bytes);
if (!f) {
return NULL;
} else {
@ -113,21 +111,6 @@ AddFragment(struct xorg_list *frags, int bytes)
}
}
/** @brief Sends all fragments in the list to the client. Does not
free anything.
@param client The client to send the fragments to
@param frags The head of the list of fragments
*/
static void
WriteFragmentsToClient(ClientPtr client, struct xorg_list *frags)
{
FragmentList *it;
xorg_list_for_each_entry(it, frags, l) {
WriteToClient(client, it->bytes, (char*) it + sizeof(*it));
}
}
/** @brief Frees a list of fragments. Does not free() root node.
@param frags The head of the list of fragments
@ -136,11 +119,13 @@ static void
DestroyFragments(struct xorg_list *frags)
{
FragmentList *it, *tmp;
if (!xorg_list_is_empty(frags)) {
xorg_list_for_each_entry_safe(it, tmp, frags, l) {
xorg_list_del(&it->l);
free(it);
}
}
}
/** @brief Constructs a context record for ConstructClientId* functions
to use */
@ -195,16 +180,15 @@ DestroyConstructResourceBytesCtx(ConstructResourceBytesCtx *ctx)
static int
ProcXResQueryVersion(ClientPtr client)
{
REQUEST_SIZE_MATCH(xXResQueryVersionReq);
xXResQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.server_major = SERVER_XRES_MAJOR_VERSION,
.server_minor = SERVER_XRES_MINOR_VERSION
};
REQUEST_SIZE_MATCH(xXResQueryVersionReq);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@ -218,24 +202,23 @@ ProcXResQueryVersion(ClientPtr client)
static int
ProcXResQueryClients(ClientPtr client)
{
/* REQUEST(xXResQueryClientsReq); */
xXResQueryClientsReply rep;
int *current_clients;
int i, num_clients;
REQUEST_SIZE_MATCH(xXResQueryClientsReq);
current_clients = xallocarray(currentMaxClients, sizeof(int));
int *current_clients = calloc(currentMaxClients, sizeof(int));
if (!current_clients)
return BadAlloc;
num_clients = 0;
for (i = 0; i < currentMaxClients; i++) {
int num_clients = 0;
for (int i = 0; i < currentMaxClients; i++) {
if (clients[i]) {
if (XaceHookClientAccess(client, clients[i], DixReadAccess) == Success) {
current_clients[num_clients] = i;
num_clients++;
}
}
}
rep = (xXResQueryClientsReply) {
xXResQueryClientsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(num_clients * sz_xXResClient),
@ -246,25 +229,31 @@ ProcXResQueryClients(ClientPtr client)
swapl(&rep.length);
swapl(&rep.num_clients);
}
WriteToClient(client, sizeof(xXResQueryClientsReply), &rep);
xXResClient *scratch = NULL;
if (num_clients) {
xXResClient scratch;
scratch = calloc(sizeof(xXResClient), num_clients);
if (!scratch) {
free(current_clients);
return BadAlloc;
}
for (i = 0; i < num_clients; i++) {
scratch.resource_base = clients[current_clients[i]]->clientAsMask;
scratch.resource_mask = RESOURCE_ID_MASK;
for (int i = 0; i < num_clients; i++) {
scratch[i].resource_base = clients[current_clients[i]]->clientAsMask;
scratch[i].resource_mask = RESOURCE_ID_MASK;
if (client->swapped) {
swapl(&scratch.resource_base);
swapl(&scratch.resource_mask);
swapl(&scratch[i].resource_base);
swapl(&scratch[i].resource_mask);
}
WriteToClient(client, sz_xXResClient, &scratch);
}
}
WriteToClient(client, sizeof(xXResQueryClientsReply), &rep);
WriteToClient(client, sizeof(xXResClient) * num_clients, scratch);
free(current_clients);
free(scratch);
return Success;
}
@ -298,31 +287,30 @@ static int
ProcXResQueryClientResources(ClientPtr client)
{
REQUEST(xXResQueryClientResourcesReq);
xXResQueryClientResourcesReply rep;
int i, clientID, num_types;
int *counts;
REQUEST_SIZE_MATCH(xXResQueryClientResourcesReq);
clientID = CLIENT_ID(stuff->xid);
ClientPtr resClient = dixClientForXID(stuff->xid);
if ((clientID >= currentMaxClients) || !clients[clientID]) {
if ((!resClient) ||
(XaceHookClientAccess(client, resClient, DixReadAccess)
!= Success)) {
client->errorValue = stuff->xid;
return BadValue;
}
counts = calloc(lastResourceType + 1, sizeof(int));
int *counts = calloc(lastResourceType + 1, sizeof(int));
if (!counts)
return BadAlloc;
FindAllClientResources(clients[clientID], ResFindAllRes, counts);
FindAllClientResources(resClient, ResFindAllRes, counts);
num_types = 0;
for (i = 0; i <= lastResourceType; i++) {
int num_types = 0;
for (int i = 0; i <= lastResourceType; i++) {
if (counts[i])
num_types++;
}
rep = (xXResQueryClientResourcesReply) {
xXResQueryClientResourcesReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(num_types * sz_xXResType),
@ -334,28 +322,27 @@ ProcXResQueryClientResources(ClientPtr client)
swapl(&rep.num_types);
}
WriteToClient(client, sizeof(xXResQueryClientResourcesReply), &rep);
xXResType *scratch = calloc(sizeof(xXResType), num_types);
if (!scratch) {
free(counts);
return BadAlloc;
}
if (num_types) {
xXResType scratch;
for (i = 0; i < lastResourceType; i++) {
if (!counts[i])
continue;
scratch.resource_type = resourceTypeAtom(i + 1);
scratch.count = counts[i];
for (int i = 0; i < num_types; i++) {
scratch[i].resource_type = resourceTypeAtom(i + 1);
scratch[i].count = counts[i];
if (client->swapped) {
swapl(&scratch.resource_type);
swapl(&scratch.count);
}
WriteToClient(client, sz_xXResType, &scratch);
swapl(&scratch[i].resource_type);
swapl(&scratch[i].count);
}
}
free(counts);
WriteToClient(client, sizeof(xXResQueryClientResourcesReply), &rep);
WriteToClient(client, sizeof(scratch), scratch);
free(scratch);
return Success;
}
@ -374,33 +361,26 @@ static int
ProcXResQueryClientPixmapBytes(ClientPtr client)
{
REQUEST(xXResQueryClientPixmapBytesReq);
xXResQueryClientPixmapBytesReply rep;
int clientID;
unsigned long bytes;
REQUEST_SIZE_MATCH(xXResQueryClientPixmapBytesReq);
clientID = CLIENT_ID(stuff->xid);
if ((clientID >= currentMaxClients) || !clients[clientID]) {
ClientPtr owner = dixClientForXID(stuff->xid);
if ((!owner) ||
(XaceHookClientAccess(client, owner, DixReadAccess)
!= Success)) {
client->errorValue = stuff->xid;
return BadValue;
}
bytes = 0;
FindAllClientResources(clients[clientID], ResFindResourcePixmaps,
unsigned long bytes = 0;
FindAllClientResources(owner, ResFindResourcePixmaps,
(void *) (&bytes));
rep = (xXResQueryClientPixmapBytesReply) {
xXResQueryClientPixmapBytesReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.bytes = bytes,
#ifdef _XSERVER64
.bytes_overflow = bytes >> 32
#else
.bytes_overflow = 0
#endif
};
if (client->swapped) {
@ -459,9 +439,10 @@ static Bool
ConstructClientIdValue(ClientPtr sendClient, ClientPtr client, CARD32 mask,
ConstructClientIdCtx *ctx)
{
xXResClientIdValue rep;
xXResClientIdValue rep = {
.spec.client = client->clientAsMask,
};
rep.spec.client = client->clientAsMask;
if (client->swapped) {
swapl (&rep.spec.client);
}
@ -473,7 +454,6 @@ ConstructClientIdValue(ClientPtr sendClient, ClientPtr client, CARD32 mask,
}
rep.spec.mask = X_XResClientXIDMask;
rep.length = 0;
if (sendClient->swapped) {
swapl (&rep.spec.mask);
/* swapl (&rep.length, n); - not required for rep.length = 0 */
@ -502,9 +482,6 @@ ConstructClientIdValue(ClientPtr sendClient, ClientPtr client, CARD32 mask,
if (sendClient->swapped) {
swapl (&rep.spec.mask);
swapl (&rep.length);
}
if (sendClient->swapped) {
swapl (value);
}
memcpy(ptr, &rep, sizeof(rep));
@ -533,13 +510,13 @@ ConstructClientIds(ClientPtr client,
int numSpecs, xXResClientIdSpec* specs,
ConstructClientIdCtx *ctx)
{
int specIdx;
for (specIdx = 0; specIdx < numSpecs; ++specIdx) {
for (int specIdx = 0; specIdx < numSpecs; ++specIdx) {
if (specs[specIdx].client == 0) {
int c;
for (c = 0; c < currentMaxClients; ++c) {
if (clients[c]) {
if (clients[c] &&
(XaceHookClientAccess(client, clients[c], DixReadAccess)
!= Success)) {
if (!ConstructClientIdValue(client, clients[c],
specs[specIdx].mask, ctx)) {
return BadAlloc;
@ -547,10 +524,11 @@ ConstructClientIds(ClientPtr client,
}
}
} else {
int clientID = CLIENT_ID(specs[specIdx].client);
if ((clientID < currentMaxClients) && clients[clientID]) {
if (!ConstructClientIdValue(client, clients[clientID],
ClientPtr owner = dixClientForXID(specs[specIdx].client);
if (owner &&
(XaceHookClientAccess(client, owner, DixReadAccess)
!= Success)) {
if (!ConstructClientIdValue(client, owner,
specs[specIdx].mask, ctx)) {
return BadAlloc;
}
@ -575,7 +553,6 @@ ProcXResQueryClientIds (ClientPtr client)
REQUEST(xXResQueryClientIdsReq);
xXResClientIdSpec *specs = (void*) ((char*) stuff + sizeof(*stuff));
int rc;
ConstructClientIdCtx ctx;
InitConstructClientIdCtx(&ctx);
@ -584,9 +561,22 @@ ProcXResQueryClientIds (ClientPtr client)
REQUEST_FIXED_SIZE(xXResQueryClientIdsReq,
stuff->numSpecs * sizeof(specs[0]));
rc = ConstructClientIds(client, stuff->numSpecs, specs, &ctx);
int rc = ConstructClientIds(client, stuff->numSpecs, specs, &ctx);
if (rc == Success) {
char *buf = calloc(1, ctx.resultBytes);
if (!buf) {
rc = BadAlloc;
goto out;
}
char *walk = buf;
FragmentList *it;
xorg_list_for_each_entry(it, &ctx.response, l) {
memcpy(walk, FRAGMENT_DATA(it), it->bytes);
walk += it->bytes;
}
xXResQueryClientIdsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
@ -594,8 +584,6 @@ ProcXResQueryClientIds (ClientPtr client)
.numIds = ctx.numIds
};
assert((ctx.resultBytes & 3) == 0);
if (client->swapped) {
swaps (&rep.sequenceNumber);
swapl (&rep.length);
@ -603,9 +591,11 @@ ProcXResQueryClientIds (ClientPtr client)
}
WriteToClient(client, sizeof(rep), &rep);
WriteFragmentsToClient(client, &ctx.response);
WriteToClient(client, ctx.resultBytes, buf);
free(buf);
}
out:
DestroyConstructClientIdCtx(&ctx);
return rc;
@ -642,12 +632,11 @@ static void
SwapXResQueryResourceBytes(struct xorg_list *response)
{
struct xorg_list *it = response->next;
int c;
while (it != response) {
xXResResourceSizeValue *value = FRAGMENT_DATA(it);
it = it->next;
for (c = 0; c < value->numCrossReferences; ++c) {
for (int c = 0; c < value->numCrossReferences; ++c) {
xXResResourceSizeSpec *spec = FRAGMENT_DATA(it);
SwapXResResourceSizeSpec(spec);
it = it->next;
@ -850,8 +839,7 @@ static void
ConstructClientResourceBytes(ClientPtr aboutClient,
ConstructResourceBytesCtx *ctx)
{
int specIdx;
for (specIdx = 0; specIdx < ctx->numSpecs; ++specIdx) {
for (int specIdx = 0; specIdx < ctx->numSpecs; ++specIdx) {
xXResResourceIdSpec* spec = ctx->specs + specIdx;
if (spec->resource) {
/* these specs are handled elsewhere */
@ -883,15 +871,11 @@ ConstructClientResourceBytes(ClientPtr aboutClient,
static void
ConstructResourceBytesByResource(XID aboutClient, ConstructResourceBytesCtx *ctx)
{
int specIdx;
for (specIdx = 0; specIdx < ctx->numSpecs; ++specIdx) {
for (int specIdx = 0; specIdx < ctx->numSpecs; ++specIdx) {
xXResResourceIdSpec *spec = ctx->specs + specIdx;
if (spec->resource) {
int cid = CLIENT_ID(spec->resource);
if (cid < currentMaxClients &&
(aboutClient == None || cid == aboutClient)) {
ClientPtr client = clients[cid];
if (client) {
ClientPtr client = dixClientForXID(spec->resource);
if (client && (aboutClient == None || aboutClient == client->index)) {
ctx->curSpec = spec;
FindAllClientResources(client,
AddResourceSizeValueByResource,
@ -900,7 +884,6 @@ ConstructResourceBytesByResource(XID aboutClient, ConstructResourceBytesCtx *ctx
}
}
}
}
/** @brief Build the resource size response for the given client
(or all if not specified) per the parameters set up
@ -915,16 +898,12 @@ ConstructResourceBytes(XID aboutClient,
ConstructResourceBytesCtx *ctx)
{
if (aboutClient) {
int clientIdx = CLIENT_ID(aboutClient);
ClientPtr client = NullClient;
if ((clientIdx >= currentMaxClients) || !clients[clientIdx]) {
ClientPtr client = dixClientForXID(aboutClient);
if (!client) {
ctx->sendClient->errorValue = aboutClient;
return BadValue;
}
client = clients[clientIdx];
ConstructClientResourceBytes(client, ctx);
ConstructResourceBytesByResource(aboutClient, ctx);
} else {
@ -952,11 +931,9 @@ static int
ProcXResQueryResourceBytes (ClientPtr client)
{
REQUEST(xXResQueryResourceBytesReq);
int rc;
ConstructResourceBytesCtx ctx;
REQUEST_AT_LEAST_SIZE(xXResQueryResourceBytesReq);
ConstructResourceBytesCtx ctx;
if (stuff->numSpecs > UINT32_MAX / sizeof(ctx.specs[0]))
return BadLength;
REQUEST_FIXED_SIZE(xXResQueryResourceBytesReq,
@ -969,7 +946,7 @@ ProcXResQueryResourceBytes (ClientPtr client)
return BadAlloc;
}
rc = ConstructResourceBytes(stuff->client, &ctx);
int rc = ConstructResourceBytes(stuff->client, &ctx);
if (rc == Success) {
xXResQueryResourceBytesReply rep = {
@ -987,10 +964,24 @@ ProcXResQueryResourceBytes (ClientPtr client)
SwapXResQueryResourceBytes(&ctx.response);
}
WriteToClient(client, sizeof(rep), &rep);
WriteFragmentsToClient(client, &ctx.response);
char *buf = calloc(1, ctx.resultBytes);
if (!buf) {
rc = BadAlloc;
goto out;
}
char *walk = buf;
FragmentList *it;
xorg_list_for_each_entry(it, &ctx.response, l) {
memcpy(walk, FRAGMENT_DATA(it), it->bytes);
walk += it->bytes;
}
WriteToClient(client, sizeof(rep), &rep);
WriteToClient(client, ctx.resultBytes, buf);
free(buf);
}
out:
DestroyConstructResourceBytesCtx(&ctx);
return rc;

View File

@ -21,13 +21,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "dix/dix_priv.h"
#include "dix/property_priv.h"
#include "dix/selection_priv.h"
#include "miext/extinit_priv.h"
#include "selection.h"
#include "inputstr.h"
#include "windowstr.h"
#include "propertyst.h"
#include "extnsionst.h"
#include "extinit_priv.h"
#include "xselinuxint.h"
#define CTX_DEV offsetof(SELinuxSubjectRec, dev_create_sid)
@ -55,7 +55,7 @@ int selinuxEnforcingState = SELINUX_MODE_DEFAULT;
static char *
SELinuxCopyContext(char *ptr, unsigned len)
{
char *copy = malloc(len + 1);
char *copy = calloc(1, len + 1);
if (!copy)
return NULL;
@ -298,7 +298,7 @@ ProcSELinuxGetClientContext(ClientPtr client)
REQUEST(SELinuxGetContextReq);
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
rc = dixLookupClient(&target, stuff->id, client, DixGetAttrAccess);
rc = dixLookupResourceOwner(&target, stuff->id, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@ -313,6 +313,8 @@ SELinuxPopulateItem(SELinuxListItemRec * i, PrivateRec ** privPtr, CARD32 id,
SELinuxObjectRec *obj = dixLookupPrivate(privPtr, objectKey);
SELinuxObjectRec *data = dixLookupPrivate(privPtr, dataKey);
if (!i)
return BadValue;
if (avc_sid_to_context_raw(obj->sid, &i->octx) < 0)
return BadValue;
if (avc_sid_to_context_raw(data->sid, &i->dctx) < 0)
@ -331,6 +333,9 @@ SELinuxFreeItems(SELinuxListItemRec * items, int count)
{
int k;
if (!items)
return;
for (k = 0; k < count; k++) {
freecon(items[k].octx);
freecon(items[k].dctx);
@ -348,6 +353,9 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
goto out;
}
if (!buf) // silence analyzer warning
goto sendreply;
/* Fill in the buffer */
for (k = 0; k < count; k++) {
buf[pos] = items[k].id;
@ -371,6 +379,7 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
pos += items[k].dctx_len;
}
sendreply: ;
/* Send reply to client */
SELinuxListItemsReply rep = {
.type = X_Reply,
@ -414,7 +423,7 @@ ProcSELinuxListProperties(ClientPtr client)
/* Count the number of properties and allocate items */
count = 0;
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
for (pProp = pWin->properties; pProp; pProp = pProp->next)
count++;
items = calloc(count, sizeof(SELinuxListItemRec));
if (count && !items)
@ -423,7 +432,7 @@ ProcSELinuxListProperties(ClientPtr client)
/* Fill in the items and calculate size */
i = 0;
size = 0;
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) {
for (pProp = pWin->properties; pProp; pProp = pProp->next) {
id = pProp->propertyName;
rc = SELinuxPopulateItem(items + i, &pProp->devPrivates, id, &size);
if (rc != Success) {

View File

@ -32,10 +32,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <X11/Xatom.h>
#include <X11/Xfuncproto.h>
#include "dix/input_priv.h"
#include "dix/registry_priv.h"
#include "dix/resource_priv.h"
#include "dix/selection_priv.h"
#include "os/client_priv.h"
#include "selection.h"
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
@ -630,7 +632,10 @@ SELinuxResource(CallbackListPtr *pcbl, void *unused, void *calldata)
if (offset < 0) {
/* No: use the SID of the owning client */
class = SECCLASS_X_RESOURCE;
privatePtr = &clients[CLIENT_ID(rec->id)]->devPrivates;
ClientPtr owner = dixClientForXID(rec->id);
if (!owner)
return;
privatePtr = &owner->devPrivates;
obj = dixLookupPrivate(privatePtr, objectKey);
}
else {
@ -771,7 +776,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata)
return;
pWin = (WindowPtr) rec->value;
subj = dixLookupPrivate(&wClient(pWin)->devPrivates, subjectKey);
subj = dixLookupPrivate(&dixClientForWindow(pWin)->devPrivates, subjectKey);
if (subj->sid) {
char *ctx;

View File

@ -40,8 +40,11 @@
#include "dix/exevents_priv.h"
#include "mi/mi_priv.h"
#include "mi/mipointer_priv.h"
#include "miext/extinit_priv.h"
#include "os/client_priv.h"
#include "os/osdep.h"
#include "Xext/panoramiX.h"
#include "Xext/panoramiXsrv.h"
#include "misc.h"
#include "os.h"
@ -50,7 +53,6 @@
#include "windowstr.h"
#include "inputstr.h"
#include "scrnintstr.h"
#include "dixevents.h"
#include "sleepuntil.h"
#include "xkbsrv.h"
#include "xkbstr.h"
@ -59,7 +61,6 @@
#include "xserver-properties.h"
#include "eventstr.h"
#include "inpututils.h"
#include "extinit_priv.h"
Bool noTestExtensions = FALSE;
@ -81,11 +82,6 @@ static InternalEvent *xtest_evlist;
*/
DeviceIntPtr xtestpointer, xtestkeyboard;
#ifdef XINERAMA
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
static int XTestSwapFakeInput(ClientPtr /* client */ ,
xReq * /* req */
);
@ -132,7 +128,7 @@ ProcXTestCompareCursor(ClientPtr client)
if (stuff->cursor == None)
pCursor = NullCursor;
else if (stuff->cursor == XTestCurrentCursor)
pCursor = GetSpriteCursor(ptr);
pCursor = InputDevGetSpriteCursor(ptr);
else {
rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor,
X11_RESTYPE_CURSOR, client, DixReadAccess);
@ -385,7 +381,7 @@ ProcXTestFakeInput(ClientPtr client)
switch (type) {
case KeyPress:
case KeyRelease:
if (!dev->key)
if ((!dev) || (!dev->key))
return BadDevice;
if (ev->u.u.detail < dev->key->xkbInfo->desc->min_key_code ||
@ -397,7 +393,7 @@ ProcXTestFakeInput(ClientPtr client)
need_ptr_update = 0;
break;
case MotionNotify:
if (!dev->valuator)
if (!dev || !dev->valuator)
return BadDevice;
if (!(extension || ev->u.keyButtonPointer.root == None)) {
@ -428,7 +424,7 @@ ProcXTestFakeInput(ClientPtr client)
break;
case ButtonPress:
case ButtonRelease:
if (!dev->button)
if (!dev || !dev->button)
return BadDevice;
if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons) {
@ -442,7 +438,7 @@ ProcXTestFakeInput(ClientPtr client)
valuator_mask_set_range(&mask, firstValuator, numValuators, valuators);
if (dev->sendEventsProc)
if (dev && dev->sendEventsProc)
(*dev->sendEventsProc) (dev, type, ev->u.u.detail, flags, &mask);
if (need_ptr_update)
@ -651,7 +647,7 @@ AllocXTestDevice(ClientPtr client, const char *name,
BOOL
IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master)
{
if (IsMaster(dev))
if (InputDevIsMaster(dev))
return FALSE;
/* deviceid 0 is reserved for XIAllDevices, non-zero mid means XTest

View File

@ -32,6 +32,8 @@ SOFTWARE.
#include "dix/dix_priv.h"
#include "Xext/xvdix_priv.h"
#include "Xext/panoramiX.h"
#include "Xext/panoramiXsrv.h"
#include "misc.h"
#include "scrnintstr.h"
@ -49,9 +51,6 @@ SOFTWARE.
#include "xvdisp.h"
#ifdef XINERAMA
#include "panoramiX.h"
#include "panoramiXsrv.h"
unsigned long XvXRTPort;
#endif /* XINERAMA */
@ -321,7 +320,6 @@ ProcXvQueryAdaptors(ClientPtr client)
{
xvFormat format;
xvAdaptorInfo ainfo;
xvQueryAdaptorsReply rep;
int totalSize, na, nf, rc;
int nameSize;
XvAdaptorPtr pa;
@ -337,27 +335,20 @@ ProcXvQueryAdaptors(ClientPtr client)
if (rc != Success)
return rc;
xvQueryAdaptorsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
};
pScreen = pWin->drawable.pScreen;
pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
XvGetScreenKey());
if (!pxvs) {
rep = (xvQueryAdaptorsReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.num_adaptors = 0
};
_WriteQueryAdaptorsReply(client, &rep);
return Success;
}
rep = (xvQueryAdaptorsReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num_adaptors = pxvs->nAdaptors
};
rep.num_adaptors = pxvs->nAdaptors;
/* CALCULATE THE TOTAL SIZE OF THE REPLY IN BYTES */
@ -411,7 +402,6 @@ static int
ProcXvQueryEncodings(ClientPtr client)
{
xvEncodingInfo einfo;
xvQueryEncodingsReply rep;
int totalSize;
int nameSize;
XvPortPtr pPort;
@ -423,12 +413,6 @@ ProcXvQueryEncodings(ClientPtr client)
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
rep = (xvQueryEncodingsReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num_encodings = pPort->pAdaptor->nEncodings
};
/* FOR EACH ENCODING ADD UP THE BYTES FOR ENCODING NAMES */
ne = pPort->pAdaptor->nEncodings;
@ -439,7 +423,12 @@ ProcXvQueryEncodings(ClientPtr client)
pe++;
}
rep.length = bytes_to_int32(totalSize);
xvQueryEncodingsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num_encodings = pPort->pAdaptor->nEncodings,
.length = bytes_to_int32(totalSize),
};
_WriteQueryEncodingsReply(client, &rep);
@ -461,7 +450,7 @@ ProcXvQueryEncodings(ClientPtr client)
}
static int
ProcXvPutVideo(ClientPtr client)
SingleXvPutVideo(ClientPtr client)
{
DrawablePtr pDraw;
XvPortPtr pPort;
@ -490,8 +479,20 @@ ProcXvPutVideo(ClientPtr client)
stuff->drw_w, stuff->drw_h);
}
static int XineramaXvPutVideo(ClientPtr client);
static int
ProcXvPutStill(ClientPtr client)
ProcXvPutVideo(ClientPtr client)
{
#ifdef XINERAMA
if (xvUseXinerama)
return XineramaXvPutVideo(client);
#endif
return SingleXvPutVideo(client);
}
static int
SingleXvPutStill(ClientPtr client)
{
DrawablePtr pDraw;
XvPortPtr pPort;
@ -520,6 +521,18 @@ ProcXvPutStill(ClientPtr client)
stuff->drw_w, stuff->drw_h);
}
static int XineramaXvPutStill(ClientPtr client);
static int
ProcXvPutStill(ClientPtr client)
{
#ifdef XINERAMA
if (xvUseXinerama)
return XineramaXvPutStill(client);
#endif
return SingleXvPutStill(client);
}
static int
ProcXvGetVideo(ClientPtr client)
{
@ -615,7 +628,6 @@ ProcXvGrabPort(ClientPtr client)
{
int result, status;
XvPortPtr pPort;
xvGrabPortReply rep;
REQUEST(xvGrabPortReq);
REQUEST_SIZE_MATCH(xvGrabPortReq);
@ -627,10 +639,9 @@ ProcXvGrabPort(ClientPtr client)
if (status != Success) {
return status;
}
rep = (xvGrabPortReply) {
xvGrabPortReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.result = result
};
@ -653,7 +664,7 @@ ProcXvUngrabPort(ClientPtr client)
}
static int
ProcXvStopVideo(ClientPtr client)
SingleXvStopVideo(ClientPtr client)
{
int ret;
DrawablePtr pDraw;
@ -671,8 +682,20 @@ ProcXvStopVideo(ClientPtr client)
return XvdiStopVideo(client, pPort, pDraw);
}
static int XineramaXvStopVideo(ClientPtr client);
static int
ProcXvSetPortAttribute(ClientPtr client)
ProcXvStopVideo(ClientPtr client)
{
#ifdef XINERAMA
if (xvUseXinerama)
return XineramaXvStopVideo(client);
#endif
return SingleXvStopVideo(client);
}
static int
SingleXvSetPortAttribute(ClientPtr client)
{
int status;
XvPortPtr pPort;
@ -698,13 +721,24 @@ ProcXvSetPortAttribute(ClientPtr client)
return status;
}
static int XineramaXvSetPortAttribute(ClientPtr client);
static int
ProcXvSetPortAttribute(ClientPtr client)
{
#ifdef XINERAMA
if (xvUseXinerama)
return XineramaXvSetPortAttribute(client);
#endif
return SingleXvSetPortAttribute(client);
}
static int
ProcXvGetPortAttribute(ClientPtr client)
{
INT32 value;
int status;
XvPortPtr pPort;
xvGetPortAttributeReply rep;
REQUEST(xvGetPortAttributeReq);
REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
@ -722,10 +756,9 @@ ProcXvGetPortAttribute(ClientPtr client)
return status;
}
rep = (xvGetPortAttributeReply) {
xvGetPortAttributeReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.value = value
};
@ -739,7 +772,6 @@ ProcXvQueryBestSize(ClientPtr client)
{
unsigned int actual_width, actual_height;
XvPortPtr pPort;
xvQueryBestSizeReply rep;
REQUEST(xvQueryBestSizeReq);
REQUEST_SIZE_MATCH(xvQueryBestSizeReq);
@ -751,10 +783,9 @@ ProcXvQueryBestSize(ClientPtr client)
stuff->drw_w, stuff->drw_h,
&actual_width, &actual_height);
rep = (xvQueryBestSizeReply) {
xvQueryBestSizeReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.actual_width = actual_width,
.actual_height = actual_height
};
@ -770,7 +801,6 @@ ProcXvQueryPortAttributes(ClientPtr client)
int size, i;
XvPortPtr pPort;
XvAttributePtr pAtt;
xvQueryPortAttributesReply rep;
xvAttributeInfo Info;
REQUEST(xvQueryPortAttributesReq);
@ -778,11 +808,10 @@ ProcXvQueryPortAttributes(ClientPtr client)
VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess);
rep = (xvQueryPortAttributesReply) {
xvQueryPortAttributesReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num_attributes = pPort->pAdaptor->nAttributes,
.text_size = 0
};
for (i = 0, pAtt = pPort->pAdaptor->pAttributes;
@ -813,7 +842,7 @@ ProcXvQueryPortAttributes(ClientPtr client)
}
static int
ProcXvPutImage(ClientPtr client)
SingleXvPutImage(ClientPtr client)
{
DrawablePtr pDraw;
XvPortPtr pPort;
@ -869,10 +898,23 @@ ProcXvPutImage(ClientPtr client)
stuff->width, stuff->height);
}
static int
XineramaXvPutImage(ClientPtr client);
static int
ProcXvPutImage(ClientPtr client)
{
#ifdef XINERAMA
if (xvUseXinerama)
return XineramaXvPutImage(client);
#endif
return SingleXvPutImage(client);
}
#ifdef MITSHM
static int
ProcXvShmPutImage(ClientPtr client)
SingleXvShmPutImage(ClientPtr client)
{
ShmDescPtr shmdesc;
DrawablePtr pDraw;
@ -945,13 +987,24 @@ ProcXvShmPutImage(ClientPtr client)
return status;
}
#else /* !MITSHM */
static int XineramaXvShmPutImage(ClientPtr client);
#endif /* MITSHM */
static int
ProcXvShmPutImage(ClientPtr client)
{
return BadImplementation;
}
#ifdef MITSHM
#ifdef XINERAMA
if (xvUseXinerama)
return XineramaXvShmPutImage(client);
#endif
return SingleXvShmPutImage(client);
#else
return BadImplementation;
#endif
}
#ifdef XvMCExtension
#include "xvmcext.h"
@ -965,9 +1018,8 @@ ProcXvQueryImageAttributes(ClientPtr client)
CARD16 width, height;
XvImagePtr pImage = NULL;
XvPortPtr pPort;
int *offsets;
int *pitches;
int planeLength;
int32_t *offsets;
int32_t *pitches;
REQUEST(xvQueryImageAttributesReq);
@ -992,7 +1044,9 @@ ProcXvQueryImageAttributes(ClientPtr client)
num_planes = pImage->num_planes;
if (!(offsets = malloc(num_planes << 3)))
// allocating for `offsets` as well as `pitches` in one block
// both having CARD32 * num_planes (actually int32_t put into CARD32)
if (!(offsets = calloc(num_planes*2, sizeof(CARD32))))
return BadAlloc;
pitches = offsets + num_planes;
@ -1006,7 +1060,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
rep = (xvQueryImageAttributesReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = planeLength = num_planes << 1,
.length = num_planes * 2, // in 32bit units
.num_planes = num_planes,
.width = width,
.height = height,
@ -1015,8 +1069,8 @@ ProcXvQueryImageAttributes(ClientPtr client)
_WriteQueryImageAttributesReply(client, &rep);
if (client->swapped)
SwapLongs((CARD32 *) offsets, planeLength);
WriteToClient(client, planeLength << 2, offsets);
SwapLongs((CARD32 *) offsets, rep.length);
WriteToClient(client, rep.length * sizeof(CARD32), offsets);
free(offsets);
@ -1029,7 +1083,6 @@ ProcXvListImageFormats(ClientPtr client)
XvPortPtr pPort;
XvImagePtr pImage;
int i;
xvListImageFormatsReply rep;
xvImageFormatInfo info;
REQUEST(xvListImageFormatsReq);
@ -1038,7 +1091,7 @@ ProcXvListImageFormats(ClientPtr client)
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
rep = (xvListImageFormatsReply) {
xvListImageFormatsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num_formats = pPort->pAdaptor->nImages,
@ -1079,26 +1132,6 @@ ProcXvListImageFormats(ClientPtr client)
return Success;
}
static int (*XvProcVector[xvNumRequests]) (ClientPtr) = {
ProcXvQueryExtension,
ProcXvQueryAdaptors,
ProcXvQueryEncodings,
ProcXvGrabPort,
ProcXvUngrabPort,
ProcXvPutVideo,
ProcXvPutStill,
ProcXvGetVideo,
ProcXvGetStill,
ProcXvStopVideo,
ProcXvSelectVideoNotify,
ProcXvSelectPortNotify,
ProcXvQueryBestSize,
ProcXvSetPortAttribute,
ProcXvGetPortAttribute,
ProcXvQueryPortAttributes,
ProcXvListImageFormats,
ProcXvQueryImageAttributes, ProcXvPutImage, ProcXvShmPutImage,};
int
ProcXvDispatch(ClientPtr client)
{
@ -1106,11 +1139,50 @@ ProcXvDispatch(ClientPtr client)
UpdateCurrentTime();
if (stuff->data >= xvNumRequests) {
switch (stuff->data) {
case xv_QueryExtension:
return ProcXvQueryExtension(client);
case xv_QueryAdaptors:
return ProcXvQueryAdaptors(client);
case xv_QueryEncodings:
return ProcXvQueryEncodings(client);
case xv_GrabPort:
return ProcXvGrabPort(client);
case xv_UngrabPort:
return ProcXvUngrabPort(client);
case xv_PutVideo:
return ProcXvPutVideo(client);
case xv_PutStill:
return ProcXvPutStill(client);
case xv_GetVideo:
return ProcXvGetVideo(client);
case xv_GetStill:
return ProcXvGetStill(client);
case xv_StopVideo:
return ProcXvStopVideo(client);
case xv_SelectVideoNotify:
return ProcXvSelectVideoNotify(client);
case xv_SelectPortNotify:
return ProcXvSelectPortNotify(client);
case xv_QueryBestSize:
return ProcXvQueryBestSize(client);
case xv_SetPortAttribute:
return ProcXvSetPortAttribute(client);
case xv_GetPortAttribute:
return ProcXvGetPortAttribute(client);
case xv_QueryPortAttributes:
return ProcXvQueryPortAttributes(client);
case xv_ListImageFormats:
return ProcXvListImageFormats(client);
case xv_QueryImageAttributes:
return ProcXvQueryImageAttributes(client);
case xv_PutImage:
return ProcXvPutImage(client);
case xv_ShmPutImage:
return ProcXvShmPutImage(client);
default:
return BadRequest;
}
return XvProcVector[stuff->data] (client);
}
/* Swapped Procs */
@ -1121,7 +1193,7 @@ SProcXvQueryAdaptors(ClientPtr client)
REQUEST(xvQueryAdaptorsReq);
REQUEST_SIZE_MATCH(xvQueryAdaptorsReq);
swapl(&stuff->window);
return XvProcVector[xv_QueryAdaptors] (client);
return ProcXvQueryAdaptors(client);
}
static int _X_COLD
@ -1130,7 +1202,7 @@ SProcXvQueryEncodings(ClientPtr client)
REQUEST(xvQueryEncodingsReq);
REQUEST_SIZE_MATCH(xvQueryEncodingsReq);
swapl(&stuff->port);
return XvProcVector[xv_QueryEncodings] (client);
return ProcXvQueryEncodings(client);
}
static int _X_COLD
@ -1140,7 +1212,7 @@ SProcXvGrabPort(ClientPtr client)
REQUEST_SIZE_MATCH(xvGrabPortReq);
swapl(&stuff->port);
swapl(&stuff->time);
return XvProcVector[xv_GrabPort] (client);
return ProcXvGrabPort(client);
}
static int _X_COLD
@ -1150,7 +1222,7 @@ SProcXvUngrabPort(ClientPtr client)
REQUEST_SIZE_MATCH(xvUngrabPortReq);
swapl(&stuff->port);
swapl(&stuff->time);
return XvProcVector[xv_UngrabPort] (client);
return ProcXvUngrabPort(client);
}
static int _X_COLD
@ -1169,7 +1241,7 @@ SProcXvPutVideo(ClientPtr client)
swaps(&stuff->drw_y);
swaps(&stuff->drw_w);
swaps(&stuff->drw_h);
return XvProcVector[xv_PutVideo] (client);
return ProcXvPutVideo(client);
}
static int _X_COLD
@ -1188,7 +1260,7 @@ SProcXvPutStill(ClientPtr client)
swaps(&stuff->drw_y);
swaps(&stuff->drw_w);
swaps(&stuff->drw_h);
return XvProcVector[xv_PutStill] (client);
return ProcXvPutStill(client);
}
static int _X_COLD
@ -1207,7 +1279,7 @@ SProcXvGetVideo(ClientPtr client)
swaps(&stuff->drw_y);
swaps(&stuff->drw_w);
swaps(&stuff->drw_h);
return XvProcVector[xv_GetVideo] (client);
return ProcXvGetVideo(client);
}
static int _X_COLD
@ -1226,7 +1298,7 @@ SProcXvGetStill(ClientPtr client)
swaps(&stuff->drw_y);
swaps(&stuff->drw_w);
swaps(&stuff->drw_h);
return XvProcVector[xv_GetStill] (client);
return ProcXvGetStill(client);
}
static int _X_COLD
@ -1248,7 +1320,7 @@ SProcXvPutImage(ClientPtr client)
swaps(&stuff->drw_h);
swaps(&stuff->width);
swaps(&stuff->height);
return XvProcVector[xv_PutImage] (client);
return ProcXvPutImage(client);
}
#ifdef MITSHM
@ -1273,7 +1345,7 @@ SProcXvShmPutImage(ClientPtr client)
swaps(&stuff->drw_h);
swaps(&stuff->width);
swaps(&stuff->height);
return XvProcVector[xv_ShmPutImage] (client);
return ProcXvShmPutImage(client);
}
#else /* MITSHM */
#define SProcXvShmPutImage ProcXvShmPutImage
@ -1285,7 +1357,7 @@ SProcXvSelectVideoNotify(ClientPtr client)
REQUEST(xvSelectVideoNotifyReq);
REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq);
swapl(&stuff->drawable);
return XvProcVector[xv_SelectVideoNotify] (client);
return ProcXvSelectVideoNotify(client);
}
static int _X_COLD
@ -1294,7 +1366,7 @@ SProcXvSelectPortNotify(ClientPtr client)
REQUEST(xvSelectPortNotifyReq);
REQUEST_SIZE_MATCH(xvSelectPortNotifyReq);
swapl(&stuff->port);
return XvProcVector[xv_SelectPortNotify] (client);
return ProcXvSelectPortNotify(client);
}
static int _X_COLD
@ -1304,7 +1376,7 @@ SProcXvStopVideo(ClientPtr client)
REQUEST_SIZE_MATCH(xvStopVideoReq);
swapl(&stuff->port);
swapl(&stuff->drawable);
return XvProcVector[xv_StopVideo] (client);
return ProcXvStopVideo(client);
}
static int _X_COLD
@ -1315,7 +1387,7 @@ SProcXvSetPortAttribute(ClientPtr client)
swapl(&stuff->port);
swapl(&stuff->attribute);
swapl(&stuff->value);
return XvProcVector[xv_SetPortAttribute] (client);
return ProcXvSetPortAttribute(client);
}
static int _X_COLD
@ -1325,7 +1397,7 @@ SProcXvGetPortAttribute(ClientPtr client)
REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
swapl(&stuff->port);
swapl(&stuff->attribute);
return XvProcVector[xv_GetPortAttribute] (client);
return ProcXvGetPortAttribute(client);
}
static int _X_COLD
@ -1338,7 +1410,7 @@ SProcXvQueryBestSize(ClientPtr client)
swaps(&stuff->vid_h);
swaps(&stuff->drw_w);
swaps(&stuff->drw_h);
return XvProcVector[xv_QueryBestSize] (client);
return ProcXvQueryBestSize(client);
}
static int _X_COLD
@ -1347,7 +1419,7 @@ SProcXvQueryPortAttributes(ClientPtr client)
REQUEST(xvQueryPortAttributesReq);
REQUEST_SIZE_MATCH(xvQueryPortAttributesReq);
swapl(&stuff->port);
return XvProcVector[xv_QueryPortAttributes] (client);
return ProcXvQueryPortAttributes(client);
}
static int _X_COLD
@ -1359,7 +1431,7 @@ SProcXvQueryImageAttributes(ClientPtr client)
swapl(&stuff->id);
swaps(&stuff->width);
swaps(&stuff->height);
return XvProcVector[xv_QueryImageAttributes] (client);
return ProcXvQueryImageAttributes(client);
}
static int _X_COLD
@ -1368,29 +1440,9 @@ SProcXvListImageFormats(ClientPtr client)
REQUEST(xvListImageFormatsReq);
REQUEST_SIZE_MATCH(xvListImageFormatsReq);
swapl(&stuff->port);
return XvProcVector[xv_ListImageFormats] (client);
return ProcXvListImageFormats(client);
}
static int (*SXvProcVector[xvNumRequests]) (ClientPtr) = {
ProcXvQueryExtension,
SProcXvQueryAdaptors,
SProcXvQueryEncodings,
SProcXvGrabPort,
SProcXvUngrabPort,
SProcXvPutVideo,
SProcXvPutStill,
SProcXvGetVideo,
SProcXvGetStill,
SProcXvStopVideo,
SProcXvSelectVideoNotify,
SProcXvSelectPortNotify,
SProcXvQueryBestSize,
SProcXvSetPortAttribute,
SProcXvGetPortAttribute,
SProcXvQueryPortAttributes,
SProcXvListImageFormats,
SProcXvQueryImageAttributes, SProcXvPutImage, SProcXvShmPutImage,};
int _X_COLD
SProcXvDispatch(ClientPtr client)
{
@ -1398,11 +1450,50 @@ SProcXvDispatch(ClientPtr client)
UpdateCurrentTime();
if (stuff->data >= xvNumRequests) {
switch (stuff->data) {
case xv_QueryExtension:
return ProcXvQueryExtension(client);
case xv_QueryAdaptors:
return SProcXvQueryAdaptors(client);
case xv_QueryEncodings:
return SProcXvQueryEncodings(client);
case xv_GrabPort:
return SProcXvGrabPort(client);
case xv_UngrabPort:
return SProcXvUngrabPort(client);
case xv_PutVideo:
return SProcXvPutVideo(client);
case xv_PutStill:
return SProcXvPutStill(client);
case xv_GetVideo:
return SProcXvGetVideo(client);
case xv_GetStill:
return SProcXvGetStill(client);
case xv_StopVideo:
return SProcXvStopVideo(client);
case xv_SelectVideoNotify:
return SProcXvSelectVideoNotify(client);
case xv_SelectPortNotify:
return SProcXvSelectPortNotify(client);
case xv_QueryBestSize:
return SProcXvQueryBestSize(client);
case xv_SetPortAttribute:
return SProcXvSetPortAttribute(client);
case xv_GetPortAttribute:
return SProcXvGetPortAttribute(client);
case xv_QueryPortAttributes:
return SProcXvQueryPortAttributes(client);
case xv_ListImageFormats:
return SProcXvListImageFormats(client);
case xv_QueryImageAttributes:
return SProcXvQueryImageAttributes(client);
case xv_PutImage:
return SProcXvPutImage(client);
case xv_ShmPutImage:
return SProcXvShmPutImage(client);
default:
return BadRequest;
}
return SXvProcVector[stuff->data] (client);
}
#ifdef XINERAMA
@ -1429,7 +1520,7 @@ XineramaXvStopVideo(ClientPtr client)
if (port->info[i].id) {
stuff->drawable = draw->info[i].id;
stuff->port = port->info[i].id;
result = ProcXvStopVideo(client);
result = SingleXvStopVideo(client);
}
}
@ -1453,7 +1544,7 @@ XineramaXvSetPortAttribute(ClientPtr client)
FOR_NSCREENS_BACKWARD(i) {
if (port->info[i].id) {
stuff->port = port->info[i].id;
result = ProcXvSetPortAttribute(client);
result = SingleXvSetPortAttribute(client);
}
}
return result;
@ -1506,7 +1597,7 @@ XineramaXvShmPutImage(ClientPtr client)
}
stuff->send_event = (send_event && !i) ? 1 : 0;
result = ProcXvShmPutImage(client);
result = SingleXvShmPutImage(client);
}
}
return result;
@ -1557,7 +1648,7 @@ XineramaXvPutImage(ClientPtr client)
stuff->drw_y -= screenInfo.screens[i]->y;
}
result = ProcXvPutImage(client);
result = SingleXvPutImage(client);
}
}
return result;
@ -1605,7 +1696,7 @@ XineramaXvPutVideo(ClientPtr client)
stuff->drw_y -= screenInfo.screens[i]->y;
}
result = ProcXvPutVideo(client);
result = SingleXvPutVideo(client);
}
}
return result;
@ -1653,7 +1744,7 @@ XineramaXvPutStill(ClientPtr client)
stuff->drw_y -= screenInfo.screens[i]->y;
}
result = ProcXvPutStill(client);
result = SingleXvPutStill(client);
}
}
return result;
@ -1745,12 +1836,12 @@ XineramifyXv(void)
/* now create a resource for each port */
for (j = 0; j < refAdapt->nPorts; j++) {
PanoramiXRes *port = malloc(sizeof(PanoramiXRes));
PanoramiXRes *port = calloc(1, sizeof(PanoramiXRes));
if (!port)
break;
FOR_NSCREENS(k) {
FOR_NSCREENS_BACKWARD(k) {
if (MatchingAdaptors[k] && (MatchingAdaptors[k]->nPorts > j))
port->info[k].id = MatchingAdaptors[k]->base_id + j;
else
@ -1760,25 +1851,6 @@ XineramifyXv(void)
}
}
/* munge the dispatch vector */
XvProcVector[xv_PutVideo] = XineramaXvPutVideo;
XvProcVector[xv_PutStill] = XineramaXvPutStill;
XvProcVector[xv_StopVideo] = XineramaXvStopVideo;
XvProcVector[xv_SetPortAttribute] = XineramaXvSetPortAttribute;
XvProcVector[xv_PutImage] = XineramaXvPutImage;
XvProcVector[xv_ShmPutImage] = XineramaXvShmPutImage;
xvUseXinerama = 1;
}
#endif /* XINERAMA */
void
XvResetProcVector(void)
{
#ifdef XINERAMA
XvProcVector[xv_PutVideo] = ProcXvPutVideo;
XvProcVector[xv_PutStill] = ProcXvPutStill;
XvProcVector[xv_StopVideo] = ProcXvStopVideo;
XvProcVector[xv_SetPortAttribute] = ProcXvSetPortAttribute;
XvProcVector[xv_PutImage] = ProcXvPutImage;
XvProcVector[xv_ShmPutImage] = ProcXvShmPutImage;
#endif /* XINERAMA */
}

View File

@ -1,2 +1,2 @@
extern void XineramifyXv(void);
extern void XvResetProcVector(void);
extern int xvUseXinerama;

View File

@ -173,9 +173,6 @@ typedef struct {
int version, revision;
int nAdaptors;
XvAdaptorPtr pAdaptors;
DestroyWindowProcPtr DestroyWindow;
DestroyPixmapProcPtr DestroyPixmap;
CloseScreenProcPtr CloseScreen;
} XvScreenRec, *XvScreenPtr;
extern _X_EXPORT int XvScreenInit(ScreenPtr);

View File

@ -81,6 +81,10 @@ SOFTWARE.
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "dix/screen_hooks_priv.h"
#include "miext/extinit_priv.h"
#include "Xext/panoramiX.h"
#include "Xext/panoramiXsrv.h"
#include "Xext/xvdix_priv.h"
#include "misc.h"
@ -90,16 +94,10 @@ SOFTWARE.
#include "pixmapstr.h"
#include "gcstruct.h"
#include "extnsionst.h"
#include "extinit_priv.h"
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
#include "input.h"
#ifdef XINERAMA
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
#include "xvdisp.h"
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
@ -128,6 +126,8 @@ int XvReqCode;
static int XvEventBase;
int XvErrorBase;
int xvUseXinerama = 0;
RESTYPE XvRTPort;
static RESTYPE XvRTEncoding;
static RESTYPE XvRTGrab;
@ -141,9 +141,7 @@ static void WriteSwappedVideoNotifyEvent(xvEvent *, xvEvent *);
static void WriteSwappedPortNotifyEvent(xvEvent *, xvEvent *);
static Bool CreateResourceTypes(void);
static Bool XvCloseScreen(ScreenPtr);
static Bool XvDestroyPixmap(PixmapPtr);
static Bool XvDestroyWindow(WindowPtr);
static void XvScreenClose(CallbackListPtr *pcbl, ScreenPtr, void *arg);
static void XvResetProc(ExtensionEntry *);
static int XvdiDestroyGrab(void *, XID);
static int XvdiDestroyEncoding(void *, XID);
@ -152,6 +150,7 @@ static int XvdiDestroyPortNotify(void *, XID);
static int XvdiDestroyVideoNotifyList(void *, XID);
static int XvdiDestroyPort(void *, XID);
static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int);
static void XvStopAdaptors(DrawablePtr pDrawable);
/*
** XvExtensionInit
@ -257,11 +256,19 @@ CreateResourceTypes(void)
}
static void XvWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
{
XvStopAdaptors(&pWin->drawable);
}
static void XvPixmapDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
{
XvStopAdaptors(&pPixmap->drawable);
}
int
XvScreenInit(ScreenPtr pScreen)
{
XvScreenPtr pxvs;
if (XvScreenGeneration != serverGeneration) {
if (!CreateResourceTypes()) {
ErrorF("XvScreenInit: Unable to allocate resource types\n");
@ -282,7 +289,7 @@ XvScreenInit(ScreenPtr pScreen)
/* ALLOCATE SCREEN PRIVATE RECORD */
pxvs = malloc(sizeof(XvScreenRec));
XvScreenPtr pxvs = calloc(1, sizeof(XvScreenRec));
if (!pxvs) {
ErrorF("XvScreenInit: Unable to allocate screen private structure\n");
return BadAlloc;
@ -290,40 +297,32 @@ XvScreenInit(ScreenPtr pScreen)
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, pxvs);
pxvs->DestroyPixmap = pScreen->DestroyPixmap;
pxvs->DestroyWindow = pScreen->DestroyWindow;
pxvs->CloseScreen = pScreen->CloseScreen;
pScreen->DestroyPixmap = XvDestroyPixmap;
pScreen->DestroyWindow = XvDestroyWindow;
pScreen->CloseScreen = XvCloseScreen;
dixScreenHookWindowDestroy(pScreen, XvWindowDestroy);
dixScreenHookClose(pScreen, XvScreenClose);
dixScreenHookPixmapDestroy(pScreen, XvPixmapDestroy);
return Success;
}
static Bool
XvCloseScreen(ScreenPtr pScreen)
static void XvScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
XvScreenPtr pxvs;
pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
pScreen->DestroyPixmap = pxvs->DestroyPixmap;
pScreen->DestroyWindow = pxvs->DestroyWindow;
pScreen->CloseScreen = pxvs->CloseScreen;
dixScreenUnhookWindowDestroy(pScreen, XvWindowDestroy);
dixScreenUnhookClose(pScreen, XvScreenClose);
dixScreenUnhookPixmapDestroy(pScreen, XvPixmapDestroy);
free(pxvs);
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
return (*pScreen->CloseScreen) (pScreen);
}
static void
XvResetProc(ExtensionEntry * extEntry)
{
XvResetProcVector();
xvUseXinerama = 0;
}
DevPrivateKey
@ -351,7 +350,7 @@ XvStopAdaptors(DrawablePtr pDrawable)
XvPortPtr pp = pa->pPorts;
int np = pa->nPorts;
while (np--) {
while ((np--) && (pp)) {
if (pp->pDraw == pDrawable) {
XvdiSendVideoNotify(pp, pDrawable, XvPreempted);
@ -367,40 +366,6 @@ XvStopAdaptors(DrawablePtr pDrawable)
}
}
static Bool
XvDestroyPixmap(PixmapPtr pPix)
{
ScreenPtr pScreen = pPix->drawable.pScreen;
Bool status = TRUE;
if (pPix->refcnt == 1)
XvStopAdaptors(&pPix->drawable);
SCREEN_PROLOGUE(pScreen, DestroyPixmap);
if (pScreen->DestroyPixmap)
status = pScreen->DestroyPixmap(pPix);
SCREEN_EPILOGUE(pScreen, DestroyPixmap, XvDestroyPixmap);
return status;
}
static Bool
XvDestroyWindow(WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
Bool status;
XvStopAdaptors(&pWin->drawable);
SCREEN_PROLOGUE(pScreen, DestroyWindow);
status = (*pScreen->DestroyWindow) (pWin);
SCREEN_EPILOGUE(pScreen, DestroyWindow, XvDestroyWindow);
return status;
}
static int
XvdiDestroyPort(void *pPort, XID id)
{
@ -809,7 +774,7 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
WILL BE DELETED WHEN THE DRAWABLE IS DESTROYED */
if (!pn) {
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
if (!(tpn = calloc(1, sizeof(XvVideoNotifyRec))))
return BadAlloc;
tpn->next = NULL;
tpn->client = NULL;
@ -845,7 +810,7 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
tpn = fpn;
}
else {
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
if (!(tpn = calloc(1, sizeof(XvVideoNotifyRec))))
return BadAlloc;
tpn->next = pn->next;
pn->next = tpn;
@ -899,7 +864,7 @@ XvdiSelectPortNotify(ClientPtr client, XvPortPtr pPort, BOOL onoff)
CREATE A NEW ONE AND ADD IT TO THE BEGINNING OF THE LIST */
if (!tpn) {
if (!(tpn = malloc(sizeof(XvPortNotifyRec))))
if (!(tpn = calloc(1, sizeof(XvPortNotifyRec))))
return BadAlloc;
tpn->next = pPort->pNotify;
pPort->pNotify = tpn;
@ -1083,7 +1048,7 @@ XvFillColorKey(DrawablePtr pDraw, CARD32 key, RegionPtr region)
(void) ChangeGC(NullClient, gc, GCForeground | GCSubwindowMode, pval);
ValidateGC(pDraw, gc);
rects = xallocarray(nbox, sizeof(xRectangle));
rects = calloc(nbox, sizeof(xRectangle));
if (rects) {
for (i = 0; i < nbox; i++, pbox++) {
rects[i].x = pbox->x1 - pDraw->x;

View File

@ -3,8 +3,14 @@
#include <string.h>
#include <X11/X.h>
#include <X11/Xfuncproto.h>
#include <X11/Xproto.h>
#include <X11/extensions/XvMC.h>
#include <X11/extensions/Xvproto.h>
#include <X11/extensions/XvMCproto.h>
#include "dix/screen_hooks_priv.h"
#include "miext/extinit_priv.h"
#include "Xext/xvdix_priv.h"
#include "misc.h"
@ -13,12 +19,7 @@
#include "resource.h"
#include "scrnintstr.h"
#include "extnsionst.h"
#include "extinit_priv.h"
#include "servermd.h"
#include <X11/Xfuncproto.h>
#include <X11/extensions/XvMC.h>
#include <X11/extensions/Xvproto.h>
#include <X11/extensions/XvMCproto.h>
#include "xvmcext.h"
#ifdef HAS_XVMCSHM
@ -48,7 +49,6 @@ static RESTYPE XvMCRTSubpicture;
typedef struct {
int num_adaptors;
XvMCAdaptorPtr adaptors;
CloseScreenProcPtr CloseScreen;
char clientDriverName[DR_CLIENT_DRIVER_NAME_SIZE];
char busID[DR_BUSID_SIZE];
int major;
@ -112,7 +112,6 @@ ProcXvMCQueryVersion(ClientPtr client)
xvmcQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.major = SERVER_XVMC_MAJOR_VERSION,
.minor = SERVER_XVMC_MINOR_VERSION
};
@ -128,13 +127,8 @@ static int
ProcXvMCListSurfaceTypes(ClientPtr client)
{
XvPortPtr pPort;
int i;
XvMCScreenPtr pScreenPriv;
xvmcListSurfaceTypesReply rep;
xvmcSurfaceInfo info;
XvMCAdaptorPtr adaptor = NULL;
XvMCSurfaceInfoPtr surface;
int num_surfaces;
REQUEST(xvmcListSurfaceTypesReq);
REQUEST_SIZE_MATCH(xvmcListSurfaceTypesReq);
@ -145,7 +139,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
ScreenPtr pScreen = pPort->pAdaptor->pScreen;
if ((pScreenPriv = XVMC_GET_PRIVATE(pScreen))) { /* any this screen */
for (i = 0; i < pScreenPriv->num_adaptors; i++) {
for (int i = 0; i < pScreenPriv->num_adaptors; i++) {
if (pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
adaptor = &(pScreenPriv->adaptors[i]);
break;
@ -154,28 +148,36 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
}
}
num_surfaces = (adaptor) ? adaptor->num_surfaces : 0;
rep = (xvmcListSurfaceTypesReply) {
int num_surfaces = (adaptor) ? adaptor->num_surfaces : 0;
xvmcSurfaceInfo *info = NULL;
if (num_surfaces) {
info = calloc(sizeof(xvmcSurfaceInfo), num_surfaces);
if (!info)
return BadAlloc;
for (int i = 0; i < num_surfaces; i++) {
XvMCSurfaceInfoPtr surface = adaptor->surfaces[i];
info[i].surface_type_id = surface->surface_type_id;
info[i].chroma_format = surface->chroma_format;
info[i].max_width = surface->max_width;
info[i].max_height = surface->max_height;
info[i].subpicture_max_width = surface->subpicture_max_width;
info[i].subpicture_max_height = surface->subpicture_max_height;
info[i].mc_type = surface->mc_type;
info[i].flags = surface->flags;
}
}
xvmcListSurfaceTypesReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num = num_surfaces,
.length = bytes_to_int32(num_surfaces * sizeof(xvmcSurfaceInfo)),
.length = bytes_to_int32(sizeof(xvmcSurfaceInfo) * num_surfaces),
};
WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), &rep);
for (i = 0; i < num_surfaces; i++) {
surface = adaptor->surfaces[i];
info.surface_type_id = surface->surface_type_id;
info.chroma_format = surface->chroma_format;
info.max_width = surface->max_width;
info.max_height = surface->max_height;
info.subpicture_max_width = surface->subpicture_max_width;
info.subpicture_max_height = surface->subpicture_max_height;
info.mc_type = surface->mc_type;
info.flags = surface->flags;
WriteToClient(client, sizeof(xvmcSurfaceInfo), &info);
}
WriteToClient(client, sizeof(xvmcSurfaceInfo) * num_surfaces, info);
free(info);
return Success;
}
@ -186,13 +188,12 @@ ProcXvMCCreateContext(ClientPtr client)
XvPortPtr pPort;
CARD32 *data = NULL;
int dwords = 0;
int i, result, adapt_num = -1;
int result, adapt_num = -1;
ScreenPtr pScreen;
XvMCContextPtr pContext;
XvMCScreenPtr pScreenPriv;
XvMCAdaptorPtr adaptor = NULL;
XvMCSurfaceInfoPtr surface = NULL;
xvmcCreateContextReply rep;
REQUEST(xvmcCreateContextReq);
REQUEST_SIZE_MATCH(xvmcCreateContextReq);
@ -207,7 +208,7 @@ ProcXvMCCreateContext(ClientPtr client)
if (!(pScreenPriv = XVMC_GET_PRIVATE(pScreen))) /* none this screen */
return BadMatch;
for (i = 0; i < pScreenPriv->num_adaptors; i++) {
for (int i = 0; i < pScreenPriv->num_adaptors; i++) {
if (pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
adaptor = &(pScreenPriv->adaptors[i]);
adapt_num = i;
@ -218,7 +219,7 @@ ProcXvMCCreateContext(ClientPtr client)
if (adapt_num < 0) /* none this port */
return BadMatch;
for (i = 0; i < adaptor->num_surfaces; i++) {
for (int i = 0; i < adaptor->num_surfaces; i++) {
if (adaptor->surfaces[i]->surface_type_id == stuff->surface_type_id) {
surface = adaptor->surfaces[i];
break;
@ -233,7 +234,7 @@ ProcXvMCCreateContext(ClientPtr client)
(stuff->height > surface->max_height))
return BadValue;
if (!(pContext = malloc(sizeof(XvMCContextRec)))) {
if (!(pContext = calloc(1, sizeof(XvMCContextRec)))) {
return BadAlloc;
}
@ -257,7 +258,7 @@ ProcXvMCCreateContext(ClientPtr client)
return BadAlloc;
}
rep = (xvmcCreateContextReply) {
xvmcCreateContextReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = dwords,
@ -303,7 +304,6 @@ ProcXvMCCreateSurface(ClientPtr client)
XvMCContextPtr pContext;
XvMCSurfacePtr pSurface;
XvMCScreenPtr pScreenPriv;
xvmcCreateSurfaceReply rep;
REQUEST(xvmcCreateSurfaceReq);
REQUEST_SIZE_MATCH(xvmcCreateSurfaceReq);
@ -315,7 +315,7 @@ ProcXvMCCreateSurface(ClientPtr client)
pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
if (!(pSurface = malloc(sizeof(XvMCSurfaceRec))))
if (!(pSurface = calloc(1, sizeof(XvMCSurfaceRec))))
return BadAlloc;
pSurface->surface_id = stuff->surface_id;
@ -336,7 +336,7 @@ ProcXvMCCreateSurface(ClientPtr client)
return BadAlloc;
}
rep = (xvmcCreateSurfaceReply) {
xvmcCreateSurfaceReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = dwords
@ -377,11 +377,10 @@ ProcXvMCCreateSubpicture(ClientPtr client)
{
Bool image_supported = FALSE;
CARD32 *data = NULL;
int i, result, dwords = 0;
int result, dwords = 0;
XvMCContextPtr pContext;
XvMCSubpicturePtr pSubpicture;
XvMCScreenPtr pScreenPriv;
xvmcCreateSubpictureReply rep;
XvMCAdaptorPtr adaptor;
XvMCSurfaceInfoPtr surface = NULL;
@ -398,7 +397,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
adaptor = &(pScreenPriv->adaptors[pContext->adapt_num]);
/* find which surface this context supports */
for (i = 0; i < adaptor->num_surfaces; i++) {
for (int i = 0; i < adaptor->num_surfaces; i++) {
if (adaptor->surfaces[i]->surface_type_id == pContext->surface_type_id) {
surface = adaptor->surfaces[i];
break;
@ -412,7 +411,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
if (!surface->compatible_subpictures)
return BadMatch;
for (i = 0; i < surface->compatible_subpictures->num_xvimages; i++) {
for (int i = 0; i < surface->compatible_subpictures->num_xvimages; i++) {
if (surface->compatible_subpictures->xvimage_ids[i] ==
stuff->xvimage_id) {
image_supported = TRUE;
@ -428,7 +427,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
(stuff->height > surface->subpicture_max_height))
return BadValue;
if (!(pSubpicture = malloc(sizeof(XvMCSubpictureRec))))
if (!(pSubpicture = calloc(1, sizeof(XvMCSubpictureRec))))
return BadAlloc;
pSubpicture->subpicture_id = stuff->subpicture_id;
@ -456,7 +455,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
return BadAlloc;
}
rep = (xvmcCreateSubpictureReply) {
xvmcCreateSubpictureReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = dwords,
@ -504,14 +503,11 @@ static int
ProcXvMCListSubpictureTypes(ClientPtr client)
{
XvPortPtr pPort;
xvmcListSubpictureTypesReply rep;
XvMCScreenPtr pScreenPriv;
ScreenPtr pScreen;
XvMCAdaptorPtr adaptor = NULL;
XvMCSurfaceInfoPtr surface = NULL;
xvImageFormatInfo info;
XvImagePtr pImage;
int i, j;
REQUEST(xvmcListSubpictureTypesReq);
REQUEST_SIZE_MATCH(xvmcListSubpictureTypesReq);
@ -526,7 +522,7 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
if (!(pScreenPriv = XVMC_GET_PRIVATE(pScreen)))
return BadMatch; /* None this screen */
for (i = 0; i < pScreenPriv->num_adaptors; i++) {
for (int i = 0; i < pScreenPriv->num_adaptors; i++) {
if (pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
adaptor = &(pScreenPriv->adaptors[i]);
break;
@ -536,7 +532,7 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
if (!adaptor)
return BadMatch;
for (i = 0; i < adaptor->num_surfaces; i++) {
for (int i = 0; i < adaptor->num_surfaces; i++) {
if (adaptor->surfaces[i]->surface_type_id == stuff->surface_type_id) {
surface = adaptor->surfaces[i];
break;
@ -546,62 +542,70 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
if (!surface)
return BadMatch;
rep = (xvmcListSubpictureTypesReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num = 0
};
if (surface->compatible_subpictures)
rep.num = surface->compatible_subpictures->num_xvimages;
int num = (surface->compatible_subpictures ?
surface->compatible_subpictures->num_xvimages : 0);
rep.length = bytes_to_int32(rep.num * sizeof(xvImageFormatInfo));
xvImageFormatInfo *info = NULL;
if (num) {
info = calloc(sizeof(xvImageFormatInfo), num);
if (!info)
return BadAlloc;
WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), &rep);
for (i = 0; i < rep.num; i++) {
for (int i = 0; i < num; i++) {
pImage = NULL;
for (j = 0; j < adaptor->num_subpictures; j++) {
for (int j = 0; j < adaptor->num_subpictures; j++) {
if (surface->compatible_subpictures->xvimage_ids[i] ==
adaptor->subpictures[j]->id) {
pImage = adaptor->subpictures[j];
break;
}
}
if (!pImage)
if (!pImage) {
free(info);
return BadImplementation;
info.id = pImage->id;
info.type = pImage->type;
info.byte_order = pImage->byte_order;
memcpy(&info.guid, pImage->guid, 16);
info.bpp = pImage->bits_per_pixel;
info.num_planes = pImage->num_planes;
info.depth = pImage->depth;
info.red_mask = pImage->red_mask;
info.green_mask = pImage->green_mask;
info.blue_mask = pImage->blue_mask;
info.format = pImage->format;
info.y_sample_bits = pImage->y_sample_bits;
info.u_sample_bits = pImage->u_sample_bits;
info.v_sample_bits = pImage->v_sample_bits;
info.horz_y_period = pImage->horz_y_period;
info.horz_u_period = pImage->horz_u_period;
info.horz_v_period = pImage->horz_v_period;
info.vert_y_period = pImage->vert_y_period;
info.vert_u_period = pImage->vert_u_period;
info.vert_v_period = pImage->vert_v_period;
memcpy(&info.comp_order, pImage->component_order, 32);
info.scanline_order = pImage->scanline_order;
WriteToClient(client, sizeof(xvImageFormatInfo), &info);
}
info[i].id = pImage->id;
info[i].type = pImage->type;
info[i].byte_order = pImage->byte_order;
memcpy(&info[i].guid, pImage->guid, 16);
info[i].bpp = pImage->bits_per_pixel;
info[i].num_planes = pImage->num_planes;
info[i].depth = pImage->depth;
info[i].red_mask = pImage->red_mask;
info[i].green_mask = pImage->green_mask;
info[i].blue_mask = pImage->blue_mask;
info[i].format = pImage->format;
info[i].y_sample_bits = pImage->y_sample_bits;
info[i].u_sample_bits = pImage->u_sample_bits;
info[i].v_sample_bits = pImage->v_sample_bits;
info[i].horz_y_period = pImage->horz_y_period;
info[i].horz_u_period = pImage->horz_u_period;
info[i].horz_v_period = pImage->horz_v_period;
info[i].vert_y_period = pImage->vert_y_period;
info[i].vert_u_period = pImage->vert_u_period;
info[i].vert_v_period = pImage->vert_v_period;
memcpy(&info[i].comp_order, pImage->component_order, 32);
info[i].scanline_order = pImage->scanline_order;
}
}
xvmcListSubpictureTypesReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num = num,
.length = bytes_to_int32(sizeof(info)),
};
WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), &rep);
WriteToClient(client, sizeof(xvImageFormatInfo) * num, info);
free(info);
return Success;
}
static int
ProcXvMCGetDRInfo(ClientPtr client)
{
xvmcGetDRInfoReply rep;
XvPortPtr pPort;
ScreenPtr pScreen;
XvMCScreenPtr pScreenPriv;
@ -618,21 +622,30 @@ ProcXvMCGetDRInfo(ClientPtr client)
pScreen = pPort->pAdaptor->pScreen;
pScreenPriv = XVMC_GET_PRIVATE(pScreen);
rep = (xvmcGetDRInfoReply) {
int nameLen = strlen(pScreenPriv->clientDriverName) + 1;
int busIDLen = strlen(pScreenPriv->busID) + 1;
// buffer holds two zero-terminated strings, padded to 4-byte ints
const size_t buflen = pad_to_int32(nameLen+busIDLen);
char *buf = calloc(1, buflen);
if (!buf)
return BadAlloc;
memcpy(buf, pScreenPriv->clientDriverName, nameLen);
memcpy(buf+nameLen, pScreenPriv->busID, busIDLen);
xvmcGetDRInfoReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.major = pScreenPriv->major,
.minor = pScreenPriv->minor,
.patchLevel = pScreenPriv->patchLevel,
.nameLen = bytes_to_int32(strlen(pScreenPriv->clientDriverName) + 1),
.busIDLen = bytes_to_int32(strlen(pScreenPriv->busID) + 1),
.nameLen = nameLen,
.busIDLen = busIDLen,
.length = bytes_to_int32(sizeof(buf)),
.isLocal = 1
};
rep.length = rep.nameLen + rep.busIDLen;
rep.nameLen <<= 2;
rep.busIDLen <<= 2;
/*
* Read back to the client what she has put in the shared memory
* segment she prepared for us.
@ -660,34 +673,41 @@ ProcXvMCGetDRInfo(ClientPtr client)
#endif /* HAS_XVMCSHM */
WriteToClient(client, sizeof(xvmcGetDRInfoReply), &rep);
if (rep.length) {
WriteToClient(client, rep.nameLen, pScreenPriv->clientDriverName);
WriteToClient(client, rep.busIDLen, pScreenPriv->busID);
}
WriteToClient(client, buflen, buf);
free(buf);
return Success;
}
int (*ProcXvMCVector[xvmcNumRequest]) (ClientPtr) = {
ProcXvMCQueryVersion,
ProcXvMCListSurfaceTypes,
ProcXvMCCreateContext,
ProcXvMCDestroyContext,
ProcXvMCCreateSurface,
ProcXvMCDestroySurface,
ProcXvMCCreateSubpicture,
ProcXvMCDestroySubpicture,
ProcXvMCListSubpictureTypes, ProcXvMCGetDRInfo};
static int
ProcXvMCDispatch(ClientPtr client)
{
REQUEST(xReq);
if (stuff->data < xvmcNumRequest)
return (*ProcXvMCVector[stuff->data]) (client);
else
switch (stuff->data)
{
case xvmc_QueryVersion:
return ProcXvMCQueryVersion(client);
case xvmc_ListSurfaceTypes:
return ProcXvMCListSurfaceTypes(client);
case xvmc_CreateContext:
return ProcXvMCCreateContext(client);
case xvmc_DestroyContext:
return ProcXvMCDestroyContext(client);
case xvmc_CreateSurface:
return ProcXvMCCreateSurface(client);
case xvmc_DestroySurface:
return ProcXvMCDestroySurface(client);
case xvmc_CreateSubpicture:
return ProcXvMCCreateSubpicture(client);
case xvmc_DestroySubpicture:
return ProcXvMCDestroySubpicture(client);
case xvmc_ListSubpictureTypes:
return ProcXvMCListSubpictureTypes(client);
case xvmc_GetDRInfo:
return ProcXvMCGetDRInfo(client);
default:
return BadRequest;
}
}
static int _X_COLD
SProcXvMCDispatch(ClientPtr client)
@ -733,16 +753,12 @@ XvMCExtensionInit(void)
extEntry->errorBase + XvMCBadSubpicture);
}
static Bool
XvMCCloseScreen(ScreenPtr pScreen)
static void XvMCScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
free(pScreenPriv);
return (*pScreen->CloseScreen) (pScreen);
dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, NULL);
dixScreenUnhookClose(pScreen, XvMCScreenClose);
}
int
@ -753,13 +769,12 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
if (!dixRegisterPrivateKey(&XvMCScreenKeyRec, PRIVATE_SCREEN, 0))
return BadAlloc;
if (!(pScreenPriv = malloc(sizeof(XvMCScreenRec))))
if (!(pScreenPriv = calloc(1, sizeof(XvMCScreenRec))))
return BadAlloc;
dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, pScreenPriv);
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = XvMCCloseScreen;
dixScreenHookClose(pScreen, XvMCScreenClose);
pScreenPriv->num_adaptors = num;
pScreenPriv->adaptors = pAdapt;
@ -781,7 +796,6 @@ XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
ScreenPtr pScreen = pPort->pAdaptor->pScreen;
XvMCScreenPtr pScreenPriv;
XvMCAdaptorPtr adaptor = NULL;
int i;
if (!dixPrivateKeyRegistered(XvMCScreenKey))
return NULL;
@ -789,7 +803,7 @@ XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
if (!(pScreenPriv = XVMC_GET_PRIVATE(pScreen)))
return NULL;
for (i = 0; i < pScreenPriv->num_adaptors; i++) {
for (int i = 0; i < pScreenPriv->num_adaptors; i++) {
if (pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
adaptor = &(pScreenPriv->adaptors[i]);
break;
@ -799,7 +813,7 @@ XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
if (!adaptor)
return NULL;
for (i = 0; i < adaptor->num_subpictures; i++) {
for (int i = 0; i < adaptor->num_subpictures; i++) {
if (adaptor->subpictures[i]->id == id) {
pImage = adaptor->subpictures[i];
break;

View File

@ -61,7 +61,6 @@ SOFTWARE.
#include "exglobals.h"
#include "allowev.h"
#include "dixevents.h"
/***********************************************************************
*

View File

@ -57,6 +57,7 @@ SOFTWARE.
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#include "dix/resource_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "XIstubs.h"
@ -107,7 +108,6 @@ ProcXChangeDeviceControl(ClientPtr client)
int i, status, ret = BadValue;
DeviceIntPtr dev;
xDeviceResolutionCtl *r;
xChangeDeviceControlReply rep;
AxisInfoPtr a;
CARD32 *resolution;
xDeviceEnableCtl *e;
@ -126,11 +126,9 @@ ProcXChangeDeviceControl(ClientPtr client)
goto out;
}
rep = (xChangeDeviceControlReply) {
.repType = X_Reply,
xChangeDeviceControlReply rep = {
.RepType = X_ChangeDeviceControl,
.sequenceNumber = client->sequence,
.length = 0,
.status = Success,
};
@ -232,24 +230,11 @@ ProcXChangeDeviceControl(ClientPtr client)
SendEventToAllWindows(dev, DevicePresenceNotifyMask,
(xEvent *) &dpn, 1);
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(xChangeDeviceControlReply), &rep);
}
return ret;
}
/***********************************************************************
*
* This procedure writes the reply for the xChangeDeviceControl function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXChangeDeviceControl(ClientPtr client, int size,
xChangeDeviceControlReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}

View File

@ -36,9 +36,4 @@ int SProcXChangeDeviceControl(ClientPtr /* client */
int ProcXChangeDeviceControl(ClientPtr /* client */
);
void SRepXChangeDeviceControl(ClientPtr /* client */ ,
int /* size */ ,
xChangeDeviceControlReply * /* rep */
);
#endif /* CHGDCTL_H */

View File

@ -59,7 +59,6 @@ SOFTWARE.
#include "windowstr.h" /* window structure */
#include "scrnintstr.h" /* screen structure */
#include "dixevents.h"
#include "exevents.h"
#include "exglobals.h"

View File

@ -52,11 +52,14 @@ SOFTWARE.
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/resource_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include "scrnintstr.h" /* screen structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
#include "exglobals.h"

View File

@ -96,7 +96,11 @@ SOFTWARE.
#include "dix/eventconvert.h"
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#include "dix/resource_priv.h"
#include "dix/window_priv.h"
#include "mi/mi_priv.h"
#include "os/log_priv.h"
#include "xkb/xkbsrv_priv.h"
#include "inputstr.h"
#include "windowstr.h"
@ -105,14 +109,12 @@ SOFTWARE.
#include "extnsionst.h"
#include "exglobals.h"
#include "eventstr.h"
#include "dixevents.h" /* DeliverFocusedEvent */
#include "scrnintstr.h"
#include "listdev.h" /* for CopySwapXXXClass */
#include "xace.h"
#include "xiquerydevice.h" /* For List*Info */
#include "eventstr.h"
#include "inpututils.h"
#include "xkbsrv.h"
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
#define AllModifiersMask ( \
@ -491,6 +493,7 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
if (!k->xkb_sli)
continue;
if (k->xkb_sli->flags & XkbSLI_IsDefault) {
assert(to->key);
k->xkb_sli->names = to->key->xkbInfo->desc->names->indicators;
k->xkb_sli->maps = to->key->xkbInfo->desc->indicators->maps;
}
@ -772,7 +775,7 @@ ChangeMasterDeviceClasses(DeviceIntPtr device, DeviceChangedEvent *dce)
int rc;
/* For now, we don't have devices that change physically. */
if (!IsMaster(device))
if (!InputDevIsMaster(device))
return;
rc = dixLookupDevice(&slave, dce->sourceid, serverClient, DixReadAccess);
@ -780,10 +783,10 @@ ChangeMasterDeviceClasses(DeviceIntPtr device, DeviceChangedEvent *dce)
if (rc != Success)
return; /* Device has disappeared */
if (IsMaster(slave))
if (InputDevIsMaster(slave))
return;
if (IsFloating(slave))
if (InputDevIsFloating(slave))
return; /* set floating since the event */
if (GetMaster(slave, MASTER_ATTACHED)->id != dce->masterid)
@ -967,7 +970,7 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
if (!button_is_down(device, key, BUTTON_PROCESSED))
return DONT_PROCESS;
if (IsMaster(device)) {
if (InputDevIsMaster(device)) {
DeviceIntPtr sd;
/*
@ -976,7 +979,7 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
* event being delivered through the slave first
*/
for (sd = inputInfo.devices; sd; sd = sd->next) {
if (IsMaster(sd) || GetMaster(sd, MASTER_POINTER) != device)
if (InputDevIsMaster(sd) || GetMaster(sd, MASTER_POINTER) != device)
continue;
if (!sd->button)
continue;
@ -1044,8 +1047,9 @@ TouchClientWantsOwnershipEvents(ClientPtr client, DeviceIntPtr dev,
{
InputClients *iclient;
assert(wOtherInputMasks(win));
nt_list_for_each_entry(iclient, wOtherInputMasks(win)->inputClients, next) {
if (rClient(iclient) != client)
if (dixClientForInputClients(iclient) != client)
continue;
return xi2mask_isset(iclient->xi2mask, dev, XI_TouchOwnership);
@ -1098,7 +1102,7 @@ DeliverOneTouchEvent(ClientPtr client, DeviceIntPtr dev, TouchPointInfoPtr ti,
filter = GetEventFilter(dev, xi2);
if (XaceHookReceiveAccess(client, win, xi2, 1) != Success)
return FALSE;
err = TryClientEvents(client, dev, xi2, 1, filter, filter, NullGrab);
TryClientEvents(client, dev, xi2, 1, filter, filter, NullGrab);
free(xi2);
/* Returning the value from TryClientEvents isn't useful, since all our
@ -1117,7 +1121,7 @@ ActivateEarlyAccept(DeviceIntPtr dev, TouchPointInfoPtr ti)
ti->listeners[0].type != TOUCH_LISTENER_POINTER_GRAB);
BUG_RETURN(!grab);
client = rClient(grab);
client = dixClientForGrab(grab);
if (TouchAcceptReject(client, dev, XIAcceptTouch, ti->client_id,
ti->listeners[0].window->drawable.id, &error) != Success)
@ -1369,7 +1373,7 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
BUG_RETURN_VAL(!*grab, FALSE);
*client = rClient(*grab);
*client = dixClientForGrab(*grab);
*win = (*grab)->window;
*mask = (*grab)->xi2mask;
}
@ -1389,6 +1393,8 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
else
evtype = GetXI2Type(ev->any.type);
assert(iclients);
assert(wOtherInputMasks(*win));
nt_list_for_each_entry(iclients,
wOtherInputMasks(*win)->inputClients, next)
if (xi2mask_isset(iclients->xi2mask, dev, evtype))
@ -1397,19 +1403,20 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
BUG_RETURN_VAL(!iclients, FALSE);
*mask = iclients->xi2mask;
*client = rClient(iclients);
*client = dixClientForInputClients(iclients);
}
else if (listener->level == XI) {
int xi_type = GetXIType(TouchGetPointerEventType(ev));
Mask xi_filter = event_get_filter_from_type(dev, xi_type);
assert(wOtherInputMasks(*win));
nt_list_for_each_entry(iclients,
wOtherInputMasks(*win)->inputClients, next)
if (iclients->mask[dev->id] & xi_filter)
break;
BUG_RETURN_VAL(!iclients, FALSE);
*client = rClient(iclients);
*client = dixClientForInputClients(iclients);
}
else {
int coretype = GetCoreType(TouchGetPointerEventType(ev));
@ -1423,7 +1430,7 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
break;
/* if owner selected, oclients is NULL */
*client = oclients ? rClient(oclients) : wClient(*win);
*client = oclients ? dixClientForOtherClients(oclients) : dixClientForWindow(*win);
}
*grab = NULL;
@ -1449,7 +1456,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
if (grab) {
win = grab->window;
xi2mask = grab->xi2mask;
client = rClient(grab);
client = dixClientForGrab(grab);
}
}
@ -1677,7 +1684,7 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
(ev->any.type == ET_TouchEnd && ti->num_listeners > 0)))
DeliverEmulatedMotionEvent(dev, ti, ev);
if (emulate_pointer && IsMaster(dev))
if (emulate_pointer && InputDevIsMaster(dev))
CheckMotion(&ev->device_event, dev);
kbd = GetMaster(dev, KEYBOARD_OR_FLOAT);
@ -1717,7 +1724,7 @@ ProcessBarrierEvent(InternalEvent *e, DeviceIntPtr dev)
int rc;
GrabPtr grab = dev->deviceGrab.grab;
if (!IsMaster(dev))
if (!InputDevIsMaster(dev))
return;
if (dixLookupWindow(&pWin, be->window, serverClient, DixReadAccess) != Success)
@ -1738,7 +1745,7 @@ ProcessBarrierEvent(InternalEvent *e, DeviceIntPtr dev)
Otherwise, deliver normally to the client.
*/
if (grab &&
CLIENT_ID(be->barrierid) == CLIENT_ID(grab->resource) &&
dixClientIdForXID(be->barrierid) == dixClientIdForXID(grab->resource) &&
grab->window->drawable.id == be->window) {
DeliverGrabbedEvent(e, dev, FALSE);
} else {
@ -1778,7 +1785,7 @@ ProcessGestureEvent(InternalEvent *ev, DeviceIntPtr dev)
if (!dev->gesture)
return;
if (IsMaster(dev) && IsAnotherGestureActiveOnMaster(dev, ev))
if (InputDevIsMaster(dev) && IsAnotherGestureActiveOnMaster(dev, ev))
return;
if (IsGestureBeginEvent(ev))
@ -1853,7 +1860,7 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
b = device->button;
if (IsMaster(device) || IsFloating(device))
if (InputDevIsMaster(device) || InputDevIsFloating(device))
CheckMotion(event, device);
switch (event->type) {
@ -1947,16 +1954,16 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
deactivateDeviceGrab);
else if (device->focus && !IsPointerEvent(ev))
DeliverFocusedEvent(device, (InternalEvent *) event,
GetSpriteWindow(device));
InputDevSpriteWindow(device));
else
DeliverDeviceEvents(GetSpriteWindow(device), (InternalEvent *) event,
DeliverDeviceEvents(InputDevSpriteWindow(device), (InternalEvent *) event,
NullGrab, NullWindow, device);
}
if (deactivateDeviceGrab == TRUE) {
(*device->deviceGrab.DeactivateGrab) (device);
if (!IsMaster (device) && !IsFloating (device)) {
if (!InputDevIsMaster (device) && !InputDevIsFloating (device)) {
int flags, num_events = 0;
InternalEvent dce;
@ -2244,7 +2251,7 @@ DeliverOneGestureEvent(ClientPtr client, DeviceIntPtr dev, GestureInfoPtr gi,
filter = GetEventFilter(dev, xi2);
if (XaceHookReceiveAccess(client, win, xi2, 1) != Success)
return FALSE;
err = TryClientEvents(client, dev, xi2, 1, filter, filter, NullGrab);
TryClientEvents(client, dev, xi2, 1, filter, filter, NullGrab);
free(xi2);
/* Returning the value from TryClientEvents isn't useful, since all our
@ -2279,7 +2286,7 @@ RetrieveGestureDeliveryData(DeviceIntPtr dev, InternalEvent *ev, GestureListener
BUG_RETURN_VAL(!*grab, FALSE);
*client = rClient(*grab);
*client = dixClientForGrab(*grab);
*win = (*grab)->window;
}
else {
@ -2292,13 +2299,14 @@ RetrieveGestureDeliveryData(DeviceIntPtr dev, InternalEvent *ev, GestureListener
listener->type == GESTURE_LISTENER_REGULAR */
evtype = GetXI2Type(ev->any.type);
assert(wOtherInputMasks(*win));
nt_list_for_each_entry(iclients, wOtherInputMasks(*win)->inputClients, next)
if (xi2mask_isset(iclients->xi2mask, dev, evtype))
break;
BUG_RETURN_VAL(!iclients, FALSE);
*client = rClient(iclients);
*client = dixClientForInputClients(iclients);
}
return TRUE;
@ -2330,12 +2338,10 @@ DeliverGestureEventToOwner(DeviceIntPtr dev, GestureInfoPtr gi, InternalEvent *e
int
InitProximityClassDeviceStruct(DeviceIntPtr dev)
{
ProximityClassPtr proxc;
BUG_RETURN_VAL(dev == NULL, FALSE);
BUG_RETURN_VAL(dev->proximity != NULL, FALSE);
proxc = (ProximityClassPtr) malloc(sizeof(ProximityClassRec));
ProximityClassPtr proxc = calloc(1, sizeof(ProximityClassRec));
if (!proxc)
return FALSE;
proxc->sourceid = dev->id;
@ -2528,7 +2534,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
else if (grabtype == XI2)
type = XI_ButtonPress;
grab = CreateGrab(client->index, dev, modifier_device, pWin, grabtype,
grab = CreateGrab(client, dev, modifier_device, pWin, grabtype,
mask, param, type, button, confineTo, cursor);
if (!grab)
return BadAlloc;
@ -2576,7 +2582,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
if (rc != Success)
return rc;
grab = CreateGrab(client->index, dev, modifier_device, pWin, grabtype,
grab = CreateGrab(client, dev, modifier_device, pWin, grabtype,
mask, param, type, key, NULL, NULL);
if (!grab)
return BadAlloc;
@ -2619,7 +2625,7 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
if (rc != Success)
return rc;
grab = CreateGrab(client->index, dev, dev, pWin, XI2,
grab = CreateGrab(client, dev, dev, pWin, XI2,
mask, param,
(type == XIGrabtypeEnter) ? XI_Enter : XI_FocusIn, 0,
NULL, cursor);
@ -2650,7 +2656,7 @@ GrabTouchOrGesture(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr mod_dev,
if (rc != Success)
return rc;
grab = CreateGrab(client->index, dev, mod_dev, pWin, XI2,
grab = CreateGrab(client, dev, mod_dev, pWin, XI2,
mask, param, type, 0, NullWindow, NullCursor);
if (!grab)
return BadAlloc;
@ -2681,6 +2687,7 @@ SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client,
return BadAccess;
}
}
assert(wOtherInputMasks(pWin));
for (others = wOtherInputMasks(pWin)->inputClients; others;
others = others->next) {
if (SameClient(others, client)) {
@ -2733,7 +2740,7 @@ AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx)
{
InputClientsPtr others;
if (!pWin->optional && !MakeWindowOptional(pWin))
if (!MakeWindowOptional(pWin))
return BadAlloc;
others = AllocInputClient();
if (!others)
@ -2853,7 +2860,7 @@ InputClientGone(WindowPtr pWin, XID id)
FreeInputClient(&other);
}
else {
other->resource = FakeClientID(0);
other->resource = dixAllocServerXID();
if (!AddResource(other->resource, RT_INPUTCLIENT,
(void *) pWin))
return BadAlloc;
@ -2908,7 +2915,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate,
{
WindowPtr pWin;
WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */
WindowPtr spriteWin = GetSpriteWindow(d);
WindowPtr spriteWin = InputDevSpriteWindow(d);
if (dest == PointerWindow)
pWin = spriteWin;
@ -2929,9 +2936,9 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate,
/* If the input focus is PointerRootWin, send the event to where
* the pointer is if possible, then perhaps propagate up to root. */
if (inputFocus == PointerRootWin)
inputFocus = GetCurrentRootWindow(d);
inputFocus = InputDevCurrentRootWindow(d);
if (IsParent(inputFocus, spriteWin)) {
if (WindowIsParent(inputFocus, spriteWin)) {
effectiveFocus = inputFocus;
pWin = spriteWin;
}
@ -3242,8 +3249,11 @@ DeviceEventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask,
inputMasks->dontPropagateMask[maskndx] = mask;
}
RecalculateDeviceDeliverableEvents(pWin);
if (ShouldFreeInputMasks(pWin, FALSE))
if (ShouldFreeInputMasks(pWin, FALSE)) {
BUG_RETURN_VAL(!inputMasks, BadImplementation);
BUG_RETURN_VAL(!inputMasks->inputClients, BadImplementation);
FreeResource(inputMasks->inputClients->resource, X11_RESTYPE_NONE);
}
return Success;
}
@ -3337,6 +3347,7 @@ XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client,
if (len && !others) {
if (AddExtensionClient(win, client, 0, 0) != Success)
return BadAlloc;
assert(wOtherInputMasks(win));
others = wOtherInputMasks(win)->inputClients;
}
@ -3346,6 +3357,7 @@ XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client,
}
if (len) {
assert(others);
xi2mask_set_one_mask(others->xi2mask, dev->id, mask, len);
}

View File

@ -36,7 +36,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef EXGLOBALS_H
#define EXGLOBALS_H 1
extern int IReqCode;
extern int IEventBase;
extern int BadDevice;
extern int BadMode;

View File

@ -53,20 +53,23 @@ SOFTWARE.
#include <dix-config.h>
#include <assert.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include <X11/extensions/XI2proto.h>
#include <X11/extensions/geproto.h>
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "dix/exevents_priv.h"
#include "dix/extension_priv.h"
#include "miext/extinit_priv.h"
#include "Xext/geext_priv.h"
#include "inputstr.h"
#include "gcstruct.h" /* pointer for extnsionst.h */
#include "extnsionst.h" /* extension entry */
#include "geext.h" /* extension interfaces for ge */
#include "dixevents.h"
#include "extinit_priv.h"
#include "exglobals.h"
#include "swaprep.h"
#include "privates.h"
@ -179,150 +182,12 @@ XExtEventInfo EventInfo[32];
static DeviceIntRec xi_all_devices;
static DeviceIntRec xi_all_master_devices;
/**
* Dispatch vector. Functions defined in here will be called when the matching
* request arrives.
*/
static int (*ProcIVector[]) (ClientPtr) = {
NULL, /* 0 */
ProcXGetExtensionVersion, /* 1 */
ProcXListInputDevices, /* 2 */
ProcXOpenDevice, /* 3 */
ProcXCloseDevice, /* 4 */
ProcXSetDeviceMode, /* 5 */
ProcXSelectExtensionEvent, /* 6 */
ProcXGetSelectedExtensionEvents, /* 7 */
ProcXChangeDeviceDontPropagateList, /* 8 */
ProcXGetDeviceDontPropagateList, /* 9 */
ProcXGetDeviceMotionEvents, /* 10 */
ProcXChangeKeyboardDevice, /* 11 */
ProcXChangePointerDevice, /* 12 */
ProcXGrabDevice, /* 13 */
ProcXUngrabDevice, /* 14 */
ProcXGrabDeviceKey, /* 15 */
ProcXUngrabDeviceKey, /* 16 */
ProcXGrabDeviceButton, /* 17 */
ProcXUngrabDeviceButton, /* 18 */
ProcXAllowDeviceEvents, /* 19 */
ProcXGetDeviceFocus, /* 20 */
ProcXSetDeviceFocus, /* 21 */
ProcXGetFeedbackControl, /* 22 */
ProcXChangeFeedbackControl, /* 23 */
ProcXGetDeviceKeyMapping, /* 24 */
ProcXChangeDeviceKeyMapping, /* 25 */
ProcXGetDeviceModifierMapping, /* 26 */
ProcXSetDeviceModifierMapping, /* 27 */
ProcXGetDeviceButtonMapping, /* 28 */
ProcXSetDeviceButtonMapping, /* 29 */
ProcXQueryDeviceState, /* 30 */
ProcXSendExtensionEvent, /* 31 */
ProcXDeviceBell, /* 32 */
ProcXSetDeviceValuators, /* 33 */
ProcXGetDeviceControl, /* 34 */
ProcXChangeDeviceControl, /* 35 */
/* XI 1.5 */
ProcXListDeviceProperties, /* 36 */
ProcXChangeDeviceProperty, /* 37 */
ProcXDeleteDeviceProperty, /* 38 */
ProcXGetDeviceProperty, /* 39 */
/* XI 2 */
ProcXIQueryPointer, /* 40 */
ProcXIWarpPointer, /* 41 */
ProcXIChangeCursor, /* 42 */
ProcXIChangeHierarchy, /* 43 */
ProcXISetClientPointer, /* 44 */
ProcXIGetClientPointer, /* 45 */
ProcXISelectEvents, /* 46 */
ProcXIQueryVersion, /* 47 */
ProcXIQueryDevice, /* 48 */
ProcXISetFocus, /* 49 */
ProcXIGetFocus, /* 50 */
ProcXIGrabDevice, /* 51 */
ProcXIUngrabDevice, /* 52 */
ProcXIAllowEvents, /* 53 */
ProcXIPassiveGrabDevice, /* 54 */
ProcXIPassiveUngrabDevice, /* 55 */
ProcXIListProperties, /* 56 */
ProcXIChangeProperty, /* 57 */
ProcXIDeleteProperty, /* 58 */
ProcXIGetProperty, /* 59 */
ProcXIGetSelectedEvents, /* 60 */
ProcXIBarrierReleasePointer /* 61 */
};
/* For swapped clients */
static int (*SProcIVector[]) (ClientPtr) = {
NULL, /* 0 */
SProcXGetExtensionVersion, /* 1 */
ProcXListInputDevices, /* 2 */
ProcXOpenDevice, /* 3 */
ProcXCloseDevice, /* 4 */
ProcXSetDeviceMode, /* 5 */
SProcXSelectExtensionEvent, /* 6 */
SProcXGetSelectedExtensionEvents, /* 7 */
SProcXChangeDeviceDontPropagateList, /* 8 */
SProcXGetDeviceDontPropagateList, /* 9 */
SProcXGetDeviceMotionEvents, /* 10 */
ProcXChangeKeyboardDevice, /* 11 */
ProcXChangePointerDevice, /* 12 */
SProcXGrabDevice, /* 13 */
SProcXUngrabDevice, /* 14 */
SProcXGrabDeviceKey, /* 15 */
SProcXUngrabDeviceKey, /* 16 */
SProcXGrabDeviceButton, /* 17 */
SProcXUngrabDeviceButton, /* 18 */
SProcXAllowDeviceEvents, /* 19 */
ProcXGetDeviceFocus, /* 20 */
SProcXSetDeviceFocus, /* 21 */
ProcXGetFeedbackControl, /* 22 */
SProcXChangeFeedbackControl, /* 23 */
ProcXGetDeviceKeyMapping, /* 24 */
SProcXChangeDeviceKeyMapping, /* 25 */
ProcXGetDeviceModifierMapping, /* 26 */
ProcXSetDeviceModifierMapping, /* 27 */
ProcXGetDeviceButtonMapping, /* 28 */
ProcXSetDeviceButtonMapping, /* 29 */
ProcXQueryDeviceState, /* 30 */
SProcXSendExtensionEvent, /* 31 */
ProcXDeviceBell, /* 32 */
ProcXSetDeviceValuators, /* 33 */
SProcXGetDeviceControl, /* 34 */
SProcXChangeDeviceControl, /* 35 */
ProcXListDeviceProperties, /* 36 */
SProcXChangeDeviceProperty, /* 37 */
SProcXDeleteDeviceProperty, /* 38 */
SProcXGetDeviceProperty, /* 39 */
SProcXIQueryPointer, /* 40 */
SProcXIWarpPointer, /* 41 */
SProcXIChangeCursor, /* 42 */
ProcXIChangeHierarchy, /* 43 */
SProcXISetClientPointer, /* 44 */
SProcXIGetClientPointer, /* 45 */
SProcXISelectEvents, /* 46 */
SProcXIQueryVersion, /* 47 */
SProcXIQueryDevice, /* 48 */
SProcXISetFocus, /* 49 */
SProcXIGetFocus, /* 50 */
SProcXIGrabDevice, /* 51 */
SProcXIUngrabDevice, /* 52 */
SProcXIAllowEvents, /* 53 */
SProcXIPassiveGrabDevice, /* 54 */
SProcXIPassiveUngrabDevice, /* 55 */
SProcXIListProperties, /* 56 */
SProcXIChangeProperty, /* 57 */
SProcXIDeleteProperty, /* 58 */
SProcXIGetProperty, /* 59 */
SProcXIGetSelectedEvents, /* 60 */
SProcXIBarrierReleasePointer /* 61 */
};
/*****************************************************************
*
* Globals referenced elsewhere in the server.
*
*/
int IReqCode = 0;
int IEventBase = 0;
int BadDevice = 0;
static int BadEvent = 1;
@ -383,11 +248,137 @@ static int
ProcIDispatch(ClientPtr client)
{
REQUEST(xReq);
if (stuff->data >= ARRAY_SIZE(ProcIVector) || !ProcIVector[stuff->data])
return BadRequest;
UpdateCurrentTimeIf();
return (*ProcIVector[stuff->data]) (client);
switch (stuff->data) {
case X_GetExtensionVersion:
return ProcXGetExtensionVersion(client);
case X_ListInputDevices:
return ProcXListInputDevices(client);
case X_OpenDevice:
return ProcXOpenDevice(client);
case X_CloseDevice:
return ProcXCloseDevice(client);
case X_SetDeviceMode:
return ProcXSetDeviceMode(client);
case X_SelectExtensionEvent:
return ProcXSelectExtensionEvent(client);
case X_GetSelectedExtensionEvents:
return ProcXGetSelectedExtensionEvents(client);
case X_ChangeDeviceDontPropagateList:
return ProcXChangeDeviceDontPropagateList(client);
case X_GetDeviceDontPropagateList:
return ProcXGetDeviceDontPropagateList(client);
case X_GetDeviceMotionEvents:
return ProcXGetDeviceMotionEvents(client);
case X_ChangeKeyboardDevice:
return ProcXChangeKeyboardDevice(client);
case X_ChangePointerDevice:
return ProcXChangePointerDevice(client);
case X_GrabDevice:
return ProcXGrabDevice(client);
case X_UngrabDevice:
return ProcXUngrabDevice(client);
case X_GrabDeviceKey:
return ProcXGrabDeviceKey(client);
case X_UngrabDeviceKey:
return ProcXUngrabDeviceKey(client);
case X_GrabDeviceButton:
return ProcXGrabDeviceButton(client);
case X_UngrabDeviceButton:
return ProcXUngrabDeviceButton(client);
case X_AllowDeviceEvents:
return ProcXAllowDeviceEvents(client);
case X_GetDeviceFocus:
return ProcXGetDeviceFocus(client);
case X_SetDeviceFocus:
return ProcXSetDeviceFocus(client);
case X_GetFeedbackControl:
return ProcXGetFeedbackControl(client);
case X_ChangeFeedbackControl:
return ProcXChangeFeedbackControl(client);
case X_GetDeviceKeyMapping:
return ProcXGetDeviceKeyMapping(client);
case X_ChangeDeviceKeyMapping:
return ProcXChangeDeviceKeyMapping(client);
case X_GetDeviceModifierMapping:
return ProcXGetDeviceModifierMapping(client);
case X_SetDeviceModifierMapping:
return ProcXSetDeviceModifierMapping(client);
case X_GetDeviceButtonMapping:
return ProcXGetDeviceButtonMapping(client);
case X_SetDeviceButtonMapping:
return ProcXSetDeviceButtonMapping(client);
case X_QueryDeviceState:
return ProcXQueryDeviceState(client);
case X_SendExtensionEvent:
return ProcXSendExtensionEvent(client);
case X_DeviceBell:
return ProcXDeviceBell(client);
case X_SetDeviceValuators:
return ProcXSetDeviceValuators(client);
case X_GetDeviceControl:
return ProcXGetDeviceControl(client);
case X_ChangeDeviceControl:
return ProcXChangeDeviceControl(client);
/* XI 1.5 */
case X_ListDeviceProperties:
return ProcXListDeviceProperties(client);
case X_ChangeDeviceProperty:
return ProcXChangeDeviceProperty(client);
case X_DeleteDeviceProperty:
return ProcXDeleteDeviceProperty(client);
case X_GetDeviceProperty:
return ProcXGetDeviceProperty(client);
/* XI 2 */
case X_XIQueryPointer:
return ProcXIQueryPointer(client);
case X_XIWarpPointer:
return ProcXIWarpPointer(client);
case X_XIChangeCursor:
return ProcXIChangeCursor(client);
case X_XIChangeHierarchy:
return ProcXIChangeHierarchy(client);
case X_XISetClientPointer:
return ProcXISetClientPointer(client);
case X_XIGetClientPointer:
return ProcXIGetClientPointer(client);
case X_XISelectEvents:
return ProcXISelectEvents(client);
case X_XIQueryVersion:
return ProcXIQueryVersion(client);
case X_XIQueryDevice:
return ProcXIQueryDevice(client);
case X_XISetFocus:
return ProcXISetFocus(client);
case X_XIGetFocus:
return ProcXIGetFocus(client);
case X_XIGrabDevice:
return ProcXIGrabDevice(client);
case X_XIUngrabDevice:
return ProcXIUngrabDevice(client);
case X_XIAllowEvents:
return ProcXIAllowEvents(client);
case X_XIPassiveGrabDevice:
return ProcXIPassiveGrabDevice(client);
case X_XIPassiveUngrabDevice:
return ProcXIPassiveUngrabDevice(client);
case X_XIListProperties:
return ProcXIListProperties(client);
case X_XIChangeProperty:
return ProcXIChangeProperty(client);
case X_XIDeleteProperty:
return ProcXIDeleteProperty(client);
case X_XIGetProperty:
return ProcXIGetProperty(client);
case X_XIGetSelectedEvents:
return ProcXIGetSelectedEvents(client);
case X_XIBarrierReleasePointer:
return ProcXIBarrierReleasePointer(client);
default:
return BadRequest;
}
}
/*******************************************************************************
@ -403,102 +394,136 @@ static int _X_COLD
SProcIDispatch(ClientPtr client)
{
REQUEST(xReq);
if (stuff->data >= ARRAY_SIZE(SProcIVector) || !SProcIVector[stuff->data])
return BadRequest;
UpdateCurrentTimeIf();
return (*SProcIVector[stuff->data]) (client);
}
/**********************************************************************
*
* SReplyIDispatch
* Swap any replies defined in this extension.
*
*/
static void _X_COLD
SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
{
/* All we look at is the type field */
/* This is common to all replies */
if (rep->RepType == X_GetExtensionVersion)
SRepXGetExtensionVersion(client, len,
(xGetExtensionVersionReply *) rep);
else if (rep->RepType == X_ListInputDevices)
SRepXListInputDevices(client, len, (xListInputDevicesReply *) rep);
else if (rep->RepType == X_OpenDevice)
SRepXOpenDevice(client, len, (xOpenDeviceReply *) rep);
else if (rep->RepType == X_SetDeviceMode)
SRepXSetDeviceMode(client, len, (xSetDeviceModeReply *) rep);
else if (rep->RepType == X_GetSelectedExtensionEvents)
SRepXGetSelectedExtensionEvents(client, len,
(xGetSelectedExtensionEventsReply *)
rep);
else if (rep->RepType == X_GetDeviceDontPropagateList)
SRepXGetDeviceDontPropagateList(client, len,
(xGetDeviceDontPropagateListReply *)
rep);
else if (rep->RepType == X_GetDeviceMotionEvents)
SRepXGetDeviceMotionEvents(client, len,
(xGetDeviceMotionEventsReply *) rep);
else if (rep->RepType == X_GrabDevice)
SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep);
else if (rep->RepType == X_GetDeviceFocus)
SRepXGetDeviceFocus(client, len, (xGetDeviceFocusReply *) rep);
else if (rep->RepType == X_GetFeedbackControl)
SRepXGetFeedbackControl(client, len, (xGetFeedbackControlReply *) rep);
else if (rep->RepType == X_GetDeviceKeyMapping)
SRepXGetDeviceKeyMapping(client, len,
(xGetDeviceKeyMappingReply *) rep);
else if (rep->RepType == X_GetDeviceModifierMapping)
SRepXGetDeviceModifierMapping(client, len,
(xGetDeviceModifierMappingReply *) rep);
else if (rep->RepType == X_SetDeviceModifierMapping)
SRepXSetDeviceModifierMapping(client, len,
(xSetDeviceModifierMappingReply *) rep);
else if (rep->RepType == X_GetDeviceButtonMapping)
SRepXGetDeviceButtonMapping(client, len,
(xGetDeviceButtonMappingReply *) rep);
else if (rep->RepType == X_SetDeviceButtonMapping)
SRepXSetDeviceButtonMapping(client, len,
(xSetDeviceButtonMappingReply *) rep);
else if (rep->RepType == X_QueryDeviceState)
SRepXQueryDeviceState(client, len, (xQueryDeviceStateReply *) rep);
else if (rep->RepType == X_SetDeviceValuators)
SRepXSetDeviceValuators(client, len, (xSetDeviceValuatorsReply *) rep);
else if (rep->RepType == X_GetDeviceControl)
SRepXGetDeviceControl(client, len, (xGetDeviceControlReply *) rep);
else if (rep->RepType == X_ChangeDeviceControl)
SRepXChangeDeviceControl(client, len,
(xChangeDeviceControlReply *) rep);
else if (rep->RepType == X_ListDeviceProperties)
SRepXListDeviceProperties(client, len,
(xListDevicePropertiesReply *) rep);
else if (rep->RepType == X_GetDeviceProperty)
SRepXGetDeviceProperty(client, len, (xGetDevicePropertyReply *) rep);
else if (rep->RepType == X_XIQueryPointer)
SRepXIQueryPointer(client, len, (xXIQueryPointerReply *) rep);
else if (rep->RepType == X_XIGetClientPointer)
SRepXIGetClientPointer(client, len, (xXIGetClientPointerReply *) rep);
else if (rep->RepType == X_XIQueryVersion)
SRepXIQueryVersion(client, len, (xXIQueryVersionReply *) rep);
else if (rep->RepType == X_XIQueryDevice)
SRepXIQueryDevice(client, len, (xXIQueryDeviceReply *) rep);
else if (rep->RepType == X_XIGrabDevice)
SRepXIGrabDevice(client, len, (xXIGrabDeviceReply *) rep);
else if (rep->RepType == X_XIPassiveGrabDevice)
SRepXIPassiveGrabDevice(client, len, (xXIPassiveGrabDeviceReply *) rep);
else if (rep->RepType == X_XIListProperties)
SRepXIListProperties(client, len, (xXIListPropertiesReply *) rep);
else if (rep->RepType == X_XIGetProperty)
SRepXIGetProperty(client, len, (xXIGetPropertyReply *) rep);
else if (rep->RepType == X_XIGetSelectedEvents)
SRepXIGetSelectedEvents(client, len, (xXIGetSelectedEventsReply *) rep);
else if (rep->RepType == X_XIGetFocus)
SRepXIGetFocus(client, len, (xXIGetFocusReply *) rep);
else {
FatalError("XINPUT confused sending swapped reply");
switch (stuff->data) {
case X_GetExtensionVersion:
return SProcXGetExtensionVersion(client);
case X_ListInputDevices:
return ProcXListInputDevices(client);
case X_OpenDevice:
return ProcXOpenDevice(client);
case X_CloseDevice:
return ProcXCloseDevice(client);
case X_SetDeviceMode:
return ProcXSetDeviceMode(client);
case X_SelectExtensionEvent:
return SProcXSelectExtensionEvent(client);
case X_GetSelectedExtensionEvents:
return SProcXGetSelectedExtensionEvents(client);
case X_ChangeDeviceDontPropagateList:
return SProcXChangeDeviceDontPropagateList(client);
case X_GetDeviceDontPropagateList:
return SProcXGetDeviceDontPropagateList(client);
case X_GetDeviceMotionEvents:
return SProcXGetDeviceMotionEvents(client);
case X_ChangeKeyboardDevice:
return ProcXChangeKeyboardDevice(client);
case X_ChangePointerDevice:
return ProcXChangePointerDevice(client);
case X_GrabDevice:
return SProcXGrabDevice(client);
case X_UngrabDevice:
return SProcXUngrabDevice(client);
case X_GrabDeviceKey:
return SProcXGrabDeviceKey(client);
case X_UngrabDeviceKey:
return SProcXUngrabDeviceKey(client);
case X_GrabDeviceButton:
return SProcXGrabDeviceButton(client);
case X_UngrabDeviceButton:
return SProcXUngrabDeviceButton(client);
case X_AllowDeviceEvents:
return SProcXAllowDeviceEvents(client);
case X_GetDeviceFocus:
return ProcXGetDeviceFocus(client);
case X_SetDeviceFocus:
return SProcXSetDeviceFocus(client);
case X_GetFeedbackControl:
return ProcXGetFeedbackControl(client);
case X_ChangeFeedbackControl:
return SProcXChangeFeedbackControl(client);
case X_GetDeviceKeyMapping:
return ProcXGetDeviceKeyMapping(client);
case X_ChangeDeviceKeyMapping:
return SProcXChangeDeviceKeyMapping(client);
case X_GetDeviceModifierMapping:
return ProcXGetDeviceModifierMapping(client);
case X_SetDeviceModifierMapping:
return ProcXSetDeviceModifierMapping(client);
case X_GetDeviceButtonMapping:
return ProcXGetDeviceButtonMapping(client);
case X_SetDeviceButtonMapping:
return ProcXSetDeviceButtonMapping(client);
case X_QueryDeviceState:
return ProcXQueryDeviceState(client);
case X_SendExtensionEvent:
return SProcXSendExtensionEvent(client);
case X_DeviceBell:
return ProcXDeviceBell(client);
case X_SetDeviceValuators:
return ProcXSetDeviceValuators(client);
case X_GetDeviceControl:
return SProcXGetDeviceControl(client);
case X_ChangeDeviceControl:
return SProcXChangeDeviceControl(client);
/* XI 1.5 */
case X_ListDeviceProperties:
return ProcXListDeviceProperties(client);
case X_ChangeDeviceProperty:
return SProcXChangeDeviceProperty(client);
case X_DeleteDeviceProperty:
return SProcXDeleteDeviceProperty(client);
case X_GetDeviceProperty:
return SProcXGetDeviceProperty(client);
/* XI 2 */
case X_XIQueryPointer:
return SProcXIQueryPointer(client);
case X_XIWarpPointer:
return SProcXIWarpPointer(client);
case X_XIChangeCursor:
return SProcXIChangeCursor(client);
case X_XIChangeHierarchy:
return ProcXIChangeHierarchy(client);
case X_XISetClientPointer:
return SProcXISetClientPointer(client);
case X_XIGetClientPointer:
return SProcXIGetClientPointer(client);
case X_XISelectEvents:
return SProcXISelectEvents(client);
case X_XIQueryVersion:
return SProcXIQueryVersion(client);
case X_XIQueryDevice:
return SProcXIQueryDevice(client);
case X_XISetFocus:
return SProcXISetFocus(client);
case X_XIGetFocus:
return SProcXIGetFocus(client);
case X_XIGrabDevice:
return SProcXIGrabDevice(client);
case X_XIUngrabDevice:
return SProcXIUngrabDevice(client);
case X_XIAllowEvents:
return SProcXIAllowEvents(client);
case X_XIPassiveGrabDevice:
return SProcXIPassiveGrabDevice(client);
case X_XIPassiveUngrabDevice:
return SProcXIPassiveUngrabDevice(client);
case X_XIListProperties:
return SProcXIListProperties(client);
case X_XIChangeProperty:
return SProcXIChangeProperty(client);
case X_XIDeleteProperty:
return SProcXIDeleteProperty(client);
case X_XIGetProperty:
return SProcXIGetProperty(client);
case X_XIGetSelectedEvents:
return SProcXIGetSelectedEvents(client);
case X_XIBarrierReleasePointer:
return SProcXIBarrierReleasePointer(client);
default:
return BadRequest;
}
}
@ -1122,7 +1147,6 @@ RestoreExtensionEvents(void)
{
int i, j;
IReqCode = 0;
IEventBase = 0;
for (i = 0; i < ExtEventIndex - 1; i++) {
@ -1171,7 +1195,6 @@ RestoreExtensionEvents(void)
static void
IResetProc(ExtensionEntry * unused)
{
ReplySwapVector[IReqCode] = ReplyNotSwappd;
EventSwapVector[DeviceValuator] = NotImplemented;
EventSwapVector[DeviceKeyPress] = NotImplemented;
EventSwapVector[DeviceKeyRelease] = NotImplemented;
@ -1324,7 +1347,8 @@ XInputExtensionInit(void)
extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
SProcIDispatch, IResetProc, StandardMinorOpcode);
if (extEntry) {
IReqCode = extEntry->base;
assert(extEntry->base == EXTENSION_MAJOR_XINPUT);
IEventBase = extEntry->eventBase;
XIVersion = thisversion;
MakeDeviceTypeAtoms();
@ -1333,7 +1357,6 @@ XInputExtensionInit(void)
if (!RT_INPUTCLIENT)
FatalError("Failed to add resource type for XI.\n");
FixExtensionEvents(extEntry);
ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch;
EventSwapVector[DeviceValuator] = SEventIDispatch;
EventSwapVector[DeviceKeyPress] = SEventIDispatch;
EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
@ -1351,7 +1374,7 @@ XInputExtensionInit(void)
EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
EventSwapVector[DevicePresenceNotify] = SEventIDispatch;
GERegisterExtension(IReqCode, XI2EventSwap);
GERegisterExtension(EXTENSION_MAJOR_XINPUT, XI2EventSwap);
memset(&xi_all_devices, 0, sizeof(xi_all_devices));
memset(&xi_all_master_devices, 0, sizeof(xi_all_master_devices));

View File

@ -69,21 +69,12 @@ int
ProcXGetDeviceButtonMapping(ClientPtr client)
{
DeviceIntPtr dev;
xGetDeviceButtonMappingReply rep;
ButtonClassPtr b;
int rc;
REQUEST(xGetDeviceButtonMappingReq);
REQUEST_SIZE_MATCH(xGetDeviceButtonMappingReq);
rep = (xGetDeviceButtonMappingReply) {
.repType = X_Reply,
.RepType = X_GetDeviceButtonMapping,
.sequenceNumber = client->sequence,
.nElts = 0,
.length = 0
};
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@ -92,25 +83,19 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
if (b == NULL)
return BadMatch;
rep.nElts = b->numButtons;
rep.length = bytes_to_int32(rep.nElts);
WriteReplyToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep);
xGetDeviceButtonMappingReply rep = {
.repType = X_Reply,
.RepType = X_GetDeviceButtonMapping,
.sequenceNumber = client->sequence,
.nElts = b->numButtons,
.length = bytes_to_int32(b->numButtons),
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep);
WriteToClient(client, rep.nElts, &b->map[1]);
return Success;
}
/***********************************************************************
*
* This procedure writes the reply for the XGetDeviceButtonMapping function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXGetDeviceButtonMapping(ClientPtr client, int size,
xGetDeviceButtonMappingReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}

View File

@ -33,9 +33,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int ProcXGetDeviceButtonMapping(ClientPtr /* client */
);
void SRepXGetDeviceButtonMapping(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceButtonMappingReply * /* rep */
);
#endif /* GETBMAP_H */

View File

@ -143,21 +143,6 @@ CopySwapDeviceEnable(ClientPtr client, DeviceIntPtr dev, char *buf)
}
}
/***********************************************************************
*
* This procedure writes the reply for the xGetDeviceControl function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}
/***********************************************************************
*
* Get the state of the specified device control.
@ -168,9 +153,8 @@ int
ProcXGetDeviceControl(ClientPtr client)
{
int rc, total_length = 0;
char *buf, *savbuf;
char *savbuf;
DeviceIntPtr dev;
xGetDeviceControlReply rep;
REQUEST(xGetDeviceControlReq);
REQUEST_SIZE_MATCH(xGetDeviceControlReq);
@ -179,13 +163,6 @@ ProcXGetDeviceControl(ClientPtr client)
if (rc != Success)
return rc;
rep = (xGetDeviceControlReply) {
.repType = X_Reply,
.RepType = X_GetDeviceControl,
.sequenceNumber = client->sequence,
.length = 0
};
switch (stuff->control) {
case DEVICE_RESOLUTION:
if (!dev->valuator)
@ -206,7 +183,7 @@ ProcXGetDeviceControl(ClientPtr client)
return BadValue;
}
buf = (char *) malloc(total_length);
char *buf = calloc(1, total_length);
if (!buf)
return BadAlloc;
savbuf = buf;
@ -225,8 +202,18 @@ ProcXGetDeviceControl(ClientPtr client)
break;
}
rep.length = bytes_to_int32(total_length);
WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep);
xGetDeviceControlReply rep = {
.repType = X_Reply,
.RepType = X_GetDeviceControl,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(total_length),
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xGetDeviceControlReply), &rep);
WriteToClient(client, total_length, savbuf);
free(savbuf);
return Success;

View File

@ -36,9 +36,4 @@ int SProcXGetDeviceControl(ClientPtr /* client */
int ProcXGetDeviceControl(ClientPtr /* client */
);
void SRepXGetDeviceControl(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceControlReply * /* rep */
);
#endif /* GETDCTL_H */

View File

@ -234,23 +234,6 @@ CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf)
*buf += sizeof(xBellFeedbackState);
}
/***********************************************************************
*
* This procedure writes the reply for the xGetFeedbackControl function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXGetFeedbackControl(ClientPtr client, int size,
xGetFeedbackControlReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->num_feedbacks);
WriteToClient(client, size, rep);
}
/***********************************************************************
*
* Get the feedback control state.
@ -261,7 +244,7 @@ int
ProcXGetFeedbackControl(ClientPtr client)
{
int rc, total_length = 0;
char *buf, *savbuf;
char *savbuf;
DeviceIntPtr dev;
KbdFeedbackPtr k;
PtrFeedbackPtr p;
@ -269,7 +252,6 @@ ProcXGetFeedbackControl(ClientPtr client)
StringFeedbackPtr s;
BellFeedbackPtr b;
LedFeedbackPtr l;
xGetFeedbackControlReply rep;
REQUEST(xGetFeedbackControlReq);
REQUEST_SIZE_MATCH(xGetFeedbackControlReq);
@ -278,12 +260,10 @@ ProcXGetFeedbackControl(ClientPtr client)
if (rc != Success)
return rc;
rep = (xGetFeedbackControlReply) {
xGetFeedbackControlReply rep = {
.repType = X_Reply,
.RepType = X_GetFeedbackControl,
.sequenceNumber = client->sequence,
.length = 0,
.num_feedbacks = 0
};
for (k = dev->kbdfeed; k; k = k->next) {
@ -315,7 +295,7 @@ ProcXGetFeedbackControl(ClientPtr client)
if (total_length == 0)
return BadMatch;
buf = (char *) malloc(total_length);
char *buf = (char *) calloc(1, total_length);
if (!buf)
return BadAlloc;
savbuf = buf;
@ -334,7 +314,13 @@ ProcXGetFeedbackControl(ClientPtr client)
CopySwapBellFeedback(client, b, &buf);
rep.length = bytes_to_int32(total_length);
WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.num_feedbacks);
}
WriteToClient(client, sizeof(xGetFeedbackControlReply), &rep);
WriteToClient(client, total_length, savbuf);
free(savbuf);
return Success;

View File

@ -33,9 +33,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int ProcXGetFeedbackControl(ClientPtr /* client */
);
void SRepXGetFeedbackControl(ClientPtr /* client */ ,
int /* size */ ,
xGetFeedbackControlReply * /* rep */
);
#endif /* GETFCTL_H */

View File

@ -71,7 +71,6 @@ ProcXGetDeviceFocus(ClientPtr client)
{
DeviceIntPtr dev;
FocusClassPtr focus;
xGetDeviceFocusReply rep;
int rc;
REQUEST(xGetDeviceFocusReq);
@ -83,15 +82,16 @@ ProcXGetDeviceFocus(ClientPtr client)
if (!dev->focus)
return BadDevice;
rep = (xGetDeviceFocusReply) {
focus = dev->focus;
xGetDeviceFocusReply rep = {
.repType = X_Reply,
.RepType = X_GetDeviceFocus,
.sequenceNumber = client->sequence,
.length = 0
.time = focus->time.milliseconds,
.revertTo = focus->revert,
};
focus = dev->focus;
if (focus->win == NoneWin)
rep.focus = None;
else if (focus->win == PointerRootWin)
@ -101,25 +101,12 @@ ProcXGetDeviceFocus(ClientPtr client)
else
rep.focus = focus->win->drawable.id;
rep.time = focus->time.milliseconds;
rep.revertTo = focus->revert;
WriteReplyToClient(client, sizeof(xGetDeviceFocusReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.focus);
swapl(&rep.time);
}
WriteToClient(client, sizeof(xGetDeviceFocusReply), &rep);
return Success;
}
/***********************************************************************
*
* This procedure writes the reply for the GetDeviceFocus function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXGetDeviceFocus(ClientPtr client, int size, xGetDeviceFocusReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swapl(&rep->focus);
swapl(&rep->time);
WriteToClient(client, size, rep);
}

View File

@ -33,9 +33,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int ProcXGetDeviceFocus(ClientPtr /* client */
);
void SRepXGetDeviceFocus(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceFocusReply * /* rep */
);
#endif /* GETFOCUS_H */

View File

@ -71,7 +71,6 @@ SOFTWARE.
int
ProcXGetDeviceKeyMapping(ClientPtr client)
{
xGetDeviceKeyMappingReply rep;
DeviceIntPtr dev;
XkbDescPtr xkb;
KeySymsPtr syms;
@ -102,14 +101,19 @@ ProcXGetDeviceKeyMapping(ClientPtr client)
if (!syms)
return BadAlloc;
rep = (xGetDeviceKeyMappingReply) {
xGetDeviceKeyMappingReply rep = {
.repType = X_Reply,
.RepType = X_GetDeviceKeyMapping,
.sequenceNumber = client->sequence,
.keySymsPerKeyCode = syms->mapWidth,
.length = (syms->mapWidth * stuff->count) /* KeySyms are 4 bytes */
};
WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep);
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
WriteSwappedDataToClient(client,
@ -121,19 +125,3 @@ ProcXGetDeviceKeyMapping(ClientPtr client)
return Success;
}
/***********************************************************************
*
* This procedure writes the reply for the XGetDeviceKeyMapping function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXGetDeviceKeyMapping(ClientPtr client, int size,
xGetDeviceKeyMappingReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}

View File

@ -33,9 +33,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int ProcXGetDeviceKeyMapping(ClientPtr /* client */
);
void SRepXGetDeviceKeyMapping(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceKeyMappingReply * /* rep */
);
#endif /* GETKMAP_H */

View File

@ -69,7 +69,6 @@ int
ProcXGetDeviceModifierMapping(ClientPtr client)
{
DeviceIntPtr dev;
xGetDeviceModifierMappingReply rep;
KeyCode *modkeymap = NULL;
int ret, max_keys_per_mod;
@ -84,7 +83,7 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
if (ret != Success)
return ret;
rep = (xGetDeviceModifierMappingReply) {
xGetDeviceModifierMappingReply rep = {
.repType = X_Reply,
.RepType = X_GetDeviceModifierMapping,
.sequenceNumber = client->sequence,
@ -93,26 +92,14 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
.length = max_keys_per_mod << 1
};
WriteReplyToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep);
WriteToClient(client, max_keys_per_mod * 8, modkeymap);
free(modkeymap);
return Success;
}
/***********************************************************************
*
* This procedure writes the reply for the XGetDeviceModifierMapping function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXGetDeviceModifierMapping(ClientPtr client, int size,
xGetDeviceModifierMappingReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}

View File

@ -33,9 +33,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int ProcXGetDeviceModifierMapping(ClientPtr /* client */
);
void SRepXGetDeviceModifierMapping(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceModifierMappingReply * /* rep */
);
#endif /* GETMMAP_H */

View File

@ -94,18 +94,15 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
int i, rc;
XEventClass *buf = NULL, *tbuf;
WindowPtr pWin;
xGetDeviceDontPropagateListReply rep;
OtherInputMasks *others;
REQUEST(xGetDeviceDontPropagateListReq);
REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
rep = (xGetDeviceDontPropagateListReply) {
xGetDeviceDontPropagateListReply rep = {
.repType = X_Reply,
.RepType = X_GetDeviceDontPropagateList,
.sequenceNumber = client->sequence,
.length = 0,
.count = 0
};
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
@ -117,7 +114,9 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
ClassFromMask(NULL, others->dontPropagateMask[i], i, &count, COUNT);
if (count) {
rep.count = count;
buf = xallocarray(rep.count, sizeof(XEventClass));
buf = calloc(rep.count, sizeof(XEventClass));
if (!buf)
return BadAlloc;
rep.length = bytes_to_int32(rep.count * sizeof(XEventClass));
tbuf = buf;
@ -127,7 +126,12 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
}
}
WriteReplyToClient(client, sizeof(xGetDeviceDontPropagateListReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.count);
}
WriteToClient(client, sizeof(xGetDeviceDontPropagateListReply), &rep);
if (count) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
@ -164,20 +168,3 @@ XEventClass
}
return buf;
}
/***********************************************************************
*
* This procedure writes the reply for the XGetDeviceDontPropagateList function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXGetDeviceDontPropagateList(ClientPtr client, int size,
xGetDeviceDontPropagateListReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->count);
WriteToClient(client, size, rep);
}

View File

@ -43,9 +43,4 @@ XEventClass *ClassFromMask(XEventClass * /* buf */ ,
int /* mode */
);
void SRepXGetDeviceDontPropagateList(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceDontPropagateListReply * /* rep */
);
#endif /* GETPROP_H */

View File

@ -55,7 +55,7 @@ SOFTWARE.
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#include "dix/resource_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window struct */
@ -90,7 +90,6 @@ int
ProcXGetSelectedExtensionEvents(ClientPtr client)
{
int i, rc, total_length = 0;
xGetSelectedExtensionEventsReply rep;
WindowPtr pWin;
XEventClass *buf = NULL;
XEventClass *tclient;
@ -101,13 +100,10 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
REQUEST(xGetSelectedExtensionEventsReq);
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
rep = (xGetSelectedExtensionEventsReply) {
xGetSelectedExtensionEventsReply rep = {
.repType = X_Reply,
.RepType = X_GetSelectedExtensionEvents,
.sequenceNumber = client->sequence,
.length = 0,
.this_client_count = 0,
.all_clients_count = 0
};
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
@ -131,7 +127,7 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
total_length = (rep.all_clients_count + rep.this_client_count) *
sizeof(XEventClass);
rep.length = bytes_to_int32(total_length);
buf = (XEventClass *) malloc(total_length);
buf = calloc(1, total_length);
tclient = buf;
aclient = buf + rep.this_client_count;
@ -146,7 +142,13 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
ClassFromMask(aclient, others->mask[i], i, NULL, CREATE);
}
WriteReplyToClient(client, sizeof(xGetSelectedExtensionEventsReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.this_client_count);
swaps(&rep.all_clients_count);
}
WriteToClient(client, sizeof(xGetSelectedExtensionEventsReply), &rep);
if (total_length) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
@ -155,21 +157,3 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
free(buf);
return Success;
}
/***********************************************************************
*
* This procedure writes the reply for the XGetSelectedExtensionEvents function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXGetSelectedExtensionEvents(ClientPtr client, int size,
xGetSelectedExtensionEventsReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->this_client_count);
swaps(&rep->all_clients_count);
WriteToClient(client, size, rep);
}

View File

@ -36,9 +36,4 @@ int SProcXGetSelectedExtensionEvents(ClientPtr /* client */
int ProcXGetSelectedExtensionEvents(ClientPtr /* client */
);
void SRepXGetSelectedExtensionEvents(ClientPtr /* client */ ,
int /* size */ ,
xGetSelectedExtensionEventsReply * /* rep */
);
#endif /* GETSELEV_H */

View File

@ -86,8 +86,6 @@ SProcXGetExtensionVersion(ClientPtr client)
int
ProcXGetExtensionVersion(ClientPtr client)
{
xGetExtensionVersionReply rep;
REQUEST(xGetExtensionVersionReq);
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
@ -95,35 +93,23 @@ ProcXGetExtensionVersion(ClientPtr client)
stuff->nbytes))
return BadLength;
rep = (xGetExtensionVersionReply) {
xGetExtensionVersionReply rep = {
.repType = X_Reply,
.RepType = X_GetExtensionVersion,
.sequenceNumber = client->sequence,
.length = 0,
.major_version = XIVersion.major_version,
.minor_version = XIVersion.minor_version,
.present = TRUE
};
WriteReplyToClient(client, sizeof(xGetExtensionVersionReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.major_version);
swaps(&rep.minor_version);
}
WriteToClient(client, sizeof(xGetExtensionVersionReply), &rep);
return Success;
}
/***********************************************************************
*
* This procedure writes the reply for the XGetExtensionVersion function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXGetExtensionVersion(ClientPtr client, int size,
xGetExtensionVersionReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->major_version);
swaps(&rep->minor_version);
WriteToClient(client, size, rep);
}

View File

@ -36,9 +36,4 @@ int SProcXGetExtensionVersion(ClientPtr /* client */
int ProcXGetExtensionVersion(ClientPtr /* client */
);
void SRepXGetExtensionVersion(ClientPtr /* client */ ,
int /* size */ ,
xGetExtensionVersionReply * /* rep */
);
#endif /* GETVERS_H */

View File

@ -60,7 +60,6 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include "exglobals.h"
#include "dixevents.h" /* GrabDevice */
#include "grabdev.h"
extern XExtEventInfo EventInfo[];
@ -101,7 +100,6 @@ int
ProcXGrabDevice(ClientPtr client)
{
int rc;
xGrabDeviceReply rep;
DeviceIntPtr dev;
GrabMask mask;
struct tmask tmp[EMASKSIZE];
@ -113,11 +111,10 @@ ProcXGrabDevice(ClientPtr client)
bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
return BadLength;
rep = (xGrabDeviceReply) {
xGrabDeviceReply rep = {
.repType = X_Reply,
.RepType = X_GrabDevice,
.sequenceNumber = client->sequence,
.length = 0,
};
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
@ -139,7 +136,11 @@ ProcXGrabDevice(ClientPtr client)
if (rc != Success)
return rc;
WriteReplyToClient(client, sizeof(xGrabDeviceReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xGrabDeviceReply), &rep);
return Success;
}
@ -197,18 +198,3 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
}
return Success;
}
/***********************************************************************
*
* This procedure writes the reply for the XGrabDevice function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXGrabDevice(ClientPtr client, int size, xGrabDeviceReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}

View File

@ -44,9 +44,4 @@ int CreateMaskFromList(ClientPtr /* client */ ,
int /* req */
);
void SRepXGrabDevice(ClientPtr /* client */ ,
int /* size */ ,
xGrabDeviceReply * /* rep */
);
#endif /* GRABDEV_H */

View File

@ -56,6 +56,7 @@ SOFTWARE.
#include <X11/extensions/XIproto.h>
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
@ -99,7 +100,6 @@ ProcXGrabDeviceButton(ClientPtr client)
DeviceIntPtr mdev;
XEventClass *class;
struct tmask tmp[EMASKSIZE];
GrabParameters param;
GrabMask mask;
REQUEST(xGrabDeviceButtonReq);
@ -135,7 +135,7 @@ ProcXGrabDeviceButton(ClientPtr client)
X_GrabDeviceButton)) != Success)
return ret;
param = (GrabParameters) {
GrabParameters param = {
.grabtype = XI,
.ownerEvents = stuff->ownerEvents,
.this_device_mode = stuff->this_device_mode,

View File

@ -56,6 +56,7 @@ SOFTWARE.
#include <X11/extensions/XIproto.h>
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
@ -97,7 +98,6 @@ ProcXGrabDeviceKey(ClientPtr client)
DeviceIntPtr mdev;
XEventClass *class;
struct tmask tmp[EMASKSIZE];
GrabParameters param;
GrabMask mask;
REQUEST(xGrabDeviceKeyReq);
@ -133,7 +133,7 @@ ProcXGrabDeviceKey(ClientPtr client)
X_GrabDeviceKey)) != Success)
return ret;
param = (GrabParameters) {
GrabParameters param = {
.grabtype = XI,
.ownerEvents = stuff->ownerEvents,
.this_device_mode = stuff->this_device_mode,

View File

@ -86,86 +86,59 @@ SProcXGetDeviceMotionEvents(ClientPtr client)
int
ProcXGetDeviceMotionEvents(ClientPtr client)
{
INT32 *coords = NULL, *bufptr;
xGetDeviceMotionEventsReply rep;
unsigned long i;
int rc, num_events, axes, size = 0;
unsigned long nEvents;
DeviceIntPtr dev;
TimeStamp start, stop;
int length = 0;
ValuatorClassPtr v;
REQUEST(xGetDeviceMotionEventsReq);
REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixReadAccess);
DeviceIntPtr dev;
int rc = dixLookupDevice(&dev, stuff->deviceid, client, DixReadAccess);
if (rc != Success)
return rc;
v = dev->valuator;
const ValuatorClassPtr v = dev->valuator;
if (v == NULL || v->numAxes == 0)
return BadMatch;
if (dev->valuator->motionHintWindow)
MaybeStopDeviceHint(dev, client);
axes = v->numAxes;
rep = (xGetDeviceMotionEventsReply) {
xGetDeviceMotionEventsReply rep = {
.repType = X_Reply,
.RepType = X_GetDeviceMotionEvents,
.sequenceNumber = client->sequence,
.length = 0,
.nEvents = 0,
.axes = axes,
.axes = v->numAxes,
.mode = Absolute /* XXX we don't do relative at the moment */
};
start = ClientTimeToServerTime(stuff->start);
stop = ClientTimeToServerTime(stuff->stop);
if (CompareTimeStamps(start, stop) == LATER ||
CompareTimeStamps(start, currentTime) == LATER) {
WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep);
return Success;
}
TimeStamp start = ClientTimeToServerTime(stuff->start);
TimeStamp stop = ClientTimeToServerTime(stuff->stop);
int length = 0;
INT32 *coords = NULL;
if (CompareTimeStamps(start, stop) != LATER &&
CompareTimeStamps(start, currentTime) != LATER) {
if (CompareTimeStamps(stop, currentTime) == LATER)
stop = currentTime;
num_events = v->numMotionEvents;
if (num_events) {
size = sizeof(Time) + (axes * sizeof(INT32));
if (v->numMotionEvents) {
const int size = sizeof(Time) + (v->numAxes * sizeof(INT32));
rep.nEvents = GetMotionHistory(dev, (xTimecoord **) &coords, /* XXX */
start.milliseconds, stop.milliseconds,
(ScreenPtr) NULL, FALSE);
length = rep.nEvents * size;
rep.length = bytes_to_int32(length);
}
if (rep.nEvents > 0) {
length = bytes_to_int32(rep.nEvents * size);
rep.length = length;
}
nEvents = rep.nEvents;
WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep);
if (nEvents) {
if (client->swapped) {
bufptr = coords;
for (i = 0; i < nEvents * (axes + 1); i++) {
swapl(bufptr);
bufptr++;
}
}
WriteToClient(client, length * 4, coords);
SwapLongs((CARD32*) coords, rep.length);
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.nEvents);
}
WriteToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep);
WriteToClient(client, length, coords);
free(coords);
return Success;
}
/***********************************************************************
*
* This procedure writes the reply for the XGetDeviceMotionEvents function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXGetDeviceMotionEvents(ClientPtr client, int size,
xGetDeviceMotionEventsReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swapl(&rep->nEvents);
WriteToClient(client, size, rep);
}

View File

@ -36,9 +36,4 @@ int SProcXGetDeviceMotionEvents(ClientPtr /* client */
int ProcXGetDeviceMotionEvents(ClientPtr /* client */
);
void SRepXGetDeviceMotionEvents(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceMotionEventsReply * /* rep */
);
#endif /* GTMOTION_H */

View File

@ -157,9 +157,9 @@ CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes, char **buf)
dev->id = d->id;
dev->type = d->xinput_type;
dev->num_classes = num_classes;
if (IsMaster(d) && IsKeyboardDevice(d))
if (InputDevIsMaster(d) && IsKeyboardDevice(d))
dev->use = IsXKeyboard;
else if (IsMaster(d) && IsPointerDevice(d))
else if (InputDevIsMaster(d) && IsPointerDevice(d))
dev->use = IsXPointer;
else if (d->valuator && d->button)
dev->use = IsXExtensionPointer;
@ -294,7 +294,7 @@ static Bool
ShouldSkipDevice(ClientPtr client, DeviceIntPtr d)
{
/* don't send master devices other than VCP/VCK */
if (!IsMaster(d) || d == inputInfo.pointer ||d == inputInfo.keyboard) {
if (!InputDevIsMaster(d) || d == inputInfo.pointer ||d == inputInfo.keyboard) {
int rc = XaceHookDeviceAccess(client, d, DixGetAttrAccess);
if (rc == Success)
@ -316,7 +316,6 @@ ShouldSkipDevice(ClientPtr client, DeviceIntPtr d)
int
ProcXListInputDevices(ClientPtr client)
{
xListInputDevicesReply rep;
int numdevs = 0;
int namesize = 1; /* need 1 extra byte for strcpy */
int i = 0, size = 0;
@ -328,13 +327,6 @@ ProcXListInputDevices(ClientPtr client)
REQUEST_SIZE_MATCH(xListInputDevicesReq);
rep = (xListInputDevicesReply) {
.repType = X_Reply,
.RepType = X_ListInputDevices,
.sequenceNumber = client->sequence,
.length = 0
};
/* allocate space for saving skip value */
skip = calloc(inputInfo.numDevices, sizeof(Bool));
if (!skip)
@ -383,26 +375,23 @@ ProcXListInputDevices(ClientPtr client)
ListDeviceInfo(client, d, dev++, &devbuf, &classbuf, &namebuf);
}
rep.ndevices = numdevs;
rep.length = bytes_to_int32(total_length);
WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep);
xListInputDevicesReply rep = {
.repType = X_Reply,
.RepType = X_ListInputDevices,
.sequenceNumber = client->sequence,
.ndevices = numdevs,
.length = bytes_to_int32(total_length),
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xListInputDevicesReply), &rep);
WriteToClient(client, total_length, savbuf);
free(savbuf);
free(skip);
return Success;
}
/***********************************************************************
*
* This procedure writes the reply for the XListInputDevices function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXListInputDevices(ClientPtr client, int size, xListInputDevicesReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}

View File

@ -35,9 +35,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int ProcXListInputDevices(ClientPtr /* client */
);
void SRepXListInputDevices(ClientPtr /* client */ ,
int /* size */ ,
xListInputDevicesReply * /* rep */
);
#endif /* LISTDEV_H */

View File

@ -52,9 +52,12 @@ SOFTWARE.
#include <dix-config.h>
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/input_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "XIstubs.h"
#include "windowstr.h" /* window structure */
#include "exglobals.h"
@ -76,7 +79,6 @@ ProcXOpenDevice(ClientPtr client)
xInputClassInfo evbase[numInputClasses];
int j = 0;
int status = Success;
xOpenDeviceReply rep;
DeviceIntPtr dev;
REQUEST(xOpenDeviceReq);
@ -94,7 +96,7 @@ ProcXOpenDevice(ClientPtr client)
else if (status != Success)
return status;
if (IsMaster(dev))
if (InputDevIsMaster(dev))
return BadDevice;
if (status != Success)
@ -127,29 +129,21 @@ ProcXOpenDevice(ClientPtr client)
}
evbase[j].class = OtherClass;
evbase[j++].event_type_base = event_base[OtherClass];
rep = (xOpenDeviceReply) {
xOpenDeviceReply rep = {
.repType = X_Reply,
.RepType = X_OpenDevice,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(j * sizeof(xInputClassInfo)),
.num_classes = j
};
WriteReplyToClient(client, sizeof(xOpenDeviceReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xOpenDeviceReply), &rep);
WriteToClient(client, j * sizeof(xInputClassInfo), evbase);
return Success;
}
/***********************************************************************
*
* This procedure writes the reply for the XOpenDevice function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXOpenDevice(ClientPtr client, int size, xOpenDeviceReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}

View File

@ -33,9 +33,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int ProcXOpenDevice(ClientPtr /* client */
);
void SRepXOpenDevice(ClientPtr /* client */ ,
int /* size */ ,
xOpenDeviceReply * /* rep */
);
#endif /* OPENDEV_H */

View File

@ -66,7 +66,6 @@ ProcXQueryDeviceState(ClientPtr client)
xButtonState *tb;
ValuatorClassPtr v;
xValuatorState *tv;
xQueryDeviceStateReply rep;
DeviceIntPtr dev;
double *values;
@ -144,31 +143,20 @@ ProcXQueryDeviceState(ClientPtr client)
}
}
rep = (xQueryDeviceStateReply) {
xQueryDeviceStateReply rep = {
.repType = X_Reply,
.RepType = X_QueryDeviceState,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(total_length),
.num_classes = num_classes
};
WriteReplyToClient(client, sizeof(xQueryDeviceStateReply), &rep);
if (total_length > 0)
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xQueryDeviceStateReply), &rep);
WriteToClient(client, total_length, savbuf);
free(savbuf);
return Success;
}
/***********************************************************************
*
* This procedure writes the reply for the XQueryDeviceState function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXQueryDeviceState(ClientPtr client, int size, xQueryDeviceStateReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}

View File

@ -33,9 +33,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int ProcXQueryDeviceState(ClientPtr /* client */
);
void SRepXQueryDeviceState(ClientPtr /* client */ ,
int /* size */ ,
xQueryDeviceStateReply * /* rep */
);
#endif /* QUERYST_H */

Some files were not shown because too many files have changed in this diff Show More