Compare commits

..

134 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult c14c7ec016 WIP: clean up forgotten comment 2025-06-26 11:25:45 +02:00
Enrico Weigelt, metux IT consult 48918f28d9 Xext: panoramiX: PanoramiXGetImage() reply payload in one block
Simplify writing reply payload into just one block.
This also makes further simplifications by subsequent patches easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:45 +02:00
Enrico Weigelt, metux IT consult 165eb1be2b dri: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:45 +02:00
Enrico Weigelt, metux IT consult d03d79f96b dri: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:45 +02:00
Enrico Weigelt, metux IT consult 32f6a22dd1 dri: ProcXF86DRIGetDrawableInfo() allocate temporary buffer on stack
No need for going through heap, stack is also fine.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:45 +02:00
Enrico Weigelt, metux IT consult c704eb884a dri: use static struct init on declaration & drop useless assignments
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-26 11:25:45 +02:00
Enrico Weigelt, metux IT consult bbfdb50b5c dbe: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:45 +02:00
Enrico Weigelt, metux IT consult 2a63c0911f dbe: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:45 +02:00
Enrico Weigelt, metux IT consult 0c3d3856cc dbe: ProcDbeGetVisualInfo() collect payload in buffer before writing
The payload lengths is already known, so we can easily collect the data
in a stack buffer and only need one WriteToClient() operation.

This also clears the road for further simplification/unification of the
reply sending code, coming with follow-up commits.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:45 +02:00
Enrico Weigelt, metux IT consult 3f37b07864 dbe: simplify temporary buffer allocation via local stack
Small buffers easily fit on stack, so their allocation can be simplified.
No need to go through heap and have extra free() calls on each return point.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:45 +02:00
Enrico Weigelt, metux IT consult f1c658e581 xkb: use new macros for byte swapping in network buffers
Use the new macros for doing byte-swapping in network buffer structs
which aren't requests or reply structs.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:45 +02:00
Enrico Weigelt, metux IT consult 1425d94daa xkb: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:45 +02:00
Enrico Weigelt, metux IT consult 71cbcb6f02 xkb: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:45 +02:00
Enrico Weigelt, metux IT consult 95301df1a9 dri3: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:45 +02:00
Enrico Weigelt, metux IT consult 9c6271258c dri3: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:45 +02:00
Enrico Weigelt, metux IT consult dc39130899 Xext: panoramiX: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:44 +02:00
Enrico Weigelt, metux IT consult a5f44e4c59 Xext: panoramiX: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:44 +02:00
Enrico Weigelt, metux IT consult 587e00e167 Xext: xvmc: enable swapped requests 2025-06-26 11:25:44 +02:00
Enrico Weigelt, metux IT consult 18331c6d19 Xext: xvmc: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:44 +02:00
Enrico Weigelt, metux IT consult 9ab956a7ef Xext: xvmc: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:44 +02:00
Enrico Weigelt, metux IT consult 67292b02e3 xfixes: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:44 +02:00
Enrico Weigelt, metux IT consult 9b8638da17 xfixes: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:44 +02:00
Enrico Weigelt, metux IT consult c2270f38b3 Xi: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:44 +02:00
Enrico Weigelt, metux IT consult 83a63a64a0 Xi: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:44 +02:00
Enrico Weigelt, metux IT consult adefed6226 composite: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:44 +02:00
Enrico Weigelt, metux IT consult 7baf8767a0 composite: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:44 +02:00
Enrico Weigelt, metux IT consult 8ca929a021 damage: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:44 +02:00
Enrico Weigelt, metux IT consult 52bf89e19f damage: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:44 +02:00
Enrico Weigelt, metux IT consult c729bfd1f9 Xext: xv: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:44 +02:00
Enrico Weigelt, metux IT consult 2892b49d26 Xext: xv: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:44 +02:00
Enrico Weigelt, metux IT consult 757f6ab8bc Xext: xtest: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:44 +02:00
Enrico Weigelt, metux IT consult d929424514 Xext: xtest: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:44 +02:00
Enrico Weigelt, metux IT consult a9f50509bc Xext: selinux: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:44 +02:00
Enrico Weigelt, metux IT consult 105ee0f8ac Xext: selinux: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:44 +02:00
Enrico Weigelt, metux IT consult a45230afac Xext: xres: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:44 +02:00
Enrico Weigelt, metux IT consult 153361bdc9 Xext: xres: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:43 +02:00
Enrico Weigelt, metux IT consult fcb1bac94c Xext: xf86bigfont: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 9cc70cd9ff Xext: xf86bigfont: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult c133b094ef Xext: xcmisc: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 6f360d77bb Xext: xcmisc: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 0bf0da7b90 Xext: vidmode: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 99e8b56421 Xext: vidmode: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 75328e8356 Xext: sync: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 5cded6356d Xext: sync: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 034791c693 Xext: security: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 35e8a37b17 Xext: security: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 03b8cb506f Xext: geext: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult ff1cb0df89 Xext: geext: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 07ce669504 Xext: shm: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult bac5e1fa2d Xext: shm: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult a7f9bcaf39 Xext: bigreq: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult f906f3afc4 Xext: bigreq: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 87c9317714 Xext: shape: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 7c92bf3937 Xext: shape: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 6f6379ff54 Xext: saver: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 0fde105e38 Xext: saver: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 428855b0df Xext: dpms: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 9614b41afb Xext: dpms: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 893f56f6b0 include: dix.h: add macros for request handlers and swapping
add some macros for making request handlers easier:

    * REQUEST_HEAD_STRUCT() declares a struct and checks size (assuming
      length field already had been swapped)
    * REQUEST_FIELD_CARD16() swaps a CARD16 (word) if neccessary
    * REQUEST_FIELD_CARD32() swaps a CARD32 (dword) if neccessary

How to use them:

    1. move swapping of lengths field into the SProc*Dispatch() and drop it
       from the individual SProc*()'s
    2. put REQUEST_HEAD_STRUCT() ontop of each Proc*()
    3. add REQUEST_FIELD_*() below, for all fields to be swapped and
       drop their swapping from the SProc*()'s
    4. clean up unnecessary wrappers (SProc*()'s just be just call the
       corresponding Proc*() by now)
    5. let demux SProc just swap length field and call the normal Proc*Dispatch()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 1d9c412683 Xext: panoramiX: ProcXineramaQueryScreens(): reply payload in one block
Simplify writing reply payload into just one block.
This also makes further simplifications by subsequent patches easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult b619f19c84 Xext: selinux: allocate reply buffer on stack
Simplify reply buffer in SELinuxSendItemsToClient() by putting it on stack.
No need to go through heap and free it later, if the compiler can do all
the work for us.

