diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2008-11-02 15:26:35 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2008-11-02 15:26:35 +0000 |
commit | dbca69c8a4f3e2d1ccb4f89152213b2861b33af6 (patch) | |
tree | f8963ef73903a7b4374adc2354dffbaa905112ac /xserver/dix | |
parent | 33b2029f322f3c238b7ba528083195ad8dde33e1 (diff) |
xserver 1.5.2. tested by ckuethe@, oga@, and others.
Diffstat (limited to 'xserver/dix')
29 files changed, 5360 insertions, 2951 deletions
diff --git a/xserver/dix/Makefile.am b/xserver/dix/Makefile.am index d26d9ea7a..eb5e77946 100644 --- a/xserver/dix/Makefile.am +++ b/xserver/dix/Makefile.am @@ -1,13 +1,20 @@ -noinst_LTLIBRARIES = libdix.la libxpstubs.la +standard_dix_libs = libdix.la libxpstubs.la + +if XPRINT +noinst_LTLIBRARIES = $(standard_dix_libs) libXpdix.la +else +noinst_LTLIBRARIES = $(standard_dix_libs) +endif AM_CFLAGS = $(DIX_CFLAGS) \ - -DVENDOR_STRING=\""@VENDOR_STRING@"\" \ + -DVENDOR_NAME=\""@VENDOR_NAME@"\" \ -DVENDOR_RELEASE="@VENDOR_RELEASE@" libdix_la_SOURCES = \ atom.c \ colormap.c \ cursor.c \ + deprecated.c \ devices.c \ dispatch.c \ dispatch.h \ @@ -17,6 +24,7 @@ libdix_la_SOURCES = \ extension.c \ ffs.c \ gc.c \ + getevents.c \ globals.c \ glyphcurs.c \ grabs.c \ @@ -25,16 +33,50 @@ libdix_la_SOURCES = \ pixmap.c \ privates.c \ property.c \ + registry.c \ resource.c \ + selection.c \ swaprep.c \ swapreq.c \ tables.c \ window.c \ - strcasecmp.c + strcasecmp.c \ + strcasestr.c libxpstubs_la_SOURCES = \ xpstubs.c -INCLUDES = -I$(top_srcdir)/Xprint +if XPRINT +libXpdix_la_SOURCES = $(libdix_la_SOURCES) +libXpdix_la_CPPFLAGS = -I$(top_srcdir)/hw/xprint +libXpdix_la_CFLAGS = $(AM_CFLAGS) $(XPRINT_CFLAGS) +endif + +EXTRA_DIST = buildatoms BuiltInAtoms CHANGES Xserver.d Xserver-dtrace.h.in + +# Install list of protocol names +miscconfigdir = $(SERVER_MISC_CONFIG_PATH) +dist_miscconfig_DATA = protocol.txt + +if XSERVER_DTRACE +# Generate dtrace header file for C sources to include +BUILT_SOURCES = Xserver-dtrace.h + +Xserver-dtrace.h: $(srcdir)/Xserver.d + $(DTRACE) -C -h -o $@ -s $(srcdir)/Xserver.d \ + || cp Xserver-dtrace.h.in $@ + +# Generate dtrace object code for probes in libdix +dtrace-dix.o: $(top_srcdir)/dix/Xserver.d $(am_libdix_la_OBJECTS) + $(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d .libs/*.o + +noinst_PROGRAMS = dix.O + +dix.O: dtrace-dix.o $(am_libdix_la_OBJECTS) + ld -r -o $@ .libs/*.o +endif + +dix.c: + touch $@ -EXTRA_DIST = buildatoms BuiltInAtoms CHANGES +CLEANFILES = dix.c diff --git a/xserver/dix/Makefile.in b/xserver/dix/Makefile.in index c3f3fbd48..254bc5710 100644 --- a/xserver/dix/Makefile.in +++ b/xserver/dix/Makefile.in @@ -15,6 +15,7 @@ @SET_MAKE@ + srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -39,7 +40,8 @@ build_triplet = @build@ host_triplet = @host@ @XSERVER_DTRACE_TRUE@noinst_PROGRAMS = dix.O$(EXEEXT) subdir = dix -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +DIST_COMMON = $(dist_miscconfig_DATA) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac @@ -56,17 +58,46 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/kdrive-config.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) +libXpdix_la_LIBADD = +am__libXpdix_la_SOURCES_DIST = atom.c colormap.c cursor.c deprecated.c \ + devices.c dispatch.c dispatch.h dixfonts.c dixutils.c events.c \ + extension.c ffs.c gc.c getevents.c globals.c glyphcurs.c \ + grabs.c initatoms.c main.c pixmap.c privates.c property.c \ + registry.c resource.c selection.c swaprep.c swapreq.c tables.c \ + window.c strcasecmp.c strcasestr.c +am__objects_1 = libXpdix_la-atom.lo libXpdix_la-colormap.lo \ + libXpdix_la-cursor.lo libXpdix_la-deprecated.lo \ + libXpdix_la-devices.lo libXpdix_la-dispatch.lo \ + libXpdix_la-dixfonts.lo libXpdix_la-dixutils.lo \ + libXpdix_la-events.lo libXpdix_la-extension.lo \ + libXpdix_la-ffs.lo libXpdix_la-gc.lo libXpdix_la-getevents.lo \ + libXpdix_la-globals.lo libXpdix_la-glyphcurs.lo \ + libXpdix_la-grabs.lo libXpdix_la-initatoms.lo \ + libXpdix_la-main.lo libXpdix_la-pixmap.lo \ + libXpdix_la-privates.lo libXpdix_la-property.lo \ + libXpdix_la-registry.lo libXpdix_la-resource.lo \ + libXpdix_la-selection.lo libXpdix_la-swaprep.lo \ + libXpdix_la-swapreq.lo libXpdix_la-tables.lo \ + libXpdix_la-window.lo libXpdix_la-strcasecmp.lo \ + libXpdix_la-strcasestr.lo +@XPRINT_TRUE@am_libXpdix_la_OBJECTS = $(am__objects_1) +libXpdix_la_OBJECTS = $(am_libXpdix_la_OBJECTS) +@XPRINT_TRUE@am_libXpdix_la_rpath = libdix_la_LIBADD = -am_libdix_la_OBJECTS = atom.lo colormap.lo cursor.lo devices.lo \ - dispatch.lo dixfonts.lo dixutils.lo events.lo extension.lo \ - ffs.lo gc.lo getevents.lo globals.lo glyphcurs.lo grabs.lo \ - initatoms.lo main.lo pixmap.lo privates.lo property.lo \ - resource.lo swaprep.lo swapreq.lo tables.lo window.lo \ - strcasecmp.lo +am_libdix_la_OBJECTS = atom.lo colormap.lo cursor.lo deprecated.lo \ + devices.lo dispatch.lo dixfonts.lo dixutils.lo events.lo \ + extension.lo ffs.lo gc.lo getevents.lo globals.lo glyphcurs.lo \ + grabs.lo initatoms.lo main.lo pixmap.lo privates.lo \ + property.lo registry.lo resource.lo selection.lo swaprep.lo \ + swapreq.lo tables.lo window.lo strcasecmp.lo strcasestr.lo libdix_la_OBJECTS = $(am_libdix_la_OBJECTS) +@XPRINT_FALSE@am_libdix_la_rpath = +@XPRINT_TRUE@am_libdix_la_rpath = libxpstubs_la_LIBADD = am_libxpstubs_la_OBJECTS = xpstubs.lo libxpstubs_la_OBJECTS = $(am_libxpstubs_la_OBJECTS) +@XPRINT_FALSE@am_libxpstubs_la_rpath = +@XPRINT_TRUE@am_libxpstubs_la_rpath = PROGRAMS = $(noinst_PROGRAMS) dix_O_SOURCES = dix.c dix_O_OBJECTS = dix.$(OBJEXT) @@ -82,8 +113,19 @@ LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libdix_la_SOURCES) $(libxpstubs_la_SOURCES) dix.c -DIST_SOURCES = $(libdix_la_SOURCES) $(libxpstubs_la_SOURCES) dix.c +SOURCES = $(libXpdix_la_SOURCES) $(libdix_la_SOURCES) \ + $(libxpstubs_la_SOURCES) dix.c +DIST_SOURCES = $(am__libXpdix_la_SOURCES_DIST) $(libdix_la_SOURCES) \ + $(libxpstubs_la_SOURCES) dix.c +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 = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(miscconfigdir)" +dist_miscconfigDATA_INSTALL = $(INSTALL_DATA) +DATA = $(dist_miscconfig_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -125,8 +167,6 @@ BSD_KQUEUE_APM_FALSE = @BSD_KQUEUE_APM_FALSE@ BSD_KQUEUE_APM_TRUE = @BSD_KQUEUE_APM_TRUE@ BUILDDOCS_FALSE = @BUILDDOCS_FALSE@ BUILDDOCS_TRUE = @BUILDDOCS_TRUE@ -BUILD_DARWIN_FALSE = @BUILD_DARWIN_FALSE@ -BUILD_DARWIN_TRUE = @BUILD_DARWIN_TRUE@ BUILD_DATE = @BUILD_DATE@ BUILD_IOPORT_FALSE = @BUILD_IOPORT_FALSE@ BUILD_IOPORT_TRUE = @BUILD_IOPORT_TRUE@ @@ -198,6 +238,10 @@ DMX_FALSE = @DMX_FALSE@ DMX_TRUE = @DMX_TRUE@ DPMSExtension_FALSE = @DPMSExtension_FALSE@ DPMSExtension_TRUE = @DPMSExtension_TRUE@ +DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ +DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ +DRI2_FALSE = @DRI2_FALSE@ +DRI2_TRUE = @DRI2_TRUE@ DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ @@ -227,7 +271,7 @@ FREEBSD_KLDLOAD_FALSE = @FREEBSD_KLDLOAD_FALSE@ FREEBSD_KLDLOAD_TRUE = @FREEBSD_KLDLOAD_TRUE@ FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ FREETYPE_LIBS = @FREETYPE_LIBS@ -FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_FALSE = @GLX_FALSE@ GLX_TRUE = @GLX_TRUE@ @@ -241,8 +285,8 @@ HAVE_AGL_FRAMEWORK_FALSE = @HAVE_AGL_FRAMEWORK_FALSE@ HAVE_AGL_FRAMEWORK_TRUE = @HAVE_AGL_FRAMEWORK_TRUE@ HAVE_DBUS_FALSE = @HAVE_DBUS_FALSE@ HAVE_DBUS_TRUE = @HAVE_DBUS_TRUE@ -HAVE_X_PLUGIN_FALSE = @HAVE_X_PLUGIN_FALSE@ -HAVE_X_PLUGIN_TRUE = @HAVE_X_PLUGIN_TRUE@ +HAVE_XPLUGIN_FALSE = @HAVE_XPLUGIN_FALSE@ +HAVE_XPLUGIN_TRUE = @HAVE_XPLUGIN_TRUE@ HP300_VIDEO_FALSE = @HP300_VIDEO_FALSE@ HP300_VIDEO_TRUE = @HP300_VIDEO_TRUE@ HPPA_VIDEO_FALSE = @HPPA_VIDEO_FALSE@ @@ -283,6 +327,9 @@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KDRIVE_TRUE = @KDRIVE_TRUE@ +LAUNCHD = @LAUNCHD@ +LAUNCHD_FALSE = @LAUNCHD_FALSE@ +LAUNCHD_TRUE = @LAUNCHD_TRUE@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LEX = @LEX@ @@ -337,6 +384,8 @@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -344,12 +393,11 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ +PCIACCESS_LIBS = @PCIACCESS_LIBS@ +PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ PERL = @PERL@ -PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ -PIXMAN_LIBS = @PIXMAN_LIBS@ PKG_CONFIG = @PKG_CONFIG@ -PLIST_VENDOR_WEB = @PLIST_VENDOR_WEB@ -PLIST_VERSION_STRING = @PLIST_VERSION_STRING@ PPC_VIDEO_FALSE = @PPC_VIDEO_FALSE@ PPC_VIDEO_TRUE = @PPC_VIDEO_TRUE@ PROJECTROOT = @PROJECTROOT@ @@ -361,13 +409,12 @@ RECORD_FALSE = @RECORD_FALSE@ RECORD_TRUE = @RECORD_TRUE@ RES_FALSE = @RES_FALSE@ RES_TRUE = @RES_TRUE@ -RGB_DB = @RGB_DB@ SCREENSAVER_FALSE = @SCREENSAVER_FALSE@ SCREENSAVER_TRUE = @SCREENSAVER_TRUE@ SECURE_RPC_FALSE = @SECURE_RPC_FALSE@ SECURE_RPC_TRUE = @SECURE_RPC_TRUE@ SED = @SED@ -SERVERCONFIGdir = @SERVERCONFIGdir@ +SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SGI_VIDEO_FALSE = @SGI_VIDEO_FALSE@ SGI_VIDEO_TRUE = @SGI_VIDEO_TRUE@ @@ -383,20 +430,21 @@ SPARC64_VIDEO_TRUE = @SPARC64_VIDEO_TRUE@ STRIP = @STRIP@ SUN_KBD_MODE_FALSE = @SUN_KBD_MODE_FALSE@ SUN_KBD_MODE_TRUE = @SUN_KBD_MODE_TRUE@ -SYS_LIBS = @SYS_LIBS@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_FALSE = @TSLIB_FALSE@ TSLIB_LIBS = @TSLIB_LIBS@ TSLIB_TRUE = @TSLIB_TRUE@ USE_CURSES_FALSE = @USE_CURSES_FALSE@ USE_CURSES_TRUE = @USE_CURSES_TRUE@ -USE_RGB_BUILTIN_FALSE = @USE_RGB_BUILTIN_FALSE@ -USE_RGB_BUILTIN_TRUE = @USE_RGB_BUILTIN_TRUE@ +UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@ VENDOR_NAME = @VENDOR_NAME@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VENDOR_RELEASE = @VENDOR_RELEASE@ VERSION = @VERSION@ +X11APP_ARCHS = @X11APP_ARCHS@ +X11APP_FALSE = @X11APP_FALSE@ +X11APP_TRUE = @X11APP_TRUE@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XACE_FALSE = @XACE_FALSE@ @@ -413,18 +461,22 @@ XDMCP_LIBS = @XDMCP_LIBS@ XDMCP_TRUE = @XDMCP_TRUE@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ +XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ +XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@ -XEGLMODULES_LIBS = @XEGLMODULES_LIBS@ XEGL_FALSE = @XEGL_FALSE@ XEGL_LIBS = @XEGL_LIBS@ +XEGL_SYS_LIBS = @XEGL_SYS_LIBS@ XEGL_TRUE = @XEGL_TRUE@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ +XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@ XEPHYR_FALSE = @XEPHYR_FALSE@ +XEPHYR_HAS_DRI_FALSE = @XEPHYR_HAS_DRI_FALSE@ +XEPHYR_HAS_DRI_TRUE = @XEPHYR_HAS_DRI_TRUE@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XEPHYR_TRUE = @XEPHYR_TRUE@ -XERRORDB_PATH = @XERRORDB_PATH@ XEVIE_FALSE = @XEVIE_FALSE@ XEVIE_TRUE = @XEVIE_TRUE@ XF86BIGFONT_FALSE = @XF86BIGFONT_FALSE@ @@ -448,10 +500,12 @@ XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@ XGLXMODULES_LIBS = @XGLXMODULES_LIBS@ XGLX_FALSE = @XGLX_FALSE@ XGLX_LIBS = @XGLX_LIBS@ +XGLX_SYS_LIBS = @XGLX_SYS_LIBS@ XGLX_TRUE = @XGLX_TRUE@ XGL_FALSE = @XGL_FALSE@ XGL_LIBS = @XGL_LIBS@ XGL_MODULE_PATH = @XGL_MODULE_PATH@ +XGL_SYS_LIBS = @XGL_SYS_LIBS@ XGL_TRUE = @XGL_TRUE@ XINERAMA_FALSE = @XINERAMA_FALSE@ XINERAMA_TRUE = @XINERAMA_TRUE@ @@ -465,19 +519,18 @@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_FALSE = @XNEST_FALSE@ XNEST_LIBS = @XNEST_LIBS@ +XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XNEST_TRUE = @XNEST_TRUE@ XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@ XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@ XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@ XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@ -XORG_BUS_FREEBSDPCI_FALSE = @XORG_BUS_FREEBSDPCI_FALSE@ -XORG_BUS_FREEBSDPCI_TRUE = @XORG_BUS_FREEBSDPCI_TRUE@ +XORG_BUS_BSDPCI_FALSE = @XORG_BUS_BSDPCI_FALSE@ +XORG_BUS_BSDPCI_TRUE = @XORG_BUS_BSDPCI_TRUE@ XORG_BUS_IX86PCI_FALSE = @XORG_BUS_IX86PCI_FALSE@ XORG_BUS_IX86PCI_TRUE = @XORG_BUS_IX86PCI_TRUE@ XORG_BUS_LINUXPCI_FALSE = @XORG_BUS_LINUXPCI_FALSE@ XORG_BUS_LINUXPCI_TRUE = @XORG_BUS_LINUXPCI_TRUE@ -XORG_BUS_NETBSDPCI_FALSE = @XORG_BUS_NETBSDPCI_FALSE@ -XORG_BUS_NETBSDPCI_TRUE = @XORG_BUS_NETBSDPCI_TRUE@ XORG_BUS_PPCPCI_FALSE = @XORG_BUS_PPCPCI_FALSE@ XORG_BUS_PPCPCI_TRUE = @XORG_BUS_PPCPCI_TRUE@ XORG_BUS_SPARCPCI_FALSE = @XORG_BUS_SPARCPCI_FALSE@ @@ -485,7 +538,6 @@ XORG_BUS_SPARCPCI_TRUE = @XORG_BUS_SPARCPCI_TRUE@ XORG_BUS_SPARC_FALSE = @XORG_BUS_SPARC_FALSE@ XORG_BUS_SPARC_TRUE = @XORG_BUS_SPARC_TRUE@ XORG_CFLAGS = @XORG_CFLAGS@ -XORG_CORE_LIBS = @XORG_CORE_LIBS@ XORG_FALSE = @XORG_FALSE@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ @@ -495,23 +547,31 @@ XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XORG_SYS_LIBS = @XORG_SYS_LIBS@ XORG_TRUE = @XORG_TRUE@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ XPRINT_CFLAGS = @XPRINT_CFLAGS@ XPRINT_FALSE = @XPRINT_FALSE@ XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ XPRINT_TRUE = @XPRINT_TRUE@ XP_USE_FREETYPE_FALSE = @XP_USE_FREETYPE_FALSE@ XP_USE_FREETYPE_TRUE = @XP_USE_FREETYPE_TRUE@ XQUARTZ_FALSE = @XQUARTZ_FALSE@ XQUARTZ_TRUE = @XQUARTZ_TRUE@ +XREGISTRY_FALSE = @XREGISTRY_FALSE@ +XREGISTRY_TRUE = @XREGISTRY_TRUE@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDLSERVER_FALSE = @XSDLSERVER_FALSE@ XSDLSERVER_TRUE = @XSDLSERVER_TRUE@ XSDL_INCS = @XSDL_INCS@ XSDL_LIBS = @XSDL_LIBS@ +XSELINUX_FALSE = @XSELINUX_FALSE@ +XSELINUX_TRUE = @XSELINUX_TRUE@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ @@ -519,12 +579,14 @@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ XSERVER_DTRACE_FALSE = @XSERVER_DTRACE_FALSE@ XSERVER_DTRACE_TRUE = @XSERVER_DTRACE_TRUE@ XSERVER_LIBS = @XSERVER_LIBS@ +XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ XTRAP_FALSE = @XTRAP_FALSE@ XTRAP_TRUE = @XTRAP_TRUE@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ XVFB_FALSE = @XVFB_FALSE@ XVFB_LIBS = @XVFB_LIBS@ +XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ XVFB_TRUE = @XVFB_TRUE@ XVMC_FALSE = @XVMC_FALSE@ XVMC_TRUE = @XVMC_TRUE@ @@ -549,7 +611,7 @@ XWIN_PRIMARYFB_TRUE = @XWIN_PRIMARYFB_TRUE@ XWIN_RANDR_FALSE = @XWIN_RANDR_FALSE@ XWIN_RANDR_TRUE = @XWIN_RANDR_TRUE@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ -XWIN_SYSTEM_LIBS = @XWIN_SYSTEM_LIBS@ +XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ XWIN_TRUE = @XWIN_TRUE@ XWIN_XV_FALSE = @XWIN_XV_FALSE@ XWIN_XV_TRUE = @XWIN_XV_TRUE@ @@ -557,6 +619,11 @@ X_PRIVSEP_FALSE = @X_PRIVSEP_FALSE@ X_PRIVSEP_TRUE = @X_PRIVSEP_TRUE@ YACC = @YACC@ __XCONFIGFILE__ = @__XCONFIGFILE__@ +abi_ansic = @abi_ansic@ +abi_extension = @abi_extension@ +abi_font = @abi_font@ +abi_videodrv = @abi_videodrv@ +abi_xinput = @abi_xinput@ ac_ct_AR = @ac_ct_AR@ ac_ct_AS = @ac_ct_AS@ ac_ct_CC = @ac_ct_CC@ @@ -599,6 +666,7 @@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ +launchagentsdir = @launchagentsdir@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ @@ -616,7 +684,9 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ xglmoduledir = @xglmoduledir@ xpconfigdir = @xpconfigdir@ -noinst_LTLIBRARIES = libdix.la libxpstubs.la +standard_dix_libs = libdix.la libxpstubs.la +@XPRINT_FALSE@noinst_LTLIBRARIES = $(standard_dix_libs) +@XPRINT_TRUE@noinst_LTLIBRARIES = $(standard_dix_libs) libXpdix.la AM_CFLAGS = $(DIX_CFLAGS) \ -DVENDOR_NAME=\""@VENDOR_NAME@"\" \ -DVENDOR_RELEASE="@VENDOR_RELEASE@" @@ -625,6 +695,7 @@ libdix_la_SOURCES = \ atom.c \ colormap.c \ cursor.c \ + deprecated.c \ devices.c \ dispatch.c \ dispatch.h \ @@ -643,19 +714,28 @@ libdix_la_SOURCES = \ pixmap.c \ privates.c \ property.c \ + registry.c \ resource.c \ + selection.c \ swaprep.c \ swapreq.c \ tables.c \ window.c \ - strcasecmp.c + strcasecmp.c \ + strcasestr.c libxpstubs_la_SOURCES = \ xpstubs.c -INCLUDES = -I$(top_srcdir)/Xprint +@XPRINT_TRUE@libXpdix_la_SOURCES = $(libdix_la_SOURCES) +@XPRINT_TRUE@libXpdix_la_CPPFLAGS = -I$(top_srcdir)/hw/xprint +@XPRINT_TRUE@libXpdix_la_CFLAGS = $(AM_CFLAGS) $(XPRINT_CFLAGS) EXTRA_DIST = buildatoms BuiltInAtoms CHANGES Xserver.d Xserver-dtrace.h.in +# Install list of protocol names +miscconfigdir = $(SERVER_MISC_CONFIG_PATH) +dist_miscconfig_DATA = protocol.txt + # Generate dtrace header file for C sources to include @XSERVER_DTRACE_TRUE@BUILT_SOURCES = Xserver-dtrace.h CLEANFILES = dix.c @@ -702,10 +782,12 @@ clean-noinstLTLIBRARIES: echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done +libXpdix.la: $(libXpdix_la_OBJECTS) $(libXpdix_la_DEPENDENCIES) + $(LINK) $(am_libXpdix_la_rpath) $(libXpdix_la_LDFLAGS) $(libXpdix_la_OBJECTS) $(libXpdix_la_LIBADD) $(LIBS) libdix.la: $(libdix_la_OBJECTS) $(libdix_la_DEPENDENCIES) - $(LINK) $(libdix_la_LDFLAGS) $(libdix_la_OBJECTS) $(libdix_la_LIBADD) $(LIBS) + $(LINK) $(am_libdix_la_rpath) $(libdix_la_LDFLAGS) $(libdix_la_OBJECTS) $(libdix_la_LIBADD) $(LIBS) libxpstubs.la: $(libxpstubs_la_OBJECTS) $(libxpstubs_la_DEPENDENCIES) - $(LINK) $(libxpstubs_la_LDFLAGS) $(libxpstubs_la_OBJECTS) $(libxpstubs_la_LIBADD) $(LIBS) + $(LINK) $(am_libxpstubs_la_rpath) $(libxpstubs_la_LDFLAGS) $(libxpstubs_la_OBJECTS) $(libxpstubs_la_LIBADD) $(LIBS) clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; for p in $$list; do \ @@ -726,6 +808,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/colormap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cursor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deprecated.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/devices.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dispatch.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dix.Po@am__quote@ @@ -740,12 +823,45 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glyphcurs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grabs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/initatoms.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-atom.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-colormap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-cursor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-deprecated.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-devices.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-dispatch.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-dixfonts.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-dixutils.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-events.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-extension.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-ffs.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-gc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-getevents.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-globals.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-glyphcurs.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-grabs.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-initatoms.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-main.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-pixmap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-privates.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-property.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-registry.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-resource.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-selection.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-strcasecmp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-strcasestr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-swaprep.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-swapreq.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-tables.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libXpdix_la-window.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixmap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/privates.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/property.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/registry.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resource.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/selection.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strcasecmp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strcasestr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/swaprep.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/swapreq.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tables.Plo@am__quote@ @@ -773,6 +889,216 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< +libXpdix_la-atom.lo: atom.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-atom.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-atom.Tpo" -c -o libXpdix_la-atom.lo `test -f 'atom.c' || echo '$(srcdir)/'`atom.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-atom.Tpo" "$(DEPDIR)/libXpdix_la-atom.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-atom.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='atom.c' object='libXpdix_la-atom.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-atom.lo `test -f 'atom.c' || echo '$(srcdir)/'`atom.c + +libXpdix_la-colormap.lo: colormap.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-colormap.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-colormap.Tpo" -c -o libXpdix_la-colormap.lo `test -f 'colormap.c' || echo '$(srcdir)/'`colormap.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-colormap.Tpo" "$(DEPDIR)/libXpdix_la-colormap.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-colormap.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='colormap.c' object='libXpdix_la-colormap.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-colormap.lo `test -f 'colormap.c' || echo '$(srcdir)/'`colormap.c + +libXpdix_la-cursor.lo: cursor.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-cursor.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-cursor.Tpo" -c -o libXpdix_la-cursor.lo `test -f 'cursor.c' || echo '$(srcdir)/'`cursor.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-cursor.Tpo" "$(DEPDIR)/libXpdix_la-cursor.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-cursor.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cursor.c' object='libXpdix_la-cursor.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-cursor.lo `test -f 'cursor.c' || echo '$(srcdir)/'`cursor.c + +libXpdix_la-deprecated.lo: deprecated.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-deprecated.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-deprecated.Tpo" -c -o libXpdix_la-deprecated.lo `test -f 'deprecated.c' || echo '$(srcdir)/'`deprecated.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-deprecated.Tpo" "$(DEPDIR)/libXpdix_la-deprecated.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-deprecated.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='deprecated.c' object='libXpdix_la-deprecated.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-deprecated.lo `test -f 'deprecated.c' || echo '$(srcdir)/'`deprecated.c + +libXpdix_la-devices.lo: devices.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-devices.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-devices.Tpo" -c -o libXpdix_la-devices.lo `test -f 'devices.c' || echo '$(srcdir)/'`devices.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-devices.Tpo" "$(DEPDIR)/libXpdix_la-devices.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-devices.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='devices.c' object='libXpdix_la-devices.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-devices.lo `test -f 'devices.c' || echo '$(srcdir)/'`devices.c + +libXpdix_la-dispatch.lo: dispatch.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-dispatch.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-dispatch.Tpo" -c -o libXpdix_la-dispatch.lo `test -f 'dispatch.c' || echo '$(srcdir)/'`dispatch.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-dispatch.Tpo" "$(DEPDIR)/libXpdix_la-dispatch.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-dispatch.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dispatch.c' object='libXpdix_la-dispatch.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-dispatch.lo `test -f 'dispatch.c' || echo '$(srcdir)/'`dispatch.c + +libXpdix_la-dixfonts.lo: dixfonts.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-dixfonts.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-dixfonts.Tpo" -c -o libXpdix_la-dixfonts.lo `test -f 'dixfonts.c' || echo '$(srcdir)/'`dixfonts.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-dixfonts.Tpo" "$(DEPDIR)/libXpdix_la-dixfonts.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-dixfonts.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dixfonts.c' object='libXpdix_la-dixfonts.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-dixfonts.lo `test -f 'dixfonts.c' || echo '$(srcdir)/'`dixfonts.c + +libXpdix_la-dixutils.lo: dixutils.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-dixutils.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-dixutils.Tpo" -c -o libXpdix_la-dixutils.lo `test -f 'dixutils.c' || echo '$(srcdir)/'`dixutils.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-dixutils.Tpo" "$(DEPDIR)/libXpdix_la-dixutils.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-dixutils.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dixutils.c' object='libXpdix_la-dixutils.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-dixutils.lo `test -f 'dixutils.c' || echo '$(srcdir)/'`dixutils.c + +libXpdix_la-events.lo: events.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-events.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-events.Tpo" -c -o libXpdix_la-events.lo `test -f 'events.c' || echo '$(srcdir)/'`events.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-events.Tpo" "$(DEPDIR)/libXpdix_la-events.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-events.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='events.c' object='libXpdix_la-events.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-events.lo `test -f 'events.c' || echo '$(srcdir)/'`events.c + +libXpdix_la-extension.lo: extension.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-extension.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-extension.Tpo" -c -o libXpdix_la-extension.lo `test -f 'extension.c' || echo '$(srcdir)/'`extension.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-extension.Tpo" "$(DEPDIR)/libXpdix_la-extension.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-extension.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='extension.c' object='libXpdix_la-extension.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-extension.lo `test -f 'extension.c' || echo '$(srcdir)/'`extension.c + +libXpdix_la-ffs.lo: ffs.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-ffs.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-ffs.Tpo" -c -o libXpdix_la-ffs.lo `test -f 'ffs.c' || echo '$(srcdir)/'`ffs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-ffs.Tpo" "$(DEPDIR)/libXpdix_la-ffs.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-ffs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ffs.c' object='libXpdix_la-ffs.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-ffs.lo `test -f 'ffs.c' || echo '$(srcdir)/'`ffs.c + +libXpdix_la-gc.lo: gc.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-gc.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-gc.Tpo" -c -o libXpdix_la-gc.lo `test -f 'gc.c' || echo '$(srcdir)/'`gc.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-gc.Tpo" "$(DEPDIR)/libXpdix_la-gc.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-gc.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gc.c' object='libXpdix_la-gc.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-gc.lo `test -f 'gc.c' || echo '$(srcdir)/'`gc.c + +libXpdix_la-getevents.lo: getevents.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-getevents.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-getevents.Tpo" -c -o libXpdix_la-getevents.lo `test -f 'getevents.c' || echo '$(srcdir)/'`getevents.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-getevents.Tpo" "$(DEPDIR)/libXpdix_la-getevents.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-getevents.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='getevents.c' object='libXpdix_la-getevents.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-getevents.lo `test -f 'getevents.c' || echo '$(srcdir)/'`getevents.c + +libXpdix_la-globals.lo: globals.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-globals.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-globals.Tpo" -c -o libXpdix_la-globals.lo `test -f 'globals.c' || echo '$(srcdir)/'`globals.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-globals.Tpo" "$(DEPDIR)/libXpdix_la-globals.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-globals.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='globals.c' object='libXpdix_la-globals.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-globals.lo `test -f 'globals.c' || echo '$(srcdir)/'`globals.c + +libXpdix_la-glyphcurs.lo: glyphcurs.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-glyphcurs.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-glyphcurs.Tpo" -c -o libXpdix_la-glyphcurs.lo `test -f 'glyphcurs.c' || echo '$(srcdir)/'`glyphcurs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-glyphcurs.Tpo" "$(DEPDIR)/libXpdix_la-glyphcurs.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-glyphcurs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='glyphcurs.c' object='libXpdix_la-glyphcurs.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-glyphcurs.lo `test -f 'glyphcurs.c' || echo '$(srcdir)/'`glyphcurs.c + +libXpdix_la-grabs.lo: grabs.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-grabs.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-grabs.Tpo" -c -o libXpdix_la-grabs.lo `test -f 'grabs.c' || echo '$(srcdir)/'`grabs.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-grabs.Tpo" "$(DEPDIR)/libXpdix_la-grabs.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-grabs.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='grabs.c' object='libXpdix_la-grabs.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-grabs.lo `test -f 'grabs.c' || echo '$(srcdir)/'`grabs.c + +libXpdix_la-initatoms.lo: initatoms.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-initatoms.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-initatoms.Tpo" -c -o libXpdix_la-initatoms.lo `test -f 'initatoms.c' || echo '$(srcdir)/'`initatoms.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-initatoms.Tpo" "$(DEPDIR)/libXpdix_la-initatoms.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-initatoms.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='initatoms.c' object='libXpdix_la-initatoms.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-initatoms.lo `test -f 'initatoms.c' || echo '$(srcdir)/'`initatoms.c + +libXpdix_la-main.lo: main.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-main.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-main.Tpo" -c -o libXpdix_la-main.lo `test -f 'main.c' || echo '$(srcdir)/'`main.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-main.Tpo" "$(DEPDIR)/libXpdix_la-main.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-main.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='libXpdix_la-main.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-main.lo `test -f 'main.c' || echo '$(srcdir)/'`main.c + +libXpdix_la-pixmap.lo: pixmap.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-pixmap.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-pixmap.Tpo" -c -o libXpdix_la-pixmap.lo `test -f 'pixmap.c' || echo '$(srcdir)/'`pixmap.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-pixmap.Tpo" "$(DEPDIR)/libXpdix_la-pixmap.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-pixmap.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pixmap.c' object='libXpdix_la-pixmap.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-pixmap.lo `test -f 'pixmap.c' || echo '$(srcdir)/'`pixmap.c + +libXpdix_la-privates.lo: privates.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-privates.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-privates.Tpo" -c -o libXpdix_la-privates.lo `test -f 'privates.c' || echo '$(srcdir)/'`privates.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-privates.Tpo" "$(DEPDIR)/libXpdix_la-privates.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-privates.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='privates.c' object='libXpdix_la-privates.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-privates.lo `test -f 'privates.c' || echo '$(srcdir)/'`privates.c + +libXpdix_la-property.lo: property.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-property.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-property.Tpo" -c -o libXpdix_la-property.lo `test -f 'property.c' || echo '$(srcdir)/'`property.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-property.Tpo" "$(DEPDIR)/libXpdix_la-property.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-property.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='property.c' object='libXpdix_la-property.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-property.lo `test -f 'property.c' || echo '$(srcdir)/'`property.c + +libXpdix_la-registry.lo: registry.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-registry.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-registry.Tpo" -c -o libXpdix_la-registry.lo `test -f 'registry.c' || echo '$(srcdir)/'`registry.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-registry.Tpo" "$(DEPDIR)/libXpdix_la-registry.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-registry.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='registry.c' object='libXpdix_la-registry.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-registry.lo `test -f 'registry.c' || echo '$(srcdir)/'`registry.c + +libXpdix_la-resource.lo: resource.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-resource.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-resource.Tpo" -c -o libXpdix_la-resource.lo `test -f 'resource.c' || echo '$(srcdir)/'`resource.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-resource.Tpo" "$(DEPDIR)/libXpdix_la-resource.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-resource.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='resource.c' object='libXpdix_la-resource.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-resource.lo `test -f 'resource.c' || echo '$(srcdir)/'`resource.c + +libXpdix_la-selection.lo: selection.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-selection.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-selection.Tpo" -c -o libXpdix_la-selection.lo `test -f 'selection.c' || echo '$(srcdir)/'`selection.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-selection.Tpo" "$(DEPDIR)/libXpdix_la-selection.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-selection.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='selection.c' object='libXpdix_la-selection.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-selection.lo `test -f 'selection.c' || echo '$(srcdir)/'`selection.c + +libXpdix_la-swaprep.lo: swaprep.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-swaprep.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-swaprep.Tpo" -c -o libXpdix_la-swaprep.lo `test -f 'swaprep.c' || echo '$(srcdir)/'`swaprep.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-swaprep.Tpo" "$(DEPDIR)/libXpdix_la-swaprep.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-swaprep.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='swaprep.c' object='libXpdix_la-swaprep.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-swaprep.lo `test -f 'swaprep.c' || echo '$(srcdir)/'`swaprep.c + +libXpdix_la-swapreq.lo: swapreq.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-swapreq.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-swapreq.Tpo" -c -o libXpdix_la-swapreq.lo `test -f 'swapreq.c' || echo '$(srcdir)/'`swapreq.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-swapreq.Tpo" "$(DEPDIR)/libXpdix_la-swapreq.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-swapreq.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='swapreq.c' object='libXpdix_la-swapreq.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-swapreq.lo `test -f 'swapreq.c' || echo '$(srcdir)/'`swapreq.c + +libXpdix_la-tables.lo: tables.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-tables.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-tables.Tpo" -c -o libXpdix_la-tables.lo `test -f 'tables.c' || echo '$(srcdir)/'`tables.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-tables.Tpo" "$(DEPDIR)/libXpdix_la-tables.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-tables.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tables.c' object='libXpdix_la-tables.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-tables.lo `test -f 'tables.c' || echo '$(srcdir)/'`tables.c + +libXpdix_la-window.lo: window.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-window.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-window.Tpo" -c -o libXpdix_la-window.lo `test -f 'window.c' || echo '$(srcdir)/'`window.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-window.Tpo" "$(DEPDIR)/libXpdix_la-window.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-window.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='window.c' object='libXpdix_la-window.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-window.lo `test -f 'window.c' || echo '$(srcdir)/'`window.c + +libXpdix_la-strcasecmp.lo: strcasecmp.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-strcasecmp.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-strcasecmp.Tpo" -c -o libXpdix_la-strcasecmp.lo `test -f 'strcasecmp.c' || echo '$(srcdir)/'`strcasecmp.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-strcasecmp.Tpo" "$(DEPDIR)/libXpdix_la-strcasecmp.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-strcasecmp.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='strcasecmp.c' object='libXpdix_la-strcasecmp.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-strcasecmp.lo `test -f 'strcasecmp.c' || echo '$(srcdir)/'`strcasecmp.c + +libXpdix_la-strcasestr.lo: strcasestr.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -MT libXpdix_la-strcasestr.lo -MD -MP -MF "$(DEPDIR)/libXpdix_la-strcasestr.Tpo" -c -o libXpdix_la-strcasestr.lo `test -f 'strcasestr.c' || echo '$(srcdir)/'`strcasestr.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libXpdix_la-strcasestr.Tpo" "$(DEPDIR)/libXpdix_la-strcasestr.Plo"; else rm -f "$(DEPDIR)/libXpdix_la-strcasestr.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='strcasestr.c' object='libXpdix_la-strcasestr.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libXpdix_la_CPPFLAGS) $(CPPFLAGS) $(libXpdix_la_CFLAGS) $(CFLAGS) -c -o libXpdix_la-strcasestr.lo `test -f 'strcasestr.c' || echo '$(srcdir)/'`strcasestr.c + mostlyclean-libtool: -rm -f *.lo @@ -782,6 +1108,23 @@ clean-libtool: distclean-libtool: -rm -f libtool uninstall-info-am: +install-dist_miscconfigDATA: $(dist_miscconfig_DATA) + @$(NORMAL_INSTALL) + test -z "$(miscconfigdir)" || $(mkdir_p) "$(DESTDIR)$(miscconfigdir)" + @list='$(dist_miscconfig_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(dist_miscconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(miscconfigdir)/$$f'"; \ + $(dist_miscconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(miscconfigdir)/$$f"; \ + done + +uninstall-dist_miscconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_miscconfig_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(miscconfigdir)/$$f'"; \ + rm -f "$(DESTDIR)$(miscconfigdir)/$$f"; \ + done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -861,8 +1204,11 @@ distdir: $(DISTFILES) check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am -all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) installdirs: + for dir in "$(DESTDIR)$(miscconfigdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am @@ -911,7 +1257,7 @@ info: info-am info-am: -install-data-am: +install-data-am: install-dist_miscconfigDATA install-exec-am: @@ -939,19 +1285,20 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am +uninstall-am: uninstall-dist_miscconfigDATA uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES clean-noinstPROGRAMS \ 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-exec install-exec-am install-info \ - install-info-am install-man 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-info-am + install-data-am install-dist_miscconfigDATA install-exec \ + install-exec-am install-info install-info-am install-man \ + 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-dist_miscconfigDATA uninstall-info-am @XSERVER_DTRACE_TRUE@Xserver-dtrace.h: $(srcdir)/Xserver.d diff --git a/xserver/dix/atom.c b/xserver/dix/atom.c index d9d74f1da..c968c1e5a 100644 --- a/xserver/dix/atom.c +++ b/xserver/dix/atom.c @@ -77,10 +77,10 @@ void FreeAtom(NodePtr patom); _X_EXPORT Atom MakeAtom(char *string, unsigned len, Bool makeit) { - register NodePtr * np; + NodePtr * np; unsigned i; - int comp; - register unsigned int fp = 0; + int comp; + unsigned int fp = 0; np = &atomRoot; for (i = 0; i < (len+1)/2; i++) @@ -107,7 +107,7 @@ MakeAtom(char *string, unsigned len, Bool makeit) } if (makeit) { - register NodePtr nd; + NodePtr nd; nd = (NodePtr) xalloc(sizeof(NodeRec)); if (!nd) @@ -167,7 +167,7 @@ NameForAtom(Atom atom) } void -AtomError() +AtomError(void) { FatalError("initializing atoms"); } @@ -185,7 +185,7 @@ FreeAtom(NodePtr patom) } void -FreeAllAtoms() +FreeAllAtoms(void) { if(atomRoot == (NodePtr)NULL) return; @@ -197,7 +197,7 @@ FreeAllAtoms() } void -InitAtoms() +InitAtoms(void) { FreeAllAtoms(); tableLength = InitialTableSize; @@ -209,5 +209,3 @@ InitAtoms() if (lastAtom != XA_LAST_PREDEFINED) AtomError (); } - - diff --git a/xserver/dix/colormap.c b/xserver/dix/colormap.c index b8f2f4af6..8b1bad8a3 100644 --- a/xserver/dix/colormap.c +++ b/xserver/dix/colormap.c @@ -63,9 +63,10 @@ SOFTWARE. #include "scrnintstr.h" #include "resource.h" #include "windowstr.h" +#include "privates.h" +#include "xace.h" extern XID clientErrorValue; -extern int colormapPrivateCount; static Pixel FindBestPixel( EntryPtr /*pentFirst*/, @@ -95,8 +96,8 @@ static int BlueComp( ); static void FreePixels( - register ColormapPtr /*pmap*/, - register int /*client*/ + ColormapPtr /*pmap*/, + int /*client*/ ); static void CopyFree( @@ -259,9 +260,9 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, int class, size; unsigned long sizebytes; ColormapPtr pmap; - register EntryPtr pent; + EntryPtr pent; int i; - register Pixel *ppix, **pptr; + Pixel *ppix, **pptr; class = pVisual->class; if(!(class & DynamicClass) && (alloc != AllocNone) && (client != SERVER_ID)) @@ -386,31 +387,25 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, pmap->numPixelsBlue[client] = size; } } - if (!AddResource(mid, RT_COLORMAP, (pointer)pmap)) - return (BadAlloc); - /* If the device wants a chance to initialize the colormap in any way, - * this is it. In specific, if this is a Static colormap, this is the - * time to fill in the colormap's values */ + pmap->devPrivates = NULL; pmap->flags |= BeingCreated; + if (!AddResource(mid, RT_COLORMAP, (pointer)pmap)) + return (BadAlloc); - /* - * Allocate the array of devPrivate's for this colormap. + /* + * Security creation/labeling check */ - - if (colormapPrivateCount == 0) - pmap->devPrivates = NULL; - else - { - pmap->devPrivates = (DevUnion *) xcalloc ( - sizeof(DevUnion), colormapPrivateCount); - if (!pmap->devPrivates) - { - FreeResource (mid, RT_NONE); - return BadAlloc; - } + i = XaceHook(XACE_RESOURCE_ACCESS, clients[client], mid, RT_COLORMAP, + pmap, RT_NONE, NULL, DixCreateAccess); + if (i != Success) { + FreeResource(mid, RT_NONE); + return i; } + /* If the device wants a chance to initialize the colormap in any way, + * this is it. In specific, if this is a Static colormap, this is the + * time to fill in the colormap's values */ if (!(*pScreen->CreateColormap)(pmap)) { FreeResource (mid, RT_NONE); @@ -428,8 +423,8 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, int FreeColormap (pointer value, XID mid) { - int i; - register EntryPtr pent; + int i; + EntryPtr pent; ColormapPtr pmap = (ColormapPtr)value; if(CLIENT_ID(mid) != SERVER_ID) @@ -474,9 +469,7 @@ FreeColormap (pointer value, XID mid) } } - if (pmap->devPrivates) - xfree(pmap->devPrivates); - + dixFreePrivates(pmap->devPrivates); xfree(pmap); return(Success); } @@ -744,14 +737,14 @@ static void UpdateColors (ColormapPtr pmap) { xColorItem *defs; - register xColorItem *pdef; - register EntryPtr pent; - register VisualPtr pVisual; + xColorItem *pdef; + EntryPtr pent; + VisualPtr pVisual; int i, n, size; pVisual = pmap->pVisual; size = pVisual->ColormapEntries; - defs = (xColorItem *)ALLOCATE_LOCAL(size * sizeof(xColorItem)); + defs = (xColorItem *)xalloc(size * sizeof(xColorItem)); if (!defs) return; n = 0; @@ -801,7 +794,7 @@ UpdateColors (ColormapPtr pmap) } if (n) (*pmap->pScreen->StoreColors)(pmap, n, defs); - DEALLOCATE_LOCAL(defs); + xfree(defs); } /* Get a read-only color from a ColorMap (probably slow for large maps) @@ -903,7 +896,7 @@ AllocColor (ColormapPtr pmap, { ColormapPtr prootmap = (ColormapPtr) SecurityLookupIDByType (clients[client], pmap->pScreen->defColormap, - RT_COLORMAP, SecurityReadAccess); + RT_COLORMAP, DixReadAccess); if (pmap->class == prootmap->class) FindColorInRootCmap (prootmap, prootmap->red, entries, &rgb, @@ -920,7 +913,7 @@ AllocColor (ColormapPtr pmap, { ColormapPtr prootmap = (ColormapPtr) SecurityLookupIDByType (clients[client], pmap->pScreen->defColormap, - RT_COLORMAP, SecurityReadAccess); + RT_COLORMAP, DixReadAccess); if (pmap->class == prootmap->class) { @@ -993,14 +986,14 @@ AllocColor (ColormapPtr pmap, */ _X_EXPORT void -FakeAllocColor (register ColormapPtr pmap, register xColorItem *item) +FakeAllocColor (ColormapPtr pmap, xColorItem *item) { - Pixel pixR, pixG, pixB; - Pixel temp; - int entries; - xrgb rgb; - int class; - register VisualPtr pVisual; + Pixel pixR, pixG, pixB; + Pixel temp; + int entries; + xrgb rgb; + int class; + VisualPtr pVisual; pVisual = pmap->pVisual; rgb.red = item->red; @@ -1013,6 +1006,7 @@ FakeAllocColor (register ColormapPtr pmap, register xColorItem *item) switch (class) { case GrayScale: case PseudoColor: + temp = 0; item->pixel = 0; if (FindColor(pmap, pmap->red, entries, &rgb, &temp, PSEUDOMAP, -1, AllComp) == Success) { @@ -1059,9 +1053,9 @@ FakeAllocColor (register ColormapPtr pmap, register xColorItem *item) /* free a pixel value obtained from FakeAllocColor */ _X_EXPORT void -FakeFreeColor(register ColormapPtr pmap, Pixel pixel) +FakeFreeColor(ColormapPtr pmap, Pixel pixel) { - register VisualPtr pVisual; + VisualPtr pVisual; Pixel pixR, pixG, pixB; switch (pmap->class) { @@ -1507,11 +1501,11 @@ QueryColors (ColormapPtr pmap, int count, Pixel *ppixIn, xrgb *prgbList) } static void -FreePixels(register ColormapPtr pmap, register int client) +FreePixels(ColormapPtr pmap, int client) { - register Pixel *ppix, *ppixStart; - register int n; - int class; + Pixel *ppix, *ppixStart; + int n; + int class; class = pmap->class; ppixStart = pmap->clientPixelsRed[client]; @@ -1646,8 +1640,8 @@ AllocColorPlanes (int client, ColormapPtr pmap, int colors, { int ok; Pixel mask, *ppixFirst; - register Pixel shift; - register int i; + Pixel shift; + int i; int class; int oldcount; colorResource *pcr = (colorResource *)NULL; @@ -1752,14 +1746,14 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont for(p = pixels; p < pixels + c; p++) *p = 0; - ppixRed = (Pixel *)ALLOCATE_LOCAL(npixR * sizeof(Pixel)); - ppixGreen = (Pixel *)ALLOCATE_LOCAL(npixG * sizeof(Pixel)); - ppixBlue = (Pixel *)ALLOCATE_LOCAL(npixB * sizeof(Pixel)); + ppixRed = (Pixel *)xalloc(npixR * sizeof(Pixel)); + ppixGreen = (Pixel *)xalloc(npixG * sizeof(Pixel)); + ppixBlue = (Pixel *)xalloc(npixB * sizeof(Pixel)); if (!ppixRed || !ppixGreen || !ppixBlue) { - if (ppixBlue) DEALLOCATE_LOCAL(ppixBlue); - if (ppixGreen) DEALLOCATE_LOCAL(ppixGreen); - if (ppixRed) DEALLOCATE_LOCAL(ppixRed); + if (ppixBlue) xfree(ppixBlue); + if (ppixGreen) xfree(ppixGreen); + if (ppixRed) xfree(ppixRed); return(BadAlloc); } @@ -1797,9 +1791,9 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont if (okB) for(ppix = ppixBlue, npix = npixB; --npix >= 0; ppix++) pmap->blue[*ppix].refcnt = 0; - DEALLOCATE_LOCAL(ppixBlue); - DEALLOCATE_LOCAL(ppixGreen); - DEALLOCATE_LOCAL(ppixRed); + xfree(ppixBlue); + xfree(ppixGreen); + xfree(ppixRed); return(BadAlloc); } @@ -1841,9 +1835,9 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont for (pDst = pixels; pDst < pixels + c; pDst++) *pDst |= ALPHAMASK(pmap->pVisual); - DEALLOCATE_LOCAL(ppixBlue); - DEALLOCATE_LOCAL(ppixGreen); - DEALLOCATE_LOCAL(ppixRed); + xfree(ppixBlue); + xfree(ppixGreen); + xfree(ppixRed); return (Success); } @@ -1859,7 +1853,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig, npix = c << r; if ((r >= 32) || (npix > pmap->freeRed) || (npix < c)) return(BadAlloc); - if(!(ppixTemp = (Pixel *)ALLOCATE_LOCAL(npix * sizeof(Pixel)))) + if(!(ppixTemp = (Pixel *)xalloc(npix * sizeof(Pixel)))) return(BadAlloc); ok = AllocCP(pmap, pmap->red, c, r, contig, ppixTemp, pmask); @@ -1889,7 +1883,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig, pmap->numPixelsRed[client] += npix; pmap->freeRed -= npix; } - DEALLOCATE_LOCAL(ppixTemp); + xfree(ppixTemp); return (ok ? Success : BadAlloc); } @@ -2089,7 +2083,7 @@ AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b, npixClientNew = c << (r + g + b); npixShared = (c << r) + (c << g) + (c << b); - psharedList = (SHAREDCOLOR **)ALLOCATE_LOCAL(npixShared * + psharedList = (SHAREDCOLOR **)xalloc(npixShared * sizeof(SHAREDCOLOR *)); if (!psharedList) return FALSE; @@ -2204,7 +2198,7 @@ AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b, } } } - DEALLOCATE_LOCAL(psharedList); + xfree(psharedList); return TRUE; } @@ -2409,10 +2403,10 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe _X_EXPORT int StoreColors (ColormapPtr pmap, int count, xColorItem *defs) { - register Pixel pix; - register xColorItem *pdef; - register EntryPtr pent, pentT, pentLast; - register VisualPtr pVisual; + Pixel pix; + xColorItem *pdef; + EntryPtr pent, pentT, pentLast; + VisualPtr pVisual; SHAREDCOLOR *pred, *pgreen, *pblue; int n, ChgRed, ChgGreen, ChgBlue, idef; int class, errVal = Success; @@ -2679,7 +2673,7 @@ IsMapInstalled(Colormap map, WindowPtr pWin) Colormap *pmaps; int imap, nummaps, found; - pmaps = (Colormap *) ALLOCATE_LOCAL( + pmaps = (Colormap *) xalloc( pWin->drawable.pScreen->maxInstalledCmaps * sizeof(Colormap)); if(!pmaps) return(FALSE); @@ -2694,6 +2688,6 @@ IsMapInstalled(Colormap map, WindowPtr pWin) break; } } - DEALLOCATE_LOCAL(pmaps); + xfree(pmaps); return (found); } diff --git a/xserver/dix/cursor.c b/xserver/dix/cursor.c index b9ede1f76..0ddf9d791 100644 --- a/xserver/dix/cursor.c +++ b/xserver/dix/cursor.c @@ -59,6 +59,7 @@ SOFTWARE. #include "cursorstr.h" #include "dixfontstr.h" #include "opaque.h" +#include "xace.h" typedef struct _GlyphShare { FontPtr font; @@ -86,7 +87,7 @@ FreeCursorBits(CursorBitsPtr bits) #endif if (bits->refcnt == 0) { - register GlyphSharePtr *prev, this; + GlyphSharePtr *prev, this; for (prev = &sharedGlyphs; (this = *prev) && (this->bits != bits); @@ -98,6 +99,7 @@ FreeCursorBits(CursorBitsPtr bits) CloseFont(this->font, (Font)0); xfree(this); } + dixFreePrivates(bits->devPrivates); xfree(bits); } } @@ -123,6 +125,7 @@ FreeCursor(pointer value, XID cid) pscr = screenInfo.screens[nscr]; (void)( *pscr->UnrealizeCursor)( pscr, pCurs); } + dixFreePrivates(pCurs->devPrivates); FreeCursorBits(pCurs->bits); xfree( pCurs); return(Success); @@ -135,7 +138,7 @@ FreeCursor(pointer value, XID cid) static void CheckForEmptyMask(CursorBitsPtr bits) { - register unsigned char *msk = bits->mask; + unsigned char *msk = bits->mask; int n = BitmapBytePad(bits->width) * bits->height; bits->emptyMask = FALSE; @@ -161,23 +164,25 @@ CheckForEmptyMask(CursorBitsPtr bits) * \param pmaskbits server-defined padding * \param argb no padding */ -CursorPtr -AllocCursorARGB(unsigned char *psrcbits, unsigned char *pmaskbits, CARD32 *argb, - CursorMetricPtr cm, - unsigned foreRed, unsigned foreGreen, unsigned foreBlue, - unsigned backRed, unsigned backGreen, unsigned backBlue) +int +AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits, + CARD32 *argb, CursorMetricPtr cm, + unsigned foreRed, unsigned foreGreen, unsigned foreBlue, + unsigned backRed, unsigned backGreen, unsigned backBlue, + CursorPtr *ppCurs, ClientPtr client, XID cid) { CursorBitsPtr bits; CursorPtr pCurs; - int nscr; + int rc, nscr; ScreenPtr pscr; + *ppCurs = NULL; pCurs = (CursorPtr)xalloc(sizeof(CursorRec) + sizeof(CursorBits)); if (!pCurs) { xfree(psrcbits); xfree(pmaskbits); - return (CursorPtr)NULL; + return BadAlloc; } bits = (CursorBitsPtr)((char *)pCurs + sizeof(CursorRec)); bits->source = psrcbits; @@ -189,9 +194,9 @@ AllocCursorARGB(unsigned char *psrcbits, unsigned char *pmaskbits, CARD32 *argb, bits->height = cm->height; bits->xhot = cm->xhot; bits->yhot = cm->yhot; + bits->devPrivates = NULL; bits->refcnt = -1; CheckForEmptyMask(bits); - pCurs->bits = bits; pCurs->refcnt = 1; #ifdef XFIXES @@ -207,6 +212,19 @@ AllocCursorARGB(unsigned char *psrcbits, unsigned char *pmaskbits, CARD32 *argb, pCurs->backGreen = backGreen; pCurs->backBlue = backBlue; + pCurs->id = cid; + pCurs->devPrivates = NULL; + + /* security creation/labeling check */ + rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR, + pCurs, RT_NONE, NULL, DixCreateAccess); + if (rc != Success) { + dixFreePrivates(pCurs->devPrivates); + FreeCursorBits(bits); + xfree(pCurs); + return rc; + } + /* * realize the cursor for every screen */ @@ -220,61 +238,46 @@ AllocCursorARGB(unsigned char *psrcbits, unsigned char *pmaskbits, CARD32 *argb, pscr = screenInfo.screens[nscr]; ( *pscr->UnrealizeCursor)( pscr, pCurs); } + dixFreePrivates(pCurs->devPrivates); FreeCursorBits(bits); xfree(pCurs); - return (CursorPtr)NULL; + return BadAlloc; } } - return pCurs; -} - -/** - * - * \param psrcbits server-defined padding - * \param pmaskbits server-defined padding - */ -CursorPtr -AllocCursor(unsigned char *psrcbits, unsigned char *pmaskbits, - CursorMetricPtr cm, - unsigned foreRed, unsigned foreGreen, unsigned foreBlue, - unsigned backRed, unsigned backGreen, unsigned backBlue) -{ - return AllocCursorARGB (psrcbits, pmaskbits, (CARD32 *) 0, cm, - foreRed, foreGreen, foreBlue, - backRed, backGreen, backBlue); + *ppCurs = pCurs; + return rc; } int AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, unsigned foreRed, unsigned foreGreen, unsigned foreBlue, unsigned backRed, unsigned backGreen, unsigned backBlue, - CursorPtr *ppCurs, ClientPtr client) + CursorPtr *ppCurs, ClientPtr client, XID cid) { FontPtr sourcefont, maskfont; unsigned char *srcbits; unsigned char *mskbits; CursorMetricRec cm; - int res; + int rc; CursorBitsPtr bits; CursorPtr pCurs; int nscr; ScreenPtr pscr; GlyphSharePtr pShare; - sourcefont = (FontPtr) SecurityLookupIDByType(client, source, RT_FONT, - SecurityReadAccess); - maskfont = (FontPtr) SecurityLookupIDByType(client, mask, RT_FONT, - SecurityReadAccess); - - if (!sourcefont) + rc = dixLookupResource((pointer *)&sourcefont, source, RT_FONT, client, + DixUseAccess); + if (rc != Success) { client->errorValue = source; - return(BadFont); + return (rc == BadValue) ? BadFont : rc; } - if (!maskfont && (mask != None)) + rc = dixLookupResource((pointer *)&maskfont, mask, RT_FONT, client, + DixUseAccess); + if (rc != Success && mask != None) { client->errorValue = mask; - return(BadFont); + return (rc == BadValue) ? BadFont : rc; } if (sourcefont != maskfont) pShare = (GlyphSharePtr)NULL; @@ -305,8 +308,8 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, } if (!maskfont) { - register long n; - register unsigned char *mskptr; + long n; + unsigned char *mskptr; n = BitmapBytePad(cm.width)*(long)cm.height; mskptr = mskbits = (unsigned char *)xalloc(n); @@ -322,13 +325,13 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, client->errorValue = maskChar; return BadValue; } - if ((res = ServerBitsFromGlyph(maskfont, maskChar, &cm, &mskbits)) != 0) - return res; + if ((rc = ServerBitsFromGlyph(maskfont, maskChar, &cm, &mskbits))) + return rc; } - if ((res = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits)) != 0) + if ((rc = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits))) { xfree(mskbits); - return res; + return rc; } if (sourcefont != maskfont) { @@ -362,6 +365,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, bits->height = cm.height; bits->xhot = cm.xhot; bits->yhot = cm.yhot; + bits->devPrivates = NULL; if (sourcefont != maskfont) bits->refcnt = -1; else @@ -398,6 +402,19 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, pCurs->backGreen = backGreen; pCurs->backBlue = backBlue; + pCurs->id = cid; + pCurs->devPrivates = NULL; + + /* security creation/labeling check */ + rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR, + pCurs, RT_NONE, NULL, DixCreateAccess); + if (rc != Success) { + dixFreePrivates(pCurs->devPrivates); + FreeCursorBits(bits); + xfree(pCurs); + return rc; + } + /* * realize the cursor for every screen */ @@ -411,6 +428,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, pscr = screenInfo.screens[nscr]; ( *pscr->UnrealizeCursor)( pscr, pCurs); } + dixFreePrivates(pCurs->devPrivates); FreeCursorBits(pCurs->bits); xfree(pCurs); return BadAlloc; @@ -430,25 +448,42 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, *************************************************************/ CursorPtr -CreateRootCursor(char *pfilename, unsigned glyph) +CreateRootCursor(char *unused1, unsigned int unused2) { CursorPtr curs; +#ifdef NULL_ROOT_CURSOR + CursorMetricRec cm; +#else FontPtr cursorfont; int err; XID fontID; +#endif + +#ifdef NULL_ROOT_CURSOR + cm.width = 0; + cm.height = 0; + cm.xhot = 0; + cm.yhot = 0; + AllocARGBCursor(NULL, NULL, NULL, &cm, 0, 0, 0, 0, 0, 0, + &curs, serverClient, (XID)0); + + if (curs == NullCursor) + return NullCursor; +#else fontID = FakeClientID(0); err = OpenFont(serverClient, fontID, FontLoadAll | FontOpenSync, - (unsigned)strlen( pfilename), pfilename); + (unsigned)strlen(defaultCursorFont), defaultCursorFont); if (err != Success) return NullCursor; cursorfont = (FontPtr)LookupIDByType(fontID, RT_FONT); if (!cursorfont) return NullCursor; - if (AllocGlyphCursor(fontID, glyph, fontID, glyph + 1, - 0, 0, 0, ~0, ~0, ~0, &curs, serverClient) != Success) + if (AllocGlyphCursor(fontID, 0, fontID, 1, 0, 0, 0, ~0, ~0, ~0, + &curs, serverClient, (XID)0) != Success) return NullCursor; +#endif if (!AddResource(FakeClientID(0), RT_CURSOR, (pointer)curs)) return NullCursor; diff --git a/xserver/dix/deprecated.c b/xserver/dix/deprecated.c new file mode 100644 index 000000000..2bb81190c --- /dev/null +++ b/xserver/dix/deprecated.c @@ -0,0 +1,162 @@ +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "dix.h" +#include "misc.h" +#include "dixstruct.h" + +/* + * These are deprecated compatibility functions and will be marked as such + * and removed soon! + * + * Please use the noted replacements instead. + */ + +/* replaced by dixLookupWindow */ +_X_EXPORT WindowPtr +SecurityLookupWindow(XID id, ClientPtr client, Mask access_mode) +{ + WindowPtr pWin; + int i = dixLookupWindow(&pWin, id, client, access_mode); + static int warn = 1; + if (warn > 0 && --warn) + ErrorF("Warning: LookupWindow()/SecurityLookupWindow() " + "are deprecated. Please convert your driver/module " + "to use dixLookupWindow().\n"); + return (i == Success) ? pWin : NULL; +} + +/* replaced by dixLookupWindow */ +_X_EXPORT WindowPtr +LookupWindow(XID id, ClientPtr client) +{ + return SecurityLookupWindow(id, client, DixUnknownAccess); +} + +/* replaced by dixLookupDrawable */ +_X_EXPORT pointer +SecurityLookupDrawable(XID id, ClientPtr client, Mask access_mode) +{ + DrawablePtr pDraw; + int i = dixLookupDrawable(&pDraw, id, client, M_DRAWABLE, access_mode); + static int warn = 1; + if (warn > 0 && --warn) + ErrorF("Warning: LookupDrawable()/SecurityLookupDrawable() " + "are deprecated. Please convert your driver/module " + "to use dixLookupDrawable().\n"); + return (i == Success) ? pDraw : NULL; +} + +/* replaced by dixLookupDrawable */ +_X_EXPORT pointer +LookupDrawable(XID id, ClientPtr client) +{ + return SecurityLookupDrawable(id, client, DixUnknownAccess); +} + +/* replaced by dixLookupClient */ +_X_EXPORT ClientPtr +LookupClient(XID id, ClientPtr client) +{ + ClientPtr pClient; + int i = dixLookupClient(&pClient, id, client, DixUnknownAccess); + static int warn = 1; + if (warn > 0 && --warn) + ErrorF("Warning: LookupClient() is deprecated. Please convert your " + "driver/module to use dixLookupClient().\n"); + return (i == Success) ? pClient : NULL; +} + +/* replaced by dixLookupResource */ +_X_EXPORT pointer +SecurityLookupIDByType(ClientPtr client, XID id, RESTYPE rtype, + Mask access_mode) +{ + pointer retval; + int i = dixLookupResource(&retval, id, rtype, client, access_mode); + static int warn = 1; + if (warn > 0 && --warn) + ErrorF("Warning: LookupIDByType()/SecurityLookupIDByType() " + "are deprecated. Please convert your driver/module " + "to use dixLookupResource().\n"); + return (i == Success) ? retval : NULL; +} + +/* replaced by dixLookupResource */ +_X_EXPORT pointer +SecurityLookupIDByClass(ClientPtr client, XID id, RESTYPE classes, + Mask access_mode) +{ + pointer retval; + int i = dixLookupResource(&retval, id, classes, client, access_mode); + static int warn = 1; + if (warn > 0 && --warn) + ErrorF("Warning: LookupIDByClass()/SecurityLookupIDByClass() " + "are deprecated. Please convert your driver/module " + "to use dixLookupResource().\n"); + return (i == Success) ? retval : NULL; +} + +/* replaced by dixLookupResource */ +_X_EXPORT pointer +LookupIDByType(XID id, RESTYPE rtype) +{ + return SecurityLookupIDByType(NullClient, id, rtype, DixUnknownAccess); +} + +/* replaced by dixLookupResource */ +_X_EXPORT pointer +LookupIDByClass(XID id, RESTYPE classes) +{ + return SecurityLookupIDByClass(NullClient, id, classes, DixUnknownAccess); +} + +/* end deprecated functions */ diff --git a/xserver/dix/devices.c b/xserver/dix/devices.c index 87519ebce..b274a97a5 100644 --- a/xserver/dix/devices.c +++ b/xserver/dix/devices.c @@ -69,6 +69,7 @@ SOFTWARE. #ifdef XKB #include <xkbsrv.h> #endif +#include "privates.h" #include "xace.h" #include "dispatch.h" @@ -84,8 +85,7 @@ SOFTWARE. * This file handles input device-related stuff. */ -int CoreDevicePrivatesIndex = 0; -static int CoreDevicePrivatesGeneration = -1; +DevPrivateKey CoreDevicePrivateKey = &CoreDevicePrivateKey; /** * Create a new input device and init it to sane values. The device is added @@ -119,7 +119,6 @@ AddInputDevice(DeviceProc deviceProc, Bool autoStart) dev->name = (char *)NULL; dev->type = 0; dev->id = devid; - inputInfo.numDevices++; dev->public.on = FALSE; dev->public.processInputProc = (ProcessInputProc)NoopDDA; dev->public.realInputProc = (ProcessInputProc)NoopDDA; @@ -150,13 +149,21 @@ AddInputDevice(DeviceProc deviceProc, Bool autoStart) dev->xkb_interest = NULL; #endif dev->config_info = NULL; - dev->nPrivates = 0; dev->devPrivates = NULL; dev->unwrapProc = NULL; dev->coreEvents = TRUE; dev->inited = FALSE; dev->enabled = FALSE; + /* security creation/labeling check + */ + if (XaceHook(XACE_DEVICE_ACCESS, serverClient, dev, DixCreateAccess)) { + xfree(dev); + return NULL; + } + + inputInfo.numDevices++; + for (prev = &inputInfo.off_devices; *prev; prev = &(*prev)->next) ; *prev = dev; @@ -351,7 +358,7 @@ CoreKeyboardProc(DeviceIntPtr pDev, int what) break; case DEVICE_CLOSE: - pDev->devPrivates[CoreDevicePrivatesIndex].ptr = NULL; + dixSetPrivate(&pDev->devPrivates, CoreDevicePrivateKey, NULL); break; default: @@ -383,7 +390,7 @@ CorePointerProc(DeviceIntPtr pDev, int what) break; case DEVICE_CLOSE: - pDev->devPrivates[CoreDevicePrivatesIndex].ptr = NULL; + dixSetPrivate(&pDev->devPrivates, CoreDevicePrivateKey, NULL); break; default: @@ -404,11 +411,6 @@ InitCoreDevices(void) { DeviceIntPtr dev; - if (CoreDevicePrivatesGeneration != serverGeneration) { - CoreDevicePrivatesIndex = AllocateDevicePrivateIndex(); - CoreDevicePrivatesGeneration = serverGeneration; - } - if (!inputInfo.keyboard) { dev = AddInputDevice(CoreKeyboardProc, TRUE); if (!dev) @@ -426,9 +428,6 @@ InitCoreDevices(void) dev->ActivateGrab = ActivateKeyboardGrab; dev->DeactivateGrab = DeactivateKeyboardGrab; dev->coreEvents = FALSE; - if (!AllocateDevicePrivate(dev, CoreDevicePrivatesIndex)) - FatalError("Couldn't allocate keyboard devPrivates\n"); - dev->devPrivates[CoreDevicePrivatesIndex].ptr = NULL; (void)ActivateDevice(dev); inputInfo.keyboard = dev; } @@ -450,9 +449,6 @@ InitCoreDevices(void) dev->ActivateGrab = ActivatePointerGrab; dev->DeactivateGrab = DeactivatePointerGrab; dev->coreEvents = FALSE; - if (!AllocateDevicePrivate(dev, CoreDevicePrivatesIndex)) - FatalError("Couldn't allocate pointer devPrivates\n"); - dev->devPrivates[CoreDevicePrivatesIndex].ptr = NULL; (void)ActivateDevice(dev); inputInfo.pointer = dev; } @@ -533,6 +529,7 @@ CloseDevice(DeviceIntPtr dev) xfree(dev->key->curKeySyms.map); xfree(dev->key->modifierKeyMap); xfree(dev->key); + dev->key = NULL; } if (dev->valuator) { @@ -604,10 +601,8 @@ CloseDevice(DeviceIntPtr dev) XkbRemoveResourceClient((DevicePtr)dev,dev->xkb_interest->resource); #endif - if (dev->devPrivates) - xfree(dev->devPrivates); - xfree(dev->sync.event); + dixFreePrivates(dev->devPrivates); xfree(dev); } @@ -623,12 +618,12 @@ CloseDownDevices(void) for (dev = inputInfo.devices; dev; dev = next) { next = dev->next; - CloseDevice(dev); + DeleteInputDeviceRequest(dev); } for (dev = inputInfo.off_devices; dev; dev = next) { next = dev->next; - CloseDevice(dev); + DeleteInputDeviceRequest(dev); } inputInfo.devices = NULL; inputInfo.off_devices = NULL; @@ -721,32 +716,28 @@ RegisterKeyboardDevice(DeviceIntPtr device) RegisterOtherDevice(device); } -_X_EXPORT DevicePtr -LookupKeyboardDevice(void) -{ - return inputInfo.keyboard ? &inputInfo.keyboard->public : NULL; -} - -_X_EXPORT DevicePtr -LookupPointerDevice(void) -{ - return inputInfo.pointer ? &inputInfo.pointer->public : NULL; -} - -DevicePtr -LookupDevice(int id) +int +dixLookupDevice(DeviceIntPtr *pDev, int id, ClientPtr client, Mask access_mode) { DeviceIntPtr dev; + int rc; + *pDev = NULL; for (dev=inputInfo.devices; dev; dev=dev->next) { if (dev->id == (CARD8)id) - return (DevicePtr)dev; + goto found; } for (dev=inputInfo.off_devices; dev; dev=dev->next) { if (dev->id == (CARD8)id) - return (DevicePtr)dev; + goto found; } - return NULL; + return BadDevice; + +found: + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode); + if (rc == Success) + *pDev = dev; + return rc; } void @@ -1287,10 +1278,10 @@ AllModifierKeysAreUp(dev, map1, per1, map2, per2) static int DoSetModifierMapping(ClientPtr client, KeyCode *inputMap, - int numKeyPerModifier) + int numKeyPerModifier, xSetModifierMappingReply *rep) { DeviceIntPtr pDev = NULL; - int i = 0, inputMapLen = numKeyPerModifier * 8; + int rc, i = 0, inputMapLen = numKeyPerModifier * 8; for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) { @@ -1305,8 +1296,9 @@ DoSetModifierMapping(ClientPtr client, KeyCode *inputMap, } } - if (!XaceHook(XACE_DEVICE_ACCESS, client, pDev, TRUE)) - return BadAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, pDev, DixManageAccess); + if (rc != Success) + return rc; /* None of the modifiers (old or new) may be down while we change * the map. */ @@ -1316,7 +1308,8 @@ DoSetModifierMapping(ClientPtr client, KeyCode *inputMap, !AllModifierKeysAreUp(pDev, inputMap, numKeyPerModifier, pDev->key->modifierKeyMap, pDev->key->maxKeysPerModifier)) { - return MappingBusy; + rep->success = MappingBusy; + return Success; } } } @@ -1353,6 +1346,7 @@ DoSetModifierMapping(ClientPtr client, KeyCode *inputMap, } } + rep->success = Success; return Success; } @@ -1361,8 +1355,8 @@ ProcSetModifierMapping(ClientPtr client) { xSetModifierMappingReply rep; DeviceIntPtr dev; + int rc; REQUEST(xSetModifierMappingReq); - REQUEST_AT_LEAST_SIZE(xSetModifierMappingReq); if (client->req_len != ((stuff->numKeyPerModifier << 1) + @@ -1373,8 +1367,10 @@ ProcSetModifierMapping(ClientPtr client) rep.length = 0; rep.sequenceNumber = client->sequence; - rep.success = DoSetModifierMapping(client, (KeyCode *)&stuff[1], - stuff->numKeyPerModifier); + rc = DoSetModifierMapping(client, (KeyCode *)&stuff[1], + stuff->numKeyPerModifier, &rep); + if (rc != Success) + return rc; SendMappingNotify(MappingModifier, 0, 0, client); for (dev = inputInfo.devices; dev; dev = dev->next) @@ -1389,8 +1385,14 @@ ProcGetModifierMapping(ClientPtr client) { xGetModifierMappingReply rep; KeyClassPtr keyc = inputInfo.keyboard->key; - + int rc; REQUEST_SIZE_MATCH(xReq); + + rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, + DixGetAttrAccess); + if (rc != Success) + return rc; + rep.type = X_Reply; rep.numKeyPerModifier = keyc->maxKeysPerModifier; rep.sequenceNumber = client->sequence; @@ -1413,6 +1415,7 @@ ProcChangeKeyboardMapping(ClientPtr client) KeySymsRec keysyms; KeySymsPtr curKeySyms = &inputInfo.keyboard->key->curKeySyms; DeviceIntPtr pDev = NULL; + int rc; REQUEST_AT_LEAST_SIZE(xChangeKeyboardMappingReq); len = client->req_len - (sizeof(xChangeKeyboardMappingReq) >> 2); @@ -1433,8 +1436,9 @@ ProcChangeKeyboardMapping(ClientPtr client) for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) { - if (!XaceHook(XACE_DEVICE_ACCESS, client, pDev, TRUE)) - return BadAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, pDev, DixManageAccess); + if (rc != Success) + return rc; } } @@ -1459,9 +1463,9 @@ ProcChangeKeyboardMapping(ClientPtr client) } static int -DoSetPointerMapping(DeviceIntPtr device, BYTE *map, int n) +DoSetPointerMapping(ClientPtr client, DeviceIntPtr device, BYTE *map, int n) { - int i = 0; + int rc, i = 0; DeviceIntPtr dev = NULL; if (!device || !device->button) @@ -1469,6 +1473,14 @@ DoSetPointerMapping(DeviceIntPtr device, BYTE *map, int n) for (dev = inputInfo.devices; dev; dev = dev->next) { if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) { + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixManageAccess); + if (rc != Success) + return rc; + } + } + + for (dev = inputInfo.devices; dev; dev = dev->next) { + if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) { for (i = 0; i < n; i++) { if ((device->button->map[i + 1] != map[i]) && BitIsOn(device->button->down, i + 1)) { @@ -1491,12 +1503,12 @@ DoSetPointerMapping(DeviceIntPtr device, BYTE *map, int n) int ProcSetPointerMapping(ClientPtr client) { - REQUEST(xSetPointerMappingReq); BYTE *map; int ret; xSetPointerMappingReply rep; - + REQUEST(xSetPointerMappingReq); REQUEST_AT_LEAST_SIZE(xSetPointerMappingReq); + if (client->req_len != (sizeof(xSetPointerMappingReq)+stuff->nElts+3) >> 2) return BadLength; rep.type = X_Reply; @@ -1514,7 +1526,7 @@ ProcSetPointerMapping(ClientPtr client) if (BadDeviceMap(&map[0], (int)stuff->nElts, 1, 255, &client->errorValue)) return BadValue; - ret = DoSetPointerMapping(inputInfo.pointer, map, stuff->nElts); + ret = DoSetPointerMapping(client, inputInfo.pointer, map, stuff->nElts); if (ret != Success) { rep.success = ret; WriteReplyToClient(client, sizeof(xSetPointerMappingReply), &rep); @@ -1531,11 +1543,16 @@ int ProcGetKeyboardMapping(ClientPtr client) { xGetKeyboardMappingReply rep; - REQUEST(xGetKeyboardMappingReq); KeySymsPtr curKeySyms = &inputInfo.keyboard->key->curKeySyms; - + int rc; + REQUEST(xGetKeyboardMappingReq); REQUEST_SIZE_MATCH(xGetKeyboardMappingReq); + rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, + DixGetAttrAccess); + if (rc != Success) + return rc; + if ((stuff->firstKeyCode < curKeySyms->minKeyCode) || (stuff->firstKeyCode > curKeySyms->maxKeyCode)) { client->errorValue = stuff->firstKeyCode; @@ -1568,8 +1585,14 @@ ProcGetPointerMapping(ClientPtr client) { xGetPointerMappingReply rep; ButtonClassPtr butc = inputInfo.pointer->button; - + int rc; REQUEST_SIZE_MATCH(xReq); + + rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.pointer, + DixGetAttrAccess); + if (rc != Success) + return rc; + rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.nElts = butc->numButtons; @@ -1788,8 +1811,9 @@ ProcChangeKeyboardControl (ClientPtr client) for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->kbdfeed && pDev->kbdfeed->CtrlProc) { - if (!XaceHook(XACE_DEVICE_ACCESS, client, pDev, TRUE)) - return BadAccess; + ret = XaceHook(XACE_DEVICE_ACCESS, client, pDev, DixManageAccess); + if (ret != Success) + return ret; } } @@ -1808,11 +1832,16 @@ ProcChangeKeyboardControl (ClientPtr client) int ProcGetKeyboardControl (ClientPtr client) { - int i; + int rc, i; KeybdCtrl *ctrl = &inputInfo.keyboard->kbdfeed->ctrl; xGetKeyboardControlReply rep; - REQUEST_SIZE_MATCH(xReq); + + rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, + DixGetAttrAccess); + if (rc != Success) + return rc; + rep.type = X_Reply; rep.length = 5; rep.sequenceNumber = client->sequence; @@ -1834,6 +1863,7 @@ ProcBell(ClientPtr client) DeviceIntPtr keybd = inputInfo.keyboard; int base = keybd->kbdfeed->ctrl.bell; int newpercent; + int rc; REQUEST(xBellReq); REQUEST_SIZE_MATCH(xBellReq); @@ -1854,6 +1884,10 @@ ProcBell(ClientPtr client) for (keybd = inputInfo.devices; keybd; keybd = keybd->next) { if ((keybd->coreEvents || keybd == inputInfo.keyboard) && keybd->kbdfeed && keybd->kbdfeed->BellProc) { + + rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixBellAccess); + if (rc != Success) + return rc; #ifdef XKB if (!noXkbExtension) XkbHandleBell(FALSE, FALSE, keybd, newpercent, @@ -1873,8 +1907,8 @@ ProcChangePointerControl(ClientPtr client) { DeviceIntPtr mouse = inputInfo.pointer; PtrCtrl ctrl; /* might get BadValue part way through */ + int rc; REQUEST(xChangePointerControlReq); - REQUEST_SIZE_MATCH(xChangePointerControlReq); if (!mouse->ptrfeed->CtrlProc) @@ -1925,6 +1959,14 @@ ProcChangePointerControl(ClientPtr client) } } + for (mouse = inputInfo.devices; mouse; mouse = mouse->next) { + if ((mouse->coreEvents || mouse == inputInfo.pointer) && + mouse->ptrfeed && mouse->ptrfeed->CtrlProc) { + rc = XaceHook(XACE_DEVICE_ACCESS, client, mouse, DixManageAccess); + if (rc != Success) + return rc; + } + } for (mouse = inputInfo.devices; mouse; mouse = mouse->next) { if ((mouse->coreEvents || mouse == inputInfo.pointer) && @@ -1942,8 +1984,14 @@ ProcGetPointerControl(ClientPtr client) { PtrCtrl *ctrl = &inputInfo.pointer->ptrfeed->ctrl; xGetPointerControlReply rep; - + int rc; REQUEST_SIZE_MATCH(xReq); + + rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.pointer, + DixGetAttrAccess); + if (rc != Success) + return rc; + rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; @@ -1981,11 +2029,15 @@ ProcGetMotionEvents(ClientPtr client) DeviceIntPtr mouse = inputInfo.pointer; TimeStamp start, stop; REQUEST(xGetMotionEventsReq); - REQUEST_SIZE_MATCH(xGetMotionEventsReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); + if (rc != Success) + return rc; + rc = XaceHook(XACE_DEVICE_ACCESS, client, mouse, DixReadAccess); if (rc != Success) return rc; + if (mouse->valuator->motionHintWindow) MaybeStopHint(mouse, client); rep.type = X_Reply; @@ -1999,7 +2051,7 @@ ProcGetMotionEvents(ClientPtr client) { if (CompareTimeStamps(stop, currentTime) == LATER) stop = currentTime; - coords = (xTimecoord *)ALLOCATE_LOCAL(mouse->valuator->numMotionEvents + coords = (xTimecoord *)xalloc(mouse->valuator->numMotionEvents * sizeof(xTimecoord)); if (!coords) return BadAlloc; @@ -2033,7 +2085,7 @@ ProcGetMotionEvents(ClientPtr client) (char *)coords); } if (coords) - DEALLOCATE_LOCAL(coords); + xfree(coords); return Success; } @@ -2041,7 +2093,7 @@ int ProcQueryKeymap(ClientPtr client) { xQueryKeymapReply rep; - int i; + int rc, i; CARD8 *down = inputInfo.keyboard->key->down; REQUEST_SIZE_MATCH(xReq); @@ -2049,11 +2101,13 @@ ProcQueryKeymap(ClientPtr client) rep.sequenceNumber = client->sequence; rep.length = 2; - if (XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, TRUE)) - for (i = 0; i<32; i++) - rep.map[i] = down[i]; - else - bzero((char *)&rep.map[0], 32); + rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, + DixReadAccess); + if (rc != Success) + return rc; + + for (i = 0; i<32; i++) + rep.map[i] = down[i]; WriteReplyToClient(client, sizeof(xQueryKeymapReply), &rep); return Success; diff --git a/xserver/dix/dispatch.c b/xserver/dix/dispatch.c index 05795407f..b91385596 100644 --- a/xserver/dix/dispatch.c +++ b/xserver/dix/dispatch.c @@ -74,6 +74,36 @@ Equipment Corporation. ******************************************************************/ +/* XSERVER_DTRACE additions: + * Copyright 2005-2006 Sun Microsystems, Inc. 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, and/or sell copies of the Software, and to permit persons + * to whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * 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 + * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. + * + * Except as contained in this notice, the name of a copyright holder + * shall not be used in advertising or otherwise to promote the sale, use + * or other dealings in this Software without prior written authorization + * of the copyright holder. + */ + + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> @@ -104,9 +134,8 @@ int ProcInitialConnection(); #include "panoramiX.h" #include "panoramiXsrv.h" #endif -#ifdef XACE +#include "privates.h" #include "xace.h" -#endif #ifdef XAPPGROUP #include "appgroup.h" #endif @@ -115,7 +144,14 @@ int ProcInitialConnection(); #define XKB_IN_SERVER #endif #include "inputstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> +#endif + +#ifdef XSERVER_DTRACE +#include "registry.h" +#include <sys/types.h> +typedef const char *string; +#include "Xserver-dtrace.h" #endif #define mskcnt ((MAXCLIENTS + 31) / 32) @@ -129,10 +165,6 @@ int ProcInitialConnection(); extern xConnSetupPrefix connSetupPrefix; extern char *ConnectionInfo; -_X_EXPORT Selection *CurrentSelections; -_X_EXPORT int NumCurrentSelections; -CallbackListPtr SelectionCallback = NULL; - static ClientPtr grabClient; #define GrabNone 0 #define GrabActive 1 @@ -145,8 +177,6 @@ extern int connBlockScreenStart; static void KillAllClients(void); -static void DeleteClientFromAnySelections(ClientPtr client); - static int nextFreeClientID; /* always MIN free client ID */ static int nClients; /* number of authorized clients */ @@ -179,7 +209,7 @@ SetInputCheck(HWEventQueuePtr c0, HWEventQueuePtr c1) } _X_EXPORT void -UpdateCurrentTime() +UpdateCurrentTime(void) { TimeStamp systime; @@ -198,7 +228,7 @@ UpdateCurrentTime() /* Like UpdateCurrentTime, but can't call ProcessInputEvents */ _X_EXPORT void -UpdateCurrentTimeIf() +UpdateCurrentTimeIf(void) { TimeStamp systime; @@ -210,42 +240,6 @@ UpdateCurrentTimeIf() currentTime = systime; } -void -InitSelections() -{ - if (CurrentSelections) - xfree(CurrentSelections); - CurrentSelections = (Selection *)NULL; - NumCurrentSelections = 0; -} - -void -FlushClientCaches(XID id) -{ - int i; - register ClientPtr client; - - client = clients[CLIENT_ID(id)]; - if (client == NullClient) - return ; - for (i=0; i<currentMaxClients; i++) - { - client = clients[i]; - if (client != NullClient) - { - if (client->lastDrawableID == id) - { - client->lastDrawableID = WindowTable[0]->drawable.id; - client->lastDrawable = (DrawablePtr)WindowTable[0]; - } - else if (client->lastGCID == id) - { - client->lastGCID = INVALID; - client->lastGC = (GCPtr)NULL; - } - } - } -} #ifdef SMART_SCHEDULE #undef SMART_DEBUG @@ -258,9 +252,8 @@ long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL; long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL; long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE; long SmartScheduleTime; -ClientPtr SmartLastClient; -int SmartLastIndex[SMART_MAX_PRIORITY-SMART_MIN_PRIORITY+1]; -int SmartScheduleClient(int *clientReady, int nready); +static ClientPtr SmartLastClient; +static int SmartLastIndex[SMART_MAX_PRIORITY-SMART_MIN_PRIORITY+1]; #ifdef SMART_DEBUG long SmartLastPrint; @@ -269,7 +262,7 @@ long SmartLastPrint; void Dispatch(void); void InitProcVectors(void); -int +static int SmartScheduleClient (int *clientReady, int nready) { ClientPtr pClient; @@ -355,20 +348,19 @@ SmartScheduleClient (int *clientReady, int nready) void Dispatch(void) { - register int *clientReady; /* array of request ready clients */ - register int result; - register ClientPtr client; - register int nready; - register HWEventQueuePtr* icheck = checkForInput; + int *clientReady; /* array of request ready clients */ + int result; + ClientPtr client; + int nready; + HWEventQueuePtr* icheck = checkForInput; #ifdef SMART_SCHEDULE long start_tick; #endif nextFreeClientID = 1; - InitSelections(); nClients = 0; - clientReady = (int *) ALLOCATE_LOCAL(sizeof(int) * MaxClients); + clientReady = (int *) xalloc(sizeof(int) * MaxClients); if (!clientReady) return; @@ -410,17 +402,18 @@ Dispatch(void) } isItTimeToYield = FALSE; +#ifdef XPRINT requestingClient = client; +#endif #ifdef SMART_SCHEDULE start_tick = SmartScheduleTime; #endif while (!isItTimeToYield) { if (*icheck[0] != *icheck[1]) - { ProcessInputEvents(); - FlushIfCriticalOutputPending(); - } + + FlushIfCriticalOutputPending(); #ifdef SMART_SCHEDULE if (!SmartScheduleDisable && (SmartScheduleTime - start_tick) >= SmartScheduleSlice) @@ -448,19 +441,24 @@ Dispatch(void) client->requestLog[client->requestLogIndex] = MAJOROP; client->requestLogIndex++; #endif +#ifdef XSERVER_DTRACE + XSERVER_REQUEST_START(LookupMajorName(MAJOROP), MAJOROP, + ((xReq *)client->requestBuffer)->length, + client->index, client->requestBuffer); +#endif if (result > (maxBigRequestSize << 2)) result = BadLength; - else -#ifdef XACE - { - XaceHook(XACE_AUDIT_BEGIN, client); - result = (* client->requestVector[MAJOROP])(client); - XaceHook(XACE_AUDIT_END, client, result); + else { + result = XaceHookDispatch(client, MAJOROP); + if (result == Success) + result = (* client->requestVector[MAJOROP])(client); + XaceHookAuditEnd(client, result); } -#else - result = (* client->requestVector[MAJOROP])(client); -#endif /* XACE */ - +#ifdef XSERVER_DTRACE + XSERVER_REQUEST_DONE(LookupMajorName(MAJOROP), MAJOROP, + client->sequence, client->index, result); +#endif + if (result != Success) { if (client->noClientException != Success) @@ -471,9 +469,6 @@ Dispatch(void) client->errorValue, result); break; } -#ifdef DAMAGEEXT - FlushIfCriticalOutputPending (); -#endif } FlushAllOutput(); #ifdef SMART_SCHEDULE @@ -481,7 +476,9 @@ Dispatch(void) if (client) client->smart_stop_tick = SmartScheduleTime; #endif +#ifdef XPRINT requestingClient = NULL; +#endif } dispatchException &= ~DE_PRIORITYCHANGE; } @@ -489,7 +486,7 @@ Dispatch(void) ddxBeforeReset (); #endif KillAllClients(); - DEALLOCATE_LOCAL(clientReady); + xfree(clientReady); dispatchException &= ~DE_RESET; } @@ -504,17 +501,16 @@ ProcBadRequest(ClientPtr client) int ProcCreateWindow(ClientPtr client) { - register WindowPtr pParent, pWin; + WindowPtr pParent, pWin; REQUEST(xCreateWindowReq); - int result; - int len; + int len, rc; REQUEST_AT_LEAST_SIZE(xCreateWindowReq); LEGAL_NEW_RESOURCE(stuff->wid, client); - if (!(pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client, - SecurityWriteAccess))) - return BadWindow; + rc = dixLookupWindow(&pParent, stuff->parent, client, DixAddAccess); + if (rc != Success) + return rc; len = client->req_len - (sizeof(xCreateWindowReq) >> 2); if (Ones(stuff->mask) != len) return BadLength; @@ -528,7 +524,7 @@ ProcCreateWindow(ClientPtr client) stuff->borderWidth, stuff->class, stuff->mask, (XID *) &stuff[1], (int)stuff->depth, - client, stuff->visual, &result); + client, stuff->visual, &rc); if (pWin) { Mask mask = pWin->eventMask; @@ -541,22 +537,23 @@ ProcCreateWindow(ClientPtr client) if (client->noClientException != Success) return(client->noClientException); else - return(result); + return rc; } int -ProcChangeWindowAttributes(register ClientPtr client) +ProcChangeWindowAttributes(ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xChangeWindowAttributesReq); - register int result; - int len; + int result, len, rc; + Mask access_mode = 0; REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityWriteAccess); - if (!pWin) - return(BadWindow); + access_mode |= (stuff->valueMask & CWEventMask) ? DixReceiveAccess : 0; + access_mode |= (stuff->valueMask & ~CWEventMask) ? DixSetAttrAccess : 0; + rc = dixLookupWindow(&pWin, stuff->window, client, access_mode); + if (rc != Success) + return rc; len = client->req_len - (sizeof(xChangeWindowAttributesReq) >> 2); if (len != Ones(stuff->valueMask)) return BadLength; @@ -571,65 +568,69 @@ ProcChangeWindowAttributes(register ClientPtr client) } int -ProcGetWindowAttributes(register ClientPtr client) +ProcGetWindowAttributes(ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); xGetWindowAttributesReply wa; + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - SecurityReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess); + if (rc != Success) + return rc; GetWindowAttributes(pWin, client, &wa); WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa); return(client->noClientException); } int -ProcDestroyWindow(register ClientPtr client) +ProcDestroyWindow(ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - SecurityDestroyAccess); - if (!pWin) - return(BadWindow); - if (pWin->parent) + rc = dixLookupWindow(&pWin, stuff->id, client, DixDestroyAccess); + if (rc != Success) + return rc; + if (pWin->parent) { + rc = dixLookupWindow(&pWin, pWin->parent->drawable.id, client, + DixRemoveAccess); + if (rc != Success) + return rc; FreeResource(stuff->id, RT_NONE); + } return(client->noClientException); } int -ProcDestroySubwindows(register ClientPtr client) +ProcDestroySubwindows(ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - SecurityDestroyAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixRemoveAccess); + if (rc != Success) + return rc; DestroySubwindows(pWin, client); return(client->noClientException); } int -ProcChangeSaveSet(register ClientPtr client) +ProcChangeSaveSet(ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xChangeSaveSetReq); - register int result; + int result, rc; REQUEST_SIZE_MATCH(xChangeSaveSetReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess); + if (rc != Success) + return rc; if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id))) return BadMatch; if ((stuff->mode == SetModeInsert) || (stuff->mode == SetModeDelete)) @@ -648,21 +649,19 @@ ProcChangeSaveSet(register ClientPtr client) } int -ProcReparentWindow(register ClientPtr client) +ProcReparentWindow(ClientPtr client) { - register WindowPtr pWin, pParent; + WindowPtr pWin, pParent; REQUEST(xReparentWindowReq); - register int result; + int result, rc; REQUEST_SIZE_MATCH(xReparentWindowReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityWriteAccess); - if (!pWin) - return(BadWindow); - pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client, - SecurityWriteAccess); - if (!pParent) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess); + if (rc != Success) + return rc; + rc = dixLookupWindow(&pParent, stuff->parent, client, DixAddAccess); + if (rc != Success) + return rc; if (SAME_SCREENS(pWin->drawable, pParent->drawable)) { if ((pWin->backgroundState == ParentRelative) && @@ -683,81 +682,81 @@ ProcReparentWindow(register ClientPtr client) } int -ProcMapWindow(register ClientPtr client) +ProcMapWindow(ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - SecurityReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixShowAccess); + if (rc != Success) + return rc; MapWindow(pWin, client); /* update cache to say it is mapped */ return(client->noClientException); } int -ProcMapSubwindows(register ClientPtr client) +ProcMapSubwindows(ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, - SecurityReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixListAccess); + if (rc != Success) + return rc; MapSubwindows(pWin, client); /* update cache to say it is mapped */ return(client->noClientException); } int -ProcUnmapWindow(register ClientPtr client) +ProcUnmapWindow(ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, - SecurityReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixHideAccess); + if (rc != Success) + return rc; UnmapWindow(pWin, FALSE); /* update cache to say it is mapped */ return(client->noClientException); } int -ProcUnmapSubwindows(register ClientPtr client) +ProcUnmapSubwindows(ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, - SecurityReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixListAccess); + if (rc != Success) + return rc; UnmapSubwindows(pWin); return(client->noClientException); } int -ProcConfigureWindow(register ClientPtr client) +ProcConfigureWindow(ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xConfigureWindowReq); - register int result; - int len; + int result; + int len, rc; REQUEST_AT_LEAST_SIZE(xConfigureWindowReq); - pWin = (WindowPtr)SecurityLookupWindow( stuff->window, client, - SecurityWriteAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, + DixManageAccess|DixSetAttrAccess); + if (rc != Success) + return rc; len = client->req_len - (sizeof(xConfigureWindowReq) >> 2); if (Ones((Mask)stuff->mask) != len) return BadLength; @@ -770,10 +769,11 @@ ProcConfigureWindow(register ClientPtr client) } int -ProcCirculateWindow(register ClientPtr client) +ProcCirculateWindow(ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xCirculateWindowReq); + int rc; REQUEST_SIZE_MATCH(xCirculateWindowReq); if ((stuff->direction != RaiseLowest) && @@ -782,22 +782,25 @@ ProcCirculateWindow(register ClientPtr client) client->errorValue = stuff->direction; return BadValue; } - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityWriteAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess); + if (rc != Success) + return rc; CirculateWindow(pWin, (int)stuff->direction, client); return(client->noClientException); } -int -GetGeometry(register ClientPtr client, xGetGeometryReply *rep) +static int +GetGeometry(ClientPtr client, xGetGeometryReply *rep) { - register DrawablePtr pDraw; + DrawablePtr pDraw; + int rc; REQUEST(xResourceReq); - REQUEST_SIZE_MATCH(xResourceReq); - SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->id, client, SecurityReadAccess); + + rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixGetAttrAccess); + if (rc != Success) + return rc; + rep->type = X_Reply; rep->length = 0; rep->sequenceNumber = client->sequence; @@ -817,7 +820,7 @@ GetGeometry(register ClientPtr client, xGetGeometryReply *rep) if ((pDraw->type == UNDRAWABLE_WINDOW) || ((pDraw->type == DRAWABLE_WINDOW) && (stuff->id == pDraw->id))) { - register WindowPtr pWin = (WindowPtr)pDraw; + WindowPtr pWin = (WindowPtr)pDraw; rep->x = pWin->origin.x - wBorderWidth (pWin); rep->y = pWin->origin.y - wBorderWidth (pWin); rep->borderWidth = pWin->borderWidth; @@ -832,7 +835,7 @@ GetGeometry(register ClientPtr client, xGetGeometryReply *rep) int -ProcGetGeometry(register ClientPtr client) +ProcGetGeometry(ClientPtr client) { xGetGeometryReply rep; int status; @@ -846,19 +849,18 @@ ProcGetGeometry(register ClientPtr client) int -ProcQueryTree(register ClientPtr client) +ProcQueryTree(ClientPtr client) { xQueryTreeReply reply; - int numChildren = 0; - register WindowPtr pChild, pWin, pHead; + int rc, numChildren = 0; + WindowPtr pChild, pWin, pHead; Window *childIDs = (Window *)NULL; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - SecurityReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixListAccess); + if (rc != Success) + return rc; reply.type = X_Reply; reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; reply.sequenceNumber = client->sequence; @@ -873,7 +875,7 @@ ProcQueryTree(register ClientPtr client) { int curChild = 0; - childIDs = (Window *) ALLOCATE_LOCAL(numChildren * sizeof(Window)); + childIDs = (Window *) xalloc(numChildren * sizeof(Window)); if (!childIDs) return BadAlloc; for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) @@ -888,14 +890,14 @@ ProcQueryTree(register ClientPtr client) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs); - DEALLOCATE_LOCAL(childIDs); + xfree(childIDs); } return(client->noClientException); } int -ProcInternAtom(register ClientPtr client) +ProcInternAtom(ClientPtr client) { Atom atom; char *tchar; @@ -924,7 +926,7 @@ ProcInternAtom(register ClientPtr client) } int -ProcGetAtomName(register ClientPtr client) +ProcGetAtomName(ClientPtr client) { char *str; xGetAtomNameReply reply; @@ -950,203 +952,10 @@ ProcGetAtomName(register ClientPtr client) } } -#ifdef K5AUTH -extern int k5_bad(); -#endif - -int -ProcSetSelectionOwner(register ClientPtr client) -{ - WindowPtr pWin; - TimeStamp time; - REQUEST(xSetSelectionOwnerReq); - - REQUEST_SIZE_MATCH(xSetSelectionOwnerReq); - UpdateCurrentTime(); - time = ClientTimeToServerTime(stuff->time); - - /* If the client's time stamp is in the future relative to the server's - time stamp, do not set the selection, just return success. */ - if (CompareTimeStamps(time, currentTime) == LATER) - return Success; - if (stuff->window != None) - { - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityReadAccess); - if (!pWin) - return(BadWindow); - } - else - pWin = (WindowPtr)None; - if (ValidAtom(stuff->selection)) - { - int i = 0; - - /* - * First, see if the selection is already set... - */ - while ((i < NumCurrentSelections) && - CurrentSelections[i].selection != stuff->selection) - i++; - if (i < NumCurrentSelections) - { - xEvent event; - - /* If the timestamp in client's request is in the past relative - to the time stamp indicating the last time the owner of the - selection was set, do not set the selection, just return - success. */ - if (CompareTimeStamps(time, CurrentSelections[i].lastTimeChanged) - == EARLIER) - return Success; - if (CurrentSelections[i].client && - (!pWin || (CurrentSelections[i].client != client))) - { - event.u.u.type = SelectionClear; - event.u.selectionClear.time = time.milliseconds; - event.u.selectionClear.window = CurrentSelections[i].window; - event.u.selectionClear.atom = CurrentSelections[i].selection; - (void) TryClientEvents (CurrentSelections[i].client, &event, 1, - NoEventMask, NoEventMask /* CantBeFiltered */, - NullGrab); - } - } - else - { - /* - * It doesn't exist, so add it... - */ - Selection *newsels; - - if (i == 0) - newsels = (Selection *)xalloc(sizeof(Selection)); - else - newsels = (Selection *)xrealloc(CurrentSelections, - (NumCurrentSelections + 1) * sizeof(Selection)); - if (!newsels) - return BadAlloc; - NumCurrentSelections++; - CurrentSelections = newsels; - CurrentSelections[i].selection = stuff->selection; - } - CurrentSelections[i].lastTimeChanged = time; - CurrentSelections[i].window = stuff->window; - CurrentSelections[i].pWin = pWin; - CurrentSelections[i].client = (pWin ? client : NullClient); - if (SelectionCallback) - { - SelectionInfoRec info; - - info.selection = &CurrentSelections[i]; - info.kind= SelectionSetOwner; - CallCallbacks(&SelectionCallback, &info); - } - return (client->noClientException); - } - else - { - client->errorValue = stuff->selection; - return (BadAtom); - } -} - int -ProcGetSelectionOwner(register ClientPtr client) -{ - REQUEST(xResourceReq); - - REQUEST_SIZE_MATCH(xResourceReq); - if (ValidAtom(stuff->id)) - { - int i; - xGetSelectionOwnerReply reply; - - i = 0; - while ((i < NumCurrentSelections) && - CurrentSelections[i].selection != stuff->id) i++; - reply.type = X_Reply; - reply.length = 0; - reply.sequenceNumber = client->sequence; - if (i < NumCurrentSelections) - reply.owner = CurrentSelections[i].window; - else - reply.owner = None; - WriteReplyToClient(client, sizeof(xGetSelectionOwnerReply), &reply); - return(client->noClientException); - } - else - { - client->errorValue = stuff->id; - return (BadAtom); - } -} - -int -ProcConvertSelection(register ClientPtr client) -{ - Bool paramsOkay; - xEvent event; - WindowPtr pWin; - REQUEST(xConvertSelectionReq); - - REQUEST_SIZE_MATCH(xConvertSelectionReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->requestor, client, - SecurityReadAccess); - if (!pWin) - return(BadWindow); - - paramsOkay = (ValidAtom(stuff->selection) && ValidAtom(stuff->target)); - if (stuff->property != None) - paramsOkay &= ValidAtom(stuff->property); - if (paramsOkay) - { - int i; - - i = 0; - while ((i < NumCurrentSelections) && - CurrentSelections[i].selection != stuff->selection) i++; - if ((i < NumCurrentSelections) && - (CurrentSelections[i].window != None) -#ifdef XACE - && XaceHook(XACE_RESOURCE_ACCESS, client, - CurrentSelections[i].window, RT_WINDOW, - SecurityReadAccess, CurrentSelections[i].pWin) -#endif - ) - { - event.u.u.type = SelectionRequest; - event.u.selectionRequest.time = stuff->time; - event.u.selectionRequest.owner = - CurrentSelections[i].window; - event.u.selectionRequest.requestor = stuff->requestor; - event.u.selectionRequest.selection = stuff->selection; - event.u.selectionRequest.target = stuff->target; - event.u.selectionRequest.property = stuff->property; - if (TryClientEvents( - CurrentSelections[i].client, &event, 1, NoEventMask, - NoEventMask /* CantBeFiltered */, NullGrab)) - return (client->noClientException); - } - event.u.u.type = SelectionNotify; - event.u.selectionNotify.time = stuff->time; - event.u.selectionNotify.requestor = stuff->requestor; - event.u.selectionNotify.selection = stuff->selection; - event.u.selectionNotify.target = stuff->target; - event.u.selectionNotify.property = None; - (void) TryClientEvents(client, &event, 1, NoEventMask, - NoEventMask /* CantBeFiltered */, NullGrab); - return (client->noClientException); - } - else - { - client->errorValue = stuff->property; - return (BadAtom); - } -} - -int -ProcGrabServer(register ClientPtr client) +ProcGrabServer(ClientPtr client) { + int rc; REQUEST_SIZE_MATCH(xReq); if (grabState != GrabNone && client != grabClient) { @@ -1156,7 +965,9 @@ ProcGrabServer(register ClientPtr client) IgnoreClient(client); return(client->noClientException); } - OnlyListenToOneClient(client); + rc = OnlyListenToOneClient(client); + if (rc != Success) + return rc; grabState = GrabKickout; grabClient = client; @@ -1199,7 +1010,7 @@ UngrabServer(ClientPtr client) } int -ProcUngrabServer(register ClientPtr client) +ProcUngrabServer(ClientPtr client) { REQUEST_SIZE_MATCH(xReq); UngrabServer(client); @@ -1207,22 +1018,21 @@ ProcUngrabServer(register ClientPtr client) } int -ProcTranslateCoords(register ClientPtr client) +ProcTranslateCoords(ClientPtr client) { REQUEST(xTranslateCoordsReq); - register WindowPtr pWin, pDst; + WindowPtr pWin, pDst; xTranslateCoordsReply rep; + int rc; REQUEST_SIZE_MATCH(xTranslateCoordsReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client, - SecurityReadAccess); - if (!pWin) - return(BadWindow); - pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client, - SecurityReadAccess); - if (!pDst) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->srcWid, client, DixGetAttrAccess); + if (rc != Success) + return rc; + rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixGetAttrAccess); + if (rc != Success) + return rc; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; @@ -1285,7 +1095,7 @@ ProcTranslateCoords(register ClientPtr client) } int -ProcOpenFont(register ClientPtr client) +ProcOpenFont(ClientPtr client) { int err; REQUEST(xOpenFontReq); @@ -1304,14 +1114,14 @@ ProcOpenFont(register ClientPtr client) } int -ProcCloseFont(register ClientPtr client) +ProcCloseFont(ClientPtr client) { FontPtr pFont; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT, - SecurityDestroyAccess); + DixDestroyAccess); if ( pFont != (FontPtr)NULL) /* id was valid */ { FreeResource(stuff->id, RT_NONE); @@ -1325,29 +1135,26 @@ ProcCloseFont(register ClientPtr client) } int -ProcQueryFont(register ClientPtr client) +ProcQueryFont(ClientPtr client) { xQueryFontReply *reply; FontPtr pFont; - register GC *pGC; + GC *pGC; + int rc; REQUEST(xResourceReq); - REQUEST_SIZE_MATCH(xResourceReq); + client->errorValue = stuff->id; /* EITHER font or gc */ - pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT, - SecurityReadAccess); - if (!pFont) - { - /* can't use VERIFY_GC because it might return BadGC */ - pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC, - SecurityReadAccess); - if (!pGC) - { - client->errorValue = stuff->id; - return(BadFont); /* procotol spec says only error is BadFont */ - } - pFont = pGC->font; + rc = dixLookupResource((pointer *)&pFont, stuff->id, RT_FONT, client, + DixGetAttrAccess); + if (rc == BadValue) { + rc = dixLookupResource((pointer *)&pGC, stuff->id, RT_GC, client, + DixGetAttrAccess); + if (rc == Success) + pFont = pGC->font; } + if (rc != Success) + return (rc == BadValue) ? BadFont: rc; { xCharInfo *pmax = FONTINKMAX(pFont); @@ -1366,7 +1173,7 @@ ProcQueryFont(register ClientPtr client) rlength = sizeof(xQueryFontReply) + FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) + nprotoxcistructs * sizeof(xCharInfo); - reply = (xQueryFontReply *)ALLOCATE_LOCAL(rlength); + reply = (xQueryFontReply *)xalloc(rlength); if(!reply) { return(BadAlloc); @@ -1378,36 +1185,35 @@ ProcQueryFont(register ClientPtr client) QueryFont( pFont, reply, nprotoxcistructs); WriteReplyToClient(client, rlength, reply); - DEALLOCATE_LOCAL(reply); + xfree(reply); return(client->noClientException); } } int -ProcQueryTextExtents(register ClientPtr client) +ProcQueryTextExtents(ClientPtr client) { - REQUEST(xQueryTextExtentsReq); xQueryTextExtentsReply reply; FontPtr pFont; GC *pGC; ExtentInfoRec info; unsigned long length; - + int rc; + REQUEST(xQueryTextExtentsReq); REQUEST_AT_LEAST_SIZE(xQueryTextExtentsReq); - pFont = (FontPtr)SecurityLookupIDByType(client, stuff->fid, RT_FONT, - SecurityReadAccess); - if (!pFont) - { - pGC = (GC *)SecurityLookupIDByType(client, stuff->fid, RT_GC, - SecurityReadAccess); - if (!pGC) - { - client->errorValue = stuff->fid; - return(BadFont); - } - pFont = pGC->font; - } + client->errorValue = stuff->fid; /* EITHER font or gc */ + rc = dixLookupResource((pointer *)&pFont, stuff->fid, RT_FONT, client, + DixGetAttrAccess); + if (rc == BadValue) { + rc = dixLookupResource((pointer *)&pGC, stuff->fid, RT_GC, client, + DixGetAttrAccess); + if (rc == Success) + pFont = pGC->font; + } + if (rc != Success) + return (rc == BadValue) ? BadFont: rc; + length = client->req_len - (sizeof(xQueryTextExtentsReq) >> 2); length = length << 1; if (stuff->oddLength) @@ -1434,7 +1240,7 @@ ProcQueryTextExtents(register ClientPtr client) } int -ProcListFonts(register ClientPtr client) +ProcListFonts(ClientPtr client) { REQUEST(xListFontsReq); @@ -1445,7 +1251,7 @@ ProcListFonts(register ClientPtr client) } int -ProcListFontsWithInfo(register ClientPtr client) +ProcListFontsWithInfo(ClientPtr client) { REQUEST(xListFontsWithInfoReq); @@ -1467,19 +1273,23 @@ dixDestroyPixmap(pointer value, XID pid) } int -ProcCreatePixmap(register ClientPtr client) +ProcCreatePixmap(ClientPtr client) { PixmapPtr pMap; - register DrawablePtr pDraw; + DrawablePtr pDraw; REQUEST(xCreatePixmapReq); DepthPtr pDepth; - register int i; + int i, rc; REQUEST_SIZE_MATCH(xCreatePixmapReq); client->errorValue = stuff->pid; LEGAL_NEW_RESOURCE(stuff->pid, client); - SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->drawable, client, - SecurityReadAccess); + + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY, + DixGetAttrAccess); + if (rc != Success) + return rc; + if (!stuff->width || !stuff->height) { client->errorValue = 0; @@ -1514,28 +1324,36 @@ ProcCreatePixmap(register ClientPtr client) CreatePmap: pMap = (PixmapPtr)(*pDraw->pScreen->CreatePixmap) (pDraw->pScreen, stuff->width, - stuff->height, stuff->depth); + stuff->height, stuff->depth, 0); if (pMap) { pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.id = stuff->pid; + /* security creation/labeling check */ + rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP, + pMap, RT_NONE, NULL, DixCreateAccess); + if (rc != Success) { + (*pDraw->pScreen->DestroyPixmap)(pMap); + return rc; + } if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap)) return(client->noClientException); + (*pDraw->pScreen->DestroyPixmap)(pMap); } return (BadAlloc); } int -ProcFreePixmap(register ClientPtr client) +ProcFreePixmap(ClientPtr client) { PixmapPtr pMap; - + int rc; REQUEST(xResourceReq); - REQUEST_SIZE_MATCH(xResourceReq); - pMap = (PixmapPtr)SecurityLookupIDByType(client, stuff->id, RT_PIXMAP, - SecurityDestroyAccess); - if (pMap) + + rc = dixLookupResource((pointer *)&pMap, stuff->id, RT_PIXMAP, client, + DixDestroyAccess); + if (rc == Success) { FreeResource(stuff->id, RT_NONE); return(client->noClientException); @@ -1543,29 +1361,32 @@ ProcFreePixmap(register ClientPtr client) else { client->errorValue = stuff->id; - return (BadPixmap); + return (rc == BadValue) ? BadPixmap : rc; } } int -ProcCreateGC(register ClientPtr client) +ProcCreateGC(ClientPtr client) { - int error; + int error, rc; GC *pGC; - register DrawablePtr pDraw; + DrawablePtr pDraw; unsigned len; REQUEST(xCreateGCReq); REQUEST_AT_LEAST_SIZE(xCreateGCReq); client->errorValue = stuff->gc; LEGAL_NEW_RESOURCE(stuff->gc, client); - SECURITY_VERIFY_DRAWABLE (pDraw, stuff->drawable, client, - SecurityReadAccess); + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, + DixGetAttrAccess); + if (rc != Success) + return rc; + len = client->req_len - (sizeof(xCreateGCReq) >> 2); if (len != Ones(stuff->mask)) return BadLength; - pGC = (GC *)CreateGC(pDraw, stuff->mask, - (XID *) &stuff[1], &error); + pGC = (GC *)CreateGC(pDraw, stuff->mask, (XID *) &stuff[1], &error, + stuff->gc, client); if (error != Success) return error; if (!AddResource(stuff->gc, RT_GC, (pointer)pGC)) @@ -1574,15 +1395,18 @@ ProcCreateGC(register ClientPtr client) } int -ProcChangeGC(register ClientPtr client) +ProcChangeGC(ClientPtr client) { GC *pGC; - REQUEST(xChangeGCReq); int result; unsigned len; - + REQUEST(xChangeGCReq); REQUEST_AT_LEAST_SIZE(xChangeGCReq); - SECURITY_VERIFY_GC(pGC, stuff->gc, client, SecurityWriteAccess); + + result = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess); + if (result != Success) + return result; + len = client->req_len - (sizeof(xChangeGCReq) >> 2); if (len != Ones(stuff->mask)) return BadLength; @@ -1598,16 +1422,20 @@ ProcChangeGC(register ClientPtr client) } int -ProcCopyGC(register ClientPtr client) +ProcCopyGC(ClientPtr client) { - register GC *dstGC; - register GC *pGC; + GC *dstGC; + GC *pGC; int result; REQUEST(xCopyGCReq); - REQUEST_SIZE_MATCH(xCopyGCReq); - SECURITY_VERIFY_GC( pGC, stuff->srcGC, client, SecurityReadAccess); - SECURITY_VERIFY_GC( dstGC, stuff->dstGC, client, SecurityWriteAccess); + + result = dixLookupGC(&pGC, stuff->srcGC, client, DixGetAttrAccess); + if (result != Success) + return result; + result = dixLookupGC(&dstGC, stuff->dstGC, client, DixSetAttrAccess); + if (result != Success) + return result; if ((dstGC->pScreen != pGC->pScreen) || (dstGC->depth != pGC->depth)) return (BadMatch); result = CopyGC(pGC, dstGC, stuff->mask); @@ -1621,9 +1449,9 @@ ProcCopyGC(register ClientPtr client) } int -ProcSetDashes(register ClientPtr client) +ProcSetDashes(ClientPtr client) { - register GC *pGC; + GC *pGC; int result; REQUEST(xSetDashesReq); @@ -1634,7 +1462,9 @@ ProcSetDashes(register ClientPtr client) return BadValue; } - SECURITY_VERIFY_GC(pGC,stuff->gc, client, SecurityWriteAccess); + result = dixLookupGC(&pGC,stuff->gc, client, DixSetAttrAccess); + if (result != Success) + return result; result = SetDashes(pGC, stuff->dashOffset, stuff->nDashes, (unsigned char *)&stuff[1]); @@ -1648,11 +1478,10 @@ ProcSetDashes(register ClientPtr client) } int -ProcSetClipRectangles(register ClientPtr client) +ProcSetClipRectangles(ClientPtr client) { - int nr; - int result; - register GC *pGC; + int nr, result; + GC *pGC; REQUEST(xSetClipRectanglesReq); REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq); @@ -1662,7 +1491,9 @@ ProcSetClipRectangles(register ClientPtr client) client->errorValue = stuff->ordering; return BadValue; } - SECURITY_VERIFY_GC(pGC,stuff->gc, client, SecurityWriteAccess); + result = dixLookupGC(&pGC,stuff->gc, client, DixSetAttrAccess); + if (result != Success) + return result; nr = (client->req_len << 2) - sizeof(xSetClipRectanglesReq); if (nr & 4) @@ -1677,28 +1508,32 @@ ProcSetClipRectangles(register ClientPtr client) } int -ProcFreeGC(register ClientPtr client) +ProcFreeGC(ClientPtr client) { - register GC *pGC; + GC *pGC; + int rc; REQUEST(xResourceReq); - REQUEST_SIZE_MATCH(xResourceReq); - SECURITY_VERIFY_GC(pGC, stuff->id, client, SecurityDestroyAccess); + + rc = dixLookupGC(&pGC, stuff->id, client, DixDestroyAccess); + if (rc != Success) + return rc; + FreeResource(stuff->id, RT_NONE); return(client->noClientException); } int -ProcClearToBackground(register ClientPtr client) +ProcClearToBackground(ClientPtr client) { REQUEST(xClearAreaReq); - register WindowPtr pWin; + WindowPtr pWin; + int rc; REQUEST_SIZE_MATCH(xClearAreaReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityWriteAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (rc != Success) + return rc; if (pWin->drawable.class == InputOnly) { client->errorValue = stuff->window; @@ -1716,21 +1551,24 @@ ProcClearToBackground(register ClientPtr client) } int -ProcCopyArea(register ClientPtr client) +ProcCopyArea(ClientPtr client) { - register DrawablePtr pDst; - register DrawablePtr pSrc; - register GC *pGC; + DrawablePtr pDst; + DrawablePtr pSrc; + GC *pGC; REQUEST(xCopyAreaReq); RegionPtr pRgn; + int rc; REQUEST_SIZE_MATCH(xCopyAreaReq); - VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, DixWriteAccess); if (stuff->dstDrawable != stuff->srcDrawable) { - SECURITY_VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client, - SecurityReadAccess); + rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth)) { client->errorValue = stuff->dstDrawable; @@ -1740,8 +1578,6 @@ ProcCopyArea(register ClientPtr client) else pSrc = pDst; - SET_DBE_SRCBUF(pSrc, stuff->srcDrawable); - pRgn = (*pGC->ops->CopyArea)(pSrc, pDst, pGC, stuff->srcX, stuff->srcY, stuff->width, stuff->height, stuff->dstX, stuff->dstY); @@ -1757,20 +1593,24 @@ ProcCopyArea(register ClientPtr client) } int -ProcCopyPlane(register ClientPtr client) +ProcCopyPlane(ClientPtr client) { - register DrawablePtr psrcDraw, pdstDraw; - register GC *pGC; + DrawablePtr psrcDraw, pdstDraw; + GC *pGC; REQUEST(xCopyPlaneReq); RegionPtr pRgn; + int rc; REQUEST_SIZE_MATCH(xCopyPlaneReq); - VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, DixWriteAccess); if (stuff->dstDrawable != stuff->srcDrawable) { - SECURITY_VERIFY_DRAWABLE(psrcDraw, stuff->srcDrawable, client, - SecurityReadAccess); + rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; + if (pdstDraw->pScreen != psrcDraw->pScreen) { client->errorValue = stuff->dstDrawable; @@ -1780,8 +1620,6 @@ ProcCopyPlane(register ClientPtr client) else psrcDraw = pdstDraw; - SET_DBE_SRCBUF(psrcDraw, stuff->srcDrawable); - /* Check to see if stuff->bitPlane has exactly ONE good bit set */ if(stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) || (stuff->bitPlane > (1L << (psrcDraw->depth - 1)))) @@ -1804,11 +1642,11 @@ ProcCopyPlane(register ClientPtr client) } int -ProcPolyPoint(register ClientPtr client) +ProcPolyPoint(ClientPtr client) { int npoint; - register GC *pGC; - register DrawablePtr pDraw; + GC *pGC; + DrawablePtr pDraw; REQUEST(xPolyPointReq); REQUEST_AT_LEAST_SIZE(xPolyPointReq); @@ -1818,7 +1656,7 @@ ProcPolyPoint(register ClientPtr client) client->errorValue = stuff->coordMode; return BadValue; } - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); npoint = ((client->req_len << 2) - sizeof(xPolyPointReq)) >> 2; if (npoint) (*pGC->ops->PolyPoint)(pDraw, pGC, stuff->coordMode, npoint, @@ -1827,11 +1665,11 @@ ProcPolyPoint(register ClientPtr client) } int -ProcPolyLine(register ClientPtr client) +ProcPolyLine(ClientPtr client) { int npoint; - register GC *pGC; - register DrawablePtr pDraw; + GC *pGC; + DrawablePtr pDraw; REQUEST(xPolyLineReq); REQUEST_AT_LEAST_SIZE(xPolyLineReq); @@ -1841,7 +1679,7 @@ ProcPolyLine(register ClientPtr client) client->errorValue = stuff->coordMode; return BadValue; } - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); npoint = ((client->req_len << 2) - sizeof(xPolyLineReq)) >> 2; if (npoint > 1) (*pGC->ops->Polylines)(pDraw, pGC, stuff->coordMode, npoint, @@ -1850,15 +1688,15 @@ ProcPolyLine(register ClientPtr client) } int -ProcPolySegment(register ClientPtr client) +ProcPolySegment(ClientPtr client) { int nsegs; - register GC *pGC; - register DrawablePtr pDraw; + GC *pGC; + DrawablePtr pDraw; REQUEST(xPolySegmentReq); REQUEST_AT_LEAST_SIZE(xPolySegmentReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq); if (nsegs & 4) return(BadLength); @@ -1869,15 +1707,15 @@ ProcPolySegment(register ClientPtr client) } int -ProcPolyRectangle (register ClientPtr client) +ProcPolyRectangle (ClientPtr client) { int nrects; - register GC *pGC; - register DrawablePtr pDraw; + GC *pGC; + DrawablePtr pDraw; REQUEST(xPolyRectangleReq); REQUEST_AT_LEAST_SIZE(xPolyRectangleReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq); if (nrects & 4) return(BadLength); @@ -1889,15 +1727,15 @@ ProcPolyRectangle (register ClientPtr client) } int -ProcPolyArc(register ClientPtr client) +ProcPolyArc(ClientPtr client) { int narcs; - register GC *pGC; - register DrawablePtr pDraw; + GC *pGC; + DrawablePtr pDraw; REQUEST(xPolyArcReq); REQUEST_AT_LEAST_SIZE(xPolyArcReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); narcs = (client->req_len << 2) - sizeof(xPolyArcReq); if (narcs % sizeof(xArc)) return(BadLength); @@ -1908,11 +1746,11 @@ ProcPolyArc(register ClientPtr client) } int -ProcFillPoly(register ClientPtr client) +ProcFillPoly(ClientPtr client) { int things; - register GC *pGC; - register DrawablePtr pDraw; + GC *pGC; + DrawablePtr pDraw; REQUEST(xFillPolyReq); REQUEST_AT_LEAST_SIZE(xFillPolyReq); @@ -1929,7 +1767,7 @@ ProcFillPoly(register ClientPtr client) return BadValue; } - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); things = ((client->req_len << 2) - sizeof(xFillPolyReq)) >> 2; if (things) (*pGC->ops->FillPolygon) (pDraw, pGC, stuff->shape, @@ -1939,15 +1777,15 @@ ProcFillPoly(register ClientPtr client) } int -ProcPolyFillRectangle(register ClientPtr client) +ProcPolyFillRectangle(ClientPtr client) { int things; - register GC *pGC; - register DrawablePtr pDraw; + GC *pGC; + DrawablePtr pDraw; REQUEST(xPolyFillRectangleReq); REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq); if (things & 4) return(BadLength); @@ -1960,15 +1798,15 @@ ProcPolyFillRectangle(register ClientPtr client) } int -ProcPolyFillArc(register ClientPtr client) +ProcPolyFillArc(ClientPtr client) { int narcs; - register GC *pGC; - register DrawablePtr pDraw; + GC *pGC; + DrawablePtr pDraw; REQUEST(xPolyFillArcReq); REQUEST_AT_LEAST_SIZE(xPolyFillArcReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq); if (narcs % sizeof(xArc)) return(BadLength); @@ -2033,17 +1871,17 @@ ReformatImage (char *base, int nbytes, int bpp, int order) * boundary, even if the scanlines are padded to our satisfaction. */ int -ProcPutImage(register ClientPtr client) +ProcPutImage(ClientPtr client) { - register GC *pGC; - register DrawablePtr pDraw; + GC *pGC; + DrawablePtr pDraw; long length; /* length of scanline server padded */ long lengthProto; /* length of scanline protocol padded */ char *tmpImage; REQUEST(xPutImageReq); REQUEST_AT_LEAST_SIZE(xPutImageReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); if (stuff->format == XYBitmap) { if ((stuff->depth != 1) || @@ -2089,29 +1927,29 @@ ProcPutImage(register ClientPtr client) return (client->noClientException); } - -int -DoGetImage(register ClientPtr client, int format, Drawable drawable, +static int +DoGetImage(ClientPtr client, int format, Drawable drawable, int x, int y, int width, int height, Mask planemask, xGetImageReply **im_return) { - register DrawablePtr pDraw; - int nlines, linesPerBuf; - register int linesDone; + DrawablePtr pDraw; + int nlines, linesPerBuf, rc; + int linesDone; long widthBytesLine, length; Mask plane = 0; char *pBuf; xGetImageReply xgi; -#ifdef XACE RegionPtr pVisibleRegion = NULL; -#endif if ((format != XYPixmap) && (format != ZPixmap)) { client->errorValue = format; return(BadValue); } - SECURITY_VERIFY_DRAWABLE(pDraw, drawable, client, SecurityReadAccess); + rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixReadAccess); + if (rc != Success) + return rc; + if(pDraw->type == DRAWABLE_WINDOW) { if( /* check for being viewable */ @@ -2141,8 +1979,6 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, xgi.visual = None; } - SET_DBE_SRCBUF(pDraw, drawable); - xgi.type = X_Reply; xgi.sequenceNumber = client->sequence; xgi.depth = pDraw->depth; @@ -2203,22 +2039,20 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, length += widthBytesLine; } } - if(!(pBuf = (char *) ALLOCATE_LOCAL(length))) + if(!(pBuf = (char *) xalloc(length))) return (BadAlloc); WriteReplyToClient(client, sizeof (xGetImageReply), &xgi); } -#ifdef XACE - if (pDraw->type == DRAWABLE_WINDOW && - !XaceHook(XACE_DRAWABLE_ACCESS, client, pDraw)) + if (pDraw->type == DRAWABLE_WINDOW) { pVisibleRegion = NotClippedByChildren((WindowPtr)pDraw); if (pVisibleRegion) { - REGION_TRANSLATE(pDraw->pScreen, pVisibleRegion, -pDraw->x, -pDraw->y); + REGION_TRANSLATE(pDraw->pScreen, pVisibleRegion, + -pDraw->x, -pDraw->y); } } -#endif if (linesPerBuf == 0) { @@ -2238,12 +2072,10 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, format, planemask, (pointer) pBuf); -#ifdef XACE if (pVisibleRegion) XaceCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y + linesDone, width, nlines, format, pBuf); -#endif /* Note that this is NOT a call to WriteSwappedDataToClient, as we do NOT byte swap */ @@ -2279,13 +2111,11 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, format, plane, (pointer)pBuf); -#ifdef XACE if (pVisibleRegion) XaceCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y + linesDone, width, nlines, format, pBuf); -#endif /* Note: NOT a call to WriteSwappedDataToClient, as we do NOT byte swap */ @@ -2307,17 +2137,15 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, } } } -#ifdef XACE if (pVisibleRegion) REGION_DESTROY(pDraw->pScreen, pVisibleRegion); -#endif if (!im_return) - DEALLOCATE_LOCAL(pBuf); + xfree(pBuf); return (client->noClientException); } int -ProcGetImage(register ClientPtr client) +ProcGetImage(ClientPtr client) { REQUEST(xGetImageReq); @@ -2330,7 +2158,7 @@ ProcGetImage(register ClientPtr client) } int -ProcPolyText(register ClientPtr client) +ProcPolyText(ClientPtr client) { int err; REQUEST(xPolyTextReq); @@ -2338,7 +2166,7 @@ ProcPolyText(register ClientPtr client) GC *pGC; REQUEST_AT_LEAST_SIZE(xPolyTextReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); err = PolyText(client, pDraw, @@ -2359,16 +2187,16 @@ ProcPolyText(register ClientPtr client) } int -ProcImageText8(register ClientPtr client) +ProcImageText8(ClientPtr client) { int err; - register DrawablePtr pDraw; - register GC *pGC; + DrawablePtr pDraw; + GC *pGC; REQUEST(xImageTextReq); REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); err = ImageText(client, pDraw, @@ -2389,16 +2217,16 @@ ProcImageText8(register ClientPtr client) } int -ProcImageText16(register ClientPtr client) +ProcImageText16(ClientPtr client) { int err; - register DrawablePtr pDraw; - register GC *pGC; + DrawablePtr pDraw; + GC *pGC; REQUEST(xImageTextReq); REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); err = ImageText(client, pDraw, @@ -2420,12 +2248,12 @@ ProcImageText16(register ClientPtr client) int -ProcCreateColormap(register ClientPtr client) +ProcCreateColormap(ClientPtr client) { VisualPtr pVisual; ColormapPtr pmap; Colormap mid; - register WindowPtr pWin; + WindowPtr pWin; ScreenPtr pScreen; REQUEST(xCreateColormapReq); int i, result; @@ -2439,10 +2267,9 @@ ProcCreateColormap(register ClientPtr client) } mid = stuff->mid; LEGAL_NEW_RESOURCE(mid, client); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityReadAccess); - if (!pWin) - return(BadWindow); + result = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); + if (result != Success) + return result; pScreen = pWin->drawable.pScreen; for (i = 0, pVisual = pScreen->visuals; @@ -2463,15 +2290,16 @@ ProcCreateColormap(register ClientPtr client) } int -ProcFreeColormap(register ClientPtr client) +ProcFreeColormap(ClientPtr client) { ColormapPtr pmap; + int rc; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - pmap = (ColormapPtr )SecurityLookupIDByType(client, stuff->id, RT_COLORMAP, - SecurityDestroyAccess); - if (pmap) + rc = dixLookupResource((pointer *)&pmap, stuff->id, RT_COLORMAP, client, + DixDestroyAccess); + if (rc == Success) { /* Freeing a default colormap is a no-op */ if (!(pmap->flags & IsDefault)) @@ -2481,98 +2309,110 @@ ProcFreeColormap(register ClientPtr client) else { client->errorValue = stuff->id; - return (BadColor); + return (rc == BadValue) ? BadColor : rc; } } int -ProcCopyColormapAndFree(register ClientPtr client) +ProcCopyColormapAndFree(ClientPtr client) { Colormap mid; ColormapPtr pSrcMap; REQUEST(xCopyColormapAndFreeReq); - int result; + int rc; REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq); mid = stuff->mid; LEGAL_NEW_RESOURCE(mid, client); - if( (pSrcMap = (ColormapPtr )SecurityLookupIDByType(client, stuff->srcCmap, - RT_COLORMAP, SecurityReadAccess|SecurityWriteAccess)) ) + rc = dixLookupResource((pointer *)&pSrcMap, stuff->srcCmap, RT_COLORMAP, + client, DixReadAccess|DixRemoveAccess); + if (rc == Success) { - result = CopyColormapAndFree(mid, pSrcMap, client->index); + rc = CopyColormapAndFree(mid, pSrcMap, client->index); if (client->noClientException != Success) return(client->noClientException); else - return(result); + return rc; } else { client->errorValue = stuff->srcCmap; - return(BadColor); + return (rc == BadValue) ? BadColor : rc; } } int -ProcInstallColormap(register ClientPtr client) +ProcInstallColormap(ClientPtr client) { ColormapPtr pcmp; + int rc; REQUEST(xResourceReq); - REQUEST_SIZE_MATCH(xResourceReq); - pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->id, - RT_COLORMAP, SecurityReadAccess); - if (pcmp) - { - (*(pcmp->pScreen->InstallColormap)) (pcmp); - return (client->noClientException); - } - else - { - client->errorValue = stuff->id; - return (BadColor); - } + + rc = dixLookupResource((pointer *)&pcmp, stuff->id, RT_COLORMAP, client, + DixInstallAccess); + if (rc != Success) + goto out; + + rc = XaceHook(XACE_SCREEN_ACCESS, client, pcmp->pScreen, DixSetAttrAccess); + if (rc != Success) + goto out; + + (*(pcmp->pScreen->InstallColormap)) (pcmp); + + rc = client->noClientException; +out: + client->errorValue = stuff->id; + return (rc == BadValue) ? BadColor : rc; } int -ProcUninstallColormap(register ClientPtr client) +ProcUninstallColormap(ClientPtr client) { ColormapPtr pcmp; + int rc; REQUEST(xResourceReq); - REQUEST_SIZE_MATCH(xResourceReq); - pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->id, - RT_COLORMAP, SecurityReadAccess); - if (pcmp) - { - if(pcmp->mid != pcmp->pScreen->defColormap) - (*(pcmp->pScreen->UninstallColormap)) (pcmp); - return (client->noClientException); - } - else - { - client->errorValue = stuff->id; - return (BadColor); - } + + rc = dixLookupResource((pointer *)&pcmp, stuff->id, RT_COLORMAP, client, + DixUninstallAccess); + if (rc != Success) + goto out; + + rc = XaceHook(XACE_SCREEN_ACCESS, client, pcmp->pScreen, DixSetAttrAccess); + if (rc != Success) + goto out; + + if(pcmp->mid != pcmp->pScreen->defColormap) + (*(pcmp->pScreen->UninstallColormap)) (pcmp); + + rc = client->noClientException; +out: + client->errorValue = stuff->id; + return (rc == BadValue) ? BadColor : rc; } int -ProcListInstalledColormaps(register ClientPtr client) +ProcListInstalledColormaps(ClientPtr client) { xListInstalledColormapsReply *preply; - int nummaps; + int nummaps, rc; WindowPtr pWin; REQUEST(xResourceReq); - REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - SecurityReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess); + if (rc != Success) + goto out; + + rc = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen, + DixGetAttrAccess); + if (rc != Success) + goto out; preply = (xListInstalledColormapsReply *) - ALLOCATE_LOCAL(sizeof(xListInstalledColormapsReply) + + xalloc(sizeof(xListInstalledColormapsReply) + pWin->drawable.pScreen->maxInstalledCmaps * sizeof(Colormap)); if(!preply) @@ -2587,22 +2427,24 @@ ProcListInstalledColormaps(register ClientPtr client) WriteReplyToClient(client, sizeof (xListInstalledColormapsReply), preply); client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]); - DEALLOCATE_LOCAL(preply); - return(client->noClientException); + xfree(preply); + rc = client->noClientException; +out: + return rc; } int -ProcAllocColor (register ClientPtr client) +ProcAllocColor (ClientPtr client) { ColormapPtr pmap; - int retval; + int rc; xAllocColorReply acr; REQUEST(xAllocColorReq); REQUEST_SIZE_MATCH(xAllocColorReq); - pmap = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, SecurityWriteAccess); - if (pmap) + rc = dixLookupResource((pointer *)&pmap, stuff->cmap, RT_COLORMAP, client, + DixAddAccess); + if (rc == Success) { acr.type = X_Reply; acr.length = 0; @@ -2611,13 +2453,13 @@ ProcAllocColor (register ClientPtr client) acr.green = stuff->green; acr.blue = stuff->blue; acr.pixel = 0; - if( (retval = AllocColor(pmap, &acr.red, &acr.green, &acr.blue, + if( (rc = AllocColor(pmap, &acr.red, &acr.green, &acr.blue, &acr.pixel, client->index)) ) { if (client->noClientException != Success) return(client->noClientException); else - return (retval); + return rc; } #ifdef PANORAMIX if (noPanoramiXExtension || !pmap->pScreen->myNum) @@ -2629,23 +2471,22 @@ ProcAllocColor (register ClientPtr client) else { client->errorValue = stuff->cmap; - return (BadColor); + return (rc == BadValue) ? BadColor : rc; } } int -ProcAllocNamedColor (register ClientPtr client) +ProcAllocNamedColor (ClientPtr client) { ColormapPtr pcmp; + int rc; REQUEST(xAllocNamedColorReq); REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes); - pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, SecurityWriteAccess); - if (pcmp) + rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + DixAddAccess); + if (rc == Success) { - int retval; - xAllocNamedColorReply ancr; ancr.type = X_Reply; @@ -2659,14 +2500,14 @@ ProcAllocNamedColor (register ClientPtr client) ancr.screenGreen = ancr.exactGreen; ancr.screenBlue = ancr.exactBlue; ancr.pixel = 0; - if( (retval = AllocColor(pcmp, + if( (rc = AllocColor(pcmp, &ancr.screenRed, &ancr.screenGreen, &ancr.screenBlue, &ancr.pixel, client->index)) ) { if (client->noClientException != Success) return(client->noClientException); else - return(retval); + return rc; } #ifdef PANORAMIX if (noPanoramiXExtension || !pcmp->pScreen->myNum) @@ -2681,23 +2522,24 @@ ProcAllocNamedColor (register ClientPtr client) else { client->errorValue = stuff->cmap; - return (BadColor); + return (rc == BadValue) ? BadColor : rc; } } int -ProcAllocColorCells (register ClientPtr client) +ProcAllocColorCells (ClientPtr client) { ColormapPtr pcmp; + int rc; REQUEST(xAllocColorCellsReq); REQUEST_SIZE_MATCH(xAllocColorCellsReq); - pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, SecurityWriteAccess); - if (pcmp) + rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + DixAddAccess); + if (rc == Success) { xAllocColorCellsReply accr; - int npixels, nmasks, retval; + int npixels, nmasks; long length; Pixel *ppixels, *pmasks; @@ -2714,19 +2556,19 @@ ProcAllocColorCells (register ClientPtr client) } nmasks = stuff->planes; length = ((long)npixels + (long)nmasks) * sizeof(Pixel); - ppixels = (Pixel *)ALLOCATE_LOCAL(length); + ppixels = (Pixel *)xalloc(length); if(!ppixels) return(BadAlloc); pmasks = ppixels + npixels; - if( (retval = AllocColorCells(client->index, pcmp, npixels, nmasks, + if( (rc = AllocColorCells(client->index, pcmp, npixels, nmasks, (Bool)stuff->contiguous, ppixels, pmasks)) ) { - DEALLOCATE_LOCAL(ppixels); + xfree(ppixels); if (client->noClientException != Success) return(client->noClientException); else - return(retval); + return rc; } #ifdef PANORAMIX if (noPanoramiXExtension || !pcmp->pScreen->myNum) @@ -2741,29 +2583,30 @@ ProcAllocColorCells (register ClientPtr client) client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, length, ppixels); } - DEALLOCATE_LOCAL(ppixels); + xfree(ppixels); return (client->noClientException); } else { client->errorValue = stuff->cmap; - return (BadColor); + return (rc == BadValue) ? BadColor : rc; } } int -ProcAllocColorPlanes(register ClientPtr client) +ProcAllocColorPlanes(ClientPtr client) { ColormapPtr pcmp; + int rc; REQUEST(xAllocColorPlanesReq); REQUEST_SIZE_MATCH(xAllocColorPlanesReq); - pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, SecurityWriteAccess); - if (pcmp) + rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + DixAddAccess); + if (rc == Success) { xAllocColorPlanesReply acpr; - int npixels, retval; + int npixels; long length; Pixel *ppixels; @@ -2782,19 +2625,19 @@ ProcAllocColorPlanes(register ClientPtr client) acpr.sequenceNumber = client->sequence; acpr.nPixels = npixels; length = (long)npixels * sizeof(Pixel); - ppixels = (Pixel *)ALLOCATE_LOCAL(length); + ppixels = (Pixel *)xalloc(length); if(!ppixels) return(BadAlloc); - if( (retval = AllocColorPlanes(client->index, pcmp, npixels, + if( (rc = AllocColorPlanes(client->index, pcmp, npixels, (int)stuff->red, (int)stuff->green, (int)stuff->blue, (Bool)stuff->contiguous, ppixels, &acpr.redMask, &acpr.greenMask, &acpr.blueMask)) ) { - DEALLOCATE_LOCAL(ppixels); + xfree(ppixels); if (client->noClientException != Success) return(client->noClientException); else - return(retval); + return rc; } acpr.length = length >> 2; #ifdef PANORAMIX @@ -2805,48 +2648,48 @@ ProcAllocColorPlanes(register ClientPtr client) client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, length, ppixels); } - DEALLOCATE_LOCAL(ppixels); + xfree(ppixels); return (client->noClientException); } else { client->errorValue = stuff->cmap; - return (BadColor); + return (rc == BadValue) ? BadColor : rc; } } int -ProcFreeColors(register ClientPtr client) +ProcFreeColors(ClientPtr client) { ColormapPtr pcmp; + int rc; REQUEST(xFreeColorsReq); REQUEST_AT_LEAST_SIZE(xFreeColorsReq); - pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, SecurityWriteAccess); - if (pcmp) + rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + DixRemoveAccess); + if (rc == Success) { int count; - int retval; if(pcmp->flags & AllAllocated) return(BadAccess); count = ((client->req_len << 2)- sizeof(xFreeColorsReq)) >> 2; - retval = FreeColors(pcmp, client->index, count, + rc = FreeColors(pcmp, client->index, count, (Pixel *)&stuff[1], (Pixel)stuff->planeMask); if (client->noClientException != Success) return(client->noClientException); else { client->errorValue = clientErrorValue; - return(retval); + return rc; } } else { client->errorValue = stuff->cmap; - return (BadColor); + return (rc == BadValue) ? BadColor : rc; } } @@ -2854,98 +2697,99 @@ int ProcStoreColors (ClientPtr client) { ColormapPtr pcmp; + int rc; REQUEST(xStoreColorsReq); REQUEST_AT_LEAST_SIZE(xStoreColorsReq); - pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, SecurityWriteAccess); - if (pcmp) + rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + DixWriteAccess); + if (rc == Success) { int count; - int retval; count = (client->req_len << 2) - sizeof(xStoreColorsReq); if (count % sizeof(xColorItem)) return(BadLength); count /= sizeof(xColorItem); - retval = StoreColors(pcmp, count, (xColorItem *)&stuff[1]); + rc = StoreColors(pcmp, count, (xColorItem *)&stuff[1]); if (client->noClientException != Success) return(client->noClientException); else { client->errorValue = clientErrorValue; - return(retval); + return rc; } } else { client->errorValue = stuff->cmap; - return (BadColor); + return (rc == BadValue) ? BadColor : rc; } } int -ProcStoreNamedColor (register ClientPtr client) +ProcStoreNamedColor (ClientPtr client) { ColormapPtr pcmp; + int rc; REQUEST(xStoreNamedColorReq); REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes); - pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, SecurityWriteAccess); - if (pcmp) + rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + DixWriteAccess); + if (rc == Success) { xColorItem def; - int retval; if(OsLookupColor(pcmp->pScreen->myNum, (char *)&stuff[1], stuff->nbytes, &def.red, &def.green, &def.blue)) { def.flags = stuff->flags; def.pixel = stuff->pixel; - retval = StoreColors(pcmp, 1, &def); + rc = StoreColors(pcmp, 1, &def); if (client->noClientException != Success) return(client->noClientException); else - return(retval); + return rc; } return (BadName); } else { client->errorValue = stuff->cmap; - return (BadColor); + return (rc == BadValue) ? BadColor : rc; } } int -ProcQueryColors(register ClientPtr client) +ProcQueryColors(ClientPtr client) { ColormapPtr pcmp; + int rc; REQUEST(xQueryColorsReq); REQUEST_AT_LEAST_SIZE(xQueryColorsReq); - pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, SecurityReadAccess); - if (pcmp) + rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + DixReadAccess); + if (rc == Success) { - int count, retval; + int count; xrgb *prgbs; xQueryColorsReply qcr; count = ((client->req_len << 2) - sizeof(xQueryColorsReq)) >> 2; - prgbs = (xrgb *)ALLOCATE_LOCAL(count * sizeof(xrgb)); + prgbs = (xrgb *)xalloc(count * sizeof(xrgb)); if(!prgbs && count) return(BadAlloc); - if( (retval = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) ) + if( (rc = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) ) { - if (prgbs) DEALLOCATE_LOCAL(prgbs); + if (prgbs) xfree(prgbs); if (client->noClientException != Success) return(client->noClientException); else { client->errorValue = clientErrorValue; - return (retval); + return rc; } } qcr.type = X_Reply; @@ -2958,27 +2802,28 @@ ProcQueryColors(register ClientPtr client) client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend; WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs); } - if (prgbs) DEALLOCATE_LOCAL(prgbs); + if (prgbs) xfree(prgbs); return(client->noClientException); } else { client->errorValue = stuff->cmap; - return (BadColor); + return (rc == BadValue) ? BadColor : rc; } } int -ProcLookupColor(register ClientPtr client) +ProcLookupColor(ClientPtr client) { ColormapPtr pcmp; + int rc; REQUEST(xLookupColorReq); REQUEST_FIXED_SIZE(xLookupColorReq, stuff->nbytes); - pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, SecurityReadAccess); - if (pcmp) + rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + DixReadAccess); + if (rc == Success) { xLookupColorReply lcr; @@ -3003,44 +2848,43 @@ ProcLookupColor(register ClientPtr client) else { client->errorValue = stuff->cmap; - return (BadColor); + return (rc == BadValue) ? BadColor : rc; } } int -ProcCreateCursor (register ClientPtr client) +ProcCreateCursor (ClientPtr client) { - CursorPtr pCursor; - - register PixmapPtr src; - register PixmapPtr msk; + CursorPtr pCursor; + PixmapPtr src; + PixmapPtr msk; unsigned char * srcbits; unsigned char * mskbits; unsigned short width, height; long n; - CursorMetricRec cm; - + CursorMetricRec cm; + int rc; REQUEST(xCreateCursorReq); REQUEST_SIZE_MATCH(xCreateCursorReq); LEGAL_NEW_RESOURCE(stuff->cid, client); - src = (PixmapPtr)SecurityLookupIDByType(client, stuff->source, - RT_PIXMAP, SecurityReadAccess); - msk = (PixmapPtr)SecurityLookupIDByType(client, stuff->mask, - RT_PIXMAP, SecurityReadAccess); - if ( src == (PixmapPtr)NULL) - { + rc = dixLookupResource((pointer *)&src, stuff->source, RT_PIXMAP, client, + DixReadAccess); + if (rc != Success) { client->errorValue = stuff->source; - return (BadPixmap); + return (rc == BadValue) ? BadPixmap : rc; } - if ( msk == (PixmapPtr)NULL) + + rc = dixLookupResource((pointer *)&msk, stuff->mask, RT_PIXMAP, client, + DixReadAccess); + if (rc != Success) { if (stuff->mask != None) { client->errorValue = stuff->mask; - return (BadPixmap); + return (rc == BadValue) ? BadPixmap : rc; } } else if ( src->drawable.width != msk->drawable.width @@ -3073,7 +2917,7 @@ ProcCreateCursor (register ClientPtr client) XYPixmap, 1, (pointer)srcbits); if ( msk == (PixmapPtr)NULL) { - register unsigned char *bits = mskbits; + unsigned char *bits = mskbits; while (--n >= 0) *bits++ = ~0; } @@ -3088,17 +2932,21 @@ ProcCreateCursor (register ClientPtr client) cm.height = height; cm.xhot = stuff->x; cm.yhot = stuff->y; - pCursor = AllocCursor( srcbits, mskbits, &cm, - stuff->foreRed, stuff->foreGreen, stuff->foreBlue, - stuff->backRed, stuff->backGreen, stuff->backBlue); + rc = AllocARGBCursor(srcbits, mskbits, NULL, &cm, + stuff->foreRed, stuff->foreGreen, stuff->foreBlue, + stuff->backRed, stuff->backGreen, stuff->backBlue, + &pCursor, client, stuff->cid); + + if (rc != Success) + return rc; + if (!AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor)) + return BadAlloc; - if (pCursor && AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor)) - return (client->noClientException); - return BadAlloc; + return client->noClientException; } int -ProcCreateGlyphCursor (register ClientPtr client) +ProcCreateGlyphCursor (ClientPtr client) { CursorPtr pCursor; int res; @@ -3112,7 +2960,7 @@ ProcCreateGlyphCursor (register ClientPtr client) stuff->mask, stuff->maskChar, stuff->foreRed, stuff->foreGreen, stuff->foreBlue, stuff->backRed, stuff->backGreen, stuff->backBlue, - &pCursor, client); + &pCursor, client, stuff->cid); if (res != Success) return res; if (AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor)) @@ -3122,15 +2970,16 @@ ProcCreateGlyphCursor (register ClientPtr client) int -ProcFreeCursor (register ClientPtr client) +ProcFreeCursor (ClientPtr client) { CursorPtr pCursor; + int rc; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->id, - RT_CURSOR, SecurityDestroyAccess); - if (pCursor) + rc = dixLookupResource((pointer *)&pCursor, stuff->id, RT_CURSOR, client, + DixDestroyAccess); + if (rc == Success) { FreeResource(stuff->id, RT_NONE); return (client->noClientException); @@ -3138,19 +2987,20 @@ ProcFreeCursor (register ClientPtr client) else { client->errorValue = stuff->id; - return (BadCursor); + return (rc == BadValue) ? BadCursor : rc; } } int -ProcQueryBestSize (register ClientPtr client) +ProcQueryBestSize (ClientPtr client) { xQueryBestSizeReply reply; - register DrawablePtr pDraw; + DrawablePtr pDraw; ScreenPtr pScreen; + int rc; REQUEST(xQueryBestSizeReq); - REQUEST_SIZE_MATCH(xQueryBestSizeReq); + if ((stuff->class != CursorShape) && (stuff->class != TileShape) && (stuff->class != StippleShape)) @@ -3158,11 +3008,17 @@ ProcQueryBestSize (register ClientPtr client) client->errorValue = stuff->class; return(BadValue); } - SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->drawable, client, - SecurityReadAccess); + + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY, + DixGetAttrAccess); + if (rc != Success) + return rc; if (stuff->class != CursorShape && pDraw->type == UNDRAWABLE_WINDOW) return (BadMatch); pScreen = pDraw->pScreen; + rc = XaceHook(XACE_SCREEN_ACCESS, client, pScreen, DixGetAttrAccess); + if (rc != Success) + return rc; (* pScreen->QueryBestSize)(stuff->class, &stuff->width, &stuff->height, pScreen); reply.type = X_Reply; @@ -3176,12 +3032,19 @@ ProcQueryBestSize (register ClientPtr client) int -ProcSetScreenSaver (register ClientPtr client) +ProcSetScreenSaver (ClientPtr client) { - int blankingOption, exposureOption; + int rc, i, blankingOption, exposureOption; REQUEST(xSetScreenSaverReq); - REQUEST_SIZE_MATCH(xSetScreenSaverReq); + + for (i = 0; i < screenInfo.numScreens; i++) { + rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i], + DixSetAttrAccess); + if (rc != Success) + return rc; + } + blankingOption = stuff->preferBlank; if ((blankingOption != DontPreferBlanking) && (blankingOption != PreferBlanking) && @@ -3232,11 +3095,19 @@ ProcSetScreenSaver (register ClientPtr client) } int -ProcGetScreenSaver(register ClientPtr client) +ProcGetScreenSaver(ClientPtr client) { xGetScreenSaverReply rep; - + int rc, i; REQUEST_SIZE_MATCH(xReq); + + for (i = 0; i < screenInfo.numScreens; i++) { + rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i], + DixGetAttrAccess); + if (rc != Success) + return rc; + } + rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; @@ -3249,7 +3120,7 @@ ProcGetScreenSaver(register ClientPtr client) } int -ProcChangeHosts(register ClientPtr client) +ProcChangeHosts(ClientPtr client) { REQUEST(xChangeHostsReq); int result; @@ -3273,7 +3144,7 @@ ProcChangeHosts(register ClientPtr client) } int -ProcListHosts(register ClientPtr client) +ProcListHosts(ClientPtr client) { xListHostsReply reply; int len, nHosts, result; @@ -3281,13 +3152,12 @@ ProcListHosts(register ClientPtr client) /* REQUEST(xListHostsReq); */ REQUEST_SIZE_MATCH(xListHostsReq); -#ifdef XACE + /* untrusted clients can't list hosts */ - if (!XaceHook(XACE_HOSTLIST_ACCESS, client, SecurityReadAccess)) - { - return BadAccess; - } -#endif + result = XaceHook(XACE_SERVER_ACCESS, client, DixReadAccess); + if (result != Success) + return result; + result = GetHosts(&pdata, &nHosts, &len, &reply.enabled); if (result != Success) return(result); @@ -3306,7 +3176,7 @@ ProcListHosts(register ClientPtr client) } int -ProcChangeAccessControl(register ClientPtr client) +ProcChangeAccessControl(ClientPtr client) { int result; REQUEST(xSetAccessControlReq); @@ -3323,11 +3193,34 @@ ProcChangeAccessControl(register ClientPtr client) return (result); } +/********************* + * CloseDownRetainedResources + * + * Find all clients that are gone and have terminated in RetainTemporary + * and destroy their resources. + *********************/ + +static void +CloseDownRetainedResources(void) +{ + int i; + ClientPtr client; + + for (i=1; i<currentMaxClients; i++) + { + client = clients[i]; + if (client && (client->closeDownMode == RetainTemporary) + && (client->clientGone)) + CloseDownClient(client); + } +} + int -ProcKillClient(register ClientPtr client) +ProcKillClient(ClientPtr client) { REQUEST(xResourceReq); - ClientPtr killclient; + ClientPtr killclient; + int rc; REQUEST_SIZE_MATCH(xResourceReq); if (stuff->id == AllTemporary) @@ -3336,8 +3229,8 @@ ProcKillClient(register ClientPtr client) return (client->noClientException); } - if ((killclient = LookupClient(stuff->id, client))) - { + rc = dixLookupClient(&killclient, stuff->id, client, DixDestroyAccess); + if (rc == Success) { CloseDownClient(killclient); /* if an LBX proxy gets killed, isItTimeToYield will be set */ if (isItTimeToYield || (client == killclient)) @@ -3351,14 +3244,11 @@ ProcKillClient(register ClientPtr client) return (client->noClientException); } else - { - client->errorValue = stuff->id; - return (BadValue); - } + return rc; } int -ProcSetFontPath(register ClientPtr client) +ProcSetFontPath(ClientPtr client) { unsigned char *ptr; unsigned long nbytes, total; @@ -3393,15 +3283,17 @@ ProcSetFontPath(register ClientPtr client) } int -ProcGetFontPath(register ClientPtr client) +ProcGetFontPath(ClientPtr client) { xGetFontPathReply reply; - int stringLens, numpaths; + int rc, stringLens, numpaths; unsigned char *bufferStart; /* REQUEST (xReq); */ REQUEST_SIZE_MATCH(xReq); - bufferStart = GetFontPath(&numpaths, &stringLens); + rc = GetFontPath(client, &numpaths, &stringLens, &bufferStart); + if (rc != Success) + return rc; reply.type = X_Reply; reply.sequenceNumber = client->sequence; @@ -3415,11 +3307,16 @@ ProcGetFontPath(register ClientPtr client) } int -ProcChangeCloseDownMode(register ClientPtr client) +ProcChangeCloseDownMode(ClientPtr client) { + int rc; REQUEST(xSetCloseDownModeReq); - REQUEST_SIZE_MATCH(xSetCloseDownModeReq); + + rc = XaceHook(XACE_CLIENT_ACCESS, client, client, DixManageAccess); + if (rc != Success) + return rc; + if ((stuff->mode == AllTemporary) || (stuff->mode == RetainPermanent) || (stuff->mode == RetainTemporary)) @@ -3434,8 +3331,9 @@ ProcChangeCloseDownMode(register ClientPtr client) } } -int ProcForceScreenSaver(register ClientPtr client) +int ProcForceScreenSaver(ClientPtr client) { + int rc; REQUEST(xForceScreenSaverReq); REQUEST_SIZE_MATCH(xForceScreenSaverReq); @@ -3446,11 +3344,13 @@ int ProcForceScreenSaver(register ClientPtr client) client->errorValue = stuff->mode; return BadValue; } - SaveScreens(SCREEN_SAVER_FORCER, (int)stuff->mode); + rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, (int)stuff->mode); + if (rc != Success) + return rc; return client->noClientException; } -int ProcNoOperation(register ClientPtr client) +int ProcNoOperation(ClientPtr client) { REQUEST_AT_LEAST_SIZE(xReq); @@ -3469,12 +3369,6 @@ InitProcVectors(void) ProcVector[i] = SwappedProcVector[i] = ProcBadRequest; ReplySwapVector[i] = ReplyNotSwappd; } -#ifdef K5AUTH - if (!k5_Vector[i]) - { - k5_Vector[i] = k5_bad; - } -#endif } for(i = LASTEvent; i < 128; i++) { @@ -3493,7 +3387,7 @@ InitProcVectors(void) char dispatchExceptionAtReset = DE_RESET; void -CloseDownClient(register ClientPtr client) +CloseDownClient(ClientPtr client) { Bool really_close_down = client->clientGone || client->closeDownMode == DestroyAll; @@ -3565,12 +3459,16 @@ CloseDownClient(register ClientPtr client) CallCallbacks((&ClientStateCallback), (pointer)&clientinfo); } FreeClientResources(client); +#ifdef XSERVER_DTRACE + XSERVER_CLIENT_DISCONNECT(client->index); +#endif if (client->index < nextFreeClientID) nextFreeClientID = client->index; clients[client->index] = NullClient; #ifdef SMART_SCHEDULE SmartLastClient = NullClient; #endif + dixFreePrivates(client->devPrivates); xfree(client); while (!clients[currentMaxClients-1]) @@ -3579,7 +3477,7 @@ CloseDownClient(register ClientPtr client) } static void -KillAllClients() +KillAllClients(void) { int i; for (i=1; i<currentMaxClients; i++) @@ -3590,52 +3488,13 @@ KillAllClients() } } -/********************* - * CloseDownRetainedResources - * - * Find all clients that are gone and have terminated in RetainTemporary - * and destroy their resources. - *********************/ - -void -CloseDownRetainedResources() -{ - register int i; - register ClientPtr client; - - for (i=1; i<currentMaxClients; i++) - { - client = clients[i]; - if (client && (client->closeDownMode == RetainTemporary) - && (client->clientGone)) - CloseDownClient(client); - } -} - -extern int clientPrivateLen; -extern unsigned *clientPrivateSizes; -extern unsigned totalClientSize; - void InitClient(ClientPtr client, int i, pointer ospriv) { client->index = i; client->sequence = 0; client->clientAsMask = ((Mask)i) << CLIENTOFFSET; client->clientGone = FALSE; - if (i) - { - client->closeDownMode = DestroyAll; - client->lastDrawable = (DrawablePtr)WindowTable[0]; - client->lastDrawableID = WindowTable[0]->drawable.id; - } - else - { - client->closeDownMode = RetainPermanent; - client->lastDrawable = (DrawablePtr)NULL; - client->lastDrawableID = INVALID; - } - client->lastGC = (GCPtr) NULL; - client->lastGCID = INVALID; + client->closeDownMode = i ? DestroyAll : RetainPermanent; client->numSaved = 0; client->saveSet = (SaveSetElt *)NULL; client->noClientException = Success; @@ -3648,6 +3507,7 @@ void InitClient(ClientPtr client, int i, pointer ospriv) client->big_requests = FALSE; client->priority = 0; client->clientState = ClientStateInitial; + client->devPrivates = NULL; #ifdef XKB if (!noXkbExtension) { client->xkbClientFlags = 0; @@ -3668,52 +3528,6 @@ void InitClient(ClientPtr client, int i, pointer ospriv) #endif } -int -InitClientPrivates(ClientPtr client) -{ - register char *ptr; - DevUnion *ppriv; - register unsigned *sizes; - register unsigned size; - register int i; - - if (totalClientSize == sizeof(ClientRec)) - ppriv = (DevUnion *)NULL; - else if (client->index) - ppriv = (DevUnion *)(client + 1); - else - { - ppriv = (DevUnion *)xalloc(totalClientSize - sizeof(ClientRec)); - if (!ppriv) - return 0; - } - client->devPrivates = ppriv; - sizes = clientPrivateSizes; - ptr = (char *)(ppriv + clientPrivateLen); - for (i = clientPrivateLen; --i >= 0; ppriv++, sizes++) - { - if ( (size = *sizes) ) - { - ppriv->ptr = (pointer)ptr; - ptr += size; - } - else - ppriv->ptr = (pointer)NULL; - } - - /* Allow registrants to initialize the serverClient devPrivates */ - if (!client->index && ClientStateCallback) - { - NewClientInfoRec clientinfo; - - clientinfo.client = client; - clientinfo.prefix = (xConnSetupPrefix *)NULL; - clientinfo.setup = (xConnSetup *) NULL; - CallCallbacks((&ClientStateCallback), (pointer)&clientinfo); - } - return 1; -} - /************************ * int NextAvailableClient(ospriv) * @@ -3723,18 +3537,17 @@ InitClientPrivates(ClientPtr client) ClientPtr NextAvailableClient(pointer ospriv) { - register int i; - register ClientPtr client; + int i; + ClientPtr client; xReq data; i = nextFreeClientID; if (i == MAXCLIENTS) return (ClientPtr)NULL; - clients[i] = client = (ClientPtr)xalloc(totalClientSize); + clients[i] = client = (ClientPtr)xalloc(sizeof(ClientRec)); if (!client) return (ClientPtr)NULL; InitClient(client, i, ospriv); - InitClientPrivates(client); if (!InitClientResources(client)) { xfree(client); @@ -3765,10 +3578,10 @@ ClientPtr NextAvailableClient(pointer ospriv) } int -ProcInitialConnection(register ClientPtr client) +ProcInitialConnection(ClientPtr client) { REQUEST(xReq); - register xConnClientPrefix *prefix; + xConnClientPrefix *prefix; int whichbyte = 1; prefix = (xConnClientPrefix *)((char *)stuff + sz_xReq); @@ -3791,11 +3604,11 @@ ProcInitialConnection(register ClientPtr client) return (client->noClientException); } -int -SendConnSetup(register ClientPtr client, char *reason) +static int +SendConnSetup(ClientPtr client, char *reason) { - register xWindowRoot *root; - register int i; + xWindowRoot *root; + int i; int numScreens; char* lConnectionInfo; xConnSetupPrefix* lconnSetupPrefix; @@ -3850,8 +3663,8 @@ SendConnSetup(register ClientPtr client, char *reason) for (i=0; i<numScreens; i++) { - register unsigned int j; - register xDepth *pDepth; + unsigned int j; + xDepth *pDepth; root->currentInputMask = WindowTable[i]->eventMask | wOtherEventMasks (WindowTable[i]); @@ -3892,10 +3705,10 @@ SendConnSetup(register ClientPtr client, char *reason) } int -ProcEstablishConnection(register ClientPtr client) +ProcEstablishConnection(ClientPtr client) { char *reason, *auth_proto, *auth_string; - register xConnClientPrefix *prefix; + xConnClientPrefix *prefix; REQUEST(xReq); prefix = (xConnClientPrefix *)((char *)stuff + sz_xReq); @@ -3942,50 +3755,6 @@ SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode, } void -DeleteWindowFromAnySelections(WindowPtr pWin) -{ - register int i; - - for (i = 0; i< NumCurrentSelections; i++) - if (CurrentSelections[i].pWin == pWin) - { - if (SelectionCallback) - { - SelectionInfoRec info; - - info.selection = &CurrentSelections[i]; - info.kind = SelectionWindowDestroy; - CallCallbacks(&SelectionCallback, &info); - } - CurrentSelections[i].pWin = (WindowPtr)NULL; - CurrentSelections[i].window = None; - CurrentSelections[i].client = NullClient; - } -} - -static void -DeleteClientFromAnySelections(ClientPtr client) -{ - register int i; - - for (i = 0; i< NumCurrentSelections; i++) - if (CurrentSelections[i].client == client) - { - if (SelectionCallback) - { - SelectionInfoRec info; - - info.selection = &CurrentSelections[i]; - info.kind = SelectionWindowDestroy; - CallCallbacks(&SelectionCallback, &info); - } - CurrentSelections[i].pWin = (WindowPtr)NULL; - CurrentSelections[i].window = None; - CurrentSelections[i].client = NullClient; - } -} - -void MarkClientException(ClientPtr client) { client->noClientException = -1; diff --git a/xserver/dix/dixfonts.c b/xserver/dix/dixfonts.c index 7bb2404c2..e9a3f3963 100644 --- a/xserver/dix/dixfonts.c +++ b/xserver/dix/dixfonts.c @@ -65,6 +65,7 @@ Equipment Corporation. #include "dixfontstr.h" #include "closestr.h" #include "dixfont.h" +#include "xace.h" #ifdef DEBUG #include <stdio.h> @@ -784,7 +785,7 @@ finish: reply.nFonts = nnames; reply.sequenceNumber = client->sequence; - bufptr = bufferStart = (char *) ALLOCATE_LOCAL(reply.length << 2); + bufptr = bufferStart = (char *) xalloc(reply.length << 2); if (!bufptr && reply.length) { SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc); @@ -809,7 +810,7 @@ finish: client->pSwapReplyFunc = ReplySwapVector[X_ListFonts]; WriteSwappedDataToClient(client, sizeof(xListFontsReply), &reply); (void) WriteToClient(client, stringLens + nnames, bufferStart); - DEALLOCATE_LOCAL(bufferStart); + xfree(bufferStart); bail: if (c->slept) @@ -840,6 +841,10 @@ ListFonts(ClientPtr client, unsigned char *pattern, unsigned length, if (length > XLFDMAXFONTNAMELEN) return BadAlloc; + i = XaceHook(XACE_SERVER_ACCESS, client, DixGetAttrAccess); + if (i != Success) + return i; + if (!(c = (LFclosurePtr) xalloc(sizeof *c))) return BadAlloc; c->fpe_list = (FontPathElementPtr *) @@ -1112,6 +1117,10 @@ StartListFontsWithInfo(ClientPtr client, int length, unsigned char *pattern, if (length > XLFDMAXFONTNAMELEN) return BadAlloc; + i = XaceHook(XACE_SERVER_ACCESS, client, DixGetAttrAccess); + if (i != Success) + return i; + if (!(c = (LFWIclosurePtr) xalloc(sizeof *c))) goto badAlloc; c->fpe_list = (FontPathElementPtr *) @@ -1635,9 +1644,6 @@ FreeFontPath(FontPathElementPtr *list, int n, Bool force) found++; } if (list[i]->refcount != found) { - ErrorF("FreeFontPath: FPE \"%.*s\" refcount is %d, should be %d; fixing.\n", - list[i]->name_length, list[i]->name, - list[i]->refcount, found); list[i]->refcount = found; /* ensure it will get freed */ } } @@ -1778,7 +1784,9 @@ bail: int SetFontPath(ClientPtr client, int npaths, unsigned char *paths, int *error) { - int err = Success; + int err = XaceHook(XACE_SERVER_ACCESS, client, DixManageAccess); + if (err != Success) + return err; if (npaths == 0) { if (SetDefaultFontPath(defaultFontPath) != Success) @@ -1804,7 +1812,7 @@ SetDefaultFontPath(char *path) /* get enough for string, plus values -- use up commas */ len = strlen(path) + 1; - nump = cp = newpath = (unsigned char *) ALLOCATE_LOCAL(len); + nump = cp = newpath = (unsigned char *) xalloc(len); if (!newpath) return BadAlloc; pp = (unsigned char *) path; @@ -1825,19 +1833,23 @@ SetDefaultFontPath(char *path) err = SetFontPathElements(num, newpath, &bad, TRUE); - DEALLOCATE_LOCAL(newpath); + xfree(newpath); return err; } -unsigned char * -GetFontPath(int *count, int *length) +int +GetFontPath(ClientPtr client, int *count, int *length, unsigned char **result) { int i; unsigned char *c; int len; FontPathElementPtr fpe; + i = XaceHook(XACE_SERVER_ACCESS, client, DixGetAttrAccess); + if (i != Success) + return i; + len = 0; for (i = 0; i < num_fpes; i++) { fpe = font_path_elements[i]; @@ -1845,7 +1857,7 @@ GetFontPath(int *count, int *length) } font_path_string = (unsigned char *) xrealloc(font_path_string, len); if (!font_path_string) - return NULL; + return BadAlloc; c = font_path_string; *length = 0; @@ -1857,7 +1869,8 @@ GetFontPath(int *count, int *length) c += fpe->name_length; } *count = num_fpes; - return font_path_string; + *result = font_path_string; + return Success; } _X_EXPORT int @@ -1918,12 +1931,15 @@ GetDefaultPointSize () FontResolutionPtr GetClientResolutions (int *num) { +#ifdef XPRINT if (requestingClient && requestingClient->fontResFunc != NULL && !requestingClient->clientGone) { return (*requestingClient->fontResFunc)(requestingClient, num); } - else { + else +#endif + { static struct _FontResolution res; ScreenPtr pScreen; diff --git a/xserver/dix/dixutils.c b/xserver/dix/dixutils.c index a395d4474..aaf510623 100644 --- a/xserver/dix/dixutils.c +++ b/xserver/dix/dixutils.c @@ -95,9 +95,7 @@ Author: Adobe Systems Incorporated #include "scrnintstr.h" #define XK_LATIN1 #include <X11/keysymdef.h> -#ifdef XACE #include "xace.h" -#endif /* * CompareTimeStamps returns -1, 0, or +1 depending on if the first @@ -170,7 +168,7 @@ ISOLatin1ToLower (unsigned char source) _X_EXPORT void CopyISOLatin1Lowered(unsigned char *dest, unsigned char *source, int length) { - register int i; + int i; for (i = 0; i < length; i++, source++, dest++) *dest = ISOLatin1ToLower (*source); @@ -196,116 +194,87 @@ CompareISOLatin1Lowered(unsigned char *s1, int s1len, return (int) c1 - (int) c2; } -#ifdef XACE - -/* SecurityLookupWindow and SecurityLookupDrawable: - * Look up the window/drawable taking into account the client doing - * the lookup and the type of access desired. Return the window/drawable - * if it exists and the client is allowed access, else return NULL. - * Most Proc* functions should be calling these instead of - * LookupWindow and LookupDrawable, which do no access checks. - * XACE note: need to see if client->lastDrawableID can still be used here. +/* + * dixLookupWindow and dixLookupDrawable: + * Look up the window/drawable taking into account the client doing the + * lookup, the type of drawable desired, and the type of access desired. + * Return Success with *pDraw set if the window/drawable exists and the client + * is allowed access, else return an error code with *pDraw set to NULL. The + * access mask values are defined in resource.h. The type mask values are + * defined in pixmap.h, with zero equivalent to M_DRAWABLE. */ - -_X_EXPORT WindowPtr -SecurityLookupWindow(XID rid, ClientPtr client, Mask access_mode) +_X_EXPORT int +dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client, + Mask type, Mask access) { - client->errorValue = rid; - if(rid == INVALID) - return NULL; - return (WindowPtr)SecurityLookupIDByType(client, rid, RT_WINDOW, access_mode); -} + DrawablePtr pTmp; + int rc; + *pDraw = NULL; + client->errorValue = id; -_X_EXPORT pointer -SecurityLookupDrawable(XID rid, ClientPtr client, Mask access_mode) -{ - register DrawablePtr pDraw; + if (id == INVALID) + return BadDrawable; - if(rid == INVALID) - return (pointer) NULL; - pDraw = (DrawablePtr)SecurityLookupIDByClass(client, rid, RC_DRAWABLE, - access_mode); - if (pDraw && (pDraw->type != UNDRAWABLE_WINDOW)) - return (pointer)pDraw; - return (pointer)NULL; -} + rc = dixLookupResource((pointer *)&pTmp, id, RC_DRAWABLE, client, access); -/* We can't replace the LookupWindow and LookupDrawable functions with - * macros because of compatibility with loadable servers. - */ + if (rc == BadValue) + return BadDrawable; + if (rc != Success) + return rc; + if (!((1 << pTmp->type) & (type ? type : M_DRAWABLE))) + return BadMatch; -_X_EXPORT WindowPtr -LookupWindow(XID rid, ClientPtr client) -{ - return SecurityLookupWindow(rid, client, SecurityUnknownAccess); + *pDraw = pTmp; + return Success; } -_X_EXPORT pointer -LookupDrawable(XID rid, ClientPtr client) +_X_EXPORT int +dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access) { - return SecurityLookupDrawable(rid, client, SecurityUnknownAccess); + int rc; + rc = dixLookupDrawable((DrawablePtr*)pWin, id, client, M_WINDOW, access); + return (rc == BadDrawable) ? BadWindow : rc; } -#else /* not XACE */ - -WindowPtr -LookupWindow(XID rid, ClientPtr client) +_X_EXPORT int +dixLookupGC(GCPtr *pGC, XID id, ClientPtr client, Mask access) { - WindowPtr pWin; - - client->errorValue = rid; - if(rid == INVALID) - return NULL; - if (client->lastDrawableID == rid) - { - if (client->lastDrawable->type == DRAWABLE_WINDOW) - return ((WindowPtr) client->lastDrawable); - return (WindowPtr) NULL; + GCPtr pTmp = (GCPtr)SecurityLookupIDByType(client, id, RT_GC, access); + if (pTmp) { + *pGC = pTmp; + return Success; } - pWin = (WindowPtr)LookupIDByType(rid, RT_WINDOW); - if (pWin && pWin->drawable.type == DRAWABLE_WINDOW) { - client->lastDrawable = (DrawablePtr) pWin; - client->lastDrawableID = rid; - client->lastGCID = INVALID; - client->lastGC = (GCPtr)NULL; - } - return pWin; + client->errorValue = id; + *pGC = NULL; + return BadGC; } - -pointer -LookupDrawable(XID rid, ClientPtr client) +_X_EXPORT int +dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access) { - register DrawablePtr pDraw; + pointer pRes; + int rc = BadValue, clientIndex = CLIENT_ID(rid); - if(rid == INVALID) - return (pointer) NULL; - if (client->lastDrawableID == rid) - return ((pointer) client->lastDrawable); - pDraw = (DrawablePtr)LookupIDByClass(rid, RC_DRAWABLE); - if (pDraw && (pDraw->type != UNDRAWABLE_WINDOW)) - return (pointer)pDraw; - return (pointer)NULL; -} + if (!clientIndex || !clients[clientIndex] || (rid & SERVER_BIT)) + goto bad; -#endif /* XACE */ + rc = dixLookupResource(&pRes, rid, RC_ANY, client, DixGetAttrAccess); + if (rc != Success) + goto bad; -_X_EXPORT ClientPtr -LookupClient(XID rid, ClientPtr client) -{ - pointer pRes = (pointer)SecurityLookupIDByClass(client, rid, RC_ANY, - SecurityReadAccess); - int clientIndex = CLIENT_ID(rid); + rc = XaceHook(XACE_CLIENT_ACCESS, client, clients[clientIndex], access); + if (rc != Success) + goto bad; - if (clientIndex && pRes && clients[clientIndex] && !(rid & SERVER_BIT)) - { - return clients[clientIndex]; - } - return (ClientPtr)NULL; + *pClient = clients[clientIndex]; + return Success; +bad: + client->errorValue = rid; + *pClient = NULL; + return rc; } - int AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode, Bool toRoot, Bool remap) @@ -365,8 +334,8 @@ AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode, void DeleteWindowFromAnySaveSet(WindowPtr pWin) { - register int i; - register ClientPtr client; + int i; + ClientPtr client; for (i = 0; i< currentMaxClients; i++) { @@ -407,7 +376,7 @@ static Bool handlerDeleted; void BlockHandler(pointer pTimeout, pointer pReadmask) { - register int i, j; + int i, j; ++inHandler; for (i = 0; i < screenInfo.numScreens; i++) @@ -441,7 +410,7 @@ BlockHandler(pointer pTimeout, pointer pReadmask) void WakeupHandler(int result, pointer pReadmask) { - register int i, j; + int i, j; ++inHandler; for (i = numHandlers - 1; i >= 0; i--) @@ -523,7 +492,7 @@ RemoveBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler, } void -InitBlockAndWakeupHandlers () +InitBlockAndWakeupHandlers (void) { xfree (handlers); handlers = (BlockHandlerPtr) 0; @@ -831,7 +800,7 @@ _DeleteCallbackList( for (i = 0; i < numCallbackListsToCleanup; i++) { - if ((listsToCleanup[i] = pcbl) != 0) + if (listsToCleanup[i] == pcbl) { listsToCleanup[i] = NULL; break; @@ -847,18 +816,8 @@ _DeleteCallbackList( *pcbl = NULL; } -static CallbackFuncsRec default_cbfuncs = -{ - _AddCallback, - _DeleteCallback, - _CallCallbacks, - _DeleteCallbackList -}; - -/* ===== Public Procedures ===== */ - -Bool -CreateCallbackList(CallbackListPtr *pcbl, CallbackFuncsPtr cbfuncs) +static Bool +CreateCallbackList(CallbackListPtr *pcbl) { CallbackListPtr cbl; int i; @@ -866,7 +825,6 @@ CreateCallbackList(CallbackListPtr *pcbl, CallbackFuncsPtr cbfuncs) if (!pcbl) return FALSE; cbl = (CallbackListPtr) xalloc(sizeof(CallbackListRec)); if (!cbl) return FALSE; - cbl->funcs = cbfuncs ? *cbfuncs : default_cbfuncs; cbl->inCallback = 0; cbl->deleted = FALSE; cbl->numDeleted = 0; @@ -889,41 +847,43 @@ CreateCallbackList(CallbackListPtr *pcbl, CallbackFuncsPtr cbfuncs) return TRUE; } +/* ===== Public Procedures ===== */ + _X_EXPORT Bool AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data) { if (!pcbl) return FALSE; if (!*pcbl) { /* list hasn't been created yet; go create it */ - if (!CreateCallbackList(pcbl, (CallbackFuncsPtr)NULL)) + if (!CreateCallbackList(pcbl)) return FALSE; } - return ((*(*pcbl)->funcs.AddCallback) (pcbl, callback, data)); + return _AddCallback(pcbl, callback, data); } _X_EXPORT Bool DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data) { if (!pcbl || !*pcbl) return FALSE; - return ((*(*pcbl)->funcs.DeleteCallback) (pcbl, callback, data)); + return _DeleteCallback(pcbl, callback, data); } void CallCallbacks(CallbackListPtr *pcbl, pointer call_data) { if (!pcbl || !*pcbl) return; - (*(*pcbl)->funcs.CallCallbacks) (pcbl, call_data); + _CallCallbacks(pcbl, call_data); } void DeleteCallbackList(CallbackListPtr *pcbl) { if (!pcbl || !*pcbl) return; - (*(*pcbl)->funcs.DeleteCallbackList) (pcbl); + _DeleteCallbackList(pcbl); } void -InitCallbackManager() +InitCallbackManager(void) { int i; diff --git a/xserver/dix/events.c b/xserver/dix/events.c index c57a30ed8..4a8e480c8 100644 --- a/xserver/dix/events.c +++ b/xserver/dix/events.c @@ -107,12 +107,17 @@ of the copyright holder. ******************************************************************/ +/** @file + * This file handles event delivery and a big part of the server-side protocol + * handling (the parts for input devices). + */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif #include <X11/X.h> +#include <X11/keysym.h> #include "misc.h" #include "resource.h" #define NEED_EVENTS @@ -131,12 +136,17 @@ of the copyright holder. #include "globals.h" #ifdef XKB -#include <X11/extensions/XKBsrv.h> +#include <X11/extensions/XKBproto.h> +#include <xkbsrv.h> extern Bool XkbFilterEvents(ClientPtr, int, xEvent *); #endif -#ifdef XACE #include "xace.h" + +#ifdef XSERVER_DTRACE +#include <sys/types.h> +typedef const char *string; +#include "Xserver-dtrace.h" #endif #ifdef XEVIE @@ -150,17 +160,20 @@ extern Mask xevieFilters[128]; extern int xevieEventSent; extern int xevieKBEventSent; int xeviegrabState = 0; -xEvent *xeviexE; #endif #include <X11/extensions/XIproto.h> +#include "exglobals.h" #include "exevents.h" +#include "exglobals.h" #include "extnsionst.h" #include "dixevents.h" #include "dixgrabs.h" #include "dispatch.h" - +/** + * Extension events type numbering starts at EXTENSION_EVENT_BASE. + */ #define EXTENSION_EVENT_BASE 64 #define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */ @@ -206,9 +219,28 @@ _X_EXPORT CallbackListPtr DeviceEventCallback; Mask DontPropagateMasks[DNPMCOUNT]; static int DontPropagateRefCnts[DNPMCOUNT]; -#ifdef DEBUG -static debug_events = 0; -#endif +/** + * Main input device struct. + * inputInfo.pointer + * is the core pointer. Referred to as "virtual core pointer", "VCP", + * "core pointer" or inputInfo.pointer. There is exactly one core pointer, + * but multiple devices may send core events. If a device generates core + * events, those events will appear to originate from the core pointer. + * + * inputInfo.keyboard + * is the core keyboard ("virtual core keyboard", "VCK", "core keyboard"). + * See inputInfo.pointer. + * + * inputInfo.devices + * linked list containing all devices including VCK and VCP. The VCK will + * always be the first entry, the VCP the second entry in the device list. + * + * inputInfo.off_devices + * Devices that have not been initialized and are thus turned off. + * + * inputInfo.numDevices + * Total number of devices. + */ _X_EXPORT InputInfo inputInfo; static struct { @@ -223,12 +255,19 @@ static struct { * The window trace information is used to avoid having to compute all the * windows between the root and the current pointer window each time a button * or key goes down. The grabs on each of those windows must be checked. + * + * @see XYToWindow() for a documentation on how the array is set up. */ static WindowPtr *spriteTrace = (WindowPtr *)NULL; #define ROOT spriteTrace[0] static int spriteTraceSize = 0; static int spriteTraceGood; +/** + * DIX sprite information. This is the sprite as seen from the DIX. It does + * not represent the actual sprite rendered to the screen. + * + */ static struct { CursorPtr current; BoxRec hotLimits; /* logical constraints of hot spot */ @@ -265,6 +304,9 @@ static WindowPtr XYToWindow( int y ); +/** + * Max event opcode. + */ extern int lastEvent; static Mask lastEventMask; @@ -319,11 +361,16 @@ static CARD8 criticalEvents[32] = }; #ifdef PANORAMIX - static void ConfineToShape(RegionPtr shape, int *px, int *py); -static void SyntheticMotion(int x, int y); static void PostNewCursor(void); +#define SyntheticMotion(x, y) \ + PostSyntheticMotion(x, y, noPanoramiXExtension ? 0 : \ + sprite.screen->myNum, \ + syncEvents.playingEvents ? \ + syncEvents.time.milliseconds : \ + currentTime.milliseconds); + static Bool XineramaSetCursorPosition( int x, @@ -647,6 +694,13 @@ XineramaChangeToCursor(CursorPtr cursor) } } +#else +#define SyntheticMotion(x, y) \ + PostSyntheticMotion(x, y, \ + 0, \ + syncEvents.playingEvents ? \ + syncEvents.time.milliseconds : \ + currentTime.milliseconds); #endif /* PANORAMIX */ @@ -666,30 +720,6 @@ SetCriticalEvent(int event) criticalEvents[event >> 3] |= 1 << (event & 7); } -static void -SyntheticMotion(int x, int y) -{ - xEvent xE; - -#ifdef PANORAMIX - /* Translate back to the sprite screen since processInputProc - will translate from sprite screen to screen 0 upon reentry - to the DIX layer */ - if(!noPanoramiXExtension) { - x += panoramiXdataPtr[0].x - panoramiXdataPtr[sprite.screen->myNum].x; - y += panoramiXdataPtr[0].y - panoramiXdataPtr[sprite.screen->myNum].y; - } -#endif - xE.u.keyButtonPointer.rootX = x; - xE.u.keyButtonPointer.rootY = y; - if (syncEvents.playingEvents) - xE.u.keyButtonPointer.time = syncEvents.time.milliseconds; - else - xE.u.keyButtonPointer.time = currentTime.milliseconds; - xE.u.u.type = MotionNotify; - (*inputInfo.pointer->public.processInputProc)(&xE, inputInfo.pointer, 1); -} - #ifdef SHAPE static void ConfineToShape(RegionPtr shape, int *px, int *py) @@ -775,8 +805,8 @@ CheckPhysLimits( static void CheckVirtualMotion( - register QdEventPtr qe, - register WindowPtr pWin) + QdEventPtr qe, + WindowPtr pWin) { #ifdef PANORAMIX if(!noPanoramiXExtension) { @@ -858,11 +888,18 @@ ConfineCursorToWindow(WindowPtr pWin, Bool generateEvents, Bool confineToScreen) } _X_EXPORT Bool -PointerConfinedToScreen() +PointerConfinedToScreen(void) { return sprite.confined; } +/** + * Update the sprite cursor to the given cursor. + * + * ChangeToCursor() will display the new cursor and free the old cursor (if + * applicable). If the provided cursor is already the updated cursor, nothing + * happens. + */ static void ChangeToCursor(CursorPtr cursor) { @@ -887,20 +924,27 @@ ChangeToCursor(CursorPtr cursor) } } -/* returns true if b is a descendent of a */ +/** + * @returns true if b is a descendent of a + */ Bool -IsParent(register WindowPtr a, register WindowPtr b) +IsParent(WindowPtr a, WindowPtr b) { for (b = b->parent; b; b = b->parent) if (b == a) return TRUE; return FALSE; } +/** + * Update the cursor displayed on the screen. + * + * Called whenever a cursor may have changed shape or position. + */ static void PostNewCursor(void) { - register WindowPtr win; - register GrabPtr grab = inputInfo.pointer->grab; + WindowPtr win; + GrabPtr grab = inputInfo.pointer->grab; if (syncEvents.playingEvents) return; @@ -926,24 +970,36 @@ PostNewCursor(void) } } +/** + * @return root window of current active screen. + */ _X_EXPORT WindowPtr -GetCurrentRootWindow() +GetCurrentRootWindow(void) { return ROOT; } +/** + * @return window underneath the cursor sprite. + */ _X_EXPORT WindowPtr -GetSpriteWindow() +GetSpriteWindow(void) { return sprite.win; } +/** + * @return current sprite cursor. + */ _X_EXPORT CursorPtr -GetSpriteCursor() +GetSpriteCursor(void) { return sprite.current; } +/** + * Set x/y current sprite position in screen coordinates. + */ _X_EXPORT void GetSpritePosition(int *px, int *py) { @@ -953,7 +1009,7 @@ GetSpritePosition(int *px, int *py) #ifdef PANORAMIX _X_EXPORT int -XineramaGetCursorScreen() +XineramaGetCursorScreen(void) { if(!noPanoramiXExtension) { return sprite.screen->myNum; @@ -966,7 +1022,7 @@ XineramaGetCursorScreen() #define TIMESLOP (5 * 60 * 1000) /* 5 minutes */ static void -MonthChangedOrBadTime(register xEvent *xE) +MonthChangedOrBadTime(xEvent *xE) { /* If the ddx/OS is careless about not processing timestamped events from * different sources in sorted order, then it's possible for time to go @@ -985,7 +1041,7 @@ MonthChangedOrBadTime(register xEvent *xE) lastDeviceEventTime = currentTime; } void -NoticeEventTime(register xEvent *xE) +NoticeEventTime(xEvent *xE) { if (!syncEvents.playingEvents) NoticeTime(xE); @@ -998,8 +1054,8 @@ NoticeEventTime(register xEvent *xE) void EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count) { - register QdEventPtr tail = *syncEvents.pendtail; - register QdEventPtr qe; + QdEventPtr tail = *syncEvents.pendtail; + QdEventPtr qe; xEvent *qxE; NoticeTime(xE); @@ -1042,9 +1098,10 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count) #endif sprite.hotPhys.x = XE_KBPTR.rootX; sprite.hotPhys.y = XE_KBPTR.rootY; - /* do motion compression */ + /* do motion compression, but not if from different devices */ if (tail && (tail->event->u.u.type == MotionNotify) && + (tail->device == device) && (tail->pScreen == sprite.hotPhys.pScreen)) { tail->event->u.keyButtonPointer.rootX = sprite.hotPhys.x; @@ -1073,8 +1130,8 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count) static void PlayReleasedEvents(void) { - register QdEventPtr *prev, qe; - register DeviceIntPtr dev; + QdEventPtr *prev, qe; + DeviceIntPtr dev; prev = &syncEvents.pending; while ( (qe = *prev) ) @@ -1118,7 +1175,7 @@ PlayReleasedEvents(void) } static void -FreezeThaw(register DeviceIntPtr dev, Bool frozen) +FreezeThaw(DeviceIntPtr dev, Bool frozen) { dev->sync.frozen = frozen; if (frozen) @@ -1127,16 +1184,16 @@ FreezeThaw(register DeviceIntPtr dev, Bool frozen) dev->public.processInputProc = dev->public.realInputProc; } -void -ComputeFreezes() +static void +ComputeFreezes(void) { - register DeviceIntPtr replayDev = syncEvents.replayDev; - register int i; + DeviceIntPtr replayDev = syncEvents.replayDev; + int i; WindowPtr w; - register xEvent *xE; + xEvent *xE; int count; GrabPtr grab; - register DeviceIntPtr dev; + DeviceIntPtr dev; for (dev = inputInfo.devices; dev; dev = dev->next) FreezeThaw(dev, dev->sync.other || (dev->sync.state >= FROZEN)); @@ -1211,11 +1268,11 @@ ScreenRestructured (ScreenPtr pScreen) } #endif -void -CheckGrabForSyncs(register DeviceIntPtr thisDev, Bool thisMode, Bool otherMode) +static void +CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode) { - register GrabPtr grab = thisDev->grab; - register DeviceIntPtr dev; + GrabPtr grab = thisDev->grab; + DeviceIntPtr dev; if (thisMode == GrabModeSync) thisDev->sync.state = FROZEN_NO_EVENT; @@ -1245,8 +1302,21 @@ CheckGrabForSyncs(register DeviceIntPtr thisDev, Bool thisMode, Bool otherMode) ComputeFreezes(); } +/** + * Activate a pointer grab on the given device. A pointer grab will cause all + * core pointer events to be delivered to the grabbing client only. Can cause + * the cursor to change if a grab cursor is set. + * + * As a pointer grab can only be issued on the core devices, mouse is always + * inputInfo.pointer. Extension devices are set up for ActivateKeyboardGrab(). + * + * @param mouse The device to grab. + * @param grab The grab structure, needs to be setup. + * @param autoGrab True if the grab was caused by a button down event and not + * explicitely by a client. + */ void -ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab, +ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab, TimeStamp time, Bool autoGrab) { WindowPtr oldWin = (mouse->grab) ? mouse->grab->window @@ -1273,11 +1343,17 @@ ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab, CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode); } +/** + * Delete grab on given device, update the sprite. + * + * As a pointer grab can only be issued on the core devices, mouse is always + * inputInfo.pointer. Extension devices are set up for ActivateKeyboardGrab(). + */ void -DeactivatePointerGrab(register DeviceIntPtr mouse) +DeactivatePointerGrab(DeviceIntPtr mouse) { - register GrabPtr grab = mouse->grab; - register DeviceIntPtr dev; + GrabPtr grab = mouse->grab; + DeviceIntPtr dev; mouse->valuator->motionHintWindow = NullWindow; mouse->grab = NullGrab; @@ -1297,8 +1373,13 @@ DeactivatePointerGrab(register DeviceIntPtr mouse) ComputeFreezes(); } +/** + * Activate a keyboard grab on the given device. + * + * Extension devices have ActivateKeyboardGrab() set as their grabbing proc. + */ void -ActivateKeyboardGrab(register DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool passive) +ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool passive) { WindowPtr oldWin; @@ -1323,12 +1404,15 @@ ActivateKeyboardGrab(register DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, CheckGrabForSyncs(keybd, (Bool)grab->keyboardMode, (Bool)grab->pointerMode); } +/** + * Delete keyboard grab for the given device. + */ void -DeactivateKeyboardGrab(register DeviceIntPtr keybd) +DeactivateKeyboardGrab(DeviceIntPtr keybd) { - register GrabPtr grab = keybd->grab; - register DeviceIntPtr dev; - register WindowPtr focusWin = keybd->focus ? keybd->focus->win + GrabPtr grab = keybd->grab; + DeviceIntPtr dev; + WindowPtr focusWin = keybd->focus ? keybd->focus->win : sprite.win; if (focusWin == FollowKeyboardWin) @@ -1352,7 +1436,7 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState) { Bool thisGrabbed, otherGrabbed, othersFrozen, thisSynced; TimeStamp grabTime; - register DeviceIntPtr dev; + DeviceIntPtr dev; thisGrabbed = thisDev->grab && SameClient(thisDev->grab, client); thisSynced = FALSE; @@ -1455,8 +1539,13 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState) } } +/** + * Server-side protocol handling for AllowEvents request. + * + * Release some events from a frozen device. Only applicable for core devices. + */ int -ProcAllowEvents(register ClientPtr client) +ProcAllowEvents(ClientPtr client) { TimeStamp time; DeviceIntPtr mouse = inputInfo.pointer; @@ -1498,10 +1587,13 @@ ProcAllowEvents(register ClientPtr client) return Success; } +/** + * Deactivate grabs from any device that has been grabbed by the client. + */ void ReleaseActiveGrabs(ClientPtr client) { - register DeviceIntPtr dev; + DeviceIntPtr dev; Bool done; /* XXX CloseDownClient should remove passive grabs before @@ -1524,6 +1616,30 @@ ReleaseActiveGrabs(ClientPtr client) * The following procedures deal with delivering events * **************************************************************************/ +/** + * Deliver the given events to the given client. + * + * More than one event may be delivered at a time. This is the case with + * DeviceMotionNotifies which may be followed by DeviceValuator events. + * + * TryClientEvents() is the last station before actually writing the events to + * the socket. Anything that is not filtered here, will get delivered to the + * client. + * An event is only delivered if + * - mask and filter match up. + * - no other client has a grab on the device that caused the event. + * + * + * @param client The target client to deliver to. + * @param pEvents The events to be delivered. + * @param count Number of elements in pEvents. + * @param mask Event mask as set by the window. + * @param filter Mask based on event type. + * @param grab Possible grab on the device that caused the event. + * + * @return 1 if event was delivered, 0 if not or -1 if grab was not set by the + * client. + */ _X_EXPORT int TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask, Mask filter, GrabPtr grab) @@ -1531,9 +1647,8 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask, int i; int type; -#ifdef DEBUG - if (debug_events) ErrorF( - "Event([%d, %d], mask=0x%x), client=%d", +#ifdef DEBUG_EVENTS + ErrorF("Event([%d, %d], mask=0x%x), client=%d", pEvents->u.u.type, pEvents->u.u.detail, mask, client->index); #endif if ((client) && (client != serverClient) && (!client->clientGone) && @@ -1549,9 +1664,9 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask, if (WID(inputInfo.pointer->valuator->motionHintWindow) == pEvents->u.keyButtonPointer.event) { -#ifdef DEBUG - if (debug_events) ErrorF("\n"); - fprintf(stderr,"motionHintWindow == keyButtonPointer.event\n"); +#ifdef DEBUG_EVENTS + ErrorF("\n"); + ErrorF("motionHintWindow == keyButtonPointer.event\n"); #endif return 1; /* don't send, but pretend we did */ } @@ -1589,27 +1704,44 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask, } WriteEventsToClient(client, count, pEvents); -#ifdef DEBUG - if (debug_events) ErrorF( " delivered\n"); +#ifdef DEBUG_EVENTS + ErrorF( " delivered\n"); #endif return 1; } else { -#ifdef DEBUG - if (debug_events) ErrorF("\n"); +#ifdef DEBUG_EVENTS + ErrorF("\n"); #endif return 0; } } +/** + * Deliver events to a window. At this point, we do not yet know if the event + * actually needs to be delivered. May activate a grab if the event is a + * button press. + * + * More than one event may be delivered at a time. This is the case with + * DeviceMotionNotifies which may be followed by DeviceValuator events. + * + * @param pWin The window that would get the event. + * @param pEvents The events to be delivered. + * @param count Number of elements in pEvents. + * @param filter Mask based on event type. + * @param grab Possible grab on the device that caused the event. + * @param mskidx Mask index, depending on device that caused event. + * + * @return Number of events delivered to various clients. + */ int -DeliverEventsToWindow(register WindowPtr pWin, xEvent *pEvents, int count, +DeliverEventsToWindow(WindowPtr pWin, xEvent *pEvents, int count, Mask filter, GrabPtr grab, int mskidx) { int deliveries = 0, nondeliveries = 0; int attempt; - register InputClients *other; + InputClients *other; ClientPtr client = NullClient; Mask deliveryMask = 0; /* If a grab occurs due to a button press, then this mask is the mask of the grab. */ @@ -1622,8 +1754,10 @@ DeliverEventsToWindow(register WindowPtr pWin, xEvent *pEvents, int count, if (filter != CantBeFiltered && !((wOtherEventMasks(pWin)|pWin->eventMask) & filter)) return 0; - if ( (attempt = TryClientEvents(wClient(pWin), pEvents, count, - pWin->eventMask, filter, grab)) ) + if (XaceHook(XACE_RECEIVE_ACCESS, wClient(pWin), pWin, pEvents, count)) + /* do nothing */; + else if ( (attempt = TryClientEvents(wClient(pWin), pEvents, count, + pWin->eventMask, filter, grab)) ) { if (attempt > 0) { @@ -1650,7 +1784,10 @@ DeliverEventsToWindow(register WindowPtr pWin, xEvent *pEvents, int count, other = (InputClients *)wOtherClients(pWin); for (; other; other = other->next) { - if ( (attempt = TryClientEvents(rClient(other), pEvents, count, + if (XaceHook(XACE_RECEIVE_ACCESS, rClient(other), pWin, pEvents, + count)) + /* do nothing */; + else if ( (attempt = TryClientEvents(rClient(other), pEvents, count, other->mask[mskidx], filter, grab)) ) { if (attempt > 0) @@ -1722,11 +1859,20 @@ XineramaTryClientEventsResult( } #endif +/** + * Try to deliver events to the interested parties. + * + * @param pWin The window that would get the event. + * @param pEvents The events to be delivered. + * @param count Number of elements in pEvents. + * @param filter Mask based on event type. + * @param dontClient Don't deliver to the dontClient. + */ int -MaybeDeliverEventsToClient(register WindowPtr pWin, xEvent *pEvents, +MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents, int count, Mask filter, ClientPtr dontClient) { - register OtherClients *other; + OtherClients *other; if (pWin->eventMask & filter) @@ -1738,6 +1884,8 @@ MaybeDeliverEventsToClient(register WindowPtr pWin, xEvent *pEvents, return XineramaTryClientEventsResult( wClient(pWin), NullGrab, pWin->eventMask, filter); #endif + if (XaceHook(XACE_RECEIVE_ACCESS, wClient(pWin), pWin, pEvents, count)) + return 1; /* don't send, but pretend we did */ return TryClientEvents(wClient(pWin), pEvents, count, pWin->eventMask, filter, NullGrab); } @@ -1752,6 +1900,9 @@ MaybeDeliverEventsToClient(register WindowPtr pWin, xEvent *pEvents, return XineramaTryClientEventsResult( rClient(other), NullGrab, other->mask, filter); #endif + if (XaceHook(XACE_RECEIVE_ACCESS, rClient(other), pWin, pEvents, + count)) + return 1; /* don't send, but pretend we did */ return TryClientEvents(rClient(other), pEvents, count, other->mask, filter, NullGrab); } @@ -1759,6 +1910,14 @@ MaybeDeliverEventsToClient(register WindowPtr pWin, xEvent *pEvents, return 2; } +/** + * Adjust event fields to comply with the window properties. + * + * @param xE Event to be modified in place + * @param pWin The window to get the information from. + * @param child Child window setting for event (if applicable) + * @param calcChild If True, calculate the child window. + */ static void FixUpEventFromWindow( xEvent *xE, @@ -1813,18 +1972,37 @@ FixUpEventFromWindow( } } +/** + * Deliver events caused by input devices. Called for all core input events + * and XI events. No filtering of events happens before DeliverDeviceEvents(), + * it will be called for any event that comes out of the event queue. + * + * For all core events, dev is either inputInfo.pointer or inputInfo.keyboard. + * For all extension events, dev is the device that caused the event. + * + * @param pWin Window to deliver event to. + * @param xE Events to deliver. + * @param grab Possible grab on a device. + * @param stopAt Don't recurse up to the root window. + * @param dev The device that is responsible for the event. + * @param count number of events in xE. + * + */ int -DeliverDeviceEvents(register WindowPtr pWin, register xEvent *xE, GrabPtr grab, - register WindowPtr stopAt, DeviceIntPtr dev, int count) +DeliverDeviceEvents(WindowPtr pWin, xEvent *xE, GrabPtr grab, + WindowPtr stopAt, DeviceIntPtr dev, int count) { Window child = None; int type = xE->u.u.type; Mask filter = filters[type]; int deliveries = 0; + if (XaceHook(XACE_SEND_ACCESS, NULL, dev, pWin, xE, count)) + return 0; + if (type & EXTENSION_EVENT_BASE) { - register OtherInputMasks *inputMasks; + OtherInputMasks *inputMasks; int mskidx = dev->id; inputMasks = wOtherInputMasks(pWin); @@ -1876,10 +2054,22 @@ DeliverDeviceEvents(register WindowPtr pWin, register xEvent *xE, GrabPtr grab, return 0; } -/* not useful for events that propagate up the tree or extension events */ +/** + * Deliver event to a window and it's immediate parent. Used for most window + * events (CreateNotify, ConfigureNotify, etc.). Not useful for events that + * propagate up the tree or extension events + * + * In case of a ReparentNotify event, the event will be delivered to the + * otherParent as well. + * + * @param pWin Window to deliver events to. + * @param xE Events to deliver. + * @param count number of events in xE. + * @param otherParent Used for ReparentNotify events. + */ _X_EXPORT int -DeliverEvents(register WindowPtr pWin, register xEvent *xE, int count, - register WindowPtr otherParent) +DeliverEvents(WindowPtr pWin, xEvent *xE, int count, + WindowPtr otherParent) { Mask filter; int deliveries; @@ -1941,10 +2131,21 @@ PointInBorderSize(WindowPtr pWin, int x, int y) return FALSE; } +/** + * Traversed from the root window to the window at the position x/y. While + * traversing, it sets up the traversal history in the spriteTrace array. + * After completing, the spriteTrace history is set in the following way: + * spriteTrace[0] ... root window + * spriteTrace[1] ... top level window that encloses x/y + * ... + * spriteTrace[spriteTraceGood - 1] ... window at x/y + * + * @returns the window at the given coordinates. + */ static WindowPtr XYToWindow(int x, int y) { - register WindowPtr pWin; + WindowPtr pWin; BoxRec box; spriteTraceGood = 1; /* root window still there */ @@ -1989,6 +2190,12 @@ XYToWindow(int x, int y) return spriteTrace[spriteTraceGood-1]; } +/** + * Update the sprite coordinates based on the event. Update the cursor + * position, then update the event with the new coordinates that may have been + * changed. If the window underneath the sprite has changed, change to new + * cursor and send enter/leave events. + */ static Bool CheckMotion(xEvent *xE) { @@ -2061,8 +2268,12 @@ CheckMotion(xEvent *xE) return TRUE; } +/** + * Windows have restructured, we need to update the sprite position and the + * sprite's cursor. + */ _X_EXPORT void -WindowsRestructured() +WindowsRestructured(void) { (void) CheckMotion((xEvent *)NULL); } @@ -2106,10 +2317,14 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff) } #endif +/** + * Set the given window to sane values, display the cursor in the center of + * the screen. Called from main() with the root window on the first screen. + */ void -DefineInitialRootWindow(register WindowPtr win) +DefineInitialRootWindow(WindowPtr win) { - register ScreenPtr pScreen = win->drawable.pScreen; + ScreenPtr pScreen = win->drawable.pScreen; sprite.hotPhys.pScreen = pScreen; sprite.hotPhys.x = pScreen->width / 2; @@ -2151,6 +2366,61 @@ DefineInitialRootWindow(register WindowPtr win) #endif } +/** + * Update the mouse sprite info when the server switches from a pScreen to another. + * Otherwise, the pScreen of the mouse sprite is never updated when we switch + * from a pScreen to another. Never updating the pScreen of the mouse sprite + * implies that windows that are in pScreen whose pScreen->myNum >0 will never + * get pointer events. This is because in CheckMotion(), sprite.hotPhys.pScreen + * always points to the first pScreen it has been set by + * DefineInitialRootWindow(). + * + * Calling this function is useful for use cases where the server + * has more than one pScreen. + * This function is similar to DefineInitialRootWindow() but it does not + * reset the mouse pointer position. + * @param win must be the new pScreen we are switching to. + */ +void +UpdateSpriteForScreen(ScreenPtr pScreen) +{ + WindowPtr win = NULL; + if (!pScreen) + return ; + win = WindowTable[pScreen->myNum]; + + sprite.hotPhys.pScreen = pScreen; + sprite.hot = sprite.hotPhys; + sprite.hotLimits.x2 = pScreen->width; + sprite.hotLimits.y2 = pScreen->height; +#ifdef XEVIE + xeviewin = +#endif + sprite.win = win; + sprite.current = wCursor (win); + sprite.current->refcnt++; + spriteTraceGood = 1; + ROOT = win; + (*pScreen->CursorLimits) (pScreen, + sprite.current, + &sprite.hotLimits, + &sprite.physLimits); + sprite.confined = FALSE; + (*pScreen->ConstrainCursor) (pScreen, &sprite.physLimits); + (*pScreen->DisplayCursor) (pScreen, sprite.current); + +#ifdef PANORAMIX + if(!noPanoramiXExtension) { + sprite.hotLimits.x1 = -panoramiXdataPtr[0].x; + sprite.hotLimits.y1 = -panoramiXdataPtr[0].y; + sprite.hotLimits.x2 = PanoramiXPixWidth - panoramiXdataPtr[0].x; + sprite.hotLimits.y2 = PanoramiXPixHeight - panoramiXdataPtr[0].y; + sprite.physLimits = sprite.hotLimits; + sprite.screen = pScreen; + } +#endif +} + /* * This does not take any shortcuts, and even ignores its argument, since * it does not happen very often, and one has to walk up the tree since @@ -2243,16 +2513,15 @@ static int XineramaWarpPointer(ClientPtr client) { WindowPtr dest = NULL; - int x, y; + int x, y, rc; REQUEST(xWarpPointerReq); - if (stuff->dstWid != None) - { - dest = SecurityLookupWindow(stuff->dstWid, client, SecurityReadAccess); - if (!dest) - return BadWindow; + if (stuff->dstWid != None) { + rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess); + if (rc != Success) + return rc; } x = sprite.hotPhys.x; y = sprite.hotPhys.y; @@ -2263,8 +2532,9 @@ XineramaWarpPointer(ClientPtr client) XID winID = stuff->srcWid; WindowPtr source; - source = SecurityLookupWindow(winID, client, SecurityReadAccess); - if (!source) return BadWindow; + rc = dixLookupWindow(&source, winID, client, DixReadAccess); + if (rc != Success) + return rc; winX = source->drawable.x; winY = source->drawable.y; @@ -2312,27 +2582,36 @@ XineramaWarpPointer(ClientPtr client) #endif +/** + * Server-side protocol handling for WarpPointer request. + * Warps the cursor position to the coordinates given in the request. + */ int ProcWarpPointer(ClientPtr client) { WindowPtr dest = NULL; - int x, y; + int x, y, rc; ScreenPtr newScreen; - + DeviceIntPtr dev; REQUEST(xWarpPointerReq); - REQUEST_SIZE_MATCH(xWarpPointerReq); + for (dev = inputInfo.devices; dev; dev = dev->next) { + if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) { + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixWriteAccess); + if (rc != Success) + return rc; + } + } #ifdef PANORAMIX if(!noPanoramiXExtension) return XineramaWarpPointer(client); #endif - if (stuff->dstWid != None) - { - dest = SecurityLookupWindow(stuff->dstWid, client, SecurityReadAccess); - if (!dest) - return BadWindow; + if (stuff->dstWid != None) { + rc = dixLookupWindow(&dest, stuff->dstWid, client, DixGetAttrAccess); + if (rc != Success) + return rc; } x = sprite.hotPhys.x; y = sprite.hotPhys.y; @@ -2343,8 +2622,9 @@ ProcWarpPointer(ClientPtr client) XID winID = stuff->srcWid; WindowPtr source; - source = SecurityLookupWindow(winID, client, SecurityReadAccess); - if (!source) return BadWindow; + rc = dixLookupWindow(&source, winID, client, DixGetAttrAccess); + if (rc != Success) + return rc; winX = source->drawable.x; winY = source->drawable.y; @@ -2420,19 +2700,27 @@ BorderSizeNotEmpty(WindowPtr pWin) return FALSE; } -/* "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a - passive grab set on the window to be activated. */ +/** + * "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a + * passive grab set on the window to be activated. + * If a passive grab is activated, the event will be delivered to the client. + * + * @param pWin The window that may be subject to a passive grab. + * @param device Device that caused the event. + * @param xE List of events (multiple ones for DeviceMotionNotify) + * @count number of elements in xE. + */ static Bool CheckPassiveGrabsOnWindow( WindowPtr pWin, - register DeviceIntPtr device, - register xEvent *xE, + DeviceIntPtr device, + xEvent *xE, int count) { - register GrabPtr grab = wPassiveGrabs(pWin); + GrabPtr grab = wPassiveGrabs(pWin); GrabRec tempGrab; - register xEvent *dxE; + xEvent *dxE; if (!grab) return FALSE; @@ -2476,10 +2764,6 @@ CheckPassiveGrabsOnWindow( (grab->confineTo->realized && BorderSizeNotEmpty(grab->confineTo)))) { -#ifdef XACE - if (!XaceHook(XACE_DEVICE_ACCESS, wClient(pWin), device, FALSE)) - return FALSE; -#endif #ifdef XKB if (!noXkbExtension) { XE_KBPTR.state &= 0x1f00; @@ -2517,25 +2801,35 @@ CheckPassiveGrabsOnWindow( } /** -"CheckDeviceGrabs" handles both keyboard and pointer events that may cause -a passive grab to be activated. If the event is a keyboard event, the -ancestors of the focus window are traced down and tried to see if they have -any passive grabs to be activated. If the focus window itself is reached and -it's descendants contain they pointer, the ancestors of the window that the -pointer is in are then traced down starting at the focus window, otherwise no -grabs are activated. If the event is a pointer event, the ancestors of the -window that the pointer is in are traced down starting at the root until -CheckPassiveGrabs causes a passive grab to activate or all the windows are -tried. PRH + * CheckDeviceGrabs handles both keyboard and pointer events that may cause + * a passive grab to be activated. + * + * If the event is a keyboard event, the ancestors of the focus window are + * traced down and tried to see if they have any passive grabs to be + * activated. If the focus window itself is reached and it's descendants + * contain the pointer, the ancestors of the window that the pointer is in + * are then traced down starting at the focus window, otherwise no grabs are + * activated. + * If the event is a pointer event, the ancestors of the window that the + * pointer is in are traced down starting at the root until CheckPassiveGrabs + * causes a passive grab to activate or all the windows are + * tried. PRH + * + * If a grab is activated, the event has been sent to the client already! + * + * @param device The device that caused the event. + * @param xE The event to handle (most likely {Device}ButtonPress). + * @param count Number of events in list. + * @return TRUE if a grab has been activated or false otherwise. */ Bool -CheckDeviceGrabs(register DeviceIntPtr device, register xEvent *xE, +CheckDeviceGrabs(DeviceIntPtr device, xEvent *xE, int checkFirst, int count) { - register int i; - register WindowPtr pWin = NULL; - register FocusClassPtr focus = device->focus; + int i; + WindowPtr pWin = NULL; + FocusClassPtr focus = device->focus; if (((xE->u.u.type == ButtonPress) #if defined(XINPUT) && defined(XKB) @@ -2573,6 +2867,16 @@ CheckDeviceGrabs(register DeviceIntPtr device, register xEvent *xE, return FALSE; } +/** + * Called for keyboard events to deliver event to whatever client owns the + * focus. Event is delivered to the keyboard's focus window, the root window + * or to the window owning the input focus. + * + * @param keybd The keyboard originating the event. + * @param xE The event list. + * @param window Window underneath the sprite. + * @param count number of events in xE. + */ void DeliverFocusedEvent(DeviceIntPtr keybd, xEvent *xE, WindowPtr window, int count) { @@ -2593,6 +2897,8 @@ DeliverFocusedEvent(DeviceIntPtr keybd, xEvent *xE, WindowPtr window, int count) if (DeliverDeviceEvents(window, xE, NullGrab, focus, keybd, count)) return; } + if (XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, xE, count)) + return; /* just deliver it to the focus window */ FixUpEventFromWindow(xE, focus, None, FALSE); if (xE->u.u.type & EXTENSION_EVENT_BASE) @@ -2601,14 +2907,21 @@ DeliverFocusedEvent(DeviceIntPtr keybd, xEvent *xE, WindowPtr window, int count) NullGrab, mskidx); } +/** + * Deliver an event from a device that is currently grabbed. Uses + * DeliverDeviceEvents() for further delivery if a ownerEvents is set on the + * grab. If not, TryClientEvents() is used. + * + * @param deactivateGrab True if the device's grab should be deactivated. + */ void -DeliverGrabbedEvent(register xEvent *xE, register DeviceIntPtr thisDev, +DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev, Bool deactivateGrab, int count) { - register GrabPtr grab = thisDev->grab; + GrabPtr grab = thisDev->grab; int deliveries = 0; - register DeviceIntPtr dev; - register xEvent *dxE; + DeviceIntPtr dev; + xEvent *dxE; if (grab->ownerEvents) { @@ -2635,9 +2948,14 @@ DeliverGrabbedEvent(register xEvent *xE, register DeviceIntPtr thisDev, if (!deliveries) { FixUpEventFromWindow(xE, grab->window, None, TRUE); - deliveries = TryClientEvents(rClient(grab), xE, count, - (Mask)grab->eventMask, - filters[xE->u.u.type], grab); + if (XaceHook(XACE_SEND_ACCESS, 0, thisDev, grab->window, xE, count) || + XaceHook(XACE_RECEIVE_ACCESS, rClient(grab), grab->window, xE, + count)) + deliveries = 1; /* don't send, but pretend we did */ + else + deliveries = TryClientEvents(rClient(grab), xE, count, + (Mask)grab->eventMask, + filters[xE->u.u.type], grab); if (deliveries && (xE->u.u.type == MotionNotify #ifdef XINPUT || xE->u.u.type == DeviceMotionNotify @@ -2683,21 +3001,32 @@ DeliverGrabbedEvent(register xEvent *xE, register DeviceIntPtr thisDev, } } +/** + * Main keyboard event processing function for core keyboard events. + * Updates the events fields from the current pointer state and delivers the + * event. + * + * For key events, xE will always be a single event. + * + * @param xE Event list + * @param keybd The device that caused an event. + * @param count Number of elements in xE. + */ void #ifdef XKB -CoreProcessKeyboardEvent (register xEvent *xE, register DeviceIntPtr keybd, int count) +CoreProcessKeyboardEvent (xEvent *xE, DeviceIntPtr keybd, int count) #else -ProcessKeyboardEvent (register xEvent *xE, register DeviceIntPtr keybd, int count) +ProcessKeyboardEvent (xEvent *xE, DeviceIntPtr keybd, int count) #endif { int key, bit; - register BYTE *kptr; - register int i; - register CARD8 modifiers; - register CARD16 mask; + BYTE *kptr; + int i; + CARD8 modifiers; + CARD16 mask; GrabPtr grab = keybd->grab; Bool deactivateGrab = FALSE; - register KeyClassPtr keyc = keybd->key; + KeyClassPtr keyc = keybd->key; #ifdef XEVIE static Window rootWin = 0; @@ -2776,13 +3105,6 @@ drawable.id:0; } #endif -#ifdef DEBUG - if ((xkbDebugFlags&0x4)&& - ((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) { - ErrorF("CoreProcessKbdEvent: Key %d %s\n",key, - (xE->u.u.type==KeyPress?"down":"up")); - } -#endif switch (xE->u.u.type) { case KeyPress: @@ -2847,57 +3169,63 @@ drawable.id:0; if (deactivateGrab) (*keybd->DeactivateGrab)(keybd); -#ifdef XACE XaceHook(XACE_KEY_AVAIL, xE, keybd, count); -#endif } #ifdef XKB /* This function is used to set the key pressed or key released state - this is only used when the pressing of keys does not cause - CoreProcessKeyEvent to be called, as in for example Mouse Keys. + the device's processInputProc to be called, as in for example Mouse Keys. */ void -FixKeyState (register xEvent *xE, register DeviceIntPtr keybd) +FixKeyState (xEvent *xE, DeviceIntPtr keybd) { int key, bit; - register BYTE *kptr; - register KeyClassPtr keyc = keybd->key; + BYTE *kptr; + KeyClassPtr keyc = keybd->key; key = xE->u.u.detail; kptr = &keyc->down[key >> 3]; bit = 1 << (key & 7); -#ifdef DEBUG - if ((xkbDebugFlags&0x4)&& - ((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) { - ErrorF("FixKeyState: Key %d %s\n",key, - (xE->u.u.type==KeyPress?"down":"up")); + + if (((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease)|| + (xE->u.u.type==DeviceKeyPress)||(xE->u.u.type==DeviceKeyRelease)) + ) { + DebugF("FixKeyState: Key %d %s\n",key, + (((xE->u.u.type==KeyPress)||(xE->u.u.type==DeviceKeyPress))?"down":"up")); } -#endif - switch (xE->u.u.type) - { - case KeyPress: + + if (xE->u.u.type == KeyPress || xE->u.u.type == DeviceKeyPress) *kptr |= bit; - break; - case KeyRelease: + else if (xE->u.u.type == KeyRelease || xE->u.u.type == DeviceKeyRelease) *kptr &= ~bit; - break; - default: - FatalError("Impossible keyboard event"); - } + else + FatalError("Impossible keyboard event"); } #endif +/** + * Main pointer event processing function for core pointer events. + * For motion events: update the sprite. + * For all other events: Update the event fields based on the current sprite + * state. + * + * For core pointer events, xE will always be a single event. + * + * @param xE Event list + * @param mouse The device that caused an event. + * @param count Number of elements in xE. + */ void #ifdef XKB -CoreProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count) +CoreProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count) #else -ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count) +ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count) #endif { - register GrabPtr grab = mouse->grab; + GrabPtr grab = mouse->grab; Bool deactivateGrab = FALSE; - register ButtonClassPtr butc = mouse->button; + ButtonClassPtr butc = mouse->button; #ifdef XKB XkbSrvInfoPtr xkbi= inputInfo.keyboard->key->xkbInfo; #endif @@ -2941,8 +3269,8 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count } if (xE->u.u.type != MotionNotify) { - register int key; - register BYTE *kptr; + int key; + BYTE *kptr; int bit; XE_KBPTR.rootX = sprite.hot.x; @@ -2984,7 +3312,7 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count deactivateGrab = TRUE; break; default: - FatalError("bogus pointer event from ddx"); + FatalError("bogus pointer event from ddx: %d", xE->u.u.type); } } else if (!CheckMotion(xE)) @@ -3000,13 +3328,27 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count #define AtMostOneClient \ (SubstructureRedirectMask | ResizeRedirectMask | ButtonPressMask) +#define ManagerMask \ + (SubstructureRedirectMask | ResizeRedirectMask) +/** + * Recalculate which events may be deliverable for the given window. + * Recalculated mask is used for quicker determination which events may be + * delivered to a window. + * + * The otherEventMasks on a WindowOptional is the combination of all event + * masks set by all clients on the window. + * deliverableEventMask is the combination of the eventMask and the + * otherEventMask. + * + * Traverses to siblings and parents of the window. + */ void RecalculateDeliverableEvents(pWin) - register WindowPtr pWin; + WindowPtr pWin; { - register OtherClients *others; - register WindowPtr pChild; + OtherClients *others; + WindowPtr pChild; pChild = pWin; while (1) @@ -3045,8 +3387,8 @@ RecalculateDeliverableEvents(pWin) int OtherClientGone(pointer value, XID id) { - register OtherClientsPtr other, prev; - register WindowPtr pWin = (WindowPtr)value; + OtherClientsPtr other, prev; + WindowPtr pWin = (WindowPtr)value; prev = 0; for (other = wOtherClients(pWin); other; other = other->next) @@ -3072,16 +3414,24 @@ OtherClientGone(pointer value, XID id) } int -EventSelectForWindow(register WindowPtr pWin, register ClientPtr client, Mask mask) +EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask) { Mask check; OtherClients * others; + int rc; if (mask & ~AllEventMasks) { client->errorValue = mask; return BadValue; } + check = (mask & ManagerMask); + if (check) { + rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, + RT_WINDOW, pWin, RT_NONE, NULL, DixManageAccess); + if (rc != Success) + return rc; + } check = (mask & AtMostOneClient); if (check & (pWin->eventMask|wOtherEventMasks(pWin))) { /* It is illegal for two different @@ -3101,12 +3451,7 @@ EventSelectForWindow(register WindowPtr pWin, register ClientPtr client, Mask ma if (wClient (pWin) == client) { check = pWin->eventMask; -#ifdef SGIMISC - pWin->eventMask = - (mask & ~SGIMiscSpecialDestroyMask) | (pWin->eventMask & SGIMiscSpecialDestroyMask); -#else pWin->eventMask = mask; -#endif } else { @@ -3115,9 +3460,6 @@ EventSelectForWindow(register WindowPtr pWin, register ClientPtr client, Mask ma if (SameClient(others, client)) { check = others->mask; -#ifdef SGIMISC - mask = (mask & ~SGIMiscSpecialDestroyMask) | (others->mask & SGIMiscSpecialDestroyMask); -#endif if (mask == 0) { FreeResource(others->resource, RT_NONE); @@ -3152,10 +3494,10 @@ maskSet: } int -EventSuppressForWindow(register WindowPtr pWin, register ClientPtr client, +EventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask, Bool *checkOptional) { - register int i, free; + int i, free; if (mask & ~PropagateMask) { @@ -3207,29 +3549,36 @@ EventSuppressForWindow(register WindowPtr pWin, register ClientPtr client, return Success; } +/** + * @return The window that is the first ancestor of both a and b. + */ static WindowPtr CommonAncestor( - register WindowPtr a, - register WindowPtr b) + WindowPtr a, + WindowPtr b) { for (b = b->parent; b; b = b->parent) if (IsParent(b, a)) return b; return NullWindow; } +/** + * Assembles an EnterNotify or LeaveNotify and sends it event to the client. + * The core devices are used to fill in the event fields. + */ static void EnterLeaveEvent( int type, int mode, int detail, - register WindowPtr pWin, + WindowPtr pWin, Window child) { xEvent event; - register DeviceIntPtr keybd = inputInfo.keyboard; + DeviceIntPtr keybd = inputInfo.keyboard; WindowPtr focus; - register DeviceIntPtr mouse = inputInfo.pointer; - register GrabPtr grab = mouse->grab; + DeviceIntPtr mouse = inputInfo.pointer; + GrabPtr grab = mouse->grab; Mask mask; if ((pWin == mouse->valuator->motionHintWindow) && @@ -3282,17 +3631,13 @@ EnterLeaveEvent( if ((type == EnterNotify) && (mask & KeymapStateMask)) { xKeymapEvent ke; - -#ifdef XACE ClientPtr client = grab ? rClient(grab) : clients[CLIENT_ID(pWin->drawable.id)]; - if (!XaceHook(XACE_DEVICE_ACCESS, client, keybd, FALSE)) - { + if (XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess)) bzero((char *)&ke.map[0], 31); - } else -#endif - memmove((char *)&ke.map[0], (char *)&keybd->key->down[1], 31); + memmove((char *)&ke.map[0], (char *)&keybd->key->down[1], 31); + ke.type = KeymapNotify; if (grab) (void)TryClientEvents(rClient(grab), (xEvent *)&ke, 1, mask, @@ -3303,6 +3648,10 @@ EnterLeaveEvent( } } +/** + * Send enter notifies to all parent windows up to ancestor. + * This function recurses. + */ static void EnterNotifies(WindowPtr ancestor, WindowPtr child, int mode, int detail) { @@ -3314,10 +3663,15 @@ EnterNotifies(WindowPtr ancestor, WindowPtr child, int mode, int detail) EnterLeaveEvent(EnterNotify, mode, detail, parent, child->drawable.id); } + +/** + * Send leave notifies to all parent windows up to ancestor. + * This function recurses. + */ static void LeaveNotifies(WindowPtr child, WindowPtr ancestor, int mode, int detail) { - register WindowPtr pWin; + WindowPtr pWin; if (ancestor == child) return; @@ -3328,6 +3682,13 @@ LeaveNotifies(WindowPtr child, WindowPtr ancestor, int mode, int detail) } } +/** + * Figure out if enter/leave events are necessary and send them to the + * appropriate windows. + * + * @param fromWin Window the sprite moved out of. + * @param toWin Window the sprite moved into. + */ static void DoEnterLeaveEvents(WindowPtr fromWin, WindowPtr toWin, int mode) { @@ -3357,7 +3718,7 @@ DoEnterLeaveEvents(WindowPtr fromWin, WindowPtr toWin, int mode) } static void -FocusEvent(DeviceIntPtr dev, int type, int mode, int detail, register WindowPtr pWin) +FocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin) { xEvent event; @@ -3378,15 +3739,12 @@ FocusEvent(DeviceIntPtr dev, int type, int mode, int detail, register WindowPtr ((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask)) { xKeymapEvent ke; -#ifdef XACE ClientPtr client = clients[CLIENT_ID(pWin->drawable.id)]; - if (!XaceHook(XACE_DEVICE_ACCESS, client, dev, FALSE)) - { + if (XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess)) bzero((char *)&ke.map[0], 31); - } else -#endif - memmove((char *)&ke.map[0], (char *)&dev->key->down[1], 31); + memmove((char *)&ke.map[0], (char *)&dev->key->down[1], 31); + ke.type = KeymapNotify; (void)DeliverEventsToWindow(pWin, (xEvent *)&ke, 1, KeymapStateMask, NullGrab, 0); @@ -3430,7 +3788,7 @@ FocusOutEvents( int mode, int detail, Bool doAncestor) { - register WindowPtr pWin; + WindowPtr pWin; for (pWin = child; pWin != ancestor; pWin = pWin->parent) FocusEvent(dev, FocusOut, mode, detail, pWin); @@ -3564,6 +3922,23 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode) } } +/** + * Set the input focus to the given window. Subsequent keyboard events will be + * delivered to the given window. + * + * Usually called from ProcSetInputFocus as result of a client request. If so, + * the device is the inputInfo.keyboard. + * If called from ProcXSetInputFocus as result of a client xinput request, the + * device is set to the device specified by the client. + * + * @param client Client that requested input focus change. + * @param dev Focus device. + * @param focusID The window to obtain the focus. Can be PointerRoot or None. + * @param revertTo Specifies where the focus reverts to when window becomes + * unviewable. + * @param ctime Specifies the time. + * @param followOK True if pointer is allowed to follow the keyboard. + */ int SetInputFocus( ClientPtr client, @@ -3573,9 +3948,9 @@ SetInputFocus( Time ctime, Bool followOK) { - register FocusClassPtr focus; - register WindowPtr focusWin; - int mode; + FocusClassPtr focus; + WindowPtr focusWin; + int mode, rc; TimeStamp time; UpdateCurrentTime(); @@ -3592,17 +3967,19 @@ SetInputFocus( focusWin = (WindowPtr)(long)focusID; else if ((focusID == FollowKeyboard) && followOK) focusWin = inputInfo.keyboard->focus->win; - else if (!(focusWin = SecurityLookupWindow(focusID, client, - SecurityReadAccess))) - return BadWindow; - else - { + else { + rc = dixLookupWindow(&focusWin, focusID, client, DixSetAttrAccess); + if (rc != Success) + return rc; /* It is a match error to try to set the input focus to an unviewable window. */ - if(!focusWin->realized) return(BadMatch); } + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixSetFocusAccess); + if (rc != Success) + return Success; + focus = dev->focus; if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, focus->time) == EARLIER)) @@ -3623,7 +4000,7 @@ SetInputFocus( else { int depth = 0; - register WindowPtr pWin; + WindowPtr pWin; for (pWin = focusWin; pWin; pWin = pWin->parent) depth++; if (depth > focus->traceSize) @@ -3642,6 +4019,11 @@ SetInputFocus( return Success; } +/** + * Server-side protocol handling for SetInputFocus request. + * + * Sets the input focus for the virtual core keyboard. + */ int ProcSetInputFocus(client) ClientPtr client; @@ -3649,22 +4031,31 @@ ProcSetInputFocus(client) REQUEST(xSetInputFocusReq); REQUEST_SIZE_MATCH(xSetInputFocusReq); -#ifdef XACE - if (!XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, TRUE)) - return Success; -#endif + return SetInputFocus(client, inputInfo.keyboard, stuff->focus, stuff->revertTo, stuff->time, FALSE); } +/** + * Server-side protocol handling for GetInputFocus request. + * + * Sends the current input focus for the virtual core keyboard back to the + * client. + */ int ProcGetInputFocus(ClientPtr client) { xGetInputFocusReply rep; - /* REQUEST(xReq); */ FocusClassPtr focus = inputInfo.keyboard->focus; - + int rc; + /* REQUEST(xReq); */ REQUEST_SIZE_MATCH(xReq); + + rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, + DixGetFocusAccess); + if (rc != Success) + return rc; + rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; @@ -3678,6 +4069,12 @@ ProcGetInputFocus(ClientPtr client) return Success; } +/** + * Server-side protocol handling for Grabpointer request. + * + * Sets an active grab on the inputInfo.pointer and returns success status to + * client. + */ int ProcGrabPointer(ClientPtr client) { @@ -3688,6 +4085,8 @@ ProcGrabPointer(ClientPtr client) CursorPtr cursor, oldCursor; REQUEST(xGrabPointerReq); TimeStamp time; + Mask access_mode = DixGrabAccess; + int rc; REQUEST_SIZE_MATCH(xGrabPointerReq); UpdateCurrentTime(); @@ -3713,30 +4112,38 @@ ProcGrabPointer(ClientPtr client) client->errorValue = stuff->eventMask; return BadValue; } - pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess); + if (rc != Success) + return rc; if (stuff->confineTo == None) confineTo = NullWindow; else { - confineTo = SecurityLookupWindow(stuff->confineTo, client, - SecurityReadAccess); - if (!confineTo) - return BadWindow; + rc = dixLookupWindow(&confineTo, stuff->confineTo, client, + DixSetAttrAccess); + if (rc != Success) + return rc; } if (stuff->cursor == None) cursor = NullCursor; else { - cursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, - RT_CURSOR, SecurityReadAccess); - if (!cursor) + rc = dixLookupResource((pointer *)&cursor, stuff->cursor, RT_CURSOR, + client, DixUseAccess); + if (rc != Success) { client->errorValue = stuff->cursor; - return BadCursor; + return (rc == BadValue) ? BadCursor : rc; } + access_mode |= DixForceAccess; } + if (stuff->pointerMode == GrabModeSync || + stuff->keyboardMode == GrabModeSync) + access_mode |= DixFreezeAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, device, access_mode); + if (rc != Success) + return rc; + /* at this point, some sort of reply is guaranteed. */ time = ClientTimeToServerTime(stuff->time); rep.type = X_Reply; @@ -3784,11 +4191,19 @@ ProcGrabPointer(ClientPtr client) return Success; } +/** + * Server-side protocol handling for ChangeActivePointerGrab request. + * + * Changes properties of the grab hold by the client. If the client does not + * hold an active grab on the device, nothing happens. + * + * Works on the core pointer only. + */ int ProcChangeActivePointerGrab(ClientPtr client) { DeviceIntPtr device = inputInfo.pointer; - register GrabPtr grab = device->grab; + GrabPtr grab = device->grab; CursorPtr newCursor, oldCursor; REQUEST(xChangeActivePointerGrabReq); TimeStamp time; @@ -3803,12 +4218,12 @@ ProcChangeActivePointerGrab(ClientPtr client) newCursor = NullCursor; else { - newCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, - RT_CURSOR, SecurityReadAccess); - if (!newCursor) + int rc = dixLookupResource((pointer *)&newCursor, stuff->cursor, + RT_CURSOR, client, DixUseAccess); + if (rc != Success) { client->errorValue = stuff->cursor; - return BadCursor; + return (rc == BadValue) ? BadCursor : rc; } } if (!grab) @@ -3830,6 +4245,11 @@ ProcChangeActivePointerGrab(ClientPtr client) return Success; } +/** + * Server-side protocol handling for UngrabPointer request. + * + * Deletes the pointer grab on the core pointer device. + */ int ProcUngrabPointer(ClientPtr client) { @@ -3849,14 +4269,34 @@ ProcUngrabPointer(ClientPtr client) return Success; } +/** + * Sets a grab on the given device. + * + * Called from ProcGrabKeyboard to work on the inputInfo.keyboard. + * Called from ProcXGrabDevice to work on the device specified by the client. + * + * The parameters this_mode and other_mode represent the keyboard_mode and + * pointer_mode parameters of XGrabKeyboard(). + * See man page for details on all the parameters + * + * @param client Client that owns the grab. + * @param dev The device to grab. + * @param this_mode GrabModeSync or GrabModeAsync + * @param other_mode GrabModeSync or GrabModeAsync + * @param status Return code to be returned to the caller. + * + * @returns Success or BadValue. + */ int -GrabDevice(register ClientPtr client, register DeviceIntPtr dev, +GrabDevice(ClientPtr client, DeviceIntPtr dev, unsigned this_mode, unsigned other_mode, Window grabWindow, unsigned ownerEvents, Time ctime, Mask mask, CARD8 *status) { - register WindowPtr pWin; - register GrabPtr grab; + WindowPtr pWin; + GrabPtr grab; TimeStamp time; + Mask access_mode = DixGrabAccess; + int rc; UpdateCurrentTime(); if ((this_mode != GrabModeSync) && (this_mode != GrabModeAsync)) @@ -3874,9 +4314,16 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev, client->errorValue = ownerEvents; return BadValue; } - pWin = SecurityLookupWindow(grabWindow, client, SecurityReadAccess); - if (!pWin) - return BadWindow; + + rc = dixLookupWindow(&pWin, grabWindow, client, DixSetAttrAccess); + if (rc != Success) + return rc; + if (this_mode == GrabModeSync || other_mode == GrabModeSync) + access_mode |= DixFreezeAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode); + if (rc != Success) + return rc; + time = ClientTimeToServerTime(ctime); grab = dev->grab; if (grab && !SameClient(grab, client)) @@ -3906,6 +4353,11 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev, return Success; } +/** + * Server-side protocol handling for GrabKeyboard request. + * + * Grabs the inputInfo.keyboad and returns success status to client. + */ int ProcGrabKeyboard(ClientPtr client) { @@ -3914,18 +4366,12 @@ ProcGrabKeyboard(ClientPtr client) int result; REQUEST_SIZE_MATCH(xGrabKeyboardReq); -#ifdef XACE - if (!XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, TRUE)) - { - result = Success; - rep.status = AlreadyGrabbed; - } - else -#endif + result = GrabDevice(client, inputInfo.keyboard, stuff->keyboardMode, stuff->pointerMode, stuff->grabWindow, stuff->ownerEvents, stuff->time, KeyPressMask | KeyReleaseMask, &rep.status); + if (result != Success) return result; rep.type = X_Reply; @@ -3935,6 +4381,11 @@ ProcGrabKeyboard(ClientPtr client) return Success; } +/** + * Server-side protocol handling for UngrabKeyboard request. + * + * Deletes a possible grab on the inputInfo.keyboard. + */ int ProcUngrabKeyboard(ClientPtr client) { @@ -3954,18 +4405,28 @@ ProcUngrabKeyboard(ClientPtr client) return Success; } +/** + * Server-side protocol handling for QueryPointer request. + * + * Returns the current state and position of the core pointer to the client. + */ int ProcQueryPointer(ClientPtr client) { xQueryPointerReply rep; WindowPtr pWin, t; - REQUEST(xResourceReq); DeviceIntPtr mouse = inputInfo.pointer; - + int rc; + REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - pWin = SecurityLookupWindow(stuff->id, client, SecurityReadAccess); - if (!pWin) - return BadWindow; + + rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess); + if (rc != Success) + return rc; + rc = XaceHook(XACE_DEVICE_ACCESS, client, mouse, DixReadAccess); + if (rc != Success) + return rc; + if (mouse->valuator->motionHintWindow) MaybeStopHint(mouse, client); rep.type = X_Reply; @@ -4011,8 +4472,12 @@ ProcQueryPointer(ClientPtr client) return(Success); } +/** + * Initializes the device list and the DIX sprite to sane values. Allocates + * trace memory used for quick window traversal. + */ void -InitEvents() +InitEvents(void) { int i; @@ -4072,6 +4537,11 @@ CloseDownEvents(void) spriteTraceSize = 0; } +/** + * Server-side protocol handling for SendEvent request. + * + * Locates the window to send the event to and forwards the event. + */ int ProcSendEvent(ClientPtr client) { @@ -4129,8 +4599,8 @@ ProcSendEvent(ClientPtr client) effectiveFocus = pWin = inputFocus; } else - pWin = SecurityLookupWindow(stuff->destination, client, - SecurityReadAccess); + dixLookupWindow(&pWin, stuff->destination, client, DixSendAccess); + if (!pWin) return BadWindow; if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue)) @@ -4143,6 +4613,9 @@ ProcSendEvent(ClientPtr client) { for (;pWin; pWin = pWin->parent) { + if (XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, + &stuff->event, 1)) + return Success; if (DeliverEventsToWindow(pWin, &stuff->event, 1, stuff->eventMask, NullGrab, 0)) return Success; @@ -4153,12 +4626,18 @@ ProcSendEvent(ClientPtr client) break; } } - else + else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, &stuff->event, 1)) (void)DeliverEventsToWindow(pWin, &stuff->event, 1, stuff->eventMask, NullGrab, 0); return Success; } +/** + * Server-side protocol handling for UngrabKey request. + * + * Deletes a passive grab for the given key. Only works on the + * inputInfo.keyboard. + */ int ProcUngrabKey(ClientPtr client) { @@ -4166,11 +4645,12 @@ ProcUngrabKey(ClientPtr client) WindowPtr pWin; GrabRec tempGrab; DeviceIntPtr keybd = inputInfo.keyboard; + int rc; REQUEST_SIZE_MATCH(xUngrabKeyReq); - pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess); + if (rc != Success) + return rc; if (((stuff->key > keybd->key->curKeySyms.maxKeyCode) || (stuff->key < keybd->key->curKeySyms.minKeyCode)) @@ -4200,6 +4680,12 @@ ProcUngrabKey(ClientPtr client) return(Success); } +/** + * Server-side protocol handling for GrabKey request. + * + * Creates a grab for the inputInfo.keyboard and adds it to the list of + * passive grabs. + */ int ProcGrabKey(ClientPtr client) { @@ -4207,6 +4693,7 @@ ProcGrabKey(ClientPtr client) REQUEST(xGrabKeyReq); GrabPtr grab; DeviceIntPtr keybd = inputInfo.keyboard; + int rc; REQUEST_SIZE_MATCH(xGrabKeyReq); if ((stuff->ownerEvents != xTrue) && (stuff->ownerEvents != xFalse)) @@ -4239,9 +4726,9 @@ ProcGrabKey(ClientPtr client) client->errorValue = stuff->modifiers; return BadValue; } - pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess); + if (rc != Success) + return rc; grab = CreateGrab(client->index, keybd, pWin, (Mask)(KeyPressMask | KeyReleaseMask), (Bool)stuff->ownerEvents, @@ -4250,10 +4737,16 @@ ProcGrabKey(ClientPtr client) NullWindow, NullCursor); if (!grab) return BadAlloc; - return AddPassiveGrabToList(grab); + return AddPassiveGrabToList(client, grab); } +/** + * Server-side protocol handling for GrabButton request. + * + * Creates a grab for the inputInfo.pointer and adds it as a passive grab to + * the list. + */ int ProcGrabButton(ClientPtr client) { @@ -4261,6 +4754,8 @@ ProcGrabButton(ClientPtr client) REQUEST(xGrabButtonReq); CursorPtr cursor; GrabPtr grab; + Mask access_mode = DixGrabAccess; + int rc; REQUEST_SIZE_MATCH(xGrabButtonReq); if ((stuff->pointerMode != GrabModeSync) && @@ -4291,30 +4786,37 @@ ProcGrabButton(ClientPtr client) client->errorValue = stuff->eventMask; return BadValue; } - pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess); + if (rc != Success) + return rc; if (stuff->confineTo == None) confineTo = NullWindow; else { - confineTo = SecurityLookupWindow(stuff->confineTo, client, - SecurityReadAccess); - if (!confineTo) - return BadWindow; + rc = dixLookupWindow(&confineTo, stuff->confineTo, client, + DixSetAttrAccess); + if (rc != Success) + return rc; } if (stuff->cursor == None) cursor = NullCursor; else { - cursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, - RT_CURSOR, SecurityReadAccess); + rc = dixLookupResource((pointer *)&cursor, stuff->cursor, RT_CURSOR, + client, DixUseAccess); + if (rc != Success) if (!cursor) { client->errorValue = stuff->cursor; - return BadCursor; + return (rc == BadValue) ? BadCursor : rc; } + access_mode |= DixForceAccess; } - + if (stuff->pointerMode == GrabModeSync || + stuff->keyboardMode == GrabModeSync) + access_mode |= DixFreezeAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.pointer, access_mode); + if (rc != Success) + return rc; grab = CreateGrab(client->index, inputInfo.pointer, pWin, (Mask)stuff->eventMask, (Bool)stuff->ownerEvents, @@ -4323,15 +4825,21 @@ ProcGrabButton(ClientPtr client) stuff->button, confineTo, cursor); if (!grab) return BadAlloc; - return AddPassiveGrabToList(grab); + return AddPassiveGrabToList(client, grab); } +/** + * Server-side protocol handling for UngrabButton request. + * + * Deletes a passive grab on the inputInfo.pointer from the list. + */ int ProcUngrabButton(ClientPtr client) { REQUEST(xUngrabButtonReq); WindowPtr pWin; GrabRec tempGrab; + int rc; REQUEST_SIZE_MATCH(xUngrabButtonReq); if ((stuff->modifiers != AnyModifier) && @@ -4340,9 +4848,9 @@ ProcUngrabButton(ClientPtr client) client->errorValue = stuff->modifiers; return BadValue; } - pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess); + if (rc != Success) + return rc; tempGrab.resource = client->clientAsMask; tempGrab.device = inputInfo.pointer; tempGrab.window = pWin; @@ -4358,6 +4866,17 @@ ProcUngrabButton(ClientPtr client) return(Success); } +/** + * Deactivate any grab that may be on the window, remove the focus. + * Delete any XInput extension events from the window too. Does not change the + * window mask. Use just before the window is deleted. + * + * If freeResources is set, passive grabs on the window are deleted. + * + * @param pWin The window to delete events from. + * @param freeResources True if resources associated with the window should be + * deleted. + */ void DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources) { @@ -4447,7 +4966,9 @@ DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources) } /** - * Call this whenever some window at or below pWin has changed geometry + * Call this whenever some window at or below pWin has changed geometry. If + * there is a grab on the window, the cursor will be re-confined into the + * window. */ _X_EXPORT void CheckCursorConfinement(WindowPtr pWin) @@ -4471,7 +4992,7 @@ CheckCursorConfinement(WindowPtr pWin) Mask EventMaskForClient(WindowPtr pWin, ClientPtr client) { - register OtherClientsPtr other; + OtherClientsPtr other; if (wClient (pWin) == client) return pWin->eventMask; @@ -4483,22 +5004,25 @@ EventMaskForClient(WindowPtr pWin, ClientPtr client) return 0; } +/** + * Server-side protocol handling for RecolorCursor request. + */ int ProcRecolorCursor(ClientPtr client) { CursorPtr pCursor; - int nscr; + int rc, nscr; ScreenPtr pscr; Bool displayed; REQUEST(xRecolorCursorReq); REQUEST_SIZE_MATCH(xRecolorCursorReq); - pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, - RT_CURSOR, SecurityWriteAccess); - if ( !pCursor) + rc = dixLookupResource((pointer *)&pCursor, stuff->cursor, RT_CURSOR, + client, DixWriteAccess); + if (rc != Success) { client->errorValue = stuff->cursor; - return (BadCursor); + return (rc == BadValue) ? BadCursor : rc; } pCursor->foreRed = stuff->foreRed; @@ -4524,6 +5048,20 @@ ProcRecolorCursor(ClientPtr client) return (Success); } +/** + * Write the given events to a client, swapping the byte order if necessary. + * To swap the byte ordering, a callback is called that has to be set up for + * the given event type. + * + * In the case of DeviceMotionNotify trailed by DeviceValuators, the events + * can be more than one. Usually it's just one event. + * + * Do not modify the event structure passed in. See comment below. + * + * @param pClient Client to send events to. + * @param count Number of events. + * @param events The event list. + */ _X_EXPORT void WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) { @@ -4580,6 +5118,14 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) eventinfo.count = count; CallCallbacks(&EventCallback, (pointer)&eventinfo); } +#ifdef XSERVER_DTRACE + if (XSERVER_SEND_EVENT_ENABLED()) { + for (i = 0; i < count; i++) + { + XSERVER_SEND_EVENT(pClient->index, events[i].u.u.type, &events[i]); + } + } +#endif if(pClient->swapped) { for(i = 0; i < count; i++) diff --git a/xserver/dix/extension.c b/xserver/dix/extension.c index 7b405a493..d486161c8 100644 --- a/xserver/dix/extension.c +++ b/xserver/dix/extension.c @@ -59,6 +59,8 @@ SOFTWARE. #include "gcstruct.h" #include "scrnintstr.h" #include "dispatch.h" +#include "privates.h" +#include "registry.h" #include "xace.h" #define EXTENSION_BASE 128 @@ -72,39 +74,6 @@ int lastEvent = EXTENSION_EVENT_BASE; static int lastError = FirstExtensionError; static unsigned int NumExtensions = 0; -extern int extensionPrivateLen; -extern unsigned *extensionPrivateSizes; -extern unsigned totalExtensionSize; - -static void -InitExtensionPrivates(ExtensionEntry *ext) -{ - char *ptr; - DevUnion *ppriv; - unsigned *sizes; - unsigned size; - int i; - - if (totalExtensionSize == sizeof(ExtensionEntry)) - ppriv = (DevUnion *)NULL; - else - ppriv = (DevUnion *)(ext + 1); - - ext->devPrivates = ppriv; - sizes = extensionPrivateSizes; - ptr = (char *)(ppriv + extensionPrivateLen); - for (i = extensionPrivateLen; --i >= 0; ppriv++, sizes++) - { - if ( (size = *sizes) ) - { - ppriv->ptr = (pointer)ptr; - ptr += size; - } - else - ppriv->ptr = (pointer)NULL; - } -} - _X_EXPORT ExtensionEntry * AddExtension(char *name, int NumEvents, int NumErrors, int (*MainProc)(ClientPtr c1), @@ -122,15 +91,14 @@ AddExtension(char *name, int NumEvents, int NumErrors, (unsigned)(lastError + NumErrors > LAST_ERROR)) return((ExtensionEntry *) NULL); - ext = (ExtensionEntry *) xalloc(totalExtensionSize); + ext = (ExtensionEntry *) xalloc(sizeof(ExtensionEntry)); if (!ext) return((ExtensionEntry *) NULL); - bzero(ext, totalExtensionSize); - InitExtensionPrivates(ext); - buflen = strlen(name) + 1; - ext->name = (char *)xalloc(buflen); ext->num_aliases = 0; ext->aliases = (char **)NULL; + ext->devPrivates = NULL; + buflen = strlen(name) + 1; + ext->name = (char *)xalloc(buflen); if (!ext->name) { xfree(ext); @@ -178,6 +146,7 @@ AddExtension(char *name, int NumEvents, int NumErrors, ext->errorLast = 0; } + RegisterExtensionNames(ext); return(ext); } @@ -187,6 +156,8 @@ _X_EXPORT Bool AddExtensionAlias(char *alias, ExtensionEntry *ext) char **aliases; size_t buflen; + if (!ext) + return FALSE ; aliases = (char **)xrealloc(ext->aliases, (ext->num_aliases + 1) * sizeof(char *)); if (!aliases) @@ -253,14 +224,6 @@ GetExtensionEntry(int major) return extensions[major]; } -_X_EXPORT void -DeclareExtensionSecurity(char *extname, Bool secure) -{ - int i = FindExtension(extname, strlen(extname)); - if (i >= 0) - XaceHook(XACE_DECLARE_EXT_SECURE, extensions[i], secure); -} - _X_EXPORT unsigned short StandardMinorOpcode(ClientPtr client) { @@ -294,6 +257,7 @@ CloseDownExtensions(void) for (j = extensions[i]->num_aliases; --j >= 0;) xfree(extensions[i]->aliases[j]); xfree(extensions[i]->aliases); + dixFreePrivates(extensions[i]->devPrivates); xfree(extensions[i]); } xfree(extensions); @@ -321,7 +285,7 @@ ProcQueryExtension(ClientPtr client) else { i = FindExtension((char *)&stuff[1], stuff->nbytes); - if (i < 0 || !XaceHook(XACE_EXT_ACCESS, client, extensions[i])) + if (i < 0 || XaceHook(XACE_EXT_ACCESS, client, extensions[i])) reply.present = xFalse; else { @@ -357,7 +321,7 @@ ProcListExtensions(ClientPtr client) for (i=0; i<NumExtensions; i++) { /* call callbacks to find out whether to show extension */ - if (!XaceHook(XACE_EXT_ACCESS, client, extensions[i])) + if (XaceHook(XACE_EXT_ACCESS, client, extensions[i]) != Success) continue; total_length += strlen(extensions[i]->name) + 1; @@ -366,13 +330,13 @@ ProcListExtensions(ClientPtr client) total_length += strlen(extensions[i]->aliases[j]) + 1; } reply.length = (total_length + 3) >> 2; - buffer = bufptr = (char *)ALLOCATE_LOCAL(total_length); + buffer = bufptr = (char *)xalloc(total_length); if (!buffer) return(BadAlloc); for (i=0; i<NumExtensions; i++) { int len; - if (!XaceHook(XACE_EXT_ACCESS, client, extensions[i])) + if (XaceHook(XACE_EXT_ACCESS, client, extensions[i]) != Success) continue; *bufptr++ = len = strlen(extensions[i]->name); @@ -390,21 +354,7 @@ ProcListExtensions(ClientPtr client) if (reply.length) { WriteToClient(client, total_length, buffer); - DEALLOCATE_LOCAL(buffer); + xfree(buffer); } return(client->noClientException); } - -#ifdef XSERVER_DTRACE -void LoadExtensionNames(char **RequestNames) { - int i; - - for (i=0; i<NumExtensions; i++) { - int r = extensions[i]->base; - - if (RequestNames[r] == NULL) { - RequestNames[r] = strdup(extensions[i]->name); - } - } -} -#endif diff --git a/xserver/dix/gc.c b/xserver/dix/gc.c index ed6bf26db..83f48d4e3 100644 --- a/xserver/dix/gc.c +++ b/xserver/dix/gc.c @@ -61,7 +61,9 @@ SOFTWARE. #include "scrnintstr.h" #include "region.h" +#include "privates.h" #include "dix.h" +#include "xace.h" #include <assert.h> extern XID clientErrorValue; @@ -69,7 +71,7 @@ extern FontPtr defaultFont; static Bool CreateDefaultTile(GCPtr pGC); -unsigned char DefaultDash[2] = {4, 4}; +static unsigned char DefaultDash[2] = {4, 4}; _X_EXPORT void ValidateGC(DrawablePtr pDraw, GC *pGC) @@ -144,12 +146,12 @@ ValidateGC(DrawablePtr pDraw, GC *pGC) assert(pUnion); _var = (_type)pUnion->ptr; pUnion++; } _X_EXPORT int -dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC32, ChangeGCValPtr pUnion) +dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr pUnion) { - register BITS32 index2; - register int error = 0; - PixmapPtr pPixmap; - BITS32 maskQ; + BITS32 index2; + int rc, error = 0; + PixmapPtr pPixmap; + BITS32 maskQ; assert( (pC32 && !pUnion) || (!pC32 && pUnion) ); pGC->serialNumber |= GC_CHANGE_SERIAL_BIT; @@ -266,14 +268,15 @@ dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC if (pUnion) { NEXT_PTR(PixmapPtr, pPixmap); + rc = Success; } else { NEXTVAL(XID, newpix); - pPixmap = (PixmapPtr)SecurityLookupIDByType(client, - newpix, RT_PIXMAP, SecurityReadAccess); + rc = dixLookupResource((pointer *)&pPixmap, newpix, + RT_PIXMAP, client, DixReadAccess); } - if (pPixmap) + if (rc == Success) { if ((pPixmap->drawable.depth != pGC->depth) || (pPixmap->drawable.pScreen != pGC->pScreen)) @@ -292,7 +295,7 @@ dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC else { clientErrorValue = newpix; - error = BadPixmap; + error = (rc == BadValue) ? BadPixmap : rc; } break; } @@ -302,14 +305,15 @@ dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC if (pUnion) { NEXT_PTR(PixmapPtr, pPixmap); + rc = Success; } else { NEXTVAL(XID, newstipple) - pPixmap = (PixmapPtr)SecurityLookupIDByType(client, - newstipple, RT_PIXMAP, SecurityReadAccess); + rc = dixLookupResource((pointer *)&pPixmap, newstipple, + RT_PIXMAP, client, DixReadAccess); } - if (pPixmap) + if (rc == Success) { if ((pPixmap->drawable.depth != 1) || (pPixmap->drawable.pScreen != pGC->pScreen)) @@ -327,7 +331,7 @@ dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC else { clientErrorValue = newstipple; - error = BadPixmap; + error = (rc == BadValue) ? BadPixmap : rc; } break; } @@ -344,14 +348,15 @@ dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC if (pUnion) { NEXT_PTR(FontPtr, pFont); + rc = Success; } else { NEXTVAL(XID, newfont) - pFont = (FontPtr)SecurityLookupIDByType(client, newfont, - RT_FONT, SecurityReadAccess); + rc = dixLookupResource((pointer *)&pFont, newfont, + RT_FONT, client, DixUseAccess); } - if (pFont) + if (rc == Success) { pFont->refcnt++; if (pGC->font) @@ -361,7 +366,7 @@ dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC else { clientErrorValue = newfont; - error = BadFont; + error = (rc == BadValue) ? BadFont : rc; } break; } @@ -414,9 +419,15 @@ dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC clipType = CT_NONE; pPixmap = NullPixmap; } - else - pPixmap = (PixmapPtr)SecurityLookupIDByType(client, - pid, RT_PIXMAP, SecurityReadAccess); + else { + rc = dixLookupResource((pointer *)&pPixmap, pid, + RT_PIXMAP, client, + DixReadAccess); + if (rc != Success) { + clientErrorValue = pid; + error = (rc == BadValue) ? BadPixmap : rc; + } + } } if (pPixmap) @@ -432,11 +443,6 @@ dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC pPixmap->refcnt++; } } - else if (!pUnion && (pid != None)) - { - clientErrorValue = pid; - error = BadPixmap; - } if(error == Success) { (*pGC->funcs->ChangeClip)(pGC, clipType, @@ -522,7 +528,7 @@ dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC /* Publically defined entry to ChangeGC. Just calls dixChangeGC and tells * it that all of the entries are constants or IDs */ _X_EXPORT int -ChangeGC(register GC *pGC, register BITS32 mask, XID *pval) +ChangeGC(GC *pGC, BITS32 mask, XID *pval) { return (dixChangeGC(NullClient, pGC, mask, pval, NULL)); } @@ -548,7 +554,7 @@ NOTE: 32 bits long */ _X_EXPORT int -DoChangeGC(register GC *pGC, register BITS32 mask, XID *pval, int fPointer) +DoChangeGC(GC *pGC, BITS32 mask, XID *pval, int fPointer) { if (fPointer) /* XXX might be a problem on 64 bit big-endian servers */ @@ -567,44 +573,13 @@ BUG: should check for failure to create default tile */ - -static GCPtr -AllocateGC(ScreenPtr pScreen) -{ - GCPtr pGC; - register char *ptr; - register DevUnion *ppriv; - register unsigned *sizes; - register unsigned size; - register int i; - - pGC = (GCPtr)xalloc(pScreen->totalGCSize); - if (pGC) - { - ppriv = (DevUnion *)(pGC + 1); - pGC->devPrivates = ppriv; - sizes = pScreen->GCPrivateSizes; - ptr = (char *)(ppriv + pScreen->GCPrivateLen); - for (i = pScreen->GCPrivateLen; --i >= 0; ppriv++, sizes++) - { - if ( (size = *sizes) ) - { - ppriv->ptr = (pointer)ptr; - ptr += size; - } - else - ppriv->ptr = (pointer)NULL; - } - } - return pGC; -} - _X_EXPORT GCPtr -CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus) +CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus, + XID gcid, ClientPtr client) { - register GCPtr pGC; + GCPtr pGC; - pGC = AllocateGC(pDrawable->pScreen); + pGC = (GCPtr)xalloc(sizeof(GC)); if (!pGC) { *pStatus = BadAlloc; @@ -617,7 +592,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus) pGC->planemask = ~0; pGC->serialNumber = GC_CHANGE_SERIAL_BIT; pGC->funcs = 0; - + pGC->devPrivates = NULL; pGC->fgPixel = 0; pGC->bgPixel = 1; pGC->lineWidth = 0; @@ -662,6 +637,12 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus) pGC->stipple = pGC->pScreen->PixmapPerDepth[0]; pGC->stipple->refcnt++; + /* security creation/labeling check */ + *pStatus = XaceHook(XACE_RESOURCE_ACCESS, client, gcid, RT_GC, pGC, + RT_NONE, NULL, DixCreateAccess|DixSetAttrAccess); + if (*pStatus != Success) + goto out; + pGC->stateChanges = (1 << (GCLastBit+1)) - 1; if (!(*pGC->pScreen->CreateGC)(pGC)) *pStatus = BadAlloc; @@ -669,6 +650,8 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus) *pStatus = ChangeGC(pGC, mask, pval); else *pStatus = Success; + +out: if (*pStatus != Success) { if (!pGC->tileIsPixel && !pGC->tile.pixmap) @@ -694,7 +677,7 @@ CreateDefaultTile (GCPtr pGC) (*pGC->pScreen->QueryBestSize)(TileShape, &w, &h, pGC->pScreen); pTile = (PixmapPtr) (*pGC->pScreen->CreatePixmap)(pGC->pScreen, - w, h, pGC->depth); + w, h, pGC->depth, 0); pgcScratch = GetScratchGC(pGC->depth, pGC->pScreen); if (!pTile || !pgcScratch) { @@ -724,11 +707,11 @@ CreateDefaultTile (GCPtr pGC) } _X_EXPORT int -CopyGC(register GC *pgcSrc, register GC *pgcDst, register BITS32 mask) +CopyGC(GC *pgcSrc, GC *pgcDst, BITS32 mask) { - register BITS32 index2; - BITS32 maskQ; - int error = 0; + BITS32 index2; + BITS32 maskQ; + int error = 0; if (pgcSrc == pgcDst) return Success; @@ -903,21 +886,11 @@ FreeGC(pointer value, XID gid) (*pGC->funcs->DestroyGC) (pGC); if (pGC->dash != DefaultDash) xfree(pGC->dash); + dixFreePrivates(pGC->devPrivates); xfree(pGC); return(Success); } -void -SetGCMask(GCPtr pGC, Mask selectMask, Mask newDataMask) -{ - pGC->stateChanges = (~selectMask & pGC->stateChanges) | - (selectMask & newDataMask); - if (selectMask & newDataMask) - pGC->serialNumber |= GC_CHANGE_SERIAL_BIT; -} - - - /* CreateScratchGC(pScreen, depth) like CreateGC, but doesn't do the default tile or stipple, since we can't create them without already having a GC. any code @@ -934,9 +907,9 @@ go with CreateGC() or ChangeGC().) _X_EXPORT GCPtr CreateScratchGC(ScreenPtr pScreen, unsigned depth) { - register GCPtr pGC; + GCPtr pGC; - pGC = AllocateGC(pScreen); + pGC = (GCPtr)xalloc(sizeof(GC)); if (!pGC) return (GCPtr)NULL; @@ -945,7 +918,7 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth) pGC->alu = GXcopy; /* dst <- src */ pGC->planemask = ~0; pGC->serialNumber = 0; - + pGC->devPrivates = NULL; pGC->fgPixel = 0; pGC->bgPixel = 1; pGC->lineWidth = 0; @@ -986,8 +959,8 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth) void FreeGCperDepth(int screenNum) { - register int i; - register ScreenPtr pScreen; + int i; + ScreenPtr pScreen; GCPtr *ppGC; pScreen = screenInfo.screens[screenNum]; @@ -1002,8 +975,8 @@ FreeGCperDepth(int screenNum) Bool CreateGCperDepth(int screenNum) { - register int i; - register ScreenPtr pScreen; + int i; + ScreenPtr pScreen; DepthPtr pDepth; GCPtr *ppGC; @@ -1035,7 +1008,7 @@ CreateGCperDepth(int screenNum) Bool CreateDefaultStipple(int screenNum) { - register ScreenPtr pScreen; + ScreenPtr pScreen; XID tmpval[3]; xRectangle rect; CARD16 w, h; @@ -1047,7 +1020,7 @@ CreateDefaultStipple(int screenNum) h = 16; (* pScreen->QueryBestSize)(StippleShape, &w, &h, pScreen); if (!(pScreen->PixmapPerDepth[0] = - (*pScreen->CreatePixmap)(pScreen, w, h, 1))) + (*pScreen->CreatePixmap)(pScreen, w, h, 1, 0))) return FALSE; /* fill stipple with 1 */ tmpval[0] = GXcopy; tmpval[1] = 1; tmpval[2] = FillSolid; @@ -1077,10 +1050,10 @@ FreeDefaultStipple(int screenNum) } _X_EXPORT int -SetDashes(register GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash) +SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash) { - register long i; - register unsigned char *p, *indash; + long i; + unsigned char *p, *indash; BITS32 maskQ = 0; i = ndash; @@ -1135,8 +1108,8 @@ SetDashes(register GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pd _X_EXPORT int VerifyRectOrder(int nrects, xRectangle *prects, int ordering) { - register xRectangle *prectP, *prectN; - register int i; + xRectangle *prectP, *prectN; + int i; switch(ordering) { @@ -1220,10 +1193,10 @@ SetClipRects(GCPtr pGC, int xOrigin, int yOrigin, int nrects, you use it often enough it will become real.) */ _X_EXPORT GCPtr -GetScratchGC(register unsigned depth, register ScreenPtr pScreen) +GetScratchGC(unsigned depth, ScreenPtr pScreen) { - register int i; - register GCPtr pGC; + int i; + GCPtr pGC; for (i=0; i<=pScreen->numDepths; i++) if ( pScreen->GCperDepth[i]->depth == depth && @@ -1269,10 +1242,10 @@ mark it as available. if not, free it for real */ _X_EXPORT void -FreeScratchGC(register GCPtr pGC) +FreeScratchGC(GCPtr pGC) { - register ScreenPtr pScreen = pGC->pScreen; - register int i; + ScreenPtr pScreen = pGC->pScreen; + int i; for (i=0; i<=pScreen->numDepths; i++) { diff --git a/xserver/dix/getevents.c b/xserver/dix/getevents.c index c96ee68cd..1e0edbf00 100644 --- a/xserver/dix/getevents.c +++ b/xserver/dix/getevents.c @@ -207,11 +207,13 @@ updateMotionHistory(DeviceIntPtr pDev, CARD32 ms, int first_valuator, * * Should be used in DIX as: * xEvent *events = xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + * + * This MUST be absolutely constant, from init until exit. */ _X_EXPORT int GetMaximumEventsNum(void) { /* Two base events -- core and device, plus valuator events. Multiply - * by two if we're doing key repeats. */ + * by two if we're doing non-XKB key repeats. */ int ret = 2 + MAX_VALUATOR_EVENTS; #ifdef XKB @@ -274,7 +276,7 @@ acceleratePointer(DeviceIntPtr pDev, int first_valuator, int num_valuators, } } else { - mult = pow((float)dx * (float)dx + (float)dy * (float)dy, + mult = pow((float)dx * (float)dx + (float)dy * (float)dy, ((float)(pDev->ptrfeed->ctrl.num) / (float)(pDev->ptrfeed->ctrl.den) - 1.0) / 2.0) / 2.0; @@ -406,7 +408,7 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type, int numEvents = 0; CARD32 ms = 0; KeySym *map = pDev->key->curKeySyms.map; - KeySym sym = map[key_code * pDev->key->curKeySyms.mapWidth]; + KeySym sym; deviceKeyButtonPointer *kbp = NULL; if (!events) @@ -423,6 +425,9 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type, if (key_code < 8 || key_code > 255) return 0; + sym = map[(key_code - pDev->key->curKeySyms.minKeyCode) + * pDev->key->curKeySyms.mapWidth]; + if (pDev->coreEvents) numEvents = 2; else @@ -837,7 +842,8 @@ SwitchCoreKeyboard(DeviceIntPtr pDev) KeyClassPtr ckeyc = inputInfo.keyboard->key; int i = 0; - if (inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr != pDev) { + if (pDev != dixLookupPrivate(&inputInfo.keyboard->devPrivates, + CoreDevicePrivateKey)) { memcpy(ckeyc->modifierMap, pDev->key->modifierMap, MAP_LENGTH); if (ckeyc->modifierKeyMap) xfree(ckeyc->modifierKeyMap); @@ -881,7 +887,8 @@ SwitchCoreKeyboard(DeviceIntPtr pDev) (ckeyc->curKeySyms.maxKeyCode - ckeyc->curKeySyms.minKeyCode), serverClient); - inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr = pDev; + dixSetPrivate(&inputInfo.keyboard->devPrivates, CoreDevicePrivateKey, + pDev); } } @@ -895,8 +902,10 @@ SwitchCoreKeyboard(DeviceIntPtr pDev) _X_EXPORT void SwitchCorePointer(DeviceIntPtr pDev) { - if (inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr != pDev) - inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr = pDev; + if (pDev != dixLookupPrivate(&inputInfo.pointer->devPrivates, + CoreDevicePrivateKey)) + dixSetPrivate(&inputInfo.pointer->devPrivates, + CoreDevicePrivateKey, pDev); } diff --git a/xserver/dix/globals.c b/xserver/dix/globals.c index f86c6026d..7f95eabd5 100644 --- a/xserver/dix/globals.c +++ b/xserver/dix/globals.c @@ -136,7 +136,6 @@ Bool screenSaverSuspended = FALSE; char *defaultFontPath = COMPILEDDEFAULTFONTPATH; char *defaultTextFont = COMPILEDDEFAULTFONT; char *defaultCursorFont = COMPILEDCURSORFONT; -char *rgbPath = RGB_DB; char *defaultDisplayClass = COMPILEDDISPLAYCLASS; FontPtr defaultFont; /* not declared in dix.h to avoid including font.h in every compilation of dix code */ @@ -144,7 +143,9 @@ Bool loadableFonts = FALSE; CursorPtr rootCursor; Bool blackRoot=FALSE; Bool whiteRoot=FALSE; +#ifdef XPRINT ClientPtr requestingClient; /* XXX this should be obsolete now, remove? */ +#endif _X_EXPORT TimeStamp currentTime; _X_EXPORT TimeStamp lastDeviceEventTime; diff --git a/xserver/dix/glyphcurs.c b/xserver/dix/glyphcurs.c index c1c545fa9..905b5fb13 100644 --- a/xserver/dix/glyphcurs.c +++ b/xserver/dix/glyphcurs.c @@ -74,10 +74,10 @@ cursor metrics. */ int -ServerBitsFromGlyph(FontPtr pfont, unsigned ch, register CursorMetricPtr cm, unsigned char **ppbits) +ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, unsigned char **ppbits) { - register ScreenPtr pScreen; - register GCPtr pGC; + ScreenPtr pScreen; + GCPtr pGC; xRectangle rect; PixmapPtr ppix; long nby; @@ -98,7 +98,8 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, register CursorMetricPtr cm, uns bzero(pbits, nby); ppix = (PixmapPtr)(*pScreen->CreatePixmap)(pScreen, cm->width, - cm->height, 1); + cm->height, 1, + CREATE_PIXMAP_USAGE_SCRATCH); pGC = GetScratchGC(1, pScreen); if (!ppix || !pGC) { @@ -140,7 +141,7 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, register CursorMetricPtr cm, uns Bool -CursorMetricsFromGlyph(register FontPtr pfont, unsigned ch, register CursorMetricPtr cm) +CursorMetricsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm) { CharInfoPtr pci; unsigned long nglyphs; diff --git a/xserver/dix/grabs.c b/xserver/dix/grabs.c index 0c2b05e89..85e101c6a 100644 --- a/xserver/dix/grabs.c +++ b/xserver/dix/grabs.c @@ -58,6 +58,7 @@ SOFTWARE. #include "inputstr.h" #include "cursorstr.h" #include "dixgrabs.h" +#include "xace.h" #define BITMASK(i) (((Mask)1) << ((i) & 31)) #define MASKIDX(i) ((i) >> 5) @@ -128,7 +129,7 @@ FreeGrab(GrabPtr pGrab) int DeletePassiveGrab(pointer value, XID id) { - register GrabPtr g, prev; + GrabPtr g, prev; GrabPtr pGrab = (GrabPtr)value; /* it is OK if the grab isn't found */ @@ -153,8 +154,8 @@ DeletePassiveGrab(pointer value, XID id) static Mask * DeleteDetailFromMask(Mask *pDetailMask, unsigned short detail) { - register Mask *mask; - register int i; + Mask *mask; + int i; mask = (Mask *)xalloc(sizeof(Mask) * MasksPerDetailMask); if (mask) @@ -269,10 +270,48 @@ GrabMatchesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab) return FALSE; } +static Bool +GrabsAreIdentical(GrabPtr pFirstGrab, GrabPtr pSecondGrab) +{ + if (pFirstGrab->device != pSecondGrab->device || + (pFirstGrab->modifierDevice != pSecondGrab->modifierDevice) || + (pFirstGrab->type != pSecondGrab->type)) + return FALSE; + + if (!(DetailSupersedesSecond(pFirstGrab->detail, + pSecondGrab->detail, + (unsigned short)AnyKey) && + DetailSupersedesSecond(pSecondGrab->detail, + pFirstGrab->detail, + (unsigned short)AnyKey))) + return FALSE; + + if (!(DetailSupersedesSecond(pFirstGrab->modifiersDetail, + pSecondGrab->modifiersDetail, + (unsigned short)AnyModifier) && + DetailSupersedesSecond(pSecondGrab->modifiersDetail, + pFirstGrab->modifiersDetail, + (unsigned short)AnyModifier))) + return FALSE; + + return TRUE; +} + + +/** + * Prepend the new grab to the list of passive grabs on the window. + * Any previously existing grab that matches the new grab will be removed. + * Adding a new grab that would override another client's grab will result in + * a BadAccess. + * + * @return Success or X error code on failure. + */ int -AddPassiveGrabToList(GrabPtr pGrab) +AddPassiveGrabToList(ClientPtr client, GrabPtr pGrab) { GrabPtr grab; + Mask access_mode = DixGrabAccess; + int rc; for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next) { @@ -286,11 +325,28 @@ AddPassiveGrabToList(GrabPtr pGrab) } } + if (pGrab->keyboardMode == GrabModeSync||pGrab->pointerMode == GrabModeSync) + access_mode |= DixFreezeAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, pGrab->device, access_mode); + if (rc != Success) + return rc; + + /* Remove all grabs that match the new one exactly */ + for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next) + { + if (GrabsAreIdentical(pGrab, grab)) + { + DeletePassiveGrabFromList(grab); + break; + } + } + if (!pGrab->window->optional && !MakeWindowOptional (pGrab->window)) { FreeGrab(pGrab); return BadAlloc; } + pGrab->next = pGrab->window->optional->passiveGrabs; pGrab->window->optional->passiveGrabs = pGrab; if (AddResource(pGrab->resource, RT_PASSIVEGRAB, (pointer)pGrab)) @@ -305,7 +361,7 @@ AddPassiveGrabToList(GrabPtr pGrab) Bool DeletePassiveGrabFromList(GrabPtr pMinuendGrab) { - register GrabPtr grab; + GrabPtr grab; GrabPtr *deletes, *adds; Mask ***updates, **details; int i, ndels, nadds, nups; @@ -322,16 +378,16 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab) i++; if (!i) return TRUE; - deletes = (GrabPtr *)ALLOCATE_LOCAL(i * sizeof(GrabPtr)); - adds = (GrabPtr *)ALLOCATE_LOCAL(i * sizeof(GrabPtr)); - updates = (Mask ***)ALLOCATE_LOCAL(i * sizeof(Mask **)); - details = (Mask **)ALLOCATE_LOCAL(i * sizeof(Mask *)); + deletes = (GrabPtr *)xalloc(i * sizeof(GrabPtr)); + adds = (GrabPtr *)xalloc(i * sizeof(GrabPtr)); + updates = (Mask ***)xalloc(i * sizeof(Mask **)); + details = (Mask **)xalloc(i * sizeof(Mask *)); if (!deletes || !adds || !updates || !details) { - if (details) DEALLOCATE_LOCAL(details); - if (updates) DEALLOCATE_LOCAL(updates); - if (adds) DEALLOCATE_LOCAL(adds); - if (deletes) DEALLOCATE_LOCAL(deletes); + if (details) xfree(details); + if (updates) xfree(updates); + if (adds) xfree(adds); + if (deletes) xfree(deletes); return FALSE; } ndels = nadds = nups = 0; @@ -426,10 +482,10 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab) *updates[i] = details[i]; } } - DEALLOCATE_LOCAL(details); - DEALLOCATE_LOCAL(updates); - DEALLOCATE_LOCAL(adds); - DEALLOCATE_LOCAL(deletes); + xfree(details); + xfree(updates); + xfree(adds); + xfree(deletes); return ok; #undef UPDATE diff --git a/xserver/dix/main.c b/xserver/dix/main.c index f3cde189c..6d9dd3332 100644 --- a/xserver/dix/main.c +++ b/xserver/dix/main.c @@ -74,8 +74,6 @@ Equipment Corporation. ******************************************************************/ -/* $TOG: main.c /main/86 1998/02/09 14:20:03 kaleb $ */ - #define NEED_EVENTS #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> @@ -95,12 +93,16 @@ Equipment Corporation. #include "colormap.h" #include "colormapst.h" #include "cursorstr.h" +#include "selection.h" #include <X11/fonts/font.h> #include "opaque.h" #include "servermd.h" +#include "hotplug.h" #include "site.h" #include "dixfont.h" #include "extnsionst.h" +#include "privates.h" +#include "registry.h" #ifdef XPRINT #include "DiPrint.h" #endif @@ -117,15 +119,12 @@ Equipment Corporation. #include "dpmsproc.h" #endif -extern int InitClientPrivates(ClientPtr client); - extern void Dispatch(void); char *ConnectionInfo; xConnSetupPrefix connSetupPrefix; extern FontPtr defaultFont; -extern int screenPrivateCount; extern void InitProcVectors(void); extern Bool CreateGCperDepthArray(void); @@ -135,14 +134,10 @@ static #endif Bool CreateConnectionBlock(void); -static void FreeScreen(ScreenPtr); - _X_EXPORT PaddingInfo PixmapWidthPaddingInfo[33]; int connBlockScreenStart; -static int restart = 0; - _X_EXPORT void NotImplemented(xEvent *from, xEvent *to) { @@ -242,6 +237,10 @@ static int indexForScanlinePad[ 65 ] = { #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif +#ifdef __APPLE__ +void DarwinHandleGUI(int argc, char **argv, char **envp); +#endif + int main(int argc, char *argv[], char *envp[]) { @@ -252,24 +251,18 @@ main(int argc, char *argv[], char *envp[]) display = "0"; InitGlobals(); + InitRegions(); #ifdef XPRINT PrinterInitGlobals(); #endif +#ifdef XQUARTZ /* Quartz support on Mac OS X requires that the Cocoa event loop be in * the main thread. This allows the X server main to be called again * from another thread. */ -#if defined(__DARWIN__) && defined(DARWIN_WITH_QUARTZ) DarwinHandleGUI(argc, argv, envp); #endif - /* Notice if we're restarted. Probably this is because we jumped through - * an uninitialized pointer */ - if (restart) - FatalError("server restarted. Jumped through uninitialized pointer?\n"); - else - restart = 1; - CheckUserParameters(argc, argv, envp); CheckUserAuthorization(); @@ -309,7 +302,8 @@ main(int argc, char *argv[], char *envp[]) #endif InitBlockAndWakeupHandlers(); /* Perform any operating system dependent initializations you'd like */ - OsInit(); + OsInit(); + config_init(); if(serverGeneration == 1) { CreateWellKnownSockets(); @@ -353,18 +347,12 @@ main(int argc, char *argv[], char *envp[]) InitAtoms(); InitEvents(); + InitSelections(); InitGlyphCaching(); - ResetExtensionPrivates(); - ResetClientPrivates(); - ResetScreenPrivates(); - ResetWindowPrivates(); - ResetGCPrivates(); -#ifdef PIXPRIV - ResetPixmapPrivates(); -#endif - ResetColormapPrivates(); + if (!dixResetPrivates()) + FatalError("couldn't init private data storage"); + dixResetRegistry(); ResetFontPrivateIndex(); - ResetDevicePrivateIndex(); InitCallbackManager(); InitVisualWrap(); InitOutput(&screenInfo, argc, argv); @@ -377,8 +365,6 @@ main(int argc, char *argv[], char *envp[]) if (screenInfo.numVideoScreens < 0) screenInfo.numVideoScreens = screenInfo.numScreens; InitExtensions(argc, argv); - if (!InitClientPrivates(serverClient)) - FatalError("failed to allocate serverClient devprivates"); for (i = 0; i < screenInfo.numScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; @@ -394,23 +380,29 @@ main(int argc, char *argv[], char *envp[]) if (!CreateRootWindow(pScreen)) FatalError("failed to create root window"); } + InitCoreDevices(); InitInput(argc, argv); if (InitAndStartDevices() != Success) FatalError("failed to initialize core devices"); InitFonts(); - if (loadableFonts) { - SetFontPath(0, 0, (unsigned char *)defaultFontPath, &error); - } else { + if (loadableFonts) + SetFontPath(serverClient, 0, (unsigned char *)defaultFontPath, + &error); + else { if (SetDefaultFontPath(defaultFontPath) != Success) ErrorF("failed to set default font path '%s'", defaultFontPath); } - if (!SetDefaultFont(defaultTextFont)) + if (!SetDefaultFont(defaultTextFont)) { FatalError("could not open default font '%s'", defaultTextFont); - if (!(rootCursor = CreateRootCursor(defaultCursorFont, 0))) + } + + if (!(rootCursor = CreateRootCursor(NULL, 0))) { FatalError("could not open default cursor font '%s'", defaultCursorFont); + } + #ifdef DPMSExtension /* check all screens, looking for DPMS Capabilities */ DPMSCapableFlag = DPMSSupported(); @@ -429,24 +421,28 @@ main(int argc, char *argv[], char *envp[]) for (i = 0; i < screenInfo.numScreens; i++) InitRootWindow(WindowTable[i]); DefineInitialRootWindow(WindowTable[0]); - SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset); + dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); #ifdef PANORAMIX if (!noPanoramiXExtension) { - if (!PanoramiXCreateConnectionBlock()) + if (!PanoramiXCreateConnectionBlock()) { FatalError("could not create connection block info"); + } } else #endif { - if (!CreateConnectionBlock()) + if (!CreateConnectionBlock()) { FatalError("could not create connection block info"); + } } + NotifyParentProcess(); + Dispatch(); /* Now free up whatever must be freed */ if (screenIsSaved == SCREEN_SAVER_ON) - SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset); + dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset); FreeScreenSaverTimer(); CloseDownExtensions(); @@ -461,14 +457,19 @@ main(int argc, char *argv[], char *envp[]) FreeAllResources(); #endif + config_fini(); + + memset(WindowTable, 0, MAXSCREENS * sizeof(WindowPtr)); CloseDownDevices(); + for (i = screenInfo.numScreens - 1; i >= 0; i--) { FreeScratchPixmapsForScreen(i); FreeGCperDepth(i); FreeDefaultStipple(i); (* screenInfo.screens[i]->CloseScreen)(i, screenInfo.screens[i]); - FreeScreen(screenInfo.screens[i]); + dixFreePrivates(screenInfo.screens[i]->devPrivates); + xfree(screenInfo.screens[i]); screenInfo.numScreens = i; } CloseDownEvents(); @@ -478,7 +479,7 @@ main(int argc, char *argv[], char *envp[]) FreeAuditTimer(); - xfree(serverClient->devPrivates); + dixFreePrivates(serverClient->devPrivates); serverClient->devPrivates = NULL; if (dispatchException & DE_TERMINATE) @@ -501,7 +502,7 @@ main(int argc, char *argv[], char *envp[]) } static int VendorRelease = VENDOR_RELEASE; -static char *VendorString = VENDOR_STRING; +static char *VendorString = VENDOR_NAME; void SetVendorRelease(int release) @@ -521,7 +522,7 @@ static int padlength[4] = {0, 3, 2, 1}; static #endif Bool -CreateConnectionBlock() +CreateConnectionBlock(void) { xConnSetup setup; xWindowRoot root; @@ -681,9 +682,6 @@ AddScreen( int i; int scanlinepad, format, depth, bitsPerPixel, j, k; ScreenPtr pScreen; -#ifdef DEBUG - void (**jNI) (); -#endif /* DEBUG */ i = screenInfo.numScreens; if (i == MAXSCREENS) @@ -693,37 +691,12 @@ AddScreen( if (!pScreen) return -1; - pScreen->devPrivates = (DevUnion *)xcalloc(sizeof(DevUnion), - screenPrivateCount); - if (!pScreen->devPrivates && screenPrivateCount) - { - xfree(pScreen); - return -1; - } + pScreen->devPrivates = NULL; pScreen->myNum = i; - pScreen->WindowPrivateLen = 0; - pScreen->WindowPrivateSizes = (unsigned *)NULL; - pScreen->totalWindowSize = - ((sizeof(WindowRec) + sizeof(long) - 1) / sizeof(long)) * sizeof(long); - pScreen->GCPrivateLen = 0; - pScreen->GCPrivateSizes = (unsigned *)NULL; - pScreen->totalGCSize = - ((sizeof(GC) + sizeof(long) - 1) / sizeof(long)) * sizeof(long); -#ifdef PIXPRIV - pScreen->PixmapPrivateLen = 0; - pScreen->PixmapPrivateSizes = (unsigned *)NULL; pScreen->totalPixmapSize = BitmapBytePad(sizeof(PixmapRec)*8); -#endif pScreen->ClipNotify = 0; /* for R4 ddx compatibility */ pScreen->CreateScreenResources = 0; -#ifdef DEBUG - for (jNI = &pScreen->QueryBestSize; - jNI < (void (**) ()) &pScreen->SendGraphicsExpose; - jNI++) - *jNI = NotImplemented; -#endif /* DEBUG */ - /* * This loop gets run once for every Screen that gets added, * but thats ok. If the ddx layer initializes the formats @@ -772,21 +745,10 @@ AddScreen( screenInfo.numScreens++; if (!(*pfnInit)(i, pScreen, argc, argv)) { - FreeScreen(pScreen); + dixFreePrivates(pScreen->devPrivates); + xfree(pScreen); screenInfo.numScreens--; return -1; } return i; } - -static void -FreeScreen(ScreenPtr pScreen) -{ - xfree(pScreen->WindowPrivateSizes); - xfree(pScreen->GCPrivateSizes); -#ifdef PIXPRIV - xfree(pScreen->PixmapPrivateSizes); -#endif - xfree(pScreen->devPrivates); - xfree(pScreen); -} diff --git a/xserver/dix/pixmap.c b/xserver/dix/pixmap.c index a5b7b064d..82e388cf3 100644 --- a/xserver/dix/pixmap.c +++ b/xserver/dix/pixmap.c @@ -59,7 +59,7 @@ GetScratchPixmapHeader(ScreenPtr pScreen, int width, int height, int depth, pScreen->pScratchPixmap = NULL; else /* width and height of 0 means don't allocate any pixmap data */ - pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth); + pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth, 0); if (pPixmap) { if ((*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth, @@ -109,12 +109,6 @@ _X_EXPORT PixmapPtr AllocatePixmap(ScreenPtr pScreen, int pixDataSize) { PixmapPtr pPixmap; -#ifdef PIXPRIV - char *ptr; - DevUnion *ppriv; - unsigned *sizes; - unsigned size; - int i; if (pScreen->totalPixmapSize > ((size_t)-1) - pixDataSize) return NullPixmap; @@ -122,30 +116,7 @@ AllocatePixmap(ScreenPtr pScreen, int pixDataSize) pPixmap = (PixmapPtr)xalloc(pScreen->totalPixmapSize + pixDataSize); if (!pPixmap) return NullPixmap; - ppriv = (DevUnion *)(pPixmap + 1); - pPixmap->devPrivates = ppriv; - sizes = pScreen->PixmapPrivateSizes; - ptr = (char *)(ppriv + pScreen->PixmapPrivateLen); - for (i = pScreen->PixmapPrivateLen; --i >= 0; ppriv++, sizes++) - { - if ((size = *sizes) != 0) - { - ppriv->ptr = (pointer)ptr; - ptr += size; - } - else - ppriv->ptr = (pointer)NULL; - } -#else - pPixmap = (PixmapPtr)xalloc(sizeof(PixmapRec) + pixDataSize); -#endif - -#ifdef _XSERVER64 - if (pPixmap) { - pPixmap->drawable.pad0 = 0; - pPixmap->drawable.pad1 = 0; - } -#endif + pPixmap->devPrivates = NULL; return pPixmap; } diff --git a/xserver/dix/privates.c b/xserver/dix/privates.c index b20a1dbf0..efb320463 100644 --- a/xserver/dix/privates.c +++ b/xserver/dix/privates.c @@ -30,427 +30,285 @@ from The Open Group. #include <dix-config.h> #endif -#include <X11/X.h> -#include "scrnintstr.h" -#include "misc.h" -#include "os.h" +#include <stddef.h> #include "windowstr.h" #include "resource.h" -#include "dixstruct.h" +#include "privates.h" #include "gcstruct.h" +#include "cursorstr.h" #include "colormapst.h" -#include "servermd.h" -#include "site.h" #include "inputstr.h" -#include "extnsionst.h" -/* - * See the Wrappers and devPrivates section in "Definition of the - * Porting Layer for the X v11 Sample Server" (doc/Server/ddx.tbl.ms) - * for information on how to use devPrivates. - */ - -/* - * extension private machinery - */ - -static int extensionPrivateCount; -int extensionPrivateLen; -unsigned *extensionPrivateSizes; -unsigned totalExtensionSize; - -void -ResetExtensionPrivates() +struct _Private { + DevPrivateKey key; + pointer value; + struct _Private *next; +}; + +typedef struct _PrivateDesc { + DevPrivateKey key; + unsigned size; + CallbackListPtr initfuncs; + CallbackListPtr deletefuncs; + struct _PrivateDesc *next; +} PrivateDescRec; + +/* list of all allocated privates */ +static PrivateDescRec *items = NULL; + +static _X_INLINE PrivateDescRec * +findItem(const DevPrivateKey key) { - extensionPrivateCount = 0; - extensionPrivateLen = 0; - xfree(extensionPrivateSizes); - extensionPrivateSizes = (unsigned *)NULL; - totalExtensionSize = - ((sizeof(ExtensionEntry) + sizeof(long) - 1) / sizeof(long)) * sizeof(long); + PrivateDescRec *item = items; + while (item) { + if (item->key == key) + return item; + item = item->next; + } + return NULL; } +/* + * Request pre-allocated space. + */ _X_EXPORT int -AllocateExtensionPrivateIndex() -{ - return extensionPrivateCount++; -} - -_X_EXPORT Bool -AllocateExtensionPrivate(int index2, unsigned amount) +dixRequestPrivate(const DevPrivateKey key, unsigned size) { - unsigned oldamount; - - /* Round up sizes for proper alignment */ - amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long); - - if (index2 >= extensionPrivateLen) - { - unsigned *nsizes; - nsizes = (unsigned *)xrealloc(extensionPrivateSizes, - (index2 + 1) * sizeof(unsigned)); - if (!nsizes) + PrivateDescRec *item = findItem(key); + if (item) { + if (size > item->size) + item->size = size; + } else { + item = (PrivateDescRec *)xalloc(sizeof(PrivateDescRec)); + if (!item) return FALSE; - while (extensionPrivateLen <= index2) - { - nsizes[extensionPrivateLen++] = 0; - totalExtensionSize += sizeof(DevUnion); - } - extensionPrivateSizes = nsizes; - } - oldamount = extensionPrivateSizes[index2]; - if (amount > oldamount) - { - extensionPrivateSizes[index2] = amount; - totalExtensionSize += (amount - oldamount); + memset(item, 0, sizeof(PrivateDescRec)); + + /* add privates descriptor */ + item->key = key; + item->size = size; + item->next = items; + items = item; } return TRUE; } /* - * client private machinery + * Allocate a private and attach it to an existing object. */ - -static int clientPrivateCount; -int clientPrivateLen; -unsigned *clientPrivateSizes; -unsigned totalClientSize; - -void -ResetClientPrivates() -{ - clientPrivateCount = 0; - clientPrivateLen = 0; - xfree(clientPrivateSizes); - clientPrivateSizes = (unsigned *)NULL; - totalClientSize = - ((sizeof(ClientRec) + sizeof(long) - 1) / sizeof(long)) * sizeof(long); -} - -_X_EXPORT int -AllocateClientPrivateIndex() +_X_EXPORT pointer * +dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key) { - return clientPrivateCount++; + PrivateDescRec *item = findItem(key); + PrivateRec *ptr; + unsigned size = sizeof(PrivateRec); + + if (item) + size += item->size; + + ptr = (PrivateRec *)xcalloc(size, 1); + if (!ptr) + return NULL; + ptr->key = key; + ptr->value = (size > sizeof(PrivateRec)) ? (ptr + 1) : NULL; + ptr->next = *privates; + *privates = ptr; + + /* call any init funcs and return */ + if (item) { + PrivateCallbackRec calldata = { key, &ptr->value }; + CallCallbacks(&item->initfuncs, &calldata); + } + return &ptr->value; } -_X_EXPORT Bool -AllocateClientPrivate(int index2, unsigned amount) +/* + * Look up a private pointer. + */ +_X_EXPORT pointer +dixLookupPrivate(PrivateRec **privates, const DevPrivateKey key) { - unsigned oldamount; + PrivateRec *rec = *privates; + pointer *ptr; - /* Round up sizes for proper alignment */ - amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long); - - if (index2 >= clientPrivateLen) - { - unsigned *nsizes; - nsizes = (unsigned *)xrealloc(clientPrivateSizes, - (index2 + 1) * sizeof(unsigned)); - if (!nsizes) - return FALSE; - while (clientPrivateLen <= index2) - { - nsizes[clientPrivateLen++] = 0; - totalClientSize += sizeof(DevUnion); - } - clientPrivateSizes = nsizes; - } - oldamount = clientPrivateSizes[index2]; - if (amount > oldamount) - { - clientPrivateSizes[index2] = amount; - totalClientSize += (amount - oldamount); + while (rec) { + if (rec->key == key) + return rec->value; + rec = rec->next; } - return TRUE; + + ptr = dixAllocatePrivate(privates, key); + return ptr ? *ptr : NULL; } /* - * screen private machinery + * Look up the address of a private pointer. */ +_X_EXPORT pointer * +dixLookupPrivateAddr(PrivateRec **privates, const DevPrivateKey key) +{ + PrivateRec *rec = *privates; -int screenPrivateCount; + while (rec) { + if (rec->key == key) + return &rec->value; + rec = rec->next; + } -void -ResetScreenPrivates() -{ - screenPrivateCount = 0; + return dixAllocatePrivate(privates, key); } -/* this can be called after some screens have been created, - * so we have to worry about resizing existing devPrivates +/* + * Set a private pointer. */ _X_EXPORT int -AllocateScreenPrivateIndex() +dixSetPrivate(PrivateRec **privates, const DevPrivateKey key, pointer val) { - int idx; - int i; - ScreenPtr pScreen; - DevUnion *nprivs; - - idx = screenPrivateCount++; - for (i = 0; i < screenInfo.numScreens; i++) - { - pScreen = screenInfo.screens[i]; - nprivs = (DevUnion *)xrealloc(pScreen->devPrivates, - screenPrivateCount * sizeof(DevUnion)); - if (!nprivs) - { - screenPrivateCount--; - return -1; + PrivateRec *rec; + + top: + rec = *privates; + while (rec) { + if (rec->key == key) { + rec->value = val; + return TRUE; } - /* Zero the new private */ - bzero(&nprivs[idx], sizeof(DevUnion)); - pScreen->devPrivates = nprivs; + rec = rec->next; } - return idx; -} + if (!dixAllocatePrivate(privates, key)) + return FALSE; + goto top; +} /* - * window private machinery + * Called to free privates at object deletion time. */ - -static int windowPrivateCount; - -void -ResetWindowPrivates() -{ - windowPrivateCount = 0; -} - -_X_EXPORT int -AllocateWindowPrivateIndex() -{ - return windowPrivateCount++; -} - -_X_EXPORT Bool -AllocateWindowPrivate(register ScreenPtr pScreen, int index2, unsigned amount) +_X_EXPORT void +dixFreePrivates(PrivateRec *privates) { - unsigned oldamount; - - /* Round up sizes for proper alignment */ - amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long); - - if (index2 >= pScreen->WindowPrivateLen) - { - unsigned *nsizes; - nsizes = (unsigned *)xrealloc(pScreen->WindowPrivateSizes, - (index2 + 1) * sizeof(unsigned)); - if (!nsizes) - return FALSE; - while (pScreen->WindowPrivateLen <= index2) - { - nsizes[pScreen->WindowPrivateLen++] = 0; - pScreen->totalWindowSize += sizeof(DevUnion); + PrivateRec *ptr, *next; + PrivateDescRec *item; + PrivateCallbackRec calldata; + + /* first pass calls the delete callbacks */ + for (ptr = privates; ptr; ptr = ptr->next) { + item = findItem(ptr->key); + if (item) { + calldata.key = ptr->key; + calldata.value = &ptr->value; + CallCallbacks(&item->deletefuncs, &calldata); } - pScreen->WindowPrivateSizes = nsizes; } - oldamount = pScreen->WindowPrivateSizes[index2]; - if (amount > oldamount) - { - pScreen->WindowPrivateSizes[index2] = amount; - pScreen->totalWindowSize += (amount - oldamount); + + /* second pass frees the memory */ + ptr = privates; + while (ptr) { + next = ptr->next; + xfree(ptr); + ptr = next; } - return TRUE; } - /* - * gc private machinery + * Callback registration */ - -static int gcPrivateCount; - -void -ResetGCPrivates() -{ - gcPrivateCount = 0; -} - _X_EXPORT int -AllocateGCPrivateIndex() -{ - return gcPrivateCount++; -} - -_X_EXPORT Bool -AllocateGCPrivate(register ScreenPtr pScreen, int index2, unsigned amount) +dixRegisterPrivateInitFunc(const DevPrivateKey key, + CallbackProcPtr callback, pointer data) { - unsigned oldamount; - - /* Round up sizes for proper alignment */ - amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long); - - if (index2 >= pScreen->GCPrivateLen) - { - unsigned *nsizes; - nsizes = (unsigned *)xrealloc(pScreen->GCPrivateSizes, - (index2 + 1) * sizeof(unsigned)); - if (!nsizes) + PrivateDescRec *item = findItem(key); + if (!item) { + if (!dixRequestPrivate(key, 0)) return FALSE; - while (pScreen->GCPrivateLen <= index2) - { - nsizes[pScreen->GCPrivateLen++] = 0; - pScreen->totalGCSize += sizeof(DevUnion); - } - pScreen->GCPrivateSizes = nsizes; - } - oldamount = pScreen->GCPrivateSizes[index2]; - if (amount > oldamount) - { - pScreen->GCPrivateSizes[index2] = amount; - pScreen->totalGCSize += (amount - oldamount); + item = findItem(key); } - return TRUE; -} - - -/* - * pixmap private machinery - */ -#ifdef PIXPRIV -static int pixmapPrivateCount; - -void -ResetPixmapPrivates() -{ - pixmapPrivateCount = 0; + return AddCallback(&item->initfuncs, callback, data); } _X_EXPORT int -AllocatePixmapPrivateIndex() -{ - return pixmapPrivateCount++; -} - -_X_EXPORT Bool -AllocatePixmapPrivate(register ScreenPtr pScreen, int index2, unsigned amount) +dixRegisterPrivateDeleteFunc(const DevPrivateKey key, + CallbackProcPtr callback, pointer data) { - unsigned oldamount; - - /* Round up sizes for proper alignment */ - amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long); - - if (index2 >= pScreen->PixmapPrivateLen) - { - unsigned *nsizes; - nsizes = (unsigned *)xrealloc(pScreen->PixmapPrivateSizes, - (index2 + 1) * sizeof(unsigned)); - if (!nsizes) + PrivateDescRec *item = findItem(key); + if (!item) { + if (!dixRequestPrivate(key, 0)) return FALSE; - while (pScreen->PixmapPrivateLen <= index2) - { - nsizes[pScreen->PixmapPrivateLen++] = 0; - pScreen->totalPixmapSize += sizeof(DevUnion); - } - pScreen->PixmapPrivateSizes = nsizes; + item = findItem(key); } - oldamount = pScreen->PixmapPrivateSizes[index2]; - if (amount > oldamount) - { - pScreen->PixmapPrivateSizes[index2] = amount; - pScreen->totalPixmapSize += (amount - oldamount); - } - pScreen->totalPixmapSize = BitmapBytePad(pScreen->totalPixmapSize * 8); - return TRUE; + return AddCallback(&item->deletefuncs, callback, data); } -#endif +/* Table of devPrivates offsets */ +static const int offsetDefaults[] = { + -1, /* RT_NONE */ + offsetof(WindowRec, devPrivates), /* RT_WINDOW */ + offsetof(PixmapRec, devPrivates), /* RT_PIXMAP */ + offsetof(GC, devPrivates), /* RT_GC */ + -1, /* RT_FONT */ + offsetof(CursorRec, devPrivates), /* RT_CURSOR */ + offsetof(ColormapRec, devPrivates), /* RT_COLORMAP */ + -1, /* RT_CMAPENTRY */ + -1, /* RT_OTHERCLIENT */ + -1 /* RT_PASSIVEGRAB */ +}; + +static int *offsets = NULL; +static int offsetsSize = 0; /* - * colormap private machinery + * Specify where the devPrivates field is located in a structure type */ - -int colormapPrivateCount; - -void -ResetColormapPrivates() -{ - colormapPrivateCount = 0; -} - - _X_EXPORT int -AllocateColormapPrivateIndex (InitCmapPrivFunc initPrivFunc) +dixRegisterPrivateOffset(RESTYPE type, int offset) { - int index; - int i; - ColormapPtr pColormap; - DevUnion *privs; - - index = colormapPrivateCount++; - - for (i = 0; i < screenInfo.numScreens; i++) - { - /* - * AllocateColormapPrivateIndex may be called after the - * default colormap has been created on each screen! - * - * We must resize the devPrivates array for the default - * colormap on each screen, making room for this new private. - * We also call the initialization function 'initPrivFunc' on - * the new private allocated for each default colormap. - */ - - ScreenPtr pScreen = screenInfo.screens[i]; - - pColormap = (ColormapPtr) LookupIDByType ( - pScreen->defColormap, RT_COLORMAP); - - if (pColormap) - { - privs = (DevUnion *) xrealloc (pColormap->devPrivates, - colormapPrivateCount * sizeof(DevUnion)); - if (!privs) { - colormapPrivateCount--; - return -1; - } - bzero(&privs[index], sizeof(DevUnion)); - pColormap->devPrivates = privs; - if (!(*initPrivFunc)(pColormap,index)) - { - colormapPrivateCount--; - return -1; - } + type = type & TypeMask; + + /* resize offsets table if necessary */ + while (type >= offsetsSize) { + unsigned i = offsetsSize * 2 * sizeof(int); + offsets = (int *)xrealloc(offsets, i); + if (!offsets) { + offsetsSize = 0; + return FALSE; } + for (i=offsetsSize; i < 2*offsetsSize; i++) + offsets[i] = -1; + offsetsSize *= 2; } - return index; + offsets[type] = offset; + return TRUE; } -/* - * device private machinery - */ - -static int devicePrivateIndex = 0; - _X_EXPORT int -AllocateDevicePrivateIndex() +dixLookupPrivateOffset(RESTYPE type) { - return devicePrivateIndex++; + type = type & TypeMask; + assert(type < offsetsSize); + return offsets[type]; } -_X_EXPORT Bool -AllocateDevicePrivate(DeviceIntPtr device, int index) +int +dixResetPrivates(void) { - if (device->nPrivates < ++index) { - DevUnion *nprivs = (DevUnion *) xrealloc(device->devPrivates, - index * sizeof(DevUnion)); - if (!nprivs) - return FALSE; - device->devPrivates = nprivs; - bzero(&nprivs[device->nPrivates], sizeof(DevUnion) - * (index - device->nPrivates)); - device->nPrivates = index; - return TRUE; - } else { - return TRUE; + PrivateDescRec *next; + + /* reset internal structures */ + while (items) { + next = items->next; + DeleteCallbackList(&items->initfuncs); + DeleteCallbackList(&items->deletefuncs); + xfree(items); + items = next; } -} - -void -ResetDevicePrivateIndex(void) -{ - devicePrivateIndex = 0; + if (offsets) + xfree(offsets); + offsetsSize = sizeof(offsetDefaults); + offsets = (int *)xalloc(offsetsSize); + offsetsSize /= sizeof(int); + if (!offsets) + return FALSE; + memcpy(offsets, offsetDefaults, sizeof(offsetDefaults)); + return TRUE; } diff --git a/xserver/dix/property.c b/xserver/dix/property.c index da983838f..8b66ad6a2 100644 --- a/xserver/dix/property.c +++ b/xserver/dix/property.c @@ -58,18 +58,15 @@ SOFTWARE. #include "dixstruct.h" #include "dispatch.h" #include "swaprep.h" -#ifdef XACE #include "xace.h" -#endif /***************************************************************** * Property Stuff * - * ChangeProperty, DeleteProperty, GetProperties, - * ListProperties + * dixLookupProperty, dixChangeProperty, DeleteProperty * - * Properties below to windows. A allocate slots each time - * a property is added. No fancy searching done. + * Properties belong to windows. The list of properties should not be + * traversed directly. Instead, use the three functions listed above. * *****************************************************************/ @@ -78,7 +75,7 @@ static void PrintPropertys(WindowPtr pWin) { PropertyPtr pProp; - register int j; + int j; pProp = pWin->userProps; while (pProp) @@ -93,96 +90,108 @@ PrintPropertys(WindowPtr pWin) } #endif +_X_EXPORT int +dixLookupProperty(PropertyPtr *result, WindowPtr pWin, Atom propertyName, + ClientPtr client, Mask access_mode) +{ + PropertyPtr pProp; + int rc = BadMatch; + client->errorValue = propertyName; + + for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) + if (pProp->propertyName == propertyName) + break; + + if (pProp) + rc = XaceHookPropertyAccess(client, pWin, &pProp, access_mode); + *result = pProp; + return rc; +} + +static void +deliverPropertyNotifyEvent(WindowPtr pWin, int state, Atom atom) +{ + xEvent event; + + event.u.u.type = PropertyNotify; + event.u.property.window = pWin->drawable.id; + event.u.property.state = state; + event.u.property.atom = atom; + event.u.property.time = currentTime.milliseconds; + DeliverEvents(pWin, &event, 1, (WindowPtr)NULL); +} + int ProcRotateProperties(ClientPtr client) { - int i, j, delta; + int i, j, delta, rc; REQUEST(xRotatePropertiesReq); WindowPtr pWin; - register Atom * atoms; + Atom * atoms; PropertyPtr * props; /* array of pointer */ - PropertyPtr pProp; - xEvent event; + PropertyPtr pProp, saved; REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2); UpdateCurrentTime(); - pWin = (WindowPtr) SecurityLookupWindow(stuff->window, client, - SecurityWriteAccess); - if (!pWin) - return(BadWindow); - if (!stuff->nAtoms) - return(Success); + rc = dixLookupWindow(&pWin, stuff->window, client, DixSetPropAccess); + if (rc != Success || stuff->nAtoms <= 0) + return rc; + atoms = (Atom *) & stuff[1]; - props = (PropertyPtr *)ALLOCATE_LOCAL(stuff->nAtoms * sizeof(PropertyPtr)); - if (!props) - return(BadAlloc); + props = (PropertyPtr *)xalloc(stuff->nAtoms * sizeof(PropertyPtr)); + saved = (PropertyPtr)xalloc(stuff->nAtoms * sizeof(PropertyRec)); + if (!props || !saved) { + rc = BadAlloc; + goto out; + } + for (i = 0; i < stuff->nAtoms; i++) { -#ifdef XACE - char action = XaceHook(XACE_PROPERTY_ACCESS, client, pWin, atoms[i], - SecurityReadAccess|SecurityWriteAccess); -#endif - if (!ValidAtom(atoms[i]) -#ifdef XACE - || (SecurityErrorOperation == action) -#endif - ) - { - DEALLOCATE_LOCAL(props); + if (!ValidAtom(atoms[i])) { + rc = BadAtom; client->errorValue = atoms[i]; - return BadAtom; + goto out; } -#ifdef XACE - if (SecurityIgnoreOperation == action) - { - DEALLOCATE_LOCAL(props); - return Success; - } -#endif for (j = i + 1; j < stuff->nAtoms; j++) if (atoms[j] == atoms[i]) { - DEALLOCATE_LOCAL(props); - return BadMatch; + rc = BadMatch; + goto out; } - pProp = wUserProps (pWin); - while (pProp) - { - if (pProp->propertyName == atoms[i]) - goto found; - pProp = pProp->next; - } - DEALLOCATE_LOCAL(props); - return BadMatch; -found: + + rc = dixLookupProperty(&pProp, pWin, atoms[i], client, + DixReadAccess|DixWriteAccess); + if (rc != Success) + goto out; + props[i] = pProp; + saved[i] = *pProp; } delta = stuff->nPositions; /* If the rotation is a complete 360 degrees, then moving the properties around and generating PropertyNotify events should be skipped. */ - if ( (stuff->nAtoms != 0) && (abs(delta) % stuff->nAtoms) != 0 ) + if (abs(delta) % stuff->nAtoms) { while (delta < 0) /* faster if abs value is small */ delta += stuff->nAtoms; for (i = 0; i < stuff->nAtoms; i++) { - /* Generate a PropertyNotify event for each property whose value - is changed in the order in which they appear in the request. */ - - event.u.u.type = PropertyNotify; - event.u.property.window = pWin->drawable.id; - event.u.property.state = PropertyNewValue; - event.u.property.atom = props[i]->propertyName; - event.u.property.time = currentTime.milliseconds; - DeliverEvents(pWin, &event, 1, (WindowPtr)NULL); - - props[i]->propertyName = atoms[(i + delta) % stuff->nAtoms]; + j = (i + delta) % stuff->nAtoms; + deliverPropertyNotifyEvent(pWin, PropertyNewValue, atoms[i]); + + /* Preserve name and devPrivates */ + props[j]->type = saved[i].type; + props[j]->format = saved[i].format; + props[j]->size = saved[i].size; + props[j]->data = saved[i].data; } } - DEALLOCATE_LOCAL(props); - return Success; +out: + xfree(saved); + xfree(props); + return rc; } int @@ -191,9 +200,7 @@ ProcChangeProperty(ClientPtr client) WindowPtr pWin; char format, mode; unsigned long len; - int sizeInBytes; - int totalSize; - int err; + int sizeInBytes, totalSize, err; REQUEST(xChangePropertyReq); REQUEST_AT_LEAST_SIZE(xChangePropertyReq); @@ -218,10 +225,9 @@ ProcChangeProperty(ClientPtr client) totalSize = len * sizeInBytes; REQUEST_FIXED_SIZE(xChangePropertyReq, totalSize); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityWriteAccess); - if (!pWin) - return(BadWindow); + err = dixLookupWindow(&pWin, stuff->window, client, DixSetPropAccess); + if (err != Success) + return err; if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; @@ -233,20 +239,9 @@ ProcChangeProperty(ClientPtr client) return(BadAtom); } -#ifdef XACE - switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property, - SecurityWriteAccess)) - { - case SecurityErrorOperation: - client->errorValue = stuff->property; - return BadAtom; - case SecurityIgnoreOperation: - return Success; - } -#endif - - err = ChangeWindowProperty(pWin, stuff->property, stuff->type, (int)format, - (int)mode, len, (pointer)&stuff[1], TRUE); + err = dixChangeWindowProperty(client, pWin, stuff->property, stuff->type, + (int)format, (int)mode, len, &stuff[1], + TRUE); if (err != Success) return err; else @@ -254,29 +249,23 @@ ProcChangeProperty(ClientPtr client) } _X_EXPORT int -ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, - int mode, unsigned long len, pointer value, - Bool sendevent) +dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, + Atom type, int format, int mode, unsigned long len, + pointer value, Bool sendevent) { PropertyPtr pProp; - xEvent event; - int sizeInBytes; - int totalSize; + int sizeInBytes, totalSize, rc; pointer data; + Mask access_mode; sizeInBytes = format>>3; totalSize = len * sizeInBytes; + access_mode = (mode == PropModeReplace) ? DixWriteAccess : DixBlendAccess; /* first see if property already exists */ + rc = dixLookupProperty(&pProp, pWin, property, pClient, access_mode); - pProp = wUserProps (pWin); - while (pProp) - { - if (pProp->propertyName == property) - break; - pProp = pProp->next; - } - if (!pProp) /* just add to list */ + if (rc == BadMatch) /* just add to list */ { if (!pWin->optional && !MakeWindowOptional (pWin)) return(BadAlloc); @@ -296,10 +285,19 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, if (len) memmove((char *)data, (char *)value, totalSize); pProp->size = len; + pProp->devPrivates = NULL; + rc = XaceHookPropertyAccess(pClient, pWin, &pProp, + DixCreateAccess|DixWriteAccess); + if (rc != Success) { + xfree(data); + xfree(pProp); + pClient->errorValue = property; + return rc; + } pProp->next = pWin->optional->userProps; pWin->optional->userProps = pProp; } - else + else if (rc == Success) { /* To append or prepend to a property the request format and type must match those of the already defined property. The @@ -354,73 +352,66 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, pProp->size += len; } } + else + return rc; + if (sendevent) - { - event.u.u.type = PropertyNotify; - event.u.property.window = pWin->drawable.id; - event.u.property.state = PropertyNewValue; - event.u.property.atom = pProp->propertyName; - event.u.property.time = currentTime.milliseconds; - DeliverEvents(pWin, &event, 1, (WindowPtr)NULL); - } + deliverPropertyNotifyEvent(pWin, PropertyNewValue, pProp->propertyName); + return(Success); } +_X_EXPORT int +ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, + int mode, unsigned long len, pointer value, + Bool sendevent) +{ + return dixChangeWindowProperty(serverClient, pWin, property, type, format, + mode, len, value, sendevent); +} + int -DeleteProperty(WindowPtr pWin, Atom propName) +DeleteProperty(ClientPtr client, WindowPtr pWin, Atom propName) { PropertyPtr pProp, prevProp; - xEvent event; + int rc; - if (!(pProp = wUserProps (pWin))) - return(Success); - prevProp = (PropertyPtr)NULL; - while (pProp) - { - if (pProp->propertyName == propName) - break; - prevProp = pProp; - pProp = pProp->next; - } - if (pProp) - { - if (prevProp == (PropertyPtr)NULL) /* takes care of head */ - { + rc = dixLookupProperty(&pProp, pWin, propName, client, DixDestroyAccess); + if (rc == BadMatch) + return Success; /* Succeed if property does not exist */ + + if (rc == Success) { + if (pWin->optional->userProps == pProp) { + /* Takes care of head */ if (!(pWin->optional->userProps = pProp->next)) CheckWindowOptionalNeed (pWin); - } - else - { - prevProp->next = pProp->next; - } - event.u.u.type = PropertyNotify; - event.u.property.window = pWin->drawable.id; - event.u.property.state = PropertyDelete; - event.u.property.atom = pProp->propertyName; - event.u.property.time = currentTime.milliseconds; - DeliverEvents(pWin, &event, 1, (WindowPtr)NULL); + } else { + /* Need to traverse to find the previous element */ + prevProp = pWin->optional->userProps; + while (prevProp->next != pProp) + prevProp = prevProp->next; + prevProp->next = pProp->next; + } + + deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName); + dixFreePrivates(pProp->devPrivates); xfree(pProp->data); xfree(pProp); } - return(Success); + return rc; } void DeleteAllWindowProperties(WindowPtr pWin) { PropertyPtr pProp, pNextProp; - xEvent event; pProp = wUserProps (pWin); while (pProp) { - event.u.u.type = PropertyNotify; - event.u.property.window = pWin->drawable.id; - event.u.property.state = PropertyDelete; - event.u.property.atom = pProp->propertyName; - event.u.property.time = currentTime.milliseconds; - DeliverEvents(pWin, &event, 1, (WindowPtr)NULL); + deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName); pNextProp = pProp->next; + dixFreePrivates(pProp->devPrivates); xfree(pProp->data); xfree(pProp); pProp = pNextProp; @@ -458,17 +449,21 @@ ProcGetProperty(ClientPtr client) { PropertyPtr pProp, prevProp; unsigned long n, len, ind; + int rc; WindowPtr pWin; xGetPropertyReply reply; + Mask win_mode = DixGetPropAccess, prop_mode = DixReadAccess; REQUEST(xGetPropertyReq); REQUEST_SIZE_MATCH(xGetPropertyReq); - if (stuff->delete) + if (stuff->delete) { UpdateCurrentTime(); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityReadAccess); - if (!pWin) - return BadWindow; + win_mode |= DixSetPropAccess; + prop_mode |= DixDestroyAccess; + } + rc = dixLookupWindow(&pWin, stuff->window, client, win_mode); + if (rc != Success) + return rc; if (!ValidAtom(stuff->property)) { @@ -486,39 +481,15 @@ ProcGetProperty(ClientPtr client) return(BadAtom); } - pProp = wUserProps (pWin); - prevProp = (PropertyPtr)NULL; - while (pProp) - { - if (pProp->propertyName == stuff->property) - break; - prevProp = pProp; - pProp = pProp->next; - } - reply.type = X_Reply; reply.sequenceNumber = client->sequence; - if (!pProp) - return NullPropertyReply(client, None, 0, &reply); -#ifdef XACE - { - Mask access_mode = SecurityReadAccess; + rc = dixLookupProperty(&pProp, pWin, stuff->property, client, prop_mode); + if (rc == BadMatch) + return NullPropertyReply(client, None, 0, &reply); + else if (rc != Success) + return rc; - if (stuff->delete) - access_mode |= SecurityDestroyAccess; - switch(XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property, - access_mode)) - { - case SecurityErrorOperation: - client->errorValue = stuff->property; - return BadAtom;; - case SecurityIgnoreOperation: - return NullPropertyReply(client, pProp->type, pProp->format, - &reply); - } - } -#endif /* If the request type and actual type don't match. Return the property information, but not the data. */ @@ -559,16 +530,7 @@ ProcGetProperty(ClientPtr client) reply.propertyType = pProp->type; if (stuff->delete && (reply.bytesAfter == 0)) - { /* send the event */ - xEvent event; - - event.u.u.type = PropertyNotify; - event.u.property.window = pWin->drawable.id; - event.u.property.state = PropertyDelete; - event.u.property.atom = pProp->propertyName; - event.u.property.time = currentTime.milliseconds; - DeliverEvents(pWin, &event, 1, (WindowPtr)NULL); - } + deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName); WriteReplyToClient(client, sizeof(xGenericReply), &reply); if (len) @@ -582,15 +544,21 @@ ProcGetProperty(ClientPtr client) (char *)pProp->data + ind); } - if (stuff->delete && (reply.bytesAfter == 0)) - { /* delete the Property */ - if (prevProp == (PropertyPtr)NULL) /* takes care of head */ - { - if (!(pWin->optional->userProps = pProp->next)) + if (stuff->delete && (reply.bytesAfter == 0)) { + /* Delete the Property */ + if (pWin->optional->userProps == pProp) { + /* Takes care of head */ + if (!(pWin->optional->userProps = pProp->next)) CheckWindowOptionalNeed (pWin); - } - else + } else { + /* Need to traverse to find the previous element */ + prevProp = pWin->optional->userProps; + while (prevProp->next != pProp) + prevProp = prevProp->next; prevProp->next = pProp->next; + } + + dixFreePrivates(pProp->devPrivates); xfree(pProp->data); xfree(pProp); } @@ -602,50 +570,49 @@ ProcListProperties(ClientPtr client) { Atom *pAtoms = NULL, *temppAtoms; xListPropertiesReply xlpr; - int numProps = 0; + int rc, numProps = 0; WindowPtr pWin; - PropertyPtr pProp; + PropertyPtr pProp, realProp; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - SecurityReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixListPropAccess); + if (rc != Success) + return rc; - pProp = wUserProps (pWin); - while (pProp) - { - pProp = pProp->next; + for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) numProps++; + + if (numProps && !(pAtoms = (Atom *)xalloc(numProps * sizeof(Atom)))) + return BadAlloc; + + numProps = 0; + temppAtoms = pAtoms; + for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) { + realProp = pProp; + rc = XaceHookPropertyAccess(client, pWin, &realProp, DixGetAttrAccess); + if (rc == Success && realProp == pProp) { + *temppAtoms++ = pProp->propertyName; + numProps++; + } } - if (numProps) - if(!(pAtoms = (Atom *)ALLOCATE_LOCAL(numProps * sizeof(Atom)))) - return(BadAlloc); xlpr.type = X_Reply; xlpr.nProperties = numProps; xlpr.length = (numProps * sizeof(Atom)) >> 2; xlpr.sequenceNumber = client->sequence; - pProp = wUserProps (pWin); - temppAtoms = pAtoms; - while (pProp) - { - *temppAtoms++ = pProp->propertyName; - pProp = pProp->next; - } WriteReplyToClient(client, sizeof(xGenericReply), &xlpr); if (numProps) { client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write; WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms); - DEALLOCATE_LOCAL(pAtoms); } + xfree(pAtoms); return(client->noClientException); } int -ProcDeleteProperty(register ClientPtr client) +ProcDeleteProperty(ClientPtr client) { WindowPtr pWin; REQUEST(xDeletePropertyReq); @@ -653,29 +620,16 @@ ProcDeleteProperty(register ClientPtr client) REQUEST_SIZE_MATCH(xDeletePropertyReq); UpdateCurrentTime(); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityWriteAccess); - if (!pWin) - return(BadWindow); + result = dixLookupWindow(&pWin, stuff->window, client, DixSetPropAccess); + if (result != Success) + return result; if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return (BadAtom); } -#ifdef XACE - switch(XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property, - SecurityDestroyAccess)) - { - case SecurityErrorOperation: - client->errorValue = stuff->property; - return BadAtom;; - case SecurityIgnoreOperation: - return Success; - } -#endif - - result = DeleteProperty(pWin, stuff->property); + result = DeleteProperty(client, pWin, stuff->property); if (client->noClientException != Success) return(client->noClientException); else diff --git a/xserver/dix/protocol.txt b/xserver/dix/protocol.txt new file mode 100644 index 000000000..0a85ca872 --- /dev/null +++ b/xserver/dix/protocol.txt @@ -0,0 +1,1066 @@ +# Registry of protocol names used by X Server +# This will eventually be replaced by server-side XCB +# +# Format is Xnnn <extension-name>:<object-name> +# R=Request, V=Event, E=Error +# +# This is a security-sensitive file, please set permissions as appropriate. +# +R001 Adobe-DPS-Extension:Init +R002 Adobe-DPS-Extension:CreateContext +R003 Adobe-DPS-Extension:CreateSpace +R004 Adobe-DPS-Extension:GiveInput +R005 Adobe-DPS-Extension:GetStatus +R006 Adobe-DPS-Extension:DestroySpace +R007 Adobe-DPS-Extension:Reset +R008 Adobe-DPS-Extension:NotifyContext +R009 Adobe-DPS-Extension:CreateContextFromID +R010 Adobe-DPS-Extension:XIDFromContext +R011 Adobe-DPS-Extension:ContextFromXID +R012 Adobe-DPS-Extension:SetStatusMask +R013 Adobe-DPS-Extension:CreateSecureContext +R014 Adobe-DPS-Extension:NotifyWhenReady +R000 Apple-DRI:QueryVersion +R001 Apple-DRI:QueryDirectRenderingCapable +R002 Apple-DRI:CreateSurface +R003 Apple-DRI:DestroySurface +R004 Apple-DRI:AuthConnection +V000 Apple-DRI:ObsoleteEvent1 +V001 Apple-DRI:ObsoleteEvent2 +V002 Apple-DRI:ObsoleteEvent3 +V003 Apple-DRI:SurfaceNotify +E000 Apple-DRI:ClientNotLocal +E001 Apple-DRI:OperationNotSupported +R000 Apple-WM:QueryVersion +R001 Apple-WM:FrameGetRect +R002 Apple-WM:FrameHitTest +R003 Apple-WM:FrameDraw +R004 Apple-WM:DisableUpdate +R005 Apple-WM:ReenableUpdate +R006 Apple-WM:SelectInput +R007 Apple-WM:SetWindowMenuCheck +R008 Apple-WM:SetFrontProcess +R009 Apple-WM:SetWindowLevel +R010 Apple-WM:SetCanQuit +R011 Apple-WM:SetWindowMenu +V000 Apple-WM:ControllerNotify +V001 Apple-WM:ActivationNotify +V002 Apple-WM:PasteboardNotify +E000 Apple-WM:ClientNotLocal +E001 Apple-WM:OperationNotSupported +R000 BIG-REQUESTS:Enable +R000 Composite:CompositeQueryVersion +R001 Composite:CompositeRedirectWindow +R002 Composite:CompositeRedirectSubwindows +R003 Composite:CompositeUnredirectWindow +R004 Composite:CompositeUnredirectSubwindows +R005 Composite:CompositeCreateRegionFromBorderClip +R006 Composite:CompositeNameWindowPixmap +R007 Composite:CompositeGetOverlayWindow +R008 Composite:CompositeReleaseOverlayWindow +R000 DAMAGE:QueryVersion +R001 DAMAGE:Create +R002 DAMAGE:Destroy +R003 DAMAGE:Subtract +R004 DAMAGE:Add +V000 DAMAGE:Notify +E000 DAMAGE:BadDamage +R000 DEC-XTRAP:Reset +R001 DEC-XTRAP:GetAvailable +R002 DEC-XTRAP:Config +R003 DEC-XTRAP:StartTrap +R004 DEC-XTRAP:StopTrap +R005 DEC-XTRAP:GetCurrent +R006 DEC-XTRAP:GetStatistics +R007 DEC-XTRAP:SimulateXEvent +R008 DEC-XTRAP:GetVersion +R009 DEC-XTRAP:GetLastInpTime +V000 DEC-XTRAP:Event +E002 DEC-XTRAP:BadIO +E004 DEC-XTRAP:BadStatistics +E005 DEC-XTRAP:BadDevices +E007 DEC-XTRAP:BadScreen +E008 DEC-XTRAP:BadSwapReq +R000 DMX:DMXQueryVersion +R001 DMX:DMXGetScreenCount +R002 DMX:DMXGetScreenInfoDEPRECATED +R003 DMX:DMXGetWindowAttributes +R004 DMX:DMXGetInputCount +R005 DMX:DMXGetInputAttributes +R006 DMX:DMXForceWindowCreationDEPRECATED +R007 DMX:DMXReconfigureScreenDEPRECATED +R008 DMX:DMXSync +R009 DMX:DMXForceWindowCreation +R010 DMX:DMXGetScreenAttributes +R011 DMX:DMXChangeScreensAttributes +R012 DMX:DMXAddScreen +R013 DMX:DMXRemoveScreen +R014 DMX:DMXGetDesktopAttributes +R015 DMX:DMXChangeDesktopAttributes +R016 DMX:DMXAddInput +R017 DMX:DMXRemoveInput +R000 DOUBLE-BUFFER:GetVersion +R001 DOUBLE-BUFFER:AllocateBackBufferName +R002 DOUBLE-BUFFER:DeallocateBackBufferName +R003 DOUBLE-BUFFER:SwapBuffers +R004 DOUBLE-BUFFER:BeginIdiom +R005 DOUBLE-BUFFER:EndIdiom +R006 DOUBLE-BUFFER:GetVisualInfo +R007 DOUBLE-BUFFER:GetBackBufferAttributes +E000 DOUBLE-BUFFER:BadBuffer +R000 DPMS:GetVersion +R001 DPMS:Capable +R002 DPMS:GetTimeouts +R003 DPMS:SetTimeouts +R004 DPMS:Enable +R005 DPMS:Disable +R006 DPMS:ForceLevel +R007 DPMS:Info +R000 Extended-Visual-Information:QueryVersion +R001 Extended-Visual-Information:GetVisualInfo +R000 FontCache:QueryVersion +R001 FontCache:GetCacheSettings +R002 FontCache:ChangeCacheSettings +R003 FontCache:GetCacheStatistics +E000 FontCache:BadProtocol +E001 FontCache:CannotAllocMemory +R001 GLX: +R002 GLX:Large +R003 GLX:CreateContext +R004 GLX:DestroyContext +R005 GLX:MakeCurrent +R006 GLX:IsDirect +R007 GLX:QueryVersion +R008 GLX:WaitGL +R009 GLX:WaitX +R010 GLX:CopyContext +R011 GLX:SwapBuffers +R012 GLX:UseXFont +R013 GLX:CreateGLXPixmap +R014 GLX:GetVisualConfigs +R015 GLX:DestroyGLXPixmap +R016 GLX:VendorPrivate +R017 GLX:VendorPrivateWithReply +R018 GLX:QueryExtensionsString +R019 GLX:QueryServerString +R020 GLX:ClientInfo +R101 GLX:NewList +R102 GLX:EndList +R103 GLX:DeleteLists +R104 GLX:GenLists +R105 GLX:FeedbackBuffer +R106 GLX:SelectBuffer +R107 GLX:Mode +R108 GLX:Finish +R109 GLX:PixelStoref +R110 GLX:PixelStorei +R111 GLX:ReadPixels +R112 GLX:GetBooleanv +R113 GLX:GetClipPlane +R114 GLX:GetDoublev +R115 GLX:GetError +R116 GLX:GetFloatv +R117 GLX:GetIntegerv +R118 GLX:GetLightfv +R119 GLX:GetLightiv +R120 GLX:GetMapdv +R121 GLX:GetMapfv +R122 GLX:GetMapiv +R123 GLX:GetMaterialfv +R124 GLX:GetMaterialiv +R125 GLX:GetPixelfv +R126 GLX:GetPixelMapuiv +R127 GLX:GetPixelMapusv +R128 GLX:GetPolygonStipple +R129 GLX:GetString +R130 GLX:GetTexEnvfv +R131 GLX:GetTexEnviv +R132 GLX:GetTexGendv +R133 GLX:GetTexGenfv +R134 GLX:GetTexGeniv +R135 GLX:GetTexImage +R136 GLX:GetTexParameterfv +R137 GLX:GetTexParameteriv +R138 GLX:GetTexLevelParameterfv +R139 GLX:GetTexLevelParameteriv +R140 GLX:IsEnabled +R141 GLX:IsList +R142 GLX:Flush +E000 GLX:BadContext +E001 GLX:BadContextState +E002 GLX:BadDrawable +E003 GLX:BadPixmap +E004 GLX:BadContextTag +E005 GLX:BadCurrentWindow +E006 GLX:BadRenderRequest +E007 GLX:BadLargeRequest +E008 GLX:UnsupportedPrivateRequest +R000 LBX:QueryVersion +R001 LBX:StartProxy +R002 LBX:StopProxy +R003 LBX:Switch +R004 LBX:NewClient +R005 LBX:CloseClient +R006 LBX:ModifySequence +R007 LBX:AllowMotion +R008 LBX:IncrementPixel +R009 LBX:Delta +R010 LBX:GetModifierMapping +R011 LBX:QueryTag +R012 LBX:InvalidateTag +R013 LBX:PolyPoint +R014 LBX:PolyLine +R015 LBX:PolySegment +R016 LBX:PolyRectangle +R017 LBX:PolyArc +R018 LBX:FillPoly +R019 LBX:PolyFillRectangle +R020 LBX:PolyFillArc +R021 LBX:GetKeyboardMapping +R022 LBX:QueryFont +R023 LBX:ChangeProperty +R024 LBX:GetProperty +R025 LBX:TagData +R026 LBX:CopyArea +R027 LBX:CopyPlane +R028 LBX:PolyText8 +R029 LBX:PolyText16 +R030 LBX:ImageText8 +R031 LBX:ImageText16 +R032 LBX:QueryExtension +R033 LBX:PutImage +R034 LBX:GetImage +R035 LBX:BeginLargeRequest +R036 LBX:LargeRequestData +R037 LBX:EndLargeRequest +R038 LBX:InternAtoms +R039 LBX:GetWinAttrAndGeom +R040 LBX:GrabCmap +R041 LBX:ReleaseCmap +R042 LBX:AllocColor +R043 LBX:Sync +E000 LBX:BadLbxClient +R000 MIT-SCREEN-SAVER:QueryVersion +R001 MIT-SCREEN-SAVER:QueryInfo +R002 MIT-SCREEN-SAVER:SelectInput +R003 MIT-SCREEN-SAVER:SetAttributes +R004 MIT-SCREEN-SAVER:UnsetAttributes +R005 MIT-SCREEN-SAVER:Suspend +V000 MIT-SCREEN-SAVER:Notify +R000 MIT-SHM:QueryVersion +R001 MIT-SHM:Attach +R002 MIT-SHM:Detach +R003 MIT-SHM:PutImage +R004 MIT-SHM:GetImage +R005 MIT-SHM:CreatePixmap +V000 MIT-SHM:Completion +E000 MIT-SHM:BadShmSeg +R000 MIT-SUNDRY-NONSTANDARD:SetBugMode +R001 MIT-SUNDRY-NONSTANDARD:GetBugMode +R000 Multi-Buffering:GetBufferVersion +R001 Multi-Buffering:CreateImageBuffers +R002 Multi-Buffering:DestroyImageBuffers +R003 Multi-Buffering:DisplayImageBuffers +R004 Multi-Buffering:SetMBufferAttributes +R005 Multi-Buffering:GetMBufferAttributes +R006 Multi-Buffering:SetBufferAttributes +R007 Multi-Buffering:GetBufferAttributes +R008 Multi-Buffering:GetBufferInfo +R009 Multi-Buffering:CreateStereoWindow +R010 Multi-Buffering:ClearImageBufferArea +V000 Multi-Buffering:ClobberNotify +V001 Multi-Buffering:UpdateNotify +E000 Multi-Buffering:BadBuffer +R000 RANDR:QueryVersion +R001 RANDR:OldGetScreenInfo +R002 RANDR:SetScreenConfig +R003 RANDR:OldScreenChangeSelectInput +R004 RANDR:SelectInput +R005 RANDR:GetScreenInfo +R006 RANDR:GetScreenSizeRange +R007 RANDR:SetScreenSize +R008 RANDR:GetScreenResources +R009 RANDR:GetOutputInfo +R010 RANDR:ListOutputProperties +R011 RANDR:QueryOutputProperty +R012 RANDR:ConfigureOutputProperty +R013 RANDR:ChangeOutputProperty +R014 RANDR:DeleteOutputProperty +R015 RANDR:GetOutputProperty +R016 RANDR:CreateMode +R017 RANDR:DestroyMode +R018 RANDR:AddOutputMode +R019 RANDR:DeleteOutputMode +R020 RANDR:GetCrtcInfo +R021 RANDR:SetCrtcConfig +R022 RANDR:GetCrtcGammaSize +R023 RANDR:GetCrtcGamma +R024 RANDR:SetCrtcGamma +V000 RANDR:ScreenChangeNotify +V001 RANDR:Notify +E000 RANDR:BadRROutput +E001 RANDR:BadRRCrtc +E002 RANDR:BadRRMode +R000 RECORD:QueryVersion +R001 RECORD:CreateContext +R002 RECORD:RegisterClients +R003 RECORD:UnregisterClients +R004 RECORD:GetContext +R005 RECORD:EnableContext +R006 RECORD:DisableContext +R007 RECORD:FreeContext +E000 RECORD:BadContext +R000 RENDER:QueryVersion +R001 RENDER:QueryPictFormats +R002 RENDER:QueryPictIndexValues +R003 RENDER:QueryDithers +R004 RENDER:CreatePicture +R005 RENDER:ChangePicture +R006 RENDER:SetPictureClipRectangles +R007 RENDER:FreePicture +R008 RENDER:Composite +R009 RENDER:Scale +R010 RENDER:Trapezoids +R011 RENDER:Triangles +R012 RENDER:TriStrip +R013 RENDER:TriFan +R014 RENDER:ColorTrapezoids +R015 RENDER:ColorTriangles +R016 RENDER:Transform +R017 RENDER:CreateGlyphSet +R018 RENDER:ReferenceGlyphSet +R019 RENDER:FreeGlyphSet +R020 RENDER:AddGlyphs +R021 RENDER:AddGlyphsFromPicture +R022 RENDER:FreeGlyphs +R023 RENDER:CompositeGlyphs8 +R024 RENDER:CompositeGlyphs16 +R025 RENDER:CompositeGlyphs32 +R026 RENDER:FillRectangles +R027 RENDER:CreateCursor +R028 RENDER:SetPictureTransform +R029 RENDER:QueryFilters +R030 RENDER:SetPictureFilter +R031 RENDER:CreateAnimCursor +R032 RENDER:AddTraps +R033 RENDER:CreateSolidFill +R034 RENDER:CreateLinearGradient +R035 RENDER:CreateRadialGradient +R036 RENDER:CreateConicalGradient +E000 RENDER:BadPictFormat +E001 RENDER:BadPicture +E002 RENDER:BadPictOp +E003 RENDER:BadGlyphSet +E004 RENDER:BadGlyph +R000 SECURITY:QueryVersion +R001 SECURITY:GenerateAuthorization +R002 SECURITY:RevokeAuthorization +V000 SECURITY:AuthorizationRevoked +E000 SECURITY:BadAuthorization +E001 SECURITY:BadAuthorizationProtocol +R000 SELinux:SELinuxQueryVersion +R001 SELinux:SELinuxSetDeviceCreateContext +R002 SELinux:SELinuxGetDeviceCreateContext +R003 SELinux:SELinuxSetDeviceContext +R004 SELinux:SELinuxGetDeviceContext +R005 SELinux:SELinuxSetWindowCreateContext +R006 SELinux:SELinuxGetWindowCreateContext +R007 SELinux:SELinuxGetWindowContext +R008 SELinux:SELinuxSetPropertyCreateContext +R009 SELinux:SELinuxGetPropertyCreateContext +R010 SELinux:SELinuxSetPropertyUseContext +R011 SELinux:SELinuxGetPropertyUseContext +R012 SELinux:SELinuxGetPropertyContext +R013 SELinux:SELinuxGetPropertyDataContext +R014 SELinux:SELinuxListProperties +R015 SELinux:SELinuxSetSelectionCreateContext +R016 SELinux:SELinuxGetSelectionCreateContext +R017 SELinux:SELinuxSetSelectionUseContext +R018 SELinux:SELinuxGetSelectionUseContext +R019 SELinux:SELinuxGetSelectionContext +R020 SELinux:SELinuxGetSelectionDataContext +R021 SELinux:SELinuxListSelections +R022 SELinux:SELinuxGetClientContext +R000 SHAPE:QueryVersion +R001 SHAPE:Rectangles +R002 SHAPE:Mask +R003 SHAPE:Combine +R004 SHAPE:Offset +R005 SHAPE:QueryExtents +R006 SHAPE:SelectInput +R007 SHAPE:InputSelected +R008 SHAPE:GetRectangles +V000 SHAPE:Notify +R000 SYNC:Initialize +R001 SYNC:ListSystemCounters +R002 SYNC:CreateCounter +R003 SYNC:SetCounter +R004 SYNC:ChangeCounter +R005 SYNC:QueryCounter +R006 SYNC:DestroyCounter +R007 SYNC:Await +R008 SYNC:CreateAlarm +R009 SYNC:ChangeAlarm +R010 SYNC:QueryAlarm +R011 SYNC:DestroyAlarm +R012 SYNC:SetPriority +R013 SYNC:GetPriority +V000 SYNC:CounterNotify +V001 SYNC:AlarmNotify +E000 SYNC:BadCounter +E001 SYNC:BadAlarm +R000 TOG-CUP:QueryVersion +R001 TOG-CUP:GetReservedColormapEntries +R002 TOG-CUP:StoreColors +R000 Windows-WM:QueryVersion +R001 Windows-WM:FrameGetRect +R002 Windows-WM:FrameDraw +R003 Windows-WM:FrameSetTitle +R004 Windows-WM:DisableUpdate +R005 Windows-WM:ReenableUpdate +R006 Windows-WM:SelectInput +R007 Windows-WM:SetFrontProcess +V000 Windows-WM:ControllerNotify +V001 Windows-WM:ActivationNotify +E000 Windows-WM:ClientNotLocal +E001 Windows-WM:OperationNotSupported +R000 X-Resource:QueryVersion +R001 X-Resource:QueryClients +R002 X-Resource:QueryClientResources +R003 X-Resource:QueryClientPixmapBytes +R001 X11:CreateWindow +R002 X11:ChangeWindowAttributes +R003 X11:GetWindowAttributes +R004 X11:DestroyWindow +R005 X11:DestroySubwindows +R006 X11:ChangeSaveSet +R007 X11:ReparentWindow +R008 X11:MapWindow +R009 X11:MapSubwindows +R010 X11:UnmapWindow +R011 X11:UnmapSubwindows +R012 X11:ConfigureWindow +R013 X11:CirculateWindow +R014 X11:GetGeometry +R015 X11:QueryTree +R016 X11:InternAtom +R017 X11:GetAtomName +R018 X11:ChangeProperty +R019 X11:DeleteProperty +R020 X11:GetProperty +R021 X11:ListProperties +R022 X11:SetSelectionOwner +R023 X11:GetSelectionOwner +R024 X11:ConvertSelection +R025 X11:SendEvent +R026 X11:GrabPointer +R027 X11:UngrabPointer +R028 X11:GrabButton +R029 X11:UngrabButton +R030 X11:ChangeActivePointerGrab +R031 X11:GrabKeyboard +R032 X11:UngrabKeyboard +R033 X11:GrabKey +R034 X11:UngrabKey +R035 X11:AllowEvents +R036 X11:GrabServer +R037 X11:UngrabServer +R038 X11:QueryPointer +R039 X11:GetMotionEvents +R040 X11:TranslateCoords +R041 X11:WarpPointer +R042 X11:SetInputFocus +R043 X11:GetInputFocus +R044 X11:QueryKeymap +R045 X11:OpenFont +R046 X11:CloseFont +R047 X11:QueryFont +R048 X11:QueryTextExtents +R049 X11:ListFonts +R050 X11:ListFontsWithInfo +R051 X11:SetFontPath +R052 X11:GetFontPath +R053 X11:CreatePixmap +R054 X11:FreePixmap +R055 X11:CreateGC +R056 X11:ChangeGC +R057 X11:CopyGC +R058 X11:SetDashes +R059 X11:SetClipRectangles +R060 X11:FreeGC +R061 X11:ClearArea +R062 X11:CopyArea +R063 X11:CopyPlane +R064 X11:PolyPoint +R065 X11:PolyLine +R066 X11:PolySegment +R067 X11:PolyRectangle +R068 X11:PolyArc +R069 X11:FillPoly +R070 X11:PolyFillRectangle +R071 X11:PolyFillArc +R072 X11:PutImage +R073 X11:GetImage +R074 X11:PolyText8 +R075 X11:PolyText16 +R076 X11:ImageText8 +R077 X11:ImageText16 +R078 X11:CreateColormap +R079 X11:FreeColormap +R080 X11:CopyColormapAndFree +R081 X11:InstallColormap +R082 X11:UninstallColormap +R083 X11:ListInstalledColormaps +R084 X11:AllocColor +R085 X11:AllocNamedColor +R086 X11:AllocColorCells +R087 X11:AllocColorPlanes +R088 X11:FreeColors +R089 X11:StoreColors +R090 X11:StoreNamedColor +R091 X11:QueryColors +R092 X11:LookupColor +R093 X11:CreateCursor +R094 X11:CreateGlyphCursor +R095 X11:FreeCursor +R096 X11:RecolorCursor +R097 X11:QueryBestSize +R098 X11:QueryExtension +R099 X11:ListExtensions +R100 X11:ChangeKeyboardMapping +R101 X11:GetKeyboardMapping +R102 X11:ChangeKeyboardControl +R103 X11:GetKeyboardControl +R104 X11:Bell +R105 X11:ChangePointerControl +R106 X11:GetPointerControl +R107 X11:SetScreenSaver +R108 X11:GetScreenSaver +R109 X11:ChangeHosts +R110 X11:ListHosts +R111 X11:SetAccessControl +R112 X11:SetCloseDownMode +R113 X11:KillClient +R114 X11:RotateProperties +R115 X11:ForceScreenSaver +R116 X11:SetPointerMapping +R117 X11:GetPointerMapping +R118 X11:SetModifierMapping +R119 X11:GetModifierMapping +R127 X11:NoOperation +V000 X11:X_Error +V001 X11:X_Reply +V002 X11:KeyPress +V003 X11:KeyRelease +V004 X11:ButtonPress +V005 X11:ButtonRelease +V006 X11:MotionNotify +V007 X11:EnterNotify +V008 X11:LeaveNotify +V009 X11:FocusIn +V010 X11:FocusOut +V011 X11:KeymapNotify +V012 X11:Expose +V013 X11:GraphicsExpose +V014 X11:NoExpose +V015 X11:VisibilityNotify +V016 X11:CreateNotify +V017 X11:DestroyNotify +V018 X11:UnmapNotify +V019 X11:MapNotify +V020 X11:MapRequest +V021 X11:ReparentNotify +V022 X11:ConfigureNotify +V023 X11:ConfigureRequest +V024 X11:GravityNotify +V025 X11:ResizeRequest +V026 X11:CirculateNotify +V027 X11:CirculateRequest +V028 X11:PropertyNotify +V029 X11:SelectionClear +V030 X11:SelectionRequest +V031 X11:SelectionNotify +V032 X11:ColormapNotify +V033 X11:ClientMessage +V034 X11:MappingNotify +E000 X11:Success +E001 X11:BadRequest +E002 X11:BadValue +E003 X11:BadWindow +E004 X11:BadPixmap +E005 X11:BadAtom +E006 X11:BadCursor +E007 X11:BadFont +E008 X11:BadMatch +E009 X11:BadDrawable +E010 X11:BadAccess +E011 X11:BadAlloc +E012 X11:BadColor +E013 X11:BadGC +E014 X11:BadIDChoice +E015 X11:BadName +E016 X11:BadLength +E017 X11:BadImplementation +R001 X3D-PEX:GetExtensionInfo +R002 X3D-PEX:GetEnumeratedTypeInfo +R003 X3D-PEX:GetImpDepConstants +R004 X3D-PEX:CreateLookupTable +R005 X3D-PEX:CopyLookupTable +R006 X3D-PEX:FreeLookupTable +R007 X3D-PEX:GetTableInfo +R008 X3D-PEX:GetPredefinedEntries +R009 X3D-PEX:GetDefinedIndices +R010 X3D-PEX:GetTableEntry +R011 X3D-PEX:GetTableEntries +R012 X3D-PEX:SetTableEntries +R013 X3D-PEX:DeleteTableEntries +R014 X3D-PEX:CreatePipelineContext +R015 X3D-PEX:CopyPipelineContext +R016 X3D-PEX:FreePipelineContext +R017 X3D-PEX:GetPipelineContext +R018 X3D-PEX:ChangePipelineContext +R019 X3D-PEX:CreateRenderer +R020 X3D-PEX:FreeRenderer +R021 X3D-PEX:ChangeRenderer +R022 X3D-PEX:GetRendererAttributes +R023 X3D-PEX:GetRendererDynamics +R024 X3D-PEX:BeginRendering +R025 X3D-PEX:EndRendering +R026 X3D-PEX:BeginStructure +R027 X3D-PEX:EndStructure +R028 X3D-PEX:OutputCommands +R029 X3D-PEX:Network +R030 X3D-PEX:CreateStructure +R031 X3D-PEX:CopyStructure +R032 X3D-PEX:DestroyStructures +R033 X3D-PEX:GetStructureInfo +R034 X3D-PEX:GetElementInfo +R035 X3D-PEX:GetStructuresInNetwork +R036 X3D-PEX:GetAncestors +R037 X3D-PEX:GetDescendants +R038 X3D-PEX:FetchElements +R039 X3D-PEX:SetEditingMode +R040 X3D-PEX:SetElementPointer +R041 X3D-PEX:SetElementPointerAtLabel +R042 X3D-PEX:ElementSearch +R043 X3D-PEX:StoreElements +R044 X3D-PEX:DeleteElements +R045 X3D-PEX:DeleteElementsToLabel +R046 X3D-PEX:DeleteBetweenLabels +R047 X3D-PEX:CopyElements +R048 X3D-PEX:ChangeStructureRefs +R049 X3D-PEX:CreateNameSet +R050 X3D-PEX:CopyNameSet +R051 X3D-PEX:FreeNameSet +R052 X3D-PEX:GetNameSet +R053 X3D-PEX:ChangeNameSet +R054 X3D-PEX:CreateSearchContext +R055 X3D-PEX:CopySearchContext +R056 X3D-PEX:FreeSearchContext +R057 X3D-PEX:GetSearchContext +R058 X3D-PEX:ChangeSearchContext +R059 X3D-PEX:SearchNetwork +R060 X3D-PEX:CreatePhigsWks +R061 X3D-PEX:FreePhigsWks +R062 X3D-PEX:GetWksInfo +R063 X3D-PEX:GetDynamics +R064 X3D-PEX:GetViewRep +R065 X3D-PEX:RedrawAllStructures +R066 X3D-PEX:UpdateWorkstation +R067 X3D-PEX:RedrawClipRegion +R068 X3D-PEX:ExecuteDeferredActions +R069 X3D-PEX:SetViewPriority +R070 X3D-PEX:SetDisplayUpdateMode +R071 X3D-PEX:MapDCtoWC +R072 X3D-PEX:MapWCtoDC +R073 X3D-PEX:SetViewRep +R074 X3D-PEX:SetWksWindow +R075 X3D-PEX:SetWksViewport +R076 X3D-PEX:SetHlhsrMode +R077 X3D-PEX:SetWksBufferMode +R078 X3D-PEX:PostStructure +R079 X3D-PEX:UnpostStructure +R080 X3D-PEX:UnpostAllStructures +R081 X3D-PEX:GetWksPostings +R082 X3D-PEX:GetPickDevice +R083 X3D-PEX:ChangePickDevice +R084 X3D-PEX:CreatePickMeasure +R085 X3D-PEX:FreePickMeasure +R086 X3D-PEX:GetPickMeasure +R087 X3D-PEX:UpdatePickMeasure +R088 X3D-PEX:OpenFont +R089 X3D-PEX:CloseFont +R090 X3D-PEX:QueryFont +R091 X3D-PEX:ListFonts +R092 X3D-PEX:ListFontsWithInfo +R093 X3D-PEX:QueryTextExtents +R094 X3D-PEX:MatchRenderingTargets +R095 X3D-PEX:Escape +R096 X3D-PEX:EscapeWithReply +R097 X3D-PEX:Elements +R098 X3D-PEX:AccumulateState +R099 X3D-PEX:BeginPickOne +R100 X3D-PEX:EndPickOne +R101 X3D-PEX:PickOne +R102 X3D-PEX:BeginPickAll +R103 X3D-PEX:EndPickAll +R104 X3D-PEX:PickAll +E000 X3D-PEX:ColorTypeError +E001 X3D-PEX:erStateError +E002 X3D-PEX:FloatingPointFormatError +E003 X3D-PEX:LabelError +E004 X3D-PEX:LookupTableError +E005 X3D-PEX:NameSetError +E006 X3D-PEX:PathError +E007 X3D-PEX:FontError +E008 X3D-PEX:PhigsWksError +E009 X3D-PEX:PickMeasureError +E010 X3D-PEX:PipelineContextError +E011 X3D-PEX:erError +E012 X3D-PEX:SearchContextError +E013 X3D-PEX:StructureError +E014 X3D-PEX:OutputCommandError +R000 XC-APPGROUP:QueryVersion +R001 XC-APPGROUP:Create +R002 XC-APPGROUP:Destroy +R003 XC-APPGROUP:GetAttr +R004 XC-APPGROUP:Query +R005 XC-APPGROUP:CreateAssoc +R006 XC-APPGROUP:DestroyAssoc +E000 XC-APPGROUP:BadAppGroup +R000 XC-MISC:GetVersion +R001 XC-MISC:GetXIDRange +R002 XC-MISC:GetXIDList +R000 XEVIE:QueryVersion +R001 XEVIE:Start +R002 XEVIE:End +R003 XEVIE:Send +R004 XEVIE:SelectInput +R000 XFIXES:QueryVersion +R001 XFIXES:ChangeSaveSet +R002 XFIXES:SelectSelectionInput +R003 XFIXES:SelectCursorInput +R004 XFIXES:GetCursorImage +R005 XFIXES:CreateRegion +R006 XFIXES:CreateRegionFromBitmap +R007 XFIXES:CreateRegionFromWindow +R008 XFIXES:CreateRegionFromGC +R009 XFIXES:CreateRegionFromPicture +R010 XFIXES:DestroyRegion +R011 XFIXES:SetRegion +R012 XFIXES:CopyRegion +R013 XFIXES:UnionRegion +R014 XFIXES:IntersectRegion +R015 XFIXES:SubtractRegion +R016 XFIXES:InvertRegion +R017 XFIXES:TranslateRegion +R018 XFIXES:RegionExtents +R019 XFIXES:FetchRegion +R020 XFIXES:SetGCClipRegion +R021 XFIXES:SetWindowShapeRegion +R022 XFIXES:SetPictureClipRegion +R023 XFIXES:SetCursorName +R024 XFIXES:GetCursorName +R025 XFIXES:GetCursorImageAndName +R026 XFIXES:ChangeCursor +R027 XFIXES:ChangeCursorByName +R028 XFIXES:ExpandRegion +R029 XFIXES:HideCursor +R030 XFIXES:ShowCursor +V000 XFIXES:SelectionNotify +V001 XFIXES:CursorNotify +E000 XFIXES:BadRegion +R000 XFree86-Bigfont:QueryVersion +R001 XFree86-Bigfont:QueryFont +R000 XFree86-DGA:QueryVersion +R001 XFree86-DGA:GetVideoLL +R002 XFree86-DGA:DirectVideo +R003 XFree86-DGA:GetViewPortSize +R004 XFree86-DGA:SetViewPort +R005 XFree86-DGA:GetVidPage +R006 XFree86-DGA:SetVidPage +R007 XFree86-DGA:InstallColormap +R008 XFree86-DGA:QueryDirectVideo +R009 XFree86-DGA:ViewPortChanged +R010 XFree86-DGA:Obsolete1 +R011 XFree86-DGA:Obsolete2 +R012 XFree86-DGA:QueryModes +R013 XFree86-DGA:SetMode +R014 XFree86-DGA:SetViewport +R015 XFree86-DGA:InstallColormap +R016 XFree86-DGA:SelectInput +R017 XFree86-DGA:FillRectangle +R018 XFree86-DGA:CopyArea +R019 XFree86-DGA:CopyTransparentArea +R020 XFree86-DGA:GetViewportStatus +R021 XFree86-DGA:Sync +R022 XFree86-DGA:OpenFramebuffer +R023 XFree86-DGA:CloseFramebuffer +R024 XFree86-DGA:SetClientVersion +R025 XFree86-DGA:ChangePixmapMode +R026 XFree86-DGA:CreateColormap +E000 XFree86-DGA:ClientNotLocal +E001 XFree86-DGA:NoDirectVideoMode +E002 XFree86-DGA:ScreenNotActive +E003 XFree86-DGA:DirectNotActivated +E004 XFree86-DGA:OperationNotSupported +R000 XFree86-DRI:QueryVersion +R001 XFree86-DRI:QueryDirectRenderingCapable +R002 XFree86-DRI:OpenConnection +R003 XFree86-DRI:CloseConnection +R004 XFree86-DRI:GetClientDriverName +R005 XFree86-DRI:CreateContext +R006 XFree86-DRI:DestroyContext +R007 XFree86-DRI:CreateDrawable +R008 XFree86-DRI:DestroyDrawable +R009 XFree86-DRI:GetDrawableInfo +R010 XFree86-DRI:GetDeviceInfo +R011 XFree86-DRI:AuthConnection +R012 XFree86-DRI:OpenFullScreen +R013 XFree86-DRI:CloseFullScreen +E000 XFree86-DRI:ClientNotLocal +E001 XFree86-DRI:OperationNotSupported +R000 XFree86-Misc:QueryVersion +R001 XFree86-Misc:GetSaver +R002 XFree86-Misc:SetSaver +R003 XFree86-Misc:GetMouseSettings +R004 XFree86-Misc:GetKbdSettings +R005 XFree86-Misc:SetMouseSettings +R006 XFree86-Misc:SetKbdSettings +R007 XFree86-Misc:SetGrabKeysState +R008 XFree86-Misc:SetClientVersion +R009 XFree86-Misc:GetFilePaths +R010 XFree86-Misc:PassMessage +E000 XFree86-Misc:BadMouseProtocol +E001 XFree86-Misc:BadMouseBaudRate +E002 XFree86-Misc:BadMouseFlags +E003 XFree86-Misc:BadMouseCombo +E004 XFree86-Misc:BadKbdType +E005 XFree86-Misc:ModInDevDisabled +E006 XFree86-Misc:ModInDevClientNotLocal +E007 XFree86-Misc:NoModule +R000 XFree86-VidModeExtension:QueryVersion +R001 XFree86-VidModeExtension:GetModeLine +R002 XFree86-VidModeExtension:ModModeLine +R003 XFree86-VidModeExtension:SwitchMode +R004 XFree86-VidModeExtension:GetMonitor +R005 XFree86-VidModeExtension:LockModeSwitch +R006 XFree86-VidModeExtension:GetAllModeLines +R007 XFree86-VidModeExtension:AddModeLine +R008 XFree86-VidModeExtension:DeleteModeLine +R009 XFree86-VidModeExtension:ValidateModeLine +R010 XFree86-VidModeExtension:SwitchToMode +R011 XFree86-VidModeExtension:GetViewPort +R012 XFree86-VidModeExtension:SetViewPort +R013 XFree86-VidModeExtension:GetDotClocks +R014 XFree86-VidModeExtension:SetClientVersion +R015 XFree86-VidModeExtension:SetGamma +R016 XFree86-VidModeExtension:GetGamma +R017 XFree86-VidModeExtension:GetGammaRamp +R018 XFree86-VidModeExtension:SetGammaRamp +R019 XFree86-VidModeExtension:GetGammaRampSize +R020 XFree86-VidModeExtension:GetPermissions +V000 XFree86-VidModeExtension:Notify +E000 XFree86-VidModeExtension:BadClock +E001 XFree86-VidModeExtension:BadHTimings +E002 XFree86-VidModeExtension:BadVTimings +E003 XFree86-VidModeExtension:ModeUnsuitable +E004 XFree86-VidModeExtension:ExtensionDisabled +E005 XFree86-VidModeExtension:ClientNotLocal +E006 XFree86-VidModeExtension:ZoomLocked +R001 XIE:QueryImageExtension +R002 XIE:QueryTechniques +R003 XIE:CreateColorList +R004 XIE:DestroyColorList +R005 XIE:PurgeColorList +R006 XIE:QueryColorList +R007 XIE:CreateLUT +R008 XIE:DestroyLUT +R009 XIE:CreatePhotomap +R010 XIE:DestroyPhotomap +R011 XIE:QueryPhotomap +R012 XIE:CreateROI +R013 XIE:DestroyROI +R014 XIE:CreatePhotospace +R015 XIE:DestroyPhotospace +R016 XIE:ExecuteImmediate +R017 XIE:CreatePhotoflo +R018 XIE:DestroyPhotoflo +R019 XIE:ExecutePhotoflo +R020 XIE:ModifyPhotoflo +R021 XIE:RedefinePhotoflo +R022 XIE:PutClientData +R023 XIE:GetClientData +R024 XIE:QueryPhotoflo +R025 XIE:Await +R026 XIE:Abort +E000 XIE:ColorListError +E001 XIE:LUTError +E002 XIE:PhotofloError +E003 XIE:PhotomapError +E004 XIE:PhotospaceError +E005 XIE:ROIError +E006 XIE:FloError +R000 XINERAMA:QueryVersion +R001 XINERAMA:GetState +R002 XINERAMA:GetScreenCount +R003 XINERAMA:GetScreenSize +R004 XINERAMA:IsActive +R005 XINERAMA:QueryScreens +R001 XInputExtension:GetExtensionVersion +R002 XInputExtension:ListInputDevices +R003 XInputExtension:OpenDevice +R004 XInputExtension:CloseDevice +R005 XInputExtension:SetDeviceMode +R006 XInputExtension:SelectExtensionEvent +R007 XInputExtension:GetSelectedExtensionEvents +R008 XInputExtension:ChangeDeviceDontPropagateList +R009 XInputExtension:GetDeviceDontPropagageList +R010 XInputExtension:GetDeviceMotionEvents +R011 XInputExtension:ChangeKeyboardDevice +R012 XInputExtension:ChangePointerDevice +R013 XInputExtension:GrabDevice +R014 XInputExtension:UngrabDevice +R015 XInputExtension:GrabDeviceKey +R016 XInputExtension:UngrabDeviceKey +R017 XInputExtension:GrabDeviceButton +R018 XInputExtension:UngrabDeviceButton +R019 XInputExtension:AllowDeviceEvents +R020 XInputExtension:GetDeviceFocus +R021 XInputExtension:SetDeviceFocus +R022 XInputExtension:GetFeedbackControl +R023 XInputExtension:ChangeFeedbackControl +R024 XInputExtension:GetDeviceKeyMapping +R025 XInputExtension:ChangeDeviceKeyMapping +R026 XInputExtension:GetDeviceModifierMapping +R027 XInputExtension:SetDeviceModifierMapping +R028 XInputExtension:GetDeviceButtonMapping +R029 XInputExtension:SetDeviceButtonMapping +R030 XInputExtension:QueryDeviceState +R031 XInputExtension:SendExtensionEvent +R032 XInputExtension:DeviceBell +R033 XInputExtension:SetDeviceValuators +R034 XInputExtension:GetDeviceControl +R035 XInputExtension:ChangeDeviceControl +V000 XInputExtension:DeviceValuator +V001 XInputExtension:DeviceKeyPress +V002 XInputExtension:DeviceKeyRelease +V003 XInputExtension:DeviceButtonPress +V004 XInputExtension:DeviceButtonRelease +V005 XInputExtension:DeviceMotionNotify +V006 XInputExtension:DeviceFocusIn +V007 XInputExtension:DeviceFocusOut +V008 XInputExtension:ProximityIn +V009 XInputExtension:ProximityOut +V010 XInputExtension:DeviceStateNotify +V011 XInputExtension:DeviceMappingNotify +V012 XInputExtension:ChangeDeviceNotify +V013 XInputExtension:DeviceKeystateNotify +V014 XInputExtension:DeviceButtonstateNotify +V015 XInputExtension:DevicePresenceNotify +E000 XInputExtension:BadDevice +E001 XInputExtension:BadEvent +E002 XInputExtension:BadMode +E003 XInputExtension:DeviceBusy +E004 XInputExtension:BadClass +R000 XKEYBOARD:UseExtension +R001 XKEYBOARD:SelectEvents +R002 XKEYBOARD:Obsolete +R003 XKEYBOARD:Bell +R004 XKEYBOARD:GetState +R005 XKEYBOARD:LatchLockState +R006 XKEYBOARD:GetControls +R007 XKEYBOARD:SetControls +R008 XKEYBOARD:GetMap +R009 XKEYBOARD:SetMap +R010 XKEYBOARD:GetCompatMap +R011 XKEYBOARD:SetCompatMap +R012 XKEYBOARD:GetIndicatorState +R013 XKEYBOARD:GetIndicatorMap +R014 XKEYBOARD:SetIndicatorMap +R015 XKEYBOARD:GetNamedIndicator +R016 XKEYBOARD:SetNamedIndicator +R017 XKEYBOARD:GetNames +R018 XKEYBOARD:SetNames +R019 XKEYBOARD:GetGeometry +R020 XKEYBOARD:SetGeometry +R021 XKEYBOARD:PerClientFlags +R022 XKEYBOARD:ListComponents +R023 XKEYBOARD:GetKbdByName +R024 XKEYBOARD:GetDeviceInfo +R025 XKEYBOARD:SetDeviceInfo +R101 XKEYBOARD:SetDebuggingFlags +V000 XKEYBOARD:EventCode +E000 XKEYBOARD:BadKeyboard +R000 XTEST:GetVersion +R001 XTEST:CompareCursor +R002 XTEST:FakeInput +R003 XTEST:GrabControl +R000 XVideo:QueryExtension +R001 XVideo:QueryAdaptors +R002 XVideo:QueryEncodings +R003 XVideo:GrabPort +R004 XVideo:UngrabPort +R005 XVideo:PutVideo +R006 XVideo:PutStill +R007 XVideo:GetVideo +R008 XVideo:GetStill +R009 XVideo:StopVideo +R010 XVideo:SelectVideoNotify +R011 XVideo:SelectPortNotify +R012 XVideo:QueryBestSize +R013 XVideo:SetPortAttribute +R014 XVideo:GetPortAttribute +R015 XVideo:QueryPortAttributes +R016 XVideo:ListImageFormats +R017 XVideo:QueryImageAttributes +R018 XVideo:PutImage +R019 XVideo:ShmPutImage +V000 XVideo:VideoNotify +V001 XVideo:PortNotify +E000 XVideo:BadPort +E001 XVideo:BadEncoding +E002 XVideo:BadControl +R000 XVideo-MotionCompensation:QueryVersion +R001 XVideo-MotionCompensation:ListSurfaceTypes +R002 XVideo-MotionCompensation:CreateContext +R003 XVideo-MotionCompensation:DestroyContext +R004 XVideo-MotionCompensation:CreateSurface +R005 XVideo-MotionCompensation:DestroySurface +R006 XVideo-MotionCompensation:CreateSubpicture +R007 XVideo-MotionCompensation:DestroySubpicture +R008 XVideo-MotionCompensation:ListSubpictureTypes +R009 XVideo-MotionCompensation:GetDRInfo +E000 XVideo-MotionCompensation:BadContext +E001 XVideo-MotionCompensation:BadSurface +E002 XVideo-MotionCompensation:BadSubpicture +R000 XpExtension:QueryVersion +R001 XpExtension:GetPrinterList +R002 XpExtension:CreateContext +R003 XpExtension:SetContext +R004 XpExtension:GetContext +R005 XpExtension:DestroyContext +R006 XpExtension:GetContextScreen +R007 XpExtension:StartJob +R008 XpExtension:EndJob +R009 XpExtension:StartDoc +R010 XpExtension:EndDoc +R011 XpExtension:PutDocumentData +R012 XpExtension:GetDocumentData +R013 XpExtension:StartPage +R014 XpExtension:EndPage +R015 XpExtension:SelectInput +R016 XpExtension:InputSelected +R017 XpExtension:GetAttributes +R018 XpExtension:SetAttributes +R019 XpExtension:GetOneAttribute +R020 XpExtension:RehashPrinterList +R021 XpExtension:GetPageDimensions +R022 XpExtension:QueryScreens +R023 XpExtension:SetImageResolution +R024 XpExtension:GetImageResolution +V000 XpExtension:PrintNotify +V001 XpExtension:AttributeNotify +E000 XpExtension:BadContext +E001 XpExtension:BadSequence +E002 XpExtension:BadResourceID diff --git a/xserver/dix/registry.c b/xserver/dix/registry.c new file mode 100644 index 000000000..a519cff6b --- /dev/null +++ b/xserver/dix/registry.c @@ -0,0 +1,336 @@ +/************************************************************ + +Author: Eamon Walsh <ewalsh@epoch.ncsc.mil> + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +this permission notice appear in supporting documentation. This permission +notice shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +********************************************************/ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#ifdef XREGISTRY + +#include <stdlib.h> +#include <string.h> +#include <X11/X.h> +#include <X11/Xproto.h> +#include "resource.h" +#include "registry.h" + +#define BASE_SIZE 16 +#define CORE "X11" +#define FILENAME SERVER_MISC_CONFIG_PATH "/protocol.txt" + +#define PROT_COMMENT '#' +#define PROT_REQUEST 'R' +#define PROT_EVENT 'V' +#define PROT_ERROR 'E' + +static FILE *fh; + +static char ***requests, **events, **errors, **resources; +static unsigned nmajor, *nminor, nevent, nerror, nresource; + +/* + * File parsing routines + */ +static int double_size(void *p, unsigned n, unsigned size) +{ + char **ptr = (char **)p; + unsigned s, f; + + if (n) { + s = n * size; + n *= 2 * size; + f = n; + } else { + s = 0; + n = f = BASE_SIZE * size; + } + + *ptr = xrealloc(*ptr, n); + if (!*ptr) { + dixResetRegistry(); + return FALSE; + } + memset(*ptr + s, 0, f - s); + return TRUE; +} + +static void +RegisterRequestName(unsigned major, unsigned minor, char *name) +{ + while (major >= nmajor) { + if (!double_size(&requests, nmajor, sizeof(char **))) + return; + if (!double_size(&nminor, nmajor, sizeof(unsigned))) + return; + nmajor = nmajor ? nmajor * 2 : BASE_SIZE; + } + while (minor >= nminor[major]) { + if (!double_size(requests+major, nminor[major], sizeof(char *))) + return; + nminor[major] = nminor[major] ? nminor[major] * 2 : BASE_SIZE; + } + + free(requests[major][minor]); + requests[major][minor] = name; +} + +static void +RegisterEventName(unsigned event, char *name) { + while (event >= nevent) { + if (!double_size(&events, nevent, sizeof(char *))) + return; + nevent = nevent ? nevent * 2 : BASE_SIZE; + } + + free(events[event]); + events[event] = name; +} + +static void +RegisterErrorName(unsigned error, char *name) { + while (error >= nerror) { + if (!double_size(&errors, nerror, sizeof(char *))) + return; + nerror = nerror ? nerror * 2 : BASE_SIZE; + } + + free(errors[error]); + errors[error] = name; +} + +void +RegisterExtensionNames(ExtensionEntry *extEntry) +{ + char buf[256], *lineobj, *ptr; + unsigned offset; + + if (fh == NULL) + return; + + rewind(fh); + + while (fgets(buf, sizeof(buf), fh)) { + lineobj = NULL; + ptr = strchr(buf, '\n'); + if (ptr) + *ptr = 0; + + /* Check for comments or empty lines */ + switch (buf[0]) { + case PROT_REQUEST: + case PROT_EVENT: + case PROT_ERROR: + break; + case PROT_COMMENT: + case '\0': + continue; + default: + goto invalid; + } + + /* Check for space character in the fifth position */ + ptr = strchr(buf, ' '); + if (!ptr || ptr != buf + 4) + goto invalid; + + /* Duplicate the string after the space */ + lineobj = strdup(ptr + 1); + if (!lineobj) + continue; + + /* Check for a colon somewhere on the line */ + ptr = strchr(buf, ':'); + if (!ptr) + goto invalid; + + /* Compare the part before colon with the target extension name */ + *ptr = 0; + if (strcmp(buf + 5, extEntry->name)) + goto skip; + + /* Get the opcode for the request, event, or error */ + offset = strtol(buf + 1, &ptr, 10); + if (offset == 0 && ptr == buf + 1) + goto invalid; + + /* Save the strdup result in the registry */ + switch(buf[0]) { + case PROT_REQUEST: + if (extEntry->base) + RegisterRequestName(extEntry->base, offset, lineobj); + else + RegisterRequestName(offset, 0, lineobj); + continue; + case PROT_EVENT: + RegisterEventName(extEntry->eventBase + offset, lineobj); + continue; + case PROT_ERROR: + RegisterErrorName(extEntry->errorBase + offset, lineobj); + continue; + } + + invalid: + LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n"); + skip: + free(lineobj); + } +} + +/* + * Registration functions + */ + +void +RegisterResourceName(RESTYPE resource, char *name) +{ + resource &= TypeMask; + + while (resource >= nresource) { + if (!double_size(&resources, nresource, sizeof(char *))) + return; + nresource = nresource ? nresource * 2 : BASE_SIZE; + } + + resources[resource] = name; +} + +/* + * Lookup functions + */ + +const char * +LookupRequestName(int major, int minor) +{ + if (major >= nmajor) + return XREGISTRY_UNKNOWN; + if (minor >= nminor[major]) + return XREGISTRY_UNKNOWN; + + return requests[major][minor] ? requests[major][minor] : XREGISTRY_UNKNOWN; +} + +const char * +LookupMajorName(int major) +{ + if (major < 128) { + const char *retval; + + if (major >= nmajor) + return XREGISTRY_UNKNOWN; + if (0 >= nminor[major]) + return XREGISTRY_UNKNOWN; + + retval = requests[major][0]; + return retval ? retval + sizeof(CORE) : XREGISTRY_UNKNOWN; + } else { + ExtensionEntry *extEntry = GetExtensionEntry(major); + return extEntry ? extEntry->name : XREGISTRY_UNKNOWN; + } +} + +const char * +LookupEventName(int event) +{ + event &= 127; + if (event >= nevent) + return XREGISTRY_UNKNOWN; + + return events[event] ? events[event] : XREGISTRY_UNKNOWN; +} + +const char * +LookupErrorName(int error) +{ + if (error >= nerror) + return XREGISTRY_UNKNOWN; + + return errors[error] ? errors[error] : XREGISTRY_UNKNOWN; +} + +const char * +LookupResourceName(RESTYPE resource) +{ + resource &= TypeMask; + if (resource >= nresource) + return XREGISTRY_UNKNOWN; + + return resources[resource] ? resources[resource] : XREGISTRY_UNKNOWN; +} + +/* + * Setup and teardown + */ +void +dixResetRegistry(void) +{ + ExtensionEntry extEntry; + + /* Free all memory */ + while (nmajor--) { + while (nminor[nmajor]) + free(requests[nmajor][--nminor[nmajor]]); + xfree(requests[nmajor]); + } + xfree(requests); + xfree(nminor); + + while (nevent--) + free(events[nevent]); + xfree(events); + + while (nerror--) + free(errors[nerror]); + xfree(errors); + + xfree(resources); + + requests = NULL; + nminor = NULL; + events = NULL; + errors = NULL; + resources = NULL; + + nmajor = nevent = nerror = nresource = 0; + + /* Open the protocol file */ + if (fh) + fclose(fh); + fh = fopen(FILENAME, "r"); + if (!fh) + LogMessage(X_WARNING, "Failed to open protocol names file " FILENAME); + + /* Add built-in resources */ + RegisterResourceName(RT_NONE, "NONE"); + RegisterResourceName(RT_WINDOW, "WINDOW"); + RegisterResourceName(RT_PIXMAP, "PIXMAP"); + RegisterResourceName(RT_GC, "GC"); + RegisterResourceName(RT_FONT, "FONT"); + RegisterResourceName(RT_CURSOR, "CURSOR"); + RegisterResourceName(RT_COLORMAP, "COLORMAP"); + RegisterResourceName(RT_CMAPENTRY, "COLORMAP ENTRY"); + RegisterResourceName(RT_OTHERCLIENT, "OTHER CLIENT"); + RegisterResourceName(RT_PASSIVEGRAB, "PASSIVE GRAB"); + + /* Add the core protocol */ + memset(&extEntry, 0, sizeof(extEntry)); + extEntry.name = CORE; + RegisterExtensionNames(&extEntry); +} + +#endif /* XREGISTRY */ diff --git a/xserver/dix/resource.c b/xserver/dix/resource.c index b2d01c8f3..f318de3c0 100644 --- a/xserver/dix/resource.c +++ b/xserver/dix/resource.c @@ -72,8 +72,34 @@ dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ - -/* $TOG: resource.c /main/41 1998/02/09 14:20:31 kaleb $ */ +/* XSERVER_DTRACE additions: + * Copyright 2005-2006 Sun Microsystems, Inc. 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, and/or sell copies of the Software, and to permit persons + * to whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * 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 + * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. + * + * Except as contained in this notice, the name of a copyright holder + * shall not be used in advertising or otherwise to promote the sale, use + * or other dealings in this Software without prior written authorization + * of the copyright holder. + */ /* Routines to manage various kinds of resources: * @@ -120,11 +146,18 @@ Equipment Corporation. #include "panoramiX.h" #include "panoramiXsrv.h" #endif -#ifdef XACE #include "xace.h" -#endif #include <assert.h> +#ifdef XSERVER_DTRACE +#include <sys/types.h> +#include "registry.h" +typedef const char *string; +#include "Xserver-dtrace.h" + +#define TypeNameString(t) LookupResourceName(t) +#endif + static void RebuildTable( int /*client*/ ); @@ -159,17 +192,17 @@ _X_EXPORT RESTYPE TypeMask; static DeleteType *DeleteFuncs = (DeleteType *)NULL; -#ifdef XResExtension +_X_EXPORT CallbackListPtr ResourceStateCallback; -_X_EXPORT Atom * ResourceNames = NULL; - -_X_EXPORT void RegisterResourceName (RESTYPE type, char *name) +static _X_INLINE void +CallResourceStateCallback(ResourceState state, ResourceRec *res) { - ResourceNames[type & TypeMask] = MakeAtom(name, strlen(name), TRUE); + if (ResourceStateCallback) { + ResourceStateInfoRec rsi = { state, res->id, res->type, res->value }; + CallCallbacks(&ResourceStateCallback, &rsi); + } } -#endif - _X_EXPORT RESTYPE CreateNewResourceType(DeleteType deleteFunc) { @@ -182,17 +215,8 @@ CreateNewResourceType(DeleteType deleteFunc) (next + 1) * sizeof(DeleteType)); if (!funcs) return 0; - -#ifdef XResExtension - { - Atom *newnames; - newnames = xrealloc(ResourceNames, (next + 1) * sizeof(Atom)); - if(!newnames) - return 0; - ResourceNames = newnames; - ResourceNames[next] = 0; - } -#endif + if (!dixRegisterPrivateOffset(next, -1)) + return 0; lastResourceType = next; DeleteFuncs = funcs; @@ -201,7 +225,7 @@ CreateNewResourceType(DeleteType deleteFunc) } _X_EXPORT RESTYPE -CreateNewResourceClass() +CreateNewResourceClass(void) { RESTYPE next = lastResourceClass >> 1; @@ -212,7 +236,7 @@ CreateNewResourceClass() return next; } -ClientResourceRec clientTable[MAXCLIENTS]; +static ClientResourceRec clientTable[MAXCLIENTS]; /***************** * InitClientResources @@ -223,7 +247,7 @@ ClientResourceRec clientTable[MAXCLIENTS]; Bool InitClientResources(ClientPtr client) { - register int i, j; + int i, j; if (client == serverClient) { @@ -246,14 +270,6 @@ InitClientResources(ClientPtr client) DeleteFuncs[RT_CMAPENTRY & TypeMask] = FreeClientPixels; DeleteFuncs[RT_OTHERCLIENT & TypeMask] = OtherClientGone; DeleteFuncs[RT_PASSIVEGRAB & TypeMask] = DeletePassiveGrab; - -#ifdef XResExtension - if(ResourceNames) - xfree(ResourceNames); - ResourceNames = xalloc((lastResourceType + 1) * sizeof(Atom)); - if(!ResourceNames) - return FALSE; -#endif } clientTable[i = client->index].resources = (ResourcePtr *)xalloc(INITBUCKETS*sizeof(ResourcePtr)); @@ -280,7 +296,7 @@ InitClientResources(ClientPtr client) static int -Hash(int client, register XID id) +Hash(int client, XID id) { id &= RESOURCE_ID_MASK; switch (clientTable[client].hashsize) @@ -303,12 +319,12 @@ Hash(int client, register XID id) static XID AvailableID( - register int client, - register XID id, - register XID maxid, - register XID goodid) + int client, + XID id, + XID maxid, + XID goodid) { - register ResourcePtr res; + ResourcePtr res; if ((goodid >= id) && (goodid <= maxid)) return goodid; @@ -326,10 +342,10 @@ AvailableID( _X_EXPORT void GetXIDRange(int client, Bool server, XID *minp, XID *maxp) { - register XID id, maxid; - register ResourcePtr *resp; - register ResourcePtr res; - register int i; + XID id, maxid; + ResourcePtr *resp; + ResourcePtr res; + int i; XID goodid; id = (Mask)client << CLIENTOFFSET; @@ -402,7 +418,7 @@ GetXIDList(ClientPtr pClient, unsigned count, XID *pids) */ _X_EXPORT XID -FakeClientID(register int client) +FakeClientID(int client) { XID id, maxid; @@ -426,9 +442,12 @@ _X_EXPORT Bool AddResource(XID id, RESTYPE type, pointer value) { int client; - register ClientResourceRec *rrec; - register ResourcePtr res, *head; + ClientResourceRec *rrec; + ResourcePtr res, *head; +#ifdef XSERVER_DTRACE + XSERVER_RESOURCE_ALLOC(id, type, value, TypeNameString(type)); +#endif client = CLIENT_ID(id); rrec = &clientTable[client]; if (!rrec->buckets) @@ -455,16 +474,17 @@ AddResource(XID id, RESTYPE type, pointer value) rrec->elements++; if (!(id & SERVER_BIT) && (id >= rrec->expectID)) rrec->expectID = id + 1; + CallResourceStateCallback(ResourceStateAdding, res); return TRUE; } static void RebuildTable(int client) { - register int j; - register ResourcePtr res, next; + int j; + ResourcePtr res, next; ResourcePtr **tails, *resources; - register ResourcePtr **tptr, *rptr; + ResourcePtr **tptr, *rptr; /* * For now, preserve insertion order, since some ddx layers depend @@ -472,13 +492,13 @@ RebuildTable(int client) */ j = 2 * clientTable[client].buckets; - tails = (ResourcePtr **)ALLOCATE_LOCAL(j * sizeof(ResourcePtr *)); + tails = (ResourcePtr **)xalloc(j * sizeof(ResourcePtr *)); if (!tails) return; resources = (ResourcePtr *)xalloc(j * sizeof(ResourcePtr)); if (!resources) { - DEALLOCATE_LOCAL(tails); + xfree(tails); return; } for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++) @@ -501,7 +521,7 @@ RebuildTable(int client) *tptr = &res->next; } } - DEALLOCATE_LOCAL(tails); + xfree(tails); clientTable[client].buckets *= 2; xfree(clientTable[client].resources); clientTable[client].resources = resources; @@ -511,11 +531,10 @@ _X_EXPORT void FreeResource(XID id, RESTYPE skipDeleteFuncType) { int cid; - register ResourcePtr res; - register ResourcePtr *prev, *head; - register int *eltptr; + ResourcePtr res; + ResourcePtr *prev, *head; + int *eltptr; int elements; - Bool gotOne = FALSE; if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) { @@ -528,29 +547,26 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType) if (res->id == id) { RESTYPE rtype = res->type; + +#ifdef XSERVER_DTRACE + XSERVER_RESOURCE_FREE(res->id, res->type, + res->value, TypeNameString(res->type)); +#endif *prev = res->next; elements = --*eltptr; - if (rtype & RC_CACHED) - FlushClientCaches(res->id); + + CallResourceStateCallback(ResourceStateFreeing, res); + if (rtype != skipDeleteFuncType) (*DeleteFuncs[rtype & TypeMask])(res->value, res->id); xfree(res); if (*eltptr != elements) prev = head; /* prev may no longer be valid */ - gotOne = TRUE; } else prev = &res->next; } - if(clients[cid] && (id == clients[cid]->lastDrawableID)) - { - clients[cid]->lastDrawable = (DrawablePtr)WindowTable[0]; - clients[cid]->lastDrawableID = WindowTable[0]->drawable.id; - } } - if (!gotOne) - ErrorF("Freeing resource id=%lX which isn't there.\n", - (unsigned long)id); } @@ -558,8 +574,8 @@ _X_EXPORT void FreeResourceByType(XID id, RESTYPE type, Bool skipFree) { int cid; - register ResourcePtr res; - register ResourcePtr *prev, *head; + ResourcePtr res; + ResourcePtr *prev, *head; if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) { head = &clientTable[cid].resources[Hash(cid, id)]; @@ -569,9 +585,14 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree) { if (res->id == id && res->type == type) { +#ifdef XSERVER_DTRACE + XSERVER_RESOURCE_FREE(res->id, res->type, + res->value, TypeNameString(res->type)); +#endif *prev = res->next; - if (type & RC_CACHED) - FlushClientCaches(res->id); + + CallResourceStateCallback(ResourceStateFreeing, res); + if (!skipFree) (*DeleteFuncs[type & TypeMask])(res->value, res->id); xfree(res); @@ -580,11 +601,6 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree) else prev = &res->next; } - if(clients[cid] && (id == clients[cid]->lastDrawableID)) - { - clients[cid]->lastDrawable = (DrawablePtr)WindowTable[0]; - clients[cid]->lastDrawableID = WindowTable[0]->drawable.id; - } } } @@ -598,7 +614,7 @@ _X_EXPORT Bool ChangeResourceValue (XID id, RESTYPE rtype, pointer value) { int cid; - register ResourcePtr res; + ResourcePtr res; if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) { @@ -607,8 +623,6 @@ ChangeResourceValue (XID id, RESTYPE rtype, pointer value) for (; res; res = res->next) if ((res->id == id) && (res->type == rtype)) { - if (rtype & RC_CACHED) - FlushClientCaches(res->id); res->value = value; return TRUE; } @@ -629,10 +643,10 @@ FindClientResourcesByType( FindResType func, pointer cdata ){ - register ResourcePtr *resources; - register ResourcePtr this, next; + ResourcePtr *resources; + ResourcePtr this, next; int i, elements; - register int *eltptr; + int *eltptr; if (!client) client = serverClient; @@ -660,10 +674,10 @@ FindAllClientResources( FindAllRes func, pointer cdata ){ - register ResourcePtr *resources; - register ResourcePtr this, next; + ResourcePtr *resources; + ResourcePtr this, next; int i, elements; - register int *eltptr; + int *eltptr; if (!client) client = serverClient; @@ -731,11 +745,16 @@ FreeClientNeverRetainResources(ClientPtr client) RESTYPE rtype = this->type; if (rtype & RC_NEVERRETAIN) { +#ifdef XSERVER_DTRACE + XSERVER_RESOURCE_FREE(this->id, this->type, + this->value, TypeNameString(this->type)); +#endif *prev = this->next; - if (rtype & RC_CACHED) - FlushClientCaches(this->id); + + CallResourceStateCallback(ResourceStateFreeing, this); + (*DeleteFuncs[rtype & TypeMask])(this->value, this->id); - xfree(this); + xfree(this); } else prev = &this->next; @@ -746,8 +765,8 @@ FreeClientNeverRetainResources(ClientPtr client) void FreeClientResources(ClientPtr client) { - register ResourcePtr *resources; - register ResourcePtr this; + ResourcePtr *resources; + ResourcePtr this; int j; /* This routine shouldn't be called with a null client, but just in @@ -777,11 +796,16 @@ FreeClientResources(ClientPtr client) for (this = *head; this; this = *head) { RESTYPE rtype = this->type; +#ifdef XSERVER_DTRACE + XSERVER_RESOURCE_FREE(this->id, this->type, + this->value, TypeNameString(this->type)); +#endif *head = this->next; - if (rtype & RC_CACHED) - FlushClientCaches(this->id); + + CallResourceStateCallback(ResourceStateFreeing, this); + (*DeleteFuncs[rtype & TypeMask])(this->value, this->id); - xfree(this); + xfree(this); } } xfree(clientTable[client->index].resources); @@ -790,7 +814,7 @@ FreeClientResources(ClientPtr client) } void -FreeAllResources() +FreeAllResources(void) { int i; @@ -802,7 +826,7 @@ FreeAllResources() } _X_EXPORT Bool -LegalNewID(XID id, register ClientPtr client) +LegalNewID(XID id, ClientPtr client) { #ifdef PANORAMIX @@ -821,83 +845,35 @@ LegalNewID(XID id, register ClientPtr client) !LookupIDByClass(id, RC_ANY))); } -/* SecurityLookupIDByType and SecurityLookupIDByClass: - * These are the heart of the resource ID security system. They take - * two additional arguments compared to the old LookupID functions: - * the client doing the lookup, and the access mode (see resource.h). - * The resource is returned if it exists and the client is allowed access, - * else NULL is returned. - */ - -_X_EXPORT pointer -SecurityLookupIDByType(ClientPtr client, XID id, RESTYPE rtype, Mask mode) +_X_EXPORT int +dixLookupResource(pointer *result, XID id, RESTYPE rtype, + ClientPtr client, Mask mode) { - int cid; - register ResourcePtr res; - pointer retval = NULL; - - if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && - clientTable[cid].buckets) - { - res = clientTable[cid].resources[Hash(cid, id)]; + int cid = CLIENT_ID(id); + int istype = (rtype & TypeMask) && (rtype != RC_ANY); + ResourcePtr res = NULL; - for (; res; res = res->next) - if ((res->id == id) && (res->type == rtype)) - { - retval = res->value; - break; - } - } -#ifdef XACE - if (retval && client && - !XaceHook(XACE_RESOURCE_ACCESS, client, id, rtype, mode, retval)) - retval = NULL; -#endif - return retval; -} + *result = NULL; - -_X_EXPORT pointer -SecurityLookupIDByClass(ClientPtr client, XID id, RESTYPE classes, Mask mode) -{ - int cid; - register ResourcePtr res = NULL; - pointer retval = NULL; - - if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && - clientTable[cid].buckets) - { + if ((cid < MAXCLIENTS) && clientTable[cid].buckets) { res = clientTable[cid].resources[Hash(cid, id)]; for (; res; res = res->next) - if ((res->id == id) && (res->type & classes)) - { - retval = res->value; + if ((res->id == id) && ((istype && res->type == rtype) || + (!istype && res->type & rtype))) break; - } } -#ifdef XACE - if (retval && client && - !XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type, mode, retval)) - retval = NULL; -#endif - return retval; -} - -/* We can't replace the LookupIDByType and LookupIDByClass functions with - * macros because of compatibility with loadable servers. - */ - -_X_EXPORT pointer -LookupIDByType(XID id, RESTYPE rtype) -{ - return SecurityLookupIDByType(NullClient, id, rtype, - SecurityUnknownAccess); -} + if (!res) + return BadValue; + + if (client) { + client->errorValue = id; + cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type, + res->value, RT_NONE, NULL, mode); + if (cid != Success) + return cid; + } -_X_EXPORT pointer -LookupIDByClass(XID id, RESTYPE classes) -{ - return SecurityLookupIDByClass(NullClient, id, classes, - SecurityUnknownAccess); + *result = res->value; + return Success; } diff --git a/xserver/dix/selection.c b/xserver/dix/selection.c new file mode 100644 index 000000000..6a9198e96 --- /dev/null +++ b/xserver/dix/selection.c @@ -0,0 +1,311 @@ +/************************************************************ + +Copyright 1987, 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "windowstr.h" +#include "dixstruct.h" +#include "dispatch.h" +#include "selection.h" +#include "xace.h" + +/***************************************************************** + * Selection Stuff + * + * dixLookupSelection + * + * Selections are global to the server. The list of selections should + * not be traversed directly. Instead, use the functions listed above. + * + *****************************************************************/ + +_X_EXPORT Selection *CurrentSelections; +CallbackListPtr SelectionCallback; + +_X_EXPORT int +dixLookupSelection(Selection **result, Atom selectionName, + ClientPtr client, Mask access_mode) +{ + Selection *pSel; + int rc = BadMatch; + client->errorValue = selectionName; + + for (pSel = CurrentSelections; pSel; pSel = pSel->next) + if (pSel->selection == selectionName) + break; + + if (pSel) + rc = XaceHookSelectionAccess(client, &pSel, access_mode); + *result = pSel; + return rc; +} + +void +InitSelections(void) +{ + Selection *pSel, *pNextSel; + + pSel = CurrentSelections; + while (pSel) { + pNextSel = pSel->next; + dixFreePrivates(pSel->devPrivates); + xfree(pSel); + pSel = pNextSel; + } + + CurrentSelections = NULL; +} + +static _X_INLINE void +CallSelectionCallback(Selection *pSel, ClientPtr client, + SelectionCallbackKind kind) +{ + SelectionInfoRec info = { pSel, client, kind }; + CallCallbacks(&SelectionCallback, &info); +} + +void +DeleteWindowFromAnySelections(WindowPtr pWin) +{ + Selection *pSel; + + for (pSel = CurrentSelections; pSel; pSel = pSel->next) + if (pSel->pWin == pWin) { + CallSelectionCallback(pSel, NULL, SelectionWindowDestroy); + + pSel->pWin = (WindowPtr)NULL; + pSel->window = None; + pSel->client = NullClient; + } +} + +void +DeleteClientFromAnySelections(ClientPtr client) +{ + Selection *pSel; + + for (pSel = CurrentSelections; pSel; pSel = pSel->next) + if (pSel->client == client) { + CallSelectionCallback(pSel, NULL, SelectionClientClose); + + pSel->pWin = (WindowPtr)NULL; + pSel->window = None; + pSel->client = NullClient; + } +} + +int +ProcSetSelectionOwner(ClientPtr client) +{ + WindowPtr pWin = NULL; + TimeStamp time; + Selection *pSel; + int rc; + + REQUEST(xSetSelectionOwnerReq); + REQUEST_SIZE_MATCH(xSetSelectionOwnerReq); + + UpdateCurrentTime(); + time = ClientTimeToServerTime(stuff->time); + + /* If the client's time stamp is in the future relative to the server's + time stamp, do not set the selection, just return success. */ + if (CompareTimeStamps(time, currentTime) == LATER) + return Success; + + if (stuff->window != None) { + rc = dixLookupWindow(&pWin, stuff->window, client, DixSetAttrAccess); + if (rc != Success) + return rc; + } + if (!ValidAtom(stuff->selection)) { + client->errorValue = stuff->selection; + return BadAtom; + } + + /* + * First, see if the selection is already set... + */ + rc = dixLookupSelection(&pSel, stuff->selection, client, DixSetAttrAccess); + + if (rc == Success) { + xEvent event; + + /* If the timestamp in client's request is in the past relative + to the time stamp indicating the last time the owner of the + selection was set, do not set the selection, just return + success. */ + if (CompareTimeStamps(time, pSel->lastTimeChanged) == EARLIER) + return Success; + if (pSel->client && (!pWin || (pSel->client != client))) + { + event.u.u.type = SelectionClear; + event.u.selectionClear.time = time.milliseconds; + event.u.selectionClear.window = pSel->window; + event.u.selectionClear.atom = pSel->selection; + TryClientEvents(pSel->client, &event, 1, NoEventMask, + NoEventMask /* CantBeFiltered */, NullGrab); + } + } + else if (rc == BadMatch) + { + /* + * It doesn't exist, so add it... + */ + pSel = xalloc(sizeof(Selection)); + if (!pSel) + return BadAlloc; + + pSel->selection = stuff->selection; + pSel->devPrivates = NULL; + + /* security creation/labeling check */ + rc = XaceHookSelectionAccess(client, &pSel, + DixCreateAccess|DixSetAttrAccess); + if (rc != Success) { + xfree(pSel); + return rc; + } + + pSel->next = CurrentSelections; + CurrentSelections = pSel; + } + else + return rc; + + pSel->lastTimeChanged = time; + pSel->window = stuff->window; + pSel->pWin = pWin; + pSel->client = (pWin ? client : NullClient); + + CallSelectionCallback(pSel, client, SelectionSetOwner); + return client->noClientException; +} + +int +ProcGetSelectionOwner(ClientPtr client) +{ + int rc; + Selection *pSel; + xGetSelectionOwnerReply reply; + + REQUEST(xResourceReq); + REQUEST_SIZE_MATCH(xResourceReq); + + if (!ValidAtom(stuff->id)) { + client->errorValue = stuff->id; + return BadAtom; + } + + reply.type = X_Reply; + reply.length = 0; + reply.sequenceNumber = client->sequence; + + rc = dixLookupSelection(&pSel, stuff->id, client, DixGetAttrAccess); + if (rc == Success) + reply.owner = pSel->window; + else if (rc == BadMatch) + reply.owner = None; + else + return rc; + + WriteReplyToClient(client, sizeof(xGetSelectionOwnerReply), &reply); + return client->noClientException; +} + +int +ProcConvertSelection(ClientPtr client) +{ + Bool paramsOkay; + xEvent event; + WindowPtr pWin; + Selection *pSel; + int rc; + + REQUEST(xConvertSelectionReq); + REQUEST_SIZE_MATCH(xConvertSelectionReq); + + rc = dixLookupWindow(&pWin, stuff->requestor, client, DixSetAttrAccess); + if (rc != Success) + return rc; + + paramsOkay = ValidAtom(stuff->selection) && ValidAtom(stuff->target); + paramsOkay &= (stuff->property == None) || ValidAtom(stuff->property); + if (!paramsOkay) { + client->errorValue = stuff->property; + return BadAtom; + } + + rc = dixLookupSelection(&pSel, stuff->selection, client, DixReadAccess); + + if (rc != Success && rc != BadMatch) + return rc; + else if (rc == Success && pSel->window != None) { + event.u.u.type = SelectionRequest; + event.u.selectionRequest.owner = pSel->window; + event.u.selectionRequest.time = stuff->time; + event.u.selectionRequest.requestor = stuff->requestor; + event.u.selectionRequest.selection = stuff->selection; + event.u.selectionRequest.target = stuff->target; + event.u.selectionRequest.property = stuff->property; + if (TryClientEvents(pSel->client, &event, 1, NoEventMask, + NoEventMask /* CantBeFiltered */, NullGrab)) + return client->noClientException; + } + + event.u.u.type = SelectionNotify; + event.u.selectionNotify.time = stuff->time; + event.u.selectionNotify.requestor = stuff->requestor; + event.u.selectionNotify.selection = stuff->selection; + event.u.selectionNotify.target = stuff->target; + event.u.selectionNotify.property = None; + TryClientEvents(client, &event, 1, NoEventMask, + NoEventMask /* CantBeFiltered */, NullGrab); + return client->noClientException; +} diff --git a/xserver/dix/strcasecmp.c b/xserver/dix/strcasecmp.c index 58f0961e6..ca1051dc1 100644 --- a/xserver/dix/strcasecmp.c +++ b/xserver/dix/strcasecmp.c @@ -1,28 +1,31 @@ -/************************************************************ - Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. - - Permission to use, copy, modify, and distribute this - software and its documentation for any purpose and without - fee is hereby granted, provided that the above copyright - notice appear in all copies and that both that copyright - notice and this permission notice appear in supporting - documentation, and that the name of Silicon Graphics not be - used in advertising or publicity pertaining to distribution - of the software without specific prior written permission. - Silicon Graphics makes no representation about the suitability - of this software for any purpose. It is provided "as is" - without any express or implied warranty. - - SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL - DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH - THE USE OR PERFORMANCE OF THIS SOFTWARE. - - ********************************************************/ +/* + * Copyright (c) 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> @@ -33,7 +36,7 @@ #ifdef NEED_STRCASECMP int -xstrcasecmp(char *str1,char *str2) +xstrcasecmp(const char *str1, const char *str2) { const u_char *us1 = (const u_char *)str1, *us2 = (const u_char *)str2; @@ -46,3 +49,22 @@ xstrcasecmp(char *str1,char *str2) return (tolower(*us1) - tolower(*us2)); } #endif + +#ifdef NEED_STRNCASECMP +int +xstrncasecmp(const char *s1, const char *s2, size_t n) +{ + if (n != 0) { + const u_char *us1 = (const u_char *)s1, *us2 = (const u_char *)s2; + + do { + if (tolower(*us1) != tolower(*us2++)) + return (tolower(*us1) - tolower(*--us2)); + if (*us1++ == '\0') + break; + } while (--n != 0); + } + + return 0; +} +#endif diff --git a/xserver/dix/strcasestr.c b/xserver/dix/strcasestr.c new file mode 100644 index 000000000..b3d45495c --- /dev/null +++ b/xserver/dix/strcasestr.c @@ -0,0 +1,64 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <ctype.h> +#include <string.h> +#include "dix.h" + +/* + * Find the first occurrence of find in s, ignore case. + */ +#ifdef NEED_STRCASESTR +char * +xstrcasestr(const char *s, const char *find) +{ + char c, sc; + size_t len; + + if ((c = *find++) != 0) { + c = tolower((unsigned char)c); + len = strlen(find); + do { + do { + if ((sc = *s++) == 0) + return (NULL); + } while ((char)tolower((unsigned char)sc) != c); + } while (strncasecmp(s, find, len) != 0); + s--; + } + return ((char *)s); +} +#endif diff --git a/xserver/dix/swaprep.c b/xserver/dix/swaprep.c index 08ae6eb1a..91469e17b 100644 --- a/xserver/dix/swaprep.c +++ b/xserver/dix/swaprep.c @@ -73,10 +73,10 @@ static void SwapFont(xQueryFontReply *pr, Bool hasGlyphs); * \param size size in bytes */ _X_EXPORT void -Swap32Write(ClientPtr pClient, int size, register CARD32 *pbuf) +Swap32Write(ClientPtr pClient, int size, CARD32 *pbuf) { - register int i; - register char n; + int i; + char n; size >>= 2; for(i = 0; i < size; i++) @@ -97,11 +97,11 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf) { int bufsize = size; CARD32 *pbufT; - register CARD32 *from, *to, *fromLast, *toLast; + CARD32 *from, *to, *fromLast, *toLast; CARD32 tmpbuf[1]; /* Allocate as big a buffer as we can... */ - while (!(pbufT = (CARD32 *) ALLOCATE_LOCAL(bufsize))) + while (!(pbufT = (CARD32 *) xalloc(bufsize))) { bufsize >>= 1; if (bufsize == 4) @@ -133,7 +133,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf) } if (pbufT != tmpbuf) - DEALLOCATE_LOCAL ((char *) pbufT); + xfree ((char *) pbufT); } /** @@ -145,11 +145,11 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf) { int bufsize = size; short *pbufT; - register short *from, *to, *fromLast, *toLast; + short *from, *to, *fromLast, *toLast; short tmpbuf[2]; /* Allocate as big a buffer as we can... */ - while (!(pbufT = (short *) ALLOCATE_LOCAL(bufsize))) + while (!(pbufT = (short *) xalloc(bufsize))) { bufsize >>= 1; if (bufsize == 4) @@ -181,7 +181,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf) } if (pbufT != tmpbuf) - DEALLOCATE_LOCAL ((char *) pbufT); + xfree ((char *) pbufT); } @@ -189,7 +189,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf) void SGenericReply(ClientPtr pClient, int size, xGenericReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); (void)WriteToClient(pClient, size, (char *) pRep); @@ -200,7 +200,7 @@ void SGetWindowAttributesReply(ClientPtr pClient, int size, xGetWindowAttributesReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); @@ -218,7 +218,7 @@ SGetWindowAttributesReply(ClientPtr pClient, int size, void SGetGeometryReply(ClientPtr pClient, int size, xGetGeometryReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->root, n); @@ -233,7 +233,7 @@ SGetGeometryReply(ClientPtr pClient, int size, xGetGeometryReply *pRep) void SQueryTreeReply(ClientPtr pClient, int size, xQueryTreeReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); @@ -246,7 +246,7 @@ SQueryTreeReply(ClientPtr pClient, int size, xQueryTreeReply *pRep) void SInternAtomReply(ClientPtr pClient, int size, xInternAtomReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->atom, n); @@ -256,7 +256,7 @@ SInternAtomReply(ClientPtr pClient, int size, xInternAtomReply *pRep) void SGetAtomNameReply(ClientPtr pClient, int size, xGetAtomNameReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); @@ -268,7 +268,7 @@ SGetAtomNameReply(ClientPtr pClient, int size, xGetAtomNameReply *pRep) void SGetPropertyReply(ClientPtr pClient, int size, xGetPropertyReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); @@ -281,7 +281,7 @@ SGetPropertyReply(ClientPtr pClient, int size, xGetPropertyReply *pRep) void SListPropertiesReply(ClientPtr pClient, int size, xListPropertiesReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); @@ -293,7 +293,7 @@ void SGetSelectionOwnerReply(ClientPtr pClient, int size, xGetSelectionOwnerReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->owner, n); @@ -304,7 +304,7 @@ SGetSelectionOwnerReply(ClientPtr pClient, int size, void SQueryPointerReply(ClientPtr pClient, int size, xQueryPointerReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->root, n); @@ -317,10 +317,10 @@ SQueryPointerReply(ClientPtr pClient, int size, xQueryPointerReply *pRep) (void)WriteToClient(pClient, size, (char *) pRep); } -void +static void SwapTimecoord(xTimecoord* pCoord) { - register char n; + char n; swapl(&pCoord->time, n); swaps(&pCoord->x, n); @@ -346,7 +346,7 @@ SwapTimeCoordWrite(ClientPtr pClient, int size, xTimecoord *pRep) void SGetMotionEventsReply(ClientPtr pClient, int size, xGetMotionEventsReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); @@ -357,7 +357,7 @@ SGetMotionEventsReply(ClientPtr pClient, int size, xGetMotionEventsReply *pRep) void STranslateCoordsReply(ClientPtr pClient, int size, xTranslateCoordsReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->child, n); @@ -369,7 +369,7 @@ STranslateCoordsReply(ClientPtr pClient, int size, xTranslateCoordsReply *pRep) void SGetInputFocusReply(ClientPtr pClient, int size, xGetInputFocusReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->focus, n); @@ -380,7 +380,7 @@ SGetInputFocusReply(ClientPtr pClient, int size, xGetInputFocusReply *pRep) void SQueryKeymapReply(ClientPtr pClient, int size, xQueryKeymapReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); @@ -390,7 +390,7 @@ SQueryKeymapReply(ClientPtr pClient, int size, xQueryKeymapReply *pRep) static void SwapCharInfo(xCharInfo *pInfo) { - register char n; + char n; swaps(&pInfo->leftSideBearing, n); swaps(&pInfo->rightSideBearing, n); @@ -403,7 +403,7 @@ SwapCharInfo(xCharInfo *pInfo) static void SwapFontInfo(xQueryFontReply *pr) { - register char n; + char n; swaps(&pr->minCharOrByte2, n); swaps(&pr->maxCharOrByte2, n); @@ -423,7 +423,7 @@ SwapFont(xQueryFontReply *pr, Bool hasGlyphs) xCharInfo * pxci; unsigned nchars, nprops; char *pby; - register char n; + char n; swaps(&pr->sequenceNumber, n); swapl(&pr->length, n); @@ -458,7 +458,7 @@ SQueryFontReply(ClientPtr pClient, int size, xQueryFontReply *pRep) void SQueryTextExtentsReply(ClientPtr pClient, int size, xQueryTextExtentsReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swaps(&pRep->fontAscent, n); @@ -474,7 +474,7 @@ SQueryTextExtentsReply(ClientPtr pClient, int size, xQueryTextExtentsReply *pRep void SListFontsReply(ClientPtr pClient, int size, xListFontsReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); @@ -493,7 +493,7 @@ SListFontsWithInfoReply(ClientPtr pClient, int size, void SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); @@ -504,7 +504,7 @@ SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply *pRep) void SGetImageReply(ClientPtr pClient, int size, xGetImageReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); @@ -517,7 +517,7 @@ void SListInstalledColormapsReply(ClientPtr pClient, int size, xListInstalledColormapsReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); @@ -531,7 +531,7 @@ SAllocColorReply(pClient, size, pRep) int size; xAllocColorReply *pRep; { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swaps(&pRep->red, n); @@ -544,7 +544,7 @@ SAllocColorReply(pClient, size, pRep) void SAllocNamedColorReply(ClientPtr pClient, int size, xAllocNamedColorReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->pixel, n); @@ -560,7 +560,7 @@ SAllocNamedColorReply(ClientPtr pClient, int size, xAllocNamedColorReply *pRep) void SAllocColorCellsReply(ClientPtr pClient, int size, xAllocColorCellsReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); @@ -573,7 +573,7 @@ SAllocColorCellsReply(ClientPtr pClient, int size, xAllocColorCellsReply *pRep) void SAllocColorPlanesReply(ClientPtr pClient, int size, xAllocColorPlanesReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); @@ -584,10 +584,10 @@ SAllocColorPlanesReply(ClientPtr pClient, int size, xAllocColorPlanesReply *pRep (void)WriteToClient(pClient, size, (char *) pRep); } -void +static void SwapRGB(xrgb *prgb) { - register char n; + char n; swaps(&prgb->red, n); swaps(&prgb->green, n); @@ -613,7 +613,7 @@ SQColorsExtend(ClientPtr pClient, int size, xrgb *prgb) void SQueryColorsReply(ClientPtr pClient, int size, xQueryColorsReply* pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); @@ -624,7 +624,7 @@ SQueryColorsReply(ClientPtr pClient, int size, xQueryColorsReply* pRep) void SLookupColorReply(ClientPtr pClient, int size, xLookupColorReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swaps(&pRep->exactRed, n); @@ -639,7 +639,7 @@ SLookupColorReply(ClientPtr pClient, int size, xLookupColorReply *pRep) void SQueryBestSizeReply(ClientPtr pClient, int size, xQueryBestSizeReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swaps(&pRep->width, n); @@ -650,7 +650,7 @@ SQueryBestSizeReply(ClientPtr pClient, int size, xQueryBestSizeReply *pRep) void SListExtensionsReply(ClientPtr pClient, int size, xListExtensionsReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); @@ -661,7 +661,7 @@ void SGetKeyboardMappingReply(ClientPtr pClient, int size, xGetKeyboardMappingReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); @@ -672,7 +672,7 @@ void SGetPointerMappingReply(ClientPtr pClient, int size, xGetPointerMappingReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); @@ -683,7 +683,7 @@ void SGetModifierMappingReply(ClientPtr pClient, int size, xGetModifierMappingReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); @@ -693,7 +693,7 @@ SGetModifierMappingReply(ClientPtr pClient, int size, void SGetKeyboardControlReply(ClientPtr pClient, int size, xGetKeyboardControlReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); @@ -706,7 +706,7 @@ SGetKeyboardControlReply(ClientPtr pClient, int size, xGetKeyboardControlReply * void SGetPointerControlReply(ClientPtr pClient, int size, xGetPointerControlReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swaps(&pRep->accelNumerator, n); @@ -718,7 +718,7 @@ SGetPointerControlReply(ClientPtr pClient, int size, xGetPointerControlReply *pR void SGetScreenSaverReply(ClientPtr pClient, int size, xGetScreenSaverReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swaps(&pRep->timeout, n); @@ -734,7 +734,7 @@ SLHostsExtend(ClientPtr pClient, int size, char *buf) while (bufT < endbuf) { xHostEntry *host = (xHostEntry *) bufT; int len = host->length; - register char n; + char n; swaps (&host->length, n); bufT += sizeof (xHostEntry) + (((len + 3) >> 2) << 2); } @@ -744,7 +744,7 @@ SLHostsExtend(ClientPtr pClient, int size, char *buf) void SListHostsReply(ClientPtr pClient, int size, xListHostsReply *pRep) { - register char n; + char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); @@ -1159,6 +1159,58 @@ SKeymapNotifyEvent(xEvent *from, xEvent *to) *to = *from; } +static void +SwapConnSetup(xConnSetup *pConnSetup, xConnSetup *pConnSetupT) +{ + cpswapl(pConnSetup->release, pConnSetupT->release); + cpswapl(pConnSetup->ridBase, pConnSetupT->ridBase); + cpswapl(pConnSetup->ridMask, pConnSetupT->ridMask); + cpswapl(pConnSetup->motionBufferSize, pConnSetupT->motionBufferSize); + cpswaps(pConnSetup->nbytesVendor, pConnSetupT->nbytesVendor); + cpswaps(pConnSetup->maxRequestSize, pConnSetupT->maxRequestSize); + pConnSetupT->minKeyCode = pConnSetup->minKeyCode; + pConnSetupT->maxKeyCode = pConnSetup->maxKeyCode; + pConnSetupT->numRoots = pConnSetup->numRoots; + pConnSetupT->numFormats = pConnSetup->numFormats; + pConnSetupT->imageByteOrder = pConnSetup->imageByteOrder; + pConnSetupT->bitmapBitOrder = pConnSetup->bitmapBitOrder; + pConnSetupT->bitmapScanlineUnit = pConnSetup->bitmapScanlineUnit; + pConnSetupT->bitmapScanlinePad = pConnSetup->bitmapScanlinePad; +} + +static void +SwapWinRoot(xWindowRoot *pRoot, xWindowRoot *pRootT) +{ + cpswapl(pRoot->windowId, pRootT->windowId); + cpswapl(pRoot->defaultColormap, pRootT->defaultColormap); + cpswapl(pRoot->whitePixel, pRootT->whitePixel); + cpswapl(pRoot->blackPixel, pRootT->blackPixel); + cpswapl(pRoot->currentInputMask, pRootT->currentInputMask); + cpswaps(pRoot->pixWidth, pRootT->pixWidth); + cpswaps(pRoot->pixHeight, pRootT->pixHeight); + cpswaps(pRoot->mmWidth, pRootT->mmWidth); + cpswaps(pRoot->mmHeight, pRootT->mmHeight); + cpswaps(pRoot->minInstalledMaps, pRootT->minInstalledMaps); + cpswaps(pRoot->maxInstalledMaps, pRootT->maxInstalledMaps); + cpswapl(pRoot->rootVisualID, pRootT->rootVisualID); + pRootT->backingStore = pRoot->backingStore; + pRootT->saveUnders = pRoot->saveUnders; + pRootT->rootDepth = pRoot->rootDepth; + pRootT->nDepths = pRoot->nDepths; +} + +static void +SwapVisual(xVisualType *pVis, xVisualType *pVisT) +{ + cpswapl(pVis->visualID, pVisT->visualID); + pVisT->class = pVis->class; + pVisT->bitsPerRGB = pVis->bitsPerRGB; + cpswaps(pVis->colormapEntries, pVisT->colormapEntries); + cpswapl(pVis->redMask, pVisT->redMask); + cpswapl(pVis->greenMask, pVisT->greenMask); + cpswapl(pVis->blueMask, pVisT->blueMask); +} + _X_EXPORT void SwapConnSetupInfo( char *pInfo, @@ -1210,13 +1262,12 @@ SwapConnSetupInfo( } } - void WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo) { char *pInfoTBase; - pInfoTBase = (char *) ALLOCATE_LOCAL(size); + pInfoTBase = (char *) xalloc(size); if (!pInfoTBase) { pClient->noClientException = -1; @@ -1224,59 +1275,7 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo) } SwapConnSetupInfo(pInfo, pInfoTBase); (void)WriteToClient(pClient, (int)size, (char *) pInfoTBase); - DEALLOCATE_LOCAL(pInfoTBase); -} - -void -SwapConnSetup(xConnSetup *pConnSetup, xConnSetup *pConnSetupT) -{ - cpswapl(pConnSetup->release, pConnSetupT->release); - cpswapl(pConnSetup->ridBase, pConnSetupT->ridBase); - cpswapl(pConnSetup->ridMask, pConnSetupT->ridMask); - cpswapl(pConnSetup->motionBufferSize, pConnSetupT->motionBufferSize); - cpswaps(pConnSetup->nbytesVendor, pConnSetupT->nbytesVendor); - cpswaps(pConnSetup->maxRequestSize, pConnSetupT->maxRequestSize); - pConnSetupT->minKeyCode = pConnSetup->minKeyCode; - pConnSetupT->maxKeyCode = pConnSetup->maxKeyCode; - pConnSetupT->numRoots = pConnSetup->numRoots; - pConnSetupT->numFormats = pConnSetup->numFormats; - pConnSetupT->imageByteOrder = pConnSetup->imageByteOrder; - pConnSetupT->bitmapBitOrder = pConnSetup->bitmapBitOrder; - pConnSetupT->bitmapScanlineUnit = pConnSetup->bitmapScanlineUnit; - pConnSetupT->bitmapScanlinePad = pConnSetup->bitmapScanlinePad; -} - -void -SwapWinRoot(xWindowRoot *pRoot, xWindowRoot *pRootT) -{ - cpswapl(pRoot->windowId, pRootT->windowId); - cpswapl(pRoot->defaultColormap, pRootT->defaultColormap); - cpswapl(pRoot->whitePixel, pRootT->whitePixel); - cpswapl(pRoot->blackPixel, pRootT->blackPixel); - cpswapl(pRoot->currentInputMask, pRootT->currentInputMask); - cpswaps(pRoot->pixWidth, pRootT->pixWidth); - cpswaps(pRoot->pixHeight, pRootT->pixHeight); - cpswaps(pRoot->mmWidth, pRootT->mmWidth); - cpswaps(pRoot->mmHeight, pRootT->mmHeight); - cpswaps(pRoot->minInstalledMaps, pRootT->minInstalledMaps); - cpswaps(pRoot->maxInstalledMaps, pRootT->maxInstalledMaps); - cpswapl(pRoot->rootVisualID, pRootT->rootVisualID); - pRootT->backingStore = pRoot->backingStore; - pRootT->saveUnders = pRoot->saveUnders; - pRootT->rootDepth = pRoot->rootDepth; - pRootT->nDepths = pRoot->nDepths; -} - -void -SwapVisual(xVisualType *pVis, xVisualType *pVisT) -{ - cpswapl(pVis->visualID, pVisT->visualID); - pVisT->class = pVis->class; - pVisT->bitsPerRGB = pVis->bitsPerRGB; - cpswaps(pVis->colormapEntries, pVisT->colormapEntries); - cpswapl(pVis->redMask, pVisT->redMask); - cpswapl(pVis->greenMask, pVisT->greenMask); - cpswapl(pVis->blueMask, pVisT->blueMask); + xfree(pInfoTBase); } _X_EXPORT void diff --git a/xserver/dix/window.c b/xserver/dix/window.c index 961c02a79..834c26b12 100644 --- a/xserver/dix/window.c +++ b/xserver/dix/window.c @@ -126,6 +126,7 @@ Equipment Corporation. #ifdef XAPPGROUP #include "appgroup.h" #endif +#include "privates.h" #include "xace.h" /****** @@ -145,13 +146,6 @@ _X_EXPORT int screenIsSaved = SCREEN_SAVER_OFF; _X_EXPORT ScreenSaverStuffRec savedScreenInfo[MAXSCREENS]; -#if 0 -extern void DeleteWindowFromAnyEvents(); -extern Mask EventMaskForClient(); -extern void WindowHasNewCursor(); -extern void RecalculateDeliverableEvents(); -#endif - static Bool TileScreenSaver(int i, int kind); @@ -175,7 +169,6 @@ static Bool TileScreenSaver(int i, int kind); #define SubStrSend(pWin,pParent) (StrSend(pWin) || SubSend(pParent)) - _X_EXPORT int numSaveUndersViewable = 0; _X_EXPORT int deltaSaveUndersViewable = 0; @@ -297,9 +290,8 @@ SetWindowToDefaults(WindowPtr pWin) pWin->deliverableEvents = 0; pWin->dontPropagate = 0; pWin->forcedBS = FALSE; -#ifdef COMPOSITE pWin->redirectDraw = RedirectDrawNone; -#endif + pWin->forcedBG = FALSE; } static void @@ -313,7 +305,7 @@ MakeRootTile(WindowPtr pWin) int i, j; pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, 4, 4, - pScreen->rootDepth); + pScreen->rootDepth, 0); pWin->backgroundState = BackgroundPixmap; pGC = GetScratchGC(pScreen->rootDepth, pScreen); @@ -345,41 +337,6 @@ MakeRootTile(WindowPtr pWin) } -WindowPtr -AllocateWindow(ScreenPtr pScreen) -{ - WindowPtr pWin; - char *ptr; - DevUnion *ppriv; - unsigned *sizes; - unsigned size; - int i; - - pWin = (WindowPtr)xalloc(pScreen->totalWindowSize); - if (pWin) - { - ppriv = (DevUnion *)(pWin + 1); - pWin->devPrivates = ppriv; - sizes = pScreen->WindowPrivateSizes; - ptr = (char *)(ppriv + pScreen->WindowPrivateLen); - for (i = pScreen->WindowPrivateLen; --i >= 0; ppriv++, sizes++) - { - if ( (size = *sizes) ) - { - ppriv->ptr = (pointer)ptr; - ptr += size; - } - else - ppriv->ptr = (pointer)NULL; - } -#if _XSERVER64 - pWin->drawable.pad0 = 0; - pWin->drawable.pad1 = 0; -#endif - } - return pWin; -} - /***** * CreateRootWindow * Makes a window at initialization time for specified screen @@ -392,7 +349,7 @@ CreateRootWindow(ScreenPtr pScreen) BoxRec box; PixmapFormatRec *format; - pWin = AllocateWindow(pScreen); + pWin = (WindowPtr)xalloc(sizeof(WindowRec)); if (!pWin) return FALSE; @@ -405,6 +362,7 @@ CreateRootWindow(ScreenPtr pScreen) pWin->drawable.pScreen = pScreen; pWin->drawable.type = DRAWABLE_WINDOW; + pWin->devPrivates = NULL; pWin->drawable.depth = pScreen->rootDepth; for (format = screenInfo.formats; @@ -468,6 +426,12 @@ CreateRootWindow(ScreenPtr pScreen) pWin->border.pixel = pScreen->blackPixel; pWin->borderWidth = 0; + /* security creation/labeling check + */ + if (XaceHook(XACE_RESOURCE_ACCESS, serverClient, pWin->drawable.id, + RT_WINDOW, pWin, RT_NONE, NULL, DixCreateAccess)) + return FALSE; + if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer)pWin)) return FALSE; @@ -525,8 +489,6 @@ InitRootWindow(WindowPtr pWin) /* We SHOULD check for an error value here XXX */ (*pScreen->ChangeWindowAttributes)(pWin, backFlag); - XaceHook(XACE_WINDOW_INIT, serverClient, pWin); - MapWindow(pWin, serverClient); } @@ -691,13 +653,14 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w, return NullWindow; } - pWin = AllocateWindow(pScreen); + pWin = (WindowPtr)xalloc(sizeof(WindowRec)); if (!pWin) { *error = BadAlloc; return NullWindow; } pWin->drawable = pParent->drawable; + pWin->devPrivates = NULL; pWin->drawable.depth = depth; if (depth == pParent->drawable.depth) pWin->drawable.bitsPerPixel = pParent->drawable.bitsPerPixel; @@ -731,16 +694,18 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w, pWin->borderWidth = bw; - /* can't let untrusted clients have background None windows; - * they make it too easy to steal window contents + /* security creation/labeling check */ - if (XaceHook(XACE_BACKGRND_ACCESS, client, pWin)) - pWin->backgroundState = None; - else { - pWin->backgroundState = BackgroundPixel; - pWin->background.pixel = 0; + *error = XaceHook(XACE_RESOURCE_ACCESS, client, wid, RT_WINDOW, pWin, + RT_WINDOW, pWin->parent, DixCreateAccess|DixSetAttrAccess); + if (*error != Success) { + xfree(pWin); + return NullWindow; } + pWin->backgroundState = XaceBackgroundNoneState(pWin); + pWin->background.pixel = pScreen->whitePixel; + pWin->borderIsPixel = pParent->borderIsPixel; pWin->border = pParent->border; if (pWin->borderIsPixel == FALSE) @@ -759,8 +724,6 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w, REGION_NULL(pScreen, &pWin->winSize); REGION_NULL(pScreen, &pWin->borderSize); - XaceHook(XACE_WINDOW_INIT, client, pWin); - pHead = RealChildHead(pParent); if (pHead) { @@ -921,6 +884,7 @@ CrushTree(WindowPtr pWin) (*UnrealizeWindow)(pChild); } FreeWindowResources(pChild); + dixFreePrivates(pChild->devPrivates); xfree(pChild); if ( (pChild = pSib) ) break; @@ -970,11 +934,12 @@ DeleteWindow(pointer value, XID wid) if (pWin->prevSib) pWin->prevSib->nextSib = pWin->nextSib; } + dixFreePrivates(pWin->devPrivates); xfree(pWin); return Success; } -void +int DestroySubwindows(WindowPtr pWin, ClientPtr client) { /* XXX @@ -986,8 +951,15 @@ DestroySubwindows(WindowPtr pWin, ClientPtr client) * If you care, simply delete the call to UnmapSubwindows. */ UnmapSubwindows(pWin); - while (pWin->lastChild) + while (pWin->lastChild) { + int rc = XaceHook(XACE_RESOURCE_ACCESS, client, + pWin->lastChild->drawable.id, RT_WINDOW, + pWin->lastChild, RT_NONE, NULL, DixDestroyAccess); + if (rc != Success) + return rc; FreeResource(pWin->lastChild->drawable.id, RT_NONE); + } + return Success; } #define DeviceEventMasks (KeyPressMask | KeyReleaseMask | ButtonPressMask | \ @@ -1004,25 +976,20 @@ DestroySubwindows(WindowPtr pWin, ClientPtr client) _X_EXPORT int ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) { - Mask index2; XID *pVlist; PixmapPtr pPixmap; Pixmap pixID; CursorPtr pCursor, pOldCursor; Cursor cursorID; - WindowPtr pChild; + WindowPtr pChild, pLayerWin; Colormap cmap; ColormapPtr pCmap; xEvent xE; - int result; + int error, rc; ScreenPtr pScreen; - Mask vmaskCopy = 0; - Mask tmask; + Mask index2, tmask, vmaskCopy = 0; unsigned int val; - int error; - Bool checkOptional = FALSE; - Bool borderRelative = FALSE; - WindowPtr pLayerWin; + Bool checkOptional = FALSE, borderRelative = FALSE; if ((pWin->drawable.class == InputOnly) && (vmask & (~INPUTONLY_LEGAL_MASK))) return BadMatch; @@ -1044,17 +1011,13 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) borderRelative = TRUE; if (pixID == None) { - /* can't let untrusted clients have background None windows */ - if (XaceHook(XACE_BACKGRND_ACCESS, client, pWin)) { - if (pWin->backgroundState == BackgroundPixmap) - (*pScreen->DestroyPixmap)(pWin->background.pixmap); - if (!pWin->parent) - MakeRootTile(pWin); - else - pWin->backgroundState = None; - } else { - /* didn't change the backgrnd to None, so don't tell ddx */ - index2 = 0; + if (pWin->backgroundState == BackgroundPixmap) + (*pScreen->DestroyPixmap)(pWin->background.pixmap); + if (!pWin->parent) + MakeRootTile(pWin); + else { + pWin->backgroundState = XaceBackgroundNoneState(pWin); + pWin->background.pixel = pScreen->whitePixel; } } else if (pixID == ParentRelative) @@ -1077,9 +1040,9 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) } else { - pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pixID, - RT_PIXMAP, DixReadAccess); - if (pPixmap != (PixmapPtr) NULL) + rc = dixLookupResource((pointer *)&pPixmap, pixID, RT_PIXMAP, + client, DixReadAccess); + if (rc == Success) { if ((pPixmap->drawable.depth != pWin->drawable.depth) || (pPixmap->drawable.pScreen != pScreen)) @@ -1095,7 +1058,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) } else { - error = BadPixmap; + error = (rc == BadValue) ? BadPixmap : rc; client->errorValue = pixID; goto PatchUp; } @@ -1124,42 +1087,40 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) error = BadMatch; goto PatchUp; } - if (pWin->borderIsPixel == FALSE) - (*pScreen->DestroyPixmap)(pWin->border.pixmap); - pWin->border = pWin->parent->border; - if ((pWin->borderIsPixel = pWin->parent->borderIsPixel) == TRUE) - { + if (pWin->parent->borderIsPixel == TRUE) { + if (pWin->borderIsPixel == FALSE) + (*pScreen->DestroyPixmap)(pWin->border.pixmap); + pWin->border = pWin->parent->border; + pWin->borderIsPixel = TRUE; index2 = CWBorderPixel; + break; } else { - pWin->parent->border.pixmap->refcnt++; + pixID = pWin->parent->border.pixmap->drawable.id; } } - else - { - pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pixID, - RT_PIXMAP, DixReadAccess); - if (pPixmap) - { - if ((pPixmap->drawable.depth != pWin->drawable.depth) || - (pPixmap->drawable.pScreen != pScreen)) - { - error = BadMatch; - goto PatchUp; - } - if (pWin->borderIsPixel == FALSE) - (*pScreen->DestroyPixmap)(pWin->border.pixmap); - pWin->borderIsPixel = FALSE; - pWin->border.pixmap = pPixmap; - pPixmap->refcnt++; - } - else + rc = dixLookupResource((pointer *)&pPixmap, pixID, RT_PIXMAP, + client, DixReadAccess); + if (rc == Success) + { + if ((pPixmap->drawable.depth != pWin->drawable.depth) || + (pPixmap->drawable.pScreen != pScreen)) { - error = BadPixmap; - client->errorValue = pixID; + error = BadMatch; goto PatchUp; } + if (pWin->borderIsPixel == FALSE) + (*pScreen->DestroyPixmap)(pWin->border.pixmap); + pWin->borderIsPixel = FALSE; + pWin->border.pixmap = pPixmap; + pPixmap->refcnt++; + } + else + { + error = (rc == BadValue) ? BadPixmap : rc; + client->errorValue = pixID; + goto PatchUp; } break; case CWBorderPixel: @@ -1284,20 +1245,20 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) #endif /* DO_SAVE_UNDERS */ break; case CWEventMask: - result = EventSelectForWindow(pWin, client, (Mask )*pVlist); - if (result) + rc = EventSelectForWindow(pWin, client, (Mask )*pVlist); + if (rc) { - error = result; + error = rc; goto PatchUp; } pVlist++; break; case CWDontPropagate: - result = EventSuppressForWindow(pWin, client, (Mask )*pVlist, + rc = EventSuppressForWindow(pWin, client, (Mask )*pVlist, &checkOptional); - if (result) + if (rc) { - error = result; + error = rc; goto PatchUp; } pVlist++; @@ -1311,6 +1272,15 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) client->errorValue = val; goto PatchUp; } + if (val == xTrue) { + rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, + RT_WINDOW, pWin, RT_NONE, NULL, DixGrabAccess); + if (rc != Success) { + error = rc; + client->errorValue = pWin->drawable.id; + goto PatchUp; + } + } pWin->overrideRedirect = val; break; case CWColormap: @@ -1348,11 +1318,11 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) error = BadMatch; goto PatchUp; } - pCmap = (ColormapPtr)SecurityLookupIDByType(client, cmap, - RT_COLORMAP, DixReadAccess); - if (!pCmap) + rc = dixLookupResource((pointer *)&pCmap, cmap, RT_COLORMAP, + client, DixUseAccess); + if (rc != Success) { - error = BadColor; + error = (rc == BadValue) ? BadColor : rc; client->errorValue = cmap; goto PatchUp; } @@ -1424,11 +1394,11 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) } else { - pCursor = (CursorPtr)SecurityLookupIDByType(client, cursorID, - RT_CURSOR, DixReadAccess); - if (!pCursor) + rc = dixLookupResource((pointer *)&pCursor, cursorID, + RT_CURSOR, client, DixUseAccess); + if (rc != Success) { - error = BadCursor; + error = (rc == BadValue) ? BadCursor : rc; client->errorValue = cursorID; goto PatchUp; } @@ -1523,7 +1493,7 @@ PatchUp: REGION_NULL(pScreen, &exposed); REGION_SUBTRACT(pScreen, &exposed, &pWin->borderClip, &pWin->winSize); - (*pWin->drawable.pScreen->PaintWindowBorder)(pWin, &exposed, PW_BORDER); + miPaintWindow(pWin, &exposed, PW_BORDER); REGION_UNINIT(pScreen, &exposed); } return error; @@ -2185,7 +2155,7 @@ WhereDoIGoInTheStack( return pWin->nextSib; default: { - ErrorF("Internal error in ConfigureWindow, smode == %d\n",smode ); + /* should never happen; make something up. */ return pWin->nextSib; } } @@ -2261,7 +2231,7 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client) unsigned short w = pWin->drawable.width, h = pWin->drawable.height, bw = pWin->borderWidth; - int action, smode = Above; + int rc, action, smode = Above; #ifdef XAPPGROUP ClientPtr win_owner; ClientPtr ag_leader = NULL; @@ -2322,12 +2292,11 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client) case CWSibling: sibwid = (Window ) *pVlist; pVlist++; - pSib = (WindowPtr )SecurityLookupIDByType(client, sibwid, - RT_WINDOW, DixReadAccess); - if (!pSib) + rc = dixLookupWindow(&pSib, sibwid, client, DixGetAttrAccess); + if (rc != Success) { client->errorValue = sibwid; - return(BadWindow); + return rc; } if (pSib->parent != pParent) return(BadMatch); @@ -2774,8 +2743,9 @@ MapWindow(WindowPtr pWin, ClientPtr client) return(Success); /* general check for permission to map window */ - if (!XaceHook(XACE_MAP_ACCESS, client, pWin)) - return Success; + if (XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, RT_WINDOW, + pWin, RT_NONE, NULL, DixShowAccess) != Success) + return Success; pScreen = pWin->drawable.pScreen; if ( (pParent = pWin->parent) ) @@ -3032,9 +3002,6 @@ UnrealizeTree( deltaSaveUndersViewable--; #endif pChild->viewable = FALSE; - if (pChild->backStorage) - (*pChild->drawable.pScreen->SaveDoomedAreas)( - pChild, &pChild->clipList, 0, 0); (* MarkUnrealizedWindow)(pChild, pWin, fromConfigure); pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER; } @@ -3162,9 +3129,6 @@ UnmapSubwindows(WindowPtr pWin) #ifdef DO_SAVE_UNDERS pChild->DIXsaveUnder = FALSE; #endif /* DO_SAVE_UNDERS */ - if (pChild->backStorage) - (*pScreen->SaveDoomedAreas)( - pChild, &pChild->clipList, 0, 0); } } } @@ -3366,12 +3330,10 @@ static void DrawLogo( ); #endif -_X_EXPORT void -SaveScreens(int on, int mode) +_X_EXPORT int +dixSaveScreens(ClientPtr client, int on, int mode) { - int i; - int what; - int type; + int rc, i, what, type; if (on == SCREEN_SAVER_FORCER) { @@ -3390,6 +3352,13 @@ SaveScreens(int on, int mode) if (what == screenIsSaved) type = SCREEN_SAVER_CYCLE; } + + for (i = 0; i < screenInfo.numScreens; i++) { + rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i], + DixShowAccess | DixHideAccess); + if (rc != Success) + return rc; + } for (i = 0; i < screenInfo.numScreens; i++) { if (on == SCREEN_SAVER_FORCER) @@ -3477,6 +3446,13 @@ SaveScreens(int on, int mode) screenIsSaved = what; if (mode == ScreenSaverReset) SetScreenSaverTimer(); + return Success; +} + +_X_EXPORT int +SaveScreens(int on, int mode) +{ + return dixSaveScreens(serverClient, on, mode); } static Bool @@ -3538,7 +3514,8 @@ TileScreenSaver(int i, int kind) { for (j=0; j<BitmapBytePad(32)*16; j++) srcbits[j] = mskbits[j] = 0x0; - cursor = AllocCursor(srcbits, mskbits, &cm, 0, 0, 0, 0, 0, 0); + result = AllocARGBCursor(srcbits, mskbits, NULL, &cm, 0, 0, 0, 0, 0, 0, + &cursor, serverClient, (XID)0); if (cursor) { cursorID = FakeClientID(0); |