Commit Graph

1074 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult
88ed85dffc Xi: inline SProcXGrabDevice()
No need to have a hole bunch of extra functions, if we can just easily
inline the few relevant lines.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-24 11:39:00 +02:00
Enrico Weigelt, metux IT consult
2b9c079b86 Xi: inline SProcXChangeFeedbackControl()
No need to have a hole bunch of extra functions, if we can just easily
inline the few relevant lines.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-24 11:38:50 +02:00
Enrico Weigelt, metux IT consult
2e64ce88ea Xi: inline SProcXSelectExtensionEvent()
No need to have a hole bunch of extra functions, if we can just easily
inline the few relevant lines.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-24 11:38:34 +02:00
Enrico Weigelt, metux IT consult
da1c2a4605 Xi: inline SProcXUngrabDevice()
No need to have a hole bunch of extra functions, if we can just easily
inline the few relevant lines.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-24 11:38:22 +02:00
Enrico Weigelt, metux IT consult
3b4ba245b7 Xi: inline SProcXIGrabDevice() and SProcXIUngrabDevice()
No need to have a hole bunch of extra functions, if we can just easily
inline the few relevant lines.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-24 11:38:10 +02:00
Enrico Weigelt, metux IT consult
24f8535f28 Xi: inline SProcXIChangeCursor()
No need to have a hole bunch of extra functions, if we can just easily
inline the few relevant lines.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-24 11:37:58 +02:00
Enrico Weigelt, metux IT consult
36facd71b5 dix: move request/response related functions to new request_priv.h header
Move functions/macros dealing with request parsing or reply assembly/write
out of the big dix_priv.h into their own headers. This new header will also
get more of those function/macros soon (yet still in the pipeline).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-24 11:32:50 +02:00
Enrico Weigelt, metux IT consult
d82aa8308d xace: drop never used XACE_KEY_AVAIL
This hook was never used, so no need to keep around something that's
really not used anywhere.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-23 11:26:19 +02:00
Enrico Weigelt, metux IT consult
48c72edf38 Xi: use return value of X_SEND_REPLY_SIMPLE()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-22 12:43:31 +02:00
Enrico Weigelt, metux IT consult
90a258d08a Xi: inline swapped property request handlers
No need to have a hole bunch of extra functions, if we can just easily
inline the few relevant lines.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-22 12:43:21 +02:00
Enrico Weigelt, metux IT consult
c2a2ce1d7e Xi: inline SProcXAllowDeviceEvents()
No need to have a hole bunch of extra functions, if we can just easily
inline the few relevant lines.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-22 12:42:44 +02:00
Enrico Weigelt, metux IT consult
a040a93f59 Xi: inline SProcXChangeDeviceKeyMapping()
No need to have a hole bunch of extra functions, if we can just easily
inline the few relevant lines.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-17 09:43:47 +02:00
Enrico Weigelt, metux IT consult
358f76f2ad treewide: fix misleading firstScreen variable naming to masterScreen
Follow-up on renaming dixGetFirstScreenPtr() to dixGetMasterScreen():
also rename the target variables for correct technical terminology.

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

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

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

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

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

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-12 11:44:05 +02:00
Enrico Weigelt, metux IT consult
2b875e18bc Xi: consolidate request handler prototypes
Instead of having huge number of micro-headers, consolidate all the
request handler prototypes in one file.

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

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-10 13:45:05 +02:00
Enrico Weigelt, metux IT consult
006f0ec78c Xi: move VPC define into the only source using it
Only used inside listdev.c, so no need to have it within a header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-10 13:42:31 +02:00
Enrico Weigelt, metux IT consult
b5210be9eb Xi: helper for private structure retrieval
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-10 13:41:47 +02:00
Enrico Weigelt, metux IT consult
a324351f67 treewide: drop unnecessary includes of Xi/eglobals.h
Dropping include by sources that don't use anything from this header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-09 14:41:10 +02:00
Enrico Weigelt, metux IT consult
f00f20aa8e Xi: ProcXCloseDevice(): compactify the loop a bit
In preparation of upcoming screen iterator macros, compactify the
loop body a little bit. This function is so cold that it's not
really worth caching the screen's root window pointer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-04 11:08:19 +02:00
Enrico Weigelt, metux IT consult
06af052eb7 Xi: SendEventToAllWindows(): drop unneeded local variable
Only used once as paramter, so we can use its assigned value directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-04 11:07:32 +02:00
Enrico Weigelt, metux IT consult
d47357e6c9 Xi: inline SProcXGetDeviceControl()
move the only one relevant line into ProcXGetDeviceControl()

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-02 12:48:50 +02:00
Enrico Weigelt, metux IT consult
34a27eacce Xi: ProcXIQueryPointer(): use x_rpcbuf_t
use x_rpcbuf_t for reply payload assembly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-31 16:10:06 +02:00
Enrico Weigelt, metux IT consult
6efd1a85e8 Xi: ProcXIAllowEvents(): untwist request header handling
The Xi protocol has some pretty unclean design aspect: instead of adding a
new sub-request type, version 2.2 introduced a different request structure
with some extra fields. So depending on which version the client has selected,
we need to operate on separate structs.