This also allows further generalizations of reply sending code by upcoming
commits.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 8501dda10d (submit/cleanup-xi) 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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 63f510ebf2 (submit/cleanup-xi) Xi: use stack allocation for temporary buffers
Small buffers easily fit on stack, which is much faster (just moving SP),
and alloca()'ed buffers are cleaned up automatically on function leave,
no extra free() needed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult e7262542d5 (submit/cleanup-xi) 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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult d84af813a2 (submit/cleanup-xi) 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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult d41b209a19 (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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 52542da36c (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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 6da5284195 (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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 8ef462c58a (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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult f8d6a480e4 (submit/cleanup-damageext) damage: minor code formatting cleanups
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 8ca913faa2 (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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult c2760879c2 (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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 6bd069b343 (submit/cleanup-xv-dispatch) Xext: xv: ProcXvListImageFormats(): write reply payload at once.
Collect up the puzzle piezes of the reply payload into to a temporary struct,
so we can send it as one block. This allows for further simplifications by
subsequent commits.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 165e48e286 (submit/cleanup-xv-dispatch) Xext: xv: ProcXvQueryAdaptors(): write reply payload at once.
Collect up the puzzle piezes of the reply payload into to a temporary struct,
so we can send it as one block. This allows for further simplifications by
subsequent commits.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 50813e93c6 (submit/cleanup-xv-dispatch) Xext: xv: ProcDbeGetVisualInfo() collect payload in buffer before writing
The payload lengths is already known, so we can easily collect the data
in a stack buffer and only need one WriteToClient() operation.

This also clears the road for further simplification/unification of the
reply sending code, coming with follow-up commits.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 014954c3f7 (submit/cleanup-xv-dispatch) Xext: xv: ProcXvQueryAdaptors() use local stack buffer
Simplify sending by collecting in a local scoped buffer, so only one
WriteToClient() call is needed. This also makes further simplifications
by upcoming patches easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 10510cd528 (submit/cleanup-xv-dispatch) Xext: xv: simplify reply byte-swap
The way it's currently done, indirectly via macros calling dedicated
functions, is unnecessarily complicated. Simply inline it, just like
(almost) all the other extensions are doing it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 70f77c510a (submit/cleanup-vidmode-dispatch) 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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 0dd817f62c (submit/cleanup-vidmode-dispatch) Xext: vidmode: ProcVidModeGetMonitor(): write reply payload at once.
Collect up the puzzle piezes of the reply payload into to a temporary struct,
so we can send it as one block. This allows for further simplifications by
subsequent commits.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult cfa82b85b0 (submit/cleanup-vidmode-dispatch) 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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult d93b4614f0 (submit/cleanup-vidmode-dispatch) 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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult ac5cdc3680 (submit/cleanup-vidmode-dispatch) 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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 4f39b005a7 (submit/cleanup-vidmode-dispatch) 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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 6c2fcf24a0 (submit/cleanup-vidmode-dispatch) 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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 0baa232235 (submit/cleanup-vidmode-dispatch) 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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 4da568c469 (submit/cleanup-vidmode-dispatch) 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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 29dc21a93e (submit/cleanup-vidmode-dispatch) 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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 9e29d9fe4f (submit/cleanup-xf86bigfont) 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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 5b4485a90d (cleanup/xext-xres) Xext: xres: ProcXResQueryClientIds() collect reply in one stack 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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 6107438647 (cleanup/xext-xres) 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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 041da82154 (cleanup/xext-xres) 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-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 757a729ad1 (cleanup/xext-xres) Xext: xres: sort includes
Bring #include's into some logical order.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:05 +02:00
Enrico Weigelt, metux IT consult 574b486872 (cleanup/xext-xres) Xext: xres: use static initialization
* use static initialization where applicable
* drop unneeded setting of zero values

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:25:04 +02:00
Enrico Weigelt, metux IT consult c6408565b9 (submit/cleanup-xfixes) xfixes: use stack allocation and static init for reply structs
Canonicalize all reply structures 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. Also gaining a little bit efficiency by skipping
some heap allocations.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult b8ce247d5d (submit/cleanup-xfixes) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult c530d6fb63 (submit/cleanup-xfixes) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 0e7c45d8d4 (submit/recv-fds) os: read file descriptors into client struct at once
Instead of having the request handler ask for fd's one by one, just read them
all into a little array in ClientRec struct. And also automatically clean up
after request had been handled.

Request handlers need to set the entries to -1 if they shouldn't be closed
automatically.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 905ac4d3b2 (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 7982f4c719 (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult f0278176f5 (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 875f684552 (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 80b72910b8 (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult a813a00c89 (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 3598a1c57c (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 9c787e8781 (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 23f6e9ef8a (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 76a58eb5fa (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult cbeeccedc0 (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult fbe85a576b (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult e415861cfd (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 55e5eb36ad (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult abf1db322b (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 1f806a6256 (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 0802aecc1f (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 41d6863370 (!1632) xkb: XkbSendMap(): some little variable decl cleanups
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 94b58409ff (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 143faef683 (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 9070f6a543 (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 9a85c8dd21 (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult cffb71b947 (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 0ed09b7093 (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult efc149c763 (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 2557593ab7 (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult c9c5477aab (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 3d4d655f2b (!1632) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 3dd5b15421 (submit/cleanup-composite) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 28316162ef (submit/cleanup-composite) 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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 8b64458aa7 (!1794) randr: use explicit case statement instead of SProcRandrVector table
No need to go indirectly through a vector table, since everything's fixed
anyways. It's not a pretty robust programming style: any changes need great
care, in order to not mix up things.

Replacing this by direct switch/case statement, which is using the defines
from the xrandr protocol headers. Also adding a little bit more protection
against subtle programming errors and reducing cognitive load (source size)
on understanding the code by using a tiny macro for deducing define name and
function name from the request's name.

This approach actually uncovered some subtle bug that had been waiting in
the dark for over 15 years.

As collateral benefit, getting a tiny bit better performance.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 5c68141260 (!1794) randr: use explicit case statement instead of ProcRandrVector table
No need to go indirectly through a vector table, since everything's fixed
anyways. It's not a pretty robust programming style: any changes need great
care, in order to not mix up things.

Replacing this by direct switch/case statement, which is using the defines
from the xrandr protocol headers. Also adding a little bit more protection
against subtle programming errors and reducing cognitive load (source size)
on understanding the code by using a tiny macro for deducing define name and
function name from the request's name.

This approach actually uncovered some subtle bug that had been waiting in
the dark for over 15 years.

As collateral benefit, getting a tiny bit better performance.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 41da339328 (!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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult 73a8b21464 (!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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult e32927e8cf (!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-26 11:21:20 +02:00
Enrico Weigelt, metux IT consult e996fd6a95 (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-26 11:21:19 +02:00
Enrico Weigelt, metux IT consult 254f467939 (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-26 11:21:19 +02:00
624 changed files with 26883 additions and 15947 deletions

View File

@ -1,65 +0,0 @@
name: 🐞 Bug report
description: Create a report to help us improve
labels: [bug, needs-triage]
#type: bug
body:
- type: markdown
attributes:
value: |
Please fill out the sections below to help everyone identify and fix the bug. If you have a general idea or question then please use the [discussions](https://github.com/orgs/X11Libre/discussions).
- type: dropdown
id: affected-version
attributes:
label: Select the version
options:
- 25.0.0.X
- Git master branch
- other or don't know
default: 1
validations:
required: true
- type: textarea
id: description
attributes:
label: Describe your issue
placeholder: When I did X then Y happened.
validations:
required: true
- type: textarea
id: steps
attributes:
label: Steps to reproduce
placeholder: |
1. Start ...
2. Do this
3. Do that
validations:
required: true
- type: textarea
id: expected
attributes:
label: What did you expect?
placeholder: I expected this to happen.
- type: textarea
id: environment
attributes:
label: Additional Information
description: Additional information you want to provide such as logs, system info, environment, screenshots, etc.
placeholder: |
Add any other context about the bug here.
- type: checkboxes
id: checks
attributes:
label: Extra fields
options:
- label: I have checked the existing [issues](https://github.com/X11Libre/xserver/issues)
required: true
- label: I have read the [Contributing Guidelines](https://github.com/X11Libre/xserver/blob/master/CONTRIBUTING.md)
required: true
- label: I'd like to work on this issue
- type: markdown
attributes:
value: |
Thanks for reporting this issue! We will get back to you as soon as possible.

View File

@ -1,49 +0,0 @@
name: ✨ Feature request
description: Suggest a feature for this software
labels: [enhancement, needs-triage]
body:
- type: markdown
attributes:
value: |
Please fill out the sections below to properly describe the new software feature you are suggesting. If you have a general idea or question then please use the [discussions](https://github.com/orgs/X11Libre/discussions).
- type: textarea
id: description
attributes:
label: "Describe the feature"
placeholder: A thing in X that allows to do Y.
validations:
required: true
- type: textarea
id: rationale
attributes:
label: "It should be implemented because"
placeholder: Doing Y is needed for Z.
validations:
required: true
- type: textarea
id: alternative
attributes:
label: "What are the alternatives?"
placeholder: We could do A or B instead.
- type: textarea
id: context
attributes:
label: Additional context
description: Additional information you want to provide such as references to related issues or protocols, the implications on existing use cases, etc.
placeholder: |
Add any other context about the feature request here.
- type: checkboxes
id: checks
attributes:
label: Extra fields
options:
- label: I have checked the existing [issues](https://github.com/X11Libre/xserver/issues)
required: true
- label: I have read the [Contributing Guidelines](https://github.com/X11Libre/xserver/blob/master/CONTRIBUTING.md)
required: true
- label: I'd like to work on this issue
- type: markdown
attributes:
value: |
Thanks for your suggestion! Let's see together if it can be implemented.

View File

@ -1,50 +0,0 @@
name: 🔧 Code cleanup
description: Level up the source code
labels: [code-cleanup, needs-triage]
#type: codecleanup
body:
- type: markdown
attributes:
value: |
Please fill out the sections below to properly describe the code cleanup you are suggesting. If you have a general idea or question then please use the [discussions](https://github.com/orgs/X11Libre/discussions).
- type: textarea
id: description
attributes:
label: "Describe the cleanup"
placeholder: C in X needs to be changed into D.
validations:
required: true
- type: textarea
id: rationale
attributes:
label: "It should be done because"
placeholder: Having D is needed for E.
validations:
required: true
- type: textarea
id: alternative
attributes:
label: "What are the alternatives?"
placeholder: We could do A or B instead.
- type: textarea
id: context
attributes:
label: Additional context
description: Additional information you want to provide such as implications on existing code, how to ensure API/ABI stability, which tests are needed or to be run, related issues, etc.
placeholder: |
Add any other context about the cleanup here.
- type: checkboxes
id: checks
attributes:
label: Extra fields
options:
- label: I have checked the existing [issues](https://github.com/X11Libre/xserver/issues)
required: true
- label: I have read the [Contributing Guidelines](https://github.com/X11Libre/xserver/blob/master/CONTRIBUTING.md)
required: true
- label: I'd like to work on this issue
- type: markdown
attributes:
value: |
Thanks for looking at the source code! Let's see together how it can be improved.

View File

@ -1,39 +0,0 @@
name: 🔖 Documentation update
description: Make your mark for better documentation
labels: [documentation, needs-triage]
#type: docchange
body:
- type: markdown
attributes:
value: |
Please fill out the sections below to help others understand our software. If you have a general idea or question then please use the [discussions](https://github.com/orgs/X11Libre/discussions).
- type: textarea
id: description
attributes:
label: Describe the update
placeholder: These things need to be better documented.
validations:
required: true
- type: textarea
id: environment
attributes:
label: Additional Information
description: Additional information you want to provide such as tickets related to changes in the software, affected files, screenshots, etc.
placeholder: |
Add any other context about the update here.
- type: checkboxes
id: checks
attributes:
label: Extra fields
options:
- label: I have checked the existing [issues](https://github.com/X11Libre/xserver/issues)
required: true
- label: I have read the [Contributing Guidelines](https://github.com/X11Libre/xserver/blob/master/CONTRIBUTING.md)
required: true
- label: I'd like to work on this issue
- type: markdown
attributes:
value: |
Thanks for requesting this update! We will get back to you as soon as possible.

View File

@ -1,44 +0,0 @@
name: ✅ Organizational task
description: Create a task for project organization
labels: [needs-triage, organization]
#type: task
body:
- type: markdown
attributes:
value: |
Please fill out the sections below to get organizational things done. If you have a general idea or question then please use the [discussions](https://github.com/orgs/X11Libre/discussions).
- type: textarea
id: description
attributes:
label: Describe the task
placeholder: These things need to be done.
validations:
required: true
- type: textarea
id: rationale
attributes:
label: "It should be done because"
placeholder: Doing Y is needed for Z.
- type: textarea
id: environment
attributes:
label: Additional Information
description: Additional information you want to provide such as the context for bigger tasks, the implicatons on existing workflows, related issues, etc.
placeholder: |
Add any other context about the task here.
- type: checkboxes
id: checks
attributes:
label: Extra fields
options:
- label: I have checked the existing [issues](https://github.com/X11Libre/xserver/issues)
required: true
- label: I have read the [Contributing Guidelines](https://github.com/X11Libre/xserver/blob/master/CONTRIBUTING.md)
required: true
- label: I'd like to work on this issue
- type: markdown
attributes:
value: |
Thanks for adding this task! We will get back to you as soon as possible.

View File

@ -1,8 +0,0 @@
blank_issues_enabled: false
contact_links:
- name: XLibre Community Support
url: https://github.com/orgs/X11Libre/discussions
about: Please ask and answer questions here.
- name: Mailing List
url: https://www.freelists.org/list/xlibre
about: You can join the discussions on our mailing list.

View File

@ -1,32 +0,0 @@
#!/bin/bash
set -e
. .github/scripts/util.sh
export PKG_CONFIG_PATH="/usr/local/lib/x86_64-linux-gnu/pkgconfig/:$PKG_CONFIG_PATH"
export ACLOCAL_PATH="/usr/share/aclocal:/usr/local/share/aclocal"
export X11L_DRV_GIT=https://github.com/X11Libre/
mkdir -p $DRV_BUILD_DIR
cd $DRV_BUILD_DIR
build_drv_ac xf86-input-elographics $X11L_DRV_GIT/xf86-input-elographics master
build_drv_ac xf86-input-evdev $X11L_DRV_GIT/xf86-input-evdev master
build_drv_ac xf86-input-libinput $X11L_DRV_GIT/xf86-input-libinput master
build_drv_ac xf86-input-mouse $X11L_DRV_GIT/xf86-input-mouse master
build_drv_ac xf86-input-synaptics $X11L_DRV_GIT/xf86-input-synaptics master
build_drv_ac xf86-video-amdgpu $X11L_DRV_GIT/xf86-video-amdgpu xf86-video-amdgpu-23.0.0
build_drv_ac xf86-video-ati $X11L_DRV_GIT/xf86-video-ati xf86-video-ati-22.0.0
build_drv_ac xf86-video-intel $X11L_DRV_GIT/xf86-video-intel.git master
build_drv_ac xf86-video-nouveau $X11L_DRV_GIT/xf86-video-nouveau xf86-video-nouveau-1.0.18
build_drv_ac xf86-video-omap $X11L_DRV_GIT/xf86-video-omap master
build_drv_ac xf86-video-qxl $X11L_DRV_GIT/xf86-video-qxl master
build_drv_ac xf86-video-r128 $X11L_DRV_GIT/xf86-video-r128 master
build_drv_ac xf86-video-vesa $X11L_DRV_GIT/xf86-video-vesa xf86-video-vesa-2.6.0
build_drv_ac xf86-video-vmware $X11L_DRV_GIT/xf86-video-vmware xf86-video-vmware-13.4.0
# doesn't compile on Linux
# build_drv_ac xf86-input-mouse $X11L_DRV_GIT/xf86-input-mouse master
# build_drv_ac xf86-input-keyboard $X11L_DRV_GIT/xf86-input-keyboard master

View File

@ -1,13 +0,0 @@
export X11_OS=`uname -s`
export X11_PREFIX="${X11_PREFIX:-$HOME/x11}"
export X11_BUILD_DIR="${X11_BUILD_DIR:-$HOME/build-deps}"
export DRV_BUILD_DIR="${DRV_BUILD_DIR:-$HOME/build-drivers}"
case "$X11_OS" in
Darwin) export FDO_CI_CONCURRENT=`sysctl -n hw.logicalcpu` ;;
Linux) export FDO_CI_CONCURRENT=`nproc` ;;
esac
export PATH="$X11_PREFIX/bin:$PATH"
export PKG_CONFIG_PATH="$X11_PREFIX/lib/x86_64-linux-gnu/pkgconfig:$X11_PREFIX/lib/pkgconfig:$X11_PREFIX/share/pkgconfig:$PKG_CONFIG_PATH"

View File

@ -1,34 +0,0 @@
#!/bin/bash
set -e
. .github/scripts/util.sh
mkdir -p $X11_BUILD_DIR
cd $X11_BUILD_DIR
build_meson rendercheck https://gitlab.freedesktop.org/xorg/test/rendercheck rendercheck-1.6
if [ "$X11_OS" = "Linux" ]; then
build_meson drm https://gitlab.freedesktop.org/mesa/drm libdrm-2.4.121 \
-Domap=enabled
fi
build_meson libxcvt https://gitlab.freedesktop.org/xorg/lib/libxcvt libxcvt-0.1.0
build_ac xorgproto https://gitlab.freedesktop.org/xorg/proto/xorgproto xorgproto-2024.1
if [ "$X11_OS" = "Linux" ]; then
build_meson wayland https://gitlab.freedesktop.org/wayland/wayland 1.21.0 \
-Dtests=false -Ddocumentation=false -Ddtd_validation=false
build_meson wayland-protocols https://gitlab.freedesktop.org/wayland/wayland-protocols 1.38
build_meson libdecor https://gitlab.freedesktop.org/libdecor/libdecor 0.1.1 \
-D{demo,install_demo}=false
build_meson libei https://gitlab.freedesktop.org/libinput/libei 1.0.0 \
-Dtests=disabled -Ddocumentation=[] -Dliboeffis=enabled
fi
if [ "$X11_OS" = "Darwin" ]; then
build_ac xset https://gitlab.freedesktop.org/xorg/app/xset xset-1.2.5
fi
build_ac_xts xts https://gitlab.freedesktop.org/xorg/test/xts master # dbbfa96c036e596346147081cbceda136e7c86c1
clone_source piglit https://gitlab.freedesktop.org/mesa/piglit main # 265896c86f90cb72e8f218ba6a3617fca8b9a1e3
echo '[xts]' > piglit/piglit.conf
echo "path=$X11_BUILD_DIR/xts" >> piglit/piglit.conf

View File

@ -1,38 +0,0 @@
#!/bin/sh
set -e
brew update
brew install \
autoconf \
automake \
bdftopcf \
libapplewm \
libtool \
libx11 \
libxau \
libxaw \
libxcb \
libxdmcp \
libxext \
libxfixes \
libxfont2 \
libxkbfile \
libxi \
libxmu \
libxrender \
libxt \
libxtst \
meson \
mkfontscale \
pkgconf \
pixman \
util-macros \
xdpyinfo \
xkbcomp \
xkeyboard-config \
xtrans
pip3 install --break-system-packages \
mako

View File

@ -1,95 +0,0 @@
#!/bin/bash
set -e
# Packages which are needed by this script, but not for the xserver build
EPHEMERAL="
libexpat-dev
libgles2-mesa-dev
libxkbcommon-dev
x11-utils
x11-xserver-utils
xauth
xvfb
"
apt-get update
apt-get install -y \
$EPHEMERAL \
autoconf \
automake \
build-essential \
ca-certificates \
libaudit-dev \
libbsd-dev \
libcairo2-dev \
libdbus-1-dev \
libdrm-dev \
libegl1-mesa-dev \
libepoxy-dev \
libevdev2 \
libexpat1 \
libffi-dev \
libgbm-dev \
libgcrypt-dev \
libgl1-mesa-dev \
libgles2 \
libglx-mesa0 \
libinput10 \
libinput-dev \
libnvidia-egl-wayland-dev \
libpciaccess-dev \
libpixman-1-dev \
libselinux1-dev \
libspice-protocol-dev \
libsystemd-dev \
libudev-dev \
libunwind-dev \
libx11-dev \
libx11-xcb-dev \
libxau-dev \
libxaw7-dev \
libxcb-glx0-dev \
libxcb-icccm4-dev \
libxcb-image0-dev \
libxcb-keysyms1-dev \
libxcb-randr0-dev \
libxcb-render-util0-dev \
libxcb-render0-dev \
libxcb-shape0-dev \
libxcb-shm0-dev \
libxcb-util0-dev \
libxcb-xf86dri0-dev \
libxcb-xkb-dev \
libxcb-xv0-dev \
libxcb1-dev \
libxdmcp-dev \
libxext-dev \
libxfixes-dev \
libxfont-dev \
libxi-dev \
libxinerama-dev \
libxkbcommon0 \
libxkbfile-dev \
libxmu-dev \
libxmuu-dev \
libxpm-dev \
libxrender-dev \
libxres-dev \
libxshmfence-dev \
libxt-dev \
libxtst-dev \
libxv-dev \
mesa-common-dev \
meson \
nettle-dev \
libpango1.0-dev \
pkg-config \
x11-xkb-utils \
xfonts-utils \
xkb-data \
xtrans-dev \
xutils-dev \
libxaw7-dev \
python3-mako

View File

@ -1,161 +0,0 @@
#!/bin/bash
apt-mark auto \
7zip \
7zip-rar \
acl \
ant \
apache2 \
apache2-bin \
aria2 \
azure-cli \
brotli \
buildah \
chrony \
cifs-utils \
clang-format-16 \
clang-format-17 \
clang-format-18 \
clang-tidy-16 \
clang-tidy-17 \
clang-tidy-18 \
cloud-init \
dbus \
dotnet-sdk-8.0 \
eatmydata \
efibootmgr \
firefox \
fonts-noto-color-emoji \
gfortran \
gfortran-12 \
gfortran-13 \
gfortran-14 \
google-chrome-stable \
google-cloud-cli \
haveged \
keyutils \
kubectl \
libeatmydata1 \
libgmp-dev \
liblz4-dev \
libmysqlclient-dev \
libpq-dev \
libsqlite3-dev \
libssl-dev \
libtss2-esys-3.0.2-0t64 \
libtss2-mu-4.0.1-0t64 \
libtss2-rc0t64 \
libwrap0 \
libyaml-dev \
lsscsi \
lz4 \
mediainfo \
mercurial \
microsoft-edge-stable \
mysql-client \
mysql-server \
ncurses-base \
ncurses-bin \
ncurses-term \
nginx \
nvme-cli \
packages-microsoft-prod \
php-pear \
php8.3 \
php8.3-amqp \
php8.3-apcu \
php8.3-bcmath \
php8.3-bz2 \
php8.3-cgi \
php8.3-cli \
php8.3-common \
php8.3-curl \
php8.3-dba \
php8.3-dev \
php8.3-enchant \
php8.3-fpm \
php8.3-gd \
php8.3-gmp \
php8.3-igbinary \
php8.3-imagick \
php8.3-imap \
php8.3-interbase \
php8.3-intl \
php8.3-ldap \
php8.3-mbstring \
php8.3-memcache \
php8.3-memcached \
php8.3-mongodb \
php8.3-mysql \
php8.3-odbc \
php8.3-opcache \
php8.3-pcov \
php8.3-pgsql \
php8.3-phpdbg \
php8.3-pspell \
php8.3-readline \
php8.3-redis \
php8.3-snmp \
php8.3-soap \
php8.3-sqlite3 \
php8.3-sybase \
php8.3-tidy \
php8.3-xdebug \
php8.3-xml \
php8.3-xsl \
php8.3-yaml \
php8.3-zip \
php8.3-zmq \
pigz \
podman \
pollinate \
postgresql-16 \
powershell \
python-babel-localedata \
python3-babel \
python3-dev \
python3-jinja2 \
python3-json-pointer \
python3-jsonpatch \
python3-jsonschema \
python3-markupsafe \
python3-parted \
python3-pyrsistent \
python3-serial \
python3-six \
python3-tz \
python3-venv \
rpm \
ruby-full \
session-manager-plugin \
shellcheck \
shim-signed \
skopeo \
snap \
snmp \
software-properties-common \
sphinxsearch \
sqlite3 \
swig \
sysstat \
systemd-coredump \
temurin-11-jdk \
temurin-17-jdk \
temurin-21-jdk \
temurin-8-jdk \
texinfo \
tk \
tree \
tzdata \
ubuntu-server \
ubuntu-standard \
unzip \
upx-ucl \
util-linux \
walinuxagent \
xvfb \
xz-utils \
zip \
zsync
apt-get autoremove -y

View File

@ -1,110 +0,0 @@
. .github/scripts/conf.sh
clone_source() {
local pkgname="$1"
local url="$2"
local ref="$3"
if [ ! -f $pkgname/.git/config ]; then
echo "need to clone $pkgname"
git clone $url $pkgname --branch=$ref --depth 1
else
echo "already cloned $pkgname"
fi
}
build_meson() {
local pkgname="$1"
local url="$2"
local ref="$3"
shift
shift
shift
if [ -f $X11_PREFIX/$pkgname.DONE ]; then
echo "package $pkgname already built"
else
clone_source "$pkgname" "$url" "$ref"
(
cd $pkgname
meson "$@" build -Dprefix=$X11_PREFIX
ninja -j${FDO_CI_CONCURRENT:-4} -C build install
)
touch $X11_PREFIX/$pkgname.DONE
fi
}
build_ac() {
local pkgname="$1"
local url="$2"
local ref="$3"
shift
shift
shift
if [ -f $X11_PREFIX/$pkgname.DONE ]; then
echo "package $pkgname already built"
else
clone_source "$pkgname" "$url" "$ref"
(
cd $pkgname
./autogen.sh --prefix=$X11_PREFIX
make -j${FDO_CI_CONCURRENT:-4} install
)
touch $X11_PREFIX/$pkgname.DONE
fi
}
build_drv_ac() {
local pkgname="$1"
local url="$2"
local ref="$3"
shift
shift
shift
clone_source "$pkgname" "$url" "$ref"
(
cd $pkgname
./autogen.sh # --prefix=$X11_PREFIX
make -j${FDO_CI_CONCURRENT:-4} # install
)
}
build_ac_xts() {
local pkgname="$1"
local url="$2"
local ref="$3"
shift
shift
shift
if [ -f $X11_PREFIX/$pkgname.DONE ]; then
echo "package $pkgname already built"
else
clone_source "$pkgname" "$url" "$ref"
(
cd $pkgname
CFLAGS='-fcommon'
if [ "$X11_OS" = "Darwin" ]; then
# xts5/include/XtTest.h includes <X11/Intrinsic.h> => needs xt
# xts5/src/libXtaw/*.c include <X11/Xaw/*.h> and <X11/Xmu/*.h> => need xmu and xaw7
sed -E -i~ 's|(\[XTS\], \[)|\1xt xmu xaw7 |' configure.ac
# xts5/Xlib14/X{mb,wc}TextListToTextProperty.m define a function accepting `XTextProperty` but call it passing
#`XTextProperty*`; since the parameter is seemingly meant for output, accept it as pointer
sed -E -i~ -e 's|(XTextProperty)[[:space:]]+(text_prop_good)|\1 *\2|' -e 's|(style_good),[[:space:]]*&(text_prop_good)|\1,\2|' -e 's|text_prop_good\.|text_prop_good->|' xts5/Xlib14/X{mb,wc}TextListToTextProperty.m
# xts5/Xlib*/*.m forward-declare `strcpy()` which is incompatible with _FORTIFY_SOURCE > 0 where `strcpy` is
# a macro; set _FORTIFY_SOURCE to 0 as we don't care much about security in this test code
CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0"
# declarations for `XtAppSetError{,Msg}Handler()` in <X11/Intrinsic.h> (libXt) make it hard to write warning-
# free code: they want a noreturn-annotated handler as input but return old handler without noreturn annotation,
# so e.g. `XtAppSetErrorHandler(XtAppSetErrorHandler(NULL))` (similar to xts5/Xt13/XtAppSetError*Handler.m)
# doesn't compile complaining about incompatible function pointers, at least with Apple Clang 16 (not sure why
# it treats this warning as error by default though)
if cc -Werror=unknown-warning-option -Wincompatible-function-pointer-types -c -xc -o /dev/null /dev/null 2>/dev/null; then
CFLAGS="$CFLAGS -Wno-error=incompatible-function-pointer-types"
fi
fi
./autogen.sh --prefix=$X11_PREFIX CFLAGS="$CFLAGS"
make -j${FDO_CI_CONCURRENT:-4} install
)
touch $X11_PREFIX/$pkgname.DONE
fi
}

View File

@ -1,182 +0,0 @@
name: Build X servers
permissions:
contents: read
env:
MESON_BUILDDIR: "build"
X11_PREFIX: /home/runner/x11
X11_BUILD_DIR: /home/runner/build-deps
on:
push:
pull_request:
jobs:
xserver-build-ubuntu:
env:
MESON_ARGS: -Dc_args="-fno-common" -Dprefix=/usr -Dxephyr=true -Dwerror=false -Dxcsecurity=true -Dxorg=true -Dxvfb=true -Dxnest=true
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: prepare build environment
run: |
MACHINE=`gcc -dumpmachine`
echo "MACHINE=$MACHINE" >> "$GITHUB_ENV"
echo "PKG_CONFIG_PATH=$X11_PREFIX/share/pkgconfig:$X11_PREFIX/lib/$MACHINE/pkgconfig:$X11_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH" >> "$GITHUB_ENV"
sudo chown root /bin/tar && sudo chmod u+s /bin/tar
- name: apt cache
uses: actions/cache@v4
with:
path: /var/cache/apt
key: apt-cache-${{ hashFiles('.github/scripts/ubuntu/install-pkg.sh') }}
restore-keys: apt-cache-
- name: pkg install
run: sudo .github/scripts/ubuntu/install-pkg.sh
- name: X11 prereq cache
uses: actions/cache@v4
with:
path: |
${{ env.X11_PREFIX }}
${{ env.X11_BUILD_DIR }}/xts
${{ env.X11_BUILD_DIR }}/piglit
key: ${{ runner.name }}-x11-deps-${{ hashFiles('.github/scripts/install-prereq.sh') }}
restore-keys: ${{ runner.name }}-x11-deps-
- name: generic prereq
run: .github/scripts/install-prereq.sh
- name: build
run: .gitlab-ci/meson-build.sh
- name: tests (may fail)
continue-on-error: true
run: meson test -C "${{ env.MESON_BUILDDIR }}" --print-errorlogs || true
env:
XTEST_DIR: ${{ env.X11_BUILD_DIR }}/xts
PIGLIT_DIR: ${{ env.X11_BUILD_DIR }}/piglit
- name: archive build logs
uses: actions/upload-artifact@v4
with:
name: build-logs
path: |
build/meson-logs/*
- name: ddx build check
run: .gitlab-ci/check-ddx-build.sh
- name: manpage check
run: .gitlab-ci/manpages-check
drivers-build-ubuntu:
env:
MESON_ARGS: -Dc_args="-fno-common" -Dprefix=/usr -Dxephyr=false -Dwerror=false -Dxcsecurity=false -Dxorg=true -Dxvfb=false -Dxnest=false
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: prepare build environment
run: |
MACHINE=`gcc -dumpmachine`
echo "MACHINE=$MACHINE" >> "$GITHUB_ENV"
echo "PKG_CONFIG_PATH=$X11_PREFIX/share/pkgconfig:$X11_PREFIX/lib/$MACHINE/pkgconfig:$X11_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH" >> "$GITHUB_ENV"
sudo chown root /bin/tar && sudo chmod u+s /bin/tar
- name: apt cache
uses: actions/cache@v4
with:
path: /var/cache/apt
key: apt-cache-${{ hashFiles('.github/scripts/ubuntu/install-pkg.sh') }}
restore-keys: apt-cache-
- name: pkg install
run: sudo .github/scripts/ubuntu/install-pkg.sh
- name: X11 prereq cache
uses: actions/cache@v4
with:
path: |
${{ env.X11_PREFIX }}
${{ env.X11_BUILD_DIR }}/xts
${{ env.X11_BUILD_DIR }}/piglit
key: ${{ runner.name }}-x11-deps-${{ hashFiles('.github/scripts/install-prereq.sh') }}
restore-keys: ${{ runner.name }}-x11-deps-
- name: generic prereq
run: .github/scripts/install-prereq.sh
- name: build xserver sdk
run: |
echo -n > .meson_environment
echo "export MESON_BUILDDIR=$MESON_BUILDDIR" >> .meson_environment
echo "export PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> .meson_environment
.gitlab-ci/meson-build.sh --skip-test
sudo meson install --no-rebuild -C "$MESON_BUILDDIR"
sudo mkdir -p /usr/local/lib/$MACHINE/xorg/modules # /home/runner/x11/lib/xorg/modules
sudo chown -R runner /usr/local/lib/$MACHINE/xorg/modules # /home/runner/x11/lib/xorg/modules
- name: compile drivers
run: .github/scripts/compile-drivers.sh
xserver-build-macos:
env:
MESON_ARGS: -Dprefix=/tmp -Dglx=false -Dxnest=false
X11_PREFIX: /Users/runner/x11
X11_BUILD_DIR: /Users/runner/build-deps
runs-on: macos-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: prepare build environment
run: |
echo "PKG_CONFIG_PATH=$X11_PREFIX/share/pkgconfig:$X11_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH" >> "$GITHUB_ENV"
- name: homebrew cache
uses: actions/cache@v4
with:
path: /Users/runner/Library/Caches/Homebrew
key: ${{ runner.os }}-homebrew-cache-${{ hashFiles('.github/scripts/macos/install-pkg.sh') }}
restore-keys: ${{ runner.os }}-homebrew-cache-
- name: pkg install
run: .github/scripts/macos/install-pkg.sh
- name: X11 prereq cache
uses: actions/cache@v4
with:
path: |
${{ env.X11_PREFIX }}
${{ env.X11_BUILD_DIR }}/xts
${{ env.X11_BUILD_DIR }}/piglit
key: ${{ runner.os }}-x11-deps-${{ hashFiles('.github/scripts/install-prereq.sh') }}
restore-keys: ${{ runner.os }}-x11-deps-
- name: generic prereq
run: .github/scripts/install-prereq.sh
- name: build
run: .gitlab-ci/meson-build.sh
- name: tests (may fail)
continue-on-error: true
run: meson test -C "${{ env.MESON_BUILDDIR }}" --print-errorlogs -j1 || true
env:
XTEST_DIR: ${{ env.X11_BUILD_DIR }}/xts
PIGLIT_DIR: ${{ env.X11_BUILD_DIR }}/piglit
- name: archive build logs
uses: actions/upload-artifact@v4
with:
name: build-logs-macos
path: |
build/meson-logs/*
- name: ddx build check
run: .gitlab-ci/check-ddx-build.sh
- name: manpage check
run: .gitlab-ci/manpages-check

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-03-07-libdrm.1'
XORG_DEBIAN_TAG: '2025-02-26-xcb-deps'
XORG_FREEBSD_VERSION: '14.2'
XORG_FREEBSD_EXEC: ''
XORG_FREEBSD_TAG: '2025-05-27-xcb'
XORG_FREEBSD_TAG: '2025-02-18-vm-image'
include:
- project: 'freedesktop/ci-templates'
@ -92,6 +92,9 @@ stages:
.xorg_paths: &xorg_paths
- hw/xfree86/**/*
.xwayland_paths: &xwayland_paths
- hw/xwayland/**/*
.all_ddx_paths:
- hw/**/*
@ -108,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 libxvmc xcb-util xcb-util-wm'
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_IMAGE_SIZE: '30G'
debian-bullseye:
@ -152,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 -Dxv=true -Dxvmc=true
MESON_ARGS: -Dc_args="-fno-common" -Dprefix=/usr -Dxephyr=true -Dwerror=true -Dxcsecurity=true
CCACHE_COMPILERCHECK: content
CCACHE_DIR: /cache/xserver/cache
LC_ALL: C.UTF-8
@ -175,11 +178,12 @@ meson:
PIGLIT_DIR: /root/piglit
LP_NUM_THREADS: 0
MESON_DDX_BUILD_ARGS: >
-Dxorg=${BUILD_XORG} -Dxephyr=${BUILD_XEPHYR} -Dxvfb=${BUILD_XVFB} -Dxnest=${BUILD_XNEST}
-Dxwayland=${BUILD_XWAYLAND} -Dxorg=${BUILD_XORG} -Dxephyr=${BUILD_XEPHYR} -Dxvfb=${BUILD_XVFB} -Dxnest=${BUILD_XNEST}
BUILD_XEPHYR: true
BUILD_XNEST: true
BUILD_XORG: true
BUILD_XVFB: true
BUILD_XWAYLAND: true
MESON_EXTRA_ARGS: ${MESON_DDX_BUILD_ARGS}
meson-noglamor:
@ -187,19 +191,28 @@ meson-noglamor:
variables:
MESON_EXTRA_ARGS: -Dglamor=false ${MESON_DDX_BUILD_ARGS}
xwayland-nolibdecor:
extends: meson
variables:
BUILD_XEPHYR: false
BUILD_XNEST: false
BUILD_XORG: false
BUILD_XVFB: false
MESON_EXTRA_ARGS: -Dlibdecor=false ${MESON_DDX_BUILD_ARGS}
mingw-cross-build:
extends: .common-build-and-test
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 -Dxvmc=true -Dxv=true
MESON_ARGS: --cross-file=.gitlab-ci/cross-i686-w64-mingw32.txt -Dglx=false -Dlisten_tcp=true
freebsd:
stage: build-and-test
extends:
- .xorg-image@freebsd
variables:
MESON_ARGS: -Dglx=false -Dglamor=false -Dudev=false -Dudev_kms=false -Dxvmc=true -Dxv=true
MESON_ARGS: -Dglx=false -Dglamor=false -Dudev=false -Dudev_kms=false
script:
# running of of disk space without this
# needed until https://gitlab.freedesktop.org/freedesktop/ci-templates/-/issues/67 is fixed
@ -208,8 +221,6 @@ 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
@ -243,102 +254,26 @@ 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.11.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-input-joystick
SHA: fa296d27fb479107fa6328a7565f665de2de98d3 # 5 commits ahead of 1.6.4
SHA: xf86-input-evdev-2.10.6
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-input-libinput
SHA: xf86-input-libinput-1.5.0
SHA: xf86-input-libinput-1.4.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.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
SHA: xf86-input-synaptics-1.9.2
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu
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
SHA: xf86-video-amdgpu-23.0.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati
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
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
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-vesa
SHA: 5b33e95acb831768c52d491de079a1adcae762e0 # 10 commits ahead of 2.6.0
SHA: xf86-video-vesa-2.6.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-vmware
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
SHA: xf86-video-vmware-13.4.0
script:
# built xserver is taken from meson-dist job
- export PKG_CONFIG_PATH=$(pwd)/xserver-tarball/install/lib/x86_64-linux-gnu/pkgconfig
@ -361,7 +296,33 @@ xf86-driver-build-test:
variables:
GIT_DEPTH: 1
MESON_ARGS: -Dprefix=/usr/
MESON_EXTRA_ARGS: -Dxnest=false -Dxvfb=false -Dxquartz=false -Ddocs=false
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

@ -19,7 +19,7 @@ fi
[[ "$BUILD_XEPHYR" == true ]] && check_executable "hw/kdrive/ephyr/Xephyr"
[[ "$BUILD_XNEST" == true ]] && check_executable "hw/xnest/Xnest"
[[ "$BUILD_XORG" == true ]] && check_executable "hw/xfree86/Xorg"
[[ "$BUILD_XQUARTZ" == true ]] && check_executable "hw/xquartz/mach-startup/Xquartz"
[[ "$BUILD_XVFB" == true ]] && check_executable "hw/vfb/Xvfb"
[[ "$BUILD_XWAYLAND" == true ]] && check_executable "hw/xwayland/Xwayland"
exit 0

View File

@ -27,3 +27,4 @@ check_piglit_results ()
check_piglit_results xephyr-glamor hw/kdrive/ephyr/Xephyr.p/ephyr_glamor.c.o
check_piglit_results xvfb hw/vfb/Xvfb
check_piglit_results xwayland hw/xwayland/Xwayland

View File

@ -49,6 +49,7 @@ apt-get install -y \
libglx-mesa0 \
libinput10 \
libinput-dev \
libnvidia-egl-wayland-dev \
libpango1.0-0 \
libpango1.0-dev \
libpciaccess-dev \
@ -59,6 +60,7 @@ apt-get install -y \
libtool \
libudev-dev \
libunwind-dev \
libwayland-dev \
libx11-dev \
libx11-xcb-dev \
libxau-dev \
@ -129,8 +131,8 @@ apt-get install -y \
cd /root
# drm 2.4.116 for drmSyncobjEventfd
git clone https://gitlab.freedesktop.org/mesa/drm --depth 1 --branch=libdrm-2.4.121
# Xwayland requires drm 2.4.116 for drmSyncobjEventfd
git clone https://gitlab.freedesktop.org/mesa/drm --depth 1 --branch=libdrm-2.4.116
cd drm
meson _build
ninja -C _build -j${FDO_CI_CONCURRENT:-4} install
@ -145,7 +147,7 @@ ninja -C _build -j${FDO_CI_CONCURRENT:-4} install
cd ..
rm -rf libxcvt
# xserver requires xorgproto >= 2024.1
# xserver requires xorgproto >= 2024.1 for XWAYLAND
git clone https://gitlab.freedesktop.org/xorg/proto/xorgproto.git --depth 1 --branch=xorgproto-2024.1
pushd xorgproto
./autogen.sh
@ -153,6 +155,38 @@ make -j${FDO_CI_CONCURRENT:-4} install
popd
rm -rf xorgproto
# wayland-protocols requires wayland-scanner 1.20, but Debian bullseye has 1.18 only
git clone https://gitlab.freedesktop.org/wayland/wayland.git --depth 1 --branch=1.21.0
cd wayland
meson -Dtests=false -Ddocumentation=false -Ddtd_validation=false _build
ninja -C _build -j${FDO_CI_CONCURRENT:-4} install
cd ..
rm -rf wayland
# Xwayland requires wayland-protocols >= 1.38, but Debian bullseye has 1.20 only
git clone https://gitlab.freedesktop.org/wayland/wayland-protocols.git --depth 1 --branch=1.38
cd wayland-protocols
meson _build
ninja -C _build -j${FDO_CI_CONCURRENT:-4} install
cd ..
rm -rf wayland-protocols
# Install libdecor for Xwayland
git clone https://gitlab.freedesktop.org/libdecor/libdecor.git --depth 1 --branch=0.1.1
cd libdecor
meson _build -D{demo,install_demo}=false
ninja -C _build -j${FDO_CI_CONCURRENT:-4} install
cd ..
rm -rf libdecor
# Install libei for Xwayland
git clone https://gitlab.freedesktop.org/libinput/libei.git --depth 1 --branch=1.0.0
cd libei
meson setup _build -Dtests=disabled -Ddocumentation=[] -Dliboeffis=enabled
ninja -C _build -j${FDO_CI_CONCURRENT:-4} install
cd ..
rm -rf libei
git clone https://gitlab.freedesktop.org/mesa/piglit.git
cd piglit
git checkout 265896c86f90cb72e8f218ba6a3617fca8b9a1e3

View File

@ -1,6 +1,6 @@
#!/bin/sh
find build/ -type f -regex ".*\.[1-9]$" -exec grep -E \
find build/ -regex ".*\.[1-9]$" -exec grep -E \
@vendorversion@\|\
@xorgversion@\|\
@xservername@\|\

View File

@ -1 +0,0 @@
404

View File

@ -1,18 +0,0 @@
# Contribution Guidelines
1. All commits need a sign-off by the author (except for drafts)
If additional reviewers gave their ack, a proper attribution
header may be added.
2. Commit messages should explain what's really done here and their
headlines need a short an precise subject. See history for examples.
Keep in mind that history is also a piece of documentation.
3. Once release is out, bugfixes should be submitted separately, against
the affected release branch(es) as well as master (so multiple pull requests)
4. If new functions or types are introduced, these should be documented
in-code, so we can generate docs directly from the code :)
5. Use pull request tags if you can - if we need some more, just ask.

View File

@ -8,7 +8,6 @@ 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
View File

@ -1 +0,0 @@
-ENOENT

141
README.md
View File

@ -1,128 +1,35 @@
XLibre Xserver
===============
X Server
--------
Xlibre is a fork of the [Xorg Xserver](https://gitlab.freedesktop.org/xorg/xserver)
with lots of code cleanups and enhanced functionality.
The X server accepts requests from client applications to create windows,
which are (normally rectangular) "virtual screens" that the client program
can draw into.
This 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 eliminate competition of their own products.
Classic "embrace, extend, extinguish" tactics.
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.
Right after journalists first 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 heard.
For a comprehensive overview of X Server and X Window System, consult the
following article:
https://en.wikipedia.org/wiki/X_server
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.
All questions regarding this software should be directed at the
Xorg mailing list:
It doesn't matter which country you're coming from, your political 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 a boring average person.
Anybody who's interested in bringing X forward is welcome.
https://lists.freedesktop.org/mailman/listinfo/xorg
Together we'll make X great again!
The primary development code repository can be found at:
Upgrade notice
--------------
https://gitlab.freedesktop.org/xorg/xserver
* Module ABIs have changed - drivers MUST be recompiled against this Xserver
version, otherwise the Xserver can crash or fail to start up correctly.
For patch submission instructions, see:
* If your console is locked up (no input possible, not even VT switch), then
most likely the input driver couldn't be loaded due to a version mismatch.
When unsure, it's best to be prepared to ssh into your machine from another one
or set a timer that's calling `chvt 1` after certain time, so you don't
need a cold reboot.
Or, make sure that you have magic `SysRq` key enabled (`Alt+PrtSc`)
via sysctl (`kernel.sysrq=1`), then press following combination depending on keyboard
layout to make kernel regain control over keyboard to make VT switching work:
- QWERTY/AZERTY keyboard layout: `SysRq + R`
- Dvorak/Colemak keyboard layout: `SysRq + P`
https://www.x.org/wiki/Development/Documentation/SubmittingPatches
* Proprietary Nvidia drivers might break: they still haven't managed to 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. But you can make it work
by adding `Option "IgnoreABI" "1"` line to `ServerFlags` section in Xorg config.
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:
* Most Xorg drivers should run as-is (once recompiled!), with some exceptions.
See `.gitlab-ci.yml` for the versions/branches built along with 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 | Release tag |
| --- | --- | --- |
| xf86-input-elographics: | https://github.com/X11Libre/xf86-input-elographics | xlibre-xf86-input-elographics-1.4.4.1 |
| xf86-input-evdev: | https://github.com/X11Libre/xf86-input-evdev | xlibre-xf86-input-evdev-2.11.0.1 |
| xf86-input-void: | https://github.com/X11Libre/xf86-input-void | xlibre-xf86-input-void-1.4.2.1 |
| xf86-input-joystick: | https://github.com/X11Libre/xf86-input-joystick | xlibre-xf86-input-joystick-1.6.4.1 |
| xf86-input-keyboard: | https://github.com/X11Libre/xf86-input-keyboard | xlibre-xf86-input-keyboard-2.1.0.1 |
| xf86-input-libinput: | https://github.com/X11Libre/xf86-input-libinput | xlibre-xf86-input-libinput-1.5.0.1 |
| xf86-input-mouse: | https://github.com/X11Libre/xf86-input-mouse | xlibre-xf86-input-mouse-1.9.5.1 |
| xf86-input-synaptics: | https://github.com/X11Libre/xf86-input-synaptics | xlibre-xf86-input-synaptics-1.10.0.1 |
| xf86-input-vmmouse: | https://github.com/X11Libre/xf86-input-vmmouse | xlibre-xf86-input-vmmouse-13.2.0.1 |
| xf86-input-wacom: | https://github.com/X11Libre/xf86-input-wacom | xlibre-xf86-input-wacom-1.2.3.1 |
| xf86-video-amdgpu: | https://github.com/X11Libre/xf86-video-amdgpu | xlibre-xf86-video-amdgpu-23.0.0.1 |
| xf86-video-apm: | https://github.com/X11Libre/xf86-video-apm | xlibre-xf86-video-apm-1.3.0.1 |
| xf86-video-ark: | https://github.com/X11Libre/xf86-video-ark | xfree-xf86-video-ark-0.7.6.1 |
| xf86-video-ast: | https://github.com/X11Libre/xf86-video-ast | xlibre-xf86-video-ast-1.2.0 |
| xf86-video-ati: | https://github.com/X11Libre/xf86-video-ati | xfree-xf86-video-ati-22.0.0.1 |
| xf86-video-chips: | https://github.com/X11Libre/xf86-video-chips | xlibre-xf86-video-chips-1.5.0.1 |
| xf86-video-cirrus: | https://github.com/X11Libre/xf86-video-cirrus | xlibre-xf86-video-cirrus-1.6.0.1 |
| xf86-video-dummy: | https://github.com/X11Libre/xf86-video-dummy | xlibre-xf86-video-dummy-0.4.1.1 |
| xf86-video-fbdev: | https://github.com/X11Libre/xf86-video-fbdev | xlibre-xf86-video-fbdev-0.5.1.1 |
| xf86-video-freedreno: | https://github.com/X11Libre/xf86-video-freedreno | xlibre-xf86-video-freedreno-1.4.0.1 |
| xf86-video-geode: | https://github.com/X11Libre/xf86-video-geode | xlibre-xf86-video-geode-2.18.1.1 |
| xf86-video-i128: | https://github.com/X11Libre/xf86-video-i128 | xlibre-xf86-video-i128-1.4.1.1 |
| xf86-video-i740: | https://github.com/X11Libre/xf86-video-i740 | xlibre-xf86-video-i740-1.4.0.1 |
| xf86-video-intel: | https://github.com/X11Libre/xf86-video-intel | xlibre-xf86-video-intel-3.0.0.1 |
| xf86-video-mach64: | https://github.com/X11Libre/xf86-video-mach64 | xlibre-xf86-video-mach64-6.10.0.1 |
| xf86-video-mga: | https://github.com/X11Libre/xf86-video-mga | xlibre-xf86-video-mga-2.1.0.1 |
| xf86-video-neomagic: | https://github.com/X11Libre/xf86-video-neomagic | xlibre-xf86-video-neomagic-1.3.1.1 |
| xf86-video-nested: | https://github.com/X11Libre/xf86-video-nested | xlibre-xf86-video-nested-1.0.0.1 |
| xf86-video-nouveau: | https://github.com/X11Libre/xf86-video-nouveau | xlibre-xf86-video-nouveau-1.0.18.1 |
| xf86-video-nv: | https://github.com/X11Libre/xf86-video-nv | xlibre-xf86-video-nv-2.1.23.1 |
| xf86-video-omap: | https://github.com/X11Libre/xf86-video-omap | xlibre-xf86-video-omap-0.4.5.1 |
| xf86-video-qxl: | https://github.com/X11Libre/xf86-video-qxl | xlibre-xf86-video-qxl-0.1.6.1 |
| xf86-video-r128: | https://github.com/X11Libre/xf86-video-r128 | xlibre-xf86-video-r128-6.13.0.1 |
| xf86-video-rendition: | https://github.com/X11Libre/xf86-video-rendition | xlibre-xf86-video-rendition-4.2.7.1 |
| xf86-video-s3virge: | https://github.com/X11Libre/xf86-video-s3virge | xlibre-xf86-video-s3virge-1.11.1.1 |
| xf86-video-savage: | https://github.com/X11Libre/xf86-video-savage | xlibre-xf86-video-savage-2.4.1.1 |
| xf86-video-siliconmotion: | https://github.com/X11Libre/xf86-video-siliconmotion | xlibre-xf86-video-siliconmotion-1.7.10.1 |
| xf86-video-sis: | https://github.com/X11Libre/xf86-video-sis | xlibre-xf86-video-sis-0.12.0.1 |
| xf86-video-sisusb: | https://github.com/X11Libre/xf86-video-sisusb | xlibre-xf86-video-sisusb-0.9.7.1 |
| xf86-video-suncg14: | https://github.com/X11Libre/xf86-video-suncg14 | xlibre-xf86-video-suncg14-1.2.0 |
| xf86-video-suncg3: | https://github.com/X11Libre/xf86-video-suncg3 | xlibre-xf86-video-suncg3-1.1.3.0 |
| xf86-video-suncg6: | https://github.com/X11Libre/xf86-video-suncg6 | xlibre-xf86-video-suncg6-1.1.3.1 |
| xf86-video-sunffb: | https://github.com/X11Libre/xf86-video-sunffb | xlibre-xf86-video-sunffb-1.2.3.1 |
| xf86-video-sunleo: | https://github.com/X11Libre/xf86-video-sunleo | xlibre-xf86-video-sunleo-1.2.3.1 |
| xf86-video-suntcx: | https://github.com/X11Libre/xf86-video-suntcx | xlibre-xf86-video-suntcx-1.1.3.1 |
| xf86-video-tdfx: | https://github.com/X11Libre/xf86-video-tdfx | xlibre-xf86-video-tdfx-1.5.0.1 |
| xf86-video-trident: | https://github.com/X11Libre/xf86-video-trident | xlibre-xf86-video-trident-1.4.0.1 |
| xf86-video-vbox: | https://github.com/X11Libre/xf86-video-vbox | xlibre-xf86-video-vbox-1.0.1.1 |
| xf86-video-v4l: | https://github.com/X11Libre/xf86-video-v4l | xlibre-xf86-video-v4l-0.3.0.1 |
| xf86-video-vesa: | https://github.com/X11Libre/xf86-video-vesa | xlibre-xf86-video-vesa-2.6.0.1 |
| xf86-video-vmware: | https://github.com/X11Libre/xf86-video-vmware | xlibre-xf86-video-vmware-13.4.0.1 |
| xf86-video-voodoo: | https://github.com/X11Libre/xf86-video-voodoo | xlibre-xf86-video-voodoo-1.2.6.1 |
| xf86-video-wsfb: | https://github.com/X11Libre/xf86-video-wsfb | xlibre-xf86-video-wsfb-0.4.1.1 |
| xf86-video-xgi: | https://github.com/X11Libre/xf86-video-xgi | xlibre-xf86-video-xgi-1.6.1.1 |
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 |
https://www.freedesktop.org/wiki/CodeOfConduct

View File

@ -33,36 +33,31 @@ from The Open Group.
#include <X11/extensions/bigreqsproto.h>
#include "dix/dix_priv.h"
#include "miext/extinit_priv.h"
#include "dix/request_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)
{
REQUEST(xBigReqEnableReq);
xBigReqEnableReply rep;
REQUEST_HEAD_STRUCT(xBigReqEnableReq);
if (stuff->brReqType != X_BigReqEnable)
return BadRequest;
REQUEST_SIZE_MATCH(xBigReqEnableReq);
client->big_requests = TRUE;
rep = (xBigReqEnableReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
xBigReqEnableReply rep = {
.max_request_size = maxBigRequestSize
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.max_request_size);
}
WriteToClient(client, sizeof(xBigReqEnableReply), &rep);
return Success;
REPLY_FIELD_CARD32(max_request_size);
REPLY_SEND_RET_SUCCESS();
}
void

View File

@ -32,7 +32,7 @@ Equipment Corporation.
#include <X11/Xproto.h>
#include <X11/extensions/dpmsproto.h>
#include "miext/extinit_priv.h"
#include "dix/request_priv.h"
#include "os/screensaver.h"
#include "Xext/geext_priv.h"
@ -42,6 +42,7 @@ Equipment Corporation.
#include "extnsionst.h"
#include "opaque.h"
#include "dpmsproc.h"
#include "extinit_priv.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "protocol-versions.h"
@ -124,12 +125,13 @@ SDPMSInfoNotifyEvent(xGenericEvent * from,
static int
ProcDPMSSelectInput(register ClientPtr client)
{
REQUEST(xDPMSSelectInputReq);
REQUEST_HEAD_STRUCT(xDPMSSelectInputReq);
REQUEST_FIELD_CARD32(eventMask);
DPMSEventPtr pEvent, pNewEvent, *pHead;
XID clientResource;
int i;
REQUEST_SIZE_MATCH(xDPMSSelectInputReq);
i = dixLookupResourceByType((void **)&pHead, eventResource, DPMSEventType,
client,
DixWriteAccess);
@ -295,77 +297,56 @@ DPMSSet(ClientPtr client, int level)
static int
ProcDPMSGetVersion(ClientPtr client)
{
/* REQUEST(xDPMSGetVersionReq); */
REQUEST_HEAD_STRUCT(xDPMSGetVersionReq);
REQUEST_FIELD_CARD16(majorVersion);
REQUEST_FIELD_CARD16(minorVersion);
xDPMSGetVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_DPMS_MAJOR_VERSION,
.minorVersion = SERVER_DPMS_MINOR_VERSION
};
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xDPMSGetVersionReply), &rep);
return Success;
REPLY_FIELD_CARD16(majorVersion);
REPLY_FIELD_CARD16(minorVersion);
REPLY_SEND_RET_SUCCESS();
}
static int
ProcDPMSCapable(ClientPtr client)
{
/* REQUEST(xDPMSCapableReq); */
REQUEST_HEAD_STRUCT(xDPMSCapableReq);
xDPMSCapableReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.capable = TRUE
};
REQUEST_SIZE_MATCH(xDPMSCapableReq);
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(xDPMSCapableReply), &rep);
return Success;
REPLY_SEND_RET_SUCCESS();
}
static int
ProcDPMSGetTimeouts(ClientPtr client)
{
/* REQUEST(xDPMSGetTimeoutsReq); */
REQUEST_HEAD_STRUCT(xDPMSGetTimeoutsReq);
xDPMSGetTimeoutsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.standby = DPMSStandbyTime / MILLI_PER_SECOND,
.suspend = DPMSSuspendTime / MILLI_PER_SECOND,
.off = DPMSOffTime / MILLI_PER_SECOND
};
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.standby);
swaps(&rep.suspend);
swaps(&rep.off);
}
WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), &rep);
return Success;
REPLY_FIELD_CARD16(standby);
REPLY_FIELD_CARD16(suspend);
REPLY_FIELD_CARD16(off);
REPLY_SEND_RET_SUCCESS();
}
static int
ProcDPMSSetTimeouts(ClientPtr client)
{
REQUEST(xDPMSSetTimeoutsReq);
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
REQUEST_HEAD_STRUCT(xDPMSSetTimeoutsReq);
REQUEST_FIELD_CARD16(standby);
REQUEST_FIELD_CARD16(suspend);
REQUEST_FIELD_CARD16(off);
if ((stuff->off != 0) && (stuff->off < stuff->suspend)) {
client->errorValue = stuff->off;
@ -387,9 +368,9 @@ ProcDPMSSetTimeouts(ClientPtr client)
static int
ProcDPMSEnable(ClientPtr client)
{
Bool was_enabled = DPMSEnabled;
REQUEST_HEAD_STRUCT(xDPMSEnableReq);
REQUEST_SIZE_MATCH(xDPMSEnableReq);
Bool was_enabled = DPMSEnabled;
DPMSEnabled = TRUE;
if (!was_enabled) {
@ -403,12 +384,10 @@ ProcDPMSEnable(ClientPtr client)
static int
ProcDPMSDisable(ClientPtr client)
{
REQUEST_HEAD_STRUCT(xDPMSDisableReq);
Bool was_enabled = DPMSEnabled;
/* REQUEST(xDPMSDisableReq); */
REQUEST_SIZE_MATCH(xDPMSDisableReq);
DPMSSet(client, DPMSModeOn);
DPMSEnabled = FALSE;
@ -421,9 +400,8 @@ ProcDPMSDisable(ClientPtr client)
static int
ProcDPMSForceLevel(ClientPtr client)
{
REQUEST(xDPMSForceLevelReq);
REQUEST_SIZE_MATCH(xDPMSForceLevelReq);
REQUEST_HEAD_STRUCT(xDPMSForceLevelReq);
REQUEST_FIELD_CARD16(level);
if (!DPMSEnabled)
return BadMatch;
@ -443,23 +421,15 @@ ProcDPMSForceLevel(ClientPtr client)
static int
ProcDPMSInfo(ClientPtr client)
{
/* REQUEST(xDPMSInfoReq); */
REQUEST_HEAD_STRUCT(xDPMSInfoReq);
xDPMSInfoReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.power_level = DPMSPowerLevel,
.state = DPMSEnabled
};
REQUEST_SIZE_MATCH(xDPMSInfoReq);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.power_level);
}
WriteToClient(client, sizeof(xDPMSInfoReply), &rep);
return Success;
REPLY_FIELD_CARD16(power_level);
REPLY_SEND_RET_SUCCESS();
}
static int
@ -491,78 +461,6 @@ ProcDPMSDispatch(ClientPtr client)
}
}
static int _X_COLD
SProcDPMSGetVersion(ClientPtr client)
{
REQUEST(xDPMSGetVersionReq);
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
return ProcDPMSGetVersion(client);
}
static int _X_COLD
SProcDPMSSetTimeouts(ClientPtr client)
{
REQUEST(xDPMSSetTimeoutsReq);
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
swaps(&stuff->standby);
swaps(&stuff->suspend);
swaps(&stuff->off);
return ProcDPMSSetTimeouts(client);
}
static int _X_COLD
SProcDPMSForceLevel(ClientPtr client)
{
REQUEST(xDPMSForceLevelReq);
REQUEST_SIZE_MATCH(xDPMSForceLevelReq);
swaps(&stuff->level);
return ProcDPMSForceLevel(client);
}
static int _X_COLD
SProcDPMSSelectInput(ClientPtr client)
{
REQUEST(xDPMSSelectInputReq);
REQUEST_SIZE_MATCH(xDPMSSelectInputReq);
swapl(&stuff->eventMask);
return ProcDPMSSelectInput(client);
}
static int _X_COLD
SProcDPMSDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_DPMSGetVersion:
return SProcDPMSGetVersion(client);
case X_DPMSCapable:
return ProcDPMSCapable(client);
case X_DPMSGetTimeouts:
return ProcDPMSGetTimeouts(client);
case X_DPMSSetTimeouts:
return SProcDPMSSetTimeouts(client);
case X_DPMSEnable:
return ProcDPMSEnable(client);
case X_DPMSDisable:
return ProcDPMSDisable(client);
case X_DPMSForceLevel:
return SProcDPMSForceLevel(client);
case X_DPMSInfo:
return ProcDPMSInfo(client);
case X_DPMSSelectInput:
return SProcDPMSSelectInput(client);
default:
return BadRequest;
}
}
static void
DPMSCloseDownExtension(ExtensionEntry *e)
{
@ -588,11 +486,11 @@ DPMSExtensionInit(void)
ClientType = CreateNewResourceType(DPMSFreeClient, "DPMSClient");
DPMSEventType = CreateNewResourceType(DPMSFreeEvents, "DPMSEvent");
eventResource = dixAllocServerXID();
eventResource = FakeClientID(0);
if (DPMSEnabled && ClientType && DPMSEventType &&
(extEntry = AddExtension(DPMSExtensionName, 0, 0,
ProcDPMSDispatch, SProcDPMSDispatch,
ProcDPMSDispatch, ProcDPMSDispatch,
DPMSCloseDownExtension, StandardMinorOpcode))) {
DPMSReqCode = extEntry->base;
GERegisterExtension(DPMSReqCode, SDPMSInfoNotifyEvent);

View File

@ -28,11 +28,12 @@
#include <X11/extensions/ge.h>
#include <X11/extensions/geproto.h>
#include "miext/extinit_priv.h"
#include "dix/request_priv.h"
#include "Xext/geext_priv.h"
#include "windowstr.h"
#include "protocol-versions.h"
#include "extinit_priv.h"
#define MAXEXTENSIONS 128
@ -67,20 +68,14 @@ static void SGEGenericEvent(xEvent *from, xEvent *to);
static int
ProcGEQueryVersion(ClientPtr client)
{
REQUEST_HEAD_STRUCT(xGEQueryVersionReq);
REQUEST_FIELD_CARD16(majorVersion);
REQUEST_FIELD_CARD16(minorVersion);
GEClientInfoPtr pGEClient = GEGetClient(client);
xGEQueryVersionReply rep;
REQUEST(xGEQueryVersionReq);
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
rep = (xGEQueryVersionReply) {
.repType = X_Reply,
xGEQueryVersionReply rep = {
.RepType = X_GEQueryVersion,
.sequenceNumber = client->sequence,
.length = 0,
/* return the supported version by the server */
.majorVersion = SERVER_GE_MAJOR_VERSION,
.minorVersion = SERVER_GE_MINOR_VERSION
};
@ -89,28 +84,9 @@ ProcGEQueryVersion(ClientPtr client)
pGEClient->major_version = stuff->majorVersion;
pGEClient->minor_version = stuff->minorVersion;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xGEQueryVersionReply), &rep);
return Success;
}
/************************************************************/
/* swapped request handlers */
/************************************************************/
static int _X_COLD
SProcGEQueryVersion(ClientPtr client)
{
REQUEST(xGEQueryVersionReq);
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
return ProcGEQueryVersion(client);
REPLY_FIELD_CARD16(majorVersion);
REPLY_FIELD_CARD16(minorVersion);
REPLY_SEND_RET_SUCCESS();
}
/************************************************************/
@ -131,21 +107,6 @@ ProcGEDispatch(ClientPtr client)
}
}
/* dispatch swapped requests */
static int _X_COLD
SProcGEDispatch(ClientPtr client)
{
REQUEST(xReq);
swaps(&stuff->length);
switch (stuff->data) {
case X_GEQueryVersion:
return SProcGEQueryVersion(client);
default:
return BadRequest;
}
}
/* Reset extension. Called on server shutdown. */
static void
GEResetProc(ExtensionEntry * extEntry)
@ -186,7 +147,7 @@ GEExtensionInit(void)
(&GEClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(GEClientInfoRec)))
FatalError("GEExtensionInit: GE private request failed.\n");
if (!AddExtension(GE_NAME, 0, GENumberErrors, ProcGEDispatch, SProcGEDispatch,
if (!AddExtension(GE_NAME, 0, GENumberErrors, ProcGEDispatch, ProcGEDispatch,
GEResetProc, StandardMinorOpcode))
FatalError("GEInit: AddExtensions failed.\n");

View File

@ -2,9 +2,7 @@
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*/
#ifndef _XORG_GEEXT_PRIV_H
#define _XORG_GEEXT_PRIV_H
#include <X11/Xproto.h>
@ -16,7 +14,6 @@ typedef void (*XorgGESwapProcPtr) (xGenericEvent *from, xGenericEvent *to);
* @param extension base opcode
* @param event swap handler function
*/
_X_EXPORT /* just for Nvidia legacy */
void GERegisterExtension(int extension, XorgGESwapProcPtr swap_handler);
#endif /* _XORG_GEEXT_PRIV_H */

View File

@ -58,13 +58,13 @@ if build_xv
hdrs_xext += ['xvdix.h', 'xvmcext.h']
endif
libxserver_xext = static_library('xserver_xext',
libxserver_xext = static_library('libxserver_xext',
srcs_xext,
include_directories: inc,
dependencies: common_dep,
)
libxserver_xext_vidmode = static_library('xserver_xext_vidmode',
libxserver_xext_vidmode = static_library('libxserver_xext_vidmode',
'vidmode.c',
include_directories: inc,
dependencies: common_dep,

View File

@ -1,208 +0,0 @@
#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

@ -1,34 +0,0 @@
#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

@ -1,45 +0,0 @@
#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

@ -1,64 +0,0 @@
#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

@ -1,67 +0,0 @@
#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

@ -1,115 +0,0 @@
#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

@ -1,71 +0,0 @@
#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

@ -1,47 +0,0 @@
#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

@ -1,75 +0,0 @@
#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

@ -1,142 +0,0 @@
#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

@ -1,67 +0,0 @@
#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

@ -1,53 +0,0 @@
#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

@ -1,37 +0,0 @@
#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

@ -1,44 +0,0 @@
#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"
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;
}
}

View File

@ -1,41 +0,0 @@
#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

@ -1,22 +0,0 @@
libxserver_namespace = static_library(
'xserver_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

@ -1,92 +0,0 @@
#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

@ -1,82 +0,0 @@
#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

@ -1,18 +0,0 @@
# 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,9 +32,9 @@ Equipment Corporation.
#include <X11/extensions/panoramiXproto.h>
#include "dix/dix_priv.h"
#include "dix/request_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"
@ -56,6 +56,7 @@ Equipment Corporation.
#include "xfixesint.h"
#include "damageextint.h"
#include "compint.h"
#include "extinit_priv.h"
#include "protocol-versions.h"
#ifdef GLXPROXY
@ -457,7 +458,8 @@ PanoramiXExtensionInit(void)
while (panoramiXGeneration != serverGeneration) {
extEntry = AddExtension(PANORAMIX_PROTOCOL_NAME, 0, 0,
ProcPanoramiXDispatch,
SProcPanoramiXDispatch, PanoramiXResetProc,
ProcPanoramiXDispatch,
PanoramiXResetProc,
StandardMinorOpcode);
if (!extEntry)
break;
@ -898,94 +900,70 @@ PanoramiXResetProc(ExtensionEntry * extEntry)
int
ProcPanoramiXQueryVersion(ClientPtr client)
{
/* REQUEST(xPanoramiXQueryVersionReq); */
REQUEST_HEAD_STRUCT(xPanoramiXQueryVersionReq);
xPanoramiXQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_PANORAMIX_MAJOR_VERSION,
.minorVersion = SERVER_PANORAMIX_MINOR_VERSION
};
REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), &rep);
return Success;
REPLY_FIELD_CARD16(majorVersion);
REPLY_FIELD_CARD16(minorVersion);
REPLY_SEND_RET_SUCCESS();
}
int
ProcPanoramiXGetState(ClientPtr client)
{
REQUEST(xPanoramiXGetStateReq);
REQUEST_HEAD_STRUCT(xPanoramiXGetStateReq);
REQUEST_FIELD_CARD32(window);
WindowPtr pWin;
xPanoramiXGetStateReply rep;
int rc;
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
rep = (xPanoramiXGetStateReply) {
.type = X_Reply,
xPanoramiXGetStateReply rep = {
.state = !noPanoramiXExtension,
.sequenceNumber = client->sequence,
.length = 0,
.window = stuff->window
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.window);
}
WriteToClient(client, sizeof(xPanoramiXGetStateReply), &rep);
return Success;
REPLY_FIELD_CARD32(window);
REPLY_SEND_RET_SUCCESS();
}
int
ProcPanoramiXGetScreenCount(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenCountReq);
REQUEST_HEAD_STRUCT(xPanoramiXGetScreenCountReq);
REQUEST_FIELD_CARD32(window);
WindowPtr pWin;
xPanoramiXGetScreenCountReply rep;
int rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
rep = (xPanoramiXGetScreenCountReply) {
.type = X_Reply,
xPanoramiXGetScreenCountReply rep = {
.ScreenCount = PanoramiXNumScreens,
.sequenceNumber = client->sequence,
.length = 0,
.window = stuff->window
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.window);
}
WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), &rep);
return Success;
REPLY_FIELD_CARD32(window);
REPLY_SEND_RET_SUCCESS();
}
int
ProcPanoramiXGetScreenSize(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenSizeReq);
WindowPtr pWin;
xPanoramiXGetScreenSizeReply rep;
int rc;
REQUEST_HEAD_STRUCT(xPanoramiXGetScreenSizeReq);
REQUEST_FIELD_CARD32(window);
REQUEST_FIELD_CARD32(screen);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
WindowPtr pWin;
int rc;
if (stuff->screen >= PanoramiXNumScreens)
return BadMatch;
@ -994,40 +972,27 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
if (rc != Success)
return rc;
rep = (xPanoramiXGetScreenSizeReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
/* screen dimensions */
xPanoramiXGetScreenSizeReply rep = {
/* screen dimensions */
.width = screenInfo.screens[stuff->screen]->width,
.height = screenInfo.screens[stuff->screen]->height,
.window = stuff->window,
.screen = stuff->screen
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.width);
swapl(&rep.height);
swapl(&rep.window);
swapl(&rep.screen);
}
WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), &rep);
return Success;
REPLY_FIELD_CARD32(width);
REPLY_FIELD_CARD32(height);
REPLY_FIELD_CARD32(window);
REPLY_FIELD_CARD32(screen);
REPLY_SEND_RET_SUCCESS();
}
int
ProcXineramaIsActive(ClientPtr client)
{
/* REQUEST(xXineramaIsActiveReq); */
xXineramaIsActiveReply rep;
REQUEST_HEAD_STRUCT(xXineramaIsActiveReq);
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
rep = (xXineramaIsActiveReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
xXineramaIsActiveReply rep = {
#if 1
/* The following hack fools clients into thinking that Xinerama
* is disabled even though it is not. */
@ -1036,56 +1001,38 @@ ProcXineramaIsActive(ClientPtr client)
.state = !noPanoramiXExtension;
#endif
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.state);
}
WriteToClient(client, sizeof(xXineramaIsActiveReply), &rep);
return Success;
REPLY_FIELD_CARD32(state);
REPLY_SEND_RET_SUCCESS();
}
int
ProcXineramaQueryScreens(ClientPtr client)
{
/* REQUEST(xXineramaQueryScreensReq); */
REQUEST_HEAD_STRUCT(xXineramaQueryScreensReq);
CARD32 number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens;
xXineramaQueryScreensReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(number * sz_XineramaScreenInfo),
.number = number
};
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.number);
}
WriteToClient(client, sizeof(xXineramaQueryScreensReply), &rep);
xXineramaScreenInfo scratch[number]; // upper bound limited, number of screens
if (!noPanoramiXExtension) {
xXineramaScreenInfo scratch;
int 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;
scratch.height = screenInfo.screens[i]->height;
if (client->swapped) {
swaps(&scratch.x_org);
swaps(&scratch.y_org);
swaps(&scratch.width);
swaps(&scratch.height);
}
WriteToClient(client, sz_XineramaScreenInfo, &scratch);
scratch[i].x_org = screenInfo.screens[i]->x;
scratch[i].y_org = screenInfo.screens[i]->y;
scratch[i].width = screenInfo.screens[i]->width;
scratch[i].height = screenInfo.screens[i]->height;
CLIENT_STRUCT_CARD16_4(&scratch[i], x_org, y_org, width, height);
}
}
REPLY_FIELD_CARD32(number);
REPLY_SEND_EXTRA(scratch, sizeof(scratch));
return Success;
}

View File

@ -1,97 +0,0 @@
/*****************************************************************
Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.
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
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
#include <dix-config.h>
#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"
#include "extnsionst.h"
#include "dixstruct.h"
#include "gc.h"
#include "gcstruct.h"
#include "scrnintstr.h"
#include "window.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "globals.h"
#include "panoramiXh.h"
static int _X_COLD
SProcPanoramiXGetState(ClientPtr client)
{
REQUEST(xPanoramiXGetStateReq);
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
swapl(&stuff->window);
return ProcPanoramiXGetState(client);
}
static int _X_COLD
SProcPanoramiXGetScreenCount(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenCountReq);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
swapl(&stuff->window);
return ProcPanoramiXGetScreenCount(client);
}
static int _X_COLD
SProcPanoramiXGetScreenSize(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenSizeReq);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
swapl(&stuff->window);
swapl(&stuff->screen);
return ProcPanoramiXGetScreenSize(client);
}
int _X_COLD
SProcPanoramiXDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_PanoramiXQueryVersion:
return ProcPanoramiXQueryVersion(client);
case X_PanoramiXGetState:
return SProcPanoramiXGetState(client);
case X_PanoramiXGetScreenCount:
return SProcPanoramiXGetScreenCount(client);
case X_PanoramiXGetScreenSize:
return SProcPanoramiXGetScreenSize(client);
case X_XineramaIsActive:
return ProcXineramaIsActive(client);
case X_XineramaQueryScreens:
return ProcXineramaQueryScreens(client);
}
return BadRequest;
}

View File

@ -1,10 +1,8 @@
/*
* Server dispatcher function replacements
*/
#ifndef XSERVER_PANORAMIXH_H
#define XSERVER_PANORAMIXH_H
extern int PanoramiXCreateWindow(ClientPtr client);
extern int PanoramiXChangeWindowAttributes(ClientPtr client);
extern int PanoramiXDestroyWindow(ClientPtr client);
@ -67,11 +65,7 @@ PROC_EXTERN(ProcPanoramiXGetScreenSize);
PROC_EXTERN(ProcXineramaQueryScreens);
PROC_EXTERN(ProcXineramaIsActive);
extern int SProcPanoramiXDispatch(ClientPtr client);
extern int connBlockScreenStart;
extern xConnSetupPrefix connSetupPrefix;
extern int (*SavedProcVector[256]) (ClientPtr client);
#endif /* XSERVER_PANORAMIXH_H */

View File

@ -1387,6 +1387,7 @@ PanoramiXPolyPoint(ClientPtr client)
{
PanoramiXRes *gc, *draw;
int result, npoint, j;
xPoint *origPts;
Bool isRoot;
REQUEST(xPolyPointReq);
@ -1409,10 +1410,7 @@ 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) {
xPoint *origPts = calloc(npoint, sizeof(xPoint));
if (!origPts)
return BadAlloc;
origPts = calloc(npoint, sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
FOR_NSCREENS_FORWARD(j) {
@ -1454,6 +1452,7 @@ PanoramiXPolyLine(ClientPtr client)
{
PanoramiXRes *gc, *draw;
int result, npoint, j;
xPoint *origPts;
Bool isRoot;
REQUEST(xPolyLineReq);
@ -1476,9 +1475,7 @@ PanoramiXPolyLine(ClientPtr client)
isRoot = IS_ROOT_DRAWABLE(draw);
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq));
if (npoint > 0) {
xPoint *origPts = calloc(npoint, sizeof(xPoint));
if (!origPts)
return BadAlloc;
origPts = calloc(npoint, sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
FOR_NSCREENS_FORWARD(j) {
@ -1520,6 +1517,7 @@ PanoramiXPolySegment(ClientPtr client)
{
int result, nsegs, i, j;
PanoramiXRes *gc, *draw;
xSegment *origSegs;
Bool isRoot;
REQUEST(xPolySegmentReq);
@ -1546,9 +1544,7 @@ PanoramiXPolySegment(ClientPtr client)
return BadLength;
nsegs >>= 3;
if (nsegs > 0) {
xSegment *origSegs = calloc(nsegs, sizeof(xSegment));
if (!origSegs)
return BadAlloc;
origSegs = calloc(nsegs, sizeof(xSegment));
memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
FOR_NSCREENS_FORWARD(j) {
@ -1590,6 +1586,7 @@ PanoramiXPolyRectangle(ClientPtr client)
int result, nrects, i, j;
PanoramiXRes *gc, *draw;
Bool isRoot;
xRectangle *origRecs;
REQUEST(xPolyRectangleReq);
@ -1615,9 +1612,7 @@ PanoramiXPolyRectangle(ClientPtr client)
return BadLength;
nrects >>= 3;
if (nrects > 0) {
xRectangle *origRecs = calloc(nrects, sizeof(xRectangle));
if (!origRecs)
return BadAlloc;
origRecs = calloc(nrects, sizeof(xRectangle));
memcpy((char *) origRecs, (char *) &stuff[1],
nrects * sizeof(xRectangle));
FOR_NSCREENS_FORWARD(j) {
@ -1658,6 +1653,7 @@ PanoramiXPolyArc(ClientPtr client)
int result, narcs, i, j;
PanoramiXRes *gc, *draw;
Bool isRoot;
xArc *origArcs;
REQUEST(xPolyArcReq);
@ -1683,9 +1679,7 @@ PanoramiXPolyArc(ClientPtr client)
return BadLength;
narcs /= sizeof(xArc);
if (narcs > 0) {
xArc *origArcs = calloc(narcs, sizeof(xArc));
if (!origArcs)
return BadAlloc;
origArcs = calloc(narcs, sizeof(xArc));
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
FOR_NSCREENS_FORWARD(j) {
@ -1724,6 +1718,7 @@ PanoramiXFillPoly(ClientPtr client)
int result, count, j;
PanoramiXRes *gc, *draw;
Bool isRoot;
DDXPointPtr locPts;
REQUEST(xFillPolyReq);
@ -1746,9 +1741,7 @@ PanoramiXFillPoly(ClientPtr client)
count = bytes_to_int32((client->req_len << 2) - sizeof(xFillPolyReq));
if (count > 0) {
DDXPointPtr locPts = calloc(count, sizeof(DDXPointRec));
if (!locPts)
return BadAlloc;
locPts = calloc(count, sizeof(DDXPointRec));
memcpy((char *) locPts, (char *) &stuff[1],
count * sizeof(DDXPointRec));
FOR_NSCREENS_FORWARD(j) {
@ -1791,6 +1784,8 @@ PanoramiXPolyFillRectangle(ClientPtr client)
int result, things, i, j;
PanoramiXRes *gc, *draw;
Bool isRoot;
xRectangle *origRects;
REQUEST(xPolyFillRectangleReq);
REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
@ -1815,9 +1810,7 @@ PanoramiXPolyFillRectangle(ClientPtr client)
return BadLength;
things >>= 3;
if (things > 0) {
xRectangle *origRects = calloc(things, sizeof(xRectangle));
if (!origRects)
return BadAlloc;
origRects = calloc(things, sizeof(xRectangle));
memcpy((char *) origRects, (char *) &stuff[1],
things * sizeof(xRectangle));
FOR_NSCREENS_FORWARD(j) {
@ -1858,6 +1851,7 @@ PanoramiXPolyFillArc(ClientPtr client)
PanoramiXRes *gc, *draw;
Bool isRoot;
int result, narcs, i, j;
xArc *origArcs;
REQUEST(xPolyFillArcReq);
@ -1883,9 +1877,7 @@ PanoramiXPolyFillArc(ClientPtr client)
return BadLength;
narcs /= sizeof(xArc);
if (narcs > 0) {
xArc *origArcs = calloc(narcs, sizeof(xArc));
if (!origArcs)
return BadAlloc;
origArcs = calloc(narcs, sizeof(xArc));
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
FOR_NSCREENS_FORWARD(j) {
@ -1968,7 +1960,6 @@ PanoramiXGetImage(ClientPtr client)
DrawablePtr pDraw;
PanoramiXRes *draw;
Bool isRoot;
char *pBuf;
int i, x, y, w, h, format, rc;
Mask plane = 0, planemask;
int linesDone, nlines, linesPerBuf;
@ -2040,7 +2031,6 @@ PanoramiXGetImage(ClientPtr client)
IncludeInferiors);
}
if (format == ZPixmap) {
widthBytesLine = PixmapBytePad(w, pDraw->depth);
length = widthBytesLine * h;
@ -2054,14 +2044,6 @@ PanoramiXGetImage(ClientPtr client)
}
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;
else if (widthBytesLine >= XINERAMA_IMAGE_BUFSIZE)
@ -2071,15 +2053,9 @@ PanoramiXGetImage(ClientPtr client)
if (linesPerBuf > h)
linesPerBuf = h;
}
if (!(pBuf = calloc(linesPerBuf, widthBytesLine)))
return BadAlloc;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.visual);
}
WriteToClient(client, sizeof(rep), &rep);
char *payload = calloc(1, length);
char *walk = payload;
if (linesPerBuf == 0) {
/* nothing to do */
@ -2089,14 +2065,11 @@ PanoramiXGetImage(ClientPtr client)
while (h - linesDone > 0) {
nlines = min(linesPerBuf, h - linesDone);
if (pDraw->depth == 1)
memset(pBuf, 0, nlines * widthBytesLine);
XineramaGetImageData(drawables, x, y + linesDone, w, nlines,
format, planemask, pBuf, widthBytesLine,
format, planemask, walk, widthBytesLine,
isRoot);
WriteToClient(client, (int) (nlines * widthBytesLine), pBuf);
walk += nlines * widthBytesLine;
linesDone += nlines;
}
}
@ -2107,20 +2080,30 @@ PanoramiXGetImage(ClientPtr client)
while (h - linesDone > 0) {
nlines = min(linesPerBuf, h - linesDone);
memset(pBuf, 0, nlines * widthBytesLine);
XineramaGetImageData(drawables, x, y + linesDone, w,
nlines, format, plane, pBuf,
nlines, format, plane, walk,
widthBytesLine, isRoot);
WriteToClient(client, (int)(nlines * widthBytesLine), pBuf);
walk += nlines * widthBytesLine;
linesDone += nlines;
}
}
}
}
free(pBuf);
xGetImageReply xgi = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.visual = wVisual(((WindowPtr) pDraw)),
.depth = pDraw->depth,
.length = bytes_to_int32(length),
};
WriteReplyToClient(client, sizeof(xGetImageReply), &xgi);
if (length)
WriteToClient(client, length, payload);
return Success;
}

View File

@ -11,18 +11,14 @@ extern int PanoramiXPixWidth;
extern int PanoramiXPixHeight;
extern RegionRec PanoramiXScreenRegion;
// exported for nvidia
_X_EXPORT VisualID PanoramiXTranslateVisualID(int screen, VisualID orig);
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 RESTYPE XRC_DRAWABLE;
extern RESTYPE XRT_WINDOW;
extern RESTYPE XRT_PIXMAP;
extern RESTYPE XRT_GC;

View File

@ -36,8 +36,8 @@ 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/request_priv.h"
#include "dix/window_priv.h"
#include "miext/extinit_priv.h"
#include "os/osdep.h"
#include "os/screensaver.h"
#include "Xext/panoramiX.h"
@ -60,6 +60,7 @@ in this Software without prior written authorization from the X Consortium.
#include "dpmsproc.h"
#endif
#include "protocol-versions.h"
#include "extinit_priv.h"
Bool noScreenSaverExtension = FALSE;
@ -495,11 +496,13 @@ CreateSaverWindow(ScreenPtr pScreen)
mask |= CWBorderPixmap;
}
if (pAttr->pCursor) {
if (!MakeWindowOptional(pWin)) {
FreeResource(pWin->drawable.id, X11_RESTYPE_NONE);
return FALSE;
}
CursorPtr cursor = RefCursor(pAttr->pCursor);
CursorPtr cursor;
if (!pWin->optional)
if (!MakeWindowOptional(pWin)) {
FreeResource(pWin->drawable.id, X11_RESTYPE_NONE);
return FALSE;
}
cursor = RefCursor(pAttr->pCursor);
if (pWin->optional->cursor)
FreeCursor(pWin->optional->cursor, (Cursor) 0);
pWin->optional->cursor = cursor;
@ -589,35 +592,30 @@ ScreenSaverHandle(ScreenPtr pScreen, int xstate, Bool force)
static int
ProcScreenSaverQueryVersion(ClientPtr client)
{
REQUEST_HEAD_STRUCT(xScreenSaverQueryVersionReq);
xScreenSaverQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.majorVersion = SERVER_SAVER_MAJOR_VERSION,
.minorVersion = SERVER_SAVER_MINOR_VERSION
};
REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xScreenSaverQueryVersionReply), &rep);
return Success;
REPLY_FIELD_CARD16(majorVersion);
REPLY_FIELD_CARD16(minorVersion);
REPLY_SEND_RET_SUCCESS();
}
static int
ProcScreenSaverQueryInfo(ClientPtr client)
{
REQUEST(xScreenSaverQueryInfoReq);
REQUEST_HEAD_STRUCT(xScreenSaverQueryInfoReq);
REQUEST_FIELD_CARD32(drawable);
int rc;
ScreenSaverStuffPtr pSaver;
DrawablePtr pDraw;
CARD32 lastInput;
ScreenSaverScreenPrivatePtr pPriv;
REQUEST_SIZE_MATCH(xScreenSaverQueryInfoReq);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixGetAttrAccess);
if (rc != Success)
@ -633,10 +631,11 @@ ProcScreenSaverQueryInfo(ClientPtr client)
lastInput = GetTimeInMillis() - LastEventTime(XIAllDevices).milliseconds;
xScreenSaverQueryInfoReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.window = pSaver->wid
.window = pSaver->wid,
.idle = lastInput,
.eventMask = getEventMask(pDraw->pScreen, client),
};
if (screenIsSaved != SCREEN_SAVER_OFF) {
rep.state = ScreenSaverOn;
if (ScreenSaverTime)
@ -652,33 +651,30 @@ ProcScreenSaverQueryInfo(ClientPtr client)
rep.state = ScreenSaverDisabled;
}
}
rep.idle = lastInput;
rep.eventMask = getEventMask(pDraw->pScreen, client);
if (pPriv && pPriv->attr)
rep.kind = ScreenSaverExternal;
else if (ScreenSaverBlanking != DontPreferBlanking)
rep.kind = ScreenSaverBlanked;
else
rep.kind = ScreenSaverInternal;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.window);
swapl(&rep.tilOrSince);
swapl(&rep.idle);
swapl(&rep.eventMask);
}
WriteToClient(client, sizeof(xScreenSaverQueryInfoReply), &rep);
return Success;
REPLY_FIELD_CARD32(window);
REPLY_FIELD_CARD32(tilOrSince);
REPLY_FIELD_CARD32(idle);
REPLY_FIELD_CARD32(eventMask);
REPLY_SEND_RET_SUCCESS();
}
static int
ProcScreenSaverSelectInput(ClientPtr client)
{
REQUEST(xScreenSaverSelectInputReq);
REQUEST_HEAD_STRUCT(xScreenSaverSelectInputReq);
REQUEST_FIELD_CARD32(drawable);
REQUEST_FIELD_CARD32(eventMask);
DrawablePtr pDraw;
int rc;
REQUEST_SIZE_MATCH(xScreenSaverSelectInputReq);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixGetAttrAccess);
if (rc != Success)
@ -1056,8 +1052,16 @@ ScreenSaverUnsetAttributes(ClientPtr client, Drawable drawable)
static int
ProcScreenSaverSetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
REQUEST_HEAD_AT_LEAST(xScreenSaverSetAttributesReq);
REQUEST_FIELD_CARD32(drawable);
REQUEST_FIELD_CARD16(x);
REQUEST_FIELD_CARD16(y);
REQUEST_FIELD_CARD16(width);
REQUEST_FIELD_CARD16(height);
REQUEST_FIELD_CARD16(borderWidth);
REQUEST_FIELD_CARD32(visualID);
REQUEST_FIELD_CARD32(mask);
REQUEST_REST_CARD32();
#ifdef XINERAMA
if (!noPanoramiXExtension) {
@ -1143,15 +1147,14 @@ ProcScreenSaverSetAttributes(ClientPtr client)
static int
ProcScreenSaverUnsetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverUnsetAttributesReq);
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
REQUEST_HEAD_STRUCT(xScreenSaverUnsetAttributesReq);
REQUEST_FIELD_CARD32(drawable);
#ifdef XINERAMA
if (!noPanoramiXExtension) {
PanoramiXRes *draw;
int rc, i;
rc = dixLookupResourceByClass((void **) &draw, stuff->drawable,
XRC_DRAWABLE, client, DixWriteAccess);
if (rc != Success)
@ -1160,8 +1163,6 @@ ProcScreenSaverUnsetAttributes(ClientPtr client)
for (i = PanoramiXNumScreens - 1; i > 0; i--) {
ScreenSaverUnsetAttributes(client, draw->info[i].id);
}
stuff->drawable = draw->info[0].id;
}
#endif /* XINERAMA */
@ -1171,12 +1172,11 @@ ProcScreenSaverUnsetAttributes(ClientPtr client)
static int
ProcScreenSaverSuspend(ClientPtr client)
{
REQUEST_HEAD_STRUCT(xScreenSaverSuspendReq);
REQUEST_FIELD_CARD32(suspend);
ScreenSaverSuspensionPtr *prev, this;
BOOL suspend;
REQUEST(xScreenSaverSuspendReq);
REQUEST_SIZE_MATCH(xScreenSaverSuspendReq);
/*
* Old versions of XCB encode suspend as 1 byte followed by three
* pad bytes (which are always cleared), instead of a 4 byte
@ -1255,82 +1255,6 @@ ProcScreenSaverDispatch(ClientPtr client)
}
}
static int _X_COLD
SProcScreenSaverQueryInfo(ClientPtr client)
{
REQUEST(xScreenSaverQueryInfoReq);
REQUEST_SIZE_MATCH(xScreenSaverQueryInfoReq);
swapl(&stuff->drawable);
return ProcScreenSaverQueryInfo(client);
}
static int _X_COLD
SProcScreenSaverSelectInput(ClientPtr client)
{
REQUEST(xScreenSaverSelectInputReq);
REQUEST_SIZE_MATCH(xScreenSaverSelectInputReq);
swapl(&stuff->drawable);
swapl(&stuff->eventMask);
return ProcScreenSaverSelectInput(client);
}
static int _X_COLD
SProcScreenSaverSetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
swapl(&stuff->drawable);
swaps(&stuff->x);
swaps(&stuff->y);
swaps(&stuff->width);
swaps(&stuff->height);
swaps(&stuff->borderWidth);
swapl(&stuff->visualID);
swapl(&stuff->mask);
SwapRestL(stuff);
return ProcScreenSaverSetAttributes(client);
}
static int _X_COLD
SProcScreenSaverUnsetAttributes(ClientPtr client)
{
REQUEST(xScreenSaverUnsetAttributesReq);
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
swapl(&stuff->drawable);
return ProcScreenSaverUnsetAttributes(client);
}
static int _X_COLD
SProcScreenSaverSuspend(ClientPtr client)
{
REQUEST(xScreenSaverSuspendReq);
REQUEST_SIZE_MATCH(xScreenSaverSuspendReq);
swapl(&stuff->suspend);
return ProcScreenSaverSuspend(client);
}
static int _X_COLD
SProcScreenSaverDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_ScreenSaverQueryVersion:
return ProcScreenSaverQueryVersion(client);
case X_ScreenSaverQueryInfo:
return SProcScreenSaverQueryInfo(client);
case X_ScreenSaverSelectInput:
return SProcScreenSaverSelectInput(client);
case X_ScreenSaverSetAttributes:
return SProcScreenSaverSetAttributes(client);
case X_ScreenSaverUnsetAttributes:
return SProcScreenSaverUnsetAttributes(client);
case X_ScreenSaverSuspend:
return SProcScreenSaverSuspend(client);
default:
return BadRequest;
}
}
void
ScreenSaverExtensionInit(void)
{
@ -1352,7 +1276,7 @@ ScreenSaverExtensionInit(void)
if (AttrType && SaverEventType && SuspendType &&
(extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0,
ProcScreenSaverDispatch,
SProcScreenSaverDispatch, NULL,
ProcScreenSaverDispatch, NULL,
StandardMinorOpcode))) {
ScreenSaverEventBase = extEntry->eventBase;
EventSwapVector[ScreenSaverEventBase] =

View File

@ -32,8 +32,9 @@ in this Software without prior written authorization from The Open Group.
#include "dix/dix_priv.h"
#include "dix/registry_priv.h"
#include "dix/request_priv.h"
#include "dix/resource_priv.h"
#include "miext/extinit_priv.h"
#include "include/extinit_priv.h"
#include "os/audit.h"
#include "os/auth.h"
#include "os/client_priv.h"
@ -46,6 +47,7 @@ in this Software without prior written authorization from The Open Group.
#include "privates.h"
#include "xacestr.h"
#include "securitysrv.h"
#include "extinit.h"
#include "protocol-versions.h"
Bool noSecurityExtension = FALSE;
@ -347,25 +349,19 @@ SecurityStartAuthorizationTimer(SecurityAuthorizationPtr pAuth)
static int
ProcSecurityQueryVersion(ClientPtr client)
{
/* REQUEST(xSecurityQueryVersionReq); */
REQUEST_HEAD_STRUCT(xSecurityQueryVersionReq);
REQUEST_FIELD_CARD16(majorVersion);
REQUEST_FIELD_CARD16(minorVersion);
xSecurityQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_SECURITY_MAJOR_VERSION,
.minorVersion = SERVER_SECURITY_MINOR_VERSION
};
REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, SIZEOF(xSecurityQueryVersionReply), &rep);
return Success;
} /* ProcSecurityQueryVersion */
REPLY_FIELD_CARD16(majorVersion);
REPLY_FIELD_CARD16(minorVersion);
REPLY_SEND_RET_SUCCESS();
}
static int
SecurityEventSelectForAuthorization(SecurityAuthorizationPtr pAuth,
@ -402,16 +398,32 @@ SecurityEventSelectForAuthorization(SecurityAuthorizationPtr pAuth,
static int
ProcSecurityGenerateAuthorization(ClientPtr client)
{
REQUEST(xSecurityGenerateAuthorizationReq);
REQUEST_HEAD_AT_LEAST(xSecurityGenerateAuthorizationReq);
REQUEST_FIELD_CARD16(nbytesAuthProto);
REQUEST_FIELD_CARD16(nbytesAuthData);
REQUEST_FIELD_CARD32(valueMask);
int values_offset = bytes_to_int32(stuff->nbytesAuthProto) +
bytes_to_int32(stuff->nbytesAuthData);
if (values_offset > stuff->length - bytes_to_int32(sz_xSecurityGenerateAuthorizationReq))
return BadLength;
CARD32 *values = (CARD32 *) (&stuff[1]) + values_offset;
if (client->swapped) {
unsigned long nvalues;
nvalues = (((CARD32 *) stuff) + stuff->length) - values;
SwapLongs(values, nvalues);
}
int len; /* request length in CARD32s */
Bool removeAuth = FALSE; /* if bailout, call RemoveAuthorization? */
int err; /* error to return from this function */
XID authId; /* authorization ID assigned by os layer */
xSecurityGenerateAuthorizationReply rep; /* reply struct */
unsigned int trustLevel; /* trust level of new auth */
XID group; /* group of new auth */
CARD32 timeout; /* timeout of new auth */
CARD32 *values; /* list of supplied attributes */
char *protoname; /* auth proto name sent in request */
char *protodata; /* auth proto data sent in request */
unsigned int authdata_len; /* # bytes of generated auth data */
@ -420,11 +432,8 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
/* check request length */
REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq);
len = bytes_to_int32(SIZEOF(xSecurityGenerateAuthorizationReq));
len += bytes_to_int32(stuff->nbytesAuthProto);
len += bytes_to_int32(stuff->nbytesAuthData);
values = ((CARD32 *) stuff) + len;
len = bytes_to_int32(sizeof(xSecurityGenerateAuthorizationReq))
+ values_offset;
len += Ones(stuff->valueMask);
if (client->req_len != len)
return BadLength;
@ -535,31 +544,22 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
if (pAuth->timeout != 0)
SecurityStartAuthorizationTimer(pAuth);
/* tell client the auth id and data */
rep = (xSecurityGenerateAuthorizationReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(authdata_len),
.authId = authId,
.dataLength = authdata_len
};
if (client->swapped) {
swapl(&rep.length);
swaps(&rep.sequenceNumber);
swapl(&rep.authId);
swaps(&rep.dataLength);
}
WriteToClient(client, SIZEOF(xSecurityGenerateAuthorizationReply), &rep);
WriteToClient(client, authdata_len, pAuthdata);
SecurityAudit
("client %d generated authorization %lu trust %d timeout %lu group %lu events %lu\n",
client->index, (unsigned long)pAuth->id, pAuth->trustLevel, (unsigned long)pAuth->timeout,
(unsigned long)pAuth->group, (unsigned long)eventMask);
/* tell client the auth id and data */
xSecurityGenerateAuthorizationReply rep = {
.authId = authId,
.dataLength = authdata_len
};
REPLY_FIELD_CARD32(authId);
REPLY_FIELD_CARD16(dataLength);
REPLY_SEND_EXTRA(pAuthdata, authdata_len);
/* the request succeeded; don't call RemoveAuthorization or free pAuth */
return Success;
@ -575,12 +575,12 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
static int
ProcSecurityRevokeAuthorization(ClientPtr client)
{
REQUEST(xSecurityRevokeAuthorizationReq);
REQUEST_HEAD_STRUCT(xSecurityRevokeAuthorizationReq);
REQUEST_FIELD_CARD32(authId);
SecurityAuthorizationPtr pAuth;
int rc;
REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
rc = dixLookupResourceByType((void **) &pAuth, stuff->authId,
SecurityAuthorizationResType, client,
DixDestroyAccess);
@ -608,64 +608,6 @@ ProcSecurityDispatch(ClientPtr client)
}
} /* ProcSecurityDispatch */
static int _X_COLD
SProcSecurityQueryVersion(ClientPtr client)
{
REQUEST(xSecurityQueryVersionReq);
REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
return ProcSecurityQueryVersion(client);
} /* SProcSecurityQueryVersion */
static int _X_COLD
SProcSecurityGenerateAuthorization(ClientPtr client)
{
REQUEST(xSecurityGenerateAuthorizationReq);
CARD32 *values;
unsigned long nvalues;
int values_offset;
REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq);
swaps(&stuff->nbytesAuthProto);
swaps(&stuff->nbytesAuthData);
swapl(&stuff->valueMask);
values_offset = bytes_to_int32(stuff->nbytesAuthProto) +
bytes_to_int32(stuff->nbytesAuthData);
if (values_offset >
client->req_len - bytes_to_int32(sz_xSecurityGenerateAuthorizationReq))
return BadLength;
values = (CARD32 *) (&stuff[1]) + values_offset;
nvalues = (((CARD32 *) stuff) + client->req_len) - values;
SwapLongs(values, nvalues);
return ProcSecurityGenerateAuthorization(client);
} /* SProcSecurityGenerateAuthorization */
static int _X_COLD
SProcSecurityRevokeAuthorization(ClientPtr client)
{
REQUEST(xSecurityRevokeAuthorizationReq);
REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
swapl(&stuff->authId);
return ProcSecurityRevokeAuthorization(client);
} /* SProcSecurityRevokeAuthorization */
static int _X_COLD
SProcSecurityDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_SecurityQueryVersion:
return SProcSecurityQueryVersion(client);
case X_SecurityGenerateAuthorization:
return SProcSecurityGenerateAuthorization(client);
case X_SecurityRevokeAuthorization:
return SProcSecurityRevokeAuthorization(client);
default:
return BadRequest;
}
} /* SProcSecurityDispatch */
static void _X_COLD
SwapSecurityAuthorizationRevokedEvent(xSecurityAuthorizationRevokedEvent * from,
xSecurityAuthorizationRevokedEvent * to)
@ -1077,7 +1019,7 @@ SecurityExtensionInit(void)
/* Add extension to server */
extEntry = AddExtension(SECURITY_EXTENSION_NAME,
XSecurityNumberEvents, XSecurityNumberErrors,
ProcSecurityDispatch, SProcSecurityDispatch,
ProcSecurityDispatch, ProcSecurityDispatch,
SecurityResetProc, StandardMinorOpcode);
SecurityErrorBase = extEntry->errorBase;

View File

@ -33,8 +33,7 @@ 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 "dix/request_priv.h"
#include "Xext/panoramiX.h"
#include "Xext/panoramiXsrv.h"
@ -49,6 +48,7 @@ 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;
@ -205,24 +205,16 @@ CreateClipShape(WindowPtr pWin)
static int
ProcShapeQueryVersion(ClientPtr client)
{
REQUEST_HEAD_STRUCT(xShapeQueryVersionReq);
xShapeQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_SHAPE_MAJOR_VERSION,
.minorVersion = SERVER_SHAPE_MINOR_VERSION
};
REQUEST_SIZE_MATCH(xShapeQueryVersionReq);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xShapeQueryVersionReply), &rep);
return Success;
REPLY_FIELD_CARD16(majorVersion);
REPLY_FIELD_CARD16(minorVersion);
REPLY_SEND_RET_SUCCESS();
}
static int
@ -268,9 +260,8 @@ ShapeRectangles(ClientPtr client, xShapeRectanglesReq *stuff)
return BadMatch;
srcRgn = RegionFromRects(nrects, prects, ctype);
if (!MakeWindowOptional(pWin))
return BadAlloc;
if (!pWin->optional)
MakeWindowOptional(pWin);
switch (stuff->destKind) {
case ShapeBounding:
destRgn = &pWin->optional->boundingShape;
@ -293,8 +284,11 @@ ShapeRectangles(ClientPtr client, xShapeRectanglesReq *stuff)
static int
ProcShapeRectangles(ClientPtr client)
{
REQUEST(xShapeRectanglesReq);
REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq);
REQUEST_HEAD_AT_LEAST(xShapeRectanglesReq);
REQUEST_FIELD_CARD32(dest);
REQUEST_FIELD_CARD16(xOff);
REQUEST_FIELD_CARD16(yOff);
REQUEST_REST_CARD16();
#ifdef XINERAMA
if (noPanoramiXExtension)
@ -365,9 +359,8 @@ ShapeMask(ClientPtr client, xShapeMaskReq *stuff)
return BadAlloc;
}
if (!MakeWindowOptional(pWin))
return BadAlloc;
if (!pWin->optional)
MakeWindowOptional(pWin);
switch (stuff->destKind) {
case ShapeBounding:
destRgn = &pWin->optional->boundingShape;
@ -390,8 +383,11 @@ ShapeMask(ClientPtr client, xShapeMaskReq *stuff)
static int
ProcShapeMask(ClientPtr client)
{
REQUEST(xShapeMaskReq);
REQUEST_SIZE_MATCH(xShapeMaskReq);
REQUEST_HEAD_STRUCT(xShapeMaskReq);
REQUEST_FIELD_CARD32(dest);
REQUEST_FIELD_CARD16(xOff);
REQUEST_FIELD_CARD16(yOff);
REQUEST_FIELD_CARD32(src);
#ifdef XINERAMA
if (noPanoramiXExtension)
@ -443,9 +439,8 @@ ShapeCombine(ClientPtr client, xShapeCombineReq *stuff)
rc = dixLookupWindow(&pDestWin, stuff->dest, client, DixSetAttrAccess);
if (rc != Success)
return rc;
if (!MakeWindowOptional(pDestWin))
return BadAlloc;
if (!pDestWin->optional)
MakeWindowOptional(pDestWin);
switch (stuff->destKind) {
case ShapeBounding:
createDefault = CreateBoundingShape;
@ -493,9 +488,8 @@ ShapeCombine(ClientPtr client, xShapeCombineReq *stuff)
else
srcRgn = (*createSrc) (pSrcWin);
if (!MakeWindowOptional(pDestWin))
return BadAlloc;
if (!pDestWin->optional)
MakeWindowOptional(pDestWin);
switch (stuff->destKind) {
case ShapeBounding:
destRgn = &pDestWin->optional->boundingShape;
@ -518,8 +512,11 @@ ShapeCombine(ClientPtr client, xShapeCombineReq *stuff)
static int
ProcShapeCombine(ClientPtr client)
{
REQUEST(xShapeCombineReq);
REQUEST_AT_LEAST_SIZE(xShapeCombineReq);
REQUEST_HEAD_STRUCT(xShapeCombineReq);
REQUEST_FIELD_CARD32(dest);
REQUEST_FIELD_CARD16(xOff);
REQUEST_FIELD_CARD16(yOff);
REQUEST_FIELD_CARD32(src);
#ifdef XINERAMA
if (noPanoramiXExtension)
@ -587,8 +584,10 @@ ShapeOffset(ClientPtr client, xShapeOffsetReq *stuff)
static int
ProcShapeOffset(ClientPtr client)
{
REQUEST(xShapeOffsetReq);
REQUEST_AT_LEAST_SIZE(xShapeOffsetReq);
REQUEST_HEAD_AT_LEAST(xShapeOffsetReq);
REQUEST_FIELD_CARD32(dest);
REQUEST_FIELD_CARD16(yOff);
REQUEST_FIELD_CARD16(yOff);
#ifdef XINERAMA
PanoramiXRes *win;
@ -617,24 +616,23 @@ ProcShapeOffset(ClientPtr client)
static int
ProcShapeQueryExtents(ClientPtr client)
{
REQUEST(xShapeQueryExtentsReq);
REQUEST_HEAD_STRUCT(xShapeQueryExtentsReq);
REQUEST_FIELD_CARD32(window);
WindowPtr pWin;
xShapeQueryExtentsReply rep;
BoxRec extents, *pExtents;
int rc;
RegionPtr region;
REQUEST_SIZE_MATCH(xShapeQueryExtentsReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
rep = (xShapeQueryExtentsReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
xShapeQueryExtentsReply rep = {
.boundingShaped = (wBoundingShape(pWin) != 0),
.clipShaped = (wClipShape(pWin) != 0)
};
if ((region = wBoundingShape(pWin))) {
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
pExtents = RegionExtents(region);
@ -665,20 +663,16 @@ ProcShapeQueryExtents(ClientPtr client)
rep.yClipShape = extents.y1;
rep.widthClipShape = extents.x2 - extents.x1;
rep.heightClipShape = extents.y2 - extents.y1;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.xBoundingShape);
swaps(&rep.yBoundingShape);
swaps(&rep.widthBoundingShape);
swaps(&rep.heightBoundingShape);
swaps(&rep.xClipShape);
swaps(&rep.yClipShape);
swaps(&rep.widthClipShape);
swaps(&rep.heightClipShape);
}
WriteToClient(client, sizeof(xShapeQueryExtentsReply), &rep);
return Success;
REPLY_FIELD_CARD16(xBoundingShape);
REPLY_FIELD_CARD16(yBoundingShape);
REPLY_FIELD_CARD16(widthBoundingShape);
REPLY_FIELD_CARD16(heightBoundingShape);
REPLY_FIELD_CARD16(xClipShape);
REPLY_FIELD_CARD16(yClipShape);
REPLY_FIELD_CARD16(widthClipShape);
REPLY_FIELD_CARD16(heightClipShape);
REPLY_SEND_RET_SUCCESS();
}
/*ARGSUSED*/ static int
@ -726,13 +720,14 @@ ShapeFreeEvents(void *data, XID id)
static int
ProcShapeSelectInput(ClientPtr client)
{
REQUEST(xShapeSelectInputReq);
REQUEST_HEAD_STRUCT(xShapeSelectInputReq);
REQUEST_FIELD_CARD32(window);
WindowPtr pWin;
ShapeEventPtr pShapeEvent, pNewShapeEvent, *pHead;
XID clientResource;
int rc;
REQUEST_SIZE_MATCH(xShapeSelectInputReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
if (rc != Success)
return rc;
@ -897,13 +892,13 @@ SendShapeNotify(WindowPtr pWin, int which)
static int
ProcShapeInputSelected(ClientPtr client)
{
REQUEST(xShapeInputSelectedReq);
REQUEST_HEAD_STRUCT(xShapeInputSelectedReq);
REQUEST_FIELD_CARD32(window);
WindowPtr pWin;
ShapeEventPtr pShapeEvent, *pHead;
int enabled, rc;
xShapeInputSelectedReply rep;
REQUEST_SIZE_MATCH(xShapeInputSelectedReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@ -920,31 +915,25 @@ ProcShapeInputSelected(ClientPtr client)
}
}
}
rep = (xShapeInputSelectedReply) {
.type = X_Reply,
xShapeInputSelectedReply rep = {
.enabled = enabled,
.sequenceNumber = client->sequence,
.length = 0
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xShapeInputSelectedReply), &rep);
return Success;
REPLY_SEND_RET_SUCCESS();
}
static int
ProcShapeGetRectangles(ClientPtr client)
{
REQUEST(xShapeGetRectanglesReq);
REQUEST_HEAD_STRUCT(xShapeGetRectanglesReq);
REQUEST_FIELD_CARD32(window);
WindowPtr pWin;
xShapeGetRectanglesReply rep;
xRectangle *rects = NULL;
int nrects, i, rc;
RegionPtr region;
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@ -1005,21 +994,15 @@ ProcShapeGetRectangles(ClientPtr client)
}
}
}
rep = (xShapeGetRectanglesReply) {
.type = X_Reply,
xShapeGetRectanglesReply rep = {
.ordering = YXBanded,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(nrects * sizeof(xRectangle)),
.nrects = nrects
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.nrects);
SwapShorts((short *) rects, (unsigned long) nrects * 4);
}
WriteToClient(client, sizeof(rep), &rep);
WriteToClient(client, nrects * sizeof(xRectangle), rects);
REPLY_BUF_CARD16(rects, (unsigned long) nrects * 4);
REPLY_FIELD_CARD32(nrects);
REPLY_SEND_EXTRA(rects, nrects * sizeof(xRectangle));
free(rects);
return Success;
}
@ -1067,117 +1050,6 @@ SShapeNotifyEvent(xShapeNotifyEvent * from, xShapeNotifyEvent * to)
to->shaped = from->shaped;
}
static int _X_COLD
SProcShapeRectangles(ClientPtr client)
{
REQUEST(xShapeRectanglesReq);
REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
swaps(&stuff->yOff);
SwapRestS(stuff);
return ProcShapeRectangles(client);
}
static int _X_COLD
SProcShapeMask(ClientPtr client)
{
REQUEST(xShapeMaskReq);
REQUEST_SIZE_MATCH(xShapeMaskReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
swaps(&stuff->yOff);
swapl(&stuff->src);
return ProcShapeMask(client);
}
static int _X_COLD
SProcShapeCombine(ClientPtr client)
{
REQUEST(xShapeCombineReq);
REQUEST_SIZE_MATCH(xShapeCombineReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
swaps(&stuff->yOff);
swapl(&stuff->src);
return ProcShapeCombine(client);
}
static int _X_COLD
SProcShapeOffset(ClientPtr client)
{
REQUEST(xShapeOffsetReq);
REQUEST_SIZE_MATCH(xShapeOffsetReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
swaps(&stuff->yOff);
return ProcShapeOffset(client);
}
static int _X_COLD
SProcShapeQueryExtents(ClientPtr client)
{
REQUEST(xShapeQueryExtentsReq);
REQUEST_SIZE_MATCH(xShapeQueryExtentsReq);
swapl(&stuff->window);
return ProcShapeQueryExtents(client);
}
static int _X_COLD
SProcShapeSelectInput(ClientPtr client)
{
REQUEST(xShapeSelectInputReq);
REQUEST_SIZE_MATCH(xShapeSelectInputReq);
swapl(&stuff->window);
return ProcShapeSelectInput(client);
}
static int _X_COLD
SProcShapeInputSelected(ClientPtr client)
{
REQUEST(xShapeInputSelectedReq);
REQUEST_SIZE_MATCH(xShapeInputSelectedReq);
swapl(&stuff->window);
return ProcShapeInputSelected(client);
}
static int _X_COLD
SProcShapeGetRectangles(ClientPtr client)
{
REQUEST(xShapeGetRectanglesReq);
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
swapl(&stuff->window);
return ProcShapeGetRectangles(client);
}
static int _X_COLD
SProcShapeDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_ShapeQueryVersion:
return ProcShapeQueryVersion(client);
case X_ShapeRectangles:
return SProcShapeRectangles(client);
case X_ShapeMask:
return SProcShapeMask(client);
case X_ShapeCombine:
return SProcShapeCombine(client);
case X_ShapeOffset:
return SProcShapeOffset(client);
case X_ShapeQueryExtents:
return SProcShapeQueryExtents(client);
case X_ShapeSelectInput:
return SProcShapeSelectInput(client);
case X_ShapeInputSelected:
return SProcShapeInputSelected(client);
case X_ShapeGetRectangles:
return SProcShapeGetRectangles(client);
default:
return BadRequest;
}
}
void
ShapeExtensionInit(void)
{
@ -1187,7 +1059,7 @@ ShapeExtensionInit(void)
ShapeEventType = CreateNewResourceType(ShapeFreeEvents, "ShapeEvent");
if (ClientType && ShapeEventType &&
(extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0,
ProcShapeDispatch, SProcShapeDispatch,
ProcShapeDispatch, ProcShapeDispatch,
NULL, StandardMinorOpcode))) {
ShapeEventBase = extEntry->eventBase;
EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent;

View File

@ -43,12 +43,11 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xfuncproto.h>
#include "dix/dix_priv.h"
#include "dix/request_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"
@ -65,6 +64,7 @@ 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 */
@ -155,7 +155,7 @@ static ShmFuncs fbFuncs = { fbShmCreatePixmap, NULL };
} \
}
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
static Bool badSysCall = FALSE;
@ -252,11 +252,10 @@ ShmRegisterFbFuncs(ScreenPtr pScreen)
static int
ProcShmQueryVersion(ClientPtr client)
{
REQUEST_HEAD_STRUCT(xShmQueryVersionReq);
xShmQueryVersionReply rep = {
.type = X_Reply,
.sharedPixmaps = sharedPixmaps,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_SHM_MAJOR_VERSION,
.minorVersion = SERVER_SHM_MINOR_VERSION,
.uid = geteuid(),
@ -264,18 +263,11 @@ ProcShmQueryVersion(ClientPtr client)
.pixmapFormat = sharedPixmaps ? ZPixmap : 0
};
REQUEST_SIZE_MATCH(xShmQueryVersionReq);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
swaps(&rep.uid);
swaps(&rep.gid);
}
WriteToClient(client, sizeof(xShmQueryVersionReply), &rep);
return Success;
REPLY_FIELD_CARD16(majorVersion);
REPLY_FIELD_CARD16(minorVersion);
REPLY_FIELD_CARD16(uid);
REPLY_FIELD_CARD16(gid);
REPLY_SEND_RET_SUCCESS();
}
/*
@ -347,8 +339,9 @@ shm_access(ClientPtr client, SHMPERM_TYPE * perm, int readonly)
static int
ProcShmAttach(ClientPtr client)
{
REQUEST(xShmAttachReq);
REQUEST_SIZE_MATCH(xShmAttachReq);
REQUEST_HEAD_STRUCT(xShmAttachReq);
REQUEST_FIELD_CARD32(shmseg);
REQUEST_FIELD_CARD32(shmid);
if (!client->local)
return BadRequest;
@ -435,8 +428,8 @@ ShmDetachSegment(void *value, /* must conform to DeleteType */
static int
ProcShmDetach(ClientPtr client)
{
REQUEST(xShmDetachReq);
REQUEST_SIZE_MATCH(xShmDetachReq);
REQUEST_HEAD_STRUCT(xShmDetachReq);
REQUEST_FIELD_CARD32(shmseg);
if (!client->local)
return BadRequest;
@ -600,7 +593,6 @@ ShmGetImage(ClientPtr client, xShmGetImageReq *stuff)
DrawablePtr pDraw;
long lenPer = 0, length;
Mask plane = 0;
xShmGetImageReply xgi;
ShmDescPtr shmdesc;
VisualID visual = None;
RegionPtr pVisibleRegion = NULL;
@ -645,13 +637,6 @@ ShmGetImage(ClientPtr client, xShmGetImageReq *stuff)
return BadMatch;
visual = None;
}
xgi = (xShmGetImageReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.visual = visual,
.depth = pDraw->depth
};
if (stuff->format == ZPixmap) {
length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height;
}
@ -663,7 +648,6 @@ ShmGetImage(ClientPtr client, xShmGetImageReq *stuff)
}
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
xgi.size = length;
if (length == 0) {
/* nothing to do */
@ -680,7 +664,6 @@ ShmGetImage(ClientPtr client, xShmGetImageReq *stuff)
stuff->format, shmdesc->addr + stuff->offset);
}
else {
length = stuff->offset;
for (; plane; plane >>= 1) {
if (stuff->planeMask & plane) {
@ -699,22 +682,33 @@ ShmGetImage(ClientPtr client, xShmGetImageReq *stuff)
}
}
if (client->swapped) {
swaps(&xgi.sequenceNumber);
swapl(&xgi.length);
swapl(&xgi.visual);
swapl(&xgi.size);
}
WriteToClient(client, sizeof(xShmGetImageReply), &xgi);
xShmGetImageReply rep = {
.visual = visual,
.depth = pDraw->depth,
.size = length,
};
return Success;
REPLY_FIELD_CARD32(visual);
REPLY_FIELD_CARD32(size);
REPLY_SEND_RET_SUCCESS();
}
static int
ProcShmPutImage(ClientPtr client)
{
REQUEST(xShmPutImageReq);
REQUEST_SIZE_MATCH(xShmPutImageReq);
REQUEST_HEAD_STRUCT(xShmPutImageReq);
REQUEST_FIELD_CARD32(drawable);
REQUEST_FIELD_CARD32(gc);
REQUEST_FIELD_CARD16(totalWidth);
REQUEST_FIELD_CARD16(totalHeight);
REQUEST_FIELD_CARD16(srcX);
REQUEST_FIELD_CARD16(srcY);
REQUEST_FIELD_CARD16(srcWidth);
REQUEST_FIELD_CARD16(srcHeight);
REQUEST_FIELD_CARD16(dstX);
REQUEST_FIELD_CARD16(dstY);
REQUEST_FIELD_CARD32(shmseg);
REQUEST_FIELD_CARD32(offset);
if (!client->local)
return BadRequest;
@ -765,8 +759,15 @@ ProcShmPutImage(ClientPtr client)
static int
ProcShmGetImage(ClientPtr client)
{
REQUEST(xShmGetImageReq);
REQUEST_SIZE_MATCH(xShmGetImageReq);
REQUEST_HEAD_STRUCT(xShmGetImageReq);
REQUEST_FIELD_CARD32(drawable);
REQUEST_FIELD_CARD16(x);
REQUEST_FIELD_CARD16(y);
REQUEST_FIELD_CARD16(width);
REQUEST_FIELD_CARD16(height);
REQUEST_FIELD_CARD32(planeMask);
REQUEST_FIELD_CARD32(shmseg);
REQUEST_FIELD_CARD32(offset);
if (!client->local)
return BadRequest;
@ -774,7 +775,6 @@ ProcShmGetImage(ClientPtr client)
#ifdef XINERAMA
PanoramiXRes *draw;
DrawablePtr pDraw;
xShmGetImageReply xgi;
ShmDescPtr shmdesc;
int i, x, y, w, h, format, rc;
Mask plane = 0, planemask;
@ -866,16 +866,6 @@ ProcShmGetImage(ClientPtr client)
IncludeInferiors);
}
xgi = (xShmGetImageReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.visual = wVisual(((WindowPtr) pDraw)),
.depth = pDraw->depth
};
xgi.size = length;
if (length == 0) { /* nothing to do */
}
else if (format == ZPixmap) {
@ -897,15 +887,15 @@ ProcShmGetImage(ClientPtr client)
}
free(drawables);
if (client->swapped) {
swaps(&xgi.sequenceNumber);
swapl(&xgi.length);
swapl(&xgi.visual);
swapl(&xgi.size);
}
WriteToClient(client, sizeof(xShmGetImageReply), &xgi);
xShmGetImageReply rep = {
.visual = wVisual(((WindowPtr) pDraw)),
.depth = pDraw->depth,
.size = length,
};
return Success;
REPLY_FIELD_CARD32(visual);
REPLY_FIELD_CARD32(size);
REPLY_SEND_RET_SUCCESS();
#else
return ShmGetImage(client, stuff);
#endif /* XINERAMA */
@ -914,8 +904,13 @@ ProcShmGetImage(ClientPtr client)
static int
ProcShmCreatePixmap(ClientPtr client)
{
REQUEST(xShmCreatePixmapReq);
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
REQUEST_HEAD_STRUCT(xShmCreatePixmapReq);
REQUEST_FIELD_CARD32(pid);
REQUEST_FIELD_CARD32(drawable);
REQUEST_FIELD_CARD16(width);
REQUEST_FIELD_CARD16(height);
REQUEST_FIELD_CARD32(shmseg);
REQUEST_FIELD_CARD32(offset);
if (!client->local)
return BadRequest;
@ -1147,8 +1142,8 @@ ShmBusfaultNotify(void *context)
static int
ProcShmAttachFd(ClientPtr client)
{
REQUEST(xShmAttachFdReq);
REQUEST_SIZE_MATCH(xShmAttachFdReq);
REQUEST_HEAD_STRUCT(xShmAttachFdReq);
REQUEST_FIELD_CARD32(shmseg);
if (!client->local)
return BadRequest;
@ -1157,13 +1152,14 @@ ProcShmAttachFd(ClientPtr client)
ShmDescPtr shmdesc;
struct stat statb;
SetReqFds(client, 1);
LEGAL_NEW_RESOURCE(stuff->shmseg, client);
if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse)) {
client->errorValue = stuff->readOnly;
return BadValue;
}
fd = ReadFdFromClient(client);
fd = client->recv_fd_list[0];
client->recv_fd_list[0] = -1;
if (fd < 0)
return BadMatch;
@ -1266,20 +1262,15 @@ shm_tmpfile(void)
static int
ProcShmCreateSegment(ClientPtr client)
{
REQUEST(xShmCreateSegmentReq);
REQUEST_SIZE_MATCH(xShmCreateSegmentReq);
REQUEST_HEAD_STRUCT(xShmCreateSegmentReq);
REQUEST_FIELD_CARD32(shmseg);
REQUEST_FIELD_CARD32(size);
if (!client->local)
return BadRequest;
int fd;
ShmDescPtr shmdesc;
xShmCreateSegmentReply rep = {
.type = X_Reply,
.nfd = 1,
.sequenceNumber = client->sequence,
.length = 0,
};
LEGAL_NEW_RESOURCE(stuff->shmseg, client);
if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse)) {
@ -1335,8 +1326,12 @@ ProcShmCreateSegment(ClientPtr client)
close(fd);
return BadAlloc;
}
WriteToClient(client, sizeof (xShmCreateSegmentReply), &rep);
return Success;
xShmCreateSegmentReply rep = {
.nfd = 1,
};
REPLY_SEND_RET_SUCCESS();
}
#endif /* SHM_FD_PASSING */
@ -1381,126 +1376,6 @@ SShmCompletionEvent(xShmCompletionEvent * from, xShmCompletionEvent * to)
cpswapl(from->offset, to->offset);
}
static int _X_COLD
SProcShmAttach(ClientPtr client)
{
REQUEST(xShmAttachReq);
REQUEST_SIZE_MATCH(xShmAttachReq);
swapl(&stuff->shmseg);
swapl(&stuff->shmid);
return ProcShmAttach(client);
}
static int _X_COLD
SProcShmDetach(ClientPtr client)
{
REQUEST(xShmDetachReq);
REQUEST_SIZE_MATCH(xShmDetachReq);
swapl(&stuff->shmseg);
return ProcShmDetach(client);
}
static int _X_COLD
SProcShmPutImage(ClientPtr client)
{
REQUEST(xShmPutImageReq);
REQUEST_SIZE_MATCH(xShmPutImageReq);
swapl(&stuff->drawable);
swapl(&stuff->gc);
swaps(&stuff->totalWidth);
swaps(&stuff->totalHeight);
swaps(&stuff->srcX);
swaps(&stuff->srcY);
swaps(&stuff->srcWidth);
swaps(&stuff->srcHeight);
swaps(&stuff->dstX);
swaps(&stuff->dstY);
swapl(&stuff->shmseg);
swapl(&stuff->offset);
return ProcShmPutImage(client);
}
static int _X_COLD
SProcShmGetImage(ClientPtr client)
{
REQUEST(xShmGetImageReq);
REQUEST_SIZE_MATCH(xShmGetImageReq);
swapl(&stuff->drawable);
swaps(&stuff->x);
swaps(&stuff->y);
swaps(&stuff->width);
swaps(&stuff->height);
swapl(&stuff->planeMask);
swapl(&stuff->shmseg);
swapl(&stuff->offset);
return ProcShmGetImage(client);
}
static int _X_COLD
SProcShmCreatePixmap(ClientPtr client)
{
REQUEST(xShmCreatePixmapReq);
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
swapl(&stuff->pid);
swapl(&stuff->drawable);
swaps(&stuff->width);
swaps(&stuff->height);
swapl(&stuff->shmseg);
swapl(&stuff->offset);
return ProcShmCreatePixmap(client);
}
#ifdef SHM_FD_PASSING
static int _X_COLD
SProcShmAttachFd(ClientPtr client)
{
REQUEST(xShmAttachFdReq);
SetReqFds(client, 1);
REQUEST_SIZE_MATCH(xShmAttachFdReq);
swapl(&stuff->shmseg);
return ProcShmAttachFd(client);
}
static int _X_COLD
SProcShmCreateSegment(ClientPtr client)
{
REQUEST(xShmCreateSegmentReq);
REQUEST_SIZE_MATCH(xShmCreateSegmentReq);
swapl(&stuff->shmseg);
swapl(&stuff->size);
return ProcShmCreateSegment(client);
}
#endif /* SHM_FD_PASSING */
static int _X_COLD
SProcShmDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_ShmQueryVersion:
return ProcShmQueryVersion(client);
case X_ShmAttach:
return SProcShmAttach(client);
case X_ShmDetach:
return SProcShmDetach(client);
case X_ShmPutImage:
return SProcShmPutImage(client);
case X_ShmGetImage:
return SProcShmGetImage(client);
case X_ShmCreatePixmap:
return SProcShmCreatePixmap(client);
#ifdef SHM_FD_PASSING
case X_ShmAttachFd:
return SProcShmAttachFd(client);
case X_ShmCreateSegment:
return SProcShmCreateSegment(client);
#endif
default:
return BadRequest;
}
}
static void ShmPixmapDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
{
ShmDetachSegment(
@ -1545,7 +1420,7 @@ ShmExtensionInit(void)
ShmSegType = CreateNewResourceType(ShmDetachSegment, "ShmSeg");
if (ShmSegType &&
(extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors,
ProcShmDispatch, SProcShmDispatch,
ProcShmDispatch, ProcShmDispatch,
ShmResetProc, StandardMinorOpcode))) {
ShmReqCode = (unsigned char) extEntry->base;
ShmCompletionCode = extEntry->eventBase;

View File

@ -59,7 +59,7 @@ PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/syncproto.h>
#include "dix/dix_priv.h"
#include "miext/extinit_priv.h"
#include "dix/request_priv.h"
#include "os/bug_priv.h"
#include "os/osdep.h"
@ -79,6 +79,8 @@ PERFORMANCE OF THIS SOFTWARE.
#include <sys/time.h>
#endif
#include "extinit_priv.h"
/*
* Local Global Variables
*/
@ -1025,7 +1027,7 @@ SyncCreateSystemCounter(const char *name,
SyncSystemCounterBracketValues BracketValues
)
{
SyncCounter *pCounter = SyncCreateCounter(NULL, dixAllocServerXID(), initial);
SyncCounter *pCounter = SyncCreateCounter(NULL, FakeClientID(0), initial);
if (pCounter) {
SysCounterInfo *psci = calloc(1, sizeof(SysCounterInfo));
@ -1266,21 +1268,14 @@ FreeAlarmClient(void *value, XID id)
static int
ProcSyncInitialize(ClientPtr client)
{
REQUEST_HEAD_STRUCT(xSyncInitializeReq);
xSyncInitializeReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_SYNC_MAJOR_VERSION,
.minorVersion = SERVER_SYNC_MINOR_VERSION,
};
REQUEST_SIZE_MATCH(xSyncInitializeReq);
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(rep), &rep);
return Success;
REPLY_SEND_RET_SUCCESS();
}
/*
@ -1289,17 +1284,16 @@ ProcSyncInitialize(ClientPtr client)
static int
ProcSyncListSystemCounters(ClientPtr client)
{
REQUEST_HEAD_STRUCT(xSyncListSystemCountersReq);
xSyncListSystemCountersReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.nCounters = 0,
};
SysCounterInfo *psci;
int len = 0;
xSyncSystemCounter *list = NULL, *walklist = NULL;
REQUEST_SIZE_MATCH(xSyncListSystemCountersReq);
xorg_list_for_each_entry(psci, &SysCounterList, entry) {
/* pad to 4 byte boundary */
len += pad_to_int32(sz_xSyncSystemCounter + strlen(psci->name));
@ -1312,13 +1306,7 @@ ProcSyncListSystemCounters(ClientPtr client)
return BadAlloc;
}
rep.length = bytes_to_int32(len);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.nCounters);
}
REPLY_FIELD_CARD32(nCounters);
xorg_list_for_each_entry(psci, &SysCounterList, entry) {
int namelen;
@ -1330,12 +1318,8 @@ ProcSyncListSystemCounters(ClientPtr client)
namelen = strlen(psci->name);
walklist->name_length = namelen;
if (client->swapped) {
swapl(&walklist->counter);
swapl(&walklist->resolution_hi);
swapl(&walklist->resolution_lo);
swaps(&walklist->name_length);
}
CLIENT_STRUCT_CARD16_1(walklist, name_length);
CLIENT_STRUCT_CARD32_3(walklist, counter, resolution_hi, resolution_lo);
pname_in_reply = ((char *) walklist) + sz_xSyncSystemCounter;
strncpy(pname_in_reply, psci->name, namelen);
@ -1344,12 +1328,7 @@ ProcSyncListSystemCounters(ClientPtr client)
namelen));
}
WriteToClient(client, sizeof(rep), &rep);
if (len) {
WriteToClient(client, len, list);
free(list);
}
REPLY_SEND_EXTRA(list, len);
return Success;
}
@ -1360,12 +1339,13 @@ ProcSyncListSystemCounters(ClientPtr client)
static int
ProcSyncSetPriority(ClientPtr client)
{
REQUEST(xSyncSetPriorityReq);
REQUEST_HEAD_STRUCT(xSyncSetPriorityReq);
REQUEST_FIELD_CARD32(id);
REQUEST_FIELD_CARD32(priority);
ClientPtr priorityclient;
int rc;
REQUEST_SIZE_MATCH(xSyncSetPriorityReq);
if (stuff->id == None)
priorityclient = client;
else {
@ -1395,37 +1375,26 @@ ProcSyncSetPriority(ClientPtr client)
static int
ProcSyncGetPriority(ClientPtr client)
{
REQUEST(xSyncGetPriorityReq);
xSyncGetPriorityReply rep;
ClientPtr priorityclient;
int rc;
REQUEST_HEAD_STRUCT(xSyncGetPriorityReq);
REQUEST_FIELD_CARD32(id);
REQUEST_SIZE_MATCH(xSyncGetPriorityReq);
ClientPtr priorityclient;
if (stuff->id == None)
priorityclient = client;
else {
rc = dixLookupResourceOwner(&priorityclient, stuff->id, client,
int rc = dixLookupResourceOwner(&priorityclient, stuff->id, client,
DixGetAttrAccess);
if (rc != Success)
return rc;
}
rep = (xSyncGetPriorityReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
xSyncGetPriorityReply rep = {
.priority = priorityclient->priority
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.priority);
}
WriteToClient(client, sizeof(xSyncGetPriorityReply), &rep);
return Success;
REPLY_FIELD_CARD32(priority);
REPLY_SEND_RET_SUCCESS();
}
/*
@ -1434,10 +1403,12 @@ ProcSyncGetPriority(ClientPtr client)
static int
ProcSyncCreateCounter(ClientPtr client)
{
REQUEST(xSyncCreateCounterReq);
int64_t initial;
REQUEST_HEAD_STRUCT(xSyncCreateCounterReq);
REQUEST_FIELD_CARD32(cid);
REQUEST_FIELD_CARD32(initial_value_lo);
REQUEST_FIELD_CARD32(initial_value_hi);
REQUEST_SIZE_MATCH(xSyncCreateCounterReq);
int64_t initial;
LEGAL_NEW_RESOURCE(stuff->cid, client);
@ -1455,13 +1426,15 @@ ProcSyncCreateCounter(ClientPtr client)
static int
ProcSyncSetCounter(ClientPtr client)
{
REQUEST(xSyncSetCounterReq);
REQUEST_HEAD_STRUCT(xSyncSetCounterReq);
REQUEST_FIELD_CARD32(cid);
REQUEST_FIELD_CARD32(value_lo);
REQUEST_FIELD_CARD32(value_hi);
SyncCounter *pCounter;
int64_t newvalue;
int rc;
REQUEST_SIZE_MATCH(xSyncSetCounterReq);
rc = dixLookupResourceByType((void **) &pCounter, stuff->cid, RTCounter,
client, DixWriteAccess);
if (rc != Success)
@ -1483,14 +1456,16 @@ ProcSyncSetCounter(ClientPtr client)
static int
ProcSyncChangeCounter(ClientPtr client)
{
REQUEST(xSyncChangeCounterReq);
REQUEST_HEAD_STRUCT(xSyncChangeCounterReq);
REQUEST_FIELD_CARD32(cid);
REQUEST_FIELD_CARD32(value_lo);
REQUEST_FIELD_CARD32(value_hi);
SyncCounter *pCounter;
int64_t newvalue;
Bool overflow;
int rc;
REQUEST_SIZE_MATCH(xSyncChangeCounterReq);
rc = dixLookupResourceByType((void **) &pCounter, stuff->cid, RTCounter,
client, DixWriteAccess);
if (rc != Success)
@ -1518,12 +1493,12 @@ ProcSyncChangeCounter(ClientPtr client)
static int
ProcSyncDestroyCounter(ClientPtr client)
{
REQUEST(xSyncDestroyCounterReq);
REQUEST_HEAD_STRUCT(xSyncDestroyCounterReq);
REQUEST_FIELD_CARD32(counter);
SyncCounter *pCounter;
int rc;
REQUEST_SIZE_MATCH(xSyncDestroyCounterReq);
rc = dixLookupResourceByType((void **) &pCounter, stuff->counter,
RTCounter, client, DixDestroyAccess);
if (rc != Success)
@ -1599,7 +1574,9 @@ SyncAwaitEpilogue(ClientPtr client, int items, SyncAwaitUnion * pAwaitUnion)
static int
ProcSyncAwait(ClientPtr client)
{
REQUEST(xSyncAwaitReq);
REQUEST_HEAD_AT_LEAST(xSyncAwaitReq);
REQUEST_REST_CARD32();
int len, items;
int i;
xSyncWaitCondition *pProtocolWaitConds;
@ -1607,8 +1584,6 @@ ProcSyncAwait(ClientPtr client)
SyncAwait *pAwait;
int status;
REQUEST_AT_LEAST_SIZE(xSyncAwaitReq);
len = client->req_len << 2;
len -= sz_xSyncAwaitReq;
items = len / sz_xSyncWaitCondition;
@ -1679,13 +1654,12 @@ ProcSyncAwait(ClientPtr client)
static int
ProcSyncQueryCounter(ClientPtr client)
{
REQUEST(xSyncQueryCounterReq);
xSyncQueryCounterReply rep;
REQUEST_HEAD_STRUCT(xSyncQueryCounterReq);
REQUEST_FIELD_CARD32(counter);
SyncCounter *pCounter;
int rc;
REQUEST_SIZE_MATCH(xSyncQueryCounterReq);
rc = dixLookupResourceByType((void **) &pCounter, stuff->counter,
RTCounter, client, DixReadAccess);
if (rc != Success)
@ -1697,22 +1671,14 @@ ProcSyncQueryCounter(ClientPtr client)
&pCounter->value);
}
rep = (xSyncQueryCounterReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
xSyncQueryCounterReply rep = (xSyncQueryCounterReply) {
.value_hi = pCounter->value >> 32,
.value_lo = pCounter->value
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.value_hi);
swapl(&rep.value_lo);
}
WriteToClient(client, sizeof(xSyncQueryCounterReply), &rep);
return Success;
REPLY_FIELD_CARD32(value_hi);
REPLY_FIELD_CARD32(value_lo);
REPLY_SEND_RET_SUCCESS();
}
/*
@ -1721,14 +1687,16 @@ ProcSyncQueryCounter(ClientPtr client)
static int
ProcSyncCreateAlarm(ClientPtr client)
{
REQUEST(xSyncCreateAlarmReq);
REQUEST_HEAD_AT_LEAST(xSyncCreateAlarmReq);
REQUEST_FIELD_CARD32(id);
REQUEST_FIELD_CARD32(valueMask);
REQUEST_REST_CARD32();
SyncAlarm *pAlarm;
int status;
unsigned long len, vmask;
SyncTrigger *pTrigger;
REQUEST_AT_LEAST_SIZE(xSyncCreateAlarmReq);
LEGAL_NEW_RESOURCE(stuff->id, client);
vmask = stuff->valueMask;
@ -1804,14 +1772,16 @@ ProcSyncCreateAlarm(ClientPtr client)
static int
ProcSyncChangeAlarm(ClientPtr client)
{
REQUEST(xSyncChangeAlarmReq);
REQUEST_HEAD_AT_LEAST(xSyncChangeAlarmReq);
REQUEST_FIELD_CARD32(alarm);
REQUEST_FIELD_CARD32(valueMask);
REQUEST_REST_CARD32();
SyncAlarm *pAlarm;
SyncCounter *pCounter = NULL;
long vmask;
int len, status;
REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq);
status = dixLookupResourceByType((void **) &pAlarm, stuff->alarm, RTAlarm,
client, DixWriteAccess);
if (status != Success)
@ -1845,23 +1815,20 @@ ProcSyncChangeAlarm(ClientPtr client)
static int
ProcSyncQueryAlarm(ClientPtr client)
{
REQUEST(xSyncQueryAlarmReq);
REQUEST_HEAD_STRUCT(xSyncQueryAlarmReq);
REQUEST_FIELD_CARD32(alarm);
SyncAlarm *pAlarm;
xSyncQueryAlarmReply rep;
SyncTrigger *pTrigger;
int rc;
REQUEST_SIZE_MATCH(xSyncQueryAlarmReq);
rc = dixLookupResourceByType((void **) &pAlarm, stuff->alarm, RTAlarm,
client, DixReadAccess);
if (rc != Success)
return rc;
pTrigger = &pAlarm->trigger;
rep = (xSyncQueryAlarmReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
xSyncQueryAlarmReply rep = {
.length =
bytes_to_int32(sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply)),
.counter = (pTrigger->pSync) ? pTrigger->pSync->id : None,
@ -1886,31 +1853,24 @@ ProcSyncQueryAlarm(ClientPtr client)
.state = pAlarm->state
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.counter);
swapl(&rep.wait_value_hi);
swapl(&rep.wait_value_lo);
swapl(&rep.test_type);
swapl(&rep.delta_hi);
swapl(&rep.delta_lo);
}
WriteToClient(client, sizeof(xSyncQueryAlarmReply), &rep);
return Success;
REPLY_FIELD_CARD32(counter);
REPLY_FIELD_CARD32(wait_value_hi);
REPLY_FIELD_CARD32(wait_value_lo);
REPLY_FIELD_CARD32(test_type);
REPLY_FIELD_CARD32(delta_hi);
REPLY_FIELD_CARD32(delta_lo);
REPLY_SEND_RET_SUCCESS();
}
static int
ProcSyncDestroyAlarm(ClientPtr client)
{
REQUEST_HEAD_STRUCT(xSyncDestroyAlarmReq);
REQUEST_FIELD_CARD32(alarm);
SyncAlarm *pAlarm;
int rc;
REQUEST(xSyncDestroyAlarmReq);
REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq);
rc = dixLookupResourceByType((void **) &pAlarm, stuff->alarm, RTAlarm,
client, DixDestroyAccess);
if (rc != Success)
@ -1923,13 +1883,14 @@ ProcSyncDestroyAlarm(ClientPtr client)
static int
ProcSyncCreateFence(ClientPtr client)
{
REQUEST(xSyncCreateFenceReq);
REQUEST_HEAD_STRUCT(xSyncCreateFenceReq);
REQUEST_FIELD_CARD32(d);
REQUEST_FIELD_CARD32(fid);
DrawablePtr pDraw;
SyncFence *pFence;
int rc;
REQUEST_SIZE_MATCH(xSyncCreateFenceReq);
rc = dixLookupDrawable(&pDraw, stuff->d, client, M_ANY, DixGetAttrAccess);
if (rc != Success)
return rc;
@ -1969,12 +1930,12 @@ SyncVerifyFence(SyncFence ** ppSyncFence, XID fid, ClientPtr client, Mask mode)
static int
ProcSyncTriggerFence(ClientPtr client)
{
REQUEST(xSyncTriggerFenceReq);
REQUEST_HEAD_STRUCT(xSyncTriggerFenceReq);
REQUEST_FIELD_CARD32(fid);
SyncFence *pFence;
int rc;
REQUEST_SIZE_MATCH(xSyncTriggerFenceReq);
rc = dixLookupResourceByType((void **) &pFence, stuff->fid, RTFence,
client, DixWriteAccess);
if (rc != Success)
@ -1988,12 +1949,12 @@ ProcSyncTriggerFence(ClientPtr client)
static int
ProcSyncResetFence(ClientPtr client)
{
REQUEST(xSyncResetFenceReq);
REQUEST_HEAD_STRUCT(xSyncResetFenceReq);
REQUEST_FIELD_CARD32(fid);
SyncFence *pFence;
int rc;
REQUEST_SIZE_MATCH(xSyncResetFenceReq);
rc = dixLookupResourceByType((void **) &pFence, stuff->fid, RTFence,
client, DixWriteAccess);
if (rc != Success)
@ -2010,12 +1971,12 @@ ProcSyncResetFence(ClientPtr client)
static int
ProcSyncDestroyFence(ClientPtr client)
{
REQUEST(xSyncDestroyFenceReq);
REQUEST_HEAD_STRUCT(xSyncDestroyFenceReq);
REQUEST_FIELD_CARD32(fid);
SyncFence *pFence;
int rc;
REQUEST_SIZE_MATCH(xSyncDestroyFenceReq);
rc = dixLookupResourceByType((void **) &pFence, stuff->fid, RTFence,
client, DixDestroyAccess);
if (rc != Success)
@ -2028,39 +1989,30 @@ ProcSyncDestroyFence(ClientPtr client)
static int
ProcSyncQueryFence(ClientPtr client)
{
REQUEST(xSyncQueryFenceReq);
xSyncQueryFenceReply rep;
REQUEST_HEAD_STRUCT(xSyncQueryFenceReq);
REQUEST_FIELD_CARD32(fid);
SyncFence *pFence;
int rc;
REQUEST_SIZE_MATCH(xSyncQueryFenceReq);
rc = dixLookupResourceByType((void **) &pFence, stuff->fid,
RTFence, client, DixReadAccess);
if (rc != Success)
return rc;
rep = (xSyncQueryFenceReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
xSyncQueryFenceReply rep = (xSyncQueryFenceReply) {
.triggered = pFence->funcs.CheckTriggered(pFence)
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xSyncQueryFenceReply), &rep);
return Success;
REPLY_SEND_RET_SUCCESS();
}
static int
ProcSyncAwaitFence(ClientPtr client)
{
REQUEST(xSyncAwaitFenceReq);
REQUEST_HEAD_AT_LEAST(xSyncAwaitFenceReq);
REQUEST_REST_CARD32();
SyncAwaitUnion *pAwaitUnion;
SyncAwait *pAwait;
@ -2072,8 +2024,6 @@ ProcSyncAwaitFence(ClientPtr client)
int items;
int i;
REQUEST_AT_LEAST_SIZE(xSyncAwaitFenceReq);
len = client->req_len << 2;
len -= sz_xSyncAwaitFenceReq;
items = len / sizeof(CARD32);
@ -2189,252 +2139,6 @@ ProcSyncDispatch(ClientPtr client)
}
}
/*
* Boring Swapping stuff ...
*/
static int _X_COLD
SProcSyncCreateCounter(ClientPtr client)
{
REQUEST(xSyncCreateCounterReq);
REQUEST_SIZE_MATCH(xSyncCreateCounterReq);
swapl(&stuff->cid);
swapl(&stuff->initial_value_lo);
swapl(&stuff->initial_value_hi);
return ProcSyncCreateCounter(client);
}
static int _X_COLD
SProcSyncSetCounter(ClientPtr client)
{
REQUEST(xSyncSetCounterReq);
REQUEST_SIZE_MATCH(xSyncSetCounterReq);
swapl(&stuff->cid);
swapl(&stuff->value_lo);
swapl(&stuff->value_hi);
return ProcSyncSetCounter(client);
}
static int _X_COLD
SProcSyncChangeCounter(ClientPtr client)
{
REQUEST(xSyncChangeCounterReq);
REQUEST_SIZE_MATCH(xSyncChangeCounterReq);
swapl(&stuff->cid);
swapl(&stuff->value_lo);
swapl(&stuff->value_hi);
return ProcSyncChangeCounter(client);
}
static int _X_COLD
SProcSyncQueryCounter(ClientPtr client)
{
REQUEST(xSyncQueryCounterReq);
REQUEST_SIZE_MATCH(xSyncQueryCounterReq);
swapl(&stuff->counter);
return ProcSyncQueryCounter(client);
}
static int _X_COLD
SProcSyncDestroyCounter(ClientPtr client)
{
REQUEST(xSyncDestroyCounterReq);
REQUEST_SIZE_MATCH(xSyncDestroyCounterReq);
swapl(&stuff->counter);
return ProcSyncDestroyCounter(client);
}
static int _X_COLD
SProcSyncAwait(ClientPtr client)
{
REQUEST(xSyncAwaitReq);
REQUEST_AT_LEAST_SIZE(xSyncAwaitReq);
SwapRestL(stuff);
return ProcSyncAwait(client);
}
static int _X_COLD
SProcSyncCreateAlarm(ClientPtr client)
{
REQUEST(xSyncCreateAlarmReq);
REQUEST_AT_LEAST_SIZE(xSyncCreateAlarmReq);
swapl(&stuff->id);
swapl(&stuff->valueMask);
SwapRestL(stuff);
return ProcSyncCreateAlarm(client);
}
static int _X_COLD
SProcSyncChangeAlarm(ClientPtr client)
{
REQUEST(xSyncChangeAlarmReq);
REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq);
swapl(&stuff->alarm);
swapl(&stuff->valueMask);
SwapRestL(stuff);
return ProcSyncChangeAlarm(client);
}
static int _X_COLD
SProcSyncQueryAlarm(ClientPtr client)
{
REQUEST(xSyncQueryAlarmReq);
REQUEST_SIZE_MATCH(xSyncQueryAlarmReq);
swapl(&stuff->alarm);
return ProcSyncQueryAlarm(client);
}
static int _X_COLD
SProcSyncDestroyAlarm(ClientPtr client)
{
REQUEST(xSyncDestroyAlarmReq);
REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq);
swapl(&stuff->alarm);
return ProcSyncDestroyAlarm(client);
}
static int _X_COLD
SProcSyncSetPriority(ClientPtr client)
{
REQUEST(xSyncSetPriorityReq);
REQUEST_SIZE_MATCH(xSyncSetPriorityReq);
swapl(&stuff->id);
swapl(&stuff->priority);
return ProcSyncSetPriority(client);
}
static int _X_COLD
SProcSyncGetPriority(ClientPtr client)
{
REQUEST(xSyncGetPriorityReq);
REQUEST_SIZE_MATCH(xSyncGetPriorityReq);
swapl(&stuff->id);
return ProcSyncGetPriority(client);
}
static int _X_COLD
SProcSyncCreateFence(ClientPtr client)
{
REQUEST(xSyncCreateFenceReq);
REQUEST_SIZE_MATCH(xSyncCreateFenceReq);
swapl(&stuff->d);
swapl(&stuff->fid);
return ProcSyncCreateFence(client);
}
static int _X_COLD
SProcSyncTriggerFence(ClientPtr client)
{
REQUEST(xSyncTriggerFenceReq);
REQUEST_SIZE_MATCH(xSyncTriggerFenceReq);
swapl(&stuff->fid);
return ProcSyncTriggerFence(client);
}
static int _X_COLD
SProcSyncResetFence(ClientPtr client)
{
REQUEST(xSyncResetFenceReq);
REQUEST_SIZE_MATCH(xSyncResetFenceReq);
swapl(&stuff->fid);
return ProcSyncResetFence(client);
}
static int _X_COLD
SProcSyncDestroyFence(ClientPtr client)
{
REQUEST(xSyncDestroyFenceReq);
REQUEST_SIZE_MATCH(xSyncDestroyFenceReq);
swapl(&stuff->fid);
return ProcSyncDestroyFence(client);
}
static int _X_COLD
SProcSyncQueryFence(ClientPtr client)
{
REQUEST(xSyncQueryFenceReq);
REQUEST_SIZE_MATCH(xSyncQueryFenceReq);
swapl(&stuff->fid);
return ProcSyncQueryFence(client);
}
static int _X_COLD
SProcSyncAwaitFence(ClientPtr client)
{
REQUEST(xSyncAwaitFenceReq);
REQUEST_AT_LEAST_SIZE(xSyncAwaitFenceReq);
SwapRestL(stuff);
return ProcSyncAwaitFence(client);
}
static int _X_COLD
SProcSyncDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_SyncInitialize:
return ProcSyncInitialize(client);
case X_SyncListSystemCounters:
return ProcSyncListSystemCounters(client);
case X_SyncCreateCounter:
return SProcSyncCreateCounter(client);
case X_SyncSetCounter:
return SProcSyncSetCounter(client);
case X_SyncChangeCounter:
return SProcSyncChangeCounter(client);
case X_SyncQueryCounter:
return SProcSyncQueryCounter(client);
case X_SyncDestroyCounter:
return SProcSyncDestroyCounter(client);
case X_SyncAwait:
return SProcSyncAwait(client);
case X_SyncCreateAlarm:
return SProcSyncCreateAlarm(client);
case X_SyncChangeAlarm:
return SProcSyncChangeAlarm(client);
case X_SyncQueryAlarm:
return SProcSyncQueryAlarm(client);
case X_SyncDestroyAlarm:
return SProcSyncDestroyAlarm(client);
case X_SyncSetPriority:
return SProcSyncSetPriority(client);
case X_SyncGetPriority:
return SProcSyncGetPriority(client);
case X_SyncCreateFence:
return SProcSyncCreateFence(client);
case X_SyncTriggerFence:
return SProcSyncTriggerFence(client);
case X_SyncResetFence:
return SProcSyncResetFence(client);
case X_SyncDestroyFence:
return SProcSyncDestroyFence(client);
case X_SyncQueryFence:
return SProcSyncQueryFence(client);
case X_SyncAwaitFence:
return SProcSyncAwaitFence(client);
default:
return BadRequest;
}
}
/*
* Event Swapping
*/
@ -2508,7 +2212,7 @@ SyncExtensionInit(void)
RTAlarmClient == 0 ||
(extEntry = AddExtension(SYNC_NAME,
XSyncNumberEvents, XSyncNumberErrors,
ProcSyncDispatch, SProcSyncDispatch,
ProcSyncDispatch, ProcSyncDispatch,
SyncResetProc, StandardMinorOpcode)) == NULL) {
ErrorF("Sync Extension %d.%d failed to Initialise\n",
SYNC_MAJOR_VERSION, SYNC_MINOR_VERSION);

File diff suppressed because it is too large Load Diff

View File

@ -280,15 +280,3 @@ 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,13 +25,12 @@ 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)
@ -57,12 +56,6 @@ 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 several modules
*/
_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);
@ -78,7 +71,7 @@ int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin, PropertyPtr *ppProp,
Mask access_mode);
int XaceHookSelectionAccess(ClientPtr ptr, Selection ** ppSel, Mask access_mode);
/* needs to be exported for in-tree modesetting, but not part of public API */
/* needs to be exported for in-tree modsetting, but not part of public API */
_X_EXPORT int XaceHookResourceAccess(ClientPtr client, XID id, RESTYPE rtype, void *res,
RESTYPE ptype, void *parent, Mask access_mode);
@ -95,7 +88,16 @@ int XaceHookScreensaverAccess(ClientPtr client, ScreenPtr screen, Mask access_mo
int XaceHookAuthAvail(ClientPtr client, XID authId);
int XaceHookKeyAvail(xEventPtr ev, DeviceIntPtr dev, int count);
/* Register / unregister a callback for a given hook. */
/* 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)
/* XTrans wrappers for use by security modules
*/

View File

@ -20,14 +20,13 @@ 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_RESOURCE_ACCESS */

View File

@ -33,71 +33,62 @@ from The Open Group.
#include <X11/Xproto.h>
#include <X11/extensions/xcmiscproto.h>
#include "dix/request_priv.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 "extinit_priv.h"
static int
ProcXCMiscGetVersion(ClientPtr client)
{
REQUEST_HEAD_STRUCT(xXCMiscGetVersionReq);
REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
REQUEST_FIELD_CARD16(majorVersion);
REQUEST_FIELD_CARD16(minorVersion);
xXCMiscGetVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = XCMiscMajorVersion,
.minorVersion = XCMiscMinorVersion
};
REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xXCMiscGetVersionReply), &rep);
return Success;
REPLY_FIELD_CARD16(majorVersion);
REPLY_FIELD_CARD16(minorVersion);
REPLY_SEND_RET_SUCCESS();
}
static int
ProcXCMiscGetXIDRange(ClientPtr client)
{
xXCMiscGetXIDRangeReply rep;
XID min_id, max_id;
REQUEST_HEAD_STRUCT(xXCMiscGetXIDRangeReq);
REQUEST_SIZE_MATCH(xXCMiscGetXIDRangeReq);
XID min_id, max_id;
GetXIDRange(client->index, FALSE, &min_id, &max_id);
rep = (xXCMiscGetXIDRangeReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
xXCMiscGetXIDRangeReply rep = {
.start_id = min_id,
.count = max_id - min_id + 1
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.start_id);
swapl(&rep.count);
}
WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), &rep);
return Success;
REPLY_FIELD_CARD32(start_id);
REPLY_FIELD_CARD32(count);
REPLY_SEND_RET_SUCCESS();
}
static int
ProcXCMiscGetXIDList(ClientPtr client)
{
REQUEST(xXCMiscGetXIDListReq);
xXCMiscGetXIDListReply rep;
REQUEST_HEAD_STRUCT(xXCMiscGetXIDListReq);
REQUEST_FIELD_CARD16(length);
REQUEST_FIELD_CARD32(count);
XID *pids;
unsigned int count;
REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq);
if (stuff->count > UINT32_MAX / sizeof(XID))
return BadAlloc;
@ -106,18 +97,15 @@ ProcXCMiscGetXIDList(ClientPtr client)
return BadAlloc;
}
count = GetXIDList(client, stuff->count, pids);
rep = (xXCMiscGetXIDListReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
xXCMiscGetXIDListReply rep = {
.length = count,
.count = count
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.count);
}
WriteToClient(client, sizeof(xXCMiscGetXIDListReply), &rep);
REPLY_FIELD_CARD32(length);
REPLY_FIELD_CARD32(count);
REPLY_SEND();
if (count) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, count * sizeof(XID), pids);
@ -142,46 +130,10 @@ ProcXCMiscDispatch(ClientPtr client)
}
}
static int _X_COLD
SProcXCMiscGetVersion(ClientPtr client)
{
REQUEST(xXCMiscGetVersionReq);
REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
return ProcXCMiscGetVersion(client);
}
static int _X_COLD
SProcXCMiscGetXIDList(ClientPtr client)
{
REQUEST(xXCMiscGetXIDListReq);
REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq);
swapl(&stuff->count);
return ProcXCMiscGetXIDList(client);
}
static int _X_COLD
SProcXCMiscDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_XCMiscGetVersion:
return SProcXCMiscGetVersion(client);
case X_XCMiscGetXIDRange:
return ProcXCMiscGetXIDRange(client);
case X_XCMiscGetXIDList:
return SProcXCMiscGetXIDList(client);
default:
return BadRequest;
}
}
void
XCMiscExtensionInit(void)
{
AddExtension(XCMiscExtensionName, 0, 0,
ProcXCMiscDispatch, SProcXCMiscDispatch,
ProcXCMiscDispatch, ProcXCMiscDispatch,
NULL, StandardMinorOpcode);
}

