Compare commits

..

350 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult 702b1687fd Xnest XCB version 24.2.0.0
2nd release this year:

* added syslog support
* xfree86: fixed DRI crash bug (#1053, #1534)
* bunch of little cleanups and fixes
* by default only builds Xnest DDX (others still can be enabled via options)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:23:56 +02:00
Enrico Weigelt, metux IT consult 23040f3814 meson.build: change project name to xnest
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:17:54 +02:00
Enrico Weigelt, metux IT consult 8eb6c1f173 meson_options: disable all DDX'es but Xnest
This branch is specifically for just Xnest only, so disable anything else
per default. The others still can be enabled via meson options.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:17:48 +02:00
Enrico Weigelt, metux IT consult d84bca91ec mi: miInitVisuals: clean up variable declarations
The code is easier to understand when variables are declared where they're
used for the first time, scoped to where they're needed and not reused
for separate things.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:04:37 +02:00
Doug Brown 4898415c6b dri2: Protect against dri2ClientPrivate assertion failures
If DRI2ScreenInit hasn't been called yet, DRI2Authenticate and
DRI2CreateDrawable2 cause the X server to crash. This has been observed
to happen on multiple modern Linux distros in various conditions,
including QEMU and VMware VMs. Make these functions more robust in order
to prevent the crash.

This patch was originally provided by Bernhard Übelacker and expanded
upon by Mark Wagner.

Signed-off-by: Doug Brown <doug@schmorgal.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1053
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1534
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult 9747ade9b1 xnest: add pixmap depths to global depth list
Right now, we're only registering the depths of our visuals, which are
mirroring upstream's visuals. But forgotten to register the pixmap depths
that don't have an assiocated visual.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult 13fcc8f4c5 (!1700) meson: drop defining BIGREQS
This symbol isn't used for decades, so no need to define it at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult 31bc28a36e dix: lookup function for WindowPtr by XID
This new lookup function retrieves a pointer to WindowRec structure by
associated XID. Unlike dixLookupWindow(), this one works globally, instead
of just on one specific client, and it doesn't do any XACE calls.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult 1c31902425 ci: always build with drivers 2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult c0de503adb ci: freebsd: fix missing xcb-aux and xcb-util-wm
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult 00e23cb0d6 bsd: drop PCCONS support
The old PCCONS driver only seems to be used on minimal install disks and
cannot coexist with newer ones, so there's probably no practical use case for
supporting it in Xorg anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult 70a25209ac os: replace GenerateRandomData() by custom arc4random_buf() on platforms that missing it
arc4random_buf() is a pretty standard libc function on Unix'oid platforms,
but not all our targets have it, thus we need a fallback there. Currently we
have GenerateRandomData(), which either just wraps arc4random_buf() or provides
some fallback implementation.

For those cases it's easier to just implement missing functions directly
instead of having custom wrapper functions. So, drop GenerateRandomData()
in favor of arc4random_buf() and provide fallback implementation for where
it is missing.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult 9d1937cd79 WIP: reorder includes
(submit/cursor-api) dix: drop superfluous XineramaGetCursorScreen()

It's only used for record extension, no external callers, thus doesn't
need to be exported. Since it's just for retrieving one struct value,
it's not needed at all - we can do this directly (just like we do in
many other places)

Note: the check on noPanoramixExtensions is superfluous, since the only
call site already does it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult 5c96b80a8d (!1695) dix: unexport Ones()
It's not used by any module/driver, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult bbdef9336f (!1694) xvmc: unexport XvMCFindXvImage()
It's not needed by any driver, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult 7bbdd50103 (!1693) xvmc: move over protocol version defines into xvmc.c
These are exclusively used in one source file, so no need to keep them
in a global header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult c88abea2fe (!1692) Xext: xvmc: drop unused XvMCScreenInitProc
This pointer field isn't used anywhere, neither in Xorg nor in drivers.
No need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult 57d6c2477a (!1691) os: log: replace VErrorF() by LogVMessageVerb()
Since LogVMessageVerb() is now signal safe, we can use this one instead.
Leaving VErrorF() macro for backwards compat with drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult 76ad971c52 (!1691) xwin: drop duplicate OsVendorVErrorF()
It really doesn't seem to be necessary to protect a LogVMessageVerb()
call by extra mutex on windows only, while obviously not needed on
any other platform.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult d49410d599 (!1691) os: log: replace VErrorFSigSafe() by VErrorF()
Since VErrorF() is now signal safe, we can use this one instead.
Leaving VErrorFSigSafe() macro for backwards compat with drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult 8dbd909d7b (!1691) os: log: replace ErrorFSigSafe() by ErrorF()
Since ErrorF() is now signal safe, we can use this one instead.
Leaving ErrorFSigSafe() macro for backwards compat with drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult 91b6453087 (!1691) os: log: replace LogMessageVerbSigSafe() by LogMessageVerb()
Since LogMessageVerb() is now signal safe, we can use this one instead.
Leaving LogMessageVerbSigSafe() macro for backwards compat with drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult 52de3c7fd2 (!1691) os: log: make LogVMessageVerb() signal safe
We already have our own signal safe vnsprintf() implementation, which is used
for formatting log messages while being in a signal handler, there's no need
to have two separate implementations of all the logging functions.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult 8ca763453a (!1691) os: log: consolidate log formatting functions
Simplify log formatting functions and remove redundancies, e.g.:

* common function for line termination
* copy prefix directly instead of *printf'ing it
* now just exactly one LogSWrite() call per message
  (good for other log targets like syslog)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult 488a97463f (!1691) os: log: drop unused variables
Drop some unneeded variabes, whose values can be computed at compile-time.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult 0c306f780f (!1690) pseudoramiX: fix warning from unused REQUEST() macro calls
In the SProc*()s, lots of REQUEST() macro calls aren't needed and causing
warnings on unused variables:

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult d2575b30dd (!1689) pseudoramix: replace PseudoramiXTrace() and PseudoramiXDebug() by LogMessageVerb()
Since we're only going through macros (that are calling these), this extra wrapper
function isn't needed at all - using LogMessageVerb() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:03:01 +02:00
Enrico Weigelt, metux IT consult 2e74b2fde6 (!1688) xfree86: man: add -syslogverbse flag
Document the newly added -syslogverbose command line flag.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-19 15:02:54 +02:00
Enrico Weigelt, metux IT consult 69bdc2c247 (!1688) os: log: add syslog support
Add support for logging to syslog.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult 2d5c8090a8 (!1688) os: helper for parsing an counting-flag or value-flag option
Parses an option that may either be used for setting an integer value or
given one or multiple times (without argument) to increase an value

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

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult e063db8204 (!1688) os: log: drop obsolete LogSetParameter()
The variables that can be set via this function are all now being
accessed directly. Not callers left, so drop it.

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

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

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult 4cd73b26c0 (!1688) os: unexport internal logging functions
Lots of logging functions, especially init and teardown aren't called
by any drivers/modules, so no need to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult 54632e9049 (!1680) os: log: drop unnecessary ifdef's
The #ifdef's for log prefix defines aren't needed, so drop them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult ac503cca59 (!1679) xfre86: drop xf86Msg() in favor of LogMessageVerb()
This function is doing the same like LogMessageVerb(), so no need to keep
around a duplicate implementation. Leaving it as a macro, until all callers,
also in drivers, have been migrated.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult af06dd35d7 (!1679) xfree86: drop xf86MsgVerb() in favor of LogMessageVerb()
This function is doing the same like LogMessageVerb(), so no need to keep
around a duplicate implementation. Leaving it as a macro, until all callers,
also in drivers, have been migrated.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult 691228d130 (!1678) os: move AbortServer() to os/utils.c
This function doesn't much to do with logging, except for being
called once by FatalError(). It's better placed in utils.c

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult f7fdaf814b (submit/rename-panoramix-sym) rename old symbol PANORAMIX to XINERAMA
PANORAMIX was the original working title of the extension, before it became
official standard. Just nobody cared about fixing the symbols to the official
naming.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult 77f7e06508 (submit/extDevReason) xkb: drop unused variable extDevReason
fix warning on unused variable:

> ../xkb/xkb.c:3576:18: warning: variable 'extDevReason' set but not used [-Wunused-but-set-variable]
>     unsigned int extDevReason;
                 ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult ea563c714f (submit/drop-cygwin) drop remains of cygwin support
Cygwin support doesn't seem to be used anymore, so it can be dropped.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult 556c8726ae (submit/xnest-gcrec) fix name clash on 'GC' between Xlib and Xserver
Both xlib as well as the Xserver use the same identifier "GC" for
different types. While on xlib it's just the numerical ID of a GC,
the xserver defines a struct for it by the same name. This is this
ugly and needs ridiculous hacks for Xserver code that needs xlib.