In the current implementation, there's a unclean hack by using the extended
structure and only accessing the extra fields when using v2.2 or above.
Even though this works, it's making the code unnecessarily complicated and
blocking the use if canonical request parsing macros (which are coming with
subsequent commits).

Thus, it's time to clean it up and only use the exactly correct structs
in the two different cases. The trick is just branching by version and pick
out the the interesting values from the corresponding structs, so they can
later be used in the (mostly) version independent part.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-31 16:09:10 +02:00
Enrico Weigelt, metux IT consult
8c90875c3d Xi: ProcXListInputDevices(): use x_rpcbuf_t
use x_rpcbuf_t for reply payload assembly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-31 16:04:18 +02:00
Enrico Weigelt, metux IT consult
a27f18d1c6 Xi: ProcXGetDeviceControl() also use x_rpcbuf_t for byte-swapping
Use x_rpcbuf_t also for writing individual fields and so let it also
do the byte-swapping.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-31 14:16:18 +02:00
Enrico Weigelt, metux IT consult
e223abb80e Xi: ProcXISelectEvents() declare variables where needed
For better readability, declare the variables only where they're used,
and try to scope them, instead of declaring them all on the very top.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-31 10:04:27 +02:00
Enrico Weigelt, metux IT consult
cb0ab6ae0b Xi: ProcXIPassiveGrabDevice(): move rpcbuf declaration upwards
The code below the `out` label is using the rpcbuf variable, but we have
a jump site before the variable is declared. It had been overlooked, because
for yet unknown reasons the compiler doesn't complain at all about this.
We could assume that it at least moves the stack allocation upwards
(always could even happen even on function entry), but we don't know whether
the memory is already unitialized.