View File

@ -41,6 +41,10 @@
#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>
@ -53,10 +57,6 @@
#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,6 +64,7 @@
#include "gcstruct.h"
#include "dixfontstr.h"
#include "extnsionst.h"
#include "extinit.h"
#include "protocol-versions.h"
#include "xf86bigfontsrv.h"
@ -86,7 +87,7 @@ static unsigned int pagesize;
static Bool badSysCall = FALSE;
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
static void
SigSysHandler(int signo)
@ -264,11 +265,9 @@ XF86BigfontResetProc(ExtensionEntry * extEntry)
static int
ProcXF86BigfontQueryVersion(ClientPtr client)
{
REQUEST_SIZE_MATCH(xXF86BigfontQueryVersionReq);
REQUEST_HEAD_STRUCT(xXF86BigfontQueryVersionReq);
xXF86BigfontQueryVersionReply reply = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION,
.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION,
.uid = geteuid(),
@ -279,17 +278,12 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
? XF86Bigfont_CAP_LocalShm : 0
#endif
};
if (client->swapped) {
swaps(&reply.sequenceNumber);
swapl(&reply.length);
swaps(&reply.majorVersion);
swaps(&reply.minorVersion);
swapl(&reply.uid);
swapl(&reply.gid);
swapl(&reply.signature);
}
WriteToClient(client, sizeof(xXF86BigfontQueryVersionReply), &reply);
return Success;
REPLY_FIELD_CARD16(&reply.majorVersion);
REPLY_FIELD_CARD16(&reply.minorVersion);
REPLY_FIELD_CARD32(&reply.uid);
REPLY_FIELD_CARD32(&reply.gid);
REPLY_FIELD_CARD32(&reply.signature);
REPLY_SEND_RET_SUCCESS();
}
static void
@ -313,9 +307,10 @@ swapCharInfo(xCharInfo * pCI)
static int
ProcXF86BigfontQueryFont(ClientPtr client)
{
FontPtr pFont;
REQUEST_HEAD_NO_CHECK(xXF86BigfontQueryFontReq);
REQUEST_FIELD_CARD32(id);
REQUEST(xXF86BigfontQueryFontReq);
FontPtr pFont;
CARD32 stuff_flags;
xCharInfo *pmax;
xCharInfo *pmin;
@ -532,10 +527,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
: 0);
xXF86BigfontQueryFontReply rep = {
.type = X_Reply,
.length = bytes_to_int32(sizeof(xXF86BigfontQueryFontReply)
- sizeof(xGenericReply) + rlength),
.sequenceNumber = client->sequence,
.length = bytes_to_int32(buflength),
.minBounds = pFont->info.ink_minbounds,
.maxBounds = pFont->info.ink_maxbounds,
.minCharOrByte2 = pFont->info.firstCol,
@ -553,21 +545,20 @@ ProcXF86BigfontQueryFont(ClientPtr client)
.shmid = shmid,
};
REPLY_FIELD_CARD16(minCharOrByte2);
REPLY_FIELD_CARD16(maxCharOrByte2);
REPLY_FIELD_CARD16(defaultChar);
REPLY_FIELD_CARD16(nFontProps);
REPLY_FIELD_CARD16(fontAscent);
REPLY_FIELD_CARD16(fontDescent);
REPLY_FIELD_CARD32(nCharInfos);
REPLY_FIELD_CARD32(nUniqCharInfos);
REPLY_FIELD_CARD32(shmid);
REPLY_FIELD_CARD32(shmsegoffset);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapCharInfo(&rep.minBounds);
swapCharInfo(&rep.maxBounds);
swaps(&rep.minCharOrByte2);
swaps(&rep.maxCharOrByte2);
swaps(&rep.defaultChar);
swaps(&rep.nFontProps);
swaps(&rep.fontAscent);
swaps(&rep.fontDescent);
swapl(&rep.nCharInfos);
swapl(&rep.nUniqCharInfos);
swapl(&rep.shmid);
swapl(&rep.shmsegoffset);
}
int rc = Success;
@ -588,10 +579,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
i < nfontprops; i++, pFP++, prFP++) {
prFP->name = pFP->name;
prFP->value = pFP->value;
if (client->swapped) {
swapl(&prFP->name);
swapl(&prFP->value);
}
CLIENT_STRUCT_CARD32_2(prFP, name, value);
}
p = (char *) prFP;
}
@ -609,14 +597,11 @@ ProcXF86BigfontQueryFont(ClientPtr client)
ps = (CARD16 *) pci;
for (j = 0; j < nCharInfos; j++, ps++) {
*ps = pIndex2UniqIndex[j];
if (client->swapped) {
swaps(ps);
}
REPLY_BUF_CARD16(ps, 1);
}
}
WriteToClient(client, sizeof(xXF86BigfontQueryFontReply), &rep);
WriteToClient(client, rlength, buf);
REPLY_SEND_EXTRA(buf, rlength);
free(buf);
out:
if (nCharInfos > 0) {
@ -644,36 +629,6 @@ ProcXF86BigfontDispatch(ClientPtr client)
}
}
static int _X_COLD
SProcXF86BigfontQueryVersion(ClientPtr client)
{
return ProcXF86BigfontQueryVersion(client);
}
static int _X_COLD
SProcXF86BigfontQueryFont(ClientPtr client)
{
REQUEST(xXF86BigfontQueryFontReq);
REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq);
swapl(&stuff->id);
return ProcXF86BigfontQueryFont(client);
}
static int _X_COLD
SProcXF86BigfontDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_XF86BigfontQueryVersion:
return SProcXF86BigfontQueryVersion(client);
case X_XF86BigfontQueryFont:
return SProcXF86BigfontQueryFont(client);
default:
return BadRequest;
}
}
void
XFree86BigfontExtensionInit(void)
{
@ -681,7 +636,7 @@ XFree86BigfontExtensionInit(void)
XF86BigfontNumberEvents,
XF86BigfontNumberErrors,
ProcXF86BigfontDispatch,
SProcXF86BigfontDispatch,
ProcXF86BigfontDispatch,
XF86BigfontResetProc, StandardMinorOpcode)) {
#ifdef MITSHM
#ifdef MUST_CHECK_FOR_SHM_SYSCALL
@ -705,7 +660,7 @@ XFree86BigfontExtensionInit(void)
FontShmdescIndex = xfont2_allocate_font_private_index();
#if !defined(CSRG_BASED)
#if !defined(CSRG_BASED) && !defined(__CYGWIN__)
pagesize = SHMLBA;
#else
#ifdef _SC_PAGESIZE

View File

@ -12,9 +12,9 @@
#include <X11/extensions/XResproto.h>
#include "dix/registry_priv.h"
#include "dix/request_priv.h"
#include "dix/resource_priv.h"
#include "os/client_priv.h"
#include "miext/extinit_priv.h"
#include "Xext/xace.h"
#include "misc.h"
@ -25,6 +25,7 @@
#include "pixmapstr.h"
#include "windowstr.h"
#include "gcstruct.h"
#include "extinit_priv.h"
#include "protocol-versions.h"
#include "list.h"
#include "misc.h"
@ -183,33 +184,27 @@ ProcXResQueryVersion(ClientPtr client)
REQUEST_SIZE_MATCH(xXResQueryVersionReq);
xXResQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.server_major = SERVER_XRES_MAJOR_VERSION,
.server_minor = SERVER_XRES_MINOR_VERSION
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.server_major);
swaps(&rep.server_minor);
}
WriteToClient(client, sizeof(xXResQueryVersionReply), &rep);
return Success;
REPLY_FIELD_CARD16(server_major);
REPLY_FIELD_CARD16(server_minor);
REPLY_SEND_RET_SUCCESS();
}
static int
ProcXResQueryClients(ClientPtr client)
{
REQUEST_SIZE_MATCH(xXResQueryClientsReq);
REQUEST_HEAD_STRUCT(xXResQueryClientsReq);
int i, num_clients = 0;
int *current_clients = calloc(currentMaxClients, sizeof(int));
if (!current_clients)
return BadAlloc;
int num_clients = 0;
for (int i = 0; i < currentMaxClients; i++) {
for (i = 0; i < currentMaxClients; i++) {
if (clients[i]) {
if (XaceHookClientAccess(client, clients[i], DixReadAccess) == Success) {
current_clients[num_clients] = i;
@ -219,41 +214,22 @@ ProcXResQueryClients(ClientPtr client)
}
xXResQueryClientsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(num_clients * sz_xXResClient),
.num_clients = num_clients
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.num_clients);
}
xXResClient *scratch = NULL;
xXResClient scratch[num_clients];
if (num_clients) {
scratch = calloc(sizeof(xXResClient), num_clients);
if (!scratch) {
free(current_clients);
return BadAlloc;
}
for (int i = 0; i < num_clients; i++) {
for (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[i].resource_base);
swapl(&scratch[i].resource_mask);
}
CLIENT_STRUCT_CARD32_2(&scratch[i], resource_base, resource_mask);
}
}
WriteToClient(client, sizeof(xXResQueryClientsReply), &rep);
WriteToClient(client, sizeof(xXResClient) * num_clients, scratch);
REPLY_FIELD_CARD32(num_clients);
REPLY_SEND_EXTRA(scratch, sizeof(scratch));
free(current_clients);
free(scratch);
return Success;
}
@ -286,8 +262,8 @@ resourceTypeAtom(int i)
static int
ProcXResQueryClientResources(ClientPtr client)
{
REQUEST(xXResQueryClientResourcesReq);
REQUEST_SIZE_MATCH(xXResQueryClientResourcesReq);
REQUEST_HEAD_STRUCT(xXResQueryClientResourcesReq);
REQUEST_FIELD_CARD32(xid);
ClientPtr resClient = dixClientForXID(stuff->xid);
@ -304,45 +280,30 @@ ProcXResQueryClientResources(ClientPtr client)
FindAllClientResources(resClient, ResFindAllRes, counts);
int num_types = 0;
for (int i = 0; i <= lastResourceType; i++) {
if (counts[i])
int cnt[lastResourceType + 1];
for (i = 0; i <= lastResourceType; i++) {
if (counts[i]) {
cnt[num_types] = counts[i];
num_types++;
}
xXResQueryClientResourcesReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(num_types * sz_xXResType),
.num_types = num_types
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.num_types);
}
xXResType *scratch = calloc(sizeof(xXResType), num_types);
if (!scratch) {
free(counts);
return BadAlloc;
}
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[i].resource_type);
swapl(&scratch[i].count);
}
}
free(counts);
xXResQueryClientResourcesReply rep = {
.num_types = num_types
};
WriteToClient(client, sizeof(xXResQueryClientResourcesReply), &rep);
WriteToClient(client, num_types * sizeof(xXResType), scratch);
free(scratch);
xXResType scratch[num_types];
for (i = 0; i < num_types; i++) {
scratch[i].resource_type = resourceTypeAtom(i + 1);
scratch[i].count = cnt[i];
CLIENT_STRUCT_CARD32_2(&scratch[i], resource_type, count);
}
REPLY_FIELD_CARD32(num_types);
REPLY_SEND_EXTRA(scratch, sizeof(scratch));
free(counts);
return Success;
}
@ -360,8 +321,8 @@ ResFindResourcePixmaps(void *value, XID id, RESTYPE type, void *cdata)
static int
ProcXResQueryClientPixmapBytes(ClientPtr client)
{
REQUEST(xXResQueryClientPixmapBytesReq);
REQUEST_SIZE_MATCH(xXResQueryClientPixmapBytesReq);
REQUEST_HEAD_STRUCT(xXResQueryClientPixmapBytesReq);
REQUEST_FIELD_CARD32(xid);
ClientPtr owner = dixClientForXID(stuff->xid);
if ((!owner) ||
@ -376,22 +337,14 @@ ProcXResQueryClientPixmapBytes(ClientPtr client)
(void *) (&bytes));
xXResQueryClientPixmapBytesReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.bytes = bytes,
#ifdef _XSERVER64
.bytes_overflow = bytes >> 32
#endif
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.bytes);
swapl(&rep.bytes_overflow);
}
WriteToClient(client, sizeof(xXResQueryClientPixmapBytesReply), &rep);
return Success;
REPLY_FIELD_CARD32(bytes);
REPLY_FIELD_CARD32(bytes_overflow);
REPLY_SEND_RET_SUCCESS();
}
/** @brief Finds out if a client's information need to be put into the
@ -443,9 +396,7 @@ ConstructClientIdValue(ClientPtr sendClient, ClientPtr client, CARD32 mask,
.spec.client = client->clientAsMask,
};
if (client->swapped) {
swapl (&rep.spec.client);
}
REPLY_FIELD_CARD32(spec.client);
if (WillConstructMask(client, mask, ctx, X_XResClientXIDMask)) {
void *ptr = AddFragment(&ctx->response, sizeof(rep));
@ -454,10 +405,7 @@ ConstructClientIdValue(ClientPtr sendClient, ClientPtr client, CARD32 mask,
}
rep.spec.mask = X_XResClientXIDMask;
if (sendClient->swapped) {
swapl (&rep.spec.mask);
/* swapl (&rep.length, n); - not required for rep.length = 0 */
}
REPLY_FIELD_CARD32(spec.mask);
memcpy(ptr, &rep, sizeof(rep));
@ -479,11 +427,11 @@ ConstructClientIdValue(ClientPtr sendClient, ClientPtr client, CARD32 mask,
rep.spec.mask = X_XResLocalClientPIDMask;
rep.length = 4;
if (sendClient->swapped) {
swapl (&rep.spec.mask);
swapl (&rep.length);
swapl (value);
}
REPLY_FIELD_CARD32(spec.mask);
REPLY_FIELD_CARD32(length); // need to do it, since not calling REPLY_SEND()
REPLY_BUF_CARD32(value, 1);
memcpy(ptr, &rep, sizeof(rep));
*value = pid;
@ -510,13 +458,15 @@ ConstructClientIds(ClientPtr client,
int numSpecs, xXResClientIdSpec* specs,
ConstructClientIdCtx *ctx)
{
for (int specIdx = 0; specIdx < numSpecs; ++specIdx) {
int specIdx;
for (specIdx = 0; specIdx < numSpecs; ++specIdx) {
if (specs[specIdx].client == 0) {
int c;
for (c = 0; c < currentMaxClients; ++c) {
if (clients[c] &&
(XaceHookClientAccess(client, clients[c], DixReadAccess)
== Success)) {
!= Success)) {
if (!ConstructClientIdValue(client, clients[c],
specs[specIdx].mask, ctx)) {
return BadAlloc;
@ -527,7 +477,7 @@ ConstructClientIds(ClientPtr client,
ClientPtr owner = dixClientForXID(specs[specIdx].client);
if (owner &&
(XaceHookClientAccess(client, owner, DixReadAccess)
== Success)) {
!= Success)) {
if (!ConstructClientIdValue(client, owner,
specs[specIdx].mask, ctx)) {
return BadAlloc;
@ -550,25 +500,22 @@ ConstructClientIds(ClientPtr client,
static int
ProcXResQueryClientIds (ClientPtr client)
{
REQUEST(xXResQueryClientIdsReq);
REQUEST_HEAD_AT_LEAST(xXResQueryClientIdsReq);
REQUEST_FIELD_CARD32(numSpecs);
xXResClientIdSpec *specs = (void*) ((char*) stuff + sizeof(*stuff));
int rc;
ConstructClientIdCtx ctx;
InitConstructClientIdCtx(&ctx);
REQUEST_AT_LEAST_SIZE(xXResQueryClientIdsReq);
REQUEST_FIXED_SIZE(xXResQueryClientIdsReq,
stuff->numSpecs * sizeof(specs[0]));
int rc = ConstructClientIds(client, stuff->numSpecs, specs, &ctx);
rc = ConstructClientIds(client, stuff->numSpecs, specs, &ctx);
if (rc == Success) {
char *buf = calloc(1, ctx.resultBytes);
if (!buf) {
rc = BadAlloc;
goto out;
}
char buf[ctx.resultBytes];
char *walk = buf;
FragmentList *it;
@ -578,24 +525,14 @@ ProcXResQueryClientIds (ClientPtr client)
}
xXResQueryClientIdsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(ctx.resultBytes),
.numIds = ctx.numIds
};
if (client->swapped) {
swaps (&rep.sequenceNumber);
swapl (&rep.length);
swapl (&rep.numIds);
}
WriteToClient(client, sizeof(rep), &rep);
WriteToClient(client, ctx.resultBytes, buf);
free(buf);
REPLY_FIELD_CARD32(numIds);
REPLY_SEND_EXTRA(buf, sizeof(buf));
}
out:
DestroyConstructClientIdCtx(&ctx);
return rc;
@ -632,11 +569,12 @@ 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 (int c = 0; c < value->numCrossReferences; ++c) {
for (c = 0; c < value->numCrossReferences; ++c) {
xXResResourceSizeSpec *spec = FRAGMENT_DATA(it);
SwapXResResourceSizeSpec(spec);
it = it->next;
@ -839,7 +777,8 @@ static void
ConstructClientResourceBytes(ClientPtr aboutClient,
ConstructResourceBytesCtx *ctx)
{
for (int specIdx = 0; specIdx < ctx->numSpecs; ++specIdx) {
int specIdx;
for (specIdx = 0; specIdx < ctx->numSpecs; ++specIdx) {
xXResResourceIdSpec* spec = ctx->specs + specIdx;
if (spec->resource) {
/* these specs are handled elsewhere */
@ -871,7 +810,8 @@ ConstructClientResourceBytes(ClientPtr aboutClient,
static void
ConstructResourceBytesByResource(XID aboutClient, ConstructResourceBytesCtx *ctx)
{
for (int specIdx = 0; specIdx < ctx->numSpecs; ++specIdx) {
int specIdx;
for (specIdx = 0; specIdx < ctx->numSpecs; ++specIdx) {
xXResResourceIdSpec *spec = ctx->specs + specIdx;
if (spec->resource) {
ClientPtr client = dixClientForXID(spec->resource);
@ -930,15 +870,24 @@ ConstructResourceBytes(XID aboutClient,
static int
ProcXResQueryResourceBytes (ClientPtr client)
{
REQUEST(xXResQueryResourceBytesReq);
REQUEST_AT_LEAST_SIZE(xXResQueryResourceBytesReq);
REQUEST_HEAD_AT_LEAST(xXResQueryResourceBytesReq);
REQUEST_FIELD_CARD32(numSpecs);
int rc;
ConstructResourceBytesCtx ctx;
ConstructResourceBytesCtx ctx;
if (stuff->numSpecs > UINT32_MAX / sizeof(ctx.specs[0]))
return BadLength;
REQUEST_FIXED_SIZE(xXResQueryResourceBytesReq,
stuff->numSpecs * sizeof(ctx.specs[0]));
if (client->swapped) {
xXResResourceIdSpec *specs = (void*) ((char*) stuff + sizeof(*stuff));
for (int c = 0; c < stuff->numSpecs; ++c) {
SwapXResResourceIdSpec(specs + c);
}
}
if (!InitConstructResourceBytesCtx(&ctx, client,
stuff->numSpecs,
(void*) ((char*) stuff +
@ -946,42 +895,32 @@ ProcXResQueryResourceBytes (ClientPtr client)
return BadAlloc;
}
int rc = ConstructResourceBytes(stuff->client, &ctx);
rc = ConstructResourceBytes(stuff->client, &ctx);
if (rc == Success) {
xXResQueryResourceBytesReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(ctx.resultBytes),
.numSizes = ctx.numSizes
};
if (client->swapped) {
swaps (&rep.sequenceNumber);
swapl (&rep.length);
swapl (&rep.numSizes);
REPLY_FIELD_CARD32(numSizes);
if (client->swapped) {
SwapXResQueryResourceBytes(&ctx.response);
}
char *buf = calloc(1, ctx.resultBytes);
if (!buf) {
rc = BadAlloc;
goto out;
char buf[ctx.resultBytes];
{
char *walk = buf;
FragmentList *it;
xorg_list_for_each_entry(it, &ctx.response, l) {
memcpy(walk, FRAGMENT_DATA(it), it->bytes);
walk += it->bytes;
}
}
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);
REPLY_SEND_EXTRA(buf, sizeof(buf));
}
out:
DestroyConstructResourceBytesCtx(&ctx);
return rc;
@ -1010,91 +949,10 @@ ProcResDispatch(ClientPtr client)
return BadRequest;
}
static int _X_COLD
SProcXResQueryVersion(ClientPtr client)
{
REQUEST_SIZE_MATCH(xXResQueryVersionReq);
return ProcXResQueryVersion(client);
}
static int _X_COLD
SProcXResQueryClientResources(ClientPtr client)
{
REQUEST(xXResQueryClientResourcesReq);
REQUEST_SIZE_MATCH(xXResQueryClientResourcesReq);
swapl(&stuff->xid);
return ProcXResQueryClientResources(client);
}
static int _X_COLD
SProcXResQueryClientPixmapBytes(ClientPtr client)
{
REQUEST(xXResQueryClientPixmapBytesReq);
REQUEST_SIZE_MATCH(xXResQueryClientPixmapBytesReq);
swapl(&stuff->xid);
return ProcXResQueryClientPixmapBytes(client);
}
static int _X_COLD
SProcXResQueryClientIds (ClientPtr client)
{
REQUEST(xXResQueryClientIdsReq);
REQUEST_AT_LEAST_SIZE (xXResQueryClientIdsReq);
swapl(&stuff->numSpecs);
return ProcXResQueryClientIds(client);
}
/** @brief Implements the XResQueryResourceBytes of XResProto v1.2.
This variant byteswaps request contents before issuing the
rest of the work to ProcXResQueryResourceBytes */
static int _X_COLD
SProcXResQueryResourceBytes (ClientPtr client)
{
REQUEST(xXResQueryResourceBytesReq);
int c;
xXResResourceIdSpec *specs = (void*) ((char*) stuff + sizeof(*stuff));
REQUEST_AT_LEAST_SIZE(xXResQueryResourceBytesReq);
swapl(&stuff->numSpecs);
REQUEST_FIXED_SIZE(xXResQueryResourceBytesReq,
stuff->numSpecs * sizeof(specs[0]));
for (c = 0; c < stuff->numSpecs; ++c) {
SwapXResResourceIdSpec(specs + c);
}
return ProcXResQueryResourceBytes(client);
}
static int _X_COLD
SProcResDispatch (ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_XResQueryVersion:
return SProcXResQueryVersion(client);
case X_XResQueryClients: /* nothing to swap */
return ProcXResQueryClients(client);
case X_XResQueryClientResources:
return SProcXResQueryClientResources(client);
case X_XResQueryClientPixmapBytes:
return SProcXResQueryClientPixmapBytes(client);
case X_XResQueryClientIds:
return SProcXResQueryClientIds(client);
case X_XResQueryResourceBytes:
return SProcXResQueryResourceBytes(client);
default: break;
}
return BadRequest;
}
void
ResExtensionInit(void)
{
(void) AddExtension(XRES_NAME, 0, 0,
ProcResDispatch, SProcResDispatch,
ProcResDispatch, ProcResDispatch,
NULL, StandardMinorOpcode);
}

View File

@ -21,13 +21,14 @@ 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 "dix/request_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)
@ -68,19 +69,13 @@ static int
ProcSELinuxQueryVersion(ClientPtr client)
{
SELinuxQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.server_major = SELINUX_MAJOR_VERSION,
.server_minor = SELINUX_MINOR_VERSION
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.server_major);
swaps(&rep.server_minor);
}
WriteToClient(client, sizeof(rep), &rep);
return Success;
REPLY_FIELD_CARD16(server_major);
REPLY_FIELD_CARD16(server_minor);
REPLY_SEND_RET_SUCCESS();
}
static int
@ -96,20 +91,11 @@ SELinuxSendContextReply(ClientPtr client, security_id_t sid)
}
SELinuxGetContextReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(len),
.context_len = len
};
if (client->swapped) {
swapl(&rep.length);
swaps(&rep.sequenceNumber);
swapl(&rep.context_len);
}
WriteToClient(client, sizeof(SELinuxGetContextReply), &rep);
WriteToClient(client, len, ctx);
REPLY_FIELD_CARD32(context_len);
REPLY_SEND_EXTRA(ctx, len);
freecon(ctx);
return Success;
}
@ -123,7 +109,8 @@ ProcSELinuxSetCreateContext(ClientPtr client, unsigned offset)
char *ptr;
int rc;
REQUEST(SELinuxSetCreateContextReq);
REQUEST_HEAD_AT_LEAST(SELinuxSetCreateContextReq);
REQUEST_FIELD_CARD32(context_len);
REQUEST_FIXED_SIZE(SELinuxSetCreateContextReq, stuff->context_len);
if (stuff->context_len > 0) {
@ -153,7 +140,7 @@ ProcSELinuxGetCreateContext(ClientPtr client, unsigned offset)
security_id_t *pSid;
char *ptr;
REQUEST_SIZE_MATCH(SELinuxGetCreateContextReq);
REQUEST_HEAD_STRUCT(SELinuxGetCreateContextReq);
if (offset == CTX_DEV)
ptr = dixLookupPrivate(&serverClient->devPrivates, subjectKey);
@ -174,7 +161,9 @@ ProcSELinuxSetDeviceContext(ClientPtr client)
SELinuxObjectRec *obj;
int rc;
REQUEST(SELinuxSetContextReq);
REQUEST_HEAD_AT_LEAST(SELinuxSetContextReq);
REQUEST_FIELD_CARD32(id);
REQUEST_FIELD_CARD32(context_len);
REQUEST_FIXED_SIZE(SELinuxSetContextReq, stuff->context_len);
if (stuff->context_len < 1)
@ -211,8 +200,8 @@ ProcSELinuxGetDeviceContext(ClientPtr client)
SELinuxSubjectRec *subj;
int rc;
REQUEST(SELinuxGetContextReq);
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
REQUEST_HEAD_STRUCT(SELinuxGetContextReq);
REQUEST_FIELD_CARD32(id);
rc = dixLookupDevice(&dev, stuff->id, client, DixGetAttrAccess);
if (rc != Success)
@ -230,8 +219,8 @@ ProcSELinuxGetDrawableContext(ClientPtr client)
SELinuxObjectRec *obj;
int rc;
REQUEST(SELinuxGetContextReq);
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
REQUEST_HEAD_STRUCT(SELinuxGetContextReq);
REQUEST_FIELD_CARD32(id);
rc = dixLookupDrawable(&pDraw, stuff->id, client, 0, DixGetAttrAccess);
if (rc != Success)
@ -254,8 +243,9 @@ ProcSELinuxGetPropertyContext(ClientPtr client, void *privKey)
SELinuxObjectRec *obj;
int rc;
REQUEST(SELinuxGetPropertyContextReq);
REQUEST_SIZE_MATCH(SELinuxGetPropertyContextReq);
REQUEST_HEAD_STRUCT(SELinuxGetPropertyContextReq);
REQUEST_FIELD_CARD32(window);
REQUEST_FIELD_CARD32(property);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetPropAccess);
if (rc != Success)
@ -277,8 +267,8 @@ ProcSELinuxGetSelectionContext(ClientPtr client, void *privKey)
SELinuxObjectRec *obj;
int rc;
REQUEST(SELinuxGetContextReq);
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
REQUEST_HEAD_STRUCT(SELinuxGetContextReq);
REQUEST_FIELD_CARD32(id);
rc = dixLookupSelection(&pSel, stuff->id, client, DixGetAttrAccess);
if (rc != Success)
@ -295,8 +285,8 @@ ProcSELinuxGetClientContext(ClientPtr client)
SELinuxSubjectRec *subj;
int rc;
REQUEST(SELinuxGetContextReq);
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
REQUEST_HEAD_STRUCT(SELinuxGetContextReq);
REQUEST_FIELD_CARD32(id);
rc = dixLookupResourceOwner(&target, stuff->id, client, DixGetAttrAccess);
if (rc != Success)
@ -348,10 +338,7 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
int size, int count)
{
int rc = BadAlloc, k, pos = 0;
CARD32 *buf = calloc(size, sizeof(CARD32));
if (size && !buf) {
goto out;
}
CARD32 buf[size];
if (!buf) // silence analyzer warning
goto sendreply;
@ -359,18 +346,15 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
/* Fill in the buffer */
for (k = 0; k < count; k++) {
buf[pos] = items[k].id;
if (client->swapped)
swapl(buf + pos);
REPLY_BUF_CARD32(buf + pos, 1);
pos++;
buf[pos] = items[k].octx_len * 4;
if (client->swapped)
swapl(buf + pos);
REPLY_BUF_CARD32(buf + pos, 1);
pos++;
buf[pos] = items[k].dctx_len * 4;
if (client->swapped)
swapl(buf + pos);
REPLY_BUF_CARD32(buf + pos, 1);
pos++;
memcpy((char *) (buf + pos), items[k].octx, strlen(items[k].octx) + 1);
@ -382,27 +366,15 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
sendreply: ;
/* Send reply to client */
SELinuxListItemsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = size,
.count = count
};
if (client->swapped) {
swapl(&rep.length);
swaps(&rep.sequenceNumber);
swapl(&rep.count);
}
WriteToClient(client, sizeof(SELinuxListItemsReply), &rep);
WriteToClient(client, size * 4, buf);
REPLY_FIELD_CARD32(count);
REPLY_SEND_EXTRA(buf, size * sizeof(CARD32));
/* Free stuff and return */
rc = Success;
free(buf);
out:
SELinuxFreeItems(items, count);
return rc;
return Success;
}
static int
@ -414,8 +386,8 @@ ProcSELinuxListProperties(ClientPtr client)
int rc, count, size, i;
CARD32 id;
REQUEST(SELinuxGetContextReq);
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
REQUEST_HEAD_STRUCT(SELinuxGetContextReq);
REQUEST_FIELD_CARD32(id);
rc = dixLookupWindow(&pWin, stuff->id, client, DixListPropAccess);
if (rc != Success)
@ -453,7 +425,7 @@ ProcSELinuxListSelections(ClientPtr client)
int rc, count, size, i;
CARD32 id;
REQUEST_SIZE_MATCH(SELinuxGetCreateContextReq);
REQUEST_HEAD_STRUCT(SELinuxGetCreateContextReq);
/* Count the number of selections and allocate items */
count = 0;
@ -535,151 +507,6 @@ ProcSELinuxDispatch(ClientPtr client)
}
}
static int _X_COLD
SProcSELinuxQueryVersion(ClientPtr client)
{
return ProcSELinuxQueryVersion(client);
}
static int _X_COLD
SProcSELinuxSetCreateContext(ClientPtr client, unsigned offset)
{
REQUEST(SELinuxSetCreateContextReq);
REQUEST_AT_LEAST_SIZE(SELinuxSetCreateContextReq);
swapl(&stuff->context_len);
return ProcSELinuxSetCreateContext(client, offset);
}
static int _X_COLD
SProcSELinuxSetDeviceContext(ClientPtr client)
{
REQUEST(SELinuxSetContextReq);
REQUEST_AT_LEAST_SIZE(SELinuxSetContextReq);
swapl(&stuff->id);
swapl(&stuff->context_len);
return ProcSELinuxSetDeviceContext(client);
}
static int _X_COLD
SProcSELinuxGetDeviceContext(ClientPtr client)
{
REQUEST(SELinuxGetContextReq);
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
swapl(&stuff->id);
return ProcSELinuxGetDeviceContext(client);
}
static int _X_COLD
SProcSELinuxGetDrawableContext(ClientPtr client)
{
REQUEST(SELinuxGetContextReq);
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
swapl(&stuff->id);
return ProcSELinuxGetDrawableContext(client);
}
static int _X_COLD
SProcSELinuxGetPropertyContext(ClientPtr client, void *privKey)
{
REQUEST(SELinuxGetPropertyContextReq);
REQUEST_SIZE_MATCH(SELinuxGetPropertyContextReq);
swapl(&stuff->window);
swapl(&stuff->property);
return ProcSELinuxGetPropertyContext(client, privKey);
}
static int _X_COLD
SProcSELinuxGetSelectionContext(ClientPtr client, void *privKey)
{
REQUEST(SELinuxGetContextReq);
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
swapl(&stuff->id);
return ProcSELinuxGetSelectionContext(client, privKey);
}
static int _X_COLD
SProcSELinuxListProperties(ClientPtr client)
{
REQUEST(SELinuxGetContextReq);
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
swapl(&stuff->id);
return ProcSELinuxListProperties(client);
}
static int _X_COLD
SProcSELinuxGetClientContext(ClientPtr client)
{
REQUEST(SELinuxGetContextReq);
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
swapl(&stuff->id);
return ProcSELinuxGetClientContext(client);
}
static int _X_COLD
SProcSELinuxDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_SELinuxQueryVersion:
return SProcSELinuxQueryVersion(client);
case X_SELinuxSetDeviceCreateContext:
return SProcSELinuxSetCreateContext(client, CTX_DEV);
case X_SELinuxGetDeviceCreateContext:
return ProcSELinuxGetCreateContext(client, CTX_DEV);
case X_SELinuxSetDeviceContext:
return SProcSELinuxSetDeviceContext(client);
case X_SELinuxGetDeviceContext:
return SProcSELinuxGetDeviceContext(client);
case X_SELinuxSetDrawableCreateContext:
return SProcSELinuxSetCreateContext(client, CTX_WIN);
case X_SELinuxGetDrawableCreateContext:
return ProcSELinuxGetCreateContext(client, CTX_WIN);
case X_SELinuxGetDrawableContext:
return SProcSELinuxGetDrawableContext(client);
case X_SELinuxSetPropertyCreateContext:
return SProcSELinuxSetCreateContext(client, CTX_PRP);
case X_SELinuxGetPropertyCreateContext:
return ProcSELinuxGetCreateContext(client, CTX_PRP);
case X_SELinuxSetPropertyUseContext:
return SProcSELinuxSetCreateContext(client, USE_PRP);
case X_SELinuxGetPropertyUseContext:
return ProcSELinuxGetCreateContext(client, USE_PRP);
case X_SELinuxGetPropertyContext:
return SProcSELinuxGetPropertyContext(client, objectKey);
case X_SELinuxGetPropertyDataContext:
return SProcSELinuxGetPropertyContext(client, dataKey);
case X_SELinuxListProperties:
return SProcSELinuxListProperties(client);
case X_SELinuxSetSelectionCreateContext:
return SProcSELinuxSetCreateContext(client, CTX_SEL);
case X_SELinuxGetSelectionCreateContext:
return ProcSELinuxGetCreateContext(client, CTX_SEL);
case X_SELinuxSetSelectionUseContext:
return SProcSELinuxSetCreateContext(client, USE_SEL);
case X_SELinuxGetSelectionUseContext:
return ProcSELinuxGetCreateContext(client, USE_SEL);
case X_SELinuxGetSelectionContext:
return SProcSELinuxGetSelectionContext(client, objectKey);
case X_SELinuxGetSelectionDataContext:
return SProcSELinuxGetSelectionContext(client, dataKey);
case X_SELinuxListSelections:
return ProcSELinuxListSelections(client);
case X_SELinuxGetClientContext:
return SProcSELinuxGetClientContext(client);
default:
return BadRequest;
}
}
/*
* Extension Setup / Teardown
*/
@ -715,5 +542,5 @@ SELinuxExtensionInit(void)
/* Add extension to server */
AddExtension(SELINUX_EXTENSION_NAME, SELinuxNumberEvents,
SELinuxNumberErrors, ProcSELinuxDispatch,
SProcSELinuxDispatch, SELinuxResetProc, StandardMinorOpcode);
ProcSELinuxDispatch, SELinuxResetProc, StandardMinorOpcode);
}

View File

@ -35,9 +35,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#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"

View File

@ -38,9 +38,9 @@
#include "dix/input_priv.h"
#include "dix/dix_priv.h"
#include "dix/exevents_priv.h"
#include "dix/request_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"
@ -61,6 +61,7 @@
#include "xserver-properties.h"
#include "eventstr.h"
#include "inpututils.h"
#include "extinit_priv.h"
Bool noTestExtensions = FALSE;
@ -89,35 +90,30 @@ static int XTestSwapFakeInput(ClientPtr /* client */ ,
static int
ProcXTestGetVersion(ClientPtr client)
{
REQUEST_HEAD_STRUCT(xXTestGetVersionReq);
REQUEST_FIELD_CARD16(minorVersion);
xXTestGetVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = XTestMajorVersion,
.minorVersion = XTestMinorVersion
};
REQUEST_SIZE_MATCH(xXTestGetVersionReq);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xXTestGetVersionReply), &rep);
return Success;
REPLY_FIELD_CARD16(minorVersion);
REPLY_SEND_RET_SUCCESS();
}
static int
ProcXTestCompareCursor(ClientPtr client)
{
REQUEST(xXTestCompareCursorReq);
xXTestCompareCursorReply rep;
REQUEST_HEAD_STRUCT(xXTestCompareCursorReq);
REQUEST_FIELD_CARD32(window);
REQUEST_FIELD_CARD32(cursor);
WindowPtr pWin;
CursorPtr pCursor;
int rc;
DeviceIntPtr ptr = PickPointer(client);
REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@ -137,17 +133,11 @@ ProcXTestCompareCursor(ClientPtr client)
return rc;
}
}
rep = (xXTestCompareCursorReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
xXTestCompareCursorReply rep = {
.same = (wCursor(pWin) == pCursor)
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(xXTestCompareCursorReply), &rep);
return Success;
REPLY_SEND_RET_SUCCESS();
}
void
@ -182,7 +172,14 @@ XTestDeviceSendEvents(DeviceIntPtr dev,
static int
ProcXTestFakeInput(ClientPtr client)
{
REQUEST(xXTestFakeInputReq);
REQUEST_HEAD_NO_CHECK(xXTestFakeInputReq);
if (client->swapped) {
int n = XTestSwapFakeInput(client, (xReq *)stuff);
if (n != Success)
return n;
}
int nev, n, type, rc;
xEvent *ev;
DeviceIntPtr dev = NULL;
@ -372,6 +369,7 @@ ProcXTestFakeInput(ClientPtr client)
/* swap the request back so we can simply re-execute it */
if (client->swapped) {
(void) XTestSwapFakeInput(client, (xReq *) stuff);
REQUEST_FIELD_CARD16(length);
}
ResetCurrentRequest(client);
client->sequence--;
@ -449,9 +447,8 @@ ProcXTestFakeInput(ClientPtr client)
static int
ProcXTestGrabControl(ClientPtr client)
{
REQUEST(xXTestGrabControlReq);
REQUEST_HEAD_STRUCT(xXTestGrabControlReq);
REQUEST_SIZE_MATCH(xXTestGrabControlReq);
if ((stuff->impervious != xTrue) && (stuff->impervious != xFalse)) {
client->errorValue = stuff->impervious;
return BadValue;
@ -481,25 +478,6 @@ ProcXTestDispatch(ClientPtr client)
}
}
static int _X_COLD
SProcXTestGetVersion(ClientPtr client)
{
REQUEST(xXTestGetVersionReq);
REQUEST_SIZE_MATCH(xXTestGetVersionReq);
swaps(&stuff->minorVersion);
return ProcXTestGetVersion(client);
}
static int _X_COLD
SProcXTestCompareCursor(ClientPtr client)
{
REQUEST(xXTestCompareCursorReq);
REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
swapl(&stuff->window);
swapl(&stuff->cursor);
return ProcXTestCompareCursor(client);
}
static int _X_COLD
XTestSwapFakeInput(ClientPtr client, xReq * req)
{
@ -524,37 +502,6 @@ XTestSwapFakeInput(ClientPtr client, xReq * req)
return Success;
}
static int _X_COLD
SProcXTestFakeInput(ClientPtr client)
{
int n;
REQUEST(xReq);
n = XTestSwapFakeInput(client, stuff);
if (n != Success)
return n;
return ProcXTestFakeInput(client);
}
static int _X_COLD
SProcXTestDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_XTestGetVersion:
return SProcXTestGetVersion(client);
case X_XTestCompareCursor:
return SProcXTestCompareCursor(client);
case X_XTestFakeInput:
return SProcXTestFakeInput(client);
case X_XTestGrabControl:
return ProcXTestGrabControl(client);
default:
return BadRequest;
}
}
/**
* Allocate an virtual slave device for xtest events, this
* is a slave device to inputInfo master devices
@ -686,7 +633,7 @@ void
XTestExtensionInit(void)
{
AddExtension(XTestExtensionName, 0, 0,
ProcXTestDispatch, SProcXTestDispatch,
ProcXTestDispatch, ProcXTestDispatch,
XTestExtensionTearDown, StandardMinorOpcode);
xtest_evlist = InitEventList(GetMaximumEventsNum());

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,2 @@
#ifndef XSERVER_XVDISP_H
#define XSERVER_XVDISP_H
extern void XineramifyXv(void);
extern int xvUseXinerama;
#endif /* XSERVER_XVDISP_H */

View File

@ -173,9 +173,6 @@ typedef struct {
int version, revision;
int nAdaptors;
XvAdaptorPtr pAdaptors;
void *_dummy1; // required in place of a removed field for ABI compatibility
void *_dummy2; // required in place of a removed field for ABI compatibility
void *_dummy3; // required in place of a removed field for ABI compatibility
} XvScreenRec, *XvScreenPtr;
extern _X_EXPORT int XvScreenInit(ScreenPtr);

View File

@ -2,9 +2,7 @@
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*/
#ifndef _XORG_XVDIX_PRIV_H
#define _XORG_XVDIX_PRIV_H
#include <X11/Xdefs.h>

View File

@ -82,7 +82,6 @@ SOFTWARE.
#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"
@ -94,6 +93,7 @@ SOFTWARE.
#include "pixmapstr.h"
#include "gcstruct.h"
#include "extnsionst.h"
#include "extinit_priv.h"
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
@ -183,7 +183,7 @@ XvExtensionInit(void)
XvExtensionGeneration = serverGeneration;
extEntry = AddExtension(XvName, XvNumEvents, XvNumErrors,
ProcXvDispatch, SProcXvDispatch,
ProcXvDispatch, ProcXvDispatch,
XvResetProc, StandardMinorOpcode);
if (!extEntry) {
FatalError("XvExtensionInit: AddExtensions failed\n");

View File

@ -3,14 +3,14 @@
#include <string.h>
#include <X11/X.h>
#include <X11/Xfuncproto.h>
#include <X11/Xproto.h>
#include <X11/Xfuncproto.h>
#include <X11/extensions/XvMC.h>
#include <X11/extensions/Xvproto.h>
#include <X11/extensions/XvMCproto.h>
#include "dix/request_priv.h"
#include "dix/screen_hooks_priv.h"
#include "miext/extinit_priv.h"
#include "Xext/xvdix_priv.h"
#include "misc.h"
@ -19,6 +19,7 @@
#include "resource.h"
#include "scrnintstr.h"
#include "extnsionst.h"
#include "extinit_priv.h"
#include "servermd.h"
#include "xvmcext.h"
@ -109,18 +110,16 @@ XvMCDestroySubpictureRes(void *data, XID id)
static int
ProcXvMCQueryVersion(ClientPtr client)
{
REQUEST_HEAD_STRUCT(xvmcQueryVersionReq);
xvmcQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.major = SERVER_XVMC_MAJOR_VERSION,
.minor = SERVER_XVMC_MINOR_VERSION
};
/* REQUEST(xvmcQueryVersionReq); */
REQUEST_SIZE_MATCH(xvmcQueryVersionReq);
WriteToClient(client, sizeof(xvmcQueryVersionReply), &rep);
return Success;
REPLY_FIELD_CARD32(major);
REPLY_FIELD_CARD32(minor);
REPLY_SEND_RET_SUCCESS();
}
static int
@ -130,8 +129,8 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
XvMCScreenPtr pScreenPriv;
XvMCAdaptorPtr adaptor = NULL;
REQUEST(xvmcListSurfaceTypesReq);
REQUEST_SIZE_MATCH(xvmcListSurfaceTypesReq);
REQUEST_HEAD_STRUCT(xvmcListSurfaceTypesReq);
REQUEST_FIELD_CARD32(port);
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
@ -149,36 +148,32 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
}
int num_surfaces = (adaptor) ? adaptor->num_surfaces : 0;
xvmcSurfaceInfo *info = NULL;
if (num_surfaces) {
info = calloc(sizeof(xvmcSurfaceInfo), num_surfaces);
if (!info)
return BadAlloc;
xvmcSurfaceInfo *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;
}
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;
CLIENT_STRUCT_CARD16_5(&info[i], chroma_format, max_width, max_height,
subpicture_max_width, subpicture_max_height);
CLIENT_STRUCT_CARD32_3(&info[i], surface_type_id, mc_type, flags);
}
xvmcListSurfaceTypesReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num = num_surfaces,
.length = bytes_to_int32(sizeof(xvmcSurfaceInfo) * num_surfaces),
};
WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), &rep);
WriteToClient(client, sizeof(xvmcSurfaceInfo) * num_surfaces, info);
free(info);
REPLY_FIELD_CARD32(num);
REPLY_SEND_EXTRA(info, sizeof(xvmcSurfaceInfo) * num_surfaces);
return Success;
}
@ -188,15 +183,18 @@ ProcXvMCCreateContext(ClientPtr client)
XvPortPtr pPort;
CARD32 *data = NULL;
int dwords = 0;
int result, adapt_num = -1;
int i, result, adapt_num = -1;
ScreenPtr pScreen;
XvMCContextPtr pContext;
XvMCScreenPtr pScreenPriv;
XvMCAdaptorPtr adaptor = NULL;
XvMCSurfaceInfoPtr surface = NULL;
REQUEST(xvmcCreateContextReq);
REQUEST_SIZE_MATCH(xvmcCreateContextReq);
REQUEST_HEAD_STRUCT(xvmcCreateContextReq);
REQUEST_FIELD_CARD32(context_id);
REQUEST_FIELD_CARD16(width);
REQUEST_FIELD_CARD16(height);
REQUEST_FIELD_CARD32(flags);
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
@ -208,7 +206,7 @@ ProcXvMCCreateContext(ClientPtr client)
if (!(pScreenPriv = XVMC_GET_PRIVATE(pScreen))) /* none this screen */
return BadMatch;
for (int i = 0; i < pScreenPriv->num_adaptors; i++) {
for (i = 0; i < pScreenPriv->num_adaptors; i++) {
if (pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
adaptor = &(pScreenPriv->adaptors[i]);
adapt_num = i;
@ -219,7 +217,7 @@ ProcXvMCCreateContext(ClientPtr client)
if (adapt_num < 0) /* none this port */
return BadMatch;
for (int i = 0; i < adaptor->num_surfaces; i++) {
for (i = 0; i < adaptor->num_surfaces; i++) {
if (adaptor->surfaces[i]->surface_type_id == stuff->surface_type_id) {
surface = adaptor->surfaces[i];
break;
@ -259,32 +257,30 @@ ProcXvMCCreateContext(ClientPtr client)
}
xvmcCreateContextReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = dwords,
.width_actual = pContext->width,
.height_actual = pContext->height,
.flags_return = pContext->flags
};
WriteToClient(client, sizeof(xvmcCreateContextReply), &rep);
if (dwords)
WriteToClient(client, dwords << 2, data);
REPLY_FIELD_CARD16(width_actual);
REPLY_FIELD_CARD16(height_actual);
REPLY_FIELD_CARD32(flags_return);
REPLY_BUF_CARD32(data, dwords);
REPLY_SEND_EXTRA(data, dwords * sizeof(CARD32));
free(data);
return Success;
}
static int
ProcXvMCDestroyContext(ClientPtr client)
{
REQUEST_HEAD_STRUCT(xvmcDestroyContextReq);
REQUEST_FIELD_CARD32(context_id);
void *val;
int rc;
REQUEST(xvmcDestroyContextReq);
REQUEST_SIZE_MATCH(xvmcDestroyContextReq);
rc = dixLookupResourceByType(&val, stuff->context_id, XvMCRTContext,
client, DixDestroyAccess);
if (rc != Success)
@ -298,6 +294,10 @@ ProcXvMCDestroyContext(ClientPtr client)
static int
ProcXvMCCreateSurface(ClientPtr client)
{
REQUEST_HEAD_STRUCT(xvmcCreateSurfaceReq);
REQUEST_FIELD_CARD32(surface_id);
REQUEST_FIELD_CARD32(context_id);
CARD32 *data = NULL;
int dwords = 0;
int result;
@ -305,9 +305,6 @@ ProcXvMCCreateSurface(ClientPtr client)
XvMCSurfacePtr pSurface;
XvMCScreenPtr pScreenPriv;
REQUEST(xvmcCreateSurfaceReq);
REQUEST_SIZE_MATCH(xvmcCreateSurfaceReq);
result = dixLookupResourceByType((void **) &pContext, stuff->context_id,
XvMCRTContext, client, DixUseAccess);
if (result != Success)
@ -336,15 +333,10 @@ ProcXvMCCreateSurface(ClientPtr client)
return BadAlloc;
}
xvmcCreateSurfaceReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = dwords
};
xvmcCreateSurfaceReply rep = { 0 };
WriteToClient(client, sizeof(xvmcCreateSurfaceReply), &rep);
if (dwords)
WriteToClient(client, dwords << 2, data);
REPLY_BUF_CARD32(data, dwords);
REPLY_SEND_EXTRA(data, dwords * sizeof(CARD32));
free(data);
@ -356,12 +348,12 @@ ProcXvMCCreateSurface(ClientPtr client)
static int
ProcXvMCDestroySurface(ClientPtr client)
{
REQUEST_HEAD_STRUCT(xvmcDestroySurfaceReq);
REQUEST_FIELD_CARD32(surface_id);
void *val;
int rc;
REQUEST(xvmcDestroySurfaceReq);
REQUEST_SIZE_MATCH(xvmcDestroySurfaceReq);
rc = dixLookupResourceByType(&val, stuff->surface_id, XvMCRTSurface,
client, DixDestroyAccess);
if (rc != Success)
@ -375,18 +367,22 @@ ProcXvMCDestroySurface(ClientPtr client)
static int
ProcXvMCCreateSubpicture(ClientPtr client)
{
REQUEST_HEAD_STRUCT(xvmcCreateSubpictureReq);
REQUEST_FIELD_CARD32(subpicture_id);
REQUEST_FIELD_CARD32(context_id);
REQUEST_FIELD_CARD32(xvimage_id);
REQUEST_FIELD_CARD16(width);
REQUEST_FIELD_CARD16(height);
Bool image_supported = FALSE;
CARD32 *data = NULL;
int result, dwords = 0;
int i, result, dwords = 0;
XvMCContextPtr pContext;
XvMCSubpicturePtr pSubpicture;
XvMCScreenPtr pScreenPriv;
XvMCAdaptorPtr adaptor;
XvMCSurfaceInfoPtr surface = NULL;
REQUEST(xvmcCreateSubpictureReq);
REQUEST_SIZE_MATCH(xvmcCreateSubpictureReq);
result = dixLookupResourceByType((void **) &pContext, stuff->context_id,
XvMCRTContext, client, DixUseAccess);
if (result != Success)
@ -397,7 +393,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
adaptor = &(pScreenPriv->adaptors[pContext->adapt_num]);
/* find which surface this context supports */
for (int i = 0; i < adaptor->num_surfaces; i++) {
for (i = 0; i < adaptor->num_surfaces; i++) {
if (adaptor->surfaces[i]->surface_type_id == pContext->surface_type_id) {
surface = adaptor->surfaces[i];
break;
@ -411,7 +407,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
if (!surface->compatible_subpictures)
return BadMatch;
for (int i = 0; i < surface->compatible_subpictures->num_xvimages; i++) {
for (i = 0; i < surface->compatible_subpictures->num_xvimages; i++) {
if (surface->compatible_subpictures->xvimage_ids[i] ==
stuff->xvimage_id) {
image_supported = TRUE;
@ -456,9 +452,6 @@ ProcXvMCCreateSubpicture(ClientPtr client)
}
xvmcCreateSubpictureReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = dwords,
.width_actual = pSubpicture->width,
.height_actual = pSubpicture->height,
.num_palette_entries = pSubpicture->num_palette_entries,
@ -469,9 +462,12 @@ ProcXvMCCreateSubpicture(ClientPtr client)
.component_order[3] = pSubpicture->component_order[3]
};
WriteToClient(client, sizeof(xvmcCreateSubpictureReply), &rep);
if (dwords)
WriteToClient(client, dwords << 2, data);
REPLY_FIELD_CARD16(width_actual);
REPLY_FIELD_CARD16(height_actual);
REPLY_FIELD_CARD16(num_palette_entries);
REPLY_FIELD_CARD16(entry_bytes);
REPLY_BUF_CARD32(data, dwords);
REPLY_SEND_EXTRA(data, dwords * sizeof(CARD32));
free(data);
@ -483,12 +479,12 @@ ProcXvMCCreateSubpicture(ClientPtr client)
static int
ProcXvMCDestroySubpicture(ClientPtr client)
{
REQUEST_HEAD_STRUCT(xvmcDestroySubpictureReq);
REQUEST_FIELD_CARD32(subpicture_id);
void *val;
int rc;
REQUEST(xvmcDestroySubpictureReq);
REQUEST_SIZE_MATCH(xvmcDestroySubpictureReq);
rc = dixLookupResourceByType(&val, stuff->subpicture_id, XvMCRTSubpicture,
client, DixDestroyAccess);
if (rc != Success)
@ -502,15 +498,17 @@ ProcXvMCDestroySubpicture(ClientPtr client)
static int
ProcXvMCListSubpictureTypes(ClientPtr client)
{
REQUEST_HEAD_STRUCT(xvmcListSubpictureTypesReq);
REQUEST_FIELD_CARD32(port);
REQUEST_FIELD_CARD32(surface_type_id);
XvPortPtr pPort;
XvMCScreenPtr pScreenPriv;
ScreenPtr pScreen;
XvMCAdaptorPtr adaptor = NULL;
XvMCSurfaceInfoPtr surface = NULL;
XvImagePtr pImage;
REQUEST(xvmcListSubpictureTypesReq);
REQUEST_SIZE_MATCH(xvmcListSubpictureTypesReq);
int i, j;
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
@ -522,7 +520,7 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
if (!(pScreenPriv = XVMC_GET_PRIVATE(pScreen)))
return BadMatch; /* None this screen */
for (int i = 0; i < pScreenPriv->num_adaptors; i++) {
for (i = 0; i < pScreenPriv->num_adaptors; i++) {
if (pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
adaptor = &(pScreenPriv->adaptors[i]);
break;
@ -532,7 +530,7 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
if (!adaptor)
return BadMatch;
for (int i = 0; i < adaptor->num_surfaces; i++) {
for (i = 0; i < adaptor->num_surfaces; i++) {
if (adaptor->surfaces[i]->surface_type_id == stuff->surface_type_id) {
surface = adaptor->surfaces[i];
break;
@ -545,67 +543,63 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
int num = (surface->compatible_subpictures ?
surface->compatible_subpictures->num_xvimages : 0);
xvImageFormatInfo *info = NULL;
if (num) {
info = calloc(sizeof(xvImageFormatInfo), num);
if (!info)
return BadAlloc;
for (int i = 0; i < num; i++) {
pImage = NULL;
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;
}
xvImageFormatInfo info[num];
for (i = 0; i < num; i++) {
pImage = NULL;
for (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) {
free(info);
return BadImplementation;
}
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;
}
if (!pImage)
return BadImplementation;
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;
CLIENT_STRUCT_CARD32_5(&info[i], id, red_mask, green_mask, blue_mask, y_sample_bits);
CLIENT_STRUCT_CARD32_5(&info[i], u_sample_bits, v_sample_bits, horz_y_period, horz_u_period, horz_v_period);
CLIENT_STRUCT_CARD32_3(&info[i], vert_y_period, vert_u_period, vert_v_period);
}
xvmcListSubpictureTypesReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num = num,
.length = bytes_to_int32(num * sizeof(xvImageFormatInfo)),
};
WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), &rep);
WriteToClient(client, sizeof(xvImageFormatInfo) * num, info);
free(info);
REPLY_SEND_EXTRA(info, sizeof(info));
return Success;
}
static int
ProcXvMCGetDRInfo(ClientPtr client)
{
REQUEST_HEAD_STRUCT(xvmcGetDRInfoReq);
REQUEST_FIELD_CARD32(port);
REQUEST_FIELD_CARD32(shmKey);
REQUEST_FIELD_CARD32(magic);
XvPortPtr pPort;
ScreenPtr pScreen;
XvMCScreenPtr pScreenPriv;
@ -614,9 +608,6 @@ ProcXvMCGetDRInfo(ClientPtr client)
volatile CARD32 *patternP;
#endif
REQUEST(xvmcGetDRInfoReq);
REQUEST_SIZE_MATCH(xvmcGetDRInfoReq);
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
pScreen = pPort->pAdaptor->pScreen;
@ -626,23 +617,17 @@ ProcXvMCGetDRInfo(ClientPtr client)
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;
char buf[pad_to_int32(nameLen+busIDLen)];
memset(buf, 0, sizeof(buf));
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 = nameLen,
.busIDLen = busIDLen,
.length = bytes_to_int32(sizeof(buf)),
.isLocal = 1
};
@ -672,9 +657,13 @@ ProcXvMCGetDRInfo(ClientPtr client)
}
#endif /* HAS_XVMCSHM */
WriteToClient(client, sizeof(xvmcGetDRInfoReply), &rep);
WriteToClient(client, buflen, buf);
free(buf);
REPLY_FIELD_CARD32(major);
REPLY_FIELD_CARD32(minor);
REPLY_FIELD_CARD32(patchLevel);
REPLY_FIELD_CARD32(nameLen);
REPLY_FIELD_CARD32(busIDLen);
REPLY_FIELD_CARD32(isLocal);
REPLY_SEND_EXTRA(buf, sizeof(buf));
return Success;
}
@ -709,13 +698,6 @@ ProcXvMCDispatch(ClientPtr client)
}
}
static int _X_COLD
SProcXvMCDispatch(ClientPtr client)
{
/* We only support local */
return BadImplementation;
}
void
XvMCExtensionInit(void)
{
@ -737,7 +719,7 @@ XvMCExtensionInit(void)
return;
extEntry = AddExtension(XvMCName, XvMCNumEvents, XvMCNumErrors,
ProcXvMCDispatch, SProcXvMCDispatch,
ProcXvMCDispatch, ProcXvMCDispatch,
NULL, StandardMinorOpcode);
if (!extEntry)
@ -796,6 +778,7 @@ XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
ScreenPtr pScreen = pPort->pAdaptor->pScreen;
XvMCScreenPtr pScreenPriv;
XvMCAdaptorPtr adaptor = NULL;
int i;
if (!dixPrivateKeyRegistered(XvMCScreenKey))
return NULL;
@ -803,7 +786,7 @@ XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
if (!(pScreenPriv = XVMC_GET_PRIVATE(pScreen)))
return NULL;
for (int i = 0; i < pScreenPriv->num_adaptors; i++) {
for (i = 0; i < pScreenPriv->num_adaptors; i++) {
if (pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
adaptor = &(pScreenPriv->adaptors[i]);
break;
@ -813,7 +796,7 @@ XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
if (!adaptor)
return NULL;
for (int i = 0; i < adaptor->num_subpictures; i++) {
for (i = 0; i < adaptor->num_subpictures; i++) {
if (adaptor->subpictures[i]->id == id) {
pImage = adaptor->subpictures[i];
break;

View File

@ -58,25 +58,11 @@ SOFTWARE.
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "dix/request_priv.h"
#include "exglobals.h"
#include "allowev.h"
/***********************************************************************
*
* This procedure allows frozen events to be routed.
*
*/
int _X_COLD
SProcXAllowDeviceEvents(ClientPtr client)
{
REQUEST(xAllowDeviceEventsReq);
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
swapl(&stuff->time);
return (ProcXAllowDeviceEvents(client));
}
/***********************************************************************
*
* This procedure allows frozen events to be routed.
@ -90,8 +76,8 @@ ProcXAllowDeviceEvents(ClientPtr client)
DeviceIntPtr thisdev;
int rc;
REQUEST(xAllowDeviceEventsReq);
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
REQUEST_HEAD_STRUCT(xAllowDeviceEventsReq);
REQUEST_FIELD_CARD32(time);
rc = dixLookupDevice(&thisdev, stuff->deviceid, client, DixGetAttrAccess);
if (rc != Success)

View File

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef ALLOWEV_H
#define ALLOWEV_H 1
int SProcXAllowDeviceEvents(ClientPtr /* client */
);
int ProcXAllowDeviceEvents(ClientPtr /* client */
);

View File

@ -57,6 +57,7 @@ SOFTWARE.
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#include "dix/request_priv.h"
#include "dix/resource_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
@ -64,37 +65,6 @@ SOFTWARE.
#include "exglobals.h"
#include "chgdctl.h"
/***********************************************************************
*
* This procedure changes the control attributes for an extension device,
* for clients on machines with a different byte ordering than the server.
*
*/
int _X_COLD
SProcXChangeDeviceControl(ClientPtr client)
{
xDeviceCtl *ctl;
REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl));
swaps(&stuff->control);
ctl = (xDeviceCtl *) &stuff[1];
swaps(&ctl->control);
swaps(&ctl->length);
switch (stuff->control) {
case DEVICE_ABS_CALIB:
case DEVICE_ABS_AREA:
case DEVICE_CORE:
case DEVICE_ENABLE:
case DEVICE_RESOLUTION:
/* hmm. beer. *drool* */
break;
}
return (ProcXChangeDeviceControl(client));
}
/***********************************************************************
*
* Change the control attributes.
@ -104,6 +74,11 @@ SProcXChangeDeviceControl(ClientPtr client)
int
ProcXChangeDeviceControl(ClientPtr client)
{
REQUEST_HEAD_AT_LEAST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl));
REQUEST_FIELD_CARD16(control);
CLIENT_STRUCT_CARD16_2((xDeviceCtl*)&stuff[1], control, length);
unsigned len;
int i, status, ret = BadValue;
DeviceIntPtr dev;
@ -112,9 +87,6 @@ ProcXChangeDeviceControl(ClientPtr client)
CARD32 *resolution;
xDeviceEnableCtl *e;
REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl));
len = client->req_len - bytes_to_int32(sizeof(xChangeDeviceControlReq));
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
if (ret != Success)
@ -128,7 +100,6 @@ ProcXChangeDeviceControl(ClientPtr client)
xChangeDeviceControlReply rep = {
.RepType = X_ChangeDeviceControl,
.sequenceNumber = client->sequence,
.status = Success,
};
@ -230,10 +201,7 @@ ProcXChangeDeviceControl(ClientPtr client)
SendEventToAllWindows(dev, DevicePresenceNotifyMask,
(xEvent *) &dpn, 1);
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(xChangeDeviceControlReply), &rep);
REPLY_SEND();
}
return ret;

View File

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CHGDCTL_H
#define CHGDCTL_H 1
int SProcXChangeDeviceControl(ClientPtr /* client */
);
int ProcXChangeDeviceControl(ClientPtr /* client */
);

View File

@ -52,32 +52,18 @@ SOFTWARE.
#include <dix-config.h>
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> /* control constants */
#include "dix/request_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "exglobals.h"
#include "chgfctl.h"
#define DO_ALL (-1)
/***********************************************************************
*
* This procedure changes the control attributes for an extension device,
* for clients on machines with a different byte ordering than the server.
*
*/
int _X_COLD
SProcXChangeFeedbackControl(ClientPtr client)
{
REQUEST(xChangeFeedbackControlReq);
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
swapl(&stuff->mask);
return (ProcXChangeFeedbackControl(client));
}
/******************************************************************************
*
* This procedure changes KbdFeedbackClass data.
@ -92,13 +78,8 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
int t;
int key = DO_ALL;
if (client->swapped) {
swaps(&f->length);
swaps(&f->pitch);
swaps(&f->duration);
swapl(&f->led_mask);
swapl(&f->led_values);
}
CLIENT_STRUCT_CARD16_3(f, length, pitch, duration);
CLIENT_STRUCT_CARD32_2(f, led_mask, led_values);
kctrl = k->ctrl;
if (mask & DvKeyClickPercent) {
@ -209,12 +190,7 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
{
PtrCtrl pctrl; /* might get BadValue part way through */
if (client->swapped) {
swaps(&f->length);
swaps(&f->num);
swaps(&f->denom);
swaps(&f->thresh);
}
CLIENT_STRUCT_CARD16_4(f, length, num, denom, thresh);
pctrl = p->ctrl;
if (mask & DvAccelNum) {
@ -275,10 +251,8 @@ ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev,
long unsigned int mask, IntegerFeedbackPtr i,
xIntegerFeedbackCtl * f)
{
if (client->swapped) {
swaps(&f->length);
swapl(&f->int_to_display);
}
CLIENT_STRUCT_CARD16_1(f, length);
CLIENT_STRUCT_CARD32_1(f, int_to_display);
i->ctrl.integer_displayed = f->int_to_display;
(*i->CtrlProc) (dev, &i->ctrl);
@ -300,10 +274,9 @@ ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev,
KeySym *syms, *sup_syms;
syms = (KeySym *) (f + 1);
if (client->swapped) {
swaps(&f->length); /* swapped num_keysyms in calling proc */
SwapLongs((CARD32 *) syms, f->num_keysyms);
}
CLIENT_STRUCT_CARD16_1(f, length); /* swapped num_keysyms in calling proc */
REQUEST_BUF_CARD32((CARD32 *) syms, f->num_keysyms);
if (f->num_keysyms > s->ctrl.max_symbols)
return BadValue;
@ -338,11 +311,7 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
int t;
BellCtrl bctrl; /* might get BadValue part way through */
if (client->swapped) {
swaps(&f->length);
swaps(&f->pitch);
swaps(&f->duration);
}
CLIENT_STRUCT_CARD16_3(f, length, pitch, duration);
bctrl = b->ctrl;
if (mask & DvPercent) {
@ -394,11 +363,8 @@ ChangeLedFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
{
LedCtrl lctrl; /* might get BadValue part way through */
if (client->swapped) {
swaps(&f->length);
swapl(&f->led_values);
swapl(&f->led_mask);
}
CLIENT_STRUCT_CARD16_1(f, length);
CLIENT_STRUCT_CARD32_2(f, led_values, led_mask);
f->led_mask &= l->ctrl.led_mask; /* set only supported leds */
f->led_values &= l->ctrl.led_mask; /* set only supported leds */
@ -432,8 +398,8 @@ ProcXChangeFeedbackControl(ClientPtr client)
LedFeedbackPtr l;
int rc;
REQUEST(xChangeFeedbackControlReq);
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
REQUEST_HEAD_AT_LEAST(xChangeFeedbackControlReq);
REQUEST_FIELD_CARD32(mask);
len = client->req_len - bytes_to_int32(sizeof(xChangeFeedbackControlReq));
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
@ -466,11 +432,7 @@ ProcXChangeFeedbackControl(ClientPtr client)
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeFeedbackControlReq,
sizeof(xStringFeedbackCtl));
f = ((xStringFeedbackCtl *) &stuff[1]);
if (client->swapped) {
if (len < bytes_to_int32(sizeof(xStringFeedbackCtl)))
return BadLength;
swaps(&f->num_keysyms);
}
CLIENT_STRUCT_CARD16_1(f, num_keysyms);
if (len !=
(bytes_to_int32(sizeof(xStringFeedbackCtl)) + f->num_keysyms))
return BadLength;

View File

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CHGFCTL_H
#define CHGFCTL_H 1
int SProcXChangeFeedbackControl(ClientPtr /* client */
);
int ProcXChangeFeedbackControl(ClientPtr /* client */
);

View File

@ -52,12 +52,14 @@ SOFTWARE.
#include <dix-config.h>
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/request_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "XIstubs.h"
#include "globals.h"
#include "exevents.h"
#include "exglobals.h"
@ -72,8 +74,7 @@ SOFTWARE.
int
ProcXChangeKeyboardDevice(ClientPtr client)
{
/* REQUEST(xChangeKeyboardDeviceReq); */
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
REQUEST_HEAD_STRUCT(xChangeKeyboardDeviceReq);
return BadDevice;
}

View File

@ -56,32 +56,13 @@ SOFTWARE.
#include <X11/extensions/XIproto.h>
#include "dix/exevents_priv.h"
#include "dix/request_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "exglobals.h"
#include "chgkmap.h"
/***********************************************************************
*
* This procedure swaps the request when the client and
* server have different byte orderings.
*
*/
int _X_COLD
SProcXChangeDeviceKeyMapping(ClientPtr client)
{
unsigned int count;
REQUEST(xChangeDeviceKeyMappingReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
count = stuff->keyCodes * stuff->keySymsPerKeyCode;
REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), count);
return (ProcXChangeDeviceKeyMapping(client));
}
/***********************************************************************
*
* Change the device key mapping.
@ -96,11 +77,10 @@ ProcXChangeDeviceKeyMapping(ClientPtr client)
DeviceIntPtr dev;
unsigned int count;
REQUEST(xChangeDeviceKeyMappingReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
REQUEST_HEAD_AT_LEAST(xChangeDeviceKeyMappingReq);
count = stuff->keyCodes * stuff->keySymsPerKeyCode;
REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32));
REQUEST_BUF_CARD32(&stuff[1], count);
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
if (ret != Success)

View File

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CHGKMAP_H
#define CHGKMAP_H 1
int SProcXChangeDeviceKeyMapping(ClientPtr /* client */
);
int ProcXChangeDeviceKeyMapping(ClientPtr /* client */
);

View File

@ -57,6 +57,7 @@ SOFTWARE.
#include "dix/dix_priv.h"
#include "dix/exevents_priv.h"
#include "dix/request_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h"
@ -65,25 +66,6 @@ SOFTWARE.
#include "chgprop.h"
#include "grabdev.h"
/***********************************************************************
*
* This procedure returns the extension version.
*
*/
int _X_COLD
SProcXChangeDeviceDontPropagateList(ClientPtr client)
{
REQUEST(xChangeDeviceDontPropagateListReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
swapl(&stuff->window);
swaps(&stuff->count);
REQUEST_FIXED_SIZE(xChangeDeviceDontPropagateListReq,
stuff->count * sizeof(CARD32));
SwapLongs((CARD32 *) (&stuff[1]), stuff->count);
return (ProcXChangeDeviceDontPropagateList(client));
}
/***********************************************************************
*
* This procedure changes the dont-propagate list for the specified window.
@ -98,13 +80,12 @@ ProcXChangeDeviceDontPropagateList(ClientPtr client)
struct tmask tmp[EMASKSIZE];
OtherInputMasks *others;
REQUEST(xChangeDeviceDontPropagateListReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
if (client->req_len !=
bytes_to_int32(sizeof(xChangeDeviceDontPropagateListReq)) +
stuff->count)
return BadLength;
REQUEST_HEAD_AT_LEAST(xChangeDeviceDontPropagateListReq);
REQUEST_FIELD_CARD32(window);
REQUEST_FIELD_CARD16(count);
REQUEST_FIXED_SIZE(xChangeDeviceDontPropagateListReq,
stuff->count * sizeof(CARD32));
REQUEST_BUF_CARD32(&stuff[1], stuff->count);
rc = dixLookupWindow(&pWin, stuff->window, client, DixSetAttrAccess);
if (rc != Success)

View File

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef CHGPROP_H
#define CHGPROP_H 1
int SProcXChangeDeviceDontPropagateList(ClientPtr /* client */
);
int ProcXChangeDeviceDontPropagateList(ClientPtr /* client */
);

View File

@ -52,13 +52,15 @@ SOFTWARE.
#include <dix-config.h>
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/request_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "XIstubs.h"
#include "windowstr.h" /* window structure */
#include "scrnintstr.h" /* screen structure */
#include "exevents.h"
#include "exglobals.h"
@ -73,8 +75,7 @@ SOFTWARE.
int
ProcXChangePointerDevice(ClientPtr client)
{
/* REQUEST(xChangePointerDeviceReq); */
REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
REQUEST_HEAD_STRUCT(xChangePointerDeviceReq);
return BadDevice;
}

View File

@ -55,6 +55,7 @@ SOFTWARE.
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/request_priv.h"
#include "dix/resource_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
@ -125,8 +126,7 @@ ProcXCloseDevice(ClientPtr client)
WindowPtr pWin, p1;
DeviceIntPtr d;
REQUEST(xCloseDeviceReq);
REQUEST_SIZE_MATCH(xCloseDeviceReq);
REQUEST_HEAD_STRUCT(xCloseDeviceReq);
rc = dixLookupDevice(&d, stuff->deviceid, client, DixUseAccess);
if (rc != Success)

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/request_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "exglobals.h"
#include "devbell.h"
@ -77,8 +80,7 @@ ProcXDeviceBell(ClientPtr client)
void *ctrl;
BellProcPtr proc;
REQUEST(xDeviceBellReq);
REQUEST_SIZE_MATCH(xDeviceBellReq);
REQUEST_HEAD_STRUCT(xDeviceBellReq);
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixBellAccess);
if (rc != Success) {

View File

@ -97,10 +97,7 @@ SOFTWARE.
#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"
@ -115,6 +112,7 @@ SOFTWARE.
#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 ( \
@ -1568,7 +1566,7 @@ static void
DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
InternalEvent *ev)
{
InternalEvent motion;
DeviceEvent motion;
if (ti->num_listeners) {
ClientPtr client;
@ -1580,27 +1578,27 @@ DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
ti->listeners[0].type != TOUCH_LISTENER_POINTER_GRAB)
return;
motion.device_event = ev->device_event;
motion.device_event.type = ET_TouchUpdate;
motion.device_event.detail.button = 0;
motion = ev->device_event;
motion.type = ET_TouchUpdate;
motion.detail.button = 0;
if (!RetrieveTouchDeliveryData(dev, ti, &motion,
if (!RetrieveTouchDeliveryData(dev, ti, (InternalEvent*)&motion,
&ti->listeners[0], &client, &win, &grab,
&mask))
return;
DeliverTouchEmulatedEvent(dev, ti, &motion, &ti->listeners[0], client,
DeliverTouchEmulatedEvent(dev, ti, (InternalEvent*)&motion, &ti->listeners[0], client,
win, grab, mask);
}
else {
InternalEvent button;
int converted;
converted = TouchConvertToPointerEvent(ev, &motion, &button);
converted = TouchConvertToPointerEvent(ev, (InternalEvent*)&motion, &button);
BUG_WARN(converted == 0);
if (converted)
ProcessOtherEvent(&motion, dev);
ProcessOtherEvent((InternalEvent*)&motion, dev);
}
}
@ -2740,7 +2738,7 @@ AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx)
{
InputClientsPtr others;
if (!MakeWindowOptional(pWin))
if (!pWin->optional && !MakeWindowOptional(pWin))
return BadAlloc;
others = AllocInputClient();
if (!others)
@ -2860,7 +2858,7 @@ InputClientGone(WindowPtr pWin, XID id)
FreeInputClient(&other);
}
else {
other->resource = dixAllocServerXID();
other->resource = FakeClientID(0);
if (!AddResource(other->resource, RT_INPUTCLIENT,
(void *) pWin))
return BadAlloc;

View File

@ -61,15 +61,14 @@ SOFTWARE.
#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 "extinit_priv.h"
#include "exglobals.h"
#include "swaprep.h"
#include "privates.h"
@ -381,152 +380,6 @@ ProcIDispatch(ClientPtr client)
}
}
/*******************************************************************************
*
* SProcXDispatch
*
* Main swapped dispatch routine for requests to this extension.
* This routine is used if server and client do not have the same byte ordering.
*
*/
static int _X_COLD
SProcIDispatch(ClientPtr client)
{
REQUEST(xReq);
UpdateCurrentTimeIf();
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;
}
}
/************************************************************************
*
* This function swaps the DeviceValuator event.
@ -1345,7 +1198,7 @@ XInputExtensionInit(void)
FatalError("Could not initialize barriers.\n");
extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
SProcIDispatch, IResetProc, StandardMinorOpcode);
ProcIDispatch, IResetProc, StandardMinorOpcode);
if (extEntry) {
assert(extEntry->base == EXTENSION_MAJOR_XINPUT);

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/request_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "exglobals.h"
#include "getbmap.h"
@ -72,8 +75,7 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
ButtonClassPtr b;
int rc;
REQUEST(xGetDeviceButtonMappingReq);
REQUEST_SIZE_MATCH(xGetDeviceButtonMappingReq);
REQUEST_HEAD_STRUCT(xGetDeviceButtonMappingReq);
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
if (rc != Success)
@ -84,18 +86,11 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
return BadMatch;
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]);
REPLY_SEND_EXTRA(&b->map[1], rep.nElts);
return Success;
}

View File

@ -52,29 +52,16 @@ SOFTWARE.
#include <dix-config.h>
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/request_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "exglobals.h"
#include "getdctl.h"
/***********************************************************************
*
* This procedure gets the control attributes for an extension device,
* for clients on machines with a different byte ordering than the server.
*
*/
int _X_COLD
SProcXGetDeviceControl(ClientPtr client)
{
REQUEST(xGetDeviceControlReq);
REQUEST_SIZE_MATCH(xGetDeviceControlReq);
swaps(&stuff->control);
return (ProcXGetDeviceControl(client));
}
/***********************************************************************
*
* This procedure copies DeviceResolution data, swapping if necessary.
@ -101,15 +88,10 @@ CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
*iptr++ = a->min_resolution;
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
*iptr++ = a->max_resolution;
if (client->swapped) {
swaps(&r->control);
swaps(&r->length);
swapl(&r->num_valuators);
iptr = (int *) buf;
for (i = 0; i < (3 * v->numAxes); i++, iptr++) {
swapl(iptr);
}
}
CLIENT_STRUCT_CARD16_2(r, control, length);
CLIENT_STRUCT_CARD32_1(r, num_valuators);
REPLY_BUF_CARD32(buf, (3 * v->numAxes));
}
static void
@ -122,10 +104,7 @@ CopySwapDeviceCore(ClientPtr client, DeviceIntPtr dev, char *buf)
c->status = dev->coreEvents;
c->iscore = (dev == inputInfo.keyboard || dev == inputInfo.pointer);
if (client->swapped) {
swaps(&c->control);
swaps(&c->length);
}
CLIENT_STRUCT_CARD16_2(c, control, length);
}
static void
@ -137,10 +116,7 @@ CopySwapDeviceEnable(ClientPtr client, DeviceIntPtr dev, char *buf)
e->length = sizeof(xDeviceEnableState);
e->enable = dev->enabled;
if (client->swapped) {
swaps(&e->control);
swaps(&e->length);
}
CLIENT_STRUCT_CARD16_2(e, control, length);
}
/***********************************************************************
@ -153,11 +129,10 @@ int
ProcXGetDeviceControl(ClientPtr client)
{
int rc, total_length = 0;
char *savbuf;
DeviceIntPtr dev;
REQUEST(xGetDeviceControlReq);
REQUEST_SIZE_MATCH(xGetDeviceControlReq);
REQUEST_HEAD_STRUCT(xGetDeviceControlReq);
REQUEST_FIELD_CARD16(control);
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
if (rc != Success)
@ -186,7 +161,7 @@ ProcXGetDeviceControl(ClientPtr client)
char *buf = calloc(1, total_length);
if (!buf)
return BadAlloc;
savbuf = buf;
char *savbuf = buf;
switch (stuff->control) {
case DEVICE_RESOLUTION:
@ -203,18 +178,10 @@ ProcXGetDeviceControl(ClientPtr client)
}
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);
REPLY_SEND_EXTRA(buf, total_length);
free(savbuf);
return Success;
}

View File

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETDCTL_H
#define GETDCTL_H 1
int SProcXGetDeviceControl(ClientPtr /* client */
);
int ProcXGetDeviceControl(ClientPtr /* client */
);

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/request_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "exglobals.h"
#include "getfctl.h"
@ -83,13 +86,10 @@ CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf)
k2->global_auto_repeat = k->ctrl.autoRepeat;
for (i = 0; i < 32; i++)
k2->auto_repeats[i] = k->ctrl.autoRepeats[i];
if (client->swapped) {
swaps(&k2->length);
swaps(&k2->pitch);
swaps(&k2->duration);
swapl(&k2->led_mask);
swapl(&k2->led_values);
}
CLIENT_STRUCT_CARD16_3(k2, length, pitch, duration);
CLIENT_STRUCT_CARD32_2(k2, led_mask, led_values);
*buf += sizeof(xKbdFeedbackState);
}
@ -111,12 +111,9 @@ CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf)
p2->accelNum = p->ctrl.num;
p2->accelDenom = p->ctrl.den;
p2->threshold = p->ctrl.threshold;
if (client->swapped) {
swaps(&p2->length);
swaps(&p2->accelNum);
swaps(&p2->accelDenom);
swaps(&p2->threshold);
}
CLIENT_STRUCT_CARD16_4(p2, length, accelNum, accelDenom, threshold);
*buf += sizeof(xPtrFeedbackState);
}
@ -138,12 +135,10 @@ CopySwapIntegerFeedback(ClientPtr client, IntegerFeedbackPtr i, char **buf)
i2->resolution = i->ctrl.resolution;
i2->min_value = i->ctrl.min_value;
i2->max_value = i->ctrl.max_value;
if (client->swapped) {
swaps(&i2->length);
swapl(&i2->resolution);
swapl(&i2->min_value);
swapl(&i2->max_value);
}
CLIENT_STRUCT_CARD16_1(i2, length);
CLIENT_STRUCT_CARD32_3(i2, resolution, min_value, max_value);
*buf += sizeof(xIntegerFeedbackState);
}
@ -171,15 +166,10 @@ CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf)
kptr = (KeySym *) (*buf);
for (i = 0; i < s->ctrl.num_symbols_supported; i++)
*kptr++ = *(s->ctrl.symbols_supported + i);
if (client->swapped) {
swaps(&s2->length);
swaps(&s2->max_symbols);
swaps(&s2->num_syms_supported);
kptr = (KeySym *) (*buf);
for (i = 0; i < s->ctrl.num_symbols_supported; i++, kptr++) {
swapl(kptr);
}
}
CLIENT_STRUCT_CARD16_3(s2, length, max_symbols, num_syms_supported);
REPLY_BUF_CARD32((CARD32*)buf, s->ctrl.num_symbols_supported);
*buf += (s->ctrl.num_symbols_supported * sizeof(KeySym));
}
@ -200,11 +190,10 @@ CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf)
l2->id = l->ctrl.id;
l2->led_values = l->ctrl.led_values;
l2->led_mask = l->ctrl.led_mask;
if (client->swapped) {
swaps(&l2->length);
swapl(&l2->led_values);
swapl(&l2->led_mask);
}
CLIENT_STRUCT_CARD16_1(l2, length);
CLIENT_STRUCT_CARD32_2(l2, led_values, led_mask);
*buf += sizeof(xLedFeedbackState);
}
@ -226,11 +215,9 @@ CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf)
b2->percent = b->ctrl.percent;
b2->pitch = b->ctrl.pitch;
b2->duration = b->ctrl.duration;
if (client->swapped) {
swaps(&b2->length);
swaps(&b2->pitch);
swaps(&b2->duration);
}
CLIENT_STRUCT_CARD16_3(b2, length, pitch, duration);
*buf += sizeof(xBellFeedbackState);
}
@ -244,7 +231,6 @@ int
ProcXGetFeedbackControl(ClientPtr client)
{
int rc, total_length = 0;
char *savbuf;
DeviceIntPtr dev;
KbdFeedbackPtr k;
PtrFeedbackPtr p;
@ -253,17 +239,14 @@ ProcXGetFeedbackControl(ClientPtr client)
BellFeedbackPtr b;
LedFeedbackPtr l;
REQUEST(xGetFeedbackControlReq);
REQUEST_SIZE_MATCH(xGetFeedbackControlReq);
REQUEST_HEAD_STRUCT(xGetFeedbackControlReq);
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
if (rc != Success)
return rc;
xGetFeedbackControlReply rep = {
.repType = X_Reply,
.RepType = X_GetFeedbackControl,
.sequenceNumber = client->sequence,
};
for (k = dev->kbdfeed; k; k = k->next) {
@ -298,7 +281,7 @@ ProcXGetFeedbackControl(ClientPtr client)
char *buf = (char *) calloc(1, total_length);
if (!buf)
return BadAlloc;
savbuf = buf;
char *savbuf = buf;
for (k = dev->kbdfeed; k; k = k->next)
CopySwapKbdFeedback(client, k, &buf);
@ -313,15 +296,7 @@ ProcXGetFeedbackControl(ClientPtr client)
for (b = dev->bell; b; b = b->next)
CopySwapBellFeedback(client, b, &buf);
rep.length = bytes_to_int32(total_length);
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);
REPLY_FIELD_CARD16(num_feedbacks);
REPLY_SEND_EXTRA(savbuf, total_length);
return Success;
}

