From dafebc5bb70303f0b5baf0b087cf4d9a64b5c7f0 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 12 Sep 2011 11:27:51 +0200 Subject: Synchronised line endinge with release branch --- xorg-server/include/Makefile.am | 144 +-- xorg-server/include/colormapst.h | 264 ++--- xorg-server/include/dix-config.h.in | 910 +++++++------- xorg-server/include/dix.h | 1168 +++++++++--------- xorg-server/include/dixstruct.h | 384 +++--- xorg-server/include/eventconvert.h | 80 +- xorg-server/include/eventstr.h | 484 ++++---- xorg-server/include/input.h | 1196 +++++++++---------- xorg-server/include/inputstr.h | 1204 +++++++++---------- xorg-server/include/inpututils.h | 84 +- xorg-server/include/list.h | 562 ++++----- xorg-server/include/misc.h | 650 +++++----- xorg-server/include/os.h | 1104 ++++++++--------- xorg-server/include/protocol-versions.h | 288 ++--- xorg-server/include/ptrveloc.h | 288 ++--- xorg-server/include/regionstr.h | 730 ++++++------ xorg-server/include/window.h | 544 ++++----- xorg-server/include/xkbsrv.h | 1974 +++++++++++++++---------------- xorg-server/include/xorg-server.h.in | 382 +++--- 19 files changed, 6220 insertions(+), 6220 deletions(-) (limited to 'xorg-server/include') diff --git a/xorg-server/include/Makefile.am b/xorg-server/include/Makefile.am index 5b2e4cc58..6f63c764f 100644 --- a/xorg-server/include/Makefile.am +++ b/xorg-server/include/Makefile.am @@ -1,72 +1,72 @@ -if XORG -sdk_HEADERS = \ - XIstubs.h \ - Xprintf.h \ - callback.h \ - client.h \ - closestr.h \ - closure.h \ - colormap.h \ - colormapst.h \ - hotplug.h \ - cursor.h \ - cursorstr.h \ - dix.h \ - dixaccess.h \ - dixevents.h \ - dixfont.h \ - dixfontstr.h \ - dixgrabs.h \ - dixstruct.h \ - events.h \ - exevents.h \ - extension.h \ - extinit.h \ - extnsionst.h \ - gc.h \ - gcstruct.h \ - globals.h \ - input.h \ - inputstr.h \ - list.h \ - misc.h \ - miscstruct.h \ - opaque.h \ - os.h \ - pixmap.h \ - pixmapstr.h \ - privates.h \ - property.h \ - propertyst.h \ - ptrveloc.h \ - region.h \ - regionstr.h \ - registry.h \ - resource.h \ - rgb.h \ - screenint.h \ - scrnintstr.h \ - selection.h \ - servermd.h \ - site.h \ - swaprep.h \ - swapreq.h \ - validate.h \ - window.h \ - windowstr.h \ - xkbfile.h \ - xkbsrv.h \ - xkbstr.h \ - xkbrules.h \ - xserver-properties.h - -nodist_sdk_HEADERS = xorg-server.h -endif - -AM_CFLAGS = $(DIX_CFLAGS) - -EXTRA_DIST = \ - dix-config-apple-verbatim.h \ - eventconvert.h eventstr.h inpututils.h \ - protocol-versions.h \ - xsha1.h +if XORG +sdk_HEADERS = \ + XIstubs.h \ + Xprintf.h \ + callback.h \ + client.h \ + closestr.h \ + closure.h \ + colormap.h \ + colormapst.h \ + hotplug.h \ + cursor.h \ + cursorstr.h \ + dix.h \ + dixaccess.h \ + dixevents.h \ + dixfont.h \ + dixfontstr.h \ + dixgrabs.h \ + dixstruct.h \ + events.h \ + exevents.h \ + extension.h \ + extinit.h \ + extnsionst.h \ + gc.h \ + gcstruct.h \ + globals.h \ + input.h \ + inputstr.h \ + list.h \ + misc.h \ + miscstruct.h \ + opaque.h \ + os.h \ + pixmap.h \ + pixmapstr.h \ + privates.h \ + property.h \ + propertyst.h \ + ptrveloc.h \ + region.h \ + regionstr.h \ + registry.h \ + resource.h \ + rgb.h \ + screenint.h \ + scrnintstr.h \ + selection.h \ + servermd.h \ + site.h \ + swaprep.h \ + swapreq.h \ + validate.h \ + window.h \ + windowstr.h \ + xkbfile.h \ + xkbsrv.h \ + xkbstr.h \ + xkbrules.h \ + xserver-properties.h + +nodist_sdk_HEADERS = xorg-server.h +endif + +AM_CFLAGS = $(DIX_CFLAGS) + +EXTRA_DIST = \ + dix-config-apple-verbatim.h \ + eventconvert.h eventstr.h inpututils.h \ + protocol-versions.h \ + xsha1.h diff --git a/xorg-server/include/colormapst.h b/xorg-server/include/colormapst.h index 6f514c5db..b597e2c60 100644 --- a/xorg-server/include/colormapst.h +++ b/xorg-server/include/colormapst.h @@ -1,132 +1,132 @@ -/* - -Copyright 1987, 1998 The Open Group - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -*/ - -#ifndef CMAPSTRUCT_H -#define CMAPSTRUCT_H 1 - -#include - -#include "colormap.h" -#include "screenint.h" -#include "privates.h" - -/* Shared color -- the color is used by AllocColorPlanes */ -typedef struct -{ - unsigned short color; - short refcnt; -} SHAREDCOLOR; - -/* LOCO -- a local color for a PseudoColor cell. DirectColor maps always - * use the first value (called red) in the structure. What channel they - * are really talking about depends on which map they are in. */ -typedef struct -{ - unsigned short red, green, blue; -} LOCO; - -/* SHCO -- a shared color for a PseudoColor cell. Used with AllocColorPlanes. - * DirectColor maps always use the first value (called red) in the structure. - * What channel they are really talking about depends on which map they - * are in. */ -typedef struct -{ - SHAREDCOLOR *red, *green, *blue; -} SHCO; - - -/* color map entry */ -typedef struct _CMEntry -{ - union - { - LOCO local; - SHCO shco; - } co; - short refcnt; - Bool fShared; -} Entry; - -/* - * COLORMAPs can be used for either Direct or Pseudo color. PseudoColor - * only needs one cell table, we arbitrarily pick red. We keep track - * of that table with freeRed, numPixelsRed, and clientPixelsRed - * - * The padN variables are unfortunate ABI BC. See fdo bug #6924. - */ - -typedef struct _ColormapRec -{ - VisualPtr pVisual; - short class; /* PseudoColor or DirectColor */ -#if defined(_LP64) - short pad0; - XID pad1; -#endif - XID mid; /* client's name for colormap */ -#if defined(_LP64) && (X_BYTE_ORDER == X_LITTLE_ENDIAN) - XID pad2; -#endif - ScreenPtr pScreen; /* screen map is associated with */ - short flags; /* 1 = IsDefault - * 2 = AllAllocated */ - int freeRed; - int freeGreen; - int freeBlue; - int *numPixelsRed; - int *numPixelsGreen; - int *numPixelsBlue; - Pixel **clientPixelsRed; - Pixel **clientPixelsGreen; - Pixel **clientPixelsBlue; - Entry *red; - Entry *green; - Entry *blue; - PrivateRec *devPrivates; -} ColormapRec; - -#endif /* COLORMAP_H */ +/* + +Copyright 1987, 1998 The Open Group + +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 +OPEN GROUP 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 Open Group 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 Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*/ + +#ifndef CMAPSTRUCT_H +#define CMAPSTRUCT_H 1 + +#include + +#include "colormap.h" +#include "screenint.h" +#include "privates.h" + +/* Shared color -- the color is used by AllocColorPlanes */ +typedef struct +{ + unsigned short color; + short refcnt; +} SHAREDCOLOR; + +/* LOCO -- a local color for a PseudoColor cell. DirectColor maps always + * use the first value (called red) in the structure. What channel they + * are really talking about depends on which map they are in. */ +typedef struct +{ + unsigned short red, green, blue; +} LOCO; + +/* SHCO -- a shared color for a PseudoColor cell. Used with AllocColorPlanes. + * DirectColor maps always use the first value (called red) in the structure. + * What channel they are really talking about depends on which map they + * are in. */ +typedef struct +{ + SHAREDCOLOR *red, *green, *blue; +} SHCO; + + +/* color map entry */ +typedef struct _CMEntry +{ + union + { + LOCO local; + SHCO shco; + } co; + short refcnt; + Bool fShared; +} Entry; + +/* + * COLORMAPs can be used for either Direct or Pseudo color. PseudoColor + * only needs one cell table, we arbitrarily pick red. We keep track + * of that table with freeRed, numPixelsRed, and clientPixelsRed + * + * The padN variables are unfortunate ABI BC. See fdo bug #6924. + */ + +typedef struct _ColormapRec +{ + VisualPtr pVisual; + short class; /* PseudoColor or DirectColor */ +#if defined(_LP64) + short pad0; + XID pad1; +#endif + XID mid; /* client's name for colormap */ +#if defined(_LP64) && (X_BYTE_ORDER == X_LITTLE_ENDIAN) + XID pad2; +#endif + ScreenPtr pScreen; /* screen map is associated with */ + short flags; /* 1 = IsDefault + * 2 = AllAllocated */ + int freeRed; + int freeGreen; + int freeBlue; + int *numPixelsRed; + int *numPixelsGreen; + int *numPixelsBlue; + Pixel **clientPixelsRed; + Pixel **clientPixelsGreen; + Pixel **clientPixelsBlue; + Entry *red; + Entry *green; + Entry *blue; + PrivateRec *devPrivates; +} ColormapRec; + +#endif /* COLORMAP_H */ diff --git a/xorg-server/include/dix-config.h.in b/xorg-server/include/dix-config.h.in index 56f45726f..4710ef881 100644 --- a/xorg-server/include/dix-config.h.in +++ b/xorg-server/include/dix-config.h.in @@ -1,455 +1,455 @@ -/* dix-config.h.in: not at all generated. -*- c -*- */ - -#ifndef _DIX_CONFIG_H_ -#define _DIX_CONFIG_H_ - -/* Support BigRequests extension */ -#undef BIGREQS - -/* Builder address */ -#undef BUILDERADDR - -/* Operating System Name */ -#undef OSNAME - -/* Operating System Vendor */ -#undef OSVENDOR - -/* Builder string */ -#undef BUILDERSTRING - -/* Default font path */ -#undef COMPILEDDEFAULTFONTPATH - -/* Miscellaneous server configuration files path */ -#undef SERVER_MISC_CONFIG_PATH - -/* Support Composite Extension */ -#undef COMPOSITE - -/* Support Damage extension */ -#undef DAMAGE - -/* Use OsVendorVErrorF */ -#undef DDXOSVERRORF - -/* Use ddxBeforeReset */ -#undef DDXBEFORERESET - -/* Build DPMS extension */ -#undef DPMSExtension - -/* Build GLX extension */ -#undef GLXEXT - -/* Build GLX DRI loader */ -#undef GLX_DRI - -/* Path to DRI drivers */ -#undef DRI_DRIVER_PATH - -/* Support XDM-AUTH*-1 */ -#undef HASXDMAUTH - -/* Define to 1 if you have the `getdtablesize' function. */ -#undef HAS_GETDTABLESIZE - -/* Define to 1 if you have the `getifaddrs' function. */ -#undef HAS_GETIFADDRS - -/* Define to 1 if you have the `getpeereid' function. */ -#undef HAS_GETPEEREID - -/* Define to 1 if you have the `getpeerucred' function. */ -#undef HAS_GETPEERUCRED - -/* Define to 1 if you have the `mmap' function. */ -#undef HAS_MMAP - -/* Support SHM */ -#undef HAS_SHM - -/* Have the 'strlcpy' function */ -#undef HAS_STRLCPY - -/* Define to 1 if you have the header file. */ -#undef HAVE_ASM_MTRR_H - -/* Has backtrace support */ -#undef HAVE_BACKTRACE - -/* Define to 1 if you have the header file. */ -#undef HAVE_BYTESWAP_H - -/* Define to 1 if you have cbrt */ -#undef HAVE_CBRT - -/* Define to 1 if you have the header file. */ -#undef HAVE_DBM_H - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#undef HAVE_DIRENT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ -#undef HAVE_DOPRNT - -/* Have execinfo.h */ -#undef HAVE_EXECINFO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define to 1 if you have the `geteuid' function. */ -#undef HAVE_GETEUID - -/* Define to 1 if you have the `getisax' function. */ -#undef HAVE_GETISAX - -/* Define to 1 if you have the `getuid' function. */ -#undef HAVE_GETUID - -/* Define to 1 if you have the `getzoneid' function. */ -#undef HAVE_GETZONEID - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Have Quartz */ -#undef XQUARTZ - -/* Support application updating through sparkle. */ -#undef XQUARTZ_SPARKLE - -/* Prefix to use for bundle identifiers */ -#undef BUNDLE_ID_PREFIX - -/* Build a standalone xpbproxy */ -#undef STANDALONE_XPBPROXY - -/* Define to 1 if you have the `m' library (-lm). */ -#undef HAVE_LIBM - -/* Define to 1 if you have the libdispatch (GCD) available */ -#undef HAVE_LIBDISPATCH - -/* Define to 1 if you have the `link' function. */ -#undef HAVE_LINK - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_AGPGART_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_APM_BIOS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_FB_H - -/* Define to 1 if you have the `mkstemp' function. */ -#undef HAVE_MKSTEMP - -/* Define to 1 if you have the header file. */ -#undef HAVE_NDBM_H - -/* Define to 1 if you have the header file, and it defines `DIR'. */ -#undef HAVE_NDIR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_RPCSVC_DBM_H - -/* Define to use libc SHA1 functions */ -#undef HAVE_SHA1_IN_LIBC - -/* Define to use CommonCrypto SHA1 functions */ -#undef HAVE_SHA1_IN_COMMONCRYPTO - -/* Define to use libmd SHA1 functions */ -#undef HAVE_SHA1_IN_LIBMD - -/* Define to use libgcrypt SHA1 functions */ -#undef HAVE_SHA1_IN_LIBGCRYPT - -/* Define to use libsha1 for SHA1 */ -#undef HAVE_SHA1_IN_LIBSHA1 - -/* Define to 1 if you have the `shmctl64' function. */ -#undef HAVE_SHMCTL64 - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strchr' function. */ -#undef HAVE_STRCHR - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strrchr' function. */ -#undef HAVE_STRRCHR - -/* Define to 1 if you have the `strtol' function. */ -#undef HAVE_STRTOL - -/* Define to 1 if SYSV IPC is available */ -#undef HAVE_SYSV_IPC - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_AGPIO_H - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#undef HAVE_SYS_DIR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_IO_H - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#undef HAVE_SYS_NDIR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UTSNAME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_VM86_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_TSLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_FNMATCH_H - -/* Have /dev/urandom */ -#undef HAVE_URANDOM - -/* Define to 1 if you have the `vprintf' function. */ -#undef HAVE_VPRINTF - -/* Define to 1 if you have the `vasprintf' function. */ -#undef HAVE_VASPRINTF - -/* Support IPv6 for TCP connections */ -#undef IPv6 - -/* Support os-specific local connections */ -#undef LOCALCONN - -/* Support MIT-SHM Extension */ -#undef MITSHM - -/* Enable some debugging code */ -#undef DEBUG - -/* Name of package */ -#undef PACKAGE - -/* Internal define for Xinerama */ -#undef PANORAMIX - -/* Overall prefix */ -#undef PROJECTROOT - -/* Support RANDR extension */ -#undef RANDR - -/* Support Record extension */ -#undef XRECORD - -/* Support RENDER extension */ -#undef RENDER - -/* Support X resource extension */ -#undef RES - -/* Support client ID tracking in X resource extension */ -#undef CLIENTIDS - -/* Support MIT-SCREEN-SAVER extension */ -#undef SCREENSAVER - -/* Support Secure RPC ("SUN-DES-1") authentication for X11 clients */ -#undef SECURE_RPC - -/* Support SHAPE extension */ -#undef SHAPE - -/* Define to 1 on systems derived from System V Release 4 */ -#undef SVR4 - -/* Support TCP socket connections */ -#undef TCPCONN - -/* Enable touchscreen support */ -#undef TOUCHSCREEN - -/* Support tslib touchscreen abstraction library */ -#undef TSLIB - -/* Support UNIX socket connections */ -#undef UNIXCONN - -/* Define to use byteswap macros from */ -#undef USE_SYS_ENDIAN_H - -/* unaligned word accesses behave as expected */ -#undef WORKING_UNALIGNED_INT - -/* Build X string registry */ -#undef XREGISTRY - -/* Build X-ACE extension */ -#undef XACE - -/* Build SELinux extension */ -#undef XSELINUX - -/* Support XCMisc extension */ -#undef XCMISC - -/* Build Security extension */ -#undef XCSECURITY - -/* Support Xdmcp */ -#undef XDMCP - -/* Build XFree86 BigFont extension */ -#undef XF86BIGFONT - -/* Support XFree86 Video Mode extension */ -#undef XF86VIDMODE - -/* Support XFixes extension */ -#undef XFIXES - -/* Build XDGA support */ -#undef XFreeXDGA - -/* Support Xinerama extension */ -#undef XINERAMA - -/* Vendor release */ -#undef XORG_RELEASE - -/* Current Xorg version */ -#undef XORG_VERSION_CURRENT - -/* Xorg release date */ -#undef XORG_DATE - -/* Build Xv Extension */ -#undef XvExtension - -/* Build XvMC Extension */ -#undef XvMCExtension - -/* Support XSync extension */ -#undef XSYNC - -/* Support XTest extension */ -#undef XTEST - -/* Support Xv extension */ -#undef XV - -/* Support DRI extension */ -#undef XF86DRI - -/* Build DRI2 extension */ -#undef DRI2 - -/* Build DBE support */ -#undef DBE - -/* Vendor name */ -#undef XVENDORNAME - -/* Enable GNU and other extensions to the C environment for GLIBC */ -#undef _GNU_SOURCE - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `int' if does not define. */ -#undef pid_t - -/* Build Rootless code */ -#undef ROOTLESS - -/* Define to 1 if unsigned long is 64 bits. */ -#undef _XSERVER64 - -/* System is BSD-like */ -#undef CSRG_BASED - -/* Define to 1 if `struct sockaddr_in' has a `sin_len' member */ -#undef BSD44SOCKETS - -/* Support D-Bus */ -#undef HAVE_DBUS - -/* Use libudev for input hotplug */ -#undef CONFIG_UDEV - -/* Use D-Bus for input hotplug */ -#undef CONFIG_NEED_DBUS - -/* Support the D-Bus hotplug API */ -#undef CONFIG_DBUS_API - -/* Support HAL for hotplug */ -#undef CONFIG_HAL - -/* Have a monotonic clock from clock_gettime() */ -#undef MONOTONIC_CLOCK - -/* Define to 1 if the DTrace Xserver provider probes should be built in */ -#undef XSERVER_DTRACE - -/* Define to 16-bit byteswap macro */ -#undef bswap_16 - -/* Define to 32-bit byteswap macro */ -#undef bswap_32 - -/* Define to 64-bit byteswap macro */ -#undef bswap_64 - -/* Need the strcasecmp function. */ -#undef NEED_STRCASECMP - -/* Need the strncasecmp function. */ -#undef NEED_STRNCASECMP - -/* Need the strcasestr function. */ -#undef NEED_STRCASESTR - -/* Define to 1 if you have the `ffs' function. */ -#undef HAVE_FFS - -/* The compiler supported TLS storage class, prefering initial-exec if tls_model is supported */ -#undef TLS - -/* Correctly set _XSERVER64 for OSX fat binaries */ -#ifdef __APPLE__ -#include "dix-config-apple-verbatim.h" -#endif - -#endif /* _DIX_CONFIG_H_ */ +/* dix-config.h.in: not at all generated. -*- c -*- */ + +#ifndef _DIX_CONFIG_H_ +#define _DIX_CONFIG_H_ + +/* Support BigRequests extension */ +#undef BIGREQS + +/* Builder address */ +#undef BUILDERADDR + +/* Operating System Name */ +#undef OSNAME + +/* Operating System Vendor */ +#undef OSVENDOR + +/* Builder string */ +#undef BUILDERSTRING + +/* Default font path */ +#undef COMPILEDDEFAULTFONTPATH + +/* Miscellaneous server configuration files path */ +#undef SERVER_MISC_CONFIG_PATH + +/* Support Composite Extension */ +#undef COMPOSITE + +/* Support Damage extension */ +#undef DAMAGE + +/* Use OsVendorVErrorF */ +#undef DDXOSVERRORF + +/* Use ddxBeforeReset */ +#undef DDXBEFORERESET + +/* Build DPMS extension */ +#undef DPMSExtension + +/* Build GLX extension */ +#undef GLXEXT + +/* Build GLX DRI loader */ +#undef GLX_DRI + +/* Path to DRI drivers */ +#undef DRI_DRIVER_PATH + +/* Support XDM-AUTH*-1 */ +#undef HASXDMAUTH + +/* Define to 1 if you have the `getdtablesize' function. */ +#undef HAS_GETDTABLESIZE + +/* Define to 1 if you have the `getifaddrs' function. */ +#undef HAS_GETIFADDRS + +/* Define to 1 if you have the `getpeereid' function. */ +#undef HAS_GETPEEREID + +/* Define to 1 if you have the `getpeerucred' function. */ +#undef HAS_GETPEERUCRED + +/* Define to 1 if you have the `mmap' function. */ +#undef HAS_MMAP + +/* Support SHM */ +#undef HAS_SHM + +/* Have the 'strlcpy' function */ +#undef HAS_STRLCPY + +/* Define to 1 if you have the header file. */ +#undef HAVE_ASM_MTRR_H + +/* Has backtrace support */ +#undef HAVE_BACKTRACE + +/* Define to 1 if you have the header file. */ +#undef HAVE_BYTESWAP_H + +/* Define to 1 if you have cbrt */ +#undef HAVE_CBRT + +/* Define to 1 if you have the header file. */ +#undef HAVE_DBM_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_DIRENT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +#undef HAVE_DOPRNT + +/* Have execinfo.h */ +#undef HAVE_EXECINFO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `geteuid' function. */ +#undef HAVE_GETEUID + +/* Define to 1 if you have the `getisax' function. */ +#undef HAVE_GETISAX + +/* Define to 1 if you have the `getuid' function. */ +#undef HAVE_GETUID + +/* Define to 1 if you have the `getzoneid' function. */ +#undef HAVE_GETZONEID + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Have Quartz */ +#undef XQUARTZ + +/* Support application updating through sparkle. */ +#undef XQUARTZ_SPARKLE + +/* Prefix to use for bundle identifiers */ +#undef BUNDLE_ID_PREFIX + +/* Build a standalone xpbproxy */ +#undef STANDALONE_XPBPROXY + +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM + +/* Define to 1 if you have the libdispatch (GCD) available */ +#undef HAVE_LIBDISPATCH + +/* Define to 1 if you have the `link' function. */ +#undef HAVE_LINK + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_AGPGART_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_APM_BIOS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_FB_H + +/* Define to 1 if you have the `mkstemp' function. */ +#undef HAVE_MKSTEMP + +/* Define to 1 if you have the header file. */ +#undef HAVE_NDBM_H + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +#undef HAVE_NDIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_RPCSVC_DBM_H + +/* Define to use libc SHA1 functions */ +#undef HAVE_SHA1_IN_LIBC + +/* Define to use CommonCrypto SHA1 functions */ +#undef HAVE_SHA1_IN_COMMONCRYPTO + +/* Define to use libmd SHA1 functions */ +#undef HAVE_SHA1_IN_LIBMD + +/* Define to use libgcrypt SHA1 functions */ +#undef HAVE_SHA1_IN_LIBGCRYPT + +/* Define to use libsha1 for SHA1 */ +#undef HAVE_SHA1_IN_LIBSHA1 + +/* Define to 1 if you have the `shmctl64' function. */ +#undef HAVE_SHMCTL64 + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strrchr' function. */ +#undef HAVE_STRRCHR + +/* Define to 1 if you have the `strtol' function. */ +#undef HAVE_STRTOL + +/* Define to 1 if SYSV IPC is available */ +#undef HAVE_SYSV_IPC + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_AGPIO_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_DIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IO_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_NDIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UTSNAME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_VM86_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TSLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FNMATCH_H + +/* Have /dev/urandom */ +#undef HAVE_URANDOM + +/* Define to 1 if you have the `vprintf' function. */ +#undef HAVE_VPRINTF + +/* Define to 1 if you have the `vasprintf' function. */ +#undef HAVE_VASPRINTF + +/* Support IPv6 for TCP connections */ +#undef IPv6 + +/* Support os-specific local connections */ +#undef LOCALCONN + +/* Support MIT-SHM Extension */ +#undef MITSHM + +/* Enable some debugging code */ +#undef DEBUG + +/* Name of package */ +#undef PACKAGE + +/* Internal define for Xinerama */ +#undef PANORAMIX + +/* Overall prefix */ +#undef PROJECTROOT + +/* Support RANDR extension */ +#undef RANDR + +/* Support Record extension */ +#undef XRECORD + +/* Support RENDER extension */ +#undef RENDER + +/* Support X resource extension */ +#undef RES + +/* Support client ID tracking in X resource extension */ +#undef CLIENTIDS + +/* Support MIT-SCREEN-SAVER extension */ +#undef SCREENSAVER + +/* Support Secure RPC ("SUN-DES-1") authentication for X11 clients */ +#undef SECURE_RPC + +/* Support SHAPE extension */ +#undef SHAPE + +/* Define to 1 on systems derived from System V Release 4 */ +#undef SVR4 + +/* Support TCP socket connections */ +#undef TCPCONN + +/* Enable touchscreen support */ +#undef TOUCHSCREEN + +/* Support tslib touchscreen abstraction library */ +#undef TSLIB + +/* Support UNIX socket connections */ +#undef UNIXCONN + +/* Define to use byteswap macros from */ +#undef USE_SYS_ENDIAN_H + +/* unaligned word accesses behave as expected */ +#undef WORKING_UNALIGNED_INT + +/* Build X string registry */ +#undef XREGISTRY + +/* Build X-ACE extension */ +#undef XACE + +/* Build SELinux extension */ +#undef XSELINUX + +/* Support XCMisc extension */ +#undef XCMISC + +/* Build Security extension */ +#undef XCSECURITY + +/* Support Xdmcp */ +#undef XDMCP + +/* Build XFree86 BigFont extension */ +#undef XF86BIGFONT + +/* Support XFree86 Video Mode extension */ +#undef XF86VIDMODE + +/* Support XFixes extension */ +#undef XFIXES + +/* Build XDGA support */ +#undef XFreeXDGA + +/* Support Xinerama extension */ +#undef XINERAMA + +/* Vendor release */ +#undef XORG_RELEASE + +/* Current Xorg version */ +#undef XORG_VERSION_CURRENT + +/* Xorg release date */ +#undef XORG_DATE + +/* Build Xv Extension */ +#undef XvExtension + +/* Build XvMC Extension */ +#undef XvMCExtension + +/* Support XSync extension */ +#undef XSYNC + +/* Support XTest extension */ +#undef XTEST + +/* Support Xv extension */ +#undef XV + +/* Support DRI extension */ +#undef XF86DRI + +/* Build DRI2 extension */ +#undef DRI2 + +/* Build DBE support */ +#undef DBE + +/* Vendor name */ +#undef XVENDORNAME + +/* Enable GNU and other extensions to the C environment for GLIBC */ +#undef _GNU_SOURCE + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `int' if does not define. */ +#undef pid_t + +/* Build Rootless code */ +#undef ROOTLESS + +/* Define to 1 if unsigned long is 64 bits. */ +#undef _XSERVER64 + +/* System is BSD-like */ +#undef CSRG_BASED + +/* Define to 1 if `struct sockaddr_in' has a `sin_len' member */ +#undef BSD44SOCKETS + +/* Support D-Bus */ +#undef HAVE_DBUS + +/* Use libudev for input hotplug */ +#undef CONFIG_UDEV + +/* Use D-Bus for input hotplug */ +#undef CONFIG_NEED_DBUS + +/* Support the D-Bus hotplug API */ +#undef CONFIG_DBUS_API + +/* Support HAL for hotplug */ +#undef CONFIG_HAL + +/* Have a monotonic clock from clock_gettime() */ +#undef MONOTONIC_CLOCK + +/* Define to 1 if the DTrace Xserver provider probes should be built in */ +#undef XSERVER_DTRACE + +/* Define to 16-bit byteswap macro */ +#undef bswap_16 + +/* Define to 32-bit byteswap macro */ +#undef bswap_32 + +/* Define to 64-bit byteswap macro */ +#undef bswap_64 + +/* Need the strcasecmp function. */ +#undef NEED_STRCASECMP + +/* Need the strncasecmp function. */ +#undef NEED_STRNCASECMP + +/* Need the strcasestr function. */ +#undef NEED_STRCASESTR + +/* Define to 1 if you have the `ffs' function. */ +#undef HAVE_FFS + +/* The compiler supported TLS storage class, prefering initial-exec if tls_model is supported */ +#undef TLS + +/* Correctly set _XSERVER64 for OSX fat binaries */ +#ifdef __APPLE__ +#include "dix-config-apple-verbatim.h" +#endif + +#endif /* _DIX_CONFIG_H_ */ diff --git a/xorg-server/include/dix.h b/xorg-server/include/dix.h index ddff00ebc..b1bf9ed82 100644 --- a/xorg-server/include/dix.h +++ b/xorg-server/include/dix.h @@ -1,584 +1,584 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef DIX_H -#define DIX_H - -#include "callback.h" -#include "gc.h" -#include "window.h" -#include "input.h" -#include "cursor.h" -#include "geext.h" -#include "events.h" -#include - -#define EARLIER -1 -#define SAMETIME 0 -#define LATER 1 - -#define NullClient ((ClientPtr) 0) -#define REQUEST(type) \ - type *stuff = (type *)client->requestBuffer - - -#define REQUEST_SIZE_MATCH(req)\ - if ((sizeof(req) >> 2) != client->req_len)\ - return(BadLength) - -#define REQUEST_AT_LEAST_SIZE(req) \ - if ((sizeof(req) >> 2) > client->req_len )\ - return(BadLength) - -#define REQUEST_FIXED_SIZE(req, n)\ - if (((sizeof(req) >> 2) > client->req_len) || \ - (((sizeof(req) + (n) + 3) >> 2) != client->req_len)) \ - return(BadLength) - -#define LEGAL_NEW_RESOURCE(id,client)\ - if (!LegalNewID(id,client)) \ - {\ - client->errorValue = id;\ - return BadIDChoice;\ - } - -#define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, mode)\ - {\ - int rc = dixLookupDrawable(&(pDraw), drawID, client, M_ANY, mode);\ - if (rc != Success)\ - return rc;\ - rc = dixLookupGC(&(pGC), stuff->gc, client, DixUseAccess);\ - if (rc != Success)\ - return rc;\ - if ((pGC->depth != pDraw->depth) || (pGC->pScreen != pDraw->pScreen))\ - return BadMatch;\ - }\ - if (pGC->serialNumber != pDraw->serialNumber)\ - ValidateGC(pDraw, pGC); - - -#define WriteReplyToClient(pClient, size, pReply) { \ - if ((pClient)->swapped) \ - (*ReplySwapVector[((xReq *)(pClient)->requestBuffer)->reqType]) \ - (pClient, (int)(size), pReply); \ - else (void) WriteToClient(pClient, (int)(size), (char *)(pReply)); } - -#define WriteSwappedDataToClient(pClient, size, pbuf) \ - if ((pClient)->swapped) \ - (*(pClient)->pSwapReplyFunc)(pClient, (int)(size), pbuf); \ - else (void) WriteToClient (pClient, (int)(size), (char *)(pbuf)); - -typedef struct _TimeStamp *TimeStampPtr; - -#ifndef _XTYPEDEF_CLIENTPTR -typedef struct _Client *ClientPtr; /* also in misc.h */ -#define _XTYPEDEF_CLIENTPTR -#endif - -typedef struct _WorkQueue *WorkQueuePtr; - -extern _X_EXPORT ClientPtr clients[MAXCLIENTS]; -extern _X_EXPORT ClientPtr serverClient; -extern _X_EXPORT int currentMaxClients; -extern _X_EXPORT char dispatchExceptionAtReset; - -typedef int HWEventQueueType; -typedef HWEventQueueType* HWEventQueuePtr; - -extern _X_EXPORT HWEventQueuePtr checkForInput[2]; - -typedef struct _TimeStamp { - CARD32 months; /* really ~49.7 days */ - CARD32 milliseconds; -} TimeStamp; - -/* dispatch.c */ - -extern _X_EXPORT void SetInputCheck( - HWEventQueuePtr /*c0*/, - HWEventQueuePtr /*c1*/); - -extern _X_EXPORT void CloseDownClient( - ClientPtr /*client*/); - -extern _X_EXPORT void UpdateCurrentTime(void); - -extern _X_EXPORT void UpdateCurrentTimeIf(void); - -extern _X_EXPORT int dixDestroyPixmap( - pointer /*value*/, - XID /*pid*/); - -extern _X_EXPORT void InitClient( - ClientPtr /*client*/, - int /*i*/, - pointer /*ospriv*/); - -extern _X_EXPORT ClientPtr NextAvailableClient( - pointer /*ospriv*/); - -extern _X_EXPORT void SendErrorToClient( - ClientPtr /*client*/, - unsigned int /*majorCode*/, - unsigned int /*minorCode*/, - XID /*resId*/, - int /*errorCode*/); - -extern _X_EXPORT void MarkClientException( - ClientPtr /*client*/); - -extern _X_HIDDEN Bool CreateConnectionBlock(void); -/* dixutils.c */ - -extern _X_EXPORT int CompareISOLatin1Lowered( - unsigned char * /*a*/, - int alen, - unsigned char * /*b*/, - int blen); - -extern _X_EXPORT int dixLookupWindow( - WindowPtr *result, - XID id, - ClientPtr client, - Mask access_mode); - -extern _X_EXPORT int dixLookupDrawable( - DrawablePtr *result, - XID id, - ClientPtr client, - Mask type_mask, - Mask access_mode); - -extern _X_EXPORT int dixLookupGC( - GCPtr *result, - XID id, - ClientPtr client, - Mask access_mode); - -extern _X_EXPORT int dixLookupFontable( - FontPtr *result, - XID id, - ClientPtr client, - Mask access_mode); - -extern _X_EXPORT int dixLookupClient( - ClientPtr *result, - XID id, - ClientPtr client, - Mask access_mode); - -extern _X_EXPORT void NoopDDA(void); - -extern _X_EXPORT int AlterSaveSetForClient( - ClientPtr /*client*/, - WindowPtr /*pWin*/, - unsigned /*mode*/, - Bool /*toRoot*/, - Bool /*map*/); - -extern _X_EXPORT void DeleteWindowFromAnySaveSet( - WindowPtr /*pWin*/); - -extern _X_EXPORT void BlockHandler( - pointer /*pTimeout*/, - pointer /*pReadmask*/); - -extern _X_EXPORT void WakeupHandler( - int /*result*/, - pointer /*pReadmask*/); - -void -EnableLimitedSchedulingLatency(void); - -void -DisableLimitedSchedulingLatency(void); - -typedef void (* WakeupHandlerProcPtr)( - pointer /* blockData */, - int /* result */, - pointer /* pReadmask */); - -extern _X_EXPORT Bool RegisterBlockAndWakeupHandlers( - BlockHandlerProcPtr /*blockHandler*/, - WakeupHandlerProcPtr /*wakeupHandler*/, - pointer /*blockData*/); - -extern _X_EXPORT void RemoveBlockAndWakeupHandlers( - BlockHandlerProcPtr /*blockHandler*/, - WakeupHandlerProcPtr /*wakeupHandler*/, - pointer /*blockData*/); - -extern _X_EXPORT void InitBlockAndWakeupHandlers(void); - -extern _X_EXPORT void ProcessWorkQueue(void); - -extern _X_EXPORT void ProcessWorkQueueZombies(void); - -extern _X_EXPORT Bool QueueWorkProc( - Bool (* /*function*/)( - ClientPtr /*clientUnused*/, - pointer /*closure*/), - ClientPtr /*client*/, - pointer /*closure*/ -); - -typedef Bool (* ClientSleepProcPtr)( - ClientPtr /*client*/, - pointer /*closure*/); - -extern _X_EXPORT Bool ClientSleep( - ClientPtr /*client*/, - ClientSleepProcPtr /* function */, - pointer /*closure*/); - -#ifndef ___CLIENTSIGNAL_DEFINED___ -#define ___CLIENTSIGNAL_DEFINED___ -extern _X_EXPORT Bool ClientSignal( - ClientPtr /*client*/); -#endif /* ___CLIENTSIGNAL_DEFINED___ */ - -extern _X_EXPORT void ClientWakeup( - ClientPtr /*client*/); - -extern _X_EXPORT Bool ClientIsAsleep( - ClientPtr /*client*/); - -/* atom.c */ - -extern _X_EXPORT Atom MakeAtom( - const char * /*string*/, - unsigned /*len*/, - Bool /*makeit*/); - -extern _X_EXPORT Bool ValidAtom( - Atom /*atom*/); - -extern _X_EXPORT const char *NameForAtom( - Atom /*atom*/); - -extern _X_EXPORT void AtomError(void) _X_NORETURN; - -extern _X_EXPORT void FreeAllAtoms(void); - -extern _X_EXPORT void InitAtoms(void); - -/* main.c */ - -extern _X_EXPORT void SetVendorRelease(int release); - -extern _X_EXPORT void SetVendorString(char *string); - -/* events.c */ - -extern void SetMaskForEvent( - int /* deviceid */, - Mask /* mask */, - int /* event */); - -extern _X_EXPORT void ConfineToShape( - DeviceIntPtr /* pDev */, - RegionPtr /* shape */, - int* /* px */, - int* /* py */); - -extern _X_EXPORT Bool IsParent( - WindowPtr /* maybeparent */, - WindowPtr /* child */); - -extern _X_EXPORT WindowPtr GetCurrentRootWindow(DeviceIntPtr pDev); - -extern _X_EXPORT WindowPtr GetSpriteWindow(DeviceIntPtr pDev); - - -extern _X_EXPORT void NoticeEventTime(InternalEvent *ev); - -extern void EnqueueEvent( - InternalEvent * /* ev */, - DeviceIntPtr /* device */); - -extern void ActivatePointerGrab( - DeviceIntPtr /* mouse */, - GrabPtr /* grab */, - TimeStamp /* time */, - Bool /* autoGrab */); - -extern void DeactivatePointerGrab( - DeviceIntPtr /* mouse */); - -extern void ActivateKeyboardGrab( - DeviceIntPtr /* keybd */, - GrabPtr /* grab */, - TimeStamp /* time */, - Bool /* passive */); - -extern void DeactivateKeyboardGrab( - DeviceIntPtr /* keybd */); - -extern BOOL ActivateFocusInGrab( - DeviceIntPtr /* dev */, - WindowPtr /* old */, - WindowPtr /* win */); - -extern void AllowSome( - ClientPtr /* client */, - TimeStamp /* time */, - DeviceIntPtr /* thisDev */, - int /* newState */); - -extern void ReleaseActiveGrabs( - ClientPtr client); - -extern GrabPtr CheckPassiveGrabsOnWindow( - WindowPtr /* pWin */, - DeviceIntPtr /* device */, - InternalEvent * /* event */, - BOOL /* checkCore */, - BOOL /* activate */); - -extern _X_EXPORT int DeliverEventsToWindow( - DeviceIntPtr /* pWin */, - WindowPtr /* pWin */, - xEventPtr /* pEvents */, - int /* count */, - Mask /* filter */, - GrabPtr /* grab */); - -extern _X_EXPORT void DeliverRawEvent( - RawDeviceEvent* /* ev */, - DeviceIntPtr /* dev */ -); - -extern int DeliverDeviceEvents( - WindowPtr /* pWin */, - InternalEvent* /* event */, - GrabPtr /* grab */, - WindowPtr /* stopAt */, - DeviceIntPtr /* dev */); - -extern void InitializeSprite( - DeviceIntPtr /* pDev */, - WindowPtr /* pWin */); - -extern void UpdateSpriteForScreen( - DeviceIntPtr /* pDev */, - ScreenPtr /* pScreen */); - -extern _X_EXPORT void WindowHasNewCursor( - WindowPtr /* pWin */); - -extern Bool CheckDeviceGrabs( - DeviceIntPtr /* device */, - DeviceEvent* /* event */, - WindowPtr /* ancestor */); - -extern void DeliverFocusedEvent( - DeviceIntPtr /* keybd */, - InternalEvent* /* event */, - WindowPtr /* window */); - -extern int DeliverGrabbedEvent( - InternalEvent* /* event */, - DeviceIntPtr /* thisDev */, - Bool /* deactivateGrab */); - -extern void FixKeyState( - DeviceEvent* /* event */, - DeviceIntPtr /* keybd */); - -extern void RecalculateDeliverableEvents( - WindowPtr /* pWin */); - -extern _X_EXPORT int OtherClientGone( - pointer /* value */, - XID /* id */); - -extern void DoFocusEvents( - DeviceIntPtr /* dev */, - WindowPtr /* fromWin */, - WindowPtr /* toWin */, - int /* mode */); - -extern int SetInputFocus( - ClientPtr /* client */, - DeviceIntPtr /* dev */, - Window /* focusID */, - CARD8 /* revertTo */, - Time /* ctime */, - Bool /* followOK */); - -extern int GrabDevice( - ClientPtr /* client */, - DeviceIntPtr /* dev */, - unsigned /* this_mode */, - unsigned /* other_mode */, - Window /* grabWindow */, - unsigned /* ownerEvents */, - Time /* ctime */, - GrabMask* /* mask */, - int /* grabtype */, - Cursor /* curs */, - Window /* confineToWin */, - CARD8 * /* status */); - -extern void InitEvents(void); - -extern void CloseDownEvents(void); - -extern void DeleteWindowFromAnyEvents( - WindowPtr /* pWin */, - Bool /* freeResources */); - - -extern Mask EventMaskForClient( - WindowPtr /* pWin */, - ClientPtr /* client */); - - - -extern _X_EXPORT int DeliverEvents( - WindowPtr /*pWin*/, - xEventPtr /*xE*/, - int /*count*/, - WindowPtr /*otherParent*/); - -extern Bool CheckMotion( - DeviceEvent* /* ev */, - DeviceIntPtr /* pDev */); - -extern _X_EXPORT void WriteEventsToClient( - ClientPtr /*pClient*/, - int /*count*/, - xEventPtr /*events*/); - -extern _X_EXPORT int TryClientEvents( - ClientPtr /*client*/, - DeviceIntPtr /* device */, - xEventPtr /*pEvents*/, - int /*count*/, - Mask /*mask*/, - Mask /*filter*/, - GrabPtr /*grab*/); - -extern _X_EXPORT void WindowsRestructured(void); - -extern int SetClientPointer( - ClientPtr /* client */, - DeviceIntPtr /* device */); - -extern _X_EXPORT DeviceIntPtr PickPointer( - ClientPtr /* client */); - -extern _X_EXPORT DeviceIntPtr PickKeyboard( - ClientPtr /* client */); - -extern Bool IsInterferingGrab( - ClientPtr /* client */, - DeviceIntPtr /* dev */, - xEvent* /* events */); - -#ifdef PANORAMIX -extern _X_EXPORT void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff); -#endif - -#ifdef RANDR -extern _X_EXPORT void -ScreenRestructured (ScreenPtr pScreen); -#endif - -extern _X_EXPORT int ffs(int i); - - -/* - * ServerGrabCallback stuff - */ - -extern _X_EXPORT CallbackListPtr ServerGrabCallback; - -typedef enum {SERVER_GRABBED, SERVER_UNGRABBED, - CLIENT_PERVIOUS, CLIENT_IMPERVIOUS } ServerGrabState; - -typedef struct { - ClientPtr client; - ServerGrabState grabstate; -} ServerGrabInfoRec; - -/* - * EventCallback stuff - */ - -extern _X_EXPORT CallbackListPtr EventCallback; - -typedef struct { - ClientPtr client; - xEventPtr events; - int count; -} EventInfoRec; - -/* - * DeviceEventCallback stuff - */ - -extern _X_EXPORT CallbackListPtr DeviceEventCallback; - -typedef struct { - InternalEvent *event; - DeviceIntPtr device; -} DeviceEventInfoRec; - -extern int XItoCoreType(int xi_type); -extern Bool DevHasCursor(DeviceIntPtr pDev); -extern Bool _X_EXPORT IsPointerDevice( DeviceIntPtr dev); -extern Bool _X_EXPORT IsKeyboardDevice(DeviceIntPtr dev); -extern Bool IsPointerEvent(InternalEvent *event); -extern _X_EXPORT Bool IsMaster(DeviceIntPtr dev); -extern _X_EXPORT Bool IsFloating(DeviceIntPtr dev); - -extern _X_HIDDEN void CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master); -extern _X_HIDDEN int CorePointerProc(DeviceIntPtr dev, int what); -extern _X_HIDDEN int CoreKeyboardProc(DeviceIntPtr dev, int what); - -#endif /* DIX_H */ +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +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 +OPEN GROUP 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 Open Group 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 Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef DIX_H +#define DIX_H + +#include "callback.h" +#include "gc.h" +#include "window.h" +#include "input.h" +#include "cursor.h" +#include "geext.h" +#include "events.h" +#include + +#define EARLIER -1 +#define SAMETIME 0 +#define LATER 1 + +#define NullClient ((ClientPtr) 0) +#define REQUEST(type) \ + type *stuff = (type *)client->requestBuffer + + +#define REQUEST_SIZE_MATCH(req)\ + if ((sizeof(req) >> 2) != client->req_len)\ + return(BadLength) + +#define REQUEST_AT_LEAST_SIZE(req) \ + if ((sizeof(req) >> 2) > client->req_len )\ + return(BadLength) + +#define REQUEST_FIXED_SIZE(req, n)\ + if (((sizeof(req) >> 2) > client->req_len) || \ + (((sizeof(req) + (n) + 3) >> 2) != client->req_len)) \ + return(BadLength) + +#define LEGAL_NEW_RESOURCE(id,client)\ + if (!LegalNewID(id,client)) \ + {\ + client->errorValue = id;\ + return BadIDChoice;\ + } + +#define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, mode)\ + {\ + int rc = dixLookupDrawable(&(pDraw), drawID, client, M_ANY, mode);\ + if (rc != Success)\ + return rc;\ + rc = dixLookupGC(&(pGC), stuff->gc, client, DixUseAccess);\ + if (rc != Success)\ + return rc;\ + if ((pGC->depth != pDraw->depth) || (pGC->pScreen != pDraw->pScreen))\ + return BadMatch;\ + }\ + if (pGC->serialNumber != pDraw->serialNumber)\ + ValidateGC(pDraw, pGC); + + +#define WriteReplyToClient(pClient, size, pReply) { \ + if ((pClient)->swapped) \ + (*ReplySwapVector[((xReq *)(pClient)->requestBuffer)->reqType]) \ + (pClient, (int)(size), pReply); \ + else (void) WriteToClient(pClient, (int)(size), (char *)(pReply)); } + +#define WriteSwappedDataToClient(pClient, size, pbuf) \ + if ((pClient)->swapped) \ + (*(pClient)->pSwapReplyFunc)(pClient, (int)(size), pbuf); \ + else (void) WriteToClient (pClient, (int)(size), (char *)(pbuf)); + +typedef struct _TimeStamp *TimeStampPtr; + +#ifndef _XTYPEDEF_CLIENTPTR +typedef struct _Client *ClientPtr; /* also in misc.h */ +#define _XTYPEDEF_CLIENTPTR +#endif + +typedef struct _WorkQueue *WorkQueuePtr; + +extern _X_EXPORT ClientPtr clients[MAXCLIENTS]; +extern _X_EXPORT ClientPtr serverClient; +extern _X_EXPORT int currentMaxClients; +extern _X_EXPORT char dispatchExceptionAtReset; + +typedef int HWEventQueueType; +typedef HWEventQueueType* HWEventQueuePtr; + +extern _X_EXPORT HWEventQueuePtr checkForInput[2]; + +typedef struct _TimeStamp { + CARD32 months; /* really ~49.7 days */ + CARD32 milliseconds; +} TimeStamp; + +/* dispatch.c */ + +extern _X_EXPORT void SetInputCheck( + HWEventQueuePtr /*c0*/, + HWEventQueuePtr /*c1*/); + +extern _X_EXPORT void CloseDownClient( + ClientPtr /*client*/); + +extern _X_EXPORT void UpdateCurrentTime(void); + +extern _X_EXPORT void UpdateCurrentTimeIf(void); + +extern _X_EXPORT int dixDestroyPixmap( + pointer /*value*/, + XID /*pid*/); + +extern _X_EXPORT void InitClient( + ClientPtr /*client*/, + int /*i*/, + pointer /*ospriv*/); + +extern _X_EXPORT ClientPtr NextAvailableClient( + pointer /*ospriv*/); + +extern _X_EXPORT void SendErrorToClient( + ClientPtr /*client*/, + unsigned int /*majorCode*/, + unsigned int /*minorCode*/, + XID /*resId*/, + int /*errorCode*/); + +extern _X_EXPORT void MarkClientException( + ClientPtr /*client*/); + +extern _X_HIDDEN Bool CreateConnectionBlock(void); +/* dixutils.c */ + +extern _X_EXPORT int CompareISOLatin1Lowered( + unsigned char * /*a*/, + int alen, + unsigned char * /*b*/, + int blen); + +extern _X_EXPORT int dixLookupWindow( + WindowPtr *result, + XID id, + ClientPtr client, + Mask access_mode); + +extern _X_EXPORT int dixLookupDrawable( + DrawablePtr *result, + XID id, + ClientPtr client, + Mask type_mask, + Mask access_mode); + +extern _X_EXPORT int dixLookupGC( + GCPtr *result, + XID id, + ClientPtr client, + Mask access_mode); + +extern _X_EXPORT int dixLookupFontable( + FontPtr *result, + XID id, + ClientPtr client, + Mask access_mode); + +extern _X_EXPORT int dixLookupClient( + ClientPtr *result, + XID id, + ClientPtr client, + Mask access_mode); + +extern _X_EXPORT void NoopDDA(void); + +extern _X_EXPORT int AlterSaveSetForClient( + ClientPtr /*client*/, + WindowPtr /*pWin*/, + unsigned /*mode*/, + Bool /*toRoot*/, + Bool /*map*/); + +extern _X_EXPORT void DeleteWindowFromAnySaveSet( + WindowPtr /*pWin*/); + +extern _X_EXPORT void BlockHandler( + pointer /*pTimeout*/, + pointer /*pReadmask*/); + +extern _X_EXPORT void WakeupHandler( + int /*result*/, + pointer /*pReadmask*/); + +void +EnableLimitedSchedulingLatency(void); + +void +DisableLimitedSchedulingLatency(void); + +typedef void (* WakeupHandlerProcPtr)( + pointer /* blockData */, + int /* result */, + pointer /* pReadmask */); + +extern _X_EXPORT Bool RegisterBlockAndWakeupHandlers( + BlockHandlerProcPtr /*blockHandler*/, + WakeupHandlerProcPtr /*wakeupHandler*/, + pointer /*blockData*/); + +extern _X_EXPORT void RemoveBlockAndWakeupHandlers( + BlockHandlerProcPtr /*blockHandler*/, + WakeupHandlerProcPtr /*wakeupHandler*/, + pointer /*blockData*/); + +extern _X_EXPORT void InitBlockAndWakeupHandlers(void); + +extern _X_EXPORT void ProcessWorkQueue(void); + +extern _X_EXPORT void ProcessWorkQueueZombies(void); + +extern _X_EXPORT Bool QueueWorkProc( + Bool (* /*function*/)( + ClientPtr /*clientUnused*/, + pointer /*closure*/), + ClientPtr /*client*/, + pointer /*closure*/ +); + +typedef Bool (* ClientSleepProcPtr)( + ClientPtr /*client*/, + pointer /*closure*/); + +extern _X_EXPORT Bool ClientSleep( + ClientPtr /*client*/, + ClientSleepProcPtr /* function */, + pointer /*closure*/); + +#ifndef ___CLIENTSIGNAL_DEFINED___ +#define ___CLIENTSIGNAL_DEFINED___ +extern _X_EXPORT Bool ClientSignal( + ClientPtr /*client*/); +#endif /* ___CLIENTSIGNAL_DEFINED___ */ + +extern _X_EXPORT void ClientWakeup( + ClientPtr /*client*/); + +extern _X_EXPORT Bool ClientIsAsleep( + ClientPtr /*client*/); + +/* atom.c */ + +extern _X_EXPORT Atom MakeAtom( + const char * /*string*/, + unsigned /*len*/, + Bool /*makeit*/); + +extern _X_EXPORT Bool ValidAtom( + Atom /*atom*/); + +extern _X_EXPORT const char *NameForAtom( + Atom /*atom*/); + +extern _X_EXPORT void AtomError(void) _X_NORETURN; + +extern _X_EXPORT void FreeAllAtoms(void); + +extern _X_EXPORT void InitAtoms(void); + +/* main.c */ + +extern _X_EXPORT void SetVendorRelease(int release); + +extern _X_EXPORT void SetVendorString(char *string); + +/* events.c */ + +extern void SetMaskForEvent( + int /* deviceid */, + Mask /* mask */, + int /* event */); + +extern _X_EXPORT void ConfineToShape( + DeviceIntPtr /* pDev */, + RegionPtr /* shape */, + int* /* px */, + int* /* py */); + +extern _X_EXPORT Bool IsParent( + WindowPtr /* maybeparent */, + WindowPtr /* child */); + +extern _X_EXPORT WindowPtr GetCurrentRootWindow(DeviceIntPtr pDev); + +extern _X_EXPORT WindowPtr GetSpriteWindow(DeviceIntPtr pDev); + + +extern _X_EXPORT void NoticeEventTime(InternalEvent *ev); + +extern void EnqueueEvent( + InternalEvent * /* ev */, + DeviceIntPtr /* device */); + +extern void ActivatePointerGrab( + DeviceIntPtr /* mouse */, + GrabPtr /* grab */, + TimeStamp /* time */, + Bool /* autoGrab */); + +extern void DeactivatePointerGrab( + DeviceIntPtr /* mouse */); + +extern void ActivateKeyboardGrab( + DeviceIntPtr /* keybd */, + GrabPtr /* grab */, + TimeStamp /* time */, + Bool /* passive */); + +extern void DeactivateKeyboardGrab( + DeviceIntPtr /* keybd */); + +extern BOOL ActivateFocusInGrab( + DeviceIntPtr /* dev */, + WindowPtr /* old */, + WindowPtr /* win */); + +extern void AllowSome( + ClientPtr /* client */, + TimeStamp /* time */, + DeviceIntPtr /* thisDev */, + int /* newState */); + +extern void ReleaseActiveGrabs( + ClientPtr client); + +extern GrabPtr CheckPassiveGrabsOnWindow( + WindowPtr /* pWin */, + DeviceIntPtr /* device */, + InternalEvent * /* event */, + BOOL /* checkCore */, + BOOL /* activate */); + +extern _X_EXPORT int DeliverEventsToWindow( + DeviceIntPtr /* pWin */, + WindowPtr /* pWin */, + xEventPtr /* pEvents */, + int /* count */, + Mask /* filter */, + GrabPtr /* grab */); + +extern _X_EXPORT void DeliverRawEvent( + RawDeviceEvent* /* ev */, + DeviceIntPtr /* dev */ +); + +extern int DeliverDeviceEvents( + WindowPtr /* pWin */, + InternalEvent* /* event */, + GrabPtr /* grab */, + WindowPtr /* stopAt */, + DeviceIntPtr /* dev */); + +extern void InitializeSprite( + DeviceIntPtr /* pDev */, + WindowPtr /* pWin */); + +extern void UpdateSpriteForScreen( + DeviceIntPtr /* pDev */, + ScreenPtr /* pScreen */); + +extern _X_EXPORT void WindowHasNewCursor( + WindowPtr /* pWin */); + +extern Bool CheckDeviceGrabs( + DeviceIntPtr /* device */, + DeviceEvent* /* event */, + WindowPtr /* ancestor */); + +extern void DeliverFocusedEvent( + DeviceIntPtr /* keybd */, + InternalEvent* /* event */, + WindowPtr /* window */); + +extern int DeliverGrabbedEvent( + InternalEvent* /* event */, + DeviceIntPtr /* thisDev */, + Bool /* deactivateGrab */); + +extern void FixKeyState( + DeviceEvent* /* event */, + DeviceIntPtr /* keybd */); + +extern void RecalculateDeliverableEvents( + WindowPtr /* pWin */); + +extern _X_EXPORT int OtherClientGone( + pointer /* value */, + XID /* id */); + +extern void DoFocusEvents( + DeviceIntPtr /* dev */, + WindowPtr /* fromWin */, + WindowPtr /* toWin */, + int /* mode */); + +extern int SetInputFocus( + ClientPtr /* client */, + DeviceIntPtr /* dev */, + Window /* focusID */, + CARD8 /* revertTo */, + Time /* ctime */, + Bool /* followOK */); + +extern int GrabDevice( + ClientPtr /* client */, + DeviceIntPtr /* dev */, + unsigned /* this_mode */, + unsigned /* other_mode */, + Window /* grabWindow */, + unsigned /* ownerEvents */, + Time /* ctime */, + GrabMask* /* mask */, + int /* grabtype */, + Cursor /* curs */, + Window /* confineToWin */, + CARD8 * /* status */); + +extern void InitEvents(void); + +extern void CloseDownEvents(void); + +extern void DeleteWindowFromAnyEvents( + WindowPtr /* pWin */, + Bool /* freeResources */); + + +extern Mask EventMaskForClient( + WindowPtr /* pWin */, + ClientPtr /* client */); + + + +extern _X_EXPORT int DeliverEvents( + WindowPtr /*pWin*/, + xEventPtr /*xE*/, + int /*count*/, + WindowPtr /*otherParent*/); + +extern Bool CheckMotion( + DeviceEvent* /* ev */, + DeviceIntPtr /* pDev */); + +extern _X_EXPORT void WriteEventsToClient( + ClientPtr /*pClient*/, + int /*count*/, + xEventPtr /*events*/); + +extern _X_EXPORT int TryClientEvents( + ClientPtr /*client*/, + DeviceIntPtr /* device */, + xEventPtr /*pEvents*/, + int /*count*/, + Mask /*mask*/, + Mask /*filter*/, + GrabPtr /*grab*/); + +extern _X_EXPORT void WindowsRestructured(void); + +extern int SetClientPointer( + ClientPtr /* client */, + DeviceIntPtr /* device */); + +extern _X_EXPORT DeviceIntPtr PickPointer( + ClientPtr /* client */); + +extern _X_EXPORT DeviceIntPtr PickKeyboard( + ClientPtr /* client */); + +extern Bool IsInterferingGrab( + ClientPtr /* client */, + DeviceIntPtr /* dev */, + xEvent* /* events */); + +#ifdef PANORAMIX +extern _X_EXPORT void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff); +#endif + +#ifdef RANDR +extern _X_EXPORT void +ScreenRestructured (ScreenPtr pScreen); +#endif + +extern _X_EXPORT int ffs(int i); + + +/* + * ServerGrabCallback stuff + */ + +extern _X_EXPORT CallbackListPtr ServerGrabCallback; + +typedef enum {SERVER_GRABBED, SERVER_UNGRABBED, + CLIENT_PERVIOUS, CLIENT_IMPERVIOUS } ServerGrabState; + +typedef struct { + ClientPtr client; + ServerGrabState grabstate; +} ServerGrabInfoRec; + +/* + * EventCallback stuff + */ + +extern _X_EXPORT CallbackListPtr EventCallback; + +typedef struct { + ClientPtr client; + xEventPtr events; + int count; +} EventInfoRec; + +/* + * DeviceEventCallback stuff + */ + +extern _X_EXPORT CallbackListPtr DeviceEventCallback; + +typedef struct { + InternalEvent *event; + DeviceIntPtr device; +} DeviceEventInfoRec; + +extern int XItoCoreType(int xi_type); +extern Bool DevHasCursor(DeviceIntPtr pDev); +extern Bool _X_EXPORT IsPointerDevice( DeviceIntPtr dev); +extern Bool _X_EXPORT IsKeyboardDevice(DeviceIntPtr dev); +extern Bool IsPointerEvent(InternalEvent *event); +extern _X_EXPORT Bool IsMaster(DeviceIntPtr dev); +extern _X_EXPORT Bool IsFloating(DeviceIntPtr dev); + +extern _X_HIDDEN void CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master); +extern _X_HIDDEN int CorePointerProc(DeviceIntPtr dev, int what); +extern _X_HIDDEN int CoreKeyboardProc(DeviceIntPtr dev, int what); + +#endif /* DIX_H */ diff --git a/xorg-server/include/dixstruct.h b/xorg-server/include/dixstruct.h index 50430c81a..2349893e9 100644 --- a/xorg-server/include/dixstruct.h +++ b/xorg-server/include/dixstruct.h @@ -1,192 +1,192 @@ -/*********************************************************** -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef DIXSTRUCT_H -#define DIXSTRUCT_H - -#include "client.h" -#include "dix.h" -#include "resource.h" -#include "cursor.h" -#include "gc.h" -#include "pixmap.h" -#include "privates.h" -#include - -/* - * direct-mapped hash table, used by resource manager to store - * translation from client ids to server addresses. - */ - -extern _X_EXPORT CallbackListPtr ClientStateCallback; - -typedef struct { - ClientPtr client; - xConnSetupPrefix *prefix; - xConnSetup *setup; -} NewClientInfoRec; - -typedef void (*ReplySwapPtr) ( - ClientPtr /* pClient */, - int /* size */, - void * /* pbuf */); - -extern _X_EXPORT void ReplyNotSwappd ( - ClientPtr /* pClient */, - int /* size */, - void * /* pbuf */) _X_NORETURN; - -typedef enum {ClientStateInitial, - ClientStateAuthenticating, - ClientStateRunning, - ClientStateRetained, - ClientStateGone, - ClientStateCheckingSecurity, - ClientStateCheckedSecurity} ClientState; - -#ifdef XFIXES -typedef struct _saveSet { - struct _Window *windowPtr; - Bool toRoot; - Bool map; -} SaveSetElt; -#define SaveSetWindow(ss) ((ss).windowPtr) -#define SaveSetToRoot(ss) ((ss).toRoot) -#define SaveSetShouldMap(ss) ((ss).map) -#define SaveSetAssignWindow(ss,w) ((ss).windowPtr = (w)) -#define SaveSetAssignToRoot(ss,tr) ((ss).toRoot = (tr)) -#define SaveSetAssignMap(ss,m) ((ss).map = (m)) -#else -typedef struct _Window *SaveSetElt; -#define SaveSetWindow(ss) (ss) -#define SaveSetToRoot(ss) FALSE -#define SaveSetShouldMap(ss) TRUE -#define SaveSetAssignWindow(ss,w) ((ss) = (w)) -#define SaveSetAssignToRoot(ss,tr) -#define SaveSetAssignMap(ss,m) -#endif - -typedef struct _Client { - int index; - Mask clientAsMask; - pointer requestBuffer; - pointer osPrivate; /* for OS layer, including scheduler */ - Bool swapped; - ReplySwapPtr pSwapReplyFunc; - XID errorValue; - unsigned short sequence; //MH - int closeDownMode; - int clientGone; - int noClientException; /* this client died or needs to be - * killed */ - int ignoreCount; /* count for Attend/IgnoreClient */ - SaveSetElt *saveSet; - int numSaved; - int (**requestVector) ( - ClientPtr /* pClient */); - CARD32 req_len; /* length of current request */ - Bool big_requests; /* supports large requests */ - int priority; - ClientState clientState; - PrivateRec *devPrivates; - unsigned short xkbClientFlags; - unsigned short mapNotifyMask; - unsigned short newKeyboardNotifyMask; - unsigned short vMajor,vMinor; - KeyCode minKC,maxKC; - - unsigned long replyBytesRemaining; - int smart_priority; - long smart_start_tick; - long smart_stop_tick; - long smart_check_tick; - - DeviceIntPtr clientPtr; - ClientIdPtr clientIds; -} ClientRec; - -/* - * Scheduling interface - */ -extern _X_EXPORT long SmartScheduleTime; -extern _X_EXPORT long SmartScheduleInterval; -extern _X_EXPORT long SmartScheduleSlice; -extern _X_EXPORT long SmartScheduleMaxSlice; -extern _X_EXPORT Bool SmartScheduleDisable; -extern _X_EXPORT void SmartScheduleStartTimer(void); -extern _X_EXPORT void SmartScheduleStopTimer(void); -#define SMART_MAX_PRIORITY (20) -#define SMART_MIN_PRIORITY (-20) - -extern _X_EXPORT void SmartScheduleInit(void); - - -/* This prototype is used pervasively in Xext, dix */ -#define DISPATCH_PROC(func) int func(ClientPtr /* client */) - -typedef struct _WorkQueue { - struct _WorkQueue *next; - Bool (*function) ( - ClientPtr /* pClient */, - pointer /* closure */ -); - ClientPtr client; - pointer closure; -} WorkQueueRec; - -extern _X_EXPORT TimeStamp currentTime; -extern _X_EXPORT TimeStamp lastDeviceEventTime; - -extern _X_EXPORT int CompareTimeStamps( - TimeStamp /*a*/, - TimeStamp /*b*/); - -extern _X_EXPORT TimeStamp ClientTimeToServerTime(CARD32 /*c*/); - -typedef struct _CallbackRec { - CallbackProcPtr proc; - pointer data; - Bool deleted; - struct _CallbackRec *next; -} CallbackRec, *CallbackPtr; - -typedef struct _CallbackList { - int inCallback; - Bool deleted; - int numDeleted; - CallbackPtr list; -} CallbackListRec; - -/* proc vectors */ - -extern _X_EXPORT int (* InitialVector[3]) (ClientPtr /*client*/); - -extern _X_EXPORT int (* ProcVector[256]) (ClientPtr /*client*/); - -extern _X_EXPORT int (* SwappedProcVector[256]) (ClientPtr /*client*/); - -extern _X_EXPORT ReplySwapPtr ReplySwapVector[256]; - -extern _X_EXPORT int ProcBadRequest(ClientPtr /*client*/); - -#endif /* DIXSTRUCT_H */ +/*********************************************************** +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef DIXSTRUCT_H +#define DIXSTRUCT_H + +#include "client.h" +#include "dix.h" +#include "resource.h" +#include "cursor.h" +#include "gc.h" +#include "pixmap.h" +#include "privates.h" +#include + +/* + * direct-mapped hash table, used by resource manager to store + * translation from client ids to server addresses. + */ + +extern _X_EXPORT CallbackListPtr ClientStateCallback; + +typedef struct { + ClientPtr client; + xConnSetupPrefix *prefix; + xConnSetup *setup; +} NewClientInfoRec; + +typedef void (*ReplySwapPtr) ( + ClientPtr /* pClient */, + int /* size */, + void * /* pbuf */); + +extern _X_EXPORT void ReplyNotSwappd ( + ClientPtr /* pClient */, + int /* size */, + void * /* pbuf */) _X_NORETURN; + +typedef enum {ClientStateInitial, + ClientStateAuthenticating, + ClientStateRunning, + ClientStateRetained, + ClientStateGone, + ClientStateCheckingSecurity, + ClientStateCheckedSecurity} ClientState; + +#ifdef XFIXES +typedef struct _saveSet { + struct _Window *windowPtr; + Bool toRoot; + Bool map; +} SaveSetElt; +#define SaveSetWindow(ss) ((ss).windowPtr) +#define SaveSetToRoot(ss) ((ss).toRoot) +#define SaveSetShouldMap(ss) ((ss).map) +#define SaveSetAssignWindow(ss,w) ((ss).windowPtr = (w)) +#define SaveSetAssignToRoot(ss,tr) ((ss).toRoot = (tr)) +#define SaveSetAssignMap(ss,m) ((ss).map = (m)) +#else +typedef struct _Window *SaveSetElt; +#define SaveSetWindow(ss) (ss) +#define SaveSetToRoot(ss) FALSE +#define SaveSetShouldMap(ss) TRUE +#define SaveSetAssignWindow(ss,w) ((ss) = (w)) +#define SaveSetAssignToRoot(ss,tr) +#define SaveSetAssignMap(ss,m) +#endif + +typedef struct _Client { + int index; + Mask clientAsMask; + pointer requestBuffer; + pointer osPrivate; /* for OS layer, including scheduler */ + Bool swapped; + ReplySwapPtr pSwapReplyFunc; + XID errorValue; + unsigned short sequence; //MH + int closeDownMode; + int clientGone; + int noClientException; /* this client died or needs to be + * killed */ + int ignoreCount; /* count for Attend/IgnoreClient */ + SaveSetElt *saveSet; + int numSaved; + int (**requestVector) ( + ClientPtr /* pClient */); + CARD32 req_len; /* length of current request */ + Bool big_requests; /* supports large requests */ + int priority; + ClientState clientState; + PrivateRec *devPrivates; + unsigned short xkbClientFlags; + unsigned short mapNotifyMask; + unsigned short newKeyboardNotifyMask; + unsigned short vMajor,vMinor; + KeyCode minKC,maxKC; + + unsigned long replyBytesRemaining; + int smart_priority; + long smart_start_tick; + long smart_stop_tick; + long smart_check_tick; + + DeviceIntPtr clientPtr; + ClientIdPtr clientIds; +} ClientRec; + +/* + * Scheduling interface + */ +extern _X_EXPORT long SmartScheduleTime; +extern _X_EXPORT long SmartScheduleInterval; +extern _X_EXPORT long SmartScheduleSlice; +extern _X_EXPORT long SmartScheduleMaxSlice; +extern _X_EXPORT Bool SmartScheduleDisable; +extern _X_EXPORT void SmartScheduleStartTimer(void); +extern _X_EXPORT void SmartScheduleStopTimer(void); +#define SMART_MAX_PRIORITY (20) +#define SMART_MIN_PRIORITY (-20) + +extern _X_EXPORT void SmartScheduleInit(void); + + +/* This prototype is used pervasively in Xext, dix */ +#define DISPATCH_PROC(func) int func(ClientPtr /* client */) + +typedef struct _WorkQueue { + struct _WorkQueue *next; + Bool (*function) ( + ClientPtr /* pClient */, + pointer /* closure */ +); + ClientPtr client; + pointer closure; +} WorkQueueRec; + +extern _X_EXPORT TimeStamp currentTime; +extern _X_EXPORT TimeStamp lastDeviceEventTime; + +extern _X_EXPORT int CompareTimeStamps( + TimeStamp /*a*/, + TimeStamp /*b*/); + +extern _X_EXPORT TimeStamp ClientTimeToServerTime(CARD32 /*c*/); + +typedef struct _CallbackRec { + CallbackProcPtr proc; + pointer data; + Bool deleted; + struct _CallbackRec *next; +} CallbackRec, *CallbackPtr; + +typedef struct _CallbackList { + int inCallback; + Bool deleted; + int numDeleted; + CallbackPtr list; +} CallbackListRec; + +/* proc vectors */ + +extern _X_EXPORT int (* InitialVector[3]) (ClientPtr /*client*/); + +extern _X_EXPORT int (* ProcVector[256]) (ClientPtr /*client*/); + +extern _X_EXPORT int (* SwappedProcVector[256]) (ClientPtr /*client*/); + +extern _X_EXPORT ReplySwapPtr ReplySwapVector[256]; + +extern _X_EXPORT int ProcBadRequest(ClientPtr /*client*/); + +#endif /* DIXSTRUCT_H */ diff --git a/xorg-server/include/eventconvert.h b/xorg-server/include/eventconvert.h index 9e63b46be..b000abc4b 100644 --- a/xorg-server/include/eventconvert.h +++ b/xorg-server/include/eventconvert.h @@ -1,40 +1,40 @@ -/* - * Copyright © 2009 Red Hat, Inc. - * - * 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. - * - */ - -#ifndef _EVENTCONVERT_H_ -#include -#include -#include "input.h" -#include "events.h" - -#define FP1616(integral, frac) ((integral) * (1 << 16) + (frac) * (1 << 16)) - -_X_EXPORT int EventToCore(InternalEvent *event, xEvent **core, int *count); -_X_EXPORT int EventToXI(InternalEvent *ev, xEvent **xi, int *count); -_X_EXPORT int EventToXI2(InternalEvent *ev, xEvent **xi); -_X_INTERNAL int GetCoreType(InternalEvent* ev); -_X_INTERNAL int GetXIType(InternalEvent* ev); -_X_INTERNAL int GetXI2Type(InternalEvent* ev); - -#endif /* _EVENTCONVERT_H_ */ +/* + * Copyright © 2009 Red Hat, Inc. + * + * 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. + * + */ + +#ifndef _EVENTCONVERT_H_ +#include +#include +#include "input.h" +#include "events.h" + +#define FP1616(integral, frac) ((integral) * (1 << 16) + (frac) * (1 << 16)) + +_X_EXPORT int EventToCore(InternalEvent *event, xEvent **core, int *count); +_X_EXPORT int EventToXI(InternalEvent *ev, xEvent **xi, int *count); +_X_EXPORT int EventToXI2(InternalEvent *ev, xEvent **xi); +_X_INTERNAL int GetCoreType(InternalEvent* ev); +_X_INTERNAL int GetXIType(InternalEvent* ev); +_X_INTERNAL int GetXI2Type(InternalEvent* ev); + +#endif /* _EVENTCONVERT_H_ */ diff --git a/xorg-server/include/eventstr.h b/xorg-server/include/eventstr.h index 83f96d168..049688ca0 100644 --- a/xorg-server/include/eventstr.h +++ b/xorg-server/include/eventstr.h @@ -1,242 +1,242 @@ -/* - * Copyright © 2009 Red Hat, Inc. - * - * 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. - * - */ - -#ifndef EVENTSTR_H -#define EVENTSTR_H - -#include -/** - * @file events.h - * This file describes the event structures used internally by the X - * server during event generation and event processing. - * - * When are internal events used? - * Events from input devices are stored as internal events in the EQ and - * processed as internal events until late in the processing cycle. Only then - * do they switch to their respective wire events. - */ - -/** - * Event types. Used exclusively internal to the server, not visible on the - * protocol. - * - * Note: Keep KeyPress to Motion aligned with the core events. - * Keep ET_Raw* in the same order as KeyPress - Motion - */ -enum EventType { - ET_KeyPress = 2, - ET_KeyRelease, - ET_ButtonPress, - ET_ButtonRelease, - ET_Motion, - ET_Enter, - ET_Leave, - ET_FocusIn, - ET_FocusOut, - ET_ProximityIn, - ET_ProximityOut, - ET_DeviceChanged, - ET_Hierarchy, - ET_DGAEvent, - ET_RawKeyPress, - ET_RawKeyRelease, - ET_RawButtonPress, - ET_RawButtonRelease, - ET_RawMotion, - ET_XQuartz, - ET_Internal = 0xFF /* First byte */ -}; - -/** - * Used for ALL input device events internal in the server until - * copied into the matching protocol event. - * - * Note: We only use the device id because the DeviceIntPtr may become invalid while - * the event is in the EQ. - */ -struct _DeviceEvent -{ - unsigned char header; /**< Always ET_Internal */ - enum EventType type; /**< One of EventType */ - int length; /**< Length in bytes */ - Time time; /**< Time in ms */ - int deviceid; /**< Device to post this event for */ - int sourceid; /**< The physical source device */ - union { - uint32_t button; /**< Button number */ - uint32_t key; /**< Key code */ - } detail; - int16_t root_x; /**< Pos relative to root window in integral data */ - float root_x_frac; /**< Pos relative to root window in frac part */ - int16_t root_y; /**< Pos relative to root window in integral part */ - float root_y_frac; /**< Pos relative to root window in frac part */ - uint8_t buttons[(MAX_BUTTONS + 7)/8]; /**< Button mask */ - struct { - uint8_t mask[(MAX_VALUATORS + 7)/8]; /**< Valuator mask */ - uint8_t mode[(MAX_VALUATORS + 7)/8]; /**< Valuator mode (Abs or Rel)*/ - int32_t data[MAX_VALUATORS]; /**< Valuator data */ - int32_t data_frac[MAX_VALUATORS]; /**< Fractional part for data */ - } valuators; - struct { - uint32_t base; /**< XKB base modifiers */ - uint32_t latched; /**< XKB latched modifiers */ - uint32_t locked; /**< XKB locked modifiers */ - uint32_t effective;/**< XKB effective modifiers */ - } mods; - struct { - uint8_t base; /**< XKB base group */ - uint8_t latched; /**< XKB latched group */ - uint8_t locked; /**< XKB locked group */ - uint8_t effective;/**< XKB effective group */ - } group; - Window root; /**< Root window of the event */ - int corestate; /**< Core key/button state BEFORE the event */ - int key_repeat; /**< Internally-generated key repeat event */ -}; - - -/* Flags used in DeviceChangedEvent to signal if the slave has changed */ -#define DEVCHANGE_SLAVE_SWITCH 0x2 -/* Flags used in DeviceChangedEvent to signal whether the event was a - * pointer event or a keyboard event */ -#define DEVCHANGE_POINTER_EVENT 0x4 -#define DEVCHANGE_KEYBOARD_EVENT 0x8 -/* device capabilities changed */ -#define DEVCHANGE_DEVICE_CHANGE 0x10 - -/** - * Sent whenever a device's capabilities have changed. - */ -struct _DeviceChangedEvent -{ - unsigned char header; /**< Always ET_Internal */ - enum EventType type; /**< ET_DeviceChanged */ - int length; /**< Length in bytes */ - Time time; /**< Time in ms */ - int deviceid; /**< Device whose capabilities have changed */ - int flags; /**< Mask of ::HAS_NEW_SLAVE, - ::POINTER_EVENT, ::KEYBOARD_EVENT */ - int masterid; /**< MD when event was generated */ - int sourceid; /**< The device that caused the change */ - - struct { - int num_buttons; /**< Number of buttons */ - Atom names[MAX_BUTTONS];/**< Button names */ - } buttons; - - int num_valuators; /**< Number of axes */ - struct { - uint32_t min; /**< Minimum value */ - uint32_t max; /**< Maximum value */ - /* FIXME: frac parts of min/max */ - uint32_t resolution; /**< Resolution counts/m */ - uint8_t mode; /**< Relative or Absolute */ - Atom name; /**< Axis name */ - } valuators[MAX_VALUATORS]; - - struct { - int min_keycode; - int max_keycode; - } keys; -}; - -#if XFreeXDGA -/** - * DGAEvent, used by DGA to intercept and emulate input events. - */ -struct _DGAEvent -{ - unsigned char header; /**< Always ET_Internal */ - enum EventType type; /**< ET_DGAEvent */ - int length; /**< Length in bytes */ - Time time; /**< Time in ms */ - int subtype; /**< KeyPress, KeyRelease, ButtonPress, - ButtonRelease, MotionNotify */ - int detail; /**< Button number or key code */ - int dx; /**< Relative x coordinate */ - int dy; /**< Relative y coordinate */ - int screen; /**< Screen number this event applies to */ - uint16_t state; /**< Core modifier/button state */ -}; -#endif - -/** - * Raw event, contains the data as posted by the device. - */ -struct _RawDeviceEvent -{ - unsigned char header; /**< Always ET_Internal */ - enum EventType type; /**< ET_Raw */ - int length; /**< Length in bytes */ - Time time; /**< Time in ms */ - int deviceid; /**< Device to post this event for */ - int sourceid; /**< The physical source device */ - union { - uint32_t button; /**< Button number */ - uint32_t key; /**< Key code */ - } detail; - struct { - uint8_t mask[(MAX_VALUATORS + 7)/8]; /**< Valuator mask */ - int32_t data[MAX_VALUATORS]; /**< Valuator data */ - int32_t data_frac[MAX_VALUATORS]; /**< Fractional part for data */ - int32_t data_raw[MAX_VALUATORS]; /**< Valuator data as posted */ - int32_t data_raw_frac[MAX_VALUATORS];/**< Fractional part for data_raw */ - } valuators; -}; - -#ifdef XQUARTZ -#define XQUARTZ_EVENT_MAXARGS 5 -struct _XQuartzEvent { - unsigned char header; /**< Always ET_Internal */ - enum EventType type; /**< Always ET_XQuartz */ - int length; /**< Length in bytes */ - Time time; /**< Time in ms. */ - int subtype; /**< Subtype defined by XQuartz DDX */ - uint32_t data[XQUARTZ_EVENT_MAXARGS]; /**< Up to 5 32bit values passed to handler */ -}; -#endif - -/** - * Event type used inside the X server for input event - * processing. - */ -union _InternalEvent { - struct { - unsigned char header; /**< Always ET_Internal */ - enum EventType type; /**< One of ET_* */ - int length; /**< Length in bytes */ - Time time; /**< Time in ms. */ - } any; - DeviceEvent device_event; - DeviceChangedEvent changed_event; -#if XFreeXDGA - DGAEvent dga_event; -#endif - RawDeviceEvent raw_event; -#ifdef XQUARTZ - XQuartzEvent xquartz_event; -#endif -}; - -#endif +/* + * Copyright © 2009 Red Hat, Inc. + * + * 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. + * + */ + +#ifndef EVENTSTR_H +#define EVENTSTR_H + +#include +/** + * @file events.h + * This file describes the event structures used internally by the X + * server during event generation and event processing. + * + * When are internal events used? + * Events from input devices are stored as internal events in the EQ and + * processed as internal events until late in the processing cycle. Only then + * do they switch to their respective wire events. + */ + +/** + * Event types. Used exclusively internal to the server, not visible on the + * protocol. + * + * Note: Keep KeyPress to Motion aligned with the core events. + * Keep ET_Raw* in the same order as KeyPress - Motion + */ +enum EventType { + ET_KeyPress = 2, + ET_KeyRelease, + ET_ButtonPress, + ET_ButtonRelease, + ET_Motion, + ET_Enter, + ET_Leave, + ET_FocusIn, + ET_FocusOut, + ET_ProximityIn, + ET_ProximityOut, + ET_DeviceChanged, + ET_Hierarchy, + ET_DGAEvent, + ET_RawKeyPress, + ET_RawKeyRelease, + ET_RawButtonPress, + ET_RawButtonRelease, + ET_RawMotion, + ET_XQuartz, + ET_Internal = 0xFF /* First byte */ +}; + +/** + * Used for ALL input device events internal in the server until + * copied into the matching protocol event. + * + * Note: We only use the device id because the DeviceIntPtr may become invalid while + * the event is in the EQ. + */ +struct _DeviceEvent +{ + unsigned char header; /**< Always ET_Internal */ + enum EventType type; /**< One of EventType */ + int length; /**< Length in bytes */ + Time time; /**< Time in ms */ + int deviceid; /**< Device to post this event for */ + int sourceid; /**< The physical source device */ + union { + uint32_t button; /**< Button number */ + uint32_t key; /**< Key code */ + } detail; + int16_t root_x; /**< Pos relative to root window in integral data */ + float root_x_frac; /**< Pos relative to root window in frac part */ + int16_t root_y; /**< Pos relative to root window in integral part */ + float root_y_frac; /**< Pos relative to root window in frac part */ + uint8_t buttons[(MAX_BUTTONS + 7)/8]; /**< Button mask */ + struct { + uint8_t mask[(MAX_VALUATORS + 7)/8]; /**< Valuator mask */ + uint8_t mode[(MAX_VALUATORS + 7)/8]; /**< Valuator mode (Abs or Rel)*/ + int32_t data[MAX_VALUATORS]; /**< Valuator data */ + int32_t data_frac[MAX_VALUATORS]; /**< Fractional part for data */ + } valuators; + struct { + uint32_t base; /**< XKB base modifiers */ + uint32_t latched; /**< XKB latched modifiers */ + uint32_t locked; /**< XKB locked modifiers */ + uint32_t effective;/**< XKB effective modifiers */ + } mods; + struct { + uint8_t base; /**< XKB base group */ + uint8_t latched; /**< XKB latched group */ + uint8_t locked; /**< XKB locked group */ + uint8_t effective;/**< XKB effective group */ + } group; + Window root; /**< Root window of the event */ + int corestate; /**< Core key/button state BEFORE the event */ + int key_repeat; /**< Internally-generated key repeat event */ +}; + + +/* Flags used in DeviceChangedEvent to signal if the slave has changed */ +#define DEVCHANGE_SLAVE_SWITCH 0x2 +/* Flags used in DeviceChangedEvent to signal whether the event was a + * pointer event or a keyboard event */ +#define DEVCHANGE_POINTER_EVENT 0x4 +#define DEVCHANGE_KEYBOARD_EVENT 0x8 +/* device capabilities changed */ +#define DEVCHANGE_DEVICE_CHANGE 0x10 + +/** + * Sent whenever a device's capabilities have changed. + */ +struct _DeviceChangedEvent +{ + unsigned char header; /**< Always ET_Internal */ + enum EventType type; /**< ET_DeviceChanged */ + int length; /**< Length in bytes */ + Time time; /**< Time in ms */ + int deviceid; /**< Device whose capabilities have changed */ + int flags; /**< Mask of ::HAS_NEW_SLAVE, + ::POINTER_EVENT, ::KEYBOARD_EVENT */ + int masterid; /**< MD when event was generated */ + int sourceid; /**< The device that caused the change */ + + struct { + int num_buttons; /**< Number of buttons */ + Atom names[MAX_BUTTONS];/**< Button names */ + } buttons; + + int num_valuators; /**< Number of axes */ + struct { + uint32_t min; /**< Minimum value */ + uint32_t max; /**< Maximum value */ + /* FIXME: frac parts of min/max */ + uint32_t resolution; /**< Resolution counts/m */ + uint8_t mode; /**< Relative or Absolute */ + Atom name; /**< Axis name */ + } valuators[MAX_VALUATORS]; + + struct { + int min_keycode; + int max_keycode; + } keys; +}; + +#if XFreeXDGA +/** + * DGAEvent, used by DGA to intercept and emulate input events. + */ +struct _DGAEvent +{ + unsigned char header; /**< Always ET_Internal */ + enum EventType type; /**< ET_DGAEvent */ + int length; /**< Length in bytes */ + Time time; /**< Time in ms */ + int subtype; /**< KeyPress, KeyRelease, ButtonPress, + ButtonRelease, MotionNotify */ + int detail; /**< Button number or key code */ + int dx; /**< Relative x coordinate */ + int dy; /**< Relative y coordinate */ + int screen; /**< Screen number this event applies to */ + uint16_t state; /**< Core modifier/button state */ +}; +#endif + +/** + * Raw event, contains the data as posted by the device. + */ +struct _RawDeviceEvent +{ + unsigned char header; /**< Always ET_Internal */ + enum EventType type; /**< ET_Raw */ + int length; /**< Length in bytes */ + Time time; /**< Time in ms */ + int deviceid; /**< Device to post this event for */ + int sourceid; /**< The physical source device */ + union { + uint32_t button; /**< Button number */ + uint32_t key; /**< Key code */ + } detail; + struct { + uint8_t mask[(MAX_VALUATORS + 7)/8]; /**< Valuator mask */ + int32_t data[MAX_VALUATORS]; /**< Valuator data */ + int32_t data_frac[MAX_VALUATORS]; /**< Fractional part for data */ + int32_t data_raw[MAX_VALUATORS]; /**< Valuator data as posted */ + int32_t data_raw_frac[MAX_VALUATORS];/**< Fractional part for data_raw */ + } valuators; +}; + +#ifdef XQUARTZ +#define XQUARTZ_EVENT_MAXARGS 5 +struct _XQuartzEvent { + unsigned char header; /**< Always ET_Internal */ + enum EventType type; /**< Always ET_XQuartz */ + int length; /**< Length in bytes */ + Time time; /**< Time in ms. */ + int subtype; /**< Subtype defined by XQuartz DDX */ + uint32_t data[XQUARTZ_EVENT_MAXARGS]; /**< Up to 5 32bit values passed to handler */ +}; +#endif + +/** + * Event type used inside the X server for input event + * processing. + */ +union _InternalEvent { + struct { + unsigned char header; /**< Always ET_Internal */ + enum EventType type; /**< One of ET_* */ + int length; /**< Length in bytes */ + Time time; /**< Time in ms. */ + } any; + DeviceEvent device_event; + DeviceChangedEvent changed_event; +#if XFreeXDGA + DGAEvent dga_event; +#endif + RawDeviceEvent raw_event; +#ifdef XQUARTZ + XQuartzEvent xquartz_event; +#endif +}; + +#endif diff --git a/xorg-server/include/input.h b/xorg-server/include/input.h index eb85d7800..5377a0c13 100644 --- a/xorg-server/include/input.h +++ b/xorg-server/include/input.h @@ -1,598 +1,598 @@ -/************************************************************ - -Copyright 1987, 1998 The Open Group - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -********************************************************/ - -#ifndef INPUT_H -#define INPUT_H - -#include "misc.h" -#include "screenint.h" -#include -#include -#include -#include "window.h" /* for WindowPtr */ -#include "xkbrules.h" -#include "events.h" - -#define DEVICE_INIT 0 -#define DEVICE_ON 1 -#define DEVICE_OFF 2 -#define DEVICE_CLOSE 3 - -#define POINTER_RELATIVE (1 << 1) -#define POINTER_ABSOLUTE (1 << 2) -#define POINTER_ACCELERATE (1 << 3) -#define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */ -#define POINTER_NORAW (1 << 5) /* Don't generate RawEvents */ - -/*int constants for pointer acceleration schemes*/ -#define PtrAccelNoOp 0 -#define PtrAccelPredictable 1 -#define PtrAccelLightweight 2 -#define PtrAccelDefault PtrAccelPredictable - -#define MAX_VALUATORS 36 -/* Maximum number of valuators, divided by six, rounded up, to get number - * of events. */ -#define MAX_VALUATOR_EVENTS 6 -#define MAX_BUTTONS 256 /* completely arbitrarily chosen */ - -#define NO_AXIS_LIMITS -1 - -#define MAP_LENGTH 256 -#define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */ -#define NullGrab ((GrabPtr)NULL) -#define PointerRootWin ((WindowPtr)PointerRoot) -#define NoneWin ((WindowPtr)None) -#define NullDevice ((DevicePtr)NULL) - -#ifndef FollowKeyboard -#define FollowKeyboard 3 -#endif -#ifndef FollowKeyboardWin -#define FollowKeyboardWin ((WindowPtr) FollowKeyboard) -#endif -#ifndef RevertToFollowKeyboard -#define RevertToFollowKeyboard 3 -#endif - -typedef unsigned long Leds; -typedef struct _OtherClients *OtherClientsPtr; -typedef struct _InputClients *InputClientsPtr; -typedef struct _DeviceIntRec *DeviceIntPtr; -typedef struct _ValuatorClassRec *ValuatorClassPtr; -typedef struct _ClassesRec *ClassesPtr; -typedef struct _SpriteRec *SpritePtr; -typedef union _GrabMask GrabMask; - -typedef struct _ValuatorMask ValuatorMask; - -/* The DIX stores incoming input events in this list */ -extern InternalEvent* InputEventList; - -typedef int (*DeviceProc)( - DeviceIntPtr /*device*/, - int /*what*/); - -typedef void (*ProcessInputProc)( - InternalEvent * /*event*/, - DeviceIntPtr /*device*/); - -typedef Bool (*DeviceHandleProc)( - DeviceIntPtr /*device*/, - void* /*data*/ - ); - -typedef void (*DeviceUnwrapProc)( - DeviceIntPtr /*device*/, - DeviceHandleProc /*proc*/, - void* /*data*/ - ); - -/* pointer acceleration handling */ -typedef void (*PointerAccelSchemeProc)( - DeviceIntPtr /*device*/, - ValuatorMask* /*valuators*/, - CARD32 /*evtime*/); - -typedef void (*DeviceCallbackProc)( - DeviceIntPtr /*pDev*/); - -struct _ValuatorAccelerationRec; -typedef Bool (*PointerAccelSchemeInitProc)( - DeviceIntPtr /*dev*/, - struct _ValuatorAccelerationRec* /*protoScheme*/); - -typedef struct _DeviceRec { - pointer devicePrivate; - ProcessInputProc processInputProc; /* current */ - ProcessInputProc realInputProc; /* deliver */ - ProcessInputProc enqueueInputProc; /* enqueue */ - Bool on; /* used by DDX to keep state */ -} DeviceRec, *DevicePtr; - -typedef struct { - int click, bell, bell_pitch, bell_duration; - Bool autoRepeat; - unsigned char autoRepeats[32]; - Leds leds; - unsigned char id; -} KeybdCtrl; - -typedef struct { - KeySym *map; - KeyCode minKeyCode, - maxKeyCode; - int mapWidth; -} KeySymsRec, *KeySymsPtr; - -typedef struct { - int num, den, threshold; - unsigned char id; -} PtrCtrl; - -typedef struct { - int resolution, min_value, max_value; - int integer_displayed; - unsigned char id; -} IntegerCtrl; - -typedef struct { - int max_symbols, num_symbols_supported; - int num_symbols_displayed; - KeySym *symbols_supported; - KeySym *symbols_displayed; - unsigned char id; -} StringCtrl; - -typedef struct { - int percent, pitch, duration; - unsigned char id; -} BellCtrl; - -typedef struct { - Leds led_values; - Mask led_mask; - unsigned char id; -} LedCtrl; - -extern _X_EXPORT KeybdCtrl defaultKeyboardControl; -extern _X_EXPORT PtrCtrl defaultPointerControl; - -typedef struct _InputOption { - char *key; - char *value; - struct _InputOption *next; -} InputOption; - -typedef struct _InputAttributes { - char *product; - char *vendor; - char *device; - char *pnp_id; - char *usb_id; - char **tags; /* null-terminated */ - uint32_t flags; -} InputAttributes; - -#define ATTR_KEYBOARD (1<<0) -#define ATTR_POINTER (1<<1) -#define ATTR_JOYSTICK (1<<2) -#define ATTR_TABLET (1<<3) -#define ATTR_TOUCHPAD (1<<4) -#define ATTR_TOUCHSCREEN (1<<5) - -/* Key/Button has been run through all input processing and events sent to clients. */ -#define KEY_PROCESSED 1 -#define BUTTON_PROCESSED 1 -/* Key/Button has not been fully processed, no events have been sent. */ -#define KEY_POSTED 2 -#define BUTTON_POSTED 2 - -extern void set_key_down(DeviceIntPtr pDev, int key_code, int type); -extern void set_key_up(DeviceIntPtr pDev, int key_code, int type); -extern int key_is_down(DeviceIntPtr pDev, int key_code, int type); -extern void set_button_down(DeviceIntPtr pDev, int button, int type); -extern void set_button_up(DeviceIntPtr pDev, int button, int type); -extern int button_is_down(DeviceIntPtr pDev, int button, int type); - -extern void InitCoreDevices(void); -extern void InitXTestDevices(void); - -extern _X_EXPORT DeviceIntPtr AddInputDevice( - ClientPtr /*client*/, - DeviceProc /*deviceProc*/, - Bool /*autoStart*/); - -extern _X_EXPORT Bool EnableDevice( - DeviceIntPtr /*device*/, - BOOL /* sendevent */); - -extern _X_EXPORT Bool ActivateDevice( - DeviceIntPtr /*device*/, - BOOL /* sendevent */); - -extern _X_EXPORT Bool DisableDevice( - DeviceIntPtr /*device*/, - BOOL /* sendevent */); - -extern int InitAndStartDevices(void); - -extern void CloseDownDevices(void); - -extern void UndisplayDevices(void); - -extern _X_EXPORT int RemoveDevice( - DeviceIntPtr /*dev*/, - BOOL /* sendevent */); - -extern _X_EXPORT int NumMotionEvents(void); - -extern _X_EXPORT int dixLookupDevice( - DeviceIntPtr * /* dev */, - int /* id */, - ClientPtr /* client */, - Mask /* access_mode */); - -extern _X_EXPORT void QueryMinMaxKeyCodes( - KeyCode* /*minCode*/, - KeyCode* /*maxCode*/); - -extern _X_EXPORT Bool SetKeySymsMap( - KeySymsPtr /*dst*/, - KeySymsPtr /*src*/); - -extern _X_EXPORT Bool InitButtonClassDeviceStruct( - DeviceIntPtr /*device*/, - int /*numButtons*/, - Atom* /* labels */, - CARD8* /*map*/); - -extern _X_INTERNAL ValuatorClassPtr AllocValuatorClass( - ValuatorClassPtr src, - int numAxes); - -extern _X_EXPORT Bool InitValuatorClassDeviceStruct( - DeviceIntPtr /*device*/, - int /*numAxes*/, - Atom* /* labels */, - int /*numMotionEvents*/, - int /*mode*/); - -extern _X_EXPORT Bool InitPointerAccelerationScheme( - DeviceIntPtr /*dev*/, - int /*scheme*/); - -extern _X_EXPORT Bool InitFocusClassDeviceStruct( - DeviceIntPtr /*device*/); - -typedef void (*BellProcPtr)( - int /*percent*/, - DeviceIntPtr /*device*/, - pointer /*ctrl*/, - int); - -typedef void (*KbdCtrlProcPtr)( - DeviceIntPtr /*device*/, - KeybdCtrl * /*ctrl*/); - -typedef void (*PtrCtrlProcPtr)( - DeviceIntPtr /*device*/, - PtrCtrl * /*ctrl*/); - -extern _X_EXPORT Bool InitPtrFeedbackClassDeviceStruct( - DeviceIntPtr /*device*/, - PtrCtrlProcPtr /*controlProc*/); - -typedef void (*StringCtrlProcPtr)( - DeviceIntPtr /*device*/, - StringCtrl * /*ctrl*/); - -extern _X_EXPORT Bool InitStringFeedbackClassDeviceStruct( - DeviceIntPtr /*device*/, - StringCtrlProcPtr /*controlProc*/, - int /*max_symbols*/, - int /*num_symbols_supported*/, - KeySym* /*symbols*/); - -typedef void (*BellCtrlProcPtr)( - DeviceIntPtr /*device*/, - BellCtrl * /*ctrl*/); - -extern _X_EXPORT Bool InitBellFeedbackClassDeviceStruct( - DeviceIntPtr /*device*/, - BellProcPtr /*bellProc*/, - BellCtrlProcPtr /*controlProc*/); - -typedef void (*LedCtrlProcPtr)( - DeviceIntPtr /*device*/, - LedCtrl * /*ctrl*/); - -extern _X_EXPORT Bool InitLedFeedbackClassDeviceStruct( - DeviceIntPtr /*device*/, - LedCtrlProcPtr /*controlProc*/); - -typedef void (*IntegerCtrlProcPtr)( - DeviceIntPtr /*device*/, - IntegerCtrl * /*ctrl*/); - - -extern _X_EXPORT Bool InitIntegerFeedbackClassDeviceStruct( - DeviceIntPtr /*device*/, - IntegerCtrlProcPtr /*controlProc*/); - -extern _X_EXPORT Bool InitPointerDeviceStruct( - DevicePtr /*device*/, - CARD8* /*map*/, - int /*numButtons*/, - Atom* /* btn_labels */, - PtrCtrlProcPtr /*controlProc*/, - int /*numMotionEvents*/, - int /*numAxes*/, - Atom* /* axes_labels */); - -extern _X_EXPORT Bool InitKeyboardDeviceStruct( - DeviceIntPtr /*device*/, - XkbRMLVOSet * /*rmlvo*/, - BellProcPtr /*bellProc*/, - KbdCtrlProcPtr /*controlProc*/); - -extern int ApplyPointerMapping( - DeviceIntPtr /* pDev */, - CARD8 * /* map */, - int /* len */, - ClientPtr /* client */); - -extern Bool BadDeviceMap( - BYTE* /*buff*/, - int /*length*/, - unsigned /*low*/, - unsigned /*high*/, - XID* /*errval*/); - -extern void NoteLedState( - DeviceIntPtr /*keybd*/, - int /*led*/, - Bool /*on*/); - -extern void MaybeStopHint( - DeviceIntPtr /*device*/, - ClientPtr /*client*/); - -extern void ProcessPointerEvent( - InternalEvent* /* ev */, - DeviceIntPtr /*mouse*/); - -extern void ProcessKeyboardEvent( - InternalEvent* /*ev*/, - DeviceIntPtr /*keybd*/); - -extern Bool LegalModifier( - unsigned int /*key*/, - DeviceIntPtr /*pDev*/); - -extern _X_EXPORT void ProcessInputEvents(void); - -extern _X_EXPORT void InitInput( - int /*argc*/, - char ** /*argv*/); -extern _X_EXPORT void CloseInput(void); - -extern _X_EXPORT int GetMaximumEventsNum(void); - -extern _X_EXPORT InternalEvent *InitEventList(int num_events); -extern _X_EXPORT void FreeEventList(InternalEvent *list, int num_events); - -extern void CreateClassesChangedEvent(InternalEvent *event, - DeviceIntPtr master, - DeviceIntPtr slave, - int type); -extern InternalEvent * UpdateFromMaster( - InternalEvent *events, - DeviceIntPtr pDev, - int type, - int *num_events); - -extern _X_EXPORT int GetPointerEvents( - InternalEvent *events, - DeviceIntPtr pDev, - int type, - int buttons, - int flags, - const ValuatorMask *mask); - -extern _X_EXPORT void QueuePointerEvents( - DeviceIntPtr pDev, - int type, - int buttons, - int flags, - const ValuatorMask *mask); - -extern _X_EXPORT int GetKeyboardEvents( - InternalEvent *events, - DeviceIntPtr pDev, - int type, - int key_code, - const ValuatorMask *mask); - -extern _X_EXPORT void QueueKeyboardEvents( - DeviceIntPtr pDev, - int type, - int key_code, - const ValuatorMask *mask); - -extern int GetProximityEvents( - InternalEvent *events, - DeviceIntPtr pDev, - int type, - const ValuatorMask *mask); - -extern void QueueProximityEvents( - DeviceIntPtr pDev, - int type, - const ValuatorMask *mask); - -extern void PostSyntheticMotion( - DeviceIntPtr pDev, - int x, - int y, - int screen, - unsigned long time); - -extern _X_EXPORT int GetMotionHistorySize( - void); - -extern _X_EXPORT void AllocateMotionHistory( - DeviceIntPtr pDev); - -extern _X_EXPORT int GetMotionHistory( - DeviceIntPtr pDev, - xTimecoord **buff, - unsigned long start, - unsigned long stop, - ScreenPtr pScreen, - BOOL core); - -extern void ReleaseButtonsAndKeys(DeviceIntPtr dev); - -extern int AttachDevice(ClientPtr client, - DeviceIntPtr slave, - DeviceIntPtr master); - -extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd); -extern DeviceIntPtr GetMaster(DeviceIntPtr dev, int type); - -extern _X_EXPORT int AllocDevicePair(ClientPtr client, - char* name, - DeviceIntPtr* ptr, - DeviceIntPtr* keybd, - DeviceProc ptr_proc, - DeviceProc keybd_proc, - Bool master); -extern void DeepCopyDeviceClasses(DeviceIntPtr from, - DeviceIntPtr to, - DeviceChangedEvent *dce); - -/* Helper functions. */ -extern _X_EXPORT int generate_modkeymap(ClientPtr client, DeviceIntPtr dev, - KeyCode **modkeymap, int *max_keys_per_mod); -extern int change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *map, - int max_keys_per_mod); -extern int AllocXTestDevice(ClientPtr client, - char* name, - DeviceIntPtr* ptr, - DeviceIntPtr* keybd, - DeviceIntPtr master_ptr, - DeviceIntPtr master_keybd); -extern BOOL IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master); -extern DeviceIntPtr GetXTestDevice(DeviceIntPtr master); -extern void SendDevicePresenceEvent(int deviceid, int type); -extern _X_EXPORT InputAttributes *DuplicateInputAttributes(InputAttributes *attrs); -extern _X_EXPORT void FreeInputAttributes(InputAttributes *attrs); - -/* misc event helpers */ -extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients); -extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event); -extern Mask GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev); -void FixUpEventFromWindow(SpritePtr pSprite, - xEvent *xE, - WindowPtr pWin, - Window child, - Bool calcChild); -extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y); -extern int EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, - WindowPtr win); -/** - * Masks specifying the type of event to deliver for an InternalEvent; used - * by EventIsDeliverable. - * @defgroup EventIsDeliverable return flags - * @{ - */ -#define EVENT_XI1_MASK (1 << 0) /**< XI1.x event */ -#define EVENT_CORE_MASK (1 << 1) /**< Core event */ -#define EVENT_DONT_PROPAGATE_MASK (1 << 2) /**< DontPropagate mask set */ -#define EVENT_XI2_MASK (1 << 3) /**< XI2 mask set on window */ -/* @} */ - -/* Implemented by the DDX. */ -extern _X_EXPORT int NewInputDeviceRequest( - InputOption *options, - InputAttributes *attrs, - DeviceIntPtr *dev); -extern _X_EXPORT void DeleteInputDeviceRequest( - DeviceIntPtr dev); - -extern _X_EXPORT void DDXRingBell( - int volume, - int pitch, - int duration); - -#define VALUATOR_MODE_ALL_AXES -1 -extern _X_HIDDEN int valuator_get_mode(DeviceIntPtr dev, int axis); -extern _X_HIDDEN void valuator_set_mode(DeviceIntPtr dev, int axis, int mode); - -/* Set to TRUE by default - os/utils.c sets it to FALSE on user request, - xfixes/cursor.c uses it to determine if the cursor is enabled */ -extern Bool EnableCursor; - -extern _X_EXPORT ValuatorMask *valuator_mask_new(int num_valuators); -extern _X_EXPORT void valuator_mask_free(ValuatorMask **mask); -extern _X_EXPORT void valuator_mask_set_range(ValuatorMask *mask, - int first_valuator, int num_valuators, - const int* valuators); -extern _X_EXPORT void valuator_mask_set(ValuatorMask *mask, - int valuator, - int data); -extern _X_EXPORT void valuator_mask_zero(ValuatorMask *mask); -extern _X_EXPORT int valuator_mask_size(const ValuatorMask *mask); -extern _X_EXPORT int valuator_mask_isset(const ValuatorMask *mask, int bit); -extern _X_EXPORT void valuator_mask_unset(ValuatorMask *mask, int bit); -extern _X_EXPORT int valuator_mask_num_valuators(const ValuatorMask *mask); -extern _X_EXPORT void valuator_mask_copy(ValuatorMask *dest, - const ValuatorMask *src); -extern _X_EXPORT int valuator_mask_get(const ValuatorMask *mask, int valnum); - -#endif /* INPUT_H */ +/************************************************************ + +Copyright 1987, 1998 The Open Group + +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 +OPEN GROUP 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 Open Group 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 Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +#ifndef INPUT_H +#define INPUT_H + +#include "misc.h" +#include "screenint.h" +#include +#include +#include +#include "window.h" /* for WindowPtr */ +#include "xkbrules.h" +#include "events.h" + +#define DEVICE_INIT 0 +#define DEVICE_ON 1 +#define DEVICE_OFF 2 +#define DEVICE_CLOSE 3 + +#define POINTER_RELATIVE (1 << 1) +#define POINTER_ABSOLUTE (1 << 2) +#define POINTER_ACCELERATE (1 << 3) +#define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */ +#define POINTER_NORAW (1 << 5) /* Don't generate RawEvents */ + +/*int constants for pointer acceleration schemes*/ +#define PtrAccelNoOp 0 +#define PtrAccelPredictable 1 +#define PtrAccelLightweight 2 +#define PtrAccelDefault PtrAccelPredictable + +#define MAX_VALUATORS 36 +/* Maximum number of valuators, divided by six, rounded up, to get number + * of events. */ +#define MAX_VALUATOR_EVENTS 6 +#define MAX_BUTTONS 256 /* completely arbitrarily chosen */ + +#define NO_AXIS_LIMITS -1 + +#define MAP_LENGTH 256 +#define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */ +#define NullGrab ((GrabPtr)NULL) +#define PointerRootWin ((WindowPtr)PointerRoot) +#define NoneWin ((WindowPtr)None) +#define NullDevice ((DevicePtr)NULL) + +#ifndef FollowKeyboard +#define FollowKeyboard 3 +#endif +#ifndef FollowKeyboardWin +#define FollowKeyboardWin ((WindowPtr) FollowKeyboard) +#endif +#ifndef RevertToFollowKeyboard +#define RevertToFollowKeyboard 3 +#endif + +typedef unsigned long Leds; +typedef struct _OtherClients *OtherClientsPtr; +typedef struct _InputClients *InputClientsPtr; +typedef struct _DeviceIntRec *DeviceIntPtr; +typedef struct _ValuatorClassRec *ValuatorClassPtr; +typedef struct _ClassesRec *ClassesPtr; +typedef struct _SpriteRec *SpritePtr; +typedef union _GrabMask GrabMask; + +typedef struct _ValuatorMask ValuatorMask; + +/* The DIX stores incoming input events in this list */ +extern InternalEvent* InputEventList; + +typedef int (*DeviceProc)( + DeviceIntPtr /*device*/, + int /*what*/); + +typedef void (*ProcessInputProc)( + InternalEvent * /*event*/, + DeviceIntPtr /*device*/); + +typedef Bool (*DeviceHandleProc)( + DeviceIntPtr /*device*/, + void* /*data*/ + ); + +typedef void (*DeviceUnwrapProc)( + DeviceIntPtr /*device*/, + DeviceHandleProc /*proc*/, + void* /*data*/ + ); + +/* pointer acceleration handling */ +typedef void (*PointerAccelSchemeProc)( + DeviceIntPtr /*device*/, + ValuatorMask* /*valuators*/, + CARD32 /*evtime*/); + +typedef void (*DeviceCallbackProc)( + DeviceIntPtr /*pDev*/); + +struct _ValuatorAccelerationRec; +typedef Bool (*PointerAccelSchemeInitProc)( + DeviceIntPtr /*dev*/, + struct _ValuatorAccelerationRec* /*protoScheme*/); + +typedef struct _DeviceRec { + pointer devicePrivate; + ProcessInputProc processInputProc; /* current */ + ProcessInputProc realInputProc; /* deliver */ + ProcessInputProc enqueueInputProc; /* enqueue */ + Bool on; /* used by DDX to keep state */ +} DeviceRec, *DevicePtr; + +typedef struct { + int click, bell, bell_pitch, bell_duration; + Bool autoRepeat; + unsigned char autoRepeats[32]; + Leds leds; + unsigned char id; +} KeybdCtrl; + +typedef struct { + KeySym *map; + KeyCode minKeyCode, + maxKeyCode; + int mapWidth; +} KeySymsRec, *KeySymsPtr; + +typedef struct { + int num, den, threshold; + unsigned char id; +} PtrCtrl; + +typedef struct { + int resolution, min_value, max_value; + int integer_displayed; + unsigned char id; +} IntegerCtrl; + +typedef struct { + int max_symbols, num_symbols_supported; + int num_symbols_displayed; + KeySym *symbols_supported; + KeySym *symbols_displayed; + unsigned char id; +} StringCtrl; + +typedef struct { + int percent, pitch, duration; + unsigned char id; +} BellCtrl; + +typedef struct { + Leds led_values; + Mask led_mask; + unsigned char id; +} LedCtrl; + +extern _X_EXPORT KeybdCtrl defaultKeyboardControl; +extern _X_EXPORT PtrCtrl defaultPointerControl; + +typedef struct _InputOption { + char *key; + char *value; + struct _InputOption *next; +} InputOption; + +typedef struct _InputAttributes { + char *product; + char *vendor; + char *device; + char *pnp_id; + char *usb_id; + char **tags; /* null-terminated */ + uint32_t flags; +} InputAttributes; + +#define ATTR_KEYBOARD (1<<0) +#define ATTR_POINTER (1<<1) +#define ATTR_JOYSTICK (1<<2) +#define ATTR_TABLET (1<<3) +#define ATTR_TOUCHPAD (1<<4) +#define ATTR_TOUCHSCREEN (1<<5) + +/* Key/Button has been run through all input processing and events sent to clients. */ +#define KEY_PROCESSED 1 +#define BUTTON_PROCESSED 1 +/* Key/Button has not been fully processed, no events have been sent. */ +#define KEY_POSTED 2 +#define BUTTON_POSTED 2 + +extern void set_key_down(DeviceIntPtr pDev, int key_code, int type); +extern void set_key_up(DeviceIntPtr pDev, int key_code, int type); +extern int key_is_down(DeviceIntPtr pDev, int key_code, int type); +extern void set_button_down(DeviceIntPtr pDev, int button, int type); +extern void set_button_up(DeviceIntPtr pDev, int button, int type); +extern int button_is_down(DeviceIntPtr pDev, int button, int type); + +extern void InitCoreDevices(void); +extern void InitXTestDevices(void); + +extern _X_EXPORT DeviceIntPtr AddInputDevice( + ClientPtr /*client*/, + DeviceProc /*deviceProc*/, + Bool /*autoStart*/); + +extern _X_EXPORT Bool EnableDevice( + DeviceIntPtr /*device*/, + BOOL /* sendevent */); + +extern _X_EXPORT Bool ActivateDevice( + DeviceIntPtr /*device*/, + BOOL /* sendevent */); + +extern _X_EXPORT Bool DisableDevice( + DeviceIntPtr /*device*/, + BOOL /* sendevent */); + +extern int InitAndStartDevices(void); + +extern void CloseDownDevices(void); + +extern void UndisplayDevices(void); + +extern _X_EXPORT int RemoveDevice( + DeviceIntPtr /*dev*/, + BOOL /* sendevent */); + +extern _X_EXPORT int NumMotionEvents(void); + +extern _X_EXPORT int dixLookupDevice( + DeviceIntPtr * /* dev */, + int /* id */, + ClientPtr /* client */, + Mask /* access_mode */); + +extern _X_EXPORT void QueryMinMaxKeyCodes( + KeyCode* /*minCode*/, + KeyCode* /*maxCode*/); + +extern _X_EXPORT Bool SetKeySymsMap( + KeySymsPtr /*dst*/, + KeySymsPtr /*src*/); + +extern _X_EXPORT Bool InitButtonClassDeviceStruct( + DeviceIntPtr /*device*/, + int /*numButtons*/, + Atom* /* labels */, + CARD8* /*map*/); + +extern _X_INTERNAL ValuatorClassPtr AllocValuatorClass( + ValuatorClassPtr src, + int numAxes); + +extern _X_EXPORT Bool InitValuatorClassDeviceStruct( + DeviceIntPtr /*device*/, + int /*numAxes*/, + Atom* /* labels */, + int /*numMotionEvents*/, + int /*mode*/); + +extern _X_EXPORT Bool InitPointerAccelerationScheme( + DeviceIntPtr /*dev*/, + int /*scheme*/); + +extern _X_EXPORT Bool InitFocusClassDeviceStruct( + DeviceIntPtr /*device*/); + +typedef void (*BellProcPtr)( + int /*percent*/, + DeviceIntPtr /*device*/, + pointer /*ctrl*/, + int); + +typedef void (*KbdCtrlProcPtr)( + DeviceIntPtr /*device*/, + KeybdCtrl * /*ctrl*/); + +typedef void (*PtrCtrlProcPtr)( + DeviceIntPtr /*device*/, + PtrCtrl * /*ctrl*/); + +extern _X_EXPORT Bool InitPtrFeedbackClassDeviceStruct( + DeviceIntPtr /*device*/, + PtrCtrlProcPtr /*controlProc*/); + +typedef void (*StringCtrlProcPtr)( + DeviceIntPtr /*device*/, + StringCtrl * /*ctrl*/); + +extern _X_EXPORT Bool InitStringFeedbackClassDeviceStruct( + DeviceIntPtr /*device*/, + StringCtrlProcPtr /*controlProc*/, + int /*max_symbols*/, + int /*num_symbols_supported*/, + KeySym* /*symbols*/); + +typedef void (*BellCtrlProcPtr)( + DeviceIntPtr /*device*/, + BellCtrl * /*ctrl*/); + +extern _X_EXPORT Bool InitBellFeedbackClassDeviceStruct( + DeviceIntPtr /*device*/, + BellProcPtr /*bellProc*/, + BellCtrlProcPtr /*controlProc*/); + +typedef void (*LedCtrlProcPtr)( + DeviceIntPtr /*device*/, + LedCtrl * /*ctrl*/); + +extern _X_EXPORT Bool InitLedFeedbackClassDeviceStruct( + DeviceIntPtr /*device*/, + LedCtrlProcPtr /*controlProc*/); + +typedef void (*IntegerCtrlProcPtr)( + DeviceIntPtr /*device*/, + IntegerCtrl * /*ctrl*/); + + +extern _X_EXPORT Bool InitIntegerFeedbackClassDeviceStruct( + DeviceIntPtr /*device*/, + IntegerCtrlProcPtr /*controlProc*/); + +extern _X_EXPORT Bool InitPointerDeviceStruct( + DevicePtr /*device*/, + CARD8* /*map*/, + int /*numButtons*/, + Atom* /* btn_labels */, + PtrCtrlProcPtr /*controlProc*/, + int /*numMotionEvents*/, + int /*numAxes*/, + Atom* /* axes_labels */); + +extern _X_EXPORT Bool InitKeyboardDeviceStruct( + DeviceIntPtr /*device*/, + XkbRMLVOSet * /*rmlvo*/, + BellProcPtr /*bellProc*/, + KbdCtrlProcPtr /*controlProc*/); + +extern int ApplyPointerMapping( + DeviceIntPtr /* pDev */, + CARD8 * /* map */, + int /* len */, + ClientPtr /* client */); + +extern Bool BadDeviceMap( + BYTE* /*buff*/, + int /*length*/, + unsigned /*low*/, + unsigned /*high*/, + XID* /*errval*/); + +extern void NoteLedState( + DeviceIntPtr /*keybd*/, + int /*led*/, + Bool /*on*/); + +extern void MaybeStopHint( + DeviceIntPtr /*device*/, + ClientPtr /*client*/); + +extern void ProcessPointerEvent( + InternalEvent* /* ev */, + DeviceIntPtr /*mouse*/); + +extern void ProcessKeyboardEvent( + InternalEvent* /*ev*/, + DeviceIntPtr /*keybd*/); + +extern Bool LegalModifier( + unsigned int /*key*/, + DeviceIntPtr /*pDev*/); + +extern _X_EXPORT void ProcessInputEvents(void); + +extern _X_EXPORT void InitInput( + int /*argc*/, + char ** /*argv*/); +extern _X_EXPORT void CloseInput(void); + +extern _X_EXPORT int GetMaximumEventsNum(void); + +extern _X_EXPORT InternalEvent *InitEventList(int num_events); +extern _X_EXPORT void FreeEventList(InternalEvent *list, int num_events); + +extern void CreateClassesChangedEvent(InternalEvent *event, + DeviceIntPtr master, + DeviceIntPtr slave, + int type); +extern InternalEvent * UpdateFromMaster( + InternalEvent *events, + DeviceIntPtr pDev, + int type, + int *num_events); + +extern _X_EXPORT int GetPointerEvents( + InternalEvent *events, + DeviceIntPtr pDev, + int type, + int buttons, + int flags, + const ValuatorMask *mask); + +extern _X_EXPORT void QueuePointerEvents( + DeviceIntPtr pDev, + int type, + int buttons, + int flags, + const ValuatorMask *mask); + +extern _X_EXPORT int GetKeyboardEvents( + InternalEvent *events, + DeviceIntPtr pDev, + int type, + int key_code, + const ValuatorMask *mask); + +extern _X_EXPORT void QueueKeyboardEvents( + DeviceIntPtr pDev, + int type, + int key_code, + const ValuatorMask *mask); + +extern int GetProximityEvents( + InternalEvent *events, + DeviceIntPtr pDev, + int type, + const ValuatorMask *mask); + +extern void QueueProximityEvents( + DeviceIntPtr pDev, + int type, + const ValuatorMask *mask); + +extern void PostSyntheticMotion( + DeviceIntPtr pDev, + int x, + int y, + int screen, + unsigned long time); + +extern _X_EXPORT int GetMotionHistorySize( + void); + +extern _X_EXPORT void AllocateMotionHistory( + DeviceIntPtr pDev); + +extern _X_EXPORT int GetMotionHistory( + DeviceIntPtr pDev, + xTimecoord **buff, + unsigned long start, + unsigned long stop, + ScreenPtr pScreen, + BOOL core); + +extern void ReleaseButtonsAndKeys(DeviceIntPtr dev); + +extern int AttachDevice(ClientPtr client, + DeviceIntPtr slave, + DeviceIntPtr master); + +extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd); +extern DeviceIntPtr GetMaster(DeviceIntPtr dev, int type); + +extern _X_EXPORT int AllocDevicePair(ClientPtr client, + char* name, + DeviceIntPtr* ptr, + DeviceIntPtr* keybd, + DeviceProc ptr_proc, + DeviceProc keybd_proc, + Bool master); +extern void DeepCopyDeviceClasses(DeviceIntPtr from, + DeviceIntPtr to, + DeviceChangedEvent *dce); + +/* Helper functions. */ +extern _X_EXPORT int generate_modkeymap(ClientPtr client, DeviceIntPtr dev, + KeyCode **modkeymap, int *max_keys_per_mod); +extern int change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *map, + int max_keys_per_mod); +extern int AllocXTestDevice(ClientPtr client, + char* name, + DeviceIntPtr* ptr, + DeviceIntPtr* keybd, + DeviceIntPtr master_ptr, + DeviceIntPtr master_keybd); +extern BOOL IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master); +extern DeviceIntPtr GetXTestDevice(DeviceIntPtr master); +extern void SendDevicePresenceEvent(int deviceid, int type); +extern _X_EXPORT InputAttributes *DuplicateInputAttributes(InputAttributes *attrs); +extern _X_EXPORT void FreeInputAttributes(InputAttributes *attrs); + +/* misc event helpers */ +extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients); +extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event); +extern Mask GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev); +void FixUpEventFromWindow(SpritePtr pSprite, + xEvent *xE, + WindowPtr pWin, + Window child, + Bool calcChild); +extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y); +extern int EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, + WindowPtr win); +/** + * Masks specifying the type of event to deliver for an InternalEvent; used + * by EventIsDeliverable. + * @defgroup EventIsDeliverable return flags + * @{ + */ +#define EVENT_XI1_MASK (1 << 0) /**< XI1.x event */ +#define EVENT_CORE_MASK (1 << 1) /**< Core event */ +#define EVENT_DONT_PROPAGATE_MASK (1 << 2) /**< DontPropagate mask set */ +#define EVENT_XI2_MASK (1 << 3) /**< XI2 mask set on window */ +/* @} */ + +/* Implemented by the DDX. */ +extern _X_EXPORT int NewInputDeviceRequest( + InputOption *options, + InputAttributes *attrs, + DeviceIntPtr *dev); +extern _X_EXPORT void DeleteInputDeviceRequest( + DeviceIntPtr dev); + +extern _X_EXPORT void DDXRingBell( + int volume, + int pitch, + int duration); + +#define VALUATOR_MODE_ALL_AXES -1 +extern _X_HIDDEN int valuator_get_mode(DeviceIntPtr dev, int axis); +extern _X_HIDDEN void valuator_set_mode(DeviceIntPtr dev, int axis, int mode); + +/* Set to TRUE by default - os/utils.c sets it to FALSE on user request, + xfixes/cursor.c uses it to determine if the cursor is enabled */ +extern Bool EnableCursor; + +extern _X_EXPORT ValuatorMask *valuator_mask_new(int num_valuators); +extern _X_EXPORT void valuator_mask_free(ValuatorMask **mask); +extern _X_EXPORT void valuator_mask_set_range(ValuatorMask *mask, + int first_valuator, int num_valuators, + const int* valuators); +extern _X_EXPORT void valuator_mask_set(ValuatorMask *mask, + int valuator, + int data); +extern _X_EXPORT void valuator_mask_zero(ValuatorMask *mask); +extern _X_EXPORT int valuator_mask_size(const ValuatorMask *mask); +extern _X_EXPORT int valuator_mask_isset(const ValuatorMask *mask, int bit); +extern _X_EXPORT void valuator_mask_unset(ValuatorMask *mask, int bit); +extern _X_EXPORT int valuator_mask_num_valuators(const ValuatorMask *mask); +extern _X_EXPORT void valuator_mask_copy(ValuatorMask *dest, + const ValuatorMask *src); +extern _X_EXPORT int valuator_mask_get(const ValuatorMask *mask, int valnum); + +#endif /* INPUT_H */ diff --git a/xorg-server/include/inputstr.h b/xorg-server/include/inputstr.h index a536a6a5a..00f72c260 100644 --- a/xorg-server/include/inputstr.h +++ b/xorg-server/include/inputstr.h @@ -1,602 +1,602 @@ -/************************************************************ - -Copyright 1987, 1998 The Open Group - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -********************************************************/ - - -#ifndef INPUTSTRUCT_H -#define INPUTSTRUCT_H - -#include -#include "input.h" -#include "window.h" -#include "dixstruct.h" -#include "cursorstr.h" -#include "geext.h" -#include "privates.h" - -#define BitIsOn(ptr, bit) (!!(((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))) -#define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7))) -#define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7))) -extern _X_EXPORT int CountBits(const uint8_t *mask, int len); - -#define SameClient(obj,client) \ - (CLIENT_BITS((obj)->resource) == (client)->clientAsMask) - -#define EMASKSIZE MAXDEVICES + 2 - -/* This is the last XI2 event supported by the server. If you add - * events to the protocol, the server will not support these events until - * this number here is bumped. - */ -#define XI2LASTEVENT 17 /* XI_RawMotion */ -#define XI2MASKSIZE ((XI2LASTEVENT + 7)/8) /* no of bits for masks */ - -/** - * This struct stores the core event mask for each client except the client - * that created the window. - * - * Each window that has events selected from other clients has at least one of - * these masks. If multiple clients selected for events on the same window, - * these masks are in a linked list. - * - * The event mask for the client that created the window is stored in - * win->eventMask instead. - * - * The resource id is simply a fake client ID to associate this mask with a - * client. - * - * Kludge: OtherClients and InputClients must be compatible, see code. - */ -typedef struct _OtherClients { - OtherClientsPtr next; /**< Pointer to the next mask */ - XID resource; /**< id for putting into resource manager */ - Mask mask; /**< Core event mask */ -} OtherClients; - -/** - * This struct stores the XI event mask for each client. - * - * Each window that has events selected has at least one of these masks. If - * multiple client selected for events on the same window, these masks are in - * a linked list. - */ -typedef struct _InputClients { - InputClientsPtr next; /**< Pointer to the next mask */ - XID resource; /**< id for putting into resource manager */ - Mask mask[EMASKSIZE]; /**< Actual XI event mask, deviceid is index */ - /** XI2 event masks. One per device, each bit is a mask of (1 << type) */ - unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE]; -} InputClients; - -/** - * Combined XI event masks from all devices. - * - * This is the XI equivalent of the deliverableEvents, eventMask and - * dontPropagate mask of the WindowRec (or WindowOptRec). - * - * A window that has an XI client selecting for events has exactly one - * OtherInputMasks struct and exactly one InputClients struct hanging off - * inputClients. Each further client appends to the inputClients list. - * Each Mask field is per-device, with the device id as the index. - * Exception: for non-device events (Presence events), the MAXDEVICES - * deviceid is used. - */ -typedef struct _OtherInputMasks { - /** - * Bitwise OR of all masks by all clients and the window's parent's masks. - */ - Mask deliverableEvents[EMASKSIZE]; - /** - * Bitwise OR of all masks by all clients on this window. - */ - Mask inputEvents[EMASKSIZE]; - /** The do-not-propagate masks for each device. */ - Mask dontPropagateMask[EMASKSIZE]; - /** The clients that selected for events */ - InputClientsPtr inputClients; - /* XI2 event masks. One per device, each bit is a mask of (1 << type) */ - unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE]; -} OtherInputMasks; - -/* - * The following structure gets used for both active and passive grabs. For - * active grabs some of the fields (e.g. modifiers) are not used. However, - * that is not much waste since there aren't many active grabs (one per - * keyboard/pointer device) going at once in the server. - */ - -#define MasksPerDetailMask 8 /* 256 keycodes and 256 possible - modifier combinations, but only - 3 buttons. */ - -typedef struct _DetailRec { /* Grab details may be bit masks */ - unsigned int exact; - Mask *pMask; -} DetailRec; - -typedef enum { - GRABTYPE_CORE, - GRABTYPE_XI, - GRABTYPE_XI2 -} GrabType; - -union _GrabMask { - Mask core; - Mask xi; - char xi2mask[EMASKSIZE][XI2MASKSIZE]; -}; - -/** - * Central struct for device grabs. - * The same struct is used for both core grabs and device grabs, with - * different fields being set. - * If the grab is a core grab (GrabPointer/GrabKeyboard), then the eventMask - * is a combination of standard event masks (i.e. PointerMotionMask | - * ButtonPressMask). - * If the grab is a device grab (GrabDevice), then the eventMask is a - * combination of event masks for a given XI event type (see SetEventInfo). - * - * If the grab is a result of a ButtonPress, then eventMask is the core mask - * and deviceMask is set to the XI event mask for the grab. - */ -typedef struct _GrabRec { - GrabPtr next; /* for chain of passive grabs */ - XID resource; - DeviceIntPtr device; - WindowPtr window; - unsigned ownerEvents:1; - unsigned keyboardMode:1; - unsigned pointerMode:1; - GrabType grabtype; - CARD8 type; /* event type */ - DetailRec modifiersDetail; - DeviceIntPtr modifierDevice; - DetailRec detail; /* key or button */ - WindowPtr confineTo; /* always NULL for keyboards */ - CursorPtr cursor; /* always NULL for keyboards */ - Mask eventMask; - Mask deviceMask; - /* XI2 event masks. One per device, each bit is a mask of (1 << type) */ - unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE]; -} GrabRec; - -/** - * Sprite information for a device. - */ -typedef struct _SpriteRec { - CursorPtr current; - BoxRec hotLimits; /* logical constraints of hot spot */ - Bool confined; /* confined to screen */ - RegionPtr hotShape; /* additional logical shape constraint */ - BoxRec physLimits; /* physical constraints of hot spot */ - WindowPtr win; /* window of logical position */ - HotSpot hot; /* logical pointer position */ - HotSpot hotPhys; /* physical pointer position */ -#ifdef PANORAMIX - ScreenPtr screen; /* all others are in Screen 0 coordinates */ - RegionRec Reg1; /* Region 1 for confining motion */ - RegionRec Reg2; /* Region 2 for confining virtual motion */ - WindowPtr windows[MAXSCREENS]; - WindowPtr confineWin; /* confine window */ -#endif - /* The window trace information is used at dix/events.c to avoid having - * to compute all the windows between the root and the current pointer - * window each time a button or key goes down. The grabs on each of those - * windows must be checked. - * spriteTraces should only be used at dix/events.c! */ - WindowPtr *spriteTrace; - int spriteTraceSize; - int spriteTraceGood; - - /* Due to delays between event generation and event processing, it is - * possible that the pointer has crossed screen boundaries between the - * time in which it begins generating events and the time when - * those events are processed. - * - * pEnqueueScreen: screen the pointer was on when the event was generated - * pDequeueScreen: screen the pointer was on when the event is processed - */ - ScreenPtr pEnqueueScreen; - ScreenPtr pDequeueScreen; - -} SpriteRec; - -typedef struct _KeyClassRec { - int sourceid; - CARD8 down[DOWN_LENGTH]; - CARD8 postdown[DOWN_LENGTH]; - int modifierKeyCount[8]; - struct _XkbSrvInfo *xkbInfo; -} KeyClassRec, *KeyClassPtr; - -typedef struct _AxisInfo { - int resolution; - int min_resolution; - int max_resolution; - int min_value; - int max_value; - Atom label; - CARD8 mode; -} AxisInfo, *AxisInfoPtr; - -typedef struct _ValuatorAccelerationRec { - int number; - PointerAccelSchemeProc AccelSchemeProc; - void *accelData; /* at disposal of AccelScheme */ - PointerAccelSchemeInitProc AccelInitProc; - DeviceCallbackProc AccelCleanupProc; -} ValuatorAccelerationRec, *ValuatorAccelerationPtr; - -typedef struct _ValuatorClassRec { - int sourceid; - int numMotionEvents; - int first_motion; - int last_motion; - void *motion; /* motion history buffer. Different layout - for MDs and SDs!*/ - WindowPtr motionHintWindow; - - AxisInfoPtr axes; - unsigned short numAxes; - double *axisVal; /* always absolute, but device-coord system */ - ValuatorAccelerationRec accelScheme; -} ValuatorClassRec; - -typedef struct _ButtonClassRec { - int sourceid; - CARD8 numButtons; - CARD8 buttonsDown; /* number of buttons currently down - This counts logical buttons, not - physical ones, i.e if some buttons - are mapped to 0, they're not counted - here */ - unsigned short state; - Mask motionMask; - CARD8 down[DOWN_LENGTH]; - CARD8 postdown[DOWN_LENGTH]; - CARD8 map[MAP_LENGTH]; - union _XkbAction *xkb_acts; - Atom labels[MAX_BUTTONS]; -} ButtonClassRec, *ButtonClassPtr; - -typedef struct _FocusClassRec { - int sourceid; - WindowPtr win; /* May be set to a int constant (e.g. PointerRootWin)! */ - int revert; - TimeStamp time; - WindowPtr *trace; - int traceSize; - int traceGood; -} FocusClassRec, *FocusClassPtr; - -typedef struct _ProximityClassRec { - int sourceid; - char in_proximity; -} ProximityClassRec, *ProximityClassPtr; - -typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr; -typedef struct _PtrFeedbackClassRec *PtrFeedbackPtr; -typedef struct _IntegerFeedbackClassRec *IntegerFeedbackPtr; -typedef struct _StringFeedbackClassRec *StringFeedbackPtr; -typedef struct _BellFeedbackClassRec *BellFeedbackPtr; -typedef struct _LedFeedbackClassRec *LedFeedbackPtr; - -typedef struct _KbdFeedbackClassRec { - BellProcPtr BellProc; - KbdCtrlProcPtr CtrlProc; - KeybdCtrl ctrl; - KbdFeedbackPtr next; - struct _XkbSrvLedInfo *xkb_sli; -} KbdFeedbackClassRec; - -typedef struct _PtrFeedbackClassRec { - PtrCtrlProcPtr CtrlProc; - PtrCtrl ctrl; - PtrFeedbackPtr next; -} PtrFeedbackClassRec; - -typedef struct _IntegerFeedbackClassRec { - IntegerCtrlProcPtr CtrlProc; - IntegerCtrl ctrl; - IntegerFeedbackPtr next; -} IntegerFeedbackClassRec; - -typedef struct _StringFeedbackClassRec { - StringCtrlProcPtr CtrlProc; - StringCtrl ctrl; - StringFeedbackPtr next; -} StringFeedbackClassRec; - -typedef struct _BellFeedbackClassRec { - BellProcPtr BellProc; - BellCtrlProcPtr CtrlProc; - BellCtrl ctrl; - BellFeedbackPtr next; -} BellFeedbackClassRec; - -typedef struct _LedFeedbackClassRec { - LedCtrlProcPtr CtrlProc; - LedCtrl ctrl; - LedFeedbackPtr next; - struct _XkbSrvLedInfo *xkb_sli; -} LedFeedbackClassRec; - - -typedef struct _ClassesRec { - KeyClassPtr key; - ValuatorClassPtr valuator; - ButtonClassPtr button; - FocusClassPtr focus; - ProximityClassPtr proximity; - KbdFeedbackPtr kbdfeed; - PtrFeedbackPtr ptrfeed; - IntegerFeedbackPtr intfeed; - StringFeedbackPtr stringfeed; - BellFeedbackPtr bell; - LedFeedbackPtr leds; -} ClassesRec; - - -/* Device properties */ -typedef struct _XIPropertyValue -{ - Atom type; /* ignored by server */ - short format; /* format of data for swapping - 8,16,32 */ - long size; /* size of data in (format/8) bytes */ - pointer data; /* private to client */ -} XIPropertyValueRec; - -typedef struct _XIProperty -{ - struct _XIProperty *next; - Atom propertyName; - BOOL deletable; /* clients can delete this prop? */ - XIPropertyValueRec value; -} XIPropertyRec; - -typedef XIPropertyRec *XIPropertyPtr; -typedef XIPropertyValueRec *XIPropertyValuePtr; - - -typedef struct _XIPropertyHandler -{ - struct _XIPropertyHandler* next; - long id; - int (*SetProperty) (DeviceIntPtr dev, - Atom property, - XIPropertyValuePtr prop, - BOOL checkonly); - int (*GetProperty) (DeviceIntPtr dev, - Atom property); - int (*DeleteProperty) (DeviceIntPtr dev, - Atom property); -} XIPropertyHandler, *XIPropertyHandlerPtr; - -/* states for devices */ - -#define NOT_GRABBED 0 -#define THAWED 1 -#define THAWED_BOTH 2 /* not a real state */ -#define FREEZE_NEXT_EVENT 3 -#define FREEZE_BOTH_NEXT_EVENT 4 -#define FROZEN 5 /* any state >= has device frozen */ -#define FROZEN_NO_EVENT 5 -#define FROZEN_WITH_EVENT 6 -#define THAW_OTHERS 7 - - -typedef struct _GrabInfoRec { - TimeStamp grabTime; - Bool fromPassiveGrab; /* true if from passive grab */ - Bool implicitGrab; /* implicit from ButtonPress */ - GrabRec activeGrab; - GrabPtr grab; - CARD8 activatingKey; - void (*ActivateGrab) ( - DeviceIntPtr /*device*/, - GrabPtr /*grab*/, - TimeStamp /*time*/, - Bool /*autoGrab*/); - void (*DeactivateGrab)( - DeviceIntPtr /*device*/); - struct { - Bool frozen; - int state; - GrabPtr other; /* if other grab has this frozen */ - DeviceEvent *event; /* saved to be replayed */ - } sync; -} GrabInfoRec, *GrabInfoPtr; - -typedef struct _SpriteInfoRec { - /* sprite must always point to a valid sprite. For devices sharing the - * sprite, let sprite point to a paired spriteOwner's sprite. */ - SpritePtr sprite; /* sprite information */ - Bool spriteOwner; /* True if device owns the sprite */ - DeviceIntPtr paired; /* The paired device. Keyboard if - spriteOwner is TRUE, otherwise the - pointer that owns the sprite. */ - - /* keep states for animated cursor */ - struct { - CursorPtr pCursor; - ScreenPtr pScreen; - int elt; - CARD32 time; - } anim; -} SpriteInfoRec, *SpriteInfoPtr; - -/* device types */ -#define MASTER_POINTER 1 -#define MASTER_KEYBOARD 2 -#define SLAVE 3 -#define MASTER_ATTACHED 4 /* special type for GetMaster */ - -typedef struct _DeviceIntRec { - DeviceRec public; - DeviceIntPtr next; - Bool startup; /* true if needs to be turned on at - server intialization time */ - DeviceProc deviceProc; /* proc(DevicePtr, DEVICE_xx). It is - used to initialize, turn on, or - turn off the device */ - Bool inited; /* TRUE if INIT returns Success */ - Bool enabled; /* TRUE if ON returns Success */ - Bool coreEvents; /* TRUE if device also sends core */ - GrabInfoRec deviceGrab; /* grab on the device */ - int type; /* MASTER_POINTER, MASTER_KEYBOARD, SLAVE */ - Atom xinput_type; - char *name; - int id; - KeyClassPtr key; - ValuatorClassPtr valuator; - ButtonClassPtr button; - FocusClassPtr focus; - ProximityClassPtr proximity; - KbdFeedbackPtr kbdfeed; - PtrFeedbackPtr ptrfeed; - IntegerFeedbackPtr intfeed; - StringFeedbackPtr stringfeed; - BellFeedbackPtr bell; - LedFeedbackPtr leds; - struct _XkbInterest *xkb_interest; - char *config_info; /* used by the hotplug layer */ - ClassesPtr unused_classes; /* for master devices */ - int saved_master_id; /* for slaves while grabbed */ - PrivateRec *devPrivates; - DeviceUnwrapProc unwrapProc; - SpriteInfoPtr spriteInfo; - DeviceIntPtr master; /* master device */ - DeviceIntPtr lastSlave; /* last slave device used */ - - /* last valuator values recorded, not posted to client; - * for slave devices, valuators is in device coordinates - * for master devices, valuators is in screen coordinates - * see dix/getevents.c - * remainder supports acceleration - */ - struct { - int valuators[MAX_VALUATORS]; - float remainder[MAX_VALUATORS]; - int numValuators; - DeviceIntPtr slave; - } last; - - /* Input device property handling. */ - struct { - XIPropertyPtr properties; - XIPropertyHandlerPtr handlers; /* NULL-terminated */ - } properties; - - /* coordinate transformation matrix for absolute input devices */ - struct pixman_f_transform transform; - - /* XTest related master device id */ - int xtest_master_id; -} DeviceIntRec; - -typedef struct { - int numDevices; /* total number of devices */ - DeviceIntPtr devices; /* all devices turned on */ - DeviceIntPtr off_devices; /* all devices turned off */ - DeviceIntPtr keyboard; /* the main one for the server */ - DeviceIntPtr pointer; - DeviceIntPtr all_devices; - DeviceIntPtr all_master_devices; -} InputInfo; - -extern _X_EXPORT InputInfo inputInfo; - -/* for keeping the events for devices grabbed synchronously */ -typedef struct _QdEvent *QdEventPtr; -typedef struct _QdEvent { - QdEventPtr next; - DeviceIntPtr device; - ScreenPtr pScreen; /* what screen the pointer was on */ - unsigned long months; /* milliseconds is in the event */ - InternalEvent *event; -} QdEventRec; - -/** - * syncEvents is the global structure for queued events. - * - * Devices can be frozen through GrabModeSync pointer grabs. If this is the - * case, events from these devices are added to "pending" instead of being - * processed normally. When the device is unfrozen, events in "pending" are - * replayed and processed as if they would come from the device directly. - */ -typedef struct _EventSyncInfo { - QdEventPtr pending, /**< list of queued events */ - *pendtail; /**< last event in list */ - /** The device to replay events for. Only set in AllowEvents(), in which - * case it is set to the device specified in the request. */ - DeviceIntPtr replayDev; /* kludgy rock to put flag for */ - - /** - * The window the events are supposed to be replayed on. - * This window may be set to the grab's window (but only when - * Replay{Pointer|Keyboard} is given in the XAllowEvents() - * request. */ - WindowPtr replayWin; /* ComputeFreezes */ - /** - * Flag to indicate whether we're in the process of - * replaying events. Only set in ComputeFreezes(). */ - Bool playingEvents; - TimeStamp time; -} EventSyncInfoRec, *EventSyncInfoPtr; - -extern EventSyncInfoRec syncEvents; - -/** - * Given a sprite, returns the window at the bottom of the trace (i.e. the - * furthest window from the root). - */ -static inline WindowPtr DeepestSpriteWin(SpritePtr sprite) -{ - assert(sprite->spriteTraceGood > 0); - return sprite->spriteTrace[sprite->spriteTraceGood - 1]; -} - -#endif /* INPUTSTRUCT_H */ +/************************************************************ + +Copyright 1987, 1998 The Open Group + +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 +OPEN GROUP 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 Open Group 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 Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + + +#ifndef INPUTSTRUCT_H +#define INPUTSTRUCT_H + +#include +#include "input.h" +#include "window.h" +#include "dixstruct.h" +#include "cursorstr.h" +#include "geext.h" +#include "privates.h" + +#define BitIsOn(ptr, bit) (!!(((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))) +#define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7))) +#define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7))) +extern _X_EXPORT int CountBits(const uint8_t *mask, int len); + +#define SameClient(obj,client) \ + (CLIENT_BITS((obj)->resource) == (client)->clientAsMask) + +#define EMASKSIZE MAXDEVICES + 2 + +/* This is the last XI2 event supported by the server. If you add + * events to the protocol, the server will not support these events until + * this number here is bumped. + */ +#define XI2LASTEVENT 17 /* XI_RawMotion */ +#define XI2MASKSIZE ((XI2LASTEVENT + 7)/8) /* no of bits for masks */ + +/** + * This struct stores the core event mask for each client except the client + * that created the window. + * + * Each window that has events selected from other clients has at least one of + * these masks. If multiple clients selected for events on the same window, + * these masks are in a linked list. + * + * The event mask for the client that created the window is stored in + * win->eventMask instead. + * + * The resource id is simply a fake client ID to associate this mask with a + * client. + * + * Kludge: OtherClients and InputClients must be compatible, see code. + */ +typedef struct _OtherClients { + OtherClientsPtr next; /**< Pointer to the next mask */ + XID resource; /**< id for putting into resource manager */ + Mask mask; /**< Core event mask */ +} OtherClients; + +/** + * This struct stores the XI event mask for each client. + * + * Each window that has events selected has at least one of these masks. If + * multiple client selected for events on the same window, these masks are in + * a linked list. + */ +typedef struct _InputClients { + InputClientsPtr next; /**< Pointer to the next mask */ + XID resource; /**< id for putting into resource manager */ + Mask mask[EMASKSIZE]; /**< Actual XI event mask, deviceid is index */ + /** XI2 event masks. One per device, each bit is a mask of (1 << type) */ + unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE]; +} InputClients; + +/** + * Combined XI event masks from all devices. + * + * This is the XI equivalent of the deliverableEvents, eventMask and + * dontPropagate mask of the WindowRec (or WindowOptRec). + * + * A window that has an XI client selecting for events has exactly one + * OtherInputMasks struct and exactly one InputClients struct hanging off + * inputClients. Each further client appends to the inputClients list. + * Each Mask field is per-device, with the device id as the index. + * Exception: for non-device events (Presence events), the MAXDEVICES + * deviceid is used. + */ +typedef struct _OtherInputMasks { + /** + * Bitwise OR of all masks by all clients and the window's parent's masks. + */ + Mask deliverableEvents[EMASKSIZE]; + /** + * Bitwise OR of all masks by all clients on this window. + */ + Mask inputEvents[EMASKSIZE]; + /** The do-not-propagate masks for each device. */ + Mask dontPropagateMask[EMASKSIZE]; + /** The clients that selected for events */ + InputClientsPtr inputClients; + /* XI2 event masks. One per device, each bit is a mask of (1 << type) */ + unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE]; +} OtherInputMasks; + +/* + * The following structure gets used for both active and passive grabs. For + * active grabs some of the fields (e.g. modifiers) are not used. However, + * that is not much waste since there aren't many active grabs (one per + * keyboard/pointer device) going at once in the server. + */ + +#define MasksPerDetailMask 8 /* 256 keycodes and 256 possible + modifier combinations, but only + 3 buttons. */ + +typedef struct _DetailRec { /* Grab details may be bit masks */ + unsigned int exact; + Mask *pMask; +} DetailRec; + +typedef enum { + GRABTYPE_CORE, + GRABTYPE_XI, + GRABTYPE_XI2 +} GrabType; + +union _GrabMask { + Mask core; + Mask xi; + char xi2mask[EMASKSIZE][XI2MASKSIZE]; +}; + +/** + * Central struct for device grabs. + * The same struct is used for both core grabs and device grabs, with + * different fields being set. + * If the grab is a core grab (GrabPointer/GrabKeyboard), then the eventMask + * is a combination of standard event masks (i.e. PointerMotionMask | + * ButtonPressMask). + * If the grab is a device grab (GrabDevice), then the eventMask is a + * combination of event masks for a given XI event type (see SetEventInfo). + * + * If the grab is a result of a ButtonPress, then eventMask is the core mask + * and deviceMask is set to the XI event mask for the grab. + */ +typedef struct _GrabRec { + GrabPtr next; /* for chain of passive grabs */ + XID resource; + DeviceIntPtr device; + WindowPtr window; + unsigned ownerEvents:1; + unsigned keyboardMode:1; + unsigned pointerMode:1; + GrabType grabtype; + CARD8 type; /* event type */ + DetailRec modifiersDetail; + DeviceIntPtr modifierDevice; + DetailRec detail; /* key or button */ + WindowPtr confineTo; /* always NULL for keyboards */ + CursorPtr cursor; /* always NULL for keyboards */ + Mask eventMask; + Mask deviceMask; + /* XI2 event masks. One per device, each bit is a mask of (1 << type) */ + unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE]; +} GrabRec; + +/** + * Sprite information for a device. + */ +typedef struct _SpriteRec { + CursorPtr current; + BoxRec hotLimits; /* logical constraints of hot spot */ + Bool confined; /* confined to screen */ + RegionPtr hotShape; /* additional logical shape constraint */ + BoxRec physLimits; /* physical constraints of hot spot */ + WindowPtr win; /* window of logical position */ + HotSpot hot; /* logical pointer position */ + HotSpot hotPhys; /* physical pointer position */ +#ifdef PANORAMIX + ScreenPtr screen; /* all others are in Screen 0 coordinates */ + RegionRec Reg1; /* Region 1 for confining motion */ + RegionRec Reg2; /* Region 2 for confining virtual motion */ + WindowPtr windows[MAXSCREENS]; + WindowPtr confineWin; /* confine window */ +#endif + /* The window trace information is used at dix/events.c to avoid having + * to compute all the windows between the root and the current pointer + * window each time a button or key goes down. The grabs on each of those + * windows must be checked. + * spriteTraces should only be used at dix/events.c! */ + WindowPtr *spriteTrace; + int spriteTraceSize; + int spriteTraceGood; + + /* Due to delays between event generation and event processing, it is + * possible that the pointer has crossed screen boundaries between the + * time in which it begins generating events and the time when + * those events are processed. + * + * pEnqueueScreen: screen the pointer was on when the event was generated + * pDequeueScreen: screen the pointer was on when the event is processed + */ + ScreenPtr pEnqueueScreen; + ScreenPtr pDequeueScreen; + +} SpriteRec; + +typedef struct _KeyClassRec { + int sourceid; + CARD8 down[DOWN_LENGTH]; + CARD8 postdown[DOWN_LENGTH]; + int modifierKeyCount[8]; + struct _XkbSrvInfo *xkbInfo; +} KeyClassRec, *KeyClassPtr; + +typedef struct _AxisInfo { + int resolution; + int min_resolution; + int max_resolution; + int min_value; + int max_value; + Atom label; + CARD8 mode; +} AxisInfo, *AxisInfoPtr; + +typedef struct _ValuatorAccelerationRec { + int number; + PointerAccelSchemeProc AccelSchemeProc; + void *accelData; /* at disposal of AccelScheme */ + PointerAccelSchemeInitProc AccelInitProc; + DeviceCallbackProc AccelCleanupProc; +} ValuatorAccelerationRec, *ValuatorAccelerationPtr; + +typedef struct _ValuatorClassRec { + int sourceid; + int numMotionEvents; + int first_motion; + int last_motion; + void *motion; /* motion history buffer. Different layout + for MDs and SDs!*/ + WindowPtr motionHintWindow; + + AxisInfoPtr axes; + unsigned short numAxes; + double *axisVal; /* always absolute, but device-coord system */ + ValuatorAccelerationRec accelScheme; +} ValuatorClassRec; + +typedef struct _ButtonClassRec { + int sourceid; + CARD8 numButtons; + CARD8 buttonsDown; /* number of buttons currently down + This counts logical buttons, not + physical ones, i.e if some buttons + are mapped to 0, they're not counted + here */ + unsigned short state; + Mask motionMask; + CARD8 down[DOWN_LENGTH]; + CARD8 postdown[DOWN_LENGTH]; + CARD8 map[MAP_LENGTH]; + union _XkbAction *xkb_acts; + Atom labels[MAX_BUTTONS]; +} ButtonClassRec, *ButtonClassPtr; + +typedef struct _FocusClassRec { + int sourceid; + WindowPtr win; /* May be set to a int constant (e.g. PointerRootWin)! */ + int revert; + TimeStamp time; + WindowPtr *trace; + int traceSize; + int traceGood; +} FocusClassRec, *FocusClassPtr; + +typedef struct _ProximityClassRec { + int sourceid; + char in_proximity; +} ProximityClassRec, *ProximityClassPtr; + +typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr; +typedef struct _PtrFeedbackClassRec *PtrFeedbackPtr; +typedef struct _IntegerFeedbackClassRec *IntegerFeedbackPtr; +typedef struct _StringFeedbackClassRec *StringFeedbackPtr; +typedef struct _BellFeedbackClassRec *BellFeedbackPtr; +typedef struct _LedFeedbackClassRec *LedFeedbackPtr; + +typedef struct _KbdFeedbackClassRec { + BellProcPtr BellProc; + KbdCtrlProcPtr CtrlProc; + KeybdCtrl ctrl; + KbdFeedbackPtr next; + struct _XkbSrvLedInfo *xkb_sli; +} KbdFeedbackClassRec; + +typedef struct _PtrFeedbackClassRec { + PtrCtrlProcPtr CtrlProc; + PtrCtrl ctrl; + PtrFeedbackPtr next; +} PtrFeedbackClassRec; + +typedef struct _IntegerFeedbackClassRec { + IntegerCtrlProcPtr CtrlProc; + IntegerCtrl ctrl; + IntegerFeedbackPtr next; +} IntegerFeedbackClassRec; + +typedef struct _StringFeedbackClassRec { + StringCtrlProcPtr CtrlProc; + StringCtrl ctrl; + StringFeedbackPtr next; +} StringFeedbackClassRec; + +typedef struct _BellFeedbackClassRec { + BellProcPtr BellProc; + BellCtrlProcPtr CtrlProc; + BellCtrl ctrl; + BellFeedbackPtr next; +} BellFeedbackClassRec; + +typedef struct _LedFeedbackClassRec { + LedCtrlProcPtr CtrlProc; + LedCtrl ctrl; + LedFeedbackPtr next; + struct _XkbSrvLedInfo *xkb_sli; +} LedFeedbackClassRec; + + +typedef struct _ClassesRec { + KeyClassPtr key; + ValuatorClassPtr valuator; + ButtonClassPtr button; + FocusClassPtr focus; + ProximityClassPtr proximity; + KbdFeedbackPtr kbdfeed; + PtrFeedbackPtr ptrfeed; + IntegerFeedbackPtr intfeed; + StringFeedbackPtr stringfeed; + BellFeedbackPtr bell; + LedFeedbackPtr leds; +} ClassesRec; + + +/* Device properties */ +typedef struct _XIPropertyValue +{ + Atom type; /* ignored by server */ + short format; /* format of data for swapping - 8,16,32 */ + long size; /* size of data in (format/8) bytes */ + pointer data; /* private to client */ +} XIPropertyValueRec; + +typedef struct _XIProperty +{ + struct _XIProperty *next; + Atom propertyName; + BOOL deletable; /* clients can delete this prop? */ + XIPropertyValueRec value; +} XIPropertyRec; + +typedef XIPropertyRec *XIPropertyPtr; +typedef XIPropertyValueRec *XIPropertyValuePtr; + + +typedef struct _XIPropertyHandler +{ + struct _XIPropertyHandler* next; + long id; + int (*SetProperty) (DeviceIntPtr dev, + Atom property, + XIPropertyValuePtr prop, + BOOL checkonly); + int (*GetProperty) (DeviceIntPtr dev, + Atom property); + int (*DeleteProperty) (DeviceIntPtr dev, + Atom property); +} XIPropertyHandler, *XIPropertyHandlerPtr; + +/* states for devices */ + +#define NOT_GRABBED 0 +#define THAWED 1 +#define THAWED_BOTH 2 /* not a real state */ +#define FREEZE_NEXT_EVENT 3 +#define FREEZE_BOTH_NEXT_EVENT 4 +#define FROZEN 5 /* any state >= has device frozen */ +#define FROZEN_NO_EVENT 5 +#define FROZEN_WITH_EVENT 6 +#define THAW_OTHERS 7 + + +typedef struct _GrabInfoRec { + TimeStamp grabTime; + Bool fromPassiveGrab; /* true if from passive grab */ + Bool implicitGrab; /* implicit from ButtonPress */ + GrabRec activeGrab; + GrabPtr grab; + CARD8 activatingKey; + void (*ActivateGrab) ( + DeviceIntPtr /*device*/, + GrabPtr /*grab*/, + TimeStamp /*time*/, + Bool /*autoGrab*/); + void (*DeactivateGrab)( + DeviceIntPtr /*device*/); + struct { + Bool frozen; + int state; + GrabPtr other; /* if other grab has this frozen */ + DeviceEvent *event; /* saved to be replayed */ + } sync; +} GrabInfoRec, *GrabInfoPtr; + +typedef struct _SpriteInfoRec { + /* sprite must always point to a valid sprite. For devices sharing the + * sprite, let sprite point to a paired spriteOwner's sprite. */ + SpritePtr sprite; /* sprite information */ + Bool spriteOwner; /* True if device owns the sprite */ + DeviceIntPtr paired; /* The paired device. Keyboard if + spriteOwner is TRUE, otherwise the + pointer that owns the sprite. */ + + /* keep states for animated cursor */ + struct { + CursorPtr pCursor; + ScreenPtr pScreen; + int elt; + CARD32 time; + } anim; +} SpriteInfoRec, *SpriteInfoPtr; + +/* device types */ +#define MASTER_POINTER 1 +#define MASTER_KEYBOARD 2 +#define SLAVE 3 +#define MASTER_ATTACHED 4 /* special type for GetMaster */ + +typedef struct _DeviceIntRec { + DeviceRec public; + DeviceIntPtr next; + Bool startup; /* true if needs to be turned on at + server intialization time */ + DeviceProc deviceProc; /* proc(DevicePtr, DEVICE_xx). It is + used to initialize, turn on, or + turn off the device */ + Bool inited; /* TRUE if INIT returns Success */ + Bool enabled; /* TRUE if ON returns Success */ + Bool coreEvents; /* TRUE if device also sends core */ + GrabInfoRec deviceGrab; /* grab on the device */ + int type; /* MASTER_POINTER, MASTER_KEYBOARD, SLAVE */ + Atom xinput_type; + char *name; + int id; + KeyClassPtr key; + ValuatorClassPtr valuator; + ButtonClassPtr button; + FocusClassPtr focus; + ProximityClassPtr proximity; + KbdFeedbackPtr kbdfeed; + PtrFeedbackPtr ptrfeed; + IntegerFeedbackPtr intfeed; + StringFeedbackPtr stringfeed; + BellFeedbackPtr bell; + LedFeedbackPtr leds; + struct _XkbInterest *xkb_interest; + char *config_info; /* used by the hotplug layer */ + ClassesPtr unused_classes; /* for master devices */ + int saved_master_id; /* for slaves while grabbed */ + PrivateRec *devPrivates; + DeviceUnwrapProc unwrapProc; + SpriteInfoPtr spriteInfo; + DeviceIntPtr master; /* master device */ + DeviceIntPtr lastSlave; /* last slave device used */ + + /* last valuator values recorded, not posted to client; + * for slave devices, valuators is in device coordinates + * for master devices, valuators is in screen coordinates + * see dix/getevents.c + * remainder supports acceleration + */ + struct { + int valuators[MAX_VALUATORS]; + float remainder[MAX_VALUATORS]; + int numValuators; + DeviceIntPtr slave; + } last; + + /* Input device property handling. */ + struct { + XIPropertyPtr properties; + XIPropertyHandlerPtr handlers; /* NULL-terminated */ + } properties; + + /* coordinate transformation matrix for absolute input devices */ + struct pixman_f_transform transform; + + /* XTest related master device id */ + int xtest_master_id; +} DeviceIntRec; + +typedef struct { + int numDevices; /* total number of devices */ + DeviceIntPtr devices; /* all devices turned on */ + DeviceIntPtr off_devices; /* all devices turned off */ + DeviceIntPtr keyboard; /* the main one for the server */ + DeviceIntPtr pointer; + DeviceIntPtr all_devices; + DeviceIntPtr all_master_devices; +} InputInfo; + +extern _X_EXPORT InputInfo inputInfo; + +/* for keeping the events for devices grabbed synchronously */ +typedef struct _QdEvent *QdEventPtr; +typedef struct _QdEvent { + QdEventPtr next; + DeviceIntPtr device; + ScreenPtr pScreen; /* what screen the pointer was on */ + unsigned long months; /* milliseconds is in the event */ + InternalEvent *event; +} QdEventRec; + +/** + * syncEvents is the global structure for queued events. + * + * Devices can be frozen through GrabModeSync pointer grabs. If this is the + * case, events from these devices are added to "pending" instead of being + * processed normally. When the device is unfrozen, events in "pending" are + * replayed and processed as if they would come from the device directly. + */ +typedef struct _EventSyncInfo { + QdEventPtr pending, /**< list of queued events */ + *pendtail; /**< last event in list */ + /** The device to replay events for. Only set in AllowEvents(), in which + * case it is set to the device specified in the request. */ + DeviceIntPtr replayDev; /* kludgy rock to put flag for */ + + /** + * The window the events are supposed to be replayed on. + * This window may be set to the grab's window (but only when + * Replay{Pointer|Keyboard} is given in the XAllowEvents() + * request. */ + WindowPtr replayWin; /* ComputeFreezes */ + /** + * Flag to indicate whether we're in the process of + * replaying events. Only set in ComputeFreezes(). */ + Bool playingEvents; + TimeStamp time; +} EventSyncInfoRec, *EventSyncInfoPtr; + +extern EventSyncInfoRec syncEvents; + +/** + * Given a sprite, returns the window at the bottom of the trace (i.e. the + * furthest window from the root). + */ +static inline WindowPtr DeepestSpriteWin(SpritePtr sprite) +{ + assert(sprite->spriteTraceGood > 0); + return sprite->spriteTrace[sprite->spriteTraceGood - 1]; +} + +#endif /* INPUTSTRUCT_H */ diff --git a/xorg-server/include/inpututils.h b/xorg-server/include/inpututils.h index 0e8488af5..92a754327 100644 --- a/xorg-server/include/inpututils.h +++ b/xorg-server/include/inpututils.h @@ -1,42 +1,42 @@ -/* - * Copyright © 2010 Red Hat, Inc. - * - * 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. - * - */ - -#ifdef HAVE_DIX_CONFIG_H -#include "dix-config.h" -#endif - -#ifndef INPUTUTILS_H -#define INPUTUTILS_H - -#include "input.h" - -struct _ValuatorMask { - int8_t last_bit; /* highest bit set in mask */ - uint8_t mask[(MAX_VALUATORS + 7)/8]; - int valuators[MAX_VALUATORS]; /* valuator data */ -}; - -extern void verify_internal_event(const InternalEvent *ev); - -#endif +/* + * Copyright © 2010 Red Hat, Inc. + * + * 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. + * + */ + +#ifdef HAVE_DIX_CONFIG_H +#include "dix-config.h" +#endif + +#ifndef INPUTUTILS_H +#define INPUTUTILS_H + +#include "input.h" + +struct _ValuatorMask { + int8_t last_bit; /* highest bit set in mask */ + uint8_t mask[(MAX_VALUATORS + 7)/8]; + int valuators[MAX_VALUATORS]; /* valuator data */ +}; + +extern void verify_internal_event(const InternalEvent *ev); + +#endif diff --git a/xorg-server/include/list.h b/xorg-server/include/list.h index 2acf149cc..5933b973d 100644 --- a/xorg-server/include/list.h +++ b/xorg-server/include/list.h @@ -1,281 +1,281 @@ -/* - * Copyright © 2010 Intel Corporation - * Copyright © 2010 Francisco Jerez - * - * 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. - * - */ - -#ifndef _LIST_H_ -#define _LIST_H_ - -/** - * @file Classic doubly-link circular list implementation. - * - * Example: - * We need to keep a list of struct foo in the parent struct bar, i.e. what - * we want is something like this. - * - * struct bar { - * ... - * struct foo *foos; -----> struct foo {}, struct foo {}, struct foo{} - * ... - * } - * - * We need one list head in bar and a list element in all foos (both are of - * data type 'struct list'). - * - * struct bar { - * ... - * struct list foos; - * ... - * } - * - * struct foo { - * ... - * struct list entry; - * ... - * } - * - * Now we initialize the list head: - * - * struct bar bar; - * ... - * list_init(&bar.foos); - * - * Then we create the first element and add it to this list: - * - * struct foo *foo = malloc(...); - * .... - * list_add(&foo->entry, &bar.foos); - * - * Repeat the above for each element you want to add to the list. Deleting - * works with the element itself. - * list_del(&foo->entry); - * free(foo); - * - * Note: calling list_del(&bar.foos) will set bar.foos to an empty - * list again. - * - * Looping through the list requires a 'struct foo' as iterator and the - * name of the field the subnodes use. - * - * struct foo *iterator; - * list_for_each_entry(iterator, &bar.foos, entry) { - * if (iterator->something == ...) - * ... - * } - * - * Note: You must not call list_del() on the iterator if you continue the - * loop. You need to run the safe for-each loop instead: - * - * struct foo *iterator, *next; - * list_for_each_entry_safe(iterator, next, &bar.foos, entry) { - * if (...) - * list_del(&iterator->entry); - * } - * - */ - -/** - * The linkage struct for list nodes. This struct must be part of your - * to-be-linked struct. - * - * Example: - * struct foo { - * int a; - * void *b; - * struct list *mylist; - * } - * - * Position and name of the struct list field is irrelevant. - * There are no requirements that elements of a list are of the same type. - * There are no requirements for a list head, any struct list can be a list - * head. - */ -struct list { - struct list *next, *prev; -}; - -/** - * Initialize the list as an empty list. - * - * Example: - * list_init(&foo->mylist); - * - * @param The list to initialized. - */ -static void -list_init(struct list *list) -{ - list->next = list->prev = list; -} - -static inline void -__list_add(struct list *entry, - struct list *prev, - struct list *next) -{ - next->prev = entry; - entry->next = next; - entry->prev = prev; - prev->next = entry; -} - -/** - * Insert a new element after the given list head. - * The list changes from: - * head → some element → ... - * to - * head → new element → older element → ... - * - * Example: - * struct foo *newfoo = malloc(...); - * list_add(&newfoo->mylist, &foo->mylist); - * - * @param entry The new element to prepend to the list. - * @param head The existing list. - */ -static inline void -list_add(struct list *entry, struct list *head) -{ - __list_add(entry, head, head->next); -} - -static inline void -__list_del(struct list *prev, struct list *next) -{ - next->prev = prev; - prev->next = next; -} - -/** - * Remove the element from the list it is in. Using this function will reset - * the pointers to/from this element so it is removed from the list. It does - * NOT free the element itself or manipulate it otherwise. - * - * Using list_del on a pure list head (like in the example at the top of - * this file) will NOT remove the first element from - * the list but rather reset the list as empty list. - * - * Example: - * list_del(&newfoo->mylist); - * - * @param entry The element to remove. - */ -static inline void -list_del(struct list *entry) -{ - __list_del(entry->prev, entry->next); - list_init(entry); -} - -/** - * Check if the list is empty. - * - * Example: - * list_is_empty(&foo->mylist); - * - * @return True if the list contains one or more elements or False otherwise. - */ -static inline Bool -list_is_empty(struct list *head) -{ - return head->next == head; -} - -/** - * Returns a pointer to the container of this list element. - * - * Example: - * struct foo* f; - * f = container_of(&foo->mylist, struct foo, mylist); - * assert(f == foo); - * - * @param ptr Pointer to the struct list. - * @param type Data type of the list element. - * @param member Member name of the struct list field in the list element. - * @return A pointer to the data struct containing the list head. - */ -#ifndef container_of -#define container_of(ptr, type, member) \ - (type *)((char *)(ptr) - (char *) &((type *)0)->member) -#endif - -/** - * Alias of container_of - */ -#define list_entry(ptr, type, member) \ - container_of(ptr, type, member) - -/** - * Retrieve the first list entry for the given list pointer. - * - * Example: - * struct foo *first; - * first = list_first_entry(&foo->mylist, struct foo, mylist); - * - * @param ptr The list head - * @param type Data type of the list element to retrieve - * @param member Member name of the struct list field in the list element. - * @return A pointer to the first list element. - */ -#define list_first_entry(ptr, type, member) \ - list_entry((ptr)->next, type, member) - -#define __container_of(ptr, sample, member) \ - (void *)((char *)(ptr) \ - - ((char *)&(sample)->member - (char *)(sample))) -/** - * Loop through the list given by head and set pos to struct in the list. - * - * Example: - * struct foo *iterator; - * list_for_each_entry(iterator, &foo->mylist, mylist) { - * [modify iterator] - * } - * - * This macro is not safe for node deletion. Use list_for_each_entry_safe - * instead. - * - * @param pos Iterator variable of the type of the list elements. - * @param head List head - * @param member Member name of the struct list in the list elements. - * - */ -#define list_for_each_entry(pos, head, member) \ - for (pos = __container_of((head)->next, pos, member); \ - &pos->member != (head); \ - pos = __container_of(pos->member.next, pos, member)) - -/** - * Loop through the list, keeping a backup pointer to the element. This - * macro allows for the deletion of a list element while looping through the - * list. - * - * See list_for_each_entry for more details. - */ -#define list_for_each_entry_safe(pos, tmp, head, member) \ - for (pos = __container_of((head)->next, pos, member), \ - tmp = __container_of(pos->member.next, pos, member); \ - &pos->member != (head); \ - pos = tmp, tmp = __container_of(pos->member.next, tmp, member)) - -#endif +/* + * Copyright © 2010 Intel Corporation + * Copyright © 2010 Francisco Jerez + * + * 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. + * + */ + +#ifndef _LIST_H_ +#define _LIST_H_ + +/** + * @file Classic doubly-link circular list implementation. + * + * Example: + * We need to keep a list of struct foo in the parent struct bar, i.e. what + * we want is something like this. + * + * struct bar { + * ... + * struct foo *foos; -----> struct foo {}, struct foo {}, struct foo{} + * ... + * } + * + * We need one list head in bar and a list element in all foos (both are of + * data type 'struct list'). + * + * struct bar { + * ... + * struct list foos; + * ... + * } + * + * struct foo { + * ... + * struct list entry; + * ... + * } + * + * Now we initialize the list head: + * + * struct bar bar; + * ... + * list_init(&bar.foos); + * + * Then we create the first element and add it to this list: + * + * struct foo *foo = malloc(...); + * .... + * list_add(&foo->entry, &bar.foos); + * + * Repeat the above for each element you want to add to the list. Deleting + * works with the element itself. + * list_del(&foo->entry); + * free(foo); + * + * Note: calling list_del(&bar.foos) will set bar.foos to an empty + * list again. + * + * Looping through the list requires a 'struct foo' as iterator and the + * name of the field the subnodes use. + * + * struct foo *iterator; + * list_for_each_entry(iterator, &bar.foos, entry) { + * if (iterator->something == ...) + * ... + * } + * + * Note: You must not call list_del() on the iterator if you continue the + * loop. You need to run the safe for-each loop instead: + * + * struct foo *iterator, *next; + * list_for_each_entry_safe(iterator, next, &bar.foos, entry) { + * if (...) + * list_del(&iterator->entry); + * } + * + */ + +/** + * The linkage struct for list nodes. This struct must be part of your + * to-be-linked struct. + * + * Example: + * struct foo { + * int a; + * void *b; + * struct list *mylist; + * } + * + * Position and name of the struct list field is irrelevant. + * There are no requirements that elements of a list are of the same type. + * There are no requirements for a list head, any struct list can be a list + * head. + */ +struct list { + struct list *next, *prev; +}; + +/** + * Initialize the list as an empty list. + * + * Example: + * list_init(&foo->mylist); + * + * @param The list to initialized. + */ +static void +list_init(struct list *list) +{ + list->next = list->prev = list; +} + +static inline void +__list_add(struct list *entry, + struct list *prev, + struct list *next) +{ + next->prev = entry; + entry->next = next; + entry->prev = prev; + prev->next = entry; +} + +/** + * Insert a new element after the given list head. + * The list changes from: + * head → some element → ... + * to + * head → new element → older element → ... + * + * Example: + * struct foo *newfoo = malloc(...); + * list_add(&newfoo->mylist, &foo->mylist); + * + * @param entry The new element to prepend to the list. + * @param head The existing list. + */ +static inline void +list_add(struct list *entry, struct list *head) +{ + __list_add(entry, head, head->next); +} + +static inline void +__list_del(struct list *prev, struct list *next) +{ + next->prev = prev; + prev->next = next; +} + +/** + * Remove the element from the list it is in. Using this function will reset + * the pointers to/from this element so it is removed from the list. It does + * NOT free the element itself or manipulate it otherwise. + * + * Using list_del on a pure list head (like in the example at the top of + * this file) will NOT remove the first element from + * the list but rather reset the list as empty list. + * + * Example: + * list_del(&newfoo->mylist); + * + * @param entry The element to remove. + */ +static inline void +list_del(struct list *entry) +{ + __list_del(entry->prev, entry->next); + list_init(entry); +} + +/** + * Check if the list is empty. + * + * Example: + * list_is_empty(&foo->mylist); + * + * @return True if the list contains one or more elements or False otherwise. + */ +static inline Bool +list_is_empty(struct list *head) +{ + return head->next == head; +} + +/** + * Returns a pointer to the container of this list element. + * + * Example: + * struct foo* f; + * f = container_of(&foo->mylist, struct foo, mylist); + * assert(f == foo); + * + * @param ptr Pointer to the struct list. + * @param type Data type of the list element. + * @param member Member name of the struct list field in the list element. + * @return A pointer to the data struct containing the list head. + */ +#ifndef container_of +#define container_of(ptr, type, member) \ + (type *)((char *)(ptr) - (char *) &((type *)0)->member) +#endif + +/** + * Alias of container_of + */ +#define list_entry(ptr, type, member) \ + container_of(ptr, type, member) + +/** + * Retrieve the first list entry for the given list pointer. + * + * Example: + * struct foo *first; + * first = list_first_entry(&foo->mylist, struct foo, mylist); + * + * @param ptr The list head + * @param type Data type of the list element to retrieve + * @param member Member name of the struct list field in the list element. + * @return A pointer to the first list element. + */ +#define list_first_entry(ptr, type, member) \ + list_entry((ptr)->next, type, member) + +#define __container_of(ptr, sample, member) \ + (void *)((char *)(ptr) \ + - ((char *)&(sample)->member - (char *)(sample))) +/** + * Loop through the list given by head and set pos to struct in the list. + * + * Example: + * struct foo *iterator; + * list_for_each_entry(iterator, &foo->mylist, mylist) { + * [modify iterator] + * } + * + * This macro is not safe for node deletion. Use list_for_each_entry_safe + * instead. + * + * @param pos Iterator variable of the type of the list elements. + * @param head List head + * @param member Member name of the struct list in the list elements. + * + */ +#define list_for_each_entry(pos, head, member) \ + for (pos = __container_of((head)->next, pos, member); \ + &pos->member != (head); \ + pos = __container_of(pos->member.next, pos, member)) + +/** + * Loop through the list, keeping a backup pointer to the element. This + * macro allows for the deletion of a list element while looping through the + * list. + * + * See list_for_each_entry for more details. + */ +#define list_for_each_entry_safe(pos, tmp, head, member) \ + for (pos = __container_of((head)->next, pos, member), \ + tmp = __container_of(pos->member.next, pos, member); \ + &pos->member != (head); \ + pos = tmp, tmp = __container_of(pos->member.next, tmp, member)) + +#endif diff --git a/xorg-server/include/misc.h b/xorg-server/include/misc.h index ba3776079..f0c92abeb 100644 --- a/xorg-server/include/misc.h +++ b/xorg-server/include/misc.h @@ -1,325 +1,325 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -Copyright 1992, 1993 Data General Corporation; -Copyright 1992, 1993 OMRON Corporation - -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, and that -neither the name OMRON or DATA GENERAL be used in advertising or publicity -pertaining to distribution of the software without specific, written prior -permission of the party whose name is to be used. Neither OMRON or -DATA GENERAL make any representation about the suitability of this software -for any purpose. It is provided "as is" without express or implied warranty. - -OMRON AND DATA GENERAL EACH DISCLAIM ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, -IN NO EVENT SHALL OMRON OR DATA GENERAL BE LIABLE FOR ANY SPECIAL, INDIRECT -OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE -OF THIS SOFTWARE. - -******************************************************************/ -#ifndef MISC_H -#define MISC_H 1 -/* - * X internal definitions - * - */ - -#include -#include -#include -#include -#include - -#include -#include -#include - -#ifdef _MSC_VER -#define inline __inline -#endif - -#ifndef MAXSCREENS -#define MAXSCREENS 16 -#endif -#define MAXCLIENTS 256 -#define MAXEXTENSIONS 128 -#define MAXFORMATS 8 -#define MAXDEVICES 40 /* input devices */ - -#define EXTENSION_EVENT_BASE 64 -#define EXTENSION_BASE 128 - -typedef uint32_t ATOM; - -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 -#endif - -#ifndef _XTYPEDEF_CALLBACKLISTPTR -typedef struct _CallbackList *CallbackListPtr; /* also in dix.h */ -#define _XTYPEDEF_CALLBACKLISTPTR -#endif - -typedef struct _xReq *xReqPtr; - -#include "os.h" /* for ALLOCATE_LOCAL and DEALLOCATE_LOCAL */ -#include /* for bcopy, bzero, and bcmp */ - -#define NullBox ((BoxPtr)0) -#define MILLI_PER_MIN (1000 * 60) -#define MILLI_PER_SECOND (1000) - - /* this next is used with None and ParentRelative to tell - PaintWin() what to use to paint the background. Also used - in the macro IS_VALID_PIXMAP */ - -#define USE_BACKGROUND_PIXEL 3 -#define USE_BORDER_PIXEL 3 - - -/* byte swap a 32-bit literal */ -#define lswapl(x) ((((x) & 0xff) << 24) |\ - (((x) & 0xff00) << 8) |\ - (((x) & 0xff0000) >> 8) |\ - (((x) >> 24) & 0xff)) - -/* byte swap a short literal */ -#define lswaps(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff)) - -#undef min -#undef max - -#define min(a, b) (((a) < (b)) ? (a) : (b)) -#define max(a, b) (((a) > (b)) ? (a) : (b)) -/* abs() is a function, not a macro; include the file declaring - * it in case we haven't done that yet. - */ -#include -#ifndef Fabs -#define Fabs(a) ((a) > 0.0 ? (a) : -(a)) /* floating absolute value */ -#endif -#define sign(x) ((x) < 0 ? -1 : ((x) > 0 ? 1 : 0)) -/* this assumes b > 0 */ -#define modulus(a, b, d) if (((d) = (a) % (b)) < 0) (d) += (b) -/* - * return the least significant bit in x which is set - * - * This works on 1's complement and 2's complement machines. - * If you care about the extra instruction on 2's complement - * machines, change to ((x) & (-(x))) - */ -#define lowbit(x) ((x) & (~(x) + 1)) - -/* XXX Not for modules */ -#include -#if !defined(MAXSHORT) || !defined(MINSHORT) || \ - !defined(MAXINT) || !defined(MININT) -/* - * Some implementations #define these through , so preclude - * #include'ing it later. - */ - -#include -#undef MAXSHORT -#define MAXSHORT 32767 -#undef MINSHORT -#define MINSHORT -32768 -#undef MAXINT -#define MAXINT INT_MAX -#undef MININT -#define MININT INT_MIN - -#include -#include -#include /* for fopen, etc... */ - -#endif - -#ifndef PATH_MAX -#include -#ifndef PATH_MAX -#ifdef MAXPATHLEN -#define PATH_MAX MAXPATHLEN -#else -#define PATH_MAX 1024 -#endif -#endif -#endif - -/** - * Calculate the number of bytes needed to hold bits. - * @param bits The minimum number of bits needed. - * @return The number of bytes needed to hold bits. - */ -static __inline int -bits_to_bytes(const int bits) { - return ((bits + 7) >> 3); -} -/** - * Calculate the number of 4-byte units needed to hold the given number of - * bytes. - * @param bytes The minimum number of bytes needed. - * @return The number of 4-byte units needed to hold bytes. - */ -static __inline int -bytes_to_int32(const int bytes) { - return (((bytes) + 3) >> 2); -} - -/** - * Calculate the number of bytes (in multiples of 4) needed to hold bytes. - * @param bytes The minimum number of bytes needed. - * @return The closest multiple of 4 that is equal or higher than bytes. - */ -static __inline int -pad_to_int32(const int bytes) { - return (((bytes) + 3) & ~3); -} - -extern char** -xstrtokenize(const char *str, const char* separators); - -/** - * Compare the two version numbers comprising of major.minor. - * - * @return A value less than 0 if a is less than b, 0 if a is equal to b, - * or a value greater than 0 - */ -static inline int -version_compare(uint16_t a_major, uint16_t a_minor, - uint16_t b_major, uint16_t b_minor) -{ - int a, b; - - a = a_major << 16 | a_minor; - b = b_major << 16 | b_minor; - - return (a - b); -} - -/* some macros to help swap requests, replies, and events */ - -#define LengthRestB(stuff) \ - ((client->req_len << 2) - sizeof(*stuff)) - -#define LengthRestS(stuff) \ - ((client->req_len << 1) - (sizeof(*stuff) >> 1)) - -#define LengthRestL(stuff) \ - (client->req_len - (sizeof(*stuff) >> 2)) - -#define SwapRestS(stuff) \ - SwapShorts((short *)(stuff + 1), LengthRestS(stuff)) - -#define SwapRestL(stuff) \ - SwapLongs((CARD32 *)(stuff + 1), LengthRestL(stuff)) - -/* byte swap a 32-bit value */ -#define swapl(x, n) { \ - n = ((char *) (x))[0];\ - ((char *) (x))[0] = ((char *) (x))[3];\ - ((char *) (x))[3] = n;\ - n = ((char *) (x))[1];\ - ((char *) (x))[1] = ((char *) (x))[2];\ - ((char *) (x))[2] = n; } - -/* byte swap a short */ -#define swaps(x, n) { \ - n = ((char *) (x))[0];\ - ((char *) (x))[0] = ((char *) (x))[1];\ - ((char *) (x))[1] = n; } - -/* copy 32-bit value from src to dst byteswapping on the way */ -#define cpswapl(src, dst) { \ - ((char *)&(dst))[0] = ((char *) &(src))[3];\ - ((char *)&(dst))[1] = ((char *) &(src))[2];\ - ((char *)&(dst))[2] = ((char *) &(src))[1];\ - ((char *)&(dst))[3] = ((char *) &(src))[0]; } - -/* copy short from src to dst byteswapping on the way */ -#define cpswaps(src, dst) { \ - ((char *) &(dst))[0] = ((char *) &(src))[1];\ - ((char *) &(dst))[1] = ((char *) &(src))[0]; } - -extern _X_EXPORT void SwapLongs( - CARD32 *list, - unsigned long count); - -extern _X_EXPORT void SwapShorts( - short *list, - unsigned long count); - -extern _X_EXPORT void MakePredeclaredAtoms(void); - -extern _X_EXPORT int Ones( - unsigned long /*mask*/); - -typedef struct _xPoint *DDXPointPtr; -typedef struct pixman_box16 *BoxPtr; -typedef struct _xEvent *xEventPtr; -typedef struct _xRectangle *xRectanglePtr; -typedef struct _GrabRec *GrabPtr; - -/* typedefs from other places - duplicated here to minimize the amount - * of unnecessary junk that one would normally have to include to get - * these symbols defined - */ - -#ifndef _XTYPEDEF_CHARINFOPTR -typedef struct _CharInfo *CharInfoPtr; /* also in fonts/include/font.h */ -#define _XTYPEDEF_CHARINFOPTR -#endif - -extern _X_EXPORT unsigned long globalSerialNumber; -extern _X_EXPORT unsigned long serverGeneration; - -#endif /* MISC_H */ +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +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 +OPEN GROUP 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 Open Group 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 Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +Copyright 1992, 1993 Data General Corporation; +Copyright 1992, 1993 OMRON Corporation + +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, and that +neither the name OMRON or DATA GENERAL be used in advertising or publicity +pertaining to distribution of the software without specific, written prior +permission of the party whose name is to be used. Neither OMRON or +DATA GENERAL make any representation about the suitability of this software +for any purpose. It is provided "as is" without express or implied warranty. + +OMRON AND DATA GENERAL EACH DISCLAIM ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, +IN NO EVENT SHALL OMRON OR DATA GENERAL BE LIABLE FOR ANY SPECIAL, INDIRECT +OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +OF THIS SOFTWARE. + +******************************************************************/ +#ifndef MISC_H +#define MISC_H 1 +/* + * X internal definitions + * + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#ifdef _MSC_VER +#define inline __inline +#endif + +#ifndef MAXSCREENS +#define MAXSCREENS 16 +#endif +#define MAXCLIENTS 256 +#define MAXEXTENSIONS 128 +#define MAXFORMATS 8 +#define MAXDEVICES 40 /* input devices */ + +#define EXTENSION_EVENT_BASE 64 +#define EXTENSION_BASE 128 + +typedef uint32_t ATOM; + +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif + +#ifndef _XTYPEDEF_CALLBACKLISTPTR +typedef struct _CallbackList *CallbackListPtr; /* also in dix.h */ +#define _XTYPEDEF_CALLBACKLISTPTR +#endif + +typedef struct _xReq *xReqPtr; + +#include "os.h" /* for ALLOCATE_LOCAL and DEALLOCATE_LOCAL */ +#include /* for bcopy, bzero, and bcmp */ + +#define NullBox ((BoxPtr)0) +#define MILLI_PER_MIN (1000 * 60) +#define MILLI_PER_SECOND (1000) + + /* this next is used with None and ParentRelative to tell + PaintWin() what to use to paint the background. Also used + in the macro IS_VALID_PIXMAP */ + +#define USE_BACKGROUND_PIXEL 3 +#define USE_BORDER_PIXEL 3 + + +/* byte swap a 32-bit literal */ +#define lswapl(x) ((((x) & 0xff) << 24) |\ + (((x) & 0xff00) << 8) |\ + (((x) & 0xff0000) >> 8) |\ + (((x) >> 24) & 0xff)) + +/* byte swap a short literal */ +#define lswaps(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff)) + +#undef min +#undef max + +#define min(a, b) (((a) < (b)) ? (a) : (b)) +#define max(a, b) (((a) > (b)) ? (a) : (b)) +/* abs() is a function, not a macro; include the file declaring + * it in case we haven't done that yet. + */ +#include +#ifndef Fabs +#define Fabs(a) ((a) > 0.0 ? (a) : -(a)) /* floating absolute value */ +#endif +#define sign(x) ((x) < 0 ? -1 : ((x) > 0 ? 1 : 0)) +/* this assumes b > 0 */ +#define modulus(a, b, d) if (((d) = (a) % (b)) < 0) (d) += (b) +/* + * return the least significant bit in x which is set + * + * This works on 1's complement and 2's complement machines. + * If you care about the extra instruction on 2's complement + * machines, change to ((x) & (-(x))) + */ +#define lowbit(x) ((x) & (~(x) + 1)) + +/* XXX Not for modules */ +#include +#if !defined(MAXSHORT) || !defined(MINSHORT) || \ + !defined(MAXINT) || !defined(MININT) +/* + * Some implementations #define these through , so preclude + * #include'ing it later. + */ + +#include +#undef MAXSHORT +#define MAXSHORT 32767 +#undef MINSHORT +#define MINSHORT -32768 +#undef MAXINT +#define MAXINT INT_MAX +#undef MININT +#define MININT INT_MIN + +#include +#include +#include /* for fopen, etc... */ + +#endif + +#ifndef PATH_MAX +#include +#ifndef PATH_MAX +#ifdef MAXPATHLEN +#define PATH_MAX MAXPATHLEN +#else +#define PATH_MAX 1024 +#endif +#endif +#endif + +/** + * Calculate the number of bytes needed to hold bits. + * @param bits The minimum number of bits needed. + * @return The number of bytes needed to hold bits. + */ +static __inline int +bits_to_bytes(const int bits) { + return ((bits + 7) >> 3); +} +/** + * Calculate the number of 4-byte units needed to hold the given number of + * bytes. + * @param bytes The minimum number of bytes needed. + * @return The number of 4-byte units needed to hold bytes. + */ +static __inline int +bytes_to_int32(const int bytes) { + return (((bytes) + 3) >> 2); +} + +/** + * Calculate the number of bytes (in multiples of 4) needed to hold bytes. + * @param bytes The minimum number of bytes needed. + * @return The closest multiple of 4 that is equal or higher than bytes. + */ +static __inline int +pad_to_int32(const int bytes) { + return (((bytes) + 3) & ~3); +} + +extern char** +xstrtokenize(const char *str, const char* separators); + +/** + * Compare the two version numbers comprising of major.minor. + * + * @return A value less than 0 if a is less than b, 0 if a is equal to b, + * or a value greater than 0 + */ +static inline int +version_compare(uint16_t a_major, uint16_t a_minor, + uint16_t b_major, uint16_t b_minor) +{ + int a, b; + + a = a_major << 16 | a_minor; + b = b_major << 16 | b_minor; + + return (a - b); +} + +/* some macros to help swap requests, replies, and events */ + +#define LengthRestB(stuff) \ + ((client->req_len << 2) - sizeof(*stuff)) + +#define LengthRestS(stuff) \ + ((client->req_len << 1) - (sizeof(*stuff) >> 1)) + +#define LengthRestL(stuff) \ + (client->req_len - (sizeof(*stuff) >> 2)) + +#define SwapRestS(stuff) \ + SwapShorts((short *)(stuff + 1), LengthRestS(stuff)) + +#define SwapRestL(stuff) \ + SwapLongs((CARD32 *)(stuff + 1), LengthRestL(stuff)) + +/* byte swap a 32-bit value */ +#define swapl(x, n) { \ + n = ((char *) (x))[0];\ + ((char *) (x))[0] = ((char *) (x))[3];\ + ((char *) (x))[3] = n;\ + n = ((char *) (x))[1];\ + ((char *) (x))[1] = ((char *) (x))[2];\ + ((char *) (x))[2] = n; } + +/* byte swap a short */ +#define swaps(x, n) { \ + n = ((char *) (x))[0];\ + ((char *) (x))[0] = ((char *) (x))[1];\ + ((char *) (x))[1] = n; } + +/* copy 32-bit value from src to dst byteswapping on the way */ +#define cpswapl(src, dst) { \ + ((char *)&(dst))[0] = ((char *) &(src))[3];\ + ((char *)&(dst))[1] = ((char *) &(src))[2];\ + ((char *)&(dst))[2] = ((char *) &(src))[1];\ + ((char *)&(dst))[3] = ((char *) &(src))[0]; } + +/* copy short from src to dst byteswapping on the way */ +#define cpswaps(src, dst) { \ + ((char *) &(dst))[0] = ((char *) &(src))[1];\ + ((char *) &(dst))[1] = ((char *) &(src))[0]; } + +extern _X_EXPORT void SwapLongs( + CARD32 *list, + unsigned long count); + +extern _X_EXPORT void SwapShorts( + short *list, + unsigned long count); + +extern _X_EXPORT void MakePredeclaredAtoms(void); + +extern _X_EXPORT int Ones( + unsigned long /*mask*/); + +typedef struct _xPoint *DDXPointPtr; +typedef struct pixman_box16 *BoxPtr; +typedef struct _xEvent *xEventPtr; +typedef struct _xRectangle *xRectanglePtr; +typedef struct _GrabRec *GrabPtr; + +/* typedefs from other places - duplicated here to minimize the amount + * of unnecessary junk that one would normally have to include to get + * these symbols defined + */ + +#ifndef _XTYPEDEF_CHARINFOPTR +typedef struct _CharInfo *CharInfoPtr; /* also in fonts/include/font.h */ +#define _XTYPEDEF_CHARINFOPTR +#endif + +extern _X_EXPORT unsigned long globalSerialNumber; +extern _X_EXPORT unsigned long serverGeneration; + +#endif /* MISC_H */ diff --git a/xorg-server/include/os.h b/xorg-server/include/os.h index 6800d4369..24558cd2f 100644 --- a/xorg-server/include/os.h +++ b/xorg-server/include/os.h @@ -1,552 +1,552 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - - -#ifndef OS_H -#define OS_H - -#include "misc.h" -#include -#include - -#define SCREEN_SAVER_ON 0 -#define SCREEN_SAVER_OFF 1 -#define SCREEN_SAVER_FORCER 2 -#define SCREEN_SAVER_CYCLE 3 - -#ifndef MAX_REQUEST_SIZE -#define MAX_REQUEST_SIZE 65535 -#endif -#ifndef MAX_BIG_REQUEST_SIZE -#define MAX_BIG_REQUEST_SIZE 4194303 -#endif - -typedef struct _FontPathRec *FontPathPtr; -typedef struct _NewClientRec *NewClientPtr; - -#ifndef xalloc -#define xnfalloc(size) XNFalloc((unsigned long)(size)) -#define xnfcalloc(_num, _size) XNFcalloc((unsigned long)(_num)*(unsigned long)(_size)) -#define xnfrealloc(ptr, size) XNFrealloc((pointer)(ptr), (unsigned long)(size)) - -#define xalloc(size) Xalloc((unsigned long)(size)) -#define xcalloc(_num, _size) Xcalloc((unsigned long)(_num)*(unsigned long)(_size)) -#define xrealloc(ptr, size) Xrealloc((pointer)(ptr), (unsigned long)(size)) -#define xfree(ptr) Xfree((pointer)(ptr)) -#define xstrdup(s) Xstrdup(s) -#define xnfstrdup(s) XNFstrdup(s) -#endif - -#include -#include - -#ifdef DDXBEFORERESET -extern void ddxBeforeReset (void); -#endif - -#ifdef DDXOSVERRORF -extern _X_EXPORT void (*OsVendorVErrorFProc)(const char *, va_list args); -#endif - -extern _X_EXPORT int WaitForSomething( - int* /*pClientsReady*/ -); - -extern _X_EXPORT int ReadRequestFromClient(ClientPtr /*client*/); - -extern _X_EXPORT Bool InsertFakeRequest( - ClientPtr /*client*/, - char* /*data*/, - int /*count*/); - -extern _X_EXPORT void ResetCurrentRequest(ClientPtr /*client*/); - -extern _X_EXPORT void FlushAllOutput(void); - -extern _X_EXPORT void FlushIfCriticalOutputPending(void); - -extern _X_EXPORT void SetCriticalOutputPending(void); - -extern _X_EXPORT int WriteToClient(ClientPtr /*who*/, int /*count*/, const void* /*buf*/); - -extern _X_EXPORT void ResetOsBuffers(void); - -extern _X_EXPORT int TransIsListening(char *protocol); - -extern _X_EXPORT void InitConnectionLimits(void); - -extern _X_EXPORT void NotifyParentProcess(void); - -extern _X_EXPORT void CreateWellKnownSockets(void); - -extern _X_EXPORT void ResetWellKnownSockets(void); - -extern _X_EXPORT void CloseWellKnownConnections(void); - -extern _X_EXPORT XID AuthorizationIDOfClient(ClientPtr /*client*/); - -extern _X_EXPORT char *ClientAuthorized( - ClientPtr /*client*/, - unsigned int /*proto_n*/, - char* /*auth_proto*/, - unsigned int /*string_n*/, - char* /*auth_string*/); - -extern _X_EXPORT Bool EstablishNewConnections( - ClientPtr /*clientUnused*/, - pointer /*closure*/); - -extern _X_EXPORT void CheckConnections(void); - -extern _X_EXPORT void CloseDownConnection(ClientPtr /*client*/); - -extern _X_EXPORT void AddGeneralSocket(int /*fd*/); - -extern _X_EXPORT void RemoveGeneralSocket(int /*fd*/); - -extern _X_EXPORT void AddEnabledDevice(int /*fd*/); - -extern _X_EXPORT void RemoveEnabledDevice(int /*fd*/); - -extern _X_EXPORT int OnlyListenToOneClient(ClientPtr /*client*/); - -extern _X_EXPORT void ListenToAllClients(void); - -extern _X_EXPORT void IgnoreClient(ClientPtr /*client*/); - -extern _X_EXPORT void AttendClient(ClientPtr /*client*/); - -extern _X_EXPORT void MakeClientGrabImpervious(ClientPtr /*client*/); - -extern _X_EXPORT void MakeClientGrabPervious(ClientPtr /*client*/); - -#ifdef XQUARTZ -extern void ListenOnOpenFD(int /* fd */, int /* noxauth */); -#endif - -extern _X_EXPORT CARD32 GetTimeInMillis(void); - -extern _X_EXPORT void AdjustWaitForDelay( - pointer /*waitTime*/, - unsigned long /*newdelay*/); - -typedef struct _OsTimerRec *OsTimerPtr; - -typedef CARD32 (*OsTimerCallback)( - OsTimerPtr /* timer */, - CARD32 /* time */, - pointer /* arg */); - -extern _X_EXPORT void TimerInit(void); - -extern _X_EXPORT Bool TimerForce(OsTimerPtr /* timer */); - -#define TimerAbsolute (1<<0) -#define TimerForceOld (1<<1) - -extern _X_EXPORT OsTimerPtr TimerSet( - OsTimerPtr /* timer */, - int /* flags */, - CARD32 /* millis */, - OsTimerCallback /* func */, - pointer /* arg */); - -extern _X_EXPORT void TimerCheck(void); -extern _X_EXPORT void TimerCancel(OsTimerPtr /* pTimer */); -extern _X_EXPORT void TimerFree(OsTimerPtr /* pTimer */); - -extern _X_EXPORT void SetScreenSaverTimer(void); -extern _X_EXPORT void FreeScreenSaverTimer(void); - -extern _X_EXPORT void AutoResetServer(int /*sig*/); - -extern _X_EXPORT void GiveUp(int /*sig*/); - -extern _X_EXPORT void UseMsg(void); - -extern _X_EXPORT void ProcessCommandLine(int /*argc*/, char* /*argv*/[]); - -extern _X_EXPORT int set_font_authorizations( - char ** /* authorizations */, - int * /*authlen */, - pointer /* client */); - -#ifndef _HAVE_XALLOC_DECLS -#define _HAVE_XALLOC_DECLS - -/* - * Use malloc(3) instead. - */ -extern _X_EXPORT void *Xalloc(unsigned long /*amount*/) _X_DEPRECATED; -/* - * Use calloc(3) instead - */ -extern _X_EXPORT void *Xcalloc(unsigned long /*amount*/) _X_DEPRECATED; -/* - * Use realloc(3) instead - */ -extern _X_EXPORT void *Xrealloc(void * /*ptr*/, unsigned long /*amount*/) - _X_DEPRECATED; -/* - * Use free(3) instead - */ -extern _X_EXPORT void Xfree(void * /*ptr*/) _X_DEPRECATED; - -#endif - -/* - * This function malloc(3)s buffer, terminating the server if there is not - * enough memory. - */ -extern _X_EXPORT void *XNFalloc(unsigned long /*amount*/); -/* - * This function calloc(3)s buffer, terminating the server if there is not - * enough memory. - */ -extern _X_EXPORT void *XNFcalloc(unsigned long /*amount*/); -/* - * This function realloc(3)s passed buffer, terminating the server if there is - * not enough memory. - */ -extern _X_EXPORT void *XNFrealloc(void * /*ptr*/, unsigned long /*amount*/); - -/* - * This function strdup(3)s passed string. The only difference from the library - * function that it is safe to pass NULL, as NULL will be returned. - */ -extern _X_EXPORT char *Xstrdup(const char *s); - -/* - * This function strdup(3)s passed string, terminating the server if there is - * not enough memory. If NULL is passed to this function, NULL is returned. - */ -extern _X_EXPORT char *XNFstrdup(const char *s); - -/* Include new X*asprintf API */ -#include "Xprintf.h" - -/* Older api deprecated in favor of the asprintf versions */ -extern _X_EXPORT char *Xprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_DEPRECATED; -extern _X_EXPORT char *Xvprintf(const char *fmt, va_list va)_X_ATTRIBUTE_PRINTF(1,0) _X_DEPRECATED; -extern _X_EXPORT char *XNFprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_DEPRECATED; -extern _X_EXPORT char *XNFvprintf(const char *fmt, va_list va)_X_ATTRIBUTE_PRINTF(1,0) _X_DEPRECATED; - -typedef void (*OsSigHandlerPtr)(int /* sig */); -typedef int (*OsSigWrapperPtr)(int /* sig */); - -extern _X_EXPORT OsSigHandlerPtr OsSignal(int /* sig */, OsSigHandlerPtr /* handler */); -extern _X_EXPORT OsSigWrapperPtr OsRegisterSigWrapper(OsSigWrapperPtr newWrap); - -extern _X_EXPORT int auditTrailLevel; - -extern _X_EXPORT void LockServer(void); -extern _X_EXPORT void UnlockServer(void); - -extern _X_EXPORT int OsLookupColor( - int /*screen*/, - char * /*name*/, - unsigned /*len*/, - unsigned short * /*pred*/, - unsigned short * /*pgreen*/, - unsigned short * /*pblue*/); - -extern _X_EXPORT void OsInit(void); - -extern _X_EXPORT void OsCleanup(Bool); - -extern _X_EXPORT void OsVendorFatalError(void); - -extern _X_EXPORT void OsVendorInit(void); - -extern _X_EXPORT void OsBlockSignals (void); - -extern _X_EXPORT void OsReleaseSignals (void); - -extern _X_EXPORT void OsAbort (void) _X_NORETURN; - -#if !defined(WIN32) -extern _X_EXPORT int System(char *); -extern _X_EXPORT pointer Popen(char *, char *); -extern _X_EXPORT int Pclose(pointer); -extern _X_EXPORT pointer Fopen(char *, char *); -extern _X_EXPORT int Fclose(pointer); -#else -#define System(a) system(a) -#define Popen(a,b) popen(a,b) -#define Pclose(a) pclose(a) -#define Fopen(a,b) fopen(a,b) -#define Fclose(a) fclose(a) -#endif - -extern _X_EXPORT void CheckUserParameters(int argc, char **argv, char **envp); -extern _X_EXPORT void CheckUserAuthorization(void); - -extern _X_EXPORT int AddHost( - ClientPtr /*client*/, - int /*family*/, - unsigned /*length*/, - const void * /*pAddr*/); - -extern _X_EXPORT Bool ForEachHostInFamily ( - int /*family*/, - Bool (* /*func*/ )( - unsigned char * /* addr */, - short /* len */, - pointer /* closure */), - pointer /*closure*/); - -extern _X_EXPORT int RemoveHost( - ClientPtr /*client*/, - int /*family*/, - unsigned /*length*/, - pointer /*pAddr*/); - -extern _X_EXPORT int GetHosts( - pointer * /*data*/, - int * /*pnHosts*/, - int * /*pLen*/, - BOOL * /*pEnabled*/); - -typedef struct sockaddr * sockaddrPtr; - -extern _X_EXPORT int InvalidHost(sockaddrPtr /*saddr*/, int /*len*/, ClientPtr client); - -extern _X_EXPORT int LocalClient(ClientPtr /* client */); - -extern _X_EXPORT int LocalClientCred(ClientPtr, int *, int *); - -#define LCC_UID_SET (1 << 0) -#define LCC_GID_SET (1 << 1) -#define LCC_PID_SET (1 << 2) -#define LCC_ZID_SET (1 << 3) - -typedef struct { - int fieldsSet; /* Bit mask of fields set */ - int euid; /* Effective uid */ - int egid; /* Primary effective group id */ - int nSuppGids; /* Number of supplementary group ids */ - int *pSuppGids; /* Array of supplementary group ids */ - int pid; /* Process id */ - int zoneid; /* Only set on Solaris 10 & later */ -} LocalClientCredRec; - -extern _X_EXPORT int GetLocalClientCreds(ClientPtr, LocalClientCredRec **); -extern _X_EXPORT void FreeLocalClientCreds(LocalClientCredRec *); - -extern _X_EXPORT int ChangeAccessControl(ClientPtr /*client*/, int /*fEnabled*/); - -extern _X_EXPORT int GetAccessControl(void); - - -extern _X_EXPORT void AddLocalHosts(void); - -extern _X_EXPORT void ResetHosts(char *display); - -extern _X_EXPORT void EnableLocalHost(void); - -extern _X_EXPORT void DisableLocalHost(void); - -extern _X_EXPORT void AccessUsingXdmcp(void); - -extern _X_EXPORT void DefineSelf(int /*fd*/, const int /*protocol*/); - -#if XDMCP -extern _X_EXPORT void AugmentSelf(pointer /*from*/, int /*len*/); - -extern _X_EXPORT void RegisterAuthorizations(void); -#endif - -extern _X_EXPORT void InitAuthorization(char * /*filename*/); - -/* extern int LoadAuthorization(void); */ - -extern _X_EXPORT int AuthorizationFromID ( - XID id, - unsigned short *name_lenp, - char **namep, - unsigned short *data_lenp, - char **datap); - -extern _X_EXPORT XID CheckAuthorization( - unsigned int /*namelength*/, - const char * /*name*/, - unsigned int /*datalength*/, - const char * /*data*/, - ClientPtr /*client*/, - char ** /*reason*/ -); - -extern _X_EXPORT void ResetAuthorization(void); - -extern _X_EXPORT int RemoveAuthorization ( - unsigned short name_length, - const char *name, - unsigned short data_length, - const char *data); - -extern _X_EXPORT int AddAuthorization( - unsigned int /*name_length*/, - const char * /*name*/, - unsigned int /*data_length*/, - char * /*data*/); - -#ifdef XCSECURITY -extern _X_EXPORT XID GenerateAuthorization( - unsigned int /* name_length */, - const char * /* name */, - unsigned int /* data_length */, - const char * /* data */, - unsigned int * /* data_length_return */, - char ** /* data_return */); -#endif - -extern _X_EXPORT int ddxProcessArgument(int /*argc*/, char * /*argv*/ [], int /*i*/); - -extern _X_EXPORT void ddxUseMsg(void); - -/* stuff for ReplyCallback */ -extern _X_EXPORT CallbackListPtr ReplyCallback; -typedef struct { - ClientPtr client; - const void *replyData; - unsigned long dataLenBytes; - unsigned long bytesRemaining; - Bool startOfReply; -} ReplyInfoRec; - -/* stuff for FlushCallback */ -extern _X_EXPORT CallbackListPtr FlushCallback; - -enum ExitCode { - EXIT_NO_ERROR = 0, - EXIT_ERR_ABORT = 1, - EXIT_ERR_CONFIGURE = 2, - EXIT_ERR_DRIVERS = 3, -}; - -extern _X_EXPORT void AbortDDX(enum ExitCode error); -extern _X_EXPORT void ddxGiveUp(enum ExitCode error); -extern _X_EXPORT int TimeSinceLastInputEvent(void); - -/* strcasecmp.c */ -#if NEED_STRCASECMP -#define strcasecmp xstrcasecmp -extern _X_EXPORT int xstrcasecmp(const char *s1, const char *s2); -#endif - -#if NEED_STRNCASECMP -#define strncasecmp xstrncasecmp -extern _X_EXPORT int xstrncasecmp(const char *s1, const char *s2, size_t n); -#endif - -#if NEED_STRCASESTR -#define strcasestr xstrcasestr -extern _X_EXPORT char *xstrcasestr(const char *s, const char *find); -#endif - -#ifndef HAS_STRLCPY -extern _X_EXPORT size_t strlcpy(char *dst, const char *src, size_t siz); -extern _X_EXPORT size_t strlcat(char *dst, const char *src, size_t siz); -#endif - -/* Logging. */ -typedef enum _LogParameter { - XLOG_FLUSH, - XLOG_SYNC, - XLOG_VERBOSITY, - XLOG_FILE_VERBOSITY -} LogParameter; - -/* Flags for log messages. */ -typedef enum { - X_PROBED, /* Value was probed */ - X_CONFIG, /* Value was given in the config file */ - X_DEFAULT, /* Value is a default */ - X_CMDLINE, /* Value was given on the command line */ - X_NOTICE, /* Notice */ - X_ERROR, /* Error message */ - X_WARNING, /* Warning message */ - X_INFO, /* Informational message */ - X_NONE, /* No prefix */ - X_NOT_IMPLEMENTED, /* Not implemented */ - X_UNKNOWN = -1 /* unknown -- this must always be last */ -} MessageType; - -extern _X_EXPORT const char *LogInit(const char *fname, const char *backup); -extern _X_EXPORT void LogClose(enum ExitCode error); -extern _X_EXPORT Bool LogSetParameter(LogParameter param, int value); -extern _X_EXPORT void LogVWrite(int verb, const char *f, va_list args) _X_ATTRIBUTE_PRINTF(2,0); -extern _X_EXPORT void LogWrite(int verb, const char *f, ...) _X_ATTRIBUTE_PRINTF(2,3); -extern _X_EXPORT void LogVMessageVerb(MessageType type, int verb, const char *format, - va_list args) _X_ATTRIBUTE_PRINTF(3,0); -extern _X_EXPORT void LogMessageVerb(MessageType type, int verb, const char *format, - ...) _X_ATTRIBUTE_PRINTF(3,4); -extern _X_EXPORT void LogMessage(MessageType type, const char *format, ...) - _X_ATTRIBUTE_PRINTF(2,3); -extern _X_EXPORT void FreeAuditTimer(void); -extern _X_EXPORT void AuditF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2); -extern _X_EXPORT void VAuditF(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1,0); -extern _X_EXPORT void FatalError(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_NORETURN; - -#ifdef DEBUG -#define DebugF ErrorF -#else -#define DebugF(...) /* */ -#endif - -extern _X_EXPORT void VErrorF(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1,0); -extern _X_EXPORT void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2); -extern _X_EXPORT void Error(const char *str); -extern _X_EXPORT void LogPrintMarkers(void); - -extern _X_EXPORT void xorg_backtrace(void); - -#ifdef _MSC_VER -#define snprintf _snprintf -#endif - -#endif /* OS_H */ +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +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 +OPEN GROUP 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 Open Group 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 Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + + +#ifndef OS_H +#define OS_H + +#include "misc.h" +#include +#include + +#define SCREEN_SAVER_ON 0 +#define SCREEN_SAVER_OFF 1 +#define SCREEN_SAVER_FORCER 2 +#define SCREEN_SAVER_CYCLE 3 + +#ifndef MAX_REQUEST_SIZE +#define MAX_REQUEST_SIZE 65535 +#endif +#ifndef MAX_BIG_REQUEST_SIZE +#define MAX_BIG_REQUEST_SIZE 4194303 +#endif + +typedef struct _FontPathRec *FontPathPtr; +typedef struct _NewClientRec *NewClientPtr; + +#ifndef xalloc +#define xnfalloc(size) XNFalloc((unsigned long)(size)) +#define xnfcalloc(_num, _size) XNFcalloc((unsigned long)(_num)*(unsigned long)(_size)) +#define xnfrealloc(ptr, size) XNFrealloc((pointer)(ptr), (unsigned long)(size)) + +#define xalloc(size) Xalloc((unsigned long)(size)) +#define xcalloc(_num, _size) Xcalloc((unsigned long)(_num)*(unsigned long)(_size)) +#define xrealloc(ptr, size) Xrealloc((pointer)(ptr), (unsigned long)(size)) +#define xfree(ptr) Xfree((pointer)(ptr)) +#define xstrdup(s) Xstrdup(s) +#define xnfstrdup(s) XNFstrdup(s) +#endif + +#include +#include + +#ifdef DDXBEFORERESET +extern void ddxBeforeReset (void); +#endif + +#ifdef DDXOSVERRORF +extern _X_EXPORT void (*OsVendorVErrorFProc)(const char *, va_list args); +#endif + +extern _X_EXPORT int WaitForSomething( + int* /*pClientsReady*/ +); + +extern _X_EXPORT int ReadRequestFromClient(ClientPtr /*client*/); + +extern _X_EXPORT Bool InsertFakeRequest( + ClientPtr /*client*/, + char* /*data*/, + int /*count*/); + +extern _X_EXPORT void ResetCurrentRequest(ClientPtr /*client*/); + +extern _X_EXPORT void FlushAllOutput(void); + +extern _X_EXPORT void FlushIfCriticalOutputPending(void); + +extern _X_EXPORT void SetCriticalOutputPending(void); + +extern _X_EXPORT int WriteToClient(ClientPtr /*who*/, int /*count*/, const void* /*buf*/); + +extern _X_EXPORT void ResetOsBuffers(void); + +extern _X_EXPORT int TransIsListening(char *protocol); + +extern _X_EXPORT void InitConnectionLimits(void); + +extern _X_EXPORT void NotifyParentProcess(void); + +extern _X_EXPORT void CreateWellKnownSockets(void); + +extern _X_EXPORT void ResetWellKnownSockets(void); + +extern _X_EXPORT void CloseWellKnownConnections(void); + +extern _X_EXPORT XID AuthorizationIDOfClient(ClientPtr /*client*/); + +extern _X_EXPORT char *ClientAuthorized( + ClientPtr /*client*/, + unsigned int /*proto_n*/, + char* /*auth_proto*/, + unsigned int /*string_n*/, + char* /*auth_string*/); + +extern _X_EXPORT Bool EstablishNewConnections( + ClientPtr /*clientUnused*/, + pointer /*closure*/); + +extern _X_EXPORT void CheckConnections(void); + +extern _X_EXPORT void CloseDownConnection(ClientPtr /*client*/); + +extern _X_EXPORT void AddGeneralSocket(int /*fd*/); + +extern _X_EXPORT void RemoveGeneralSocket(int /*fd*/); + +extern _X_EXPORT void AddEnabledDevice(int /*fd*/); + +extern _X_EXPORT void RemoveEnabledDevice(int /*fd*/); + +extern _X_EXPORT int OnlyListenToOneClient(ClientPtr /*client*/); + +extern _X_EXPORT void ListenToAllClients(void); + +extern _X_EXPORT void IgnoreClient(ClientPtr /*client*/); + +extern _X_EXPORT void AttendClient(ClientPtr /*client*/); + +extern _X_EXPORT void MakeClientGrabImpervious(ClientPtr /*client*/); + +extern _X_EXPORT void MakeClientGrabPervious(ClientPtr /*client*/); + +#ifdef XQUARTZ +extern void ListenOnOpenFD(int /* fd */, int /* noxauth */); +#endif + +extern _X_EXPORT CARD32 GetTimeInMillis(void); + +extern _X_EXPORT void AdjustWaitForDelay( + pointer /*waitTime*/, + unsigned long /*newdelay*/); + +typedef struct _OsTimerRec *OsTimerPtr; + +typedef CARD32 (*OsTimerCallback)( + OsTimerPtr /* timer */, + CARD32 /* time */, + pointer /* arg */); + +extern _X_EXPORT void TimerInit(void); + +extern _X_EXPORT Bool TimerForce(OsTimerPtr /* timer */); + +#define TimerAbsolute (1<<0) +#define TimerForceOld (1<<1) + +extern _X_EXPORT OsTimerPtr TimerSet( + OsTimerPtr /* timer */, + int /* flags */, + CARD32 /* millis */, + OsTimerCallback /* func */, + pointer /* arg */); + +extern _X_EXPORT void TimerCheck(void); +extern _X_EXPORT void TimerCancel(OsTimerPtr /* pTimer */); +extern _X_EXPORT void TimerFree(OsTimerPtr /* pTimer */); + +extern _X_EXPORT void SetScreenSaverTimer(void); +extern _X_EXPORT void FreeScreenSaverTimer(void); + +extern _X_EXPORT void AutoResetServer(int /*sig*/); + +extern _X_EXPORT void GiveUp(int /*sig*/); + +extern _X_EXPORT void UseMsg(void); + +extern _X_EXPORT void ProcessCommandLine(int /*argc*/, char* /*argv*/[]); + +extern _X_EXPORT int set_font_authorizations( + char ** /* authorizations */, + int * /*authlen */, + pointer /* client */); + +#ifndef _HAVE_XALLOC_DECLS +#define _HAVE_XALLOC_DECLS + +/* + * Use malloc(3) instead. + */ +extern _X_EXPORT void *Xalloc(unsigned long /*amount*/) _X_DEPRECATED; +/* + * Use calloc(3) instead + */ +extern _X_EXPORT void *Xcalloc(unsigned long /*amount*/) _X_DEPRECATED; +/* + * Use realloc(3) instead + */ +extern _X_EXPORT void *Xrealloc(void * /*ptr*/, unsigned long /*amount*/) + _X_DEPRECATED; +/* + * Use free(3) instead + */ +extern _X_EXPORT void Xfree(void * /*ptr*/) _X_DEPRECATED; + +#endif + +/* + * This function malloc(3)s buffer, terminating the server if there is not + * enough memory. + */ +extern _X_EXPORT void *XNFalloc(unsigned long /*amount*/); +/* + * This function calloc(3)s buffer, terminating the server if there is not + * enough memory. + */ +extern _X_EXPORT void *XNFcalloc(unsigned long /*amount*/); +/* + * This function realloc(3)s passed buffer, terminating the server if there is + * not enough memory. + */ +extern _X_EXPORT void *XNFrealloc(void * /*ptr*/, unsigned long /*amount*/); + +/* + * This function strdup(3)s passed string. The only difference from the library + * function that it is safe to pass NULL, as NULL will be returned. + */ +extern _X_EXPORT char *Xstrdup(const char *s); + +/* + * This function strdup(3)s passed string, terminating the server if there is + * not enough memory. If NULL is passed to this function, NULL is returned. + */ +extern _X_EXPORT char *XNFstrdup(const char *s); + +/* Include new X*asprintf API */ +#include "Xprintf.h" + +/* Older api deprecated in favor of the asprintf versions */ +extern _X_EXPORT char *Xprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_DEPRECATED; +extern _X_EXPORT char *Xvprintf(const char *fmt, va_list va)_X_ATTRIBUTE_PRINTF(1,0) _X_DEPRECATED; +extern _X_EXPORT char *XNFprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_DEPRECATED; +extern _X_EXPORT char *XNFvprintf(const char *fmt, va_list va)_X_ATTRIBUTE_PRINTF(1,0) _X_DEPRECATED; + +typedef void (*OsSigHandlerPtr)(int /* sig */); +typedef int (*OsSigWrapperPtr)(int /* sig */); + +extern _X_EXPORT OsSigHandlerPtr OsSignal(int /* sig */, OsSigHandlerPtr /* handler */); +extern _X_EXPORT OsSigWrapperPtr OsRegisterSigWrapper(OsSigWrapperPtr newWrap); + +extern _X_EXPORT int auditTrailLevel; + +extern _X_EXPORT void LockServer(void); +extern _X_EXPORT void UnlockServer(void); + +extern _X_EXPORT int OsLookupColor( + int /*screen*/, + char * /*name*/, + unsigned /*len*/, + unsigned short * /*pred*/, + unsigned short * /*pgreen*/, + unsigned short * /*pblue*/); + +extern _X_EXPORT void OsInit(void); + +extern _X_EXPORT void OsCleanup(Bool); + +extern _X_EXPORT void OsVendorFatalError(void); + +extern _X_EXPORT void OsVendorInit(void); + +extern _X_EXPORT void OsBlockSignals (void); + +extern _X_EXPORT void OsReleaseSignals (void); + +extern _X_EXPORT void OsAbort (void) _X_NORETURN; + +#if !defined(WIN32) +extern _X_EXPORT int System(char *); +extern _X_EXPORT pointer Popen(char *, char *); +extern _X_EXPORT int Pclose(pointer); +extern _X_EXPORT pointer Fopen(char *, char *); +extern _X_EXPORT int Fclose(pointer); +#else +#define System(a) system(a) +#define Popen(a,b) popen(a,b) +#define Pclose(a) pclose(a) +#define Fopen(a,b) fopen(a,b) +#define Fclose(a) fclose(a) +#endif + +extern _X_EXPORT void CheckUserParameters(int argc, char **argv, char **envp); +extern _X_EXPORT void CheckUserAuthorization(void); + +extern _X_EXPORT int AddHost( + ClientPtr /*client*/, + int /*family*/, + unsigned /*length*/, + const void * /*pAddr*/); + +extern _X_EXPORT Bool ForEachHostInFamily ( + int /*family*/, + Bool (* /*func*/ )( + unsigned char * /* addr */, + short /* len */, + pointer /* closure */), + pointer /*closure*/); + +extern _X_EXPORT int RemoveHost( + ClientPtr /*client*/, + int /*family*/, + unsigned /*length*/, + pointer /*pAddr*/); + +extern _X_EXPORT int GetHosts( + pointer * /*data*/, + int * /*pnHosts*/, + int * /*pLen*/, + BOOL * /*pEnabled*/); + +typedef struct sockaddr * sockaddrPtr; + +extern _X_EXPORT int InvalidHost(sockaddrPtr /*saddr*/, int /*len*/, ClientPtr client); + +extern _X_EXPORT int LocalClient(ClientPtr /* client */); + +extern _X_EXPORT int LocalClientCred(ClientPtr, int *, int *); + +#define LCC_UID_SET (1 << 0) +#define LCC_GID_SET (1 << 1) +#define LCC_PID_SET (1 << 2) +#define LCC_ZID_SET (1 << 3) + +typedef struct { + int fieldsSet; /* Bit mask of fields set */ + int euid; /* Effective uid */ + int egid; /* Primary effective group id */ + int nSuppGids; /* Number of supplementary group ids */ + int *pSuppGids; /* Array of supplementary group ids */ + int pid; /* Process id */ + int zoneid; /* Only set on Solaris 10 & later */ +} LocalClientCredRec; + +extern _X_EXPORT int GetLocalClientCreds(ClientPtr, LocalClientCredRec **); +extern _X_EXPORT void FreeLocalClientCreds(LocalClientCredRec *); + +extern _X_EXPORT int ChangeAccessControl(ClientPtr /*client*/, int /*fEnabled*/); + +extern _X_EXPORT int GetAccessControl(void); + + +extern _X_EXPORT void AddLocalHosts(void); + +extern _X_EXPORT void ResetHosts(char *display); + +extern _X_EXPORT void EnableLocalHost(void); + +extern _X_EXPORT void DisableLocalHost(void); + +extern _X_EXPORT void AccessUsingXdmcp(void); + +extern _X_EXPORT void DefineSelf(int /*fd*/, const int /*protocol*/); + +#if XDMCP +extern _X_EXPORT void AugmentSelf(pointer /*from*/, int /*len*/); + +extern _X_EXPORT void RegisterAuthorizations(void); +#endif + +extern _X_EXPORT void InitAuthorization(char * /*filename*/); + +/* extern int LoadAuthorization(void); */ + +extern _X_EXPORT int AuthorizationFromID ( + XID id, + unsigned short *name_lenp, + char **namep, + unsigned short *data_lenp, + char **datap); + +extern _X_EXPORT XID CheckAuthorization( + unsigned int /*namelength*/, + const char * /*name*/, + unsigned int /*datalength*/, + const char * /*data*/, + ClientPtr /*client*/, + char ** /*reason*/ +); + +extern _X_EXPORT void ResetAuthorization(void); + +extern _X_EXPORT int RemoveAuthorization ( + unsigned short name_length, + const char *name, + unsigned short data_length, + const char *data); + +extern _X_EXPORT int AddAuthorization( + unsigned int /*name_length*/, + const char * /*name*/, + unsigned int /*data_length*/, + char * /*data*/); + +#ifdef XCSECURITY +extern _X_EXPORT XID GenerateAuthorization( + unsigned int /* name_length */, + const char * /* name */, + unsigned int /* data_length */, + const char * /* data */, + unsigned int * /* data_length_return */, + char ** /* data_return */); +#endif + +extern _X_EXPORT int ddxProcessArgument(int /*argc*/, char * /*argv*/ [], int /*i*/); + +extern _X_EXPORT void ddxUseMsg(void); + +/* stuff for ReplyCallback */ +extern _X_EXPORT CallbackListPtr ReplyCallback; +typedef struct { + ClientPtr client; + const void *replyData; + unsigned long dataLenBytes; + unsigned long bytesRemaining; + Bool startOfReply; +} ReplyInfoRec; + +/* stuff for FlushCallback */ +extern _X_EXPORT CallbackListPtr FlushCallback; + +enum ExitCode { + EXIT_NO_ERROR = 0, + EXIT_ERR_ABORT = 1, + EXIT_ERR_CONFIGURE = 2, + EXIT_ERR_DRIVERS = 3, +}; + +extern _X_EXPORT void AbortDDX(enum ExitCode error); +extern _X_EXPORT void ddxGiveUp(enum ExitCode error); +extern _X_EXPORT int TimeSinceLastInputEvent(void); + +/* strcasecmp.c */ +#if NEED_STRCASECMP +#define strcasecmp xstrcasecmp +extern _X_EXPORT int xstrcasecmp(const char *s1, const char *s2); +#endif + +#if NEED_STRNCASECMP +#define strncasecmp xstrncasecmp +extern _X_EXPORT int xstrncasecmp(const char *s1, const char *s2, size_t n); +#endif + +#if NEED_STRCASESTR +#define strcasestr xstrcasestr +extern _X_EXPORT char *xstrcasestr(const char *s, const char *find); +#endif + +#ifndef HAS_STRLCPY +extern _X_EXPORT size_t strlcpy(char *dst, const char *src, size_t siz); +extern _X_EXPORT size_t strlcat(char *dst, const char *src, size_t siz); +#endif + +/* Logging. */ +typedef enum _LogParameter { + XLOG_FLUSH, + XLOG_SYNC, + XLOG_VERBOSITY, + XLOG_FILE_VERBOSITY +} LogParameter; + +/* Flags for log messages. */ +typedef enum { + X_PROBED, /* Value was probed */ + X_CONFIG, /* Value was given in the config file */ + X_DEFAULT, /* Value is a default */ + X_CMDLINE, /* Value was given on the command line */ + X_NOTICE, /* Notice */ + X_ERROR, /* Error message */ + X_WARNING, /* Warning message */ + X_INFO, /* Informational message */ + X_NONE, /* No prefix */ + X_NOT_IMPLEMENTED, /* Not implemented */ + X_UNKNOWN = -1 /* unknown -- this must always be last */ +} MessageType; + +extern _X_EXPORT const char *LogInit(const char *fname, const char *backup); +extern _X_EXPORT void LogClose(enum ExitCode error); +extern _X_EXPORT Bool LogSetParameter(LogParameter param, int value); +extern _X_EXPORT void LogVWrite(int verb, const char *f, va_list args) _X_ATTRIBUTE_PRINTF(2,0); +extern _X_EXPORT void LogWrite(int verb, const char *f, ...) _X_ATTRIBUTE_PRINTF(2,3); +extern _X_EXPORT void LogVMessageVerb(MessageType type, int verb, const char *format, + va_list args) _X_ATTRIBUTE_PRINTF(3,0); +extern _X_EXPORT void LogMessageVerb(MessageType type, int verb, const char *format, + ...) _X_ATTRIBUTE_PRINTF(3,4); +extern _X_EXPORT void LogMessage(MessageType type, const char *format, ...) + _X_ATTRIBUTE_PRINTF(2,3); +extern _X_EXPORT void FreeAuditTimer(void); +extern _X_EXPORT void AuditF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2); +extern _X_EXPORT void VAuditF(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1,0); +extern _X_EXPORT void FatalError(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_NORETURN; + +#ifdef DEBUG +#define DebugF ErrorF +#else +#define DebugF(...) /* */ +#endif + +extern _X_EXPORT void VErrorF(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1,0); +extern _X_EXPORT void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2); +extern _X_EXPORT void Error(const char *str); +extern _X_EXPORT void LogPrintMarkers(void); + +extern _X_EXPORT void xorg_backtrace(void); + +#ifdef _MSC_VER +#define snprintf _snprintf +#endif + +#endif /* OS_H */ diff --git a/xorg-server/include/protocol-versions.h b/xorg-server/include/protocol-versions.h index 5ecf39e49..7b7a9f53c 100644 --- a/xorg-server/include/protocol-versions.h +++ b/xorg-server/include/protocol-versions.h @@ -1,144 +1,144 @@ -/* - * Copyright © 2009 Red Hat, Inc. - * - * 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. - * - */ - -/** - * This file specifies the server-supported protocol versions. - */ -#ifndef _PROTOCOL_VERSIONS_ -#define _PROTOCOL_VERSIONS_ - -/* Apple DRI */ -#define SERVER_APPLEDRI_MAJOR_VERSION 1 -#define SERVER_APPLEDRI_MINOR_VERSION 0 -#define SERVER_APPLEDRI_PATCH_VERSION 0 - -/* AppleWM */ -#define SERVER_APPLEWM_MAJOR_VERSION 1 -#define SERVER_APPLEWM_MINOR_VERSION 3 -#define SERVER_APPLEWM_PATCH_VERSION 0 - -/* Composite */ -#define SERVER_COMPOSITE_MAJOR_VERSION 0 -#define SERVER_COMPOSITE_MINOR_VERSION 4 - -/* Damage */ -#define SERVER_DAMAGE_MAJOR_VERSION 1 -#define SERVER_DAMAGE_MINOR_VERSION 1 - -/* DMX */ -#define SERVER_DMX_MAJOR_VERSION 2 -#define SERVER_DMX_MINOR_VERSION 2 -#define SERVER_DMX_PATCH_VERSION 20040604 - -/* Generic event extension */ -#define SERVER_GE_MAJOR_VERSION 1 -#define SERVER_GE_MINOR_VERSION 0 - -/* GLX */ -#define SERVER_GLX_MAJOR_VERSION 1 -#define SERVER_GLX_MINOR_VERSION 4 - -/* Xinerama */ -#define SERVER_PANORAMIX_MAJOR_VERSION 1 -#define SERVER_PANORAMIX_MINOR_VERSION 1 - -/* RandR */ -#define SERVER_RANDR_MAJOR_VERSION 1 -#define SERVER_RANDR_MINOR_VERSION 3 - -/* Record */ -#define SERVER_RECORD_MAJOR_VERSION 1 -#define SERVER_RECORD_MINOR_VERSION 13 - -/* Render */ -#define SERVER_RENDER_MAJOR_VERSION 0 -#define SERVER_RENDER_MINOR_VERSION 11 - -/* RandR Xinerama */ -#define SERVER_RRXINERAMA_MAJOR_VERSION 1 -#define SERVER_RRXINERAMA_MINOR_VERSION 1 - -/* Screensaver */ -#define SERVER_SAVER_MAJOR_VERSION 1 -#define SERVER_SAVER_MINOR_VERSION 1 - -/* Security */ -#define SERVER_SECURITY_MAJOR_VERSION 1 -#define SERVER_SECURITY_MINOR_VERSION 0 - -/* Shape */ -#define SERVER_SHAPE_MAJOR_VERSION 1 -#define SERVER_SHAPE_MINOR_VERSION 1 - -/* SHM */ -#define SERVER_SHM_MAJOR_VERSION 1 -#define SERVER_SHM_MINOR_VERSION 1 - -/* Sync */ -#define SERVER_SYNC_MAJOR_VERSION 3 -#define SERVER_SYNC_MINOR_VERSION 1 - -/* Windows WM */ -#define SERVER_WINDOWSWM_MAJOR_VERSION 1 -#define SERVER_WINDOWSWM_MINOR_VERSION 0 -#define SERVER_WINDOWSWM_PATCH_VERSION 0 - -/* DGA */ -#define SERVER_XDGA_MAJOR_VERSION 2 -#define SERVER_XDGA_MINOR_VERSION 0 - -/* Big Font */ -#define SERVER_XF86BIGFONT_MAJOR_VERSION 1 -#define SERVER_XF86BIGFONT_MINOR_VERSION 1 - -/* DRI */ -#define SERVER_XF86DRI_MAJOR_VERSION 4 -#define SERVER_XF86DRI_MINOR_VERSION 1 -#define SERVER_XF86DRI_PATCH_VERSION 20040604 - -/* Vidmode */ -#define SERVER_XF86VIDMODE_MAJOR_VERSION 2 -#define SERVER_XF86VIDMODE_MINOR_VERSION 2 - -/* Fixes */ -#define SERVER_XFIXES_MAJOR_VERSION 5 -#define SERVER_XFIXES_MINOR_VERSION 0 - -/* X Input */ -#define SERVER_XI_MAJOR_VERSION 2 -#define SERVER_XI_MINOR_VERSION 0 - -/* XKB */ -#define SERVER_XKB_MAJOR_VERSION 1 -#define SERVER_XKB_MINOR_VERSION 0 - -/* Resource */ -#define SERVER_XRES_MAJOR_VERSION 1 -#define SERVER_XRES_MINOR_VERSION 0 - -/* XvMC */ -#define SERVER_XVMC_MAJOR_VERSION 1 -#define SERVER_XVMC_MINOR_VERSION 1 - -#endif +/* + * Copyright © 2009 Red Hat, Inc. + * + * 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. + * + */ + +/** + * This file specifies the server-supported protocol versions. + */ +#ifndef _PROTOCOL_VERSIONS_ +#define _PROTOCOL_VERSIONS_ + +/* Apple DRI */ +#define SERVER_APPLEDRI_MAJOR_VERSION 1 +#define SERVER_APPLEDRI_MINOR_VERSION 0 +#define SERVER_APPLEDRI_PATCH_VERSION 0 + +/* AppleWM */ +#define SERVER_APPLEWM_MAJOR_VERSION 1 +#define SERVER_APPLEWM_MINOR_VERSION 3 +#define SERVER_APPLEWM_PATCH_VERSION 0 + +/* Composite */ +#define SERVER_COMPOSITE_MAJOR_VERSION 0 +#define SERVER_COMPOSITE_MINOR_VERSION 4 + +/* Damage */ +#define SERVER_DAMAGE_MAJOR_VERSION 1 +#define SERVER_DAMAGE_MINOR_VERSION 1 + +/* DMX */ +#define SERVER_DMX_MAJOR_VERSION 2 +#define SERVER_DMX_MINOR_VERSION 2 +#define SERVER_DMX_PATCH_VERSION 20040604 + +/* Generic event extension */ +#define SERVER_GE_MAJOR_VERSION 1 +#define SERVER_GE_MINOR_VERSION 0 + +/* GLX */ +#define SERVER_GLX_MAJOR_VERSION 1 +#define SERVER_GLX_MINOR_VERSION 4 + +/* Xinerama */ +#define SERVER_PANORAMIX_MAJOR_VERSION 1 +#define SERVER_PANORAMIX_MINOR_VERSION 1 + +/* RandR */ +#define SERVER_RANDR_MAJOR_VERSION 1 +#define SERVER_RANDR_MINOR_VERSION 3 + +/* Record */ +#define SERVER_RECORD_MAJOR_VERSION 1 +#define SERVER_RECORD_MINOR_VERSION 13 + +/* Render */ +#define SERVER_RENDER_MAJOR_VERSION 0 +#define SERVER_RENDER_MINOR_VERSION 11 + +/* RandR Xinerama */ +#define SERVER_RRXINERAMA_MAJOR_VERSION 1 +#define SERVER_RRXINERAMA_MINOR_VERSION 1 + +/* Screensaver */ +#define SERVER_SAVER_MAJOR_VERSION 1 +#define SERVER_SAVER_MINOR_VERSION 1 + +/* Security */ +#define SERVER_SECURITY_MAJOR_VERSION 1 +#define SERVER_SECURITY_MINOR_VERSION 0 + +/* Shape */ +#define SERVER_SHAPE_MAJOR_VERSION 1 +#define SERVER_SHAPE_MINOR_VERSION 1 + +/* SHM */ +#define SERVER_SHM_MAJOR_VERSION 1 +#define SERVER_SHM_MINOR_VERSION 1 + +/* Sync */ +#define SERVER_SYNC_MAJOR_VERSION 3 +#define SERVER_SYNC_MINOR_VERSION 1 + +/* Windows WM */ +#define SERVER_WINDOWSWM_MAJOR_VERSION 1 +#define SERVER_WINDOWSWM_MINOR_VERSION 0 +#define SERVER_WINDOWSWM_PATCH_VERSION 0 + +/* DGA */ +#define SERVER_XDGA_MAJOR_VERSION 2 +#define SERVER_XDGA_MINOR_VERSION 0 + +/* Big Font */ +#define SERVER_XF86BIGFONT_MAJOR_VERSION 1 +#define SERVER_XF86BIGFONT_MINOR_VERSION 1 + +/* DRI */ +#define SERVER_XF86DRI_MAJOR_VERSION 4 +#define SERVER_XF86DRI_MINOR_VERSION 1 +#define SERVER_XF86DRI_PATCH_VERSION 20040604 + +/* Vidmode */ +#define SERVER_XF86VIDMODE_MAJOR_VERSION 2 +#define SERVER_XF86VIDMODE_MINOR_VERSION 2 + +/* Fixes */ +#define SERVER_XFIXES_MAJOR_VERSION 5 +#define SERVER_XFIXES_MINOR_VERSION 0 + +/* X Input */ +#define SERVER_XI_MAJOR_VERSION 2 +#define SERVER_XI_MINOR_VERSION 0 + +/* XKB */ +#define SERVER_XKB_MAJOR_VERSION 1 +#define SERVER_XKB_MINOR_VERSION 0 + +/* Resource */ +#define SERVER_XRES_MAJOR_VERSION 1 +#define SERVER_XRES_MINOR_VERSION 0 + +/* XvMC */ +#define SERVER_XVMC_MAJOR_VERSION 1 +#define SERVER_XVMC_MINOR_VERSION 1 + +#endif diff --git a/xorg-server/include/ptrveloc.h b/xorg-server/include/ptrveloc.h index 081de448f..6ca309c8c 100644 --- a/xorg-server/include/ptrveloc.h +++ b/xorg-server/include/ptrveloc.h @@ -1,144 +1,144 @@ -/* - * - * Copyright © 2006-2011 Simon Thum simon dot thum at gmx dot de - * - * 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. - */ - -#ifndef POINTERVELOCITY_H -#define POINTERVELOCITY_H - -#include - -/* constants for acceleration profiles */ - -#define AccelProfileNone -1 -#define AccelProfileClassic 0 -#define AccelProfileDeviceSpecific 1 -#define AccelProfilePolynomial 2 -#define AccelProfileSmoothLinear 3 -#define AccelProfileSimple 4 -#define AccelProfilePower 5 -#define AccelProfileLinear 6 -#define AccelProfileSmoothLimited 7 -#define AccelProfileLAST AccelProfileSmoothLimited - -/* fwd */ -struct _DeviceVelocityRec; - -/** - * profile - * returns actual acceleration depending on velocity, acceleration control,... - */ -typedef float (*PointerAccelerationProfileFunc) - (DeviceIntPtr dev, struct _DeviceVelocityRec* vel, - float velocity, float threshold, float accelCoeff); - -/** - * a motion history, with just enough information to - * calc mean velocity and decide which motion was along - * a more or less straight line - */ -typedef struct _MotionTracker { - int dx, dy; /* accumulated delta for each axis */ - int time; /* time of creation */ - int dir; /* initial direction bitfield */ -} MotionTracker, *MotionTrackerPtr; - -/** - * Contains all data needed to implement mouse ballistics - */ -typedef struct _DeviceVelocityRec { - MotionTrackerPtr tracker; - int num_tracker; - int cur_tracker; /* current index */ - float velocity; /* velocity as guessed by algorithm */ - float last_velocity; /* previous velocity estimate */ - int last_dx; /* last time-difference */ - int last_dy ; /* phase of last/current estimate */ - float corr_mul; /* config: multiply this into velocity */ - float const_acceleration; /* config: (recipr.) const deceleration */ - float min_acceleration; /* config: minimum acceleration */ - short reset_time; /* config: reset non-visible state after # ms */ - short use_softening; /* config: use softening of mouse values */ - float max_rel_diff; /* config: max. relative difference */ - float max_diff; /* config: max. difference */ - int initial_range; /* config: max. offset used as initial velocity */ - Bool average_accel; /* config: average acceleration over velocity */ - PointerAccelerationProfileFunc Profile; - PointerAccelerationProfileFunc deviceSpecificProfile; - void* profile_private;/* extended data, see SetAccelerationProfile() */ - struct { /* to be able to query this information */ - int profile_number; - } statistics; -} DeviceVelocityRec, *DeviceVelocityPtr; - -/** - * contains the run-time data for the predictable scheme, that is, a - * DeviceVelocityPtr and the property handlers. - */ -typedef struct _PredictableAccelSchemeRec { - DeviceVelocityPtr vel; - long* prop_handlers; - int num_prop_handlers; -} PredictableAccelSchemeRec, *PredictableAccelSchemePtr; - -extern _X_EXPORT void -InitVelocityData(DeviceVelocityPtr vel); - -extern _X_EXPORT void -InitTrackers(DeviceVelocityPtr vel, int ntracker); - -extern _X_EXPORT BOOL -ProcessVelocityData2D(DeviceVelocityPtr vel, int dx, int dy, int time); - -extern _X_EXPORT float -BasicComputeAcceleration(DeviceIntPtr dev, DeviceVelocityPtr vel, - float velocity, float threshold, float acc); - -extern _X_EXPORT void -FreeVelocityData(DeviceVelocityPtr vel); - -extern _X_EXPORT int -SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num); - -extern _X_EXPORT DeviceVelocityPtr -GetDevicePredictableAccelData(DeviceIntPtr dev); - -extern _X_EXPORT void -SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr vel, - PointerAccelerationProfileFunc profile); - -extern _X_INTERNAL void -AccelerationDefaultCleanup(DeviceIntPtr dev); - -extern _X_INTERNAL Bool -InitPredictableAccelerationScheme(DeviceIntPtr dev, - struct _ValuatorAccelerationRec* protoScheme); - -extern _X_INTERNAL void -acceleratePointerPredictable(DeviceIntPtr dev, ValuatorMask* val, - CARD32 evtime); - -extern _X_INTERNAL void -acceleratePointerLightweight(DeviceIntPtr dev, ValuatorMask* val, - CARD32 evtime); - -#endif /* POINTERVELOCITY_H */ +/* + * + * Copyright © 2006-2011 Simon Thum simon dot thum at gmx dot de + * + * 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. + */ + +#ifndef POINTERVELOCITY_H +#define POINTERVELOCITY_H + +#include + +/* constants for acceleration profiles */ + +#define AccelProfileNone -1 +#define AccelProfileClassic 0 +#define AccelProfileDeviceSpecific 1 +#define AccelProfilePolynomial 2 +#define AccelProfileSmoothLinear 3 +#define AccelProfileSimple 4 +#define AccelProfilePower 5 +#define AccelProfileLinear 6 +#define AccelProfileSmoothLimited 7 +#define AccelProfileLAST AccelProfileSmoothLimited + +/* fwd */ +struct _DeviceVelocityRec; + +/** + * profile + * returns actual acceleration depending on velocity, acceleration control,... + */ +typedef float (*PointerAccelerationProfileFunc) + (DeviceIntPtr dev, struct _DeviceVelocityRec* vel, + float velocity, float threshold, float accelCoeff); + +/** + * a motion history, with just enough information to + * calc mean velocity and decide which motion was along + * a more or less straight line + */ +typedef struct _MotionTracker { + int dx, dy; /* accumulated delta for each axis */ + int time; /* time of creation */ + int dir; /* initial direction bitfield */ +} MotionTracker, *MotionTrackerPtr; + +/** + * Contains all data needed to implement mouse ballistics + */ +typedef struct _DeviceVelocityRec { + MotionTrackerPtr tracker; + int num_tracker; + int cur_tracker; /* current index */ + float velocity; /* velocity as guessed by algorithm */ + float last_velocity; /* previous velocity estimate */ + int last_dx; /* last time-difference */ + int last_dy ; /* phase of last/current estimate */ + float corr_mul; /* config: multiply this into velocity */ + float const_acceleration; /* config: (recipr.) const deceleration */ + float min_acceleration; /* config: minimum acceleration */ + short reset_time; /* config: reset non-visible state after # ms */ + short use_softening; /* config: use softening of mouse values */ + float max_rel_diff; /* config: max. relative difference */ + float max_diff; /* config: max. difference */ + int initial_range; /* config: max. offset used as initial velocity */ + Bool average_accel; /* config: average acceleration over velocity */ + PointerAccelerationProfileFunc Profile; + PointerAccelerationProfileFunc deviceSpecificProfile; + void* profile_private;/* extended data, see SetAccelerationProfile() */ + struct { /* to be able to query this information */ + int profile_number; + } statistics; +} DeviceVelocityRec, *DeviceVelocityPtr; + +/** + * contains the run-time data for the predictable scheme, that is, a + * DeviceVelocityPtr and the property handlers. + */ +typedef struct _PredictableAccelSchemeRec { + DeviceVelocityPtr vel; + long* prop_handlers; + int num_prop_handlers; +} PredictableAccelSchemeRec, *PredictableAccelSchemePtr; + +extern _X_EXPORT void +InitVelocityData(DeviceVelocityPtr vel); + +extern _X_EXPORT void +InitTrackers(DeviceVelocityPtr vel, int ntracker); + +extern _X_EXPORT BOOL +ProcessVelocityData2D(DeviceVelocityPtr vel, int dx, int dy, int time); + +extern _X_EXPORT float +BasicComputeAcceleration(DeviceIntPtr dev, DeviceVelocityPtr vel, + float velocity, float threshold, float acc); + +extern _X_EXPORT void +FreeVelocityData(DeviceVelocityPtr vel); + +extern _X_EXPORT int +SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num); + +extern _X_EXPORT DeviceVelocityPtr +GetDevicePredictableAccelData(DeviceIntPtr dev); + +extern _X_EXPORT void +SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr vel, + PointerAccelerationProfileFunc profile); + +extern _X_INTERNAL void +AccelerationDefaultCleanup(DeviceIntPtr dev); + +extern _X_INTERNAL Bool +InitPredictableAccelerationScheme(DeviceIntPtr dev, + struct _ValuatorAccelerationRec* protoScheme); + +extern _X_INTERNAL void +acceleratePointerPredictable(DeviceIntPtr dev, ValuatorMask* val, + CARD32 evtime); + +extern _X_INTERNAL void +acceleratePointerLightweight(DeviceIntPtr dev, ValuatorMask* val, + CARD32 evtime); + +#endif /* POINTERVELOCITY_H */ diff --git a/xorg-server/include/regionstr.h b/xorg-server/include/regionstr.h index 75db30a3f..3dfef5c83 100644 --- a/xorg-server/include/regionstr.h +++ b/xorg-server/include/regionstr.h @@ -1,365 +1,365 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef REGIONSTRUCT_H -#define REGIONSTRUCT_H - -typedef struct pixman_region16 RegionRec, *RegionPtr; - -#include "miscstruct.h" - -/* Return values from RectIn() */ - -#define rgnOUT 0 -#define rgnIN 1 -#define rgnPART 2 - -#define NullRegion ((RegionPtr)0) - -/* - * clip region - */ - -typedef struct pixman_region16_data RegDataRec, *RegDataPtr; - -extern _X_EXPORT BoxRec RegionEmptyBox; -extern _X_EXPORT RegDataRec RegionEmptyData; -extern _X_EXPORT RegDataRec RegionBrokenData; -static inline Bool RegionNil(RegionPtr reg) { - return ((reg)->data && !(reg)->data->numRects); -} - -/* not a region */ - -static inline Bool RegionNar(RegionPtr reg) { - return ((reg)->data == &RegionBrokenData); -} - -static inline int RegionNumRects(RegionPtr reg) { - return ((reg)->data ? (reg)->data->numRects : 1); -} - -static inline int RegionSize(RegionPtr reg) { - return ((reg)->data ? (reg)->data->size : 0); -} - -static inline BoxPtr RegionRects(RegionPtr reg) { - return ((reg)->data ? (BoxPtr)((reg)->data + 1) : &(reg)->extents); -} - -static inline BoxPtr RegionBoxptr(RegionPtr reg) { - return ((BoxPtr)((reg)->data + 1)); -} - -static inline BoxPtr RegionBox(RegionPtr reg, int i) { - return (&RegionBoxptr(reg)[i]); -} - -static inline BoxPtr RegionTop(RegionPtr reg) { - return RegionBox(reg, (reg)->data->numRects); -} - -static inline BoxPtr RegionEnd(RegionPtr reg) { - return RegionBox(reg, (reg)->data->numRects - 1); -} - -static inline size_t RegionSizeof(int n) { - return (sizeof(RegDataRec) + ((n) * sizeof(BoxRec))); -} - -static inline void RegionInit(RegionPtr _pReg, BoxPtr _rect, int _size) -{ - if ((_rect) != NULL) - { - (_pReg)->extents = *(_rect); - (_pReg)->data = (RegDataPtr)NULL; - } - else - { - (_pReg)->extents = RegionEmptyBox; - if (((_size) > 1) && ((_pReg)->data = - (RegDataPtr)malloc(RegionSizeof(_size)))) - { - (_pReg)->data->size = (_size); - (_pReg)->data->numRects = 0; - } - else - (_pReg)->data = &RegionEmptyData; - } -} - -static inline Bool RegionInitBoxes(RegionPtr pReg, BoxPtr boxes, int nBoxes) -{ - return pixman_region_init_rects (pReg, boxes, nBoxes); -} - -static inline void RegionUninit(RegionPtr _pReg) -{ - if ((_pReg)->data && (_pReg)->data->size) { - free((_pReg)->data); - (_pReg)->data = NULL; - } -} - -static inline void RegionReset(RegionPtr _pReg, BoxPtr _pBox) -{ - (_pReg)->extents = *(_pBox); - RegionUninit(_pReg); - (_pReg)->data = (RegDataPtr)NULL; -} - -static inline Bool RegionNotEmpty(RegionPtr _pReg) { - return !RegionNil(_pReg); -} - -static inline Bool RegionBroken(RegionPtr _pReg) { - return RegionNar(_pReg); -} - -static inline void RegionEmpty(RegionPtr _pReg) -{ - RegionUninit(_pReg); - (_pReg)->extents.x2 = (_pReg)->extents.x1; - (_pReg)->extents.y2 = (_pReg)->extents.y1; - (_pReg)->data = &RegionEmptyData; -} - -static inline BoxPtr RegionExtents(RegionPtr _pReg) -{ - return (&(_pReg)->extents); -} - -static inline void RegionNull(RegionPtr _pReg) -{ - (_pReg)->extents = RegionEmptyBox; - (_pReg)->data = &RegionEmptyData; -} - -extern _X_EXPORT void InitRegions(void); - -extern _X_EXPORT RegionPtr RegionCreate( - BoxPtr /*rect*/, - int /*size*/); - -extern _X_EXPORT void RegionDestroy( - RegionPtr /*pReg*/); - -static inline Bool -RegionCopy(RegionPtr dst, RegionPtr src) -{ - return pixman_region_copy (dst, src); -} - -static inline Bool -RegionIntersect( - RegionPtr newReg, /* destination Region */ - RegionPtr reg1, - RegionPtr reg2 /* source regions */ - ) -{ - return pixman_region_intersect (newReg, reg1, reg2); -} - -static inline Bool -RegionUnion( - RegionPtr newReg, /* destination Region */ - RegionPtr reg1, - RegionPtr reg2 /* source regions */ - ) -{ - return pixman_region_union (newReg, reg1, reg2); -} - -extern _X_EXPORT Bool RegionAppend( - RegionPtr /*dstrgn*/, - RegionPtr /*rgn*/); - -extern _X_EXPORT Bool RegionValidate( - RegionPtr /*badreg*/, - Bool * /*pOverlap*/); - -extern _X_EXPORT RegionPtr RegionFromRects( - int /*nrects*/, - xRectanglePtr /*prect*/, - int /*ctype*/); - -/*- - *----------------------------------------------------------------------- - * Subtract -- - * Subtract regS from regM and leave the result in regD. - * S stands for subtrahend, M for minuend and D for difference. - * - * Results: - * TRUE if successful. - * - * Side Effects: - * regD is overwritten. - * - *----------------------------------------------------------------------- - */ -static inline Bool -RegionSubtract(RegionPtr regD, RegionPtr regM, RegionPtr regS) -{ - return pixman_region_subtract (regD, regM, regS); -} - -/*- - *----------------------------------------------------------------------- - * Inverse -- - * Take a region and a box and return a region that is everything - * in the box but not in the region. The careful reader will note - * that this is the same as subtracting the region from the box... - * - * Results: - * TRUE. - * - * Side Effects: - * newReg is overwritten. - * - *----------------------------------------------------------------------- - */ - -static inline Bool -RegionInverse( - RegionPtr newReg, /* Destination region */ - RegionPtr reg1, /* Region to invert */ - BoxPtr invRect /* Bounding box for inversion */ - ) -{ - return pixman_region_inverse (newReg, reg1, invRect); -} - -static inline int -RegionContainsRect(RegionPtr region, BoxPtr prect) -{ - return pixman_region_contains_rectangle (region, prect); -} - -/* TranslateRegion(pReg, x, y) - translates in place -*/ - -static inline void -RegionTranslate(RegionPtr pReg, int x, int y) -{ - pixman_region_translate (pReg, x, y); -} - -extern _X_EXPORT Bool RegionBreak( - RegionPtr /*pReg*/); - -static inline Bool -RegionContainsPoint( - RegionPtr pReg, - int x, - int y, - BoxPtr box /* "return" value */ - ) -{ - return pixman_region_contains_point (pReg, x, y, box); -} - -static inline Bool -RegionEqual(RegionPtr reg1, RegionPtr reg2) -{ - return pixman_region_equal (reg1, reg2); -} - -extern _X_EXPORT Bool RegionRectAlloc( - RegionPtr /*pRgn*/, - int /*n*/ -); - -#ifdef DEBUG -extern _X_EXPORT Bool RegionIsValid( - RegionPtr /*prgn*/ -); -#endif - -extern _X_EXPORT void RegionPrint( - RegionPtr /*pReg*/); - -#define INCLUDE_LEGACY_REGION_DEFINES -#ifdef INCLUDE_LEGACY_REGION_DEFINES - -#define REGION_NIL RegionNil -#define REGION_NAR RegionNar -#define REGION_NUM_RECTS RegionNumRects -#define REGION_SIZE RegionSize -#define REGION_RECTS RegionRects -#define REGION_BOXPTR RegionBoxptr -#define REGION_BOX RegionBox -#define REGION_TOP RegionTop -#define REGION_END RegionEnd -#define REGION_SZOF RegionSizeof -#define BITMAP_TO_REGION BitmapToRegion -#define REGION_CREATE(pScreen, r, s) RegionCreate(r,s) -#define REGION_COPY(pScreen, d, r) RegionCopy(d, r) -#define REGION_DESTROY(pScreen, r) RegionDestroy(r) -#define REGION_INTERSECT(pScreen, res, r1, r2) RegionIntersect(res, r1, r2) -#define REGION_UNION(pScreen, res, r1, r2) RegionUnion(res, r1, r2) -#define REGION_SUBTRACT(pScreen, res, r1, r2) RegionSubtract(res, r1, r2) -#define REGION_INVERSE(pScreen, n, r, b) RegionInverse(n, r, b) -#define REGION_TRANSLATE(pScreen, r, x, y) RegionTranslate(r, x, y) -#define RECT_IN_REGION(pScreen, r, b) RegionContainsRect(r, b) -#define POINT_IN_REGION(pScreen, r, x, y, b) RegionContainsPoint(r, x, y, b) -#define REGION_EQUAL(pScreen, r1, r2) RegionEqual(r1, r2) -#define REGION_APPEND(pScreen, d, r) RegionAppend(d, r) -#define REGION_VALIDATE(pScreen, r, o) RegionValidate(r, o) -#define RECTS_TO_REGION(pScreen, n, r, c) RegionFromRects(n, r, c) -#define REGION_BREAK(pScreen, r) RegionBreak(r) -#define REGION_INIT(pScreen, r, b, s) RegionInit(r, b, s) -#define REGION_UNINIT(pScreen, r) RegionUninit(r) -#define REGION_RESET(pScreen, r, b) RegionReset(r, b) -#define REGION_NOTEMPTY(pScreen, r) RegionNotEmpty(r) -#define REGION_BROKEN(pScreen, r) RegionBroken(r) -#define REGION_EMPTY(pScreen, r) RegionEmpty(r) -#define REGION_EXTENTS(pScreen, r) RegionExtents(r) -#define REGION_NULL(pScreen, r) RegionNull(r) - -#endif /* INCLUDE_LEGACY_REGION_DEFINES */ -#endif /* REGIONSTRUCT_H */ +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +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 +OPEN GROUP 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 Open Group 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 Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef REGIONSTRUCT_H +#define REGIONSTRUCT_H + +typedef struct pixman_region16 RegionRec, *RegionPtr; + +#include "miscstruct.h" + +/* Return values from RectIn() */ + +#define rgnOUT 0 +#define rgnIN 1 +#define rgnPART 2 + +#define NullRegion ((RegionPtr)0) + +/* + * clip region + */ + +typedef struct pixman_region16_data RegDataRec, *RegDataPtr; + +extern _X_EXPORT BoxRec RegionEmptyBox; +extern _X_EXPORT RegDataRec RegionEmptyData; +extern _X_EXPORT RegDataRec RegionBrokenData; +static inline Bool RegionNil(RegionPtr reg) { + return ((reg)->data && !(reg)->data->numRects); +} + +/* not a region */ + +static inline Bool RegionNar(RegionPtr reg) { + return ((reg)->data == &RegionBrokenData); +} + +static inline int RegionNumRects(RegionPtr reg) { + return ((reg)->data ? (reg)->data->numRects : 1); +} + +static inline int RegionSize(RegionPtr reg) { + return ((reg)->data ? (reg)->data->size : 0); +} + +static inline BoxPtr RegionRects(RegionPtr reg) { + return ((reg)->data ? (BoxPtr)((reg)->data + 1) : &(reg)->extents); +} + +static inline BoxPtr RegionBoxptr(RegionPtr reg) { + return ((BoxPtr)((reg)->data + 1)); +} + +static inline BoxPtr RegionBox(RegionPtr reg, int i) { + return (&RegionBoxptr(reg)[i]); +} + +static inline BoxPtr RegionTop(RegionPtr reg) { + return RegionBox(reg, (reg)->data->numRects); +} + +static inline BoxPtr RegionEnd(RegionPtr reg) { + return RegionBox(reg, (reg)->data->numRects - 1); +} + +static inline size_t RegionSizeof(int n) { + return (sizeof(RegDataRec) + ((n) * sizeof(BoxRec))); +} + +static inline void RegionInit(RegionPtr _pReg, BoxPtr _rect, int _size) +{ + if ((_rect) != NULL) + { + (_pReg)->extents = *(_rect); + (_pReg)->data = (RegDataPtr)NULL; + } + else + { + (_pReg)->extents = RegionEmptyBox; + if (((_size) > 1) && ((_pReg)->data = + (RegDataPtr)malloc(RegionSizeof(_size)))) + { + (_pReg)->data->size = (_size); + (_pReg)->data->numRects = 0; + } + else + (_pReg)->data = &RegionEmptyData; + } +} + +static inline Bool RegionInitBoxes(RegionPtr pReg, BoxPtr boxes, int nBoxes) +{ + return pixman_region_init_rects (pReg, boxes, nBoxes); +} + +static inline void RegionUninit(RegionPtr _pReg) +{ + if ((_pReg)->data && (_pReg)->data->size) { + free((_pReg)->data); + (_pReg)->data = NULL; + } +} + +static inline void RegionReset(RegionPtr _pReg, BoxPtr _pBox) +{ + (_pReg)->extents = *(_pBox); + RegionUninit(_pReg); + (_pReg)->data = (RegDataPtr)NULL; +} + +static inline Bool RegionNotEmpty(RegionPtr _pReg) { + return !RegionNil(_pReg); +} + +static inline Bool RegionBroken(RegionPtr _pReg) { + return RegionNar(_pReg); +} + +static inline void RegionEmpty(RegionPtr _pReg) +{ + RegionUninit(_pReg); + (_pReg)->extents.x2 = (_pReg)->extents.x1; + (_pReg)->extents.y2 = (_pReg)->extents.y1; + (_pReg)->data = &RegionEmptyData; +} + +static inline BoxPtr RegionExtents(RegionPtr _pReg) +{ + return (&(_pReg)->extents); +} + +static inline void RegionNull(RegionPtr _pReg) +{ + (_pReg)->extents = RegionEmptyBox; + (_pReg)->data = &RegionEmptyData; +} + +extern _X_EXPORT void InitRegions(void); + +extern _X_EXPORT RegionPtr RegionCreate( + BoxPtr /*rect*/, + int /*size*/); + +extern _X_EXPORT void RegionDestroy( + RegionPtr /*pReg*/); + +static inline Bool +RegionCopy(RegionPtr dst, RegionPtr src) +{ + return pixman_region_copy (dst, src); +} + +static inline Bool +RegionIntersect( + RegionPtr newReg, /* destination Region */ + RegionPtr reg1, + RegionPtr reg2 /* source regions */ + ) +{ + return pixman_region_intersect (newReg, reg1, reg2); +} + +static inline Bool +RegionUnion( + RegionPtr newReg, /* destination Region */ + RegionPtr reg1, + RegionPtr reg2 /* source regions */ + ) +{ + return pixman_region_union (newReg, reg1, reg2); +} + +extern _X_EXPORT Bool RegionAppend( + RegionPtr /*dstrgn*/, + RegionPtr /*rgn*/); + +extern _X_EXPORT Bool RegionValidate( + RegionPtr /*badreg*/, + Bool * /*pOverlap*/); + +extern _X_EXPORT RegionPtr RegionFromRects( + int /*nrects*/, + xRectanglePtr /*prect*/, + int /*ctype*/); + +/*- + *----------------------------------------------------------------------- + * Subtract -- + * Subtract regS from regM and leave the result in regD. + * S stands for subtrahend, M for minuend and D for difference. + * + * Results: + * TRUE if successful. + * + * Side Effects: + * regD is overwritten. + * + *----------------------------------------------------------------------- + */ +static inline Bool +RegionSubtract(RegionPtr regD, RegionPtr regM, RegionPtr regS) +{ + return pixman_region_subtract (regD, regM, regS); +} + +/*- + *----------------------------------------------------------------------- + * Inverse -- + * Take a region and a box and return a region that is everything + * in the box but not in the region. The careful reader will note + * that this is the same as subtracting the region from the box... + * + * Results: + * TRUE. + * + * Side Effects: + * newReg is overwritten. + * + *----------------------------------------------------------------------- + */ + +static inline Bool +RegionInverse( + RegionPtr newReg, /* Destination region */ + RegionPtr reg1, /* Region to invert */ + BoxPtr invRect /* Bounding box for inversion */ + ) +{ + return pixman_region_inverse (newReg, reg1, invRect); +} + +static inline int +RegionContainsRect(RegionPtr region, BoxPtr prect) +{ + return pixman_region_contains_rectangle (region, prect); +} + +/* TranslateRegion(pReg, x, y) + translates in place +*/ + +static inline void +RegionTranslate(RegionPtr pReg, int x, int y) +{ + pixman_region_translate (pReg, x, y); +} + +extern _X_EXPORT Bool RegionBreak( + RegionPtr /*pReg*/); + +static inline Bool +RegionContainsPoint( + RegionPtr pReg, + int x, + int y, + BoxPtr box /* "return" value */ + ) +{ + return pixman_region_contains_point (pReg, x, y, box); +} + +static inline Bool +RegionEqual(RegionPtr reg1, RegionPtr reg2) +{ + return pixman_region_equal (reg1, reg2); +} + +extern _X_EXPORT Bool RegionRectAlloc( + RegionPtr /*pRgn*/, + int /*n*/ +); + +#ifdef DEBUG +extern _X_EXPORT Bool RegionIsValid( + RegionPtr /*prgn*/ +); +#endif + +extern _X_EXPORT void RegionPrint( + RegionPtr /*pReg*/); + +#define INCLUDE_LEGACY_REGION_DEFINES +#ifdef INCLUDE_LEGACY_REGION_DEFINES + +#define REGION_NIL RegionNil +#define REGION_NAR RegionNar +#define REGION_NUM_RECTS RegionNumRects +#define REGION_SIZE RegionSize +#define REGION_RECTS RegionRects +#define REGION_BOXPTR RegionBoxptr +#define REGION_BOX RegionBox +#define REGION_TOP RegionTop +#define REGION_END RegionEnd +#define REGION_SZOF RegionSizeof +#define BITMAP_TO_REGION BitmapToRegion +#define REGION_CREATE(pScreen, r, s) RegionCreate(r,s) +#define REGION_COPY(pScreen, d, r) RegionCopy(d, r) +#define REGION_DESTROY(pScreen, r) RegionDestroy(r) +#define REGION_INTERSECT(pScreen, res, r1, r2) RegionIntersect(res, r1, r2) +#define REGION_UNION(pScreen, res, r1, r2) RegionUnion(res, r1, r2) +#define REGION_SUBTRACT(pScreen, res, r1, r2) RegionSubtract(res, r1, r2) +#define REGION_INVERSE(pScreen, n, r, b) RegionInverse(n, r, b) +#define REGION_TRANSLATE(pScreen, r, x, y) RegionTranslate(r, x, y) +#define RECT_IN_REGION(pScreen, r, b) RegionContainsRect(r, b) +#define POINT_IN_REGION(pScreen, r, x, y, b) RegionContainsPoint(r, x, y, b) +#define REGION_EQUAL(pScreen, r1, r2) RegionEqual(r1, r2) +#define REGION_APPEND(pScreen, d, r) RegionAppend(d, r) +#define REGION_VALIDATE(pScreen, r, o) RegionValidate(r, o) +#define RECTS_TO_REGION(pScreen, n, r, c) RegionFromRects(n, r, c) +#define REGION_BREAK(pScreen, r) RegionBreak(r) +#define REGION_INIT(pScreen, r, b, s) RegionInit(r, b, s) +#define REGION_UNINIT(pScreen, r) RegionUninit(r) +#define REGION_RESET(pScreen, r, b) RegionReset(r, b) +#define REGION_NOTEMPTY(pScreen, r) RegionNotEmpty(r) +#define REGION_BROKEN(pScreen, r) RegionBroken(r) +#define REGION_EMPTY(pScreen, r) RegionEmpty(r) +#define REGION_EXTENTS(pScreen, r) RegionExtents(r) +#define REGION_NULL(pScreen, r) RegionNull(r) + +#endif /* INCLUDE_LEGACY_REGION_DEFINES */ +#endif /* REGIONSTRUCT_H */ diff --git a/xorg-server/include/window.h b/xorg-server/include/window.h index f3afee38d..e13598b88 100644 --- a/xorg-server/include/window.h +++ b/xorg-server/include/window.h @@ -1,272 +1,272 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifndef WINDOW_H -#define WINDOW_H - -#include "misc.h" -#include "region.h" -#include "screenint.h" -#include - -#define TOTALLY_OBSCURED 0 -#define UNOBSCURED 1 -#define OBSCURED 2 - -#define VisibilityNotViewable 3 - -/* return values for tree-walking callback procedures */ -#define WT_STOPWALKING 0 -#define WT_WALKCHILDREN 1 -#define WT_DONTWALKCHILDREN 2 -#define WT_NOMATCH 3 -#define NullWindow ((WindowPtr) 0) - -/* Forward declaration, we can't include input.h here */ -struct _DeviceIntRec; -struct _Cursor; - -typedef struct _BackingStore *BackingStorePtr; -typedef struct _Window *WindowPtr; - -typedef int (*VisitWindowProcPtr)( - WindowPtr /*pWin*/, - pointer /*data*/); - -extern _X_EXPORT int TraverseTree( - WindowPtr /*pWin*/, - VisitWindowProcPtr /*func*/, - pointer /*data*/); - -extern _X_EXPORT int WalkTree( - ScreenPtr /*pScreen*/, - VisitWindowProcPtr /*func*/, - pointer /*data*/); - -extern _X_EXPORT Bool CreateRootWindow( - ScreenPtr /*pScreen*/); - -extern _X_EXPORT void InitRootWindow( - WindowPtr /*pWin*/); - -typedef WindowPtr (* RealChildHeadProc) (WindowPtr pWin); - -extern _X_EXPORT void RegisterRealChildHeadProc (RealChildHeadProc proc); - -extern _X_EXPORT WindowPtr RealChildHead( - WindowPtr /*pWin*/); - -extern _X_EXPORT WindowPtr CreateWindow( - Window /*wid*/, - WindowPtr /*pParent*/, - int /*x*/, - int /*y*/, - unsigned int /*w*/, - unsigned int /*h*/, - unsigned int /*bw*/, - unsigned int /*class*/, - Mask /*vmask*/, - XID* /*vlist*/, - int /*depth*/, - ClientPtr /*client*/, - VisualID /*visual*/, - int* /*error*/); - -extern _X_EXPORT int DeleteWindow( - pointer /*pWin*/, - XID /*wid*/); - -extern _X_EXPORT int DestroySubwindows( - WindowPtr /*pWin*/, - ClientPtr /*client*/); - -/* Quartz support on Mac OS X uses the HIToolbox - framework whose ChangeWindowAttributes function conflicts here. */ -#ifdef __APPLE__ -#define ChangeWindowAttributes Darwin_X_ChangeWindowAttributes -#endif -extern _X_EXPORT int ChangeWindowAttributes( - WindowPtr /*pWin*/, - Mask /*vmask*/, - XID* /*vlist*/, - ClientPtr /*client*/); - -extern _X_EXPORT int ChangeWindowDeviceCursor( - WindowPtr /*pWin*/, - struct _DeviceIntRec* /*pDev*/, - struct _Cursor* /*pCursor*/); - -extern _X_EXPORT struct _Cursor* WindowGetDeviceCursor( - WindowPtr /*pWin*/, - struct _DeviceIntRec* /*pDev*/); - -/* Quartz support on Mac OS X uses the HIToolbox - framework whose GetWindowAttributes function conflicts here. */ -#ifdef __APPLE__ -#define GetWindowAttributes(w,c,x) Darwin_X_GetWindowAttributes(w,c,x) -extern void Darwin_X_GetWindowAttributes( -#else -extern _X_EXPORT void GetWindowAttributes( -#endif - WindowPtr /*pWin*/, - ClientPtr /*client*/, - xGetWindowAttributesReply* /* wa */); - -extern _X_EXPORT void GravityTranslate( - int /*x*/, - int /*y*/, - int /*oldx*/, - int /*oldy*/, - int /*dw*/, - int /*dh*/, - unsigned /*gravity*/, - int* /*destx*/, - int* /*desty*/); - -extern _X_EXPORT int ConfigureWindow( - WindowPtr /*pWin*/, - Mask /*mask*/, - XID* /*vlist*/, - ClientPtr /*client*/); - -extern _X_EXPORT int CirculateWindow( - WindowPtr /*pParent*/, - int /*direction*/, - ClientPtr /*client*/); - -extern _X_EXPORT int ReparentWindow( - WindowPtr /*pWin*/, - WindowPtr /*pParent*/, - int /*x*/, - int /*y*/, - ClientPtr /*client*/); - -extern _X_EXPORT int MapWindow( - WindowPtr /*pWin*/, - ClientPtr /*client*/); - -extern _X_EXPORT void MapSubwindows( - WindowPtr /*pParent*/, - ClientPtr /*client*/); - -extern _X_EXPORT int UnmapWindow( - WindowPtr /*pWin*/, - Bool /*fromConfigure*/); - -extern _X_EXPORT void UnmapSubwindows( - WindowPtr /*pWin*/); - -extern _X_EXPORT void HandleSaveSet( - ClientPtr /*client*/); - -extern _X_EXPORT Bool PointInWindowIsVisible( - WindowPtr /*pWin*/, - int /*x*/, - int /*y*/); - -extern _X_EXPORT RegionPtr NotClippedByChildren( - WindowPtr /*pWin*/); - -extern _X_EXPORT void SendVisibilityNotify( - WindowPtr /*pWin*/); - -extern _X_EXPORT int dixSaveScreens( - ClientPtr client, - int on, - int mode); - -extern _X_EXPORT int SaveScreens( - int on, - int mode); - -extern _X_EXPORT WindowPtr FindWindowWithOptional( - WindowPtr /*w*/); - -extern _X_EXPORT void CheckWindowOptionalNeed( - WindowPtr /*w*/); - -extern _X_EXPORT Bool MakeWindowOptional( - WindowPtr /*pWin*/); - -extern _X_EXPORT WindowPtr MoveWindowInStack( - WindowPtr /*pWin*/, - WindowPtr /*pNextSib*/); - -extern _X_EXPORT void SetWinSize( - WindowPtr /*pWin*/); - -extern _X_EXPORT void SetBorderSize( - WindowPtr /*pWin*/); - -extern _X_EXPORT void ResizeChildrenWinSize( - WindowPtr /*pWin*/, - int /*dx*/, - int /*dy*/, - int /*dw*/, - int /*dh*/); - -extern _X_EXPORT void ShapeExtensionInit(void); - -extern _X_EXPORT void SendShapeNotify( - WindowPtr /* pWin */, - int /* which */ ); - -extern _X_EXPORT RegionPtr CreateBoundingShape( - WindowPtr /* pWin */ ); - -extern _X_EXPORT RegionPtr CreateClipShape( - WindowPtr /* pWin */ ); - -extern _X_EXPORT void DisableMapUnmapEvents( - WindowPtr /* pWin */ ); -extern _X_EXPORT void EnableMapUnmapEvents( - WindowPtr /* pWin */ ); - -extern _X_EXPORT void SetRootClip(ScreenPtr pScreen, Bool enable); -extern _X_EXPORT void PrintWindowTree(void); - -#endif /* WINDOW_H */ +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +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 +OPEN GROUP 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 Open Group 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 Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifndef WINDOW_H +#define WINDOW_H + +#include "misc.h" +#include "region.h" +#include "screenint.h" +#include + +#define TOTALLY_OBSCURED 0 +#define UNOBSCURED 1 +#define OBSCURED 2 + +#define VisibilityNotViewable 3 + +/* return values for tree-walking callback procedures */ +#define WT_STOPWALKING 0 +#define WT_WALKCHILDREN 1 +#define WT_DONTWALKCHILDREN 2 +#define WT_NOMATCH 3 +#define NullWindow ((WindowPtr) 0) + +/* Forward declaration, we can't include input.h here */ +struct _DeviceIntRec; +struct _Cursor; + +typedef struct _BackingStore *BackingStorePtr; +typedef struct _Window *WindowPtr; + +typedef int (*VisitWindowProcPtr)( + WindowPtr /*pWin*/, + pointer /*data*/); + +extern _X_EXPORT int TraverseTree( + WindowPtr /*pWin*/, + VisitWindowProcPtr /*func*/, + pointer /*data*/); + +extern _X_EXPORT int WalkTree( + ScreenPtr /*pScreen*/, + VisitWindowProcPtr /*func*/, + pointer /*data*/); + +extern _X_EXPORT Bool CreateRootWindow( + ScreenPtr /*pScreen*/); + +extern _X_EXPORT void InitRootWindow( + WindowPtr /*pWin*/); + +typedef WindowPtr (* RealChildHeadProc) (WindowPtr pWin); + +extern _X_EXPORT void RegisterRealChildHeadProc (RealChildHeadProc proc); + +extern _X_EXPORT WindowPtr RealChildHead( + WindowPtr /*pWin*/); + +extern _X_EXPORT WindowPtr CreateWindow( + Window /*wid*/, + WindowPtr /*pParent*/, + int /*x*/, + int /*y*/, + unsigned int /*w*/, + unsigned int /*h*/, + unsigned int /*bw*/, + unsigned int /*class*/, + Mask /*vmask*/, + XID* /*vlist*/, + int /*depth*/, + ClientPtr /*client*/, + VisualID /*visual*/, + int* /*error*/); + +extern _X_EXPORT int DeleteWindow( + pointer /*pWin*/, + XID /*wid*/); + +extern _X_EXPORT int DestroySubwindows( + WindowPtr /*pWin*/, + ClientPtr /*client*/); + +/* Quartz support on Mac OS X uses the HIToolbox + framework whose ChangeWindowAttributes function conflicts here. */ +#ifdef __APPLE__ +#define ChangeWindowAttributes Darwin_X_ChangeWindowAttributes +#endif +extern _X_EXPORT int ChangeWindowAttributes( + WindowPtr /*pWin*/, + Mask /*vmask*/, + XID* /*vlist*/, + ClientPtr /*client*/); + +extern _X_EXPORT int ChangeWindowDeviceCursor( + WindowPtr /*pWin*/, + struct _DeviceIntRec* /*pDev*/, + struct _Cursor* /*pCursor*/); + +extern _X_EXPORT struct _Cursor* WindowGetDeviceCursor( + WindowPtr /*pWin*/, + struct _DeviceIntRec* /*pDev*/); + +/* Quartz support on Mac OS X uses the HIToolbox + framework whose GetWindowAttributes function conflicts here. */ +#ifdef __APPLE__ +#define GetWindowAttributes(w,c,x) Darwin_X_GetWindowAttributes(w,c,x) +extern void Darwin_X_GetWindowAttributes( +#else +extern _X_EXPORT void GetWindowAttributes( +#endif + WindowPtr /*pWin*/, + ClientPtr /*client*/, + xGetWindowAttributesReply* /* wa */); + +extern _X_EXPORT void GravityTranslate( + int /*x*/, + int /*y*/, + int /*oldx*/, + int /*oldy*/, + int /*dw*/, + int /*dh*/, + unsigned /*gravity*/, + int* /*destx*/, + int* /*desty*/); + +extern _X_EXPORT int ConfigureWindow( + WindowPtr /*pWin*/, + Mask /*mask*/, + XID* /*vlist*/, + ClientPtr /*client*/); + +extern _X_EXPORT int CirculateWindow( + WindowPtr /*pParent*/, + int /*direction*/, + ClientPtr /*client*/); + +extern _X_EXPORT int ReparentWindow( + WindowPtr /*pWin*/, + WindowPtr /*pParent*/, + int /*x*/, + int /*y*/, + ClientPtr /*client*/); + +extern _X_EXPORT int MapWindow( + WindowPtr /*pWin*/, + ClientPtr /*client*/); + +extern _X_EXPORT void MapSubwindows( + WindowPtr /*pParent*/, + ClientPtr /*client*/); + +extern _X_EXPORT int UnmapWindow( + WindowPtr /*pWin*/, + Bool /*fromConfigure*/); + +extern _X_EXPORT void UnmapSubwindows( + WindowPtr /*pWin*/); + +extern _X_EXPORT void HandleSaveSet( + ClientPtr /*client*/); + +extern _X_EXPORT Bool PointInWindowIsVisible( + WindowPtr /*pWin*/, + int /*x*/, + int /*y*/); + +extern _X_EXPORT RegionPtr NotClippedByChildren( + WindowPtr /*pWin*/); + +extern _X_EXPORT void SendVisibilityNotify( + WindowPtr /*pWin*/); + +extern _X_EXPORT int dixSaveScreens( + ClientPtr client, + int on, + int mode); + +extern _X_EXPORT int SaveScreens( + int on, + int mode); + +extern _X_EXPORT WindowPtr FindWindowWithOptional( + WindowPtr /*w*/); + +extern _X_EXPORT void CheckWindowOptionalNeed( + WindowPtr /*w*/); + +extern _X_EXPORT Bool MakeWindowOptional( + WindowPtr /*pWin*/); + +extern _X_EXPORT WindowPtr MoveWindowInStack( + WindowPtr /*pWin*/, + WindowPtr /*pNextSib*/); + +extern _X_EXPORT void SetWinSize( + WindowPtr /*pWin*/); + +extern _X_EXPORT void SetBorderSize( + WindowPtr /*pWin*/); + +extern _X_EXPORT void ResizeChildrenWinSize( + WindowPtr /*pWin*/, + int /*dx*/, + int /*dy*/, + int /*dw*/, + int /*dh*/); + +extern _X_EXPORT void ShapeExtensionInit(void); + +extern _X_EXPORT void SendShapeNotify( + WindowPtr /* pWin */, + int /* which */ ); + +extern _X_EXPORT RegionPtr CreateBoundingShape( + WindowPtr /* pWin */ ); + +extern _X_EXPORT RegionPtr CreateClipShape( + WindowPtr /* pWin */ ); + +extern _X_EXPORT void DisableMapUnmapEvents( + WindowPtr /* pWin */ ); +extern _X_EXPORT void EnableMapUnmapEvents( + WindowPtr /* pWin */ ); + +extern _X_EXPORT void SetRootClip(ScreenPtr pScreen, Bool enable); +extern _X_EXPORT void PrintWindowTree(void); + +#endif /* WINDOW_H */ diff --git a/xorg-server/include/xkbsrv.h b/xorg-server/include/xkbsrv.h index 9f7945e22..7b0053486 100644 --- a/xorg-server/include/xkbsrv.h +++ b/xorg-server/include/xkbsrv.h @@ -1,987 +1,987 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright -notice appear in all copies and that both that copyright -notice and this permission notice appear in supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL -DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ - -#ifndef _XKBSRV_H_ -#define _XKBSRV_H_ - -#define XkbAllocClientMap SrvXkbAllocClientMap -#define XkbAllocServerMap SrvXkbAllocServerMap -#define XkbChangeTypesOfKey SrvXkbChangeTypesOfKey -#define XkbCopyKeyTypes SrvXkbCopyKeyTypes -#define XkbFreeClientMap SrvXkbFreeClientMap -#define XkbFreeServerMap SrvXkbFreeServerMap -#define XkbKeyTypesForCoreSymbols SrvXkbKeyTypesForCoreSymbols -#define XkbApplyCompatMapToKey SrvXkbApplyCompatMapToKey -#define XkbResizeKeyActions SrvXkbResizeKeyActions -#define XkbResizeKeySyms SrvXkbResizeKeySyms -#define XkbResizeKeyType SrvXkbResizeKeyType -#define XkbAllocCompatMap SrvXkbAllocCompatMap -#define XkbAllocControls SrvXkbAllocControls -#define XkbAllocIndicatorMaps SrvXkbAllocIndicatorMaps -#define XkbAllocKeyboard SrvXkbAllocKeyboard -#define XkbAllocNames SrvXkbAllocNames -#define XkbFreeCompatMap SrvXkbFreeCompatMap -#define XkbFreeKeyboard SrvXkbFreeKeyboard -#define XkbFreeNames SrvXkbFreeNames -#define XkbLatchModifiers SrvXkbLatchModifiers -#define XkbLatchGroup SrvXkbLatchGroup -#define XkbVirtualModsToReal SrvXkbVirtualModsToReal -#define XkbChangeKeycodeRange SrvXkbChangeKeycodeRange -#define XkbApplyVirtualModChanges SrvXkbApplyVirtualModChanges - -#include -#include "xkbstr.h" -#include "xkbrules.h" -#include "inputstr.h" -#include "events.h" - -typedef struct _XkbInterest { - DeviceIntPtr dev; - ClientPtr client; - XID resource; - struct _XkbInterest * next; - CARD16 extDevNotifyMask; - CARD16 stateNotifyMask; - CARD16 namesNotifyMask; - CARD32 ctrlsNotifyMask; - CARD8 compatNotifyMask; - BOOL bellNotifyMask; - BOOL actionMessageMask; - CARD16 accessXNotifyMask; - CARD32 iStateNotifyMask; - CARD32 iMapNotifyMask; - CARD16 altSymsNotifyMask; - CARD32 autoCtrls; - CARD32 autoCtrlValues; -} XkbInterestRec,*XkbInterestPtr; - -typedef struct _XkbRadioGroup { - CARD8 flags; - CARD8 nMembers; - CARD8 dfltDown; - CARD8 currentDown; - CARD8 members[XkbRGMaxMembers]; -} XkbRadioGroupRec, *XkbRadioGroupPtr; - -typedef struct _XkbEventCause { - CARD8 kc; - CARD8 event; - CARD8 mjr; - CARD8 mnr; - ClientPtr client; -} XkbEventCauseRec,*XkbEventCausePtr; -#define XkbSetCauseKey(c,k,e) { (c)->kc= (k),(c)->event= (e),\ - (c)->mjr= (c)->mnr= 0; \ - (c)->client= NULL; } -#define XkbSetCauseReq(c,j,n,cl) { (c)->kc= (c)->event= 0,\ - (c)->mjr= (j),(c)->mnr= (n);\ - (c)->client= (cl); } -#define XkbSetCauseCoreReq(c,e,cl) XkbSetCauseReq(c,e,0,cl) -#define XkbSetCauseXkbReq(c,e,cl) XkbSetCauseReq(c,XkbReqCode,e,cl) -#define XkbSetCauseUnknown(c) XkbSetCauseKey(c,0,0) - -#define _OFF_TIMER 0 -#define _KRG_WARN_TIMER 1 -#define _KRG_TIMER 2 -#define _SK_TIMEOUT_TIMER 3 -#define _ALL_TIMEOUT_TIMER 4 - -#define _BEEP_NONE 0 -#define _BEEP_FEATURE_ON 1 -#define _BEEP_FEATURE_OFF 2 -#define _BEEP_FEATURE_CHANGE 3 -#define _BEEP_SLOW_WARN 4 -#define _BEEP_SLOW_PRESS 5 -#define _BEEP_SLOW_ACCEPT 6 -#define _BEEP_SLOW_REJECT 7 -#define _BEEP_SLOW_RELEASE 8 -#define _BEEP_STICKY_LATCH 9 -#define _BEEP_STICKY_LOCK 10 -#define _BEEP_STICKY_UNLOCK 11 -#define _BEEP_LED_ON 12 -#define _BEEP_LED_OFF 13 -#define _BEEP_LED_CHANGE 14 -#define _BEEP_BOUNCE_REJECT 15 - -typedef struct _XkbFilter { - CARD16 keycode; - CARD8 what; - CARD8 active; - CARD8 filterOthers; - CARD32 priv; - XkbAction upAction; - int (*filter)( - struct _XkbSrvInfo* /* xkbi */, - struct _XkbFilter * /* filter */, - unsigned /* keycode */, - XkbAction * /* action */ - ); - struct _XkbFilter *next; -} XkbFilterRec,*XkbFilterPtr; - -typedef struct _XkbSrvInfo { - XkbStateRec prev_state; - XkbStateRec state; - XkbDescPtr desc; - - DeviceIntPtr device; - KbdCtrlProcPtr kbdProc; - - XkbRadioGroupPtr radioGroups; - CARD8 nRadioGroups; - CARD8 clearMods; - CARD8 setMods; - INT16 groupChange; - - CARD16 dfltPtrDelta; - - double mouseKeysCurve; - double mouseKeysCurveFactor; - INT16 mouseKeysDX; - INT16 mouseKeysDY; - CARD8 mouseKeysFlags; - Bool mouseKeysAccel; - CARD8 mouseKeysCounter; - - CARD8 lockedPtrButtons; - CARD8 shiftKeyCount; - KeyCode mouseKey; - KeyCode inactiveKey; - KeyCode slowKey; - KeyCode repeatKey; - CARD8 krgTimerActive; - CARD8 beepType; - CARD8 beepCount; - - CARD32 flags; - CARD32 lastPtrEventTime; - CARD32 lastShiftEventTime; - OsTimerPtr beepTimer; - OsTimerPtr mouseKeyTimer; - OsTimerPtr slowKeysTimer; - OsTimerPtr bounceKeysTimer; - OsTimerPtr repeatKeyTimer; - OsTimerPtr krgTimer; - - int szFilters; - XkbFilterPtr filters; -} XkbSrvInfoRec, *XkbSrvInfoPtr; - -#define XkbSLI_IsDefault (1L<<0) -#define XkbSLI_HasOwnState (1L<<1) - -typedef struct _XkbSrvLedInfo { - CARD16 flags; - CARD16 class; - CARD16 id; - union { - KbdFeedbackPtr kf; - LedFeedbackPtr lf; - } fb; - - CARD32 physIndicators; - CARD32 autoState; - CARD32 explicitState; - CARD32 effectiveState; - - CARD32 mapsPresent; - CARD32 namesPresent; - XkbIndicatorMapPtr maps; - Atom * names; - - CARD32 usesBase; - CARD32 usesLatched; - CARD32 usesLocked; - CARD32 usesEffective; - CARD32 usesCompat; - CARD32 usesControls; - - CARD32 usedComponents; -} XkbSrvLedInfoRec, *XkbSrvLedInfoPtr; - -/* - * Settings for xkbClientFlags field (used by DIX) - * These flags _must_ not overlap with XkbPCF_* - */ -#define _XkbClientInitialized (1<<15) - -#define _XkbWantsDetectableAutoRepeat(c)\ - ((c)->xkbClientFlags&XkbPCF_DetectableAutoRepeatMask) - -/* - * Settings for flags field - */ -#define _XkbStateNotifyInProgress (1<<0) - -typedef struct -{ - ProcessInputProc processInputProc; - /* If processInputProc is set to something different than realInputProc, - * UNWRAP and COND_WRAP will not touch processInputProc and update only - * realInputProc. This ensures that - * processInputProc == (frozen ? EnqueueEvent : realInputProc) - * - * WRAP_PROCESS_INPUT_PROC should only be called during initialization, - * since it may destroy this invariant. - */ - ProcessInputProc realInputProc; - DeviceUnwrapProc unwrapProc; -} xkbDeviceInfoRec, *xkbDeviceInfoPtr; - -#define WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ - device->public.processInputProc = proc; \ - oldprocs->processInputProc = \ - oldprocs->realInputProc = device->public.realInputProc; \ - device->public.realInputProc = proc; \ - oldprocs->unwrapProc = device->unwrapProc; \ - device->unwrapProc = unwrapproc; - -#define COND_WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ - if (device->public.processInputProc == device->public.realInputProc)\ - device->public.processInputProc = proc; \ - oldprocs->processInputProc = \ - oldprocs->realInputProc = device->public.realInputProc; \ - device->public.realInputProc = proc; \ - oldprocs->unwrapProc = device->unwrapProc; \ - device->unwrapProc = unwrapproc; - -#define UNWRAP_PROCESS_INPUT_PROC(device, oldprocs, backupproc) \ - backupproc = device->public.realInputProc; \ - if (device->public.processInputProc == device->public.realInputProc)\ - device->public.processInputProc = oldprocs->realInputProc; \ - device->public.realInputProc = oldprocs->realInputProc; \ - device->unwrapProc = oldprocs->unwrapProc; - -extern _X_EXPORT DevPrivateKeyRec xkbDevicePrivateKeyRec; -#define xkbDevicePrivateKey (&xkbDevicePrivateKeyRec) - -#define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr)dixLookupPrivate(&(dev)->devPrivates, xkbDevicePrivateKey)) - -extern void xkbUnwrapProc(DeviceIntPtr, DeviceHandleProc, pointer); - -/***====================================================================***/ - - -/***====================================================================***/ - -#define XkbAX_KRGMask (XkbSlowKeysMask|XkbBounceKeysMask) -#define XkbAllFilteredEventsMask \ - (XkbAccessXKeysMask|XkbRepeatKeysMask|XkbMouseKeysAccelMask|XkbAX_KRGMask) - -/***====================================================================***/ - -extern _X_EXPORT int XkbReqCode; -extern _X_EXPORT int XkbEventBase; -extern _X_EXPORT int XkbKeyboardErrorCode; -extern _X_EXPORT const char * XkbBaseDirectory; -extern _X_EXPORT const char * XkbBinDirectory; - -extern _X_EXPORT CARD32 xkbDebugFlags; - -#define _XkbLibError(c,l,d) /* Epoch fail */ -#define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff))) -#define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c)) -#define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d))) - -extern _X_EXPORT int DeviceKeyPress,DeviceKeyRelease,DeviceMotionNotify; -extern _X_EXPORT int DeviceButtonPress,DeviceButtonRelease; - -#define Status int - -extern _X_EXPORT void XkbUseMsg( - void -); - -extern _X_EXPORT int XkbProcessArguments( - int /* argc */, - char ** /* argv */, - int /* i */ -); - -extern _X_EXPORT Bool XkbInitPrivates(void); - -extern _X_EXPORT void XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc); - -extern _X_EXPORT void XkbFreeCompatMap( - XkbDescPtr /* xkb */, - unsigned int /* which */, - Bool /* freeMap */ -); - -extern _X_EXPORT void XkbFreeNames( - XkbDescPtr /* xkb */, - unsigned int /* which */, - Bool /* freeMap */ -); - -extern _X_EXPORT int _XkbLookupAnyDevice( - DeviceIntPtr *pDev, - int id, - ClientPtr client, - Mask access_mode, - int *xkb_err -); - -extern _X_EXPORT int _XkbLookupKeyboard( - DeviceIntPtr *pDev, - int id, - ClientPtr client, - Mask access_mode, - int *xkb_err -); - -extern _X_EXPORT int _XkbLookupBellDevice( - DeviceIntPtr *pDev, - int id, - ClientPtr client, - Mask access_mode, - int *xkb_err -); - -extern _X_EXPORT int _XkbLookupLedDevice( - DeviceIntPtr *pDev, - int id, - ClientPtr client, - Mask access_mode, - int *xkb_err -); - -extern _X_EXPORT int _XkbLookupButtonDevice( - DeviceIntPtr *pDev, - int id, - ClientPtr client, - Mask access_mode, - int *xkb_err -); - -extern _X_EXPORT XkbDescPtr XkbAllocKeyboard( - void -); - -extern _X_EXPORT Status XkbAllocClientMap( - XkbDescPtr /* xkb */, - unsigned int /* which */, - unsigned int /* nTypes */ -); - -extern _X_EXPORT Status XkbAllocServerMap( - XkbDescPtr /* xkb */, - unsigned int /* which */, - unsigned int /* nNewActions */ -); - -extern _X_EXPORT void XkbFreeClientMap( - XkbDescPtr /* xkb */, - unsigned int /* what */, - Bool /* freeMap */ -); - -extern _X_EXPORT void XkbFreeServerMap( - XkbDescPtr /* xkb */, - unsigned int /* what */, - Bool /* freeMap */ -); - -extern _X_EXPORT Status XkbAllocIndicatorMaps( - XkbDescPtr /* xkb */ -); - -extern _X_EXPORT Status XkbAllocCompatMap( - XkbDescPtr /* xkb */, - unsigned int /* which */, - unsigned int /* nInterpret */ -); - -extern _X_EXPORT Status XkbAllocNames( - XkbDescPtr /* xkb */, - unsigned int /* which */, - int /* nTotalRG */, - int /* nTotalAliases */ -); - -extern _X_EXPORT Status XkbAllocControls( - XkbDescPtr /* xkb */, - unsigned int /* which*/ -); - -extern _X_EXPORT Status XkbCopyKeyTypes( - XkbKeyTypePtr /* from */, - XkbKeyTypePtr /* into */, - int /* num_types */ -); - -extern _X_EXPORT Status XkbResizeKeyType( - XkbDescPtr /* xkb */, - int /* type_ndx */, - int /* map_count */, - Bool /* want_preserve */, - int /* new_num_lvls */ -); - -extern _X_EXPORT void XkbFreeKeyboard( - XkbDescPtr /* xkb */, - unsigned int /* which */, - Bool /* freeDesc */ -); - -extern _X_EXPORT void XkbFreeComponentNames( - XkbComponentNamesPtr /* names */, - Bool /* freeNames */ -); - -extern _X_EXPORT void XkbSetActionKeyMods( - XkbDescPtr /* xkb */, - XkbAction * /* act */, - unsigned int /* mods */ -); - -extern _X_EXPORT unsigned int XkbMaskForVMask( - XkbDescPtr /* xkb */, - unsigned int /* vmask */ -); - -extern _X_EXPORT Bool XkbVirtualModsToReal( - XkbDescPtr /* xkb */, - unsigned int /* virtua_mask */, - unsigned int * /* mask_rtrn */ -); - -extern _X_EXPORT unsigned int XkbAdjustGroup( - int /* group */, - XkbControlsPtr /* ctrls */ -); - -extern _X_EXPORT KeySym *XkbResizeKeySyms( - XkbDescPtr /* xkb */, - int /* key */, - int /* needed */ -); - -extern _X_EXPORT XkbAction *XkbResizeKeyActions( - XkbDescPtr /* xkb */, - int /* key */, - int /* needed */ -); - -extern _X_EXPORT void XkbUpdateKeyTypesFromCore( - DeviceIntPtr /* pXDev */, - KeySymsPtr /* syms */, - KeyCode /* first */, - CARD8 /* num */, - XkbChangesPtr /* pChanges */ -); - -extern _X_EXPORT void XkbUpdateDescActions( - XkbDescPtr /* xkb */, - KeyCode /* first */, - CARD8 /* num */, - XkbChangesPtr /* changes */ -); - -extern _X_EXPORT void XkbUpdateActions( - DeviceIntPtr /* pXDev */, - KeyCode /* first */, - CARD8 /* num */, - XkbChangesPtr /* pChanges */, - unsigned int * /* needChecksRtrn */, - XkbEventCausePtr /* cause */ -); - -extern _X_EXPORT KeySymsPtr XkbGetCoreMap( - DeviceIntPtr /* keybd */ -); - -extern _X_EXPORT void XkbApplyMappingChange( - DeviceIntPtr /* pXDev */, - KeySymsPtr /* map */, - KeyCode /* firstKey */, - CARD8 /* num */, - CARD8 * /* modmap */, - ClientPtr /* client */ -); - -extern _X_EXPORT void XkbSetIndicators( - DeviceIntPtr /* pXDev */, - CARD32 /* affect */, - CARD32 /* values */, - XkbEventCausePtr /* cause */ -); - -extern _X_EXPORT void XkbUpdateIndicators( - DeviceIntPtr /* keybd */, - CARD32 /* changed */, - Bool /* check_edevs */, - XkbChangesPtr /* pChanges */, - XkbEventCausePtr /* cause */ -); - -extern _X_EXPORT XkbSrvLedInfoPtr XkbAllocSrvLedInfo( - DeviceIntPtr /* dev */, - KbdFeedbackPtr /* kf */, - LedFeedbackPtr /* lf */, - unsigned int /* needed_parts */ -); - -extern _X_EXPORT XkbSrvLedInfoPtr XkbCopySrvLedInfo( - DeviceIntPtr /* dev */, - XkbSrvLedInfoPtr /* src */, - KbdFeedbackPtr /* kf */, - LedFeedbackPtr /* lf */ -); - - -extern _X_EXPORT XkbSrvLedInfoPtr XkbFindSrvLedInfo( - DeviceIntPtr /* dev */, - unsigned int /* class */, - unsigned int /* id */, - unsigned int /* needed_parts */ -); - -extern _X_EXPORT void XkbApplyLedNameChanges( - DeviceIntPtr /* dev */, - XkbSrvLedInfoPtr /* sli */, - unsigned int /* changed_names */, - xkbExtensionDeviceNotify * /* ed */, - XkbChangesPtr /* changes */, - XkbEventCausePtr /* cause */ -); - -extern _X_EXPORT void XkbApplyLedMapChanges( - DeviceIntPtr /* dev */, - XkbSrvLedInfoPtr /* sli */, - unsigned int /* changed_maps */, - xkbExtensionDeviceNotify * /* ed */, - XkbChangesPtr /* changes */, - XkbEventCausePtr /* cause */ -); - -extern _X_EXPORT void XkbApplyLedStateChanges( - DeviceIntPtr /* dev */, - XkbSrvLedInfoPtr /* sli */, - unsigned int /* changed_leds */, - xkbExtensionDeviceNotify * /* ed */, - XkbChangesPtr /* changes */, - XkbEventCausePtr /* cause */ -); - -extern _X_EXPORT void XkbFlushLedEvents( - DeviceIntPtr /* dev */, - DeviceIntPtr /* kbd */, - XkbSrvLedInfoPtr /* sli */, - xkbExtensionDeviceNotify * /* ed */, - XkbChangesPtr /* changes */, - XkbEventCausePtr /* cause */ -); - -extern _X_EXPORT unsigned int XkbIndicatorsToUpdate( - DeviceIntPtr /* dev */, - unsigned long /* state_changes */, - Bool /* enabled_ctrl_changes */ -); - -extern _X_EXPORT void XkbComputeDerivedState( - XkbSrvInfoPtr /* xkbi */ -); - -extern _X_EXPORT void XkbCheckSecondaryEffects( - XkbSrvInfoPtr /* xkbi */, - unsigned int /* which */, - XkbChangesPtr /* changes */, - XkbEventCausePtr /* cause */ -); - -extern _X_EXPORT void XkbCheckIndicatorMaps( - DeviceIntPtr /* dev */, - XkbSrvLedInfoPtr /* sli */, - unsigned int /* which */ -); - -extern _X_EXPORT unsigned int XkbStateChangedFlags( - XkbStatePtr /* old */, - XkbStatePtr /* new */ -); - -extern _X_EXPORT void XkbSendStateNotify( - DeviceIntPtr /* kbd */, - xkbStateNotify * /* pSN */ -); - -extern _X_EXPORT void XkbSendMapNotify( - DeviceIntPtr /* kbd */, - xkbMapNotify * /* ev */ -); - -extern _X_EXPORT int XkbComputeControlsNotify( - DeviceIntPtr /* kbd */, - XkbControlsPtr /* old */, - XkbControlsPtr /* new */, - xkbControlsNotify * /* pCN */, - Bool /* forceCtrlProc */ -); - -extern _X_EXPORT void XkbSendControlsNotify( - DeviceIntPtr /* kbd */, - xkbControlsNotify * /* ev */ -); - -extern _X_EXPORT void XkbSendCompatMapNotify( - DeviceIntPtr /* kbd */, - xkbCompatMapNotify * /* ev */ -); - -extern _X_EXPORT void XkbHandleBell( - BOOL /* force */, - BOOL /* eventOnly */, - DeviceIntPtr /* kbd */, - CARD8 /* percent */, - pointer /* ctrl */, - CARD8 /* class */, - Atom /* name */, - WindowPtr /* pWin */, - ClientPtr /* pClient */ -); - -extern _X_EXPORT void XkbSendAccessXNotify( - DeviceIntPtr /* kbd */, - xkbAccessXNotify * /* pEv */ -); - -extern _X_EXPORT void XkbSendNamesNotify( - DeviceIntPtr /* kbd */, - xkbNamesNotify * /* ev */ -); - -extern _X_EXPORT void XkbSendActionMessage( - DeviceIntPtr /* kbd */, - xkbActionMessage * /* ev */ -); - -extern _X_EXPORT void XkbSendExtensionDeviceNotify( - DeviceIntPtr /* kbd */, - ClientPtr /* client */, - xkbExtensionDeviceNotify * /* ev */ -); - -extern _X_EXPORT void XkbSendNotification( - DeviceIntPtr /* kbd */, - XkbChangesPtr /* pChanges */, - XkbEventCausePtr /* cause */ -); - -extern _X_EXPORT void XkbProcessKeyboardEvent( - DeviceEvent* /* event */, - DeviceIntPtr /* keybd */ -); - -extern _X_EXPORT void XkbHandleActions( - DeviceIntPtr /* dev */, - DeviceIntPtr /* kbd */, - DeviceEvent* /* event */ -); - -extern _X_EXPORT Bool XkbEnableDisableControls( - XkbSrvInfoPtr /* xkbi */, - unsigned long /* change */, - unsigned long /* newValues */, - XkbChangesPtr /* changes */, - XkbEventCausePtr /* cause */ -); - -extern _X_EXPORT void AccessXInit( - DeviceIntPtr /* dev */ -); - -extern _X_EXPORT Bool AccessXFilterPressEvent( - DeviceEvent* /* event */, - DeviceIntPtr /* keybd */ -); - -extern _X_EXPORT Bool AccessXFilterReleaseEvent( - DeviceEvent* /* event */, - DeviceIntPtr /* keybd */ -); - -extern _X_EXPORT void AccessXCancelRepeatKey( - XkbSrvInfoPtr /* xkbi */, - KeyCode /* key */ -); - -extern _X_EXPORT void AccessXComputeCurveFactor( - XkbSrvInfoPtr /* xkbi */, - XkbControlsPtr /* ctrls */ -); - -extern _X_EXPORT XkbInterestPtr XkbFindClientResource( - DevicePtr /* inDev */, - ClientPtr /* client */ -); - -extern _X_EXPORT XkbInterestPtr XkbAddClientResource( - DevicePtr /* inDev */, - ClientPtr /* client */, - XID /* id */ -); - -extern _X_EXPORT int XkbRemoveResourceClient( - DevicePtr /* inDev */, - XID /* id */ -); - -extern _X_EXPORT int XkbDDXAccessXBeep( - DeviceIntPtr /* dev */, - unsigned int /* what */, - unsigned int /* which */ -); - -extern _X_EXPORT int XkbDDXUsesSoftRepeat( - DeviceIntPtr /* dev */ -); - -extern _X_EXPORT void XkbDDXKeybdCtrlProc( - DeviceIntPtr /* dev */, - KeybdCtrl * /* ctrl */ -); - -extern _X_EXPORT void XkbDDXChangeControls( - DeviceIntPtr /* dev */, - XkbControlsPtr /* old */, - XkbControlsPtr /* new */ -); - -extern _X_EXPORT void XkbDDXUpdateDeviceIndicators( - DeviceIntPtr /* dev */, - XkbSrvLedInfoPtr /* sli */, - CARD32 /* newState */ -); - -extern _X_EXPORT int XkbDDXTerminateServer( - DeviceIntPtr /* dev */, - KeyCode /* key */, - XkbAction * /* act */ -); - -extern _X_EXPORT int XkbDDXSwitchScreen( - DeviceIntPtr /* dev */, - KeyCode /* key */, - XkbAction * /* act */ -); - -extern _X_EXPORT int XkbDDXPrivate( - DeviceIntPtr /* dev */, - KeyCode /* key */, - XkbAction * /* act */ -); - -extern _X_EXPORT void XkbDisableComputedAutoRepeats( - DeviceIntPtr /* pXDev */, - unsigned int /* key */ -); - -extern _X_EXPORT void XkbSetRepeatKeys( - DeviceIntPtr /* pXDev */, - int /* key */, - int /* onoff */ -); - -extern _X_EXPORT int XkbLatchModifiers( - DeviceIntPtr /* pXDev */, - CARD8 /* mask */, - CARD8 /* latches */ -); - -extern _X_EXPORT int XkbLatchGroup( - DeviceIntPtr /* pXDev */, - int /* group */ -); - -extern _X_EXPORT void XkbClearAllLatchesAndLocks( - DeviceIntPtr /* dev */, - XkbSrvInfoPtr /* xkbi */, - Bool /* genEv */, - XkbEventCausePtr /* cause */ -); - -extern _X_EXPORT void XkbGetRulesDflts( - XkbRMLVOSet * /* rmlvo */ -); - -extern _X_EXPORT void XkbFreeRMLVOSet( - XkbRMLVOSet * /* rmlvo */, - Bool /* freeRMLVO */ -); - -extern _X_EXPORT void XkbSetRulesDflts( - XkbRMLVOSet * /* rmlvo */ -); - -extern _X_EXPORT void XkbDeleteRulesDflts( - void -); - -extern _X_EXPORT int SProcXkbDispatch( - ClientPtr /* client */ -); - -extern _X_EXPORT XkbGeometryPtr XkbLookupNamedGeometry( - DeviceIntPtr /* dev */, - Atom /* name */, - Bool * /* shouldFree */ -); - -extern _X_EXPORT void XkbConvertCase( - KeySym /* sym */, - KeySym * /* lower */, - KeySym * /* upper */ -); - -extern _X_EXPORT Status XkbChangeKeycodeRange( - XkbDescPtr /* xkb */, - int /* minKC */, - int /* maxKC */, - XkbChangesPtr /* changes */ -); - -extern _X_EXPORT void XkbFreeSrvLedInfo( - XkbSrvLedInfoPtr /* sli */ -); - -extern _X_EXPORT void XkbFreeInfo( - XkbSrvInfoPtr /* xkbi */ -); - -extern _X_EXPORT Status XkbChangeTypesOfKey( - XkbDescPtr /* xkb */, - int /* key */, - int /* nGroups */, - unsigned int /* groups */, - int * /* newTypesIn */, - XkbMapChangesPtr /* changes */ -); - -extern _X_EXPORT int XkbKeyTypesForCoreSymbols( - XkbDescPtr /* xkb */, - int /* map_width */, - KeySym * /* core_syms */, - unsigned int /* protected */, - int * /* types_inout */, - KeySym * /* xkb_syms_rtrn */ -); - -extern _X_EXPORT Bool XkbApplyCompatMapToKey( - XkbDescPtr /* xkb */, - KeyCode /* key */, - XkbChangesPtr /* changes */ -); - -extern _X_EXPORT Bool XkbApplyVirtualModChanges( - XkbDescPtr /* xkb */, - unsigned int /* changed */, - XkbChangesPtr /* changes */ -); - -extern _X_EXPORT void XkbSendNewKeyboardNotify( - DeviceIntPtr /* kbd */, - xkbNewKeyboardNotify * /* pNKN */ -); - -extern Bool XkbCopyKeymap( - XkbDescPtr /* dst */, - XkbDescPtr /* src */); - -extern _X_EXPORT Bool XkbCopyDeviceKeymap( - DeviceIntPtr /* dst */, - DeviceIntPtr /* src */); - -extern void XkbFilterEvents( - ClientPtr /* pClient */, - int /* nEvents */, - xEvent* /* xE */); - -extern int XkbGetEffectiveGroup( - XkbSrvInfoPtr /* xkbi */, - XkbStatePtr /* xkbstate */, - CARD8 /* keycode */); - -extern void XkbMergeLockedPtrBtns( - DeviceIntPtr /* master */); - -extern void XkbFakeDeviceButton( - DeviceIntPtr /* dev */, - int /* press */, - int /* button */); - - -#include "xkbfile.h" -#include "xkbrules.h" - -#define _XkbListKeycodes 0 -#define _XkbListTypes 1 -#define _XkbListCompat 2 -#define _XkbListSymbols 3 -#define _XkbListGeometry 4 -#define _XkbListNumComponents 5 - -typedef struct _XkbSrvListInfo { - int szPool; - int nPool; - char * pool; - - int maxRtrn; - int nTotal; - - char * pattern[_XkbListNumComponents]; - int nFound[_XkbListNumComponents]; -} XkbSrvListInfoRec,*XkbSrvListInfoPtr; - -extern _X_EXPORT Status XkbDDXList( - DeviceIntPtr /* dev */, - XkbSrvListInfoPtr /* listing */, - ClientPtr /* client */ -); - -extern _X_EXPORT unsigned int XkbDDXLoadKeymapByNames( - DeviceIntPtr /* keybd */, - XkbComponentNamesPtr /* names */, - unsigned int /* want */, - unsigned int /* need */, - XkbDescPtr * /* finfoRtrn */, - char * /* keymapNameRtrn */, - int /* keymapNameRtrnLen */ -); - -extern _X_EXPORT Bool XkbDDXNamesFromRules( - DeviceIntPtr /* keybd */, - char * /* rules */, - XkbRF_VarDefsPtr /* defs */, - XkbComponentNamesPtr /* names */ -); - -extern _X_EXPORT XkbDescPtr XkbCompileKeymap( - DeviceIntPtr /* dev */, - XkbRMLVOSet * /* rmlvo */ -); - -#endif /* _XKBSRV_H_ */ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ + +#ifndef _XKBSRV_H_ +#define _XKBSRV_H_ + +#define XkbAllocClientMap SrvXkbAllocClientMap +#define XkbAllocServerMap SrvXkbAllocServerMap +#define XkbChangeTypesOfKey SrvXkbChangeTypesOfKey +#define XkbCopyKeyTypes SrvXkbCopyKeyTypes +#define XkbFreeClientMap SrvXkbFreeClientMap +#define XkbFreeServerMap SrvXkbFreeServerMap +#define XkbKeyTypesForCoreSymbols SrvXkbKeyTypesForCoreSymbols +#define XkbApplyCompatMapToKey SrvXkbApplyCompatMapToKey +#define XkbResizeKeyActions SrvXkbResizeKeyActions +#define XkbResizeKeySyms SrvXkbResizeKeySyms +#define XkbResizeKeyType SrvXkbResizeKeyType +#define XkbAllocCompatMap SrvXkbAllocCompatMap +#define XkbAllocControls SrvXkbAllocControls +#define XkbAllocIndicatorMaps SrvXkbAllocIndicatorMaps +#define XkbAllocKeyboard SrvXkbAllocKeyboard +#define XkbAllocNames SrvXkbAllocNames +#define XkbFreeCompatMap SrvXkbFreeCompatMap +#define XkbFreeKeyboard SrvXkbFreeKeyboard +#define XkbFreeNames SrvXkbFreeNames +#define XkbLatchModifiers SrvXkbLatchModifiers +#define XkbLatchGroup SrvXkbLatchGroup +#define XkbVirtualModsToReal SrvXkbVirtualModsToReal +#define XkbChangeKeycodeRange SrvXkbChangeKeycodeRange +#define XkbApplyVirtualModChanges SrvXkbApplyVirtualModChanges + +#include +#include "xkbstr.h" +#include "xkbrules.h" +#include "inputstr.h" +#include "events.h" + +typedef struct _XkbInterest { + DeviceIntPtr dev; + ClientPtr client; + XID resource; + struct _XkbInterest * next; + CARD16 extDevNotifyMask; + CARD16 stateNotifyMask; + CARD16 namesNotifyMask; + CARD32 ctrlsNotifyMask; + CARD8 compatNotifyMask; + BOOL bellNotifyMask; + BOOL actionMessageMask; + CARD16 accessXNotifyMask; + CARD32 iStateNotifyMask; + CARD32 iMapNotifyMask; + CARD16 altSymsNotifyMask; + CARD32 autoCtrls; + CARD32 autoCtrlValues; +} XkbInterestRec,*XkbInterestPtr; + +typedef struct _XkbRadioGroup { + CARD8 flags; + CARD8 nMembers; + CARD8 dfltDown; + CARD8 currentDown; + CARD8 members[XkbRGMaxMembers]; +} XkbRadioGroupRec, *XkbRadioGroupPtr; + +typedef struct _XkbEventCause { + CARD8 kc; + CARD8 event; + CARD8 mjr; + CARD8 mnr; + ClientPtr client; +} XkbEventCauseRec,*XkbEventCausePtr; +#define XkbSetCauseKey(c,k,e) { (c)->kc= (k),(c)->event= (e),\ + (c)->mjr= (c)->mnr= 0; \ + (c)->client= NULL; } +#define XkbSetCauseReq(c,j,n,cl) { (c)->kc= (c)->event= 0,\ + (c)->mjr= (j),(c)->mnr= (n);\ + (c)->client= (cl); } +#define XkbSetCauseCoreReq(c,e,cl) XkbSetCauseReq(c,e,0,cl) +#define XkbSetCauseXkbReq(c,e,cl) XkbSetCauseReq(c,XkbReqCode,e,cl) +#define XkbSetCauseUnknown(c) XkbSetCauseKey(c,0,0) + +#define _OFF_TIMER 0 +#define _KRG_WARN_TIMER 1 +#define _KRG_TIMER 2 +#define _SK_TIMEOUT_TIMER 3 +#define _ALL_TIMEOUT_TIMER 4 + +#define _BEEP_NONE 0 +#define _BEEP_FEATURE_ON 1 +#define _BEEP_FEATURE_OFF 2 +#define _BEEP_FEATURE_CHANGE 3 +#define _BEEP_SLOW_WARN 4 +#define _BEEP_SLOW_PRESS 5 +#define _BEEP_SLOW_ACCEPT 6 +#define _BEEP_SLOW_REJECT 7 +#define _BEEP_SLOW_RELEASE 8 +#define _BEEP_STICKY_LATCH 9 +#define _BEEP_STICKY_LOCK 10 +#define _BEEP_STICKY_UNLOCK 11 +#define _BEEP_LED_ON 12 +#define _BEEP_LED_OFF 13 +#define _BEEP_LED_CHANGE 14 +#define _BEEP_BOUNCE_REJECT 15 + +typedef struct _XkbFilter { + CARD16 keycode; + CARD8 what; + CARD8 active; + CARD8 filterOthers; + CARD32 priv; + XkbAction upAction; + int (*filter)( + struct _XkbSrvInfo* /* xkbi */, + struct _XkbFilter * /* filter */, + unsigned /* keycode */, + XkbAction * /* action */ + ); + struct _XkbFilter *next; +} XkbFilterRec,*XkbFilterPtr; + +typedef struct _XkbSrvInfo { + XkbStateRec prev_state; + XkbStateRec state; + XkbDescPtr desc; + + DeviceIntPtr device; + KbdCtrlProcPtr kbdProc; + + XkbRadioGroupPtr radioGroups; + CARD8 nRadioGroups; + CARD8 clearMods; + CARD8 setMods; + INT16 groupChange; + + CARD16 dfltPtrDelta; + + double mouseKeysCurve; + double mouseKeysCurveFactor; + INT16 mouseKeysDX; + INT16 mouseKeysDY; + CARD8 mouseKeysFlags; + Bool mouseKeysAccel; + CARD8 mouseKeysCounter; + + CARD8 lockedPtrButtons; + CARD8 shiftKeyCount; + KeyCode mouseKey; + KeyCode inactiveKey; + KeyCode slowKey; + KeyCode repeatKey; + CARD8 krgTimerActive; + CARD8 beepType; + CARD8 beepCount; + + CARD32 flags; + CARD32 lastPtrEventTime; + CARD32 lastShiftEventTime; + OsTimerPtr beepTimer; + OsTimerPtr mouseKeyTimer; + OsTimerPtr slowKeysTimer; + OsTimerPtr bounceKeysTimer; + OsTimerPtr repeatKeyTimer; + OsTimerPtr krgTimer; + + int szFilters; + XkbFilterPtr filters; +} XkbSrvInfoRec, *XkbSrvInfoPtr; + +#define XkbSLI_IsDefault (1L<<0) +#define XkbSLI_HasOwnState (1L<<1) + +typedef struct _XkbSrvLedInfo { + CARD16 flags; + CARD16 class; + CARD16 id; + union { + KbdFeedbackPtr kf; + LedFeedbackPtr lf; + } fb; + + CARD32 physIndicators; + CARD32 autoState; + CARD32 explicitState; + CARD32 effectiveState; + + CARD32 mapsPresent; + CARD32 namesPresent; + XkbIndicatorMapPtr maps; + Atom * names; + + CARD32 usesBase; + CARD32 usesLatched; + CARD32 usesLocked; + CARD32 usesEffective; + CARD32 usesCompat; + CARD32 usesControls; + + CARD32 usedComponents; +} XkbSrvLedInfoRec, *XkbSrvLedInfoPtr; + +/* + * Settings for xkbClientFlags field (used by DIX) + * These flags _must_ not overlap with XkbPCF_* + */ +#define _XkbClientInitialized (1<<15) + +#define _XkbWantsDetectableAutoRepeat(c)\ + ((c)->xkbClientFlags&XkbPCF_DetectableAutoRepeatMask) + +/* + * Settings for flags field + */ +#define _XkbStateNotifyInProgress (1<<0) + +typedef struct +{ + ProcessInputProc processInputProc; + /* If processInputProc is set to something different than realInputProc, + * UNWRAP and COND_WRAP will not touch processInputProc and update only + * realInputProc. This ensures that + * processInputProc == (frozen ? EnqueueEvent : realInputProc) + * + * WRAP_PROCESS_INPUT_PROC should only be called during initialization, + * since it may destroy this invariant. + */ + ProcessInputProc realInputProc; + DeviceUnwrapProc unwrapProc; +} xkbDeviceInfoRec, *xkbDeviceInfoPtr; + +#define WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ + device->public.processInputProc = proc; \ + oldprocs->processInputProc = \ + oldprocs->realInputProc = device->public.realInputProc; \ + device->public.realInputProc = proc; \ + oldprocs->unwrapProc = device->unwrapProc; \ + device->unwrapProc = unwrapproc; + +#define COND_WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ + if (device->public.processInputProc == device->public.realInputProc)\ + device->public.processInputProc = proc; \ + oldprocs->processInputProc = \ + oldprocs->realInputProc = device->public.realInputProc; \ + device->public.realInputProc = proc; \ + oldprocs->unwrapProc = device->unwrapProc; \ + device->unwrapProc = unwrapproc; + +#define UNWRAP_PROCESS_INPUT_PROC(device, oldprocs, backupproc) \ + backupproc = device->public.realInputProc; \ + if (device->public.processInputProc == device->public.realInputProc)\ + device->public.processInputProc = oldprocs->realInputProc; \ + device->public.realInputProc = oldprocs->realInputProc; \ + device->unwrapProc = oldprocs->unwrapProc; + +extern _X_EXPORT DevPrivateKeyRec xkbDevicePrivateKeyRec; +#define xkbDevicePrivateKey (&xkbDevicePrivateKeyRec) + +#define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr)dixLookupPrivate(&(dev)->devPrivates, xkbDevicePrivateKey)) + +extern void xkbUnwrapProc(DeviceIntPtr, DeviceHandleProc, pointer); + +/***====================================================================***/ + + +/***====================================================================***/ + +#define XkbAX_KRGMask (XkbSlowKeysMask|XkbBounceKeysMask) +#define XkbAllFilteredEventsMask \ + (XkbAccessXKeysMask|XkbRepeatKeysMask|XkbMouseKeysAccelMask|XkbAX_KRGMask) + +/***====================================================================***/ + +extern _X_EXPORT int XkbReqCode; +extern _X_EXPORT int XkbEventBase; +extern _X_EXPORT int XkbKeyboardErrorCode; +extern _X_EXPORT const char * XkbBaseDirectory; +extern _X_EXPORT const char * XkbBinDirectory; + +extern _X_EXPORT CARD32 xkbDebugFlags; + +#define _XkbLibError(c,l,d) /* Epoch fail */ +#define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff))) +#define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c)) +#define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d))) + +extern _X_EXPORT int DeviceKeyPress,DeviceKeyRelease,DeviceMotionNotify; +extern _X_EXPORT int DeviceButtonPress,DeviceButtonRelease; + +#define Status int + +extern _X_EXPORT void XkbUseMsg( + void +); + +extern _X_EXPORT int XkbProcessArguments( + int /* argc */, + char ** /* argv */, + int /* i */ +); + +extern _X_EXPORT Bool XkbInitPrivates(void); + +extern _X_EXPORT void XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc); + +extern _X_EXPORT void XkbFreeCompatMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeMap */ +); + +extern _X_EXPORT void XkbFreeNames( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeMap */ +); + +extern _X_EXPORT int _XkbLookupAnyDevice( + DeviceIntPtr *pDev, + int id, + ClientPtr client, + Mask access_mode, + int *xkb_err +); + +extern _X_EXPORT int _XkbLookupKeyboard( + DeviceIntPtr *pDev, + int id, + ClientPtr client, + Mask access_mode, + int *xkb_err +); + +extern _X_EXPORT int _XkbLookupBellDevice( + DeviceIntPtr *pDev, + int id, + ClientPtr client, + Mask access_mode, + int *xkb_err +); + +extern _X_EXPORT int _XkbLookupLedDevice( + DeviceIntPtr *pDev, + int id, + ClientPtr client, + Mask access_mode, + int *xkb_err +); + +extern _X_EXPORT int _XkbLookupButtonDevice( + DeviceIntPtr *pDev, + int id, + ClientPtr client, + Mask access_mode, + int *xkb_err +); + +extern _X_EXPORT XkbDescPtr XkbAllocKeyboard( + void +); + +extern _X_EXPORT Status XkbAllocClientMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nTypes */ +); + +extern _X_EXPORT Status XkbAllocServerMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nNewActions */ +); + +extern _X_EXPORT void XkbFreeClientMap( + XkbDescPtr /* xkb */, + unsigned int /* what */, + Bool /* freeMap */ +); + +extern _X_EXPORT void XkbFreeServerMap( + XkbDescPtr /* xkb */, + unsigned int /* what */, + Bool /* freeMap */ +); + +extern _X_EXPORT Status XkbAllocIndicatorMaps( + XkbDescPtr /* xkb */ +); + +extern _X_EXPORT Status XkbAllocCompatMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nInterpret */ +); + +extern _X_EXPORT Status XkbAllocNames( + XkbDescPtr /* xkb */, + unsigned int /* which */, + int /* nTotalRG */, + int /* nTotalAliases */ +); + +extern _X_EXPORT Status XkbAllocControls( + XkbDescPtr /* xkb */, + unsigned int /* which*/ +); + +extern _X_EXPORT Status XkbCopyKeyTypes( + XkbKeyTypePtr /* from */, + XkbKeyTypePtr /* into */, + int /* num_types */ +); + +extern _X_EXPORT Status XkbResizeKeyType( + XkbDescPtr /* xkb */, + int /* type_ndx */, + int /* map_count */, + Bool /* want_preserve */, + int /* new_num_lvls */ +); + +extern _X_EXPORT void XkbFreeKeyboard( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeDesc */ +); + +extern _X_EXPORT void XkbFreeComponentNames( + XkbComponentNamesPtr /* names */, + Bool /* freeNames */ +); + +extern _X_EXPORT void XkbSetActionKeyMods( + XkbDescPtr /* xkb */, + XkbAction * /* act */, + unsigned int /* mods */ +); + +extern _X_EXPORT unsigned int XkbMaskForVMask( + XkbDescPtr /* xkb */, + unsigned int /* vmask */ +); + +extern _X_EXPORT Bool XkbVirtualModsToReal( + XkbDescPtr /* xkb */, + unsigned int /* virtua_mask */, + unsigned int * /* mask_rtrn */ +); + +extern _X_EXPORT unsigned int XkbAdjustGroup( + int /* group */, + XkbControlsPtr /* ctrls */ +); + +extern _X_EXPORT KeySym *XkbResizeKeySyms( + XkbDescPtr /* xkb */, + int /* key */, + int /* needed */ +); + +extern _X_EXPORT XkbAction *XkbResizeKeyActions( + XkbDescPtr /* xkb */, + int /* key */, + int /* needed */ +); + +extern _X_EXPORT void XkbUpdateKeyTypesFromCore( + DeviceIntPtr /* pXDev */, + KeySymsPtr /* syms */, + KeyCode /* first */, + CARD8 /* num */, + XkbChangesPtr /* pChanges */ +); + +extern _X_EXPORT void XkbUpdateDescActions( + XkbDescPtr /* xkb */, + KeyCode /* first */, + CARD8 /* num */, + XkbChangesPtr /* changes */ +); + +extern _X_EXPORT void XkbUpdateActions( + DeviceIntPtr /* pXDev */, + KeyCode /* first */, + CARD8 /* num */, + XkbChangesPtr /* pChanges */, + unsigned int * /* needChecksRtrn */, + XkbEventCausePtr /* cause */ +); + +extern _X_EXPORT KeySymsPtr XkbGetCoreMap( + DeviceIntPtr /* keybd */ +); + +extern _X_EXPORT void XkbApplyMappingChange( + DeviceIntPtr /* pXDev */, + KeySymsPtr /* map */, + KeyCode /* firstKey */, + CARD8 /* num */, + CARD8 * /* modmap */, + ClientPtr /* client */ +); + +extern _X_EXPORT void XkbSetIndicators( + DeviceIntPtr /* pXDev */, + CARD32 /* affect */, + CARD32 /* values */, + XkbEventCausePtr /* cause */ +); + +extern _X_EXPORT void XkbUpdateIndicators( + DeviceIntPtr /* keybd */, + CARD32 /* changed */, + Bool /* check_edevs */, + XkbChangesPtr /* pChanges */, + XkbEventCausePtr /* cause */ +); + +extern _X_EXPORT XkbSrvLedInfoPtr XkbAllocSrvLedInfo( + DeviceIntPtr /* dev */, + KbdFeedbackPtr /* kf */, + LedFeedbackPtr /* lf */, + unsigned int /* needed_parts */ +); + +extern _X_EXPORT XkbSrvLedInfoPtr XkbCopySrvLedInfo( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* src */, + KbdFeedbackPtr /* kf */, + LedFeedbackPtr /* lf */ +); + + +extern _X_EXPORT XkbSrvLedInfoPtr XkbFindSrvLedInfo( + DeviceIntPtr /* dev */, + unsigned int /* class */, + unsigned int /* id */, + unsigned int /* needed_parts */ +); + +extern _X_EXPORT void XkbApplyLedNameChanges( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* changed_names */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern _X_EXPORT void XkbApplyLedMapChanges( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* changed_maps */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern _X_EXPORT void XkbApplyLedStateChanges( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* changed_leds */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern _X_EXPORT void XkbFlushLedEvents( + DeviceIntPtr /* dev */, + DeviceIntPtr /* kbd */, + XkbSrvLedInfoPtr /* sli */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern _X_EXPORT unsigned int XkbIndicatorsToUpdate( + DeviceIntPtr /* dev */, + unsigned long /* state_changes */, + Bool /* enabled_ctrl_changes */ +); + +extern _X_EXPORT void XkbComputeDerivedState( + XkbSrvInfoPtr /* xkbi */ +); + +extern _X_EXPORT void XkbCheckSecondaryEffects( + XkbSrvInfoPtr /* xkbi */, + unsigned int /* which */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern _X_EXPORT void XkbCheckIndicatorMaps( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* which */ +); + +extern _X_EXPORT unsigned int XkbStateChangedFlags( + XkbStatePtr /* old */, + XkbStatePtr /* new */ +); + +extern _X_EXPORT void XkbSendStateNotify( + DeviceIntPtr /* kbd */, + xkbStateNotify * /* pSN */ +); + +extern _X_EXPORT void XkbSendMapNotify( + DeviceIntPtr /* kbd */, + xkbMapNotify * /* ev */ +); + +extern _X_EXPORT int XkbComputeControlsNotify( + DeviceIntPtr /* kbd */, + XkbControlsPtr /* old */, + XkbControlsPtr /* new */, + xkbControlsNotify * /* pCN */, + Bool /* forceCtrlProc */ +); + +extern _X_EXPORT void XkbSendControlsNotify( + DeviceIntPtr /* kbd */, + xkbControlsNotify * /* ev */ +); + +extern _X_EXPORT void XkbSendCompatMapNotify( + DeviceIntPtr /* kbd */, + xkbCompatMapNotify * /* ev */ +); + +extern _X_EXPORT void XkbHandleBell( + BOOL /* force */, + BOOL /* eventOnly */, + DeviceIntPtr /* kbd */, + CARD8 /* percent */, + pointer /* ctrl */, + CARD8 /* class */, + Atom /* name */, + WindowPtr /* pWin */, + ClientPtr /* pClient */ +); + +extern _X_EXPORT void XkbSendAccessXNotify( + DeviceIntPtr /* kbd */, + xkbAccessXNotify * /* pEv */ +); + +extern _X_EXPORT void XkbSendNamesNotify( + DeviceIntPtr /* kbd */, + xkbNamesNotify * /* ev */ +); + +extern _X_EXPORT void XkbSendActionMessage( + DeviceIntPtr /* kbd */, + xkbActionMessage * /* ev */ +); + +extern _X_EXPORT void XkbSendExtensionDeviceNotify( + DeviceIntPtr /* kbd */, + ClientPtr /* client */, + xkbExtensionDeviceNotify * /* ev */ +); + +extern _X_EXPORT void XkbSendNotification( + DeviceIntPtr /* kbd */, + XkbChangesPtr /* pChanges */, + XkbEventCausePtr /* cause */ +); + +extern _X_EXPORT void XkbProcessKeyboardEvent( + DeviceEvent* /* event */, + DeviceIntPtr /* keybd */ +); + +extern _X_EXPORT void XkbHandleActions( + DeviceIntPtr /* dev */, + DeviceIntPtr /* kbd */, + DeviceEvent* /* event */ +); + +extern _X_EXPORT Bool XkbEnableDisableControls( + XkbSrvInfoPtr /* xkbi */, + unsigned long /* change */, + unsigned long /* newValues */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern _X_EXPORT void AccessXInit( + DeviceIntPtr /* dev */ +); + +extern _X_EXPORT Bool AccessXFilterPressEvent( + DeviceEvent* /* event */, + DeviceIntPtr /* keybd */ +); + +extern _X_EXPORT Bool AccessXFilterReleaseEvent( + DeviceEvent* /* event */, + DeviceIntPtr /* keybd */ +); + +extern _X_EXPORT void AccessXCancelRepeatKey( + XkbSrvInfoPtr /* xkbi */, + KeyCode /* key */ +); + +extern _X_EXPORT void AccessXComputeCurveFactor( + XkbSrvInfoPtr /* xkbi */, + XkbControlsPtr /* ctrls */ +); + +extern _X_EXPORT XkbInterestPtr XkbFindClientResource( + DevicePtr /* inDev */, + ClientPtr /* client */ +); + +extern _X_EXPORT XkbInterestPtr XkbAddClientResource( + DevicePtr /* inDev */, + ClientPtr /* client */, + XID /* id */ +); + +extern _X_EXPORT int XkbRemoveResourceClient( + DevicePtr /* inDev */, + XID /* id */ +); + +extern _X_EXPORT int XkbDDXAccessXBeep( + DeviceIntPtr /* dev */, + unsigned int /* what */, + unsigned int /* which */ +); + +extern _X_EXPORT int XkbDDXUsesSoftRepeat( + DeviceIntPtr /* dev */ +); + +extern _X_EXPORT void XkbDDXKeybdCtrlProc( + DeviceIntPtr /* dev */, + KeybdCtrl * /* ctrl */ +); + +extern _X_EXPORT void XkbDDXChangeControls( + DeviceIntPtr /* dev */, + XkbControlsPtr /* old */, + XkbControlsPtr /* new */ +); + +extern _X_EXPORT void XkbDDXUpdateDeviceIndicators( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + CARD32 /* newState */ +); + +extern _X_EXPORT int XkbDDXTerminateServer( + DeviceIntPtr /* dev */, + KeyCode /* key */, + XkbAction * /* act */ +); + +extern _X_EXPORT int XkbDDXSwitchScreen( + DeviceIntPtr /* dev */, + KeyCode /* key */, + XkbAction * /* act */ +); + +extern _X_EXPORT int XkbDDXPrivate( + DeviceIntPtr /* dev */, + KeyCode /* key */, + XkbAction * /* act */ +); + +extern _X_EXPORT void XkbDisableComputedAutoRepeats( + DeviceIntPtr /* pXDev */, + unsigned int /* key */ +); + +extern _X_EXPORT void XkbSetRepeatKeys( + DeviceIntPtr /* pXDev */, + int /* key */, + int /* onoff */ +); + +extern _X_EXPORT int XkbLatchModifiers( + DeviceIntPtr /* pXDev */, + CARD8 /* mask */, + CARD8 /* latches */ +); + +extern _X_EXPORT int XkbLatchGroup( + DeviceIntPtr /* pXDev */, + int /* group */ +); + +extern _X_EXPORT void XkbClearAllLatchesAndLocks( + DeviceIntPtr /* dev */, + XkbSrvInfoPtr /* xkbi */, + Bool /* genEv */, + XkbEventCausePtr /* cause */ +); + +extern _X_EXPORT void XkbGetRulesDflts( + XkbRMLVOSet * /* rmlvo */ +); + +extern _X_EXPORT void XkbFreeRMLVOSet( + XkbRMLVOSet * /* rmlvo */, + Bool /* freeRMLVO */ +); + +extern _X_EXPORT void XkbSetRulesDflts( + XkbRMLVOSet * /* rmlvo */ +); + +extern _X_EXPORT void XkbDeleteRulesDflts( + void +); + +extern _X_EXPORT int SProcXkbDispatch( + ClientPtr /* client */ +); + +extern _X_EXPORT XkbGeometryPtr XkbLookupNamedGeometry( + DeviceIntPtr /* dev */, + Atom /* name */, + Bool * /* shouldFree */ +); + +extern _X_EXPORT void XkbConvertCase( + KeySym /* sym */, + KeySym * /* lower */, + KeySym * /* upper */ +); + +extern _X_EXPORT Status XkbChangeKeycodeRange( + XkbDescPtr /* xkb */, + int /* minKC */, + int /* maxKC */, + XkbChangesPtr /* changes */ +); + +extern _X_EXPORT void XkbFreeSrvLedInfo( + XkbSrvLedInfoPtr /* sli */ +); + +extern _X_EXPORT void XkbFreeInfo( + XkbSrvInfoPtr /* xkbi */ +); + +extern _X_EXPORT Status XkbChangeTypesOfKey( + XkbDescPtr /* xkb */, + int /* key */, + int /* nGroups */, + unsigned int /* groups */, + int * /* newTypesIn */, + XkbMapChangesPtr /* changes */ +); + +extern _X_EXPORT int XkbKeyTypesForCoreSymbols( + XkbDescPtr /* xkb */, + int /* map_width */, + KeySym * /* core_syms */, + unsigned int /* protected */, + int * /* types_inout */, + KeySym * /* xkb_syms_rtrn */ +); + +extern _X_EXPORT Bool XkbApplyCompatMapToKey( + XkbDescPtr /* xkb */, + KeyCode /* key */, + XkbChangesPtr /* changes */ +); + +extern _X_EXPORT Bool XkbApplyVirtualModChanges( + XkbDescPtr /* xkb */, + unsigned int /* changed */, + XkbChangesPtr /* changes */ +); + +extern _X_EXPORT void XkbSendNewKeyboardNotify( + DeviceIntPtr /* kbd */, + xkbNewKeyboardNotify * /* pNKN */ +); + +extern Bool XkbCopyKeymap( + XkbDescPtr /* dst */, + XkbDescPtr /* src */); + +extern _X_EXPORT Bool XkbCopyDeviceKeymap( + DeviceIntPtr /* dst */, + DeviceIntPtr /* src */); + +extern void XkbFilterEvents( + ClientPtr /* pClient */, + int /* nEvents */, + xEvent* /* xE */); + +extern int XkbGetEffectiveGroup( + XkbSrvInfoPtr /* xkbi */, + XkbStatePtr /* xkbstate */, + CARD8 /* keycode */); + +extern void XkbMergeLockedPtrBtns( + DeviceIntPtr /* master */); + +extern void XkbFakeDeviceButton( + DeviceIntPtr /* dev */, + int /* press */, + int /* button */); + + +#include "xkbfile.h" +#include "xkbrules.h" + +#define _XkbListKeycodes 0 +#define _XkbListTypes 1 +#define _XkbListCompat 2 +#define _XkbListSymbols 3 +#define _XkbListGeometry 4 +#define _XkbListNumComponents 5 + +typedef struct _XkbSrvListInfo { + int szPool; + int nPool; + char * pool; + + int maxRtrn; + int nTotal; + + char * pattern[_XkbListNumComponents]; + int nFound[_XkbListNumComponents]; +} XkbSrvListInfoRec,*XkbSrvListInfoPtr; + +extern _X_EXPORT Status XkbDDXList( + DeviceIntPtr /* dev */, + XkbSrvListInfoPtr /* listing */, + ClientPtr /* client */ +); + +extern _X_EXPORT unsigned int XkbDDXLoadKeymapByNames( + DeviceIntPtr /* keybd */, + XkbComponentNamesPtr /* names */, + unsigned int /* want */, + unsigned int /* need */, + XkbDescPtr * /* finfoRtrn */, + char * /* keymapNameRtrn */, + int /* keymapNameRtrnLen */ +); + +extern _X_EXPORT Bool XkbDDXNamesFromRules( + DeviceIntPtr /* keybd */, + char * /* rules */, + XkbRF_VarDefsPtr /* defs */, + XkbComponentNamesPtr /* names */ +); + +extern _X_EXPORT XkbDescPtr XkbCompileKeymap( + DeviceIntPtr /* dev */, + XkbRMLVOSet * /* rmlvo */ +); + +#endif /* _XKBSRV_H_ */ diff --git a/xorg-server/include/xorg-server.h.in b/xorg-server/include/xorg-server.h.in index 16da7500d..b10b9949e 100644 --- a/xorg-server/include/xorg-server.h.in +++ b/xorg-server/include/xorg-server.h.in @@ -1,191 +1,191 @@ -/* xorg-server.h.in -*- c -*- - * - * This file is the template file for the xorg-server.h file which gets - * installed as part of the SDK. The #defines in this file overlap - * with those from config.h, but only for those options that we want - * to export to external modules. Boilerplate autotool #defines such - * as HAVE_STUFF and PACKAGE_NAME is kept in config.h - * - * It is still possible to update config.h.in using autoheader, since - * autoheader only creates a .h.in file for the first - * AM_CONFIG_HEADER() line, and thus does not overwrite this file. - * - * However, it should be kept in sync with this file. - */ - -#ifndef _XORG_SERVER_H_ -#define _XORG_SERVER_H_ - -/* Support BigRequests extension */ -#undef BIGREQS - -/* Default font path */ -#undef COMPILEDDEFAULTFONTPATH - -/* Support Composite Extension */ -#undef COMPOSITE - -/* Build DPMS extension */ -#undef DPMSExtension - -/* Build GLX extension */ -#undef GLXEXT - -/* Support XDM-AUTH*-1 */ -#undef HASXDMAUTH - -/* Support SHM */ -#undef HAS_SHM - -/* Support IPv6 for TCP connections */ -#undef IPv6 - -/* Support MIT-SHM Extension */ -#undef MITSHM - -/* Internal define for Xinerama */ -#undef PANORAMIX - -/* Support RANDR extension */ -#undef RANDR - -/* Support RENDER extension */ -#undef RENDER - -/* Support X resource extension */ -#undef RES - -/* Support MIT-SCREEN-SAVER extension */ -#undef SCREENSAVER - -/* Support SHAPE extension */ -#undef SHAPE - -/* Define to 1 on systems derived from System V Release 4 */ -#undef SVR4 - -/* Support TCP socket connections */ -#undef TCPCONN - -/* Enable touchscreen support */ -#undef TOUCHSCREEN - -/* Support tslib touchscreen abstraction library */ -#undef TSLIB - -/* Support UNIX socket connections */ -#undef UNIXCONN - -/* unaligned word accesses behave as expected */ -#undef WORKING_UNALIGNED_INT - -/* Support XCMisc extension */ -#undef XCMISC - -/* Support Xdmcp */ -#undef XDMCP - -/* Build XFree86 BigFont extension */ -#undef XF86BIGFONT - -/* Support XFree86 Video Mode extension */ -#undef XF86VIDMODE - -/* Build XDGA support */ -#undef XFreeXDGA - -/* Support Xinerama extension */ -#undef XINERAMA - -/* Support X Input extension */ -#undef XINPUT - -/* XKB default rules */ -#undef XKB_DFLT_RULES - -/* Support loadable input and output drivers */ -#undef XLOADABLE - -/* Build DRI extension */ -#undef XF86DRI - -/* Build DRI2 extension */ -#undef DRI2 - -/* Build Xorg server */ -#undef XORGSERVER - -/* Vendor release */ -#undef XORG_RELEASE - -/* Current Xorg version */ -#undef XORG_VERSION_CURRENT - -/* Build Xv Extension */ -#undef XvExtension - -/* Build XvMC Extension */ -#undef XvMCExtension - -/* Support XSync extension */ -#undef XSYNC - -/* Support XTest extension */ -#undef XTEST - -/* Support Xv Extension */ -#undef XV - -/* Vendor name */ -#undef XVENDORNAME - -/* BSD-compliant source */ -#undef _BSD_SOURCE - -/* POSIX-compliant source */ -#undef _POSIX_SOURCE - -/* X/Open-compliant source */ -#undef _XOPEN_SOURCE - -/* Vendor web address for support */ -#undef __VENDORDWEBSUPPORT__ - -/* Location of configuration file */ -#undef __XCONFIGFILE__ - -/* Name of X server */ -#undef __XSERVERNAME__ - -/* Building vgahw module */ -#undef WITH_VGAHW - -/* System is BSD-like */ -#undef CSRG_BASED - -/* System has PC console */ -#undef PCCONS_SUPPORT - -/* System has PCVT console */ -#undef PCVT_SUPPORT - -/* System has syscons console */ -#undef SYSCONS_SUPPORT - -/* System has wscons console */ -#undef WSCONS_SUPPORT - -/* Loadable XFree86 server awesomeness */ -#undef XFree86LOADER - -/* Use libpciaccess */ -#undef XSERVER_LIBPCIACCESS - -/* X Access Control Extension */ -#undef XACE - -#ifdef _LP64 -#define _XSERVER64 1 -#endif - -#endif /* _XORG_SERVER_H_ */ +/* xorg-server.h.in -*- c -*- + * + * This file is the template file for the xorg-server.h file which gets + * installed as part of the SDK. The #defines in this file overlap + * with those from config.h, but only for those options that we want + * to export to external modules. Boilerplate autotool #defines such + * as HAVE_STUFF and PACKAGE_NAME is kept in config.h + * + * It is still possible to update config.h.in using autoheader, since + * autoheader only creates a .h.in file for the first + * AM_CONFIG_HEADER() line, and thus does not overwrite this file. + * + * However, it should be kept in sync with this file. + */ + +#ifndef _XORG_SERVER_H_ +#define _XORG_SERVER_H_ + +/* Support BigRequests extension */ +#undef BIGREQS + +/* Default font path */ +#undef COMPILEDDEFAULTFONTPATH + +/* Support Composite Extension */ +#undef COMPOSITE + +/* Build DPMS extension */ +#undef DPMSExtension + +/* Build GLX extension */ +#undef GLXEXT + +/* Support XDM-AUTH*-1 */ +#undef HASXDMAUTH + +/* Support SHM */ +#undef HAS_SHM + +/* Support IPv6 for TCP connections */ +#undef IPv6 + +/* Support MIT-SHM Extension */ +#undef MITSHM + +/* Internal define for Xinerama */ +#undef PANORAMIX + +/* Support RANDR extension */ +#undef RANDR + +/* Support RENDER extension */ +#undef RENDER + +/* Support X resource extension */ +#undef RES + +/* Support MIT-SCREEN-SAVER extension */ +#undef SCREENSAVER + +/* Support SHAPE extension */ +#undef SHAPE + +/* Define to 1 on systems derived from System V Release 4 */ +#undef SVR4 + +/* Support TCP socket connections */ +#undef TCPCONN + +/* Enable touchscreen support */ +#undef TOUCHSCREEN + +/* Support tslib touchscreen abstraction library */ +#undef TSLIB + +/* Support UNIX socket connections */ +#undef UNIXCONN + +/* unaligned word accesses behave as expected */ +#undef WORKING_UNALIGNED_INT + +/* Support XCMisc extension */ +#undef XCMISC + +/* Support Xdmcp */ +#undef XDMCP + +/* Build XFree86 BigFont extension */ +#undef XF86BIGFONT + +/* Support XFree86 Video Mode extension */ +#undef XF86VIDMODE + +/* Build XDGA support */ +#undef XFreeXDGA + +/* Support Xinerama extension */ +#undef XINERAMA + +/* Support X Input extension */ +#undef XINPUT + +/* XKB default rules */ +#undef XKB_DFLT_RULES + +/* Support loadable input and output drivers */ +#undef XLOADABLE + +/* Build DRI extension */ +#undef XF86DRI + +/* Build DRI2 extension */ +#undef DRI2 + +/* Build Xorg server */ +#undef XORGSERVER + +/* Vendor release */ +#undef XORG_RELEASE + +/* Current Xorg version */ +#undef XORG_VERSION_CURRENT + +/* Build Xv Extension */ +#undef XvExtension + +/* Build XvMC Extension */ +#undef XvMCExtension + +/* Support XSync extension */ +#undef XSYNC + +/* Support XTest extension */ +#undef XTEST + +/* Support Xv Extension */ +#undef XV + +/* Vendor name */ +#undef XVENDORNAME + +/* BSD-compliant source */ +#undef _BSD_SOURCE + +/* POSIX-compliant source */ +#undef _POSIX_SOURCE + +/* X/Open-compliant source */ +#undef _XOPEN_SOURCE + +/* Vendor web address for support */ +#undef __VENDORDWEBSUPPORT__ + +/* Location of configuration file */ +#undef __XCONFIGFILE__ + +/* Name of X server */ +#undef __XSERVERNAME__ + +/* Building vgahw module */ +#undef WITH_VGAHW + +/* System is BSD-like */ +#undef CSRG_BASED + +/* System has PC console */ +#undef PCCONS_SUPPORT + +/* System has PCVT console */ +#undef PCVT_SUPPORT + +/* System has syscons console */ +#undef SYSCONS_SUPPORT + +/* System has wscons console */ +#undef WSCONS_SUPPORT + +/* Loadable XFree86 server awesomeness */ +#undef XFree86LOADER + +/* Use libpciaccess */ +#undef XSERVER_LIBPCIACCESS + +/* X Access Control Extension */ +#undef XACE + +#ifdef _LP64 +#define _XSERVER64 1 +#endif + +#endif /* _XORG_SERVER_H_ */ -- cgit v1.2.3