Mixing result variables for separate things is making the code hard
to understand, so add a new local variable for temporarily storing
the result of ReadRequestFromClient().
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
a) trade a little bit of code size for speed
(depending on exact caller, compiler might also optimize a lot)
b) reduce the need for exported, but non-public symbol
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
add some macros for making request handlers and byte swapping easier:
* X_REQUEST_HEAD_STRUCT(type) and X_REQUEST_HEAD_AT_LEAST(type)
declare header struct pointers and check size
* X_REQUEST_FIELD_CARD16(field)
swaps a CARD16 (word) header field (if neccessary)
* X_REQUEST_FIELD_CARD32(field)
swaps a CARD32 (dword) header field (if neccessary)
* X_REQUEST_REST_CARD16()
swaps remaining CARD16 array payload (if necessary)
* X_REQUEST_REST_CARD32()
swaps remaining CARD32 array payload (if necessary)
* X_REQUEST_REST_COUNT_CARD16(count)
check swaps `count` CARD16 payload fields and checks size
* X_REQUEST_REST_COUNT_CARD32(count)
check swaps `count` CARD32 payload fields and checks size
How to use them:
1. put X_REQUEST_HEAD_STRUCT() or X_REQUEST_HEAD_AT_LEAST() ontop of each Proc*()
2. add X_REQUEST_FIELD_*() et al below, for all fields to be swapped and
drop the corresponding SProc*()'s
3. let the dispatchers call Proc*() instead of SProc*()
Notes:
* the length field is already swapped before request handlers called
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Current code walks along all screens and initializes screen resources,
then gc's, stipples, root windows for each of them, hence after
the first screen registering new private keys is no more possible.
This crashes modesetting driver if it is not initialized before others.
This patch makes screen resources for all screen initialize first, hence
all necessary private keys (including of the type PRIVATE_WINDOW) are
initialized before root windows are created.
Signed-off-by: Oleh Nykyforchyn <oleh.nyk@gmail.com>
Nothing in there that we need, include <regionstr.h> instead.
But keeping the file in place, until all external consumer have
been migrated.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This patch exports ConnectionInfo in server_priv.h and references
it in globals.c to force exporting.
Signed-off-by: Oleh Nykyforchyn <oleh.nyk@gmail.com>
Now that we have untwisted Xinerama side, it's trivial to inline
the few lines for byte-swapping into the actual handlers.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Adding new source and header that's going to host all DIX
settings (set via cmdline or xf86 config file) in the future.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Not used by any external drivers, so no need to keep it in public SDK.
Since it's used by internal modules, still needs to be _X_EXPORT'ed.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Not used anywhere, neither in Xserver nor in drivers, so no need
to keep it around any longer.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Still needs to be _X_EXPORT'ed for internal modules, but
not supposed to be visible to external drivers.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Only internally within OS layer and screen saver logic,
so no need to keep it exported.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Since we're always terminating now, everbody can call UnlockServer()
directly, so we don't need that extra function anymore.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Drop the -reset flag, so Xserver now either simply continues (w/o going
through internal reset) when last client disconnected or terminates
when -terminate is given.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Turns out that glx does need this one.
Assuming no external modules need this,
it should be fine to keep this in a private header.
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
It's just a tuning parameter (that nobody touched for aeons) for
DoGetImage(), inside dix/dispatch.c
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
It's assigned a const char* value and not writing into it,
so it should be const, too (compiler correctly warning about that)
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Instead of internally faking requests, factor out the actual logic
into separate function, which is getting everything it needs as
parameters, so no need to fiddle with request buffer anymore.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Instead of directly accessing the global screenInfo.screens[] array,
let everybody go through a little inline helper. This one also checks
for array bounds - if the screen doesn't exist, return NULL.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
a) move to doxygen-style docs, inside the header instead of code
b) mention that the function can be called many times with the
same parameters (already registered keys are silently tolerated)
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Call DeleteCallbackList(&pScreen->hookPostCreateResources) during
dixFreeScreen, because otherwise it will be heap-use-after-free during
DeleteCallbackManager call.
Signed-off-by: Tautvis <gtautvis@gmail.com>
In order to reduce complexity of wrapped core request handlers with PanoramiX,
split the ProcCreateWindow() function into two pieces: the upper half is the
usual (non-PanoramiX) handler, while the lower one is what's called by both
the usual handler, as well as the PanoramiX' one.
We're already passing in the request parameters as separate pointers, so
follow-up commits can easily change PanoramiX handler to not tweaking the
request buffer directly anymore. Another one is letting PanoramiXCreateWindow()
be called by ProcCreateWindow explicitly (when enabled), so we don't need to
wrap the core request proc vector anymore. Once that's done, the swapping can
also be moved into ProcCreateWindow().
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>