View File

@ -52,10 +52,13 @@ SOFTWARE.
#include <dix-config.h>
#include "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/request_priv.h"
#include "windowstr.h" /* focus struct */
#include "inputstr.h" /* DeviceIntPtr */
#include "exglobals.h"
#include "getfocus.h"
@ -73,8 +76,7 @@ ProcXGetDeviceFocus(ClientPtr client)
FocusClassPtr focus;
int rc;
REQUEST(xGetDeviceFocusReq);
REQUEST_SIZE_MATCH(xGetDeviceFocusReq);
REQUEST_HEAD_STRUCT(xGetDeviceFocusReq);
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetFocusAccess);
if (rc != Success)
@ -85,9 +87,7 @@ ProcXGetDeviceFocus(ClientPtr client)
focus = dev->focus;
xGetDeviceFocusReply rep = {
.repType = X_Reply,
.RepType = X_GetDeviceFocus,
.sequenceNumber = client->sequence,
.time = focus->time.milliseconds,
.revertTo = focus->revert,
};
@ -101,12 +101,8 @@ ProcXGetDeviceFocus(ClientPtr client)
else
rep.focus = focus->win->drawable.id;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.focus);
swapl(&rep.time);
}
WriteToClient(client, sizeof(xGetDeviceFocusReply), &rep);
REPLY_FIELD_CARD32(focus);
REPLY_FIELD_CARD32(time);
REPLY_SEND();
return Success;
}

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/request_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "exglobals.h"
#include "swaprep.h"
#include "xkbsrv.h"
@ -76,8 +79,7 @@ ProcXGetDeviceKeyMapping(ClientPtr client)
KeySymsPtr syms;
int rc;
REQUEST(xGetDeviceKeyMappingReq);
REQUEST_SIZE_MATCH(xGetDeviceKeyMappingReq);
REQUEST_HEAD_STRUCT(xGetDeviceKeyMappingReq);
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
if (rc != Success)
@ -102,18 +104,12 @@ ProcXGetDeviceKeyMapping(ClientPtr client)
return BadAlloc;
xGetDeviceKeyMappingReply rep = {
.repType = X_Reply,
.RepType = X_GetDeviceKeyMapping,
.sequenceNumber = client->sequence,
.keySymsPerKeyCode = syms->mapWidth,
.length = (syms->mapWidth * stuff->count) /* KeySyms are 4 bytes */
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep);
REPLY_SEND();
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
WriteSwappedDataToClient(client,

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> /* Request macro */
#include "dix/request_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "exglobals.h"
#include "getmmap.h"
@ -72,8 +75,7 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
KeyCode *modkeymap = NULL;
int ret, max_keys_per_mod;
REQUEST(xGetDeviceModifierMappingReq);
REQUEST_SIZE_MATCH(xGetDeviceModifierMappingReq);
REQUEST_HEAD_STRUCT(xGetDeviceModifierMappingReq);
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
if (ret != Success)
@ -84,21 +86,12 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
return ret;
xGetDeviceModifierMappingReply rep = {
.repType = X_Reply,
.RepType = X_GetDeviceModifierMapping,
.sequenceNumber = client->sequence,
.numKeyPerModifier = max_keys_per_mod,
/* length counts 4 byte quantities - there are 8 modifiers 1 byte big */
.length = max_keys_per_mod << 1
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep);
WriteToClient(client, max_keys_per_mod * 8, modkeymap);
/* 8 modifiers per key, each CARD8 */
REPLY_SEND_EXTRA(modkeymap, max_keys_per_mod * 8);
free(modkeymap);
return Success;

View File

@ -56,6 +56,7 @@ SOFTWARE.
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#include "dix/request_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structs */
@ -66,21 +67,6 @@ SOFTWARE.
extern XExtEventInfo EventInfo[];
extern int ExtEventIndex;
/***********************************************************************
*
* Handle a request from a client with a different byte order.
*
*/
int _X_COLD
SProcXGetDeviceDontPropagateList(ClientPtr client)
{
REQUEST(xGetDeviceDontPropagateListReq);
REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
swapl(&stuff->window);
return (ProcXGetDeviceDontPropagateList(client));
}
/***********************************************************************
*
* This procedure lists the input devices available to the server.
@ -96,13 +82,11 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
WindowPtr pWin;
OtherInputMasks *others;
REQUEST(xGetDeviceDontPropagateListReq);
REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
REQUEST_HEAD_STRUCT(xGetDeviceDontPropagateListReq);
REQUEST_FIELD_CARD32(window);
xGetDeviceDontPropagateListReply rep = {
.repType = X_Reply,
.RepType = X_GetDeviceDontPropagateList,
.sequenceNumber = client->sequence,
};
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
@ -114,9 +98,7 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
ClassFromMask(NULL, others->dontPropagateMask[i], i, &count, COUNT);
if (count) {
rep.count = count;
buf = calloc(rep.count, sizeof(XEventClass));
if (!buf)
return BadAlloc;
buf = xallocarray(rep.count, sizeof(XEventClass));
rep.length = bytes_to_int32(rep.count * sizeof(XEventClass));
tbuf = buf;
@ -126,12 +108,8 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
}
}
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.count);
}
WriteToClient(client, sizeof(xGetDeviceDontPropagateListReply), &rep);
REPLY_FIELD_CARD16(count);
REPLY_SEND();
if (count) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;

View File

@ -30,9 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef GETPROP_H
#define GETPROP_H 1
int SProcXGetDeviceDontPropagateList(ClientPtr /* client */
);
int ProcXGetDeviceDontPropagateList(ClientPtr /* client */
);

