diff options
author | root <root@zombrain.(none)> | 2011-07-25 08:54:41 (GMT) |
---|---|---|
committer | root <root@zombrain.(none)> | 2011-07-25 08:54:41 (GMT) |
commit | ab4fcaad149d4bdccefa8f693c2a8e044b40dd4c (patch) | |
tree | c95c280caabc70e7aedbde723e38820047357be7 /xfixes |
initial state (xorg-server 1.10.2)
Diffstat (limited to 'xfixes')
-rw-r--r-- | xfixes/Makefile.am | 16 | ||||
-rw-r--r-- | xfixes/Makefile.in | 762 | ||||
-rw-r--r-- | xfixes/cursor.c | 1065 | ||||
-rw-r--r-- | xfixes/region.c | 920 | ||||
-rw-r--r-- | xfixes/saveset.c | 72 | ||||
-rw-r--r-- | xfixes/select.c | 290 | ||||
-rw-r--r-- | xfixes/xfixes.c | 294 | ||||
-rw-r--r-- | xfixes/xfixes.h | 55 | ||||
-rw-r--r-- | xfixes/xfixesint.h | 285 |
9 files changed, 3759 insertions, 0 deletions
diff --git a/xfixes/Makefile.am b/xfixes/Makefile.am new file mode 100644 index 0000000..a8425e8 --- /dev/null +++ b/xfixes/Makefile.am @@ -0,0 +1,16 @@ +noinst_LTLIBRARIES = libxfixes.la + +AM_CFLAGS = $(DIX_CFLAGS) + +if XORG +sdk_HEADERS = xfixes.h +endif + +libxfixes_la_SOURCES = \ + cursor.c \ + region.c \ + saveset.c \ + select.c \ + xfixes.c \ + xfixes.h \ + xfixesint.h diff --git a/xfixes/Makefile.in b/xfixes/Makefile.in new file mode 100644 index 0000000..2545cf3 --- /dev/null +++ b/xfixes/Makefile.in @@ -0,0 +1,762 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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 = xfixes +DIST_COMMON = $(am__sdk_HEADERS_DIST) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ + $(top_srcdir)/m4/ax_tls.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/xorg-config.h \ + $(top_builddir)/include/xkb-config.h \ + $(top_builddir)/include/xwin-config.h \ + $(top_builddir)/include/kdrive-config.h \ + $(top_builddir)/include/version-config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libxfixes_la_LIBADD = +am_libxfixes_la_OBJECTS = cursor.lo region.lo saveset.lo select.lo \ + xfixes.lo +libxfixes_la_OBJECTS = $(am_libxfixes_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libxfixes_la_SOURCES) +DIST_SOURCES = $(libxfixes_la_SOURCES) +am__sdk_HEADERS_DIST = xfixes.h +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(sdkdir)" +HEADERS = $(sdk_HEADERS) +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@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ +APP_MAN_DIR = @APP_MAN_DIR@ +APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ +AR = @AR@ +ARM_BACKTRACE_CFLAGS = @ARM_BACKTRACE_CFLAGS@ +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@ +CHANGELOG_CMD = @CHANGELOG_CMD@ +COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CWARNFLAGS = @CWARNFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DARWIN_LIBS = @DARWIN_LIBS@ +DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_LIBS = @DBUS_LIBS@ +DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ +DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ +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@ +DIX_LIB = @DIX_LIB@ +DLLTOOL = @DLLTOOL@ +DLOPEN_LIBS = @DLOPEN_LIBS@ +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@ +DOXYGEN = @DOXYGEN@ +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_CFLAGS = @DRI_CFLAGS@ +DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ +DRI_LIBS = @DRI_LIBS@ +DSYMUTIL = @DSYMUTIL@ +DTRACE = @DTRACE@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILE_MAN_DIR = @FILE_MAN_DIR@ +FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +FONT100DPIDIR = @FONT100DPIDIR@ +FONT75DPIDIR = @FONT75DPIDIR@ +FONTMISCDIR = @FONTMISCDIR@ +FONTOTFDIR = @FONTOTFDIR@ +FONTROOTDIR = @FONTROOTDIR@ +FONTTTFDIR = @FONTTTFDIR@ +FONTTYPE1DIR = @FONTTYPE1DIR@ +FOP = @FOP@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ +GLX_DEFINES = @GLX_DEFINES@ +GLX_TLS = @GLX_TLS@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +GREP = @GREP@ +HAL_CFLAGS = @HAL_CFLAGS@ +HAL_LIBS = @HAL_LIBS@ +INSTALL = @INSTALL@ +INSTALL_CMD = @INSTALL_CMD@ +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_ID_PREFIX = @LAUNCHD_ID_PREFIX@ +LD = @LD@ +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@ +LIBSHA1_CFLAGS = @LIBSHA1_CFLAGS@ +LIBSHA1_LIBS = @LIBSHA1_LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_MAN_DIR = @LIB_MAN_DIR@ +LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAIN_LIB = @MAIN_LIB@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MAN_SUBSTS = @MAN_SUBSTS@ +MISC_MAN_DIR = @MISC_MAN_DIR@ +MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCCLD = @OBJCCLD@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJCLINK = @OBJCLINK@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OS_LIB = @OS_LIB@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +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@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PROJECTROOT = @PROJECTROOT@ +RANLIB = @RANLIB@ +RAWCPP = @RAWCPP@ +RAWCPPFLAGS = @RAWCPPFLAGS@ +RELEASE_DATE = @RELEASE_DATE@ +SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ +SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ +SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ +SET_MAKE = @SET_MAKE@ +SHA1_CFLAGS = @SHA1_CFLAGS@ +SHA1_LIBS = @SHA1_LIBS@ +SHELL = @SHELL@ +SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@ +SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ +STRIP = @STRIP@ +STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +SYSCONFDIR = @SYSCONFDIR@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +UDEV_CFLAGS = @UDEV_CFLAGS@ +UDEV_LIBS = @UDEV_LIBS@ +UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ +VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ +VERSION = @VERSION@ +WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ +WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ +WINDRES = @WINDRES@ +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@ +XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ +XEPHYR_INCS = @XEPHYR_INCS@ +XEPHYR_LIBS = @XEPHYR_LIBS@ +XF86CONFIGDIR = @XF86CONFIGDIR@ +XF86CONFIGFILE = @XF86CONFIGFILE@ +XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ +XF86VIDMODE_LIBS = @XF86VIDMODE_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@ +XMLTO = @XMLTO@ +XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ +XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ +XNEST_LIBS = @XNEST_LIBS@ +XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ +XORG_CFLAGS = @XORG_CFLAGS@ +XORG_INCS = @XORG_INCS@ +XORG_LIBS = @XORG_LIBS@ +XORG_MAN_PAGE = @XORG_MAN_PAGE@ +XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ +XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ +XORG_OS = @XORG_OS@ +XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XORG_SGML_PATH = @XORG_SGML_PATH@ +XORG_SYS_LIBS = @XORG_SYS_LIBS@ +XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ +XPBPROXY_LIBS = @XPBPROXY_LIBS@ +XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ +XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ +XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_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@ +XSL_STYLESHEET = @XSL_STYLESHEET@ +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@ +__XCONFIGDIR__ = @__XCONFIGDIR__@ +__XCONFIGFILE__ = @__XCONFIGFILE__@ +abi_ansic = @abi_ansic@ +abi_extension = @abi_extension@ +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_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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@ +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@ +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@ +symbol_visibility = @symbol_visibility@ +sysconfdir = @sysconfdir@ +sysconfigdir = @sysconfigdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LTLIBRARIES = libxfixes.la +AM_CFLAGS = $(DIX_CFLAGS) +@XORG_TRUE@sdk_HEADERS = xfixes.h +libxfixes_la_SOURCES = \ + cursor.c \ + region.c \ + saveset.c \ + select.c \ + xfixes.c \ + xfixes.h \ + xfixesint.h + +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 ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign xfixes/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign xfixes/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 +$(am__aclocal_m4_deps): + +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 +libxfixes.la: $(libxfixes_la_OBJECTS) $(libxfixes_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libxfixes_la_OBJECTS) $(libxfixes_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cursor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/region.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/saveset.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/select.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfixes.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@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@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@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@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@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 +install-sdkHEADERS: $(sdk_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(sdkdir)" || $(MKDIR_P) "$(DESTDIR)$(sdkdir)" + @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(sdkdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(sdkdir)" || exit $$?; \ + done + +uninstall-sdkHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(sdk_HEADERS)'; test -n "$(sdkdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(sdkdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(sdkdir)" && rm -f $$files + +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; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + 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; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + 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)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$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) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(sdkdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +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) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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 + +html-am: + +info: info-am + +info-am: + +install-data-am: install-sdkHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +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: uninstall-sdkHEADERS + +.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-sdkHEADERS 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 uninstall-sdkHEADERS + + +# 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/xfixes/cursor.c b/xfixes/cursor.c new file mode 100644 index 0000000..fb608f6 --- /dev/null +++ b/xfixes/cursor.c @@ -0,0 +1,1065 @@ +/* + * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Copyright © 2002 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD 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. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "xfixesint.h" +#include "scrnintstr.h" +#include "cursorstr.h" +#include "dixevents.h" +#include "servermd.h" +#include "inputstr.h" +#include "windowstr.h" +#include "xace.h" + +static RESTYPE CursorClientType; +static RESTYPE CursorHideCountType; +static RESTYPE CursorWindowType; +static CursorPtr CursorCurrent[MAXDEVICES]; + +static DevPrivateKeyRec CursorScreenPrivateKeyRec; +#define CursorScreenPrivateKey (&CursorScreenPrivateKeyRec) + +static void deleteCursorHideCountsForScreen (ScreenPtr pScreen); + +#define VERIFY_CURSOR(pCursor, cursor, client, access) \ + do { \ + int err; \ + err = dixLookupResourceByType((pointer *) &pCursor, cursor, \ + RT_CURSOR, client, access); \ + if (err != Success) { \ + client->errorValue = cursor; \ + return err; \ + } \ + } while (0) + +/* + * There is a global list of windows selecting for cursor events + */ + +typedef struct _CursorEvent *CursorEventPtr; + +typedef struct _CursorEvent { + CursorEventPtr next; + CARD32 eventMask; + ClientPtr pClient; + WindowPtr pWindow; + XID clientResource; +} CursorEventRec; + +static CursorEventPtr cursorEvents; + +/* + * Each screen has a list of clients which have requested + * that the cursor be hid, and the number of times each + * client has requested. +*/ + +typedef struct _CursorHideCountRec *CursorHideCountPtr; + +typedef struct _CursorHideCountRec { + CursorHideCountPtr pNext; + ClientPtr pClient; + ScreenPtr pScreen; + int hideCount; + XID resource; +} CursorHideCountRec; + +/* + * Wrap DisplayCursor to catch cursor change events + */ + +typedef struct _CursorScreen { + DisplayCursorProcPtr DisplayCursor; + CloseScreenProcPtr CloseScreen; + CursorHideCountPtr pCursorHideCounts; +} CursorScreenRec, *CursorScreenPtr; + +#define GetCursorScreen(s) ((CursorScreenPtr)dixLookupPrivate(&(s)->devPrivates, CursorScreenPrivateKey)) +#define GetCursorScreenIfSet(s) GetCursorScreen(s) +#define SetCursorScreen(s,p) dixSetPrivate(&(s)->devPrivates, CursorScreenPrivateKey, p) +#define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func) +#define Unwrap(as,s,elt,backup) (((backup) = (s)->elt), (s)->elt = (as)->elt) + +/* The cursor doesn't show up until the first XDefineCursor() */ +static Bool CursorVisible = FALSE; + +Bool EnableCursor = TRUE; + +static Bool +CursorDisplayCursor (DeviceIntPtr pDev, + ScreenPtr pScreen, + CursorPtr pCursor) +{ + CursorScreenPtr cs = GetCursorScreen(pScreen); + Bool ret; + DisplayCursorProcPtr backupProc; + + Unwrap (cs, pScreen, DisplayCursor, backupProc); + + /* + * Have to check ConnectionInfo to distinguish client requests from + * initial root window setup. Not a great way to do it, I admit. + */ + if (ConnectionInfo) + CursorVisible = EnableCursor; + + if (cs->pCursorHideCounts != NULL || !CursorVisible) { + ret = (*pScreen->DisplayCursor) (pDev, pScreen, NullCursor); + } else { + ret = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor); + } + + if (pCursor != CursorCurrent[pDev->id]) + { + CursorEventPtr e; + + CursorCurrent[pDev->id] = pCursor; + for (e = cursorEvents; e; e = e->next) + { + if ((e->eventMask & XFixesDisplayCursorNotifyMask)) + { + xXFixesCursorNotifyEvent ev; + ev.type = XFixesEventBase + XFixesCursorNotify; + ev.subtype = XFixesDisplayCursorNotify; + ev.window = e->pWindow->drawable.id; + ev.cursorSerial = pCursor->serialNumber; + ev.timestamp = currentTime.milliseconds; + ev.name = pCursor->name; + WriteEventsToClient (e->pClient, 1, (xEvent *) &ev); + } + } + } + Wrap (cs, pScreen, DisplayCursor, backupProc); + + return ret; +} + +static Bool +CursorCloseScreen (int index, ScreenPtr pScreen) +{ + CursorScreenPtr cs = GetCursorScreen (pScreen); + Bool ret; + CloseScreenProcPtr close_proc; + DisplayCursorProcPtr display_proc; + + Unwrap (cs, pScreen, CloseScreen, close_proc); + Unwrap (cs, pScreen, DisplayCursor, display_proc); + deleteCursorHideCountsForScreen(pScreen); + ret = (*pScreen->CloseScreen) (index, pScreen); + free(cs); + return ret; +} + +#define CursorAllEvents (XFixesDisplayCursorNotifyMask) + +static int +XFixesSelectCursorInput (ClientPtr pClient, + WindowPtr pWindow, + CARD32 eventMask) +{ + CursorEventPtr *prev, e; + pointer val; + int rc; + + for (prev = &cursorEvents; (e = *prev); prev = &e->next) + { + if (e->pClient == pClient && + e->pWindow == pWindow) + { + break; + } + } + if (!eventMask) + { + if (e) + { + FreeResource (e->clientResource, 0); + } + return Success; + } + if (!e) + { + e = (CursorEventPtr) malloc(sizeof (CursorEventRec)); + if (!e) + return BadAlloc; + + e->next = 0; + e->pClient = pClient; + e->pWindow = pWindow; + e->clientResource = FakeClientID(pClient->index); + + /* + * Add a resource hanging from the window to + * catch window destroy + */ + rc = dixLookupResourceByType( &val, pWindow->drawable.id, + CursorWindowType, serverClient, + DixGetAttrAccess); + if (rc != Success) + if (!AddResource (pWindow->drawable.id, CursorWindowType, + (pointer) pWindow)) + { + free(e); + return BadAlloc; + } + + if (!AddResource (e->clientResource, CursorClientType, (pointer) e)) + return BadAlloc; + + *prev = e; + } + e->eventMask = eventMask; + return Success; +} + +int +ProcXFixesSelectCursorInput (ClientPtr client) +{ + REQUEST (xXFixesSelectCursorInputReq); + WindowPtr pWin; + int rc; + + REQUEST_SIZE_MATCH (xXFixesSelectCursorInputReq); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); + if (rc != Success) + return rc; + if (stuff->eventMask & ~CursorAllEvents) + { + client->errorValue = stuff->eventMask; + return BadValue; + } + return XFixesSelectCursorInput (client, pWin, stuff->eventMask); +} + +static int +GetBit (unsigned char *line, int x) +{ + unsigned char mask; + + if (screenInfo.bitmapBitOrder == LSBFirst) + mask = (1 << (x & 7)); + else + mask = (0x80 >> (x & 7)); + /* XXX assumes byte order is host byte order */ + line += (x >> 3); + if (*line & mask) + return 1; + return 0; +} + +int +SProcXFixesSelectCursorInput (ClientPtr client) +{ + register int n; + REQUEST(xXFixesSelectCursorInputReq); + + swaps(&stuff->length, n); + swapl(&stuff->window, n); + swapl(&stuff->eventMask, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +void +SXFixesCursorNotifyEvent (xXFixesCursorNotifyEvent *from, + xXFixesCursorNotifyEvent *to) +{ + to->type = from->type; + cpswaps (from->sequenceNumber, to->sequenceNumber); + cpswapl (from->window, to->window); + cpswapl (from->cursorSerial, to->cursorSerial); + cpswapl (from->timestamp, to->timestamp); + cpswapl (from->name, to->name); +} + +static void +CopyCursorToImage (CursorPtr pCursor, CARD32 *image) +{ + int width = pCursor->bits->width; + int height = pCursor->bits->height; + int npixels = width * height; + +#ifdef ARGB_CURSOR + if (pCursor->bits->argb) + memcpy (image, pCursor->bits->argb, npixels * sizeof (CARD32)); + else +#endif + { + unsigned char *srcLine = pCursor->bits->source; + unsigned char *mskLine = pCursor->bits->mask; + int stride = BitmapBytePad (width); + int x, y; + CARD32 fg, bg; + + fg = (0xff000000 | + ((pCursor->foreRed & 0xff00) << 8) | + (pCursor->foreGreen & 0xff00) | + (pCursor->foreBlue >> 8)); + bg = (0xff000000 | + ((pCursor->backRed & 0xff00) << 8) | + (pCursor->backGreen & 0xff00) | + (pCursor->backBlue >> 8)); + for (y = 0; y < height; y++) + { + for (x = 0; x < width; x++) + { + if (GetBit (mskLine, x)) + { + if (GetBit (srcLine, x)) + *image++ = fg; + else + *image++ = bg; + } + else + *image++ = 0; + } + srcLine += stride; + mskLine += stride; + } + } +} + +int +ProcXFixesGetCursorImage (ClientPtr client) +{ +/* REQUEST(xXFixesGetCursorImageReq); */ + xXFixesGetCursorImageReply *rep; + CursorPtr pCursor; + CARD32 *image; + int npixels, width, height, rc, x, y; + + REQUEST_SIZE_MATCH(xXFixesGetCursorImageReq); + pCursor = CursorCurrent[PickPointer(client)->id]; + if (!pCursor) + return BadCursor; + rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, RT_CURSOR, + pCursor, RT_NONE, NULL, DixReadAccess); + if (rc != Success) + return rc; + GetSpritePosition (PickPointer(client), &x, &y); + width = pCursor->bits->width; + height = pCursor->bits->height; + npixels = width * height; + rep = malloc(sizeof (xXFixesGetCursorImageReply) + + npixels * sizeof (CARD32)); + if (!rep) + return BadAlloc; + + rep->type = X_Reply; + rep->sequenceNumber = client->sequence; + rep->length = npixels; + rep->width = width; + rep->height = height; + rep->x = x; + rep->y = y; + rep->xhot = pCursor->bits->xhot; + rep->yhot = pCursor->bits->yhot; + rep->cursorSerial = pCursor->serialNumber; + + image = (CARD32 *) (rep + 1); + CopyCursorToImage (pCursor, image); + if (client->swapped) + { + int n; + swaps (&rep->sequenceNumber, n); + swapl (&rep->length, n); + swaps (&rep->x, n); + swaps (&rep->y, n); + swaps (&rep->width, n); + swaps (&rep->height, n); + swaps (&rep->xhot, n); + swaps (&rep->yhot, n); + swapl (&rep->cursorSerial, n); + SwapLongs (image, npixels); + } + WriteToClient(client, sizeof (xXFixesGetCursorImageReply) + + (npixels << 2), (char *) rep); + free(rep); + return Success; +} + +int +SProcXFixesGetCursorImage (ClientPtr client) +{ + int n; + REQUEST(xXFixesGetCursorImageReq); + swaps (&stuff->length, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +int +ProcXFixesSetCursorName (ClientPtr client) +{ + CursorPtr pCursor; + char *tchar; + REQUEST(xXFixesSetCursorNameReq); + Atom atom; + + REQUEST_AT_LEAST_SIZE(xXFixesSetCursorNameReq); + VERIFY_CURSOR(pCursor, stuff->cursor, client, DixSetAttrAccess); + tchar = (char *) &stuff[1]; + atom = MakeAtom (tchar, stuff->nbytes, TRUE); + if (atom == BAD_RESOURCE) + return BadAlloc; + + pCursor->name = atom; + return Success; +} + +int +SProcXFixesSetCursorName (ClientPtr client) +{ + int n; + REQUEST(xXFixesSetCursorNameReq); + + swaps (&stuff->length, n); + REQUEST_AT_LEAST_SIZE(xXFixesSetCursorNameReq); + swapl (&stuff->cursor, n); + swaps (&stuff->nbytes, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +int +ProcXFixesGetCursorName (ClientPtr client) +{ + CursorPtr pCursor; + xXFixesGetCursorNameReply reply; + REQUEST(xXFixesGetCursorNameReq); + const char *str; + int len; + + REQUEST_SIZE_MATCH(xXFixesGetCursorNameReq); + VERIFY_CURSOR(pCursor, stuff->cursor, client, DixGetAttrAccess); + if (pCursor->name) + str = NameForAtom (pCursor->name); + else + str = ""; + len = strlen (str); + + reply.type = X_Reply; + reply.length = bytes_to_int32(len); + reply.sequenceNumber = client->sequence; + reply.atom = pCursor->name; + reply.nbytes = len; + if (client->swapped) + { + int n; + swaps (&reply.sequenceNumber, n); + swapl (&reply.length, n); + swapl (&reply.atom, n); + swaps (&reply.nbytes, n); + } + WriteReplyToClient(client, sizeof(xXFixesGetCursorNameReply), &reply); + WriteToClient(client, len, str); + + return Success; +} + +int +SProcXFixesGetCursorName (ClientPtr client) +{ + int n; + REQUEST(xXFixesGetCursorNameReq); + + swaps (&stuff->length, n); + REQUEST_SIZE_MATCH(xXFixesGetCursorNameReq); + swapl (&stuff->cursor, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +int +ProcXFixesGetCursorImageAndName (ClientPtr client) +{ +/* REQUEST(xXFixesGetCursorImageAndNameReq); */ + xXFixesGetCursorImageAndNameReply *rep; + CursorPtr pCursor; + CARD32 *image; + int npixels; + const char *name; + int nbytes, nbytesRound; + int width, height; + int rc, x, y; + + REQUEST_SIZE_MATCH(xXFixesGetCursorImageAndNameReq); + pCursor = CursorCurrent[PickPointer(client)->id]; + if (!pCursor) + return BadCursor; + rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, RT_CURSOR, + pCursor, RT_NONE, NULL, DixReadAccess|DixGetAttrAccess); + if (rc != Success) + return rc; + GetSpritePosition (PickPointer(client), &x, &y); + width = pCursor->bits->width; + height = pCursor->bits->height; + npixels = width * height; + name = pCursor->name ? NameForAtom (pCursor->name) : ""; + nbytes = strlen (name); + nbytesRound = pad_to_int32(nbytes); + rep = malloc(sizeof (xXFixesGetCursorImageAndNameReply) + + npixels * sizeof (CARD32) + nbytesRound); + if (!rep) + return BadAlloc; + + rep->type = X_Reply; + rep->sequenceNumber = client->sequence; + rep->length = npixels + bytes_to_int32(nbytesRound); + rep->width = width; + rep->height = height; + rep->x = x; + rep->y = y; + rep->xhot = pCursor->bits->xhot; + rep->yhot = pCursor->bits->yhot; + rep->cursorSerial = pCursor->serialNumber; + rep->cursorName = pCursor->name; + rep->nbytes = nbytes; + + image = (CARD32 *) (rep + 1); + CopyCursorToImage (pCursor, image); + memcpy ((image + npixels), name, nbytes); + if (client->swapped) + { + int n; + swaps (&rep->sequenceNumber, n); + swapl (&rep->length, n); + swaps (&rep->x, n); + swaps (&rep->y, n); + swaps (&rep->width, n); + swaps (&rep->height, n); + swaps (&rep->xhot, n); + swaps (&rep->yhot, n); + swapl (&rep->cursorSerial, n); + swapl (&rep->cursorName, n); + swaps (&rep->nbytes, n); + SwapLongs (image, npixels); + } + WriteToClient(client, sizeof (xXFixesGetCursorImageAndNameReply) + + (npixels << 2) + nbytesRound, (char *) rep); + free(rep); + return Success; +} + +int +SProcXFixesGetCursorImageAndName (ClientPtr client) +{ + int n; + REQUEST(xXFixesGetCursorImageAndNameReq); + swaps (&stuff->length, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +/* + * Find every cursor reference in the system, ask testCursor + * whether it should be replaced with a reference to pCursor. + */ + +typedef Bool (*TestCursorFunc) (CursorPtr pOld, pointer closure); + +typedef struct { + RESTYPE type; + TestCursorFunc testCursor; + CursorPtr pNew; + pointer closure; +} ReplaceCursorLookupRec, *ReplaceCursorLookupPtr; + +static const RESTYPE CursorRestypes[] = { + RT_WINDOW, RT_PASSIVEGRAB, RT_CURSOR +}; + +#define NUM_CURSOR_RESTYPES (sizeof (CursorRestypes) / sizeof (CursorRestypes[0])) + +static Bool +ReplaceCursorLookup (pointer value, XID id, pointer closure) +{ + ReplaceCursorLookupPtr rcl = (ReplaceCursorLookupPtr) closure; + WindowPtr pWin; + GrabPtr pGrab; + CursorPtr pCursor = 0, *pCursorRef = 0; + XID cursor = 0; + + switch (rcl->type) { + case RT_WINDOW: + pWin = (WindowPtr) value; + if (pWin->optional) + { + pCursorRef = &pWin->optional->cursor; + pCursor = *pCursorRef; + } + break; + case RT_PASSIVEGRAB: + pGrab = (GrabPtr) value; + pCursorRef = &pGrab->cursor; + pCursor = *pCursorRef; + break; + case RT_CURSOR: + pCursorRef = 0; + pCursor = (CursorPtr) value; + cursor = id; + break; + } + if (pCursor && pCursor != rcl->pNew) + { + if ((*rcl->testCursor) (pCursor, rcl->closure)) + { + rcl->pNew->refcnt++; + /* either redirect reference or update resource database */ + if (pCursorRef) + *pCursorRef = rcl->pNew; + else + ChangeResourceValue (id, RT_CURSOR, rcl->pNew); + FreeCursor (pCursor, cursor); + } + } + return FALSE; /* keep walking */ +} + +static void +ReplaceCursor (CursorPtr pCursor, + TestCursorFunc testCursor, + pointer closure) +{ + int clientIndex; + int resIndex; + ReplaceCursorLookupRec rcl; + + /* + * Cursors exist only in the resource database, windows and grabs. + * All of these are always pointed at by the resource database. Walk + * the whole thing looking for cursors + */ + rcl.testCursor = testCursor; + rcl.pNew = pCursor; + rcl.closure = closure; + + /* for each client */ + for (clientIndex = 0; clientIndex < currentMaxClients; clientIndex++) + { + if (!clients[clientIndex]) + continue; + for (resIndex = 0; resIndex < NUM_CURSOR_RESTYPES; resIndex++) + { + rcl.type = CursorRestypes[resIndex]; + /* + * This function walks the entire client resource database + */ + LookupClientResourceComplex (clients[clientIndex], + rcl.type, + ReplaceCursorLookup, + (pointer) &rcl); + } + } + /* this "knows" that WindowHasNewCursor doesn't depend on it's argument */ + WindowHasNewCursor (screenInfo.screens[0]->root); +} + +static Bool +TestForCursor (CursorPtr pCursor, pointer closure) +{ + return (pCursor == (CursorPtr) closure); +} + +int +ProcXFixesChangeCursor (ClientPtr client) +{ + CursorPtr pSource, pDestination; + REQUEST(xXFixesChangeCursorReq); + + REQUEST_SIZE_MATCH(xXFixesChangeCursorReq); + VERIFY_CURSOR (pSource, stuff->source, client, + DixReadAccess|DixGetAttrAccess); + VERIFY_CURSOR (pDestination, stuff->destination, client, + DixWriteAccess|DixSetAttrAccess); + + ReplaceCursor (pSource, TestForCursor, (pointer) pDestination); + return Success; +} + +int +SProcXFixesChangeCursor (ClientPtr client) +{ + int n; + REQUEST(xXFixesChangeCursorReq); + + swaps (&stuff->length, n); + REQUEST_SIZE_MATCH(xXFixesChangeCursorReq); + swapl (&stuff->source, n); + swapl (&stuff->destination, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +static Bool +TestForCursorName (CursorPtr pCursor, pointer closure) +{ + Atom *pName = closure; + return pCursor->name == *pName; +} + +int +ProcXFixesChangeCursorByName (ClientPtr client) +{ + CursorPtr pSource; + Atom name; + char *tchar; + REQUEST(xXFixesChangeCursorByNameReq); + + REQUEST_FIXED_SIZE(xXFixesChangeCursorByNameReq, stuff->nbytes); + VERIFY_CURSOR(pSource, stuff->source, client, + DixReadAccess|DixGetAttrAccess); + tchar = (char *) &stuff[1]; + name = MakeAtom (tchar, stuff->nbytes, FALSE); + if (name) + ReplaceCursor (pSource, TestForCursorName, &name); + return Success; +} + +int +SProcXFixesChangeCursorByName (ClientPtr client) +{ + int n; + REQUEST(xXFixesChangeCursorByNameReq); + + swaps (&stuff->length, n); + REQUEST_AT_LEAST_SIZE (xXFixesChangeCursorByNameReq); + swapl (&stuff->source, n); + swaps (&stuff->nbytes, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +/* + * Routines for manipulating the per-screen hide counts list. + * This list indicates which clients have requested cursor hiding + * for that screen. + */ + +/* Return the screen's hide-counts list element for the given client */ +static CursorHideCountPtr +findCursorHideCount (ClientPtr pClient, ScreenPtr pScreen) +{ + CursorScreenPtr cs = GetCursorScreen(pScreen); + CursorHideCountPtr pChc; + + for (pChc = cs->pCursorHideCounts; pChc != NULL; pChc = pChc->pNext) { + if (pChc->pClient == pClient) { + return pChc; + } + } + + return NULL; +} + +static int +createCursorHideCount (ClientPtr pClient, ScreenPtr pScreen) +{ + CursorScreenPtr cs = GetCursorScreen(pScreen); + CursorHideCountPtr pChc; + + pChc = (CursorHideCountPtr) malloc(sizeof(CursorHideCountRec)); + if (pChc == NULL) { + return BadAlloc; + } + pChc->pClient = pClient; + pChc->pScreen = pScreen; + pChc->hideCount = 1; + pChc->resource = FakeClientID(pClient->index); + pChc->pNext = cs->pCursorHideCounts; + cs->pCursorHideCounts = pChc; + + /* + * Create a resource for this element so it can be deleted + * when the client goes away. + */ + if (!AddResource (pChc->resource, CursorHideCountType, + (pointer) pChc)) { + free(pChc); + return BadAlloc; + } + + return Success; +} + +/* + * Delete the given hide-counts list element from its screen list. + */ +static void +deleteCursorHideCount (CursorHideCountPtr pChcToDel, ScreenPtr pScreen) +{ + CursorScreenPtr cs = GetCursorScreen(pScreen); + CursorHideCountPtr pChc, pNext; + CursorHideCountPtr pChcLast = NULL; + + pChc = cs->pCursorHideCounts; + while (pChc != NULL) { + pNext = pChc->pNext; + if (pChc == pChcToDel) { + free(pChc); + if (pChcLast == NULL) { + cs->pCursorHideCounts = pNext; + } else { + pChcLast->pNext = pNext; + } + return; + } + pChcLast = pChc; + pChc = pNext; + } +} + +/* + * Delete all the hide-counts list elements for this screen. + */ +static void +deleteCursorHideCountsForScreen (ScreenPtr pScreen) +{ + CursorScreenPtr cs = GetCursorScreen(pScreen); + CursorHideCountPtr pChc, pTmp; + + pChc = cs->pCursorHideCounts; + while (pChc != NULL) { + pTmp = pChc->pNext; + FreeResource(pChc->resource, 0); + pChc = pTmp; + } + cs->pCursorHideCounts = NULL; +} + +int +ProcXFixesHideCursor (ClientPtr client) +{ + WindowPtr pWin; + CursorHideCountPtr pChc; + REQUEST(xXFixesHideCursorReq); + int ret; + + REQUEST_SIZE_MATCH (xXFixesHideCursorReq); + + ret = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, + client, DixGetAttrAccess); + if (ret != Success) { + client->errorValue = stuff->window; + return ret; + } + + /* + * Has client hidden the cursor before on this screen? + * If so, just increment the count. + */ + + pChc = findCursorHideCount(client, pWin->drawable.pScreen); + if (pChc != NULL) { + pChc->hideCount++; + return Success; + } + + /* + * This is the first time this client has hid the cursor + * for this screen. + */ + ret = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen, + DixHideAccess); + if (ret != Success) + return ret; + + ret = createCursorHideCount(client, pWin->drawable.pScreen); + + if (ret == Success) { + DeviceIntPtr dev; + for (dev = inputInfo.devices; dev; dev = dev->next) + { + if (IsMaster(dev) && IsPointerDevice(dev)) + CursorDisplayCursor(dev, pWin->drawable.pScreen, CursorCurrent[dev->id]); + } + } + + return ret; +} + +int +SProcXFixesHideCursor (ClientPtr client) +{ + int n; + REQUEST(xXFixesHideCursorReq); + + swaps (&stuff->length, n); + REQUEST_SIZE_MATCH (xXFixesHideCursorReq); + swapl (&stuff->window, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +int +ProcXFixesShowCursor (ClientPtr client) +{ + WindowPtr pWin; + CursorHideCountPtr pChc; + int rc; + REQUEST(xXFixesShowCursorReq); + + REQUEST_SIZE_MATCH (xXFixesShowCursorReq); + + rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, + client, DixGetAttrAccess); + if (rc != Success) { + client->errorValue = stuff->window; + return rc; + } + + /* + * Has client hidden the cursor on this screen? + * If not, generate an error. + */ + pChc = findCursorHideCount(client, pWin->drawable.pScreen); + if (pChc == NULL) { + return BadMatch; + } + + rc = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen, + DixShowAccess); + if (rc != Success) + return rc; + + pChc->hideCount--; + if (pChc->hideCount <= 0) { + FreeResource(pChc->resource, 0); + } + + return Success; +} + +int +SProcXFixesShowCursor (ClientPtr client) +{ + int n; + REQUEST(xXFixesShowCursorReq); + + swaps (&stuff->length, n); + REQUEST_SIZE_MATCH (xXFixesShowCursorReq); + swapl (&stuff->window, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +static int +CursorFreeClient (pointer data, XID id) +{ + CursorEventPtr old = (CursorEventPtr) data; + CursorEventPtr *prev, e; + + for (prev = &cursorEvents; (e = *prev); prev = &e->next) + { + if (e == old) + { + *prev = e->next; + free(e); + break; + } + } + return 1; +} + +static int +CursorFreeHideCount (pointer data, XID id) +{ + CursorHideCountPtr pChc = (CursorHideCountPtr) data; + ScreenPtr pScreen = pChc->pScreen; + DeviceIntPtr dev; + + deleteCursorHideCount(pChc, pChc->pScreen); + for (dev = inputInfo.devices; dev; dev = dev->next) + { + if (IsMaster(dev) && IsPointerDevice(dev)) + CursorDisplayCursor(dev, pScreen, CursorCurrent[dev->id]); + } + + return 1; +} + +static int +CursorFreeWindow (pointer data, XID id) +{ + WindowPtr pWindow = (WindowPtr) data; + CursorEventPtr e, next; + + for (e = cursorEvents; e; e = next) + { + next = e->next; + if (e->pWindow == pWindow) + { + FreeResource (e->clientResource, 0); + } + } + return 1; +} + +Bool +XFixesCursorInit (void) +{ + int i; + + if (party_like_its_1989) + CursorVisible = EnableCursor; + + if (!dixRegisterPrivateKey(&CursorScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) + return FALSE; + + for (i = 0; i < screenInfo.numScreens; i++) + { + ScreenPtr pScreen = screenInfo.screens[i]; + CursorScreenPtr cs; + + cs = (CursorScreenPtr) calloc(1, sizeof (CursorScreenRec)); + if (!cs) + return FALSE; + Wrap (cs, pScreen, CloseScreen, CursorCloseScreen); + Wrap (cs, pScreen, DisplayCursor, CursorDisplayCursor); + cs->pCursorHideCounts = NULL; + SetCursorScreen (pScreen, cs); + } + CursorClientType = CreateNewResourceType(CursorFreeClient, + "XFixesCursorClient"); + CursorHideCountType = CreateNewResourceType(CursorFreeHideCount, + "XFixesCursorHideCount"); + CursorWindowType = CreateNewResourceType(CursorFreeWindow, + "XFixesCursorWindow"); + + return CursorClientType && CursorHideCountType && CursorWindowType; +} + diff --git a/xfixes/region.c b/xfixes/region.c new file mode 100644 index 0000000..f493496 --- /dev/null +++ b/xfixes/region.c @@ -0,0 +1,920 @@ +/* + * Copyright © 2003 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD 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. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "xfixesint.h" +#include "scrnintstr.h" +#include <picturestr.h> +extern int RenderErrBase; +#include <regionstr.h> +#include <gcstruct.h> +#include <window.h> + +RESTYPE RegionResType; + +static int +RegionResFree (pointer data, XID id) +{ + RegionPtr pRegion = (RegionPtr) data; + + RegionDestroy(pRegion); + return Success; +} + +RegionPtr +XFixesRegionCopy (RegionPtr pRegion) +{ + RegionPtr pNew = RegionCreate(RegionExtents(pRegion), + RegionNumRects(pRegion)); + if (!pNew) + return 0; + if (!RegionCopy(pNew, pRegion)) + { + RegionDestroy(pNew); + return 0; + } + return pNew; +} + +Bool +XFixesRegionInit (void) +{ + RegionResType = CreateNewResourceType(RegionResFree, "XFixesRegion"); + + return RegionResType != 0; +} + +int +ProcXFixesCreateRegion (ClientPtr client) +{ + int things; + RegionPtr pRegion; + REQUEST (xXFixesCreateRegionReq); + + REQUEST_AT_LEAST_SIZE(xXFixesCreateRegionReq); + LEGAL_NEW_RESOURCE (stuff->region, client); + + things = (client->req_len << 2) - sizeof (xXFixesCreateRegionReq); + if (things & 4) + return BadLength; + things >>= 3; + + pRegion = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED); + if (!pRegion) + return BadAlloc; + if (!AddResource (stuff->region, RegionResType, (pointer) pRegion)) + return BadAlloc; + + return Success; +} + +int +SProcXFixesCreateRegion (ClientPtr client) +{ + register int n; + REQUEST(xXFixesCreateRegionReq); + + swaps(&stuff->length, n); + REQUEST_AT_LEAST_SIZE(xXFixesCreateRegionReq); + swapl(&stuff->region, n); + SwapRestS(stuff); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +int +ProcXFixesCreateRegionFromBitmap (ClientPtr client) +{ + RegionPtr pRegion; + PixmapPtr pPixmap; + int rc; + REQUEST (xXFixesCreateRegionFromBitmapReq); + + REQUEST_SIZE_MATCH (xXFixesCreateRegionFromBitmapReq); + LEGAL_NEW_RESOURCE (stuff->region, client); + + rc = dixLookupResourceByType((pointer *)&pPixmap, stuff->bitmap, RT_PIXMAP, + client, DixReadAccess); + if (rc != Success) + { + client->errorValue = stuff->bitmap; + return rc; + } + if (pPixmap->drawable.depth != 1) + return BadMatch; + + pRegion = BitmapToRegion(pPixmap->drawable.pScreen, pPixmap); + + if (!pRegion) + return BadAlloc; + + if (!AddResource (stuff->region, RegionResType, (pointer) pRegion)) + return BadAlloc; + + return Success; +} + +int +SProcXFixesCreateRegionFromBitmap (ClientPtr client) +{ + int n; + REQUEST (xXFixesCreateRegionFromBitmapReq); + + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH (xXFixesCreateRegionFromBitmapReq); + swapl(&stuff->region, n); + swapl(&stuff->bitmap, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +int +ProcXFixesCreateRegionFromWindow (ClientPtr client) +{ + RegionPtr pRegion; + Bool copy = TRUE; + WindowPtr pWin; + int rc; + REQUEST (xXFixesCreateRegionFromWindowReq); + + REQUEST_SIZE_MATCH (xXFixesCreateRegionFromWindowReq); + LEGAL_NEW_RESOURCE (stuff->region, client); + rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, + client, DixGetAttrAccess); + if (rc != Success) + { + client->errorValue = stuff->window; + return rc; + } + switch (stuff->kind) { + case WindowRegionBounding: + pRegion = wBoundingShape(pWin); + if (!pRegion) + { + pRegion = CreateBoundingShape (pWin); + copy = FALSE; + } + break; + case WindowRegionClip: + pRegion = wClipShape(pWin); + if (!pRegion) + { + pRegion = CreateClipShape (pWin); + copy = FALSE; + } + break; + default: + client->errorValue = stuff->kind; + return BadValue; + } + if (copy && pRegion) + pRegion = XFixesRegionCopy (pRegion); + if (!pRegion) + return BadAlloc; + if (!AddResource (stuff->region, RegionResType, (pointer) pRegion)) + return BadAlloc; + + return Success; +} + +int +SProcXFixesCreateRegionFromWindow (ClientPtr client) +{ + int n; + REQUEST (xXFixesCreateRegionFromWindowReq); + + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH (xXFixesCreateRegionFromWindowReq); + swapl(&stuff->region, n); + swapl(&stuff->window, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +int +ProcXFixesCreateRegionFromGC (ClientPtr client) +{ + RegionPtr pRegion, pClip; + GCPtr pGC; + int rc; + REQUEST (xXFixesCreateRegionFromGCReq); + + REQUEST_SIZE_MATCH (xXFixesCreateRegionFromGCReq); + LEGAL_NEW_RESOURCE (stuff->region, client); + + rc = dixLookupGC(&pGC, stuff->gc, client, DixGetAttrAccess); + if (rc != Success) + return rc; + + switch (pGC->clientClipType) { + case CT_PIXMAP: + pRegion = BitmapToRegion(pGC->pScreen, (PixmapPtr) pGC->clientClip); + if (!pRegion) + return BadAlloc; + break; + case CT_REGION: + pClip = (RegionPtr) pGC->clientClip; + pRegion = XFixesRegionCopy (pClip); + if (!pRegion) + return BadAlloc; + break; + default: + return BadImplementation; /* assume sane server bits */ + } + + if (!AddResource (stuff->region, RegionResType, (pointer) pRegion)) + return BadAlloc; + + return Success; +} + +int +SProcXFixesCreateRegionFromGC (ClientPtr client) +{ + int n; + REQUEST (xXFixesCreateRegionFromGCReq); + + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH (xXFixesCreateRegionFromGCReq); + swapl(&stuff->region, n); + swapl(&stuff->gc, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +int +ProcXFixesCreateRegionFromPicture (ClientPtr client) +{ + RegionPtr pRegion; + PicturePtr pPicture; + REQUEST (xXFixesCreateRegionFromPictureReq); + + REQUEST_SIZE_MATCH (xXFixesCreateRegionFromPictureReq); + LEGAL_NEW_RESOURCE (stuff->region, client); + + VERIFY_PICTURE(pPicture, stuff->picture, client, DixGetAttrAccess); + + switch (pPicture->clientClipType) { + case CT_PIXMAP: + pRegion = BitmapToRegion(pPicture->pDrawable->pScreen, + (PixmapPtr) pPicture->clientClip); + if (!pRegion) + return BadAlloc; + break; + case CT_REGION: + pRegion = XFixesRegionCopy ((RegionPtr) pPicture->clientClip); + if (!pRegion) + return BadAlloc; + break; + default: + return BadImplementation; /* assume sane server bits */ + } + + if (!AddResource (stuff->region, RegionResType, (pointer) pRegion)) + return BadAlloc; + + return Success; +} + +int +SProcXFixesCreateRegionFromPicture (ClientPtr client) +{ + int n; + REQUEST (xXFixesCreateRegionFromPictureReq); + + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH (xXFixesCreateRegionFromPictureReq); + swapl(&stuff->region, n); + swapl(&stuff->picture, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +int +ProcXFixesDestroyRegion (ClientPtr client) +{ + REQUEST (xXFixesDestroyRegionReq); + RegionPtr pRegion; + + REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq); + VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess); + FreeResource (stuff->region, RT_NONE); + return Success; +} + +int +SProcXFixesDestroyRegion (ClientPtr client) +{ + int n; + REQUEST (xXFixesDestroyRegionReq); + + swaps (&stuff->length, n); + REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq); + swapl (&stuff->region, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +int +ProcXFixesSetRegion (ClientPtr client) +{ + int things; + RegionPtr pRegion, pNew; + REQUEST (xXFixesSetRegionReq); + + REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq); + VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess); + + things = (client->req_len << 2) - sizeof (xXFixesCreateRegionReq); + if (things & 4) + return BadLength; + things >>= 3; + + pNew = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED); + if (!pNew) + return BadAlloc; + if (!RegionCopy(pRegion, pNew)) + { + RegionDestroy(pNew); + return BadAlloc; + } + RegionDestroy(pNew); + return Success; +} + +int +SProcXFixesSetRegion (ClientPtr client) +{ + int n; + REQUEST (xXFixesSetRegionReq); + + swaps (&stuff->length, n); + REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq); + swapl (&stuff->region, n); + SwapRestS(stuff); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +int +ProcXFixesCopyRegion (ClientPtr client) +{ + RegionPtr pSource, pDestination; + REQUEST (xXFixesCopyRegionReq); + + VERIFY_REGION(pSource, stuff->source, client, DixReadAccess); + VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); + + if (!RegionCopy(pDestination, pSource)) + return BadAlloc; + + return Success; +} + +int +SProcXFixesCopyRegion (ClientPtr client) +{ + int n; + REQUEST (xXFixesCopyRegionReq); + + swaps (&stuff->length, n); + REQUEST_AT_LEAST_SIZE(xXFixesCopyRegionReq); + swapl (&stuff->source, n); + swapl (&stuff->destination, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +int +ProcXFixesCombineRegion (ClientPtr client) +{ + RegionPtr pSource1, pSource2, pDestination; + REQUEST (xXFixesCombineRegionReq); + + REQUEST_SIZE_MATCH (xXFixesCombineRegionReq); + VERIFY_REGION(pSource1, stuff->source1, client, DixReadAccess); + VERIFY_REGION(pSource2, stuff->source2, client, DixReadAccess); + VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); + + switch (stuff->xfixesReqType) { + case X_XFixesUnionRegion: + if (!RegionUnion(pDestination, pSource1, pSource2)) + return BadAlloc; + break; + case X_XFixesIntersectRegion: + if (!RegionIntersect(pDestination, pSource1, pSource2)) + return BadAlloc; + break; + case X_XFixesSubtractRegion: + if (!RegionSubtract(pDestination, pSource1, pSource2)) + return BadAlloc; + break; + } + + return Success; +} + +int +SProcXFixesCombineRegion (ClientPtr client) +{ + int n; + REQUEST (xXFixesCombineRegionReq); + + swaps (&stuff->length, n); + REQUEST_SIZE_MATCH (xXFixesCombineRegionReq); + swapl (&stuff->source1, n); + swapl (&stuff->source2, n); + swapl (&stuff->destination, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +int +ProcXFixesInvertRegion (ClientPtr client) +{ + RegionPtr pSource, pDestination; + BoxRec bounds; + REQUEST(xXFixesInvertRegionReq); + + REQUEST_SIZE_MATCH(xXFixesInvertRegionReq); + VERIFY_REGION(pSource, stuff->source, client, DixReadAccess); + VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); + + /* Compute bounds, limit to 16 bits */ + bounds.x1 = stuff->x; + bounds.y1 = stuff->y; + if ((int) stuff->x + (int) stuff->width > MAXSHORT) + bounds.x2 = MAXSHORT; + else + bounds.x2 = stuff->x + stuff->width; + + if ((int) stuff->y + (int) stuff->height > MAXSHORT) + bounds.y2 = MAXSHORT; + else + bounds.y2 = stuff->y + stuff->height; + + if (!RegionInverse(pDestination, pSource, &bounds)) + return BadAlloc; + + return Success; +} + +int +SProcXFixesInvertRegion (ClientPtr client) +{ + int n; + REQUEST(xXFixesInvertRegionReq); + + swaps (&stuff->length, n); + REQUEST_SIZE_MATCH(xXFixesInvertRegionReq); + swapl (&stuff->source, n); + swaps (&stuff->x, n); + swaps (&stuff->y, n); + swaps (&stuff->width, n); + swaps (&stuff->height, n); + swapl (&stuff->destination, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +int +ProcXFixesTranslateRegion (ClientPtr client) +{ + RegionPtr pRegion; + REQUEST(xXFixesTranslateRegionReq); + + REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq); + VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess); + + RegionTranslate(pRegion, stuff->dx, stuff->dy); + return Success; +} + +int +SProcXFixesTranslateRegion (ClientPtr client) +{ + int n; + REQUEST(xXFixesTranslateRegionReq); + + swaps (&stuff->length, n); + REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq); + swapl (&stuff->region, n); + swaps (&stuff->dx, n); + swaps (&stuff->dy, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +int +ProcXFixesRegionExtents (ClientPtr client) +{ + RegionPtr pSource, pDestination; + REQUEST(xXFixesRegionExtentsReq); + + REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq); + VERIFY_REGION(pSource, stuff->source, client, DixReadAccess); + VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); + + RegionReset(pDestination, RegionExtents(pSource)); + + return Success; +} + +int +SProcXFixesRegionExtents (ClientPtr client) +{ + int n; + REQUEST(xXFixesRegionExtentsReq); + + swaps (&stuff->length, n); + REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq); + swapl (&stuff->source, n); + swapl (&stuff->destination, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +int +ProcXFixesFetchRegion (ClientPtr client) +{ + RegionPtr pRegion; + xXFixesFetchRegionReply *reply; + xRectangle *pRect; + BoxPtr pExtent; + BoxPtr pBox; + int i, nBox; + REQUEST(xXFixesFetchRegionReq); + + REQUEST_SIZE_MATCH(xXFixesFetchRegionReq); + VERIFY_REGION(pRegion, stuff->region, client, DixReadAccess); + + pExtent = RegionExtents(pRegion); + pBox = RegionRects (pRegion); + nBox = RegionNumRects (pRegion); + + reply = malloc(sizeof (xXFixesFetchRegionReply) + + nBox * sizeof (xRectangle)); + if (!reply) + return BadAlloc; + reply->type = X_Reply; + reply->sequenceNumber = client->sequence; + reply->length = nBox << 1; + reply->x = pExtent->x1; + reply->y = pExtent->y1; + reply->width = pExtent->x2 - pExtent->x1; + reply->height = pExtent->y2 - pExtent->y1; + + pRect = (xRectangle *) (reply + 1); + for (i = 0; i < nBox; i++) + { + pRect[i].x = pBox[i].x1; + pRect[i].y = pBox[i].y1; + pRect[i].width = pBox[i].x2 - pBox[i].x1; + pRect[i].height = pBox[i].y2 - pBox[i].y1; + } + if (client->swapped) + { + int n; + swaps (&reply->sequenceNumber, n); + swapl (&reply->length, n); + swaps (&reply->x, n); + swaps (&reply->y, n); + swaps (&reply->width, n); + swaps (&reply->height, n); + SwapShorts ((INT16 *) pRect, nBox * 4); + } + (void) WriteToClient(client, sizeof (xXFixesFetchRegionReply) + + nBox * sizeof (xRectangle), (char *) reply); + free(reply); + return Success; +} + +int +SProcXFixesFetchRegion (ClientPtr client) +{ + int n; + REQUEST(xXFixesFetchRegionReq); + + swaps (&stuff->length, n); + REQUEST_SIZE_MATCH(xXFixesFetchRegionReq); + swapl (&stuff->region, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +int +ProcXFixesSetGCClipRegion (ClientPtr client) +{ + GCPtr pGC; + RegionPtr pRegion; + ChangeGCVal vals[2]; + int rc; + REQUEST(xXFixesSetGCClipRegionReq); + REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq); + + rc = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess); + if (rc != Success) + return rc; + + VERIFY_REGION_OR_NONE (pRegion, stuff->region, client, DixReadAccess); + + if (pRegion) + { + pRegion = XFixesRegionCopy (pRegion); + if (!pRegion) + return BadAlloc; + } + + vals[0].val = stuff->xOrigin; + vals[1].val = stuff->yOrigin; + ChangeGC (NullClient, pGC, GCClipXOrigin|GCClipYOrigin, vals); + (*pGC->funcs->ChangeClip)(pGC, pRegion ? CT_REGION : CT_NONE, (pointer)pRegion, 0); + + return Success; +} + +int +SProcXFixesSetGCClipRegion (ClientPtr client) +{ + int n; + REQUEST(xXFixesSetGCClipRegionReq); + + swaps (&stuff->length, n); + REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq); + swapl (&stuff->gc, n); + swapl (&stuff->region, n); + swaps (&stuff->xOrigin, n); + swaps (&stuff->yOrigin, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +typedef RegionPtr (*CreateDftPtr)(WindowPtr pWin); + +int +ProcXFixesSetWindowShapeRegion (ClientPtr client) +{ + WindowPtr pWin; + RegionPtr pRegion; + RegionPtr *pDestRegion; + int rc; + REQUEST(xXFixesSetWindowShapeRegionReq); + + REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq); + rc = dixLookupResourceByType((pointer *)&pWin, stuff->dest, RT_WINDOW, + client, DixSetAttrAccess); + if (rc != Success) + { + client->errorValue = stuff->dest; + return rc; + } + VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixWriteAccess); + switch (stuff->destKind) { + case ShapeBounding: + case ShapeClip: + case ShapeInput: + break; + default: + client->errorValue = stuff->destKind; + return BadValue; + } + if (pRegion) + { + pRegion = XFixesRegionCopy (pRegion); + if (!pRegion) + return BadAlloc; + if (!pWin->optional) + MakeWindowOptional (pWin); + switch (stuff->destKind) { + default: + case ShapeBounding: + pDestRegion = &pWin->optional->boundingShape; + break; + case ShapeClip: + pDestRegion = &pWin->optional->clipShape; + break; + case ShapeInput: + pDestRegion = &pWin->optional->inputShape; + break; + } + if (stuff->xOff || stuff->yOff) + RegionTranslate(pRegion, stuff->xOff, stuff->yOff); + } + else + { + if (pWin->optional) + { + switch (stuff->destKind) { + default: + case ShapeBounding: + pDestRegion = &pWin->optional->boundingShape; + break; + case ShapeClip: + pDestRegion = &pWin->optional->clipShape; + break; + case ShapeInput: + pDestRegion = &pWin->optional->inputShape; + break; + } + } + else + pDestRegion = &pRegion; /* a NULL region pointer */ + } + if (*pDestRegion) + RegionDestroy(*pDestRegion); + *pDestRegion = pRegion; + (*pWin->drawable.pScreen->SetShape) (pWin, stuff->destKind); + SendShapeNotify (pWin, stuff->destKind); + return Success; +} + +int +SProcXFixesSetWindowShapeRegion (ClientPtr client) +{ + int n; + REQUEST(xXFixesSetWindowShapeRegionReq); + + swaps (&stuff->length, n); + REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq); + swapl (&stuff->dest, n); + swaps (&stuff->xOff, n); + swaps (&stuff->yOff, n); + swapl (&stuff->region, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +int +ProcXFixesSetPictureClipRegion (ClientPtr client) +{ + PicturePtr pPicture; + RegionPtr pRegion; + ScreenPtr pScreen; + REQUEST(xXFixesSetPictureClipRegionReq); + + REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq); + VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess); + pScreen = pPicture->pDrawable->pScreen; + VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess); + + return SetPictureClipRegion (pPicture, stuff->xOrigin, stuff->yOrigin, + pRegion); +} + +int +SProcXFixesSetPictureClipRegion (ClientPtr client) +{ + int n; + REQUEST(xXFixesSetPictureClipRegionReq); + + swaps (&stuff->length, n); + REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq); + swapl (&stuff->picture, n); + swapl (&stuff->region, n); + swaps (&stuff->xOrigin, n); + swaps (&stuff->yOrigin, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +int +ProcXFixesExpandRegion (ClientPtr client) +{ + RegionPtr pSource, pDestination; + REQUEST (xXFixesExpandRegionReq); + BoxPtr pTmp; + BoxPtr pSrc; + int nBoxes; + int i; + + REQUEST_SIZE_MATCH (xXFixesExpandRegionReq); + VERIFY_REGION(pSource, stuff->source, client, DixReadAccess); + VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess); + + nBoxes = RegionNumRects(pSource); + pSrc = RegionRects(pSource); + if (nBoxes) + { + pTmp = malloc(nBoxes * sizeof (BoxRec)); + if (!pTmp) + return BadAlloc; + for (i = 0; i < nBoxes; i++) + { + pTmp[i].x1 = pSrc[i].x1 - stuff->left; + pTmp[i].x2 = pSrc[i].x2 + stuff->right; + pTmp[i].y1 = pSrc[i].y1 - stuff->top; + pTmp[i].y2 = pSrc[i].y2 + stuff->bottom; + } + RegionEmpty(pDestination); + for (i = 0; i < nBoxes; i++) + { + RegionRec r; + RegionInit(&r, &pTmp[i], 0); + RegionUnion(pDestination, pDestination, &r); + } + free(pTmp); + } + return Success; +} + +int +SProcXFixesExpandRegion (ClientPtr client) +{ + int n; + REQUEST (xXFixesExpandRegionReq); + + swaps (&stuff->length, n); + REQUEST_SIZE_MATCH (xXFixesExpandRegionReq); + swapl (&stuff->source, n); + swapl (&stuff->destination, n); + swaps (&stuff->left, n); + swaps (&stuff->right, n); + swaps (&stuff->top, n); + swaps (&stuff->bottom, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +#ifdef PANORAMIX +#include "panoramiX.h" +#include "panoramiXsrv.h" + +int +PanoramiXFixesSetGCClipRegion (ClientPtr client) +{ + REQUEST(xXFixesSetGCClipRegionReq); + int result = Success, j; + PanoramiXRes *gc; + REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq); + + if ((result = dixLookupResourceByType((void **)&gc, stuff->gc, XRT_GC, + client, DixWriteAccess))) { + client->errorValue = stuff->gc; + return result; + } + + FOR_NSCREENS_BACKWARD(j) { + stuff->gc = gc->info[j].id; + result = (*PanoramiXSaveXFixesVector[X_XFixesSetGCClipRegion]) (client); + if(result != Success) break; + } + + return result; +} + +int +PanoramiXFixesSetWindowShapeRegion (ClientPtr client) +{ + int result = Success, j; + PanoramiXRes *win; + REQUEST(xXFixesSetWindowShapeRegionReq); + + REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq); + + if ((result = dixLookupResourceByType((void **)&win, stuff->dest, + XRT_WINDOW, client, + DixWriteAccess))) { + client->errorValue = stuff->dest; + return result; + } + + FOR_NSCREENS_FORWARD(j) { + stuff->dest = win->info[j].id; + result = (*PanoramiXSaveXFixesVector[X_XFixesSetWindowShapeRegion]) (client); + if(result != Success) break; + } + + return result; +} + +int +PanoramiXFixesSetPictureClipRegion (ClientPtr client) +{ + REQUEST(xXFixesSetPictureClipRegionReq); + int result = Success, j; + PanoramiXRes *pict; + + REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq); + + if ((result = dixLookupResourceByType((void **)&pict, stuff->picture, + XRT_PICTURE, client, + DixWriteAccess))) { + client->errorValue = stuff->picture; + return result; + } + + FOR_NSCREENS_BACKWARD(j) { + stuff->picture = pict->info[j].id; + result = (*PanoramiXSaveXFixesVector[X_XFixesSetPictureClipRegion]) (client); + if(result != Success) break; + } + + return result; +} + +#endif diff --git a/xfixes/saveset.c b/xfixes/saveset.c new file mode 100644 index 0000000..35d8e17 --- /dev/null +++ b/xfixes/saveset.c @@ -0,0 +1,72 @@ +/* + * Copyright © 2002 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD 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. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "xfixesint.h" + +int +ProcXFixesChangeSaveSet(ClientPtr client) +{ + Bool toRoot, map; + int result; + WindowPtr pWin; + REQUEST(xXFixesChangeSaveSetReq); + + REQUEST_SIZE_MATCH(xXFixesChangeSaveSetReq); + result = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess); + if (result != Success) + return result; + if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id))) + return BadMatch; + if ((stuff->mode != SetModeInsert) && (stuff->mode != SetModeDelete)) + { + client->errorValue = stuff->mode; + return BadValue; + } + if ((stuff->target != SaveSetNearest) && (stuff->target != SaveSetRoot)) + { + client->errorValue = stuff->target; + return BadValue; + } + if ((stuff->map != SaveSetMap) && (stuff->map != SaveSetUnmap)) + { + client->errorValue = stuff->map; + return BadValue; + } + toRoot = (stuff->target == SaveSetRoot); + map = (stuff->map == SaveSetMap); + return AlterSaveSetForClient(client, pWin, stuff->mode, toRoot, map); +} + +int +SProcXFixesChangeSaveSet(ClientPtr client) +{ + register int n; + REQUEST(xXFixesChangeSaveSetReq); + + swaps(&stuff->length, n); + swapl(&stuff->window, n); + return (*ProcXFixesVector[stuff->xfixesReqType])(client); +} diff --git a/xfixes/select.c b/xfixes/select.c new file mode 100644 index 0000000..baf1ef8 --- /dev/null +++ b/xfixes/select.c @@ -0,0 +1,290 @@ +/* + * Copyright © 2002 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD 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. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "xfixesint.h" +#include "xace.h" + +static RESTYPE SelectionClientType, SelectionWindowType; +static Bool SelectionCallbackRegistered = FALSE; + +/* + * There is a global list of windows selecting for selection events + * on every selection. This should be plenty efficient for the + * expected usage, if it does become a problem, it should be easily + * replaced with a hash table of some kind keyed off the selection atom + */ + +typedef struct _SelectionEvent *SelectionEventPtr; + +typedef struct _SelectionEvent { + SelectionEventPtr next; + Atom selection; + CARD32 eventMask; + ClientPtr pClient; + WindowPtr pWindow; + XID clientResource; +} SelectionEventRec; + +static SelectionEventPtr selectionEvents; + +static void +XFixesSelectionCallback (CallbackListPtr *callbacks, pointer data, pointer args) +{ + SelectionEventPtr e; + SelectionInfoRec *info = (SelectionInfoRec *) args; + Selection *selection = info->selection; + int subtype; + CARD32 eventMask; + + switch (info->kind) { + case SelectionSetOwner: + subtype = XFixesSetSelectionOwnerNotify; + eventMask = XFixesSetSelectionOwnerNotifyMask; + break; + case SelectionWindowDestroy: + subtype = XFixesSelectionWindowDestroyNotify; + eventMask = XFixesSelectionWindowDestroyNotifyMask; + break; + case SelectionClientClose: + subtype = XFixesSelectionClientCloseNotify; + eventMask = XFixesSelectionClientCloseNotifyMask; + break; + default: + return; + } + for (e = selectionEvents; e; e = e->next) + { + if (e->selection == selection->selection && + (e->eventMask & eventMask)) + { + xXFixesSelectionNotifyEvent ev; + + memset(&ev, 0, sizeof(xXFixesSelectionNotifyEvent)); + ev.type = XFixesEventBase + XFixesSelectionNotify; + ev.subtype = subtype; + ev.window = e->pWindow->drawable.id; + if (subtype == XFixesSetSelectionOwnerNotify) + ev.owner = selection->window; + else + ev.owner = 0; + ev.selection = e->selection; + ev.timestamp = currentTime.milliseconds; + ev.selectionTimestamp = selection->lastTimeChanged.milliseconds; + WriteEventsToClient (e->pClient, 1, (xEvent *) &ev); + } + } +} + +static Bool +CheckSelectionCallback (void) +{ + if (selectionEvents) + { + if (!SelectionCallbackRegistered) + { + if (!AddCallback (&SelectionCallback, XFixesSelectionCallback, NULL)) + return FALSE; + SelectionCallbackRegistered = TRUE; + } + } + else + { + if (SelectionCallbackRegistered) + { + DeleteCallback (&SelectionCallback, XFixesSelectionCallback, NULL); + SelectionCallbackRegistered = FALSE; + } + } + return TRUE; +} + +#define SelectionAllEvents (XFixesSetSelectionOwnerNotifyMask |\ + XFixesSelectionWindowDestroyNotifyMask |\ + XFixesSelectionClientCloseNotifyMask) + +static int +XFixesSelectSelectionInput (ClientPtr pClient, + Atom selection, + WindowPtr pWindow, + CARD32 eventMask) +{ + pointer val; + int rc; + SelectionEventPtr *prev, e; + + rc = XaceHook(XACE_SELECTION_ACCESS, pClient, selection, DixGetAttrAccess); + if (rc != Success) + return rc; + + for (prev = &selectionEvents; (e = *prev); prev = &e->next) + { + if (e->selection == selection && + e->pClient == pClient && + e->pWindow == pWindow) + { + break; + } + } + if (!eventMask) + { + if (e) + { + FreeResource (e->clientResource, 0); + } + return Success; + } + if (!e) + { + e = (SelectionEventPtr) malloc(sizeof (SelectionEventRec)); + if (!e) + return BadAlloc; + + e->next = 0; + e->selection = selection; + e->pClient = pClient; + e->pWindow = pWindow; + e->clientResource = FakeClientID(pClient->index); + + /* + * Add a resource hanging from the window to + * catch window destroy + */ + rc = dixLookupResourceByType (&val, pWindow->drawable.id, + SelectionWindowType, serverClient, + DixGetAttrAccess); + if (rc != Success) + if (!AddResource (pWindow->drawable.id, SelectionWindowType, + (pointer) pWindow)) + { + free(e); + return BadAlloc; + } + + if (!AddResource (e->clientResource, SelectionClientType, (pointer) e)) + return BadAlloc; + + *prev = e; + if (!CheckSelectionCallback ()) + { + FreeResource (e->clientResource, 0); + return BadAlloc; + } + } + e->eventMask = eventMask; + return Success; +} + +int +ProcXFixesSelectSelectionInput (ClientPtr client) +{ + REQUEST (xXFixesSelectSelectionInputReq); + WindowPtr pWin; + int rc; + + REQUEST_SIZE_MATCH (xXFixesSelectSelectionInputReq); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); + if (rc != Success) + return rc; + if (stuff->eventMask & ~SelectionAllEvents) + { + client->errorValue = stuff->eventMask; + return BadValue; + } + return XFixesSelectSelectionInput (client, stuff->selection, + pWin, stuff->eventMask); +} + +int +SProcXFixesSelectSelectionInput (ClientPtr client) +{ + register int n; + REQUEST(xXFixesSelectSelectionInputReq); + + swaps(&stuff->length, n); + swapl(&stuff->window, n); + swapl(&stuff->selection, n); + swapl(&stuff->eventMask, n); + return (*ProcXFixesVector[stuff->xfixesReqType])(client); +} + +void +SXFixesSelectionNotifyEvent (xXFixesSelectionNotifyEvent *from, + xXFixesSelectionNotifyEvent *to) +{ + to->type = from->type; + cpswaps (from->sequenceNumber, to->sequenceNumber); + cpswapl (from->window, to->window); + cpswapl (from->owner, to->owner); + cpswapl (from->selection, to->selection); + cpswapl (from->timestamp, to->timestamp); + cpswapl (from->selectionTimestamp, to->selectionTimestamp); +} + +static int +SelectionFreeClient (pointer data, XID id) +{ + SelectionEventPtr old = (SelectionEventPtr) data; + SelectionEventPtr *prev, e; + + for (prev = &selectionEvents; (e = *prev); prev = &e->next) + { + if (e == old) + { + *prev = e->next; + free(e); + CheckSelectionCallback (); + break; + } + } + return 1; +} + +static int +SelectionFreeWindow (pointer data, XID id) +{ + WindowPtr pWindow = (WindowPtr) data; + SelectionEventPtr e, next; + + for (e = selectionEvents; e; e = next) + { + next = e->next; + if (e->pWindow == pWindow) + { + FreeResource (e->clientResource, 0); + } + } + return 1; +} + +Bool +XFixesSelectionInit (void) +{ + SelectionClientType = CreateNewResourceType(SelectionFreeClient, + "XFixesSelectionClient"); + SelectionWindowType = CreateNewResourceType(SelectionFreeWindow, + "XFixesSelectionWindow"); + return SelectionClientType && SelectionWindowType; +} diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c new file mode 100644 index 0000000..e8c7bf1 --- /dev/null +++ b/xfixes/xfixes.c @@ -0,0 +1,294 @@ +/* + * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Copyright © 2002 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD 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. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "xfixesint.h" +#include "protocol-versions.h" +/* + * Must use these instead of the constants from xfixeswire.h. They advertise + * what we implement, not what the protocol headers define. + */ + +static unsigned char XFixesReqCode; +int XFixesEventBase; +int XFixesErrorBase; + +static DevPrivateKeyRec XFixesClientPrivateKeyRec; +#define XFixesClientPrivateKey (&XFixesClientPrivateKeyRec) + +static int +ProcXFixesQueryVersion(ClientPtr client) +{ + XFixesClientPtr pXFixesClient = GetXFixesClient (client); + xXFixesQueryVersionReply rep; + register int n; + REQUEST(xXFixesQueryVersionReq); + + REQUEST_SIZE_MATCH(xXFixesQueryVersionReq); + memset(&rep, 0, sizeof(xXFixesQueryVersionReply)); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + if (stuff->majorVersion < SERVER_XFIXES_MAJOR_VERSION) { + rep.majorVersion = stuff->majorVersion; + rep.minorVersion = stuff->minorVersion; + } else { + rep.majorVersion = SERVER_XFIXES_MAJOR_VERSION; + if (stuff->majorVersion == SERVER_XFIXES_MAJOR_VERSION && + stuff->minorVersion < SERVER_XFIXES_MINOR_VERSION) + rep.minorVersion = stuff->minorVersion; + else + rep.minorVersion = SERVER_XFIXES_MINOR_VERSION; + } + pXFixesClient->major_version = rep.majorVersion; + pXFixesClient->minor_version = rep.minorVersion; + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.majorVersion, n); + swapl(&rep.minorVersion, n); + } + WriteToClient(client, sizeof(xXFixesQueryVersionReply), (char *)&rep); + return Success; +} + +/* Major version controls available requests */ +static const int version_requests[] = { + X_XFixesQueryVersion, /* before client sends QueryVersion */ + X_XFixesGetCursorImage, /* Version 1 */ + X_XFixesChangeCursorByName, /* Version 2 */ + X_XFixesExpandRegion, /* Version 3 */ + X_XFixesShowCursor, /* Version 4 */ +}; + +#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0])) + +int (*ProcXFixesVector[XFixesNumberRequests])(ClientPtr) = { +/*************** Version 1 ******************/ + ProcXFixesQueryVersion, + ProcXFixesChangeSaveSet, + ProcXFixesSelectSelectionInput, + ProcXFixesSelectCursorInput, + ProcXFixesGetCursorImage, +/*************** Version 2 ******************/ + ProcXFixesCreateRegion, + ProcXFixesCreateRegionFromBitmap, + ProcXFixesCreateRegionFromWindow, + ProcXFixesCreateRegionFromGC, + ProcXFixesCreateRegionFromPicture, + ProcXFixesDestroyRegion, + ProcXFixesSetRegion, + ProcXFixesCopyRegion, + ProcXFixesCombineRegion, + ProcXFixesCombineRegion, + ProcXFixesCombineRegion, + ProcXFixesInvertRegion, + ProcXFixesTranslateRegion, + ProcXFixesRegionExtents, + ProcXFixesFetchRegion, + ProcXFixesSetGCClipRegion, + ProcXFixesSetWindowShapeRegion, + ProcXFixesSetPictureClipRegion, + ProcXFixesSetCursorName, + ProcXFixesGetCursorName, + ProcXFixesGetCursorImageAndName, + ProcXFixesChangeCursor, + ProcXFixesChangeCursorByName, +/*************** Version 3 ******************/ + ProcXFixesExpandRegion, +/*************** Version 4 ****************/ + ProcXFixesHideCursor, + ProcXFixesShowCursor, +}; + +static int +ProcXFixesDispatch (ClientPtr client) +{ + REQUEST(xXFixesReq); + XFixesClientPtr pXFixesClient = GetXFixesClient (client); + + if (pXFixesClient->major_version >= NUM_VERSION_REQUESTS) + return BadRequest; + if (stuff->xfixesReqType > version_requests[pXFixesClient->major_version]) + return BadRequest; + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +static int +SProcXFixesQueryVersion(ClientPtr client) +{ + register int n; + REQUEST(xXFixesQueryVersionReq); + + swaps(&stuff->length, n); + swapl(&stuff->majorVersion, n); + swapl(&stuff->minorVersion, n); + return (*ProcXFixesVector[stuff->xfixesReqType]) (client); +} + +static int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr) = { +/*************** Version 1 ******************/ + SProcXFixesQueryVersion, + SProcXFixesChangeSaveSet, + SProcXFixesSelectSelectionInput, + SProcXFixesSelectCursorInput, + SProcXFixesGetCursorImage, +/*************** Version 2 ******************/ + SProcXFixesCreateRegion, + SProcXFixesCreateRegionFromBitmap, + SProcXFixesCreateRegionFromWindow, + SProcXFixesCreateRegionFromGC, + SProcXFixesCreateRegionFromPicture, + SProcXFixesDestroyRegion, + SProcXFixesSetRegion, + SProcXFixesCopyRegion, + SProcXFixesCombineRegion, + SProcXFixesCombineRegion, + SProcXFixesCombineRegion, + SProcXFixesInvertRegion, + SProcXFixesTranslateRegion, + SProcXFixesRegionExtents, + SProcXFixesFetchRegion, + SProcXFixesSetGCClipRegion, + SProcXFixesSetWindowShapeRegion, + SProcXFixesSetPictureClipRegion, + SProcXFixesSetCursorName, + SProcXFixesGetCursorName, + SProcXFixesGetCursorImageAndName, + SProcXFixesChangeCursor, + SProcXFixesChangeCursorByName, +/*************** Version 3 ******************/ + SProcXFixesExpandRegion, +/*************** Version 4 ****************/ + SProcXFixesHideCursor, + SProcXFixesShowCursor, +}; + +static int +SProcXFixesDispatch (ClientPtr client) +{ + REQUEST(xXFixesReq); + if (stuff->xfixesReqType >= XFixesNumberRequests) + return BadRequest; + return (*SProcXFixesVector[stuff->xfixesReqType]) (client); +} + +static void +XFixesClientCallback (CallbackListPtr *list, + pointer closure, + pointer data) +{ + NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; + ClientPtr pClient = clientinfo->client; + XFixesClientPtr pXFixesClient = GetXFixesClient (pClient); + + pXFixesClient->major_version = 0; + pXFixesClient->minor_version = 0; +} + +/*ARGSUSED*/ +static void +XFixesResetProc (ExtensionEntry *extEntry) +{ + DeleteCallback (&ClientStateCallback, XFixesClientCallback, 0); +} + +void +XFixesExtensionInit(void) +{ + ExtensionEntry *extEntry; + + if (!dixRegisterPrivateKey(&XFixesClientPrivateKeyRec, PRIVATE_CLIENT, sizeof (XFixesClientRec))) + return; + if (!AddCallback (&ClientStateCallback, XFixesClientCallback, 0)) + return; + + if (XFixesSelectionInit() && XFixesCursorInit () && XFixesRegionInit () && + (extEntry = AddExtension(XFIXES_NAME, XFixesNumberEvents, + XFixesNumberErrors, + ProcXFixesDispatch, SProcXFixesDispatch, + XFixesResetProc, StandardMinorOpcode)) != 0) + { + XFixesReqCode = (unsigned char)extEntry->base; + XFixesEventBase = extEntry->eventBase; + XFixesErrorBase = extEntry->errorBase; + EventSwapVector[XFixesEventBase + XFixesSelectionNotify] = + (EventSwapPtr) SXFixesSelectionNotifyEvent; + EventSwapVector[XFixesEventBase + XFixesCursorNotify] = + (EventSwapPtr) SXFixesCursorNotifyEvent; + SetResourceTypeErrorValue(RegionResType, XFixesErrorBase + BadRegion); + } +} + +#ifdef PANORAMIX + +int (*PanoramiXSaveXFixesVector[XFixesNumberRequests])(ClientPtr); + +void +PanoramiXFixesInit (void) +{ + int i; + + for (i = 0; i < XFixesNumberRequests; i++) + PanoramiXSaveXFixesVector[i] = ProcXFixesVector[i]; + /* + * Stuff in Xinerama aware request processing hooks + */ + ProcXFixesVector[X_XFixesSetGCClipRegion] = PanoramiXFixesSetGCClipRegion; + ProcXFixesVector[X_XFixesSetWindowShapeRegion] = PanoramiXFixesSetWindowShapeRegion; + ProcXFixesVector[X_XFixesSetPictureClipRegion] = PanoramiXFixesSetPictureClipRegion; +} + +void +PanoramiXFixesReset (void) +{ + int i; + + for (i = 0; i < XFixesNumberRequests; i++) + ProcXFixesVector[i] = PanoramiXSaveXFixesVector[i]; +} + +#endif diff --git a/xfixes/xfixes.h b/xfixes/xfixes.h new file mode 100644 index 0000000..1638350 --- /dev/null +++ b/xfixes/xfixes.h @@ -0,0 +1,55 @@ +/* + * Copyright © 2002 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD 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. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#ifndef _XFIXES_H_ +#define _XFIXES_H_ + +#include "resource.h" + +extern _X_EXPORT RESTYPE RegionResType; +extern _X_EXPORT int XFixesErrorBase; + +#define VERIFY_REGION(pRegion, rid, client, mode) \ + do { \ + int err; \ + err = dixLookupResourceByType((pointer *) &pRegion, rid, \ + RegionResType, client, mode); \ + if (err != Success) { \ + client->errorValue = rid; \ + return err; \ + } \ + } while (0) + +#define VERIFY_REGION_OR_NONE(pRegion, rid, client, mode) { \ + pRegion = 0; \ + if (rid) VERIFY_REGION(pRegion, rid, client, mode); \ +} + +extern _X_EXPORT RegionPtr +XFixesRegionCopy (RegionPtr pRegion); + + +#endif /* _XFIXES_H_ */ diff --git a/xfixes/xfixesint.h b/xfixes/xfixesint.h new file mode 100644 index 0000000..d005369 --- /dev/null +++ b/xfixes/xfixesint.h @@ -0,0 +1,285 @@ +/* + * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Copyright © 2002 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD 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. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#ifndef _XFIXESINT_H_ +#define _XFIXESINT_H_ + +#include <X11/X.h> +#include <X11/Xproto.h> +#include "misc.h" +#include "os.h" +#include "dixstruct.h" +#include "extnsionst.h" +#include <X11/extensions/xfixesproto.h> +#include "windowstr.h" +#include "selection.h" +#include "xfixes.h" + +extern int XFixesEventBase; + +typedef struct _XFixesClient { + CARD32 major_version; + CARD32 minor_version; +} XFixesClientRec, *XFixesClientPtr; + +#define GetXFixesClient(pClient) ((XFixesClientPtr)dixLookupPrivate(&(pClient)->devPrivates, XFixesClientPrivateKey)) + +extern int (*ProcXFixesVector[XFixesNumberRequests])(ClientPtr); + +/* Initialize extension at server startup time */ + +void +XFixesExtensionInit(void); + +/* Save set */ +int +ProcXFixesChangeSaveSet(ClientPtr client); + +int +SProcXFixesChangeSaveSet(ClientPtr client); + +/* Selection events */ +int +ProcXFixesSelectSelectionInput (ClientPtr client); + +int +SProcXFixesSelectSelectionInput (ClientPtr client); + +void +SXFixesSelectionNotifyEvent (xXFixesSelectionNotifyEvent *from, + xXFixesSelectionNotifyEvent *to); +Bool +XFixesSelectionInit (void); + +/* Cursor notification */ +Bool +XFixesCursorInit (void); + +int +ProcXFixesSelectCursorInput (ClientPtr client); + +int +SProcXFixesSelectCursorInput (ClientPtr client); + +void +SXFixesCursorNotifyEvent (xXFixesCursorNotifyEvent *from, + xXFixesCursorNotifyEvent *to); + +int +ProcXFixesGetCursorImage (ClientPtr client); + +int +SProcXFixesGetCursorImage (ClientPtr client); + +/* Cursor names (Version 2) */ + +int +ProcXFixesSetCursorName (ClientPtr client); + +int +SProcXFixesSetCursorName (ClientPtr client); + +int +ProcXFixesGetCursorName (ClientPtr client); + +int +SProcXFixesGetCursorName (ClientPtr client); + +int +ProcXFixesGetCursorImageAndName (ClientPtr client); + +int +SProcXFixesGetCursorImageAndName (ClientPtr client); + +/* Cursor replacement (Version 2) */ + +int +ProcXFixesChangeCursor (ClientPtr client); + +int +SProcXFixesChangeCursor (ClientPtr client); + +int +ProcXFixesChangeCursorByName (ClientPtr client); + +int +SProcXFixesChangeCursorByName (ClientPtr client); + +/* Region objects (Version 2* */ +Bool +XFixesRegionInit (void); + +int +ProcXFixesCreateRegion (ClientPtr client); + +int +SProcXFixesCreateRegion (ClientPtr client); + +int +ProcXFixesCreateRegionFromBitmap (ClientPtr client); + +int +SProcXFixesCreateRegionFromBitmap (ClientPtr client); + +int +ProcXFixesCreateRegionFromWindow (ClientPtr client); + +int +SProcXFixesCreateRegionFromWindow (ClientPtr client); + +int +ProcXFixesCreateRegionFromGC (ClientPtr client); + +int +SProcXFixesCreateRegionFromGC (ClientPtr client); + +int +ProcXFixesCreateRegionFromPicture (ClientPtr client); + +int +SProcXFixesCreateRegionFromPicture (ClientPtr client); + +int +ProcXFixesDestroyRegion (ClientPtr client); + +int +SProcXFixesDestroyRegion (ClientPtr client); + +int +ProcXFixesSetRegion (ClientPtr client); + +int +SProcXFixesSetRegion (ClientPtr client); + +int +ProcXFixesCopyRegion (ClientPtr client); + +int +SProcXFixesCopyRegion (ClientPtr client); + +int +ProcXFixesCombineRegion (ClientPtr client); + +int +SProcXFixesCombineRegion (ClientPtr client); + +int +ProcXFixesInvertRegion (ClientPtr client); + +int +SProcXFixesInvertRegion (ClientPtr client); + +int +ProcXFixesTranslateRegion (ClientPtr client); + +int +SProcXFixesTranslateRegion (ClientPtr client); + +int +ProcXFixesRegionExtents (ClientPtr client); + +int +SProcXFixesRegionExtents (ClientPtr client); + +int +ProcXFixesFetchRegion (ClientPtr client); + +int +SProcXFixesFetchRegion (ClientPtr client); + +int +ProcXFixesSetGCClipRegion (ClientPtr client); + +int +SProcXFixesSetGCClipRegion (ClientPtr client); + +int +ProcXFixesSetWindowShapeRegion (ClientPtr client); + +int +SProcXFixesSetWindowShapeRegion (ClientPtr client); + +int +ProcXFixesSetPictureClipRegion (ClientPtr client); + +int +SProcXFixesSetPictureClipRegion (ClientPtr client); + +int +ProcXFixesExpandRegion (ClientPtr client); + +int +SProcXFixesExpandRegion (ClientPtr client); + +int +PanoramiXFixesSetGCClipRegion (ClientPtr client); + +int +PanoramiXFixesSetWindowShapeRegion (ClientPtr client); + +int +PanoramiXFixesSetPictureClipRegion (ClientPtr client); + +/* Cursor Visibility (Version 4) */ + +int +ProcXFixesHideCursor (ClientPtr client); + +int +SProcXFixesHideCursor (ClientPtr client); + +int +ProcXFixesShowCursor (ClientPtr client); + +int +SProcXFixesShowCursor (ClientPtr client); + +extern int (*PanoramiXSaveXFixesVector[XFixesNumberRequests])(ClientPtr); +void PanoramiXFixesInit (void); +void PanoramiXFixesReset (void); + +#endif /* _XFIXESINT_H_ */ |