So, to be on safe-side, move the declaration upwards, before the first
jump site.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-29 14:32:39 +02:00
Enrico Weigelt, metux IT consult
0075fca5fb Xi: ProcXIPassiveGrabDevice(): use x_rpcbuf_t
use x_rpcbuf_t for reply payload assembly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-29 13:20:17 +02:00
Enrico Weigelt, metux IT consult
6413bd61d7 Xi: ProcXGetFeedbackControl(): use x_rpcbuf_t
Use x_rpcbuf_t for reply payload assembly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-29 13:11:43 +02:00
Enrico Weigelt, metux IT consult
e46ea5c7eb Xi: ProcXGetDeviceMotionEvents(): use x_rpcbuf_t
Use x_rpcbuf_t for reply payload assembly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-29 13:11:32 +02:00
Enrico Weigelt, metux IT consult
eee0a6b1fd Xi: ProcXGetDeviceModifierMapping(): use x_rpcbuf_t
Use x_rpcbuf_t for reply payload assembly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-29 13:11:20 +02:00
Enrico Weigelt, metux IT consult
8ce6636973 Xi: ProcXGetDeviceControl(): use x_rpcbuf_t
Use x_rpcbuf_t for reply payload assembly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-29 13:11:10 +02:00
Enrico Weigelt, metux IT consult
e45decb482 Xi: ProcXGetDeviceButtonMapping(): use x_rpcbuf_t
Use x_rpcbuf_t for reply payload assembly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-29 13:10:59 +02:00
Enrico Weigelt, metux IT consult
61eb2e2675 Xi: make ListDeviceClasses() static
Only used within the same source file, so can be made static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-29 13:10:48 +02:00
Enrico Weigelt, metux IT consult
18d3fd9ac8 Xi: ProcXOpenDevice(): use x_rpcbuf_t
use x_rpcbuf_t for reply payload assembly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-29 11:42:31 +02:00
Enrico Weigelt, metux IT consult
68b7098173 Xi: ProcXQueryDeviceState(): use x_rpcbuf_t
use x_rpcbuf_t for reply payload assembly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-29 11:42:22 +02:00
Enrico Weigelt, metux IT consult
a7a48427f5 Xi: ProcXIQueryDevice(): use x_rpcbuf_t
use x_rpcbuf_t for reply payload assembly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-29 11:39:59 +02:00
Enrico Weigelt, metux IT consult
5281024261 Xi: ProcXIQueryPointer(): use x_rpcbuf_t
use x_rpcbuf_t for reply payload assembly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-29 11:39:51 +02:00
Enrico Weigelt, metux IT consult
681ff201d5 Xi: replace WriteRpcbufToClient() by X_SEND_REPLY_WITH_RPCBUF() macro
Use the new X_SEND_REPLY_WITH_RPCBUF() macro for final reply write out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-24 12:11:24 +02:00
Enrico Weigelt, metux IT consult
64996477f5 Xi: xtest: use X_SEND_REPLY_SIMPLE()
Use X_SEND_REPLY_SIMPLE() for sending out simple replies.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-22 14:27:29 +02:00
stefan11111
4c79fd513a Xi: Fix xinput property count
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-08-22 14:27:01 +02:00
Enrico Weigelt, metux IT consult
6730e673d6 Xi: canonical walkScreen variable on screen list iterations
When iterating screen lists, consistently use the same variable name
`walkScreen` for holding current screen pointer everywhere.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-18 10:52:49 +02:00
Enrico Weigelt, metux IT consult
6d6f64da55 Xi: fix size parameter to WriteToClient()
Size computation needs to be done on the struct actually written.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-14 16:52:47 +02:00
Enrico Weigelt, metux IT consult
946eb68ff3 xkb: ProcXGetDeviceKeyMapping(): use x_rpcbuf_t
Using x_rpcbuf_t for payload assembly and byte swapping.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-11 20:26:14 +02:00
Enrico Weigelt, metux IT consult
566f961fd4 dix: fix int-type mismatches related to dixClientIdForXID()
The client index (in the client table) can never be negative, thus
make it an unsigned short.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-11 13:02:14 +02:00
Enrico Weigelt, metux IT consult
95959758dc Xi: drop including <dix-config.h> from internal headers
All their consumers need to include <dix-config.h> at the very top anyways.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-05 12:58:07 +02:00
Enrico Weigelt, metux IT consult
9b32a62d04 Xi: ProcXIGetProperty(): use x_rpcbuf_t
Use x_rpcbuf_t for reply payload assembly and byte-swap, instead of
writing in little pieces via complicated callbacks.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-04 15:58:07 +02:00
Enrico Weigelt, metux IT consult
232c8d97f8 Xi: simplify ProcXListDeviceProperties() and ProcXIListProperties()
Skip allocation of temporay buffer for the atom IDs, instead walk through
the property list and write the IDs directly into the rpcbuf.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-04 15:58:07 +02:00