View File

@ -55,6 +55,7 @@ SOFTWARE.
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/request_priv.h"
#include "dix/resource_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
@ -64,21 +65,6 @@ SOFTWARE.
#include "getprop.h"
#include "getselev.h"
/***********************************************************************
*
* This procedure gets the current selected extension events.
*
*/
int _X_COLD
SProcXGetSelectedExtensionEvents(ClientPtr client)
{
REQUEST(xGetSelectedExtensionEventsReq);
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
swapl(&stuff->window);
return (ProcXGetSelectedExtensionEvents(client));
}
/***********************************************************************
*
* This procedure gets the current device select mask,
@ -97,13 +83,11 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
OtherInputMasks *pOthers;
InputClientsPtr others;
REQUEST(xGetSelectedExtensionEventsReq);
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
REQUEST_HEAD_STRUCT(xGetSelectedExtensionEventsReq);
REQUEST_FIELD_CARD32(window);
xGetSelectedExtensionEventsReply rep = {
.repType = X_Reply,
.RepType = X_GetSelectedExtensionEvents,
.sequenceNumber = client->sequence,
};
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
@ -142,13 +126,9 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
ClassFromMask(aclient, others->mask[i], i, NULL, CREATE);
}
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.this_client_count);
swaps(&rep.all_clients_count);
}
WriteToClient(client, sizeof(xGetSelectedExtensionEventsReply), &rep);
REPLY_FIELD_CARD16(this_client_count);
REPLY_FIELD_CARD16(all_clients_count);
REPLY_SEND();
if (total_length) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;

Some files were not shown because too many files have changed in this diff Show More