diff options
author | marha <marha@users.sourceforge.net> | 2009-06-28 22:07:26 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-06-28 22:07:26 +0000 |
commit | 3562e78743202e43aec8727005182a2558117eca (patch) | |
tree | 8f9113a77d12470c5c851a2a8e4cb02e89df7d43 /xorg-server/XTrap | |
download | vcxsrv-3562e78743202e43aec8727005182a2558117eca.tar.gz vcxsrv-3562e78743202e43aec8727005182a2558117eca.tar.bz2 vcxsrv-3562e78743202e43aec8727005182a2558117eca.zip |
Checked in the following released items:
xkeyboard-config-1.4.tar.gz
ttf-bitstream-vera-1.10.tar.gz
font-alias-1.0.1.tar.gz
font-sun-misc-1.0.0.tar.gz
font-sun-misc-1.0.0.tar.gz
font-sony-misc-1.0.0.tar.gz
font-schumacher-misc-1.0.0.tar.gz
font-mutt-misc-1.0.0.tar.gz
font-misc-misc-1.0.0.tar.gz
font-misc-meltho-1.0.0.tar.gz
font-micro-misc-1.0.0.tar.gz
font-jis-misc-1.0.0.tar.gz
font-isas-misc-1.0.0.tar.gz
font-dec-misc-1.0.0.tar.gz
font-daewoo-misc-1.0.0.tar.gz
font-cursor-misc-1.0.0.tar.gz
font-arabic-misc-1.0.0.tar.gz
font-winitzki-cyrillic-1.0.0.tar.gz
font-misc-cyrillic-1.0.0.tar.gz
font-cronyx-cyrillic-1.0.0.tar.gz
font-screen-cyrillic-1.0.1.tar.gz
font-xfree86-type1-1.0.1.tar.gz
font-adobe-utopia-type1-1.0.1.tar.gz
font-ibm-type1-1.0.0.tar.gz
font-bitstream-type1-1.0.0.tar.gz
font-bitstream-speedo-1.0.0.tar.gz
font-bh-ttf-1.0.0.tar.gz
font-bh-type1-1.0.0.tar.gz
font-bitstream-100dpi-1.0.0.tar.gz
font-bh-lucidatypewriter-100dpi-1.0.0.tar.gz
font-bh-100dpi-1.0.0.tar.gz
font-adobe-utopia-100dpi-1.0.1.tar.gz
font-adobe-100dpi-1.0.0.tar.gz
font-util-1.0.1.tar.gz
font-bitstream-75dpi-1.0.0.tar.gz
font-bh-lucidatypewriter-75dpi-1.0.0.tar.gz
font-adobe-utopia-75dpi-1.0.1.tar.gz
font-bh-75dpi-1.0.0.tar.gz
bdftopcf-1.0.1.tar.gz
font-adobe-75dpi-1.0.0.tar.gz
mkfontscale-1.0.6.tar.gz
openssl-0.9.8k.tar.gz
bigreqsproto-1.0.2.tar.gz
xtrans-1.2.2.tar.gz
resourceproto-1.0.2.tar.gz
inputproto-1.4.4.tar.gz
compositeproto-0.4.tar.gz
damageproto-1.1.0.tar.gz
zlib-1.2.3.tar.gz
xkbcomp-1.0.5.tar.gz
freetype-2.3.9.tar.gz
pthreads-w32-2-8-0-release.tar.gz
pixman-0.12.0.tar.gz
kbproto-1.0.3.tar.gz
evieext-1.0.2.tar.gz
fixesproto-4.0.tar.gz
recordproto-1.13.2.tar.gz
randrproto-1.2.2.tar.gz
scrnsaverproto-1.1.0.tar.gz
renderproto-0.9.3.tar.gz
xcmiscproto-1.1.2.tar.gz
fontsproto-2.0.2.tar.gz
xextproto-7.0.3.tar.gz
xproto-7.0.14.tar.gz
libXdmcp-1.0.2.tar.gz
libxkbfile-1.0.5.tar.gz
libfontenc-1.0.4.tar.gz
libXfont-1.3.4.tar.gz
libX11-1.1.5.tar.gz
libXau-1.0.4.tar.gz
libxcb-1.1.tar.gz
xorg-server-1.5.3.tar.gz
Diffstat (limited to 'xorg-server/XTrap')
-rw-r--r-- | xorg-server/XTrap/Makefile.am | 5 | ||||
-rw-r--r-- | xorg-server/XTrap/Makefile.in | 646 | ||||
-rw-r--r-- | xorg-server/XTrap/xtrapddmi.c | 160 | ||||
-rw-r--r-- | xorg-server/XTrap/xtrapdi.c | 2151 | ||||
-rw-r--r-- | xorg-server/XTrap/xtrapdiswp.c | 937 | ||||
-rw-r--r-- | xorg-server/XTrap/xtrapditbl.c | 243 |
6 files changed, 4142 insertions, 0 deletions
diff --git a/xorg-server/XTrap/Makefile.am b/xorg-server/XTrap/Makefile.am new file mode 100644 index 000000000..1eddd4f56 --- /dev/null +++ b/xorg-server/XTrap/Makefile.am @@ -0,0 +1,5 @@ +noinst_LTLIBRARIES = libxtrap.la + +AM_CFLAGS = $(DIX_CFLAGS) + +libxtrap_la_SOURCES = xtrapddmi.c xtrapdi.c xtrapdiswp.c xtrapditbl.c diff --git a/xorg-server/XTrap/Makefile.in b/xorg-server/XTrap/Makefile.in new file mode 100644 index 000000000..55a3d3e10 --- /dev/null +++ b/xorg-server/XTrap/Makefile.in @@ -0,0 +1,646 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = XTrap +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ + $(top_builddir)/include/xorg-server.h \ + $(top_builddir)/include/dix-config.h \ + $(top_builddir)/include/xgl-config.h \ + $(top_builddir)/include/xorg-config.h \ + $(top_builddir)/include/xkb-config.h \ + $(top_builddir)/include/xwin-config.h \ + $(top_builddir)/include/kdrive-config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libxtrap_la_LIBADD = +am_libxtrap_la_OBJECTS = xtrapddmi.lo xtrapdi.lo xtrapdiswp.lo \ + xtrapditbl.lo +libxtrap_la_OBJECTS = $(am_libxtrap_la_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libxtrap_la_SOURCES) +DIST_SOURCES = $(libxtrap_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ +ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +APPDEFAULTDIR = @APPDEFAULTDIR@ +APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APP_MAN_DIR = @APP_MAN_DIR@ +APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASE_FONT_PATH = @BASE_FONT_PATH@ +BUILD_DATE = @BUILD_DATE@ +BUILD_TIME = @BUILD_TIME@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DARWIN_LIBS = @DARWIN_LIBS@ +DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_LIBS = @DBUS_LIBS@ +DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ +DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ +DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DGA_CFLAGS = @DGA_CFLAGS@ +DGA_LIBS = @DGA_LIBS@ +DIX_CFLAGS = @DIX_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ +DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ +DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ +DMXMODULES_LIBS = @DMXMODULES_LIBS@ +DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ +DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ +DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ +DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ +DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ +DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ +DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ +DRIPROTO_LIBS = @DRIPROTO_LIBS@ +DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ +DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ +DSYMUTIL = @DSYMUTIL@ +DTRACE = @DTRACE@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FILE_MAN_DIR = @FILE_MAN_DIR@ +FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ +FREETYPE_LIBS = @FREETYPE_LIBS@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ +GLX_DEFINES = @GLX_DEFINES@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +GREP = @GREP@ +HAL_CFLAGS = @HAL_CFLAGS@ +HAL_LIBS = @HAL_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ +KDRIVE_INCS = @KDRIVE_INCS@ +KDRIVE_LIBS = @KDRIVE_LIBS@ +KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ +KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ +KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ +LAUNCHD = @LAUNCHD@ +LDFLAGS = @LDFLAGS@ +LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ +LIBDRM_LIBS = @LIBDRM_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_MAN_DIR = @LIB_MAN_DIR@ +LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ +LINUXDOC = @LINUXDOC@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MAKE_HTML = @MAKE_HTML@ +MAKE_PDF = @MAKE_PDF@ +MAKE_PS = @MAKE_PS@ +MAKE_TEXT = @MAKE_TEXT@ +MESA_SOURCE = @MESA_SOURCE@ +MISC_MAN_DIR = @MISC_MAN_DIR@ +MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +MKDIR_P = @MKDIR_P@ +MKFONTDIR = @MKFONTDIR@ +MKFONTSCALE = @MKFONTSCALE@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCCLD = @OBJCCLD@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJCLINK = @OBJCLINK@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ +PCIACCESS_LIBS = @PCIACCESS_LIBS@ +PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ +PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +PROJECTROOT = @PROJECTROOT@ +PS2PDF = @PS2PDF@ +RANLIB = @RANLIB@ +RAWCPP = @RAWCPP@ +RAWCPPFLAGS = @RAWCPPFLAGS@ +SED = @SED@ +SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@ +SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ +STRIP = @STRIP@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ +VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@ +VENDOR_NAME = @VENDOR_NAME@ +VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ +VENDOR_RELEASE = @VENDOR_RELEASE@ +VERSION = @VERSION@ +X11APP_ARCHS = @X11APP_ARCHS@ +X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ +X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ +XDMCP_CFLAGS = @XDMCP_CFLAGS@ +XDMCP_LIBS = @XDMCP_LIBS@ +XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ +XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ +XDMX_CFLAGS = @XDMX_CFLAGS@ +XDMX_LIBS = @XDMX_LIBS@ +XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ +XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@ +XEGL_LIBS = @XEGL_LIBS@ +XEGL_SYS_LIBS = @XEGL_SYS_LIBS@ +XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ +XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@ +XEPHYR_INCS = @XEPHYR_INCS@ +XEPHYR_LIBS = @XEPHYR_LIBS@ +XF86CONFIGFILE = @XF86CONFIGFILE@ +XF86MISC_CFLAGS = @XF86MISC_CFLAGS@ +XF86MISC_LIBS = @XF86MISC_LIBS@ +XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ +XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ +XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@ +XGLMODULES_LIBS = @XGLMODULES_LIBS@ +XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@ +XGLXMODULES_LIBS = @XGLXMODULES_LIBS@ +XGLX_LIBS = @XGLX_LIBS@ +XGLX_SYS_LIBS = @XGLX_SYS_LIBS@ +XGL_LIBS = @XGL_LIBS@ +XGL_MODULE_PATH = @XGL_MODULE_PATH@ +XGL_SYS_LIBS = @XGL_SYS_LIBS@ +XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ +XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ +XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ +XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ +XLIB_CFLAGS = @XLIB_CFLAGS@ +XLIB_LIBS = @XLIB_LIBS@ +XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ +XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ +XNEST_LIBS = @XNEST_LIBS@ +XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ +XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@ +XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@ +XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@ +XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@ +XORG_CFLAGS = @XORG_CFLAGS@ +XORG_INCS = @XORG_INCS@ +XORG_LIBS = @XORG_LIBS@ +XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ +XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ +XORG_OS = @XORG_OS@ +XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XORG_SYS_LIBS = @XORG_SYS_LIBS@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ +XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ +XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ +XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ +XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ +XSDL_INCS = @XSDL_INCS@ +XSDL_LIBS = @XSDL_LIBS@ +XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ +XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ +XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ +XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ +XSERVER_LIBS = @XSERVER_LIBS@ +XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ +XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ +XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ +XVFB_LIBS = @XVFB_LIBS@ +XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ +XWINMODULES_LIBS = @XWINMODULES_LIBS@ +XWIN_LIBS = @XWIN_LIBS@ +XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ +XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +__XCONFIGFILE__ = @__XCONFIGFILE__@ +abi_ansic = @abi_ansic@ +abi_extension = @abi_extension@ +abi_font = @abi_font@ +abi_videodrv = @abi_videodrv@ +abi_xinput = @abi_xinput@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +driverdir = @driverdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +extdir = @extdir@ +ft_config = @ft_config@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +launchagentsdir = @launchagentsdir@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +logdir = @logdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +moduledir = @moduledir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sdkdir = @sdkdir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +xglmoduledir = @xglmoduledir@ +xpconfigdir = @xpconfigdir@ +noinst_LTLIBRARIES = libxtrap.la +AM_CFLAGS = $(DIX_CFLAGS) +libxtrap_la_SOURCES = xtrapddmi.c xtrapdi.c xtrapdiswp.c xtrapditbl.c +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign XTrap/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign XTrap/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libxtrap.la: $(libxtrap_la_OBJECTS) $(libxtrap_la_DEPENDENCIES) + $(LINK) $(libxtrap_la_OBJECTS) $(libxtrap_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xtrapddmi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xtrapdi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xtrapdiswp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xtrapditbl.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/xorg-server/XTrap/xtrapddmi.c b/xorg-server/XTrap/xtrapddmi.c new file mode 100644 index 000000000..3f1a72ab8 --- /dev/null +++ b/xorg-server/XTrap/xtrapddmi.c @@ -0,0 +1,160 @@ +/***************************************************************************** +Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA + +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. + +*****************************************************************************/ +/* + * ABSTRACT: + * + * This module is the platform-specific but conditionally independent + * code for the XTrap extension (usually I/O or platform setup). + * This is shared code and is subject to change only by team approval. + * + * CONTRIBUTORS: + * + * Dick Annicchiarico + * Robert Chesler + * Gene Durso + * Marc Evans + * Alan Jamison + * Mark Henry + * Ken Miller + * + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <errno.h> +#include <X11/Xos.h> +#ifdef PC +# include "fcntl.h" +# include "io.h" +# define O_NDELAY 0L +#endif + +#define NEED_REPLIES +#define NEED_EVENTS +#include <X11/X.h> /* From library include environment */ +#include "inputstr.h" /* From server include env. (must be before Xlib.h!) */ +#ifdef PC +# include "scrintst.h" /* Screen struct */ +# include "extnsist.h" +#else +# include "extnsionst.h" /* Server ExtensionEntry definitions */ +# include "scrnintstr.h" /* Screen struct */ +#endif + +#include <X11/extensions/xtrapdi.h> +#include <X11/extensions/xtrapddmi.h> +#include <X11/extensions/xtrapproto.h> + +extern int XETrapErrorBase; +extern xXTrapGetAvailReply XETrap_avail; +extern DevicePtr XETrapKbdDev; +extern DevicePtr XETrapPtrDev; + +/* + * DESCRIPTION: + * + * This function performs the platform specific setup for server + * extension implementations. + */ +void XETrapPlatformSetup() +{ +} + + +#if !defined _XINPUT +/* + * DESCRIPTION: + * + * This routine processes the simulation of some input event. + * + */ +int XETrapSimulateXEvent(register xXTrapInputReq *request, + register ClientPtr client) +{ + ScreenPtr pScr = NULL; + int status = Success; + xEvent xev; + register int x = request->input.x; + register int y = request->input.y; + DevicePtr keydev = (DevicePtr)inputInfo.keyboard; + DevicePtr ptrdev = (DevicePtr)inputInfo.pointer; + + if (request->input.screen < screenInfo.numScreens) + { + pScr = screenInfo.screens[request->input.screen]; + } + else + { /* Trying to play bogus events to this WS! */ +#ifdef VERBOSE + ErrorF("%s: Trying to send events to screen %d!\n", XTrapExtName, + request->input.screen); +#endif + status = XETrapErrorBase + BadScreen; + } + /* Fill in the event structure with the information + * Note: root, event, child, eventX, eventY, state, and sameScreen + * are all updated by FixUpEventFromWindow() when the events + * are delivered via DeliverDeviceEvents() or whatever. XTrap + * needs to only concern itself with type, detail, time, rootX, + * and rootY. + */ + if (status == Success) + { + xev.u.u.type = request->input.type; + xev.u.u.detail = request->input.detail; + xev.u.keyButtonPointer.time = GetTimeInMillis(); + xev.u.keyButtonPointer.rootX = x; + xev.u.keyButtonPointer.rootY = y; + + if (request->input.type == MotionNotify) + { /* Set new cursor position on screen */ + XETrap_avail.data.cur_x = x; + XETrap_avail.data.cur_y = y; + NewCurrentScreen (pScr, x, y); /* fix from amnonc@mercury.co.il */ + if (!(*pScr->SetCursorPosition)(pScr, x, y, xFalse)) + { + status = BadImplementation; + } + } + } + if (status == Success) + { + switch(request->input.type) + { /* Now process the event appropriately */ + case KeyPress: + case KeyRelease: + (*XETrapKbdDev->realInputProc)(&xev,(DeviceIntPtr)keydev, 1L); + break; + case MotionNotify: + case ButtonPress: + case ButtonRelease: + (*XETrapPtrDev->realInputProc)(&xev,(DeviceIntPtr)ptrdev, 1L); + break; + default: + status = BadValue; + break; + } + } + return(status); +} +#endif /* _XINPUT */ diff --git a/xorg-server/XTrap/xtrapdi.c b/xorg-server/XTrap/xtrapdi.c new file mode 100644 index 000000000..55c28a8b9 --- /dev/null +++ b/xorg-server/XTrap/xtrapdi.c @@ -0,0 +1,2151 @@ +/***************************************************************************** +Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA +X11R6 Changes Copyright (c) 1994 by Robert Chesler of Absol-Puter, Hudson, NH. + +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 AND ABSOL-PUTER DISCLAIM ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL DIGITAL OR ABSOL-PUTER 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. + +*****************************************************************************/ +/* + * ABSTRACT: + * + * This module is the main module for extension initialization and setup. + * It is called by the server and by clients using the extension. + * This is shared code and is subject to change only by team approval. + * + * CONTRIBUTORS: + * + * Dick Annicchiarico + * Robert Chesler + * Gene Durso + * Marc Evans + * Alan Jamison + * Mark Henry + * Ken Miller + * + * CHANGES: + * + * Robert Chesler - grab-impreviousness patch to improve grab behavior + * Robert Chesler - add client arg to swapping routines for X11R6 port + * + */ + +/*-----------------* + * Include Files * + *-----------------*/ + +#define NEED_REPLIES +#define NEED_EVENTS +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <stdio.h> +#include <errno.h> +#include <X11/Xos.h> +#include <X11/X.h> +#include <X11/Xproto.h> +#include "inputstr.h" /* Server DevicePtr definitions */ +#include "misc.h" /* Server swapping macros */ +#include "dixstruct.h" /* Server ClientRec definitions */ +#include "resource.h" /* Used with the MakeAtom call */ +#ifdef PC +# include "scrintst.h" /* Screen struct */ +# include "extnsist.h" +#else +# include "extnsionst.h" /* Server ExtensionEntry definitions */ +# include "scrnintstr.h" /* Screen struct */ +#endif +#include "pixmapstr.h" /* DrawableRec */ +#include "windowstr.h" /* Drawable Lookup structures */ +#include <X11/extensions/xtrapdi.h> +#include <X11/extensions/xtrapddmi.h> +#include <X11/extensions/xtrapproto.h> +#include "colormapst.h" +#ifdef PANORAMIX +#include "panoramiX.h" +#include "panoramiXsrv.h" +#include "cursor.h" +#endif + + +/*----------------------------* + * Global Data Declarations * + *----------------------------*/ + +DevicePtr XETrapKbdDev = NULL; +DevicePtr XETrapPtrDev = NULL; +int XETrapErrorBase = 0L; +xXTrapGetAvailReply XETrap_avail; /* What's available to clients */ + +globalref int_function XETrapDispatchVector[10L]; /* Vector of XTrap Rtns */ +globalref int_function XETSwDispatchVector[10L]; /* Swapped XTrap Rtns */ + +globalref int_function XETrapProcVector[256L]; /* The "shadowed" ProcVector */ + /* The "real" EventVector (XTrap creates it till events + * truly become vectored + */ +#ifndef VECTORED_EVENTS +globalref int_function EventProcVector[XETrapCoreEvents]; +#else +extern WindowPtr GetCurrentRootWindow(); +globalref int_function EventProcVector[128L]; +#endif +static int_function keybd_process_inp = NULL; /* Used for VECTORED_EVENTS */ + /* The "shadowed" Event Vector */ +globalref int_function XETrapEventProcVector[XETrapCoreEvents]; + +globalref void_function XETSwProcVector[256L];/* Vector of Req swapping rtns */ + +/* This macro returns a true/false indicator based on whether it changes the + * environment state bits local to the server extension. This is based on the + * idea that if a valid flag is set and the corresponding data bit is not in + * the same state as desired, then true is returned, otherwise false is + * returned. + */ +#define _CheckChangeBit(valid,data,local,bit) \ + (BitIsFalse(valid,bit) ? 0L : \ + (((BitIsTrue(data,bit) && BitIsTrue(local,bit)) || \ + (BitIsFalse(data,bit) && BitIsFalse(local,bit))) ? 0L : \ + (BitToggle(local,bit), 1L))) + +/* This macro is designed to return the number of elements in an + * automatically allocated array. + */ +#ifndef ASIZE +#define ASIZE(array) (sizeof(array)/sizeof(array[0L])) +#endif + +/* This macro is designed to return the number of long words beyond + * XETrapMinRepSize contained in a data structure. + */ +#ifndef XEXTRA +#define XEXTRA(s) \ + ((sizeof(s)+(sizeof(CARD32)-1L)-XETrapMinRepSize)/sizeof(CARD32)) +#endif + +/* Static Declarations known to XTrap Only + * All XTrap clients refer to these single copies! + */ +/* This carries all of the information XTrap uses for internal information */ +static XETrapEnv *XETenv[MAXCLIENTS] = {NULL}; +#ifndef RESTYPE +#define RESTYPE unsigned long +#endif +static RESTYPE XETrapClass = 0L; /* Resource class for this extension */ +static RESTYPE XETrapType = 0L; /* Resource type for this extension */ +static Bool gate_closed = False; /* The global "gatekeeper" */ +static Bool key_ignore = False; /* The global "keymaster" */ +static Bool ignore_grabs = False; +static CARD8 next_key = XEKeyIsClear; /* Echo, Clear, or Other */ +#ifdef VECTORED_EVENTS +static INT16 current_screen = -1L; /* Current screen for events */ +#endif +static INT16 vectored_requests[256L] = {0L}; /* cnt of vectoring clients */ +static INT16 vectored_events[KeyPress+MotionNotify] = {0L}; +typedef struct _client_list +{ + struct _client_list *next; + ClientPtr client; +} ClientList; +static ClientList io_clients; /* Linked-list of clients currently doing I/O */ +static ClientList stats_clients; /* Linked-list of clients collecting stats */ +static ClientList cmd_clients; /* Linked-list of clients using command key */ + +/*----------------------------* + * Forward Declarations + *----------------------------*/ +static void _SwapProc (int (**f1 )(void), int (**f2 )(void)); +static void sXETrapEvent (xETrapDataEvent *from , xETrapDataEvent *to ); +static int add_accelerator_node (ClientPtr client , ClientList *accel ); +static void remove_accelerator_node (ClientPtr client , ClientList *accel ); +static void update_protocol (xXTrapGetReq *reqptr , ClientPtr client ); +#ifdef COLOR_REPLIES +static void GetSendColorRep (ClientPtr client , xResourceReq *req ); +static void GetSendNamedColorRep (ClientPtr client , xResourceReq *req ); +static void GetSendColorCellsRep (ClientPtr client , xResourceReq *req ); +static void GetSendColorPlanesRep (ClientPtr client , xResourceReq *req ); +#endif + +/* + * DESCRIPTION: + * + * This routine is called by the server when a given client + * goes away (as identified by the first argument). All + * memory allocations, misc. values specific to a given + * client would be reset here. + * + */ +int XETrapDestroyEnv(pointer value, XID id) +{ + xXTrapReq request; + XETrapEnv *penv = XETenv[(long)value]; + + XETrapReset(&request,penv->client); + /* Free any memory malloc'd for a particular client here */ + /* In case stop I/O wasn't received for this client */ + if (penv->stats) + { /* Remove from client accelerator list */ + remove_accelerator_node(penv->client, &stats_clients); + Xfree(penv->stats); /* Free the stats buckets */ + } + if (cmd_clients.next == NULL) + { /* No more command key clients! Let's reset the gate */ + gate_closed = False; + key_ignore = False; + next_key = XEKeyIsClear; + } + +#ifdef VECTORED_EVENTS + current_screen = -1L; /* Invalidate current screen */ +#endif + +#ifdef VERBOSE + ErrorF("%s: Client '%d' Disconnected\n", XTrapExtName, + penv->client->index); +#endif + + Xfree(penv); + XETenv[(long)value] = NULL; + + return 0; +} + +/* + * DESCRIPTION: + * + * This routine is called by the server when the last client + * (the session manager in most cases) goes away. This is server + * reset. When the server comes back up, this extension will not + * be loaded unless this routine makes the proper arrangements. + * + * The real concern here is to unload the extension + * and possibly make arragements to be called upon + * server restart. + * + */ +void XETrapCloseDown(ExtensionEntry *extEntry) +{ + long i; + + for (i=0L; i<MAXCLIENTS; i++) + { + if (XETenv[i] != NULL) + { + XETrapDestroyEnv((pointer)i,0L); + } + } + ignore_grabs = False; + return; +} + +/* + * + * DESCRIPTION: + * + * This routine has been created because of the initialization + * order that X uses, such that extensions are initialized before + * devices. This means that this extension must perform a second + * level of initialization to obtain the device references at some + * point after they have been initialized. It is assumed that when + * a client establishes communication with the extension that the + * devices havae been initialized, and therefore this function can + * obtain the information it needs. + * + * In obtaining the information, this function also places its own + * functions in place of the *standard* functions. The original + * functions are retained for vectoring purposes. + */ + +Bool XETrapRedirectDevices() +{ + Bool retval = True; + + /* Do we need to redirect the keyboard device? */ + if (XETrapKbdDev == NULL) + { + if ((XETrapKbdDev = (DevicePtr)inputInfo.keyboard) == NULL) + { + retval = False; + } + else + { + EventProcVector[KeyPress] = + (int_function)XETrapKbdDev->realInputProc; + EventProcVector[KeyRelease] = + (int_function)XETrapKbdDev->realInputProc; + } +#ifdef VECTORED_EVENTS + keybd_process_inp = EventProcVector[KeyPress]; + EventProcVector[KeyPress] = EventProcVector[KeyRelease] = NULL; + XETrapEventProcVector[KeyPress] = XETrapEventVector; + XETrapEventProcVector[KeyRelease] = XETrapEventVector; +#else /* !VECTORED_EVENTS */ + XETrapEventProcVector[KeyPress] = XETrapKeyboard; + XETrapEventProcVector[KeyRelease] = XETrapKeyboard; +#endif /* !VECTORED_EVENTS */ + } + /* Do we need to redirect the pointer device? */ +#ifndef VECTORED_EVENTS + if (XETrapPtrDev == NULL) + { + if ((XETrapPtrDev = (DevicePtr)inputInfo.pointer) == 0L) + { + retval = False; + } + else + { + EventProcVector[ButtonPress] = + (int_function)XETrapPtrDev->realInputProc; + EventProcVector[ButtonRelease] = + (int_function)XETrapPtrDev->realInputProc; + EventProcVector[MotionNotify] = + (int_function)XETrapPtrDev->realInputProc; + } + XETrapEventProcVector[ButtonPress] = XETrapPointer; + XETrapEventProcVector[ButtonRelease] = XETrapPointer; + XETrapEventProcVector[MotionNotify] = XETrapPointer; + } +#endif /* !VECTORED_EVENTS */ + return(retval); +} + +/* + * + * DESCRIPTION: + * + * This routine is the main entry point for the Xtrap extension. It is + * called by the server to inititalize the Xtrap extension. Once the + * extension is initialized, life is controlled by the XtrapDispatch + * routine by the requests it will handle. + * + * Initializes all the XTrap data structures with the proper + * addresses of defined routines that will help control the extension. + * It is vital that the extension state be kept accurate so that only + * one call to this routine be made. + * + */ + +void DEC_XTRAPInit() +{ + register ExtensionEntry *extEntry; + unsigned int i; + Atom a; + + /* Make the extension known to the server. Must be done every time + * DEC_XTRAPInit is called, else server will think it failed. + */ + if ((extEntry = AddExtension(XTrapExtName,XETrapNumEvents, + XETrapNumErrors,XETrapDispatch,sXETrapDispatch,XETrapCloseDown + ,StandardMinorOpcode)) == NULL) + { + ErrorF("%s: AddExtension Failed!\n", XTrapExtName); + return; + } +#ifdef VERBOSE + ErrorF("%s: AddExtension assigned Major Opcode '%d'\n", + XTrapExtName, extEntry->base); +#endif + XETrap_avail.data.major_opcode = extEntry->base; + XETrapErrorBase = extEntry->errorBase; + XETrap_avail.data.event_base = extEntry->eventBase; + + /* Set up our swapped reply vector */ + ReplySwapVector[XETrap_avail.data.major_opcode] = + (void_function) sReplyXTrapDispatch; + + /* Set up our swapped event vector */ + EventSwapVector[extEntry->eventBase + XETrapData] = + (EventSwapPtr) sXETrapEvent; + + /* make an atom saying that the extension is present. The + * adding of the resource occurs during XETrapCreateEnv(). + */ + if ((a = MakeAtom(XTrapExtName,strlen(XTrapExtName),1L)) == None || + (XETrapType = CreateNewResourceType(XETrapDestroyEnv)) == 0L) + { + ErrorF("%s: Setup can't create new resource type (%d,%d,%d)\n", + XTrapExtName, (int)a,(int)XETrapClass,(int)XETrapType); + return; + } + /* initialize the GetAvailable info reply here */ + XETrap_avail.hdr.type = X_Reply; + XETrap_avail.hdr.length = XEXTRA(xXTrapGetAvailReply); + XETrap_avail.data.xtrap_release = XETrapRelease; + XETrap_avail.data.xtrap_version = XETrapVersion; + XETrap_avail.data.xtrap_revision = XETrapRevision; + XETrap_avail.data.pf_ident = XETrapPlatform; + XETrap_avail.data.max_pkt_size = 0xFFFF; /* very large number */ + for (i=0L; i<ASIZE(XETrap_avail.data.valid); i++) + { + XETrap_avail.data.valid[i] = 0L; /* Clear bits initially */ + } + BitTrue(XETrap_avail.data.valid,XETrapTimestamp); + BitTrue(XETrap_avail.data.valid,XETrapCmd); + BitTrue(XETrap_avail.data.valid,XETrapCmdKeyMod); + BitTrue(XETrap_avail.data.valid,XETrapRequest); + BitTrue(XETrap_avail.data.valid,XETrapEvent); + BitTrue(XETrap_avail.data.valid,XETrapMaxPacket); + BitTrue(XETrap_avail.data.valid,XETrapStatistics); + BitTrue(XETrap_avail.data.valid,XETrapWinXY); + /* Not yet implemented */ + BitFalse(XETrap_avail.data.valid,XETrapCursor); +#ifndef _XINPUT + BitFalse(XETrap_avail.data.valid,XETrapXInput); +#else + BitTrue(XETrap_avail.data.valid,XETrapXInput); +#endif +#ifndef VECTORED_EVENTS + BitFalse(XETrap_avail.data.valid,XETrapVectorEvents); +#else + BitTrue(XETrap_avail.data.valid,XETrapVectorEvents); +#endif /* VECTORED_EVENTS */ +#ifndef COLOR_REPLIES + BitFalse(XETrap_avail.data.valid,XETrapColorReplies); +#else + BitTrue(XETrap_avail.data.valid,XETrapColorReplies); +#endif /* COLOR_REPLIES */ + BitTrue(XETrap_avail.data.valid,XETrapGrabServer); + /* initialize multi-client accelerator lists */ + io_clients.next = NULL; + stats_clients.next = NULL; + cmd_clients.next = NULL; + for (i=0L; i<256L; i++) + { + vectored_requests[i] = 0L; + } + for (i=KeyPress; i<=MotionNotify; i++) + { + vectored_events[i] = 0L; + } + gate_closed = False; + key_ignore = False; + next_key = XEKeyIsClear; + + XETrapPlatformSetup(); + /* Initialize any local memory we use */ + for (i=0L; i<ASIZE(EventProcVector); i++) + { + EventProcVector[i] = NULL; +#ifndef VECTORED_EVENTS + XETrapEventProcVector[i] = NULL; +#else + XETrapEventProcVector[i] = XETrapEventVector; +#endif + } + XETrapKbdDev = NULL; + XETrapPtrDev = NULL; + for (i=0L; i<ASIZE(XETrapProcVector); i++) + { + XETrapProcVector[i] = XETrapRequestVector; + } + for (i=128L; i<=255L; i++) + { /* Extension "swapped" requests are not implemented */ + XETSwProcVector[i] = NotImplemented; + } +#ifdef VERBOSE + ErrorF("%s: Vers. %d.%d-%d successfully loaded\n", XTrapExtName, + XETrap_avail.data.xtrap_release, + XETrap_avail.data.xtrap_version, + XETrap_avail.data.xtrap_revision); +#endif + + return; +} + +/* + * DESCRIPTION: + * + * This procedure is called upon dispatch to allocate an + * environment structure for a new XTrap client. The XETenv[] + * entry is allocated and initialized with default values. + * XETrapDestroyEnv() is responsible for deallocating this memory + * upon client termination. + * + * Note: the status of this routine is returned to the caller of + * the Dispatch routine which will in turn SendErrorToClient if + * necessary. + * + */ + +int XETrapCreateEnv(ClientPtr client) +{ + XETrapEnv *penv = NULL; + int status = Success; + + if (client->index >= MAXCLIENTS) + { + status = BadImplementation; + } + else if ((XETenv[client->index] = (XETrapEnv *)Xcalloc(sizeof(XETrapEnv))) + == NULL) + { + status = BadAlloc; + } + if (status == Success) + { + penv = XETenv[client->index]; + penv->client = client; + penv->protocol = 31; /* default to backwards compatibility */ + /* prep for client's departure (for memory dealloc, cleanup) */ + AddResource(FakeClientID(client->index),XETrapType, + (pointer)(long)(client->index)); + if (XETrapRedirectDevices() == False) + { + status = XETrapErrorBase + BadDevices; + } + /* Initialize the current state */ + if (status == Success) + { + status = XETrapReset(NULL, penv->client); + } + } + +#ifdef VECTORED_EVENTS + current_screen = -1L; /* Invalidate current screen */ +#endif + +#ifdef VERBOSE + if (status == Success) + { + ErrorF("%s: Client '%d' Connection Accepted\n", XTrapExtName, + penv->client->index); + } +#endif + + return(status); +} + +/* + * DESCRIPTION: + * + * This procedure is defined for the call to AddExtension() + * in which it is expected to be a parameter of the call. + * + * This routine will be called by the server dispatcher + * when a client makes a request that is handled + * by the extension and the byte ordering of the client is the + * SAME as that of the extension. + * + * Note: the status of the requests is returned to the caller of + * the Dispatch routine which will in turn SendErrorToClient if + * necessary. + */ + +int XETrapDispatch(ClientPtr client) +{ + + REQUEST(xXTrapReq); + register int status = Success; + + REQUEST_AT_LEAST_SIZE(xXTrapReq); + + /* Have we seen this client before? */ + if (XETenv[client->index] == NULL) + { + status = XETrapCreateEnv(client); + } + /* Do we have a valid request? */ + if (status == Success) + { + if (stuff->minor_opcode < ASIZE(XETrapDispatchVector)) + { + /* Then vector to the pointed to function */ + status = + (*(XETrapDispatchVector[stuff->minor_opcode]))(stuff,client); + } + else + { + status = BadRequest; + } + } + return(status); +} + +/* + * DESCRIPTION: + * + * This procedure is defined for the call to AddExtension() + * in which it is expected to be a parameter of the call. + * + * This routine would ordinarily be called by the server + * dispatcher when a client makes a request that is handled + * by the extension and the byte ordering of the client is + * DIFFERENT than that of the extension. + */ + +int sXETrapDispatch(ClientPtr client) +{ + + REQUEST(xXTrapReq); + register int status = Success; + + REQUEST_AT_LEAST_SIZE(xXTrapReq); + + /* Have we seen this client before? */ + if (XETenv[client->index] == NULL) + { + status = XETrapCreateEnv(client); + } + /* Do we have a valid request? */ + if (status == Success) + { + if (stuff->minor_opcode < ASIZE(XETSwDispatchVector)) + { + /* Then vector to the pointed to function */ + status = + (*(XETSwDispatchVector[stuff->minor_opcode]))(stuff,client); + } + else + { + status = BadRequest; + } + } + return(status); +} + +/* + * DESCRIPTION: + * + * This routine will place the extension in a steady and known + * state. Any current state will be reset. This is called either + * by a client request (dispatched) or when a new client environment + * is created. + * + */ +int XETrapReset(xXTrapReq *request, ClientPtr client) +{ + static xXTrapConfigReq DummyReq; + register int i; + register int status = Success; + XETrapEnv *penv = XETenv[client->index]; + + /* in case any i/o's pending */ + (void)XETrapStopTrap((xXTrapReq *)NULL, client); + penv->cur.hdr.type = X_Reply; + penv->cur.hdr.length = XEXTRA(xXTrapGetCurReply); + /* Fill in a dummy config request to clear all elements */ + for (i=0L; i<ASIZE(DummyReq.config_flags_valid); i++) + { + DummyReq.config_flags_valid[i] = 0xFFL; /* set all the valid flags */ + DummyReq.config_flags_data[i] = 0L; /* clear all data flags */ + } + /* Don't reset grab server arbitrarily, it must be explicitly + * de-configured. + */ + BitSet(DummyReq.config_flags_data, XETrapGrabServer, ignore_grabs); + for (i=0L; i< ASIZE(DummyReq.config_flags_req); i++) + { + DummyReq.config_flags_req[i] = 0xFF; /* Clear all protocol requests */ + } + for (i=0L; i< ASIZE(DummyReq.config_flags_event); i++) + { + DummyReq.config_flags_event[i] = 0xFF; /* Clear all protocol events */ + } + /* Call config routine to clear all configurable fields */ + status = XETrapConfig(&DummyReq, client); + /* reset the environment */ + for (i=0L; i<ASIZE(penv->cur.data_state_flags); i++) + { + penv->cur.data_state_flags[i] = 0L; /* Clear all env flags */ + } + penv->cur.data_config_max_pkt_size = XETrap_avail.data.max_pkt_size; + + return(status); +} + +/* + * DESCRIPTION: + * + * This function sends a reply back to the requesting client indicating + * the available states of the extension can be configured for. + */ +int XETrapGetAvailable(xXTrapGetReq *request, ClientPtr client) +{ + XETrapEnv *penv = XETenv[client->index]; + update_protocol(request, client); + /* Initialize the reply as needed */ + XETrap_avail.data.xtrap_protocol = penv->protocol; + XETrap_avail.hdr.detail = XETrap_GetAvailable; + XETrap_avail.hdr.sequenceNumber = client->sequence; + WriteReplyToClient(client, sizeof(xXTrapGetAvailReply), &XETrap_avail); + return(Success); +} + +/* + * DESCRIPTION: + * + * This function sends a reply back to the requesting client indicating + * the current state of the extension. + */ +int XETrapGetCurrent(xXTrapReq *request, ClientPtr client) +{ + XETrapEnv *penv = XETenv[client->index]; + int rep_size = (penv->protocol == 31 ? 284 : sz_xXTrapGetCurReply); + penv->cur.hdr.length = (rep_size - 32L) / SIZEOF(CARD32); + + /* Initialize the reply as needed */ + penv->cur.hdr.detail = XETrap_GetCurrent; + penv->cur.hdr.sequenceNumber = client->sequence; + WriteReplyToClient(client, rep_size, &(penv->cur)); + + return(Success); +} + +/* + * DESCRIPTION: + * + * This function sends a reply back to the requesting client dumping + * statistics (counts) of requests and events. If stat's isn't + * configured, return failure. + */ +int XETrapGetStatistics(xXTrapReq *request, ClientPtr client) +{ + int status = Success; + XETrapEnv *penv = XETenv[client->index]; + + if ((BitIsTrue(penv->cur.data_config_flags_data, XETrapStatistics)) && + (penv->stats)) + { + /* Initialize the reply as needed */ + int rep_size = sizeof(xXTrapGetStatsReply); + penv->stats->detail = XETrap_GetStatistics; + penv->stats->sequenceNumber = client->sequence; + if (penv->protocol == 31) + { + xXTrapGetStatsReply rep_stats; + rep_stats = *penv->stats; +#ifndef VECTORED_EVENTS + rep_size = 1060; +#else + rep_size = 1544; +#endif + rep_stats.length = (rep_size - 32L) / SIZEOF(CARD32); + /* + * Now we need to shift the data *into* the header area + * for bug compatibility. + */ + memcpy(&(rep_stats.pad0),&(penv->stats->data), + sizeof(XETrapGetStatsRep)); + WriteReplyToClient(client, rep_size, &rep_stats); + } + else + { + WriteReplyToClient(client, rep_size, penv->stats); + } + } + else + { + status = XETrapErrorBase + BadStatistics; + } + return(status); +} + +/* + * DESCRIPTION: + * + * This function is dispatched when a client requests the extension to + * be configured in some manner. + */ +int XETrapConfig(xXTrapConfigReq *request, ClientPtr client) +{ + UByteP vflags = request->config_flags_valid; + UByteP dflags = request->config_flags_data; + UByteP req_flags = request->config_flags_req; + UByteP event_flags = request->config_flags_event; + XETrapEnv *penv = XETenv[client->index]; + UByteP bit_flags = penv->cur.data_config_flags_data; + int status = Success; + CARD32 i = 0L; + + /* Check events and swap if desired */ + if (BitIsTrue(vflags,XETrapEvent)) + { /* Loop through all of the events */ + for (i=0L; i<ASIZE(EventProcVector); i++) + { + if (BitIsTrue(event_flags,i) && /* Do we care about this one? */ + (BitValue(dflags,XETrapEvent) ^ /* Exclusive Or */ + (BitValue(penv->cur.data_config_flags_event,i)))) + { /* At this point we *know* there's a change. The + * only question remaining is are there any more + * clients interested in this specific event. If + * so, *don't* swap this process! + */ + if (BitIsTrue(dflags,XETrapEvent)) + { /* Client wants the XTrap rtn */ + if (++(vectored_events[i]) <= 1L) + { /* first client, so do it */ + _SwapProc(&(XETrapEventProcVector[i]), + &(EventProcVector[i])); + } + } + else + { /* Client wants the *real* rtn */ + if (--(vectored_events[i]) <= 0L) + { /* No more clients using, so do it */ + _SwapProc(&(XETrapEventProcVector[i]), + &(EventProcVector[i])); + } + } + switch(i) + { + case KeyPress: /* needed for command key processing */ + case KeyRelease: + XETrapKbdDev->processInputProc = + (void_function)(EventProcVector[i] ? + (void_function)EventProcVector[i] : + (void_function)keybd_process_inp); + XETrapKbdDev->realInputProc = + (void_function)(EventProcVector[i] ? + (void_function)EventProcVector[i] : + (void_function)keybd_process_inp); + break; +#ifndef VECTORED_EVENTS + case ButtonPress: /* hack until events become vectored */ + case ButtonRelease: + case MotionNotify: + XETrapPtrDev->processInputProc = + (void_function)EventProcVector[i]; + XETrapPtrDev->realInputProc = + (void_function)EventProcVector[i]; + break; + default: + status = BadImplementation; + break; +#endif /* !VECTORED_EVENTS */ + } + BitToggle(penv->cur.data_config_flags_event,i); + } + } + } + if ((status == Success) && + (_CheckChangeBit(vflags,dflags,bit_flags,XETrapCmd))) + { + if (BitIsTrue(dflags, XETrapCmd)) + { /* Add accelerator entry to cmd_clients list iff necessary */ + penv->cur.data_config_cmd_key = request->config_cmd_key; + status = add_accelerator_node(penv->client, &cmd_clients); + } + else + { + penv->cur.data_config_cmd_key = 0L; /* default no KeyCode */ + remove_accelerator_node(penv->client, &cmd_clients); + } + } + if ((status == Success) && + (_CheckChangeBit(vflags,dflags,bit_flags,XETrapMaxPacket))) + { + if (BitIsTrue(dflags,XETrapMaxPacket)) + { /* Set size to what's passed in */ + if (request->config_max_pkt_size < XETrapMinPktSize) + { /* Tell them the value is too small */ + status = BadValue; + } + else + { + penv->cur.data_config_max_pkt_size = + request->config_max_pkt_size; + } + } + else + { /* Set it to the default (a *very* big number) */ + penv->cur.data_config_max_pkt_size = 0xFFFF; + } + } + /* If the valid flag is set for requests, then each of the + * requests is swapped if it's different from current state. + */ + if (BitIsTrue(vflags,XETrapRequest) && status == Success) + { /* Loop through all of the core requests */ + for (i=0L; i<ASIZE(XETrapProcVector); i++) + { + if (BitIsTrue(req_flags,i) && /* Do we care about this one? */ + (BitValue(dflags,XETrapRequest) ^ /* Exclusive Or */ + (BitValue(penv->cur.data_config_flags_req,i)))) + { /* At this point we *know* there's a change. The + * only question remaining is are there any more + * clients interested in this specific request. If + * so, *don't* swap this process! + */ + if (BitIsTrue(dflags,XETrapRequest)) + { /* Client wants the XTrap rtn */ + if (++(vectored_requests[i]) <= 1L) + { /* first client, so do it */ + _SwapProc(&(XETrapProcVector[i]), (int_function *)&(ProcVector[i])); + } + } + else + { /* Client wants the *real* rtn */ + if (--(vectored_requests[i]) <= 0L) + { /* No more clients using, so do it */ + _SwapProc(&(XETrapProcVector[i]), (int_function *)&(ProcVector[i])); + } + } + if (status == Success) + { + BitToggle(penv->cur.data_config_flags_req,i); + } + } + } + } + /* Check & Set the boolean flags */ + if (status == Success) + { + _CheckChangeBit(vflags,dflags,bit_flags,XETrapCmdKeyMod); + _CheckChangeBit(vflags,dflags,bit_flags,XETrapTimestamp); + _CheckChangeBit(vflags,dflags,bit_flags,XETrapWinXY); +/* _CheckChangeBit(vflags,dflags,bit_flags,XETrapCursor); */ +#ifdef COLOR_REPLIES + _CheckChangeBit(vflags,dflags,bit_flags,XETrapColorReplies); +#endif /* COLOR_REPLIES */ + if (_CheckChangeBit(vflags,dflags,bit_flags,XETrapGrabServer)) + { /* Let any client uncoditionally set/clear Grabs */ + ignore_grabs = BitValue(dflags, XETrapGrabServer); + } + } + /* The statistics vflag/dflag mechanism is a little different + * from most. The dflag is initially set to 0 to indicate no + * statistics. When a config request comes in to request + * statistics, memory's allocated and the dflag is set. + * Thereafter, whenever a client wants to clear the counters, he + * simply sets the vflag and clears the dflag. Multiple requests + * for statistics configuration are ignored, and the stats memory is + * free'd only when the client disconnects. + */ + if (status == Success) + { + if (_CheckChangeBit(vflags,dflags,bit_flags,XETrapStatistics)) + { + if (BitIsTrue(dflags,XETrapStatistics)) + { /* Do we need to allocate memory? */ + if (penv->stats == NULL && (penv->stats = + (xXTrapGetStatsReply *)Xcalloc(sizeof(xXTrapGetStatsReply))) + != NULL) + { /* Set up the reply header */ + penv->stats->type = X_Reply; + penv->stats->length = XEXTRA(xXTrapGetStatsReply); + /* add accelerator node for stats clients list */ + status = add_accelerator_node(penv->client, &stats_clients); + } + else if (penv->stats == NULL) + { /* No Memory! */ + status = BadAlloc; + } + } + else + { /* Zero out counters */ + (void)memset(penv->stats->data.requests, 0L, + sizeof(penv->stats->data.requests)); + (void)memset(penv->stats->data.events, 0L, + sizeof(penv->stats->data.events)); + /* Re-cock the Stat's flag so that it'll + * sense a change for next zero'ing out + * of the counters. + */ + BitTrue(penv->cur.data_config_flags_data, XETrapStatistics); + } + } + } + return(status); +} + +/* + * DESCRIPTION: + * + * This function sets the XETrapTrapActive bit to indicate that Trapping + * of requests and/or core events to the client may take place. + * + */ +int XETrapStartTrap(xXTrapReq *request, ClientPtr client) +{ + XETrapEnv *penv = XETenv[client->index]; + int status = add_accelerator_node(penv->client, &io_clients); + if (status == Success) + { + BitTrue(penv->cur.data_state_flags, XETrapTrapActive); + } + return(status); +} +/* + * DESCRIPTION: + * + * This function clears the XETrapTrapActive bit to indicate that Trapping + * of requests and/or core events to the client may *not* take place. + * + */ +int XETrapStopTrap(xXTrapReq *request, ClientPtr client) +{ + XETrapEnv *penv = XETenv[client->index]; + + remove_accelerator_node(penv->client, &io_clients); + BitFalse(penv->cur.data_state_flags, XETrapTrapActive); + return(Success); +} + +/* + * DESCRIPTION: + * + * This function sends a reply back to the requesting client indicating + * the specific XTrap version of this extension. + */ +int XETrapGetVersion(xXTrapGetReq *request, ClientPtr client) +{ + xXTrapGetVersReply ver_rep; + XETrapEnv *penv = XETenv[client->index]; + + update_protocol(request,client); /* to agree on protocol version */ + /* Initialize the reply as needed */ + ver_rep.hdr.type = X_Reply; + ver_rep.hdr.detail = XETrap_GetVersion; + ver_rep.hdr.sequenceNumber = client->sequence; + ver_rep.hdr.length = XEXTRA(xXTrapGetVersReply); + ver_rep.data.xtrap_release = XETrap_avail.data.xtrap_release; + ver_rep.data.xtrap_version = XETrap_avail.data.xtrap_version; + ver_rep.data.xtrap_revision = XETrap_avail.data.xtrap_revision; + ver_rep.data.xtrap_protocol = penv->protocol; /* return agreed protocol */ + WriteReplyToClient(client, sizeof(xXTrapGetVersReply), &ver_rep); + return(Success); +} + +/* + * DESCRIPTION: + * + * This function sends a reply back to the requesting client indicating + * the specific XTrap version of this extension. + */ +int XETrapGetLastInpTime(xXTrapReq *request, ClientPtr client) +{ + xXTrapGetLITimReply tim_rep; + XETrapEnv *penv = XETenv[client->index]; + + /* Initialize the reply as needed */ + tim_rep.hdr.type = X_Reply; + tim_rep.hdr.detail = XETrap_GetLastInpTime; + tim_rep.hdr.sequenceNumber = client->sequence; + tim_rep.hdr.length = XEXTRA(xXTrapGetLITimReply); + tim_rep.data_last_time = penv->last_input_time; + WriteReplyToClient(client, sizeof(xXTrapGetLITimReply), &tim_rep); + return(Success); +} + +/* + * DESCRIPTION: + * + * This routine is swapped in for the server's output request vectors. + * After writing the request to one (or more) XTrap client(s), this + * routine ALWAYS returns by calling the REAL output request vector rtn. + * + * Note: Swapped Requests are handled automatically since the unswapped + * vectored routine is called after the request has been swapped. + * IOW, all requests are directed through ProcVector eventually and are + * "unswapped" at that point. It is necessary to swap the data + * back if writing to a swapped client, however, and this is done + * by calling the appropriate XETSwProcVector[] routine. + */ +int XETrapRequestVector(ClientPtr client) +{ + int status = True; + XETrapDatum *pdata, *spdata = NULL; + REQUEST(xResourceReq); + WindowPtr window_ptr; + XETrapEnv *penv; + BYTE *tptr; + ClientList *ioc = &io_clients; + ClientList *stc = &stats_clients; + INT32 asize = sizeof(pdata->hdr) + stuff->length * sizeof(CARD32); + INT32 size = MAX(asize,XETrapMinPktSize); /* Must be at least */ + INT32 csize; /* size of request to send to the XTrap client */ + + /* Get memory for the data to be sent */ + if ((pdata = (XETrapDatum *)Xcalloc(size)) == NULL) + { /* Can't do anything accept set a flag since we don't + * know who to send the error to yet. + */ + status = False; + } + + while (ioc->next != NULL) + { + ioc = ioc->next; + penv = XETenv[ioc->client->index]; + if (status == False) + { /* We didn't get the memory! Complain */ + SendErrorToClient(penv->client,XETrap_avail.data.major_opcode, + stuff->reqType, 0L, BadAlloc); + break; + } + if (BitIsTrue(penv->cur.data_config_flags_req,stuff->reqType)) + { /* This particular client is interested in *this* request */ + pdata->hdr.client = client->index; /* stuff client index in hdr */ + if (BitIsTrue(penv->cur.data_config_flags_data,XETrapWinXY)) + { + if (Success != dixLookupDrawable(&window_ptr, stuff->id, + client, 0, DixUnknownAccess)) + { /* Failed...invalidate the X and Y coordinate data. */ + pdata->hdr.win_x = -1L; + pdata->hdr.win_y = -1L; + } + else + { + pdata->hdr.screen = window_ptr->drawable.pScreen->myNum; + pdata->hdr.win_x = window_ptr->drawable.x; + pdata->hdr.win_y = window_ptr->drawable.y; + } + } + if (BitIsTrue(penv->cur.data_config_flags_data,XETrapTimestamp)) + { + pdata->hdr.timestamp = GetTimeInMillis(); + } + /* Copy the information to a location we can write it from */ + (void) memcpy(&(pdata->u.req),stuff,stuff->length*sizeof(CARD32)); + pdata->hdr.count = MIN(penv->cur.data_config_max_pkt_size,asize); + XETrapSetHeaderRequest(&(pdata->hdr)); + + /* Perform any needed byte/word swapping. NOTE: This is not + * the "normal" technique that should be used to perform the + * swapping. The reason that we do it here is to be sure to + * do it only once in a controlled manner, which we can not + * guarentee in the case of the Xlib transport. Notice that + * we don't swap the XTRAP EVENT information. This is done + * in the XETrapWriteXLib() routine. + */ + + if (penv->client->swapped) + { /* need to deal with swapped clients */ + if (spdata == NULL) + { /* Get memory for the swapped data to be sent */ + if ((spdata = (XETrapDatum *)Xcalloc(size)) == NULL) + { + SendErrorToClient(penv->client, + XETrap_avail.data.major_opcode, + stuff->reqType, 0L, BadAlloc); + break; + } + + memcpy(spdata,pdata,size); /* fill in the info */ + /* Now call the request-specific rtn to swap the request */ + if (stuff->reqType < 128) + { /* a core request, good */ + (*XETSwProcVector[stuff->reqType])(&(spdata->u.req), + penv->client); /* RTC X11R6 */ + } + else if (penv->cur.data_config_max_pkt_size == + XETrapMinPktSize) + { /* Minimum size, so swap it as an ResourceReq */ + XETSwResourceReq(&(spdata->u.req)); + } + else + { /* trying to swap an extension request! */ + SendErrorToClient(penv->client, + XETrap_avail.data.major_opcode, + stuff->reqType, 0L, XETrapErrorBase + BadSwapReq); + } + } + /* need to stow in the latest header (count) */ + memcpy(spdata,pdata,SIZEOF(XETrapHeader)); + sXETrapHeader(&(spdata->hdr)); /* swap the XTrap Header */ + } + /* Write as many bytes of information as the client wants */ + tptr = (BYTE *)(penv->client->swapped ? spdata : pdata); + csize = MAX(pdata->hdr.count, XETrapMinPktSize); + if (XETrapWriteXLib(penv, tptr, csize) != csize) + { + SendErrorToClient(penv->client,XETrap_avail.data.major_opcode, + stuff->reqType, 0L, XETrapErrorBase + BadIO); + } +#ifdef COLOR_REPLIES + /* Process Color Replies, if desired, and applicable */ + if (BitIsTrue(penv->cur.data_config_flags_data,XETrapColorReplies)) + { /* wants color replies */ + switch(stuff->reqType) + { + case X_AllocColor: + GetSendColorRep(client, stuff); + break; + case X_AllocNamedColor: + GetSendNamedColorRep(client, stuff); + break; + case X_AllocColorCells: + GetSendColorCellsRep(client, stuff); + break; + case X_AllocColorPlanes: + GetSendColorPlanesRep(client, stuff); + break; + default: + break; + } + } +#endif /* COLOR_REPLIES */ + } + } + while (stc->next != NULL) + { /* increment appropriate stats bucket for each interested client */ + stc = stc->next; + penv = XETenv[stc->client->index]; + if (BitIsTrue(penv->cur.data_config_flags_req,stuff->reqType)) + { /* This particular client would like this particular stat */ + penv->stats->data.requests[stuff->reqType]++; + } + } + + if (pdata) + { + Xfree(pdata); + } + if (spdata) + { + Xfree(spdata); + } + if (ignore_grabs == True && + (stuff->reqType == X_GrabServer || stuff->reqType == X_UngrabServer)) + { /* doesn't want Grab's! Note: this is a "last configured" setting */ +#ifndef NO_NEW_XTRAP + int status; + + if (stuff->reqType == X_GrabServer) + { + ClientList *pclient; + + /* first call grab server procedure */ + status = (*XETrapProcVector[stuff->reqType])(client); + + /* then add XTrap controlling clients */ + for (pclient = &io_clients; pclient; pclient = pclient->next) + if (pclient->client) + MakeClientGrabImpervious(pclient->client); + } + else + { + ClientList *pclient; + + /* first drop XTrap controlling clients */ + for (pclient = &io_clients; pclient; pclient = pclient->next) + if (pclient->client) + MakeClientGrabPervious(pclient->client); + + /* then call ungrab server procedure */ + status = (*XETrapProcVector[stuff->reqType])(client); + } + return status; +#else /* NO_NEW_XTRAP */ + return(Success); +#endif /* NO_NEW_XTRAP */ + } + else + { + return((*XETrapProcVector[stuff->reqType])(client)); + } +} +/* + * + * DESCRIPTION: + * + * This routine intercepts input xEvents from the keyboard. + * if XETrapTrapActive, will write record to client(s) + * and then pass the event to the server iff not command + * key and gate is open. If it's a command key, then twiddle + * the gate state as required (optional, see below). + * + * This routine implements an optional user specified command key + * that can be used to close the input pipe into the server + * while a client command is generated. The keypress of the + * command key places this routine in command mode, the keyrelease + * exits command mode. + * + * A keypress of the command key followed by the + * optionally specified lock key will place this routine in continuous + * command mode until the command key and lock key are pressed again + * to exit command mode. In the locked state, the client interprets + * keystrokes as it wishes, as commands or as input to a prior command. + * + * Both mechanisms can be used alternately. + * + * IMPLICIT INPUTS : + * + * penv->cur.data_config_cmd_key : + * This is the keycode of the key that is used to stop + * and restart the transmission of intercepted input + * events to the server. If specified, the gate_state + * flag will be set or cleared depending on the state of + * the command_key. + * + * penv->cur.data_config_flags_data.XETrapCmdKeyMod: + * This is the value of the mode in which the command_key + * will operate. It currently has two values: MODIFIER and + * COMMAND_LOCK. MODIFIER mode clears gate_state on + * keypress, and sets gate_state on keyrelease. + * COMMAND_LOCK mode toggles gate_state on + * or off. + * + * gate_closed: + * A flag that is set/cleared in the xtrap_keyboard + * routine that indicates whether intercepted input + * should be passed to the server at any particular + * instance. + * + * + * next_key: + * This variable tracks the state of the next key to be + * pressed or released. It allows the checking of double + * presses of the command key to be sent to the server and + * keeps good state order when the command key is used. + * + * key_ignore: + * This variable indicates whether or not the specific + * key should be ignored for subsequent server processing. + * + */ +int XETrapKeyboard(xEvent *x_event, DevicePtr keybd, int count) +{ + register BYTE type = x_event->u.u.type; + register BYTE detail = x_event->u.u.detail; + XETrapEnv *penv; + ClientList *stc = &stats_clients; + ClientList *cmc = &cmd_clients; + int_function cur_func = XETrapKeyboard; + +#ifdef VERBOSE + if (count != 1L) + { /* We haven't coded for this situation yet! */ + ErrorF("Warning! Event count != 1 (%d)\n", count); + } +#endif + while (stc->next != NULL) + { /* increment appropriate stats bucket for each interested client */ + stc = stc->next; + penv = XETenv[stc->client->index]; + if (BitIsTrue(penv->cur.data_config_flags_event,type)) + { /* This particular client would like this particular stat */ + penv->stats->data.events[type]++; + } + } +#ifndef VECTORED_EVENTS + /* We *only* StampAndMail command keys with vectored events since + * we get much more data by waiting till we get called in XETrapEventVector + */ + XETrapStampAndMail(x_event); /* send to XTrap client if necessry */ +#endif + while (cmc->next != NULL) + { + cmc = cmc->next; + penv = XETenv[cmc->client->index]; + key_ignore = False; + if (detail == penv->cur.data_config_cmd_key) + { + if (BitIsTrue(penv->cur.data_config_flags_data, XETrapCmdKeyMod)) + { + switch (type) + { + case KeyPress: + if (next_key == XEKeyIsEcho) + { + break; + } + gate_closed = True; + next_key = XEKeyIsClear; + break; + + case KeyRelease: + if (next_key == XEKeyIsEcho) + { + next_key = XEKeyIsClear; + break; + } + if (next_key == XEKeyIsClear) + { + next_key = XEKeyIsEcho; + } + else + { /* it's Other, so Clear it */ + next_key = XEKeyIsClear; + } + gate_closed = False; + key_ignore = True; + break; + + default: break; + } + } + else + { + switch (type) + { + case KeyPress: + if (next_key == XEKeyIsEcho) + { + gate_closed = False; + break; + } + /* Open gate on cmd key release */ + if ((next_key == XEKeyIsOther) && + gate_closed == True) + { + break; + } + gate_closed = True; + next_key = XEKeyIsClear; + break; + + case KeyRelease: + if (next_key == XEKeyIsClear) + { + next_key = XEKeyIsEcho; + break; + } + + if (next_key == XEKeyIsEcho) + { + next_key = XEKeyIsClear; + break; + } + + gate_closed = False; + key_ignore = True; + next_key = XEKeyIsClear; + break; + + default: + break; + } + } + } + else + { + next_key = XEKeyIsOther; + } + } + + /* + * If the gate to the server is open, + * and we are not ignoring a keyrelease, + * pass the event to the server for normal processing. + */ +#ifndef VECTORED_EVENTS + if ((gate_closed == False) && (key_ignore == False)) + { + if (XETrapEventProcVector[type] != cur_func) + { /* to protect us from infinite loops */ + (void)(*XETrapEventProcVector[type])(x_event,keybd,count); + } + else + { + (void)(*EventProcVector[type])(x_event,keybd,count); + } + } +#else /* VECTORED_EVENTS */ + if ((gate_closed == False) && (key_ignore == False)) + { /* send event on to server to be trapped again in XETrapEventVector */ + (void)(*keybd_process_inp)(x_event,keybd,count); + } + else + { + XETrapStampAndMail(x_event); /* send to XTrap client if necessry */ + } +#endif + key_ignore = False; /* reset for next time around */ + return 0; +} + +/* + * DESCRIPTION: + * + * This routine intercepts input xEvents from the pointer device + * and passes the input event back to the server for normal processing. + * + * This routine is sensitive to whether input is being passed + * up to the server or not. This state is set by the keyboard + * input routine. + * + * + */ +#ifndef VECTORED_EVENTS +int XETrapPointer(xEvent *x_event, DevicePtr ptrdev, int count) +{ + XETrapEnv *penv; + ClientList *stc = &stats_clients; + int_function cur_func = XETrapPointer; + +#ifdef VERBOSE + if (count != 1L) + { /* We haven't coded for this situation yet! */ + ErrorF("Warning! Event count != 1 (%d)\n", count); + } +#endif + while (stc->next != NULL) + { /* increment appropriate stats bucket for each interested client */ + stc = stc->next; + penv = XETenv[stc->client->index]; + if (BitIsTrue(penv->cur.data_config_flags_event,x_event->u.u.type)) + { /* This particular client would like this particular stat */ + penv->stats->data.events[x_event->u.u.type]++; + } + } + XETrapStampAndMail(x_event); /* send to XTrap client if necessry */ + /* + * If the gate to the server is open, + * pass the event up like nothing has happened. + */ + if (gate_closed == False) + { + if (XETrapEventProcVector[x_event->u.u.type] != cur_func) + { /* to protect us from infinite loops */ + (void)(*XETrapEventProcVector[x_event->u.u.type])(x_event,ptrdev, + count); + } + else + { + (void)(*EventProcVector[x_event->u.u.type])(x_event,ptrdev,count); + } + } + return 0; +} +#endif /* !VECTORED_EVENTS */ + + +/* + * DESCRIPTION: + * + * This routine determines whether it needs to send event data + * to the XTrap Client(s). If so, it timestamps it appropriately + * and writes out both the header and detail information. + * + */ +void XETrapStampAndMail(xEvent *x_event) +{ + XETrapDatum data; + register CARD32 size; + XETrapEnv *penv; + ClientList *ioc = &io_clients; + + /* Currently, we're intercepting core events *before* most + * of the event information's filled in. Specifically, the + * only fields that are valid at this level are: type, detail, + * time, rootX, rootY, and state. + */ + /* Loop through all clients wishing I/O */ + while (ioc->next != NULL) + { + ioc = ioc->next; + penv = XETenv[ioc->client->index]; + /* Do we have a valid fd? Do we care about this event? */ + if (BitIsTrue(penv->cur.data_config_flags_event, x_event->u.u.type)) + { + XETrapSetHeaderEvent(&(data.hdr)); + data.hdr.win_x = data.hdr.win_y = -1L; /* Invalidate req draw */ + data.hdr.screen = 0L; /* not till Events are vectored! */ + data.hdr.client = 0L; /* not till Events are vectored! */ + if (BitIsTrue(penv->cur.data_config_flags_data, + XETrapTimestamp)) + { + data.hdr.timestamp = GetTimeInMillis(); + } + size = data.hdr.count = XETrapMinPktSize; /* Always for evts */ + penv->last_input_time = x_event->u.keyButtonPointer.time; + /* Copy the event information into our local memory */ + (void)memcpy(&(data.u.event),x_event,sizeof(xEvent)); + +#ifdef PANORAMIX + if (!noPanoramiXExtension && + (data.u.event.u.u.type == MotionNotify || + data.u.event.u.u.type == ButtonPress || + data.u.event.u.u.type == ButtonRelease || + data.u.event.u.u.type == KeyPress || + data.u.event.u.u.type == KeyRelease)) { + int scr = XineramaGetCursorScreen(); + data.u.event.u.keyButtonPointer.rootX += + panoramiXdataPtr[scr].x - panoramiXdataPtr[0].x; + data.u.event.u.keyButtonPointer.rootY += + panoramiXdataPtr[scr].y - panoramiXdataPtr[0].y; + } +#endif + + if (penv->client->swapped) + { /* + * Notice that we don't swap the XTRAP EVENT information. + * This is done in the XETrapWriteXLib() routine. + */ + xEvent ToEvent; + (*EventSwapVector[data.u.event.u.u.type & 0177]) + (&data.u.event,&ToEvent); + (void)memcpy(&(data.u.event),&ToEvent,sizeof(ToEvent)); + sXETrapHeader(&(data.hdr)); /* swap the XTrap Header */ + } + /* From this point on, the contents of data is swapped and + * therefore we should not refer to it for information. + */ + if (XETrapWriteXLib(penv, (BYTE *)&data, size) != size) + { + SendErrorToClient(penv->client, + XETrap_avail.data.major_opcode, + x_event->u.u.type, 0L, XETrapErrorBase + BadIO); + } + } + } + return; +} +#ifdef VECTORED_EVENTS +int XETrapEventVector(ClientPtr client, xEvent *x_event) +{ + XETrapDatum data; + register CARD32 size; + XETrapEnv *penv; + ClientList *ioc = &io_clients; + + /* Loop through all clients wishing I/O */ + while (ioc->next != NULL) + { + ioc = ioc->next; + penv = XETenv[ioc->client->index]; + /* Do we care about this event? */ + if (BitIsTrue(penv->cur.data_config_flags_event, x_event->u.u.type)) + { + XETrapSetHeaderEvent(&(data.hdr)); + data.hdr.client = client->index; + data.hdr.win_x = data.hdr.win_y = -1L; /* Invalidate req draw */ + if ((current_screen < 0L) || ((x_event->u.u.type >= KeyPress) && + (x_event->u.u.type <= MotionNotify) && + (!x_event->u.keyButtonPointer.sameScreen))) + { /* we've moved/warped to another screen */ + WindowPtr root_win = GetCurrentRootWindow(); + current_screen = root_win->drawable.pScreen->myNum; + } + data.hdr.screen = current_screen; + if (BitIsTrue(penv->cur.data_config_flags_data, + XETrapTimestamp)) + { + data.hdr.timestamp = GetTimeInMillis(); + } + size = data.hdr.count = XETrapMinPktSize; /* Always for evts */ + penv->last_input_time = x_event->u.keyButtonPointer.time; + /* Copy the event information into our local memory */ + (void)memcpy(&(data.u.event),x_event,sizeof(xEvent)); + + if (penv->client->swapped) + { + xEvent ToEvent; + (*EventSwapVector[data.u.event.u.u.type & 0177]) + (&data.u.event,&ToEvent); + (void)memcpy(&(data.u.event),&ToEvent,sizeof(ToEvent)); + sXETrapHeader(&(data.hdr)); /* swap the XTrap Header */ + } + /* From this point on, the contents of pdata is swapped and + * therefore we should not refer to it for information. + */ + if (XETrapWriteXLib(penv, (BYTE *)&data, size) != size) + { + SendErrorToClient(penv->client, + XETrap_avail.data.major_opcode, + x_event->u.u.type, 0L, XETrapErrorBase + BadIO); + } + } + } + return; +} +#endif /* VECTORED_EVENTS */ +void sReplyXTrapDispatch(ClientPtr client, int size, char *reply) +{ + register XETrapRepHdr *rep = (XETrapRepHdr *)reply; + + switch(rep->detail) + { + case XETrap_GetAvailable: + { + xXTrapGetAvailReply lrep; + (void)memcpy((char *)&lrep,reply,sizeof(lrep)); + sReplyXETrapGetAvail(client,size,(char *)&lrep); + } + break; + case XETrap_GetCurrent: + { + xXTrapGetCurReply lrep; + (void)memcpy((char *)&lrep,reply,sizeof(lrep)); + sReplyXETrapGetCur(client,size,(char *)&lrep); + } + break; + case XETrap_GetStatistics: + { + xXTrapGetStatsReply lrep; + (void)memcpy((char *)&lrep,reply,sizeof(lrep)); + sReplyXETrapGetStats(client,size,(char *)&lrep); + } + break; + case XETrap_GetVersion: + { + xXTrapGetVersReply lrep; + (void)memcpy((char *)&lrep,reply,sizeof(lrep)); + sReplyXETrapGetVers(client,size,(char *)&lrep); + } + break; + case XETrap_GetLastInpTime: + { + xXTrapGetLITimReply lrep; + (void)memcpy((char *)&lrep,reply,sizeof(lrep)); + sReplyXETrapGetLITim(client,size,(char *)&lrep); + } + break; + default: + SendErrorToClient(client,XETrap_avail.data.major_opcode, + rep->detail, 0L, BadImplementation); + break; + } + return; +} + +/* + * XLib communications routines + */ + +/* + * DESCRIPTION: + * + * This function performs the transport specific functions required + * for writing data back to an XTrap client over XLib. The trick is + * packaging the data into <=32 byte packets to conform to the sizeof + * an X Event. nbytes must be at least equal to XETrapMinPktSize + * + */ +int XETrapWriteXLib(XETrapEnv *penv, BYTE *data, CARD32 nbytes) +{ + CARD32 size, total = 0L; + xETrapDataEvent event; + + /* Initialize the detail field to show the beginning of a datum */ + event.detail = XETrapDataStart; + event.idx = 0L; + + /* This loop could be optimized by not calling Write until after all + * of the events are packaged. However, this would require memory + * games, and may not therefore be a win. + */ + while (nbytes > 0L) + { /* How many bytes can we send in this packet */ + size = (nbytes > sz_EventData) ? sz_EventData : nbytes; + + /* Initialize the event */ + event.type = XETrapData + XETrap_avail.data.event_base; + event.sequenceNumber = penv->client->sequence; + + /* Copy the data we are sending */ + (void)memcpy(event.data,data,size); + if (size < sz_EventData) + (void)memset(event.data+size,0L,sz_EventData-size); + data += size; + nbytes -= size; + total += size; + + /* Set the detail field to show the continuation of datum */ + if (total != size) + { /* this is not the first one */ + event.detail = (nbytes > 0) ? XETrapDataContinued : XETrapDataLast; + } + + /* Send this part to the client */ + WriteEventsToClient(penv->client, 1L, (xEvent *) &event); + event.idx++; /* Bump the index for the next event */ + } + return(total); +} + +/*----------------------------* + * Static Functions + *----------------------------*/ + +static void update_protocol(xXTrapGetReq *reqptr, ClientPtr client) +{ + XETrapEnv *penv = XETenv[client->index]; + /* update protocol number */ + switch (reqptr->protocol) + { + /* known acceptable protocols */ + case 31: + case XETrapProtocol: + penv->protocol = reqptr->protocol; + break; + /* all else */ + default: /* stay backwards compatible */ + penv->protocol = 31; + break; + } +} + +/* Swap 2 functions. This is a function instead of a macro to help to keep + * lint from complaining about mixed types. It seems to work, but I would + * probably classify this as a hack. + */ +static void _SwapProc( register int (**f1)(void), register int (**f2)(void)) +{ + register int (*t1)(void) = *f1; + *f1 = *f2; + *f2 = t1; + + return; +} + +/* + * DESCRIPTION: + * + * This function swaps the byte order of fields within + * the XTrap Event Header. It assumes the data will be + * swapped by code in XETrapRequestVector(). + * + */ +static void sXETrapEvent(xETrapDataEvent *from, xETrapDataEvent *to) +{ + to->type = from->type; + to->detail = from->detail; + cpswaps(from->sequenceNumber,to->sequenceNumber); + cpswapl(from->idx,to->idx); + /* Assumes that the data's already been swapped by XETrapRequestVector */ + memcpy(to->data, from->data, SIZEOF(EventData)); +} + +/* + * DESCRIPTION: + * + * This function adds a node from an accelerator linked-list + * (either io_clients, stats_clients, or cmd_clients). + * + */ +static int add_accelerator_node(ClientPtr client, ClientList *accel) +{ + Bool found = False; + int status = Success; + + while (accel->next != NULL) + { + if (accel->client == client) + { + found = True; /* Client's already known */ + break; + } + else + { + accel = accel->next; + } + } + if (found == False) + { + if ((accel->next = (ClientList *)Xcalloc(sizeof(ClientList))) == NULL) + { + status = BadAlloc; + } + else + { /* fill in the node */ + accel = accel->next; + accel->next = NULL; + accel->client = client; + } + } + return(status); +} +/* + * DESCRIPTION: + * + * This function removes a node from an accelerator linked-list + * (either io_clients, stats_clients, or cmd_clients). + * + */ +static void remove_accelerator_node(ClientPtr client, ClientList *accel) +{ + while (accel->next != NULL) + { + if (accel->next->client == client) + { + ClientList *tmp = accel->next->next; + Xfree(accel->next); + accel->next = tmp; + break; + } + else + { + accel = accel->next; + } + } + + return; +} + +#ifdef COLOR_REPLIES +static void GetSendColorRep(ClientPtr client, xResourceReq *req) +{ /* adapted from ProcAllocColor() in dispatch.c */ + XETrapDatum data; + int retval; + XETrapEnv *penv = XETenv[client->index]; + xAllocColorReply *crep = (xAllocColorReply *)&(data.u.reply); + xAllocColorReq *creq = (xAllocColorReq *)req; + ColormapPtr pmap = (ColormapPtr )LookupIDByType(creq->cmap, RT_COLORMAP); + + /* Fill in the header fields */ + data.hdr.count = XETrapMinPktSize; /* The color replies are 32 bytes */ + XETrapSetHeaderReply(&(data.hdr)); + /* Hack alert: + * We need to pass the "reply" type in the header since replies don't + * contain the id's themselves. However, we're not changing the + * protocol to support this until we decide exactly how we want to + * do *all* replies (e.g. not just ColorReplies). So until then, stow + * the reply id in the screen field which wouldn't normally be used in + * this context. + */ + data.hdr.screen = req->reqType; + if (!pmap) + { + SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, + req->reqType, 0L, BadColor); + return; + } + crep->red = creq->red; + crep->green = creq->green; + crep->blue = creq->blue; + crep->pixel = 0; + if ((retval = AllocColor(pmap, &(crep->red), &(crep->green), + &(crep->blue), &(crep->pixel), client->index)) != Success) + { + SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, + req->reqType, 0L, retval); + return; + } + /* Swap data if necessary */ + if (client->swapped) + { + INT32 n; + swaps(&(crep->red), n); + swaps(&(crep->green), n); + swaps(&(crep->blue), n); + swapl(&(crep->pixel), n); + } + /* Send data to client */ + if (XETrapWriteXLib(penv, (BYTE *)&data, XETrapMinPktSize) + != XETrapMinPktSize) + { + SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, + req->reqType, 0L, XETrapErrorBase + BadIO); + } +} + +static void GetSendNamedColorRep(ClientPtr client, xResourceReq *req) +{ /* adapted from ProcAllocNamedColor() in dispatch.c */ + XETrapDatum data; + XETrapEnv *penv = XETenv[client->index]; + int retval; + xAllocNamedColorReply *nrep = (xAllocNamedColorReply *)&(data.u.reply); + xAllocNamedColorReq *nreq = (xAllocNamedColorReq *)req; + ColormapPtr pcmp = (ColormapPtr )LookupIDByType(nreq->cmap, RT_COLORMAP); + + data.hdr.count = XETrapMinPktSize; /* The color replies are 32 bytes */ + XETrapSetHeaderReply(&(data.hdr)); + /* Hack alert: + * We need to pass the "reply" type in the header since replies don't + * contain the id's themselves. However, we're not changing the + * protocol to support this until we decide exactly how we want to + * do *all* replies (e.g. not just ColorReplies). So until then, stow + * the reply id in the screen field which wouldn't normally be used in + * this context. + */ + data.hdr.screen = req->reqType; + if (!pcmp) + { + SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, + req->reqType, 0L, BadColor); + return; + } + if (!OsLookupColor(pcmp->pScreen->myNum, (char *)&nreq[1], + nreq->nbytes, &(nrep->exactRed), &(nrep->exactGreen), + &(nrep->exactBlue))) + { + SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, + req->reqType, 0L, BadName); + return; + } + nrep->screenRed = nrep->exactRed; + nrep->screenGreen = nrep->exactGreen; + nrep->screenBlue = nrep->exactBlue; + nrep->pixel = 0; + if ((retval = AllocColor(pcmp, &(nrep->screenRed), + &(nrep->screenGreen), &(nrep->screenBlue), &(nrep->pixel), + client->index)) != Success) + { + SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, + req->reqType, 0L, retval); + return; + } + /* Swap data if necessary */ + if (client->swapped) + { + INT32 n; + swapl(&(nrep->pixel), n); + swaps(&(nrep->exactRed), n); + swaps(&(nrep->exactGreen), n); + swaps(&(nrep->exactBlue), n); + swaps(&(nrep->screenRed), n); + swaps(&(nrep->screenGreen), n); + swaps(&(nrep->screenBlue), n); + } + + /* Send data to client */ + if (XETrapWriteXLib(penv, (BYTE *)&data, XETrapMinPktSize) + != XETrapMinPktSize) + { + SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, + req->reqType, 0L, XETrapErrorBase + BadIO); + } +} + +static void GetSendColorCellsRep(ClientPtr client, xResourceReq *req) +{ /* adapted from ProcAllocColorCells() in dispatch.c */ + int retval; + int npixels, nmasks; + unsigned long *ppixels, *pmasks; + long length; + XETrapDatum *data; + XETrapEnv *penv = XETenv[client->index]; + xAllocColorCellsReply *crep; + xAllocColorCellsReq *creq = (xAllocColorCellsReq *)req; + ColormapPtr pmap = (ColormapPtr )LookupIDByType(creq->cmap, RT_COLORMAP); + + if (!pmap) + { + SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, + req->reqType, 0L, BadColor); + return; + } + npixels = creq->colors; + if (!npixels) + { + SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, + req->reqType, 0L, BadValue); + return; + } + nmasks = creq->planes; + length = ((long)npixels + (long)nmasks) * sizeof(Pixel); + data = (XETrapDatum *)xalloc(sizeof(XETrapDatum)+length); + if (!data) + { + SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, + req->reqType, 0L, BadAlloc); + return; + } + data->hdr.count = MIN(penv->cur.data_config_max_pkt_size, + sizeof(XETrapDatum)+length); + XETrapSetHeaderReply(&(data->hdr)); + data->hdr.screen = req->reqType; /* hack! but necessary */ + ppixels = (unsigned long *)((char *)data + sizeof(XETrapDatum)); + pmasks = ppixels + npixels; + if ((retval = AllocColorCells(client->index, pmap, npixels, + nmasks, (Bool)creq->contiguous, ppixels, pmasks)) != Success) + { + SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, + req->reqType, 0L, retval); + xfree(data); + return; + } + crep = (xAllocColorCellsReply *)&(data->u.reply); + crep->nPixels = npixels; + crep->nMasks = nmasks; + /* Swap data if necessary */ + if (client->swapped) + { + INT32 n, i, *ptr; + ptr=(INT32 *)ppixels; + swaps(&(crep->nPixels), n); + swaps(&(crep->nMasks), n); + for (i=0; i<length; i++) + { + swapl(&(ptr[i]), n); + } + } + /* Send data to client */ + if (XETrapWriteXLib(penv, (BYTE *)&data, data->hdr.count) + != data->hdr.count) + { + SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, + req->reqType, 0L, XETrapErrorBase + BadIO); + } + xfree(data); +} +static void GetSendColorPlanesRep(ClientPtr client, xResourceReq *req) +{ /* adapted from ProcAllocColorPlanes() in dispatch.c */ + int retval; + int npixels, nmasks; + unsigned long *ppixels, *pmasks; + long length; + XETrapDatum *data; + XETrapEnv *penv = XETenv[client->index]; + xAllocColorPlanesReply *crep; + xAllocColorPlanesReq *creq = (xAllocColorPlanesReq *)req; + ColormapPtr pmap = (ColormapPtr )LookupIDByType(creq->cmap, RT_COLORMAP); + + if (!pmap) + { + SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, + req->reqType, 0L, BadColor); + return; + } + npixels = creq->colors; + if (!npixels) + { + SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, + req->reqType, 0L, BadValue); + return; + } + length = (long)npixels * sizeof(Pixel); + data = (XETrapDatum *)xalloc(sizeof(XETrapDatum)+length); + if (!data) + { + SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, + req->reqType, 0L, BadAlloc); + return; + } + data->hdr.count = MIN(penv->cur.data_config_max_pkt_size, + sizeof(XETrapDatum)+length); + XETrapSetHeaderReply(&(data->hdr)); + data->hdr.screen = req->reqType; /* hack! but necessary */ + ppixels = (unsigned long *)((char *)data + sizeof(XETrapDatum)); + crep = (xAllocColorPlanesReply *)&(data->u.reply); + if ((retval = AllocColorPlanes(client->index, pmap, npixels, + (int)creq->red, (int)creq->green, (int)creq->blue, + (int)creq->contiguous, ppixels, &(crep->redMask), &(crep->greenMask), + &(crep->blueMask))) != Success) + { + SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, + req->reqType, 0L, retval); + xfree(data); + return; + } + crep->nPixels = npixels; + /* Swap data if necessary */ + if (client->swapped) + { + INT32 n, i, *ptr; + ptr=(INT32 *)ppixels; + swaps(&(crep->nPixels), n); + swapl(&(crep->redMask), n); + swapl(&(crep->greenMask), n); + swapl(&(crep->blueMask), n); + for (i=0; i<length; i++) + { + swapl(&(ptr[i]), n); + } + } + /* Send data to client */ + if (XETrapWriteXLib(penv, (BYTE *)&data, data->hdr.count) + != data->hdr.count) + { + SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, + req->reqType, 0L, XETrapErrorBase + BadIO); + } + xfree(data); +} +#endif /* COLOR_REPLIES */ diff --git a/xorg-server/XTrap/xtrapdiswp.c b/xorg-server/XTrap/xtrapdiswp.c new file mode 100644 index 000000000..86c240362 --- /dev/null +++ b/xorg-server/XTrap/xtrapdiswp.c @@ -0,0 +1,937 @@ +/**************************************************************************** +Copyright 1987, 1988, 1989, 1990, 1991, 1992 by + + Digital Equipment Corp., Maynard, MA + +X11R6 Changes Copyright (c) 1994 by Robert Chesler of Absol-Puter, Hudson, NH. + +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 AND ABSOL-PUTER DISCLAIM ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL DIGITAL OR ABSOL-PUTER 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. + +*****************************************************************************/ +/* + * ABSTRACT: + * + * This module is the device independent module responsible for all + * routines required for proper communication in a heterogeneous + * networking environment (i.e. client & server on different endian + * machines). The bulk of this module is patterned after X11/R4's + * server/dix/swapreq.c ; however, they infact swap fields + * in the exact opposite order since XTrap requires "unswapped" data + * to become "swapped" before sending it to a "swapped" client. + * + * CONTRIBUTORS: + * + * Ken Miller + * Marc Evans + * + * CHANGES: + * + * Robert Chesler - added client arg for X11R6 port in many spots + * + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <X11/X.h> +#define NEED_REPLIES +#define NEED_EVENTS +#include <X11/Xproto.h> +#include <X11/Xprotostr.h> +#include <X11/extensions/xtrapdi.h> +#include "input.h" /* Server DevicePtr definitions */ +#include "misc.h" +#include "dixstruct.h" +#ifdef PC +# include "extnsist.h" +#else +# include "extnsionst.h" /* Server ExtensionEntry definitions */ +#endif +# include "swapreq.h" /* Server SwapColorItem definition */ +#include <X11/extensions/xtrapddmi.h> +#include <X11/extensions/xtrapproto.h> + +/* In-coming XTrap requests needing to be swapped to native format */ + +int sXETrapReset(xXTrapReq *request, ClientPtr client) +{ + register char n; + swaps(&(request->length),n); + return(XETrapReset(request,client)); +} + +int sXETrapGetAvailable(xXTrapGetReq *request, ClientPtr client) +{ + register char n; + swaps(&(request->length),n); + swaps(&(request->protocol),n); + return(XETrapGetAvailable(request,client)); +} + +int sXETrapConfig(xXTrapConfigReq *request, ClientPtr client) +{ + register char n; + swaps(&(request->length),n); + swaps(&(request->config_max_pkt_size),n); + return(XETrapConfig(request,client)); +} + +int sXETrapStartTrap(xXTrapReq *request, ClientPtr client) +{ + register char n; + swaps(&(request->length),n); + return(XETrapStartTrap(request,client)); +} + +int sXETrapStopTrap(xXTrapReq *request, ClientPtr client) +{ + register char n; + swaps(&(request->length),n); + return(XETrapStopTrap(request,client)); +} + +int sXETrapGetCurrent(xXTrapReq *request, ClientPtr client) +{ + register char n; + swaps(&(request->length),n); + return(XETrapGetCurrent(request,client)); +} + +int sXETrapGetStatistics(xXTrapReq *request, ClientPtr client) +{ + register char n; + swaps(&(request->length),n); + return(XETrapGetStatistics(request,client)); +} + +#ifndef _XINPUT +int sXETrapSimulateXEvent(xXTrapInputReq *request, ClientPtr client) +{ + register char n; + swaps(&(request->input.x),n); + swaps(&(request->input.y),n); + return(XETrapSimulateXEvent(request,client)); +} +#endif + +int sXETrapGetVersion(xXTrapGetReq *request, ClientPtr client) +{ + register char n; + swaps(&(request->length),n); + swaps(&(request->protocol),n); + return(XETrapGetVersion(request,client)); +} + +int sXETrapGetLastInpTime(xXTrapReq *request, ClientPtr client) +{ + register char n; + swaps(&(request->length),n); + return(XETrapGetLastInpTime(request,client)); +} + + +/* Out-going XTrap replies needing to be swapped *from* native format */ + +void sReplyXETrapGetAvail(ClientPtr client, int size, char *reply) +{ + xXTrapGetAvailReply *rep = (xXTrapGetAvailReply *)reply; + register char n; + swaps(&(rep->hdr.sequenceNumber),n); + swapl(&(rep->hdr.length),n); + swapl(&(rep->data.pf_ident),n); + swaps(&(rep->data.xtrap_release),n); + swaps(&(rep->data.xtrap_version),n); + swaps(&(rep->data.xtrap_revision),n); + swaps(&(rep->data.max_pkt_size),n); + swapl(&(rep->data.major_opcode),n); + swapl(&(rep->data.event_base),n); + swaps(&(rep->data.cur_x),n); + swaps(&(rep->data.cur_y),n); + (void)WriteToClient(client,size,reply); + return; +} +void sReplyXETrapGetVers(ClientPtr client, int size, char *reply) +{ + xXTrapGetVersReply *rep = (xXTrapGetVersReply *)reply; + register char n; + swaps(&(rep->hdr.sequenceNumber),n); + swapl(&(rep->hdr.length),n); + swaps(&(rep->data.xtrap_release),n); + swaps(&(rep->data.xtrap_version),n); + swaps(&(rep->data.xtrap_revision),n); + (void)WriteToClient(client,size,reply); + return; +} +void sReplyXETrapGetLITim(ClientPtr client, int size, char *reply) +{ + xXTrapGetLITimReply *rep = (xXTrapGetLITimReply *)reply; + register char n; + swaps(&(rep->hdr.sequenceNumber),n); + swapl(&(rep->hdr.length),n); + swapl(&(rep->data_last_time),n); + (void)WriteToClient(client,size,reply); + return; +} +void sReplyXETrapGetCur(ClientPtr client, int size, char *reply) +{ + xXTrapGetCurReply *rep = (xXTrapGetCurReply *)reply; + register char n; + swaps(&(rep->hdr.sequenceNumber),n); + swapl(&(rep->hdr.length),n); + swaps(&(rep->data_config_max_pkt_size),n); + (void)WriteToClient(client,size,reply); + return; +} +void sReplyXETrapGetStats(ClientPtr client, int size, char *reply) +{ + xXTrapGetStatsReply *rep = (xXTrapGetStatsReply *)reply; + register char n; + register int i; + long *p; + + swaps(&(rep->sequenceNumber),n); + swapl(&(rep->length),n); + for (i=0L, p = (long *)rep->data.requests; i<256L; i++, p++) + { + swapl(p,n); + } + for (i=0L, p = (long *)rep->data.events; i<XETrapCoreEvents; i++, p++) + { + swapl(p,n); + } + (void)WriteToClient(client,size,reply); + return; +} + +/* Out-going XTrap I/O header needing to be swapped *from* native format */ + +void sXETrapHeader(XETrapHeader *hdr) +{ + register char n; + + swapl(&(hdr->count), n); + swapl(&(hdr->timestamp), n); + swaps(&(hdr->win_x), n); + swaps(&(hdr->win_y), n); + swaps(&(hdr->client), n); +} + + /* Out-going requests needing to be swapped *from* native format + * aka swapreq.c "equivalents" + */ + +/* The following is used for all requests that have + no fields to be swapped (except "length") */ +void XETSwSimpleReq(register xReq *data) +{ + register char n; + swaps(&(data->length), n); +} + +/* The following is used for all requests that have + only a single 32-bit field to be swapped, coming + right after the "length" field */ + +void XETSwResourceReq(register xResourceReq *data) +{ + register char n; + + swaps(&(data->length), n); + swapl(&(data->id), n); +} + +void XETSwCreateWindow(register xCreateWindowReq *data,ClientPtr client) +{ + register char n; + + swapl(&(data->wid), n); + swapl(&(data->parent), n); + swaps(&(data->x), n); + swaps(&(data->y), n); + swaps(&(data->width), n); + swaps(&(data->height), n); + swaps(&(data->borderWidth), n); + swaps(&(data->class), n); + swapl(&(data->visual), n); + swapl(&(data->mask), n); + SwapRestL(data); + swaps(&(data->length), n); +} + +void XETSwChangeWindowAttributes(register xChangeWindowAttributesReq *data, +ClientPtr client) +{ + register char n; + + swapl(&(data->window), n); + swapl(&(data->valueMask), n); + SwapRestL(data); + swaps(&(data->length), n); +} + +void XETSwReparentWindow(register xReparentWindowReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->window), n); + swapl(&(data->parent), n); + swaps(&(data->x), n); + swaps(&(data->y), n); +} + +void XETSwConfigureWindow(xConfigureWindowReq *data, ClientPtr client) +{ + register char n; + swapl(&(data->window), n); + swaps(&(data->mask), n); + SwapRestL(data); + swaps(&(data->length), n); +} + + +void XETSwInternAtom(register xInternAtomReq *data) +{ + register char n; + swaps(&(data->length), n); + swaps(&(data->nbytes), n); +} + +void XETSwChangeProperty(register xChangePropertyReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->window), n); + swapl(&(data->property), n); + swapl(&(data->type), n); + switch ( data->format ) { + case 8L : break; + case 16L: + SwapShorts((short *)(data + 1), data->nUnits); + break; + case 32L: + SwapLongs((CARD32 *)(data + 1), data->nUnits); + break; + } + swapl(&(data->nUnits), n); +} + +void XETSwDeleteProperty(register xDeletePropertyReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->window), n); + swapl(&(data->property), n); + +} +void XETSwGetProperty(register xGetPropertyReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->window), n); + swapl(&(data->property), n); + swapl(&(data->type), n); + swapl(&(data->longOffset), n); + swapl(&(data->longLength), n); +} + +void XETSwSetSelectionOwner(register xSetSelectionOwnerReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->window), n); + swapl(&(data->selection), n); + swapl(&(data->time), n); +} + +void XETSwConvertSelection(register xConvertSelectionReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->requestor), n); + swapl(&(data->selection), n); + swapl(&(data->target), n); + swapl(&(data->property), n); + swapl(&(data->time), n); +} + +void XETSwSendEvent(register xSendEventReq *data) +{ + register char n; + xEvent eventT; + EventSwapPtr proc; + swapl(&(data->destination), n); + swapl(&(data->eventMask), n); + + /* Swap event */ + proc = EventSwapVector[data->event.u.u.type & 0177]; + if (!proc || proc == NotImplemented) + (*proc)(&(data->event), &eventT); + data->event = eventT; + swaps(&(data->length), n); +} + +void XETSwGrabPointer(register xGrabPointerReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->grabWindow), n); + swaps(&(data->eventMask), n); + swapl(&(data->confineTo), n); + swapl(&(data->cursor), n); + swapl(&(data->time), n); +} + +void XETSwGrabButton(register xGrabButtonReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->grabWindow), n); + swaps(&(data->eventMask), n); + swapl(&(data->confineTo), n); + swapl(&(data->cursor), n); + swaps(&(data->modifiers), n); +} + +void XETSwUngrabButton(register xUngrabButtonReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->grabWindow), n); + swaps(&(data->modifiers), n); +} + +void XETSwChangeActivePointerGrab(register xChangeActivePointerGrabReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->cursor), n); + swapl(&(data->time), n); + swaps(&(data->eventMask), n); +} + +void XETSwGrabKeyboard(register xGrabKeyboardReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->grabWindow), n); + swapl(&(data->time), n); +} + +void XETSwGrabKey(register xGrabKeyReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->grabWindow), n); + swaps(&(data->modifiers), n); +} + +void XETSwUngrabKey(register xUngrabKeyReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->grabWindow), n); + swaps(&(data->modifiers), n); +} + +void XETSwGetMotionEvents(register xGetMotionEventsReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->window), n); + swapl(&(data->start), n); + swapl(&(data->stop), n); +} + +void XETSwTranslateCoords(register xTranslateCoordsReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->srcWid), n); + swapl(&(data->dstWid), n); + swaps(&(data->srcX), n); + swaps(&(data->srcY), n); +} + +void XETSwWarpPointer(register xWarpPointerReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->srcWid), n); + swapl(&(data->dstWid), n); + swaps(&(data->srcX), n); + swaps(&(data->srcY), n); + swaps(&(data->srcWidth), n); + swaps(&(data->srcHeight), n); + swaps(&(data->dstX), n); + swaps(&(data->dstY), n); +} + +void XETSwSetInputFocus(register xSetInputFocusReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->focus), n); + swapl(&(data->time), n); +} + +void XETSwOpenFont(register xOpenFontReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->fid), n); + swaps(&(data->nbytes), n); +} + +void XETSwListFonts(register xListFontsReq *data) +{ + register char n; + swaps(&(data->length), n); + swaps(&(data->maxNames), n); + swaps(&(data->nbytes), n); +} + +void XETSwListFontsWithInfo(register xListFontsWithInfoReq *data) +{ + register char n; + swaps(&(data->length), n); + swaps(&(data->maxNames), n); + swaps(&(data->nbytes), n); +} + +void XETSwSetFontPath(register xSetFontPathReq *data) +{ + register char n; + swaps(&(data->length), n); + swaps(&(data->nFonts), n); +} + +void XETSwCreatePixmap(register xCreatePixmapReq *data) +{ + register char n; + + swaps(&(data->length), n); + swapl(&(data->pid), n); + swapl(&(data->drawable), n); + swaps(&(data->width), n); + swaps(&(data->height), n); +} + +void XETSwCreateGC(register xCreateGCReq *data, ClientPtr client) +{ + register char n; + swapl(&(data->gc), n); + swapl(&(data->drawable), n); + swapl(&(data->mask), n); + SwapRestL(data); + swaps(&(data->length), n); +} + +void XETSwChangeGC(register xChangeGCReq *data, ClientPtr client) +{ + register char n; + swapl(&(data->gc), n); + swapl(&(data->mask), n); + SwapRestL(data); + swaps(&(data->length), n); +} + +void XETSwCopyGC(register xCopyGCReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->srcGC), n); + swapl(&(data->dstGC), n); + swapl(&(data->mask), n); +} + +void XETSwSetDashes(register xSetDashesReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->gc), n); + swaps(&(data->dashOffset), n); + swaps(&(data->nDashes), n); +} + +void XETSwSetClipRectangles(register xSetClipRectanglesReq *data, ClientPtr +client) +{ + register char n; + swapl(&(data->gc), n); + swaps(&(data->xOrigin), n); + swaps(&(data->yOrigin), n); + SwapRestS(data); + swaps(&(data->length), n); +} + +void XETSwClearToBackground(register xClearAreaReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->window), n); + swaps(&(data->x), n); + swaps(&(data->y), n); + swaps(&(data->width), n); + swaps(&(data->height), n); +} + +void XETSwCopyArea(register xCopyAreaReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->srcDrawable), n); + swapl(&(data->dstDrawable), n); + swapl(&(data->gc), n); + swaps(&(data->srcX), n); + swaps(&(data->srcY), n); + swaps(&(data->dstX), n); + swaps(&(data->dstY), n); + swaps(&(data->width), n); + swaps(&(data->height), n); +} + +void XETSwCopyPlane(register xCopyPlaneReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->srcDrawable), n); + swapl(&(data->dstDrawable), n); + swapl(&(data->gc), n); + swaps(&(data->srcX), n); + swaps(&(data->srcY), n); + swaps(&(data->dstX), n); + swaps(&(data->dstY), n); + swaps(&(data->width), n); + swaps(&(data->height), n); + swapl(&(data->bitPlane), n); +} + +/* The following routine is used for all Poly drawing requests + (except FillPoly, which uses a different request format) */ +void XETSwPoly(register xPolyPointReq *data, ClientPtr client) +{ + register char n; + + swapl(&(data->drawable), n); + swapl(&(data->gc), n); + SwapRestS(data); + swaps(&(data->length), n); +} + /* cannot use XETSwPoly for this one, because xFillPolyReq + * is longer than xPolyPointReq, and we don't want to swap + * the difference as shorts! + */ +void XETSwFillPoly(register xFillPolyReq *data, ClientPtr client) +{ + register char n; + + swapl(&(data->drawable), n); + swapl(&(data->gc), n); + SwapRestS(data); + swaps(&(data->length), n); +} + +void XETSwPutImage(register xPutImageReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->drawable), n); + swapl(&(data->gc), n); + swaps(&(data->width), n); + swaps(&(data->height), n); + swaps(&(data->dstX), n); + swaps(&(data->dstY), n); + /* Image should already be swapped */ +} + +void XETSwGetImage(register xGetImageReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->drawable), n); + swaps(&(data->x), n); + swaps(&(data->y), n); + swaps(&(data->width), n); + swaps(&(data->height), n); + swapl(&(data->planeMask), n); +} + +/* ProcPolyText used for both PolyText8 and PolyText16 */ + +void XETSwPolyText(register xPolyTextReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->drawable), n); + swapl(&(data->gc), n); + swaps(&(data->x), n); + swaps(&(data->y), n); +} + +/* ProcImageText used for both ImageText8 and ImageText16 */ + +void XETSwImageText(register xImageTextReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->drawable), n); + swapl(&(data->gc), n); + swaps(&(data->x), n); + swaps(&(data->y), n); +} + +void XETSwCreateColormap(register xCreateColormapReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->mid), n); + swapl(&(data->window), n); + swapl(&(data->visual), n); +} + + +void XETSwCopyColormapAndFree(register xCopyColormapAndFreeReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->mid), n); + swapl(&(data->srcCmap), n); + +} + +void XETSwAllocColor (register xAllocColorReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->cmap), n); + swaps(&(data->red), n); + swaps(&(data->green), n); + swaps(&(data->blue), n); +} + +void XETSwAllocNamedColor (register xAllocNamedColorReq *data) +{ + register char n; + + swaps(&(data->length), n); + swapl(&(data->cmap), n); + swaps(&(data->nbytes), n); +} + +void XETSwAllocColorCells (register xAllocColorCellsReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->cmap), n); + swaps(&(data->colors), n); + swaps(&(data->planes), n); +} + +void XETSwAllocColorPlanes(register xAllocColorPlanesReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->cmap), n); + swaps(&(data->colors), n); + swaps(&(data->red), n); + swaps(&(data->green), n); + swaps(&(data->blue), n); +} + +void XETSwFreeColors (register xFreeColorsReq *data, ClientPtr +client) +{ + register char n; + swapl(&(data->cmap), n); + swapl(&(data->planeMask), n); + SwapRestL(data); + swaps(&(data->length), n); + +} + +void XETSwStoreColors (register xStoreColorsReq *data,ClientPtr +client) +{ + register char n; + unsigned long count; + xColorItem *pItem; + + swapl(&(data->cmap), n); + pItem = (xColorItem *) &(data[1]); + for(count = LengthRestB(data)/sizeof(xColorItem); count != 0; count--) + SwapColorItem(pItem++); + swaps(&(data->length), n); +} + +void XETSwStoreNamedColor (register xStoreNamedColorReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->cmap), n); + swapl(&(data->pixel), n); + swaps(&(data->nbytes), n); +} + +void XETSwQueryColors(register xQueryColorsReq *data, ClientPtr client) +{ + register char n; + swapl(&(data->cmap), n); + SwapRestL(data); + swaps(&(data->length), n); +} + +void XETSwLookupColor(register xLookupColorReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->cmap), n); + swaps(&(data->nbytes), n); +} + +void XETSwCreateCursor(register xCreateCursorReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->cid), n); + swapl(&(data->source), n); + swapl(&(data->mask), n); + swaps(&(data->foreRed), n); + swaps(&(data->foreGreen), n); + swaps(&(data->foreBlue), n); + swaps(&(data->backRed), n); + swaps(&(data->backGreen), n); + swaps(&(data->backBlue), n); + swaps(&(data->x), n); + swaps(&(data->y), n); +} + +void XETSwCreateGlyphCursor(register xCreateGlyphCursorReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->cid), n); + swapl(&(data->source), n); + swapl(&(data->mask), n); + swaps(&(data->sourceChar), n); + swaps(&(data->maskChar), n); + swaps(&(data->foreRed), n); + swaps(&(data->foreGreen), n); + swaps(&(data->foreBlue), n); + swaps(&(data->backRed), n); + swaps(&(data->backGreen), n); + swaps(&(data->backBlue), n); +} + + +void XETSwRecolorCursor(register xRecolorCursorReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->cursor), n); + swaps(&(data->foreRed), n); + swaps(&(data->foreGreen), n); + swaps(&(data->foreBlue), n); + swaps(&(data->backRed), n); + swaps(&(data->backGreen), n); + swaps(&(data->backBlue), n); +} + +void XETSwQueryBestSize (register xQueryBestSizeReq *data) +{ + register char n; + swaps(&(data->length), n); + swapl(&(data->drawable), n); + swaps(&(data->width), n); + swaps(&(data->height), n); + +} + +void XETSwQueryExtension (register xQueryExtensionReq *data) +{ + register char n; + swaps(&(data->length), n); + swaps(&(data->nbytes), n); +} + +void XETSwChangeKeyboardMapping (register xChangeKeyboardMappingReq *data) +{ + register char n; + register long *p; + register int i, count; + + swaps(&(data->length), n); + p = (long *)&(data[1]); + count = data->keyCodes * data->keySymsPerKeyCode; + for(i = 0; i < count; i++) + { + swapl(p, n); + p++; + } +} + + +void XETSwChangeKeyboardControl (register xChangeKeyboardControlReq *data, + ClientPtr client) +{ + register char n; + swapl(&(data->mask), n); + SwapRestL(data); + swaps(&(data->length), n); +} + +void XETSwChangePointerControl (register xChangePointerControlReq *data) +{ + register char n; + swaps(&(data->length), n); + swaps(&(data->accelNum), n); + swaps(&(data->accelDenum), n); + swaps(&(data->threshold), n); +} + + +void XETSwSetScreenSaver (register xSetScreenSaverReq *data) +{ + register char n; + swaps(&(data->length), n); + swaps(&(data->timeout), n); + swaps(&(data->interval), n); +} + +void XETSwChangeHosts(register xChangeHostsReq *data) +{ + register char n; + + swaps(&(data->length), n); + swaps(&(data->hostLength), n); + +} +void XETSwRotateProperties(register xRotatePropertiesReq *data, ClientPtr client) +{ + register char n; + swapl(&(data->window), n); + swaps(&(data->nAtoms), n); + swaps(&(data->nPositions), n); + SwapRestL(data); + swaps(&(data->length), n); +} + +/*ARGSUSED*/ +void XETSwNoOperation(xReq *data) +{ + /* noop -- don't do anything */ +} diff --git a/xorg-server/XTrap/xtrapditbl.c b/xorg-server/XTrap/xtrapditbl.c new file mode 100644 index 000000000..db78c26e2 --- /dev/null +++ b/xorg-server/XTrap/xtrapditbl.c @@ -0,0 +1,243 @@ +/**************************************************************************** +Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA + +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. + +*****************************************************************************/ +/* + * ABSTRACT: + * + * This module is contains Vector tables used for swapping and general + * dispatch by the XTrap server extension. + * + * CONTRIBUTORS: + * + * Ken Miller + * Marc Evans + * + */ + +/*-----------------* + * Include Files * + *-----------------*/ +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <stdlib.h> + +#include <X11/X.h> +#define NEED_REPLIES +#define NEED_EVENTS +#include <X11/Xproto.h> +#include <X11/Xprotostr.h> +#include <X11/extensions/xtrapdi.h> +#include "input.h" /* Server DevicePtr definitions */ +#include "misc.h" +#include "dixstruct.h" +#ifdef PC +# include "extnsist.h" +#else +# include "extnsionst.h" /* Server ExtensionEntry definitions */ +#endif +#include <X11/extensions/xtrapddmi.h> +#include <X11/extensions/xtrapproto.h> + +globaldef void_function XETSwProcVector[256L] = +{ + (void_function)ProcBadRequest, + XETSwCreateWindow, + XETSwChangeWindowAttributes, + XETSwResourceReq, /* GetWindowAttributes */ + XETSwResourceReq, /* DestroyWindow */ + XETSwResourceReq, /* 5 DestroySubwindows */ + XETSwResourceReq, /* XETSwChangeSaveSet, */ + XETSwReparentWindow, + XETSwResourceReq, /* MapWindow */ + XETSwResourceReq, /* MapSubwindows */ + XETSwResourceReq, /* 10 UnmapWindow */ + XETSwResourceReq, /* UnmapSubwindows */ + XETSwConfigureWindow, + XETSwResourceReq, /* XETSwCirculateWindow, */ + XETSwResourceReq, /* GetGeometry */ + XETSwResourceReq, /* 15 QueryTree */ + XETSwInternAtom, + XETSwResourceReq, /* XETSwGetAtomName, */ + XETSwChangeProperty, + XETSwDeleteProperty, + XETSwGetProperty, /* 20 */ + XETSwResourceReq, /* XETSwListProperties, */ + XETSwSetSelectionOwner, + XETSwResourceReq, /* XETSwGetSelectionOwner, */ + XETSwConvertSelection, + XETSwSendEvent, /* 25 */ + XETSwGrabPointer, + XETSwResourceReq, /* XETSwUngrabPointer, */ + XETSwGrabButton, + XETSwUngrabButton, + XETSwChangeActivePointerGrab, /* 30 */ + XETSwGrabKeyboard, + XETSwResourceReq, /* XETSwUngrabKeyboard, */ + XETSwGrabKey, + XETSwUngrabKey, + XETSwResourceReq, /* 35 XETSwAllowEvents, */ + XETSwSimpleReq, /* XETSwGrabServer, */ + XETSwSimpleReq, /* XETSwUngrabServer, */ + XETSwResourceReq, /* XETSwQueryPointer, */ + XETSwGetMotionEvents, + XETSwTranslateCoords, /*40 */ + XETSwWarpPointer, + XETSwSetInputFocus, + XETSwSimpleReq, /* XETSwGetInputFocus, */ + XETSwSimpleReq, /* QueryKeymap, */ + XETSwOpenFont, /* 45 */ + XETSwResourceReq, /* XETSwCloseFont, */ + XETSwResourceReq, /* XETSwQueryFont, */ + XETSwResourceReq, /* XETSwQueryTextExtents, */ + XETSwListFonts, + XETSwListFontsWithInfo, /* 50 */ + XETSwSetFontPath, + XETSwSimpleReq, /* GetFontPath, */ + XETSwCreatePixmap, + XETSwResourceReq, /* XETSwFreePixmap, */ + XETSwCreateGC, /* 55 */ + XETSwChangeGC, + XETSwCopyGC, + XETSwSetDashes, + XETSwSetClipRectangles, + XETSwResourceReq, /* 60 XETSwFreeGC, */ + XETSwClearToBackground, + XETSwCopyArea, + XETSwCopyPlane, + XETSwPoly, /* PolyPoint, */ + XETSwPoly, /* 65 PolyLine */ + XETSwPoly, /* PolySegment, */ + XETSwPoly, /* PolyRectangle, */ + XETSwPoly, /* PolyArc, */ + XETSwFillPoly, + XETSwPoly, /* 70 PolyFillRectangle */ + XETSwPoly, /* PolyFillArc, */ + XETSwPutImage, + XETSwGetImage, + XETSwPolyText, + XETSwPolyText, /* 75 */ + XETSwImageText, + XETSwImageText, + XETSwCreateColormap, + XETSwResourceReq, /* XETSwFreeColormap, */ + XETSwCopyColormapAndFree, /* 80 */ + XETSwResourceReq, /* XETSwInstallColormap, */ + XETSwResourceReq, /* XETSwUninstallColormap, */ + XETSwResourceReq, /* XETSwListInstalledColormaps, */ + XETSwAllocColor, + XETSwAllocNamedColor, /* 85 */ + XETSwAllocColorCells, + XETSwAllocColorPlanes, + XETSwFreeColors, + XETSwStoreColors, + XETSwStoreNamedColor, /* 90 */ + XETSwQueryColors, + XETSwLookupColor, + XETSwCreateCursor, + XETSwCreateGlyphCursor, + XETSwResourceReq, /* 95 XETSwFreeCursor, */ + XETSwRecolorCursor, + XETSwQueryBestSize, + XETSwQueryExtension, + XETSwSimpleReq, /* ListExtensions, */ + XETSwChangeKeyboardMapping, /* 100 */ + XETSwSimpleReq, /* GetKeyboardMapping, */ + XETSwChangeKeyboardControl, + XETSwSimpleReq, /* GetKeyboardControl, */ + XETSwSimpleReq, /* Bell, */ + XETSwChangePointerControl, /* 105 */ + XETSwSimpleReq, /* GetPointerControl, */ + XETSwSetScreenSaver, + XETSwSimpleReq, /* GetScreenSaver, */ + XETSwChangeHosts, + XETSwSimpleReq, /* 110 ListHosts, */ + XETSwSimpleReq, /* XETSwChangeAccessControl, */ + XETSwSimpleReq, /* XETSwChangeCloseDownMode, */ + XETSwResourceReq, /* XETSwKillClient, */ + XETSwRotateProperties, + XETSwSimpleReq, /* 115 ForceScreenSaver */ + XETSwSimpleReq, /* SetPointerMapping, */ + XETSwSimpleReq, /* GetPointerMapping, */ + XETSwSimpleReq, /* SetModifierMapping, */ + XETSwSimpleReq, /* GetModifierMapping, */ + NotImplemented, /* 120 */ + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, + NotImplemented, /* 125 */ + NotImplemented, + XETSwNoOperation +}; + +/* NOTE: This array must align with the values of the constants used + * as minor_opcode values in the request structure. Failure to do this + * could result in random code paths. + */ +globaldef int_function XETrapDispatchVector[10L] = +{ + XETrapReset, /* 0 XETrap_Reset */ + XETrapGetAvailable, /* 1 XETrap_GetAvailable */ + XETrapConfig, /* 2 XETrap_Config */ + XETrapStartTrap, /* 3 XETrap_StartTrap */ + XETrapStopTrap, /* 4 XETrap_StopTrap */ + XETrapGetCurrent, /* 5 XETrap_GetCurrent */ + XETrapGetStatistics, /* 6 XETrap_GetStatistics */ +#ifndef _XINPUT + XETrapSimulateXEvent, /* 7 XETrap_SimulateXEvent */ +#endif + XETrapGetVersion, /* 8 XETrap_GetVersion */ + XETrapGetLastInpTime, /* 9 XETrap_GetLastInpTime */ +}; + +/* NOTE: This array must align with the values of the constants used + * as minor_opcode values in the request structure. Failure to do this + * could result in random code paths. + */ +globaldef int_function XETSwDispatchVector[10L] = +{ + sXETrapReset, /* 0 XETrap_Reset */ + sXETrapGetAvailable, /* 1 XETrap_GetAvailable */ + sXETrapConfig, /* 2 XETrap_Config */ + sXETrapStartTrap, /* 3 XETrap_StartTrap */ + sXETrapStopTrap, /* 4 XETrap_StopTrap */ + sXETrapGetCurrent, /* 5 XETrap_GetCurrent */ + sXETrapGetStatistics, /* 6 XETrap_GetStatistics */ +#ifndef _XINPUT + sXETrapSimulateXEvent, /* 7 XETrap_SimulateXEvent */ +#endif + sXETrapGetVersion, /* 8 XETrap_GetVersion */ + sXETrapGetLastInpTime, /* 9 XETrap_GetLastInpTime */ +}; + +/* ProcVector shadow vector */ +globaldef int_function XETrapProcVector[256L] = {XETrapRequestVector}; +/* + * Events are faked as if they're vectored since that's + * the way it'll eventually be (X11 R5?). + */ +#ifndef VECTORED_EVENTS +globaldef int_function EventProcVector[XETrapCoreEvents] = {NULL}; +#endif +globaldef int_function XETrapEventProcVector[XETrapCoreEvents] = {NULL}; + + |