Easy to solve by just renaming the GC typedef to GCRec (consistent
with how we're naming other structs) and replacing GC* by GCPtr.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult 3bd44734a4 (submit/bsd-defines) xfree86: os-support: move including machine/sysarch.h out of public header
The only consumer seems to be one BSD specific file, the few drivers using
the *_iopl seem to include it on their own. Thus, no need to keep it in
public headers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult 913d6081e5 (submit/unexport-ddx-callbacks) os: rename ddx.h to ddx_priv.h
Make it clear that stuff from this file really isn't supposed to be used
by dynamically loaded modules like drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult ba7d036718 (submit/unexport-ddx-callbacks) os: unexport ddx callbacks
The DDX callbacks (where core/DIX calls into DDX) aren't supposed to be
called by drivers directly, so unexport them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult 3993de5346 (submit/cmdline-funcs) os: unexport command line args handling functions
These functions shouldn't be called by drivers or extensions, thus
shouldn't be exported. Also moving it to separate header, so the
already huge ones aren't cluttered with even more things.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult b7c59f2dac (submit/fix-char-signedness) xkb: xkbInit: fix char signess mismatch
On NetBSD gives warning:

../xkb/xkbInit.c: In function ‘XkbProcessArguments’:
../xkb/xkbInit.c:778:57: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  778 |             if (((i + 1) < argc) && (isdigit(argv[i + 1][0]))) {
      |                                                         ^
../xkb/xkbInit.c:782:61: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  782 |                 if (((i + 1) < argc) && (isdigit(argv[i + 1][0]))) {
      |                                                             ^
../xkb/xkbInit.c:792:61: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  792 |                 if (((i + 1) < argc) && (isdigit(argv[i + 1][0]))) {
      |                                                             ^
../xkb/xkbInit.c:799:61: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  799 |                 if (((i + 1) < argc) && (isdigit(argv[i + 1][0]))) {
      |                                                             ^
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult b5ebbb2e3f (submit/fix-char-signedness) xkb: xkbtext: fix char signess mismatch
On NetBSD gives warning:

In file included from /usr/include/ctype.h:100,
                 from ../xkb/xkbtext.c:32:
../xkb/xkbtext.c: In function ‘XkbAtomText’:
../xkb/xkbtext.c:94:44: warning: array subscript has type ‘char’ [-Wchar-subscripts]
   94 |             if ((tmp == rtrn) && (!isalpha(*tmp)))
      |                                            ^
../xkb/xkbtext.c:96:31: warning: array subscript has type ‘char’ [-Wchar-subscripts]
   96 |             else if (!isalnum(*tmp))
      |                               ^
../xkb/xkbtext.c: In function ‘XkbIMWhichStateMaskText’:
../xkb/xkbtext.c:470:43: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  470 |                 buf[len + 9] = toupper(buf[len + 9]);
      |                                           ^
../xkb/xkbtext.c: In function ‘XkbControlsMaskText’:
../xkb/xkbtext.c:532:43: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  532 |                 buf[len + 3] = toupper(buf[len + 3]);
      |                                           ^
../xkb/xkbtext.c: In function ‘XkbStringText’:
../xkb/xkbtext.c:563:22: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  563 |         if (!isprint(*in)) {
      |                      ^
../xkb/xkbtext.c:584:21: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  584 |         if (isprint(*in))
      |                     ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult 0e054c32e3 (submit/fix-char-signedness) os: utils: fix char signess mismatch
On NetBSD gives warning:

In file included from /usr/include/ctype.h:100,
                 from ../include/misc.h:174,
                 from ../os/utils.c:75:
../os/utils.c: In function ‘VerifyDisplayName’:
../os/utils.c:624:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  624 |         if (!isdigit(d[i])) {
      |                       ^
../os/utils.c: In function ‘ProcessCommandLine’:
../os/utils.c:942:44: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  942 |             if ((i + 1 < argc) && (isdigit(*argv[i + 1])))
      |                                            ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult 63ceada731 (submit/fix-char-signedness) os: access: fix char signess mismatch
On NetBSD gives warning:

In file included from /usr/include/ctype.h:100,
                 from ../include/misc.h:174,
                 from ../os/access.c:96:
../os/access.c: In function ‘ResetHosts’:
../os/access.c:981:49: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  981 |                 lhostname[i] = tolower(ohostname[i]);
      |                                                 ^
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult 87f2e80b05 (submit/fix-char-signedness) xfree86: parser: scan: fix char signess mismatch
On NetBSD gives warning:

In file included from /usr/include/ctype.h:100,
                 from ../hw/xfree86/parser/scan.c:58:
../hw/xfree86/parser/scan.c: In function ‘xf86getToken’:
../hw/xfree86/parser/scan.c:343:50: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  343 |         else if ((c == ',') && !isalpha(configBuf[configPos])) {
      |                                                  ^
../hw/xfree86/parser/scan.c:346:50: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  346 |         else if ((c == '-') && !isalpha(configBuf[configPos])) {
      |                                                  ^
../hw/xfree86/parser/scan.c: In function ‘xf86nameCompare’:
../hw/xfree86/parser/scan.c:1031:19: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1031 |     c1 = (isupper(*s1) ? tolower(*s1) : *s1);
      |                   ^
../hw/xfree86/parser/scan.c:1031:34: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1031 |     c1 = (isupper(*s1) ? tolower(*s1) : *s1);
      |                                  ^
../hw/xfree86/parser/scan.c:1032:19: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1032 |     c2 = (isupper(*s2) ? tolower(*s2) : *s2);
      |                   ^
../hw/xfree86/parser/scan.c:1032:34: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1032 |     c2 = (isupper(*s2) ? tolower(*s2) : *s2);
      |                                  ^
../hw/xfree86/parser/scan.c:1042:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1042 |         c1 = (isupper(*s1) ? tolower(*s1) : *s1);
      |                       ^
../hw/xfree86/parser/scan.c:1042:38: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1042 |         c1 = (isupper(*s1) ? tolower(*s1) : *s1);
      |                                      ^
../hw/xfree86/parser/scan.c:1043:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1043 |         c2 = (isupper(*s2) ? tolower(*s2) : *s2);
      |                       ^
../hw/xfree86/parser/scan.c:1043:38: warning: array subscript has type ‘char’ [-Wchar-subscripts]
 1043 |         c2 = (isupper(*s2) ? tolower(*s2) : *s2);
      |                                      ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult 3086ed6d31 (submit/fix-char-signedness) xfree86: common: xf86Configure: fix char signess mismatch
On NetBSD gives warning:

../hw/xfree86/common/xf86Configure.c: In function ‘xf86AddBusDeviceToConfigure’:
../hw/xfree86/common/xf86Configure.c:125:50: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  125 |     for (j = 0; (lower_driver[j] = tolower(driver[j])); j++);
      |                                                  ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult de5ec979d5 (submit/fix-char-signedness) xfree86: common: xf86pciBus: fix char signess mismatch
On NetBSD gives warning:

In file included from /usr/include/ctype.h:100,
                 from ../hw/xfree86/common/xf86pciBus.c:35:
../hw/xfree86/common/xf86pciBus.c: In function ‘xf86ParsePciBusString’:
../hw/xfree86/common/xf86pciBus.c:286:27: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  286 |             if (!isdigit(d[i])) {
      |                           ^
../hw/xfree86/common/xf86pciBus.c:293:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  293 |         if (!isdigit(p[i])) {
      |                       ^
../hw/xfree86/common/xf86pciBus.c:307:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  307 |         if (!isdigit(p[i])) {
      |                       ^
../hw/xfree86/common/xf86pciBus.c:320:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  320 |         if (!isdigit(p[i])) {
      |                       ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult edd4887cd3 (submit/fix-char-signedness) xfree86: common: xf86Option: fix char signess mismatch
On NetBSD gives warning:

In file included from /usr/include/ctype.h:100,
                 from ../hw/xfree86/common/xf86Option.c:39:
../hw/xfree86/common/xf86Option.c: In function ‘xf86NormalizeName’:
../hw/xfree86/common/xf86Option.c:915:25: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  915 |             if (isupper(*p))
      |                         ^
../hw/xfree86/common/xf86Option.c:916:32: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  916 |                 *q++ = tolower(*p);
      |                                ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult 65e814aaa1 (submit/fix-char-signedness) xfree86: common: xf86Bus: fix char signess mismatch
On NetBSD gives warning:

In file included from /usr/include/ctype.h:100,
                 from ../hw/xfree86/common/xf86Bus.c:36:
../hw/xfree86/common/xf86Bus.c: In function ‘StringToBusType’:
../hw/xfree86/common/xf86Bus.c:270:22: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  270 |     if (isdigit(busID[0])) {
      |                      ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult 8fa7192799 (submit/xkb-errmacro) xkb: move _XkbErrCode3() and _XkbErrCode4()
These are only used inside xkb.c, nowhere else, so no need to
keep them in public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult 9032c194aa (submit/xkb-devkey) xkb: drop xkbDevicePrivateKey define
It's only used exactly once, where we can easily write &xkbDevicePrivateKeyRec.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult 796c65001a (submit/move-systemd-logind.h) move systemd-logind.h to hw/xfree86/os-support/linux
systemd is linux specific and the actual implementation is under the
os-support layer of xfree86 ddx. Thus no need to keep it in global
include directory, putting it onto the linux specific os-support instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult 2594a99829 (submit/bsd-DEV_MEM) xfree86: os-support: bsd: consolidate duplicate defines
Consolidate defines duplicated across several sources into one header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult a4e29e4f79 (submit/bsd-DEV_MEM) xfree86: os-support: unexport DEV_MEM defines
DEV_MEM define isn't used by any drivers, and BSD seems to be the only
platform using /dev/pmem instead of /dev/mem - as well as the DEV_MEM
define from xf86_OSlib.h (Linux uses the symbol, but defines on its own)

Therefore, just define it where actually used and drop it from the global
xf86OSlib.h file.

Note that /dev/pmem refers to physical memory, not to be mixed up with
Linux's persistent memory subsys, which uses /dev/pmem[N] device nodes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult 7e614e8c39 (submit/hotplug.h) config: unexport config_pre_init()
This function isn't used by any drivers/modules, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult 0260e13073 (submit/hotplug.h) include: move out private definitions from hotplug.h
Public server module API shouldn't be clobbered with private definitions,
thus move them out to private header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:12 +02:00
Enrico Weigelt, metux IT consult f4edaa6b64 (submit/hotplug.h) xfree86: common: make _xf86_get_platform_device_attrib() a real function
Doing so that struct OdevAttributes doesn't need to be exposed to
drivers anymore. It really doesn't seem to be a hot path, so not
inlining anymore shouldn't have any practical performance impact.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 7bcf65ea20 (submit/cleanup-api-xfree86) xfree86: sdksyms.sh: add more headers
Add some headers that are still needed by drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult fae7389ba4 (submit/cleanup-api-xfree86) xfree86: move private definitions out of dri.h
public server module API headers shouldn't be clobbered with non-exported
definitions, so move them out to private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 9e32358192 (submit/cleanup-api-xfree86) xfree86: move private definitions out of dri2.h
public server module API headers shouldn't be clobbered with non-exported
definitions, so move them out to private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 5743bd368a (submit/cleanup-api-xfree86) xfree86: ddc: move private definitions from xf86DDC.h to xf86DDC_priv.h
public server module API headers shouldn't be clobbered with non-exported
definitions, so move them out to private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult dabc766bba (submit/cleanup-api-xfree86) xfree86: parser: move private defs from xf86Parser.h to xf86Parser_priv.h
public server module API headers shouldn't be clobbered with non-exported
definitions, so move them out to private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult fb4422efe1 (submit/cleanup-api-xfree86) xfree86: modes: move private definitions out of from xf86RandR12.h
public server module API headers shouldn't be clobbered with non-exported
definitions, so move them out to private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult baf84073d1 (submit/cleanup-api-xfree86) xfree86: common: move private defs out of xf86VGAarbiter.h
public server module API headers shouldn't be clobbered with non-exported
definitions, so move them out to private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult cd3c6401bf (submit/cleanup-api-xfree86) xfree86: common: move private defs from xf86Xinput.h to xf86Xinput_priv.h
public server module API headers shouldn't be clobbered with non-exported
definitions, so move them out to private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 360cfb39bf (submit/cleanup-api-xfree86) xfree86: int10: move private defs out of xf86int10.h
public server module API headers shouldn't be clobbered with non-exported
definitions, so move them out to private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 15054e4424 (submit/cleanup-api-xfree86) xfree86: common: move private defs out of xf86sbusBus.h
public server module API headers shouldn't be clobbered with non-exported
definitions, so move them out to private header file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 5546ca2c96 (submit/xf86-parser v2) xfree86: parser: rename IOBASE for fixing name conflict
Resolve conflicts with OS headers definining IOBASE by renaming the
IOBASE enum value to XF86_TOKEN_IOBASE.

This way, don't need the special #undef hack anymore.
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 1068d6031e (submit/xf86-parser v2) xfree86: parser: rename STRING for fixing name conflict
Resolve name conflict with Sun's <sys/kbd.h> by renaming STRING enum
value to XF86_TOKEN_STRING.

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 1201a6ed88 (submit/xf86-parser v2) xfree86: parser: drop obsolete token enum values
These have been forgotten on some major cleanup back almost two decades ago.
(Daniel dropped a lot of dead code, which already had been removed earlier
but merged back accidentially).

Didn't look further back on where exactly they had become obsolete - being
unused for decades should be enough justification for dropping.

Fixes: 81913a1291
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult e21bc4c697 (submit/bsd-defines v2) xfree86: os-support: move including machine/sysarch.h out of public header
The only consumer seems to be one BSD specific file, the few drivers using
the *_iopl seem to include it on their own. Thus, no need to keep it in
public headers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult af72e10c8b (submit/bsd-defines v2) xfree86: os-support: move CONSOLE_X_TV_ON/OFF to i386_video.c
These are only used in i386_video.c, so move them there.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult c17f250d70 (submit/bsd-defines v2) xfree86: os-support: move CONSOLE_X_MODE_ON/OFF to bsd_init.c
These are only used in bsd_init.c, so move them there.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 491ba2669a (submit/bsd-defines v2) xfree86: os-support: move CONSOLE_X_BELL into bsd_bell.c
This define is only used inside bsd_bell.c, so move it there.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 82a1cac173 (submit/bsd-defines v2) xfree86: os-support: drop unused CONSOLE_GET_* defines
These don't seem to be used anywhere, so we can drop them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult ea8fda84b6 (submit/bsd-defines v2) xfree86. os-support: drop obsolete XMODE_* defines
These only had been used by xf86-video-chips, but meanwhile this
defines them on it's own, so we can drop them from here now.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 31c8867db4 (submit/drop-obsolete-have-dix-config.h) drop obsolete HAVE_DIX_CONFIG_H
The symbol controls whether to include dix-config.h, and it's always set,
thus we don't need it (and dozens of ifdef's) anymore.

This commit only removes them from our own source files, where we can
guarantee that dix-config.h is present - leaving the (potentially exported)
headers untouched.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult a3349f3e31 (submit/split-input.h) include: move private definitions out of input.h
It's not good having the public server api headers clobbered with private
definitions, so cleaning them up.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 0c27d5b102 (!1279) os: don't include client.h anymore
There's no need to include client.h anymore. But still leaving it, in case
some external consumer relying on it's presence.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult b17cc82252 (!1279) os: unexport client id retrieval functions
These aren't used by any (known) external modules, thus no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult be5a9820d9 (!1279) os: unexport DetermineClientPid() and DetermineClientCmd()
These aren't used by any drivers/modules, so no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult d14d63360b (!1279) os: split off internal definitions from client.h
The client.h file is part of the public module API, but it also contains
definitions that aren't useful for being used in modules. Splitting them
out into their own client_priv.h file, which isn't part of the API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 82521f4698 (submit/meson-sdk.pc) meson.build: fix missing dependencies in xorg-server.pc
xorg-server.pc missed a few dependencies, so consumers might not
get them and break build.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 2dc806da2c (!1578) os: fix link failure on Illumos
On SunOS, the BSD socket API as well as hostname lookups isn't
implemented in libc, but separate libraries. We need to link them
explicitly.

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

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult dde546672e (submit/selection.h) dix: rename selection.h to selection_priv.h
rename it in order to reflects it's private nature (not exported).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 450b08c6f1 (submit/selection.h) dix: unexport selection functions
No driver needs them, so no reason to keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 221803bcc9 (submit/selection.h) dix: don't install selection.h anymore
This file isn't included by any driver - not even indirectly, and hard
to imagine any driver ever needs it, so no need to keep it installed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 5f863835e7 (submit/xfuncproto) fix mising includes of <X11/Xfuncproto.h>
Several places using _X_ATTRIBUTE_PRINTF macro from X11/Xfuncproto.h
but missing to include it, so it depends on other headers whether it's
included by mere accident, which quickly causes trouble if include order
changes. Cleaning that up by adding explicit include statements.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult a7ce225546 (submit/miext-extinit) Xext: geext: move out noGEExtension to corresponding extension
The OS abstraction isn't really the right place for those flags,
they are're probably better off in their corresponding extensions.

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

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

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

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 66f6f49263 (submit/miext-extinit) miext: move over extinit_priv.h from include
Since most of the extension init logic (and on/off switches for them)
is driven from miext, this seems the appropriate place for the header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult d69250ac86 (submit/miext-extinit) treewide: clean up remaining consumers of extinit.h
Several sources including it without need. For consistency, those who still
need someting from there should include exitinit_priv.h (which also pulls
in extinit.h)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 39300cc0bc (submit/miext-extinit) composite: move noCompositeExtension into the extension code
This flag is better off in the extension code instead of the OS layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 53bc46fd2a (submit/miext-extinit) Xext: selinux: unexport noSELinuxExtension
It's not needed by any driver/module, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 32fcffa4bb (submit/miext-extinit) Xext: shape: unexport noXFixesExtension
This field isn't used by any drivers, and also better belongs into
the corresponding extension instead of OS adaption layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult f232ee9042 (submit/miext-extinit) Xext: xf86bigfont: unexport noXFree86BigfontExtension
This field isn't used by any drivers, and also better belongs into
the corresponding extension instead of OS adaption layer.

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 4a20614fcb (submit/miext-extinit) Xext: shm: unexport noMITShmExtension
This field isn't used by any drivers, and also better belongs into
the corresponding extension instead of OS adaption layer.

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult b3790a0c26 (submit/miext-extinit) present: unexport present_extension_init()
It's not called by drivers/modules, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult b27071b35f (submit/miext-extinit) Xext: shape: unexport noShapeExtension field
This field isn't used by any drivers, and also better belongs into
the corresponding extension instead of OS adaption layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult eb452fcecc (submit/miext-extinit) res: unexport noResExtension field
This field isn't used by any drivers, and also better belongs into
the corresponding extension instead of OS adaption layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 5564d7585c (submit/miext-extinit) render: unexport noRenderExtension field
This field isn't used by any drivers, and also better belongs into
the corresponding extension instead of OS adaption layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 90984e4c9a (submit/miext-extinit) randr: unexport noRRExtension field
This field isn't used by any drivers, and also better belongs into
the corresponding extension instead of OS adaption layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 65e1b52484 (submit/miext-extinit) panoramix: move noPanoramiXExtension field into extension.
This field is better of in the corresponding extension,
than in the OS layer.

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 00176a7433 (submit/miext-extinit) glx: unexport noGlxExtension field
This field isn't used by any drivers, and also better belongs into
the corresponding extension instead of OS adaption layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 88489e86b2 (submit/miext-extinit) dpms: unexport noDPMSExtension field
This field isn't used by any drivers, and also better belongs into
the corresponding extension instead of OS adaption layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult 2909832ac8 (submit/miext-extinit) dbe: unexport noDbeExtension field
This field isn't used by any drivers, and also better belongs into
the corresponding extension instead of OS adaption layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult b8d22a1306 (submit/miext-extinit) damageext: unexport noDamageExtension field
This field isn't used by any drivers, and also better belongs into
the corresponding extension instead of OS adaption layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:11 +02:00
Enrico Weigelt, metux IT consult baae5b19a6 (submit/netbsd-pccons) netbsd: disable pccons support
On NetBSD, pccons is (almost) dead: only remaining port is arc,
but only on some specific kernel, which is unlikely to be used
for running X.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 00bedc4bbb (submit/xext-saver) Xext: saver: consolidate (non-)xinerama versions
We can make it a bit simpler by doing the request header
checking only once.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult e7291758ac (submit/xext-saver) Xext: saver: use explicit switch/case for dispatching
It's more robust / easier understandable programming style to use explicit
switch statements, case'ing on the constants defined in the protocol header,
instead of implicitly via a some opaque call table. It's also done this
way in the other extensions, so making the code a bit more consistent.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult e7797e713f (submit/xext-saver) Xext: saver: skip unneeded zero init and zero-swapping
When using struct initializers, all fields not set explicitly are zero.
Also no need to swap fields that are known to be zero.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 8837a855bc (submit/xext-saver) Xext: saver: fix missing swap in QueryVersion reply
The `majorVersion` and `minorVersion` fields are CARD16, thus need to be swapped.
OTOH, the lengths field is zero anyways, so no need to swap it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 43e988011f (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>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 49927ddf82 (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>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 52bb626cd7 (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>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 89941e666d (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>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult bb2713ce15 (submit/cleanup-damageext) damage: minor code formatting cleanups
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult b25cc0e8d4 (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>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult c4d9bd6b2a (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>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult fc3b95012e (submit/cleanup-xv-dispatch) Xext: xv: simplify dispatcher
These dispatcher functions are much more complex than they're usually are
(just switch/case statement). Bring them in line with the standard scheme
used in the Xserver, so further steps become easier.

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

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

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 3ab8f10b65 (submit/cleanup-xv-dispatch) Xext: xv: use static struct initialization on declaration
A little bit of code simplification by using static initialization
of struct right at the point of declaration. Also dropping a few now
unneccessary zero assignments.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult fc82a71e35 (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>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 652c4c4f2d (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>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 439d6977c3 (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>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 8780c16441 (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>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult bd00472bcb (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>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 8be5b12eb5 (submit/xquartz-unused-code) xquartz: drop unused code
These code pieces have been commented out since their introduction back
almost two decades ago, so probably no need for them anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult e4be1e71fe (submit/clean-modsetting-1) xfree86: modesetting: merge FreeRec() into FreeScreen()
No need to have one function doing nothing more than calling another one
with the same prototype.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult da9bcd9a07 (submit/modset-fix-vrr-hook) xace: export XaceRegisterCallback() and XaceDeleteCallback()
Allow drivers to use Xace as a clean way for retrieving property updates.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 806f613d18 (submit/vrr-driver-api) modesetting: use new VRR mode signaling DDX/driver API
Instead of highjacking core request handlers, use the recently introduced
DDX/driver API.

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

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

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

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

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

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 2e847c7b23 (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>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult b487d2d77f (submit/xrandr-swap-fix) randr: fix wrong call to RRGetScreenResources() in swapped case
ProcRRGetScreenResources() vs. RRGetScreenResourcesCurrent() have different
semantics - this also must be followed in byte-swapped case.

Fixes: fc70839431 - Add server support for RRGetScreenResourcesCurrent
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 05b748440f (submit/xnest-config.h) Xnest: drop obsolete xnest-config.h
This file became pretty no-op, just including dix-config.h.
So we can remove it now and include dix-config.h directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult e6b2a9a9ac (submit/xnest-config.h) mi: drop special include hack for Xnest
Now that Xnest is taking care of disbling unsupported extensions itself,
no more need for the special hack in here. Including xnest-config.h also
isn't needed anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 5bc3bc20d8 (submit/xnest-config.h) Xnest: no need to include xkb-config.h
Xnest doesn't need anything from xkb-config.h, so no need to include it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult fe845676cc (submit/xnest-config.h) Xnest: simplify disabling unsupported extension
Instead of strange #undef hacks in various places, just go the straight
route and set the corresponding no*Extension flags on server startup.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 9046580fdd (submit/drop-SWAPREQ_PROC) swapreq.h: drop SWAPREQ_PROC
This macro doesn't do anything more than just making the function declarations
a few bytes smaller, but this makes the code harder to read (eg. when just
grepping through the code base).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 016b2f3b9f (!1639) xfree86: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult bad606c251 (!1639) Xi: drop now obsolete swap procs
Lots of SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 7f629ec502 (!1639) Xext: xv: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult b1f5a743ea (!1639) Xext: xtest: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 51173435b6 (!1639) Xext: xcmisc: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 97c4d66252 (!1639) Xext: vidmode: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult c9cc516cf7 (!1639) Xext: sync: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult c266f3ca83 (!1639) Xext: shm: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 99f02145f0 (!1639) Xext: shape: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 074b8223d5 (!1639) Xext: saver: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult b545728853 (!1639) Xext: panoramiX: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult be4be0900c (!1639) Xext: dpms: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult df57469f2a (!1639) randr: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 683f76224a (!1639) dbe: drop now obsolete swap procs
Several SProc's have become no-ops, just calling the actual Proc's,
so we can get rid of them entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 047b7584f9 (!1639) dix: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Also dropping now obsolete SProcNoOperation().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 6992fbad67 (!1639) xwin: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 44926e6d5f (!1639) xwayland: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult cdd6a62f3f (!1639) xquartz: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult dc2818ac84 (!1639) xfree86: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 80f4475682 (!1639) Xi: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 3f2cad47a8 (!1639) Xext: xv: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 26fb8455f7 (!1639) Xext: xtest: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult fd96a57294 (!1639) Xext: selinux: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult e89a55acc5 (!1639) Xext: xres: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult f2ffdfed3d (!1639) Xext: xf86bigfont: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult e5a3b8a385 (!1639) Xext: xcmisc: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult c12a7656fa (!1639) Xext: vidmode: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 938db6decc (!1639) Xext: sync: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 2c8620a4ee (!1639) Xext: shm: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 57d8528ce5 (!1639) Xext: shape: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 8f42faa697 (!1639) Xext: security: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult f1f73d4553 (!1639) Xext: saver: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 517756ecc1 (!1639) Xext: panoramiX: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 111fd04bf1 (!1639) Xext: dpms: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 504834d877 (!1639) Xext: bigreq: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult cef72a14b2 (!1639) dri3: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 0d76ed8b2c (!1639) damage: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult d405ceb9a7 (!1639) randr: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 44fb38fdb2 (!1639) render: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult a29aa98030 (!1639) present: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 6a6f04bbe0 (!1639) pseudoramiX: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 1aca289cb5 (!1639) record: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult f30407135e (!1639) dbe: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 9ed079ed2e (!1639) composite: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 7b0fb2d50b (!1639) xfixes: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 5d0f661588 (!1639) xkb: drop swapping request length fields
The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 21b38c2772 (!1639) Xext: xtest: fix length checking with bigreq
The authorative source of the request frame size is client->req_len,
especially with big requests larger than 2^18 bytes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 9768618ad0 (!1639) Xext: vidmode: fix length checking with bigreq
The authorative source of the request frame size is client->req_len,
especially with big requests larger than 2^18 bytes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 8ebcbb5d92 (!1639) Xext: shape: fix length checking with bigreq
The authorative source of the request frame size is client->req_len,
especially with big requests larger than 2^18 bytes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 4ebeaa025d (!1639) Xext: security: fix length checking with bigreq
The authorative source of the request frame size is client->req_len,
especially with big requests larger than 2^18 bytes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult e187ea816a (!1639) Xext: saver: fix length checking with bigreq
The authorative source of the request frame size is client->req_len,
especially with big requests larger than 2^18 bytes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 2b7f53a0bf (!1639) xquartz: fix length checking with bigreq
The authorative source of the request frame size is client->req_len,
especially with big requests larger than 2^18 bytes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 31e693ca2c (!1639) xkb: fix length checking with bigreq
The authorative source of the request frame size is client->req_len,
especially with big requests larger than 2^18 bytes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 0402e58cf3 (!1639) randr: fix length checking with bigreq
The authorative source of the request frame size is client->req_len,
especially with big requests larger than 2^18 bytes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult f3520016b2 (!1639) Xi: fix length checking with bigreq
The authorative source of the request frame size is client->req_len,
especially with big requests larger than 2^18 bytes.

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

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

Fixes: ded6147b - R6.6 is the Xorg base-line
Closes:https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1644
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 69ddd7624f (submit/xrandr-swap-fix) randr: fix wrong call to RRGetScreenResources() in swapped case
ProcRRGetScreenResources() vs. RRGetScreenResourcesCurrent() have different
semantics - this also must be followed in byte-swapped case.

Fixes: fc70839431 - Add server support for RRGetScreenResourcesCurrent
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 15547148aa (!1665) glx: DoQueryContext(): use core's swapping macros
No need to have duplicated byte swapping macros in GLX for things that
the core alreay provides. Using core's macros is actually even easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 37362c5d1a (!1665) glx: DoQueryContext(): drop duplicate write path
We now have two copies of the same write path in both swapped and
non-swapped branch. One is enough.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult b8985433a3 (!1665) glx: DoQueryContext(): determine reply length from buffer size
The reply length (in units as well as bytes) can safely be determined
at compile time, by using sizeof() operator. No need for unnecessarily
complicated shifting bits back and forth.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 02d16aa845 (!1665) glx: DoQueryContext(): explicitly use reply buf type defined by spec
The spec defines the reply as array of "CARD32", not "int". The latter
just accidentially has the same type (for now :o), but it's *semantically*
incorrect. Using CARD32 instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 3e0e188960 (!1665) glx: DoQueryContext(): use fixed size array instead of variable length
Our array here really is fixed, but it's size is determined by a variable
(that's assigned a fix values), unncessarily making it a VLA (even making
it const doesn't change that), so giving false alarms when compiling w/
-Wvla or -Werror=vla.

Replacing the variable by #define trivially fixes this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult e6ade4f97d (!1665) glx: use sizeof() for reply struct
The reply struct's size can safely be determined by the sizeof()
operator, so no need for using an extra define here. Making the code
easier to read and also open the door for future convenience macros
that might determine the buffer size on their own.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 35dff2b784 (!1665) glx: assign at declaration
Assigning structs at declaration is quicker to read/understand. No need
to support ancient compilers that couldn't do that, anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 8886fbcf43 (!1654) Xnest: use xcb_window_t instead of Window
Since we're now using xcb for upstream X11 connection, it's cleaner to
use it's type for the window IDs.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 9d9e09620f (!1654) Xnest: dont link Xlib anymore
Now that we completely ported from Xlib to XCB, we can finally stop
importing Xlib :)

FIN.

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult e88d76fb69 (!1654) Xnest: use XCB for event loop
Now that no X11 calls are being done via Xlib anymore, we're free to
also move over event receiving, leaving Xlib pretty much unused.

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

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

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

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

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult f714b17888 (!1654) Xnest: replace XConnectionNumber() by xcb_get_file_descriptor()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult b782711066 (!1654) Xnest: replace XReparentWindow() by xcb_reparent_window()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 30badb7b83 (!1654) Xnest: drop using XLoadQueryFont()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 6b97b55995 (!1654) Xnest: replace XTextWidth[16]() by own implementation
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 5bc713bb86 (!1654) Xnest: load fonts via xcb
FIXME: support xf86bigfont extension
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult d66f67ba69 (!1654) Xnest: replace XQueryBestSize() by xcb_query_best_size()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult d402eb18f5 (!1654) Xnest: replace X(Un)InstallColormap() by xcb_(un)install_colormap()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 1dc7ced6a4 (!1654) Xnest: drop obsolete XGetVisualInfo() call and reundant colormaps
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult db48b04c90 (!1654) Xnest: use new lookup table for visuals and cmaps mappings
Use the visuals lookup table introduced by previous commit for
looking up local vs upstream visuals and their colormaps.
Replacing the the old Xlib visuals table.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 87324c84b3 (!1654) Xnest: screen: record visuals and cmaps in separate table
Record the associations between host's and our visuals as well their
corresponding cmaps in a global table, which's used later for lookups.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult d8cff051d8 (!1654) Xnest: fetch visuals from XCB setup data instead of Xlib
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult f78287f7b2 (!1654) Xnest: screen move assigment between depths and visual assignment to own function
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult cc43e55005 (!1654) Xnest: replace XParseGeometry() by own implementation
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 7f72f7bb31 (!1654) Xnest: replace XGetWindowAttributes() by xcb_get_geometry()
Use xcb function instead of Xlib, and also spare one additional
(unused) request.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 89b5b9bf83 (!1654) Xnest: collect upstream window geometry in one xRectangle struct
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:10 +02:00
Enrico Weigelt, metux IT consult 1f54e50281 (!1654) Xnest: replace XGetKeyboardControl() by xcb_get_keyboard_control()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 0606dce445 (!1654) Xnest: replace XGetPointerMapping() by xcb_get_pointer_mapping()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 02a49d5c73 (!1654) Xnest: replace XGetPointerControl() by xcb_get_pointer_control()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult bfbc6752aa (!1654) Xnest: replace XGetModifierMapping() by xcb_get_modifier_mapping()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult c830d73bf5 (!1654) Xnest: fetch keyboard mapping via xcb
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 3a1aa6efe5 (!1654) Xnest: add own copy of fixed xcb_xkb_get_kbd_by_name()
This is a temporary measure, until xcbproto / libxcb is fixed:
keep an own copy of the fixed xcb_xkb_get_kbd_by_name(), renamed
as xcb_xkb_get_kbd_by_name_1().

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 76e23c3705 (!1654) Xnest: use xcb for retrieving keymap controls
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 65ce2b1c65 (!1654) Xnest: replace XSelectInput() by xcb_change_window_attributes()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 5e7c5d7432 (!1654) Xnest: replace XSetStandardProperties() by xcb functions
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 2ca292bcdd (!1654) Xnest: fetch supported pixmap formats from xcb setup data
There's even no need to keep our own copies, since we can ask XCB's
copy any time.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult c0272962ce (!1654) Xnest: fetch allowed screen depths from xcb screen info
There's even no need to keep our own copies, since we can ask XCB's
copy any time.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult b38bd025d3 (!1654) Xnest: Pixmap: replace XGetImage() by xcb_get_image()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 2d3a61945c (!1654) Xnest: GC: replace XGetImage() by xcb_get_image()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 082db756c8 (!1654) Xnest: replace XDestroyWindow() by xnest_destroy_window()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult d4a593dde4 (!1654) Xnest: replace XCreatePixmapFromBitmapData() by xcb_put_image()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 0a52553260 (!1654) Xnest: replace XCreateBitmapFromData() by xcb_put_image()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult c9f03fccc6 (!1654) Xnest: replace XDefineCursor() by xcb_change_window_attributes()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 9b9b7cbfc6 (!1654) Xnest: replace xnestRecolorCursor() by xcb_recolor_cursor()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult ef2121b126 (!1654) Xnest: replace XFreeCursor() by xcb_free_cursor()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 650acbf38e (!1654) Xnest: replace XStoreColors() by xcb_store_colors()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult b28bcffd55 (!1654) Xnest: replace XQueryColors() by xcb_query_colors()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 6e435c5de2 (!1654) Xnest: replace XSetWindowColormap() by xcb_change_window_attributes()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult b64fce9391 (!1654) Xnest: replace XSetWMColormapWindows() by xcb_icccm_set_wm_colormap_windows_checked()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 63bd3e1128 (!1654) Xnest: use XIDs directly, instead of Xlib's GC
Now that no Xlib drawing functions used anymore, we can finally switch over
to using GC XID's directly, instead of Xlib's GC struct.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 46db902717 (!1654) Xnest: GC: set stipple filling via xcb_change_gc
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 643c9354a5 (!1654) Xnest: replace XSetClipMask() by xcb_change_gc()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 0bd5a4774c (!1654) Xnest: replace XSetClipRectangles() by xnset_set_clip_rectangles()
Use XCB for setting clip rectangles.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult fa03432688 (!1654) Xnest: replace XSetDashes() by xnest_set_dashes()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 622d216aa1 (!1654) Xnest: replace XChangeGC() by xcb_change_gc()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult f2760a2a3e (!1654) Xnest: replace XChangeKeyboardControl() by xcb_change_keyboard_control()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 4677bb6dfd (!1654) Xnest: replace XChangePointerControl() by xcb_change_pointer_control
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 48d27a4db5 (!1654) Xnest: replace XChangeWindowAttributes() by xcb_aux_change_window_attributes()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult b92a738cd9 (!1654) Xnest: replace XDrawImageString() by xcb_image_text_8()
Replace XDrawImageString() by xcb_image_text_8(), as well as their 16-bit
counterparts.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 502dcb55fc (!1654) Xnest: replace XDrawString[8|16]() by xcb_poly_text_[8|16]()
Replace XDrawString8() by xcb_poly_text_8(), as well as XDrawString16()
by xcb_poly_text_16(). Some care needs to be taken to prepend the xTextElt
header before sending the request out.

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult d3dc6c32a6 (!1654) Xnest: replace XFillRectangles() by xcb_poly_fill_rectangle()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult d93e9a8641 (!1654) Xnest: directly pass ClearArea request to upstream server
Instead of going through mi machinery, just pass the ClearArea
request to the upstream window.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult e7d539fdf8 (!1654) Xnest: replace XFillArcs() by xcb_poly_fill_arc()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult e5950ac008 (!1654) Xnest: replace XFillPolygon() by xcb_fill_poly()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 66a7f718d2 (!1654) Xnest: replace XCopyPlane() by xcb_copy_plane()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 9ccba989a8 (!1654) Xnest: replace XCopyArea() by xcb_copy_area()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 634d14aae5 (!1654) Xnest: replace XDrawArcs() by xcb_poly_arc()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult ea8f0b3324 (!1654) Xnest: replace XDrawRectangles() by xcb_poly_rectangle()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult cddedeab01 (!1654) Xnest: replace XDrawSegments() by xcb_poly_segment()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult c151a5e9ed (!1654) Xnest: replace XDrawLines() by xcb_poly_line()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult b510e2cf75 (!1654) Xnest: replace XDrawPoints() by xcb_poly_point()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 389e3eca37 (!1654) Xnest: replace XCreateColormap() / XFreeColormap() by xcb
Use xcb_create_colormap() and XFreeColormap() instead of XCreateColormap()
and XFreeColormap().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult fad7540c75 (!1654) Xnest: use xcb instead of XShapeCombineRegion() and XShapeCombineMask()
Using xcb_shape_rectangles() and xcb_shape_mask() instead of Xlib's
XShapeCombineRegion() and XShapeCombineMask().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult d191d06820 (!1654) Xnest: use xcb_put_image() for PutImage requests
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 573e9fd044 (!1654) Xnest: use xcb_put_image() for creating cursors
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult f563877363 (!1654) Xnest: replace XCreatePixmapCursor() by xcb_create_cursor()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 0eb425be18 (!1654) Xnest: replace XConfigureWindow() calls by xcb_configure_window()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult fbc61db6cf (!1654) Xnest: use xcb for creating / destroying pixmaps
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 62cb6492ff (!1654) Xnest: replace XBell() by xcb_bell()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult edb34c8cc5 (!1654) Xnest: use xcb for (un)mapping windows
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 3f8ef629ff (!1654) Xnest: replace XCreateWindow() by use xcb_create_window()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult c6866f8f85 (!1654) Xnest: fetch root visual ID from screen data
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 8205a253c4 (!1654) Xnest: fetch keycode min/max from setup data
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult cc6d94c528 (!1654) Xnest: fetch image metrics from xcb connection setup data
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 90d7ee7d0f (!1654) Xnest: fetch default screen's root window from screen info
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 0b0ffeaeb2 (!1654) Xnest: add helper for retrieving GC XID on upstream connection
Upcoming patches will need to retieve GC's XIDs on the upstream connection.
Moving this out into separate .c file, in order to not creating more
dependencies on Xlib headers, which we wanna get rid of.

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult b910f4b83f (!1654) Xnest: fetch default colormap from xcb screen info
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult b57a566849 (!1654) Xnest: fetch root window depth from screen info
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult e395112ffe (!1654) Xnest: fetch display size from xcb setup data
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult c4c696a1ef (!1654) Xnest: fetch BlackPixel and WhitePixel from xcb setup data
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 3818fab928 (!1654) Xnest: fetch xcb setup data
Fetching the setup data from xcb instead of Xlib, storing in our own struct,
holding all information needed for one particular upstream connection.
For now, there's only one, but future multi-upstream implementation will
change this to an array (and storing pointers to particular upstream in
various places).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult fe43e9ca60 (!1654) Xnest: use XCB_EVENT_MASK_* defines
Use xcb's defines instead of Xlib's ones.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 6dc5526552 (!1654) Xnest: use XCB*_NONE instead of None
Use xcb's defines instead of Xlib's ones.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult a346e1998e (!1654) Xnest: use XCB_BACK_PIXMAP_* defines
Use xcb's defines instead of Xlib's ones.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult dcc0169c8a (!1654) xnest: replace ExposureMask by XCB_EVENT_MASK_EXPOSURE
Use xcb's defines instead of Xlib's ones.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 86cccef9bc (!1654) Xnest: replace NotUseful by XCB_BACKING_STORE_NOT_USEFUL
Use xcb's defines instead of Xlib's ones.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult b8240ab3e1 (!1654) Xnest: use XCB_CONFIG_WINDOW_* defines instead of CW*
Use xcb's defines instead of Xlib's ones.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 9754a9d6db (!1654) Xnest: use XCB_CW_* defines instead of CW*
Use XCB's defines instead of Xlib's ones.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult d85d6e7dfb (!1654) Xnest: add xcb and x11-xcb as dependency
In order to transition to XCB, we need to link xcb, but temporarily
also x11-xcb.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult cdc18a6013 (!1614) 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.

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

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

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

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

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

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult fd889145a0 (!1596) Xext: geext: simplify dispatcher
Most of the complexity here isn't needed at all. It can be really trivial,
since we just have one operation anyways.

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>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 41f9f33660 (!1596) Xext: geext: drop unused variable extEntry
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult ca62578352 (!1601) Xext: xres: ProcXResQueryClientIds() collect reply in one buffer
In order to allow simplifying the reply send path, collect the reply
fragments into one buffer, instead of arbitrary number of WriteToClient()
calls. This also makes it much easier for potentially new purely packet-based
transports which (eg. binder) that would need their own stream parsing logic.

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 4c42242339 (!1601) Xext: xres: ProcXResQueryClientResources() simplify payload write out
Collect the few bits in a local array, so one WriteToClient() call is
sufficient. That's also easing further simplifications in upcoming commits.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 1946545f86 (!1601) Xext: xres: ProcXResQueryClientResources(): put temporary int array on stack
Simplify allocaton by putting the small temporary int array onto stack.
This also allows further simplifications by upcoming commits.

The upper bound is determined by the number of resource types registered
in the server - this can only be increased by writing new extensions.

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 14304a851a (!1601) Xext: xres: ProcXResQueryClients() put temporary int array on stack
Simplify allocaton by putting the small temporary int array onto stack.
This also allows further simplifications by upcoming commits.

Note: there's an upper bound by compile time defines (theoretically, can
be increased by special cmdline args, that virtually nobody ever using).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 3ac32208f6 (!1601) Xext: xres: sort includes
Bring #include's into some logical order.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 5743c16b3b (!1601) 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>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult fe804dfc1c (!1598) Xext: shape: clean up Xinerama dispatch
Simplify the dispatching by moving the branching between Xinerama
vs. single screen into the actual request handlers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 67bf0944d3 (!1600) Xext: xf86bigfont: drop unncessary zero assignments
When using static struct initialization, fields not explicitly
stated are automatically zero.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult e9340013c3 (!1359) dix: unexport non-public functions from dixgrabs.h and document prototypes
* unexport functions from dixgrab.h, that aren't used by any driver/module.
* add paremeter names to prototypes
* add doxygen-style documentation for all the prototypes

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 1f3179ac9d (!1359) dix: CreateGrab() rename "type" parameter to "eventType"
Make it clear what exactly this parameter is for.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult a33003a2c4 (!1359) dix: make FreeGrab() NULL tolerant
Allow NULL parameters to be passed to FreeGrab(), so callers don't all
need to check on their own anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 4f337a2760 (!1359) dix: make CopyGrab() static
This function is only called once in the same source file, no external callers
at all. So, it doesn't need to be visible outside that file, and we can allow
the compiler to do whatever fancy optimizations it might wanna do.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult cd0b9ff4e9 (!1670) dix: drop remains of ancient code generator
This script used to generated xproto header as well as a piece of source
for initializing the builtin atoms in the Xserver (MakePredeclaredAtoms()).

At least with R6.6 baseline it didn't seem to be used anymore, and - at least
since the modularization - it's completely broken and useless.

Since we now have a new generator, running directly in the build process,
this ancient script can be dropped.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 8e87055bb5 (!1670) dix: generate MakePredeclaredAtoms() from BuiltInAtoms file
This function probably been (half?) auto generated somewhere back in the
dark ages (there're still remains of the former generator, which doesn't
work anymore, and hasn't been updated for ages). It's been added to SCM
with R6.6 baseline - and from that on manually maintained.

Adding a little generator to create source from "BuiltInAtoms" file,
directly in the build process.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult a51225ea61 (!1675) ci: enable xv and xvmc
Needed for the xf86-video-intel driver, so we should build-test it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 00363c8840 (!1675) Revert "xv: unexport XvScreenRec and XvScreenPtr"
This reverts commit 58a2fb8b6f.

Needed by xf86-video-intel driver. Didn't get noticed, because we don't
have this driver in our CI yet.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 7d6464e029 (!1677) os: drop obsolete LogHdrMessage()
This function isn't used anywhere, so no need to keep it around.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult e8b6bd4731 (!1681) xfree86: common: use LogMessageVerb() instead of xf86Msg()
Both are doing same job, so no need to keep using an duplicated implementation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 630b3144b8 (!1681) xfree86: fbdevhw: use LogMessageVerb() instead of xf86Msg()
Both are doing same job, so no need to keep using an duplicated implementation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 5d115439ca (!1681) xfree86: os-support: use LogMessageVerb() instead of xf86Msg()
Both are doing same job, so no need to keep using an duplicated implementation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 3763bcab18 (!1681) xfree86: i2c: use LogMessageVerb() instead of xf86Msg()
Both are doing same job, so no need to keep using an duplicated implementation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 16e4bcb019 (!1681) glx: use LogMessageVerb() instead of xf86Msg()
Both are doing same job, so no need to keep using an duplicated implementation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 50df7ed4a6 (!1681) xfree86: use LogMessageVerb() instead of xf86MsgVerb()
Both are doing same job, so no need to keep using an duplicated implementation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 82667ad3ae (!1682) os: log: consolidate OS specific fsync() call into helper
Instead of having lots of #ifdef's, consolidating the conditionally
compiled fsync() call into a tiny inline helper.

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

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult ac22cf2d45 (!1682) os: log via fd instead of FILE
Instead of maintaining both the logfile fd, as well as ANSI FILE pointer,
simplify it to just a fd.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:09 +02:00
Enrico Weigelt, metux IT consult 754dbbb73a (!1683) os: replace LogVWrite() by LogVMessageVerb()
It's just a wrapper around LogVMessageVerb() and no external module
using it, so can easily be optimized-away.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:08 +02:00
Enrico Weigelt, metux IT consult f59440d82f (!1683) os: replace LogWrite() by LogMessageVerb()
It's nothing but a wrapper, doing the same as LogMessageVerb(X_NONE, ...),
and no external module / driver needs it, so can be easily optimized away.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:08 +02:00
Enrico Weigelt, metux IT consult c92d7037db (!1685) os: log: use localtime_r() on mingw builds
MingW also provides localtime_r(), but needs _POSIX_THREAD_SAFE_FUNCTIONS
symbol before including anything, in order for the prototype being defined.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:08 +02:00
Enrico Weigelt, metux IT consult e305638cc9 (!1684) os.h: drop unnecessary guard on stdlib.h include
It's a standard C header, that's always present, so no extra guard needed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:08 +02:00
Enrico Weigelt, metux IT consult c2e0309612 (!1686) os: drop redefining getpid() on mingw32
mingw32 does does have getpid() function, so conditionally redefining
it to _getpid() isn't necessary.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:08 +02:00
Enrico Weigelt, metux IT consult a4d09ecc82 (!1687) xfree86: unexport xf86SetVerbosity() and xf86SetLogVerbosity()
These aren't used by any modules/drivers, so no need to keep them exported.
Also drop the return value, which isn't used by any caller.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:08 +02:00
Enrico Weigelt, metux IT consult 9f0395bfe9 (!1696) ci: build more drivers
Increase driver build test coverage by adding more drivers.
Only left out those which won't compile on Linux (yet).

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-09-18 17:23:08 +02:00
872 changed files with 34245 additions and 16162 deletions

View File

@ -1,24 +0,0 @@
# This file contains revisions to be ignored by git blame.
# These revisions are expected to be formatting-only changes.
#
# Calling `git blame --ignore-revs-file .git-blame-ignore-revs` will
# tell git blame to ignore changes made by these revisions when assigning
# assigning blame, as if the change never happened.
#
# You can enable this as a default for your local repository by running
# `git config blame.ignoreRevsFile .git-blame-ignore-revs`
# Important: if you do this, then switch to a branch without this file,
# `git blame` will fail with an error.
#
# Introduce a consistent coding style
9838b7032ea9792bec21af424c53c07078636d21
# Drop trailing whitespaces
732fd7e571b81d63aa44d6e4cf55883479e88f2f
# glamor: Apply x-indent.sh.
d84d71029ae9e462559d64eff7259e2cc7732fac
# indent fixes (OMG SO UGLY), and nuke old RCS keywords.
6d7083bd69724586338d79784655328f1fcd2ae5

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

@ -4,7 +4,7 @@
# Please see the ci-templates documentation for details:
# https://freedesktop.pages.freedesktop.org/ci-templates/
.templates_sha: &template_sha ef5e4669b7500834a17ffe9277e15fbb6d977fff # see https://docs.gitlab.com/ee/ci/yaml/#includefile
.templates_sha: &template_sha c5626190ec14b475271288dda7a7dae8dbe0cd76 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
# FDO_DISTRIBUTION_TAG is the tag of the docker image used for the build jobs.
# If the image doesn't exist yet, the docker-image stage generates it.
@ -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_FREEBSD_VERSION: '14.2'
XORG_DEBIAN_TAG: '2024-09-13-xvmc'
XORG_FREEBSD_VERSION: '14.0'
XORG_FREEBSD_EXEC: ''
XORG_FREEBSD_TAG: '2025-05-27-xcb'
XORG_FREEBSD_TAG: '2024-09-10-fix-freebsd-xcb'
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/**/*
@ -102,14 +105,11 @@ stages:
FDO_DISTRIBUTION_TAG: '$XORG_DEBIAN_TAG'
.freebsd:
tags:
- kvm
variables:
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_IMAGE_SIZE: '30G'
debian-bullseye:
extends:
@ -169,23 +169,22 @@ meson:
- .gitlab-ci/meson-build.sh --run-test
- .gitlab-ci/check-piglit-results.sh
- .gitlab-ci/manpages-check
- .gitlab-ci/check-ddx-build.sh
variables:
XTEST_DIR: /root/xts
PIGLIT_DIR: /root/piglit
LP_NUM_THREADS: 0
MESON_DDX_BUILD_ARGS: >
-Dxorg=${BUILD_XORG} -Dxephyr=${BUILD_XEPHYR} -Dxvfb=${BUILD_XVFB} -Dxnest=${BUILD_XNEST}
BUILD_XEPHYR: true
BUILD_XNEST: true
BUILD_XORG: true
BUILD_XVFB: true
MESON_EXTRA_ARGS: ${MESON_DDX_BUILD_ARGS}
meson-noglamor:
extends: meson
variables:
MESON_EXTRA_ARGS: -Dglamor=false ${MESON_DDX_BUILD_ARGS}
MESON_EXTRA_ARGS: >
-Dglamor=false
xwayland-nolibdecor:
extends: meson
variables:
MESON_EXTRA_ARGS: >
-Dlibdecor=false -Dxorg=false -Dxephyr=false -Dxvfb=false -Dxnest=false
mingw-cross-build:
extends: .common-build-and-test
@ -208,8 +207,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
@ -225,18 +222,17 @@ meson-dist:
when: always
paths:
- $MESON_BUILDDIR/meson-logs/
- $MESON_BUILDDIR/xserver-*/$MESON_BUILDDIR/meson-logs/
- xserver-tarball/install/
- $MESON_BUILDDIR/xlibre-xnest-*/$MESON_BUILDDIR/meson-logs/
script:
- .gitlab-ci/meson-build.sh --run-dist
- mkdir xserver-tarball
- tar xf $MESON_BUILDDIR/meson-dist/xserver-*.tar.xz -C xserver-tarball --strip-components=1
- tar xf $MESON_BUILDDIR/meson-dist/xlibre-xnest-*.tar.xz -C xserver-tarball --strip-components=1
- .gitlab-ci/meson-build.sh -C xserver-tarball --skip-test --skip-dist --run-install
variables:
MESON_DIST_ARGS: --no-tests
MESON_EXTRA_ARGS: -Dprefix=$CI_PROJECT_DIR/xserver-tarball/install/
DESTDIR: xserver-tarball/install/
xf86-driver-build-test:
.xf86-driver-build-test:
extends:
- .xorg-image@debian
- .ci-run-policy
@ -244,124 +240,140 @@ xf86-driver-build-test:
parallel:
matrix:
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-input-elographics
SHA: xf86-input-elographics-1.4.4
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev
SHA: xf86-input-evdev-2.11.0
SHA: xf86-input-evdev-2.10.6
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-input-joystick
SHA: fa296d27fb479107fa6328a7565f665de2de98d3 # 5 commits ahead of 1.6.4
SHA: master
- 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
SHA: xf86-input-synaptics-1.9.2
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-input-vmmouse
SHA: 3bbcb6a143bb3f53e5b776fb70a4933229c1781a # 2 commits ahead of 13.2.0
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-input-void
SHA: b43e11eeb8b96aa87da910991da8b005d9847783 # 4 commits ahead of 1.4.2
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu
SHA: 2cb59a92de4a19909682a35e4f31f3c02de2899f # 18 commits ahead of 23.0.0
SHA: xf86-video-amdgpu-23.0.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-apm
SHA: 196784e691b8f8739792439434ffa002e9f5cdfa # 14 commits ahead of 1.3.0
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-ark
SHA: 109745d5c7e6982ee0dabbc5a233c1f2667ad5c9 # 9 commits ahead of 0.7.4
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-armsoc
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-ast
SHA: db56de34bdf70f1904dba50d98774aaa950a2ca5 # 10 commits ahead of 1.1.6
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati
SHA: c610c037369500089baddd86aa3cf8046f3dc48b # 11 commits ahead of 22.0.0
SHA: xf86-video-ati-22.0.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-chips
SHA: 4503aece04cc8860df18ce946633b5449a0cb47b # 7 commits ahead of 1.5.0
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-cirrus
SHA: 15d68316524c593bd67a6ea59b5c746a94c6c1f6 # 10 commits ahead of 1.6.0
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-dummy
SHA: 3a407a34c4a2b6b263a535b6aa7b49dd70784fdf # 9 commits ahead of 0.4.1
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-fbdev
SHA: c8d9f3be7e95689d793bb2f45a5dddf409e46811 # 15 commits ahead of 0.5.0
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-i128
SHA: 4fd0309834deca78e5ef6cad5ecba8864a308ba5 # 7 commits ahead of 1.4.1
SHA: master
- 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
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-mach64
SHA: 878048e3aec04c6bb8034f21afdfff37e3528c5f # 20 commits ahead of 6.9.7
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-mga
SHA: 66ee371516c48c30b67684317a8e3c24ba7f1f4e # 11 commits ahead of 2.0.1
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-neomagic
SHA: 69cafdeebf7c338ede076424f9bcb97f26ede7a8 # 8 commits ahead of 1.3.1
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-nested
SHA: 86b6dc3bb6d78f40905ecc63df3635b284214836 # no release yet
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-nouveau
SHA: xf86-video-nouveau-1.0.18
SHA: master
- 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
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-qxl
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-r128
SHA: bc21fcdffa623bb8e7150e1da69aeaed6cd7c5d2 # 1 commits ahead of 6.13.0
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-rendition
SHA: 49d50f1fdeb4dc81895fec81be9fae1dc78e5974 # 14 commits ahead of 4.2.7
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-s3virge
SHA: 8834f100114ba136d52590e711054ab063306421 # 11 commits ahead of 1.11.1
SHA: master
- 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
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-siliconmotion
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-sis
SHA: ee451146c0afd735b50488588f82f3f158e9da03 # 68 commits ahead of 0.12.0
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-sisusb
SHA: ccff93b681968463d00793a9a7c5c2db8301634f # 30 commits ahead of 0.12.0
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-suncg14
SHA: 471e04fe84abaf2f868fb85566d99495142692a9 # 9 commits ahead of 1.1.3
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-suncg3
SHA: 8162844221f6d59e540c3c3a146a9c581d413949 # 9 commits ahead of 1.1.3
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-suncg6
SHA: 37a28d0d9dbb9b0c6631aa7b09d558d5f552c627 # 10 commits ahead of 1.1.3
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-sunffb
SHA: 6100635debdda392ca420e87c5b0d70bd22dfed8 # 14 commits ahead of 1.2.3
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-sunleo
SHA: 6d56a007f3d47fa43e95f1a0c8619be00b0c1c97 # 10 commits ahead of 1.2.3
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-suntcx
SHA: c1c0e384b95da18b81793612b90f693891f2e476 # 9 commits ahead of 1.1.3
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-tdfx
SHA: 5253278119a4db07b5a01856f0de34e576f4dcdd # 9 commits ahead of 1.5.0
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-trident
SHA: fddaa2084b9aac51a845ee1ede8c498cbc9330cf # 13 commits ahead of 1.4.0
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-v4l
SHA: eb1e55874cbacf7455f70269581a877e88e3bf37 # 15 commits ahead of 0.3.0
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-vbox
SHA: ec4bc6b8e9d1a83526573d27afd099debbd5b86b # 7 commits ahead of 1.0.1
SHA: master
- 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
SHA: xf86-video-vmware-13.4.0
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-voodoo
SHA: c70353ddf49d557c596a47b835b6b8d8bbe35ebe # 15 commits ahead of 1.2.6
SHA: master
- REPO: https://gitlab.freedesktop.org/xorg/driver/xf86-video-xgi
SHA: e73ff14a7f1b7562ff447aad527641cc35f557ae # 49 commits ahead 1.6.1
SHA: master
script:
# built xserver is taken from meson-dist job
- export PKG_CONFIG_PATH=$(pwd)/xserver-tarball/install/lib/x86_64-linux-gnu/pkgconfig
- export ACLOCAL_PATH=$(pwd)/xserver-tarball/install/share/aclocal/
# Install the server first
- .gitlab-ci/meson-build.sh --skip-test --run-install
- unset MESON_EXTRA_ARGS
- DRIVER=$(basename $REPO)
- git clone "$REPO" "$DRIVER"
- git -C "$DRIVER" checkout "$SHA"
- |
if [[ -e "$DRIVER/meson.build" ]] && [[ "$DRIVER" != "xf86-video-intel" ]]; then
if [[ -e "$DRIVER/meson.build" ]]; then
.gitlab-ci/meson-build.sh -C "$DRIVER" --skip-test
else
pushd "$DRIVER" || exit 1
./autogen.sh && make
fi
needs:
- meson-dist
dependencies:
- meson-dist
- "meson"
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
#
# 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

@ -1,25 +0,0 @@
#!/bin/bash
set -e
set -o xtrace
check_executable () {
if [[ ! -x $MESON_BUILDDIR/$1 ]]; then
echo "$1 not found after build"
exit 1
fi
return 0
}
if [[ -z "$MESON_BUILDDIR" ]]; then
echo "\$MESON_BUILDDIR not set"
exit 1
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"
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,13 +60,12 @@ apt-get install -y \
libtool \
libudev-dev \
libunwind-dev \
libwayland-dev \
libx11-dev \
libx11-xcb-dev \
libxau-dev \
libxaw7-dev \
libxcb-damage0-dev \
libxcb-dri2-0-dev \
libxcb-dri3-dev \
libxcb-glx0-dev \
libxcb-icccm4-dev \
libxcb-image0-dev \
@ -75,15 +75,11 @@ apt-get install -y \
libxcb-render0-dev \
libxcb-shape0-dev \
libxcb-shm0-dev \
libxcb-sync-dev \
libxcb-util0-dev \
libxcb-xf86dri0-dev \
libxcb-xinput-dev \
libxcb-xkb-dev \
libxcb-xv0-dev \
libxcb1-dev \
libxcursor-dev \
libxdamage-dev \
libxdmcp-dev \
libxext-dev \
libxfixes-dev \
@ -95,16 +91,13 @@ apt-get install -y \
libxmu-dev \
libxmuu-dev \
libxpm-dev \
libxrandr-dev \
libxrender-dev \
libxres-dev \
libxshmfence-dev \
libxss-dev \
libxt-dev \
libxtst-dev \
libxv-dev \
libxvmc-dev \
libxxf86vm-dev \
libz-mingw-w64-dev \
linux-libc-dev/bullseye-backports \
mesa-common-dev \
@ -117,7 +110,6 @@ apt-get install -y \
python3-mako \
python3-numpy \
python3-six \
valgrind \
weston \
x11-xkb-utils \
xfonts-utils \
@ -129,8 +121,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 +137,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 +145,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.34, but Debian bullseye has 1.20 only
git clone https://gitlab.freedesktop.org/wayland/wayland-protocols.git --depth 1 --branch=1.34
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
@ -160,8 +184,10 @@ cd ..
git clone https://gitlab.freedesktop.org/xorg/test/xts
cd xts
git checkout 12a887c2c72c4258962b56ced7b0aec782f1ffed
./autogen.sh
git checkout dbbfa96c036e596346147081cbceda136e7c86c1
# Using -fcommon until we get a proper fix into xtst.
# See discussion at https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/913
CFLAGS=-fcommon ./autogen.sh
xvfb-run make -j${FDO_CI_CONCURRENT:-4}
cd ..

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

@ -277,8 +277,7 @@ Paulo Zanoni <paulo.r.zanoni@intel.com> Paulo Ricardo Zanoni <pzanoni@mandriva.c
Pekka Paalanen <pekka.paalanen@collabora.co.uk> <pekka.paalanen@collabora.com>
Peter Harris <pharris2@rocketsoftware.com> <peter.harris@hummingbird.com>
Peter Harris <pharris2@rocketsoftware.com> <pharris@opentext.com>
Peter Harris <pharris@opentext.com> <peter.harris@hummingbird.com>
Peter Hutterer <peter.hutterer@who-t.net> <peter.hutterer@redhat.com>
Peter Hutterer <peter.hutterer@who-t.net> <peter@cs.unisa.edu.au>

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

@ -34,7 +34,6 @@ Equipment Corporation.
#include "miext/extinit_priv.h"
#include "os/screensaver.h"
#include "Xext/geext_priv.h"
#include "misc.h"
#include "os.h"
@ -145,9 +144,10 @@ ProcDPMSSelectInput(register ClientPtr client)
}
/* build the entry */
pNewEvent = calloc(1, sizeof(DPMSEventRec));
pNewEvent = (DPMSEventPtr)malloc(sizeof(DPMSEventRec));
if (!pNewEvent)
return BadAlloc;
pNewEvent->next = 0;
pNewEvent->client = client;
pNewEvent->mask = stuff->eventMask;
/*
@ -163,7 +163,7 @@ ProcDPMSSelectInput(register ClientPtr client)
* of clients selecting input
*/
if (i != Success || !pHead) {
pHead = calloc(1, sizeof(DPMSEventPtr));
pHead = (DPMSEventPtr *)malloc(sizeof(DPMSEventPtr));
if (!pHead ||
!AddResource(eventResource, DPMSEventType, (void *)pHead)) {
FreeResource(clientResource, X11_RESTYPE_NONE);
@ -588,7 +588,7 @@ DPMSExtensionInit(void)
ClientType = CreateNewResourceType(DPMSFreeClient, "DPMSClient");
DPMSEventType = CreateNewResourceType(DPMSFreeEvents, "DPMSEvent");
eventResource = dixAllocServerXID();
eventResource = FakeClientID(0);
if (DPMSEnabled && ClientType && DPMSEventType &&
(extEntry = AddExtension(DPMSExtensionName, 0, 0,

View File

@ -1,6 +1,8 @@
/* Prototypes for functions that the DDX must provide */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _DPMSPROC_H_
#define _DPMSPROC_H_

View File

@ -26,34 +26,20 @@
#include <dix-config.h>
#include <X11/extensions/ge.h>
#include <X11/extensions/geproto.h>
#include "miext/extinit_priv.h"
#include "Xext/geext_priv.h"
#include "windowstr.h"
#include "miext/extinit_priv.h"
#include "geint.h"
#include "geext.h"
#include "protocol-versions.h"
#define MAXEXTENSIONS 128
Bool noGEExtension = FALSE;
DevPrivateKeyRec GEClientPrivateKeyRec;
#define GEClientPrivateKey (&GEClientPrivateKeyRec)
/** Struct to keep information about registered extensions */
typedef struct _GEExtension {
/** Event swapping routine */
void (*evswap) (xGenericEvent *from, xGenericEvent *to);
} GEExtension, *GEExtensionPtr;
static GEExtension GEExtensions[MAXEXTENSIONS];
typedef struct _GEClientInfo {
CARD32 major_version;
CARD32 minor_version;
} GEClientInfoRec, *GEClientInfoPtr;
#define GEGetClient(pClient) ((GEClientInfoPtr)(dixLookupPrivate(&((pClient)->devPrivates), GEClientPrivateKey)))
GEExtension GEExtensions[MAXEXTENSIONS];
/* Forward declarations */
static void SGEGenericEvent(xEvent *from, xEvent *to);
@ -110,7 +96,7 @@ SProcGEQueryVersion(ClientPtr client)
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
return ProcGEQueryVersion(client);
return SProcGEQueryVersion(client);
}
/************************************************************/
@ -215,3 +201,14 @@ GERegisterExtension(int extension,
/* extension opcodes are > 128, might as well save some space here */
GEExtensions[EXT_MASK(extension)].evswap = ev_swap;
}
/* Sets type and extension field for a generic event. This is just an
* auxiliary function, extensions could do it manually too.
*/
void
GEInitEvent(xGenericEvent *ev, int extension)
{
ev->type = GenericEvent;
ev->extension = extension;
ev->length = 0;
}

81
Xext/geext.h Normal file
View File

@ -0,0 +1,81 @@
/*
Copyright 2007 Peter Hutterer <peter@cs.unisa.edu.au>
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the author shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the author.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _GEEXT_H_
#define _GEEXT_H_
#include <X11/extensions/geproto.h>
/** Struct to keep information about registered extensions */
typedef struct _GEExtension {
/** Event swapping routine */
void (*evswap) (xGenericEvent *from, xGenericEvent *to);
} GEExtension, *GEExtensionPtr;
/* All registered extensions and their handling functions. */
extern _X_EXPORT GEExtension GEExtensions[MAXEXTENSIONS];
/* Typecast to generic event */
#define GEV(ev) ((xGenericEvent*)(ev))
/* Returns the extension offset from the event */
#define GEEXT(ev) (GEV(ev)->extension)
/* Return zero-based extension offset (offset - 128). Only for use in arrays */
#define GEEXTIDX(ev) (GEEXT(ev) & 0x7F)
/* True if mask is set for extension on window */
#define GEMaskIsSet(pWin, extension, mask) \
((pWin)->optional && \
(pWin)->optional->geMasks && \
((pWin)->optional->geMasks->eventMasks[(extension) & 0x7F] & (mask)))
/* Returns first client */
#define GECLIENT(pWin) \
(((pWin)->optional) ? (pWin)->optional->geMasks->geClients : NULL)
/* Returns the event_fill for the given event */
#define GEEventFill(ev) \
GEExtensions[GEEXTIDX(ev)].evfill
#define GEIsType(ev, ext, ev_type) \
((GEV(ev)->type == GenericEvent) && \
GEEXT(ev) == (ext) && \
GEV(ev)->evtype == (ev_type))
/* Interface for other extensions */
extern _X_EXPORT void GERegisterExtension(int extension,
void (*ev_dispatch) (xGenericEvent
*from,
xGenericEvent
*to));
extern _X_EXPORT void GEInitEvent(xGenericEvent *ev, int extension);
#endif /* _GEEXT_H_ */

View File

@ -1,22 +0,0 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*/
#ifndef _XORG_GEEXT_PRIV_H
#define _XORG_GEEXT_PRIV_H
#include <X11/Xproto.h>
typedef void (*XorgGESwapProcPtr) (xGenericEvent *from, xGenericEvent *to);
/*
* Register generic event extension dispatch handler
*
* @param extension base opcode
* @param event swap handler function
*/
_X_EXPORT /* just for Nvidia legacy */
void GERegisterExtension(int extension, XorgGESwapProcPtr swap_handler);
#endif /* _XORG_GEEXT_PRIV_H */

51
Xext/geint.h Normal file
View File

@ -0,0 +1,51 @@
/*
* Copyright 2007-2008 Peter Hutterer
*
* 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, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Author: Peter Hutterer, University of South Australia, NICTA
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _GEINT_H_
#define _GEINT_H_
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include <X11/extensions/geproto.h>
extern DevPrivateKeyRec GEClientPrivateKeyRec;
#define GEClientPrivateKey (&GEClientPrivateKeyRec)
typedef struct _GEClientInfo {
CARD32 major_version;
CARD32 minor_version;
} GEClientInfoRec, *GEClientInfoPtr;
#define GEGetClient(pClient) ((GEClientInfoPtr)(dixLookupPrivate(&((pClient)->devPrivates), GEClientPrivateKey)))
#endif /* _GEINT_H_ */

View File

@ -1,9 +1,6 @@
#include <dix-config.h>
#include <stdlib.h>
#include "dix/resource_priv.h"
#include "misc.h"
#include "hashtable.h"
@ -42,7 +39,7 @@ ht_create(int keySize,
{
int c;
int numBuckets;
HashTable ht = calloc(1, sizeof(struct HashTableRec));
HashTable ht = malloc(sizeof(struct HashTableRec));
if (!ht) {
return NULL;
@ -55,7 +52,7 @@ ht_create(int keySize,
ht->elements = 0;
ht->bucketBits = INITHASHSIZE;
numBuckets = 1 << ht->bucketBits;
ht->buckets = calloc(numBuckets, sizeof(*ht->buckets));
ht->buckets = xallocarray(numBuckets, sizeof(*ht->buckets));
ht->cdata = cdata;
if (ht->buckets) {
@ -96,7 +93,7 @@ double_size(HashTable ht)
int newNumBuckets = 1 << newBucketBits;
int c;
newBuckets = calloc(newNumBuckets, sizeof(*ht->buckets));
newBuckets = xallocarray(newNumBuckets, sizeof(*ht->buckets));
if (newBuckets) {
for (c = 0; c < newNumBuckets; ++c) {
xorg_list_init(&newBuckets[c]);
@ -130,7 +127,7 @@ ht_add(HashTable ht, const void *key)
if (!elem) {
goto outOfMemory;
}
elem->key = calloc(1, ht->keySize);
elem->key = malloc(ht->keySize);
if (!elem->key) {
goto outOfMemory;
}

View File

@ -51,15 +51,15 @@ typedef struct {
@param[in] cdata Opaque data that will be passed to hash and
comparison functions
*/
HashTable ht_create(int keySize,
int dataSize,
HashFunc hash,
HashCompareFunc compare,
void *cdata);
extern _X_EXPORT HashTable ht_create(int keySize,
int dataSize,
HashFunc hash,
HashCompareFunc compare,
void *cdata);
/** @brief HtDestruct deinitializes the structure. It does not free the
memory allocated to HashTableRec
*/
void ht_destroy(HashTable ht);
extern _X_EXPORT void ht_destroy(HashTable ht);
/** @brief Adds a new key to the hash table. The key will be copied
and a pointer to the value will be returned. The data will
@ -75,12 +75,12 @@ void ht_destroy(HashTable ht);
to avoid returning NULL. Obviously the data pointed cannot be
modified, as implied by dataSize being 0.
*/
void *ht_add(HashTable ht, const void *key);
extern _X_EXPORT void *ht_add(HashTable ht, const void *key);
/** @brief Removes a key from the hash table along with its
associated data, which will be free'd.
*/
void ht_remove(HashTable ht, const void *key);
extern _X_EXPORT void ht_remove(HashTable ht, const void *key);
/** @brief Finds the associated data of a key from the hash table.
@ -93,45 +93,45 @@ void ht_remove(HashTable ht, const void *key);
use HtMember instead to determine if a key has been
inserted.
*/
void *ht_find(HashTable ht, const void *key);
extern _X_EXPORT void *ht_find(HashTable ht, const void *key);
/** @brief A generic hash function */
unsigned ht_generic_hash(void *cdata,
const void *ptr,
int numBits);
extern _X_EXPORT unsigned ht_generic_hash(void *cdata,
const void *ptr,
int numBits);
/** @brief A generic comparison function. It compares data byte-wise. */
int ht_generic_compare(void *cdata,
const void *l,
const void *r);
extern _X_EXPORT int ht_generic_compare(void *cdata,
const void *l,
const void *r);
/** @brief A debugging function that dumps the distribution of the
hash table: for each bucket, list the number of elements
contained within. */
void ht_dump_distribution(HashTable ht);
extern _X_EXPORT void ht_dump_distribution(HashTable ht);
/** @brief A debugging function that dumps the contents of the hash
table: for each bucket, list the elements contained
within. */
void ht_dump_contents(HashTable ht,
void (*print_key)(void *opaque, void *key),
void (*print_value)(void *opaque, void *value),
void* opaque);
extern _X_EXPORT void ht_dump_contents(HashTable ht,
void (*print_key)(void *opaque, void *key),
void (*print_value)(void *opaque, void *value),
void* opaque);
/** @brief A hashing function to be used for hashing resource IDs when
used with HashTables. It makes no use of cdata, so that can
be NULL. It uses HashXID underneath, and should HashXID be
unable to hash the value, it switches into using the generic
hash function. */
unsigned ht_resourceid_hash(void *cdata,
const void * data,
int numBits);
extern _X_EXPORT unsigned ht_resourceid_hash(void *cdata,
const void * data,
int numBits);
/** @brief A comparison function to be used for comparing resource
IDs when used with HashTables. It makes no use of cdata,
so that can be NULL. */
int ht_resourceid_compare(void *cdata,
const void *a,
const void *b);
extern _X_EXPORT int ht_resourceid_compare(void *cdata,
const void *a,
const void *b);
#endif // HASHTABLE_H

View File

@ -9,6 +9,8 @@ srcs_xext = [
]
hdrs_xext = [
'geext.h',
'geint.h',
'syncsdk.h',
]
@ -43,6 +45,7 @@ endif
if build_xinerama
srcs_xext += ['panoramiX.c', 'panoramiXprocs.c', 'panoramiXSwap.c']
hdrs_xext += ['panoramiX.h', 'panoramiXsrv.h']
endif
if build_xsecurity
@ -58,13 +61,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,11 +32,7 @@ Equipment Corporation.
#include <X11/extensions/panoramiXproto.h>
#include "dix/dix_priv.h"
#include "dix/resource_priv.h"
#include "dix/screen_hooks_priv.h"
#include "miext/extinit_priv.h"
#include "Xext/panoramiX.h"
#include "Xext/panoramiXsrv.h"
#include "misc.h"
#include "cursor.h"
@ -49,13 +45,17 @@ Equipment Corporation.
#include "window.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "panoramiX.h"
#include "panoramiXsrv.h"
#include "globals.h"
#include "servermd.h"
#include "resource.h"
#include "picturestr_priv.h"
#include "xfixesint.h"
#include "damageextint.h"
#ifdef COMPOSITE
#include "compint.h"
#endif
#include "protocol-versions.h"
#ifdef GLXPROXY
@ -74,7 +74,7 @@ int PanoramiXPixWidth = 0;
int PanoramiXPixHeight = 0;
int PanoramiXNumScreens = 0;
RegionRec PanoramiXScreenRegion = { {0, 0, 0, 0}, NULL };
_X_EXPORT RegionRec PanoramiXScreenRegion = { {0, 0, 0, 0}, NULL };
static int PanoramiXNumDepths;
static DepthPtr PanoramiXDepths;
@ -88,7 +88,7 @@ RESTYPE XRT_GC;
RESTYPE XRT_COLORMAP;
static Bool VisualsEqual(VisualPtr, ScreenPtr, VisualPtr);
static XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr = &VisualsEqual;
XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr = &VisualsEqual;
/*
* Function prototypes
@ -123,6 +123,7 @@ typedef struct {
typedef struct {
CreateGCProcPtr CreateGC;
CloseScreenProcPtr CloseScreen;
} PanoramiXScreenRec, *PanoramiXScreenPtr;
static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr);
@ -147,23 +148,21 @@ static const GCFuncs XineramaGCFuncs = {
pGCPriv->wrapFuncs = (pGC)->funcs;\
(pGC)->funcs = &XineramaGCFuncs;
static void XineramaCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unsused)
static Bool
XineramaCloseScreen(ScreenPtr pScreen)
{
dixScreenUnhookClose(pScreen, XineramaCloseScreen);
PanoramiXScreenPtr pScreenPriv = (PanoramiXScreenPtr)
dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey);
if (!pScreenPriv)
return;
pScreen->CloseScreen = pScreenPriv->CloseScreen;
pScreen->CreateGC = pScreenPriv->CreateGC;
if (pScreen->myNum == 0)
RegionUninit(&PanoramiXScreenRegion);
free(pScreenPriv);
dixSetPrivate(&pScreen->devPrivates, PanoramiXScreenKey, NULL);
return (*pScreen->CloseScreen) (pScreen);
}
static Bool
@ -353,7 +352,7 @@ PanoramiXFindIDByScrnum(RESTYPE type, XID id, int screen)
data.screen = screen;
data.id = id;
return LookupClientResourceComplex(dixClientForXID(id), type,
return LookupClientResourceComplex(clients[CLIENT_ID(id)], type,
XineramaFindIDByScrnum, &data);
}
@ -369,7 +368,7 @@ XineramaRegisterConnectionBlockCallback(void (*func) (void))
{
XineramaConnectionCallbackList *newlist;
if (!(newlist = calloc(1, sizeof(XineramaConnectionCallbackList))))
if (!(newlist = malloc(sizeof(XineramaConnectionCallbackList))))
return FALSE;
newlist->next = ConnectionCallbackList;
@ -385,7 +384,7 @@ XineramaInitData(void)
int i, w, h;
RegionNull(&PanoramiXScreenRegion);
FOR_NSCREENS_BACKWARD(i) {
FOR_NSCREENS(i) {
BoxRec TheBox;
RegionRec ScreenRegion;
@ -419,6 +418,13 @@ XineramaInitData(void)
}
}
void
XineramaReinitData(void)
{
RegionUninit(&PanoramiXScreenRegion);
XineramaInitData();
}
/*
* PanoramiXExtensionInit():
* Called from InitExtensions in main().
@ -433,6 +439,7 @@ PanoramiXExtensionInit(void)
Bool success = FALSE;
ExtensionEntry *extEntry;
ScreenPtr pScreen = screenInfo.screens[0];
PanoramiXScreenPtr pScreenPriv;
if (noPanoramiXExtension)
return;
@ -467,9 +474,9 @@ PanoramiXExtensionInit(void)
* run in non-PanoramiXeen mode.
*/
FOR_NSCREENS_BACKWARD(i) {
FOR_NSCREENS(i) {
pScreen = screenInfo.screens[i];
PanoramiXScreenPtr pScreenPriv = calloc(1, sizeof(PanoramiXScreenRec));
pScreenPriv = malloc(sizeof(PanoramiXScreenRec));
dixSetPrivate(&pScreen->devPrivates, PanoramiXScreenKey,
pScreenPriv);
if (!pScreenPriv) {
@ -477,10 +484,11 @@ PanoramiXExtensionInit(void)
return;
}
dixScreenHookClose(pScreen, XineramaCloseScreen);
pScreenPriv->CreateGC = pScreen->CreateGC;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CreateGC = XineramaCreateGC;
pScreen->CloseScreen = XineramaCloseScreen;
}
XRC_DRAWABLE = CreateNewResourceClass();
@ -576,7 +584,10 @@ PanoramiXExtensionInit(void)
PanoramiXRenderInit();
PanoramiXFixesInit();
PanoramiXDamageInit();
#ifdef COMPOSITE
PanoramiXCompositeInit();
#endif
}
Bool
@ -795,6 +806,7 @@ extern void
PanoramiXConsolidate(void)
{
int i;
PanoramiXRes *root, *defmap, *saver;
ScreenPtr pScreen = screenInfo.screens[0];
DepthPtr pDepth = pScreen->allowedDepths;
VisualPtr pVisual = pScreen->visuals;
@ -808,26 +820,14 @@ PanoramiXConsolidate(void)
for (i = 0; i < pScreen->numVisuals; i++)
PanoramiXMaybeAddVisual(pVisual++);
PanoramiXRes *root = calloc(1, sizeof(PanoramiXRes));
if (!root)
return;
root = malloc(sizeof(PanoramiXRes));
root->type = XRT_WINDOW;
PanoramiXRes *defmap = calloc(1, sizeof(PanoramiXRes));
if (!defmap) {
free(root);
return;
}
defmap = malloc(sizeof(PanoramiXRes));
defmap->type = XRT_COLORMAP;
PanoramiXRes *saver = calloc(1, sizeof(PanoramiXRes));
if (!saver) {
free(root);
free(defmap);
return;
}
saver = malloc(sizeof(PanoramiXRes));
saver->type = XRT_WINDOW;
FOR_NSCREENS_BACKWARD(i) {
FOR_NSCREENS(i) {
ScreenPtr scr = screenInfo.screens[i];
root->info[i].id = scr->root->drawable.id;
@ -889,7 +889,9 @@ PanoramiXResetProc(ExtensionEntry * extEntry)
PanoramiXRenderReset();
PanoramiXFixesReset();
PanoramiXDamageReset();
#ifdef COMPOSITE
PanoramiXCompositeReset ();
#endif
screenInfo.numScreens = PanoramiXNumScreens;
for (i = 256; i--;)
ProcVector[i] = SavedProcVector[i];
@ -1070,7 +1072,7 @@ ProcXineramaQueryScreens(ClientPtr client)
xXineramaScreenInfo scratch;
int i;
FOR_NSCREENS_BACKWARD(i) {
FOR_NSCREENS(i) {
scratch.x_org = screenInfo.screens[i]->x;
scratch.y_org = screenInfo.screens[i]->y;
scratch.width = screenInfo.screens[i]->width;
@ -1169,7 +1171,7 @@ XineramaGetImageData(DrawablePtr *pDrawables,
depth = (format == XYPixmap) ? 1 : pDraw->depth;
FOR_NSCREENS_BACKWARD(i) {
FOR_NSCREENS(i) {
BoxRec TheBox;
ScreenPtr pScreen;
@ -1251,15 +1253,11 @@ XineramaGetImageData(DrawablePtr *pDrawables,
for (j = 0, index = (pitch * y) + x, index2 = 0; j < h;
j++, index += pitch, index2 += ScratchPitch) {
if (w) {
if (!shift) {
assert(ScratchMem);
if (!shift)
memcpy(data + index, ScratchMem + index2, w);
}
else {
assert(ScratchMem);
else
CopyBits(data + index, shift,
ScratchMem + index2, w);
}
}
if (leftover) {
@ -1279,7 +1277,6 @@ XineramaGetImageData(DrawablePtr *pDrawables,
w *= j;
for (j = 0; j < h; j++) {
assert(ScratchMem);
memcpy(data + (pitch * (y + j)) + x,
ScratchMem + (ScratchPitch * j), w);
}

View File

@ -32,12 +32,13 @@ Equipment Corporation.
* PanoramiX definitions
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _PANORAMIX_H_
#define _PANORAMIX_H_
#include <X11/Xmd.h>
#include <X11/extensions/panoramiXproto.h>
#include "gcstruct.h"
@ -69,6 +70,7 @@ typedef struct {
#define FOR_NSCREENS_FORWARD(j) for(j = 0; j < PanoramiXNumScreens; j++)
#define FOR_NSCREENS_FORWARD_SKIP(j) for(j = 1; j < PanoramiXNumScreens; j++)
#define FOR_NSCREENS_BACKWARD(j) for(j = PanoramiXNumScreens - 1; j >= 0; j--)
#define FOR_NSCREENS(j) FOR_NSCREENS_FORWARD(j)
#define IS_SHARED_PIXMAP(r) (((r)->type == XRT_PIXMAP) && (r)->u.pix.shared)

View File

@ -28,11 +28,6 @@ Equipment Corporation.
#include <stdio.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/extensions/panoramiXproto.h>
#include "Xext/panoramiX.h"
#include "Xext/panoramiXsrv.h"
#include "misc.h"
#include "cursor.h"
#include "cursorstr.h"
@ -44,6 +39,9 @@ Equipment Corporation.
#include "window.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "panoramiX.h"
#include <X11/extensions/panoramiXproto.h>
#include "panoramiXsrv.h"
#include "globals.h"
#include "panoramiXh.h"

View File

@ -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);
@ -73,5 +71,3 @@ extern int connBlockScreenStart;
extern xConnSetupPrefix connSetupPrefix;
extern int (*SavedProcVector[256]) (ClientPtr client);
#endif /* XSERVER_PANORAMIXH_H */

View File

@ -33,18 +33,19 @@ Equipment Corporation.
#include "dix/dix_priv.h"
#include "os/osdep.h"
#include "Xext/panoramiX.h"
#include "Xext/panoramiXsrv.h"
#include "windowstr.h"
#include "dixfontstr.h"
#include "gcstruct.h"
#include "colormapst.h"
#include "scrnintstr.h"
#include "opaque.h"
#include "inputstr.h"
#include "migc.h"
#include "misc.h"
#include "dixstruct.h"
#include "panoramiX.h"
#include "panoramiXsrv.h"
#include "resource.h"
#include "panoramiXh.h"
@ -116,7 +117,7 @@ PanoramiXCreateWindow(ClientPtr client)
}
}
if (!(newWin = calloc(1, sizeof(PanoramiXRes))))
if (!(newWin = malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newWin->type = XRT_WINDOW;
@ -556,6 +557,7 @@ PanoramiXCirculateWindow(ClientPtr client)
int
PanoramiXGetGeometry(ClientPtr client)
{
xGetGeometryReply rep;
DrawablePtr pDraw;
int rc;
@ -566,7 +568,7 @@ PanoramiXGetGeometry(ClientPtr client)
if (rc != Success)
return rc;
xGetGeometryReply rep = {
rep = (xGetGeometryReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
@ -600,16 +602,7 @@ PanoramiXGetGeometry(ClientPtr client)
rep.borderWidth = pWin->borderWidth;
}
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.root);
swaps(&rep.x);
swaps(&rep.y);
swaps(&rep.width);
swaps(&rep.height);
swaps(&rep.borderWidth);
}
WriteToClient(client, sizeof(xGetGeometryReply), &rep);
WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep);
return Success;
}
@ -621,6 +614,7 @@ PanoramiXTranslateCoords(ClientPtr client)
REQUEST(xTranslateCoordsReq);
int rc;
WindowPtr pWin, pDst;
xTranslateCoordsReply rep;
REQUEST_SIZE_MATCH(xTranslateCoordsReq);
rc = dixLookupWindow(&pWin, stuff->srcWid, client, DixReadAccess);
@ -629,8 +623,7 @@ PanoramiXTranslateCoords(ClientPtr client)
rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess);
if (rc != Success)
return rc;
xTranslateCoordsReply rep = {
rep = (xTranslateCoordsReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
@ -681,13 +674,7 @@ PanoramiXTranslateCoords(ClientPtr client)
rep.dstY += screenInfo.screens[0]->y;
}
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.child);
swaps(&rep.dstX);
swaps(&rep.dstY);
}
WriteToClient(client, sizeof(rep), &rep);
WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep);
return Success;
}
@ -707,7 +694,7 @@ PanoramiXCreatePixmap(ClientPtr client)
if (result != Success)
return (result == BadValue) ? BadDrawable : result;
if (!(newPix = calloc(1, sizeof(PanoramiXRes))))
if (!(newPix = malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newPix->type = XRT_PIXMAP;
@ -814,7 +801,7 @@ PanoramiXCreateGC(ClientPtr client)
}
}
if (!(newGC = calloc(1, sizeof(PanoramiXRes))))
if (!(newGC = malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newGC->type = XRT_GC;
@ -930,7 +917,7 @@ PanoramiXCopyGC(ClientPtr client)
if (result != Success)
return result;
FOR_NSCREENS_BACKWARD(j) {
FOR_NSCREENS(j) {
stuff->srcGC = srcGC->info[j].id;
stuff->dstGC = dstGC->info[j].id;
result = (*SavedProcVector[X_CopyGC]) (client);
@ -1111,11 +1098,11 @@ PanoramiXCopyArea(ClientPtr client)
if ((dst->type == XRT_PIXMAP) && (src->type == XRT_WINDOW)) {
DrawablePtr drawables[MAXSCREENS];
DrawablePtr pDst;
GCPtr pGC = NULL;
GCPtr pGC;
char *data;
int pitch, rc;
FOR_NSCREENS_BACKWARD(j) {
FOR_NSCREENS(j) {
rc = dixLookupDrawable(drawables + j, src->info[j].id, client, 0,
DixGetAttrAccess);
if (rc != Success)
@ -1149,7 +1136,7 @@ PanoramiXCopyArea(ClientPtr client)
}
free(data);
if (pGC && pGC->graphicsExposures) {
if (pGC->graphicsExposures) {
RegionRec rgn;
int dx, dy;
BoxRec sourceBox;
@ -1169,7 +1156,7 @@ PanoramiXCopyArea(ClientPtr client)
RegionInit(&rgn, &sourceBox, 1);
/* subtract the (screen-space) clips of the source drawables */
FOR_NSCREENS_BACKWARD(j) {
FOR_NSCREENS(j) {
ScreenPtr screen = screenInfo.screens[j];
RegionPtr sd;
@ -1387,6 +1374,7 @@ PanoramiXPolyPoint(ClientPtr client)
{
PanoramiXRes *gc, *draw;
int result, npoint, j;
xPoint *origPts;
Bool isRoot;
REQUEST(xPolyPointReq);
@ -1409,10 +1397,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 = xallocarray(npoint, sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
FOR_NSCREENS_FORWARD(j) {
@ -1454,6 +1439,7 @@ PanoramiXPolyLine(ClientPtr client)
{
PanoramiXRes *gc, *draw;
int result, npoint, j;
xPoint *origPts;
Bool isRoot;
REQUEST(xPolyLineReq);
@ -1476,9 +1462,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 = xallocarray(npoint, sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
FOR_NSCREENS_FORWARD(j) {
@ -1520,6 +1504,7 @@ PanoramiXPolySegment(ClientPtr client)
{
int result, nsegs, i, j;
PanoramiXRes *gc, *draw;
xSegment *origSegs;
Bool isRoot;
REQUEST(xPolySegmentReq);
@ -1546,9 +1531,7 @@ PanoramiXPolySegment(ClientPtr client)
return BadLength;
nsegs >>= 3;
if (nsegs > 0) {
xSegment *origSegs = calloc(nsegs, sizeof(xSegment));
if (!origSegs)
return BadAlloc;
origSegs = xallocarray(nsegs, sizeof(xSegment));
memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
FOR_NSCREENS_FORWARD(j) {
@ -1590,6 +1573,7 @@ PanoramiXPolyRectangle(ClientPtr client)
int result, nrects, i, j;
PanoramiXRes *gc, *draw;
Bool isRoot;
xRectangle *origRecs;
REQUEST(xPolyRectangleReq);
@ -1615,9 +1599,7 @@ PanoramiXPolyRectangle(ClientPtr client)
return BadLength;
nrects >>= 3;
if (nrects > 0) {
xRectangle *origRecs = calloc(nrects, sizeof(xRectangle));
if (!origRecs)
return BadAlloc;
origRecs = xallocarray(nrects, sizeof(xRectangle));
memcpy((char *) origRecs, (char *) &stuff[1],
nrects * sizeof(xRectangle));
FOR_NSCREENS_FORWARD(j) {
@ -1658,6 +1640,7 @@ PanoramiXPolyArc(ClientPtr client)
int result, narcs, i, j;
PanoramiXRes *gc, *draw;
Bool isRoot;
xArc *origArcs;
REQUEST(xPolyArcReq);
@ -1683,9 +1666,7 @@ PanoramiXPolyArc(ClientPtr client)
return BadLength;
narcs /= sizeof(xArc);
if (narcs > 0) {
xArc *origArcs = calloc(narcs, sizeof(xArc));
if (!origArcs)
return BadAlloc;
origArcs = xallocarray(narcs, sizeof(xArc));
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
FOR_NSCREENS_FORWARD(j) {
@ -1724,6 +1705,7 @@ PanoramiXFillPoly(ClientPtr client)
int result, count, j;
PanoramiXRes *gc, *draw;
Bool isRoot;
DDXPointPtr locPts;
REQUEST(xFillPolyReq);
@ -1746,9 +1728,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 = xallocarray(count, sizeof(DDXPointRec));
memcpy((char *) locPts, (char *) &stuff[1],
count * sizeof(DDXPointRec));
FOR_NSCREENS_FORWARD(j) {
@ -1791,6 +1771,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 +1797,7 @@ PanoramiXPolyFillRectangle(ClientPtr client)
return BadLength;
things >>= 3;
if (things > 0) {
xRectangle *origRects = calloc(things, sizeof(xRectangle));
if (!origRects)
return BadAlloc;
origRects = xallocarray(things, sizeof(xRectangle));
memcpy((char *) origRects, (char *) &stuff[1],
things * sizeof(xRectangle));
FOR_NSCREENS_FORWARD(j) {
@ -1858,6 +1838,7 @@ PanoramiXPolyFillArc(ClientPtr client)
PanoramiXRes *gc, *draw;
Bool isRoot;
int result, narcs, i, j;
xArc *origArcs;
REQUEST(xPolyFillArcReq);
@ -1883,9 +1864,7 @@ PanoramiXPolyFillArc(ClientPtr client)
return BadLength;
narcs /= sizeof(xArc);
if (narcs > 0) {
xArc *origArcs = calloc(narcs, sizeof(xArc));
if (!origArcs)
return BadAlloc;
origArcs = xallocarray(narcs, sizeof(xArc));
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
FOR_NSCREENS_FORWARD(j) {
@ -1967,6 +1946,7 @@ PanoramiXGetImage(ClientPtr client)
DrawablePtr drawables[MAXSCREENS];
DrawablePtr pDraw;
PanoramiXRes *draw;
xGetImageReply xgi;
Bool isRoot;
char *pBuf;
int i, x, y, w, h, format, rc;
@ -2040,7 +2020,12 @@ PanoramiXGetImage(ClientPtr client)
IncludeInferiors);
}
xgi = (xGetImageReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.visual = wVisual(((WindowPtr) pDraw)),
.depth = pDraw->depth
};
if (format == ZPixmap) {
widthBytesLine = PixmapBytePad(w, pDraw->depth);
length = widthBytesLine * h;
@ -2054,13 +2039,7 @@ PanoramiXGetImage(ClientPtr client)
}
xGetImageReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.visual = wVisual(((WindowPtr) pDraw)),
.depth = pDraw->depth,
.length = bytes_to_int32(length),
};
xgi.length = bytes_to_int32(length);
if (widthBytesLine == 0 || h == 0)
linesPerBuf = 0;
@ -2071,15 +2050,10 @@ PanoramiXGetImage(ClientPtr client)
if (linesPerBuf > h)
linesPerBuf = h;
}
if (!(pBuf = calloc(linesPerBuf, widthBytesLine)))
if (!(pBuf = xallocarray(linesPerBuf, widthBytesLine)))
return BadAlloc;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.visual);
}
WriteToClient(client, sizeof(rep), &rep);
WriteReplyToClient(client, sizeof(xGetImageReply), &xgi);
if (linesPerBuf == 0) {
/* nothing to do */
@ -2315,7 +2289,7 @@ PanoramiXCreateColormap(ClientPtr client)
if (result != Success)
return result;
if (!(newCmap = calloc(1, sizeof(PanoramiXRes))))
if (!(newCmap = malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newCmap->type = XRT_COLORMAP;
@ -2387,7 +2361,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
if (result != Success)
return result;
if (!(newCmap = calloc(1, sizeof(PanoramiXRes))))
if (!(newCmap = malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newCmap->type = XRT_COLORMAP;

View File

@ -1,33 +1,34 @@
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _PANORAMIXSRV_H_
#define _PANORAMIXSRV_H_
#include "panoramiX.h"
extern int PanoramiXNumScreens;
extern int PanoramiXPixWidth;
extern int PanoramiXPixHeight;
extern RegionRec PanoramiXScreenRegion;
extern _X_EXPORT int PanoramiXNumScreens;
extern _X_EXPORT int PanoramiXPixWidth;
extern _X_EXPORT int PanoramiXPixHeight;
extern _X_EXPORT RegionRec PanoramiXScreenRegion;
// exported for nvidia
_X_EXPORT VisualID PanoramiXTranslateVisualID(int screen, VisualID orig);
extern _X_EXPORT VisualID PanoramiXTranslateVisualID(int screen, VisualID orig);
extern _X_EXPORT void PanoramiXConsolidate(void);
extern _X_EXPORT Bool PanoramiXCreateConnectionBlock(void);
extern _X_EXPORT PanoramiXRes *PanoramiXFindIDByScrnum(RESTYPE, XID, int);
extern _X_EXPORT Bool
XineramaRegisterConnectionBlockCallback(void (*func) (void));
extern _X_EXPORT int XineramaDeleteResource(void *, XID);
void PanoramiXConsolidate(void);
Bool PanoramiXCreateConnectionBlock(void);
PanoramiXRes *PanoramiXFindIDByScrnum(RESTYPE, XID, int);
Bool XineramaRegisterConnectionBlockCallback(void (*func) (void));
int XineramaDeleteResource(void *, XID);
extern _X_EXPORT void XineramaReinitData(void);
/* only exported for Nvidia legacy. This really shouldn't be used by drivers */
extern _X_EXPORT RESTYPE XRC_DRAWABLE;
extern RESTYPE XRT_WINDOW;
extern RESTYPE XRT_PIXMAP;
extern RESTYPE XRT_GC;
extern RESTYPE XRT_COLORMAP;
extern RESTYPE XRT_PICTURE;
extern _X_EXPORT RESTYPE XRT_WINDOW;
extern _X_EXPORT RESTYPE XRT_PIXMAP;
extern _X_EXPORT RESTYPE XRT_GC;
extern _X_EXPORT RESTYPE XRT_COLORMAP;
extern _X_EXPORT RESTYPE XRT_PICTURE;
/*
* Drivers are allowed to wrap this function. Each wrapper can decide that the
@ -37,15 +38,16 @@ extern RESTYPE XRT_PICTURE;
* screen 0.
*/
typedef Bool (*XineramaVisualsEqualProcPtr) (VisualPtr, ScreenPtr, VisualPtr);
extern _X_EXPORT XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr;
void XineramaGetImageData(DrawablePtr *pDrawables,
int left,
int top,
int width,
int height,
unsigned int format,
unsigned long planemask,
char *data, int pitch, Bool isRoot);
extern _X_EXPORT void XineramaGetImageData(DrawablePtr *pDrawables,
int left,
int top,
int width,
int height,
unsigned int format,
unsigned long planemask,
char *data, int pitch, Bool isRoot);
static inline void
panoramix_setup_ids(PanoramiXRes * resource, ClientPtr client, XID base_id)

View File

@ -36,12 +36,9 @@ in this Software without prior written authorization from the X Consortium.
#include "dix/colormap_priv.h"
#include "dix/cursor_priv.h"
#include "dix/dix_priv.h"
#include "dix/window_priv.h"
#include "miext/extinit_priv.h"
#include "os/osdep.h"
#include "os/screensaver.h"
#include "Xext/panoramiX.h"
#include "Xext/panoramiXsrv.h"
#include "misc.h"
#include "os.h"
@ -53,8 +50,13 @@ in this Software without prior written authorization from the X Consortium.
#include "resource.h"
#include "gcstruct.h"
#include "cursorstr.h"
#include "colormapst.h"
#include "xace.h"
#include "inputstr.h"
#ifdef XINERAMA
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
#ifdef DPMSExtension
#include <X11/extensions/dpmsconst.h>
#include "dpmsproc.h"
@ -63,6 +65,10 @@ in this Software without prior written authorization from the X Consortium.
Bool noScreenSaverExtension = FALSE;
// temporary workaround for win32/mingw32 name clash
// see: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355
#undef CreateWindow
static int ScreenSaverEventBase = 0;
static Bool ScreenSaverHandle(ScreenPtr pScreen, int xstate, Bool force);
@ -271,10 +277,13 @@ setEventMask(ScreenPtr pScreen, ClientPtr client, unsigned long mask)
static void
FreeAttrs(ScreenSaverAttrPtr pAttr)
{
PixmapPtr pPixmap;
CursorPtr pCursor;
dixDestroyPixmap(pAttr->pBackgroundPixmap, 0);
dixDestroyPixmap(pAttr->pBorderPixmap, 0);
if ((pPixmap = pAttr->pBackgroundPixmap) != 0)
(*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap);
if ((pPixmap = pAttr->pBorderPixmap) != 0)
(*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap);
if ((pCursor = pAttr->pCursor) != 0)
FreeCursor(pCursor, (Cursor) 0);
}
@ -470,7 +479,7 @@ CreateSaverWindow(ScreenPtr pScreen)
if (GrabInProgress && GrabInProgress != pAttr->client->index)
return FALSE;
pWin = dixCreateWindow(pSaver->wid, pScreen->root,
pWin = CreateWindow(pSaver->wid, pScreen->root,
pAttr->x, pAttr->y, pAttr->width, pAttr->height,
pAttr->borderWidth, pAttr->class,
pAttr->mask, (XID *) pAttr->values,
@ -495,11 +504,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;
@ -749,7 +760,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
depth = stuff->depth;
visual = stuff->visualID;
/* copied directly from dixCreateWindow */
/* copied directly from CreateWindow */
if (class == CopyFromParent)
class = pParent->drawable.class;
@ -802,7 +813,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
return BadMatch;
}
/* end of errors from dixCreateWindow */
/* end of errors from CreateWindow */
pPriv = GetScreenPrivate(pScreen);
if (pPriv && pPriv->attr) {
@ -820,7 +831,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
goto bail;
}
/* over allocate for override redirect */
pAttr->values = values = calloc(len + 1, sizeof(unsigned long));
pAttr->values = values = xallocarray(len + 1, sizeof(unsigned long));
if (!values) {
ret = BadAlloc;
goto bail;
@ -1209,7 +1220,7 @@ ProcScreenSaverSuspend(ClientPtr client)
* to the record, so the screensaver will be re-enabled and the record freed
* if the client disconnects without reenabling it first.
*/
this = calloc(1, sizeof(ScreenSaverSuspensionRec));
this = malloc(sizeof(ScreenSaverSuspensionRec));
if (!this)
return BadAlloc;

View File

@ -32,17 +32,16 @@ in this Software without prior written authorization from The Open Group.
#include "dix/dix_priv.h"
#include "dix/registry_priv.h"
#include "dix/resource_priv.h"
#include "miext/extinit_priv.h"
#include "os/audit.h"
#include "os/auth.h"
#include "os/client_priv.h"
#include "os/osdep.h"
#include "scrnintstr.h"
#include "inputstr.h"
#include "windowstr.h"
#include "propertyst.h"
#include "colormapst.h"
#include "privates.h"
#include "xacestr.h"
#include "securitysrv.h"
@ -206,7 +205,7 @@ SecurityDeleteAuthorization(void *value, XID id)
.type = SecurityEventBase + XSecurityAuthorizationRevoked,
.authId = pAuth->id
};
WriteEventsToClient(dixClientForOtherClients(pEventClient), 1, (xEvent *) &are);
WriteEventsToClient(rClient(pEventClient), 1, (xEvent *) &are);
FreeResource(pEventClient->resource, X11_RESTYPE_NONE);
}
@ -384,7 +383,7 @@ SecurityEventSelectForAuthorization(SecurityAuthorizationPtr pAuth,
}
}
pEventClient = calloc(1, sizeof(OtherClients));
pEventClient = malloc(sizeof(OtherClients));
if (!pEventClient)
return BadAlloc;
pEventClient->mask = mask;
@ -405,6 +404,7 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
REQUEST(xSecurityGenerateAuthorizationReq);
int len; /* request length in CARD32s */
Bool removeAuth = FALSE; /* if bailout, call RemoveAuthorization? */
SecurityAuthorizationPtr pAuth = NULL; /* auth we are creating */
int err; /* error to return from this function */
XID authId; /* authorization ID assigned by os layer */
xSecurityGenerateAuthorizationReply rep; /* reply struct */
@ -490,8 +490,9 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
authId = GenerateAuthorization(stuff->nbytesAuthProto, protoname,
stuff->nbytesAuthData, protodata,
&authdata_len, &pAuthdata);
if (!authId) {
return SecurityErrorBase + XSecurityBadAuthorizationProtocol;
if ((XID) ~0L == authId) {
err = SecurityErrorBase + XSecurityBadAuthorizationProtocol;
goto bailout;
}
/* now that we've added the auth, remember to remove it if we have to
@ -501,7 +502,7 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
/* associate additional information with this auth ID */
SecurityAuthorizationPtr pAuth = calloc(1, sizeof(SecurityAuthorizationRec));
pAuth = malloc(sizeof(SecurityAuthorizationRec));
if (!pAuth) {
err = BadAlloc;
goto bailout;
@ -741,6 +742,7 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
{
XaceResourceAccessRec *rec = calldata;
SecurityStateRec *subj, *obj;
int cid = CLIENT_ID(rec->id);
Mask requested = rec->access_mode;
Mask allowed = SecurityResourceMask;
@ -755,12 +757,8 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
if (rec->rtype == X11_RESTYPE_WINDOW)
allowed |= SecurityWindowExtraMask;
ClientPtr owner = dixClientForXID(rec->id);
if (!owner)
goto denied;
/* special checks for server-owned resources */
if (dixResouceIsServerOwned(rec->id)) {
if (cid == 0) {
if (rec->rtype & RC_DRAWABLE)
/* additional operations allowed on root windows */
allowed |= SecurityRootWindowExtraMask;
@ -774,15 +772,15 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
allowed |= DixReadAccess;
}
obj = dixLookupPrivate(&owner->devPrivates, stateKey);
if (SecurityDoCheck(subj, obj, requested, allowed) == Success)
return;
if (clients[cid] != NULL) {
obj = dixLookupPrivate(&clients[cid]->devPrivates, stateKey);
if (SecurityDoCheck(subj, obj, requested, allowed) == Success)
return;
}
denied:
SecurityAudit("Security: denied client %d access %lx to resource 0x%lx "
"of client %d on request %s\n", rec->client->index,
(unsigned long)requested, (unsigned long)rec->id,
dixClientIdForXID(rec->id),
(unsigned long)requested, (unsigned long)rec->id, cid,
SecurityLookupRequestName(rec->client));
rec->status = BadAccess; /* deny access */
}
@ -858,13 +856,13 @@ SecurityProperty(CallbackListPtr *pcbl, void *unused, void *calldata)
Mask allowed = SecurityResourceMask | DixReadAccess;
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
obj = dixLookupPrivate(&dixClientForWindow(rec->pWin)->devPrivates, stateKey);
obj = dixLookupPrivate(&wClient(rec->pWin)->devPrivates, stateKey);
if (SecurityDoCheck(subj, obj, requested, allowed) != Success) {
SecurityAudit("Security: denied client %d access to property %s "
"(atom 0x%x) window 0x%lx of client %d on request %s\n",
rec->client->index, NameForAtom(name), name,
(unsigned long)rec->pWin->drawable.id, dixClientForWindow(rec->pWin)->index,
(unsigned long)rec->pWin->drawable.id, wClient(rec->pWin)->index,
SecurityLookupRequestName(rec->client));
rec->status = BadAccess;
}
@ -880,7 +878,7 @@ SecuritySend(CallbackListPtr *pcbl, void *unused, void *calldata)
int i;
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
obj = dixLookupPrivate(&dixClientForWindow(rec->pWin)->devPrivates, stateKey);
obj = dixLookupPrivate(&wClient(rec->pWin)->devPrivates, stateKey);
if (SecurityDoCheck(subj, obj, DixSendAccess, 0) == Success)
return;
@ -895,7 +893,7 @@ SecuritySend(CallbackListPtr *pcbl, void *unused, void *calldata)
rec->client->index,
LookupEventName(rec->events[i].u.u.type),
(unsigned long)rec->pWin->drawable.id,
dixClientForWindow(rec->pWin)->index);
wClient(rec->pWin)->index);
rec->status = BadAccess;
return;
}
@ -909,7 +907,7 @@ SecurityReceive(CallbackListPtr *pcbl, void *unused, void *calldata)
SecurityStateRec *subj, *obj;
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
obj = dixLookupPrivate(&dixClientForWindow(rec->pWin)->devPrivates, stateKey);
obj = dixLookupPrivate(&wClient(rec->pWin)->devPrivates, stateKey);
if (SecurityDoCheck(subj, obj, DixReceiveAccess, 0) == Success)
return;
@ -917,7 +915,7 @@ SecurityReceive(CallbackListPtr *pcbl, void *unused, void *calldata)
SecurityAudit("Security: denied client %d from receiving an event "
"sent to window 0x%lx of client %d\n",
rec->client->index, (unsigned long)rec->pWin->drawable.id,
dixClientForWindow(rec->pWin)->index);
wClient(rec->pWin)->index);
rec->status = BadAccess;
}

View File

@ -33,6 +33,7 @@ from The Open Group.
#include <X11/extensions/secur.h>
#include "input.h" /* for DeviceIntPtr */
#include "property.h" /* for PropertyPtr */
#include "pixmap.h" /* for DrawablePtr */
#include "resource.h" /* for RESTYPE */

View File

@ -33,10 +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 "Xext/panoramiX.h"
#include "Xext/panoramiXsrv.h"
#include "misc.h"
#include "os.h"
@ -51,8 +48,6 @@ in this Software without prior written authorization from The Open Group.
#include "gcstruct.h"
#include "protocol-versions.h"
Bool noShapeExtension = FALSE;
typedef RegionPtr (*CreateDftPtr) (WindowPtr /* pWin */
);
@ -70,6 +65,13 @@ static void SShapeNotifyEvent(xShapeNotifyEvent * /* from */ ,
* externally by the Xfixes extension and are now defined in window.h
*/
#ifdef XINERAMA
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
Bool noShapeExtension = FALSE;
static int ShapeEventBase = 0;
static RESTYPE ClientType, ShapeEventType; /* resource types for event masks */
@ -268,9 +270,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;
@ -308,7 +309,7 @@ ProcShapeRectangles(ClientPtr client)
if (result != Success)
return result;
FOR_NSCREENS_BACKWARD(j) {
FOR_NSCREENS(j) {
stuff->dest = win->info[j].id;
result = ShapeRectangles(client, stuff);
if (result != Success)
@ -365,9 +366,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;
@ -414,7 +414,7 @@ ProcShapeMask(ClientPtr client)
else
pmap = NULL;
FOR_NSCREENS_BACKWARD(j) {
FOR_NSCREENS(j) {
stuff->dest = win->info[j].id;
if (pmap)
stuff->src = pmap->info[j].id;
@ -443,9 +443,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 +492,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;
@ -538,7 +536,7 @@ ProcShapeCombine(ClientPtr client)
if (result != Success)
return result;
FOR_NSCREENS_BACKWARD(j) {
FOR_NSCREENS(j) {
stuff->dest = win->info[j].id;
stuff->src = win2->info[j].id;
result = ShapeCombine(client, stuff);
@ -602,7 +600,7 @@ ProcShapeOffset(ClientPtr client)
if (result != Success)
return result;
FOR_NSCREENS_BACKWARD(j) {
FOR_NSCREENS(j) {
stuff->dest = win->info[j].id;
result = ShapeOffset(client, stuff);
if (result != Success)
@ -754,7 +752,7 @@ ProcShapeSelectInput(ClientPtr client)
}
/* build the entry */
pNewShapeEvent = calloc(1, sizeof(ShapeEventRec));
pNewShapeEvent = malloc(sizeof(ShapeEventRec));
if (!pNewShapeEvent)
return BadAlloc;
pNewShapeEvent->next = 0;
@ -775,7 +773,7 @@ ProcShapeSelectInput(ClientPtr client)
* done through the resource database.
*/
if (!pHead) {
pHead = calloc(1, sizeof(ShapeEventPtr));
pHead = malloc(sizeof(ShapeEventPtr));
if (!pHead ||
!AddResource(pWin->drawable.id, ShapeEventType,
(void *) pHead)) {
@ -940,7 +938,7 @@ ProcShapeGetRectangles(ClientPtr client)
REQUEST(xShapeGetRectanglesReq);
WindowPtr pWin;
xShapeGetRectanglesReply rep;
xRectangle *rects = NULL;
xRectangle *rects;
int nrects, i, rc;
RegionPtr region;
@ -964,7 +962,7 @@ ProcShapeGetRectangles(ClientPtr client)
}
if (!region) {
nrects = 1;
rects = calloc(1, sizeof(xRectangle));
rects = malloc(sizeof(xRectangle));
if (!rects)
return BadAlloc;
switch (stuff->kind) {
@ -993,16 +991,14 @@ ProcShapeGetRectangles(ClientPtr client)
nrects = RegionNumRects(region);
box = RegionRects(region);
if (nrects) {
rects = calloc(nrects, sizeof(xRectangle));
if (!rects)
return BadAlloc;
for (i = 0; i < nrects; i++, box++) {
rects[i].x = box->x1;
rects[i].y = box->y1;
rects[i].width = box->x2 - box->x1;
rects[i].height = box->y2 - box->y1;
}
rects = xallocarray(nrects, sizeof(xRectangle));
if (!rects && nrects)
return BadAlloc;
for (i = 0; i < nrects; i++, box++) {
rects[i].x = box->x1;
rects[i].y = box->y1;
rects[i].width = box->x2 - box->x1;
rects[i].height = box->y2 - box->y1;
}
}
rep = (xShapeGetRectanglesReply) {

View File

@ -43,15 +43,11 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xfuncproto.h>
#include "dix/dix_priv.h"
#include "dix/screen_hooks_priv.h"
#include "miext/extinit_priv.h"
#include "os/auth.h"
#include "os/busfault.h"
#include "os/client_priv.h"
#include "os/log_priv.h"
#include "os/osdep.h"
#include "Xext/panoramiX.h"
#include "Xext/panoramiXsrv.h"
#include "misc.h"
#include "os.h"
@ -94,21 +90,28 @@ in this Software without prior written authorization from The Open Group.
#define SHMPERM_MODE(p) p->mode
#endif
#ifdef XINERAMA
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
typedef struct _ShmScrPrivateRec {
CloseScreenProcPtr CloseScreen;
ShmFuncsPtr shmFuncs;
DestroyPixmapProcPtr destroyPixmap;
} ShmScrPrivateRec;
Bool noMITShmExtension = FALSE;
static PixmapPtr fbShmCreatePixmap(XSHM_CREATE_PIXMAP_ARGS);
static int ShmDetachSegment(void *value, XID shmseg);
static void ShmResetProc(ExtensionEntry *extEntry);
static void SShmCompletionEvent(xShmCompletionEvent *from,
xShmCompletionEvent *to);
static Bool ShmDestroyPixmap(PixmapPtr pPixmap);
static int ShmCreatePixmap(ClientPtr client, xShmCreatePixmapReq *stuff);
Bool noMITShmExtension = FALSE;
static unsigned char ShmReqCode;
int ShmCompletionCode;
int BadShmSegCode;
@ -193,13 +196,15 @@ CheckForShmSyscall(void)
#endif
static void
ShmScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
static Bool
ShmCloseScreen(ScreenPtr pScreen)
{
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
pScreen->CloseScreen = screen_priv->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL);
free(screen_priv);
return (*pScreen->CloseScreen) (pScreen);
}
static ShmScrPrivateRec *
@ -209,8 +214,9 @@ ShmInitScreenPriv(ScreenPtr pScreen)
if (!screen_priv) {
screen_priv = calloc(1, sizeof(ShmScrPrivateRec));
screen_priv->CloseScreen = pScreen->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
dixScreenHookClose(pScreen, ShmScreenClose);
pScreen->CloseScreen = ShmCloseScreen;
}
return screen_priv;
}
@ -242,6 +248,27 @@ ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs)
ShmInitScreenPriv(pScreen)->shmFuncs = funcs;
}
static Bool
ShmDestroyPixmap(PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
void *shmdesc = NULL;
Bool ret;
if (pPixmap->refcnt == 1)
shmdesc = dixLookupPrivate(&pPixmap->devPrivates, shmPixmapPrivateKey);
pScreen->DestroyPixmap = screen_priv->destroyPixmap;
ret = (*pScreen->DestroyPixmap) (pPixmap);
screen_priv->destroyPixmap = pScreen->DestroyPixmap;
pScreen->DestroyPixmap = ShmDestroyPixmap;
if (shmdesc)
ShmDetachSegment(shmdesc, 0);
return ret;
}
void
ShmRegisterFbFuncs(ScreenPtr pScreen)
@ -371,7 +398,7 @@ ProcShmAttach(ClientPtr client)
shmdesc->refcnt++;
}
else {
shmdesc = calloc(1, sizeof(ShmDescRec));
shmdesc = malloc(sizeof(ShmDescRec));
if (!shmdesc)
return BadAlloc;
#ifdef SHM_FD_PASSING
@ -413,9 +440,6 @@ ShmDetachSegment(void *value, /* must conform to DeleteType */
ShmDescPtr shmdesc = (ShmDescPtr) value;
ShmDescPtr *prev;
if (!shmdesc)
return Success;
if (--shmdesc->refcnt)
return TRUE;
#if SHM_FD_PASSING
@ -494,7 +518,7 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
else
(void) (*pGC->ops->CopyArea) (&pPixmap->drawable, dst, pGC, 0, 0,
sw, sh, dx, dy);
dixDestroyPixmap(pPixmap, 0);
(*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap);
}
}
@ -743,7 +767,7 @@ ProcShmPutImage(ClientPtr client)
orig_y = stuff->dstY;
sendEvent = stuff->sendEvent;
stuff->sendEvent = 0;
FOR_NSCREENS_BACKWARD(j) {
FOR_NSCREENS(j) {
if (!j)
stuff->sendEvent = sendEvent;
stuff->drawable = draw->info[j].id;
@ -773,6 +797,7 @@ ProcShmGetImage(ClientPtr client)
#ifdef XINERAMA
PanoramiXRes *draw;
DrawablePtr *drawables;
DrawablePtr pDraw;
xShmGetImageReply xgi;
ShmDescPtr shmdesc;
@ -846,7 +871,7 @@ ProcShmGetImage(ClientPtr client)
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
DrawablePtr *drawables = calloc(PanoramiXNumScreens, sizeof(DrawablePtr));
drawables = calloc(PanoramiXNumScreens, sizeof(DrawablePtr));
if (!drawables)
return BadAlloc;
@ -976,7 +1001,7 @@ ProcShmCreatePixmap(ClientPtr client)
VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
if (!(newPix = calloc(1, sizeof(PanoramiXRes))))
if (!(newPix = malloc(sizeof(PanoramiXRes))))
return BadAlloc;
newPix->type = XRT_PIXMAP;
@ -985,7 +1010,7 @@ ProcShmCreatePixmap(ClientPtr client)
result = Success;
FOR_NSCREENS_BACKWARD(j) {
FOR_NSCREENS(j) {
ShmScrPrivateRec *screen_priv;
pScreen = screenInfo.screens[j];
@ -1002,7 +1027,7 @@ ProcShmCreatePixmap(ClientPtr client)
result = XaceHookResourceAccess(client, stuff->pid,
X11_RESTYPE_PIXMAP, pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (result != Success) {
dixDestroyPixmap(pMap, 0);
pDraw->pScreen->DestroyPixmap(pMap);
break;
}
dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);
@ -1048,7 +1073,7 @@ fbShmCreatePixmap(ScreenPtr pScreen,
BitsPerPixel(depth),
PixmapBytePad(width, depth),
(void *) addr)) {
dixDestroyPixmap(pPixmap, 0);
(*pScreen->DestroyPixmap) (pPixmap);
return NullPixmap;
}
return pPixmap;
@ -1116,7 +1141,7 @@ ShmCreatePixmap(ClientPtr client, xShmCreatePixmapReq *stuff)
rc = XaceHookResourceAccess(client, stuff->pid, X11_RESTYPE_PIXMAP,
pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
if (rc != Success) {
dixDestroyPixmap(pMap, 0);
pDraw->pScreen->DestroyPixmap(pMap);
return rc;
}
dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);
@ -1157,13 +1182,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;
@ -1172,7 +1198,7 @@ ProcShmAttachFd(ClientPtr client)
return BadMatch;
}
shmdesc = calloc(1, sizeof(ShmDescRec));
shmdesc = malloc(sizeof(ShmDescRec));
if (!shmdesc) {
close(fd);
return BadAlloc;
@ -1293,7 +1319,7 @@ ProcShmCreateSegment(ClientPtr client)
close(fd);
return BadAlloc;
}
shmdesc = calloc(1, sizeof(ShmDescRec));
shmdesc = malloc(sizeof(ShmDescRec));
if (!shmdesc) {
close(fd);
return BadAlloc;
@ -1455,7 +1481,6 @@ static int _X_COLD
SProcShmAttachFd(ClientPtr client)
{
REQUEST(xShmAttachFdReq);
SetReqFds(client, 1);
REQUEST_SIZE_MATCH(xShmAttachFdReq);
swapl(&stuff->shmseg);
return ProcShmAttachFd(client);
@ -1501,14 +1526,6 @@ SProcShmDispatch(ClientPtr client)
}
}
static void ShmPixmapDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
{
ShmDetachSegment(
dixLookupPrivate(&pPixmap->devPrivates, shmPixmapPrivateKey),
0);
dixSetPrivate(&pPixmap->devPrivates, shmPixmapPrivateKey, NULL);
}
void
ShmExtensionInit(void)
{
@ -1531,16 +1548,19 @@ ShmExtensionInit(void)
for (i = 0; i < screenInfo.numScreens; i++) {
ShmScrPrivateRec *screen_priv =
ShmInitScreenPriv(screenInfo.screens[i]);
if (!screen_priv)
continue;
if (!screen_priv->shmFuncs)
screen_priv->shmFuncs = &miFuncs;
if (!screen_priv->shmFuncs->CreatePixmap)
sharedPixmaps = xFalse;
}
if (sharedPixmaps)
for (i = 0; i < screenInfo.numScreens; i++)
dixScreenHookPixmapDestroy(screenInfo.screens[i], ShmPixmapDestroy);
for (i = 0; i < screenInfo.numScreens; i++) {
ShmScrPrivateRec *screen_priv =
ShmGetScreenPriv(screenInfo.screens[i]);
screen_priv->destroyPixmap =
screenInfo.screens[i]->DestroyPixmap;
screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap;
}
}
ShmSegType = CreateNewResourceType(ShmDetachSegment, "ShmSeg");
if (ShmSegType &&

View File

@ -72,7 +72,7 @@ ClientSleepUntil(ClientPtr client,
TimeStamp *revive,
void (*notifyFunc) (ClientPtr, void *), void *closure)
{
SertafiedPtr pReq, pPrev;
SertafiedPtr pRequest, pReq, pPrev;
if (SertafiedGeneration != serverGeneration) {
SertafiedResType = CreateNewResourceType(SertafiedDelete,
@ -82,8 +82,7 @@ ClientSleepUntil(ClientPtr client,
SertafiedGeneration = serverGeneration;
BlockHandlerRegistered = FALSE;
}
SertafiedPtr pRequest = calloc(1, sizeof(SertafiedRec));
pRequest = malloc(sizeof(SertafiedRec));
if (!pRequest)
return FALSE;
pRequest->pClient = client;

View File

@ -24,7 +24,9 @@
* XFree86 Project.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _SLEEPUNTIL_H_
#define _SLEEPUNTIL_H_ 1

View File

@ -60,7 +60,6 @@ PERFORMANCE OF THIS SOFTWARE.
#include "dix/dix_priv.h"
#include "miext/extinit_priv.h"
#include "os/bug_priv.h"
#include "os/osdep.h"
#include "scrnintstr.h"
@ -200,8 +199,8 @@ SyncAddTriggerToSyncObject(SyncTrigger * pTrigger)
return Success;
}
/* Failure is not an option, it's succeed or burst! */
pCur = XNFalloc(sizeof(SyncTriggerList));
if (!(pCur = malloc(sizeof(SyncTriggerList))))
return BadAlloc;
pCur->pTrigger = pTrigger;
pCur->next = pTrigger->pSync->pTriglist;
@ -311,35 +310,6 @@ SyncCheckTriggerFence(SyncTrigger * pTrigger, int64_t unused)
return (pFence == NULL || pFence->funcs.CheckTriggered(pFence));
}
static inline Bool
checked_int64_add(int64_t *out, int64_t a, int64_t b)
{
/* Do the potentially overflowing math as uint64_t, as signed
* integers in C are undefined on overflow (and the compiler may
* optimize out our overflow check below, otherwise)
*/
int64_t result = (uint64_t)a + (uint64_t)b;
/* signed addition overflows if operands have the same sign, and
* the sign of the result doesn't match the sign of the inputs.
*/
Bool overflow = (a < 0) == (b < 0) && (a < 0) != (result < 0);
*out = result;
return overflow;
}
static inline Bool
checked_int64_subtract(int64_t *out, int64_t a, int64_t b)
{
int64_t result = (uint64_t)a - (uint64_t)b;
Bool overflow = (a < 0) != (b < 0) && (a < 0) != (result < 0);
*out = result;
return overflow;
}
static int
SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject,
RESTYPE resType, Mask changes)
@ -359,6 +329,11 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject,
client->errorValue = syncObject;
return rc;
}
if (pSync != pTrigger->pSync) { /* new counter for trigger */
SyncDeleteTriggerFromSyncObject(pTrigger);
pTrigger->pSync = pSync;
newSyncObject = TRUE;
}
}
/* if system counter, ask it what the current value is */
@ -380,24 +355,6 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject,
}
}
if (changes & (XSyncCAValueType | XSyncCAValue)) {
if (pTrigger->value_type == XSyncAbsolute)
pTrigger->test_value = pTrigger->wait_value;
else { /* relative */
Bool overflow;
if (pCounter == NULL)
return BadMatch;
overflow = checked_int64_add(&pTrigger->test_value,
pCounter->value, pTrigger->wait_value);
if (overflow) {
client->errorValue = pTrigger->wait_value >> 32;
return BadValue;
}
}
}
if (changes & XSyncCATestType) {
if (pSync && SYNC_FENCE == pSync->type) {
@ -426,11 +383,21 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject,
}
}
if (changes & XSyncCACounter) {
if (pSync != pTrigger->pSync) { /* new counter for trigger */
SyncDeleteTriggerFromSyncObject(pTrigger);
pTrigger->pSync = pSync;
newSyncObject = TRUE;
if (changes & (XSyncCAValueType | XSyncCAValue)) {
if (pTrigger->value_type == XSyncAbsolute)
pTrigger->test_value = pTrigger->wait_value;
else { /* relative */
Bool overflow;
if (pCounter == NULL)
return BadMatch;
overflow = checked_int64_add(&pTrigger->test_value,
pCounter->value, pTrigger->wait_value);
if (overflow) {
client->errorValue = pTrigger->wait_value >> 32;
return BadValue;
}
}
}
@ -438,7 +405,8 @@ SyncInitTrigger(ClientPtr client, SyncTrigger * pTrigger, XID syncObject,
* a new counter on a trigger
*/
if (newSyncObject) {
SyncAddTriggerToSyncObject(pTrigger);
if ((rc = SyncAddTriggerToSyncObject(pTrigger)) != Success)
return rc;
}
else if (pCounter && IsSystemCounter(pCounter)) {
SyncComputeBracketValues(pCounter);
@ -649,7 +617,7 @@ SyncAwaitTriggerFired(SyncTrigger * pTrigger)
pAwaitUnion = (SyncAwaitUnion *) pAwait->pHeader;
numwaits = pAwaitUnion->header.num_waitconditions;
ppAwait = calloc(numwaits, sizeof(SyncAwait *));
ppAwait = xallocarray(numwaits, sizeof(SyncAwait *));
if (!ppAwait)
goto bail;
@ -763,6 +731,8 @@ SyncChangeCounter(SyncCounter * pCounter, int64_t newval)
static Bool
SyncEventSelectForAlarm(SyncAlarm * pAlarm, ClientPtr client, Bool wantevents)
{
SyncAlarmClientList *pClients;
if (client == pAlarm->client) { /* alarm owner */
pAlarm->events = wantevents;
return Success;
@ -770,8 +740,7 @@ SyncEventSelectForAlarm(SyncAlarm * pAlarm, ClientPtr client, Bool wantevents)
/* see if the client is already on the list (has events selected) */
for (SyncAlarmClientList *pClients = pClients = pAlarm->pEventClients;
pClients; pClients = pClients->next) {
for (pClients = pAlarm->pEventClients; pClients; pClients = pClients->next) {
if (pClients->client == client) {
/* client's presence on the list indicates desire for
* events. If the client doesn't want events, remove it
@ -797,7 +766,7 @@ SyncEventSelectForAlarm(SyncAlarm * pAlarm, ClientPtr client, Bool wantevents)
/* add new client to pAlarm->pEventClients */
SyncAlarmClientList *pClients = calloc(1, sizeof(SyncAlarmClientList));
pClients = malloc(sizeof(SyncAlarmClientList));
if (!pClients)
return BadAlloc;
@ -828,14 +797,8 @@ SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm * pAlarm, Mask mask,
int status;
XSyncCounter counter;
Mask origmask = mask;
SyncTrigger trigger;
Bool select_events_changed = FALSE;
Bool select_events_value = FALSE;
int64_t delta;
trigger = pAlarm->trigger;
delta = pAlarm->delta;
counter = trigger.pSync ? trigger.pSync->id : None;
counter = pAlarm->trigger.pSync ? pAlarm->trigger.pSync->id : None;
while (mask) {
int index2 = lowbit(mask);
@ -851,24 +814,24 @@ SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm * pAlarm, Mask mask,
case XSyncCAValueType:
mask &= ~XSyncCAValueType;
/* sanity check in SyncInitTrigger */
trigger.value_type = *values++;
pAlarm->trigger.value_type = *values++;
break;
case XSyncCAValue:
mask &= ~XSyncCAValue;
trigger.wait_value = ((int64_t)values[0] << 32) | values[1];
pAlarm->trigger.wait_value = ((int64_t)values[0] << 32) | values[1];
values += 2;
break;
case XSyncCATestType:
mask &= ~XSyncCATestType;
/* sanity check in SyncInitTrigger */
trigger.test_type = *values++;
pAlarm->trigger.test_type = *values++;
break;
case XSyncCADelta:
mask &= ~XSyncCADelta;
delta = ((int64_t)values[0] << 32) | values[1];
pAlarm->delta = ((int64_t)values[0] << 32) | values[1];
values += 2;
break;
@ -878,8 +841,10 @@ SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm * pAlarm, Mask mask,
client->errorValue = *values;
return BadValue;
}
select_events_value = (Bool) (*values++);
select_events_changed = TRUE;
status = SyncEventSelectForAlarm(pAlarm, client,
(Bool) (*values++));
if (status != Success)
return status;
break;
default:
@ -888,33 +853,25 @@ SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm * pAlarm, Mask mask,
}
}
if (select_events_changed) {
status = SyncEventSelectForAlarm(pAlarm, client, select_events_value);
if (status != Success)
return status;
}
/* "If the test-type is PositiveComparison or PositiveTransition
* and delta is less than zero, or if the test-type is
* NegativeComparison or NegativeTransition and delta is
* greater than zero, a Match error is generated."
*/
if (origmask & (XSyncCADelta | XSyncCATestType)) {
if ((((trigger.test_type == XSyncPositiveComparison) ||
(trigger.test_type == XSyncPositiveTransition))
&& delta < 0)
if ((((pAlarm->trigger.test_type == XSyncPositiveComparison) ||
(pAlarm->trigger.test_type == XSyncPositiveTransition))
&& pAlarm->delta < 0)
||
(((trigger.test_type == XSyncNegativeComparison) ||
(trigger.test_type == XSyncNegativeTransition))
&& delta > 0)
(((pAlarm->trigger.test_type == XSyncNegativeComparison) ||
(pAlarm->trigger.test_type == XSyncNegativeTransition))
&& pAlarm->delta > 0)
) {
return BadMatch;
}
}
/* postpone this until now, when we're sure nothing else can go wrong */
pAlarm->delta = delta;
pAlarm->trigger = trigger;
if ((status = SyncInitTrigger(client, &pAlarm->trigger, counter, RTCounter,
origmask & XSyncCAAllTrigger)) != Success)
return status;
@ -932,7 +889,7 @@ SyncCreate(ClientPtr client, XID id, unsigned char type)
switch (type) {
case SYNC_COUNTER:
pSync = calloc(1, sizeof(SyncCounter));
pSync = malloc(sizeof(SyncCounter));
resType = RTCounter;
break;
case SYNC_FENCE:
@ -1025,10 +982,12 @@ 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));
SysCounterInfo *psci;
psci = malloc(sizeof(SysCounterInfo));
if (!psci) {
FreeResource(pCounter->sync.id, X11_RESTYPE_NONE);
return pCounter;
@ -1307,7 +1266,7 @@ ProcSyncListSystemCounters(ClientPtr client)
}
if (len) {
walklist = list = calloc(1, len);
walklist = list = malloc(len);
if (!list)
return BadAlloc;
}
@ -1354,8 +1313,7 @@ ProcSyncListSystemCounters(ClientPtr client)
}
/*
* Set the priority of the client owning given resource.
* If the resource ID is None then set the priority of calling client.
* ** Set client Priority
*/
static int
ProcSyncSetPriority(ClientPtr client)
@ -1369,7 +1327,7 @@ ProcSyncSetPriority(ClientPtr client)
if (stuff->id == None)
priorityclient = client;
else {
rc = dixLookupResourceOwner(&priorityclient, stuff->id, client,
rc = dixLookupClient(&priorityclient, stuff->id, client,
DixSetAttrAccess);
if (rc != Success)
return rc;
@ -1389,8 +1347,7 @@ ProcSyncSetPriority(ClientPtr client)
}
/*
* Retrieve the priority of the client owning given resource.
* If the resource ID is None then retrieve the priority of calling client.
* ** Get client Priority
*/
static int
ProcSyncGetPriority(ClientPtr client)
@ -1405,7 +1362,7 @@ ProcSyncGetPriority(ClientPtr client)
if (stuff->id == None)
priorityclient = client;
else {
rc = dixLookupResourceOwner(&priorityclient, stuff->id, client,
rc = dixLookupClient(&priorityclient, stuff->id, client,
DixGetAttrAccess);
if (rc != Success)
return rc;
@ -1545,7 +1502,7 @@ SyncAwaitPrologue(ClientPtr client, int items)
/* all the memory for the entire await list is allocated
* here in one chunk
*/
pAwaitUnion = calloc(items + 1, sizeof(SyncAwaitUnion));
pAwaitUnion = xallocarray(items + 1, sizeof(SyncAwaitUnion));
if (!pAwaitUnion)
return NULL;
@ -1737,7 +1694,7 @@ ProcSyncCreateAlarm(ClientPtr client)
if (len != (Ones(vmask) + Ones(vmask & (XSyncCAValue | XSyncCADelta))))
return BadLength;
if (!(pAlarm = calloc(1, sizeof(SyncAlarm)))) {
if (!(pAlarm = malloc(sizeof(SyncAlarm)))) {
return BadAlloc;
}
@ -2645,15 +2602,16 @@ typedef struct {
static void
IdleTimeQueryValue(void *pCounter, int64_t *pValue_return)
{
int deviceid = XIAllDevices;
int deviceid;
CARD32 idle;
if (pCounter) {
SyncCounter *counter = pCounter;
IdleCounterPriv *priv = SysCounterGetPrivate(counter);
if (priv)
deviceid = priv->deviceid;
deviceid = priv->deviceid;
}
else
deviceid = XIAllDevices;
idle = GetTimeInMillis() - LastEventTime(deviceid).milliseconds;
*pValue_return = idle;
}
@ -2663,8 +2621,6 @@ IdleTimeBlockHandler(void *pCounter, void *wt)
{
SyncCounter *counter = pCounter;
IdleCounterPriv *priv = SysCounterGetPrivate(counter);
if (!priv)
return;
int64_t *less = priv->value_less;
int64_t *greater = priv->value_greater;
int64_t idle, old_idle;
@ -2755,8 +2711,6 @@ IdleTimeWakeupHandler(void *pCounter, int rc)
{
SyncCounter *counter = pCounter;
IdleCounterPriv *priv = SysCounterGetPrivate(counter);
if (!priv)
return;
int64_t *less = priv->value_less;
int64_t *greater = priv->value_greater;
int64_t idle;
@ -2790,8 +2744,6 @@ IdleTimeBracketValues(void *pCounter, int64_t *pbracket_less,
{
SyncCounter *counter = pCounter;
IdleCounterPriv *priv = SysCounterGetPrivate(counter);
if (!priv)
return;
int64_t *less = priv->value_less;
int64_t *greater = priv->value_greater;
Bool registered = (less || greater);
@ -2821,24 +2773,20 @@ init_system_idle_counter(const char *name, int deviceid)
IdleTimeQueryValue(NULL, &idle);
IdleCounterPriv *priv = calloc(1, sizeof(IdleCounterPriv));
if (!priv)
return NULL;
idle_time_counter = SyncCreateSystemCounter(name, idle, resolution,
XSyncCounterUnrestricted,
IdleTimeQueryValue,
IdleTimeBracketValues);
if (!idle_time_counter) {
free(priv);
return NULL;
if (idle_time_counter != NULL) {
IdleCounterPriv *priv = malloc(sizeof(IdleCounterPriv));
priv->value_less = priv->value_greater = NULL;
priv->deviceid = deviceid;
idle_time_counter->pSysCounterInfo->private = priv;
}
priv->value_less = priv->value_greater = NULL;
priv->deviceid = deviceid;
idle_time_counter->pSysCounterInfo->private = priv;
return idle_time_counter;
}

View File

@ -44,6 +44,7 @@ from Kaleb S. KEITHLEY
#include "extnsionst.h"
#include "scrnintstr.h"
#include "servermd.h"
#include "swaprep.h"
#include "vidmodestr.h"
#include "globals.h"
#include "protocol-versions.h"
@ -77,7 +78,9 @@ typedef struct {
static DisplayModePtr
VidModeCreateMode(void)
{
DisplayModePtr mode = calloc(1, sizeof(DisplayModeRec));
DisplayModePtr mode;
mode = malloc(sizeof(DisplayModeRec));
if (mode != NULL) {
mode->name = "";
mode->VScan = 1; /* divides refresh rate. default = 1 */
@ -313,72 +316,6 @@ ProcVidModeGetModeLine(ClientPtr client)
return Success;
}
static char *fillModeInfoV1(ClientPtr client, char *buf, int dotClock, DisplayModePtr mode)
{
xXF86OldVidModeModeInfo info = {
.dotclock = dotClock,
.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL),
.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS),
};
if (client->swapped) {
swapl(&info.dotclock);
swaps(&info.hdisplay);
swaps(&info.hsyncstart);
swaps(&info.hsyncend);
swaps(&info.htotal);
swaps(&info.vdisplay);
swaps(&info.vsyncstart);
swaps(&info.vsyncend);
swaps(&info.vtotal);
swapl(&info.flags);
}
memcpy(buf, &info, sizeof(info));
return buf + sizeof(info);
}
static char *fillModeInfoV2(ClientPtr client, char *buf, int dotClock, DisplayModePtr mode)
{
xXF86VidModeModeInfo info = {
.dotclock = dotClock,
.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL),
.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW),
.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS),
};
if (client->swapped) {
swapl(&info.dotclock);
swaps(&info.hdisplay);
swaps(&info.hsyncstart);
swaps(&info.hsyncend);
swaps(&info.htotal);
swapl(&info.hskew);
swaps(&info.vdisplay);
swaps(&info.vsyncstart);
swaps(&info.vsyncend);
swaps(&info.vtotal);
swapl(&info.flags);
}
memcpy(buf, &info, sizeof(info));
return buf + sizeof(info);
}
static int
ProcVidModeGetAllModeLines(ClientPtr client)
{
@ -408,13 +345,14 @@ ProcVidModeGetAllModeLines(ClientPtr client)
if (!pVidMode->GetFirstModeline(pScreen, &mode, &dotClock))
return BadValue;
int payload_len = modecount * ((ver < 2) ? sizeof(xXF86OldVidModeModeInfo)
: sizeof(xXF86VidModeModeInfo));
int payload_len = ((ver < 2) ?
((modecount * sizeof(xXF86OldVidModeModeInfo)) >> 2) :
((modecount * sizeof(xXF86VidModeModeInfo)) >> 2));
xXF86VidModeGetAllModeLinesReply rep = {
.type = X_Reply,
.length = bytes_to_int32(sizeof(xXF86VidModeGetAllModeLinesReply) -
sizeof(xGenericReply) + payload_len),
.length = sizeof(xXF86VidModeGetAllModeLinesReply) -
sizeof(xGenericReply) + payload_len,
.sequenceNumber = client->sequence,
.modecount = modecount
};
@ -424,21 +362,58 @@ ProcVidModeGetAllModeLines(ClientPtr client)
swapl(&rep.length);
swapl(&rep.modecount);
}
char *payload = calloc(1, payload_len);
if (!payload)
return BadAlloc;
char *walk = payload;
WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply), &rep);
do {
walk = (ver < 2) ? fillModeInfoV1(client, walk, dotClock, mode)
: fillModeInfoV2(client, walk, dotClock, mode);
} while (pVidMode->GetNextModeline(pScreen, &mode, &dotClock));
xXF86VidModeModeInfo mdinf = {
.dotclock = dotClock,
.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL),
.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW),
.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS),
.privsize = 0
};
if (client->swapped) {
swapl(&mdinf.dotclock);
swaps(&mdinf.hdisplay);
swaps(&mdinf.hsyncstart);
swaps(&mdinf.hsyncend);
swaps(&mdinf.htotal);
swapl(&mdinf.hskew);
swaps(&mdinf.vdisplay);
swaps(&mdinf.vsyncstart);
swaps(&mdinf.vsyncend);
swaps(&mdinf.vtotal);
swapl(&mdinf.flags);
swapl(&mdinf.privsize);
}
if (ver < 2) {
xXF86OldVidModeModeInfo oldmdinf = {
.dotclock = mdinf.dotclock,
.hdisplay = mdinf.hdisplay,
.hsyncstart = mdinf.hsyncstart,
.hsyncend = mdinf.hsyncend,
.htotal = mdinf.htotal,
.vdisplay = mdinf.vdisplay,
.vsyncstart = mdinf.vsyncstart,
.vsyncend = mdinf.vsyncend,
.vtotal = mdinf.vtotal,
.flags = mdinf.flags,
.privsize = mdinf.privsize
};
WriteToClient(client, sizeof(xXF86OldVidModeModeInfo), &oldmdinf);
}
else {
WriteToClient(client, sizeof(xXF86VidModeModeInfo), &mdinf);
}
WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply), &rep);
WriteToClient(client, payload_len, payload);
free(payload);
} while (pVidMode->GetNextModeline(pScreen, &mode, &dotClock));
return Success;
}
@ -779,6 +754,8 @@ VidModeModModeLine(ClientPtr client, xXF86VidModeModModeLineReq *stuff);
static int
ProcVidModeModModeLine(ClientPtr client)
{
int len;
/* limited to local-only connections */
if (!VidModeAllowNonLocal && !client->local)
return VidModeErrorBase + XF86VidModeClientNotLocal;
@ -788,7 +765,7 @@ ProcVidModeModModeLine(ClientPtr client)
if (ClientMajorVersion(client) < 2) {
REQUEST(xXF86OldVidModeModModeLineReq)
REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
int len =
len =
client->req_len -
bytes_to_int32(sizeof(xXF86OldVidModeModModeLineReq));
if (len != stuff->privsize)
@ -815,7 +792,7 @@ ProcVidModeModModeLine(ClientPtr client)
else {
REQUEST(xXF86VidModeModModeLineReq);
REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq);
int len =
len =
client->req_len -
bytes_to_int32(sizeof(xXF86VidModeModModeLineReq));
if (len != stuff->privsize)
@ -829,7 +806,7 @@ VidModeModModeLine(ClientPtr client, xXF86VidModeModModeLineReq *stuff)
{
ScreenPtr pScreen;
VidModePtr pVidMode;
DisplayModePtr mode;
DisplayModePtr mode, modetmp;
int dotClock;
DebugF("ModModeLine - scrn: %d hdsp: %d hbeg: %d hend: %d httl: %d\n",
@ -857,10 +834,7 @@ VidModeModModeLine(ClientPtr client, xXF86VidModeModModeLineReq *stuff)
if (!pVidMode->GetCurrentModeline(pScreen, &mode, &dotClock))
return BadValue;
DisplayModePtr modetmp = VidModeCreateMode();
if (!modetmp)
return BadAlloc;
modetmp = VidModeCreateMode();
VidModeCopyMode(mode, modetmp);
VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
@ -1008,9 +982,6 @@ VidModeValidateModeLine(ClientPtr client, xXF86VidModeValidateModeLineReq *stuff
return BadValue;
modetmp = VidModeCreateMode();
if (!modetmp)
return BadAlloc;
VidModeCopyMode(mode, modetmp);
VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
@ -1229,20 +1200,14 @@ ProcVidModeLockModeSwitch(ClientPtr client)
return Success;
}
static inline CARD32 _combine_f(vidMonitorValue a, vidMonitorValue b, Bool swapped)
{
CARD32 buf =
((unsigned short) a.f) |
((unsigned short) b.f << 16);
if (swapped)
swapl(&buf);
return buf;
}
static int
ProcVidModeGetMonitor(ClientPtr client)
{
REQUEST(xXF86VidModeGetMonitorReq);
CARD32 *hsyncdata, *vsyncdata;
ScreenPtr pScreen;
VidModePtr pVidMode;
int i, nHsync, nVrefresh, vendorLength = 0, modelLength = 0;
DEBUG_P("XF86VidModeGetMonitor");
@ -1250,23 +1215,24 @@ ProcVidModeGetMonitor(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
ScreenPtr pScreen = screenInfo.screens[stuff->screen];
pScreen = screenInfo.screens[stuff->screen];
VidModePtr pVidMode = VidModeGetPtr(pScreen);
pVidMode = VidModeGetPtr(pScreen);
if (pVidMode == NULL)
return BadImplementation;
const int nHsync = pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_NHSYNC, 0).i;
const int nVrefresh = pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_NVREFRESH, 0).i;
nHsync = pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_NHSYNC, 0).i;
nVrefresh = pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_NVREFRESH, 0).i;
const char *vendorStr = (const char*)pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_VENDOR, 0).ptr;
const char *modelStr = (const char*)pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_MODEL, 0).ptr;
if ((char *) (pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_VENDOR, 0)).ptr)
vendorLength = strlen((char *) (pVidMode->GetMonitorValue(pScreen,
VIDMODE_MON_VENDOR,
0)).ptr);
const int vendorLength = (vendorStr ? strlen(vendorStr) : 0);
const int modelLength = (modelStr ? strlen(modelStr) : 0);
const int nVendorItems = bytes_to_int32(pad_to_int32(vendorLength));
const int nModelItems = bytes_to_int32(pad_to_int32(modelLength));
if ((char *) (pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_MODEL, 0)).ptr)
modelLength = strlen((char *) (pVidMode->GetMonitorValue(pScreen,
VIDMODE_MON_MODEL,
0)).ptr);
xXF86VidModeGetMonitorReply rep = {
.type = X_Reply,
@ -1276,51 +1242,58 @@ ProcVidModeGetMonitor(ClientPtr client)
.vendorLength = vendorLength,
.modelLength = modelLength,
.length = bytes_to_int32(sizeof(xXF86VidModeGetMonitorReply) -
sizeof(xGenericReply))
+ nHsync + nVrefresh + nVendorItems + nModelItems
sizeof(xGenericReply) +
(nHsync + nVrefresh) * sizeof(CARD32) +
pad_to_int32(vendorLength) +
pad_to_int32(modelLength)),
};
const int buflen = nHsync + nVrefresh + nVendorItems + nModelItems;
CARD32 *sendbuf = calloc(buflen, sizeof(CARD32));
if (!sendbuf)
hsyncdata = xallocarray(nHsync, sizeof(CARD32));
if (!hsyncdata) {
return BadAlloc;
}
vsyncdata = xallocarray(nVrefresh, sizeof(CARD32));
CARD32 *bufwalk = sendbuf;
for (int i = 0; i < nHsync; i++) {
*bufwalk = _combine_f(pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_HSYNC_LO, i),
pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_HSYNC_HI, i),
client->swapped);
bufwalk++;
if (!vsyncdata) {
free(hsyncdata);
return BadAlloc;
}
for (int i = 0; i < nVrefresh; i++) {
*bufwalk = _combine_f(pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_VREFRESH_LO, i),
pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_VREFRESH_HI, i),
client->swapped);
bufwalk++;
for (i = 0; i < nHsync; i++) {
hsyncdata[i] = (unsigned short) (pVidMode->GetMonitorValue(pScreen,
VIDMODE_MON_HSYNC_LO,
i)).f |
(unsigned
short) (pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_HSYNC_HI,
i)).f << 16;
}
for (i = 0; i < nVrefresh; i++) {
vsyncdata[i] = (unsigned short) (pVidMode->GetMonitorValue(pScreen,
VIDMODE_MON_VREFRESH_LO,
i)).f |
(unsigned
short) (pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_VREFRESH_HI,
i)).f << 16;
}
memcpy(bufwalk,
pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_VENDOR, 0).ptr,
vendorLength);
bufwalk += nVendorItems;
memcpy(bufwalk,
pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_MODEL, 0).ptr,
modelLength);
bufwalk += nModelItems;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, SIZEOF(xXF86VidModeGetMonitorReply), &rep);
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, nHsync * sizeof(CARD32), hsyncdata);
WriteSwappedDataToClient(client, nVrefresh * sizeof(CARD32), vsyncdata);
if (rep.vendorLength)
WriteToClient(client, rep.vendorLength,
(pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_VENDOR, 0)).ptr);
if (rep.modelLength)
WriteToClient(client, rep.modelLength,
(pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_MODEL, 0)).ptr);
WriteToClient(client, sizeof(xXF86VidModeGetMonitorReply), &rep);
WriteToClient(client, buflen * sizeof(CARD32), sendbuf);
free(hsyncdata);
free(vsyncdata);
free(sendbuf);
return Success;
}
@ -1446,10 +1419,15 @@ ProcVidModeGetDotClocks(ClientPtr client)
swapl(&rep.flags);
}
WriteToClient(client, sizeof(xXF86VidModeGetDotClocksReply), &rep);
if (!ClockProg && Clocks) {
if (!ClockProg) {
for (n = 0; n < numClocks; n++) {
dotclock = Clocks[n];
WriteSwappedDataToClient(client, 4, (char *) &dotclock);
if (client->swapped) {
WriteSwappedDataToClient(client, 4, (char *) &dotclock);
}
else {
WriteToClient(client, 4, &dotclock);
}
}
}
@ -1574,26 +1552,30 @@ static int
ProcVidModeGetGammaRamp(ClientPtr client)
{
CARD16 *ramp = NULL;
int length;
size_t ramplen = 0;
ScreenPtr pScreen;
VidModePtr pVidMode;
REQUEST(xXF86VidModeGetGammaRampReq);
REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
if (stuff->screen >= screenInfo.numScreens)
return BadValue;
ScreenPtr pScreen = screenInfo.screens[stuff->screen];
pScreen = screenInfo.screens[stuff->screen];
VidModePtr pVidMode = VidModeGetPtr(pScreen);
pVidMode = VidModeGetPtr(pScreen);
if (pVidMode == NULL)
return BadImplementation;
if (stuff->size != pVidMode->GetGammaRampSize(pScreen))
return BadValue;
const int length = (stuff->size + 1) & ~1;
length = (stuff->size + 1) & ~1;
if (stuff->size) {
if (!(ramp = calloc(length, 3 * sizeof(CARD16))))
if (!(ramp = xallocarray(length, 3 * sizeof(CARD16))))
return BadAlloc;
ramplen = length * 3 * sizeof(CARD16);
@ -1607,7 +1589,7 @@ ProcVidModeGetGammaRamp(ClientPtr client)
xXF86VidModeGetGammaRampReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(ramplen),
.length = (length >> 1) * 3,
.size = stuff->size
};
if (client->swapped) {
@ -1617,8 +1599,11 @@ ProcVidModeGetGammaRamp(ClientPtr client)
SwapShorts((short *) ramp, length * 3);
}
WriteToClient(client, sizeof(xXF86VidModeGetGammaRampReply), &rep);
WriteToClient(client, ramplen, ramp);
free(ramp);
if (stuff->size) {
WriteToClient(client, ramplen, ramp);
free(ramp);
}
return Success;
}
@ -1696,7 +1681,7 @@ ProcVidModeSetClientVersion(ClientPtr client)
REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
if ((pPriv = VM_GETPRIV(client)) == NULL) {
pPriv = calloc(1, sizeof(VidModePrivRec));
pPriv = malloc(sizeof(VidModePrivRec));
if (!pPriv)
return BadAlloc;
VM_SETPRIV(client, pPriv);

View File

@ -20,9 +20,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <dix-config.h>
#include <stdarg.h>
#include "os/client_priv.h"
#include "scrnintstr.h"
#include "extnsionst.h"
#include "pixmapstr.h"
@ -204,6 +201,7 @@ XaceCensorImage(ClientPtr client,
if (nRects > 0) { /* we have something to censor */
GCPtr pScratchGC = NULL;
PixmapPtr pPix = NULL;
xRectangle *pRects = NULL;
Bool failed = FALSE;
int depth = 1;
int bitsPerPixel = 1;
@ -212,7 +210,7 @@ XaceCensorImage(ClientPtr client,
/* convert region to list-of-rectangles for PolyFillRect */
xRectangle *pRects = calloc(1, nRects * sizeof(xRectangle));
pRects = malloc(nRects * sizeof(xRectangle));
if (!pRects) {
failed = TRUE;
goto failSafe;

View File

@ -39,6 +39,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/* security hooks */
/* Constants used to identify the available security hooks
*/
#define XACE_CORE_DISPATCH 0
#define XACE_EXT_DISPATCH 1
#define XACE_RESOURCE_ACCESS 2
#define XACE_DEVICE_ACCESS 3
@ -60,6 +61,7 @@ extern CallbackListPtr XaceHooks[XACE_NUM_HOOKS];
/* Entry point for hook functions. Called by Xserver.
* Required by several modules
*/
_X_EXPORT int XaceHook(int hook, ... /* appropriate args for hook */);
_X_EXPORT Bool XaceRegisterCallback(int hook, CallbackProcPtr callback, void *data);
_X_EXPORT Bool XaceDeleteCallback(int hook, CallbackProcPtr callback, void *data);
@ -78,7 +80,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);

View File

@ -30,6 +30,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "property.h"
#include "xace.h"
/* XACE_CORE_DISPATCH */
typedef struct {
ClientPtr client;
int status;
} XaceCoreDispatchRec;
/* XACE_RESOURCE_ACCESS */
typedef struct {
ClientPtr client;

View File

@ -33,7 +33,6 @@ from The Open Group.
#include <X11/Xproto.h>
#include <X11/extensions/xcmiscproto.h>
#include "dix/resource_priv.h"
#include "miext/extinit_priv.h"
#include "misc.h"
@ -101,7 +100,7 @@ ProcXCMiscGetXIDList(ClientPtr client)
if (stuff->count > UINT32_MAX / sizeof(XID))
return BadAlloc;
pids = calloc(stuff->count, sizeof(XID));
pids = xallocarray(stuff->count, sizeof(XID));
if (!pids) {
return BadAlloc;
}

View File

@ -53,8 +53,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"
@ -146,6 +144,7 @@ static ShmDescPtr ShmList = (ShmDescPtr) NULL;
static ShmDescPtr
shmalloc(unsigned int size)
{
ShmDescPtr pDesc;
int shmid;
char *addr;
@ -163,7 +162,7 @@ shmalloc(unsigned int size)
if (size < 3500)
return (ShmDescPtr) NULL;
ShmDescPtr pDesc = calloc(1, sizeof(ShmDescRec));
pDesc = malloc(sizeof(ShmDescRec));
if (!pDesc)
return (ShmDescPtr) NULL;
@ -383,7 +382,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
}
else {
#endif
pCI = calloc(nCharInfos, sizeof(xCharInfo));
pCI = xallocarray(nCharInfos, sizeof(xCharInfo));
if (!pCI)
return BadAlloc;
#ifdef MITSHM
@ -445,7 +444,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
if (hashModulus > nCharInfos + 1)
hashModulus = nCharInfos + 1;
tmp = calloc(4 * nCharInfos + 1, sizeof(CARD16));
tmp = xallocarray(4 * nCharInfos + 1, sizeof(CARD16));
if (!tmp) {
if (!pDesc)
free(pCI);
@ -532,9 +531,8 @@ ProcXF86BigfontQueryFont(ClientPtr client)
: 0);
xXF86BigfontQueryFontReply rep = {
.type = X_Reply,
.length = bytes_to_int32(sizeof(xXF86BigfontQueryFontReply)
- sizeof(xGenericReply) + rlength),
.type = X_Reply;
.length = bytes_to_int32(buflength),
.sequenceNumber = client->sequence,
.minBounds = pFont->info.ink_minbounds,
.maxBounds = pFont->info.ink_maxbounds,
@ -647,6 +645,7 @@ ProcXF86BigfontDispatch(ClientPtr client)
static int _X_COLD
SProcXF86BigfontQueryVersion(ClientPtr client)
{
REQUEST(xXF86BigfontQueryVersionReq);
return ProcXF86BigfontQueryVersion(client);
}

View File

@ -12,10 +12,8 @@
#include <X11/extensions/XResproto.h>
#include "dix/registry_priv.h"
#include "dix/resource_priv.h"
#include "os/client_priv.h"
#include "miext/extinit_priv.h"
#include "Xext/xace.h"
#include "os/client_priv.h"
#include "misc.h"
#include "os.h"
@ -30,7 +28,10 @@
#include "misc.h"
#include "hashtable.h"
#include "picturestr.h"
#ifdef COMPOSITE
#include "compint.h"
#endif
Bool noResExtension = FALSE;
@ -101,7 +102,7 @@ typedef struct {
static void *
AddFragment(struct xorg_list *frags, int bytes)
{
FragmentList *f = calloc(1, sizeof(FragmentList) + bytes);
FragmentList *f = malloc(sizeof(FragmentList) + bytes);
if (!f) {
return NULL;
} else {
@ -119,11 +120,9 @@ static void
DestroyFragments(struct xorg_list *frags)
{
FragmentList *it, *tmp;
if (!xorg_list_is_empty(frags)) {
xorg_list_for_each_entry_safe(it, tmp, frags, l) {
xorg_list_del(&it->l);
free(it);
}
xorg_list_for_each_entry_safe(it, tmp, frags, l) {
xorg_list_del(&it->l);
free(it);
}
}
@ -202,19 +201,16 @@ ProcXResQueryVersion(ClientPtr client)
static int
ProcXResQueryClients(ClientPtr client)
{
int i, num_clients = 0;
REQUEST_SIZE_MATCH(xXResQueryClientsReq);
int *current_clients = calloc(currentMaxClients, sizeof(int));
if (!current_clients)
return BadAlloc;
int current_clients[currentMaxClients];
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;
num_clients++;
}
current_clients[num_clients] = i;
num_clients++;
}
}
@ -229,17 +225,12 @@ ProcXResQueryClients(ClientPtr client)
swapl(&rep.length);
swapl(&rep.num_clients);
}
WriteToClient(client, sizeof(xXResQueryClientsReply), &rep);
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;
@ -250,10 +241,8 @@ ProcXResQueryClients(ClientPtr client)
}
}
WriteToClient(client, sizeof(xXResQueryClientsReply), &rep);
WriteToClient(client, sizeof(xXResClient) * num_clients, scratch);
free(current_clients);
free(scratch);
WriteToClient(client, sizeof(scratch), scratch);
return Success;
}
@ -289,25 +278,27 @@ ProcXResQueryClientResources(ClientPtr client)
REQUEST(xXResQueryClientResourcesReq);
REQUEST_SIZE_MATCH(xXResQueryClientResourcesReq);
ClientPtr resClient = dixClientForXID(stuff->xid);
int i, clientID, num_types = 0;
if ((!resClient) ||
(XaceHookClientAccess(client, resClient, DixReadAccess)
!= Success)) {
clientID = CLIENT_ID(stuff->xid);
if ((clientID >= currentMaxClients) || !clients[clientID]) {
client->errorValue = stuff->xid;
return BadValue;
}
int *counts = calloc(lastResourceType + 1, sizeof(int));
if (!counts)
return BadAlloc;
int counts[lastResourceType + 1];
memset(counts, 0, sizeof(counts));
FindAllClientResources(resClient, ResFindAllRes, counts);
FindAllClientResources(clients[clientID], 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 = {
@ -322,15 +313,11 @@ ProcXResQueryClientResources(ClientPtr client)
swapl(&rep.num_types);
}
xXResType *scratch = calloc(sizeof(xXResType), num_types);
if (!scratch) {
free(counts);
return BadAlloc;
}
xXResType scratch[num_types];
for (int i = 0; i < num_types; i++) {
for (i = 0; i < num_types; i++) {
scratch[i].resource_type = resourceTypeAtom(i + 1);
scratch[i].count = counts[i];
scratch[i].count = cnt[i];
if (client->swapped) {
swapl(&scratch[i].resource_type);
@ -338,11 +325,8 @@ ProcXResQueryClientResources(ClientPtr client)
}
}
free(counts);
WriteToClient(client, sizeof(xXResQueryClientResourcesReply), &rep);
WriteToClient(client, num_types * sizeof(xXResType), scratch);
free(scratch);
WriteToClient(client, sizeof(scratch), scratch);
return Success;
}
@ -363,16 +347,17 @@ ProcXResQueryClientPixmapBytes(ClientPtr client)
REQUEST(xXResQueryClientPixmapBytesReq);
REQUEST_SIZE_MATCH(xXResQueryClientPixmapBytesReq);
ClientPtr owner = dixClientForXID(stuff->xid);
if ((!owner) ||
(XaceHookClientAccess(client, owner, DixReadAccess)
!= Success)) {
int clientID;
unsigned long bytes = 0;
clientID = CLIENT_ID(stuff->xid);
if ((clientID >= currentMaxClients) || !clients[clientID]) {
client->errorValue = stuff->xid;
return BadValue;
}
unsigned long bytes = 0;
FindAllClientResources(owner, ResFindResourcePixmaps,
FindAllClientResources(clients[clientID], ResFindResourcePixmaps,
(void *) (&bytes));
xXResQueryClientPixmapBytesReply rep = {
@ -510,13 +495,13 @@ 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)) {
if (clients[c]) {
if (!ConstructClientIdValue(client, clients[c],
specs[specIdx].mask, ctx)) {
return BadAlloc;
@ -524,11 +509,10 @@ ConstructClientIds(ClientPtr client,
}
}
} else {
ClientPtr owner = dixClientForXID(specs[specIdx].client);
if (owner &&
(XaceHookClientAccess(client, owner, DixReadAccess)
== Success)) {
if (!ConstructClientIdValue(client, owner,
int clientID = CLIENT_ID(specs[specIdx].client);
if ((clientID < currentMaxClients) && clients[clientID]) {
if (!ConstructClientIdValue(client, clients[clientID],
specs[specIdx].mask, ctx)) {
return BadAlloc;
}
@ -553,6 +537,7 @@ ProcXResQueryClientIds (ClientPtr client)
REQUEST(xXResQueryClientIdsReq);
xXResClientIdSpec *specs = (void*) ((char*) stuff + sizeof(*stuff));
int rc;
ConstructClientIdCtx ctx;
InitConstructClientIdCtx(&ctx);
@ -561,7 +546,7 @@ ProcXResQueryClientIds (ClientPtr client)
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);
@ -632,11 +617,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 +825,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,15 +858,20 @@ 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);
if (client && (aboutClient == None || aboutClient == client->index)) {
ctx->curSpec = spec;
FindAllClientResources(client,
AddResourceSizeValueByResource,
ctx);
int cid = CLIENT_ID(spec->resource);
if (cid < currentMaxClients &&
(aboutClient == None || cid == aboutClient)) {
ClientPtr client = clients[cid];
if (client) {
ctx->curSpec = spec;
FindAllClientResources(client,
AddResourceSizeValueByResource,
ctx);
}
}
}
}
@ -898,12 +890,16 @@ ConstructResourceBytes(XID aboutClient,
ConstructResourceBytesCtx *ctx)
{
if (aboutClient) {
ClientPtr client = dixClientForXID(aboutClient);
if (!client) {
int clientIdx = CLIENT_ID(aboutClient);
ClientPtr client = NullClient;
if ((clientIdx >= currentMaxClients) || !clients[clientIdx]) {
ctx->sendClient->errorValue = aboutClient;
return BadValue;
}
client = clients[clientIdx];
ConstructClientResourceBytes(client, ctx);
ConstructResourceBytesByResource(aboutClient, ctx);
} else {
@ -933,7 +929,9 @@ ProcXResQueryResourceBytes (ClientPtr client)
REQUEST(xXResQueryResourceBytesReq);
REQUEST_AT_LEAST_SIZE(xXResQueryResourceBytesReq);
ConstructResourceBytesCtx ctx;
int rc;
ConstructResourceBytesCtx ctx;
if (stuff->numSpecs > UINT32_MAX / sizeof(ctx.specs[0]))
return BadLength;
REQUEST_FIXED_SIZE(xXResQueryResourceBytesReq,
@ -946,7 +944,7 @@ ProcXResQueryResourceBytes (ClientPtr client)
return BadAlloc;
}
int rc = ConstructResourceBytes(stuff->client, &ctx);
rc = ConstructResourceBytes(stuff->client, &ctx);
if (rc == Success) {
xXResQueryResourceBytesReply rep = {

View File

@ -55,7 +55,7 @@ int selinuxEnforcingState = SELINUX_MODE_DEFAULT;
static char *
SELinuxCopyContext(char *ptr, unsigned len)
{
char *copy = calloc(1, len + 1);
char *copy = malloc(len + 1);
if (!copy)
return NULL;
@ -70,6 +70,7 @@ ProcSELinuxQueryVersion(ClientPtr client)
SELinuxQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.server_major = SELINUX_MAJOR_VERSION,
.server_minor = SELINUX_MINOR_VERSION
};
@ -86,6 +87,7 @@ ProcSELinuxQueryVersion(ClientPtr client)
static int
SELinuxSendContextReply(ClientPtr client, security_id_t sid)
{
SELinuxGetContextReply rep;
char *ctx = NULL;
int len = 0;
@ -95,7 +97,7 @@ SELinuxSendContextReply(ClientPtr client, security_id_t sid)
len = strlen(ctx) + 1;
}
SELinuxGetContextReply rep = {
rep = (SELinuxGetContextReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(len),
@ -298,7 +300,7 @@ ProcSELinuxGetClientContext(ClientPtr client)
REQUEST(SELinuxGetContextReq);
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
rc = dixLookupResourceOwner(&target, stuff->id, client, DixGetAttrAccess);
rc = dixLookupClient(&target, stuff->id, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@ -313,8 +315,6 @@ SELinuxPopulateItem(SELinuxListItemRec * i, PrivateRec ** privPtr, CARD32 id,
SELinuxObjectRec *obj = dixLookupPrivate(privPtr, objectKey);
SELinuxObjectRec *data = dixLookupPrivate(privPtr, dataKey);
if (!i)
return BadValue;
if (avc_sid_to_context_raw(obj->sid, &i->octx) < 0)
return BadValue;
if (avc_sid_to_context_raw(data->sid, &i->dctx) < 0)
@ -333,9 +333,6 @@ SELinuxFreeItems(SELinuxListItemRec * items, int count)
{
int k;
if (!items)
return;
for (k = 0; k < count; k++) {
freecon(items[k].octx);
freecon(items[k].dctx);
@ -347,15 +344,16 @@ static int
SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
int size, int count)
{
int rc = BadAlloc, k, pos = 0;
CARD32 *buf = calloc(size, sizeof(CARD32));
int rc, k, pos = 0;
SELinuxListItemsReply rep;
CARD32 *buf;
buf = calloc(size, sizeof(CARD32));
if (size && !buf) {
rc = BadAlloc;
goto out;
}
if (!buf) // silence analyzer warning
goto sendreply;
/* Fill in the buffer */
for (k = 0; k < count; k++) {
buf[pos] = items[k].id;
@ -379,9 +377,8 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
pos += items[k].dctx_len;
}
sendreply: ;
/* Send reply to client */
SELinuxListItemsReply rep = {
rep = (SELinuxListItemsReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = size,
@ -423,7 +420,7 @@ ProcSELinuxListProperties(ClientPtr client)
/* Count the number of properties and allocate items */
count = 0;
for (pProp = pWin->properties; pProp; pProp = pProp->next)
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
count++;
items = calloc(count, sizeof(SELinuxListItemRec));
if (count && !items)
@ -432,7 +429,7 @@ ProcSELinuxListProperties(ClientPtr client)
/* Fill in the items and calculate size */
i = 0;
size = 0;
for (pProp = pWin->properties; pProp; pProp = pProp->next) {
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) {
id = pProp->propertyName;
rc = SELinuxPopulateItem(items + i, &pProp->devPrivates, id, &size);
if (rc != Success) {

View File

@ -32,9 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <X11/Xatom.h>
#include <X11/Xfuncproto.h>
#include "dix/input_priv.h"
#include "dix/registry_priv.h"
#include "dix/resource_priv.h"
#include "dix/selection_priv.h"
#include "os/client_priv.h"
@ -632,10 +630,7 @@ SELinuxResource(CallbackListPtr *pcbl, void *unused, void *calldata)
if (offset < 0) {
/* No: use the SID of the owning client */
class = SECCLASS_X_RESOURCE;
ClientPtr owner = dixClientForXID(rec->id);
if (!owner)
return;
privatePtr = &owner->devPrivates;
privatePtr = &clients[CLIENT_ID(rec->id)]->devPrivates;
obj = dixLookupPrivate(privatePtr, objectKey);
}
else {
@ -776,7 +771,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata)
return;
pWin = (WindowPtr) rec->value;
subj = dixLookupPrivate(&dixClientForWindow(pWin)->devPrivates, subjectKey);
subj = dixLookupPrivate(&wClient(pWin)->devPrivates, subjectKey);
if (subj->sid) {
char *ctx;

View File

@ -38,13 +38,8 @@
#include "dix/input_priv.h"
#include "dix/dix_priv.h"
#include "dix/exevents_priv.h"
#include "mi/mi_priv.h"
#include "mi/mipointer_priv.h"
#include "miext/extinit_priv.h"
#include "os/client_priv.h"
#include "os/osdep.h"
#include "Xext/panoramiX.h"
#include "Xext/panoramiXsrv.h"
#include "misc.h"
#include "os.h"
@ -53,7 +48,9 @@
#include "windowstr.h"
#include "inputstr.h"
#include "scrnintstr.h"
#include "dixevents.h"
#include "sleepuntil.h"
#include "mi.h"
#include "xkbsrv.h"
#include "xkbstr.h"
#include "exglobals.h"
@ -82,6 +79,11 @@ static InternalEvent *xtest_evlist;
*/
DeviceIntPtr xtestpointer, xtestkeyboard;
#ifdef XINERAMA
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
static int XTestSwapFakeInput(ClientPtr /* client */ ,
xReq * /* req */
);
@ -128,7 +130,7 @@ ProcXTestCompareCursor(ClientPtr client)
if (stuff->cursor == None)
pCursor = NullCursor;
else if (stuff->cursor == XTestCurrentCursor)
pCursor = InputDevGetSpriteCursor(ptr);
pCursor = GetSpriteCursor(ptr);
else {
rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor,
X11_RESTYPE_CURSOR, client, DixReadAccess);
@ -381,7 +383,7 @@ ProcXTestFakeInput(ClientPtr client)
switch (type) {
case KeyPress:
case KeyRelease:
if ((!dev) || (!dev->key))
if (!dev->key)
return BadDevice;
if (ev->u.u.detail < dev->key->xkbInfo->desc->min_key_code ||
@ -393,7 +395,7 @@ ProcXTestFakeInput(ClientPtr client)
need_ptr_update = 0;
break;
case MotionNotify:
if (!dev || !dev->valuator)
if (!dev->valuator)
return BadDevice;
if (!(extension || ev->u.keyButtonPointer.root == None)) {
@ -424,7 +426,7 @@ ProcXTestFakeInput(ClientPtr client)
break;
case ButtonPress:
case ButtonRelease:
if (!dev || !dev->button)
if (!dev->button)
return BadDevice;
if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons) {
@ -438,7 +440,7 @@ ProcXTestFakeInput(ClientPtr client)
valuator_mask_set_range(&mask, firstValuator, numValuators, valuators);
if (dev && dev->sendEventsProc)
if (dev->sendEventsProc)
(*dev->sendEventsProc) (dev, type, ev->u.u.detail, flags, &mask);
if (need_ptr_update)
@ -647,7 +649,7 @@ AllocXTestDevice(ClientPtr client, const char *name,
BOOL
IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master)
{
if (InputDevIsMaster(dev))
if (IsMaster(dev))
return FALSE;
/* deviceid 0 is reserved for XIAllDevices, non-zero mid means XTest

View File

@ -32,8 +32,6 @@ SOFTWARE.
#include "dix/dix_priv.h"
#include "Xext/xvdix_priv.h"
#include "Xext/panoramiX.h"
#include "Xext/panoramiXsrv.h"
#include "misc.h"
#include "scrnintstr.h"
@ -51,6 +49,9 @@ SOFTWARE.
#include "xvdisp.h"
#ifdef XINERAMA
#include "panoramiX.h"
#include "panoramiXsrv.h"
unsigned long XvXRTPort;
#endif /* XINERAMA */
@ -1018,8 +1019,9 @@ ProcXvQueryImageAttributes(ClientPtr client)
CARD16 width, height;
XvImagePtr pImage = NULL;
XvPortPtr pPort;
int32_t *offsets;
int32_t *pitches;
int *offsets;
int *pitches;
int planeLength;
REQUEST(xvQueryImageAttributesReq);
@ -1044,9 +1046,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
num_planes = pImage->num_planes;
// allocating for `offsets` as well as `pitches` in one block
// both having CARD32 * num_planes (actually int32_t put into CARD32)
if (!(offsets = calloc(num_planes*2, sizeof(CARD32))))
if (!(offsets = malloc(num_planes << 3)))
return BadAlloc;
pitches = offsets + num_planes;
@ -1060,7 +1060,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
rep = (xvQueryImageAttributesReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = num_planes * 2, // in 32bit units
.length = planeLength = num_planes << 1,
.num_planes = num_planes,
.width = width,
.height = height,
@ -1069,8 +1069,8 @@ ProcXvQueryImageAttributes(ClientPtr client)
_WriteQueryImageAttributesReply(client, &rep);
if (client->swapped)
SwapLongs((CARD32 *) offsets, rep.length);
WriteToClient(client, rep.length * sizeof(CARD32), offsets);
SwapLongs((CARD32 *) offsets, planeLength);
WriteToClient(client, planeLength << 2, offsets);
free(offsets);
@ -1836,12 +1836,12 @@ XineramifyXv(void)
/* now create a resource for each port */
for (j = 0; j < refAdapt->nPorts; j++) {
PanoramiXRes *port = calloc(1, sizeof(PanoramiXRes));
PanoramiXRes *port = malloc(sizeof(PanoramiXRes));
if (!port)
break;
FOR_NSCREENS_BACKWARD(k) {
FOR_NSCREENS(k) {
if (MatchingAdaptors[k] && (MatchingAdaptors[k]->nPorts > j))
port->info[k].id = MatchingAdaptors[k]->base_id + j;
else

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,9 @@ 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
DestroyWindowProcPtr DestroyWindow;
DestroyPixmapProcPtr DestroyPixmap;
CloseScreenProcPtr CloseScreen;
} 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

@ -81,10 +81,7 @@ SOFTWARE.
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "dix/screen_hooks_priv.h"
#include "miext/extinit_priv.h"
#include "Xext/panoramiX.h"
#include "Xext/panoramiXsrv.h"
#include "Xext/xvdix_priv.h"
#include "misc.h"
@ -98,6 +95,11 @@ SOFTWARE.
#include "resource.h"
#include "opaque.h"
#include "input.h"
#ifdef XINERAMA
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif /* XINERAMA */
#include "xvdisp.h"
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
@ -141,7 +143,9 @@ static void WriteSwappedVideoNotifyEvent(xvEvent *, xvEvent *);
static void WriteSwappedPortNotifyEvent(xvEvent *, xvEvent *);
static Bool CreateResourceTypes(void);
static void XvScreenClose(CallbackListPtr *pcbl, ScreenPtr, void *arg);
static Bool XvCloseScreen(ScreenPtr);
static Bool XvDestroyPixmap(PixmapPtr);
static Bool XvDestroyWindow(WindowPtr);
static void XvResetProc(ExtensionEntry *);
static int XvdiDestroyGrab(void *, XID);
static int XvdiDestroyEncoding(void *, XID);
@ -150,7 +154,6 @@ static int XvdiDestroyPortNotify(void *, XID);
static int XvdiDestroyVideoNotifyList(void *, XID);
static int XvdiDestroyPort(void *, XID);
static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int);
static void XvStopAdaptors(DrawablePtr pDrawable);
/*
** XvExtensionInit
@ -256,19 +259,11 @@ CreateResourceTypes(void)
}
static void XvWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
{
XvStopAdaptors(&pWin->drawable);
}
static void XvPixmapDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
{
XvStopAdaptors(&pPixmap->drawable);
}
int
XvScreenInit(ScreenPtr pScreen)
{
XvScreenPtr pxvs;
if (XvScreenGeneration != serverGeneration) {
if (!CreateResourceTypes()) {
ErrorF("XvScreenInit: Unable to allocate resource types\n");
@ -289,7 +284,7 @@ XvScreenInit(ScreenPtr pScreen)
/* ALLOCATE SCREEN PRIVATE RECORD */
XvScreenPtr pxvs = calloc(1, sizeof(XvScreenRec));
pxvs = malloc(sizeof(XvScreenRec));
if (!pxvs) {
ErrorF("XvScreenInit: Unable to allocate screen private structure\n");
return BadAlloc;
@ -297,26 +292,34 @@ XvScreenInit(ScreenPtr pScreen)
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, pxvs);
dixScreenHookWindowDestroy(pScreen, XvWindowDestroy);
dixScreenHookClose(pScreen, XvScreenClose);
dixScreenHookPixmapDestroy(pScreen, XvPixmapDestroy);
pxvs->DestroyPixmap = pScreen->DestroyPixmap;
pxvs->DestroyWindow = pScreen->DestroyWindow;
pxvs->CloseScreen = pScreen->CloseScreen;
pScreen->DestroyPixmap = XvDestroyPixmap;
pScreen->DestroyWindow = XvDestroyWindow;
pScreen->CloseScreen = XvCloseScreen;
return Success;
}
static void XvScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
static Bool
XvCloseScreen(ScreenPtr pScreen)
{
XvScreenPtr pxvs;
pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
dixScreenUnhookWindowDestroy(pScreen, XvWindowDestroy);
dixScreenUnhookClose(pScreen, XvScreenClose);
dixScreenUnhookPixmapDestroy(pScreen, XvPixmapDestroy);
pScreen->DestroyPixmap = pxvs->DestroyPixmap;
pScreen->DestroyWindow = pxvs->DestroyWindow;
pScreen->CloseScreen = pxvs->CloseScreen;
free(pxvs);
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
return (*pScreen->CloseScreen) (pScreen);
}
static void
@ -350,7 +353,7 @@ XvStopAdaptors(DrawablePtr pDrawable)
XvPortPtr pp = pa->pPorts;
int np = pa->nPorts;
while ((np--) && (pp)) {
while (np--) {
if (pp->pDraw == pDrawable) {
XvdiSendVideoNotify(pp, pDrawable, XvPreempted);
@ -366,6 +369,39 @@ XvStopAdaptors(DrawablePtr pDrawable)
}
}
static Bool
XvDestroyPixmap(PixmapPtr pPix)
{
ScreenPtr pScreen = pPix->drawable.pScreen;
Bool status;
if (pPix->refcnt == 1)
XvStopAdaptors(&pPix->drawable);
SCREEN_PROLOGUE(pScreen, DestroyPixmap);
status = (*pScreen->DestroyPixmap) (pPix);
SCREEN_EPILOGUE(pScreen, DestroyPixmap, XvDestroyPixmap);
return status;
}
static Bool
XvDestroyWindow(WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
Bool status;
XvStopAdaptors(&pWin->drawable);
SCREEN_PROLOGUE(pScreen, DestroyWindow);
status = (*pScreen->DestroyWindow) (pWin);
SCREEN_EPILOGUE(pScreen, DestroyWindow, XvDestroyWindow);
return status;
}
static int
XvdiDestroyPort(void *pPort, XID id)
{
@ -774,7 +810,7 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
WILL BE DELETED WHEN THE DRAWABLE IS DESTROYED */
if (!pn) {
if (!(tpn = calloc(1, sizeof(XvVideoNotifyRec))))
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
return BadAlloc;
tpn->next = NULL;
tpn->client = NULL;
@ -810,7 +846,7 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
tpn = fpn;
}
else {
if (!(tpn = calloc(1, sizeof(XvVideoNotifyRec))))
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
return BadAlloc;
tpn->next = pn->next;
pn->next = tpn;
@ -864,7 +900,7 @@ XvdiSelectPortNotify(ClientPtr client, XvPortPtr pPort, BOOL onoff)
CREATE A NEW ONE AND ADD IT TO THE BEGINNING OF THE LIST */
if (!tpn) {
if (!(tpn = calloc(1, sizeof(XvPortNotifyRec))))
if (!(tpn = malloc(sizeof(XvPortNotifyRec))))
return BadAlloc;
tpn->next = pPort->pNotify;
pPort->pNotify = tpn;
@ -1048,7 +1084,7 @@ XvFillColorKey(DrawablePtr pDraw, CARD32 key, RegionPtr region)
(void) ChangeGC(NullClient, gc, GCForeground | GCSubwindowMode, pval);
ValidateGC(pDraw, gc);
rects = calloc(nbox, sizeof(xRectangle));
rects = xallocarray(nbox, sizeof(xRectangle));
if (rects) {
for (i = 0; i < nbox; i++, pbox++) {
rects[i].x = pbox->x1 - pDraw->x;

View File

@ -9,7 +9,6 @@
#include <X11/extensions/Xvproto.h>
#include <X11/extensions/XvMCproto.h>
#include "dix/screen_hooks_priv.h"
#include "miext/extinit_priv.h"
#include "Xext/xvdix_priv.h"
@ -49,6 +48,7 @@ static RESTYPE XvMCRTSubpicture;
typedef struct {
int num_adaptors;
XvMCAdaptorPtr adaptors;
CloseScreenProcPtr CloseScreen;
char clientDriverName[DR_CLIENT_DRIVER_NAME_SIZE];
char busID[DR_BUSID_SIZE];
int major;
@ -112,6 +112,7 @@ ProcXvMCQueryVersion(ClientPtr client)
xvmcQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.major = SERVER_XVMC_MAJOR_VERSION,
.minor = SERVER_XVMC_MINOR_VERSION
};
@ -127,8 +128,13 @@ static int
ProcXvMCListSurfaceTypes(ClientPtr client)
{
XvPortPtr pPort;
int i;
XvMCScreenPtr pScreenPriv;
xvmcListSurfaceTypesReply rep;
xvmcSurfaceInfo info;
XvMCAdaptorPtr adaptor = NULL;
XvMCSurfaceInfoPtr surface;
int num_surfaces;
REQUEST(xvmcListSurfaceTypesReq);
REQUEST_SIZE_MATCH(xvmcListSurfaceTypesReq);
@ -139,7 +145,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
ScreenPtr pScreen = pPort->pAdaptor->pScreen;
if ((pScreenPriv = XVMC_GET_PRIVATE(pScreen))) { /* any 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;
@ -148,36 +154,28 @@ 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;
for (int i = 0; i < num_surfaces; i++) {
XvMCSurfaceInfoPtr surface = adaptor->surfaces[i];
info[i].surface_type_id = surface->surface_type_id;
info[i].chroma_format = surface->chroma_format;
info[i].max_width = surface->max_width;
info[i].max_height = surface->max_height;
info[i].subpicture_max_width = surface->subpicture_max_width;
info[i].subpicture_max_height = surface->subpicture_max_height;
info[i].mc_type = surface->mc_type;
info[i].flags = surface->flags;
}
}
xvmcListSurfaceTypesReply rep = {
num_surfaces = (adaptor) ? adaptor->num_surfaces : 0;
rep = (xvmcListSurfaceTypesReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num = num_surfaces,
.length = bytes_to_int32(sizeof(xvmcSurfaceInfo) * num_surfaces),
.length = bytes_to_int32(num_surfaces * sizeof(xvmcSurfaceInfo)),
};
WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), &rep);
WriteToClient(client, sizeof(xvmcSurfaceInfo) * num_surfaces, info);
free(info);
for (i = 0; i < num_surfaces; i++) {
surface = adaptor->surfaces[i];
info.surface_type_id = surface->surface_type_id;
info.chroma_format = surface->chroma_format;
info.max_width = surface->max_width;
info.max_height = surface->max_height;
info.subpicture_max_width = surface->subpicture_max_width;
info.subpicture_max_height = surface->subpicture_max_height;
info.mc_type = surface->mc_type;
info.flags = surface->flags;
WriteToClient(client, sizeof(xvmcSurfaceInfo), &info);
}
return Success;
}
@ -188,12 +186,13 @@ 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;
xvmcCreateContextReply rep;
REQUEST(xvmcCreateContextReq);
REQUEST_SIZE_MATCH(xvmcCreateContextReq);
@ -208,7 +207,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 +218,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;
@ -234,7 +233,7 @@ ProcXvMCCreateContext(ClientPtr client)
(stuff->height > surface->max_height))
return BadValue;
if (!(pContext = calloc(1, sizeof(XvMCContextRec)))) {
if (!(pContext = malloc(sizeof(XvMCContextRec)))) {
return BadAlloc;
}
@ -258,7 +257,7 @@ ProcXvMCCreateContext(ClientPtr client)
return BadAlloc;
}
xvmcCreateContextReply rep = {
rep = (xvmcCreateContextReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = dwords,
@ -304,6 +303,7 @@ ProcXvMCCreateSurface(ClientPtr client)
XvMCContextPtr pContext;
XvMCSurfacePtr pSurface;
XvMCScreenPtr pScreenPriv;
xvmcCreateSurfaceReply rep;
REQUEST(xvmcCreateSurfaceReq);
REQUEST_SIZE_MATCH(xvmcCreateSurfaceReq);
@ -315,7 +315,7 @@ ProcXvMCCreateSurface(ClientPtr client)
pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
if (!(pSurface = calloc(1, sizeof(XvMCSurfaceRec))))
if (!(pSurface = malloc(sizeof(XvMCSurfaceRec))))
return BadAlloc;
pSurface->surface_id = stuff->surface_id;
@ -336,7 +336,7 @@ ProcXvMCCreateSurface(ClientPtr client)
return BadAlloc;
}
xvmcCreateSurfaceReply rep = {
rep = (xvmcCreateSurfaceReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = dwords
@ -377,10 +377,11 @@ ProcXvMCCreateSubpicture(ClientPtr client)
{
Bool image_supported = FALSE;
CARD32 *data = NULL;
int result, dwords = 0;
int i, result, dwords = 0;
XvMCContextPtr pContext;
XvMCSubpicturePtr pSubpicture;
XvMCScreenPtr pScreenPriv;
xvmcCreateSubpictureReply rep;
XvMCAdaptorPtr adaptor;
XvMCSurfaceInfoPtr surface = NULL;
@ -397,7 +398,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 +412,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;
@ -427,7 +428,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
(stuff->height > surface->subpicture_max_height))
return BadValue;
if (!(pSubpicture = calloc(1, sizeof(XvMCSubpictureRec))))
if (!(pSubpicture = malloc(sizeof(XvMCSubpictureRec))))
return BadAlloc;
pSubpicture->subpicture_id = stuff->subpicture_id;
@ -455,7 +456,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
return BadAlloc;
}
xvmcCreateSubpictureReply rep = {
rep = (xvmcCreateSubpictureReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = dwords,
@ -503,11 +504,14 @@ static int
ProcXvMCListSubpictureTypes(ClientPtr client)
{
XvPortPtr pPort;
xvmcListSubpictureTypesReply rep;
XvMCScreenPtr pScreenPriv;
ScreenPtr pScreen;
XvMCAdaptorPtr adaptor = NULL;
XvMCSurfaceInfoPtr surface = NULL;
xvImageFormatInfo info;
XvImagePtr pImage;
int i, j;
REQUEST(xvmcListSubpictureTypesReq);
REQUEST_SIZE_MATCH(xvmcListSubpictureTypesReq);
@ -522,7 +526,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 +536,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;
@ -542,70 +546,62 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
if (!surface)
return BadMatch;
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;
}
}
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;
}
}
xvmcListSubpictureTypesReply rep = {
rep = (xvmcListSubpictureTypesReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.num = num,
.length = bytes_to_int32(num * sizeof(xvImageFormatInfo)),
.num = 0
};
if (surface->compatible_subpictures)
rep.num = surface->compatible_subpictures->num_xvimages;
rep.length = bytes_to_int32(rep.num * sizeof(xvImageFormatInfo));
WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), &rep);
WriteToClient(client, sizeof(xvImageFormatInfo) * num, info);
free(info);
for (i = 0; i < rep.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)
return BadImplementation;
info.id = pImage->id;
info.type = pImage->type;
info.byte_order = pImage->byte_order;
memcpy(&info.guid, pImage->guid, 16);
info.bpp = pImage->bits_per_pixel;
info.num_planes = pImage->num_planes;
info.depth = pImage->depth;
info.red_mask = pImage->red_mask;
info.green_mask = pImage->green_mask;
info.blue_mask = pImage->blue_mask;
info.format = pImage->format;
info.y_sample_bits = pImage->y_sample_bits;
info.u_sample_bits = pImage->u_sample_bits;
info.v_sample_bits = pImage->v_sample_bits;
info.horz_y_period = pImage->horz_y_period;
info.horz_u_period = pImage->horz_u_period;
info.horz_v_period = pImage->horz_v_period;
info.vert_y_period = pImage->vert_y_period;
info.vert_u_period = pImage->vert_u_period;
info.vert_v_period = pImage->vert_v_period;
memcpy(&info.comp_order, pImage->component_order, 32);
info.scanline_order = pImage->scanline_order;
WriteToClient(client, sizeof(xvImageFormatInfo), &info);
}
return Success;
}
static int
ProcXvMCGetDRInfo(ClientPtr client)
{
xvmcGetDRInfoReply rep;
XvPortPtr pPort;
ScreenPtr pScreen;
XvMCScreenPtr pScreenPriv;
@ -622,30 +618,21 @@ ProcXvMCGetDRInfo(ClientPtr client)
pScreen = pPort->pAdaptor->pScreen;
pScreenPriv = XVMC_GET_PRIVATE(pScreen);
int nameLen = strlen(pScreenPriv->clientDriverName) + 1;
int busIDLen = strlen(pScreenPriv->busID) + 1;
// buffer holds two zero-terminated strings, padded to 4-byte ints
const size_t buflen = pad_to_int32(nameLen+busIDLen);
char *buf = calloc(1, buflen);
if (!buf)
return BadAlloc;
memcpy(buf, pScreenPriv->clientDriverName, nameLen);
memcpy(buf+nameLen, pScreenPriv->busID, busIDLen);
xvmcGetDRInfoReply rep = {
rep = (xvmcGetDRInfoReply) {
.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)),
.nameLen = bytes_to_int32(strlen(pScreenPriv->clientDriverName) + 1),
.busIDLen = bytes_to_int32(strlen(pScreenPriv->busID) + 1),
.isLocal = 1
};
rep.length = rep.nameLen + rep.busIDLen;
rep.nameLen <<= 2;
rep.busIDLen <<= 2;
/*
* Read back to the client what she has put in the shared memory
* segment she prepared for us.
@ -673,40 +660,33 @@ ProcXvMCGetDRInfo(ClientPtr client)
#endif /* HAS_XVMCSHM */
WriteToClient(client, sizeof(xvmcGetDRInfoReply), &rep);
WriteToClient(client, buflen, buf);
free(buf);
if (rep.length) {
WriteToClient(client, rep.nameLen, pScreenPriv->clientDriverName);
WriteToClient(client, rep.busIDLen, pScreenPriv->busID);
}
return Success;
}
int (*ProcXvMCVector[xvmcNumRequest]) (ClientPtr) = {
ProcXvMCQueryVersion,
ProcXvMCListSurfaceTypes,
ProcXvMCCreateContext,
ProcXvMCDestroyContext,
ProcXvMCCreateSurface,
ProcXvMCDestroySurface,
ProcXvMCCreateSubpicture,
ProcXvMCDestroySubpicture,
ProcXvMCListSubpictureTypes, ProcXvMCGetDRInfo};
static int
ProcXvMCDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data)
{
case xvmc_QueryVersion:
return ProcXvMCQueryVersion(client);
case xvmc_ListSurfaceTypes:
return ProcXvMCListSurfaceTypes(client);
case xvmc_CreateContext:
return ProcXvMCCreateContext(client);
case xvmc_DestroyContext:
return ProcXvMCDestroyContext(client);
case xvmc_CreateSurface:
return ProcXvMCCreateSurface(client);
case xvmc_DestroySurface:
return ProcXvMCDestroySurface(client);
case xvmc_CreateSubpicture:
return ProcXvMCCreateSubpicture(client);
case xvmc_DestroySubpicture:
return ProcXvMCDestroySubpicture(client);
case xvmc_ListSubpictureTypes:
return ProcXvMCListSubpictureTypes(client);
case xvmc_GetDRInfo:
return ProcXvMCGetDRInfo(client);
default:
return BadRequest;
}
if (stuff->data < xvmcNumRequest)
return (*ProcXvMCVector[stuff->data]) (client);
else
return BadRequest;
}
static int _X_COLD
@ -753,12 +733,16 @@ XvMCExtensionInit(void)
extEntry->errorBase + XvMCBadSubpicture);
}
static void XvMCScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
static Bool
XvMCCloseScreen(ScreenPtr pScreen)
{
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
free(pScreenPriv);
dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, NULL);
dixScreenUnhookClose(pScreen, XvMCScreenClose);
return (*pScreen->CloseScreen) (pScreen);
}
int
@ -769,12 +753,13 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
if (!dixRegisterPrivateKey(&XvMCScreenKeyRec, PRIVATE_SCREEN, 0))
return BadAlloc;
if (!(pScreenPriv = calloc(1, sizeof(XvMCScreenRec))))
if (!(pScreenPriv = malloc(sizeof(XvMCScreenRec))))
return BadAlloc;
dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, pScreenPriv);
dixScreenHookClose(pScreen, XvMCScreenClose);
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = XvMCCloseScreen;
pScreenPriv->num_adaptors = num;
pScreenPriv->adaptors = pAdapt;
@ -796,6 +781,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 +789,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 +799,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

@ -57,10 +57,10 @@ SOFTWARE.
#include <X11/extensions/XIproto.h>
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "exglobals.h"
#include "allowev.h"
#include "dixevents.h"
/***********************************************************************
*
@ -100,22 +100,22 @@ ProcXAllowDeviceEvents(ClientPtr client)
switch (stuff->mode) {
case ReplayThisDevice:
AllowSome(client, time, thisdev, GRAB_STATE_NOT_GRABBED);
AllowSome(client, time, thisdev, NOT_GRABBED);
break;
case SyncThisDevice:
AllowSome(client, time, thisdev, GRAB_STATE_FREEZE_NEXT_EVENT);
AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT);
break;
case AsyncThisDevice:
AllowSome(client, time, thisdev, GRAB_STATE_THAWED);
AllowSome(client, time, thisdev, THAWED);
break;
case AsyncOtherDevices:
AllowSome(client, time, thisdev, GRAB_STATE_THAW_OTHERS);
AllowSome(client, time, thisdev, THAW_OTHERS);
break;
case SyncAll:
AllowSome(client, time, thisdev, GRAB_STATE_FREEZE_BOTH_NEXT_EVENT);
AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT);
break;
case AsyncAll:
AllowSome(client, time, thisdev, GRAB_STATE_THAWED_BOTH);
AllowSome(client, time, thisdev, THAWED_BOTH);
break;
default:
client->errorValue = stuff->mode;

View File

@ -57,7 +57,6 @@ SOFTWARE.
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#include "dix/resource_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "XIstubs.h"
@ -108,6 +107,7 @@ ProcXChangeDeviceControl(ClientPtr client)
int i, status, ret = BadValue;
DeviceIntPtr dev;
xDeviceResolutionCtl *r;
xChangeDeviceControlReply rep;
AxisInfoPtr a;
CARD32 *resolution;
xDeviceEnableCtl *e;
@ -126,9 +126,11 @@ ProcXChangeDeviceControl(ClientPtr client)
goto out;
}
xChangeDeviceControlReply rep = {
rep = (xChangeDeviceControlReply) {
.repType = X_Reply,
.RepType = X_ChangeDeviceControl,
.sequenceNumber = client->sequence,
.length = 0,
.status = Success,
};
@ -230,11 +232,24 @@ ProcXChangeDeviceControl(ClientPtr client)
SendEventToAllWindows(dev, DevicePresenceNotifyMask,
(xEvent *) &dpn, 1);
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(xChangeDeviceControlReply), &rep);
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
}
return ret;
}
/***********************************************************************
*
* This procedure writes the reply for the xChangeDeviceControl function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXChangeDeviceControl(ClientPtr client, int size,
xChangeDeviceControlReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}

View File

@ -36,4 +36,9 @@ int SProcXChangeDeviceControl(ClientPtr /* client */
int ProcXChangeDeviceControl(ClientPtr /* client */
);
void SRepXChangeDeviceControl(ClientPtr /* client */ ,
int /* size */ ,
xChangeDeviceControlReply * /* rep */
);
#endif /* CHGDCTL_H */

View File

@ -59,6 +59,7 @@ SOFTWARE.
#include "windowstr.h" /* window structure */
#include "scrnintstr.h" /* screen structure */
#include "dixevents.h"
#include "exevents.h"
#include "exglobals.h"

View File

@ -52,14 +52,11 @@ SOFTWARE.
#include <dix-config.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "dix/resource_priv.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include "scrnintstr.h" /* screen structure */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
#include "exglobals.h"

View File

@ -81,7 +81,6 @@ SOFTWARE.
#include <dix-config.h>
#include "dix/cursor_priv.h"
#include "os/bug_priv.h"
#include <X11/X.h>
#include <X11/Xproto.h>
@ -96,11 +95,7 @@ SOFTWARE.
#include "dix/eventconvert.h"
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#include "dix/resource_priv.h"
#include "dix/window_priv.h"
#include "mi/mi_priv.h"
#include "os/log_priv.h"
#include "xkb/xkbsrv_priv.h"
#include "inputstr.h"
#include "windowstr.h"
@ -109,12 +104,15 @@ SOFTWARE.
#include "extnsionst.h"
#include "exglobals.h"
#include "eventstr.h"
#include "dixevents.h" /* DeliverFocusedEvent */
#include "scrnintstr.h"
#include "listdev.h" /* for CopySwapXXXClass */
#include "xace.h"
#include "xiquerydevice.h" /* For List*Info */
#include "eventstr.h"
#include "inpututils.h"
#include "mi.h"
#include "xkbsrv.h"
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
#define AllModifiersMask ( \
@ -493,7 +491,6 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
if (!k->xkb_sli)
continue;
if (k->xkb_sli->flags & XkbSLI_IsDefault) {
assert(to->key);
k->xkb_sli->names = to->key->xkbInfo->desc->names->indicators;
k->xkb_sli->maps = to->key->xkbInfo->desc->indicators->maps;
}
@ -775,7 +772,7 @@ ChangeMasterDeviceClasses(DeviceIntPtr device, DeviceChangedEvent *dce)
int rc;
/* For now, we don't have devices that change physically. */
if (!InputDevIsMaster(device))
if (!IsMaster(device))
return;
rc = dixLookupDevice(&slave, dce->sourceid, serverClient, DixReadAccess);
@ -783,10 +780,10 @@ ChangeMasterDeviceClasses(DeviceIntPtr device, DeviceChangedEvent *dce)
if (rc != Success)
return; /* Device has disappeared */
if (InputDevIsMaster(slave))
if (IsMaster(slave))
return;
if (InputDevIsFloating(slave))
if (IsFloating(slave))
return; /* set floating since the event */
if (GetMaster(slave, MASTER_ATTACHED)->id != dce->masterid)
@ -970,7 +967,7 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
if (!button_is_down(device, key, BUTTON_PROCESSED))
return DONT_PROCESS;
if (InputDevIsMaster(device)) {
if (IsMaster(device)) {
DeviceIntPtr sd;
/*
@ -979,7 +976,7 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
* event being delivered through the slave first
*/
for (sd = inputInfo.devices; sd; sd = sd->next) {
if (InputDevIsMaster(sd) || GetMaster(sd, MASTER_POINTER) != device)
if (IsMaster(sd) || GetMaster(sd, MASTER_POINTER) != device)
continue;
if (!sd->button)
continue;
@ -1047,9 +1044,8 @@ TouchClientWantsOwnershipEvents(ClientPtr client, DeviceIntPtr dev,
{
InputClients *iclient;
assert(wOtherInputMasks(win));
nt_list_for_each_entry(iclient, wOtherInputMasks(win)->inputClients, next) {
if (dixClientForInputClients(iclient) != client)
if (rClient(iclient) != client)
continue;
return xi2mask_isset(iclient->xi2mask, dev, XI_TouchOwnership);
@ -1102,7 +1098,7 @@ DeliverOneTouchEvent(ClientPtr client, DeviceIntPtr dev, TouchPointInfoPtr ti,
filter = GetEventFilter(dev, xi2);
if (XaceHookReceiveAccess(client, win, xi2, 1) != Success)
return FALSE;
TryClientEvents(client, dev, xi2, 1, filter, filter, NullGrab);
err = TryClientEvents(client, dev, xi2, 1, filter, filter, NullGrab);
free(xi2);
/* Returning the value from TryClientEvents isn't useful, since all our
@ -1121,7 +1117,7 @@ ActivateEarlyAccept(DeviceIntPtr dev, TouchPointInfoPtr ti)
ti->listeners[0].type != TOUCH_LISTENER_POINTER_GRAB);
BUG_RETURN(!grab);
client = dixClientForGrab(grab);
client = rClient(grab);
if (TouchAcceptReject(client, dev, XIAcceptTouch, ti->client_id,
ti->listeners[0].window->drawable.id, &error) != Success)
@ -1373,7 +1369,7 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
BUG_RETURN_VAL(!*grab, FALSE);
*client = dixClientForGrab(*grab);
*client = rClient(*grab);
*win = (*grab)->window;
*mask = (*grab)->xi2mask;
}
@ -1393,8 +1389,6 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
else
evtype = GetXI2Type(ev->any.type);
assert(iclients);
assert(wOtherInputMasks(*win));
nt_list_for_each_entry(iclients,
wOtherInputMasks(*win)->inputClients, next)
if (xi2mask_isset(iclients->xi2mask, dev, evtype))
@ -1403,20 +1397,19 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
BUG_RETURN_VAL(!iclients, FALSE);
*mask = iclients->xi2mask;
*client = dixClientForInputClients(iclients);
*client = rClient(iclients);
}
else if (listener->level == XI) {
int xi_type = GetXIType(TouchGetPointerEventType(ev));
Mask xi_filter = event_get_filter_from_type(dev, xi_type);
assert(wOtherInputMasks(*win));
nt_list_for_each_entry(iclients,
wOtherInputMasks(*win)->inputClients, next)
if (iclients->mask[dev->id] & xi_filter)
break;
BUG_RETURN_VAL(!iclients, FALSE);
*client = dixClientForInputClients(iclients);
*client = rClient(iclients);
}
else {
int coretype = GetCoreType(TouchGetPointerEventType(ev));
@ -1430,7 +1423,7 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
break;
/* if owner selected, oclients is NULL */
*client = oclients ? dixClientForOtherClients(oclients) : dixClientForWindow(*win);
*client = oclients ? rClient(oclients) : wClient(*win);
}
*grab = NULL;
@ -1456,7 +1449,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
if (grab) {
win = grab->window;
xi2mask = grab->xi2mask;
client = dixClientForGrab(grab);
client = rClient(grab);
}
}
@ -1568,7 +1561,7 @@ static void
DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
InternalEvent *ev)
{
InternalEvent motion;
DeviceEvent motion;
if (ti->num_listeners) {
ClientPtr client;
@ -1580,27 +1573,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);
}
}
@ -1684,7 +1677,7 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
(ev->any.type == ET_TouchEnd && ti->num_listeners > 0)))
DeliverEmulatedMotionEvent(dev, ti, ev);
if (emulate_pointer && InputDevIsMaster(dev))
if (emulate_pointer && IsMaster(dev))
CheckMotion(&ev->device_event, dev);
kbd = GetMaster(dev, KEYBOARD_OR_FLOAT);
@ -1724,7 +1717,7 @@ ProcessBarrierEvent(InternalEvent *e, DeviceIntPtr dev)
int rc;
GrabPtr grab = dev->deviceGrab.grab;
if (!InputDevIsMaster(dev))
if (!IsMaster(dev))
return;
if (dixLookupWindow(&pWin, be->window, serverClient, DixReadAccess) != Success)
@ -1745,7 +1738,7 @@ ProcessBarrierEvent(InternalEvent *e, DeviceIntPtr dev)
Otherwise, deliver normally to the client.
*/
if (grab &&
dixClientIdForXID(be->barrierid) == dixClientIdForXID(grab->resource) &&
CLIENT_ID(be->barrierid) == CLIENT_ID(grab->resource) &&
grab->window->drawable.id == be->window) {
DeliverGrabbedEvent(e, dev, FALSE);
} else {
@ -1785,7 +1778,7 @@ ProcessGestureEvent(InternalEvent *ev, DeviceIntPtr dev)
if (!dev->gesture)
return;
if (InputDevIsMaster(dev) && IsAnotherGestureActiveOnMaster(dev, ev))
if (IsMaster(dev) && IsAnotherGestureActiveOnMaster(dev, ev))
return;
if (IsGestureBeginEvent(ev))
@ -1860,7 +1853,7 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
b = device->button;
if (InputDevIsMaster(device) || InputDevIsFloating(device))
if (IsMaster(device) || IsFloating(device))
CheckMotion(event, device);
switch (event->type) {
@ -1954,16 +1947,16 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
deactivateDeviceGrab);
else if (device->focus && !IsPointerEvent(ev))
DeliverFocusedEvent(device, (InternalEvent *) event,
InputDevSpriteWindow(device));
GetSpriteWindow(device));
else
DeliverDeviceEvents(InputDevSpriteWindow(device), (InternalEvent *) event,
DeliverDeviceEvents(GetSpriteWindow(device), (InternalEvent *) event,
NullGrab, NullWindow, device);
}
if (deactivateDeviceGrab == TRUE) {
(*device->deviceGrab.DeactivateGrab) (device);
if (!InputDevIsMaster (device) && !InputDevIsFloating (device)) {
if (!IsMaster (device) && !IsFloating (device)) {
int flags, num_events = 0;
InternalEvent dce;
@ -2251,7 +2244,7 @@ DeliverOneGestureEvent(ClientPtr client, DeviceIntPtr dev, GestureInfoPtr gi,
filter = GetEventFilter(dev, xi2);
if (XaceHookReceiveAccess(client, win, xi2, 1) != Success)
return FALSE;
TryClientEvents(client, dev, xi2, 1, filter, filter, NullGrab);
err = TryClientEvents(client, dev, xi2, 1, filter, filter, NullGrab);
free(xi2);
/* Returning the value from TryClientEvents isn't useful, since all our
@ -2286,7 +2279,7 @@ RetrieveGestureDeliveryData(DeviceIntPtr dev, InternalEvent *ev, GestureListener
BUG_RETURN_VAL(!*grab, FALSE);
*client = dixClientForGrab(*grab);
*client = rClient(*grab);
*win = (*grab)->window;
}
else {
@ -2299,14 +2292,13 @@ RetrieveGestureDeliveryData(DeviceIntPtr dev, InternalEvent *ev, GestureListener
listener->type == GESTURE_LISTENER_REGULAR */
evtype = GetXI2Type(ev->any.type);
assert(wOtherInputMasks(*win));
nt_list_for_each_entry(iclients, wOtherInputMasks(*win)->inputClients, next)
if (xi2mask_isset(iclients->xi2mask, dev, evtype))
break;
BUG_RETURN_VAL(!iclients, FALSE);
*client = dixClientForInputClients(iclients);
*client = rClient(iclients);
}
return TRUE;
@ -2338,10 +2330,12 @@ DeliverGestureEventToOwner(DeviceIntPtr dev, GestureInfoPtr gi, InternalEvent *e
int
InitProximityClassDeviceStruct(DeviceIntPtr dev)
{
ProximityClassPtr proxc;
BUG_RETURN_VAL(dev == NULL, FALSE);
BUG_RETURN_VAL(dev->proximity != NULL, FALSE);
ProximityClassPtr proxc = calloc(1, sizeof(ProximityClassRec));
proxc = (ProximityClassPtr) malloc(sizeof(ProximityClassRec));
if (!proxc)
return FALSE;
proxc->sourceid = dev->id;
@ -2534,7 +2528,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
else if (grabtype == XI2)
type = XI_ButtonPress;
grab = CreateGrab(client, dev, modifier_device, pWin, grabtype,
grab = CreateGrab(client->index, dev, modifier_device, pWin, grabtype,
mask, param, type, button, confineTo, cursor);
if (!grab)
return BadAlloc;
@ -2582,7 +2576,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
if (rc != Success)
return rc;
grab = CreateGrab(client, dev, modifier_device, pWin, grabtype,
grab = CreateGrab(client->index, dev, modifier_device, pWin, grabtype,
mask, param, type, key, NULL, NULL);
if (!grab)
return BadAlloc;
@ -2625,7 +2619,7 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
if (rc != Success)
return rc;
grab = CreateGrab(client, dev, dev, pWin, XI2,
grab = CreateGrab(client->index, dev, dev, pWin, XI2,
mask, param,
(type == XIGrabtypeEnter) ? XI_Enter : XI_FocusIn, 0,
NULL, cursor);
@ -2656,7 +2650,7 @@ GrabTouchOrGesture(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr mod_dev,
if (rc != Success)
return rc;
grab = CreateGrab(client, dev, mod_dev, pWin, XI2,
grab = CreateGrab(client->index, dev, mod_dev, pWin, XI2,
mask, param, type, 0, NullWindow, NullCursor);
if (!grab)
return BadAlloc;
@ -2687,7 +2681,6 @@ SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client,
return BadAccess;
}
}
assert(wOtherInputMasks(pWin));
for (others = wOtherInputMasks(pWin)->inputClients; others;
others = others->next) {
if (SameClient(others, client)) {
@ -2740,7 +2733,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 +2853,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;
@ -2915,7 +2908,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate,
{
WindowPtr pWin;
WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */
WindowPtr spriteWin = InputDevSpriteWindow(d);
WindowPtr spriteWin = GetSpriteWindow(d);
if (dest == PointerWindow)
pWin = spriteWin;
@ -2936,9 +2929,9 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate,
/* If the input focus is PointerRootWin, send the event to where
* the pointer is if possible, then perhaps propagate up to root. */
if (inputFocus == PointerRootWin)
inputFocus = InputDevCurrentRootWindow(d);
inputFocus = GetCurrentRootWindow(d);
if (WindowIsParent(inputFocus, spriteWin)) {
if (IsParent(inputFocus, spriteWin)) {
effectiveFocus = inputFocus;
pWin = spriteWin;
}
@ -3249,11 +3242,8 @@ DeviceEventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask,
inputMasks->dontPropagateMask[maskndx] = mask;
}
RecalculateDeviceDeliverableEvents(pWin);
if (ShouldFreeInputMasks(pWin, FALSE)) {
BUG_RETURN_VAL(!inputMasks, BadImplementation);
BUG_RETURN_VAL(!inputMasks->inputClients, BadImplementation);
if (ShouldFreeInputMasks(pWin, FALSE))
FreeResource(inputMasks->inputClients->resource, X11_RESTYPE_NONE);
}
return Success;
}
@ -3347,7 +3337,6 @@ XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client,
if (len && !others) {
if (AddExtensionClient(win, client, 0, 0) != Success)
return BadAlloc;
assert(wOtherInputMasks(win));
others = wOtherInputMasks(win)->inputClients;
}
@ -3357,7 +3346,6 @@ XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client,
}
if (len) {
assert(others);
xi2mask_set_one_mask(others->xi2mask, dev->id, mask, len);
}

View File

@ -36,6 +36,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef EXGLOBALS_H
#define EXGLOBALS_H 1
extern int IReqCode;
extern int IEventBase;
extern int BadDevice;
extern int BadMode;

View File

@ -53,23 +53,20 @@ SOFTWARE.
#include <dix-config.h>
#include <assert.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include <X11/extensions/XI2proto.h>
#include <X11/extensions/geproto.h>
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "dix/exevents_priv.h"
#include "dix/extension_priv.h"
#include "miext/extinit_priv.h"
#include "Xext/geext_priv.h"
#include "inputstr.h"
#include "gcstruct.h" /* pointer for extnsionst.h */
#include "extnsionst.h" /* extension entry */
#include "geext.h" /* extension interfaces for ge */
#include "dixevents.h"
#include "exglobals.h"
#include "swaprep.h"
#include "privates.h"
@ -182,12 +179,150 @@ XExtEventInfo EventInfo[32];
static DeviceIntRec xi_all_devices;
static DeviceIntRec xi_all_master_devices;
/**
* Dispatch vector. Functions defined in here will be called when the matching
* request arrives.
*/
static int (*ProcIVector[]) (ClientPtr) = {
NULL, /* 0 */
ProcXGetExtensionVersion, /* 1 */
ProcXListInputDevices, /* 2 */
ProcXOpenDevice, /* 3 */
ProcXCloseDevice, /* 4 */
ProcXSetDeviceMode, /* 5 */
ProcXSelectExtensionEvent, /* 6 */
ProcXGetSelectedExtensionEvents, /* 7 */
ProcXChangeDeviceDontPropagateList, /* 8 */
ProcXGetDeviceDontPropagateList, /* 9 */
ProcXGetDeviceMotionEvents, /* 10 */
ProcXChangeKeyboardDevice, /* 11 */
ProcXChangePointerDevice, /* 12 */
ProcXGrabDevice, /* 13 */
ProcXUngrabDevice, /* 14 */
ProcXGrabDeviceKey, /* 15 */
ProcXUngrabDeviceKey, /* 16 */
ProcXGrabDeviceButton, /* 17 */
ProcXUngrabDeviceButton, /* 18 */
ProcXAllowDeviceEvents, /* 19 */
ProcXGetDeviceFocus, /* 20 */
ProcXSetDeviceFocus, /* 21 */
ProcXGetFeedbackControl, /* 22 */
ProcXChangeFeedbackControl, /* 23 */
ProcXGetDeviceKeyMapping, /* 24 */
ProcXChangeDeviceKeyMapping, /* 25 */
ProcXGetDeviceModifierMapping, /* 26 */
ProcXSetDeviceModifierMapping, /* 27 */
ProcXGetDeviceButtonMapping, /* 28 */
ProcXSetDeviceButtonMapping, /* 29 */
ProcXQueryDeviceState, /* 30 */
ProcXSendExtensionEvent, /* 31 */
ProcXDeviceBell, /* 32 */
ProcXSetDeviceValuators, /* 33 */
ProcXGetDeviceControl, /* 34 */
ProcXChangeDeviceControl, /* 35 */
/* XI 1.5 */
ProcXListDeviceProperties, /* 36 */
ProcXChangeDeviceProperty, /* 37 */
ProcXDeleteDeviceProperty, /* 38 */
ProcXGetDeviceProperty, /* 39 */
/* XI 2 */
ProcXIQueryPointer, /* 40 */
ProcXIWarpPointer, /* 41 */
ProcXIChangeCursor, /* 42 */
ProcXIChangeHierarchy, /* 43 */
ProcXISetClientPointer, /* 44 */
ProcXIGetClientPointer, /* 45 */
ProcXISelectEvents, /* 46 */
ProcXIQueryVersion, /* 47 */
ProcXIQueryDevice, /* 48 */
ProcXISetFocus, /* 49 */
ProcXIGetFocus, /* 50 */
ProcXIGrabDevice, /* 51 */
ProcXIUngrabDevice, /* 52 */
ProcXIAllowEvents, /* 53 */
ProcXIPassiveGrabDevice, /* 54 */
ProcXIPassiveUngrabDevice, /* 55 */
ProcXIListProperties, /* 56 */
ProcXIChangeProperty, /* 57 */
ProcXIDeleteProperty, /* 58 */
ProcXIGetProperty, /* 59 */
ProcXIGetSelectedEvents, /* 60 */
ProcXIBarrierReleasePointer /* 61 */
};
/* For swapped clients */
static int (*SProcIVector[]) (ClientPtr) = {
NULL, /* 0 */
SProcXGetExtensionVersion, /* 1 */
ProcXListInputDevices, /* 2 */
ProcXOpenDevice, /* 3 */
ProcXCloseDevice, /* 4 */
ProcXSetDeviceMode, /* 5 */
SProcXSelectExtensionEvent, /* 6 */
SProcXGetSelectedExtensionEvents, /* 7 */
SProcXChangeDeviceDontPropagateList, /* 8 */
SProcXGetDeviceDontPropagateList, /* 9 */
SProcXGetDeviceMotionEvents, /* 10 */
ProcXChangeKeyboardDevice, /* 11 */
ProcXChangePointerDevice, /* 12 */
SProcXGrabDevice, /* 13 */
SProcXUngrabDevice, /* 14 */
SProcXGrabDeviceKey, /* 15 */
SProcXUngrabDeviceKey, /* 16 */
SProcXGrabDeviceButton, /* 17 */
SProcXUngrabDeviceButton, /* 18 */
SProcXAllowDeviceEvents, /* 19 */
ProcXGetDeviceFocus, /* 20 */
SProcXSetDeviceFocus, /* 21 */
ProcXGetFeedbackControl, /* 22 */
SProcXChangeFeedbackControl, /* 23 */
ProcXGetDeviceKeyMapping, /* 24 */
SProcXChangeDeviceKeyMapping, /* 25 */
ProcXGetDeviceModifierMapping, /* 26 */
ProcXSetDeviceModifierMapping, /* 27 */
ProcXGetDeviceButtonMapping, /* 28 */
ProcXSetDeviceButtonMapping, /* 29 */
ProcXQueryDeviceState, /* 30 */
SProcXSendExtensionEvent, /* 31 */
ProcXDeviceBell, /* 32 */
ProcXSetDeviceValuators, /* 33 */
SProcXGetDeviceControl, /* 34 */
SProcXChangeDeviceControl, /* 35 */
ProcXListDeviceProperties, /* 36 */
SProcXChangeDeviceProperty, /* 37 */
SProcXDeleteDeviceProperty, /* 38 */
SProcXGetDeviceProperty, /* 39 */
SProcXIQueryPointer, /* 40 */
SProcXIWarpPointer, /* 41 */
SProcXIChangeCursor, /* 42 */
ProcXIChangeHierarchy, /* 43 */
SProcXISetClientPointer, /* 44 */
SProcXIGetClientPointer, /* 45 */
SProcXISelectEvents, /* 46 */
SProcXIQueryVersion, /* 47 */
SProcXIQueryDevice, /* 48 */
SProcXISetFocus, /* 49 */
SProcXIGetFocus, /* 50 */
SProcXIGrabDevice, /* 51 */
SProcXIUngrabDevice, /* 52 */
SProcXIAllowEvents, /* 53 */
SProcXIPassiveGrabDevice, /* 54 */
SProcXIPassiveUngrabDevice, /* 55 */
SProcXIListProperties, /* 56 */
SProcXIChangeProperty, /* 57 */
SProcXIDeleteProperty, /* 58 */
SProcXIGetProperty, /* 59 */
SProcXIGetSelectedEvents, /* 60 */
SProcXIBarrierReleasePointer /* 61 */
};
/*****************************************************************
*
* Globals referenced elsewhere in the server.
*
*/
int IReqCode = 0;
int IEventBase = 0;
int BadDevice = 0;
static int BadEvent = 1;
@ -248,137 +383,11 @@ static int
ProcIDispatch(ClientPtr client)
{
REQUEST(xReq);
if (stuff->data >= ARRAY_SIZE(ProcIVector) || !ProcIVector[stuff->data])
return BadRequest;
UpdateCurrentTimeIf();
switch (stuff->data) {
case X_GetExtensionVersion:
return ProcXGetExtensionVersion(client);
case X_ListInputDevices:
return ProcXListInputDevices(client);
case X_OpenDevice:
return ProcXOpenDevice(client);
case X_CloseDevice:
return ProcXCloseDevice(client);
case X_SetDeviceMode:
return ProcXSetDeviceMode(client);
case X_SelectExtensionEvent:
return ProcXSelectExtensionEvent(client);
case X_GetSelectedExtensionEvents:
return ProcXGetSelectedExtensionEvents(client);
case X_ChangeDeviceDontPropagateList:
return ProcXChangeDeviceDontPropagateList(client);
case X_GetDeviceDontPropagateList:
return ProcXGetDeviceDontPropagateList(client);
case X_GetDeviceMotionEvents:
return ProcXGetDeviceMotionEvents(client);
case X_ChangeKeyboardDevice:
return ProcXChangeKeyboardDevice(client);
case X_ChangePointerDevice:
return ProcXChangePointerDevice(client);
case X_GrabDevice:
return ProcXGrabDevice(client);
case X_UngrabDevice:
return ProcXUngrabDevice(client);
case X_GrabDeviceKey:
return ProcXGrabDeviceKey(client);
case X_UngrabDeviceKey:
return ProcXUngrabDeviceKey(client);
case X_GrabDeviceButton:
return ProcXGrabDeviceButton(client);
case X_UngrabDeviceButton:
return ProcXUngrabDeviceButton(client);
case X_AllowDeviceEvents:
return ProcXAllowDeviceEvents(client);
case X_GetDeviceFocus:
return ProcXGetDeviceFocus(client);
case X_SetDeviceFocus:
return ProcXSetDeviceFocus(client);
case X_GetFeedbackControl:
return ProcXGetFeedbackControl(client);
case X_ChangeFeedbackControl:
return ProcXChangeFeedbackControl(client);
case X_GetDeviceKeyMapping:
return ProcXGetDeviceKeyMapping(client);
case X_ChangeDeviceKeyMapping:
return ProcXChangeDeviceKeyMapping(client);
case X_GetDeviceModifierMapping:
return ProcXGetDeviceModifierMapping(client);
case X_SetDeviceModifierMapping:
return ProcXSetDeviceModifierMapping(client);
case X_GetDeviceButtonMapping:
return ProcXGetDeviceButtonMapping(client);
case X_SetDeviceButtonMapping:
return ProcXSetDeviceButtonMapping(client);
case X_QueryDeviceState:
return ProcXQueryDeviceState(client);
case X_SendExtensionEvent:
return ProcXSendExtensionEvent(client);
case X_DeviceBell:
return ProcXDeviceBell(client);
case X_SetDeviceValuators:
return ProcXSetDeviceValuators(client);
case X_GetDeviceControl:
return ProcXGetDeviceControl(client);
case X_ChangeDeviceControl:
return ProcXChangeDeviceControl(client);
/* XI 1.5 */
case X_ListDeviceProperties:
return ProcXListDeviceProperties(client);
case X_ChangeDeviceProperty:
return ProcXChangeDeviceProperty(client);
case X_DeleteDeviceProperty:
return ProcXDeleteDeviceProperty(client);
case X_GetDeviceProperty:
return ProcXGetDeviceProperty(client);
/* XI 2 */
case X_XIQueryPointer:
return ProcXIQueryPointer(client);
case X_XIWarpPointer:
return ProcXIWarpPointer(client);
case X_XIChangeCursor:
return ProcXIChangeCursor(client);
case X_XIChangeHierarchy:
return ProcXIChangeHierarchy(client);
case X_XISetClientPointer:
return ProcXISetClientPointer(client);
case X_XIGetClientPointer:
return ProcXIGetClientPointer(client);
case X_XISelectEvents:
return ProcXISelectEvents(client);
case X_XIQueryVersion:
return ProcXIQueryVersion(client);
case X_XIQueryDevice:
return ProcXIQueryDevice(client);
case X_XISetFocus:
return ProcXISetFocus(client);
case X_XIGetFocus:
return ProcXIGetFocus(client);
case X_XIGrabDevice:
return ProcXIGrabDevice(client);
case X_XIUngrabDevice:
return ProcXIUngrabDevice(client);
case X_XIAllowEvents:
return ProcXIAllowEvents(client);
case X_XIPassiveGrabDevice:
return ProcXIPassiveGrabDevice(client);
case X_XIPassiveUngrabDevice:
return ProcXIPassiveUngrabDevice(client);
case X_XIListProperties:
return ProcXIListProperties(client);
case X_XIChangeProperty:
return ProcXIChangeProperty(client);
case X_XIDeleteProperty:
return ProcXIDeleteProperty(client);
case X_XIGetProperty:
return ProcXIGetProperty(client);
case X_XIGetSelectedEvents:
return ProcXIGetSelectedEvents(client);
case X_XIBarrierReleasePointer:
return ProcXIBarrierReleasePointer(client);
default:
return BadRequest;
}
return (*ProcIVector[stuff->data]) (client);
}
/*******************************************************************************
@ -394,136 +403,102 @@ static int _X_COLD
SProcIDispatch(ClientPtr client)
{
REQUEST(xReq);
if (stuff->data >= ARRAY_SIZE(SProcIVector) || !SProcIVector[stuff->data])
return BadRequest;
UpdateCurrentTimeIf();
return (*SProcIVector[stuff->data]) (client);
}
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;
/**********************************************************************
*
* SReplyIDispatch
* Swap any replies defined in this extension.
*
*/
static void _X_COLD
SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
{
/* All we look at is the type field */
/* This is common to all replies */
if (rep->RepType == X_GetExtensionVersion)
SRepXGetExtensionVersion(client, len,
(xGetExtensionVersionReply *) rep);
else if (rep->RepType == X_ListInputDevices)
SRepXListInputDevices(client, len, (xListInputDevicesReply *) rep);
else if (rep->RepType == X_OpenDevice)
SRepXOpenDevice(client, len, (xOpenDeviceReply *) rep);
else if (rep->RepType == X_SetDeviceMode)
SRepXSetDeviceMode(client, len, (xSetDeviceModeReply *) rep);
else if (rep->RepType == X_GetSelectedExtensionEvents)
SRepXGetSelectedExtensionEvents(client, len,
(xGetSelectedExtensionEventsReply *)
rep);
else if (rep->RepType == X_GetDeviceDontPropagateList)
SRepXGetDeviceDontPropagateList(client, len,
(xGetDeviceDontPropagateListReply *)
rep);
else if (rep->RepType == X_GetDeviceMotionEvents)
SRepXGetDeviceMotionEvents(client, len,
(xGetDeviceMotionEventsReply *) rep);
else if (rep->RepType == X_GrabDevice)
SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep);
else if (rep->RepType == X_GetDeviceFocus)
SRepXGetDeviceFocus(client, len, (xGetDeviceFocusReply *) rep);
else if (rep->RepType == X_GetFeedbackControl)
SRepXGetFeedbackControl(client, len, (xGetFeedbackControlReply *) rep);
else if (rep->RepType == X_GetDeviceKeyMapping)
SRepXGetDeviceKeyMapping(client, len,
(xGetDeviceKeyMappingReply *) rep);
else if (rep->RepType == X_GetDeviceModifierMapping)
SRepXGetDeviceModifierMapping(client, len,
(xGetDeviceModifierMappingReply *) rep);
else if (rep->RepType == X_SetDeviceModifierMapping)
SRepXSetDeviceModifierMapping(client, len,
(xSetDeviceModifierMappingReply *) rep);
else if (rep->RepType == X_GetDeviceButtonMapping)
SRepXGetDeviceButtonMapping(client, len,
(xGetDeviceButtonMappingReply *) rep);
else if (rep->RepType == X_SetDeviceButtonMapping)
SRepXSetDeviceButtonMapping(client, len,
(xSetDeviceButtonMappingReply *) rep);
else if (rep->RepType == X_QueryDeviceState)
SRepXQueryDeviceState(client, len, (xQueryDeviceStateReply *) rep);
else if (rep->RepType == X_SetDeviceValuators)
SRepXSetDeviceValuators(client, len, (xSetDeviceValuatorsReply *) rep);
else if (rep->RepType == X_GetDeviceControl)
SRepXGetDeviceControl(client, len, (xGetDeviceControlReply *) rep);
else if (rep->RepType == X_ChangeDeviceControl)
SRepXChangeDeviceControl(client, len,
(xChangeDeviceControlReply *) rep);
else if (rep->RepType == X_ListDeviceProperties)
SRepXListDeviceProperties(client, len,
(xListDevicePropertiesReply *) rep);
else if (rep->RepType == X_GetDeviceProperty)
SRepXGetDeviceProperty(client, len, (xGetDevicePropertyReply *) rep);
else if (rep->RepType == X_XIQueryPointer)
SRepXIQueryPointer(client, len, (xXIQueryPointerReply *) rep);
else if (rep->RepType == X_XIGetClientPointer)
SRepXIGetClientPointer(client, len, (xXIGetClientPointerReply *) rep);
else if (rep->RepType == X_XIQueryVersion)
SRepXIQueryVersion(client, len, (xXIQueryVersionReply *) rep);
else if (rep->RepType == X_XIQueryDevice)
SRepXIQueryDevice(client, len, (xXIQueryDeviceReply *) rep);
else if (rep->RepType == X_XIGrabDevice)
SRepXIGrabDevice(client, len, (xXIGrabDeviceReply *) rep);
else if (rep->RepType == X_XIPassiveGrabDevice)
SRepXIPassiveGrabDevice(client, len, (xXIPassiveGrabDeviceReply *) rep);
else if (rep->RepType == X_XIListProperties)
SRepXIListProperties(client, len, (xXIListPropertiesReply *) rep);
else if (rep->RepType == X_XIGetProperty)
SRepXIGetProperty(client, len, (xXIGetPropertyReply *) rep);
else if (rep->RepType == X_XIGetSelectedEvents)
SRepXIGetSelectedEvents(client, len, (xXIGetSelectedEventsReply *) rep);
else if (rep->RepType == X_XIGetFocus)
SRepXIGetFocus(client, len, (xXIGetFocusReply *) rep);
else {
FatalError("XINPUT confused sending swapped reply");
}
}
@ -1147,6 +1122,7 @@ RestoreExtensionEvents(void)
{
int i, j;
IReqCode = 0;
IEventBase = 0;
for (i = 0; i < ExtEventIndex - 1; i++) {
@ -1195,6 +1171,7 @@ RestoreExtensionEvents(void)
static void
IResetProc(ExtensionEntry * unused)
{
ReplySwapVector[IReqCode] = ReplyNotSwappd;
EventSwapVector[DeviceValuator] = NotImplemented;
EventSwapVector[DeviceKeyPress] = NotImplemented;
EventSwapVector[DeviceKeyRelease] = NotImplemented;
@ -1347,8 +1324,7 @@ XInputExtensionInit(void)
extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
SProcIDispatch, IResetProc, StandardMinorOpcode);
if (extEntry) {
assert(extEntry->base == EXTENSION_MAJOR_XINPUT);
IReqCode = extEntry->base;
IEventBase = extEntry->eventBase;
XIVersion = thisversion;
MakeDeviceTypeAtoms();
@ -1357,6 +1333,7 @@ XInputExtensionInit(void)
if (!RT_INPUTCLIENT)
FatalError("Failed to add resource type for XI.\n");
FixExtensionEvents(extEntry);
ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch;
EventSwapVector[DeviceValuator] = SEventIDispatch;
EventSwapVector[DeviceKeyPress] = SEventIDispatch;
EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
@ -1374,7 +1351,7 @@ XInputExtensionInit(void)
EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
EventSwapVector[DevicePresenceNotify] = SEventIDispatch;
GERegisterExtension(EXTENSION_MAJOR_XINPUT, XI2EventSwap);
GERegisterExtension(IReqCode, XI2EventSwap);
memset(&xi_all_devices, 0, sizeof(xi_all_devices));
memset(&xi_all_master_devices, 0, sizeof(xi_all_master_devices));

View File

@ -69,12 +69,21 @@ int
ProcXGetDeviceButtonMapping(ClientPtr client)
{
DeviceIntPtr dev;
xGetDeviceButtonMappingReply rep;
ButtonClassPtr b;
int rc;
REQUEST(xGetDeviceButtonMappingReq);
REQUEST_SIZE_MATCH(xGetDeviceButtonMappingReq);
rep = (xGetDeviceButtonMappingReply) {
.repType = X_Reply,
.RepType = X_GetDeviceButtonMapping,
.sequenceNumber = client->sequence,
.nElts = 0,
.length = 0
};
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@ -83,19 +92,25 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
if (b == NULL)
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);
rep.nElts = b->numButtons;
rep.length = bytes_to_int32(rep.nElts);
WriteReplyToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep);
WriteToClient(client, rep.nElts, &b->map[1]);
return Success;
}
/***********************************************************************
*
* This procedure writes the reply for the XGetDeviceButtonMapping function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXGetDeviceButtonMapping(ClientPtr client, int size,
xGetDeviceButtonMappingReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}

View File

@ -33,4 +33,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int ProcXGetDeviceButtonMapping(ClientPtr /* client */
);
void SRepXGetDeviceButtonMapping(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceButtonMappingReply * /* rep */
);
#endif /* GETBMAP_H */

View File

@ -143,6 +143,21 @@ CopySwapDeviceEnable(ClientPtr client, DeviceIntPtr dev, char *buf)
}
}
/***********************************************************************
*
* This procedure writes the reply for the xGetDeviceControl function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}
/***********************************************************************
*
* Get the state of the specified device control.
@ -153,8 +168,9 @@ int
ProcXGetDeviceControl(ClientPtr client)
{
int rc, total_length = 0;
char *savbuf;
char *buf, *savbuf;
DeviceIntPtr dev;
xGetDeviceControlReply rep;
REQUEST(xGetDeviceControlReq);
REQUEST_SIZE_MATCH(xGetDeviceControlReq);
@ -163,6 +179,13 @@ ProcXGetDeviceControl(ClientPtr client)
if (rc != Success)
return rc;
rep = (xGetDeviceControlReply) {
.repType = X_Reply,
.RepType = X_GetDeviceControl,
.sequenceNumber = client->sequence,
.length = 0
};
switch (stuff->control) {
case DEVICE_RESOLUTION:
if (!dev->valuator)
@ -183,7 +206,7 @@ ProcXGetDeviceControl(ClientPtr client)
return BadValue;
}
char *buf = calloc(1, total_length);
buf = (char *) malloc(total_length);
if (!buf)
return BadAlloc;
savbuf = buf;
@ -202,18 +225,8 @@ ProcXGetDeviceControl(ClientPtr client)
break;
}
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);
rep.length = bytes_to_int32(total_length);
WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep);
WriteToClient(client, total_length, savbuf);
free(savbuf);
return Success;

View File

@ -36,4 +36,9 @@ int SProcXGetDeviceControl(ClientPtr /* client */
int ProcXGetDeviceControl(ClientPtr /* client */
);
void SRepXGetDeviceControl(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceControlReply * /* rep */
);
#endif /* GETDCTL_H */

View File

@ -234,6 +234,23 @@ CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf)
*buf += sizeof(xBellFeedbackState);
}
/***********************************************************************
*
* This procedure writes the reply for the xGetFeedbackControl function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXGetFeedbackControl(ClientPtr client, int size,
xGetFeedbackControlReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->num_feedbacks);
WriteToClient(client, size, rep);
}
/***********************************************************************
*
* Get the feedback control state.
@ -244,7 +261,7 @@ int
ProcXGetFeedbackControl(ClientPtr client)
{
int rc, total_length = 0;
char *savbuf;
char *buf, *savbuf;
DeviceIntPtr dev;
KbdFeedbackPtr k;
PtrFeedbackPtr p;
@ -252,6 +269,7 @@ ProcXGetFeedbackControl(ClientPtr client)
StringFeedbackPtr s;
BellFeedbackPtr b;
LedFeedbackPtr l;
xGetFeedbackControlReply rep;
REQUEST(xGetFeedbackControlReq);
REQUEST_SIZE_MATCH(xGetFeedbackControlReq);
@ -260,10 +278,12 @@ ProcXGetFeedbackControl(ClientPtr client)
if (rc != Success)
return rc;
xGetFeedbackControlReply rep = {
rep = (xGetFeedbackControlReply) {
.repType = X_Reply,
.RepType = X_GetFeedbackControl,
.sequenceNumber = client->sequence,
.length = 0,
.num_feedbacks = 0
};
for (k = dev->kbdfeed; k; k = k->next) {
@ -295,7 +315,7 @@ ProcXGetFeedbackControl(ClientPtr client)
if (total_length == 0)
return BadMatch;
char *buf = (char *) calloc(1, total_length);
buf = (char *) malloc(total_length);
if (!buf)
return BadAlloc;
savbuf = buf;
@ -314,13 +334,7 @@ ProcXGetFeedbackControl(ClientPtr client)
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);
WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep);
WriteToClient(client, total_length, savbuf);
free(savbuf);
return Success;

View File

@ -33,4 +33,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int ProcXGetFeedbackControl(ClientPtr /* client */
);
void SRepXGetFeedbackControl(ClientPtr /* client */ ,
int /* size */ ,
xGetFeedbackControlReply * /* rep */
);
#endif /* GETFCTL_H */

View File

@ -71,6 +71,7 @@ ProcXGetDeviceFocus(ClientPtr client)
{
DeviceIntPtr dev;
FocusClassPtr focus;
xGetDeviceFocusReply rep;
int rc;
REQUEST(xGetDeviceFocusReq);
@ -82,16 +83,15 @@ ProcXGetDeviceFocus(ClientPtr client)
if (!dev->focus)
return BadDevice;
focus = dev->focus;
xGetDeviceFocusReply rep = {
rep = (xGetDeviceFocusReply) {
.repType = X_Reply,
.RepType = X_GetDeviceFocus,
.sequenceNumber = client->sequence,
.time = focus->time.milliseconds,
.revertTo = focus->revert,
.length = 0
};
focus = dev->focus;
if (focus->win == NoneWin)
rep.focus = None;
else if (focus->win == PointerRootWin)
@ -101,12 +101,25 @@ 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);
rep.time = focus->time.milliseconds;
rep.revertTo = focus->revert;
WriteReplyToClient(client, sizeof(xGetDeviceFocusReply), &rep);
return Success;
}
/***********************************************************************
*
* This procedure writes the reply for the GetDeviceFocus function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXGetDeviceFocus(ClientPtr client, int size, xGetDeviceFocusReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swapl(&rep->focus);
swapl(&rep->time);
WriteToClient(client, size, rep);
}

View File

@ -33,4 +33,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int ProcXGetDeviceFocus(ClientPtr /* client */
);
void SRepXGetDeviceFocus(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceFocusReply * /* rep */
);
#endif /* GETFOCUS_H */

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