diff options
Diffstat (limited to 'xorg-server/hw/xquartz')
140 files changed, 11435 insertions, 6226 deletions
diff --git a/xorg-server/hw/xquartz/GL/Makefile.am b/xorg-server/hw/xquartz/GL/Makefile.am index 450ee5c5b..8f4478fec 100644 --- a/xorg-server/hw/xquartz/GL/Makefile.am +++ b/xorg-server/hw/xquartz/GL/Makefile.am @@ -10,4 +10,10 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/miext/damage libCGLCore_la_SOURCES = \ - indirect.c + indirect.c \ + capabilities.c \ + visualConfigs.c + +EXTRA_DIST = \ + capabilities.h \ + visualConfigs.h diff --git a/xorg-server/hw/xquartz/GL/Makefile.in b/xorg-server/hw/xquartz/GL/Makefile.in index 893c0123b..d4572abfe 100644 --- a/xorg-server/hw/xquartz/GL/Makefile.in +++ b/xorg-server/hw/xquartz/GL/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -43,7 +43,6 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ - $(top_builddir)/include/xgl-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ @@ -51,16 +50,14 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libCGLCore_la_LIBADD = -am_libCGLCore_la_OBJECTS = indirect.lo +am_libCGLCore_la_OBJECTS = indirect.lo capabilities.lo \ + visualConfigs.lo libCGLCore_la_OBJECTS = $(am_libCGLCore_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ @@ -75,8 +72,9 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ -APPDEFAULTDIR = @APPDEFAULTDIR@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@ +APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ @@ -97,10 +95,6 @@ CFLAGS = @CFLAGS@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DARWIN_LIBS = @DARWIN_LIBS@ DBUS_CFLAGS = @DBUS_CFLAGS@ @@ -122,6 +116,7 @@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ +DOLT_BASH = @DOLT_BASH@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ @@ -131,18 +126,15 @@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ -ECHO = @ECHO@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ -FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ -FREETYPE_LIBS = @FREETYPE_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ @@ -161,7 +153,7 @@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ -LAUNCHD = @LAUNCHD@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LEX = @LEX@ @@ -175,7 +167,10 @@ LIBTOOL = @LIBTOOL@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LINUXDOC = @LINUXDOC@ +LIPO = @LIPO@ LN_S = @LN_S@ +LTCOMPILE = @LTCOMPILE@ +LTCXXCOMPILE = @LTCXXCOMPILE@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -187,8 +182,7 @@ MESA_SOURCE = @MESA_SOURCE@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ -MKFONTDIR = @MKFONTDIR@ -MKFONTSCALE = @MKFONTSCALE@ +NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ @@ -197,8 +191,8 @@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -231,7 +225,6 @@ VENDOR_NAME = @VENDOR_NAME@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VENDOR_RELEASE = @VENDOR_RELEASE@ VERSION = @VERSION@ -X11APP_ARCHS = @X11APP_ARCHS@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ @@ -241,27 +234,12 @@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ -XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@ -XEGL_LIBS = @XEGL_LIBS@ -XEGL_SYS_LIBS = @XEGL_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ -XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGFILE = @XF86CONFIGFILE@ -XF86MISC_CFLAGS = @XF86MISC_CFLAGS@ -XF86MISC_LIBS = @XF86MISC_LIBS@ XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ -XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@ -XGLMODULES_LIBS = @XGLMODULES_LIBS@ -XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@ -XGLXMODULES_LIBS = @XGLXMODULES_LIBS@ -XGLX_LIBS = @XGLX_LIBS@ -XGLX_SYS_LIBS = @XGLX_SYS_LIBS@ -XGL_LIBS = @XGL_LIBS@ -XGL_MODULE_PATH = @XGL_MODULE_PATH@ -XGL_SYS_LIBS = @XGL_SYS_LIBS@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ @@ -272,10 +250,6 @@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ -XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@ -XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@ -XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@ -XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ @@ -284,13 +258,8 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ -XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ -XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ -XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ -XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ -XPRINT_CFLAGS = @XPRINT_CFLAGS@ -XPRINT_LIBS = @XPRINT_LIBS@ -XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ +XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ +XPBPROXY_LIBS = @XPBPROXY_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ @@ -323,8 +292,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -344,7 +312,6 @@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ -ft_config = @ft_config@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -354,12 +321,12 @@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ -launchagentsdir = @launchagentsdir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ +lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ @@ -377,8 +344,6 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -xglmoduledir = @xglmoduledir@ -xpconfigdir = @xpconfigdir@ noinst_LTLIBRARIES = libCGLCore.la AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS) AM_CPPFLAGS = \ @@ -391,7 +356,13 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/miext/damage libCGLCore_la_SOURCES = \ - indirect.c + indirect.c \ + capabilities.c \ + visualConfigs.c + +EXTRA_DIST = \ + capabilities.h \ + visualConfigs.h all: all-am @@ -401,8 +372,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ @@ -444,7 +415,9 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/capabilities.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indirect.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/visualConfigs.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -478,7 +451,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS diff --git a/xorg-server/hw/xquartz/GL/capabilities.c b/xorg-server/hw/xquartz/GL/capabilities.c new file mode 100644 index 000000000..bc3966f4b --- /dev/null +++ b/xorg-server/hw/xquartz/GL/capabilities.c @@ -0,0 +1,559 @@ +/* + * Copyright (c) 2008 Apple Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT HOLDER(S) 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. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <assert.h> +#include <OpenGL/OpenGL.h> +#include <OpenGL/gl.h> +#include <OpenGL/glu.h> +#include <OpenGL/glext.h> +#include <ApplicationServices/ApplicationServices.h> + +#include "capabilities.h" + +static void handleBufferModes(struct glCapabilitiesConfig *c, GLint bufferModes) { + if(bufferModes & kCGLStereoscopicBit) { + c->stereo = true; + } + + if(bufferModes & kCGLDoubleBufferBit) { + c->buffers = 2; + } else { + c->buffers = 1; + } +} + +static void handleStencilModes(struct glCapabilitiesConfig *c, GLint smodes) { + int offset = 0; + + if(kCGL0Bit & smodes) + c->stencil_bit_depths[offset++] = 0; + + if(kCGL1Bit & smodes) + c->stencil_bit_depths[offset++] = 1; + + if(kCGL2Bit & smodes) + c->stencil_bit_depths[offset++] = 2; + + if(kCGL3Bit & smodes) + c->stencil_bit_depths[offset++] = 3; + + if(kCGL4Bit & smodes) + c->stencil_bit_depths[offset++] = 4; + + if(kCGL5Bit & smodes) + c->stencil_bit_depths[offset++] = 5; + + if(kCGL6Bit & smodes) + c->stencil_bit_depths[offset++] = 6; + + if(kCGL8Bit & smodes) + c->stencil_bit_depths[offset++] = 8; + + if(kCGL10Bit & smodes) + c->stencil_bit_depths[offset++] = 10; + + if(kCGL12Bit & smodes) + c->stencil_bit_depths[offset++] = 12; + + if(kCGL16Bit & smodes) + c->stencil_bit_depths[offset++] = 16; + + if(kCGL24Bit & smodes) + c->stencil_bit_depths[offset++] = 24; + + if(kCGL32Bit & smodes) + c->stencil_bit_depths[offset++] = 32; + + if(kCGL48Bit & smodes) + c->stencil_bit_depths[offset++] = 48; + + if(kCGL64Bit & smodes) + c->stencil_bit_depths[offset++] = 64; + + if(kCGL96Bit & smodes) + c->stencil_bit_depths[offset++] = 96; + + if(kCGL128Bit & smodes) + c->stencil_bit_depths[offset++] = 128; + + assert(offset < GLCAPS_STENCIL_BIT_DEPTH_BUFFERS); + + c->total_stencil_bit_depths = offset; +} + +static int handleColorAndAccumulation(struct glColorBufCapabilities *c, + GLint cmodes) { + int offset = 0; + + /*1*/ + if(kCGLRGB444Bit & cmodes) { + c[offset].r = 4; + c[offset].g = 4; + c[offset].b = 4; + ++offset; + } + + /*2*/ + if(kCGLARGB4444Bit & cmodes) { + c[offset].a = 4; + c[offset].r = 4; + c[offset].g = 4; + c[offset].b = 4; + c[offset].is_argb = true; + ++offset; + } + + /*3*/ + if(kCGLRGB444A8Bit & cmodes) { + c[offset].r = 4; + c[offset].g = 4; + c[offset].b = 4; + c[offset].a = 8; + ++offset; + } + + /*4*/ + if(kCGLRGB555Bit & cmodes) { + c[offset].r = 5; + c[offset].g = 5; + c[offset].b = 5; + ++offset; + } + + /*5*/ + if(kCGLARGB1555Bit & cmodes) { + c[offset].a = 1; + c[offset].r = 5; + c[offset].g = 5; + c[offset].b = 5; + c[offset].is_argb = true; + ++offset; + } + + /*6*/ + if(kCGLRGB555A8Bit & cmodes) { + c[offset].r = 5; + c[offset].g = 5; + c[offset].b = 5; + c[offset].a = 8; + ++offset; + } + + /*7*/ + if(kCGLRGB565Bit & cmodes) { + c[offset].r = 5; + c[offset].g = 6; + c[offset].b = 5; + ++offset; + } + + /*8*/ + if(kCGLRGB565A8Bit & cmodes) { + c[offset].r = 5; + c[offset].g = 6; + c[offset].b = 5; + c[offset].a = 8; + ++offset; + } + + /*9*/ + if(kCGLRGB888Bit & cmodes) { + c[offset].r = 8; + c[offset].g = 8; + c[offset].b = 8; + ++offset; + } + + /*10*/ + if(kCGLARGB8888Bit & cmodes) { + c[offset].a = 8; + c[offset].r = 8; + c[offset].g = 8; + c[offset].b = 8; + c[offset].is_argb = true; + ++offset; + } + + /*11*/ + if(kCGLRGB888A8Bit & cmodes) { + c[offset].r = 8; + c[offset].g = 8; + c[offset].b = 8; + c[offset].a = 8; + ++offset; + } + +#if 0 + /* + * Disable this path, because some part of libGL, X, or Xplugin + * doesn't work with sizes greater than 8. + * When this is enabled and visuals are chosen using depths + * such as 16, the result is that the windows don't redraw + * and are often white, until a resize. + */ + + /*12*/ + if(kCGLRGB101010Bit & cmodes) { + c[offset].r = 10; + c[offset].g = 10; + c[offset].b = 10; + ++offset; + } + + /*13*/ + if(kCGLARGB2101010Bit & cmodes) { + c[offset].a = 2; + c[offset].r = 10; + c[offset].g = 10; + c[offset].b = 10; + c[offset].is_argb = true; + ++offset; + } + + /*14*/ + if(kCGLRGB101010_A8Bit & cmodes) { + c[offset].r = 10; + c[offset].g = 10; + c[offset].b = 10; + c[offset].a = 8; + ++offset; + } + + /*15*/ + if(kCGLRGB121212Bit & cmodes) { + c[offset].r = 12; + c[offset].g = 12; + c[offset].b = 12; + ++offset; + } + + /*16*/ + if(kCGLARGB12121212Bit & cmodes) { + c[offset].a = 12; + c[offset].r = 12; + c[offset].g = 12; + c[offset].b = 12; + c[offset].is_argb = true; + ++offset; + } + + /*17*/ + if(kCGLRGB161616Bit & cmodes) { + c[offset].r = 16; + c[offset].g = 16; + c[offset].b = 16; + ++offset; + } + + /*18*/ + if(kCGLRGBA16161616Bit & cmodes) { + c[offset].r = 16; + c[offset].g = 16; + c[offset].b = 16; + c[offset].a = 16; + ++offset; + } +#endif + + /* FIXME should we handle the floating point color modes, and if so, how? */ + + return offset; +} + + +static void handleColorModes(struct glCapabilitiesConfig *c, GLint cmodes) { + c->total_color_buffers = handleColorAndAccumulation(c->color_buffers, + cmodes); + + assert(c->total_color_buffers < GLCAPS_COLOR_BUFFERS); +} + +static void handleAccumulationModes(struct glCapabilitiesConfig *c, GLint cmodes) { + c->total_accum_buffers = handleColorAndAccumulation(c->accum_buffers, + cmodes); + assert(c->total_accum_buffers < GLCAPS_COLOR_BUFFERS); +} + +static void handleDepthModes(struct glCapabilitiesConfig *c, GLint dmodes) { + int offset = 0; +#define DEPTH(flag,value) do { \ + if(dmodes & flag) { \ + c->depth_buffers[offset++] = value; \ + } \ + } while(0) + + /*1*/ + DEPTH(kCGL0Bit, 0); + /*2*/ + DEPTH(kCGL1Bit, 1); + /*3*/ + DEPTH(kCGL2Bit, 2); + /*4*/ + DEPTH(kCGL3Bit, 3); + /*5*/ + DEPTH(kCGL4Bit, 4); + /*6*/ + DEPTH(kCGL5Bit, 5); + /*7*/ + DEPTH(kCGL6Bit, 6); + /*8*/ + DEPTH(kCGL8Bit, 8); + /*9*/ + DEPTH(kCGL10Bit, 10); + /*10*/ + DEPTH(kCGL12Bit, 12); + /*11*/ + DEPTH(kCGL16Bit, 16); + /*12*/ + DEPTH(kCGL24Bit, 24); + /*13*/ + DEPTH(kCGL32Bit, 32); + /*14*/ + DEPTH(kCGL48Bit, 48); + /*15*/ + DEPTH(kCGL64Bit, 64); + /*16*/ + DEPTH(kCGL96Bit, 96); + /*17*/ + DEPTH(kCGL128Bit, 128); + +#undef DEPTH + + c->total_depth_buffer_depths = offset; + assert(c->total_depth_buffer_depths < GLCAPS_DEPTH_BUFFERS); +} + +/* Return non-zero if an error occured. */ +static CGLError handleRendererDescriptions(CGLRendererInfoObj info, GLint r, + struct glCapabilitiesConfig *c) { + CGLError err; + GLint accelerated = 0, flags = 0, aux = 0, samplebufs = 0, samples = 0; + + err = CGLDescribeRenderer (info, r, kCGLRPAccelerated, &accelerated); + + if(err) + return err; + + c->accelerated = accelerated; + + /* Buffering modes: single/double, stereo */ + err = CGLDescribeRenderer(info, r, kCGLRPBufferModes, &flags); + + if(err) + return err; + + handleBufferModes(c, flags); + + /* AUX buffers */ + err = CGLDescribeRenderer(info, r, kCGLRPMaxAuxBuffers, &aux); + + if(err) + return err; + + c->aux_buffers = aux; + + + /* Depth buffer size */ + err = CGLDescribeRenderer(info, r, kCGLRPDepthModes, &flags); + + if(err) + return err; + + handleDepthModes(c, flags); + + + /* Multisample buffers */ + err = CGLDescribeRenderer(info, r, kCGLRPMaxSampleBuffers, &samplebufs); + + if(err) + return err; + + c->multisample_buffers = samplebufs; + + + /* Multisample samples per multisample buffer */ + err = CGLDescribeRenderer(info, r, kCGLRPMaxSamples, &samples); + + if(err) + return err; + + c->multisample_samples = samples; + + + /* Stencil bit depths */ + err = CGLDescribeRenderer(info, r, kCGLRPStencilModes, &flags); + + if(err) + return err; + + handleStencilModes(c, flags); + + + /* Color modes (RGB/RGBA depths supported */ + err = CGLDescribeRenderer(info, r, kCGLRPColorModes, &flags); + + if(err) + return err; + + handleColorModes(c, flags); + + err = CGLDescribeRenderer(info, r, kCGLRPAccumModes, &flags); + + if(err) + return err; + + handleAccumulationModes(c, flags); + + return 0; +} + +static void initCapabilities(struct glCapabilities *cap) { + cap->configurations = NULL; + cap->total_configurations = 0; +} + +static void initConfig(struct glCapabilitiesConfig *c) { + int i; + + c->accelerated = false; + c->stereo = false; + c->aux_buffers = 0; + c->buffers = 0; + + c->total_depth_buffer_depths = 0; + + for(i = 0; i < GLCAPS_DEPTH_BUFFERS; ++i) { + c->depth_buffers[i] = GLCAPS_INVALID_DEPTH_VALUE; + } + + c->multisample_buffers = 0; + c->multisample_samples = 0; + + c->total_stencil_bit_depths = 0; + + for(i = 0; i < GLCAPS_STENCIL_BIT_DEPTH_BUFFERS; ++i) { + c->stencil_bit_depths[i] = GLCAPS_INVALID_STENCIL_DEPTH; + } + + c->total_color_buffers = 0; + + for(i = 0; i < GLCAPS_COLOR_BUFFERS; ++i) { + c->color_buffers[i].r = c->color_buffers[i].g = + c->color_buffers[i].b = c->color_buffers[i].a = + GLCAPS_COLOR_BUF_INVALID_VALUE; + c->color_buffers[i].is_argb = false; + } + + c->total_accum_buffers = 0; + + for(i = 0; i < GLCAPS_COLOR_BUFFERS; ++i) { + c->accum_buffers[i].r = c->accum_buffers[i].g = + c->accum_buffers[i].b = c->accum_buffers[i].a = + GLCAPS_COLOR_BUF_INVALID_VALUE; + c->accum_buffers[i].is_argb = false; + } + + c->next = NULL; +} + +void freeGlCapabilities(struct glCapabilities *cap) { + struct glCapabilitiesConfig *conf, *next; + + conf = cap->configurations; + + while(conf) { + next = conf->next; + free(conf); + conf = next; + } + + cap->configurations = NULL; +} + +enum { MAX_DISPLAYS = 3 }; + +/*Return true if an error occured. */ +bool getGlCapabilities(struct glCapabilities *cap) { + CGDirectDisplayID dspys[MAX_DISPLAYS]; + CGDisplayErr err; + CGOpenGLDisplayMask displayMask; + CGDisplayCount i, displayCount = 0; + + initCapabilities(cap); + + err = CGGetActiveDisplayList(MAX_DISPLAYS, dspys, &displayCount); + if(err) { + fprintf(stderr, "CGGetActiveDisplayList error: %s\n", CGLErrorString(err)); + return true; + } + + for(i = 0; i < displayCount; ++i) { + displayMask = CGDisplayIDToOpenGLDisplayMask(dspys[i]); + + CGLRendererInfoObj info; + GLint numRenderers = 0, r, renderCount = 0; + + err = CGLQueryRendererInfo(displayMask, &info, &numRenderers); + + if(err) { + fprintf(stderr, "CGLQueryRendererInfo error: %s\n", CGLErrorString(err)); + fprintf(stderr, "trying to continue...\n"); + continue; + } + + CGLDescribeRenderer(info, 0, kCGLRPRendererCount, &renderCount); + + for(r = 0; r < renderCount; ++r) { + CGLError derr; + struct glCapabilitiesConfig tmpconf, *conf; + + initConfig(&tmpconf); + + derr = handleRendererDescriptions(info, r, &tmpconf); + if(derr) { + fprintf(stderr, "error: %s\n", CGLErrorString(derr)); + fprintf(stderr, "trying to continue...\n"); + continue; + } + + conf = malloc(sizeof(*conf)); + if(NULL == conf) { + perror("malloc"); + abort(); + } + + /* Copy the struct. */ + *conf = tmpconf; + + /* Now link the configuration into the list. */ + conf->next = cap->configurations; + cap->configurations = conf; + } + + CGLDestroyRendererInfo(info); + } + + /* No error occured. We are done. */ + return false; +} diff --git a/xorg-server/hw/xquartz/GL/capabilities.h b/xorg-server/hw/xquartz/GL/capabilities.h new file mode 100644 index 000000000..361856b07 --- /dev/null +++ b/xorg-server/hw/xquartz/GL/capabilities.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2008 Apple Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef CAPABILITIES_H +#define CAPABILITIES_H + +#include <stdbool.h> + +enum { GLCAPS_INVALID_STENCIL_DEPTH = -1 }; +enum { GLCAPS_COLOR_BUF_INVALID_VALUE = -1 }; +enum { GLCAPS_COLOR_BUFFERS = 20 }; +enum { GLCAPS_STENCIL_BIT_DEPTH_BUFFERS = 20 }; +enum { GLCAPS_DEPTH_BUFFERS = 20 }; +enum { GLCAPS_INVALID_DEPTH_VALUE = 1 }; + +struct glColorBufCapabilities { + char r, g, b, a; + bool is_argb; +}; + +struct glCapabilitiesConfig { + bool accelerated; + bool stereo; + int aux_buffers; + int buffers; + int total_depth_buffer_depths; + int depth_buffers[GLCAPS_DEPTH_BUFFERS]; + int multisample_buffers; + int multisample_samples; + int total_stencil_bit_depths; + char stencil_bit_depths[GLCAPS_STENCIL_BIT_DEPTH_BUFFERS]; + int total_color_buffers; + struct glColorBufCapabilities color_buffers[GLCAPS_COLOR_BUFFERS]; + int total_accum_buffers; + struct glColorBufCapabilities accum_buffers[GLCAPS_COLOR_BUFFERS]; + struct glCapabilitiesConfig *next; +}; + +struct glCapabilities { + struct glCapabilitiesConfig *configurations; + int total_configurations; +}; + +bool getGlCapabilities(struct glCapabilities *cap); +void freeGlCapabilities(struct glCapabilities *cap); + +#endif diff --git a/xorg-server/hw/xquartz/GL/indirect.c b/xorg-server/hw/xquartz/GL/indirect.c index 07a9c066a..0a60672b6 100644 --- a/xorg-server/hw/xquartz/GL/indirect.c +++ b/xorg-server/hw/xquartz/GL/indirect.c @@ -1,8 +1,8 @@ /* * GLX implementation that uses Apple's OpenGL.framework - * (Indirect rendering path) + * (Indirect rendering path -- it's also used for some direct mode code too) * - * Copyright (c) 2007 Apple Inc. + * Copyright (c) 2007, 2008, 2009 Apple Inc. * Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved. * Copyright (c) 2002 Greg Parker. All Rights Reserved. * @@ -37,6 +37,13 @@ #include "dri.h" +#include <AvailabilityMacros.h> + +/* + * These define seem questionable to me, but I'm not sure why they were here + * in the first place. + */ +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 #define GL_EXT_histogram 1 #define GL_EXT_polygon_offset 1 #define GL_SGIS_pixel_texture 1 @@ -53,11 +60,11 @@ #define GL_APPLE_fence 1 #define GL_IBM_multimode_draw_arrays 1 #define GL_EXT_fragment_shader 1 +#endif #include <OpenGL/OpenGL.h> #include <OpenGL/CGLContext.h> -// X11 and X11's glx #include <GL/gl.h> #include <GL/glxproto.h> #include <windowstr.h> @@ -76,17 +83,15 @@ #include "x-hash.h" #include "x-list.h" -#include <dispatch.h> -#define GLAPIENTRYP * +#include "capabilities.h" + typedef unsigned long long GLuint64EXT; typedef long long GLint64EXT; +#include <dispatch.h> #include <Xplugin.h> -#include "glcontextmodes.h" #include <glapi.h> #include <glapitable.h> -// ggs: needed to call back to glx with visual configs -extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **configprivs); __GLXprovider * GlxGetDRISWrastProvider (void); // Write debugging output, or not @@ -102,35 +107,27 @@ void warn_func(void * p1, char *format, ...); // some prototypes static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen); -static __GLXdrawable * __glXAquaScreenCreateDrawable(__GLXscreen *screen, DrawablePtr pDraw, XID drawId, __GLcontextModes *modes); - -static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, - int *rootDepthp, VisualID *defaultVisp, - unsigned long sizes, int bitsPerRGB); -static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates); +static __GLXdrawable * __glXAquaScreenCreateDrawable(__GLXscreen *screen, DrawablePtr pDraw, int type, XID drawId, __GLXconfig *conf); -static void glAquaResetExtension(void); static void __glXAquaContextDestroy(__GLXcontext *baseContext); static int __glXAquaContextMakeCurrent(__GLXcontext *baseContext); static int __glXAquaContextLoseCurrent(__GLXcontext *baseContext); static int __glXAquaContextForceCurrent(__GLXcontext *baseContext); static int __glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, unsigned long mask); -static CGLPixelFormatObj makeFormat(__GLcontextModes *mode); +static CGLPixelFormatObj makeFormat(__GLXconfig *conf); __GLXprovider __glXDRISWRastProvider = { - __glXAquaScreenProbe, - "Core OpenGL", + __glXAquaScreenProbe, + "Core OpenGL", NULL }; __GLXprovider * GlxGetDRISWRastProvider (void) { - GLAQUA_DEBUG_MSG("GlxGetDRISWRastProvider\n"); - return &__glXDRISWRastProvider; + GLAQUA_DEBUG_MSG("GlxGetDRISWRastProvider\n"); + return &__glXDRISWRastProvider; } typedef struct __GLXAquaScreen __GLXAquaScreen; @@ -138,86 +135,77 @@ typedef struct __GLXAquaContext __GLXAquaContext; typedef struct __GLXAquaDrawable __GLXAquaDrawable; struct __GLXAquaScreen { - __GLXscreen base; - int index; + __GLXscreen base; + int index; int num_vis; - __GLcontextModes *modes; }; -static __GLXAquaScreen glAquaScreens[MAXSCREENS]; - struct __GLXAquaContext { - __GLXcontext base; - CGLContextObj ctx; - CGLPixelFormatObj pixelFormat; - xp_surface_id sid; - unsigned isAttached :1; + __GLXcontext base; + CGLContextObj ctx; + CGLPixelFormatObj pixelFormat; + xp_surface_id sid; + unsigned isAttached :1; }; struct __GLXAquaDrawable { - __GLXdrawable base; + __GLXdrawable base; DrawablePtr pDraw; xp_surface_id sid; + __GLXAquaContext *context; }; + static __GLXcontext * __glXAquaScreenCreateContext(__GLXscreen *screen, - __GLcontextModes *modes, + __GLXconfig *conf, __GLXcontext *baseShareContext) { - __GLXAquaContext *context; - __GLXAquaContext *shareContext = (__GLXAquaContext *) baseShareContext; - CGLError gl_err; + __GLXAquaContext *context; + __GLXAquaContext *shareContext = (__GLXAquaContext *) baseShareContext; + CGLError gl_err; - GLAQUA_DEBUG_MSG("glXAquaScreenCreateContext\n"); - - context = malloc (sizeof (__GLXAquaContext)); - if (context == NULL) return NULL; - - memset(context, 0, sizeof *context); - - context->base.pGlxScreen = screen; - context->base.modes = modes; - - context->base.destroy = __glXAquaContextDestroy; - context->base.makeCurrent = __glXAquaContextMakeCurrent; - context->base.loseCurrent = __glXAquaContextLoseCurrent; - context->base.copy = __glXAquaContextCopy; - context->base.forceCurrent = __glXAquaContextForceCurrent; - // context->base.createDrawable = __glXAquaContextCreateDrawable; + GLAQUA_DEBUG_MSG("glXAquaScreenCreateContext\n"); + + context = xalloc (sizeof (__GLXAquaContext)); + + if (context == NULL) + return NULL; - context->pixelFormat = makeFormat(modes); - if (!context->pixelFormat) { - free(context); + memset(context, 0, sizeof *context); + + context->base.pGlxScreen = screen; + + context->base.destroy = __glXAquaContextDestroy; + context->base.makeCurrent = __glXAquaContextMakeCurrent; + context->base.loseCurrent = __glXAquaContextLoseCurrent; + context->base.copy = __glXAquaContextCopy; + context->base.forceCurrent = __glXAquaContextForceCurrent; + /*FIXME verify that the context->base is fully initialized. */ + + context->pixelFormat = makeFormat(conf); + + if (!context->pixelFormat) { + xfree(context); return NULL; - } - - context->ctx = NULL; - gl_err = CGLCreateContext(context->pixelFormat, - shareContext ? shareContext->ctx : NULL, - &context->ctx); + } - if (gl_err != 0) { - ErrorF("CGLCreateContext error: %s\n", CGLErrorString(gl_err)); - CGLDestroyPixelFormat(context->pixelFormat); - free(context); - return NULL; + context->ctx = NULL; + gl_err = CGLCreateContext(context->pixelFormat, + shareContext ? shareContext->ctx : NULL, + &context->ctx); + + if (gl_err != 0) { + ErrorF("CGLCreateContext error: %s\n", CGLErrorString(gl_err)); + CGLDestroyPixelFormat(context->pixelFormat); + xfree(context); + return NULL; } - setup_dispatch_table(); + + setup_dispatch_table(); GLAQUA_DEBUG_MSG("glAquaCreateContext done\n"); - return &context->base; -} - -static __GLXextensionInfo __glDDXExtensionInfo = { - GL_CORE_APPLE, - glAquaResetExtension, - glAquaInitVisuals, - glAquaSetVisualConfigs -}; - -void *__glXglDDXExtensionInfo(void) { - GLAQUA_DEBUG_MSG("glXAglDDXExtensionInfo\n"); - return &__glDDXExtensionInfo; + + return &context->base; } /* maps from surface id -> list of __GLcontext */ @@ -227,21 +215,23 @@ static void __glXAquaContextDestroy(__GLXcontext *baseContext) { x_list *lst; __GLXAquaContext *context = (__GLXAquaContext *) baseContext; - + GLAQUA_DEBUG_MSG("glAquaContextDestroy (ctx 0x%x)\n", (unsigned int) baseContext); if (context != NULL) { if (context->sid != 0 && surface_hash != NULL) { - lst = x_hash_table_lookup(surface_hash, (void *) context->sid, NULL); + lst = x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr(context->sid), NULL); lst = x_list_remove(lst, context); - x_hash_table_insert(surface_hash, (void *) context->sid, lst); + x_hash_table_insert(surface_hash, x_cvt_uint_to_vptr(context->sid), lst); } - if (context->ctx != NULL) CGLDestroyContext(context->ctx); + if (context->ctx != NULL) + CGLDestroyContext(context->ctx); - if (context->pixelFormat != NULL) CGLDestroyPixelFormat(context->pixelFormat); + if (context->pixelFormat != NULL) + CGLDestroyPixelFormat(context->pixelFormat); - free(context); + xfree(context); } } @@ -266,79 +256,95 @@ static void surface_notify(void *_arg, void *data) { __GLXAquaDrawable *draw = (__GLXAquaDrawable *)data; __GLXAquaContext *context; x_list *lst; - if(_arg == NULL || data == NULL) { - ErrorF("surface_notify called with bad params"); - return; - } + if(_arg == NULL || data == NULL) { + ErrorF("surface_notify called with bad params"); + return; + } GLAQUA_DEBUG_MSG("surface_notify(%p, %p)\n", _arg, data); switch (arg->kind) { case AppleDRISurfaceNotifyDestroyed: if (surface_hash != NULL) - x_hash_table_remove(surface_hash, (void *) arg->id); - draw->base.pDraw = NULL; - draw->sid = 0; + x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(arg->id)); + draw->base.pDraw = NULL; + draw->sid = 0; break; case AppleDRISurfaceNotifyChanged: if (surface_hash != NULL) { - lst = x_hash_table_lookup(surface_hash, (void *) arg->id, NULL); + lst = x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr(arg->id), NULL); for (; lst != NULL; lst = lst->next) - { + { context = lst->data; xp_update_gl_context(context->ctx); } } break; - default: - ErrorF("surface_notify: unknown kind %d\n", arg->kind); - break; + default: + ErrorF("surface_notify: unknown kind %d\n", arg->kind); + break; } } -static void attach(__GLXAquaContext *context, __GLXAquaDrawable *draw) { +static BOOL attach(__GLXAquaContext *context, __GLXAquaDrawable *draw) { DrawablePtr pDraw; - GLAQUA_DEBUG_MSG("attach(%p, %p)\n", context, draw); + + GLAQUA_DEBUG_MSG("attach(%p, %p)\n", context, draw); + + if(NULL == context || NULL == draw) + return TRUE; + pDraw = draw->base.pDraw; + if(NULL == pDraw) { + ErrorF("%s:%s() pDraw is NULL!\n", __FILE__, __func__); + return TRUE; + } + if (draw->sid == 0) { -// if (!quartzProcs->CreateSurface(pDraw->pScreen, pDraw->id, pDraw, + //if (!quartzProcs->CreateSurface(pDraw->pScreen, pDraw->id, pDraw, if (!DRICreateSurface(pDraw->pScreen, pDraw->id, pDraw, - 0, &draw->sid, NULL, - surface_notify, draw)) - return; + 0, &draw->sid, NULL, + surface_notify, draw)) + return TRUE; draw->pDraw = pDraw; - } - + } + if (!context->isAttached || context->sid != draw->sid) { x_list *lst; - + if (xp_attach_gl_context(context->ctx, draw->sid) != Success) { -// quartzProcs->DestroySurface(pDraw->pScreen, pDraw->id, pDraw, + //quartzProcs->DestroySurface(pDraw->pScreen, pDraw->id, pDraw, DRIDestroySurface(pDraw->pScreen, pDraw->id, pDraw, - surface_notify, draw); + surface_notify, draw); if (surface_hash != NULL) - x_hash_table_remove(surface_hash, (void *) draw->sid); - + x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(draw->sid)); + draw->sid = 0; - return; + return TRUE; } - + context->isAttached = TRUE; context->sid = draw->sid; - + if (surface_hash == NULL) surface_hash = x_hash_table_new(NULL, NULL, NULL, NULL); - - lst = x_hash_table_lookup(surface_hash, (void *) context->sid, NULL); + + lst = x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr(context->sid), NULL); if (x_list_find(lst, context) == NULL) { lst = x_list_prepend(lst, context); - x_hash_table_insert(surface_hash, (void *) context->sid, lst); + x_hash_table_insert(surface_hash, x_cvt_uint_to_vptr(context->sid), lst); } + + GLAQUA_DEBUG_MSG("attached 0x%x to 0x%x\n", (unsigned int) pDraw->id, (unsigned int) draw->sid); } + + draw->context = context; + + return FALSE; } #if 0 // unused @@ -368,11 +374,12 @@ static void unattach(__GLXAquaContext *context) { static int __glXAquaContextMakeCurrent(__GLXcontext *baseContext) { CGLError gl_err; __GLXAquaContext *context = (__GLXAquaContext *) baseContext; - __GLXAquaDrawable *drawPriv = (__GLXAquaDrawable *) context->base.drawPriv; - + __GLXAquaDrawable *drawPriv = (__GLXAquaDrawable *) context->base.drawPriv; + GLAQUA_DEBUG_MSG("glAquaMakeCurrent (ctx 0x%p)\n", baseContext); - attach(context, drawPriv); + if(attach(context, drawPriv)) + return /*error*/ 0; gl_err = CGLSetCurrentContext(context->ctx); if (gl_err != 0) @@ -412,797 +419,388 @@ static int __glXAquaContextForceCurrent(__GLXcontext *baseContext) /* Drawing surface notification callbacks */ -static GLboolean __glXAquaDrawableResize(__GLXdrawable *base) { - GLAQUA_DEBUG_MSG("unimplemented glAquaDrawableResize\n"); - return GL_TRUE; -} - static GLboolean __glXAquaDrawableSwapBuffers(__GLXdrawable *base) { - CGLError gl_err; - __GLXAquaContext * drawableCtx; -// GLAQUA_DEBUG_MSG("glAquaDrawableSwapBuffers(%p)\n",base); + CGLError err; + __GLXAquaDrawable *drawable; + + // GLAQUA_DEBUG_MSG("glAquaDrawableSwapBuffers(%p)\n",base); - if(!base) { - ErrorF("glXAquaDrawbleSwapBuffers passed NULL\n"); - return GL_FALSE; - } - - drawableCtx = (__GLXAquaContext *)base->drawGlxc; - - if (drawableCtx != NULL && drawableCtx->ctx != NULL) { - gl_err = CGLFlushDrawable(drawableCtx->ctx); - if (gl_err != 0) - ErrorF("CGLFlushDrawable error: %s\n", CGLErrorString(gl_err)); + if(!base) { + ErrorF("%s passed NULL\n", __func__); + return GL_FALSE; } - return GL_TRUE; -} -static CGLPixelFormatObj makeFormat(__GLcontextModes *mode) { - int i; - CGLPixelFormatAttribute attr[64]; // currently uses max of 30 - CGLPixelFormatObj result; - GLint n_formats; - CGLError gl_err; - - GLAQUA_DEBUG_MSG("makeFormat\n"); - - if (!mode->rgbMode) - return NULL; - - i = 0; - - // attr [i++] = kCGLPFAAcelerated; // require hwaccel - BAD for multiscreen - // attr [i++] = kCGLPFANoRecovery; // disable fallback renderers - BAD - - if (mode->stereoMode) { - attr[i++] = kCGLPFAStereo; - } - if (mode->doubleBufferMode) { - attr[i++] = kCGLPFADoubleBuffer; - } + drawable = (__GLXAquaDrawable *)base; - if (mode->colorIndexMode) { - /* ignored */ + if(NULL == drawable->context) { + ErrorF("%s called with a NULL->context for drawable %p!\n", + __func__, (void *)drawable); + return GL_FALSE; } - if (mode->rgbMode) { - attr[i++] = kCGLPFAColorSize; - attr[i++] = mode->redBits + mode->greenBits + mode->blueBits; - attr[i++] = kCGLPFAAlphaSize; - attr[i++] = 1; /* FIXME: ignoring mode->alphaBits which is always 0 */ - } + err = CGLFlushDrawable(drawable->context->ctx); - if (mode->haveAccumBuffer) { - attr[i++] = kCGLPFAAccumSize; - attr[i++] = mode->accumRedBits + mode->accumGreenBits - + mode->accumBlueBits + mode->accumAlphaBits; - } - - if (mode->haveDepthBuffer) { - attr[i++] = kCGLPFADepthSize; - attr[i++] = mode->depthBits; + if(kCGLNoError != err) { + ErrorF("CGLFlushDrawable error: %s in %s\n", CGLErrorString(err), + __func__); + return GL_FALSE; } - - if (mode->haveStencilBuffer) { - attr[i++] = kCGLPFAStencilSize; - attr[i++] = mode->stencilBits; - } - - attr[i++] = kCGLPFAAuxBuffers; - attr[i++] = mode->numAuxBuffers; - - /* mode->level ignored */ - - /* mode->pixmapMode ? */ - - attr[i++] = 0; - - GLAQUA_DEBUG_MSG("makeFormat almost done\n"); - - result = NULL; - gl_err = CGLChoosePixelFormat(attr, &result, &n_formats); - if (gl_err != 0) - ErrorF("CGLChoosePixelFormat error: %s\n", CGLErrorString(gl_err)); - - GLAQUA_DEBUG_MSG("makeFormat done (0x%x)\n", (unsigned int) result); - return result; + return GL_TRUE; } -// Originally copied from Mesa - -static int numConfigs = 0; -static __GLXvisualConfig *visualConfigs = NULL; -static void **visualPrivates = NULL; - -/* - * In the case the driver defines no GLX visuals we'll use these. - * Note that for TrueColor and DirectColor visuals, bufferSize is the - * sum of redSize, greenSize, blueSize and alphaSize, which may be larger - * than the nplanes/rootDepth of the server's X11 visuals - */ -#define NUM_FALLBACK_CONFIGS 5 -static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = { - /* [0] = RGB, double buffered, Z */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [1] = RGB, double buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 16, 16, 16, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [2] = RGB+Alpha, double buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 8, /* rgba sizes */ - -1, -1, -1, -1, /* rgba masks */ - 16, 16, 16, 16, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [3] = RGB+Alpha, single buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 8, /* rgba sizes */ - -1, -1, -1, -1, /* rgba masks */ - 16, 16, 16, 16, /* rgba accum sizes */ - False, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [4] = CI, double buffered, Z */ - { - -1, /* vid */ - -1, /* class */ - False, /* rgba? (false = color index) */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, -}; - -static __GLXvisualConfig NullConfig = { - -1, /* vid */ - -1, /* class */ - False, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - False, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE_EXT, /* visualRating */ - 0, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ -}; +static CGLPixelFormatObj makeFormat(__GLXconfig *conf) { + CGLPixelFormatAttribute attr[64]; + CGLPixelFormatObj fobj; + GLint formats; + CGLError error; + int i = 0; + + if(conf->doubleBufferMode) + attr[i++] = kCGLPFADoubleBuffer; -static inline int count_bits(uint32_t x) -{ - x = x - ((x >> 1) & 0x55555555); - x = (x & 0x33333333) + ((x >> 2) & 0x33333333); - x = (x + (x >> 4)) & 0x0f0f0f0f; - x = x + (x >> 8); - x = x + (x >> 16); - return x & 63; -} + if(conf->stereoMode) + attr[i++] = kCGLPFAStereo; + attr[i++] = kCGLPFAColorSize; + attr[i++] = conf->redBits + conf->greenBits + conf->blueBits; + attr[i++] = kCGLPFAAlphaSize; + attr[i++] = conf->alphaBits; -static Bool init_visuals(int *nvisualp, VisualPtr *visualp, - VisualID *defaultVisp, - int ndepth, DepthPtr pdepth, - int rootDepth) -{ - int numRGBconfigs; - int numCIconfigs; - int numVisuals = *nvisualp; - int numNewVisuals; - int numNewConfigs; - VisualPtr pVisual = *visualp; - VisualPtr pVisualNew = NULL; - VisualID *orig_vid = NULL; - __GLcontextModes *modes; - __GLXvisualConfig *pNewVisualConfigs = NULL; - void **glXVisualPriv; - void **pNewVisualPriv; - int found_default; - int i, j, k; - - GLAQUA_DEBUG_MSG("init_visuals\n"); - - if (numConfigs > 0) - numNewConfigs = numConfigs; - else - numNewConfigs = NUM_FALLBACK_CONFIGS; - - /* Alloc space for the list of new GLX visuals */ - pNewVisualConfigs = (__GLXvisualConfig *) - malloc(numNewConfigs * sizeof(__GLXvisualConfig)); - if (!pNewVisualConfigs) { - return FALSE; - } + if((conf->accumRedBits + conf->accumGreenBits + conf->accumBlueBits + + conf->accumAlphaBits) > 0) { - /* Alloc space for the list of new GLX visual privates */ - pNewVisualPriv = (void **) malloc(numNewConfigs * sizeof(void *)); - if (!pNewVisualPriv) { - free(pNewVisualConfigs); - return FALSE; + attr[i++] = kCGLPFAAccumSize; + attr[i++] = conf->accumRedBits + conf->accumGreenBits + + conf->accumBlueBits + conf->accumAlphaBits; } + + attr[i++] = kCGLPFADepthSize; + attr[i++] = conf->depthBits; - /* - ** If SetVisualConfigs was not called, then use default GLX - ** visual configs. - */ - if (numConfigs == 0) { - memcpy(pNewVisualConfigs, FallbackConfigs, - NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig)); - memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *)); + if(conf->stencilBits) { + attr[i++] = kCGLPFAStencilSize; + attr[i++] = conf->stencilBits; } - else { - /* copy driver's visual config info */ - for (i = 0; i < numConfigs; i++) { - pNewVisualConfigs[i] = visualConfigs[i]; - pNewVisualPriv[i] = visualPrivates[i]; - } - } - - /* Count the number of RGB and CI visual configs */ - numRGBconfigs = 0; - numCIconfigs = 0; - for (i = 0; i < numNewConfigs; i++) { - if (pNewVisualConfigs[i].rgba) - numRGBconfigs++; - else - numCIconfigs++; + + if(conf->numAuxBuffers > 0) { + attr[i++] = kCGLPFAAuxBuffers; + attr[i++] = conf->numAuxBuffers; } - /* Count the total number of visuals to compute */ - numNewVisuals = 0; - for (i = 0; i < numVisuals; i++) { - int count; - - count = ((pVisual[i].class == TrueColor || - pVisual[i].class == DirectColor) - ? numRGBconfigs : numCIconfigs); - if (count == 0) - count = 1; /* preserve the existing visual */ - - numNewVisuals += count; + if(conf->sampleBuffers > 0) { + attr[i++] = kCGLPFASampleBuffers; + attr[i++] = conf->sampleBuffers; + attr[i++] = kCGLPFASamples; + attr[i++] = conf->samples; } + + attr[i++] = 0; - /* Reset variables for use with the next screen/driver's visual configs */ - visualConfigs = NULL; - numConfigs = 0; - - /* Alloc temp space for the list of orig VisualIDs for each new visual */ - orig_vid = (VisualID *)malloc(numNewVisuals * sizeof(VisualID)); - if (!orig_vid) { - free(pNewVisualPriv); - free(pNewVisualConfigs); - return FALSE; + error = CGLChoosePixelFormat(attr, &fobj, &formats); + if(error) { + ErrorF("error: creating pixel format %s\n", CGLErrorString(error)); + return NULL; } - /* Alloc space for the list of glXVisuals */ - modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes)); - if (modes == NULL) { - free(orig_vid); - free(pNewVisualPriv); - free(pNewVisualConfigs); - return FALSE; - } + return fobj; +} - /* Alloc space for the list of glXVisualPrivates */ - glXVisualPriv = (void **)malloc(numNewVisuals * sizeof(void *)); - if (!glXVisualPriv) { - _gl_context_modes_destroy( modes ); - free(orig_vid); - free(pNewVisualPriv); - free(pNewVisualConfigs); - return FALSE; - } +static void __glXAquaScreenDestroy(__GLXscreen *screen) { - /* Alloc space for the new list of the X server's visuals */ - pVisualNew = (VisualPtr)malloc(numNewVisuals * sizeof(VisualRec)); - if (!pVisualNew) { - free(glXVisualPriv); - _gl_context_modes_destroy( modes ); - free(orig_vid); - free(pNewVisualPriv); - free(pNewVisualConfigs); - return FALSE; - } + GLAQUA_DEBUG_MSG("glXAquaScreenDestroy(%p)\n", screen); + __glXScreenDestroy(screen); - /* Initialize the new visuals */ - found_default = FALSE; - glAquaScreens[screenInfo.numScreens-1].modes = modes; - for (i = j = 0; i < numVisuals; i++) { - int is_rgb = (pVisual[i].class == TrueColor || - pVisual[i].class == DirectColor); - - if (!is_rgb) - { - /* We don't support non-rgb visuals for GL. But we don't - want to remove them either, so just pass them through - with null glX configs */ - - pVisualNew[j] = pVisual[i]; - pVisualNew[j].vid = FakeClientID(0); - - /* Check for the default visual */ - if (!found_default && pVisual[i].vid == *defaultVisp) { - *defaultVisp = pVisualNew[j].vid; - found_default = TRUE; - } + xfree(screen); +} - /* Save the old VisualID */ - orig_vid[j] = pVisual[i].vid; +static __GLXconfig *CreateConfigs(int *numConfigsPtr, int screenNumber) { + __GLXconfig *c, *result; + struct glCapabilities cap; + struct glCapabilitiesConfig *conf = NULL; + int numConfigs = 0; + int i; - /* Initialize the glXVisual */ - _gl_copy_visual_to_context_mode( modes, & NullConfig ); - modes->visualID = pVisualNew[j].vid; + if(getGlCapabilities(&cap)) + FatalError("error from getGlCapabilities() in %s\n", __func__); - j++; + assert(NULL != cap.configurations); + for(conf = cap.configurations; conf; conf = conf->next) { + if(conf->total_color_buffers <= 0) continue; - } - - for (k = 0; k < numNewConfigs; k++) { - if (pNewVisualConfigs[k].rgba != is_rgb) - continue; - - assert( modes != NULL ); - - /* Initialize the new visual */ - pVisualNew[j] = pVisual[i]; - pVisualNew[j].vid = FakeClientID(0); - - /* Check for the default visual */ - if (!found_default && pVisual[i].vid == *defaultVisp) { - *defaultVisp = pVisualNew[j].vid; - found_default = TRUE; - } - - /* Save the old VisualID */ - orig_vid[j] = pVisual[i].vid; - - /* Initialize the glXVisual */ - _gl_copy_visual_to_context_mode( modes, & pNewVisualConfigs[k] ); - modes->visualID = pVisualNew[j].vid; - - /* - * If the class is -1, then assume the X visual information - * is identical to what GLX needs, and take them from the X - * visual. NOTE: if class != -1, then all other fields MUST - * be initialized. - */ - if (modes->visualType == GLX_NONE) { - modes->visualType = _gl_convert_from_x_visual_type( pVisual[i].class ); - modes->redBits = count_bits(pVisual[i].redMask); - modes->greenBits = count_bits(pVisual[i].greenMask); - modes->blueBits = count_bits(pVisual[i].blueMask); - modes->alphaBits = modes->alphaBits; - modes->redMask = pVisual[i].redMask; - modes->greenMask = pVisual[i].greenMask; - modes->blueMask = pVisual[i].blueMask; - modes->alphaMask = modes->alphaMask; - modes->rgbBits = (is_rgb) - ? (modes->redBits + modes->greenBits + - modes->blueBits + modes->alphaBits) - : rootDepth; - } - - /* Save the device-dependent private for this visual */ - glXVisualPriv[j] = pNewVisualPriv[k]; - j++; - modes = modes->next; - } - } - - assert(j <= numNewVisuals); - - /* Save the GLX visuals in the screen structure */ - glAquaScreens[screenInfo.numScreens-1].num_vis = numNewVisuals; - // glAquaScreens[screenInfo.numScreens-1].priv = glXVisualPriv; - - /* set up depth's VisualIDs */ - for (i = 0; i < ndepth; i++) { - int numVids = 0; - VisualID *pVids = NULL; - int k, n = 0; - - /* Count the new number of VisualIDs at this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - numVids++; - - /* Allocate a new list of VisualIDs for this depth */ - pVids = (VisualID *)malloc(numVids * sizeof(VisualID)); - - /* Initialize the new list of VisualIDs for this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - pVids[n++] = pVisualNew[k].vid; - - /* Update this depth's list of VisualIDs */ - free(pdepth[i].vids); - pdepth[i].vids = pVids; - pdepth[i].numVids = numVids; + numConfigs += (conf->stereo ? 2 : 1) + * (conf->aux_buffers ? 2 : 1) + * conf->buffers + * ((conf->total_stencil_bit_depths > 0) ? + conf->total_stencil_bit_depths : 1) + * conf->total_color_buffers + * ((conf->total_accum_buffers > 0) ? conf->total_accum_buffers : 1) + * conf->total_depth_buffer_depths + * (conf->multisample_buffers + 1); } - /* Update the X server's visuals */ - *nvisualp = numNewVisuals; - *visualp = pVisualNew; - - /* Free the old list of the X server's visuals */ - free(pVisual); - - /* Clean up temporary allocations */ - free(orig_vid); - free(pNewVisualPriv); - free(pNewVisualConfigs); - - /* Free the private list created by DDX HW driver */ - if (visualPrivates) - free(visualPrivates); - visualPrivates = NULL; + *numConfigsPtr = numConfigs; + + c = xalloc(sizeof(*c) * numConfigs); + + if(NULL == c) + return NULL; - return TRUE; -} + -Bool enable_stereo = FALSE; -/* based on code in i830_dri.c - This ends calling glAquaSetVisualConfigs to set the static - numconfigs, etc. */ -static void -glAquaInitVisualConfigs(void) -{ - int lclNumConfigs = 0; - __GLXvisualConfig *lclVisualConfigs = NULL; - void **lclVisualPrivates = NULL; + result = c; + + memset(result, 0, sizeof(*c) * numConfigs); - int stereo, depth, aux, buffers, stencil, accum; - int i = 0; + i = 0; - GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs "); - - /* count num configs: - 2 stereo (on, off) (optional) - 2 Z buffer (0, 24 bit) - 2 AUX buffer (0, 2) - 2 buffers (single, double) - 2 stencil (0, 8 bit) - 2 accum (0, 64 bit) - = 64 configs with stereo, or 32 without */ - - if (enable_stereo) lclNumConfigs = 2 * 2 * 2 * 2 * 2 * 2; /* 64 */ - else lclNumConfigs = 2 * 2 * 2 * 2 * 2; /* 32 */ - - /* alloc */ - lclVisualConfigs = xcalloc(sizeof(__GLXvisualConfig), lclNumConfigs); - lclVisualPrivates = xcalloc(sizeof(void *), lclNumConfigs); - - /* fill in configs */ - if (NULL != lclVisualConfigs) { - i = 0; /* current buffer */ - for (stereo = 0; stereo < (enable_stereo ? 2 : 1); stereo++) { - for (depth = 0; depth < 2; depth++) { - for (aux = 0; aux < 2; aux++) { - for (buffers = 0; buffers < 2; buffers++) { - for (stencil = 0; stencil < 2; stencil++) { - for (accum = 0; accum < 2; accum++) { - lclVisualConfigs[i].vid = -1; - lclVisualConfigs[i].class = -1; - lclVisualConfigs[i].rgba = TRUE; - lclVisualConfigs[i].redSize = -1; - lclVisualConfigs[i].greenSize = -1; - lclVisualConfigs[i].blueSize = -1; - lclVisualConfigs[i].redMask = -1; - lclVisualConfigs[i].greenMask = -1; - lclVisualConfigs[i].blueMask = -1; - lclVisualConfigs[i].alphaMask = 0; - if (accum) { - lclVisualConfigs[i].accumRedSize = 16; - lclVisualConfigs[i].accumGreenSize = 16; - lclVisualConfigs[i].accumBlueSize = 16; - lclVisualConfigs[i].accumAlphaSize = 16; - } else { - lclVisualConfigs[i].accumRedSize = 0; - lclVisualConfigs[i].accumGreenSize = 0; - lclVisualConfigs[i].accumBlueSize = 0; - lclVisualConfigs[i].accumAlphaSize = 0; + for(conf = cap.configurations; conf; conf = conf->next) { + int stereo, aux, buffers, stencil, color, accum, depth, msample; + + for(stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) { + for(aux = 0; aux < (conf->aux_buffers ? 2 : 1); ++aux) { + for(buffers = 0; buffers < conf->buffers; ++buffers) { + for(stencil = 0; stencil < ((conf->total_stencil_bit_depths > 0) ? + conf->total_stencil_bit_depths : 1); ++stencil) { + for(color = 0; color < conf->total_color_buffers; ++color) { + for(accum = 0; accum < ((conf->total_accum_buffers > 0) ? + conf->total_accum_buffers : 1); ++accum) { + for(depth = 0; depth < conf->total_depth_buffer_depths; ++depth) { + for(msample = 0; msample < (conf->multisample_buffers + 1); ++msample) { + if((i + 1) < numConfigs) { + c->next = c + 1; + } else { + c->next = NULL; + } + + c->doubleBufferMode = buffers ? GL_TRUE : GL_FALSE; + c->stereoMode = stereo ? GL_TRUE : GL_FALSE; + + c->redBits = conf->color_buffers[color].r; + c->greenBits = conf->color_buffers[color].g; + c->blueBits = conf->color_buffers[color].b; + c->alphaBits = 0; + + if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->color_buffers[color].a) { + c->alphaBits = conf->color_buffers[color].a; + } + + c->redMask = -1; + c->greenMask = -1; + c->blueMask = -1; + c->alphaMask = -1; + + c->rgbBits = c->redBits + c->greenBits + c->blueBits + c->alphaBits; + c->indexBits = 0; + + c->accumRedBits = 0; + c->accumGreenBits = 0; + c->accumBlueBits = 0; + c->accumAlphaBits = 0; + + if(conf->total_accum_buffers > 0) { + c->accumRedBits = conf->accum_buffers[accum].r; + c->accumGreenBits = conf->accum_buffers[accum].g; + c->accumBlueBits = conf->accum_buffers[accum].b; + if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->accum_buffers[accum].a) { + c->accumAlphaBits = conf->accum_buffers[accum].a; + } + } + + c->depthBits = conf->depth_buffers[depth]; + + c->stencilBits = 0; + + if(conf->total_stencil_bit_depths > 0) { + c->stencilBits = conf->stencil_bit_depths[stencil]; + } + + + c->numAuxBuffers = aux ? conf->aux_buffers : 0; + + c->level = 0; + /*TODO what should this be? */ + c->pixmapMode = 0; + + c->visualID = -1; + c->visualType = GLX_TRUE_COLOR; + + if(conf->accelerated) { + c->visualRating = GLX_NONE; + } else { + c->visualRating = GLX_SLOW_VISUAL_EXT; + } + + c->transparentPixel = GLX_NONE; + c->transparentRed = GLX_NONE; + c->transparentGreen = GLX_NONE; + c->transparentAlpha = GLX_NONE; + c->transparentIndex = GLX_NONE; + + c->sampleBuffers = 0; + c->samples = 0; + + if(msample > 0) { + c->sampleBuffers = conf->multisample_buffers; + c->samples = conf->multisample_samples; + } + + /* SGIX_fbconfig / GLX 1.3 */ + c->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT; + c->renderType = GLX_RGBA_BIT; + c->xRenderable = GL_TRUE; + c->fbconfigID = -1; + + /*TODO add querying code to capabilities.c for the Pbuffer maximums. + *I'm not sure we can even use CGL for Pbuffers yet... + */ + /* SGIX_pbuffer / GLX 1.3 */ + c->maxPbufferWidth = 0; + c->maxPbufferHeight = 0; + c->maxPbufferPixels = 0; + c->optimalPbufferWidth = 0; + c->optimalPbufferHeight = 0; + c->visualSelectGroup = 0; + + c->swapMethod = GLX_SWAP_UNDEFINED_OML; + + c->screen = screenNumber; + + /* EXT_texture_from_pixmap */ + c->bindToTextureRgb = 0; + c->bindToTextureRgba = 0; + c->bindToMipmapTexture = 0; + c->bindToTextureTargets = 0; + c->yInverted = 0; + + if(c->next) + c = c->next; + + ++i; + } + } + } + } } - lclVisualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE; - lclVisualConfigs[i].stereo = stereo ? TRUE : FALSE; - lclVisualConfigs[i].bufferSize = -1; - - lclVisualConfigs[i].depthSize = depth? 24 : 0; - lclVisualConfigs[i].stencilSize = stencil ? 8 : 0; - lclVisualConfigs[i].auxBuffers = aux ? 2 : 0; - lclVisualConfigs[i].level = 0; - lclVisualConfigs[i].visualRating = GLX_NONE_EXT; - lclVisualConfigs[i].transparentPixel = 0; - lclVisualConfigs[i].transparentRed = 0; - lclVisualConfigs[i].transparentGreen = 0; - lclVisualConfigs[i].transparentBlue = 0; - lclVisualConfigs[i].transparentAlpha = 0; - lclVisualConfigs[i].transparentIndex = 0; - i++; - } } - } - } - } + } } } - if (i != lclNumConfigs) - GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs failed to alloc visual configs"); - - GlxSetVisualConfigs(lclNumConfigs, lclVisualConfigs, lclVisualPrivates); -} - -static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates) -{ - GLAQUA_DEBUG_MSG("glAquaSetVisualConfigs\n"); - - numConfigs = nconfigs; - visualConfigs = configs; - visualPrivates = privates; -} - -static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, - int *rootDepthp, VisualID *defaultVisp, - unsigned long sizes, int bitsPerRGB) -{ - GLAQUA_DEBUG_MSG("glAquaInitVisuals\n"); + if(i != numConfigs) + FatalError("The number of __GLXconfig generated does not match the initial calculation!\n"); - if (numConfigs == 0) /* if no configs */ - glAquaInitVisualConfigs(); /* ensure the visual configs are setup */ - /* - * setup the visuals supported by this particular screen. - */ - return init_visuals(nvisualp, visualp, defaultVisp, - *ndepthp, *depthp, *rootDepthp); -} - -#if 0 -static void fixup_visuals(int screen) -{ - ScreenPtr pScreen = screenInfo.screens[screen]; - glAquaScreenRec *pScr = &glAquaScreens[screen]; - int j; - __GLcontextModes *modes; - - GLAQUA_DEBUG_MSG("fixup_visuals\n"); - - for ( modes = pScr->modes ; modes != NULL ; modes = modes->next ) { - const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); - const int nplanes = (modes->rgbBits - modes->alphaBits); - const VisualPtr pVis = pScreen->visuals; - - /* Find a visual that matches the GLX visual's class and size */ - for (j = 0; j < pScreen->numVisuals; j++) { - if (pVis[j].class == vis_class && - pVis[j].nplanes == nplanes) { - - /* Fixup the masks */ - modes->redMask = pVis[j].redMask; - modes->greenMask = pVis[j].greenMask; - modes->blueMask = pVis[j].blueMask; - - /* Recalc the sizes */ - modes->redBits = count_bits(modes->redMask); - modes->greenBits = count_bits(modes->greenMask); - modes->blueBits = count_bits(modes->blueMask); - } - } - } -} -#endif -static void __glXAquaScreenDestroy(__GLXscreen *screen) { + freeGlCapabilities(&cap); - GLAQUA_DEBUG_MSG("glXAquaScreenDestroy(%p)\n", screen); - __glXScreenDestroy(screen); - - free(screen); -} - -static void init_screen_visuals(__GLXAquaScreen *screen) { - ScreenPtr pScreen = screen->base.pScreen; - - __GLcontextModes *modes; - int *used; - int i, j; - - GLAQUA_DEBUG_MSG("init_screen_visuals\n"); - - /* FIXME: Change 'used' to be a array of bits (rather than of ints), - * FIXME: create a stack array of 8 or 16 bytes. If 'numVisuals' is less - * FIXME: than 64 or 128 the stack array can be used instead of calling - * FIXME: malloc / free. If nothing else, convert 'used' to - * FIXME: array of bytes instead of ints! - */ - used = (int *)malloc(pScreen->numVisuals * sizeof(int)); - memset(used, 0, pScreen->numVisuals * sizeof(int)); - - i = 0; - for ( modes = screen -> base.modes - ; modes != NULL - ; modes = modes->next ) { - const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); - const int nplanes = (modes->rgbBits - modes->alphaBits); - const VisualPtr pVis = pScreen->visuals; - - for (j = 0; j < pScreen->numVisuals; j++) { - if (pVis[j].class == vis_class && - pVis[j].nplanes == nplanes && - pVis[j].redMask == modes->redMask && - pVis[j].greenMask == modes->greenMask && - pVis[j].blueMask == modes->blueMask && - !used[j]) { - - /* set the VisualID */ - modes->visualID = pVis[j].vid; - - /* Mark this visual used */ - used[j] = 1; - break; - } - } - if ( j == pScreen->numVisuals ) { - ErrorF("No matching visual for __GLcontextMode with " - "visual class = %d (%d), nplanes = %u\n", - vis_class, - (int)modes->visualType, - (unsigned int)(modes->rgbBits - modes->alphaBits) ); - } - else if ( modes->visualID == -1 ) { - FatalError( "Matching visual found, but visualID still -1!\n" ); - } - - i++; - } - - free(used); + return result; } +/* This is called by __glXInitScreens(). */ static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) { - __GLXAquaScreen *screen; - GLAQUA_DEBUG_MSG("glXAquaScreenProbe\n"); - if (screen == NULL) return NULL; - - screen = malloc(sizeof *screen); + __GLXAquaScreen *screen; - __glXScreenInit(&screen->base, pScreen); + GLAQUA_DEBUG_MSG("glXAquaScreenProbe\n"); - screen->base.destroy = __glXAquaScreenDestroy; - screen->base.createContext = __glXAquaScreenCreateContext; - screen->base.createDrawable = __glXAquaScreenCreateDrawable; - screen->base.pScreen = pScreen; + if (pScreen == NULL) + return NULL; - init_screen_visuals(screen); + screen = xalloc(sizeof *screen); + if(NULL == screen) + return NULL; + + screen->base.destroy = __glXAquaScreenDestroy; + screen->base.createContext = __glXAquaScreenCreateContext; + screen->base.createDrawable = __glXAquaScreenCreateDrawable; + screen->base.swapInterval = /*FIXME*/ NULL; + screen->base.hyperpipeFuncs = NULL; + screen->base.swapBarrierFuncs = NULL; + screen->base.pScreen = pScreen; + + screen->base.fbconfigs = CreateConfigs(&screen->base.numFBConfigs, + pScreen->myNum); + + __glXScreenInit(&screen->base, pScreen); + + /* __glXScreenInit initializes these, so the order here is important, if we need these... */ + // screen->base.GLextensions = ""; + // screen->base.GLXvendor = "Apple"; + screen->base.GLXversion = xstrdup("1.4"); + screen->base.GLXextensions = xstrdup("GLX_SGIX_fbconfig " + "GLX_SGIS_multisample " + "GLX_ARB_multisample " + "GLX_EXT_visual_info " + "GLX_EXT_import_context "); + + /*We may be able to add more GLXextensions at a later time. */ + + return &screen->base; +} - return &screen->base; +static void __glXAquaDrawableCopySubBuffer (__GLXdrawable *drawable, + int x, int y, int w, int h) { + /*TODO finish me*/ } + static void __glXAquaDrawableDestroy(__GLXdrawable *base) { - GLAQUA_DEBUG_MSG("glAquaDestroyDrawablePrivate\n"); + /* gstaplin: base is the head of the structure, so it's at the same + * offset in memory. + * Is this safe with strict aliasing? I noticed that the other dri code + * does this too... + */ + __GLXAquaDrawable *glxPriv = (__GLXAquaDrawable *)base; + GLAQUA_DEBUG_MSG(__func__); + /* It doesn't work to call DRIDestroySurface here, the drawable's already gone.. But dri.c notices the window destruction and frees the surface itself. */ - free(base); + /*gstaplin: verify the statement above. The surface destroy + *messages weren't making it through, and may still not be. + *We need a good test case for surface creation and destruction. + *We also need a good way to enable introspection on the server + *to validate the test, beyond using gdb with print. + */ + + xfree(glxPriv); } static __GLXdrawable * __glXAquaScreenCreateDrawable(__GLXscreen *screen, DrawablePtr pDraw, + int type, XID drawId, - __GLcontextModes *modes) { + __GLXconfig *conf) { __GLXAquaDrawable *glxPriv; - GLAQUA_DEBUG_MSG("glAquaScreenCreateDrawable(%p,%p,%d,%p)\n", context, pDraw, drawId, modes); - glxPriv = xalloc(sizeof *glxPriv); - if (glxPriv == NULL) return NULL; + + if(glxPriv == NULL) + return NULL; memset(glxPriv, 0, sizeof *glxPriv); - if (!__glXDrawableInit(&glxPriv->base, screen, pDraw, drawId, modes)) { + if(!__glXDrawableInit(&glxPriv->base, screen, pDraw, type, drawId, conf)) { xfree(glxPriv); return NULL; } glxPriv->base.destroy = __glXAquaDrawableDestroy; - glxPriv->base.resize = __glXAquaDrawableResize; glxPriv->base.swapBuffers = __glXAquaDrawableSwapBuffers; - // glxPriv->base.copySubBuffer = __glXAquaDrawableCopySubBuffer; + glxPriv->base.copySubBuffer = NULL; /* __glXAquaDrawableCopySubBuffer; */ + glxPriv->pDraw = pDraw; + glxPriv->sid = 0; + glxPriv->context = NULL; + return &glxPriv->base; } -static void glAquaResetExtension(void) -{ - GLAQUA_DEBUG_MSG("glAquaResetExtension\n"); - CGLSetOption(kCGLGOResetLibrary, GL_TRUE); -} - // Extra goodies for glx GLuint __glFloorLog2(GLuint val) @@ -1255,7 +853,9 @@ static void setup_dispatch_table(void) { SET_BlendEquationSeparateEXT(disp, glBlendEquationSeparateEXT); SET_BlendFunc(disp, glBlendFunc); SET_BlendFuncSeparateEXT(disp, glBlendFuncSeparateEXT); +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 SET_BlitFramebufferEXT(disp, glBlitFramebufferEXT); +#endif SET_BufferDataARB(disp, glBufferDataARB); SET_BufferSubDataARB(disp, glBufferSubDataARB); SET_CallList(disp, glCallList); @@ -1312,12 +912,16 @@ static void setup_dispatch_table(void) { SET_ColorTable(disp, glColorTable); SET_ColorTableParameterfv(disp, glColorTableParameterfv); SET_ColorTableParameteriv(disp, glColorTableParameteriv); + + +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 SET_CombinerInputNV(disp, glCombinerInputNV); SET_CombinerOutputNV(disp, glCombinerOutputNV); SET_CombinerParameterfNV(disp, glCombinerParameterfNV); SET_CombinerParameterfvNV(disp, glCombinerParameterfvNV); SET_CombinerParameteriNV(disp, glCombinerParameteriNV); SET_CombinerParameterivNV(disp, glCombinerParameterivNV); +#endif SET_CompileShaderARB(disp, glCompileShaderARB); SET_CompressedTexImage1DARB(disp, glCompressedTexImage1DARB); SET_CompressedTexImage2DARB(disp, glCompressedTexImage2DARB); @@ -1395,7 +999,10 @@ static void setup_dispatch_table(void) { SET_EvalPoint2(disp, glEvalPoint2); //SET_ExecuteProgramNV(disp, glExecuteProgramNV); SET_FeedbackBuffer(disp, glFeedbackBuffer); + +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 SET_FinalCombinerInputNV(disp, glFinalCombinerInputNV); +#endif SET_Finish(disp, glFinish); SET_FinishFenceNV(disp, glFinishFenceAPPLE); // <-- APPLE -> NV SET_Flush(disp, glFlush); @@ -1437,10 +1044,12 @@ static void setup_dispatch_table(void) { SET_GetColorTable(disp, glGetColorTable); SET_GetColorTableParameterfv(disp, glGetColorTableParameterfv); SET_GetColorTableParameteriv(disp, glGetColorTableParameteriv); +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 SET_GetCombinerInputParameterfvNV(disp, glGetCombinerInputParameterfvNV); SET_GetCombinerInputParameterivNV(disp, glGetCombinerInputParameterivNV); SET_GetCombinerOutputParameterfvNV(disp, glGetCombinerOutputParameterfvNV); SET_GetCombinerOutputParameterivNV(disp, glGetCombinerOutputParameterivNV); +#endif SET_GetCompressedTexImageARB(disp, glGetCompressedTexImageARB); SET_GetConvolutionFilter(disp, glGetConvolutionFilter); SET_GetConvolutionParameterfv(disp, glGetConvolutionParameterfv); @@ -1448,8 +1057,10 @@ static void setup_dispatch_table(void) { SET_GetDoublev(disp, glGetDoublev); SET_GetError(disp, glGetError); //SET_GetFenceivNV(disp, glGetFenceivNV); +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 SET_GetFinalCombinerInputParameterfvNV(disp, glGetFinalCombinerInputParameterfvNV); SET_GetFinalCombinerInputParameterivNV(disp, glGetFinalCombinerInputParameterivNV); +#endif SET_GetFloatv(disp, glGetFloatv); SET_GetFramebufferAttachmentParameterivEXT(disp, glGetFramebufferAttachmentParameterivEXT); SET_GetHandleARB(disp, glGetHandleARB); diff --git a/xorg-server/hw/xquartz/GL/visualConfigs.c b/xorg-server/hw/xquartz/GL/visualConfigs.c new file mode 100644 index 000000000..81f88fb3c --- /dev/null +++ b/xorg-server/hw/xquartz/GL/visualConfigs.c @@ -0,0 +1,255 @@ +/* + * Copyright (c) 2007, 2008 Apple Inc. + * Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved. + * Copyright (c) 2002 Greg Parker. All Rights Reserved. + * + * Portions of this file are copied from Mesa's xf86glx.c, + * which contains the following copyright: + * + * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT HOLDER(S) 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 + +#include "dri.h" + +#include <OpenGL/OpenGL.h> +#include <OpenGL/CGLContext.h> + +#include <GL/gl.h> +#include <GL/glxproto.h> +#include <windowstr.h> +#include <resource.h> +#include <GL/glxint.h> +#include <GL/glxtokens.h> +#include <scrnintstr.h> +#include <glxserver.h> +#include <glxscreens.h> +#include <glxdrawable.h> +#include <glxcontext.h> +#include <glxext.h> +#include <glxutil.h> +#include <glxscreens.h> +#include <GL/internal/glcore.h> + +#include "capabilities.h" +#include "visualConfigs.h" + +/* Based originally on code from indirect.c which was based on code from i830_dri.c. */ +void setVisualConfigs(void) { + int numConfigs = 0; + __GLXvisualConfig *visualConfigs = NULL; + void **visualPrivates = NULL; + struct glCapabilities caps; + struct glCapabilitiesConfig *conf = NULL; + int stereo, depth, aux, buffers, stencil, accum, color, msample; + int i = 0; + + if(getGlCapabilities(&caps)) { + ErrorF("error from getGlCapabilities()!\n"); + return; + } + + /* + conf->stereo is 0 or 1, but we need at least 1 iteration of the loop, + so we treat a true conf->stereo as 2. + + The depth size is 0 or 24. Thus we do 2 iterations for that. + + conf->aux_buffers (when available/non-zero) result in 2 iterations instead of 1. + + conf->buffers indicates whether we have single or double buffering. + + conf->total_stencil_bit_depths + + conf->total_color_buffers indicates the RGB/RGBA color depths. + + conf->total_accum_buffers iterations for accum (with at least 1 if equal to 0) + + conf->total_depth_buffer_depths + + conf->multisample_buffers iterations (with at least 1 if equal to 0). We add 1 + for the 0 multisampling config. + + */ + + assert(NULL != caps.configurations); + conf = caps.configurations; + + numConfigs = 0; + + for(conf = caps.configurations; conf; conf = conf->next) { + if(conf->total_color_buffers <= 0) + continue; + + numConfigs += (conf->stereo ? 2 : 1) + * (conf->aux_buffers ? 2 : 1) + * conf->buffers + * ((conf->total_stencil_bit_depths > 0) ? conf->total_stencil_bit_depths : 1) + * conf->total_color_buffers + * ((conf->total_accum_buffers > 0) ? conf->total_accum_buffers : 1) + * conf->total_depth_buffer_depths + * (conf->multisample_buffers + 1); + } + + visualConfigs = xcalloc(sizeof(*visualConfigs), numConfigs); + + if(NULL == visualConfigs) { + ErrorF("xcalloc failure when allocating visualConfigs\n"); + freeGlCapabilities(&caps); + return; + } + + visualPrivates = xcalloc(sizeof(void *), numConfigs); + + if(NULL == visualPrivates) { + ErrorF("xcalloc failure when allocating visualPrivates"); + freeGlCapabilities(&caps); + xfree(visualConfigs); + return; + } + + i = 0; /* current buffer */ + for(conf = caps.configurations; conf; conf = conf->next) { + for(stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) { + for(aux = 0; aux < (conf->aux_buffers ? 2 : 1); ++aux) { + for(buffers = 0; buffers < conf->buffers; ++buffers) { + for(stencil = 0; stencil < ((conf->total_stencil_bit_depths > 0) ? + conf->total_stencil_bit_depths : 1); ++stencil) { + for(color = 0; color < conf->total_color_buffers; ++color) { + for(accum = 0; accum < ((conf->total_accum_buffers > 0) ? + conf->total_accum_buffers : 1); ++accum) { + for(depth = 0; depth < conf->total_depth_buffer_depths; ++depth) { + for(msample = 0; msample < (conf->multisample_buffers + 1); ++msample) { + visualConfigs[i].vid = (VisualID)(-1); + visualConfigs[i].class = TrueColor; + + visualConfigs[i].rgba = true; + visualConfigs[i].redSize = conf->color_buffers[color].r; + visualConfigs[i].greenSize = conf->color_buffers[color].g; + visualConfigs[i].blueSize = conf->color_buffers[color].b; + + if(GLCAPS_COLOR_BUF_INVALID_VALUE == conf->color_buffers[color].a) { + /* This visual has no alpha. */ + visualConfigs[i].alphaSize = 0; + } else { + visualConfigs[i].alphaSize = conf->color_buffers[color].a; + } + + /* + * If the .a/alpha value is unset, then don't add it to the + * bufferSize specification. The INVALID_VALUE indicates that it + * was unset. + * + * This prevents odd bufferSizes, such as 14. + */ + if(GLCAPS_COLOR_BUF_INVALID_VALUE == conf->color_buffers[color].a) { + visualConfigs[i].bufferSize = conf->color_buffers[color].r + + conf->color_buffers[color].g + conf->color_buffers[color].b; + } else { + visualConfigs[i].bufferSize = conf->color_buffers[color].r + + conf->color_buffers[color].g + conf->color_buffers[color].b + + conf->color_buffers[color].a; + } + + /* + * I'm uncertain about these masks. + * I don't think we actually care what the values are in our + * libGL, so it doesn't seem to make a difference. + */ + visualConfigs[i].redMask = -1; + visualConfigs[i].greenMask = -1; + visualConfigs[i].blueMask = -1; + visualConfigs[i].alphaMask = -1; + + if(conf->total_accum_buffers > 0) { + visualConfigs[i].accumRedSize = conf->accum_buffers[accum].r; + visualConfigs[i].accumGreenSize = conf->accum_buffers[accum].g; + visualConfigs[i].accumBlueSize = conf->accum_buffers[accum].b; + if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->accum_buffers[accum].a) { + visualConfigs[i].accumAlphaSize = conf->accum_buffers[accum].a; + } else { + visualConfigs[i].accumAlphaSize = 0; + } + } else { + visualConfigs[i].accumRedSize = 0; + visualConfigs[i].accumGreenSize = 0; + visualConfigs[i].accumBlueSize = 0; + visualConfigs[i].accumAlphaSize = 0; + } + + visualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE; + visualConfigs[i].stereo = stereo ? TRUE : FALSE; + + visualConfigs[i].depthSize = conf->depth_buffers[depth]; + + if(conf->total_stencil_bit_depths > 0) { + visualConfigs[i].stencilSize = conf->stencil_bit_depths[stencil]; + } else { + visualConfigs[i].stencilSize = 0; + } + visualConfigs[i].auxBuffers = aux ? conf->aux_buffers : 0; + visualConfigs[i].level = 0; + + if(conf->accelerated) { + visualConfigs[i].visualRating = GLX_NONE; + } else { + visualConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; + } + + visualConfigs[i].transparentPixel = GLX_NONE; + visualConfigs[i].transparentRed = GLX_NONE; + visualConfigs[i].transparentGreen = GLX_NONE; + visualConfigs[i].transparentBlue = GLX_NONE; + visualConfigs[i].transparentAlpha = GLX_NONE; + visualConfigs[i].transparentIndex = GLX_NONE; + + if(msample > 0) { + visualConfigs[i].multiSampleSize = conf->multisample_samples; + visualConfigs[i].nMultiSampleBuffers = conf->multisample_buffers; + } else { + visualConfigs[i].multiSampleSize = 0; + visualConfigs[i].nMultiSampleBuffers = 0; + } + + ++i; + } + } + } + } + } + } + } + } + } + + if (i != numConfigs) { + ErrorF("numConfigs calculation error in setVisualConfigs! numConfigs is %d i is %d\n", numConfigs, i); + abort(); + } + + freeGlCapabilities(&caps); + + GlxSetVisualConfigs(numConfigs, visualConfigs, visualPrivates); +} diff --git a/xorg-server/hw/xquartz/quartzCursor.h b/xorg-server/hw/xquartz/GL/visualConfigs.h index 56a02098d..b9e6ae756 100644 --- a/xorg-server/hw/xquartz/quartzCursor.h +++ b/xorg-server/hw/xquartz/GL/visualConfigs.h @@ -1,10 +1,5 @@ /* - * quartzCursor.h - * - * External interface for Quartz hardware cursor - * - * Copyright (c) 2001 Torrey T. Lyons and Greg Parker. - * All Rights Reserved. + * Copyright (c) 2008 Apple Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -23,20 +18,11 @@ * 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(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. */ -#ifndef QUARTZCURSOR_H -#define QUARTZCURSOR_H - -#include "screenint.h" +#ifndef VISUAL_CONFIGS_H +#define VISUAL_CONFIGS_H -Bool QuartzInitCursor(ScreenPtr pScreen); -void QuartzReallySetCursor(void); -void QuartzSuspendXCursor(ScreenPtr pScreen); -void QuartzResumeXCursor(ScreenPtr pScreen, int x, int y); +void setVisualConfigs(void); #endif diff --git a/xorg-server/hw/xquartz/Makefile.am b/xorg-server/hw/xquartz/Makefile.am index 999013d1b..e5e2e9e37 100644 --- a/xorg-server/hw/xquartz/Makefile.am +++ b/xorg-server/hw/xquartz/Makefile.am @@ -7,35 +7,35 @@ AM_CPPFLAGS = \ -DINXQUARTZ \ -DUSE_NEW_CLUT \ -DXFree86Server \ - -I$(top_srcdir)/miext/rootless + -I$(top_srcdir)/miext/rootless \ + -DX11LIBDIR=\"$(libdir)\" -if X11APP -X11APP_SUBDIRS = bundle +if GLX +GL_DIR = GL endif -SUBDIRS = . GL xpr $(X11APP_SUBDIRS) -DIST_SUBDIRS = GL xpr bundle +SUBDIRS = bundle . $(GL_DIR) xpr pbproxy mach-startup doc + +DIST_SUBDIRS = bundle . GL xpr pbproxy mach-startup doc libXquartz_la_SOURCES = \ $(top_srcdir)/fb/fbcmap_mi.c \ $(top_srcdir)/mi/miinitext.c \ - $(top_srcdir)/Xext/dpmsstubs.c \ X11Application.m \ X11Controller.m \ applewm.c \ darwin.c \ darwinEvents.c \ - darwinKeyboard.c \ darwinXinput.c \ keysym2ucs.c \ pseudoramiX.c \ quartz.c \ quartzAudio.c \ quartzCocoa.m \ - quartzForeground.c \ quartzKeyboard.c \ quartzPasteboard.c \ - quartzStartup.c + quartzStartup.c \ + threadSafety.c EXTRA_DIST = \ X11Application.h \ @@ -44,14 +44,13 @@ EXTRA_DIST = \ darwinClut8.h \ darwin.h \ darwinEvents.h \ - darwinKeyboard.h \ keysym2ucs.h \ pseudoramiX.h \ quartz.h \ quartzAudio.h \ quartzCommon.h \ - quartzCursor.c \ - quartzCursor.h \ - quartzForeground.h \ quartzKeyboard.h \ - quartzPasteboard.h + quartzPasteboard.h \ + sanitizedCarbon.h \ + sanitizedCocoa.h \ + threadSafety.h diff --git a/xorg-server/hw/xquartz/Makefile.in b/xorg-server/hw/xquartz/Makefile.in index b57b513bf..6a2dbf41c 100644 --- a/xorg-server/hw/xquartz/Makefile.in +++ b/xorg-server/hw/xquartz/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -43,7 +43,6 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ - $(top_builddir)/include/xgl-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ @@ -51,21 +50,17 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libXquartz_la_LIBADD = -am_libXquartz_la_OBJECTS = fbcmap_mi.lo miinitext.lo dpmsstubs.lo \ - X11Application.lo X11Controller.lo applewm.lo darwin.lo \ - darwinEvents.lo darwinKeyboard.lo darwinXinput.lo \ - keysym2ucs.lo pseudoramiX.lo quartz.lo quartzAudio.lo \ - quartzCocoa.lo quartzForeground.lo quartzKeyboard.lo \ - quartzPasteboard.lo quartzStartup.lo +am_libXquartz_la_OBJECTS = fbcmap_mi.lo miinitext.lo X11Application.lo \ + X11Controller.lo applewm.lo darwin.lo darwinEvents.lo \ + darwinXinput.lo keysym2ucs.lo pseudoramiX.lo quartz.lo \ + quartzAudio.lo quartzCocoa.lo quartzKeyboard.lo \ + quartzPasteboard.lo quartzStartup.lo threadSafety.lo libXquartz_la_OBJECTS = $(am_libXquartz_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ @@ -95,8 +90,9 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ -APPDEFAULTDIR = @APPDEFAULTDIR@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@ +APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ @@ -117,10 +113,6 @@ CFLAGS = @CFLAGS@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DARWIN_LIBS = @DARWIN_LIBS@ DBUS_CFLAGS = @DBUS_CFLAGS@ @@ -142,6 +134,7 @@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ +DOLT_BASH = @DOLT_BASH@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ @@ -151,18 +144,15 @@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ -ECHO = @ECHO@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ -FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ -FREETYPE_LIBS = @FREETYPE_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ @@ -181,7 +171,7 @@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ -LAUNCHD = @LAUNCHD@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LEX = @LEX@ @@ -195,7 +185,10 @@ LIBTOOL = @LIBTOOL@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LINUXDOC = @LINUXDOC@ +LIPO = @LIPO@ LN_S = @LN_S@ +LTCOMPILE = @LTCOMPILE@ +LTCXXCOMPILE = @LTCXXCOMPILE@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -207,8 +200,7 @@ MESA_SOURCE = @MESA_SOURCE@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ -MKFONTDIR = @MKFONTDIR@ -MKFONTSCALE = @MKFONTSCALE@ +NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ @@ -217,8 +209,8 @@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -251,7 +243,6 @@ VENDOR_NAME = @VENDOR_NAME@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VENDOR_RELEASE = @VENDOR_RELEASE@ VERSION = @VERSION@ -X11APP_ARCHS = @X11APP_ARCHS@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ @@ -261,27 +252,12 @@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ -XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@ -XEGL_LIBS = @XEGL_LIBS@ -XEGL_SYS_LIBS = @XEGL_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ -XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGFILE = @XF86CONFIGFILE@ -XF86MISC_CFLAGS = @XF86MISC_CFLAGS@ -XF86MISC_LIBS = @XF86MISC_LIBS@ XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ -XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@ -XGLMODULES_LIBS = @XGLMODULES_LIBS@ -XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@ -XGLXMODULES_LIBS = @XGLXMODULES_LIBS@ -XGLX_LIBS = @XGLX_LIBS@ -XGLX_SYS_LIBS = @XGLX_SYS_LIBS@ -XGL_LIBS = @XGL_LIBS@ -XGL_MODULE_PATH = @XGL_MODULE_PATH@ -XGL_SYS_LIBS = @XGL_SYS_LIBS@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ @@ -292,10 +268,6 @@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ -XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@ -XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@ -XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@ -XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ @@ -304,13 +276,8 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ -XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ -XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ -XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ -XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ -XPRINT_CFLAGS = @XPRINT_CFLAGS@ -XPRINT_LIBS = @XPRINT_LIBS@ -XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ +XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ +XPBPROXY_LIBS = @XPBPROXY_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ @@ -343,8 +310,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -364,7 +330,6 @@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ -ft_config = @ft_config@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -374,12 +339,12 @@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ -launchagentsdir = @launchagentsdir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ +lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ @@ -397,8 +362,6 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -xglmoduledir = @xglmoduledir@ -xpconfigdir = @xpconfigdir@ noinst_LTLIBRARIES = libXquartz.la AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS) AM_OBJCFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS) @@ -408,31 +371,30 @@ AM_CPPFLAGS = \ -DINXQUARTZ \ -DUSE_NEW_CLUT \ -DXFree86Server \ - -I$(top_srcdir)/miext/rootless + -I$(top_srcdir)/miext/rootless \ + -DX11LIBDIR=\"$(libdir)\" -@X11APP_TRUE@X11APP_SUBDIRS = bundle -SUBDIRS = . GL xpr $(X11APP_SUBDIRS) -DIST_SUBDIRS = GL xpr bundle +@GLX_TRUE@GL_DIR = GL +SUBDIRS = bundle . $(GL_DIR) xpr pbproxy mach-startup doc +DIST_SUBDIRS = bundle . GL xpr pbproxy mach-startup doc libXquartz_la_SOURCES = \ $(top_srcdir)/fb/fbcmap_mi.c \ $(top_srcdir)/mi/miinitext.c \ - $(top_srcdir)/Xext/dpmsstubs.c \ X11Application.m \ X11Controller.m \ applewm.c \ darwin.c \ darwinEvents.c \ - darwinKeyboard.c \ darwinXinput.c \ keysym2ucs.c \ pseudoramiX.c \ quartz.c \ quartzAudio.c \ quartzCocoa.m \ - quartzForeground.c \ quartzKeyboard.c \ quartzPasteboard.c \ - quartzStartup.c + quartzStartup.c \ + threadSafety.c EXTRA_DIST = \ X11Application.h \ @@ -441,17 +403,16 @@ EXTRA_DIST = \ darwinClut8.h \ darwin.h \ darwinEvents.h \ - darwinKeyboard.h \ keysym2ucs.h \ pseudoramiX.h \ quartz.h \ quartzAudio.h \ quartzCommon.h \ - quartzCursor.c \ - quartzCursor.h \ - quartzForeground.h \ quartzKeyboard.h \ - quartzPasteboard.h + quartzPasteboard.h \ + sanitizedCarbon.h \ + sanitizedCocoa.h \ + threadSafety.h all: all-recursive @@ -461,8 +422,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ @@ -509,9 +470,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/applewm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/darwin.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/darwinEvents.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/darwinKeyboard.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/darwinXinput.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dpmsstubs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbcmap_mi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keysym2ucs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Plo@am__quote@ @@ -519,10 +478,10 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quartz.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quartzAudio.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quartzCocoa.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quartzForeground.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quartzKeyboard.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quartzPasteboard.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quartzStartup.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/threadSafety.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -559,13 +518,6 @@ miinitext.lo: $(top_srcdir)/mi/miinitext.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o miinitext.lo `test -f '$(top_srcdir)/mi/miinitext.c' || echo '$(srcdir)/'`$(top_srcdir)/mi/miinitext.c -dpmsstubs.lo: $(top_srcdir)/Xext/dpmsstubs.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dpmsstubs.lo -MD -MP -MF $(DEPDIR)/dpmsstubs.Tpo -c -o dpmsstubs.lo `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dpmsstubs.Tpo $(DEPDIR)/dpmsstubs.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/Xext/dpmsstubs.c' object='dpmsstubs.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dpmsstubs.lo `test -f '$(top_srcdir)/Xext/dpmsstubs.c' || echo '$(srcdir)/'`$(top_srcdir)/Xext/dpmsstubs.c - .m.o: @am__fastdepOBJC_TRUE@ $(OBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepOBJC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @@ -668,7 +620,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS diff --git a/xorg-server/hw/xquartz/X11Application.h b/xorg-server/hw/xquartz/X11Application.h index 86da67f2e..80aee5932 100644 --- a/xorg-server/hw/xquartz/X11Application.h +++ b/xorg-server/hw/xquartz/X11Application.h @@ -32,7 +32,6 @@ #if __OBJC__ -#import <Cocoa/Cocoa.h> #import "X11Controller.h" @interface X11Application : NSApplication { @@ -56,8 +55,7 @@ - (void) prefs_set_string:(NSString *)key value:(NSString *)value; - (void) prefs_synchronize; -- (BOOL) x_active; - +- (OSX_BOOL) x_active; @end extern X11Application *X11App; @@ -72,18 +70,17 @@ void X11ApplicationSetCanQuit (int state); void X11ApplicationServerReady (void); void X11ApplicationShowHideMenubar (int state); -void X11ApplicationMain(int argc, const char **argv, void (*server_thread) (void *), void *server_arg); +void X11ApplicationMain(int argc, char **argv, char **envp); extern int X11EnableKeyEquivalents; -extern int quartzHasRoot, quartzEnableRootless; - -#define APP_PREFS "org.x.X11" +extern int quartzHasRoot, quartzEnableRootless, quartzFullscreenMenu; #define PREFS_APPSMENU "apps_menu" #define PREFS_FAKEBUTTONS "enable_fake_buttons" #define PREFS_SYSBEEP "enable_system_beep" #define PREFS_KEYEQUIVS "enable_key_equivalents" -#define PREFS_KEYMAP_FILE "keymap_file" +#define PREFS_FULLSCREEN_HOTKEYS "fullscreen_hotkeys" +#define PREFS_FULLSCREEN_MENU "fullscreen_menu" #define PREFS_SYNC_KEYMAP "sync_keymap" #define PREFS_DEPTH "depth" #define PREFS_NO_AUTH "no_auth" @@ -92,12 +89,20 @@ extern int quartzHasRoot, quartzEnableRootless; #define PREFS_NO_QUIT_ALERT "no_quit_alert" #define PREFS_FAKE_BUTTON2 "fake_button2" #define PREFS_FAKE_BUTTON3 "fake_button3" +#define PREFS_APPKIT_MODIFIERS "appkit_modifiers" +#define PREFS_WINDOW_ITEM_MODIFIERS "window_item_modifiers" #define PREFS_ROOTLESS "rootless" -#define PREFS_FULLSCREEN_HOTKEYS "fullscreen_hotkeys" -#define PREFS_SWAP_ALT_META "swap_alt_meta" +#define PREFS_TEST_EXTENSIONS "enable_test_extensions" #define PREFS_XP_OPTIONS "xp_options" -#define PREFS_ENABLE_STEREO "enable_stereo" #define PREFS_LOGIN_SHELL "login_shell" -#define PREFS_QUARTZ_WM_CLICK_THROUGH "wm_click_through" +#define PREFS_CLICK_THROUGH "wm_click_through" +#define PREFS_FFM "wm_ffm" +#define PREFS_FOCUS_ON_NEW_WINDOW "wm_focus_on_new_window" + +#define PREFS_SYNC_PB "sync_pasteboard" +#define PREFS_SYNC_PB_TO_CLIPBOARD "sync_pasteboard_to_clipboard" +#define PREFS_SYNC_PB_TO_PRIMARY "sync_pasteboard_to_primary" +#define PREFS_SYNC_CLIPBOARD_TO_PB "sync_clipboard_to_pasteboard" +#define PREFS_SYNC_PRIMARY_ON_SELECT "sync_primary_on_select" #endif /* X11APPLICATION_H */ diff --git a/xorg-server/hw/xquartz/X11Application.m b/xorg-server/hw/xquartz/X11Application.m index be5511d30..9f4738c47 100644 --- a/xorg-server/hw/xquartz/X11Application.m +++ b/xorg-server/hw/xquartz/X11Application.m @@ -1,6 +1,6 @@ /* X11Application.m -- subclass of NSApplication to multiplex events - Copyright (c) 2002-2007 Apple Inc. + Copyright (c) 2002-2008 Apple Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files @@ -27,48 +27,69 @@ promote the sale, use or other dealings in this Software without prior written authorization. */ +#include "sanitizedCarbon.h" + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif #include "quartzCommon.h" -#include "quartzForeground.h" #import "X11Application.h" -#include <Carbon/Carbon.h> - -/* ouch! */ -#define BOOL X_BOOL -# include "darwin.h" -# include "darwinEvents.h" -# include "quartz.h" -# define _APPLEWM_SERVER_ -# include "X11/extensions/applewm.h" -# include "micmap.h" -#undef BOOL + +#include "darwin.h" +#include "darwinEvents.h" +#include "quartzKeyboard.h" +#include "quartz.h" +#define _APPLEWM_SERVER_ +#include "X11/extensions/applewm.h" +#include "micmap.h" #include <mach/mach.h> #include <unistd.h> -#include <pthread.h> +#include <AvailabilityMacros.h> + +#include <Xplugin.h> -#include "rootlessCommon.h" +// pbproxy/pbproxy.h +extern BOOL xpbproxy_init (void); -WindowPtr xprGetXWindowFromAppKit(int windowNumber); // xpr/xprFrame.c +#define DEFAULTS_FILE X11LIBDIR"/X11/xserver/Xquartz.plist" + +#ifndef XSERVER_VERSION +#define XSERVER_VERSION "?" +#endif -#define DEFAULTS_FILE "/usr/X11/lib/X11/xserver/Xquartz.plist" +#define ProximityIn 0 +#define ProximityOut 1 -int X11EnableKeyEquivalents = TRUE; +/* Stuck modifier / button state... force release when we context switch */ +static NSEventType keyState[NUM_KEYCODES]; +static int modifierFlagsMask; + +int X11EnableKeyEquivalents = TRUE, quartzFullscreenMenu = FALSE; int quartzHasRoot = FALSE, quartzEnableRootless = TRUE; -extern int darwinFakeButtons, input_check_flag; -extern Bool enable_stereo; +extern Bool noTestExtensions; + +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 +static TISInputSourceRef last_key_layout; +#else +static KeyboardLayoutRef last_key_layout; +#endif -extern xEvent *darwinEvents; +extern int darwinFakeButtons; X11Application *X11App; +CFStringRef app_prefs_domain_cfstr = NULL; + #define ALL_KEY_MASKS (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask) +@interface X11Application (Private) +- (void) sendX11NSEvent:(NSEvent *)e; +@end + @implementation X11Application typedef struct message_struct message; @@ -80,8 +101,6 @@ struct message_struct { static mach_port_t _port; -static void send_nsevent (NSEventType type, NSEvent *e); - /* Quartz mode initialization routine. This is often dynamically loaded but is statically linked into this X server. */ Bool QuartzModeBundleInit(void); @@ -144,195 +163,259 @@ static void message_kit_thread (SEL selector, NSObject *arg) { NSMutableDictionary *dict; NSDictionary *infoDict; NSString *tem; - - dict = [NSMutableDictionary dictionaryWithCapacity:2]; + + dict = [NSMutableDictionary dictionaryWithCapacity:3]; infoDict = [[NSBundle mainBundle] infoDictionary]; - + [dict setObject: NSLocalizedString (@"The X Window System", @"About panel") - forKey:@"ApplicationName"]; - + forKey:@"ApplicationName"]; + tem = [infoDict objectForKey:@"CFBundleShortVersionString"]; - - [dict setObject:[NSString stringWithFormat:@"XQuartz %@ - (xorg-server %s)", tem, XSERVER_VERSION] - forKey:@"ApplicationVersion"]; - + + [dict setObject:[NSString stringWithFormat:@"XQuartz %@", tem] + forKey:@"ApplicationVersion"]; + + [dict setObject:[NSString stringWithFormat:@"xorg-server %s", XSERVER_VERSION] + forKey:@"Version"]; + [self orderFrontStandardAboutPanelWithOptions: dict]; } -- (void) activateX:(BOOL)state { +- (void) activateX:(OSX_BOOL)state { /* Create a TSM document that supports full Unicode input, and - have it activated while X is active (unless using the old - keymapping files) */ + have it activated while X is active */ static TSMDocumentID x11_document; - DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active) + size_t i; + DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active) if (state) { - QuartzMessageServerThread (kXDarwinActivate, 0); - - if (!_x_active) { - if (x11_document == 0 && darwinKeymapFile == NULL) { - OSType types[1]; - types[0] = kUnicodeDocument; - NewTSMDocument (1, types, &x11_document, 0); - } - - if (x11_document != 0) ActivateTSMDocument (x11_document); - } + DarwinSendDDXEvent(kXquartzActivate, 0); + + if (!_x_active) { + if (x11_document == 0) { + OSType types[1]; + types[0] = kUnicodeDocument; + NewTSMDocument (1, types, &x11_document, 0); + } + + if (x11_document != 0) ActivateTSMDocument (x11_document); + } } else { - QuartzMessageServerThread (kXDarwinDeactivate, 0); - - if (_x_active && x11_document != 0) - DeactivateTSMDocument (x11_document); + + if(darwin_modifier_flags) + DarwinUpdateModKeys(0); + for(i=0; i < NUM_KEYCODES; i++) { + if(keyState[i] == NSKeyDown) { + DarwinSendKeyboardEvents(KeyRelease, i); + keyState[i] = NSKeyUp; + } + } + + DarwinSendDDXEvent(kXquartzDeactivate, 0); + + if (_x_active && x11_document != 0) + DeactivateTSMDocument (x11_document); } - + _x_active = state; } - (void) became_key:(NSWindow *)win { - [self activateX:NO]; + [self activateX:NO]; } - (void) sendEvent:(NSEvent *)e { - NSEventType type; - BOOL for_appkit, for_x; - - type = [e type]; - - /* By default pass down the responder chain and to X. */ - for_appkit = YES; - for_x = YES; - - switch (type) { - case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown: - case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp: - if ([e window] != nil) { - /* Pointer event has an (AppKit) window. Probably something for the kit. */ - for_x = NO; - if (_x_active) [self activateX:NO]; - } else if ([self modalWindow] == nil) { - /* Must be an X window. Tell appkit it doesn't have focus. */ - WindowPtr pWin = xprGetXWindowFromAppKit([e windowNumber]); - if (pWin) RootlessReorderWindow(pWin); - for_appkit = NO; - - if ([self isActive]) { - [self deactivate]; - - if (!_x_active && quartzProcs->IsX11Window([e window], - [e windowNumber])) - [self activateX:YES]; - } - } - break; - - case NSKeyDown: case NSKeyUp: - if (_x_active) { - static int swallow_up; - - /* No kit window is focused, so send it to X. */ - for_appkit = NO; - if (type == NSKeyDown) { - /* Before that though, see if there are any global - shortcuts bound to it. */ - - if (X11EnableKeyEquivalents - && [[self mainMenu] performKeyEquivalent:e]) { - swallow_up = [e keyCode]; - for_x = NO; - } else if (!quartzEnableRootless - && ([e modifierFlags] & ALL_KEY_MASKS) - == (NSCommandKeyMask | NSAlternateKeyMask) - && ([e keyCode] == 0 /*a*/ - || [e keyCode] == 53 /*Esc*/)) { - swallow_up = 0; - for_x = NO; -#ifdef DARWIN_DDX_MISSING - QuartzMessageServerThread (kXDarwinToggleFullscreen, 0); -#endif - } - } else { - /* If we saw a key equivalent on the down, don't pass - the up through to X. */ - - if (swallow_up != 0 && [e keyCode] == swallow_up) { - swallow_up = 0; - for_x = NO; - } - } - } else for_x = NO; - break; + OSX_BOOL for_appkit, for_x; - case NSFlagsChanged: - /* For the l33t X users who remap modifier keys to normal keysyms. */ - if (!_x_active) for_x = NO; - break; + /* By default pass down the responder chain and to X. */ + for_appkit = YES; + for_x = YES; - case NSAppKitDefined: - switch ([e subtype]) { - case NSApplicationActivatedEventType: - for_x = NO; - if ([self modalWindow] == nil) { - for_appkit = NO; - - /* FIXME: hack to avoid having to pass the event to appkit, - which would cause it to raise one of its windows. */ - _appFlags._active = YES; - - [self activateX:YES]; - if ([e data2] & 0x10) X11ApplicationSetFrontProcess(); - } - break; - - case 18: /* ApplicationDidReactivate */ - if (quartzHasRoot) for_appkit = NO; - break; - - case NSApplicationDeactivatedEventType: - for_x = NO; - [self activateX:NO]; - break; + switch ([e type]) { + case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown: + case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp: + if ([e window] != nil) { + /* Pointer event has an (AppKit) window. Probably something for the kit. */ + for_x = NO; + if (_x_active) [self activateX:NO]; + } else if ([self modalWindow] == nil) { + /* Must be an X window. Tell appkit it doesn't have focus. */ + for_appkit = NO; + + if ([self isActive]) { + [self deactivate]; + if (!_x_active && quartzProcs->IsX11Window([e window], + [e windowNumber])) + [self activateX:YES]; + } + } + + /* We want to force sending to appkit if we're over the menu bar */ + if(!for_appkit) { + NSPoint NSlocation = [e locationInWindow]; + NSWindow *window = [e window]; + + if (window != nil) { + NSRect frame = [window frame]; + NSlocation.x += frame.origin.x; + NSlocation.y += frame.origin.y; + } + + NSRect NSframe = [[NSScreen mainScreen] frame]; + NSRect NSvisibleFrame = [[NSScreen mainScreen] visibleFrame]; + + CGRect CGframe = CGRectMake(NSframe.origin.x, NSframe.origin.y, + NSframe.size.width, NSframe.size.height); + CGRect CGvisibleFrame = CGRectMake(NSvisibleFrame.origin.x, + NSvisibleFrame.origin.y, + NSvisibleFrame.size.width, + NSvisibleFrame.size.height); + CGPoint CGlocation = CGPointMake(NSlocation.x, NSlocation.y); + + if(CGRectContainsPoint(CGframe, CGlocation) && + !CGRectContainsPoint(CGvisibleFrame, CGlocation)) + for_appkit = YES; + } + + break; + + case NSKeyDown: case NSKeyUp: + + if(_x_active) { + static BOOL do_swallow = NO; + static int swallow_keycode; + + if([e type] == NSKeyDown) { + /* Before that though, see if there are any global + * shortcuts bound to it. */ + + if(darwinAppKitModMask & [e modifierFlags]) { + /* Override to force sending to Appkit */ + swallow_keycode = [e keyCode]; + do_swallow = YES; + for_x = NO; +#if XPLUGIN_VERSION >= 1 + } else if(X11EnableKeyEquivalents && + xp_is_symbolic_hotkey_event([e eventRef])) { + swallow_keycode = [e keyCode]; + do_swallow = YES; + for_x = NO; +#endif + } else if(X11EnableKeyEquivalents && + [[self mainMenu] performKeyEquivalent:e]) { + swallow_keycode = [e keyCode]; + do_swallow = YES; + for_appkit = NO; + for_x = NO; + } else if(!quartzEnableRootless + && ([e modifierFlags] & ALL_KEY_MASKS) == (NSCommandKeyMask | NSAlternateKeyMask) + && ([e keyCode] == 0 /*a*/ || [e keyCode] == 53 /*Esc*/)) { + /* We have this here to force processing fullscreen + * toggle even if X11EnableKeyEquivalents is disabled */ + swallow_keycode = [e keyCode]; + do_swallow = YES; + for_x = NO; + for_appkit = NO; + DarwinSendDDXEvent(kXquartzToggleFullscreen, 0); + } else { + /* No kit window is focused, so send it to X. */ + for_appkit = NO; + } + } else { /* KeyUp */ + /* If we saw a key equivalent on the down, don't pass + * the up through to X. */ + if (do_swallow && [e keyCode] == swallow_keycode) { + do_swallow = NO; + for_x = NO; + } + } + } else { /* !_x_active */ + for_x = NO; + } + break; + + case NSFlagsChanged: + /* Don't tell X11 about modifiers changing while it's not active */ + if (!_x_active) + for_x = NO; + break; + + case NSAppKitDefined: + switch ([e subtype]) { + case NSApplicationActivatedEventType: + for_x = NO; + if ([self modalWindow] == nil) { + for_appkit = NO; + + /* FIXME: hack to avoid having to pass the event to appkit, + which would cause it to raise one of its windows. */ + _appFlags._active = YES; + + [self activateX:YES]; + + /* Get the Spaces preference for SwitchOnActivate */ + (void)CFPreferencesAppSynchronize(CFSTR(".GlobalPreferences")); + BOOL switch_on_activate, ok; + switch_on_activate = CFPreferencesGetAppBooleanValue(CFSTR("AppleSpacesSwitchOnActivate"), CFSTR(".GlobalPreferences"), &ok); + if(!ok) + switch_on_activate = YES; + + if ([e data2] & 0x10 && switch_on_activate) + DarwinSendDDXEvent(kXquartzBringAllToFront, 0); + } + break; + + case 18: /* ApplicationDidReactivate */ + if (quartzHasRoot) for_appkit = NO; + break; + + case NSApplicationDeactivatedEventType: + for_x = NO; + [self activateX:NO]; + break; + } + break; + + default: break; /* for gcc */ } - break; - default: break; /* for gcc */ - } - - if (for_appkit) [super sendEvent:e]; - - if (for_x) send_nsevent (type, e); + if (for_appkit) [super sendEvent:e]; + + if (for_x) [self sendX11NSEvent:e]; } - (void) set_window_menu:(NSArray *)list { - [_controller set_window_menu:list]; + [_controller set_window_menu:list]; } - (void) set_window_menu_check:(NSNumber *)n { - [_controller set_window_menu_check:n]; + [_controller set_window_menu_check:n]; } - (void) set_apps_menu:(NSArray *)list { - [_controller set_apps_menu:list]; + [_controller set_apps_menu:list]; } - (void) set_front_process:unused { - /* Hackery needed due to argv[0] hackery */ - // [self activateX:YES]; - ProcessSerialNumber psn = { 0, kCurrentProcess }; - SetFrontProcess(&psn); + [NSApp activateIgnoringOtherApps:YES]; - QuartzMessageServerThread(kXDarwinBringAllToFront, 0); + if ([self modalWindow] == nil) + [self activateX:YES]; } - (void) set_can_quit:(NSNumber *)state { - [_controller set_can_quit:[state boolValue]]; + [_controller set_can_quit:[state boolValue]]; } - (void) server_ready:unused { - [_controller server_ready]; + [_controller server_ready]; } - (void) show_hide_menubar:(NSNumber *)state { - if ([state boolValue]) ShowMenuBar (); - else HideMenuBar (); + /* Also shows/hides the dock */ + if ([state boolValue]) + SetSystemUIMode(kUIModeNormal, 0); + else + SetSystemUIMode(kUIModeAllHidden, quartzFullscreenMenu ? kUIOptionAutoShowMenuBar : 0); // kUIModeAllSuppressed or kUIOptionAutoShowMenuBar can be used to allow "mouse-activation" } @@ -350,63 +433,63 @@ static void cfrelease (CFAllocatorRef a, const void *b) { } static CFMutableArrayRef nsarray_to_cfarray (NSArray *in) { - CFMutableArrayRef out; - CFArrayCallBacks cb; - NSObject *ns; - const CFTypeRef *cf; - int i, count; - - memset (&cb, 0, sizeof (cb)); - cb.version = 0; - cb.retain = cfretain; - cb.release = cfrelease; - - count = [in count]; - out = CFArrayCreateMutable (NULL, count, &cb); - - for (i = 0; i < count; i++) { - ns = [in objectAtIndex:i]; - - if ([ns isKindOfClass:[NSArray class]]) - cf = (CFTypeRef) nsarray_to_cfarray ((NSArray *) ns); - else - cf = CFRetain ((CFTypeRef) ns); - - CFArrayAppendValue (out, cf); - CFRelease (cf); - } - - return out; + CFMutableArrayRef out; + CFArrayCallBacks cb; + NSObject *ns; + const CFTypeRef *cf; + int i, count; + + memset (&cb, 0, sizeof (cb)); + cb.version = 0; + cb.retain = cfretain; + cb.release = cfrelease; + + count = [in count]; + out = CFArrayCreateMutable (NULL, count, &cb); + + for (i = 0; i < count; i++) { + ns = [in objectAtIndex:i]; + + if ([ns isKindOfClass:[NSArray class]]) + cf = (CFTypeRef) nsarray_to_cfarray ((NSArray *) ns); + else + cf = CFRetain ((CFTypeRef) ns); + + CFArrayAppendValue (out, cf); + CFRelease (cf); + } + + return out; } static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { - NSMutableArray *out; - const CFTypeRef *cf; - NSObject *ns; - int i, count; - - count = CFArrayGetCount (in); - out = [[NSMutableArray alloc] initWithCapacity:count]; - - for (i = 0; i < count; i++) { - cf = CFArrayGetValueAtIndex (in, i); - - if (CFGetTypeID (cf) == CFArrayGetTypeID ()) - ns = cfarray_to_nsarray ((CFArrayRef) cf); - else - ns = [(id)cf retain]; - - [out addObject:ns]; - [ns release]; - } - - return out; + NSMutableArray *out; + const CFTypeRef *cf; + NSObject *ns; + int i, count; + + count = CFArrayGetCount (in); + out = [[NSMutableArray alloc] initWithCapacity:count]; + + for (i = 0; i < count; i++) { + cf = CFArrayGetValueAtIndex (in, i); + + if (CFGetTypeID (cf) == CFArrayGetTypeID ()) + ns = cfarray_to_nsarray ((CFArrayRef) cf); + else + ns = [(id)cf retain]; + + [out addObject:ns]; + [ns release]; + } + + return out; } - (CFPropertyListRef) prefs_get:(NSString *)key { CFPropertyListRef value; - value = CFPreferencesCopyAppValue ((CFStringRef) key, CFSTR (APP_PREFS)); + value = CFPreferencesCopyAppValue ((CFStringRef) key, app_prefs_domain_cfstr); if (value == NULL) { static CFDictionaryRef defaults; @@ -503,7 +586,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { if (value != NULL && CFGetTypeID (value) == CFNumberGetTypeID () - && CFNumberIsFloatType (value)) + && CFNumberIsFloatType (value)) CFNumberGetValue (value, kCFNumberFloatType, &ret); else if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ()) ret = CFStringGetDoubleValue (value); @@ -558,7 +641,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { x = CFNumberCreate (NULL, kCFNumberIntType, &value); - CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, CFSTR (APP_PREFS), + CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, app_prefs_domain_cfstr, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); CFRelease (x); @@ -569,7 +652,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { x = CFNumberCreate (NULL, kCFNumberFloatType, &value); - CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, CFSTR (APP_PREFS), + CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, app_prefs_domain_cfstr, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); CFRelease (x); @@ -577,8 +660,8 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { - (void) prefs_set_boolean:(NSString *)key value:(int)value { CFPreferencesSetValue ((CFStringRef) key, - (CFTypeRef) value ? kCFBooleanTrue - : kCFBooleanFalse, CFSTR (APP_PREFS), + (CFTypeRef) (value ? kCFBooleanTrue + : kCFBooleanFalse), app_prefs_domain_cfstr, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); } @@ -589,14 +672,14 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { cfarray = nsarray_to_cfarray (value); CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) cfarray, - CFSTR (APP_PREFS), + app_prefs_domain_cfstr, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); CFRelease (cfarray); } - (void) prefs_set_string:(NSString *)key value:(NSString *)value { CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) value, - CFSTR (APP_PREFS), kCFPreferencesCurrentUser, + app_prefs_domain_cfstr, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); } @@ -606,55 +689,65 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { - (void) read_defaults { + NSString *nsstr; const char *tem; quartzUseSysBeep = [self prefs_get_boolean:@PREFS_SYSBEEP - default:quartzUseSysBeep]; + default:quartzUseSysBeep]; quartzEnableRootless = [self prefs_get_boolean:@PREFS_ROOTLESS - default:quartzEnableRootless]; -#ifdef DARWIN_DDX_MISSING + default:quartzEnableRootless]; + quartzFullscreenMenu = [self prefs_get_boolean:@PREFS_FULLSCREEN_MENU + default:quartzFullscreenMenu]; quartzFullscreenDisableHotkeys = ![self prefs_get_boolean: - @PREFS_FULLSCREEN_HOTKEYS default: - !quartzFullscreenDisableHotkeys]; - quartzXpluginOptions = [self prefs_get_integer:@PREFS_XP_OPTIONS - default:quartzXpluginOptions]; -#endif + @PREFS_FULLSCREEN_HOTKEYS default:!quartzFullscreenDisableHotkeys]; darwinFakeButtons = [self prefs_get_boolean:@PREFS_FAKEBUTTONS - default:darwinFakeButtons]; + default:darwinFakeButtons]; if (darwinFakeButtons) { - const char *fake2, *fake3; - - fake2 = [self prefs_get_string:@PREFS_FAKE_BUTTON2 default:NULL]; - fake3 = [self prefs_get_string:@PREFS_FAKE_BUTTON3 default:NULL]; - - if (fake2 != NULL) darwinFakeMouse2Mask = DarwinParseModifierList(fake2); - if (fake3 != NULL) darwinFakeMouse3Mask = DarwinParseModifierList(fake3); + const char *fake2, *fake3; + + fake2 = [self prefs_get_string:@PREFS_FAKE_BUTTON2 default:NULL]; + fake3 = [self prefs_get_string:@PREFS_FAKE_BUTTON3 default:NULL]; + + if (fake2 != NULL) darwinFakeMouse2Mask = DarwinParseModifierList(fake2, TRUE); + if (fake3 != NULL) darwinFakeMouse3Mask = DarwinParseModifierList(fake3, TRUE); } + + tem = [self prefs_get_string:@PREFS_APPKIT_MODIFIERS default:NULL]; + if (tem != NULL) darwinAppKitModMask = DarwinParseModifierList(tem, TRUE); + tem = [self prefs_get_string:@PREFS_WINDOW_ITEM_MODIFIERS default:NULL]; + if (tem != NULL) { + windowItemModMask = DarwinParseModifierList(tem, FALSE); + } else { + nsstr = NSLocalizedString (@"window item modifiers", @"window item modifiers"); + if(nsstr != NULL) { + tem = [nsstr UTF8String]; + if((tem != NULL) && strcmp(tem, "window item modifiers")) { + windowItemModMask = DarwinParseModifierList(tem, FALSE); + } + } + } + X11EnableKeyEquivalents = [self prefs_get_boolean:@PREFS_KEYEQUIVS - default:X11EnableKeyEquivalents]; + default:X11EnableKeyEquivalents]; darwinSyncKeymap = [self prefs_get_boolean:@PREFS_SYNC_KEYMAP - default:darwinSyncKeymap]; - - tem = [self prefs_get_string:@PREFS_KEYMAP_FILE default:NULL]; - if (tem != NULL) darwinKeymapFile = strdup (tem); - else darwinKeymapFile = NULL; - + default:darwinSyncKeymap]; + darwinDesiredDepth = [self prefs_get_integer:@PREFS_DEPTH - default:darwinDesiredDepth]; - - enable_stereo = [self prefs_get_boolean:@PREFS_ENABLE_STEREO - default:false]; + default:darwinDesiredDepth]; + + noTestExtensions = ![self prefs_get_boolean:@PREFS_TEST_EXTENSIONS + default:FALSE]; } /* This will end up at the end of the responder chain. */ - (void) copy:sender { - QuartzMessageServerThread (kXDarwinPasteboardNotify, 1, + DarwinSendDDXEvent(kXquartzPasteboardNotify, 1, AppleWMCopyToPasteboard); } -- (BOOL) x_active { +- (OSX_BOOL) x_active { return _x_active; } @@ -741,19 +834,6 @@ void X11ApplicationShowHideMenubar (int state) { [n release]; } -static void * create_thread (void *func, void *arg) { - pthread_attr_t attr; - pthread_t tid; - - pthread_attr_init (&attr); - pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM); - pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); - pthread_create (&tid, &attr, func, arg); - pthread_attr_destroy (&attr); - - return (void *) tid; -} - static void check_xinitrc (void) { char *tem, buf[1024]; NSString *msg; @@ -768,26 +848,23 @@ static void check_xinitrc (void) { if (access (buf, F_OK) != 0) goto done; - /* FIXME: put localized strings into Resources/English.lproj */ - msg = NSLocalizedString (@"You have an existing ~/.xinitrc file.\n\n\ Windows displayed by X11 applications may not have titlebars, or may look \ different to windows displayed by native applications.\n\n\ Would you like to move aside the existing file and use the standard X11 \ -environment?", @"Startup xinitrc dialog"); - - if (NSRunAlertPanel (nil, msg, NSLocalizedString (@"Yes", @""), - NSLocalizedString (@"No", @""), nil) - == NSAlertDefaultReturn) { - char buf2[1024]; - int i = -1; - - snprintf (buf2, sizeof (buf2), "%s.old", buf); +environment the next time you start X11?", @"Startup xinitrc dialog"); + + if(NSAlertDefaultReturn == NSRunAlertPanel (nil, msg, NSLocalizedString (@"Yes", @""), + NSLocalizedString (@"No", @""), nil)) { + char buf2[1024]; + int i = -1; - for (i = 1; access (buf2, F_OK) == 0; i++) - snprintf (buf2, sizeof (buf2), "%s.old.%d", buf, i); + snprintf (buf2, sizeof (buf2), "%s.old", buf); - rename (buf, buf2); + for(i = 1; access (buf2, F_OK) == 0; i++) + snprintf (buf2, sizeof (buf2), "%s.old.%d", buf, i); + + rename (buf, buf2); } done: @@ -795,8 +872,9 @@ environment?", @"Startup xinitrc dialog"); [X11App prefs_synchronize]; } -void X11ApplicationMain (int argc, const char **argv, void (*server_thread) (void *), void *server_arg) { +void X11ApplicationMain (int argc, char **argv, char **envp) { NSAutoreleasePool *pool; + int *p; #ifdef DEBUG while (access ("/tmp/x11-block", F_OK) == 0) sleep (1); @@ -805,12 +883,14 @@ void X11ApplicationMain (int argc, const char **argv, void (*server_thread) (voi pool = [[NSAutoreleasePool alloc] init]; X11App = (X11Application *) [X11Application sharedApplication]; init_ports (); + + app_prefs_domain_cfstr = (CFStringRef)[[NSBundle mainBundle] bundleIdentifier]; + [NSApp read_defaults]; [NSBundle loadNibNamed:@"main" owner:NSApp]; [[NSNotificationCenter defaultCenter] addObserver:NSApp selector:@selector (became_key:) name:NSWindowDidBecomeKeyNotification object:nil]; - check_xinitrc (); /* * The xpr Quartz mode is statically linked into this server. @@ -821,102 +901,255 @@ void X11ApplicationMain (int argc, const char **argv, void (*server_thread) (voi /* Calculate the height of the menubar so we can avoid it. */ aquaMenuBarHeight = NSHeight([[NSScreen mainScreen] frame]) - NSMaxY([[NSScreen mainScreen] visibleFrame]); - - if (!create_thread (server_thread, server_arg)) { - ErrorF("can't create secondary thread\n"); - exit (1); - } - QuartzMoveToForeground(); + /* Set the key layout seed before we start the server */ +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 + last_key_layout = TISCopyCurrentKeyboardLayoutInputSource(); + if(!last_key_layout) + fprintf(stderr, "X11ApplicationMain: Unable to determine TISCopyCurrentKeyboardLayoutInputSource() at startup.\n"); +#else + KLGetCurrentKeyboardLayout(&last_key_layout); + if(!last_key_layout) + fprintf(stderr, "X11ApplicationMain: Unable to determine KLGetCurrentKeyboardLayout() at startup.\n"); +#endif + + memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap)); + if (!QuartzReadSystemKeymap(&keyInfo)) { + fprintf(stderr, "X11ApplicationMain: Could not build a valid keymap.\n"); + } + + for(p=darwin_modifier_mask_list, modifierFlagsMask=0; *p; p++) { + modifierFlagsMask |= *p; + } + + /* Tell the server thread that it can proceed */ + QuartzInitServer(argc, argv, envp); + + /* This must be done after QuartzInitServer because it can result in + * an mieqEnqueue() - <rdar://problem/6300249> + */ + check_xinitrc(); + + if(!xpbproxy_init()) + fprintf(stderr, "Error initializing xpbproxy\n"); + [NSApp run]; /* not reached */ } -/* event conversion */ - -static inline unsigned short -convert_flags (unsigned int nsflags) { - unsigned int xflags = 0; - - if (nsflags == ~0) return 0xffff; - - if (nsflags & NSAlphaShiftKeyMask) xflags |= LockMask; - if (nsflags & NSShiftKeyMask) xflags |= ShiftMask; - if (nsflags & NSControlKeyMask) xflags |= ControlMask; - if (nsflags & NSAlternateKeyMask) xflags |= Mod1Mask; - if (nsflags & NSCommandKeyMask) xflags |= Mod2Mask; - /* FIXME: secondaryfn? */ - - return xflags; +@implementation X11Application (Private) + +#ifdef NX_DEVICELCMDKEYMASK +/* This is to workaround a bug in the VNC server where we sometimes see the L + * modifier and sometimes see no "side" + */ +static inline int ensure_flag(int flags, int device_independent, int device_dependents, int device_dependent_default) { + if( (flags & device_independent) && + !(flags & device_dependents)) + flags |= device_dependent_default; + return flags; } +#endif - -// This code should probably be merged with that in XDarwin's XServer.m - BB -static void send_nsevent (NSEventType type, NSEvent *e) { - // static unsigned int button_state = 0; +- (void) sendX11NSEvent:(NSEvent *)e { NSRect screen; NSPoint location; NSWindow *window; - int pointer_x, pointer_y, ev_button, ev_type; - // int num_events=0, i=0, state; - // xEvent xe; - - /* convert location to global top-left coordinates */ + int ev_button, ev_type; + float pointer_x, pointer_y, pressure, tilt_x, tilt_y; + DeviceIntPtr pDev; + int modifierFlags; + + /* convert location to be relative to top-left of primary display */ location = [e locationInWindow]; window = [e window]; screen = [[[NSScreen screens] objectAtIndex:0] frame]; - + if (window != nil) { - NSRect frame = [window frame]; - pointer_x = location.x + frame.origin.x; - pointer_y = (((screen.origin.y + screen.size.height) - - location.y) - frame.origin.y); + NSRect frame = [window frame]; + pointer_x = location.x + frame.origin.x; + pointer_y = (screen.origin.y + screen.size.height) + - (location.y + frame.origin.y); } else { - pointer_x = location.x; - pointer_y = (screen.origin.y + screen.size.height) - location.y; + pointer_x = location.x; + pointer_y = (screen.origin.y + screen.size.height) - location.y; } + + /* Setup our valuators. These will range from 0 to 1 */ + pressure = 0; + tilt_x = 0; + tilt_y = 0; - pointer_y -= aquaMenuBarHeight; - // state = convert_flags ([e modifierFlags]); + modifierFlags = [e modifierFlags]; - switch (type) { - case NSLeftMouseDown: ev_button=1; ev_type=ButtonPress; goto handle_mouse; - case NSOtherMouseDown: ev_button=2; ev_type=ButtonPress; goto handle_mouse; - case NSRightMouseDown: ev_button=3; ev_type=ButtonPress; goto handle_mouse; - case NSLeftMouseUp: ev_button=1; ev_type=ButtonRelease; goto handle_mouse; - case NSOtherMouseUp: ev_button=2; ev_type=ButtonRelease; goto handle_mouse; - case NSRightMouseUp: ev_button=3; ev_type=ButtonRelease; goto handle_mouse; - case NSLeftMouseDragged: ev_button=1; ev_type=MotionNotify; goto handle_mouse; - case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify; goto handle_mouse; - case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify; goto handle_mouse; - case NSMouseMoved: ev_button=0; ev_type=MotionNotify; goto handle_mouse; - handle_mouse: - - /* I'm not sure the below code is necessary or useful (-bb) - if(ev_type==ButtonPress) { - if (!quartzProcs->IsX11Window([e window], [e windowNumber])) { - fprintf(stderr, "Dropping event because it's not a window\n"); - break; - } - button_state |= (1 << ev_button); - DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y); - } else if (ev_type==ButtonRelease && (button_state & (1 << ev_button)) == 0) break; - */ - DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y); - break; - case NSScrollWheel: - DarwinSendScrollEvents([e deltaY], pointer_x, pointer_y); - break; - - case NSKeyDown: // do we need to translate these keyCodes? - case NSKeyUp: - DarwinSendKeyboardEvents((type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]); - break; +#ifdef NX_DEVICELCMDKEYMASK + /* This is to workaround a bug in the VNC server where we sometimes see the L + * modifier and sometimes see no "side" + */ + modifierFlags = ensure_flag(modifierFlags, NX_CONTROLMASK, NX_DEVICELCTLKEYMASK | NX_DEVICERCTLKEYMASK, NX_DEVICELCTLKEYMASK); + modifierFlags = ensure_flag(modifierFlags, NX_SHIFTMASK, NX_DEVICELSHIFTKEYMASK | NX_DEVICERSHIFTKEYMASK, NX_DEVICELSHIFTKEYMASK); + modifierFlags = ensure_flag(modifierFlags, NX_COMMANDMASK, NX_DEVICELCMDKEYMASK | NX_DEVICERCMDKEYMASK, NX_DEVICELCMDKEYMASK); + modifierFlags = ensure_flag(modifierFlags, NX_ALTERNATEMASK, NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK, NX_DEVICELALTKEYMASK); +#endif + + modifierFlags &= modifierFlagsMask; - case NSFlagsChanged: - DarwinUpdateModKeys([e modifierFlags]); - break; - default: break; /* for gcc */ - } + /* We don't receive modifier key events while out of focus, and 3button + * emulation mucks this up, so we need to check our modifier flag state + * on every event... ugg + */ + + if(darwin_modifier_flags != modifierFlags) + DarwinUpdateModKeys(modifierFlags); + + switch ([e type]) { + case NSLeftMouseDown: ev_button=1; ev_type=ButtonPress; goto handle_mouse; + case NSOtherMouseDown: ev_button=2; ev_type=ButtonPress; goto handle_mouse; + case NSRightMouseDown: ev_button=3; ev_type=ButtonPress; goto handle_mouse; + case NSLeftMouseUp: ev_button=1; ev_type=ButtonRelease; goto handle_mouse; + case NSOtherMouseUp: ev_button=2; ev_type=ButtonRelease; goto handle_mouse; + case NSRightMouseUp: ev_button=3; ev_type=ButtonRelease; goto handle_mouse; + case NSLeftMouseDragged: ev_button=1; ev_type=MotionNotify; goto handle_mouse; + case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify; goto handle_mouse; + case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify; goto handle_mouse; + case NSMouseMoved: ev_button=0; ev_type=MotionNotify; goto handle_mouse; + case NSTabletPoint: ev_button=0; ev_type=MotionNotify; goto handle_mouse; + + handle_mouse: + pDev = darwinPointer; + + /* NSTabletPoint can have no subtype */ + if([e type] != NSTabletPoint && + [e subtype] == NSTabletProximityEventSubtype) { + switch([e pointingDeviceType]) { + case NSEraserPointingDevice: + darwinTabletCurrent=darwinTabletEraser; + break; + case NSPenPointingDevice: + darwinTabletCurrent=darwinTabletStylus; + break; + case NSCursorPointingDevice: + case NSUnknownPointingDevice: + default: + darwinTabletCurrent=darwinTabletCursor; + break; + } + + /* NSTabletProximityEventSubtype doesn't encode pressure ant tilt + * So we just pretend the motion was caused by the mouse. Hopefully + * we'll have a better solution for this in the future (like maybe + * NSTabletProximityEventSubtype will come from NSTabletPoint + * rather than NSMouseMoved. + pressure = [e pressure]; + tilt_x = [e tilt].x; + tilt_y = [e tilt].y; + pDev = darwinTabletCurrent; + */ + + DarwinSendProximityEvents([e isEnteringProximity]?ProximityIn:ProximityOut, + pointer_x, pointer_y); + } + + if ([e type] == NSTabletPoint || [e subtype] == NSTabletPointEventSubtype) { + pressure = [e pressure]; + tilt_x = [e tilt].x; + tilt_y = [e tilt].y; + + pDev = darwinTabletCurrent; + } + +/* Older libXplugin (Tiger/"Stock" Leopard) aren't thread safe, so we can't call xp_find_window from the Appkit thread */ +#ifdef XPLUGIN_VERSION +#if XPLUGIN_VERSION > 0 + if(!quartzServerVisible) { + xp_window_id wid; + + /* Sigh. Need to check that we're really over one of + * our windows. (We need to receive pointer events while + * not in the foreground, but we don't want to receive them + * when another window is over us or we might show a tooltip) + */ + + wid = 0; + + if (xp_find_window(pointer_x, pointer_y, 0, &wid) == XP_Success && + wid == 0) + return; + } +#endif +#endif + + DarwinSendPointerEvents(pDev, ev_type, ev_button, pointer_x, pointer_y, + pressure, tilt_x, tilt_y); + + break; + + case NSTabletProximity: + switch([e pointingDeviceType]) { + case NSEraserPointingDevice: + darwinTabletCurrent=darwinTabletEraser; + break; + case NSPenPointingDevice: + darwinTabletCurrent=darwinTabletStylus; + break; + case NSCursorPointingDevice: + case NSUnknownPointingDevice: + default: + darwinTabletCurrent=darwinTabletCursor; + break; + } + + DarwinSendProximityEvents([e isEnteringProximity]?ProximityIn:ProximityOut, + pointer_x, pointer_y); + break; + + case NSScrollWheel: + DarwinSendScrollEvents([e deltaX], [e deltaY], pointer_x, pointer_y, + pressure, tilt_x, tilt_y); + break; + + case NSKeyDown: case NSKeyUp: + if(darwinSyncKeymap) { +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 + TISInputSourceRef key_layout = TISCopyCurrentKeyboardLayoutInputSource(); + TISInputSourceRef clear; + if (CFEqual(key_layout, last_key_layout)) { + CFRelease(key_layout); + } else { + /* Swap/free thread-safely */ + clear = last_key_layout; + last_key_layout = key_layout; + CFRelease(clear); +#else + KeyboardLayoutRef key_layout; + KLGetCurrentKeyboardLayout(&key_layout); + if(key_layout != last_key_layout) { + last_key_layout = key_layout; +#endif + + /* Update keyInfo */ + pthread_mutex_lock(&keyInfo_mutex); + memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap)); + if (!QuartzReadSystemKeymap(&keyInfo)) { + fprintf(stderr, "sendX11NSEvent: Could not build a valid keymap.\n"); + } + pthread_mutex_unlock(&keyInfo_mutex); + + /* Tell server thread to deal with new keyInfo */ + DarwinSendDDXEvent(kXquartzReloadKeymap, 0); + } + } + + /* Avoid stuck keys on context switch */ + if(keyState[[e keyCode]] == [e type]) + return; + keyState[[e keyCode]] = [e type]; + + DarwinSendKeyboardEvents(([e type] == NSKeyDown) ? KeyPress : KeyRelease, [e keyCode]); + break; + + default: break; /* for gcc */ + } } +@end diff --git a/xorg-server/hw/xquartz/X11Controller.h b/xorg-server/hw/xquartz/X11Controller.h index 64d5cd1ce..bb9adb1ce 100644 --- a/xorg-server/hw/xquartz/X11Controller.h +++ b/xorg-server/hw/xquartz/X11Controller.h @@ -32,7 +32,7 @@ #if __OBJC__ -#import <Cocoa/Cocoa.h> +#include "sanitizedCocoa.h" #include "xpr/x-list.h" @interface X11Controller : NSObject @@ -41,12 +41,22 @@ IBOutlet NSButton *fake_buttons; IBOutlet NSButton *enable_fullscreen; + IBOutlet NSButton *enable_fullscreen_menu; IBOutlet NSButton *use_sysbeep; IBOutlet NSButton *enable_keyequivs; IBOutlet NSButton *sync_keymap; IBOutlet NSButton *click_through; + IBOutlet NSButton *focus_follows_mouse; + IBOutlet NSButton *focus_on_new_window; IBOutlet NSButton *enable_auth; IBOutlet NSButton *enable_tcp; + IBOutlet NSButton *sync_pasteboard; + IBOutlet NSButton *sync_pasteboard_to_clipboard; + IBOutlet NSButton *sync_pasteboard_to_primary; + IBOutlet NSButton *sync_clipboard_to_pasteboard; + IBOutlet NSButton *sync_primary_immediately; + IBOutlet NSTextField *sync_text1; + IBOutlet NSTextField *sync_text2; IBOutlet NSPopUpButton *depth; IBOutlet NSMenuItem *x11_about_item; @@ -54,6 +64,7 @@ IBOutlet NSMenuItem *dock_window_separator; IBOutlet NSMenuItem *apps_separator; IBOutlet NSMenuItem *toggle_fullscreen_item; + IBOutlet NSMenuItem *copy_menu_item; IBOutlet NSMenu *dock_apps_menu; IBOutlet NSTableView *apps_table; @@ -65,18 +76,17 @@ int checked_window_item; x_list *pending_apps; - BOOL finished_launching; - BOOL can_quit; + OSX_BOOL finished_launching; + OSX_BOOL can_quit; } - (void) set_window_menu:(NSArray *)list; - (void) set_window_menu_check:(NSNumber *)n; - (void) set_apps_menu:(NSArray *)list; -- (void) set_can_quit:(BOOL)state; +- (void) set_can_quit:(OSX_BOOL)state; - (void) server_ready; - (IBAction) apps_table_show:(id)sender; -- (IBAction) apps_table_cancel:(id)sender; - (IBAction) apps_table_done:(id)sender; - (IBAction) apps_table_new:(id)sender; - (IBAction) apps_table_duplicate:(id)sender; @@ -98,6 +108,6 @@ #endif /* __OBJC__ */ -void X11ControllerMain(int argc, const char **argv, void (*server_thread) (void *), void *server_arg); +void X11ControllerMain(int argc, char **argv, char **envp); #endif /* X11CONTROLLER_H */ diff --git a/xorg-server/hw/xquartz/X11Controller.m b/xorg-server/hw/xquartz/X11Controller.m index 5111eafc3..adf861ca9 100644 --- a/xorg-server/hw/xquartz/X11Controller.m +++ b/xorg-server/hw/xquartz/X11Controller.m @@ -1,6 +1,6 @@ /* X11Controller.m -- connect the IB ui, also the NSApp delegate - Copyright (c) 2002-2007 Apple Inc. All rights reserved. + Copyright (c) 2002-2008 Apple Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files @@ -27,27 +27,25 @@ promote the sale, use or other dealings in this Software without prior written authorization. */ +#include "sanitizedCarbon.h" +#include <AvailabilityMacros.h> + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif -#define DEFAULT_PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11/bin" - #include "quartzCommon.h" #import "X11Controller.h" #import "X11Application.h" -#import <Carbon/Carbon.h> -/* ouch! */ -#define BOOL X_BOOL #include "opaque.h" -# include "darwin.h" -# include "quartz.h" -# define _APPLEWM_SERVER_ -# include "X11/extensions/applewm.h" -# include "applewmExt.h" -#undef BOOL +#include "darwin.h" +#include "darwinEvents.h" +#include "quartz.h" +#define _APPLEWM_SERVER_ +#include "X11/extensions/applewm.h" +#include "applewmExt.h" #include <stdio.h> #include <unistd.h> @@ -55,6 +53,8 @@ #include <sys/types.h> #include <sys/wait.h> +BOOL xquartz_resetenv_display = NO; + @implementation X11Controller - (void) awakeFromNib @@ -97,13 +97,20 @@ [self set_apps_menu:array]; } + + [[NSNotificationCenter defaultCenter] + addObserver: self + selector: @selector(apps_table_done:) + name: NSWindowWillCloseNotification + object: [apps_table window]]; + } - (void) item_selected:sender { [NSApp activateIgnoringOtherApps:YES]; - QuartzMessageServerThread (kXDarwinControllerNotify, 2, + DarwinSendDDXEvent(kXquartzControllerNotify, 2, AppleWMWindowMenuItem, [sender tag]); } @@ -130,7 +137,7 @@ NSMenu *menu; NSMenuItem *item; int first, count, i; - + menu = [window_separator menu]; first = [menu indexOfItem:window_separator] + 1; count = [list count]; @@ -140,17 +147,30 @@ name = [[list objectAtIndex:i] objectAtIndex:0]; shortcut = [[list objectAtIndex:i] objectAtIndex:1]; - + + if(windowItemModMask == 0 || windowItemModMask == -1) + shortcut = @""; + item = (NSMenuItem *) [menu addItemWithTitle:name action:@selector (item_selected:) keyEquivalent:shortcut]; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 + [item setKeyEquivalentModifierMask:(NSUInteger) windowItemModMask]; +#else + [item setKeyEquivalentModifierMask:windowItemModMask]; +#endif [item setTarget:self]; [item setTag:i]; [item setEnabled:YES]; - + item = (NSMenuItem *) [dock_menu insertItemWithTitle:name action:@selector (item_selected:) keyEquivalent:shortcut atIndex:i]; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 + [item setKeyEquivalentModifierMask:(NSUInteger) windowItemModMask]; +#else + [item setKeyEquivalentModifierMask:windowItemModMask]; +#endif [item setTarget:self]; [item setTag:i]; [item setEnabled:YES]; @@ -254,7 +274,7 @@ [self remove_window_menu]; [self install_window_menu:list]; - QuartzMessageServerThread (kXDarwinControllerNotify, 1, + DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMWindowMenuNotify); } @@ -294,76 +314,59 @@ - (void) launch_client:(NSString *)filename { - const char *command = [filename UTF8String]; - const char *argv[7]; - int child1, child2 = 0; - int status; - - argv[0] = "/usr/bin/login"; - argv[1] = "-fp"; - argv[2] = getlogin(); - argv[3] = [X11App prefs_get_string:@PREFS_LOGIN_SHELL default:"/bin/sh"]; - argv[4] = "-c"; - argv[5] = command; - argv[6] = NULL; - - /* Do the fork-twice trick to avoid having to reap zombies */ + int child1, child2 = 0; + int status; + const char *newargv[4]; + char buf[128]; + char *s; - child1 = fork(); + newargv[0] = [X11App prefs_get_string:@PREFS_LOGIN_SHELL default:"/bin/sh"]; + newargv[1] = "-c"; + newargv[2] = [filename UTF8String]; + newargv[3] = NULL; - switch (child1) { - case -1: /* error */ - break; + s = getenv("DISPLAY"); + if (xquartz_resetenv_display || s == NULL || s[0] == 0) { + snprintf(buf, sizeof(buf), ":%s", display); + setenv("DISPLAY", buf, TRUE); + } + + /* Do the fork-twice trick to avoid having to reap zombies */ + child1 = fork(); + switch (child1) { + case -1: /* error */ + break; - case 0: /* child1 */ - child2 = fork(); + case 0: /* child1 */ + child2 = fork(); - switch (child2) { - int max_files, i; - char buf[1024], *temp; - - case -1: /* error */ - _exit(1); - - case 0: /* child2 */ - /* close all open files except for standard streams */ - max_files = sysconf(_SC_OPEN_MAX); - for (i = 3; i < max_files; i++) close(i); - - /* ensure stdin is on /dev/null */ - close(0); - open("/dev/null", O_RDONLY); - - /* Setup environment */ - temp = getenv("DISPLAY"); - if (temp == NULL || temp[0] == 0) { - snprintf(buf, sizeof(buf), ":%s", display); - setenv("DISPLAY", buf, TRUE); - } - - temp = getenv("PATH"); - if (temp == NULL || temp[0] == 0) - setenv ("PATH", DEFAULT_PATH, TRUE); - else if (strnstr(temp, "/usr/X11/bin", sizeof(temp)) == NULL) { - snprintf(buf, sizeof(buf), "%s:/usr/X11/bin", temp); - setenv("PATH", buf, TRUE); - } - /* cd $HOME */ - temp = getenv("HOME"); - if (temp != NULL && temp[0]!=0) chdir(temp); - - execvp(argv[0], (char **const) argv); - - _exit(2); - - default: /* parent (child1) */ - _exit(0); - } - break; + switch (child2) { + int max_files, i; + + case -1: /* error */ + _exit(1); + + case 0: /* child2 */ + /* close all open files except for standard streams */ + max_files = sysconf(_SC_OPEN_MAX); + for(i = 3; i < max_files; i++) + close(i); + + /* ensure stdin is on /dev/null */ + close(0); + open("/dev/null", O_RDONLY); + + execvp(newargv[0], (char **const) newargv); + _exit(2); + + default: /* parent (child1) */ + _exit(0); + } + break; - default: /* parent */ - waitpid(child1, &status, 0); - } + default: /* parent */ + waitpid(child1, &status, 0); + } } - (void) app_selected:sender @@ -383,12 +386,14 @@ - (IBAction) apps_table_show:sender { NSArray *columns; + NSMutableArray *oldapps = nil; - if (table_apps == nil) { - table_apps = [[NSMutableArray alloc] initWithCapacity:1]; - - if (apps != nil)[table_apps addObjectsFromArray:apps]; - } + if (table_apps != nil) + oldapps = table_apps; + + table_apps = [[NSMutableArray alloc] initWithCapacity:1]; + if(apps != nil) + [table_apps addObjectsFromArray:apps]; columns = [apps_table tableColumns]; [[columns objectAtIndex:0] setIdentifier:@"0"]; @@ -399,15 +404,9 @@ [apps_table selectRow:0 byExtendingSelection:NO]; [[apps_table window] makeKeyAndOrderFront:sender]; -} - -- (IBAction) apps_table_cancel:sender -{ - [[apps_table window] orderOut:sender]; [apps_table reloadData]; - - [table_apps release]; - table_apps = nil; + if(oldapps != nil) + [oldapps release]; } - (IBAction) apps_table_done:sender @@ -539,20 +538,20 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (void) hide_window:sender { if ([X11App x_active]) - QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMHideWindow); + DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMHideWindow); else NSBeep (); /* FIXME: something here */ } - (IBAction)bring_to_front:sender { - QuartzMessageServerThread(kXDarwinControllerNotify, 1, AppleWMBringAllToFront); + DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMBringAllToFront); } - (IBAction)close_window:sender { if ([X11App x_active]) - QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMCloseWindow); + DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMCloseWindow); else [[NSApp keyWindow] performClose:sender]; } @@ -560,7 +559,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (IBAction)minimize_window:sender { if ([X11App x_active]) - QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMMinimizeWindow); + DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMMinimizeWindow); else [[NSApp keyWindow] performMiniaturize:sender]; } @@ -568,101 +567,145 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (IBAction)zoom_window:sender { if ([X11App x_active]) - QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMZoomWindow); + DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMZoomWindow); else [[NSApp keyWindow] performZoom:sender]; } - (IBAction) next_window:sender { - QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMNextWindow); + DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMNextWindow); } - (IBAction) previous_window:sender { - QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMPreviousWindow); + DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMPreviousWindow); } -- (IBAction) enable_fullscreen_changed:sender -{ - int value = ![enable_fullscreen intValue]; - -#ifdef DARWIN_DDX_MISSING - QuartzMessageServerThread (kXDarwinSetRootless, 1, value); -#endif - - [NSApp prefs_set_boolean:@PREFS_ROOTLESS value:value]; - [NSApp prefs_synchronize]; +- (IBAction) enable_fullscreen_changed:sender { + int value = ![enable_fullscreen intValue]; + + [enable_fullscreen_menu setEnabled:!value]; + + DarwinSendDDXEvent(kXquartzSetRootless, 1, value); + + [NSApp prefs_set_boolean:@PREFS_ROOTLESS value:value]; + [NSApp prefs_synchronize]; } - (IBAction) toggle_fullscreen:sender { -#ifdef DARWIN_DDX_MISSING - QuartzMessageServerThread (kXDarwinToggleFullscreen, 0); -#endif + DarwinSendDDXEvent(kXquartzToggleFullscreen, 0); } -- (void) set_can_quit:(BOOL)state +- (void) set_can_quit:(OSX_BOOL)state { can_quit = state; } - (IBAction)prefs_changed:sender { - darwinFakeButtons = [fake_buttons intValue]; - quartzUseSysBeep = [use_sysbeep intValue]; - X11EnableKeyEquivalents = [enable_keyequivs intValue]; - darwinSyncKeymap = [sync_keymap intValue]; - - /* after adding prefs here, also add to [X11Application read_defaults] - and below */ - - [NSApp prefs_set_boolean:@PREFS_FAKEBUTTONS value:darwinFakeButtons]; - [NSApp prefs_set_boolean:@PREFS_SYSBEEP value:quartzUseSysBeep]; - [NSApp prefs_set_boolean:@PREFS_KEYEQUIVS value:X11EnableKeyEquivalents]; - [NSApp prefs_set_boolean:@PREFS_SYNC_KEYMAP value:darwinSyncKeymap]; - [NSApp prefs_set_boolean:@PREFS_QUARTZ_WM_CLICK_THROUGH value:[click_through intValue]]; - [NSApp prefs_set_boolean:@PREFS_NO_AUTH value:![enable_auth intValue]]; - [NSApp prefs_set_boolean:@PREFS_NO_TCP value:![enable_tcp intValue]]; - [NSApp prefs_set_integer:@PREFS_DEPTH value:[depth selectedTag]]; - - [NSApp prefs_synchronize]; + darwinFakeButtons = [fake_buttons intValue]; + quartzUseSysBeep = [use_sysbeep intValue]; + X11EnableKeyEquivalents = [enable_keyequivs intValue]; + darwinSyncKeymap = [sync_keymap intValue]; + quartzFullscreenMenu = [enable_fullscreen_menu intValue]; + + /* after adding prefs here, also add to [X11Application read_defaults] + and prefs_show */ + + [NSApp prefs_set_boolean:@PREFS_FAKEBUTTONS value:darwinFakeButtons]; + [NSApp prefs_set_boolean:@PREFS_SYSBEEP value:quartzUseSysBeep]; + [NSApp prefs_set_boolean:@PREFS_KEYEQUIVS value:X11EnableKeyEquivalents]; + [NSApp prefs_set_boolean:@PREFS_SYNC_KEYMAP value:darwinSyncKeymap]; + [NSApp prefs_set_boolean:@PREFS_FULLSCREEN_MENU value:quartzFullscreenMenu]; + [NSApp prefs_set_boolean:@PREFS_CLICK_THROUGH value:[click_through intValue]]; + [NSApp prefs_set_boolean:@PREFS_FFM value:[focus_follows_mouse intValue]]; + [NSApp prefs_set_boolean:@PREFS_FOCUS_ON_NEW_WINDOW value:[focus_on_new_window intValue]]; + [NSApp prefs_set_boolean:@PREFS_NO_AUTH value:![enable_auth intValue]]; + [NSApp prefs_set_boolean:@PREFS_NO_TCP value:![enable_tcp intValue]]; + [NSApp prefs_set_integer:@PREFS_DEPTH value:[depth selectedTag]]; + + BOOL pbproxy_active = [sync_pasteboard intValue]; + + [NSApp prefs_set_boolean:@PREFS_SYNC_PB value:pbproxy_active]; + [NSApp prefs_set_boolean:@PREFS_SYNC_PB_TO_CLIPBOARD value:[sync_pasteboard_to_clipboard intValue]]; + [NSApp prefs_set_boolean:@PREFS_SYNC_PB_TO_PRIMARY value:[sync_pasteboard_to_primary intValue]]; + [NSApp prefs_set_boolean:@PREFS_SYNC_CLIPBOARD_TO_PB value:[sync_clipboard_to_pasteboard intValue]]; + [NSApp prefs_set_boolean:@PREFS_SYNC_PRIMARY_ON_SELECT value:[sync_primary_immediately intValue]]; + + [NSApp prefs_synchronize]; + + [sync_pasteboard_to_clipboard setEnabled:pbproxy_active]; + [sync_pasteboard_to_primary setEnabled:pbproxy_active]; + [sync_clipboard_to_pasteboard setEnabled:pbproxy_active]; + [sync_primary_immediately setEnabled:pbproxy_active]; + + // setEnabled doesn't do this... + [sync_text1 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]]; + [sync_text2 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]]; + + DarwinSendDDXEvent(kXquartzReloadPreferences, 0); } - (IBAction) prefs_show:sender { - [fake_buttons setIntValue:darwinFakeButtons]; - [use_sysbeep setIntValue:quartzUseSysBeep]; - [enable_keyequivs setIntValue:X11EnableKeyEquivalents]; - [sync_keymap setIntValue:darwinSyncKeymap]; - [sync_keymap setEnabled:darwinKeymapFile == NULL]; - [click_through setIntValue:[NSApp prefs_get_boolean:@PREFS_QUARTZ_WM_CLICK_THROUGH default:NO]]; - - [enable_auth setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_AUTH default:NO]]; - [enable_tcp setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_TCP default:NO]]; - [depth selectItemAtIndex:[depth indexOfItemWithTag:[NSApp prefs_get_integer:@PREFS_DEPTH default:-1]]]; - - [enable_fullscreen setIntValue:!quartzEnableRootless]; + BOOL pbproxy_active = [NSApp prefs_get_boolean:@PREFS_SYNC_PB default:YES]; + + [fake_buttons setIntValue:darwinFakeButtons]; + [use_sysbeep setIntValue:quartzUseSysBeep]; + [enable_keyequivs setIntValue:X11EnableKeyEquivalents]; + [sync_keymap setIntValue:darwinSyncKeymap]; + [click_through setIntValue:[NSApp prefs_get_boolean:@PREFS_CLICK_THROUGH default:NO]]; + [focus_follows_mouse setIntValue:[NSApp prefs_get_boolean:@PREFS_FFM default:NO]]; + [focus_on_new_window setIntValue:[NSApp prefs_get_boolean:@PREFS_FOCUS_ON_NEW_WINDOW default:YES]]; + + [enable_auth setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_AUTH default:NO]]; + [enable_tcp setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_TCP default:NO]]; + + [depth selectItemAtIndex:[depth indexOfItemWithTag:[NSApp prefs_get_integer:@PREFS_DEPTH default:-1]]]; + + [sync_pasteboard setIntValue:pbproxy_active]; + [sync_pasteboard_to_clipboard setIntValue:[NSApp prefs_get_boolean:@PREFS_SYNC_PB_TO_CLIPBOARD default:YES]]; + [sync_pasteboard_to_primary setIntValue:[NSApp prefs_get_boolean:@PREFS_SYNC_PB_TO_PRIMARY default:YES]]; + [sync_clipboard_to_pasteboard setIntValue:[NSApp prefs_get_boolean:@PREFS_SYNC_CLIPBOARD_TO_PB default:YES]]; + [sync_primary_immediately setIntValue:[NSApp prefs_get_boolean:@PREFS_SYNC_PRIMARY_ON_SELECT default:NO]]; + + [sync_pasteboard_to_clipboard setEnabled:pbproxy_active]; + [sync_pasteboard_to_primary setEnabled:pbproxy_active]; + [sync_clipboard_to_pasteboard setEnabled:pbproxy_active]; + [sync_primary_immediately setEnabled:pbproxy_active]; + + // setEnabled doesn't do this... + [sync_text1 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]]; + [sync_text2 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]]; - [prefs_panel makeKeyAndOrderFront:sender]; + [enable_fullscreen setIntValue:!quartzEnableRootless]; + [enable_fullscreen_menu setEnabled:!quartzEnableRootless]; + [enable_fullscreen_menu setIntValue:quartzFullscreenMenu]; + + [prefs_panel makeKeyAndOrderFront:sender]; } -- (IBAction) quit:sender -{ - QuartzMessageServerThread (kXDarwinQuit, 0); +- (IBAction) quit:sender { + DarwinSendDDXEvent(kXquartzQuit, 0); } -- (IBAction) x11_help:sender -{ - AHLookupAnchor ((CFStringRef)NSLocalizedString(@"Mac Help", no comment), CFSTR ("mchlp2276")); +- (IBAction) x11_help:sender { +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 + AHLookupAnchor((CFStringRef)NSLocalizedString(@"Mac Help", no comment), CFSTR("mchlp2276")); +#else + AHLookupAnchor(CFSTR("com.apple.machelp"), CFSTR("mchlp2276")); +#endif } -- (BOOL) validateMenuItem:(NSMenuItem *)item -{ +- (OSX_BOOL) validateMenuItem:(NSMenuItem *)item { NSMenu *menu = [item menu]; - + if (item == toggle_fullscreen_item) return !quartzEnableRootless; + else if (item == copy_menu_item) // For some reason, this isn't working... + return NO; else if (menu == [window_separator menu] || menu == dock_menu || (menu == [x11_about_item menu] && [item tag] == 42)) return (AppleWMSelectedEvents () & AppleWMControllerNotifyMask) != 0; @@ -672,32 +715,34 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (void) applicationDidHide:(NSNotification *)notify { - QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMHideAll); + DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMHideAll); } - (void) applicationDidUnhide:(NSNotification *)notify { - QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMShowAll); + DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMShowAll); } -- (NSApplicationTerminateReply) applicationShouldTerminate:sender -{ - NSString *msg; - - if (can_quit || [X11App prefs_get_boolean:@PREFS_NO_QUIT_ALERT default:NO]) - return NSTerminateNow; +- (NSApplicationTerminateReply) applicationShouldTerminate:sender { + NSString *msg; + NSString *title; - /* Make sure we're frontmost. */ - [NSApp activateIgnoringOtherApps:YES]; + if (can_quit || [X11App prefs_get_boolean:@PREFS_NO_QUIT_ALERT default:NO]) + return NSTerminateNow; - msg = NSLocalizedString (@"Are you sure you want to quit X11?\n\nIf you quit X11, any X11 applications you are running will stop immediately and you will lose any changes you have not saved.", @"Dialog when quitting"); + /* Make sure we're frontmost. */ + [NSApp activateIgnoringOtherApps:YES]; - /* FIXME: safe to run the alert in here? Or should we return Later - and then run the alert on a timer? It seems to work here, so.. */ + title = NSLocalizedString(@"Do you really want to quit X11?", @"Dialog title when quitting"); + msg = NSLocalizedString(@"Any open X11 applications will stop immediately, and you will lose any unsaved changes.", @"Dialog when quitting"); + + /* FIXME: safe to run the alert in here? Or should we return Later + * and then run the alert on a timer? It seems to work here, so.. + */ - return (NSRunAlertPanel (nil, msg, NSLocalizedString (@"Quit", @""), - NSLocalizedString (@"Cancel", @""), nil) - == NSAlertDefaultReturn) ? NSTerminateNow : NSTerminateCancel; + return (NSRunAlertPanel (title, msg, NSLocalizedString (@"Quit", @""), + NSLocalizedString (@"Cancel", @""), nil) + == NSAlertDefaultReturn) ? NSTerminateNow : NSTerminateCancel; } - (void) applicationWillTerminate:(NSNotification *)aNotification @@ -705,7 +750,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row [X11App prefs_synchronize]; /* shutdown the X server, it will exit () for us. */ - QuartzMessageServerThread (kXDarwinQuit, 0); + DarwinSendDDXEvent(kXquartzQuit, 0); /* In case it doesn't, exit anyway after a while. */ while (sleep (10) != 0) ; @@ -729,21 +774,21 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row pending_apps = NULL; } -- (BOOL) application:(NSApplication *)app openFile:(NSString *)filename +- (OSX_BOOL) application:(NSApplication *)app openFile:(NSString *)filename { - const char *name = [filename UTF8String]; - - if (finished_launching) - [self launch_client:filename]; - else if (name[0] != ':') /* ignore display names */ - pending_apps = x_list_prepend (pending_apps, [filename retain]); - - /* FIXME: report failures. */ - return YES; + const char *name = [filename UTF8String]; + + if (finished_launching) + [self launch_client:filename]; + else if (name[0] != ':') /* ignore display names */ + pending_apps = x_list_prepend (pending_apps, [filename retain]); + + /* FIXME: report failures. */ + return YES; } @end -void X11ControllerMain(int argc, const char **argv, void (*server_thread) (void *), void *server_arg) { - X11ApplicationMain (argc, argv, server_thread, server_arg); +void X11ControllerMain(int argc, char **argv, char **envp) { + X11ApplicationMain (argc, argv, envp); } diff --git a/xorg-server/hw/xquartz/applewm.c b/xorg-server/hw/xquartz/applewm.c index 072e57ff4..c72540ace 100644 --- a/xorg-server/hw/xquartz/applewm.c +++ b/xorg-server/hw/xquartz/applewm.c @@ -25,6 +25,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ +#include "sanitizedCarbon.h" + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -72,8 +74,6 @@ static int WMErrorBase; static DISPATCH_PROC(ProcAppleWMDispatch); static DISPATCH_PROC(SProcAppleWMDispatch); -static void AppleWMResetProc(ExtensionEntry* extEntry); - static unsigned char WMReqCode = 0; static int WMEventBase = 0; @@ -122,7 +122,7 @@ AppleWMExtensionInit( AppleWMNumberErrors, ProcAppleWMDispatch, SProcAppleWMDispatch, - AppleWMResetProc, + NULL, StandardMinorOpcode))) { WMReqCode = (unsigned char)extEntry->base; @@ -133,14 +133,6 @@ AppleWMExtensionInit( } } -/*ARGSUSED*/ -static void -AppleWMResetProc ( - ExtensionEntry* extEntry -) -{ -} - /* Updates the _NATIVE_SCREEN_ORIGIN property on the given root window. */ void AppleWMSetScreenOrigin( @@ -173,7 +165,11 @@ AppleWMDoReorderWindow( atom = xa_apple_no_order_in(); rc = dixLookupProperty(&prop, pWin, atom, serverClient, DixReadAccess); - return (rc == Success) && (prop->type == atom); + + if(Success == rc && prop->type == atom) + return 0; + + return 1; } diff --git a/xorg-server/hw/xquartz/bundle/English.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/English.lproj/Localizable.strings Binary files differdeleted file mode 100644 index c83b08536..000000000 --- a/xorg-server/hw/xquartz/bundle/English.lproj/Localizable.strings +++ /dev/null diff --git a/xorg-server/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib Binary files differdeleted file mode 100644 index f60dcbacb..000000000 --- a/xorg-server/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib +++ /dev/null diff --git a/xorg-server/hw/xquartz/bundle/Info.plist b/xorg-server/hw/xquartz/bundle/Info.plist.cpp index 6ba02dda2..47018fdf3 100644 --- a/xorg-server/hw/xquartz/bundle/Info.plist +++ b/xorg-server/hw/xquartz/bundle/Info.plist.cpp @@ -7,33 +7,33 @@ <key>CFBundleExecutable</key> <string>X11</string> <key>CFBundleGetInfoString</key> - <string>X11</string> + <string>APPLE_APPLICATION_NAME</string> <key>CFBundleIconFile</key> <string>X11.icns</string> <key>CFBundleIdentifier</key> - <string>org.x.X11</string> + <string>APPLE_APPLICATION_ID</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> - <string>X11</string> + <string>APPLE_APPLICATION_NAME</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>2.2.0</string> + <string>2.3.2</string> + <key>CFBundleVersion</key> + <string>2.3.2</string> <key>CFBundleSignature</key> <string>x11a</string> <key>CSResourcesFileMapped</key> <true/> <key>NSHumanReadableCopyright</key> - <string>Copyright © 2003-2008, Apple Inc. + <string>Copyright © 2003-2009, Apple Inc. Copyright © 2003, XFree86 Project, Inc. -Copyright © 2003-2008, X.org Foundation, Inc. +Copyright © 2003-2009, X.org Foundation, Inc. </string> <key>NSMainNibFile</key> <string>main</string> <key>NSPrincipalClass</key> <string>X11Application</string> - <key>LSBackgroundOnly</key> - <true/> </dict> </plist> diff --git a/xorg-server/hw/xquartz/bundle/Makefile.am b/xorg-server/hw/xquartz/bundle/Makefile.am index 801fdc7d8..963327bb9 100644 --- a/xorg-server/hw/xquartz/bundle/Makefile.am +++ b/xorg-server/hw/xquartz/bundle/Makefile.am @@ -1,77 +1,82 @@ -bin_SCRIPTS = x11app +include cpprules.in -.PHONY: x11app - -x11app: - xcodebuild CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ARCHS="$(X11APP_ARCHS)" +CPP_FILES_FLAGS = \ + -DAPPLE_APPLICATION_ID="$(APPLE_APPLICATION_ID)" \ + -DAPPLE_APPLICATION_NAME="$(APPLE_APPLICATION_NAME)" install-data-hook: - xcodebuild install DSTROOT="/$(DESTDIR)" INSTALL_PATH="$(APPLE_APPLICATIONS_DIR)" DEPLOYMENT_LOCATION=YES SKIP_INSTALL=NO ARCHS="$(X11APP_ARCHS)" + $(srcdir)/mk_bundke.sh $(srcdir) $(builddir) $(DESTDIR)$(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app install + +uninstall-hook: + $(RM) -rf $(DESTDIR)$(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app + +noinst_PRE = Info.plist.cpp +noinst_DATA = $(noinst_PRE:plist.cpp=plist) -clean-local: - rm -rf build +CLEANFILES = $(noinst_DATA) resourcedir=$(libdir)/X11/xserver resource_DATA = Xquartz.plist EXTRA_DIST = \ + mk_bundke.sh \ + X11.sh \ + Info.plist.cpp \ + PkgInfo \ $(resource_DATA) \ - Info.plist \ - X11.icns \ - bundle-main.c \ - X11.xcodeproj/project.pbxproj \ - Dutch.lproj/InfoPlist.strings \ - Dutch.lproj/Localizable.strings \ - Dutch.lproj/main.nib/keyedobjects.nib \ - English.lproj/InfoPlist.strings \ - English.lproj/Localizable.strings \ - English.lproj/main.nib/designable.nib \ - English.lproj/main.nib/keyedobjects.nib \ - French.lproj/InfoPlist.strings \ - French.lproj/Localizable.strings \ - French.lproj/main.nib/keyedobjects.nib \ - German.lproj/InfoPlist.strings \ - German.lproj/Localizable.strings \ - German.lproj/main.nib/keyedobjects.nib \ - Italian.lproj/InfoPlist.strings \ - Italian.lproj/Localizable.strings \ - Italian.lproj/main.nib/keyedobjects.nib \ - Japanese.lproj/InfoPlist.strings \ - Japanese.lproj/Localizable.strings \ - Japanese.lproj/main.nib/keyedobjects.nib \ - Spanish.lproj/InfoPlist.strings \ - Spanish.lproj/Localizable.strings \ - Spanish.lproj/main.nib/keyedobjects.nib \ - da.lproj/InfoPlist.strings \ - da.lproj/Localizable.strings \ - da.lproj/main.nib/keyedobjects.nib \ - fi.lproj/InfoPlist.strings \ - fi.lproj/Localizable.strings \ - fi.lproj/main.nib/keyedobjects.nib \ - ko.lproj/InfoPlist.strings \ - ko.lproj/Localizable.strings \ - ko.lproj/main.nib/keyedobjects.nib \ - no.lproj/InfoPlist.strings \ - no.lproj/Localizable.strings \ - no.lproj/main.nib/keyedobjects.nib \ - pl.lproj/InfoPlist.strings \ - pl.lproj/Localizable.strings \ - pl.lproj/main.nib/keyedobjects.nib \ - pt.lproj/InfoPlist.strings \ - pt.lproj/Localizable.strings \ - pt.lproj/main.nib/keyedobjects.nib \ - pt_PT.lproj/InfoPlist.strings \ - pt_PT.lproj/Localizable.strings \ - pt_PT.lproj/main.nib/keyedobjects.nib \ - ru.lproj/InfoPlist.strings \ - ru.lproj/Localizable.strings \ - ru.lproj/main.nib/keyedobjects.nib \ - sv.lproj/InfoPlist.strings \ - sv.lproj/Localizable.strings \ - sv.lproj/main.nib/keyedobjects.nib \ - zh_CN.lproj/InfoPlist.strings \ - zh_CN.lproj/Localizable.strings \ - zh_CN.lproj/main.nib/keyedobjects.nib \ - zh_TW.lproj/InfoPlist.strings \ - zh_TW.lproj/Localizable.strings \ - zh_TW.lproj/main.nib/keyedobjects.nib + Resources/da.lproj/InfoPlist.strings \ + Resources/da.lproj/Localizable.strings \ + Resources/da.lproj/main.nib/keyedobjects.nib \ + Resources/Dutch.lproj/InfoPlist.strings \ + Resources/Dutch.lproj/Localizable.strings \ + Resources/Dutch.lproj/main.nib/keyedobjects.nib \ + Resources/English.lproj/InfoPlist.strings \ + Resources/English.lproj/Localizable.strings \ + Resources/English.lproj/main.nib/designable.nib \ + Resources/English.lproj/main.nib/keyedobjects.nib \ + Resources/fi.lproj/InfoPlist.strings \ + Resources/fi.lproj/Localizable.strings \ + Resources/fi.lproj/main.nib/keyedobjects.nib \ + Resources/French.lproj/InfoPlist.strings \ + Resources/French.lproj/Localizable.strings \ + Resources/French.lproj/main.nib/keyedobjects.nib \ + Resources/German.lproj/InfoPlist.strings \ + Resources/German.lproj/Localizable.strings \ + Resources/German.lproj/main.nib/keyedobjects.nib \ + Resources/Italian.lproj/InfoPlist.strings \ + Resources/Italian.lproj/Localizable.strings \ + Resources/Italian.lproj/main.nib/keyedobjects.nib \ + Resources/Japanese.lproj/InfoPlist.strings \ + Resources/Japanese.lproj/Localizable.strings \ + Resources/Japanese.lproj/main.nib/keyedobjects.nib \ + Resources/ko.lproj/InfoPlist.strings \ + Resources/ko.lproj/Localizable.strings \ + Resources/ko.lproj/main.nib/keyedobjects.nib \ + Resources/no.lproj/InfoPlist.strings \ + Resources/no.lproj/Localizable.strings \ + Resources/no.lproj/main.nib/keyedobjects.nib \ + Resources/pl.lproj/InfoPlist.strings \ + Resources/pl.lproj/Localizable.strings \ + Resources/pl.lproj/main.nib/keyedobjects.nib \ + Resources/pt.lproj/InfoPlist.strings \ + Resources/pt.lproj/Localizable.strings \ + Resources/pt.lproj/main.nib/keyedobjects.nib \ + Resources/pt_PT.lproj/InfoPlist.strings \ + Resources/pt_PT.lproj/Localizable.strings \ + Resources/pt_PT.lproj/main.nib/keyedobjects.nib \ + Resources/ru.lproj/InfoPlist.strings \ + Resources/ru.lproj/Localizable.strings \ + Resources/ru.lproj/main.nib/keyedobjects.nib \ + Resources/Spanish.lproj/InfoPlist.strings \ + Resources/Spanish.lproj/Localizable.strings \ + Resources/Spanish.lproj/main.nib/keyedobjects.nib \ + Resources/sv.lproj/InfoPlist.strings \ + Resources/sv.lproj/Localizable.strings \ + Resources/sv.lproj/main.nib/keyedobjects.nib \ + Resources/X11.icns \ + Resources/zh_CN.lproj/InfoPlist.strings \ + Resources/zh_CN.lproj/Localizable.strings \ + Resources/zh_CN.lproj/main.nib/keyedobjects.nib \ + Resources/zh_TW.lproj/InfoPlist.strings \ + Resources/zh_TW.lproj/Localizable.strings \ + Resources/zh_TW.lproj/main.nib/keyedobjects.nib diff --git a/xorg-server/hw/xquartz/bundle/Makefile.in b/xorg-server/hw/xquartz/bundle/Makefile.in index bd065ed9d..dd3b3c066 100644 --- a/xorg-server/hw/xquartz/bundle/Makefile.in +++ b/xorg-server/hw/xquartz/bundle/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -14,6 +14,12 @@ @SET_MAKE@ +# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM +# to cpp, because that trick does not work on all ANSI C preprocessors. +# Delete line numbers from the cpp output (-P is not portable, I guess). +# Allow XCOMM to be preceded by whitespace and provide a means of generating +# output lines with trailing backslashes. +# Allow XHASH to always be substituted, even in cases where XCOMM isn't. VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ @@ -33,8 +39,9 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/cpprules.in subdir = hw/xquartz/bundle -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac @@ -44,15 +51,11 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ - $(top_builddir)/include/xgl-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/kdrive-config.h CONFIG_CLEAN_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(resourcedir)" -binSCRIPT_INSTALL = $(INSTALL_SCRIPT) -SCRIPTS = $(bin_SCRIPTS) SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -61,16 +64,18 @@ am__vpath_adj = case $$p in \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(resourcedir)" resourceDATA_INSTALL = $(INSTALL_DATA) -DATA = $(resource_DATA) +DATA = $(noinst_DATA) $(resource_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ -APPDEFAULTDIR = @APPDEFAULTDIR@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@ +APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ @@ -91,10 +96,6 @@ CFLAGS = @CFLAGS@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DARWIN_LIBS = @DARWIN_LIBS@ DBUS_CFLAGS = @DBUS_CFLAGS@ @@ -116,6 +117,7 @@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ +DOLT_BASH = @DOLT_BASH@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ @@ -125,18 +127,15 @@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ -ECHO = @ECHO@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ -FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ -FREETYPE_LIBS = @FREETYPE_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ @@ -155,7 +154,7 @@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ -LAUNCHD = @LAUNCHD@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LEX = @LEX@ @@ -169,7 +168,10 @@ LIBTOOL = @LIBTOOL@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LINUXDOC = @LINUXDOC@ +LIPO = @LIPO@ LN_S = @LN_S@ +LTCOMPILE = @LTCOMPILE@ +LTCXXCOMPILE = @LTCXXCOMPILE@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -181,8 +183,7 @@ MESA_SOURCE = @MESA_SOURCE@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ -MKFONTDIR = @MKFONTDIR@ -MKFONTSCALE = @MKFONTSCALE@ +NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ @@ -191,8 +192,8 @@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -225,7 +226,6 @@ VENDOR_NAME = @VENDOR_NAME@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VENDOR_RELEASE = @VENDOR_RELEASE@ VERSION = @VERSION@ -X11APP_ARCHS = @X11APP_ARCHS@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ @@ -235,27 +235,12 @@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ -XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@ -XEGL_LIBS = @XEGL_LIBS@ -XEGL_SYS_LIBS = @XEGL_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ -XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGFILE = @XF86CONFIGFILE@ -XF86MISC_CFLAGS = @XF86MISC_CFLAGS@ -XF86MISC_LIBS = @XF86MISC_LIBS@ XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ -XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@ -XGLMODULES_LIBS = @XGLMODULES_LIBS@ -XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@ -XGLXMODULES_LIBS = @XGLXMODULES_LIBS@ -XGLX_LIBS = @XGLX_LIBS@ -XGLX_SYS_LIBS = @XGLX_SYS_LIBS@ -XGL_LIBS = @XGL_LIBS@ -XGL_MODULE_PATH = @XGL_MODULE_PATH@ -XGL_SYS_LIBS = @XGL_SYS_LIBS@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ @@ -266,10 +251,6 @@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ -XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@ -XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@ -XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@ -XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ @@ -278,13 +259,8 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ -XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ -XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ -XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ -XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ -XPRINT_CFLAGS = @XPRINT_CFLAGS@ -XPRINT_LIBS = @XPRINT_LIBS@ -XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ +XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ +XPBPROXY_LIBS = @XPBPROXY_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ @@ -317,8 +293,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -338,7 +313,6 @@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ -ft_config = @ft_config@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -348,12 +322,12 @@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ -launchagentsdir = @launchagentsdir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ +lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ @@ -371,82 +345,112 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -xglmoduledir = @xglmoduledir@ -xpconfigdir = @xpconfigdir@ -bin_SCRIPTS = x11app +CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \ + -e '/^\#line *[0-9][0-9]* *.*$$/d' \ + -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \ + -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \ + -e '/^[ ]*XHASH/s/XHASH/\#/' \ + -e '/XSLASHGLOB/s/XSLASHGLOB/\/\*/' \ + -e '/\@\@$$/s/\@\@$$/\\/' + + +# Strings to replace in man pages +XORGRELSTRING = @PACKAGE_STRING@ +XORGMANNAME = X Version 11 +MANDEFS = \ + -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \ + -D__appmansuffix__=$(APP_MAN_SUFFIX) \ + -D__filemansuffix__=$(FILE_MAN_SUFFIX) \ + -D__libmansuffix__=$(LIB_MAN_SUFFIX) \ + -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \ + -D__XSERVERNAME__=Xorg -D__XCONFIGFILE__=xorg.conf \ + -D__xinitdir__=$(XINITDIR) \ + -D__bindir__=$(bindir) \ + -DSHELL_CMD=$(SHELL_CMD) $(ARCHMANDEFS) + +SUFFIXES = .$(APP_MAN_SUFFIX) .man .cpp +CPP_FILES_FLAGS = \ + -DAPPLE_APPLICATION_ID="$(APPLE_APPLICATION_ID)" \ + -DAPPLE_APPLICATION_NAME="$(APPLE_APPLICATION_NAME)" + +noinst_PRE = Info.plist.cpp +noinst_DATA = $(noinst_PRE:plist.cpp=plist) +CLEANFILES = $(noinst_DATA) resourcedir = $(libdir)/X11/xserver resource_DATA = Xquartz.plist EXTRA_DIST = \ + mk_bundke.sh \ + X11.sh \ + Info.plist.cpp \ + PkgInfo \ $(resource_DATA) \ - Info.plist \ - X11.icns \ - bundle-main.c \ - X11.xcodeproj/project.pbxproj \ - Dutch.lproj/InfoPlist.strings \ - Dutch.lproj/Localizable.strings \ - Dutch.lproj/main.nib/keyedobjects.nib \ - English.lproj/InfoPlist.strings \ - English.lproj/Localizable.strings \ - English.lproj/main.nib/designable.nib \ - English.lproj/main.nib/keyedobjects.nib \ - French.lproj/InfoPlist.strings \ - French.lproj/Localizable.strings \ - French.lproj/main.nib/keyedobjects.nib \ - German.lproj/InfoPlist.strings \ - German.lproj/Localizable.strings \ - German.lproj/main.nib/keyedobjects.nib \ - Italian.lproj/InfoPlist.strings \ - Italian.lproj/Localizable.strings \ - Italian.lproj/main.nib/keyedobjects.nib \ - Japanese.lproj/InfoPlist.strings \ - Japanese.lproj/Localizable.strings \ - Japanese.lproj/main.nib/keyedobjects.nib \ - Spanish.lproj/InfoPlist.strings \ - Spanish.lproj/Localizable.strings \ - Spanish.lproj/main.nib/keyedobjects.nib \ - da.lproj/InfoPlist.strings \ - da.lproj/Localizable.strings \ - da.lproj/main.nib/keyedobjects.nib \ - fi.lproj/InfoPlist.strings \ - fi.lproj/Localizable.strings \ - fi.lproj/main.nib/keyedobjects.nib \ - ko.lproj/InfoPlist.strings \ - ko.lproj/Localizable.strings \ - ko.lproj/main.nib/keyedobjects.nib \ - no.lproj/InfoPlist.strings \ - no.lproj/Localizable.strings \ - no.lproj/main.nib/keyedobjects.nib \ - pl.lproj/InfoPlist.strings \ - pl.lproj/Localizable.strings \ - pl.lproj/main.nib/keyedobjects.nib \ - pt.lproj/InfoPlist.strings \ - pt.lproj/Localizable.strings \ - pt.lproj/main.nib/keyedobjects.nib \ - pt_PT.lproj/InfoPlist.strings \ - pt_PT.lproj/Localizable.strings \ - pt_PT.lproj/main.nib/keyedobjects.nib \ - ru.lproj/InfoPlist.strings \ - ru.lproj/Localizable.strings \ - ru.lproj/main.nib/keyedobjects.nib \ - sv.lproj/InfoPlist.strings \ - sv.lproj/Localizable.strings \ - sv.lproj/main.nib/keyedobjects.nib \ - zh_CN.lproj/InfoPlist.strings \ - zh_CN.lproj/Localizable.strings \ - zh_CN.lproj/main.nib/keyedobjects.nib \ - zh_TW.lproj/InfoPlist.strings \ - zh_TW.lproj/Localizable.strings \ - zh_TW.lproj/main.nib/keyedobjects.nib + Resources/da.lproj/InfoPlist.strings \ + Resources/da.lproj/Localizable.strings \ + Resources/da.lproj/main.nib/keyedobjects.nib \ + Resources/Dutch.lproj/InfoPlist.strings \ + Resources/Dutch.lproj/Localizable.strings \ + Resources/Dutch.lproj/main.nib/keyedobjects.nib \ + Resources/English.lproj/InfoPlist.strings \ + Resources/English.lproj/Localizable.strings \ + Resources/English.lproj/main.nib/designable.nib \ + Resources/English.lproj/main.nib/keyedobjects.nib \ + Resources/fi.lproj/InfoPlist.strings \ + Resources/fi.lproj/Localizable.strings \ + Resources/fi.lproj/main.nib/keyedobjects.nib \ + Resources/French.lproj/InfoPlist.strings \ + Resources/French.lproj/Localizable.strings \ + Resources/French.lproj/main.nib/keyedobjects.nib \ + Resources/German.lproj/InfoPlist.strings \ + Resources/German.lproj/Localizable.strings \ + Resources/German.lproj/main.nib/keyedobjects.nib \ + Resources/Italian.lproj/InfoPlist.strings \ + Resources/Italian.lproj/Localizable.strings \ + Resources/Italian.lproj/main.nib/keyedobjects.nib \ + Resources/Japanese.lproj/InfoPlist.strings \ + Resources/Japanese.lproj/Localizable.strings \ + Resources/Japanese.lproj/main.nib/keyedobjects.nib \ + Resources/ko.lproj/InfoPlist.strings \ + Resources/ko.lproj/Localizable.strings \ + Resources/ko.lproj/main.nib/keyedobjects.nib \ + Resources/no.lproj/InfoPlist.strings \ + Resources/no.lproj/Localizable.strings \ + Resources/no.lproj/main.nib/keyedobjects.nib \ + Resources/pl.lproj/InfoPlist.strings \ + Resources/pl.lproj/Localizable.strings \ + Resources/pl.lproj/main.nib/keyedobjects.nib \ + Resources/pt.lproj/InfoPlist.strings \ + Resources/pt.lproj/Localizable.strings \ + Resources/pt.lproj/main.nib/keyedobjects.nib \ + Resources/pt_PT.lproj/InfoPlist.strings \ + Resources/pt_PT.lproj/Localizable.strings \ + Resources/pt_PT.lproj/main.nib/keyedobjects.nib \ + Resources/ru.lproj/InfoPlist.strings \ + Resources/ru.lproj/Localizable.strings \ + Resources/ru.lproj/main.nib/keyedobjects.nib \ + Resources/Spanish.lproj/InfoPlist.strings \ + Resources/Spanish.lproj/Localizable.strings \ + Resources/Spanish.lproj/main.nib/keyedobjects.nib \ + Resources/sv.lproj/InfoPlist.strings \ + Resources/sv.lproj/Localizable.strings \ + Resources/sv.lproj/main.nib/keyedobjects.nib \ + Resources/X11.icns \ + Resources/zh_CN.lproj/InfoPlist.strings \ + Resources/zh_CN.lproj/Localizable.strings \ + Resources/zh_CN.lproj/main.nib/keyedobjects.nib \ + Resources/zh_TW.lproj/InfoPlist.strings \ + Resources/zh_TW.lproj/Localizable.strings \ + Resources/zh_TW.lproj/main.nib/keyedobjects.nib all: all-am .SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) +.SUFFIXES: .$(APP_MAN_SUFFIX) .man .cpp +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/cpprules.in $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ @@ -470,25 +474,6 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-binSCRIPTS: $(bin_SCRIPTS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" - @list='$(bin_SCRIPTS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f $$d$$p; then \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " $(binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \ - $(binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \ - else :; fi; \ - done - -uninstall-binSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(bin_SCRIPTS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ - rm -f "$(DESTDIR)$(bindir)/$$f"; \ - done mostlyclean-libtool: -rm -f *.lo @@ -547,9 +532,9 @@ distdir: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile $(SCRIPTS) $(DATA) +all-am: Makefile $(DATA) installdirs: - for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(resourcedir)"; do \ + for dir in "$(DESTDIR)$(resourcedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -569,6 +554,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -578,7 +564,7 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libtool clean-local mostlyclean-am +clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile @@ -600,7 +586,7 @@ install-data-am: install-resourceDATA install-dvi: install-dvi-am -install-exec-am: install-binSCRIPTS +install-exec-am: install-html: install-html-am @@ -630,34 +616,37 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binSCRIPTS uninstall-resourceDATA +uninstall-am: uninstall-resourceDATA + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) uninstall-hook -.MAKE: install-am install-data-am install-strip +.MAKE: install-am install-data-am install-strip uninstall-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ - clean-local distclean distclean-generic distclean-libtool \ - distdir dvi dvi-am html html-am info info-am install \ - install-am install-binSCRIPTS install-data install-data-am \ - install-data-hook install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-resourceDATA install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-data-hook install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-resourceDATA install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-binSCRIPTS uninstall-resourceDATA + uninstall-hook uninstall-resourceDATA -.PHONY: x11app +.cpp: + $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@ -x11app: - xcodebuild CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ARCHS="$(X11APP_ARCHS)" +.man.$(APP_MAN_SUFFIX): + $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@ install-data-hook: - xcodebuild install DSTROOT="/$(DESTDIR)" INSTALL_PATH="$(APPLE_APPLICATIONS_DIR)" DEPLOYMENT_LOCATION=YES SKIP_INSTALL=NO ARCHS="$(X11APP_ARCHS)" + $(srcdir)/mk_bundke.sh $(srcdir) $(builddir) $(DESTDIR)$(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app install -clean-local: - rm -rf build +uninstall-hook: + $(RM) -rf $(DESTDIR)$(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/xorg-server/hw/xquartz/bundle/PkgInfo b/xorg-server/hw/xquartz/bundle/PkgInfo new file mode 100644 index 000000000..b8e0aec42 --- /dev/null +++ b/xorg-server/hw/xquartz/bundle/PkgInfo @@ -0,0 +1 @@ +APPLx11a
\ No newline at end of file diff --git a/xorg-server/hw/xquartz/bundle/Dutch.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Resources/Dutch.lproj/InfoPlist.strings Binary files differindex 8f978d63f..8f978d63f 100644 --- a/xorg-server/hw/xquartz/bundle/Dutch.lproj/InfoPlist.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/Dutch.lproj/InfoPlist.strings diff --git a/xorg-server/hw/xquartz/bundle/Dutch.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Resources/Dutch.lproj/Localizable.strings Binary files differindex 1ff39fe67..1ff39fe67 100644 --- a/xorg-server/hw/xquartz/bundle/Dutch.lproj/Localizable.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/Dutch.lproj/Localizable.strings diff --git a/xorg-server/hw/xquartz/bundle/Dutch.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/Dutch.lproj/main.nib/keyedobjects.nib Binary files differindex 95c26d7b3..95c26d7b3 100644 --- a/xorg-server/hw/xquartz/bundle/Dutch.lproj/main.nib/keyedobjects.nib +++ b/xorg-server/hw/xquartz/bundle/Resources/Dutch.lproj/main.nib/keyedobjects.nib diff --git a/xorg-server/hw/xquartz/bundle/English.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Resources/English.lproj/InfoPlist.strings Binary files differindex 88e1f04ac..88e1f04ac 100644 --- a/xorg-server/hw/xquartz/bundle/English.lproj/InfoPlist.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/English.lproj/InfoPlist.strings diff --git a/xorg-server/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings Binary files differnew file mode 100644 index 000000000..001227afe --- /dev/null +++ b/xorg-server/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings diff --git a/xorg-server/hw/xquartz/bundle/English.lproj/main.nib/designable.nib b/xorg-server/hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib index ea3a0daa8..d27162539 100644 --- a/xorg-server/hw/xquartz/bundle/English.lproj/main.nib/designable.nib +++ b/xorg-server/hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib @@ -1,20 +1,27 @@ <?xml version="1.0" encoding="UTF-8"?> -<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02"> +<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03"> <data> <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">9C31</string> - <string key="IBDocument.InterfaceBuilderVersion">639</string> - <string key="IBDocument.AppKitVersion">949.26</string> - <string key="IBDocument.HIToolboxVersion">352.00</string> + <string key="IBDocument.SystemVersion">9G55</string> + <string key="IBDocument.InterfaceBuilderVersion">677</string> + <string key="IBDocument.AppKitVersion">949.43</string> + <string key="IBDocument.HIToolboxVersion">353.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="57"/> - <integer value="285"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> + <object class="NSMutableDictionary" key="IBDocument.Metadata"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> <object class="NSMutableArray" key="IBDocument.RootObjects" id="904585544"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSCustomObject" id="815810918"> @@ -142,8 +149,8 @@ <object class="NSMenuItem" id="206802571"> <reference key="NSMenu" ref="576521955"/> <string key="NSTitle">Hide Others</string> - <string key="NSKeyEquiv"/> - <int key="NSKeyEquivModMask">1048576</int> + <string key="NSKeyEquiv">h</string> + <int key="NSKeyEquivModMask">1572864</int> <int key="NSMnemonicLoc">2147483647</int> <reference key="NSOnImage" ref="531645050"/> <reference key="NSMixedImage" ref="351811234"/> @@ -231,44 +238,6 @@ <string key="NSTitle">Edit</string> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMenuItem" id="1010221707"> - <reference key="NSMenu" ref="526778998"/> - <string key="NSTitle">Undo</string> - <string key="NSKeyEquiv">z</string> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="531645050"/> - <reference key="NSMixedImage" ref="351811234"/> - </object> - <object class="NSMenuItem" id="535038564"> - <reference key="NSMenu" ref="526778998"/> - <string key="NSTitle">Redo</string> - <string key="NSKeyEquiv">Z</string> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="531645050"/> - <reference key="NSMixedImage" ref="351811234"/> - </object> - <object class="NSMenuItem" id="839739619"> - <reference key="NSMenu" ref="526778998"/> - <bool key="NSIsDisabled">YES</bool> - <bool key="NSIsSeparator">YES</bool> - <string key="NSTitle"/> - <string key="NSKeyEquiv"/> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="531645050"/> - <reference key="NSMixedImage" ref="351811234"/> - </object> - <object class="NSMenuItem" id="581727829"> - <reference key="NSMenu" ref="526778998"/> - <string key="NSTitle">Cut</string> - <string key="NSKeyEquiv">x</string> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="531645050"/> - <reference key="NSMixedImage" ref="351811234"/> - </object> <object class="NSMenuItem" id="185296989"> <reference key="NSMenu" ref="526778998"/> <string key="NSTitle">Copy</string> @@ -278,33 +247,6 @@ <reference key="NSOnImage" ref="531645050"/> <reference key="NSMixedImage" ref="351811234"/> </object> - <object class="NSMenuItem" id="924678073"> - <reference key="NSMenu" ref="526778998"/> - <string key="NSTitle">Paste</string> - <string key="NSKeyEquiv">v</string> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="531645050"/> - <reference key="NSMixedImage" ref="351811234"/> - </object> - <object class="NSMenuItem" id="994817848"> - <reference key="NSMenu" ref="526778998"/> - <string key="NSTitle">Delete</string> - <string key="NSKeyEquiv"/> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="531645050"/> - <reference key="NSMixedImage" ref="351811234"/> - </object> - <object class="NSMenuItem" id="322866464"> - <reference key="NSMenu" ref="526778998"/> - <string key="NSTitle">Select All</string> - <string key="NSKeyEquiv">a</string> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="531645050"/> - <reference key="NSMixedImage" ref="351811234"/> - </object> </object> </object> </object> @@ -323,6 +265,15 @@ </object> <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="984461797"> + <reference key="NSMenu" ref="96874957"/> + <string key="NSTitle">Close</string> + <string key="NSKeyEquiv">w</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> <object class="NSMenuItem" id="677652931"> <reference key="NSMenu" ref="96874957"/> <string key="NSTitle">Minimize</string> @@ -341,6 +292,17 @@ <reference key="NSOnImage" ref="531645050"/> <reference key="NSMixedImage" ref="351811234"/> </object> + <object class="NSMenuItem" id="280172320"> + <reference key="NSMenu" ref="96874957"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> <object class="NSMenuItem" id="1036389925"> <reference key="NSMenu" ref="96874957"/> <string key="NSTitle">Cycle Through Windows</string> @@ -359,26 +321,6 @@ <reference key="NSOnImage" ref="531645050"/> <reference key="NSMixedImage" ref="351811234"/> </object> - <object class="NSMenuItem" id="280172320"> - <reference key="NSMenu" ref="96874957"/> - <bool key="NSIsDisabled">YES</bool> - <bool key="NSIsSeparator">YES</bool> - <string key="NSTitle"/> - <string key="NSKeyEquiv"/> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="531645050"/> - <reference key="NSMixedImage" ref="351811234"/> - </object> - <object class="NSMenuItem" id="984461797"> - <reference key="NSMenu" ref="96874957"/> - <string key="NSTitle">Close</string> - <string key="NSKeyEquiv">w</string> - <int key="NSKeyEquivModMask">1048576</int> - <int key="NSMnemonicLoc">2147483647</int> - <reference key="NSOnImage" ref="531645050"/> - <reference key="NSMixedImage" ref="351811234"/> - </object> <object class="NSMenuItem" id="155085383"> <reference key="NSMenu" ref="96874957"/> <bool key="NSIsDisabled">YES</bool> @@ -448,7 +390,7 @@ <object class="NSWindowTemplate" id="124913468"> <int key="NSWindowStyleMask">3</int> <int key="NSWindowBacking">2</int> - <string key="NSWindowRect">{{319, 294}, {481, 345}}</string> + <string key="NSWindowRect">{{266, 364}, {484, 308}}</string> <int key="NSWTFlags">1350041600</int> <string key="NSWindowTitle">X11 Preferences</string> <string key="NSWindowClass">NSPanel</string> @@ -456,7 +398,7 @@ <characters key="NS.bytes">View</characters> </object> <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> - <string key="NSWindowContentMinSize">{213, 107}</string> + <string key="NSWindowContentMinSize">{320, 240}</string> <object class="NSView" key="NSWindowView" id="941366957"> <nil key="NSNextResponder"/> <int key="NSvFlags">256</int> @@ -465,7 +407,7 @@ <object class="NSTabView" id="448510093"> <reference key="NSNextResponder" ref="941366957"/> <int key="NSvFlags">256</int> - <string key="NSFrame">{{10, 10}, {458, 325}}</string> + <string key="NSFrame">{{13, 10}, {458, 292}}</string> <reference key="NSSuperview" ref="941366957"/> <object class="NSMutableArray" key="NSTabViewItems"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -481,7 +423,7 @@ <object class="NSButton" id="119157981"> <reference key="NSNextResponder" ref="596750588"/> <int key="NSvFlags">256</int> - <string key="NSFrame">{{18, 243}, {402, 18}}</string> + <string key="NSFrame">{{18, 210}, {402, 18}}</string> <reference key="NSSuperview" ref="596750588"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="990762273"> @@ -508,7 +450,7 @@ <object class="NSTextField" id="443008216"> <reference key="NSNextResponder" ref="596750588"/> <int key="NSvFlags">256</int> - <string key="NSFrame">{{36, 93}, {385, 31}}</string> + <string key="NSFrame">{{36, 60}, {385, 31}}</string> <reference key="NSSuperview" ref="596750588"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="391919450"> @@ -544,14 +486,14 @@ <object class="NSTextField" id="282885445"> <reference key="NSNextResponder" ref="596750588"/> <int key="NSvFlags">256</int> - <string key="NSFrame">{{36, 208}, {385, 29}}</string> + <string key="NSFrame">{{36, 162}, {385, 42}}</string> <reference key="NSSuperview" ref="596750588"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="649334366"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">4194304</int> - <string type="base64-UTF8" key="NSContents">SG9sZCBPcHRpb24gYW5kIENvbW1hbmQgd2hpbGUgY2xpY2tpbmcgdG8gYWN0aXZhdGUgdGhlIG1pZGRs -ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string> + <string type="base64-UTF8" key="NSContents">SG9sZCBPcHRpb24gb3IgQ29tbWFuZCB3aGlsZSBjbGlja2luZyB0byBhY3RpdmF0ZSB0aGUgbWlkZGxl +IG9yIHJpZ2h0IG1vdXNlIGJ1dHRvbnMuCg</string> <reference key="NSSupport" ref="26"/> <reference key="NSControlView" ref="282885445"/> <reference key="NSBackgroundColor" ref="57160303"/> @@ -561,7 +503,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string> <object class="NSButton" id="842100515"> <reference key="NSNextResponder" ref="596750588"/> <int key="NSvFlags">256</int> - <string key="NSFrame">{{18, 130}, {402, 18}}</string> + <string key="NSFrame">{{18, 97}, {402, 18}}</string> <reference key="NSSuperview" ref="596750588"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="940564599"> @@ -582,7 +524,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string> <object class="NSTextField" id="31160162"> <reference key="NSNextResponder" ref="596750588"/> <int key="NSvFlags">256</int> - <string key="NSFrame">{{36, 159}, {385, 14}}</string> + <string key="NSFrame">{{36, 126}, {385, 14}}</string> <reference key="NSSuperview" ref="596750588"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="666057093"> @@ -598,7 +540,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string> <object class="NSButton" id="179949713"> <reference key="NSNextResponder" ref="596750588"/> <int key="NSvFlags">256</int> - <string key="NSFrame">{{18, 179}, {402, 18}}</string> + <string key="NSFrame">{{18, 146}, {402, 18}}</string> <reference key="NSSuperview" ref="596750588"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="967619578"> @@ -616,45 +558,8 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string> <int key="NSPeriodicInterval">25</int> </object> </object> - <object class="NSButton" id="915448994"> - <reference key="NSNextResponder" ref="596750588"/> - <int key="NSvFlags">256</int> - <string key="NSFrame">{{18, 69}, {402, 18}}</string> - <reference key="NSSuperview" ref="596750588"/> - <bool key="NSEnabled">YES</bool> - <object class="NSButtonCell" key="NSCell" id="117056849"> - <int key="NSCellFlags">67239424</int> - <int key="NSCellFlags2">0</int> - <string key="NSContents">Click-through Inactive Windows</string> - <reference key="NSSupport" ref="463863101"/> - <reference key="NSControlView" ref="915448994"/> - <int key="NSButtonFlags">1211912703</int> - <int key="NSButtonFlags2">2</int> - <reference key="NSAlternateImage" ref="391434389"/> - <string key="NSAlternateContents"/> - <string key="NSKeyEquivalent"/> - <int key="NSPeriodicDelay">200</int> - <int key="NSPeriodicInterval">25</int> - </object> - </object> - <object class="NSTextField" id="707276799"> - <reference key="NSNextResponder" ref="596750588"/> - <int key="NSvFlags">256</int> - <string key="NSFrame">{{33, 32}, {385, 31}}</string> - <reference key="NSSuperview" ref="596750588"/> - <bool key="NSEnabled">YES</bool> - <object class="NSTextFieldCell" key="NSCell" id="318286890"> - <int key="NSCellFlags">67239424</int> - <int key="NSCellFlags2">4194304</int> - <string key="NSContents">When enabled, clicking on an inactive window will cause that mouse click to pass through to that window in addition to activating it.</string> - <reference key="NSSupport" ref="26"/> - <reference key="NSControlView" ref="707276799"/> - <reference key="NSBackgroundColor" ref="57160303"/> - <reference key="NSTextColor" ref="930815747"/> - </object> - </object> </object> - <string key="NSFrame">{{10, 33}, {438, 279}}</string> + <string key="NSFrame">{{10, 33}, {438, 246}}</string> <reference key="NSSuperview" ref="448510093"/> </object> <string key="NSLabel">Input</string> @@ -673,7 +578,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string> <object class="NSButton" id="418227126"> <reference key="NSNextResponder" ref="515308735"/> <int key="NSvFlags">256</int> - <string key="NSFrame">{{18, 116}, {402, 18}}</string> + <string key="NSFrame">{{18, 63}, {402, 18}}</string> <reference key="NSSuperview" ref="515308735"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="1016069354"> @@ -694,7 +599,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string> <object class="NSTextField" id="1039016593"> <reference key="NSNextResponder" ref="515308735"/> <int key="NSvFlags">256</int> - <string key="NSFrame">{{36, 82}, {385, 28}}</string> + <string key="NSFrame">{{36, 29}, {385, 28}}</string> <reference key="NSSuperview" ref="515308735"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="624655599"> @@ -710,7 +615,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string> <object class="NSPopUpButton" id="709074847"> <reference key="NSNextResponder" ref="515308735"/> <int key="NSvFlags">256</int> - <string key="NSFrame">{{74, 235}, {128, 26}}</string> + <string key="NSFrame">{{74, 202}, {128, 26}}</string> <reference key="NSSuperview" ref="515308735"/> <bool key="NSEnabled">YES</bool> <object class="NSPopUpButtonCell" key="NSCell" id="633115429"> @@ -801,7 +706,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string> <object class="NSTextField" id="201731424"> <reference key="NSNextResponder" ref="515308735"/> <int key="NSvFlags">256</int> - <string key="NSFrame">{{17, 238}, {55, 20}}</string> + <string key="NSFrame">{{17, 205}, {55, 20}}</string> <reference key="NSSuperview" ref="515308735"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="930265681"> @@ -817,7 +722,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string> <object class="NSTextField" id="86150604"> <reference key="NSNextResponder" ref="515308735"/> <int key="NSvFlags">256</int> - <string key="NSFrame">{{36, 216}, {392, 14}}</string> + <string key="NSFrame">{{36, 183}, {392, 14}}</string> <reference key="NSSuperview" ref="515308735"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="311969422"> @@ -833,13 +738,13 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string> <object class="NSButton" id="477203622"> <reference key="NSNextResponder" ref="515308735"/> <int key="NSvFlags">256</int> - <string key="NSFrame">{{18, 182}, {409, 23}}</string> + <string key="NSFrame">{{18, 149}, {409, 23}}</string> <reference key="NSSuperview" ref="515308735"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="631531164"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">0</int> - <string key="NSContents">Full screen mode</string> + <string key="NSContents">Full-screen mode</string> <reference key="NSSupport" ref="463863101"/> <reference key="NSControlView" ref="477203622"/> <int key="NSButtonFlags">1211912703</int> @@ -851,10 +756,31 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string> <int key="NSPeriodicInterval">25</int> </object> </object> + <object class="NSButton" id="57246850"> + <reference key="NSNextResponder" ref="515308735"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{37, 83}, {409, 23}}</string> + <reference key="NSSuperview" ref="515308735"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="917248662"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Auto-show menu bar in full-screen mode</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="57246850"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSAlternateImage" ref="391434389"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> <object class="NSTextField" id="298603383"> <reference key="NSNextResponder" ref="515308735"/> <int key="NSvFlags">256</int> - <string key="NSFrame">{{36, 145}, {385, 31}}</string> + <string key="NSFrame">{{36, 112}, {385, 31}}</string> <reference key="NSSuperview" ref="515308735"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="761107402"> @@ -868,12 +794,310 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string> </object> </object> </object> - <string key="NSFrame">{{10, 33}, {438, 279}}</string> + <string key="NSFrame">{{10, 33}, {438, 246}}</string> </object> <string key="NSLabel">Output</string> <reference key="NSColor" ref="57160303"/> <reference key="NSTabView" ref="448510093"/> </object> + <object class="NSTabViewItem" id="723450037"> + <object class="NSMutableString" key="NSIdentifier"> + <characters key="NS.bytes">2</characters> + </object> + <object class="NSView" key="NSView" id="408298283"> + <nil key="NSNextResponder"/> + <int key="NSvFlags">256</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSButton" id="878106058"> + <reference key="NSNextResponder" ref="408298283"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{18, 222}, {409, 23}}</string> + <reference key="NSSuperview" ref="408298283"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="718083688"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Enable syncing</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="878106058"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSAlternateImage" ref="391434389"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSTextField" id="386152084"> + <reference key="NSNextResponder" ref="408298283"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{36, 188}, {385, 28}}</string> + <reference key="NSSuperview" ref="408298283"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="572508492"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">4194304</int> + <string type="base64-UTF8" key="NSContents">RW5hYmxlcyB0aGUgImNvcHkiIG1lbnUgaXRlbSBhbmQgYWxsb3dzIGZvciBzeW5jaW5nIGJldHdlZW4g +dGhlIE9TWCBQYXN0ZWJvYXJkIGFuZCB0aGUgWDExIENMSVBCT0FSRCBhbmQgUFJJTUFSWSBidWZmZXJz +Lg</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="386152084"/> + <reference key="NSBackgroundColor" ref="57160303"/> + <reference key="NSTextColor" ref="930815747"/> + </object> + </object> + <object class="NSButton" id="477050998"> + <reference key="NSNextResponder" ref="408298283"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{34, 96}, {409, 23}}</string> + <reference key="NSSuperview" ref="408298283"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="501304422"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Update CLIPBOARD when Pasteboard changes.</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="477050998"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSAlternateImage" ref="391434389"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSButton" id="765780304"> + <reference key="NSNextResponder" ref="408298283"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{34, 71}, {409, 23}}</string> + <reference key="NSSuperview" ref="408298283"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="510771323"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Update PRIMARY (middle-click) when Pasteboard changes.</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="765780304"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSAlternateImage" ref="391434389"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSButton" id="1002778833"> + <reference key="NSNextResponder" ref="408298283"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{34, 46}, {409, 23}}</string> + <reference key="NSSuperview" ref="408298283"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="897099877"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Update Pasteboard immediately when new text is selected.</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="1002778833"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSAlternateImage" ref="391434389"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSButton" id="487809555"> + <reference key="NSNextResponder" ref="408298283"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{34, 159}, {409, 23}}</string> + <reference key="NSSuperview" ref="408298283"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="619977658"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Update Pasteboard when CLIPBOARD changes.</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="487809555"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSAlternateImage" ref="391434389"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSTextField" id="620944856"> + <reference key="NSNextResponder" ref="408298283"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{48, 125}, {385, 28}}</string> + <reference key="NSSuperview" ref="408298283"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="461823902"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">4194304</int> + <string key="NSContents">Disable this option if you want to use xclipboard, klipper, or any other X11 clipboard manager.</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="620944856"/> + <reference key="NSBackgroundColor" ref="57160303"/> + <reference key="NSTextColor" ref="930815747"/> + </object> + </object> + <object class="NSTextField" id="522511724"> + <reference key="NSNextResponder" ref="408298283"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{48, 14}, {370, 28}}</string> + <reference key="NSSuperview" ref="408298283"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="994587858"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">4194304</int> + <string key="NSContents">Due to limitations in the X11 protocol, this option may not always work in some applications.</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="522511724"/> + <reference key="NSBackgroundColor" ref="57160303"/> + <reference key="NSTextColor" ref="930815747"/> + </object> + </object> + </object> + <string key="NSFrame">{{10, 33}, {438, 246}}</string> + </object> + <string key="NSLabel">Pasteboard</string> + <reference key="NSColor" ref="57160303"/> + <reference key="NSTabView" ref="448510093"/> + </object> + <object class="NSTabViewItem" id="10973343"> + <object class="NSMutableString" key="NSIdentifier"> + <characters key="NS.bytes">2</characters> + </object> + <object class="NSView" key="NSView" id="184765684"> + <nil key="NSNextResponder"/> + <int key="NSvFlags">256</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSButton" id="657659108"> + <reference key="NSNextResponder" ref="184765684"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{15, 212}, {402, 18}}</string> + <reference key="NSSuperview" ref="184765684"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="259618205"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Click-through Inactive Windows</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="657659108"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSAlternateImage" ref="391434389"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSTextField" id="290578835"> + <reference key="NSNextResponder" ref="184765684"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{23, 175}, {385, 31}}</string> + <reference key="NSSuperview" ref="184765684"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="399127858"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">4194304</int> + <string key="NSContents">When enabled, clicking on an inactive window will cause that mouse click to pass through to that window in addition to activating it.</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="290578835"/> + <reference key="NSBackgroundColor" ref="57160303"/> + <reference key="NSTextColor" ref="930815747"/> + </object> + </object> + <object class="NSButton" id="992839333"> + <reference key="NSNextResponder" ref="184765684"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{15, 151}, {402, 18}}</string> + <reference key="NSSuperview" ref="184765684"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="959555182"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Focus Follows Mouse</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="992839333"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSAlternateImage" ref="391434389"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSTextField" id="138261120"> + <reference key="NSNextResponder" ref="184765684"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{23, 128}, {385, 17}}</string> + <reference key="NSSuperview" ref="184765684"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="183409141"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">4194304</int> + <string key="NSContents">X11 window focus follows the cursor. This has some adverse effects.</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="138261120"/> + <reference key="NSBackgroundColor" ref="57160303"/> + <reference key="NSTextColor" ref="930815747"/> + </object> + </object> + <object class="NSButton" id="128352289"> + <reference key="NSNextResponder" ref="184765684"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{15, 107}, {402, 18}}</string> + <reference key="NSSuperview" ref="184765684"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="556463187"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Focus On New Windows</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="128352289"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSAlternateImage" ref="391434389"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSTextField" id="57161931"> + <reference key="NSNextResponder" ref="184765684"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{23, 73}, {385, 28}}</string> + <reference key="NSSuperview" ref="184765684"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="989804990"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">4194304</int> + <string key="NSContents">When enabled, creation of a new X11 window will cause X11.app to move to the foreground (instead of Finder.app, Terminal.app, etc.)</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="57161931"/> + <reference key="NSBackgroundColor" ref="57160303"/> + <reference key="NSTextColor" ref="930815747"/> + </object> + </object> + </object> + <string key="NSFrame">{{10, 33}, {438, 246}}</string> + </object> + <string key="NSLabel">Windows</string> + <reference key="NSColor" ref="57160303"/> + <reference key="NSTabView" ref="448510093"/> + </object> <object class="NSTabViewItem" id="348328898"> <object class="NSView" key="NSView" id="300811574"> <nil key="NSNextResponder"/> @@ -883,7 +1107,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string> <object class="NSButton" id="989050925"> <reference key="NSNextResponder" ref="300811574"/> <int key="NSvFlags">256</int> - <string key="NSFrame">{{18, 243}, {402, 18}}</string> + <string key="NSFrame">{{18, 210}, {402, 18}}</string> <reference key="NSSuperview" ref="300811574"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="189594322"> @@ -904,7 +1128,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string> <object class="NSButton" id="700826966"> <reference key="NSNextResponder" ref="300811574"/> <int key="NSvFlags">256</int> - <string key="NSFrame">{{18, 166}, {402, 18}}</string> + <string key="NSFrame">{{18, 133}, {402, 18}}</string> <reference key="NSSuperview" ref="300811574"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="489340979"> @@ -925,7 +1149,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string> <object class="NSTextField" id="168436707"> <reference key="NSNextResponder" ref="300811574"/> <int key="NSvFlags">256</int> - <string key="NSFrame">{{36, 195}, {385, 42}}</string> + <string key="NSFrame">{{36, 162}, {385, 42}}</string> <reference key="NSSuperview" ref="300811574"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="53243865"> @@ -943,7 +1167,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <object class="NSTextField" id="363817195"> <reference key="NSNextResponder" ref="300811574"/> <int key="NSvFlags">256</int> - <string key="NSFrame">{{36, 118}, {385, 42}}</string> + <string key="NSFrame">{{36, 85}, {385, 42}}</string> <reference key="NSSuperview" ref="300811574"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="390084685"> @@ -959,7 +1183,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <object class="NSTextField" id="223835729"> <reference key="NSNextResponder" ref="300811574"/> <int key="NSvFlags">256</int> - <string key="NSFrame">{{20, 17}, {404, 14}}</string> + <string key="NSFrame">{{20, -16}, {404, 14}}</string> <reference key="NSSuperview" ref="300811574"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="283628678"> @@ -973,7 +1197,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> </object> </object> </object> - <string key="NSFrame">{{10, 33}, {438, 279}}</string> + <string key="NSFrame">{{10, 33}, {438, 246}}</string> </object> <string key="NSLabel">Security</string> <reference key="NSColor" ref="57160303"/> @@ -991,34 +1215,34 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> </object> </object> </object> - <string key="NSFrameSize">{481, 345}</string> + <string key="NSFrameSize">{484, 308}</string> </object> - <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> - <string key="NSMinSize">{213, 129}</string> + <string key="NSScreenRect">{{0, 0}, {1280, 938}}</string> + <string key="NSMinSize">{320, 262}</string> <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSFrameAutosaveName">x11_prefs</string> </object> <object class="NSWindowTemplate" id="604417141"> <int key="NSWindowStyleMask">11</int> <int key="NSWindowBacking">2</int> - <string key="NSWindowRect">{{361, 362}, {454, 311}}</string> + <string key="NSWindowRect">{{302, 440}, {454, 271}}</string> <int key="NSWTFlags">1350041600</int> <string key="NSWindowTitle">X11 Application Menu</string> <string key="NSWindowClass">NSPanel</string> <object class="NSMutableString" key="NSViewClass"> <characters key="NS.bytes">View</characters> </object> - <string key="NSWindowContentMaxSize">{10000, 10000}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{320, 240}</string> <object class="NSView" key="NSWindowView" id="85544634"> - <reference key="NSNextResponder"/> + <nil key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSButton" id="671954382"> <reference key="NSNextResponder" ref="85544634"/> <int key="NSvFlags">265</int> - <string key="NSFrame">{{340, 231}, {100, 32}}</string> + <string key="NSFrame">{{340, 191}, {100, 32}}</string> <reference key="NSSuperview" ref="85544634"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="143554520"> @@ -1047,7 +1271,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <object class="NSButton" id="492358940"> <reference key="NSNextResponder" ref="85544634"/> <int key="NSvFlags">265</int> - <string key="NSFrame">{{340, 199}, {100, 32}}</string> + <string key="NSFrame">{{340, 159}, {100, 32}}</string> <reference key="NSSuperview" ref="85544634"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="8201128"> @@ -1100,9 +1324,9 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> </object> <object class="NSMutableArray" key="NSTableColumns"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSTableColumn" id="84282687"> - <double key="NSWidth">9.900000e+01</double> - <double key="NSMinWidth">4.000000e+01</double> + <object class="NSTableColumn" id="938444323"> + <double key="NSWidth">1.217310e+02</double> + <double key="NSMinWidth">6.273100e+01</double> <double key="NSMaxWidth">1.000000e+03</double> <object class="NSTableHeaderCell" key="NSHeaderCell"> <int key="NSCellFlags">75628032</int> @@ -1120,7 +1344,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <reference key="NSColor" ref="214098874"/> </object> </object> - <object class="NSTextFieldCell" key="NSDataCell" id="432610585"> + <object class="NSTextFieldCell" key="NSDataCell" id="825378892"> <int key="NSCellFlags">338820672</int> <int key="NSCellFlags2">1024</int> <string key="NSContents">Text Cell</string> @@ -1137,9 +1361,9 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <bool key="NSIsEditable">YES</bool> <reference key="NSTableView" ref="905092943"/> </object> - <object class="NSTableColumn" id="938444323"> - <double key="NSWidth">1.217310e+02</double> - <double key="NSMinWidth">6.273100e+01</double> + <object class="NSTableColumn" id="84282687"> + <double key="NSWidth">9.900000e+01</double> + <double key="NSMinWidth">4.000000e+01</double> <double key="NSMaxWidth">1.000000e+03</double> <object class="NSTableHeaderCell" key="NSHeaderCell"> <int key="NSCellFlags">75628032</int> @@ -1149,7 +1373,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <reference key="NSBackgroundColor" ref="113872566"/> <reference key="NSTextColor" ref="249576247"/> </object> - <object class="NSTextFieldCell" key="NSDataCell" id="825378892"> + <object class="NSTextFieldCell" key="NSDataCell" id="432610585"> <int key="NSCellFlags">338820672</int> <int key="NSCellFlags2">1024</int> <string key="NSContents">Text Cell</string> @@ -1267,7 +1491,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> </object> <reference ref="898633680"/> </object> - <string key="NSFrame">{{20, 60}, {318, 231}}</string> + <string key="NSFrame">{{20, 20}, {318, 231}}</string> <reference key="NSSuperview" ref="85544634"/> <reference key="NSNextKeyView" ref="580565898"/> <int key="NSsFlags">50</int> @@ -1281,7 +1505,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <object class="NSButton" id="758204686"> <reference key="NSNextResponder" ref="85544634"/> <int key="NSvFlags">265</int> - <string key="NSFrame">{{340, 263}, {100, 32}}</string> + <string key="NSFrame">{{340, 223}, {100, 32}}</string> <reference key="NSSuperview" ref="85544634"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="1025474039"> @@ -1303,60 +1527,12 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <int key="NSPeriodicInterval">25</int> </object> </object> - <object class="NSButton" id="125703429"> - <reference key="NSNextResponder" ref="85544634"/> - <int key="NSvFlags">257</int> - <string key="NSFrame">{{356, 12}, {84, 32}}</string> - <reference key="NSSuperview" ref="85544634"/> - <bool key="NSEnabled">YES</bool> - <object class="NSButtonCell" key="NSCell" id="892296813"> - <int key="NSCellFlags">-2080244224</int> - <int key="NSCellFlags2">137887744</int> - <string key="NSContents">Cancel</string> - <reference key="NSSupport" ref="463863101"/> - <reference key="NSControlView" ref="125703429"/> - <int key="NSButtonFlags">-2038284033</int> - <int key="NSButtonFlags2">1</int> - <reference key="NSAlternateImage" ref="549406736"/> - <object class="NSMutableString" key="NSAlternateContents"> - <characters key="NS.bytes"/> - </object> - <object class="NSMutableString" key="NSKeyEquivalent"> - <characters key="NS.bytes"/> - </object> - <int key="NSPeriodicDelay">200</int> - <int key="NSPeriodicInterval">25</int> - </object> - </object> - <object class="NSButton" id="724002248"> - <reference key="NSNextResponder" ref="85544634"/> - <int key="NSvFlags">257</int> - <string key="NSFrame">{{272, 12}, {84, 32}}</string> - <reference key="NSSuperview" ref="85544634"/> - <bool key="NSEnabled">YES</bool> - <object class="NSButtonCell" key="NSCell" id="809610613"> - <int key="NSCellFlags">-2080244224</int> - <int key="NSCellFlags2">137887744</int> - <string key="NSContents">Done</string> - <reference key="NSSupport" ref="463863101"/> - <reference key="NSControlView" ref="724002248"/> - <int key="NSButtonFlags">-2038284033</int> - <int key="NSButtonFlags2">1</int> - <reference key="NSAlternateImage" ref="549406736"/> - <string key="NSAlternateContents"/> - <object class="NSMutableString" key="NSKeyEquivalent"> - <characters key="NS.bytes"/> - </object> - <int key="NSPeriodicDelay">200</int> - <int key="NSPeriodicInterval">25</int> - </object> - </object> </object> - <string key="NSFrameSize">{454, 311}</string> - <reference key="NSSuperview"/> + <string key="NSFrameSize">{454, 271}</string> </object> - <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> + <string key="NSScreenRect">{{0, 0}, {1280, 938}}</string> <string key="NSMinSize">{320, 262}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSFrameAutosaveName">x11_apps</string> </object> <object class="NSMenu" id="294137138"> @@ -1419,46 +1595,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> - <string key="label">cut:</string> - <reference key="source" ref="941939442"/> - <reference key="destination" ref="581727829"/> - </object> - <int key="connectionID">175</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">paste:</string> - <reference key="source" ref="941939442"/> - <reference key="destination" ref="924678073"/> - </object> - <int key="connectionID">176</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">redo:</string> - <reference key="source" ref="941939442"/> - <reference key="destination" ref="535038564"/> - </object> - <int key="connectionID">178</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">selectAll:</string> - <reference key="source" ref="941939442"/> - <reference key="destination" ref="322866464"/> - </object> - <int key="connectionID">179</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">undo:</string> - <reference key="source" ref="941939442"/> - <reference key="destination" ref="1010221707"/> - </object> - <int key="connectionID">180</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> <string key="label">copy:</string> <reference key="source" ref="941939442"/> <reference key="destination" ref="185296989"/> @@ -1467,14 +1603,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> - <string key="label">delete:</string> - <reference key="source" ref="941939442"/> - <reference key="destination" ref="994817848"/> - </object> - <int key="connectionID">195</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> <string key="label">minimize_window:</string> <reference key="source" ref="485884620"/> <reference key="destination" ref="677652931"/> @@ -1531,14 +1659,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> - <string key="label">apps_table_done:</string> - <reference key="source" ref="485884620"/> - <reference key="destination" ref="724002248"/> - </object> - <int key="connectionID">302</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> <string key="label">apps_table_delete:</string> <reference key="source" ref="485884620"/> <reference key="destination" ref="492358940"/> @@ -1563,14 +1683,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> </object> <object class="IBConnectionRecord"> <object class="IBActionConnection" key="connection"> - <string key="label">apps_table_cancel:</string> - <reference key="source" ref="485884620"/> - <reference key="destination" ref="125703429"/> - </object> - <int key="connectionID">309</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> <string key="label">apps_table_new:</string> <reference key="source" ref="485884620"/> <reference key="destination" ref="758204686"/> @@ -1842,14 +1954,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <int key="connectionID">549</int> </object> <object class="IBConnectionRecord"> - <object class="IBActionConnection" key="connection"> - <string key="label">prefs_changed:</string> - <reference key="source" ref="485884620"/> - <reference key="destination" ref="915448994"/> - </object> - <int key="connectionID">300300</int> - </object> - <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">window_separator</string> <reference key="source" ref="485884620"/> @@ -1859,14 +1963,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> - <string key="label">click_through</string> - <reference key="source" ref="485884620"/> - <reference key="destination" ref="915448994"/> - </object> - <int key="connectionID">300332</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> <string key="label">menu</string> <reference key="source" ref="815810918"/> <reference key="destination" ref="524015605"/> @@ -1881,6 +1977,174 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> </object> <int key="connectionID">300336</int> </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">prefs_changed:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="657659108"/> + </object> + <int key="connectionID">300389</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">prefs_changed:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="992839333"/> + </object> + <int key="connectionID">300390</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">prefs_changed:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="128352289"/> + </object> + <int key="connectionID">300391</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">click_through</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="657659108"/> + </object> + <int key="connectionID">300392</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">focus_follows_mouse</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="992839333"/> + </object> + <int key="connectionID">300393</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">focus_on_new_window</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="128352289"/> + </object> + <int key="connectionID">300394</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">copy_menu_item</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="185296989"/> + </object> + <int key="connectionID">300443</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">sync_pasteboard</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="878106058"/> + </object> + <int key="connectionID">300444</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">sync_clipboard_to_pasteboard</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="487809555"/> + </object> + <int key="connectionID">300461</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">sync_pasteboard_to_clipboard</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="477050998"/> + </object> + <int key="connectionID">300462</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">sync_pasteboard_to_primary</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="765780304"/> + </object> + <int key="connectionID">300463</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">sync_primary_immediately</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="1002778833"/> + </object> + <int key="connectionID">300464</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">prefs_changed:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="878106058"/> + </object> + <int key="connectionID">300465</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">prefs_changed:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="487809555"/> + </object> + <int key="connectionID">300466</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">prefs_changed:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="477050998"/> + </object> + <int key="connectionID">300467</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">prefs_changed:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="765780304"/> + </object> + <int key="connectionID">300468</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">prefs_changed:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="1002778833"/> + </object> + <int key="connectionID">300469</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">sync_text1</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="620944856"/> + </object> + <int key="connectionID">300470</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">sync_text2</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="522511724"/> + </object> + <int key="connectionID">300471</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">enable_fullscreen_menu</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="57246850"/> + </object> + <int key="connectionID">300474</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">prefs_changed:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="57246850"/> + </object> + <int key="connectionID">300475</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -1943,11 +2207,11 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <reference ref="276216762"/> <reference ref="1066447520"/> <reference ref="1036389925"/> - <reference ref="280172320"/> <reference ref="369641893"/> - <reference ref="984461797"/> <reference ref="155085383"/> <reference ref="444952046"/> + <reference ref="984461797"/> + <reference ref="280172320"/> </object> <reference key="parent" ref="931553638"/> </object> @@ -2103,58 +2367,16 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <reference key="object" ref="526778998"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="839739619"/> <reference ref="185296989"/> - <reference ref="1010221707"/> - <reference ref="581727829"/> - <reference ref="994817848"/> - <reference ref="924678073"/> - <reference ref="322866464"/> - <reference ref="535038564"/> </object> <reference key="parent" ref="200491363"/> </object> <object class="IBObjectRecord"> - <int key="objectID">156</int> - <reference key="object" ref="839739619"/> - <reference key="parent" ref="526778998"/> - </object> - <object class="IBObjectRecord"> <int key="objectID">157</int> <reference key="object" ref="185296989"/> <reference key="parent" ref="526778998"/> </object> <object class="IBObjectRecord"> - <int key="objectID">158</int> - <reference key="object" ref="1010221707"/> - <reference key="parent" ref="526778998"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">160</int> - <reference key="object" ref="581727829"/> - <reference key="parent" ref="526778998"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">164</int> - <reference key="object" ref="994817848"/> - <reference key="parent" ref="526778998"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">171</int> - <reference key="object" ref="924678073"/> - <reference key="parent" ref="526778998"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">172</int> - <reference key="object" ref="322866464"/> - <reference key="parent" ref="526778998"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">173</int> - <reference key="object" ref="535038564"/> - <reference key="parent" ref="526778998"/> - </object> - <object class="IBObjectRecord"> <int key="objectID">269</int> <reference key="object" ref="868031522"/> <object class="NSMutableArray" key="children"> @@ -2239,6 +2461,8 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <reference ref="287591690"/> <reference ref="960678392"/> <reference ref="348328898"/> + <reference ref="10973343"/> + <reference ref="723450037"/> </object> <reference key="parent" ref="941366957"/> </object> @@ -2262,8 +2486,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <reference ref="842100515"/> <reference ref="31160162"/> <reference ref="179949713"/> - <reference ref="915448994"/> - <reference ref="707276799"/> </object> <reference key="parent" ref="287591690"/> </object> @@ -2335,13 +2557,14 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <reference key="object" ref="515308735"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="418227126"/> - <reference ref="1039016593"/> <reference ref="709074847"/> <reference ref="201731424"/> <reference ref="86150604"/> <reference ref="477203622"/> + <reference ref="57246850"/> <reference ref="298603383"/> + <reference ref="418227126"/> + <reference ref="1039016593"/> </object> <reference key="parent" ref="960678392"/> </object> @@ -2494,8 +2717,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <reference ref="758204686"/> <reference ref="671954382"/> <reference ref="492358940"/> - <reference ref="125703429"/> - <reference ref="724002248"/> </object> <reference key="parent" ref="604417141"/> </object> @@ -2671,34 +2892,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <reference key="parent" ref="341113515"/> </object> <object class="IBObjectRecord"> - <int key="objectID">300296</int> - <reference key="object" ref="915448994"/> - <object class="NSMutableArray" key="children"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="117056849"/> - </object> - <reference key="parent" ref="596750588"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">300297</int> - <reference key="object" ref="117056849"/> - <reference key="parent" ref="915448994"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">300298</int> - <reference key="object" ref="707276799"/> - <object class="NSMutableArray" key="children"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="318286890"/> - </object> - <reference key="parent" ref="596750588"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">300299</int> - <reference key="object" ref="318286890"/> - <reference key="parent" ref="707276799"/> - </object> - <object class="IBObjectRecord"> <int key="objectID">295</int> <reference key="object" ref="1063387772"/> <object class="NSMutableArray" key="children"> @@ -2821,37 +3014,267 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <reference key="parent" ref="492358940"/> </object> <object class="IBObjectRecord"> - <int key="objectID">299</int> - <reference key="object" ref="125703429"/> + <int key="objectID">300330</int> + <reference key="object" ref="444952046"/> + <reference key="parent" ref="96874957"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300337</int> + <reference key="object" ref="10973343"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="892296813"/> + <reference ref="184765684"/> </object> - <reference key="parent" ref="85544634"/> + <reference key="parent" ref="448510093"/> </object> <object class="IBObjectRecord"> - <int key="objectID">100299</int> - <reference key="object" ref="892296813"/> - <reference key="parent" ref="125703429"/> + <int key="objectID">300338</int> + <reference key="object" ref="184765684"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="657659108"/> + <reference ref="290578835"/> + <reference ref="992839333"/> + <reference ref="138261120"/> + <reference ref="128352289"/> + <reference ref="57161931"/> + </object> + <reference key="parent" ref="10973343"/> </object> <object class="IBObjectRecord"> - <int key="objectID">291</int> - <reference key="object" ref="724002248"/> + <int key="objectID">300358</int> + <reference key="object" ref="290578835"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="809610613"/> + <reference ref="399127858"/> </object> - <reference key="parent" ref="85544634"/> + <reference key="parent" ref="184765684"/> </object> <object class="IBObjectRecord"> - <int key="objectID">100291</int> - <reference key="object" ref="809610613"/> - <reference key="parent" ref="724002248"/> + <int key="objectID">300359</int> + <reference key="object" ref="657659108"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="259618205"/> + </object> + <reference key="parent" ref="184765684"/> </object> <object class="IBObjectRecord"> - <int key="objectID">300330</int> - <reference key="object" ref="444952046"/> - <reference key="parent" ref="96874957"/> + <int key="objectID">300360</int> + <reference key="object" ref="259618205"/> + <reference key="parent" ref="657659108"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300361</int> + <reference key="object" ref="399127858"/> + <reference key="parent" ref="290578835"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300362</int> + <reference key="object" ref="992839333"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="959555182"/> + </object> + <reference key="parent" ref="184765684"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300363</int> + <reference key="object" ref="959555182"/> + <reference key="parent" ref="992839333"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300364</int> + <reference key="object" ref="138261120"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="183409141"/> + </object> + <reference key="parent" ref="184765684"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300365</int> + <reference key="object" ref="183409141"/> + <reference key="parent" ref="138261120"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300368</int> + <reference key="object" ref="128352289"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="556463187"/> + </object> + <reference key="parent" ref="184765684"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300369</int> + <reference key="object" ref="556463187"/> + <reference key="parent" ref="128352289"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300370</int> + <reference key="object" ref="57161931"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="989804990"/> + </object> + <reference key="parent" ref="184765684"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300371</int> + <reference key="object" ref="989804990"/> + <reference key="parent" ref="57161931"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300421</int> + <reference key="object" ref="723450037"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="408298283"/> + </object> + <reference key="parent" ref="448510093"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300422</int> + <reference key="object" ref="408298283"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="878106058"/> + <reference ref="386152084"/> + <reference ref="487809555"/> + <reference ref="620944856"/> + <reference ref="477050998"/> + <reference ref="765780304"/> + <reference ref="1002778833"/> + <reference ref="522511724"/> + </object> + <reference key="parent" ref="723450037"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300423</int> + <reference key="object" ref="386152084"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="572508492"/> + </object> + <reference key="parent" ref="408298283"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300424</int> + <reference key="object" ref="878106058"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="718083688"/> + </object> + <reference key="parent" ref="408298283"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300440</int> + <reference key="object" ref="718083688"/> + <reference key="parent" ref="878106058"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300441</int> + <reference key="object" ref="572508492"/> + <reference key="parent" ref="386152084"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300447</int> + <reference key="object" ref="477050998"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="501304422"/> + </object> + <reference key="parent" ref="408298283"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300450</int> + <reference key="object" ref="501304422"/> + <reference key="parent" ref="477050998"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300451</int> + <reference key="object" ref="765780304"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="510771323"/> + </object> + <reference key="parent" ref="408298283"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300452</int> + <reference key="object" ref="510771323"/> + <reference key="parent" ref="765780304"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300453</int> + <reference key="object" ref="487809555"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="619977658"/> + </object> + <reference key="parent" ref="408298283"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300454</int> + <reference key="object" ref="619977658"/> + <reference key="parent" ref="487809555"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300455</int> + <reference key="object" ref="620944856"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="461823902"/> + </object> + <reference key="parent" ref="408298283"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300456</int> + <reference key="object" ref="461823902"/> + <reference key="parent" ref="620944856"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300457</int> + <reference key="object" ref="1002778833"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="897099877"/> + </object> + <reference key="parent" ref="408298283"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300458</int> + <reference key="object" ref="897099877"/> + <reference key="parent" ref="1002778833"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300459</int> + <reference key="object" ref="522511724"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="994587858"/> + </object> + <reference key="parent" ref="408298283"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300460</int> + <reference key="object" ref="994587858"/> + <reference key="parent" ref="522511724"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300472</int> + <reference key="object" ref="57246850"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="917248662"/> + </object> + <reference key="parent" ref="515308735"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300473</int> + <reference key="object" ref="917248662"/> + <reference key="parent" ref="57246850"/> </object> </object> </object> @@ -2863,7 +3286,29 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <string>-2.IBPluginDependency</string> <string>-3.IBPluginDependency</string> <string>-3.ImportedFromIB2</string> + <string>100292.IBPluginDependency</string> + <string>100293.IBPluginDependency</string> + <string>100295.IBPluginDependency</string> <string>100295.IBShouldRemoveOnLegacySave</string> + <string>100310.IBPluginDependency</string> + <string>100363.IBPluginDependency</string> + <string>100364.IBPluginDependency</string> + <string>100365.IBPluginDependency</string> + <string>100368.IBPluginDependency</string> + <string>100369.IBPluginDependency</string> + <string>100370.IBPluginDependency</string> + <string>100371.IBPluginDependency</string> + <string>100372.IBPluginDependency</string> + <string>100374.IBPluginDependency</string> + <string>100375.IBPluginDependency</string> + <string>100376.IBPluginDependency</string> + <string>100377.IBPluginDependency</string> + <string>100379.IBPluginDependency</string> + <string>100382.IBPluginDependency</string> + <string>100385.IBPluginDependency</string> + <string>100386.IBPluginDependency</string> + <string>100541.IBPluginDependency</string> + <string>100543.IBPluginDependency</string> <string>129.IBPluginDependency</string> <string>129.ImportedFromIB2</string> <string>130.IBPluginDependency</string> @@ -2884,31 +3329,19 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <string>149.ImportedFromIB2</string> <string>150.IBPluginDependency</string> <string>150.ImportedFromIB2</string> - <string>156.IBPluginDependency</string> - <string>156.ImportedFromIB2</string> <string>157.IBPluginDependency</string> <string>157.ImportedFromIB2</string> - <string>158.IBPluginDependency</string> - <string>158.ImportedFromIB2</string> - <string>160.IBPluginDependency</string> - <string>160.ImportedFromIB2</string> <string>163.IBPluginDependency</string> <string>163.ImportedFromIB2</string> - <string>164.IBPluginDependency</string> - <string>164.ImportedFromIB2</string> + <string>169.IBEditorWindowLastContentRect</string> <string>169.IBPluginDependency</string> <string>169.ImportedFromIB2</string> <string>169.editorWindowContentRectSynchronizationRect</string> - <string>171.IBPluginDependency</string> - <string>171.ImportedFromIB2</string> - <string>172.IBPluginDependency</string> - <string>172.ImportedFromIB2</string> - <string>173.IBPluginDependency</string> - <string>173.ImportedFromIB2</string> <string>19.IBPluginDependency</string> <string>19.ImportedFromIB2</string> <string>196.IBPluginDependency</string> <string>196.ImportedFromIB2</string> + <string>200295.IBPluginDependency</string> <string>200295.IBShouldRemoveOnLegacySave</string> <string>203.IBPluginDependency</string> <string>203.ImportedFromIB2</string> @@ -2916,10 +3349,11 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <string>204.ImportedFromIB2</string> <string>23.IBPluginDependency</string> <string>23.ImportedFromIB2</string> + <string>24.IBEditorWindowLastContentRect</string> <string>24.IBPluginDependency</string> <string>24.ImportedFromIB2</string> <string>24.editorWindowContentRectSynchronizationRect</string> - <string>244.IBPluginDependency</string> + <string>244.IBEditorWindowLastContentRect</string> <string>244.IBWindowTemplateEditedContentRect</string> <string>244.ImportedFromIB2</string> <string>244.editorWindowContentRectSynchronizationRect</string> @@ -2931,19 +3365,18 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <string>245.ImportedFromIB2</string> <string>269.IBPluginDependency</string> <string>269.ImportedFromIB2</string> + <string>270.IBEditorWindowLastContentRect</string> <string>270.IBPluginDependency</string> <string>270.ImportedFromIB2</string> <string>270.editorWindowContentRectSynchronizationRect</string> <string>272.IBPluginDependency</string> <string>272.ImportedFromIB2</string> <string>285.IBEditorWindowLastContentRect</string> - <string>285.IBPluginDependency</string> <string>285.IBViewEditorWindowController.showingBoundsRectangles</string> <string>285.IBViewEditorWindowController.showingLayoutRectangles</string> <string>285.IBWindowTemplateEditedContentRect</string> <string>285.ImportedFromIB2</string> <string>285.editorWindowContentRectSynchronizationRect</string> - <string>285.lastResizeAction</string> <string>285.windowTemplate.hasMaxSize</string> <string>285.windowTemplate.hasMinSize</string> <string>285.windowTemplate.maxSize</string> @@ -2954,8 +3387,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <string>29.IBPluginDependency</string> <string>29.ImportedFromIB2</string> <string>29.editorWindowContentRectSynchronizationRect</string> - <string>291.IBPluginDependency</string> - <string>291.ImportedFromIB2</string> <string>292.IBPluginDependency</string> <string>292.ImportedFromIB2</string> <string>293.IBPluginDependency</string> @@ -2968,15 +3399,63 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <string>297.ImportedFromIB2</string> <string>298.IBPluginDependency</string> <string>298.ImportedFromIB2</string> - <string>299.IBPluginDependency</string> - <string>299.ImportedFromIB2</string> + <string>300295.IBPluginDependency</string> <string>300295.IBShouldRemoveOnLegacySave</string> - <string>300296.IBPluginDependency</string> - <string>300296.ImportedFromIB2</string> - <string>300298.IBPluginDependency</string> - <string>300298.ImportedFromIB2</string> <string>300330.IBPluginDependency</string> <string>300330.ImportedFromIB2</string> + <string>300337.IBPluginDependency</string> + <string>300337.ImportedFromIB2</string> + <string>300338.IBPluginDependency</string> + <string>300338.ImportedFromIB2</string> + <string>300358.IBPluginDependency</string> + <string>300358.ImportedFromIB2</string> + <string>300359.IBPluginDependency</string> + <string>300359.ImportedFromIB2</string> + <string>300360.IBPluginDependency</string> + <string>300361.IBPluginDependency</string> + <string>300362.IBPluginDependency</string> + <string>300362.ImportedFromIB2</string> + <string>300363.IBPluginDependency</string> + <string>300364.IBPluginDependency</string> + <string>300364.ImportedFromIB2</string> + <string>300365.IBPluginDependency</string> + <string>300368.IBPluginDependency</string> + <string>300368.ImportedFromIB2</string> + <string>300369.IBPluginDependency</string> + <string>300370.IBPluginDependency</string> + <string>300370.ImportedFromIB2</string> + <string>300371.IBPluginDependency</string> + <string>300421.IBPluginDependency</string> + <string>300421.ImportedFromIB2</string> + <string>300422.IBPluginDependency</string> + <string>300422.ImportedFromIB2</string> + <string>300423.IBPluginDependency</string> + <string>300423.ImportedFromIB2</string> + <string>300424.IBPluginDependency</string> + <string>300424.ImportedFromIB2</string> + <string>300440.IBPluginDependency</string> + <string>300441.IBPluginDependency</string> + <string>300447.IBPluginDependency</string> + <string>300447.ImportedFromIB2</string> + <string>300450.IBPluginDependency</string> + <string>300451.IBPluginDependency</string> + <string>300451.ImportedFromIB2</string> + <string>300452.IBPluginDependency</string> + <string>300453.IBPluginDependency</string> + <string>300453.ImportedFromIB2</string> + <string>300454.IBPluginDependency</string> + <string>300455.IBPluginDependency</string> + <string>300455.ImportedFromIB2</string> + <string>300456.IBPluginDependency</string> + <string>300457.IBPluginDependency</string> + <string>300457.ImportedFromIB2</string> + <string>300458.IBPluginDependency</string> + <string>300459.IBPluginDependency</string> + <string>300459.ImportedFromIB2</string> + <string>300460.IBPluginDependency</string> + <string>300472.IBPluginDependency</string> + <string>300472.ImportedFromIB2</string> + <string>300473.IBPluginDependency</string> <string>305.IBPluginDependency</string> <string>305.ImportedFromIB2</string> <string>310.IBPluginDependency</string> @@ -3096,8 +3575,30 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1" id="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> @@ -3121,8 +3622,10 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> + <string>{{168, 821}, {113, 23}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> + <string>{{202, 626}, {154, 153}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -3131,79 +3634,87 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> - <string>{{202, 626}, {154, 153}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> + <string>{{349, 858}, {315, 153}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> + <string>{{271, 666}, {301, 153}}</string> + <string>{{437, 749}, {484, 308}}</string> + <string>{{437, 749}, {484, 308}}</string> + <reference ref="9"/> + <string>{{184, 290}, {481, 345}}</string> + <integer value="0" id="8"/> + <reference ref="9"/> + <string>{3.40282e+38, 3.40282e+38}</string> + <string>{320, 240}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> + <string>{{58, 803}, {155, 33}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> + <string>{{100, 746}, {155, 33}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> + <string>{{68, 585}, {454, 271}}</string> + <reference ref="9"/> + <reference ref="9"/> + <string>{{68, 585}, {454, 271}}</string> + <reference ref="9"/> + <string>{{433, 406}, {486, 327}}</string> + <reference ref="8"/> + <reference ref="9"/> + <string>{3.40282e+38, 3.40282e+38}</string> + <string>{320, 240}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> + <string>{{145, 1011}, {336, 20}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> + <string>{{67, 819}, {336, 20}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> - <string>{{271, 666}, {301, 153}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{184, 290}, {481, 345}}</string> <reference ref="9"/> - <string>{{184, 290}, {481, 345}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> - <string>{3.40282e+38, 3.40282e+38}</string> - <string>{213, 107}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> - <string>{{100, 746}, {155, 33}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> - <string>{{537, 545}, {454, 311}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> - <string>{{537, 545}, {454, 311}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> - <string>{{433, 406}, {486, 327}}</string> - <object class="NSDictionary"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>IBResizeActionFinalFrame</string> - <string>IBResizeActionInitialFrame</string> - </object> - <object class="NSMutableArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>{{537, 554}, {454, 311}}</string> - <string>{{537, 576}, {471, 289}}</string> - </object> - </object> - <integer value="0"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> - <string>{3.40282e+38, 3.40282e+38}</string> - <string>{320, 240}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> - <string>{{0, 836}, {336, 20}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> - <string>{{67, 819}, {336, 20}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> @@ -3212,19 +3723,29 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> @@ -3320,7 +3841,9 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> - <string>{{12, 633}, {218, 203}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{20, 641}, {218, 203}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>{{79, 616}, {218, 203}}</string> @@ -3356,13 +3879,14 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> </object> </object> <nil key="sourceID"/> - <int key="maxID">300336</int> + <int key="maxID">300475</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBPartialClassDescription"> <string key="className">FirstResponder</string> + <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBUserSource</string> <string key="minorKey"/> @@ -3370,6 +3894,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> </object> <object class="IBPartialClassDescription"> <string key="className">NSFormatter</string> + <string key="superclassName">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBUserSource</string> <string key="minorKey"/> @@ -3378,11 +3903,21 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <object class="IBPartialClassDescription"> <string key="className">X11Controller</string> <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBUserSource</string> + <string key="minorKey"/> + </object> + </object> + </object> + <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBPartialClassDescription"> + <string key="className">X11Controller</string> + <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSMutableArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> - <string>apps_table_cancel:</string> <string>apps_table_delete:</string> <string>apps_table_done:</string> <string>apps_table_duplicate:</string> @@ -3420,7 +3955,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <string>id</string> <string>id</string> <string>id</string> - <string>id</string> </object> </object> <object class="NSMutableDictionary" key="outlets"> @@ -3430,17 +3964,28 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <string>apps_separator</string> <string>apps_table</string> <string>click_through</string> + <string>copy_menu_item</string> <string>depth</string> <string>dock_apps_menu</string> <string>dock_menu</string> <string>dock_window_separator</string> <string>enable_auth</string> <string>enable_fullscreen</string> + <string>enable_fullscreen_menu</string> <string>enable_keyequivs</string> <string>enable_tcp</string> <string>fake_buttons</string> + <string>focus_follows_mouse</string> + <string>focus_on_new_window</string> <string>prefs_panel</string> + <string>sync_clipboard_to_pasteboard</string> <string>sync_keymap</string> + <string>sync_pasteboard</string> + <string>sync_pasteboard_to_clipboard</string> + <string>sync_pasteboard_to_primary</string> + <string>sync_primary_immediately</string> + <string>sync_text1</string> + <string>sync_text2</string> <string>toggle_fullscreen_item</string> <string>use_sysbeep</string> <string>window_separator</string> @@ -3451,6 +3996,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <string>NSMenuItem</string> <string>NSTableView</string> <string>NSButton</string> + <string>NSMenuItem</string> <string>NSPopUpButton</string> <string>NSMenu</string> <string>NSMenu</string> @@ -3460,8 +4006,18 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <string>NSButton</string> <string>NSButton</string> <string>NSButton</string> + <string>NSButton</string> + <string>NSButton</string> + <string>NSButton</string> <string>NSPanel</string> <string>NSButton</string> + <string>NSButton</string> + <string>NSButton</string> + <string>NSButton</string> + <string>NSButton</string> + <string>NSButton</string> + <string>NSTextField</string> + <string>NSTextField</string> <string>NSMenuItem</string> <string>NSButton</string> <string>NSMenuItem</string> @@ -3469,14 +4025,14 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBUserSource</string> - <string key="minorKey"/> + <string key="majorKey">IBDocumentRelativeSource</string> + <string key="minorKey">../../../X11Controller.h</string> </object> </object> </object> </object> <int key="IBDocument.localizationMode">0</int> - <nil key="IBDocument.LastKnownRelativeProjectPath"/> + <string key="IBDocument.LastKnownRelativeProjectPath">../X11.xcodeproj</string> <int key="IBDocument.defaultPropertyAccessControl">3</int> </data> </archive> diff --git a/xorg-server/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..ee6cdf25e --- /dev/null +++ b/xorg-server/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib diff --git a/xorg-server/hw/xquartz/bundle/French.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Resources/French.lproj/InfoPlist.strings Binary files differindex 88e1f04ac..88e1f04ac 100644 --- a/xorg-server/hw/xquartz/bundle/French.lproj/InfoPlist.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/French.lproj/InfoPlist.strings diff --git a/xorg-server/hw/xquartz/bundle/French.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Resources/French.lproj/Localizable.strings Binary files differindex 2770dfb8c..2770dfb8c 100644 --- a/xorg-server/hw/xquartz/bundle/French.lproj/Localizable.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/French.lproj/Localizable.strings diff --git a/xorg-server/hw/xquartz/bundle/French.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/French.lproj/main.nib/keyedobjects.nib Binary files differindex 9f9a7da67..9f9a7da67 100644 --- a/xorg-server/hw/xquartz/bundle/French.lproj/main.nib/keyedobjects.nib +++ b/xorg-server/hw/xquartz/bundle/Resources/French.lproj/main.nib/keyedobjects.nib diff --git a/xorg-server/hw/xquartz/bundle/German.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Resources/German.lproj/InfoPlist.strings Binary files differindex aa37e7555..aa37e7555 100644 --- a/xorg-server/hw/xquartz/bundle/German.lproj/InfoPlist.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/German.lproj/InfoPlist.strings diff --git a/xorg-server/hw/xquartz/bundle/German.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Resources/German.lproj/Localizable.strings Binary files differindex a5489ab5c..a5489ab5c 100644 --- a/xorg-server/hw/xquartz/bundle/German.lproj/Localizable.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/German.lproj/Localizable.strings diff --git a/xorg-server/hw/xquartz/bundle/German.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/German.lproj/main.nib/keyedobjects.nib Binary files differindex 19532a9c2..19532a9c2 100644 --- a/xorg-server/hw/xquartz/bundle/German.lproj/main.nib/keyedobjects.nib +++ b/xorg-server/hw/xquartz/bundle/Resources/German.lproj/main.nib/keyedobjects.nib diff --git a/xorg-server/hw/xquartz/bundle/Italian.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Resources/Italian.lproj/InfoPlist.strings Binary files differindex 412169880..412169880 100644 --- a/xorg-server/hw/xquartz/bundle/Italian.lproj/InfoPlist.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/Italian.lproj/InfoPlist.strings diff --git a/xorg-server/hw/xquartz/bundle/Italian.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Resources/Italian.lproj/Localizable.strings Binary files differindex d05d73d44..d05d73d44 100644 --- a/xorg-server/hw/xquartz/bundle/Italian.lproj/Localizable.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/Italian.lproj/Localizable.strings diff --git a/xorg-server/hw/xquartz/bundle/Italian.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/Italian.lproj/main.nib/keyedobjects.nib Binary files differindex b6e2e1bb1..b6e2e1bb1 100644 --- a/xorg-server/hw/xquartz/bundle/Italian.lproj/main.nib/keyedobjects.nib +++ b/xorg-server/hw/xquartz/bundle/Resources/Italian.lproj/main.nib/keyedobjects.nib diff --git a/xorg-server/hw/xquartz/bundle/Japanese.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/InfoPlist.strings Binary files differindex 2d6330fa7..2d6330fa7 100644 --- a/xorg-server/hw/xquartz/bundle/Japanese.lproj/InfoPlist.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/InfoPlist.strings diff --git a/xorg-server/hw/xquartz/bundle/Japanese.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/Localizable.strings Binary files differindex 99821ea1f..99821ea1f 100644 --- a/xorg-server/hw/xquartz/bundle/Japanese.lproj/Localizable.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/Localizable.strings diff --git a/xorg-server/hw/xquartz/bundle/Japanese.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/keyedobjects.nib Binary files differindex 523fd0856..523fd0856 100644 --- a/xorg-server/hw/xquartz/bundle/Japanese.lproj/main.nib/keyedobjects.nib +++ b/xorg-server/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/keyedobjects.nib diff --git a/xorg-server/hw/xquartz/bundle/Spanish.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Resources/Spanish.lproj/InfoPlist.strings Binary files differindex 0e4287d14..0e4287d14 100644 --- a/xorg-server/hw/xquartz/bundle/Spanish.lproj/InfoPlist.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/Spanish.lproj/InfoPlist.strings diff --git a/xorg-server/hw/xquartz/bundle/Spanish.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Resources/Spanish.lproj/Localizable.strings Binary files differindex 652f432a5..652f432a5 100644 --- a/xorg-server/hw/xquartz/bundle/Spanish.lproj/Localizable.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/Spanish.lproj/Localizable.strings diff --git a/xorg-server/hw/xquartz/bundle/Spanish.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/Spanish.lproj/main.nib/keyedobjects.nib Binary files differindex 029349dd0..029349dd0 100644 --- a/xorg-server/hw/xquartz/bundle/Spanish.lproj/main.nib/keyedobjects.nib +++ b/xorg-server/hw/xquartz/bundle/Resources/Spanish.lproj/main.nib/keyedobjects.nib diff --git a/xorg-server/hw/xquartz/bundle/Resources/X11.icns b/xorg-server/hw/xquartz/bundle/Resources/X11.icns Binary files differnew file mode 100644 index 000000000..d9d2f7696 --- /dev/null +++ b/xorg-server/hw/xquartz/bundle/Resources/X11.icns diff --git a/xorg-server/hw/xquartz/bundle/da.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Resources/da.lproj/InfoPlist.strings Binary files differindex 88e1f04ac..88e1f04ac 100644 --- a/xorg-server/hw/xquartz/bundle/da.lproj/InfoPlist.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/da.lproj/InfoPlist.strings diff --git a/xorg-server/hw/xquartz/bundle/da.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Resources/da.lproj/Localizable.strings Binary files differindex 9608a2e6b..9608a2e6b 100644 --- a/xorg-server/hw/xquartz/bundle/da.lproj/Localizable.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/da.lproj/Localizable.strings diff --git a/xorg-server/hw/xquartz/bundle/da.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/da.lproj/main.nib/keyedobjects.nib Binary files differindex 4a2bd4bde..4a2bd4bde 100644 --- a/xorg-server/hw/xquartz/bundle/da.lproj/main.nib/keyedobjects.nib +++ b/xorg-server/hw/xquartz/bundle/Resources/da.lproj/main.nib/keyedobjects.nib diff --git a/xorg-server/hw/xquartz/bundle/fi.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Resources/fi.lproj/InfoPlist.strings Binary files differindex 8e4f6474f..8e4f6474f 100644 --- a/xorg-server/hw/xquartz/bundle/fi.lproj/InfoPlist.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/fi.lproj/InfoPlist.strings diff --git a/xorg-server/hw/xquartz/bundle/fi.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Resources/fi.lproj/Localizable.strings Binary files differindex e8420fbaa..e8420fbaa 100644 --- a/xorg-server/hw/xquartz/bundle/fi.lproj/Localizable.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/fi.lproj/Localizable.strings diff --git a/xorg-server/hw/xquartz/bundle/fi.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/fi.lproj/main.nib/keyedobjects.nib Binary files differindex b5039fd44..b5039fd44 100644 --- a/xorg-server/hw/xquartz/bundle/fi.lproj/main.nib/keyedobjects.nib +++ b/xorg-server/hw/xquartz/bundle/Resources/fi.lproj/main.nib/keyedobjects.nib diff --git a/xorg-server/hw/xquartz/bundle/ko.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Resources/ko.lproj/InfoPlist.strings Binary files differindex 4c738f8b2..4c738f8b2 100644 --- a/xorg-server/hw/xquartz/bundle/ko.lproj/InfoPlist.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/ko.lproj/InfoPlist.strings diff --git a/xorg-server/hw/xquartz/bundle/ko.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Resources/ko.lproj/Localizable.strings Binary files differindex 56a335859..56a335859 100644 --- a/xorg-server/hw/xquartz/bundle/ko.lproj/Localizable.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/ko.lproj/Localizable.strings diff --git a/xorg-server/hw/xquartz/bundle/ko.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/ko.lproj/main.nib/keyedobjects.nib Binary files differindex 925945c4d..925945c4d 100644 --- a/xorg-server/hw/xquartz/bundle/ko.lproj/main.nib/keyedobjects.nib +++ b/xorg-server/hw/xquartz/bundle/Resources/ko.lproj/main.nib/keyedobjects.nib diff --git a/xorg-server/hw/xquartz/bundle/no.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Resources/no.lproj/InfoPlist.strings Binary files differindex eb1cfb002..eb1cfb002 100644 --- a/xorg-server/hw/xquartz/bundle/no.lproj/InfoPlist.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/no.lproj/InfoPlist.strings diff --git a/xorg-server/hw/xquartz/bundle/no.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Resources/no.lproj/Localizable.strings Binary files differindex 5157a67de..5157a67de 100644 --- a/xorg-server/hw/xquartz/bundle/no.lproj/Localizable.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/no.lproj/Localizable.strings diff --git a/xorg-server/hw/xquartz/bundle/no.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/no.lproj/main.nib/keyedobjects.nib Binary files differindex ca25327f5..ca25327f5 100644 --- a/xorg-server/hw/xquartz/bundle/no.lproj/main.nib/keyedobjects.nib +++ b/xorg-server/hw/xquartz/bundle/Resources/no.lproj/main.nib/keyedobjects.nib diff --git a/xorg-server/hw/xquartz/bundle/pl.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Resources/pl.lproj/InfoPlist.strings Binary files differindex b9c950214..b9c950214 100644 --- a/xorg-server/hw/xquartz/bundle/pl.lproj/InfoPlist.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/pl.lproj/InfoPlist.strings diff --git a/xorg-server/hw/xquartz/bundle/pl.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Resources/pl.lproj/Localizable.strings Binary files differindex 4ae12d77f..4ae12d77f 100644 --- a/xorg-server/hw/xquartz/bundle/pl.lproj/Localizable.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/pl.lproj/Localizable.strings diff --git a/xorg-server/hw/xquartz/bundle/pl.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/pl.lproj/main.nib/keyedobjects.nib Binary files differindex e9ca5404b..e9ca5404b 100644 --- a/xorg-server/hw/xquartz/bundle/pl.lproj/main.nib/keyedobjects.nib +++ b/xorg-server/hw/xquartz/bundle/Resources/pl.lproj/main.nib/keyedobjects.nib diff --git a/xorg-server/hw/xquartz/bundle/pt.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Resources/pt.lproj/InfoPlist.strings Binary files differindex 33c637448..33c637448 100644 --- a/xorg-server/hw/xquartz/bundle/pt.lproj/InfoPlist.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/pt.lproj/InfoPlist.strings diff --git a/xorg-server/hw/xquartz/bundle/pt.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Resources/pt.lproj/Localizable.strings Binary files differindex 23ea96847..23ea96847 100644 --- a/xorg-server/hw/xquartz/bundle/pt.lproj/Localizable.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/pt.lproj/Localizable.strings diff --git a/xorg-server/hw/xquartz/bundle/pt.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/pt.lproj/main.nib/keyedobjects.nib Binary files differindex e88cccdba..e88cccdba 100644 --- a/xorg-server/hw/xquartz/bundle/pt.lproj/main.nib/keyedobjects.nib +++ b/xorg-server/hw/xquartz/bundle/Resources/pt.lproj/main.nib/keyedobjects.nib diff --git a/xorg-server/hw/xquartz/bundle/pt_PT.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Resources/pt_PT.lproj/InfoPlist.strings Binary files differindex 33c637448..33c637448 100644 --- a/xorg-server/hw/xquartz/bundle/pt_PT.lproj/InfoPlist.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/pt_PT.lproj/InfoPlist.strings diff --git a/xorg-server/hw/xquartz/bundle/pt_PT.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Resources/pt_PT.lproj/Localizable.strings Binary files differindex 71c33ad14..71c33ad14 100644 --- a/xorg-server/hw/xquartz/bundle/pt_PT.lproj/Localizable.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/pt_PT.lproj/Localizable.strings diff --git a/xorg-server/hw/xquartz/bundle/pt_PT.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/pt_PT.lproj/main.nib/keyedobjects.nib Binary files differindex a61933475..a61933475 100644 --- a/xorg-server/hw/xquartz/bundle/pt_PT.lproj/main.nib/keyedobjects.nib +++ b/xorg-server/hw/xquartz/bundle/Resources/pt_PT.lproj/main.nib/keyedobjects.nib diff --git a/xorg-server/hw/xquartz/bundle/ru.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Resources/ru.lproj/InfoPlist.strings Binary files differindex 7f722e4b6..7f722e4b6 100644 --- a/xorg-server/hw/xquartz/bundle/ru.lproj/InfoPlist.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/ru.lproj/InfoPlist.strings diff --git a/xorg-server/hw/xquartz/bundle/ru.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Resources/ru.lproj/Localizable.strings Binary files differindex 3b3811234..3b3811234 100644 --- a/xorg-server/hw/xquartz/bundle/ru.lproj/Localizable.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/ru.lproj/Localizable.strings diff --git a/xorg-server/hw/xquartz/bundle/ru.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/ru.lproj/main.nib/keyedobjects.nib Binary files differindex 9354e0264..9354e0264 100644 --- a/xorg-server/hw/xquartz/bundle/ru.lproj/main.nib/keyedobjects.nib +++ b/xorg-server/hw/xquartz/bundle/Resources/ru.lproj/main.nib/keyedobjects.nib diff --git a/xorg-server/hw/xquartz/bundle/sv.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Resources/sv.lproj/InfoPlist.strings Binary files differindex 655d5ff63..655d5ff63 100644 --- a/xorg-server/hw/xquartz/bundle/sv.lproj/InfoPlist.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/sv.lproj/InfoPlist.strings diff --git a/xorg-server/hw/xquartz/bundle/sv.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Resources/sv.lproj/Localizable.strings Binary files differindex 796f06c21..796f06c21 100644 --- a/xorg-server/hw/xquartz/bundle/sv.lproj/Localizable.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/sv.lproj/Localizable.strings diff --git a/xorg-server/hw/xquartz/bundle/sv.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/sv.lproj/main.nib/keyedobjects.nib Binary files differindex bd01c2dac..bd01c2dac 100644 --- a/xorg-server/hw/xquartz/bundle/sv.lproj/main.nib/keyedobjects.nib +++ b/xorg-server/hw/xquartz/bundle/Resources/sv.lproj/main.nib/keyedobjects.nib diff --git a/xorg-server/hw/xquartz/bundle/zh_CN.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Resources/zh_CN.lproj/InfoPlist.strings Binary files differindex b5df36885..b5df36885 100644 --- a/xorg-server/hw/xquartz/bundle/zh_CN.lproj/InfoPlist.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/zh_CN.lproj/InfoPlist.strings diff --git a/xorg-server/hw/xquartz/bundle/zh_CN.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Resources/zh_CN.lproj/Localizable.strings Binary files differindex f88a6da4b..f88a6da4b 100644 --- a/xorg-server/hw/xquartz/bundle/zh_CN.lproj/Localizable.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/zh_CN.lproj/Localizable.strings diff --git a/xorg-server/hw/xquartz/bundle/zh_CN.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/zh_CN.lproj/main.nib/keyedobjects.nib Binary files differindex e36c15fb6..e36c15fb6 100644 --- a/xorg-server/hw/xquartz/bundle/zh_CN.lproj/main.nib/keyedobjects.nib +++ b/xorg-server/hw/xquartz/bundle/Resources/zh_CN.lproj/main.nib/keyedobjects.nib diff --git a/xorg-server/hw/xquartz/bundle/zh_TW.lproj/InfoPlist.strings b/xorg-server/hw/xquartz/bundle/Resources/zh_TW.lproj/InfoPlist.strings Binary files differindex 92d5473b0..92d5473b0 100644 --- a/xorg-server/hw/xquartz/bundle/zh_TW.lproj/InfoPlist.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/zh_TW.lproj/InfoPlist.strings diff --git a/xorg-server/hw/xquartz/bundle/zh_TW.lproj/Localizable.strings b/xorg-server/hw/xquartz/bundle/Resources/zh_TW.lproj/Localizable.strings Binary files differindex f009302c2..f009302c2 100644 --- a/xorg-server/hw/xquartz/bundle/zh_TW.lproj/Localizable.strings +++ b/xorg-server/hw/xquartz/bundle/Resources/zh_TW.lproj/Localizable.strings diff --git a/xorg-server/hw/xquartz/bundle/zh_TW.lproj/main.nib/keyedobjects.nib b/xorg-server/hw/xquartz/bundle/Resources/zh_TW.lproj/main.nib/keyedobjects.nib Binary files differindex 36602c53e..36602c53e 100644 --- a/xorg-server/hw/xquartz/bundle/zh_TW.lproj/main.nib/keyedobjects.nib +++ b/xorg-server/hw/xquartz/bundle/Resources/zh_TW.lproj/main.nib/keyedobjects.nib diff --git a/xorg-server/hw/xquartz/bundle/X11.icns b/xorg-server/hw/xquartz/bundle/X11.icns Binary files differdeleted file mode 100644 index d770e617d..000000000 --- a/xorg-server/hw/xquartz/bundle/X11.icns +++ /dev/null diff --git a/xorg-server/hw/xquartz/bundle/X11.sh b/xorg-server/hw/xquartz/bundle/X11.sh new file mode 100644 index 000000000..3b8b6799c --- /dev/null +++ b/xorg-server/hw/xquartz/bundle/X11.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set "$(dirname "$0")"/X11.bin "${@}" + +if [ -x ~/.x11run ]; then + exec ~/.x11run "${@}" +fi + +case $(basename "${SHELL}") in + bash) exec -l "${SHELL}" --login -c 'exec "${@}"' - "${@}" ;; + ksh|sh|zsh) exec -l "${SHELL}" -c 'exec "${@}"' - "${@}" ;; + csh|tcsh) exec -l "${SHELL}" -c 'exec $argv:q' "${@}" ;; + es|rc) exec -l "${SHELL}" -l -c 'exec $*' "${@}" ;; + *) exec "${@}" ;; +esac diff --git a/xorg-server/hw/xquartz/bundle/X11.xcodeproj/project.pbxproj b/xorg-server/hw/xquartz/bundle/X11.xcodeproj/project.pbxproj deleted file mode 100644 index ae8ec07e6..000000000 --- a/xorg-server/hw/xquartz/bundle/X11.xcodeproj/project.pbxproj +++ /dev/null @@ -1,458 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 42; - objects = { - -/* Begin PBXBuildFile section */ - 527F24190B5D938C007840A7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */; }; - 527F241A0B5D938C007840A7 /* main.nib in Resources */ = {isa = PBXBuildFile; fileRef = 02345980000FD03B11CA0E72 /* main.nib */; }; - 527F241B0B5D938C007840A7 /* X11.icns in Resources */ = {isa = PBXBuildFile; fileRef = 50459C5F038587C60ECA21EC /* X11.icns */; }; - 527F241D0B5D938C007840A7 /* bundle-main.c in Sources */ = {isa = PBXBuildFile; fileRef = 50EE2AB703849F0B0ECA21EC /* bundle-main.c */; }; - 527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */; }; - 527F24200B5D938C007840A7 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 570C5748047186C400ACF82F /* SystemConfiguration.framework */; }; - 527F24370B5D9D89007840A7 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 527F24260B5D938C007840A7 /* Info.plist */; }; - 52D9C0ED0BCDDF6B00CD2AFC /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 0867D6ABFE840B52C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 1870340FFE93FCAF11CA0CD7 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E460D1B6C05005958A5 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E470D1B6C05005958A5 /* Dutch */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Dutch; path = Dutch.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E480D1B6C05005958A5 /* fi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fi; path = fi.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E490D1B6C05005958A5 /* French */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = French; path = French.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E4A0D1B6C05005958A5 /* German */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = German; path = German.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E4B0D1B6C05005958A5 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Italian; path = Italian.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E4C0D1B6C05005958A5 /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Japanese; path = Japanese.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E4D0D1B6C05005958A5 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E4E0D1B6C05005958A5 /* no */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = no; path = no.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E4F0D1B6C05005958A5 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E500D1B6C05005958A5 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E510D1B6C05005958A5 /* pt_PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt_PT; path = pt_PT.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E520D1B6C05005958A5 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E530D1B6C05005958A5 /* Spanish */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Spanish; path = Spanish.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E540D1B6C05005958A5 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E550D1B6C05005958A5 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_CN; path = zh_CN.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E560D1B6C05005958A5 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_TW; path = zh_TW.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E570D1B6C17005958A5 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E580D1B6C17005958A5 /* Dutch */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Dutch; path = Dutch.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E590D1B6C17005958A5 /* fi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fi; path = fi.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E5A0D1B6C17005958A5 /* French */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = French; path = French.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E5B0D1B6C17005958A5 /* German */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = German; path = German.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E5C0D1B6C17005958A5 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Italian; path = Italian.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E5D0D1B6C17005958A5 /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Japanese; path = Japanese.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E5E0D1B6C17005958A5 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E5F0D1B6C17005958A5 /* no */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = no; path = no.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E600D1B6C17005958A5 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E610D1B6C17005958A5 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E620D1B6C17005958A5 /* pt_PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt_PT; path = pt_PT.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E630D1B6C17005958A5 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E640D1B6C17005958A5 /* Spanish */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Spanish; path = Spanish.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E650D1B6C17005958A5 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E660D1B6C17005958A5 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_CN; path = zh_CN.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E670D1B6C17005958A5 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_TW; path = zh_TW.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E680D1B6C34005958A5 /* da */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = da; path = da.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E690D1B6C34005958A5 /* Dutch */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Dutch; path = Dutch.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E6A0D1B6C34005958A5 /* fi */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = fi; path = fi.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E6B0D1B6C34005958A5 /* French */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = French; path = French.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E6C0D1B6C34005958A5 /* German */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = German; path = German.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E6D0D1B6C34005958A5 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Italian; path = Italian.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E6E0D1B6C34005958A5 /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Japanese; path = Japanese.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E6F0D1B6C34005958A5 /* ko */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = ko; path = ko.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E700D1B6C34005958A5 /* no */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = no; path = no.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E710D1B6C34005958A5 /* pl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = pl; path = pl.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E720D1B6C34005958A5 /* pt */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = pt; path = pt.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E730D1B6C34005958A5 /* pt_PT */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = pt_PT; path = pt_PT.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E740D1B6C34005958A5 /* ru */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = ru; path = ru.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E750D1B6C34005958A5 /* Spanish */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Spanish; path = Spanish.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E760D1B6C34005958A5 /* sv */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = sv; path = sv.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E770D1B6C34005958A5 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = zh_CN; path = zh_CN.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E780D1B6C34005958A5 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = zh_TW; path = zh_TW.lproj/main.nib; sourceTree = "<group>"; }; - 50459C5F038587C60ECA21EC /* X11.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = X11.icns; sourceTree = "<group>"; }; - 50EE2AB703849F0B0ECA21EC /* bundle-main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "bundle-main.c"; sourceTree = "<group>"; }; - 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; }; - 527F24260B5D938C007840A7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; }; - 527F24270B5D938C007840A7 /* X11.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = X11.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 52D9C0EC0BCDDF6B00CD2AFC /* English */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; }; - 570C5748047186C400ACF82F /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = /System/Library/Frameworks/SystemConfiguration.framework; sourceTree = "<absolute>"; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 527F241E0B5D938C007840A7 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */, - 527F24200B5D938C007840A7 /* SystemConfiguration.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 195DF8CFFE9D517E11CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 527F24270B5D938C007840A7 /* X11.app */, - ); - name = Products; - sourceTree = "<group>"; - }; - 20286C29FDCF999611CA2CEA /* X11 */ = { - isa = PBXGroup; - children = ( - 20286C2AFDCF999611CA2CEA /* Sources */, - 20286C2CFDCF999611CA2CEA /* Resources */, - 20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */, - 195DF8CFFE9D517E11CA2CBB /* Products */, - 527F24260B5D938C007840A7 /* Info.plist */, - ); - name = X11; - sourceTree = "<group>"; - }; - 20286C2AFDCF999611CA2CEA /* Sources */ = { - isa = PBXGroup; - children = ( - 50EE2AB703849F0B0ECA21EC /* bundle-main.c */, - ); - name = Sources; - sourceTree = "<group>"; - }; - 20286C2CFDCF999611CA2CEA /* Resources */ = { - isa = PBXGroup; - children = ( - 52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */, - 50459C5F038587C60ECA21EC /* X11.icns */, - 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */, - 02345980000FD03B11CA0E72 /* main.nib */, - ); - name = Resources; - sourceTree = "<group>"; - }; - 20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */ = { - isa = PBXGroup; - children = ( - 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */, - 570C5748047186C400ACF82F /* SystemConfiguration.framework */, - ); - name = "External Frameworks and Libraries"; - sourceTree = "<group>"; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 527F24170B5D938C007840A7 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 527F24160B5D938C007840A7 /* X11 */ = { - isa = PBXNativeTarget; - buildConfigurationList = 527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */; - buildPhases = ( - 527F24170B5D938C007840A7 /* Headers */, - 527F24180B5D938C007840A7 /* Resources */, - 527F241C0B5D938C007840A7 /* Sources */, - 527F241E0B5D938C007840A7 /* Frameworks */, - 527F24210B5D938C007840A7 /* Rez */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = X11; - productName = X11; - productReference = 527F24270B5D938C007840A7 /* X11.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 20286C28FDCF999611CA2CEA /* Project object */ = { - isa = PBXProject; - buildConfigurationList = 527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */; - compatibilityVersion = "Xcode 2.4"; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - da, - Dutch, - fi, - Italian, - ko, - no, - pl, - pt, - pt_PT, - ru, - Spanish, - sv, - zh_CN, - zh_TW, - ); - mainGroup = 20286C29FDCF999611CA2CEA /* X11 */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 527F24160B5D938C007840A7 /* X11 */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 527F24180B5D938C007840A7 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 527F24370B5D9D89007840A7 /* Info.plist in Resources */, - 527F24190B5D938C007840A7 /* InfoPlist.strings in Resources */, - 527F241A0B5D938C007840A7 /* main.nib in Resources */, - 527F241B0B5D938C007840A7 /* X11.icns in Resources */, - 52D9C0ED0BCDDF6B00CD2AFC /* Localizable.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXRezBuildPhase section */ - 527F24210B5D938C007840A7 /* Rez */ = { - isa = PBXRezBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXRezBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 527F241C0B5D938C007840A7 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 527F241D0B5D938C007840A7 /* bundle-main.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 02345980000FD03B11CA0E72 /* main.nib */ = { - isa = PBXVariantGroup; - children = ( - 1870340FFE93FCAF11CA0CD7 /* English */, - 3FB03E680D1B6C34005958A5 /* da */, - 3FB03E690D1B6C34005958A5 /* Dutch */, - 3FB03E6A0D1B6C34005958A5 /* fi */, - 3FB03E6B0D1B6C34005958A5 /* French */, - 3FB03E6C0D1B6C34005958A5 /* German */, - 3FB03E6D0D1B6C34005958A5 /* Italian */, - 3FB03E6E0D1B6C34005958A5 /* Japanese */, - 3FB03E6F0D1B6C34005958A5 /* ko */, - 3FB03E700D1B6C34005958A5 /* no */, - 3FB03E710D1B6C34005958A5 /* pl */, - 3FB03E720D1B6C34005958A5 /* pt */, - 3FB03E730D1B6C34005958A5 /* pt_PT */, - 3FB03E740D1B6C34005958A5 /* ru */, - 3FB03E750D1B6C34005958A5 /* Spanish */, - 3FB03E760D1B6C34005958A5 /* sv */, - 3FB03E770D1B6C34005958A5 /* zh_CN */, - 3FB03E780D1B6C34005958A5 /* zh_TW */, - ); - name = main.nib; - sourceTree = "<group>"; - }; - 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 0867D6ABFE840B52C02AAC07 /* English */, - 3FB03E570D1B6C17005958A5 /* da */, - 3FB03E580D1B6C17005958A5 /* Dutch */, - 3FB03E590D1B6C17005958A5 /* fi */, - 3FB03E5A0D1B6C17005958A5 /* French */, - 3FB03E5B0D1B6C17005958A5 /* German */, - 3FB03E5C0D1B6C17005958A5 /* Italian */, - 3FB03E5D0D1B6C17005958A5 /* Japanese */, - 3FB03E5E0D1B6C17005958A5 /* ko */, - 3FB03E5F0D1B6C17005958A5 /* no */, - 3FB03E600D1B6C17005958A5 /* pl */, - 3FB03E610D1B6C17005958A5 /* pt */, - 3FB03E620D1B6C17005958A5 /* pt_PT */, - 3FB03E630D1B6C17005958A5 /* ru */, - 3FB03E640D1B6C17005958A5 /* Spanish */, - 3FB03E650D1B6C17005958A5 /* sv */, - 3FB03E660D1B6C17005958A5 /* zh_CN */, - 3FB03E670D1B6C17005958A5 /* zh_TW */, - ); - name = InfoPlist.strings; - sourceTree = "<group>"; - }; - 52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */ = { - isa = PBXVariantGroup; - children = ( - 52D9C0EC0BCDDF6B00CD2AFC /* English */, - 3FB03E460D1B6C05005958A5 /* da */, - 3FB03E470D1B6C05005958A5 /* Dutch */, - 3FB03E480D1B6C05005958A5 /* fi */, - 3FB03E490D1B6C05005958A5 /* French */, - 3FB03E4A0D1B6C05005958A5 /* German */, - 3FB03E4B0D1B6C05005958A5 /* Italian */, - 3FB03E4C0D1B6C05005958A5 /* Japanese */, - 3FB03E4D0D1B6C05005958A5 /* ko */, - 3FB03E4E0D1B6C05005958A5 /* no */, - 3FB03E4F0D1B6C05005958A5 /* pl */, - 3FB03E500D1B6C05005958A5 /* pt */, - 3FB03E510D1B6C05005958A5 /* pt_PT */, - 3FB03E520D1B6C05005958A5 /* ru */, - 3FB03E530D1B6C05005958A5 /* Spanish */, - 3FB03E540D1B6C05005958A5 /* sv */, - 3FB03E550D1B6C05005958A5 /* zh_CN */, - 3FB03E560D1B6C05005958A5 /* zh_TW */, - ); - name = Localizable.strings; - sourceTree = "<group>"; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 527F24090B5D8FFC007840A7 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - INSTALL_MODE_FLAG = "a+rX"; - }; - name = Development; - }; - 527F240A0B5D8FFC007840A7 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - INSTALL_MODE_FLAG = "a+rX"; - }; - name = Deployment; - }; - 527F240B0B5D8FFC007840A7 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - INSTALL_MODE_FLAG = "a+rX"; - }; - name = Default; - }; - 527F24230B5D938C007840A7 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = ""; - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - HEADER_SEARCH_PATHS = /usr/X11/include; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = /usr/X11; - LIBRARY_SEARCH_PATHS = /usr/X11/lib; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ( - "-lXau", - "-lxcb", - "-lX11", - ); - OTHER_REZFLAGS = ""; - PRODUCT_NAME = X11; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - WRAPPER_EXTENSION = app; - }; - name = Development; - }; - 527F24240B5D938C007840A7 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = YES; - FRAMEWORK_SEARCH_PATHS = ""; - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - HEADER_SEARCH_PATHS = /usr/X11/include; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = /usr/X11; - LIBRARY_SEARCH_PATHS = /usr/X11/lib; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ( - "-lXau", - "-lxcb", - "-lX11", - ); - OTHER_REZFLAGS = ""; - PRODUCT_NAME = X11; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - WRAPPER_EXTENSION = app; - }; - name = Deployment; - }; - 527F24250B5D938C007840A7 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ""; - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - HEADER_SEARCH_PATHS = /usr/X11/include; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = /usr/X11; - LIBRARY_SEARCH_PATHS = /usr/X11/lib; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ( - "-lXau", - "-lxcb", - "-lX11", - ); - OTHER_REZFLAGS = ""; - PRODUCT_NAME = X11; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - WRAPPER_EXTENSION = app; - }; - name = Default; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 527F24090B5D8FFC007840A7 /* Development */, - 527F240A0B5D8FFC007840A7 /* Deployment */, - 527F240B0B5D8FFC007840A7 /* Default */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; - }; - 527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 527F24230B5D938C007840A7 /* Development */, - 527F24240B5D938C007840A7 /* Deployment */, - 527F24250B5D938C007840A7 /* Default */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; - }; -/* End XCConfigurationList section */ - }; - rootObject = 20286C28FDCF999611CA2CEA /* Project object */; -} diff --git a/xorg-server/hw/xquartz/bundle/bundle-main.c b/xorg-server/hw/xquartz/bundle/bundle-main.c deleted file mode 100644 index e97770a55..000000000 --- a/xorg-server/hw/xquartz/bundle/bundle-main.c +++ /dev/null @@ -1,136 +0,0 @@ -/* main.c -- X application launcher - - Copyright (c) 2007 Jeremy Huddleston - Copyright (c) 2007 Apple Inc - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation files - (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of the Software, - and to permit persons to whom the Software is furnished to do so, - subject to the following conditions: - - The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT - HOLDER(S) 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(s) of the above - copyright holders shall not be used in advertising or otherwise to - promote the sale, use or other dealings in this Software without - prior written authorization. */ - -#include <X11/Xlib.h> -#include <unistd.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#include <CoreFoundation/CoreFoundation.h> - -#define DEFAULT_CLIENT "/usr/X11/bin/xterm" -#define DEFAULT_STARTX "/usr/X11/bin/startx" -#define DEFAULT_SHELL "/bin/sh" - -static int execute(const char *command); -static char *command_from_prefs(const char *key, const char *default_value); - -int main(int argc, char **argv) { - Display *display; - const char *s; - - size_t i; - fprintf(stderr, "X11.app: main(): argc=%d\n", argc); - for(i=0; i < argc; i++) { - fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]); - } - - /* If we have a process serial number and it's our only arg, act as if - * the user double clicked the app bundle: launch app_to_run if possible - */ - if(argc == 1 || (argc == 2 && !strncmp(argv[1], "-psn_", 5))) { - /* Now, try to open a display, if so, run the launcher */ - display = XOpenDisplay(NULL); - if(display) { - fprintf(stderr, "X11.app: Closing the display and sleeping for 2s to allow the X server to start up.\n"); - /* Could open the display, start the launcher */ - XCloseDisplay(display); - - /* Give 2 seconds for the server to start... - * TODO: *Really* fix this race condition - */ - usleep(2000); - return execute(command_from_prefs("app_to_run", DEFAULT_CLIENT)); - } - } - - /* Start the server */ - if(s = getenv("DISPLAY")) { - fprintf(stderr, "X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting). Starting X server.\n", s); - unsetenv("DISPLAY"); - } else { - fprintf(stderr, "X11.app: Could not connect to server (DISPLAY is not set). Starting X server.\n"); - } - return execute(command_from_prefs("startx_script", DEFAULT_STARTX)); -} - -static int execute(const char *command) { - const char *newargv[7]; - const char **s; - - newargv[0] = "/usr/bin/login"; - newargv[1] = "-fp"; - newargv[2] = getlogin(); - newargv[3] = command_from_prefs("login_shell", DEFAULT_SHELL); - newargv[4] = "-c"; - newargv[5] = command; - newargv[6] = NULL; - - fprintf(stderr, "X11.app: Launching %s:\n", command); - for(s=newargv; *s; s++) { - fprintf(stderr, "\targv[%d] = %s\n", s - newargv, *s); - } - - execvp (newargv[0], (char * const *) newargv); - perror ("X11.app: Couldn't exec."); - return(1); -} - -static char *command_from_prefs(const char *key, const char *default_value) { - char *command = NULL; - - CFStringRef cfKey = CFStringCreateWithCString(NULL, key, kCFStringEncodingASCII); - CFPropertyListRef PlistRef = CFPreferencesCopyAppValue(cfKey, kCFPreferencesCurrentApplication); - - if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) { - CFStringRef cfDefaultValue = CFStringCreateWithCString(NULL, default_value, kCFStringEncodingASCII); - - CFPreferencesSetAppValue(cfKey, cfDefaultValue, kCFPreferencesCurrentApplication); - CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication); - - int len = strlen(default_value) + 1; - command = (char *)malloc(len * sizeof(char)); - if(!command) - return NULL; - strcpy(command, default_value); - } else { - int len = CFStringGetLength((CFStringRef)PlistRef) + 1; - command = (char *)malloc(len * sizeof(char)); - if(!command) - return NULL; - CFStringGetCString((CFStringRef)PlistRef, command, len, kCFStringEncodingASCII); - } - - if (PlistRef) - CFRelease(PlistRef); - - return command; -} diff --git a/xorg-server/hw/xquartz/bundle/cpprules.in b/xorg-server/hw/xquartz/bundle/cpprules.in new file mode 100644 index 000000000..f32eafc06 --- /dev/null +++ b/xorg-server/hw/xquartz/bundle/cpprules.in @@ -0,0 +1,37 @@ +# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM +# to cpp, because that trick does not work on all ANSI C preprocessors. +# Delete line numbers from the cpp output (-P is not portable, I guess). +# Allow XCOMM to be preceded by whitespace and provide a means of generating +# output lines with trailing backslashes. +# Allow XHASH to always be substituted, even in cases where XCOMM isn't. + +CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \ + -e '/^\#line *[0-9][0-9]* *.*$$/d' \ + -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \ + -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \ + -e '/^[ ]*XHASH/s/XHASH/\#/' \ + -e '/XSLASHGLOB/s/XSLASHGLOB/\/\*/' \ + -e '/\@\@$$/s/\@\@$$/\\/' + +# Strings to replace in man pages +XORGRELSTRING = @PACKAGE_STRING@ + XORGMANNAME = X Version 11 + +MANDEFS = \ + -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \ + -D__appmansuffix__=$(APP_MAN_SUFFIX) \ + -D__filemansuffix__=$(FILE_MAN_SUFFIX) \ + -D__libmansuffix__=$(LIB_MAN_SUFFIX) \ + -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \ + -D__XSERVERNAME__=Xorg -D__XCONFIGFILE__=xorg.conf \ + -D__xinitdir__=$(XINITDIR) \ + -D__bindir__=$(bindir) \ + -DSHELL_CMD=$(SHELL_CMD) $(ARCHMANDEFS) + +SUFFIXES = .$(APP_MAN_SUFFIX) .man .cpp + +.cpp: + $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@ + +.man.$(APP_MAN_SUFFIX): + $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@ diff --git a/xorg-server/hw/xquartz/bundle/mk_bundke.sh b/xorg-server/hw/xquartz/bundle/mk_bundke.sh new file mode 100644 index 000000000..c85b21765 --- /dev/null +++ b/xorg-server/hw/xquartz/bundle/mk_bundke.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# +# 'Cause xcodebuild is hard to deal with + +SRCDIR=$1 +BUILDDIR=$2 +BUNDLE_ROOT=$3 + +localities="Dutch English French German Italian Japanese Spanish da fi ko no pl pt pt_PT ru sv zh_CN zh_TW" +for lang in ${localities} ; do + mkdir -p ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj/main.nib + [ -d ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj/main.nib ] || exit 1 + + for f in InfoPlist.strings Localizable.strings main.nib/keyedobjects.nib ; do + install -m 644 ${SRCDIR}/Resources/${lang}.lproj/$f ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj/${f} + done +done + +install -m 644 ${SRCDIR}/Resources/English.lproj/main.nib//designable.nib ${BUNDLE_ROOT}/Contents/Resources/English.lproj/main.nib +install -m 644 ${SRCDIR}/Resources/X11.icns ${BUNDLE_ROOT}/Contents/Resources + +install -m 644 ${BUILDDIR}/Info.plist ${BUNDLE_ROOT}/Contents +install -m 644 ${SRCDIR}/PkgInfo ${BUNDLE_ROOT}/Contents + +mkdir -p ${BUNDLE_ROOT}/Contents/MacOS +install -m 755 ${SRCDIR}/X11.sh ${BUNDLE_ROOT}/Contents/MacOS/X11 + +if [[ $(id -u) == 0 ]] ; then + chown -R root:admin ${BUNDLE_ROOT} +fi diff --git a/xorg-server/hw/xquartz/darwin.c b/xorg-server/hw/xquartz/darwin.c index 20bcee592..f01668201 100644 --- a/xorg-server/hw/xquartz/darwin.c +++ b/xorg-server/hw/xquartz/darwin.c @@ -1,10 +1,9 @@ /************************************************************** * - * Shared code for the Darwin X Server - * running with Quartz or IOKit display mode + * Xquartz initialization code * + * Copyright (c) 2007-2008 Apple Inc. * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved. - * Copyright (c) 2007 Apple Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -47,12 +46,10 @@ #include "globals.h" #include "dix.h" -#ifdef XINPUT -# include <X11/extensions/XI.h> -# include <X11/extensions/XIproto.h> -# include "exevents.h" -# include "extinit.h" -#endif +#include <X11/extensions/XI.h> +#include <X11/extensions/XIproto.h> +#include "exevents.h" +#include "extinit.h" #include <sys/types.h> #include <sys/time.h> @@ -65,9 +62,7 @@ #include <sys/utsname.h> #define NO_CFPLUGIN -#include <IOKit/IOKitLib.h> #include <IOKit/hidsystem/IOHIDLib.h> -#include <IOKit/hidsystem/ev_keymap.h> #ifdef MITSHM #define _XSHM_SERVER_ @@ -76,10 +71,13 @@ #include "darwin.h" #include "darwinEvents.h" -#include "darwinKeyboard.h" +#include "quartzKeyboard.h" #include "quartz.h" //#include "darwinClut8.h" +#include "GL/visualConfigs.h" + + #ifdef ENABLE_DEBUG_LOG FILE *debug_log_fp = NULL; #endif @@ -88,7 +86,8 @@ FILE *debug_log_fp = NULL; * X server shared global variables */ int darwinScreensFound = 0; -DevPrivateKey darwinScreenKey = &darwinScreenKey; +static int darwinScreenKeyIndex; +DevPrivateKey darwinScreenKey = &darwinScreenKeyIndex; io_connect_t darwinParamConnect = 0; int darwinEventReadFD = -1; int darwinEventWriteFD = -1; @@ -103,16 +102,30 @@ int darwinMainScreenY = 0; unsigned int darwinDesiredWidth = 0, darwinDesiredHeight = 0; int darwinDesiredDepth = -1; int darwinDesiredRefresh = -1; -char *darwinKeymapFile = "USA.keymapping"; int darwinSyncKeymap = FALSE; -// modifier masks for faking mouse buttons +// modifier masks for faking mouse buttons - ANY of these bits trigger it (not all) +#ifdef NX_DEVICELCMDKEYMASK +int darwinFakeMouse2Mask = NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK; +int darwinFakeMouse3Mask = NX_DEVICELCMDKEYMASK | NX_DEVICERCMDKEYMASK; +#else int darwinFakeMouse2Mask = NX_ALTERNATEMASK; int darwinFakeMouse3Mask = NX_COMMANDMASK; +#endif + +// Modifier mask for overriding event delivery to appkit (might be useful to set this to rcommand for input menu +unsigned int darwinAppKitModMask = 0; // Any of these bits + +// Modifier mask for items in the Window menu (0 and -1 cause shortcuts to be disabled) +unsigned int windowItemModMask = NX_COMMANDMASK; // devices -DeviceIntPtr darwinPointer = NULL; DeviceIntPtr darwinKeyboard = NULL; +DeviceIntPtr darwinPointer = NULL; +DeviceIntPtr darwinTabletCurrent = NULL; +DeviceIntPtr darwinTabletStylus = NULL; +DeviceIntPtr darwinTabletCursor = NULL; +DeviceIntPtr darwinTabletEraser = NULL; // Common pixmap formats static PixmapFormatRec formats[] = { @@ -150,8 +163,7 @@ void DarwinPrintBanner(void) { // this should change depending on which specific server we are building - ErrorF("XQuartz starting:\n"); - ErrorF("X.org Release 7.2\n"); // This is here to help fink until they fix their packages. + ErrorF("Xquartz starting:\n"); ErrorF("X.Org X Server %s\nBuild Date: %s\n", XSERVER_VERSION, BUILD_DATE ); } @@ -170,7 +182,6 @@ static Bool DarwinSaveScreen(ScreenPtr pScreen, int on) return TRUE; } - /* * DarwinAddScreen * This is a callback from dix during AddScreen() from InitOutput(). @@ -206,6 +217,21 @@ static Bool DarwinAddScreen(int index, ScreenPtr pScreen, int argc, char **argv) dfb->greenMask, dfb->blueMask)) { return FALSE; } + +// TODO: Make PseudoColor visuals not suck in TrueColor mode +// if(dfb->depth > 8) +// miSetVisualTypesAndMasks(8, PseudoColorMask, 8, PseudoColor, 0, 0, 0); + +#if 0 + /* + * These aren't used anymore. xpr/xprScreen.c initializes the dfb struct + * above based on the display properties. + */ + if(dfb->depth > 15) + miSetVisualTypesAndMasks(15, LARGE_VISUALS, 5, TrueColor, 0x7c00, 0x03e0, 0x001f); + if(dfb->depth > 24) + miSetVisualTypesAndMasks(24, LARGE_VISUALS, 8, TrueColor, 0x00ff0000, 0x0000ff00, 0x000000ff); +#endif miSetPixmapDepths(); @@ -214,7 +240,7 @@ static Bool DarwinAddScreen(int index, ScreenPtr pScreen, int argc, char **argv) if (monitorResolution) dpi = monitorResolution; else - dpi = 75; + dpi = 96; // initialize fb if (! fbScreenInit(pScreen, @@ -306,89 +332,75 @@ static Bool DarwinAddScreen(int index, ScreenPtr pScreen, int argc, char **argv) ============================================================================= */ -#if 0 /* - * DarwinChangePointerControl - * Set mouse acceleration and thresholding - * FIXME: We currently ignore the threshold in ctrl->threshold. + * DarwinMouseProc: Handle the initialization, etc. of a mouse */ -static void DarwinChangePointerControl( - DeviceIntPtr device, - PtrCtrl *ctrl ) -{ - kern_return_t kr; - double acceleration; - - if (!darwinMouseAccelChange) - return; - - acceleration = ctrl->num / ctrl->den; - kr = IOHIDSetMouseAcceleration( darwinParamConnect, acceleration ); - if (kr != KERN_SUCCESS) - ErrorF( "Could not set mouse acceleration with kernel return = 0x%x.\n", kr ); +static int DarwinMouseProc(DeviceIntPtr pPointer, int what) { + // 7 buttons: left, right, middle, then four scroll wheel "buttons" + CARD8 map[8] = {0, 1, 2, 3, 4, 5, 6, 7}; + + switch (what) { + case DEVICE_INIT: + pPointer->public.on = FALSE; + + // Set button map. + InitPointerDeviceStruct((DevicePtr)pPointer, map, 7, + (PtrCtrlProcPtr)NoopDDA, + GetMotionHistorySize(), 2); + pPointer->valuator->mode = Absolute; // Relative + InitAbsoluteClassDeviceStruct(pPointer); +// InitValuatorAxisStruct(pPointer, 0, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1); +// InitValuatorAxisStruct(pPointer, 1, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1); + break; + case DEVICE_ON: + pPointer->public.on = TRUE; + AddEnabledDevice( darwinEventReadFD ); + return Success; + case DEVICE_CLOSE: + case DEVICE_OFF: + pPointer->public.on = FALSE; + RemoveEnabledDevice(darwinEventReadFD); + return Success; + } + + return Success; } -#endif - -/* - * DarwinMouseProc - * Handle the initialization, etc. of a mouse - */ -static int DarwinMouseProc( - DeviceIntPtr pPointer, - int what ) -{ - CARD8 map[6]; +static int DarwinTabletProc(DeviceIntPtr pPointer, int what) { + CARD8 map[4] = {0, 1, 2, 3}; + switch (what) { - case DEVICE_INIT: pPointer->public.on = FALSE; - + // Set button map. - map[1] = 1; - map[2] = 2; - map[3] = 3; - map[4] = 4; - map[5] = 5; - InitPointerDeviceStruct( (DevicePtr)pPointer, map, 5, - GetMotionHistory, - (PtrCtrlProcPtr)NoopDDA, - GetMotionHistorySize(), 2); - -#ifdef XINPUT - InitValuatorAxisStruct( pPointer, - 0, // X axis - 0, // min value - 16000, // max value (fixme screen size?) - 1, // resolution (fixme ?) - 1, // min resolution - 1 ); // max resolution - InitValuatorAxisStruct( pPointer, - 1, // X axis - 0, // min value - 16000, // max value (fixme screen size?) - 1, // resolution (fixme ?) - 1, // min resolution - 1 ); // max resolution -#endif + InitPointerDeviceStruct((DevicePtr)pPointer, map, 3, + (PtrCtrlProcPtr)NoopDDA, + GetMotionHistorySize(), 5); + pPointer->valuator->mode = Absolute; // Relative + InitProximityClassDeviceStruct(pPointer); + InitAbsoluteClassDeviceStruct(pPointer); + + InitValuatorAxisStruct(pPointer, 0, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1); + InitValuatorAxisStruct(pPointer, 1, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1); + InitValuatorAxisStruct(pPointer, 2, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1); + InitValuatorAxisStruct(pPointer, 3, -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1); + InitValuatorAxisStruct(pPointer, 4, -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1); +// pPointer->use = IsXExtensionDevice; break; - case DEVICE_ON: pPointer->public.on = TRUE; AddEnabledDevice( darwinEventReadFD ); return Success; - case DEVICE_CLOSE: case DEVICE_OFF: pPointer->public.on = FALSE; - RemoveEnabledDevice( darwinEventReadFD ); + RemoveEnabledDevice(darwinEventReadFD); return Success; } - return Success; } - /* * DarwinKeybdProc * Callback from X @@ -423,67 +435,10 @@ static int DarwinKeybdProc( DeviceIntPtr pDev, int onoff ) */ /* - * DarwinFindLibraryFile - * Search for a file in the standard Library paths, which are (in order): - * - * ~/Library/ user specific - * /Library/ host specific - * /Network/Library/ LAN specific - * /System/Library/ OS specific - * - * A sub-path can be specified to search in below the various Library - * directories. Returns a new character string (owned by the caller) - * containing the full path to the first file found. - */ -static char * DarwinFindLibraryFile( - const char *file, - const char *pathext ) -{ - // Library search paths - char *pathList[] = { - "", - "/Network", - "/System", - NULL - }; - char *home; - char *fullPath; - int i = 0; - - // Return the file name as is if it is already a fully qualified path. - if (!access(file, F_OK)) { - fullPath = xalloc(strlen(file)+1); - strcpy(fullPath, file); - return fullPath; - } - - fullPath = xalloc(PATH_MAX); - - home = getenv("HOME"); - if (home) { - snprintf(fullPath, PATH_MAX, "%s/Library/%s/%s", home, pathext, file); - if (!access(fullPath, F_OK)) - return fullPath; - } - - while (pathList[i]) { - snprintf(fullPath, PATH_MAX, "%s/Library/%s/%s", pathList[i++], - pathext, file); - if (!access(fullPath, F_OK)) - return fullPath; - } - - xfree(fullPath); - return NULL; -} - - -/* * DarwinParseModifierList * Parse a list of modifier names and return a corresponding modifier mask */ -int DarwinParseModifierList( - const char *constmodifiers) // string containing list of modifier names +int DarwinParseModifierList(const char *constmodifiers, int separatelr) { int result = 0; @@ -495,9 +450,9 @@ int DarwinParseModifierList( while (p) { modifier = strsep(&p, " ,+&|/"); // allow lots of separators - nxkey = DarwinModifierStringToNXKey(modifier); - if (nxkey != -1) - result |= DarwinModifierNXKeyToNXMask(nxkey); + nxkey = DarwinModifierStringToNXMask(modifier, separatelr); + if(nxkey) + result |= nxkey; else ErrorF("fakebuttons: Unknown modifier \"%s\"\n", modifier); } @@ -520,13 +475,43 @@ int DarwinParseModifierList( */ void InitInput( int argc, char **argv ) { - darwinPointer = AddInputDevice(DarwinMouseProc, TRUE); + darwinKeyboard = AddInputDevice(serverClient, DarwinKeybdProc, TRUE); + RegisterKeyboardDevice( darwinKeyboard ); + darwinKeyboard->name = strdup("keyboard"); + + /* here's the snippet from the current gdk sources: + if (!strcmp (tmp_name, "pointer")) + gdkdev->info.source = GDK_SOURCE_MOUSE; + else if (!strcmp (tmp_name, "wacom") || + !strcmp (tmp_name, "pen")) + gdkdev->info.source = GDK_SOURCE_PEN; + else if (!strcmp (tmp_name, "eraser")) + gdkdev->info.source = GDK_SOURCE_ERASER; + else if (!strcmp (tmp_name, "cursor")) + gdkdev->info.source = GDK_SOURCE_CURSOR; + else + gdkdev->info.source = GDK_SOURCE_PEN; + */ + + darwinPointer = AddInputDevice(serverClient, DarwinMouseProc, TRUE); RegisterPointerDevice( darwinPointer ); + darwinPointer->name = strdup("pointer"); - darwinKeyboard = AddInputDevice(DarwinKeybdProc, TRUE); - RegisterKeyboardDevice( darwinKeyboard ); + darwinTabletStylus = AddInputDevice(serverClient, DarwinTabletProc, TRUE); + RegisterPointerDevice( darwinTabletStylus ); + darwinTabletStylus->name = strdup("pen"); + + darwinTabletCursor = AddInputDevice(serverClient, DarwinTabletProc, TRUE); + RegisterPointerDevice( darwinTabletCursor ); + darwinTabletCursor->name = strdup("cursor"); + + darwinTabletEraser = AddInputDevice(serverClient, DarwinTabletProc, TRUE); + RegisterPointerDevice( darwinTabletEraser ); + darwinTabletEraser->name = strdup("eraser"); + + darwinTabletCurrent = darwinTabletStylus; - DarwinEQInit( (DevicePtr)darwinKeyboard, (DevicePtr)darwinPointer ); + DarwinEQInit(); QuartzInitInput(argc, argv); } @@ -557,8 +542,7 @@ DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo) /* Find leftmost screen. If there's a tie, take the topmost of the two. */ for (i = 1; i < pScreenInfo->numScreens; i++) { if (dixScreenOrigins[i].x < left || - (dixScreenOrigins[i].x == left && - dixScreenOrigins[i].y < top)) + (dixScreenOrigins[i].x == left && dixScreenOrigins[i].y < top)) { left = dixScreenOrigins[i].x; top = dixScreenOrigins[i].y; @@ -567,17 +551,20 @@ DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo) darwinMainScreenX = left; darwinMainScreenY = top; + + DEBUG_LOG("top = %d, left=%d\n", top, left); /* Shift all screens so that there is a screen whose top left - is at X11 (0,0) and at global screen coordinate - (darwinMainScreenX, darwinMainScreenY). */ + * is at X11 (0,0) and at global screen coordinate + * (darwinMainScreenX, darwinMainScreenY). + */ if (darwinMainScreenX != 0 || darwinMainScreenY != 0) { for (i = 0; i < pScreenInfo->numScreens; i++) { dixScreenOrigins[i].x -= darwinMainScreenX; dixScreenOrigins[i].y -= darwinMainScreenY; - /* ErrorF("Screen %d placed at X11 coordinate (%d,%d).\n", - i, dixScreenOrigins[i].x, dixScreenOrigins[i].y); */ + DEBUG_LOG("Screen %d placed at X11 coordinate (%d,%d).\n", + i, dixScreenOrigins[i].x, dixScreenOrigins[i].y); } } } @@ -610,6 +597,10 @@ void InitOutput( ScreenInfo *pScreenInfo, int argc, char **argv ) for (i = 0; i < NUMFORMATS; i++) pScreenInfo->formats[i] = formats[i]; +#ifdef GLXEXT + setVisualConfigs(); +#endif + // Discover screens and do mode specific initialization QuartzInitOutput(argc, argv); @@ -654,27 +645,6 @@ void OsVendorInit(void) } #endif } - // DEBUG_LOG("Xquartz started at %s\n", ctime(time(NULL))); - - // Find the full path to the keymapping file. - if ( darwinKeymapFile ) { - char *tempStr = DarwinFindLibraryFile(darwinKeymapFile, "Keyboards"); - if ( !tempStr ) { - ErrorF("Could not find keymapping file %s.\n", darwinKeymapFile); - } else { - ErrorF("Using keymapping provided in %s.\n", tempStr); - } - darwinKeymapFile = tempStr; - } -} - - -/* - * ddxInitGlobals - * Called by InitGlobals() from os/util.c. - */ -void ddxInitGlobals(void) -{ } @@ -720,7 +690,7 @@ int ddxProcessArgument( int argc, char *argv[], int i ) if (!strcasecmp(argv[i+1], "none") || !strcmp(argv[i+1], "")) darwinFakeMouse2Mask = 0; else - darwinFakeMouse2Mask = DarwinParseModifierList(argv[i+1]); + darwinFakeMouse2Mask = DarwinParseModifierList(argv[i+1], 1); ErrorF("Modifier mask to fake mouse button 2 = 0x%x\n", darwinFakeMouse2Mask); return 2; @@ -733,25 +703,12 @@ int ddxProcessArgument( int argc, char *argv[], int i ) if (!strcasecmp(argv[i+1], "none") || !strcmp(argv[i+1], "")) darwinFakeMouse3Mask = 0; else - darwinFakeMouse3Mask = DarwinParseModifierList(argv[i+1]); + darwinFakeMouse3Mask = DarwinParseModifierList(argv[i+1], 1); ErrorF("Modifier mask to fake mouse button 3 = 0x%x\n", darwinFakeMouse3Mask); return 2; } - if ( !strcmp( argv[i], "-keymap" ) ) { - if ( i == argc-1 ) { - FatalError( "-keymap must be followed by a filename\n" ); - } - darwinKeymapFile = argv[i+1]; - return 2; - } - - if ( !strcmp( argv[i], "-nokeymap" ) ) { - darwinKeymapFile = NULL; - return 1; - } - if ( !strcmp( argv[i], "+synckeymap" ) ) { darwinSyncKeymap = TRUE; return 1; @@ -835,12 +792,8 @@ void ddxUseMsg( void ) ErrorF("-fakemouse2 <modifiers> : fake middle mouse button with modifier keys.\n"); ErrorF("-fakemouse3 <modifiers> : fake right mouse button with modifier keys.\n"); ErrorF(" ex: -fakemouse2 \"option,shift\" = option-shift-click is middle button.\n"); - ErrorF("-keymap <file> : read the keymapping from a file instead of the kernel.\n"); ErrorF("-version : show the server version.\n"); ErrorF("\n"); -// ErrorF("Quartz modes (Experimental / In Development):\n"); -// ErrorF("-fullscreen : run full screen in parallel with Mac OS X window server.\n"); -// ErrorF("-rootless : run rootless inside Mac OS X window server.\n"); ErrorF("\n"); ErrorF("Options ignored in rootless mode:\n"); ErrorF("-size <height> <width> : use a screen resolution of <height> x <width>.\n"); @@ -856,10 +809,7 @@ void ddxUseMsg( void ) */ void ddxGiveUp( void ) { - ErrorF( "Quitting XQuartz...\n" ); - - //if (!quartzRootless) - // quartzProcs->ReleaseScreens(); + ErrorF( "Quitting Xquartz...\n" ); } @@ -896,16 +846,13 @@ void AbortDDX( void ) */ void -xf86SetRootClip (ScreenPtr pScreen, BOOL enable) +xf86SetRootClip (ScreenPtr pScreen, int enable) { WindowPtr pWin = WindowTable[pScreen->myNum]; WindowPtr pChild; Bool WasViewable = (Bool)(pWin->viewable); Bool anyMarked = TRUE; RegionPtr pOldClip = NULL, bsExposed; -#ifdef DO_SAVE_UNDERS - Bool dosave = FALSE; -#endif WindowPtr pLayerWin; BoxRec box; @@ -976,12 +923,6 @@ xf86SetRootClip (ScreenPtr pScreen, BOOL enable) anyMarked = TRUE; } -#ifdef DO_SAVE_UNDERS - if (DO_SAVE_UNDERS(pWin)) - { - dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin); - } -#endif /* DO_SAVE_UNDERS */ if (anyMarked) (*pScreen->ValidateTree)(pWin, NullWindow, VTOther); @@ -1013,10 +954,6 @@ xf86SetRootClip (ScreenPtr pScreen, BOOL enable) { if (anyMarked) (*pScreen->HandleExposures)(pWin); -#ifdef DO_SAVE_UNDERS - if (dosave) - (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin); -#endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther); } diff --git a/xorg-server/hw/xquartz/darwin.h b/xorg-server/hw/xquartz/darwin.h index c5e2ed80d..7fb9396e5 100644 --- a/xorg-server/hw/xquartz/darwin.h +++ b/xorg-server/hw/xquartz/darwin.h @@ -1,4 +1,5 @@ /* + * Copyright (C) 2008 Apple, Inc. * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -33,6 +34,8 @@ #include <X11/extensions/XKB.h> #include <assert.h> +#include "threadSafety.h" + typedef struct { void *framebuffer; int x; @@ -52,9 +55,9 @@ typedef struct { // From darwin.c void DarwinPrintBanner(void); -int DarwinParseModifierList(const char *constmodifiers); +int DarwinParseModifierList(const char *constmodifiers, int separatelr); void DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo); -void xf86SetRootClip (ScreenPtr pScreen, BOOL enable); +void xf86SetRootClip (ScreenPtr pScreen, int enable); #define SCREEN_PRIV(pScreen) ((DarwinFramebufferPtr) \ dixLookupPrivate(&pScreen->devPrivates, darwinScreenKey)) @@ -68,6 +71,10 @@ extern io_connect_t darwinParamConnect; extern int darwinEventReadFD; extern int darwinEventWriteFD; extern DeviceIntPtr darwinPointer; +extern DeviceIntPtr darwinTabletCurrent; +extern DeviceIntPtr darwinTabletCursor; +extern DeviceIntPtr darwinTabletStylus; +extern DeviceIntPtr darwinTabletEraser; extern DeviceIntPtr darwinKeyboard; // User preferences @@ -75,7 +82,8 @@ extern int darwinMouseAccelChange; extern int darwinFakeButtons; extern int darwinFakeMouse2Mask; extern int darwinFakeMouse3Mask; -extern char *darwinKeymapFile; +extern unsigned int darwinAppKitModMask; +extern unsigned int windowItemModMask; extern int darwinSyncKeymap; extern unsigned int darwinDesiredWidth, darwinDesiredHeight; extern int darwinDesiredDepth; @@ -85,48 +93,16 @@ extern int darwinDesiredRefresh; extern int darwinMainScreenX; extern int darwinMainScreenY; - -/* - * Special ddx events understood by the X server - */ -enum { - kXDarwinUpdateModifiers // update all modifier keys - = LASTEvent+1, // (from X.h list of event names) - kXDarwinUpdateButtons, // update state of mouse buttons 2 and up - kXDarwinScrollWheel, // scroll wheel event - /* - * Quartz-specific events -- not used in IOKit mode - */ - kXDarwinActivate, // restore X drawing and cursor - kXDarwinDeactivate, // clip X drawing and switch to Aqua cursor - kXDarwinSetRootClip, // enable or disable drawing to the X screen - kXDarwinQuit, // kill the X server and release the display - kXDarwinReadPasteboard, // copy Mac OS X pasteboard into X cut buffer - kXDarwinWritePasteboard, // copy X cut buffer onto Mac OS X pasteboard - kXDarwinBringAllToFront, // bring all X windows to front - kXDarwinToggleFullscreen, // Enable/Disable fullscreen mode - kXDarwinSetRootless, // Set rootless mode - /* - * AppleWM events - */ - kXDarwinControllerNotify, // send an AppleWMControllerNotify event - kXDarwinPasteboardNotify, // notify the WM to copy or paste - /* - * Xplugin notification events - */ - kXDarwinDisplayChanged, // display configuration has changed - kXDarwinWindowState, // window visibility state has changed - kXDarwinWindowMoved // window has moved on screen -}; - #define ENABLE_DEBUG_LOG 1 #ifdef ENABLE_DEBUG_LOG extern FILE *debug_log_fp; #define DEBUG_LOG_NAME "x11-debug.txt" -#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%s:%d " msg, __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp); +#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%s:%s:%d " msg, threadSafetyID(pthread_self()), __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp); #else #define DEBUG_LOG(msg, args...) #endif +#define TRACE() DEBUG_LOG("\n") + #endif /* _DARWIN_H */ diff --git a/xorg-server/hw/xquartz/darwinEvents.c b/xorg-server/hw/xquartz/darwinEvents.c index 827fd81b8..374c4e07e 100644 --- a/xorg-server/hw/xquartz/darwinEvents.c +++ b/xorg-server/hw/xquartz/darwinEvents.c @@ -1,7 +1,7 @@ /* Darwin event queue and event handling -Copyright 2007 Apple Inc. +Copyright 2007-2008 Apple Inc. Copyright 2004 Kaleb S. KEITHLEY. All Rights Reserved. Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved. @@ -30,6 +30,12 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ +#include "sanitizedCarbon.h" + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + #define NEED_EVENTS #include <X11/X.h> #include <X11/Xmd.h> @@ -41,421 +47,534 @@ in this Software without prior written authorization from The Open Group. #include "mi.h" #include "scrnintstr.h" #include "mipointer.h" +#include "os.h" #include "darwin.h" #include "quartz.h" -#include "darwinKeyboard.h" +#include "quartzKeyboard.h" #include "darwinEvents.h" #include <sys/types.h> #include <sys/uio.h> #include <unistd.h> +#include <pthread.h> +#include <errno.h> + #include <IOKit/hidsystem/IOLLEvent.h> /* Fake button press/release for scroll wheel move. */ -#define SCROLLWHEELUPFAKE 4 -#define SCROLLWHEELDOWNFAKE 5 +#define SCROLLWHEELUPFAKE 4 +#define SCROLLWHEELDOWNFAKE 5 +#define SCROLLWHEELLEFTFAKE 6 +#define SCROLLWHEELRIGHTFAKE 7 -#define QUEUE_SIZE 256 +#define _APPLEWM_SERVER_ +#include "applewmExt.h" +#include <X11/extensions/applewm.h> -typedef struct _Event { - xEvent event; - ScreenPtr pScreen; -} EventRec, *EventPtr; +/* FIXME: Abstract this better */ +void QuartzModeEQInit(void); -int input_check_zero, input_check_flag; +int darwin_modifier_flags = 0; // last known modifier state -static int old_flags = 0; // last known modifier state +#define FD_ADD_MAX 128 +static int fd_add[FD_ADD_MAX]; +int fd_add_count = 0; +static pthread_mutex_t fd_add_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_cond_t fd_add_ready_cond = PTHREAD_COND_INITIALIZER; +static pthread_t fd_add_tid = NULL; -typedef struct _EventQueue { - HWEventQueueType head, tail; /* long for SetInputCheck */ - CARD32 lastEventTime; /* to avoid time running backwards */ - Bool lastMotion; - EventRec events[QUEUE_SIZE]; /* static allocation for signals */ - DevicePtr pKbd, pPtr; /* device pointer, to get funcs */ - ScreenPtr pEnqueueScreen; /* screen events are being delivered to */ - ScreenPtr pDequeueScreen; /* screen events are being dispatched to */ -} EventQueueRec, *EventQueuePtr; +static EventList *darwinEvents = NULL; -static EventQueueRec darwinEventQueue; -xEvent *darwinEvents; +static pthread_mutex_t mieq_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_cond_t mieq_ready_cond = PTHREAD_COND_INITIALIZER; -/* - * DarwinPressModifierMask - * Press or release the given modifier key, specified by its mask. - */ -static void DarwinPressModifierMask( - int pressed, - int mask) // one of NX_*MASK constants -{ - int key = DarwinModifierNXMaskToNXKey(mask); +/*** Pthread Magics ***/ +static pthread_t create_thread(void *func, void *arg) { + pthread_attr_t attr; + pthread_t tid; - if (key != -1) { - int keycode = DarwinModifierNXKeyToNXKeycode(key, 0); - if (keycode != 0) - DarwinSendKeyboardEvents(pressed, keycode); - } -} - -#ifdef NX_DEVICELCTLKEYMASK -#define CONTROL_MASK(flags) (flags & (NX_DEVICELCTLKEYMASK|NX_DEVICERCTLKEYMASK)) -#else -#define CONTROL_MASK(flags) (NX_CONTROLMASK) -#endif /* NX_DEVICELCTLKEYMASK */ - -#ifdef NX_DEVICELSHIFTKEYMASK -#define SHIFT_MASK(flags) (flags & (NX_DEVICELSHIFTKEYMASK|NX_DEVICERSHIFTKEYMASK)) -#else -#define SHIFT_MASK(flags) (NX_SHIFTMASK) -#endif /* NX_DEVICELSHIFTKEYMASK */ - -#ifdef NX_DEVICELCMDKEYMASK -#define COMMAND_MASK(flags) (flags & (NX_DEVICELCMDKEYMASK|NX_DEVICERCMDKEYMASK)) -#else -#define COMMAND_MASK(flags) (NX_COMMANDMASK) -#endif /* NX_DEVICELCMDKEYMASK */ + pthread_attr_init (&attr); + pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM); + pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); + pthread_create (&tid, &attr, func, arg); + pthread_attr_destroy (&attr); -#ifdef NX_DEVICELALTKEYMASK -#define ALTERNATE_MASK(flags) (flags & (NX_DEVICELALTKEYMASK|NX_DEVICERALTKEYMASK)) -#else -#define ALTERNATE_MASK(flags) (NX_ALTERNATEMASK) -#endif /* NX_DEVICELALTKEYMASK */ + return tid; +} -/* - * DarwinUpdateModifiers - * Send events to update the modifier state. - */ -static void DarwinUpdateModifiers( - int pressed, // KeyPress or KeyRelease - int flags ) // modifier flags that have changed -{ - if (flags & NX_ALPHASHIFTMASK) { - DarwinPressModifierMask(pressed, NX_ALPHASHIFTMASK); - } - if (flags & NX_COMMANDMASK) { - DarwinPressModifierMask(pressed, COMMAND_MASK(flags)); - } - if (flags & NX_CONTROLMASK) { - DarwinPressModifierMask(pressed, CONTROL_MASK(flags)); - } - if (flags & NX_ALTERNATEMASK) { - DarwinPressModifierMask(pressed, ALTERNATE_MASK(flags)); - } - if (flags & NX_SHIFTMASK) { - DarwinPressModifierMask(pressed, SHIFT_MASK(flags)); +void darwinEvents_lock(void); +void darwinEvents_lock(void) { + int err; + if((err = pthread_mutex_lock(&mieq_lock))) { + ErrorF("%s:%s:%d: Failed to lock mieq_lock: %d\n", + __FILE__, __FUNCTION__, __LINE__, err); + spewCallStack(); } - if (flags & NX_SECONDARYFNMASK) { - DarwinPressModifierMask(pressed, NX_SECONDARYFNMASK); + if(darwinEvents == NULL) { + pthread_cond_wait(&mieq_ready_cond, &mieq_lock); } } -/* - * DarwinReleaseModifiers - * This hacky function releases all modifier keys. It should be called when X11.app - * is deactivated (kXDarwinDeactivate) to prevent modifiers from getting stuck if they - * are held down during a "context" switch -- otherwise, we would miss the KeyUp. - */ -static void DarwinReleaseModifiers(void) { - DarwinUpdateModifiers(KeyRelease, COMMAND_MASK(-1) | CONTROL_MASK(-1) | ALTERNATE_MASK(-1) | SHIFT_MASK(-1)); +void darwinEvents_unlock(void); +void darwinEvents_unlock(void) { + int err; + if((err = pthread_mutex_unlock(&mieq_lock))) { + ErrorF("%s:%s:%d: Failed to unlock mieq_lock: %d\n", + __FILE__, __FUNCTION__, __LINE__, err); + spewCallStack(); + } } /* - * DarwinSimulateMouseClick - * Send a mouse click to X when multiple mouse buttons are simulated - * with modifier-clicks, such as command-click for button 2. The dix - * layer is told that the previously pressed modifier key(s) are - * released, the simulated click event is sent. After the mouse button - * is released, the modifier keys are reverted to their actual state, - * which may or may not be pressed at that point. This is usually - * closest to what the user wants. Ie. the user typically wants to - * simulate a button 2 press instead of Command-button 2. + * DarwinPressModifierKey + * Press or release the given modifier key (one of NX_MODIFIERKEY_* constants) */ -static void DarwinSimulateMouseClick( - int pointer_x, - int pointer_y, - int whichButton, // mouse button to be pressed - int modifierMask) // modifiers used for the fake click -{ - // first fool X into forgetting about the keys - // for some reason, it's not enough to tell X we released the Command key -- - // it has to be the *left* Command key. - if (modifierMask & NX_COMMANDMASK) modifierMask |=NX_DEVICELCMDKEYMASK ; - DarwinUpdateModifiers(KeyRelease, modifierMask); - - // push the mouse button - DarwinSendPointerEvents(ButtonPress, whichButton, pointer_x, pointer_y); - DarwinSendPointerEvents(ButtonRelease, whichButton, pointer_x, pointer_y); - - // restore old modifiers - DarwinUpdateModifiers(KeyPress, modifierMask); -} +static void DarwinPressModifierKey(int pressed, int key) { + int keycode = DarwinModifierNXKeyToNXKeycode(key, 0); + if (keycode == 0) { + ErrorF("DarwinPressModifierKey bad keycode: key=%d\n", key); + return; + } -Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) { - darwinEvents = (xEvent *)malloc(sizeof(xEvent) * GetMaximumEventsNum()); - mieqInit(); - darwinEventQueue.head = darwinEventQueue.tail = 0; - darwinEventQueue.lastEventTime = GetTimeInMillis (); - darwinEventQueue.pKbd = pKbd; - darwinEventQueue.pPtr = pPtr; - darwinEventQueue.pEnqueueScreen = screenInfo.screens[0]; - darwinEventQueue.pDequeueScreen = darwinEventQueue.pEnqueueScreen; - SetInputCheck(&input_check_zero, &input_check_flag); - return TRUE; + DarwinSendKeyboardEvents(pressed, keycode); } - /* - * DarwinEQEnqueue - * Must be thread safe with ProcessInputEvents. - * DarwinEQEnqueue - called from event gathering thread - * ProcessInputEvents - called from X server thread - * DarwinEQEnqueue should never be called from more than one thread. - * - * This should be deprecated in favor of miEQEnqueue -- BB + * DarwinUpdateModifiers + * Send events to update the modifier state. */ -void DarwinEQEnqueue(const xEventPtr e) { - HWEventQueueType oldtail, newtail; - - oldtail = darwinEventQueue.tail; - // mieqEnqueue() collapses successive motion events into one event. - // This is difficult to do in a thread-safe way and rarely useful. - - newtail = oldtail + 1; - if (newtail == QUEUE_SIZE) newtail = 0; - /* Toss events which come in late */ - if (newtail == darwinEventQueue.head) return; +int darwin_modifier_mask_list[] = { +#ifdef NX_DEVICELCMDKEYMASK + NX_DEVICELCTLKEYMASK, NX_DEVICERCTLKEYMASK, + NX_DEVICELSHIFTKEYMASK, NX_DEVICERSHIFTKEYMASK, + NX_DEVICELCMDKEYMASK, NX_DEVICERCMDKEYMASK, + NX_DEVICELALTKEYMASK, NX_DEVICERALTKEYMASK, +#else + NX_CONTROLMASK, NX_SHIFTMASK, NX_COMMANDMASK, NX_ALTERNATEMASK, +#endif + NX_ALPHASHIFTMASK, + 0 +}; - darwinEventQueue.events[oldtail].event = *e; +static void DarwinUpdateModifiers( + int pressed, // KeyPress or KeyRelease + int flags ) // modifier flags that have changed +{ + int *f; + int key; - /* - * Make sure that event times don't go backwards - this - * is "unnecessary", but very useful + /* Capslock is special. This mask is the state of capslock (on/off), + * not the state of the button. Hopefully we can find a better solution. */ - if (e->u.keyButtonPointer.time < darwinEventQueue.lastEventTime && - darwinEventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000) - { - darwinEventQueue.events[oldtail].event.u.keyButtonPointer.time = - darwinEventQueue.lastEventTime; + if(NX_ALPHASHIFTMASK & flags) { + DarwinPressModifierKey(KeyPress, NX_MODIFIERKEY_ALPHALOCK); + DarwinPressModifierKey(KeyRelease, NX_MODIFIERKEY_ALPHALOCK); } - darwinEventQueue.events[oldtail].pScreen = darwinEventQueue.pEnqueueScreen; + + for(f=darwin_modifier_mask_list; *f; f++) + if(*f & flags && *f != NX_ALPHASHIFTMASK) { + key = DarwinModifierNXMaskToNXKey(*f); + if(key == -1) + ErrorF("DarwinUpdateModifiers: Unsupported NXMask: 0x%x\n", *f); + else + DarwinPressModifierKey(pressed, key); + } +} - // Update the tail after the event is prepared - darwinEventQueue.tail = newtail; +/* Generic handler for Xquartz-specifc events. When possible, these should + be moved into their own individual functions and set as handlers using + mieqSetHandler. */ + +static void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) { + int i; + + TA_SERVER(); + +// DEBUG_LOG("DarwinEventHandler(%d, %p, %p, %d)\n", screenNum, xe, dev, nevents); + for (i=0; i<nevents; i++) { + switch(xe[i].u.u.type) { + case kXquartzControllerNotify: + DEBUG_LOG("kXquartzControllerNotify\n"); + AppleWMSendEvent(AppleWMControllerNotify, + AppleWMControllerNotifyMask, + xe[i].u.clientMessage.u.l.longs0, + xe[i].u.clientMessage.u.l.longs1); + break; + + case kXquartzPasteboardNotify: + DEBUG_LOG("kXquartzPasteboardNotify\n"); + AppleWMSendEvent(AppleWMPasteboardNotify, + AppleWMPasteboardNotifyMask, + xe[i].u.clientMessage.u.l.longs0, + xe[i].u.clientMessage.u.l.longs1); + break; + + case kXquartzActivate: + DEBUG_LOG("kXquartzActivate\n"); + QuartzShow(xe[i].u.keyButtonPointer.rootX, + xe[i].u.keyButtonPointer.rootY); + AppleWMSendEvent(AppleWMActivationNotify, + AppleWMActivationNotifyMask, + AppleWMIsActive, 0); + break; + + case kXquartzDeactivate: + DEBUG_LOG("kXquartzDeactivate\n"); + AppleWMSendEvent(AppleWMActivationNotify, + AppleWMActivationNotifyMask, + AppleWMIsInactive, 0); + QuartzHide(); + break; - // Signal there is an event ready to handle - DarwinPokeEQ(); -} + case kXquartzReloadPreferences: + DEBUG_LOG("kXquartzReloadPreferences\n"); + AppleWMSendEvent(AppleWMActivationNotify, + AppleWMActivationNotifyMask, + AppleWMReloadPreferences, 0); + break; + + case kXquartzToggleFullscreen: + DEBUG_LOG("kXquartzToggleFullscreen\n"); + if (quartzEnableRootless) + QuartzSetFullscreen(!quartzHasRoot); + else if (quartzHasRoot) + QuartzHide(); + else + QuartzShow(xe[i].u.keyButtonPointer.rootX, + xe[i].u.keyButtonPointer.rootY); + break; + + case kXquartzSetRootless: + DEBUG_LOG("kXquartzSetRootless\n"); + QuartzSetRootless(xe[i].u.clientMessage.u.l.longs0); + if (!quartzEnableRootless && !quartzHasRoot) + QuartzHide(); + break; + + case kXquartzSetRootClip: + QuartzSetRootClip((Bool)xe[i].u.clientMessage.u.l.longs0); + break; + + case kXquartzQuit: + GiveUp(0); + break; + + case kXquartzSpaceChanged: + DEBUG_LOG("kXquartzSpaceChanged\n"); + QuartzSpaceChanged(xe[i].u.clientMessage.u.l.longs0); + break; + default: + ErrorF("Unknown application defined event type %d.\n", xe[i].u.u.type); + } + } +} -/* - * DarwinEQPointerPost - * Post a pointer event. Used by the mipointer.c routines. - */ -void DarwinEQPointerPost(DeviceIntPtr pdev, xEventPtr e) { - (*darwinEventQueue.pPtr->processInputProc) - (e, (DeviceIntPtr)darwinEventQueue.pPtr, 1); +void DarwinListenOnOpenFD(int fd) { + ErrorF("DarwinListenOnOpenFD: %d\n", fd); + + pthread_mutex_lock(&fd_add_lock); + if(fd_add_count < FD_ADD_MAX) + fd_add[fd_add_count++] = fd; + else + ErrorF("FD Addition buffer at max. Dropping fd addition request.\n"); + + pthread_cond_broadcast(&fd_add_ready_cond); + pthread_mutex_unlock(&fd_add_lock); } +static void DarwinProcessFDAdditionQueue_thread(void *args) { + pthread_mutex_lock(&fd_add_lock); + while(true) { + while(fd_add_count) { + DarwinSendDDXEvent(kXquartzListenOnOpenFD, 1, fd_add[--fd_add_count]); + } + pthread_cond_wait(&fd_add_ready_cond, &fd_add_lock); + } +} -void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX) { - darwinEventQueue.pEnqueueScreen = pScreen; - if (fromDIX) - darwinEventQueue.pDequeueScreen = pScreen; +static void kXquartzListenOnOpenFDHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) { + size_t i; + TA_SERVER(); + + for (i=0; i<nevents; i++) { + ErrorF("Calling ListenOnOpenFD() for new fd: %d\n", (int)xe[i].u.clientMessage.u.l.longs0); + ListenOnOpenFD((int)xe[i].u.clientMessage.u.l.longs0, 1); + } } +Bool DarwinEQInit(void) { + mieqInit(); + mieqSetHandler(kXquartzReloadKeymap, DarwinKeyboardReloadHandler); + mieqSetHandler(kXquartzActivate, DarwinEventHandler); + mieqSetHandler(kXquartzDeactivate, DarwinEventHandler); + mieqSetHandler(kXquartzReloadPreferences, DarwinEventHandler); + mieqSetHandler(kXquartzSetRootClip, DarwinEventHandler); + mieqSetHandler(kXquartzQuit, DarwinEventHandler); + mieqSetHandler(kXquartzReadPasteboard, QuartzReadPasteboard); + mieqSetHandler(kXquartzWritePasteboard, QuartzWritePasteboard); + mieqSetHandler(kXquartzToggleFullscreen, DarwinEventHandler); + mieqSetHandler(kXquartzSetRootless, DarwinEventHandler); + mieqSetHandler(kXquartzSpaceChanged, DarwinEventHandler); + mieqSetHandler(kXquartzControllerNotify, DarwinEventHandler); + mieqSetHandler(kXquartzPasteboardNotify, DarwinEventHandler); + mieqSetHandler(kXquartzDisplayChanged, QuartzDisplayChangedHandler); + mieqSetHandler(kXquartzListenOnOpenFD, kXquartzListenOnOpenFDHandler); + + QuartzModeEQInit(); + + /* Note that this *could* cause a potential async issue, since we're checking + * darwinEvents without holding the lock, but darwinEvents is only ever set + * here, so I don't bother. + */ + if (!darwinEvents) { + darwinEvents = InitEventList(GetMaximumEventsNum());; + + if (!darwinEvents) + FatalError("Couldn't allocate event buffer\n"); + + darwinEvents_lock(); + pthread_cond_broadcast(&mieq_ready_cond); + darwinEvents_unlock(); + } + + if(!fd_add_tid) + fd_add_tid = create_thread(DarwinProcessFDAdditionQueue_thread, NULL); + + return TRUE; +} /* * ProcessInputEvents * Read and process events from the event queue until it is empty. */ void ProcessInputEvents(void) { - EventRec *e; - int x, y; xEvent xe; - // button number and modifier mask of currently pressed fake button - input_check_flag=0; + int x = sizeof(xe); + + TA_SERVER(); - // ErrorF("calling mieqProcessInputEvents\n"); mieqProcessInputEvents(); // Empty the signaling pipe - x = sizeof(xe); - while (x == sizeof(xe)) - x = read(darwinEventReadFD, &xe, sizeof(xe)); - - while (darwinEventQueue.head != darwinEventQueue.tail) - { - if (screenIsSaved == SCREEN_SAVER_ON) - dixSaveScreens (serverClient, SCREEN_SAVER_OFF, ScreenSaverReset); - - e = &darwinEventQueue.events[darwinEventQueue.head]; - xe = e->event; - - // Shift from global screen coordinates to coordinates relative to - // the origin of the current screen. - xe.u.keyButtonPointer.rootX -= darwinMainScreenX + - dixScreenOrigins[miPointerCurrentScreen()->myNum].x; - xe.u.keyButtonPointer.rootY -= darwinMainScreenY + - dixScreenOrigins[miPointerCurrentScreen()->myNum].y; - - /* ErrorF("old rootX = (%d,%d) darwinMainScreen = (%d,%d) dixScreenOrigins[%d]=(%d,%d)\n", - xe.u.keyButtonPointer.rootX, xe.u.keyButtonPointer.rootY, - darwinMainScreenX, darwinMainScreenY, - miPointerCurrentScreen()->myNum, - dixScreenOrigins[miPointerCurrentScreen()->myNum].x, - dixScreenOrigins[miPointerCurrentScreen()->myNum].y); */ - - //Assumption - screen switching can only occur on motion events - - if (e->pScreen != darwinEventQueue.pDequeueScreen) - { - darwinEventQueue.pDequeueScreen = e->pScreen; - x = xe.u.keyButtonPointer.rootX; - y = xe.u.keyButtonPointer.rootY; - if (darwinEventQueue.head == QUEUE_SIZE - 1) - darwinEventQueue.head = 0; - else - ++darwinEventQueue.head; - NewCurrentScreen (darwinEventQueue.pDequeueScreen, x, y); - } - else - { - if (darwinEventQueue.head == QUEUE_SIZE - 1) - darwinEventQueue.head = 0; - else - ++darwinEventQueue.head; - switch (xe.u.u.type) { - case KeyPress: - case KeyRelease: - ErrorF("Unexpected Keyboard event in DarwinProcessInputEvents\n"); - break; - - case ButtonPress: - ErrorF("Unexpected ButtonPress event in DarwinProcessInputEvents\n"); - break; - - case ButtonRelease: - ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n"); - break; - - case MotionNotify: - ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n"); - break; - - case kXDarwinUpdateModifiers: - ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n"); - break; - - case kXDarwinUpdateButtons: - ErrorF("Unexpected XDarwinScrollWheel event in DarwinProcessInputEvents\n"); - break; - - case kXDarwinScrollWheel: - ErrorF("Unexpected XDarwinScrollWheel event in DarwinProcessInputEvents\n"); - break; - - case kXDarwinDeactivate: - DarwinReleaseModifiers(); - // fall through - default: - // Check for mode specific event - QuartzProcessEvent(&xe); - } - } + while (x == sizeof(xe)) { + x = read(darwinEventReadFD, &xe, sizeof(xe)); } - - // miPointerUpdate(); } /* Sends a null byte down darwinEventWriteFD, which will cause the Dispatch() event loop to check out event queue */ -void DarwinPokeEQ(void) { - char nullbyte=0; - input_check_flag++; - // <daniels> bushing: oh, i ... er ... christ. - write(darwinEventWriteFD, &nullbyte, 1); +static void DarwinPokeEQ(void) { + char nullbyte=0; + // <daniels> oh, i ... er ... christ. + write(darwinEventWriteFD, &nullbyte, 1); } -void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y) { - static int darwinFakeMouseButtonDown = 0; - static int darwinFakeMouseButtonMask = 0; - int i, num_events; - int valuators[2] = {pointer_x, pointer_y}; - if (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) { - // Mimic multi-button mouse with modifier-clicks - // If both sets of modifiers are pressed, - // button 2 is clicked. - if ((old_flags & darwinFakeMouse2Mask) == darwinFakeMouse2Mask) { - DarwinSimulateMouseClick(pointer_x, pointer_y, 2, darwinFakeMouse2Mask); - darwinFakeMouseButtonDown = 2; - darwinFakeMouseButtonMask = darwinFakeMouse2Mask; - } else if ((old_flags & darwinFakeMouse3Mask) == darwinFakeMouse3Mask) { - DarwinSimulateMouseClick(pointer_x, pointer_y, 3, darwinFakeMouse3Mask); - darwinFakeMouseButtonDown = 3; - darwinFakeMouseButtonMask = darwinFakeMouse3Mask; +/* Convert from Appkit pointer input values to X input values: + * Note: pointer_x and pointer_y are relative to the upper-left of primary + * display. + */ +static void DarwinPrepareValuators(DeviceIntPtr pDev, int *valuators, ScreenPtr screen, + float pointer_x, float pointer_y, + float pressure, float tilt_x, float tilt_y) { + /* Fix offset between darwin and X screens */ + pointer_x -= darwinMainScreenX + dixScreenOrigins[screen->myNum].x; + pointer_y -= darwinMainScreenY + dixScreenOrigins[screen->myNum].y; + + if(pointer_x < 0.0) + pointer_x = 0.0; + + if(pointer_y < 0.0) + pointer_y = 0.0; + + if(pDev == darwinPointer) { + valuators[0] = pointer_x; + valuators[1] = pointer_y; + valuators[2] = 0; + valuators[3] = 0; + valuators[4] = 0; + } else { + /* Setup our array of values */ + valuators[0] = XQUARTZ_VALUATOR_LIMIT * (pointer_x / (float)screenInfo.screens[0]->width); + valuators[1] = XQUARTZ_VALUATOR_LIMIT * (pointer_y / (float)screenInfo.screens[0]->height); + valuators[2] = XQUARTZ_VALUATOR_LIMIT * pressure; + valuators[3] = XQUARTZ_VALUATOR_LIMIT * tilt_x; + valuators[4] = XQUARTZ_VALUATOR_LIMIT * tilt_y; } - } - if (ev_type == ButtonRelease && darwinFakeButtons && darwinFakeMouseButtonDown) { - // If last mousedown was a fake click, don't check for - // mouse modifiers here. The user may have released the - // modifiers before the mouse button. - ev_button = darwinFakeMouseButtonDown; - darwinFakeMouseButtonDown = 0; - // Bring modifiers back up to date - DarwinUpdateModifiers(KeyPress, darwinFakeMouseButtonMask & old_flags); - darwinFakeMouseButtonMask = 0; - } - - num_events = GetPointerEvents(darwinEvents, darwinPointer, ev_type, ev_button, - POINTER_ABSOLUTE, 0, 2, valuators); - - for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]); - DarwinPokeEQ(); + //DEBUG_LOG("Pointer (%f, %f), Valuators: {%d,%d,%d,%d,%d}\n", pointer_x, pointer_y, + // valuators[0], valuators[1], valuators[2], valuators[3], valuators[4]); } -void DarwinSendKeyboardEvents(int ev_type, int keycode) { - int i, num_events; - if (old_flags == 0 && darwinSyncKeymap && darwinKeymapFile == NULL) { - /* See if keymap has changed. */ +void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, float pointer_x, float pointer_y, + float pressure, float tilt_x, float tilt_y) { + static int darwinFakeMouseButtonDown = 0; + int i, num_events; + ScreenPtr screen; + int valuators[5]; + + //DEBUG_LOG("x=%f, y=%f, p=%f, tx=%f, ty=%f\n", pointer_x, pointer_y, pressure, tilt_x, tilt_y); + + if(!darwinEvents) { + DEBUG_LOG("DarwinSendPointerEvents called before darwinEvents was initialized\n"); + return; + } + + screen = miPointerGetScreen(pDev); + if(!screen) { + DEBUG_LOG("DarwinSendPointerEvents called before screen was initialized\n"); + return; + } - static unsigned int last_seed; - unsigned int this_seed; + /* Handle fake click */ + if (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) { + if(darwinFakeMouseButtonDown != 0) { + /* We're currently "down" with another button, so release it first */ + DarwinSendPointerEvents(pDev, ButtonRelease, darwinFakeMouseButtonDown, pointer_x, pointer_y, pressure, tilt_x, tilt_y); + darwinFakeMouseButtonDown=0; + } + if (darwin_modifier_flags & darwinFakeMouse2Mask) { + ev_button = 2; + darwinFakeMouseButtonDown = 2; + DarwinUpdateModKeys(darwin_modifier_flags & ~darwinFakeMouse2Mask); + } else if (darwin_modifier_flags & darwinFakeMouse3Mask) { + ev_button = 3; + darwinFakeMouseButtonDown = 3; + DarwinUpdateModKeys(darwin_modifier_flags & ~darwinFakeMouse3Mask); + } + } + + if (ev_type == ButtonRelease && ev_button == 1) { + if(darwinFakeMouseButtonDown) { + ev_button = darwinFakeMouseButtonDown; + } - this_seed = QuartzSystemKeymapSeed(); - if (this_seed != last_seed) { - last_seed = this_seed; - DarwinKeyboardReload(darwinKeyboard); - } - } + if(darwinFakeMouseButtonDown == 2) { + DarwinUpdateModKeys(darwin_modifier_flags & ~darwinFakeMouse2Mask); + } else if(darwinFakeMouseButtonDown == 3) { + DarwinUpdateModKeys(darwin_modifier_flags & ~darwinFakeMouse3Mask); + } + + darwinFakeMouseButtonDown = 0; + } - num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE); - for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard,&darwinEvents[i]); - DarwinPokeEQ(); + DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y, pressure, tilt_x, tilt_y); + darwinEvents_lock(); { + num_events = GetPointerEvents(darwinEvents, pDev, ev_type, ev_button, + POINTER_ABSOLUTE, 0, pDev==darwinTabletCurrent?5:2, valuators); + for(i=0; i<num_events; i++) mieqEnqueue (pDev, darwinEvents[i].event); + DarwinPokeEQ(); + } darwinEvents_unlock(); } -/* Send the appropriate number of button 4 / 5 clicks to emulate scroll wheel */ -void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y) { - int i; - int ev_button = count > 0.0f ? 4 : 5; - int valuators[2] = {pointer_x, pointer_y}; - - for (count = fabs(count); count > 0.0; count = count - 1.0f) { - int num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonPress, ev_button, - POINTER_ABSOLUTE, 0, 2, valuators); - for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]); - num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonRelease, ev_button, - POINTER_ABSOLUTE, 0, 2, valuators); - for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]); - } - DarwinPokeEQ(); +void DarwinSendKeyboardEvents(int ev_type, int keycode) { + int i, num_events; + + if(!darwinEvents) { + DEBUG_LOG("DarwinSendKeyboardEvents called before darwinEvents was initialized\n"); + return; + } + + darwinEvents_lock(); { + num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE); + for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard,darwinEvents[i].event); + DarwinPokeEQ(); + } darwinEvents_unlock(); +} + +void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) { + int i, num_events; + ScreenPtr screen; + DeviceIntPtr pDev = darwinTabletCurrent; + int valuators[5]; + + DEBUG_LOG("DarwinSendProximityEvents(%d, %f, %f)\n", ev_type, pointer_x, pointer_y); + + if(!darwinEvents) { + DEBUG_LOG("DarwinSendProximityEvents called before darwinEvents was initialized\n"); + return; + } + + screen = miPointerGetScreen(pDev); + if(!screen) { + DEBUG_LOG("DarwinSendPointerEvents called before screen was initialized\n"); + return; + } + + DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y, 0.0f, 0.0f, 0.0f); + darwinEvents_lock(); { + num_events = GetProximityEvents(darwinEvents, pDev, ev_type, + 0, 5, valuators); + for(i=0; i<num_events; i++) mieqEnqueue (pDev,darwinEvents[i].event); + DarwinPokeEQ(); + } darwinEvents_unlock(); +} + + +/* Send the appropriate number of button clicks to emulate scroll wheel */ +void DarwinSendScrollEvents(float count_x, float count_y, + float pointer_x, float pointer_y, + float pressure, float tilt_x, float tilt_y) { + if(!darwinEvents) { + DEBUG_LOG("DarwinSendScrollEvents called before darwinEvents was initialized\n"); + return; + } + + int sign_x = count_x > 0.0f ? SCROLLWHEELLEFTFAKE : SCROLLWHEELRIGHTFAKE; + int sign_y = count_y > 0.0f ? SCROLLWHEELUPFAKE : SCROLLWHEELDOWNFAKE; + count_x = fabs(count_x); + count_y = fabs(count_y); + + while ((count_x > 0.0f) || (count_y > 0.0f)) { + if (count_x > 0.0f) { + DarwinSendPointerEvents(darwinPointer, ButtonPress, sign_x, pointer_x, pointer_y, pressure, tilt_x, tilt_y); + DarwinSendPointerEvents(darwinPointer, ButtonRelease, sign_x, pointer_x, pointer_y, pressure, tilt_x, tilt_y); + count_x = count_x - 1.0f; + } + if (count_y > 0.0f) { + DarwinSendPointerEvents(darwinPointer, ButtonPress, sign_y, pointer_x, pointer_y, pressure, tilt_x, tilt_y); + DarwinSendPointerEvents(darwinPointer, ButtonRelease, sign_y, pointer_x, pointer_y, pressure, tilt_x, tilt_y); + count_y = count_y - 1.0f; + } + } } /* Send the appropriate KeyPress/KeyRelease events to GetKeyboardEvents to reflect changing modifier flags (alt, control, meta, etc) */ void DarwinUpdateModKeys(int flags) { - DarwinUpdateModifiers(KeyRelease, old_flags & ~flags); - DarwinUpdateModifiers(KeyPress, ~old_flags & flags); - old_flags = flags; + DarwinUpdateModifiers(KeyRelease, darwin_modifier_flags & ~flags); + DarwinUpdateModifiers(KeyPress, ~darwin_modifier_flags & flags); + darwin_modifier_flags = flags; +} + +/* + * DarwinSendDDXEvent + * Send the X server thread a message by placing it on the event queue. + */ +void DarwinSendDDXEvent(int type, int argc, ...) { + xEvent xe; + INT32 *argv; + int i, max_args; + va_list args; + + memset(&xe, 0, sizeof(xe)); + xe.u.u.type = type; + xe.u.clientMessage.u.l.type = type; + + argv = &xe.u.clientMessage.u.l.longs0; + max_args = 4; + + if (argc > 0 && argc <= max_args) { + va_start (args, argc); + for (i = 0; i < argc; i++) + argv[i] = (int) va_arg (args, int); + va_end (args); + } + + darwinEvents_lock(); { + mieqEnqueue(darwinPointer, &xe); + DarwinPokeEQ(); + } darwinEvents_unlock(); } diff --git a/xorg-server/hw/xquartz/darwinEvents.h b/xorg-server/hw/xquartz/darwinEvents.h index 82cc26bc0..9ec3bda2f 100644 --- a/xorg-server/hw/xquartz/darwinEvents.h +++ b/xorg-server/hw/xquartz/darwinEvents.h @@ -1,4 +1,5 @@ /* + * Copyright (c) 2008 Apple, Inc. * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -27,14 +28,57 @@ #ifndef _DARWIN_EVENTS_H #define _DARWIN_EVENTS_H -Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr); +/* For extra precision of our cursor and other valuators */ +#define XQUARTZ_VALUATOR_LIMIT (1 << 16) + +Bool DarwinEQInit(void); void DarwinEQEnqueue(const xEventPtr e); void DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e); void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX); -void DarwinPokeEQ(void); -void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y); +void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, float pointer_x, float pointer_y, + float pressure, float tilt_x, float tilt_y); +void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y); void DarwinSendKeyboardEvents(int ev_type, int keycode); -void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y); +void DarwinSendScrollEvents(float count_x, float count_y, float pointer_x, float pointer_y, + float pressure, float tilt_x, float tilt_y); void DarwinUpdateModKeys(int flags); +void DarwinListenOnOpenFD(int fd); + +/* + * Special ddx events understood by the X server + */ +enum { + kXquartzReloadKeymap // Reload system keymap + = LASTEvent+1, // (from X.h list of event names) + kXquartzActivate, // restore X drawing and cursor + kXquartzDeactivate, // clip X drawing and switch to Aqua cursor + kXquartzSetRootClip, // enable or disable drawing to the X screen + kXquartzQuit, // kill the X server and release the display + kXquartzReadPasteboard, // copy Mac OS X pasteboard into X cut buffer + kXquartzWritePasteboard, // copy X cut buffer onto Mac OS X pasteboard + kXquartzBringAllToFront, // bring all X windows to front + kXquartzToggleFullscreen, // Enable/Disable fullscreen mode + kXquartzSetRootless, // Set rootless mode + kXquartzSpaceChanged, // Spaces changed + kXquartzListenOnOpenFD, // Listen to the launchd fd (passed as arg) + /* + * AppleWM events + */ + kXquartzControllerNotify, // send an AppleWMControllerNotify event + kXquartzPasteboardNotify, // notify the WM to copy or paste + kXquartzReloadPreferences, // send AppleWMReloadPreferences + /* + * Xplugin notification events + */ + kXquartzDisplayChanged, // display configuration has changed + kXquartzWindowState, // window visibility state has changed + kXquartzWindowMoved, // window has moved on screen +}; + +/* Send one of the above events to the server thread. */ +void DarwinSendDDXEvent(int type, int argc, ...); + +extern int darwin_modifier_mask_list[]; +extern int darwin_modifier_flags; #endif /* _DARWIN_EVENTS_H */ diff --git a/xorg-server/hw/xquartz/darwinKeyboard.c b/xorg-server/hw/xquartz/darwinKeyboard.c deleted file mode 100644 index 8d1ee8ec9..000000000 --- a/xorg-server/hw/xquartz/darwinKeyboard.c +++ /dev/null @@ -1,1009 +0,0 @@ -//============================================================================= -// -// Keyboard support for the Darwin X Server -// -// Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved. -// Copyright (c) 2003 Apple Computer, Inc. All Rights Reserved. -// Copyright 2004 Kaleb S. KEITHLEY. All Rights Reserved. -// -// The code to parse the Darwin keymap is derived from dumpkeymap.c -// by Eric Sunshine, which includes the following copyright: -// -// Copyright (C) 1999,2000 by Eric Sunshine <sunshine@sunshineco.com> -// 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. -// 3. The name of the author may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. -// -//============================================================================= - - -/* -=========================================================================== - - An X keyCode must be in the range XkbMinLegalKeyCode (8) to - XkbMaxLegalKeyCode(255). - - The keyCodes we get from the kernel range from 0 to 127, so we need to - offset the range before passing the keyCode to X. - - An X KeySym is an extended ascii code that is device independent. - - The modifier map is accessed by the keyCode, but the normal map is - accessed by keyCode - MIN_KEYCODE. Sigh. - -=========================================================================== -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -// Define this to get a diagnostic output to stderr which is helpful -// in determining how the X server is interpreting the Darwin keymap. -// #define DUMP_DARWIN_KEYMAP - -#include <stdio.h> -#include <stdlib.h> -#include <errno.h> -#include <sys/stat.h> -#include <IOKit/hidsystem/event_status_driver.h> -#include <IOKit/hidsystem/ev_keymap.h> -#include <architecture/byte_order.h> // For the NXSwap* -#include "darwin.h" -#include "darwinKeyboard.h" -#include "quartzKeyboard.h" -#include "quartzAudio.h" - -#ifdef NDEBUG -#undef NDEBUG -#include <assert.h> -#define NDEBUG 1 -#else -#include <assert.h> -#endif - -#define AltMask Mod1Mask -#define MetaMask Mod2Mask -#define FunctionMask Mod3Mask - -#define UK(a) NoSymbol // unknown symbol - -static KeySym const next_to_x[256] = { - NoSymbol, NoSymbol, NoSymbol, XK_KP_Enter, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, - NoSymbol, XK_Return, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - NoSymbol, NoSymbol, NoSymbol, XK_Escape, - NoSymbol, NoSymbol, NoSymbol, NoSymbol, - XK_space, XK_exclam, XK_quotedbl, XK_numbersign, - XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, - XK_parenleft, XK_parenright, XK_asterisk, XK_plus, - XK_comma, XK_minus, XK_period, XK_slash, - XK_0, XK_1, XK_2, XK_3, - XK_4, XK_5, XK_6, XK_7, - XK_8, XK_9, XK_colon, XK_semicolon, - XK_less, XK_equal, XK_greater, XK_question, - XK_at, XK_A, XK_B, XK_C, - XK_D, XK_E, XK_F, XK_G, - XK_H, XK_I, XK_J, XK_K, - XK_L, XK_M, XK_N, XK_O, - XK_P, XK_Q, XK_R, XK_S, - XK_T, XK_U, XK_V, XK_W, - XK_X, XK_Y, XK_Z, XK_bracketleft, - XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, - XK_grave, XK_a, XK_b, XK_c, - XK_d, XK_e, XK_f, XK_g, - XK_h, XK_i, XK_j, XK_k, - XK_l, XK_m, XK_n, XK_o, - XK_p, XK_q, XK_r, XK_s, - XK_t, XK_u, XK_v, XK_w, - XK_x, XK_y, XK_z, XK_braceleft, - XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace, -// 128 - NoSymbol, XK_Agrave, XK_Aacute, XK_Acircumflex, - XK_Atilde, XK_Adiaeresis, XK_Aring, XK_Ccedilla, - XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis, - XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis, -// 144 - XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute, - XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_Ugrave, - XK_Uacute, XK_Ucircumflex, XK_Udiaeresis, XK_Yacute, - XK_THORN, XK_mu, XK_multiply, XK_division, -// 160 - XK_copyright, XK_exclamdown, XK_cent, XK_sterling, - UK(fraction), XK_yen, UK(fhook), XK_section, - XK_currency, XK_rightsinglequotemark, - XK_leftdoublequotemark, - XK_guillemotleft, - XK_leftanglebracket, - XK_rightanglebracket, - UK(filigature), UK(flligature), -// 176 - XK_registered, XK_endash, XK_dagger, XK_doubledagger, - XK_periodcentered,XK_brokenbar, XK_paragraph, UK(bullet), - XK_singlelowquotemark, - XK_doublelowquotemark, - XK_rightdoublequotemark, - XK_guillemotright, - XK_ellipsis, UK(permille), XK_notsign, XK_questiondown, -// 192 - XK_onesuperior, XK_dead_grave, XK_dead_acute, XK_dead_circumflex, - XK_dead_tilde, XK_dead_macron, XK_dead_breve, XK_dead_abovedot, - XK_dead_diaeresis, - XK_twosuperior, XK_dead_abovering, - XK_dead_cedilla, - XK_threesuperior, - XK_dead_doubleacute, - XK_dead_ogonek, XK_dead_caron, -// 208 - XK_emdash, XK_plusminus, XK_onequarter, XK_onehalf, - XK_threequarters, - XK_agrave, XK_aacute, XK_acircumflex, - XK_atilde, XK_adiaeresis, XK_aring, XK_ccedilla, - XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis, -// 224 - XK_igrave, XK_AE, XK_iacute, XK_ordfeminine, - XK_icircumflex, XK_idiaeresis, XK_eth, XK_ntilde, - XK_Lstroke, XK_Ooblique, XK_OE, XK_masculine, - XK_ograve, XK_oacute, XK_ocircumflex, XK_otilde, -// 240 - XK_odiaeresis, XK_ae, XK_ugrave, XK_uacute, - XK_ucircumflex, XK_idotless, XK_udiaeresis, XK_ygrave, - XK_lstroke, XK_ooblique, XK_oe, XK_ssharp, - XK_thorn, XK_ydiaeresis, NoSymbol, NoSymbol, - }; - -#define MIN_SYMBOL 0xAC -static KeySym const symbol_to_x[] = { - XK_Left, XK_Up, XK_Right, XK_Down - }; -static int const NUM_SYMBOL = sizeof(symbol_to_x) / sizeof(symbol_to_x[0]); - -#define MIN_FUNCKEY 0x20 -static KeySym const funckey_to_x[] = { - XK_F1, XK_F2, XK_F3, XK_F4, - XK_F5, XK_F6, XK_F7, XK_F8, - XK_F9, XK_F10, XK_F11, XK_F12, - XK_Insert, XK_Delete, XK_Home, XK_End, - XK_Page_Up, XK_Page_Down, XK_F13, XK_F14, - XK_F15 - }; -static int const NUM_FUNCKEY = sizeof(funckey_to_x) / sizeof(funckey_to_x[0]); - -typedef struct { - KeySym normalSym; - KeySym keypadSym; -} darwinKeyPad_t; - -static darwinKeyPad_t const normal_to_keypad[] = { - { XK_0, XK_KP_0 }, - { XK_1, XK_KP_1 }, - { XK_2, XK_KP_2 }, - { XK_3, XK_KP_3 }, - { XK_4, XK_KP_4 }, - { XK_5, XK_KP_5 }, - { XK_6, XK_KP_6 }, - { XK_7, XK_KP_7 }, - { XK_8, XK_KP_8 }, - { XK_9, XK_KP_9 }, - { XK_equal, XK_KP_Equal }, - { XK_asterisk, XK_KP_Multiply }, - { XK_plus, XK_KP_Add }, - { XK_comma, XK_KP_Separator }, - { XK_minus, XK_KP_Subtract }, - { XK_period, XK_KP_Decimal }, - { XK_slash, XK_KP_Divide } -}; -static int const NUM_KEYPAD = sizeof(normal_to_keypad) / sizeof(normal_to_keypad[0]); - -static void DarwinChangeKeyboardControl( DeviceIntPtr device, KeybdCtrl *ctrl ) -{ - // keyclick, bell volume / pitch, autorepead, LED's -} - -darwinKeyboardInfo keyInfo; -static FILE *fref = NULL; -static char *inBuffer = NULL; - -//----------------------------------------------------------------------------- -// Data Stream Object -// Can be configured to treat embedded "numbers" as being composed of -// either 1, 2, or 4 bytes, apiece. -//----------------------------------------------------------------------------- -typedef struct _DataStream { - unsigned char const *data; - unsigned char const *data_end; - short number_size; // Size in bytes of a "number" in the stream. -} DataStream; - -static DataStream* new_data_stream(unsigned char const* data, int size) { - DataStream* s = (DataStream*)xalloc( sizeof(DataStream) ); - if(s) { - s->data = data; - s->data_end = data + size; - s->number_size = 1; // Default to byte-sized numbers. - } - return s; -} - -static void destroy_data_stream(DataStream* s) { - xfree(s); -} - -static unsigned char get_byte(DataStream* s) { - assert(s->data + 1 <= s->data_end); - return *s->data++; -} - -static short get_word(DataStream* s) { - short hi, lo; - assert(s->data + 2 <= s->data_end); - hi = *s->data++; - lo = *s->data++; - return ((hi << 8) | lo); -} - -static int get_dword(DataStream* s) { - int b1, b2, b3, b4; - assert(s->data + 4 <= s->data_end); - b4 = *s->data++; - b3 = *s->data++; - b2 = *s->data++; - b1 = *s->data++; - return ((b4 << 24) | (b3 << 16) | (b2 << 8) | b1); -} - -static int get_number(DataStream* s) { - switch (s->number_size) { - case 4: return get_dword(s); - case 2: return get_word(s); - default: return get_byte(s); - } -} - -//----------------------------------------------------------------------------- -// Utility functions to help parse Darwin keymap -//----------------------------------------------------------------------------- - -/* - * bits_set - * Calculate number of bits set in the modifier mask. - */ -static short bits_set(short mask) { - short n = 0; - - for ( ; mask != 0; mask >>= 1) - if ((mask & 0x01) != 0) - n++; - return n; -} - -/* - * parse_next_char_code - * Read the next character code from the Darwin keymapping - * and write it to the X keymap. - */ -static void parse_next_char_code(DataStream *s, KeySym *k) { - const short charSet = get_number(s); - const short charCode = get_number(s); - - if (charSet == 0) { // ascii character - if (charCode >= 0 && charCode < 256) - *k = next_to_x[charCode]; - } else if (charSet == 0x01) { // symbol character - if (charCode >= MIN_SYMBOL && - charCode <= MIN_SYMBOL + NUM_SYMBOL) - *k = symbol_to_x[charCode - MIN_SYMBOL]; - } else if (charSet == 0xFE) { // function key - if (charCode >= MIN_FUNCKEY && - charCode <= MIN_FUNCKEY + NUM_FUNCKEY) - *k = funckey_to_x[charCode - MIN_FUNCKEY]; - } -} - - -/* - * DarwinReadKeymapFile - * Read the appropriate keymapping from a keymapping file. - */ -static Bool DarwinReadKeymapFile(NXKeyMapping *keyMap) { - struct stat st; - NXEventSystemDevice info[20]; - int interface = 0, handler_id = 0; - int map_interface, map_handler_id, map_size = 0; - unsigned int i, size; - int *bufferEnd; - union km_tag { - int *intP; - char *charP; - } km; - - fref = fopen( darwinKeymapFile, "rb" ); - if (fref == NULL) { - ErrorF("Unable to open keymapping file '%s' (%s).\n", - darwinKeymapFile, strerror(errno)); - return FALSE; - } - if (fstat(fileno(fref), &st) == -1) { - ErrorF("Could not stat keymapping file '%s' (%s).\n", - darwinKeymapFile, strerror(errno)); - return FALSE; - } - - // check to make sure we don't crash later - if (st.st_size <= 16*sizeof(int)) { - ErrorF("Keymapping file '%s' is invalid (too small).\n", - darwinKeymapFile); - return FALSE; - } - - inBuffer = (char*) xalloc( st.st_size ); - bufferEnd = (int *) (inBuffer + st.st_size); - if (fread(inBuffer, st.st_size, 1, fref) != 1) { - ErrorF("Could not read %qd bytes from keymapping file '%s' (%s).\n", - st.st_size, darwinKeymapFile, strerror(errno)); - return FALSE; - } - - if (strncmp( inBuffer, "KYM1", 4 ) == 0) { - // Magic number OK. - } else if (strncmp( inBuffer, "KYMP", 4 ) == 0) { - ErrorF("Keymapping file '%s' is intended for use with the original NeXT keyboards and cannot be used by XDarwin.\n", darwinKeymapFile); - return FALSE; - } else { - ErrorF("Keymapping file '%s' has a bad magic number and cannot be used by XDarwin.\n", darwinKeymapFile); - return FALSE; - } - - // find the keyboard interface and handler id - size = sizeof( info ) / sizeof( int ); - if (!NXEventSystemInfo( darwinParamConnect, NX_EVS_DEVICE_INFO, - (NXEventSystemInfoType) info, &size )) { - ErrorF("Error reading event status driver info.\n"); - return FALSE; - } - - size = size * sizeof( int ) / sizeof( info[0] ); - for( i = 0; i < size; i++) { - if (info[i].dev_type == NX_EVS_DEVICE_TYPE_KEYBOARD) { - Bool hasInterface = FALSE; - Bool hasMatch = FALSE; - - interface = info[i].interface; - handler_id = info[i].id; - - // Find an appropriate keymapping: - // The first time we try to match both interface and handler_id. - // If we can't match both, we take the first match for interface. - - do { - km.charP = inBuffer; - km.intP++; - while (km.intP+3 < bufferEnd) { - map_interface = NXSwapBigIntToHost(*(km.intP++)); - map_handler_id = NXSwapBigIntToHost(*(km.intP++)); - map_size = NXSwapBigIntToHost(*(km.intP++)); - if (map_interface == interface) { - if (map_handler_id == handler_id || hasInterface) { - hasMatch = TRUE; - break; - } else { - hasInterface = TRUE; - } - } - km.charP += map_size; - } - } while (hasInterface && !hasMatch); - - if (hasMatch) { - // fill in NXKeyMapping structure - keyMap->size = map_size; - keyMap->mapping = (char*) xalloc(map_size); - memcpy(keyMap->mapping, km.charP, map_size); - return TRUE; - } - } // if dev_id == keyboard device - } // foreach info struct - - // The keymapping file didn't match any of the info structs - // returned by NXEventSystemInfo. - ErrorF("Keymapping file '%s' did not contain appropriate keyboard interface.\n", darwinKeymapFile); - return FALSE; -} - - -/* - * DarwinParseNXKeyMapping - */ -static Bool DarwinParseNXKeyMapping(darwinKeyboardInfo *info) { - KeySym *k; - int i; - short numMods, numKeys, numPadKeys = 0; - Bool haveKeymap = FALSE; - NXKeyMapping keyMap; - DataStream *keyMapStream; - unsigned char const *numPadStart = 0; - - if (darwinKeymapFile) { - haveKeymap = DarwinReadKeymapFile(&keyMap); - if (fref) - fclose(fref); - if (inBuffer) - xfree(inBuffer); - if (!haveKeymap) { - ErrorF("Reverting to kernel keymapping.\n"); - } - } - - if (!haveKeymap) { - // get the Darwin keyboard map - keyMap.size = NXKeyMappingLength( darwinParamConnect ); - keyMap.mapping = (char*) xalloc( keyMap.size ); - if (!NXGetKeyMapping( darwinParamConnect, &keyMap )) { - return FALSE; - } - } - - keyMapStream = new_data_stream( (unsigned char const*)keyMap.mapping, - keyMap.size ); - - // check the type of map - if (get_word(keyMapStream)) { - keyMapStream->number_size = 2; - ErrorF("Current 16-bit keymapping may not be interpreted correctly.\n"); - } - - // Insert X modifier KeySyms into the keyboard map. - numMods = get_number(keyMapStream); - while (numMods-- > 0) { - int left = 1; // first keycode is left - short const charCode = get_number(keyMapStream); - short numKeyCodes = get_number(keyMapStream); - - // This is just a marker, not a real modifier. - // Store numeric keypad keys for later. - if (charCode == NX_MODIFIERKEY_NUMERICPAD) { - numPadStart = keyMapStream->data; - numPadKeys = numKeyCodes; - } - - while (numKeyCodes-- > 0) { - const short keyCode = get_number(keyMapStream); - if (charCode != NX_MODIFIERKEY_NUMERICPAD) { - switch (charCode) { - case NX_MODIFIERKEY_ALPHALOCK: - info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Caps_Lock; - break; - case NX_MODIFIERKEY_SHIFT: - info->keyMap[keyCode * GLYPHS_PER_KEY] = - (left ? XK_Shift_L : XK_Shift_R); - break; - case NX_MODIFIERKEY_CONTROL: - info->keyMap[keyCode * GLYPHS_PER_KEY] = - (left ? XK_Control_L : XK_Control_R); - break; - case NX_MODIFIERKEY_ALTERNATE: - // info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Mode_switch; - info->keyMap[keyCode * GLYPHS_PER_KEY] = - (left ? XK_Alt_L : XK_Alt_R); - break; - case NX_MODIFIERKEY_COMMAND: - info->keyMap[keyCode * GLYPHS_PER_KEY] = - (left ? XK_Meta_L : XK_Meta_R); - break; - case NX_MODIFIERKEY_SECONDARYFN: - info->keyMap[keyCode * GLYPHS_PER_KEY] = - (left ? XK_Control_L : XK_Control_R); - break; - case NX_MODIFIERKEY_HELP: - // Help is not an X11 modifier; treat as normal key - info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Help; - break; - } - } - left = 0; - } - } - - // Convert the Darwin keyboard mapping to an X keyboard map. - // A key can have a different character code for each combination of - // modifiers. We currently ignore all modifier combinations except - // those with Shift, AlphaLock, and Alt. - numKeys = get_number(keyMapStream); - for (i = 0, k = info->keyMap; i < numKeys; i++, k += GLYPHS_PER_KEY) { - short const charGenMask = get_number(keyMapStream); - if (charGenMask != 0xFF) { // is key bound? - short numKeyCodes = 1 << bits_set(charGenMask); - - // Record unmodified case - parse_next_char_code( keyMapStream, k ); - numKeyCodes--; - - // If AlphaLock and Shift modifiers produce different codes, - // we record the Shift case since X handles AlphaLock. - if (charGenMask & 0x01) { // AlphaLock - parse_next_char_code( keyMapStream, k+1 ); - numKeyCodes--; - } - - if (charGenMask & 0x02) { // Shift - parse_next_char_code( keyMapStream, k+1 ); - numKeyCodes--; - - if (charGenMask & 0x01) { // Shift-AlphaLock - get_number(keyMapStream); get_number(keyMapStream); - numKeyCodes--; - } - } - - // Skip the Control cases - if (charGenMask & 0x04) { // Control - get_number(keyMapStream); get_number(keyMapStream); - numKeyCodes--; - - if (charGenMask & 0x01) { // Control-AlphaLock - get_number(keyMapStream); get_number(keyMapStream); - numKeyCodes--; - } - - if (charGenMask & 0x02) { // Control-Shift - get_number(keyMapStream); get_number(keyMapStream); - numKeyCodes--; - - if (charGenMask & 0x01) { // Shift-Control-AlphaLock - get_number(keyMapStream); get_number(keyMapStream); - numKeyCodes--; - } - } - } - - // Process Alt cases - if (charGenMask & 0x08) { // Alt - parse_next_char_code( keyMapStream, k+2 ); - numKeyCodes--; - - if (charGenMask & 0x01) { // Alt-AlphaLock - parse_next_char_code( keyMapStream, k+3 ); - numKeyCodes--; - } - - if (charGenMask & 0x02) { // Alt-Shift - parse_next_char_code( keyMapStream, k+3 ); - numKeyCodes--; - - if (charGenMask & 0x01) { // Alt-Shift-AlphaLock - get_number(keyMapStream); get_number(keyMapStream); - numKeyCodes--; - } - } - } - - while (numKeyCodes-- > 0) { - get_number(keyMapStream); get_number(keyMapStream); - } - - if (k[3] == k[2]) k[3] = NoSymbol; - if (k[2] == k[1]) k[2] = NoSymbol; - if (k[1] == k[0]) k[1] = NoSymbol; - if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol; - } - } - - // Now we have to go back through the list of keycodes that are on the - // numeric keypad and update the X keymap. - keyMapStream->data = numPadStart; - while(numPadKeys-- > 0) { - const short keyCode = get_number(keyMapStream); - k = &info->keyMap[keyCode * GLYPHS_PER_KEY]; - for (i = 0; i < NUM_KEYPAD; i++) { - if (*k == normal_to_keypad[i].normalSym) { - k[0] = normal_to_keypad[i].keypadSym; - break; - } - } - } - - // free Darwin keyboard map - destroy_data_stream( keyMapStream ); - xfree( keyMap.mapping ); - - return TRUE; -} - -/* - * DarwinBuildModifierMaps - * Use the keyMap field of keyboard info structure to populate - * the modMap and modifierKeycodes fields. - */ -static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) { - int i; - KeySym *k; - - memset(info->modMap, NoSymbol, sizeof(info->modMap)); - memset(info->modifierKeycodes, 0, sizeof(info->modifierKeycodes)); - - for (i = 0; i < NUM_KEYCODES; i++) { - k = info->keyMap + i * GLYPHS_PER_KEY; - - switch (*k) { - case XK_Shift_L: - info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i; - info->modMap[MIN_KEYCODE + i] = ShiftMask; - break; - - case XK_Shift_R: -#ifdef NX_MODIFIERKEY_RSHIFT - info->modifierKeycodes[NX_MODIFIERKEY_RSHIFT][0] = i; -#else - info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i; -#endif - info->modMap[MIN_KEYCODE + i] = ShiftMask; - break; - - case XK_Control_L: - info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i; - info->modMap[MIN_KEYCODE + i] = ControlMask; - break; - - case XK_Control_R: -#ifdef NX_MODIFIERKEY_RCONTROL - info->modifierKeycodes[NX_MODIFIERKEY_RCONTROL][0] = i; -#else - info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i; -#endif - info->modMap[MIN_KEYCODE + i] = ControlMask; - break; - - case XK_Caps_Lock: - info->modifierKeycodes[NX_MODIFIERKEY_ALPHALOCK][0] = i; - info->modMap[MIN_KEYCODE + i] = LockMask; - break; - - case XK_Alt_L: - info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i; - info->modMap[MIN_KEYCODE + i] = Mod1Mask; - *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor. - break; - - case XK_Alt_R: -#ifdef NX_MODIFIERKEY_RALTERNATE - info->modifierKeycodes[NX_MODIFIERKEY_RALTERNATE][0] = i; -#else - info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i; -#endif - *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor. - info->modMap[MIN_KEYCODE + i] = Mod1Mask; - break; - - case XK_Mode_switch: - info->modMap[MIN_KEYCODE + i] = Mod1Mask; - break; - - case XK_Meta_L: - info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i; - info->modMap[MIN_KEYCODE + i] = Mod2Mask; - break; - - case XK_Meta_R: -#ifdef NX_MODIFIERKEY_RCOMMAND - info->modifierKeycodes[NX_MODIFIERKEY_RCOMMAND][0] = i; -#else - info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i; -#endif - info->modMap[MIN_KEYCODE + i] = Mod2Mask; - break; - - case XK_Num_Lock: - info->modMap[MIN_KEYCODE + i] = Mod3Mask; - break; - } - } -} - -/* - * DarwinLoadKeyboardMapping - * Load the keyboard map from a file or system and convert - * it to an equivalent X keyboard map and modifier map. - */ -static void DarwinLoadKeyboardMapping(KeySymsRec *keySyms) { - memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap)); - - /* TODO: Clean this up - * QuartzReadSystemKeymap is in quartz/quartzKeyboard.c - * DarwinParseNXKeyMapping is here - */ - if (!DarwinParseNXKeyMapping(&keyInfo)) { - DEBUG_LOG("DarwinParseNXKeyMapping returned 0... running QuartzReadSystemKeymap().\n"); - if (!QuartzReadSystemKeymap(&keyInfo)) { - FatalError("Could not build a valid keymap."); - } - } - - DarwinBuildModifierMaps(&keyInfo); - -#ifdef DUMP_DARWIN_KEYMAP - int i; - KeySym *k; - DEBUG_LOG("Darwin -> X converted keyboard map\n"); - for (i = 0, k = keyInfo.keyMap; i < NX_NUMKEYCODES; - i++, k += GLYPHS_PER_KEY) - { - int j; - for (j = 0; j < GLYPHS_PER_KEY; j++) { - if (k[j] == NoSymbol) { - DEBUG_LOG("0x%02x:\tNoSym\n", i); - } else { - DEBUG_LOG("0x%02x:\t0x%lx\n", i, k[j]); - } - } - } -#endif - - keySyms->map = keyInfo.keyMap; - keySyms->mapWidth = GLYPHS_PER_KEY; - keySyms->minKeyCode = MIN_KEYCODE; - keySyms->maxKeyCode = MAX_KEYCODE; -} - - -/* - * DarwinKeyboardInit - * Get the Darwin keyboard map and compute an equivalent - * X keyboard map and modifier map. Set the new keyboard - * device structure. - */ -void DarwinKeyboardInit(DeviceIntPtr pDev) { - KeySymsRec keySyms; - - // Open a shared connection to the HID System. - // Note that the Event Status Driver is really just a wrapper - // for a kIOHIDParamConnectType connection. - assert( darwinParamConnect = NXOpenEventStatus() ); - - DarwinLoadKeyboardMapping(&keySyms); - // DarwinKeyboardReload(pDev); - /* Initialize the seed, so we don't reload the keymap unnecessarily - (and possibly overwrite xinitrc changes) */ - QuartzSystemKeymapSeed(); - - assert( InitKeyboardDeviceStruct( (DevicePtr)pDev, &keySyms, - keyInfo.modMap, QuartzBell, - DarwinChangeKeyboardControl )); -} - - -/* Borrowed from dix/devices.c */ -static Bool InitModMap(register KeyClassPtr keyc) { - int i, j; - CARD8 keysPerModifier[8]; - CARD8 mask; - - // darwinKeyc = keyc; - if (keyc->modifierKeyMap != NULL) - xfree (keyc->modifierKeyMap); - - keyc->maxKeysPerModifier = 0; - for (i = 0; i < 8; i++) - keysPerModifier[i] = 0; - for (i = 8; i < MAP_LENGTH; i++) - { - for (j = 0, mask = 1; j < 8; j++, mask <<= 1) - { - if (mask & keyc->modifierMap[i]) - { - if (++keysPerModifier[j] > keyc->maxKeysPerModifier) - keyc->maxKeysPerModifier = keysPerModifier[j]; - } - } - } - keyc->modifierKeyMap = (KeyCode *)xalloc(8*keyc->maxKeysPerModifier); - if (!keyc->modifierKeyMap && keyc->maxKeysPerModifier) - return (FALSE); - bzero((char *)keyc->modifierKeyMap, 8*(int)keyc->maxKeysPerModifier); - for (i = 0; i < 8; i++) - keysPerModifier[i] = 0; - for (i = 8; i < MAP_LENGTH; i++) - { - for (j = 0, mask = 1; j < 8; j++, mask <<= 1) - { - if (mask & keyc->modifierMap[i]) - { - keyc->modifierKeyMap[(j*keyc->maxKeysPerModifier) + - keysPerModifier[j]] = i; - keysPerModifier[j]++; - } - } - } - return TRUE; -} - - -void DarwinKeyboardReload(DeviceIntPtr pDev) { - KeySymsRec keySyms; - - DarwinLoadKeyboardMapping(&keySyms); - - if (SetKeySymsMap(&pDev->key->curKeySyms, &keySyms)) { - /* now try to update modifiers. */ - - memmove(pDev->key->modifierMap, keyInfo.modMap, MAP_LENGTH); - InitModMap(pDev->key); - } else DEBUG_LOG("SetKeySymsMap=0\n"); - - SendMappingNotify(MappingKeyboard, MIN_KEYCODE, NUM_KEYCODES, 0); - SendMappingNotify(MappingModifier, 0, 0, 0); -} - - -//----------------------------------------------------------------------------- -// Modifier translation functions -// -// There are three different ways to specify a Mac modifier key: -// keycode - specifies hardware key, read from keymapping -// key - NX_MODIFIERKEY_*, really an index -// mask - NX_*MASK, mask for modifier flags in event record -// Left and right side have different keycodes but the same key and mask. -//----------------------------------------------------------------------------- - -/* - * DarwinModifierNXKeyToNXKeycode - * Return the keycode for an NX_MODIFIERKEY_* modifier. - * side = 0 for left or 1 for right. - * Returns 0 if key+side is not a known modifier. - */ -int DarwinModifierNXKeyToNXKeycode(int key, int side) { - return keyInfo.modifierKeycodes[key][side]; -} - -/* - * DarwinModifierNXKeycodeToNXKey - * Returns -1 if keycode+side is not a modifier key - * outSide may be NULL, else it gets 0 for left and 1 for right. - */ -int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide) { - int key, side; - - keycode += MIN_KEYCODE; - // search modifierKeycodes for this keycode+side - for (key = 0; key < NX_NUMMODIFIERS; key++) { - for (side = 0; side <= 1; side++) { - if (keyInfo.modifierKeycodes[key][side] == keycode) break; - } - } - if (key == NX_NUMMODIFIERS) return -1; - if (outSide) *outSide = side; - return key; -} - -/* - * DarwinModifierNXMaskToNXKey - * Returns -1 if mask is not a known modifier mask. - */ -int DarwinModifierNXMaskToNXKey(int mask) { - switch (mask) { - case NX_ALPHASHIFTMASK: return NX_MODIFIERKEY_ALPHALOCK; - case NX_SHIFTMASK: return NX_MODIFIERKEY_SHIFT; -#ifdef NX_DEVICELSHIFTKEYMASK - case NX_DEVICELSHIFTKEYMASK: return NX_MODIFIERKEY_SHIFT; - case NX_DEVICERSHIFTKEYMASK: return NX_MODIFIERKEY_RSHIFT; -#endif - case NX_CONTROLMASK: return NX_MODIFIERKEY_CONTROL; -#ifdef NX_DEVICELCTLKEYMASK - case NX_DEVICELCTLKEYMASK: return NX_MODIFIERKEY_CONTROL; - case NX_DEVICERCTLKEYMASK: return NX_MODIFIERKEY_RCONTROL; -#endif - case NX_ALTERNATEMASK: return NX_MODIFIERKEY_ALTERNATE; -#ifdef NX_DEVICELALTKEYMASK - case NX_DEVICELALTKEYMASK: return NX_MODIFIERKEY_ALTERNATE; - case NX_DEVICERALTKEYMASK: return NX_MODIFIERKEY_RALTERNATE; -#endif - case NX_COMMANDMASK: return NX_MODIFIERKEY_COMMAND; -#ifdef NX_DEVICELCMDKEYMASK - case NX_DEVICELCMDKEYMASK: return NX_MODIFIERKEY_COMMAND; - case NX_DEVICERCMDKEYMASK: return NX_MODIFIERKEY_RCOMMAND; -#endif - case NX_NUMERICPADMASK: return NX_MODIFIERKEY_NUMERICPAD; - case NX_HELPMASK: return NX_MODIFIERKEY_HELP; - case NX_SECONDARYFNMASK: return NX_MODIFIERKEY_SECONDARYFN; - } - return -1; -} - -static const char *DarwinModifierNXMaskTostring(int mask) { - switch (mask) { - case NX_ALPHASHIFTMASK: return "NX_ALPHASHIFTMASK"; - case NX_SHIFTMASK: return "NX_SHIFTMASK"; - case NX_DEVICELSHIFTKEYMASK: return "NX_DEVICELSHIFTKEYMASK"; - case NX_DEVICERSHIFTKEYMASK: return "NX_DEVICERSHIFTKEYMASK"; - case NX_CONTROLMASK: return "NX_CONTROLMASK"; - case NX_DEVICELCTLKEYMASK: return "NX_DEVICELCTLKEYMASK"; - case NX_DEVICERCTLKEYMASK: return "NX_DEVICERCTLKEYMASK"; - case NX_ALTERNATEMASK: return "NX_ALTERNATEMASK"; - case NX_DEVICELALTKEYMASK: return "NX_DEVICELALTKEYMASK"; - case NX_DEVICERALTKEYMASK: return "NX_DEVICERALTKEYMASK"; - case NX_COMMANDMASK: return "NX_COMMANDMASK"; - case NX_DEVICELCMDKEYMASK: return "NX_DEVICELCMDKEYMASK"; - case NX_DEVICERCMDKEYMASK: return "NX_DEVICERCMDKEYMASK"; - case NX_NUMERICPADMASK: return "NX_NUMERICPADMASK"; - case NX_HELPMASK: return "NX_HELPMASK"; - case NX_SECONDARYFNMASK: return "NX_SECONDARYFNMASK"; - } - return "unknown mask"; -} - -/* - * DarwinModifierNXKeyToNXMask - * Returns 0 if key is not a known modifier key. - */ -int DarwinModifierNXKeyToNXMask(int key) { - switch (key) { - case NX_MODIFIERKEY_ALPHALOCK: return NX_ALPHASHIFTMASK; - case NX_MODIFIERKEY_SHIFT: return NX_SHIFTMASK; -#ifdef NX_MODIFIERKEY_RSHIFT - case NX_MODIFIERKEY_RSHIFT: return NX_SHIFTMASK; -#endif - case NX_MODIFIERKEY_CONTROL: return NX_CONTROLMASK; -#ifdef NX_MODIFIERKEY_RCONTROL - case NX_MODIFIERKEY_RCONTROL: return NX_CONTROLMASK; -#endif - case NX_MODIFIERKEY_ALTERNATE: return NX_ALTERNATEMASK; -#ifdef NX_MODIFIERKEY_RALTERNATE - case NX_MODIFIERKEY_RALTERNATE: return NX_ALTERNATEMASK; -#endif - case NX_MODIFIERKEY_COMMAND: return NX_COMMANDMASK; -#ifdef NX_MODIFIERKEY_RCOMMAND - case NX_MODIFIERKEY_RCOMMAND: return NX_COMMANDMASK; -#endif - case NX_MODIFIERKEY_NUMERICPAD: return NX_NUMERICPADMASK; - case NX_MODIFIERKEY_HELP: return NX_HELPMASK; - case NX_MODIFIERKEY_SECONDARYFN: return NX_SECONDARYFNMASK; - } - return 0; -} - -/* - * DarwinModifierStringToNXKey - * Returns -1 if string is not a known modifier. - */ -int DarwinModifierStringToNXKey(const char *str) { - if (!strcasecmp(str, "shift")) return NX_MODIFIERKEY_SHIFT; - else if (!strcasecmp(str, "control")) return NX_MODIFIERKEY_CONTROL; - else if (!strcasecmp(str, "option")) return NX_MODIFIERKEY_ALTERNATE; - else if (!strcasecmp(str, "command")) return NX_MODIFIERKEY_COMMAND; - else if (!strcasecmp(str, "fn")) return NX_MODIFIERKEY_SECONDARYFN; - else return -1; -} - -/* - * LegalModifier - * This allows the ddx layer to prevent some keys from being remapped - * as modifier keys. - */ -Bool LegalModifier(unsigned int key, DeviceIntPtr pDev) -{ - return 1; -} diff --git a/xorg-server/hw/xquartz/darwinXinput.c b/xorg-server/hw/xquartz/darwinXinput.c index e62ec0ab6..59bae6fde 100644 --- a/xorg-server/hw/xquartz/darwinXinput.c +++ b/xorg-server/hw/xquartz/darwinXinput.c @@ -1,8 +1,7 @@ - /* - * X server support of the XINPUT extension for Darwin + * X server support of the XINPUT extension for xquartz * - * This is currently a copy of mi/stubs.c, but eventually this + * This is currently a copy of Xi/stubs.c, but eventually this * should include more complete XINPUT support. */ @@ -52,100 +51,18 @@ SOFTWARE. ********************************************************/ +#define NEED_EVENTS #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif -#define NEED_EVENTS #include <X11/X.h> #include <X11/Xproto.h> #include "inputstr.h" #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "XIstubs.h" -#include "chgkbd.h" - -/*********************************************************************** - * - * Caller: ProcXChangeKeyboardDevice - * - * This procedure does the implementation-dependent portion of the work - * needed to change the keyboard device. - * - * The X keyboard device has a FocusRec. If the device that has been - * made into the new X keyboard did not have a FocusRec, - * ProcXChangeKeyboardDevice will allocate one for it. - * - * If you do not want clients to be able to focus the old X keyboard - * device, call DeleteFocusClassDeviceStruct to free the FocusRec. - * - * If you support input devices with keys that you do not want to be - * used as the X keyboard, you need to check for them here and return - * a BadDevice error. - * - * The default implementation is to do nothing (assume you do want - * clients to be able to focus the old X keyboard). The commented-out - * sample code shows what you might do if you don't want the default. - * - */ - -int ChangeKeyboardDevice (DeviceIntPtr old_dev, DeviceIntPtr new_dev) { - /*********************************************************************** - DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c * - **********************************************************************/ - return BadMatch; -} - - -/*********************************************************************** - * - * Caller: ProcXChangePointerDevice - * - * This procedure does the implementation-dependent portion of the work - * needed to change the pointer device. - * - * The X pointer device does not have a FocusRec. If the device that - * has been made into the new X pointer had a FocusRec, - * ProcXChangePointerDevice will free it. - * - * If you want clients to be able to focus the old pointer device that - * has now become accessible through the input extension, you need to - * add a FocusRec to it here. - * - * The XChangePointerDevice protocol request also allows the client - * to choose which axes of the new pointer device are used to move - * the X cursor in the X- and Y- directions. If the axes are different - * than the default ones, you need to keep track of that here. - * - * If you support input devices with valuators that you do not want to be - * used as the X pointer, you need to check for them here and return a - * BadDevice error. - * - * The default implementation is to do nothing (assume you don't want - * clients to be able to focus the old X pointer). The commented-out - * sample code shows what you might do if you don't want the default. - * - */ - -int -ChangePointerDevice ( - DeviceIntPtr old_dev, - DeviceIntPtr new_dev, - unsigned char x, - unsigned char y) - { - /*********************************************************************** - InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr* - - x_axis = x; * keep track of new x-axis* - y_axis = y; * keep track of new y-axis* - if (x_axis != 0 || y_axis != 1) - axes_changed = TRUE; * remember axes have changed* - else - axes_changed = FALSE; - *************************************************************************/ - return BadMatch; - } +#include "darwin.h" /*********************************************************************** * @@ -161,11 +78,10 @@ ChangePointerDevice ( */ void -CloseInputDevice (d, client) - DeviceIntPtr d; - ClientPtr client; - { - } +CloseInputDevice(DeviceIntPtr d, ClientPtr client) +{ + DEBUG_LOG("CloseInputDevice(%p, %p)\n", d, client); +} /*********************************************************************** * @@ -194,8 +110,8 @@ CloseInputDevice (d, client) */ void -AddOtherInputDevices () - { +AddOtherInputDevices(void) +{ /********************************************************************** for each uninitialized device, do something like: @@ -208,8 +124,8 @@ AddOtherInputDevices () RegisterOtherDevice(dev); dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success); ************************************************************************/ - - } + DEBUG_LOG("AddOtherInputDevices\n"); +} /*********************************************************************** * @@ -234,12 +150,10 @@ AddOtherInputDevices () */ void -OpenInputDevice (dev, client, status) - DeviceIntPtr dev; - ClientPtr client; - int *status; - { - } +OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status) +{ + DEBUG_LOG("OpenInputDevice(%p, %p, %p)\n", dev, client, status); +} /**************************************************************************** * @@ -254,13 +168,11 @@ OpenInputDevice (dev, client, status) */ int -SetDeviceMode (client, dev, mode) - register ClientPtr client; - DeviceIntPtr dev; - int mode; - { +SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode) +{ + DEBUG_LOG("SetDeviceMode(%p, %p, %d)\n", client, dev, mode); return BadMatch; - } +} /**************************************************************************** * @@ -275,15 +187,13 @@ SetDeviceMode (client, dev, mode) */ int -SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators) - register ClientPtr client; - DeviceIntPtr dev; - int *valuators; - int first_valuator; - int num_valuators; - { - return BadMatch; - } +SetDeviceValuators(ClientPtr client, DeviceIntPtr dev, + int *valuators, int first_valuator, int num_valuators) +{ + DEBUG_LOG("SetDeviceValuators(%p, %p, %p, %d, %d)\n", client, + dev, valuators, first_valuator, num_valuators); + return BadMatch; +} /**************************************************************************** * @@ -294,16 +204,48 @@ SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators) */ int -ChangeDeviceControl (client, dev, control) - register ClientPtr client; - DeviceIntPtr dev; - xDeviceCtl *control; - { - switch (control->control) - { - case DEVICE_RESOLUTION: - return (BadMatch); - default: - return (BadMatch); - } +ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, + xDeviceCtl * control) +{ + + DEBUG_LOG("ChangeDeviceControl(%p, %p, %p)\n", client, dev, control); + switch (control->control) { + case DEVICE_RESOLUTION: + return (BadMatch); + case DEVICE_ABS_CALIB: + case DEVICE_ABS_AREA: + return (BadMatch); + case DEVICE_CORE: + return (BadMatch); + default: + return (BadMatch); } +} + + +/**************************************************************************** + * + * Caller: configAddDevice (and others) + * + * Add a new device with the specified options. + * + */ +int +NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev) +{ + DEBUG_LOG("NewInputDeviceRequest(%p, %p)\n", options, pdev); + return BadValue; +} + +/**************************************************************************** + * + * Caller: configRemoveDevice (and others) + * + * Remove the specified device previously added. + * + */ +void +DeleteInputDeviceRequest(DeviceIntPtr dev) +{ + DEBUG_LOG("DeleteInputDeviceRequest(%p)\n", dev); +} diff --git a/xorg-server/hw/xquartz/doc/Makefile.am b/xorg-server/hw/xquartz/doc/Makefile.am new file mode 100644 index 000000000..b812af1cb --- /dev/null +++ b/xorg-server/hw/xquartz/doc/Makefile.am @@ -0,0 +1,14 @@ +appmandir = $(APP_MAN_DIR) +appman_PRE = Xquartz.man.pre +appman_PROCESSED = $(appman_PRE:man.pre=man) +appman_DATA = $(appman_PRE:man.pre=@APP_MAN_SUFFIX@) + +CLEANFILES = $(appman_PROCESSED) $(appman_DATA) + +include $(top_srcdir)/cpprules.in + +.man.$(APP_MAN_SUFFIX): + cp $< $@ + +EXTRA_DIST = \ + Xquartz.man.pre diff --git a/xorg-server/hw/xquartz/doc/Makefile.in b/xorg-server/hw/xquartz/doc/Makefile.in new file mode 100644 index 000000000..dcdc5f5f1 --- /dev/null +++ b/xorg-server/hw/xquartz/doc/Makefile.in @@ -0,0 +1,587 @@ +# Makefile.in generated by automake 1.10.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# -*- Makefile -*- +# Rules for generating files using the C pre-processor +# (Replaces CppFileTarget from Imake) + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/cpprules.in +subdir = hw/xquartz/doc +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ + $(top_builddir)/include/xorg-server.h \ + $(top_builddir)/include/dix-config.h \ + $(top_builddir)/include/xorg-config.h \ + $(top_builddir)/include/xkb-config.h \ + $(top_builddir)/include/xwin-config.h \ + $(top_builddir)/include/kdrive-config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +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)$(appmandir)" +appmanDATA_INSTALL = $(INSTALL_DATA) +DATA = $(appman_DATA) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ +ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@ +APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ +APP_MAN_DIR = @APP_MAN_DIR@ +APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASE_FONT_PATH = @BASE_FONT_PATH@ +BUILD_DATE = @BUILD_DATE@ +BUILD_TIME = @BUILD_TIME@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DARWIN_LIBS = @DARWIN_LIBS@ +DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_LIBS = @DBUS_LIBS@ +DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ +DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ +DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DGA_CFLAGS = @DGA_CFLAGS@ +DGA_LIBS = @DGA_LIBS@ +DIX_CFLAGS = @DIX_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ +DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ +DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ +DMXMODULES_LIBS = @DMXMODULES_LIBS@ +DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ +DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ +DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ +DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ +DOLT_BASH = @DOLT_BASH@ +DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ +DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ +DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ +DRIPROTO_LIBS = @DRIPROTO_LIBS@ +DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ +DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ +DSYMUTIL = @DSYMUTIL@ +DTRACE = @DTRACE@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILE_MAN_DIR = @FILE_MAN_DIR@ +FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ +GLX_DEFINES = @GLX_DEFINES@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +GREP = @GREP@ +HAL_CFLAGS = @HAL_CFLAGS@ +HAL_LIBS = @HAL_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ +KDRIVE_INCS = @KDRIVE_INCS@ +KDRIVE_LIBS = @KDRIVE_LIBS@ +KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ +KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ +KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ +LIBDRM_LIBS = @LIBDRM_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_MAN_DIR = @LIB_MAN_DIR@ +LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ +LINUXDOC = @LINUXDOC@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTCOMPILE = @LTCOMPILE@ +LTCXXCOMPILE = @LTCXXCOMPILE@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MAKE_HTML = @MAKE_HTML@ +MAKE_PDF = @MAKE_PDF@ +MAKE_PS = @MAKE_PS@ +MAKE_TEXT = @MAKE_TEXT@ +MESA_SOURCE = @MESA_SOURCE@ +MISC_MAN_DIR = @MISC_MAN_DIR@ +MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCCLD = @OBJCCLD@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJCLINK = @OBJCLINK@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ +PCIACCESS_LIBS = @PCIACCESS_LIBS@ +PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ +PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +PROJECTROOT = @PROJECTROOT@ +PS2PDF = @PS2PDF@ +RANLIB = @RANLIB@ +RAWCPP = @RAWCPP@ +RAWCPPFLAGS = @RAWCPPFLAGS@ +SED = sed +SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@ +SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ +STRIP = @STRIP@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ +VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@ +VENDOR_NAME = @VENDOR_NAME@ +VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ +VENDOR_RELEASE = @VENDOR_RELEASE@ +VERSION = @VERSION@ +X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ +X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ +XDMCP_CFLAGS = @XDMCP_CFLAGS@ +XDMCP_LIBS = @XDMCP_LIBS@ +XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ +XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ +XDMX_CFLAGS = @XDMX_CFLAGS@ +XDMX_LIBS = @XDMX_LIBS@ +XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ +XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ +XEPHYR_INCS = @XEPHYR_INCS@ +XEPHYR_LIBS = @XEPHYR_LIBS@ +XF86CONFIGFILE = @XF86CONFIGFILE@ +XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ +XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ +XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ +XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ +XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ +XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ +XLIB_CFLAGS = @XLIB_CFLAGS@ +XLIB_LIBS = @XLIB_LIBS@ +XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ +XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ +XNEST_LIBS = @XNEST_LIBS@ +XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ +XORG_CFLAGS = @XORG_CFLAGS@ +XORG_INCS = @XORG_INCS@ +XORG_LIBS = @XORG_LIBS@ +XORG_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@ +XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ +XPBPROXY_LIBS = @XPBPROXY_LIBS@ +XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ +XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ +XSDL_INCS = @XSDL_INCS@ +XSDL_LIBS = @XSDL_LIBS@ +XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ +XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ +XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ +XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ +XSERVER_LIBS = @XSERVER_LIBS@ +XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ +XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ +XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ +XVFB_LIBS = @XVFB_LIBS@ +XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ +XWINMODULES_LIBS = @XWINMODULES_LIBS@ +XWIN_LIBS = @XWIN_LIBS@ +XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ +XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +__XCONFIGFILE__ = @__XCONFIGFILE__@ +abi_ansic = @abi_ansic@ +abi_extension = @abi_extension@ +abi_font = @abi_font@ +abi_videodrv = @abi_videodrv@ +abi_xinput = @abi_xinput@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +driverdir = @driverdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +extdir = @extdir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +logdir = @logdir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +moduledir = @moduledir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sdkdir = @sdkdir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +appmandir = $(APP_MAN_DIR) +appman_PRE = Xquartz.man.pre +appman_PROCESSED = $(appman_PRE:man.pre=man) +appman_DATA = $(appman_PRE:man.pre=@APP_MAN_SUFFIX@) +CLEANFILES = $(appman_PROCESSED) $(appman_DATA) +SUFFIXES = .pre .man .man.pre + +# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM +# to cpp, because that trick does not work on all ANSI C preprocessors. +# Delete line numbers from the cpp output (-P is not portable, I guess). +# Allow XCOMM to be preceded by whitespace and provide a means of generating +# output lines with trailing backslashes. +# Allow XHASH to always be substituted, even in cases where XCOMM isn't. +CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \ + -e '/^\#line *[0-9][0-9]* *.*$$/d' \ + -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \ + -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \ + -e '/^[ ]*XHASH/s/XHASH/\#/' \ + -e '/\@\@$$/s/\@\@$$/\\/' + + +# Strings to replace in man pages +XORGRELSTRING = @PACKAGE_STRING@ +XORGMANNAME = X Version 11 +XSERVERNAME = Xorg +MANDEFS = \ + -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \ + -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \ + -D__appmansuffix__=$(APP_MAN_SUFFIX) \ + -D__filemansuffix__=$(FILE_MAN_SUFFIX) \ + -D__libmansuffix__=$(LIB_MAN_SUFFIX) \ + -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \ + -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \ + -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \ + -D__mandir__=$(mandir) \ + -D__projectroot__=$(prefix) \ + -D__xconfigfile__=$(__XCONFIGFILE__) -D__xconfigdir__=$(XCONFIGDIR) \ + -D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME) + +EXTRA_DIST = \ + Xquartz.man.pre + +all: all-am + +.SUFFIXES: +.SUFFIXES: .pre .man .man.pre .$(APP_MAN_SUFFIX) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/cpprules.in $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xquartz/doc/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/xquartz/doc/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-appmanDATA: $(appman_DATA) + @$(NORMAL_INSTALL) + test -z "$(appmandir)" || $(MKDIR_P) "$(DESTDIR)$(appmandir)" + @list='$(appman_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(appmanDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(appmandir)/$$f'"; \ + $(appmanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(appmandir)/$$f"; \ + done + +uninstall-appmanDATA: + @$(NORMAL_UNINSTALL) + @list='$(appman_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(appmandir)/$$f'"; \ + rm -f "$(DESTDIR)$(appmandir)/$$f"; \ + done +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(DATA) +installdirs: + for dir in "$(DESTDIR)$(appmandir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-appmanDATA + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-appmanDATA + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-appmanDATA install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + uninstall uninstall-am uninstall-appmanDATA + + +.pre: + $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@ + +.man.pre.man: + $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@ + +.man.$(APP_MAN_SUFFIX): + cp $< $@ +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/xorg-server/hw/xquartz/doc/Xquartz.man.pre b/xorg-server/hw/xquartz/doc/Xquartz.man.pre new file mode 100644 index 000000000..04bbee30c --- /dev/null +++ b/xorg-server/hw/xquartz/doc/Xquartz.man.pre @@ -0,0 +1,159 @@ +.TH XQUARTZ 1 __vendorversion__ +.SH NAME +Xquartz \- X window system server for Mac OSX +.SH SYNOPSIS +.B Xquartz +[ options ] ... +.SH DESCRIPTION +.I Xquartz +is the X window server for Mac OS X provided by Apple. +.I Xquartz +runs in parallel with Aqua in rootless mode. In rootless mode, the X +window system and Mac OS X share your display. The root window of the +X11 display is the size of the screen and contains all the other +windows. The X11 root window is not displayed in rootless mode as Mac +OS X handles the desktop background. +.SH CUSTOMIZATION +\fIXquartz\fP can be customized using the defaults(1) command. The available options are: +.TP 8 +.B defaults write org.x.X11 enable_fake_buttons -boolean true +Emulates a 3 button mouse using modifier keys. By default, the Command modifier +is used to emulate button 2 and Option is used for button 3. Thus, clicking the +first mouse button while holding down Command will act like clicking +button 2. Holding down Option will simulate button 3. +.TP 8 +.B defaults write org.x.X11 fake_button2 \fImodifiers\fP +Change the modifier keys used to emulate the second mouse button. By default, +Command is used to emulate the second button. Any combination of the following +modifier names may be used: {l,r,}shift, {l,r,}option, {l,r,}control, {l,r,}command, fn +.TP 8 +.B defaults write org.x.X11 fake_button3 \fImodifiers\fP +Change the modifier keys used to emulate the second mouse button. By default, +Command is used to emulate the second button. Any combination of the following +modifier names may be used: {l,r,}shift, {l,r,}option, {l,r,}control, {l,r,}command, fn +.TP 8 +.B defaults write org.x.X11 fullscreen_hotkeys -boolean true +Enable OSX hotkeys while in fullscreen +.TP 8 +.B defaults write org.x.X11 fullscreen_menu -boolean true +Show the OSX menu while in fullscreen +.TP 8 +.B defaults write org.x.X11 no_quit_alert -boolean true +Disables the alert dialog displayed when attempting to quit X11. +.TP 8 +.B defaults write org.x.X11 no_auth -boolean true +Stops the X server requiring that clients authenticate themselves when +connecting. See Xsecurity(__miscmansuffix__). +.TP 8 +.B defaults write org.x.X11 nolisten_tcp -boolean false +This will tell the server to listen and accept TCP connections. Doing this without enabling +xauth is a possible security concern. See Xsecurity(__miscmansuffix__). +.TP 8 +.B defaults write org.x.X11 enable_system_beep -boolean false +Don't use the standard system beep effect for X11 alerts. +.TP 8 +.B defaults write org.x.X11 enable_key_equivalents -boolean false +Disable menu keyboard equivalents while X11 windows are focused. +.TP 8 +.B defaults write org.x.X11 depth \fIdepth\fP +Specifies the color bit depth to use. Currently only 15, and 24 color +bits per pixel are supported. If not specified, or a value of -1 is specified, +defaults to the depth of the main display. +.TP 8 +.B defaults write org.x.X11 sync_keymap -boolean true +Keep the X11 keymap up to date with the OSX system keymap. +.TP 8 +.B defaults write org.x.X11 sync_pasteboard -boolean true +Enable syncing between the OSX pasteboard and clipboard/primary selection buffers in X11. This option needs to be true for any of the other pasteboard sync options to have an effect. +.TP 8 +.B defaults write org.x.X11 sync_pasteboard_to_clipboard -boolean true +Update the X11 CLIPBOARD when the OSX NSPasteboard is updated. +.TP 8 +.B defaults write org.x.X11 sync_pasteboard_to_primary -boolean true +Update the the X11 PRIMARY buffer when the OSX NSPasteboard is updated. +.TP 8 +.B defaults write org.x.X11 sync_clipboard_to_pasteboard -boolean true +Update the the OSX NSPasteboard when the X11 CLIPBOARD is updated. Note that enabling this option causes the clipboard synchronization to act as a clipboard manager in X11. This makes it impossible to use xclipboard, klipper, or any other such clipboard managers. If you want to use any of these programs, you must disable this option. +.TP 8 +.B defaults write org.x.X11 sync_primary_on_select -boolean true +This option defaults to false and is provided only "for experts." It updates the NSPasteboard whenever a new X11 selection is made (rather than requiring you to hit cmd-c to copy the selection to the NSPasteboard). Since the X11 protocol does not require applications to send notification when they change selection, this might not work in all cases (if you run into this problem, try selecting text in another application first, then selecting the text you want). +.TP 8 +.B defaults write org.x.X11 enable_test_extensions -boolean true +This option defaults to false and is only accessible through the command line. Enable this option to turn on the DEC-XTRAP, RECORD, and XTEST extensions in the server. +.SH OPTIONS +.PP +In addition to the normal server options described in the \fIXserver(1)\fP +manual page, \fIXquartz\fP accepts the following command line switches: +.TP 8 +.B \-fakebuttons +Same as enable_fake_buttons above with value true. +.TP 8 +.B \-nofakebuttons +Same as enable_fake_buttons above with value false. +.TP 8 +.B "\-fakemouse2 \fImodifiers\fP" +Same as fake_button2 above. +.TP 8 +.B "\-fakemouse3 \fImodifiers\fP" +Same as fake_button3 above. +.TP 8 +.B "\-depth \fIdepth\fP" +Same as depth above. +.SH "SEE ALSO" +.PP +X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1) +.PP +http://xquartz.macosforge.org +.PP +.SH AUTHORS / HISTORY +X11 was originally ported to Mac OS X Server by John Carmack. Dave +Zarzycki used this as the basis of his port of XFree86 4.0 to Darwin 1.0. +Torrey T. Lyons improved and integrated this code into the XFree86 +Project's mainline for the 4.0.2 release. +.PP +The following members of the XonX Team contributed to the following +releases (in alphabetical order): +.TP 4 +XFree86 4.1.0: +.br +Rob Braun - Darwin x86 support +.br +Torrey T. Lyons - Project Lead +.br +Andreas Monitzer - Cocoa version of XDarwin front end +.br +Gregory Robert Parker - Original Quartz implementation +.br +Christoph Pfisterer - Dynamic shared X libraries +.br +Toshimitsu Tanaka - Japanese localization +.TP 4 +XFree86 4.2.0: +.br +Rob Braun - Darwin x86 support +.br +Pablo Di Noto - Spanish localization +.br +Paul Edens - Dutch localization +.br +Kyunghwan Kim - Korean localization +.br +Mario Klebsch - Non-US keyboard support +.br +Torrey T. Lyons - Project Lead +.br +Andreas Monitzer - German localization +.br +Patrik Montgomery - Swedish localization +.br +Greg Parker - Rootless support +.br +Toshimitsu Tanaka - Japanese localization +.br +Olivier Verdier - French localization +.PP +Code from Apple's X11.app (which was based on XFree86 4.1) was integrated into X.org's XDarwin DDX by Ben Byer for xorg-server-1.2. +The XDarwin DDX was renamed Xquartz to more accurately reflect its state (the pure-darwin backend was removed). +Jeremy Huddleston took over as project lead and brought the project up to the X.org 1.4 server branch. +.PP +Jeremy Huddleston <jeremyhu@apple.com> is the current maintainer. diff --git a/xorg-server/hw/xquartz/mach-startup/Makefile.am b/xorg-server/hw/xquartz/mach-startup/Makefile.am new file mode 100644 index 000000000..b0112949d --- /dev/null +++ b/xorg-server/hw/xquartz/mach-startup/Makefile.am @@ -0,0 +1,74 @@ +AM_CPPFLAGS = \ + -DBUILD_DATE=\"$(BUILD_DATE)\" \ + -DXSERVER_VERSION=\"$(VERSION)\" \ + -DX11BINDIR=\"$(bindir)\" + +x11appdir = $(APPLE_APPLICATIONS_DIR)/X11.app/Contents/MacOS +x11app_PROGRAMS = X11.bin + +dist_X11_bin_SOURCES = \ + bundle-main.c + +nodist_X11_bin_SOURCES = \ + mach_startupServer.c \ + mach_startupUser.c + +X11_bin_LDADD = \ + $(top_builddir)/hw/xquartz/libXquartz.la \ + $(top_builddir)/hw/xquartz/xpr/libXquartzXpr.la \ + $(top_builddir)/dix/dixfonts.lo \ + $(top_builddir)/miext/rootless/librootless.la \ + $(top_builddir)/hw/xquartz/pbproxy/libxpbproxy.la \ + $(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin + +X11_bin_LDFLAGS = \ + -XCClinker -Objc \ + -Wl,-u,_miDCInitialize \ + -Wl,-framework,Carbon \ + -Wl,-framework,Cocoa \ + -Wl,-framework,CoreAudio \ + -Wl,-framework,IOKit + +if GLX +X11_bin_LDADD += \ + $(top_builddir)/hw/xquartz/GL/libCGLCore.la \ + $(top_builddir)/glx/libglx.la + +X11_bin_LDFLAGS += \ + -L/System/Library/Frameworks/OpenGL.framework/Libraries -lGL \ + -Wl,-framework,OpenGL +endif + +if RECORD +X11_bin_LDADD += \ + $(top_builddir)/record/librecord.la +endif + +bin_PROGRAMS = Xquartz + +dist_Xquartz_SOURCES = \ + stub.c \ + launchd_fd.c + +nodist_Xquartz_SOURCES = \ + mach_startupUser.c + +Xquartz_LDFLAGS = \ + -Wl,-framework,CoreServices + +BUILT_SOURCES = \ + mach_startupServer.c \ + mach_startupUser.c \ + mach_startupServer.h \ + mach_startup.h + +CLEANFILES = \ + $(BUILT_SOURCES) + +$(BUILT_SOURCES): $(srcdir)/mach_startup.defs + mig -sheader mach_startupServer.h $(srcdir)/mach_startup.defs + +EXTRA_DIST = \ + launchd_fd.h \ + mach_startup.defs \ + mach_startup_types.h diff --git a/xorg-server/hw/xquartz/mach-startup/Makefile.in b/xorg-server/hw/xquartz/mach-startup/Makefile.in new file mode 100644 index 000000000..fbdedad9b --- /dev/null +++ b/xorg-server/hw/xquartz/mach-startup/Makefile.in @@ -0,0 +1,754 @@ +# Makefile.in generated by automake 1.10.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +x11app_PROGRAMS = X11.bin$(EXEEXT) +@GLX_TRUE@am__append_1 = \ +@GLX_TRUE@ $(top_builddir)/hw/xquartz/GL/libCGLCore.la \ +@GLX_TRUE@ $(top_builddir)/glx/libglx.la + +@GLX_TRUE@am__append_2 = \ +@GLX_TRUE@ -L/System/Library/Frameworks/OpenGL.framework/Libraries -lGL \ +@GLX_TRUE@ -Wl,-framework,OpenGL + +@RECORD_TRUE@am__append_3 = \ +@RECORD_TRUE@ $(top_builddir)/record/librecord.la + +bin_PROGRAMS = Xquartz$(EXEEXT) +subdir = hw/xquartz/mach-startup +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ + $(top_builddir)/include/xorg-server.h \ + $(top_builddir)/include/dix-config.h \ + $(top_builddir)/include/xorg-config.h \ + $(top_builddir)/include/xkb-config.h \ + $(top_builddir)/include/xwin-config.h \ + $(top_builddir)/include/kdrive-config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(x11appdir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +x11appPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) $(x11app_PROGRAMS) +dist_X11_bin_OBJECTS = bundle-main.$(OBJEXT) +nodist_X11_bin_OBJECTS = mach_startupServer.$(OBJEXT) \ + mach_startupUser.$(OBJEXT) +X11_bin_OBJECTS = $(dist_X11_bin_OBJECTS) $(nodist_X11_bin_OBJECTS) +am__DEPENDENCIES_1 = +X11_bin_DEPENDENCIES = $(top_builddir)/hw/xquartz/libXquartz.la \ + $(top_builddir)/hw/xquartz/xpr/libXquartzXpr.la \ + $(top_builddir)/dix/dixfonts.lo \ + $(top_builddir)/miext/rootless/librootless.la \ + $(top_builddir)/hw/xquartz/pbproxy/libxpbproxy.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__append_1) $(am__append_3) +X11_bin_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(X11_bin_LDFLAGS) \ + $(LDFLAGS) -o $@ +dist_Xquartz_OBJECTS = stub.$(OBJEXT) launchd_fd.$(OBJEXT) +nodist_Xquartz_OBJECTS = mach_startupUser.$(OBJEXT) +Xquartz_OBJECTS = $(dist_Xquartz_OBJECTS) $(nodist_Xquartz_OBJECTS) +Xquartz_LDADD = $(LDADD) +Xquartz_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xquartz_LDFLAGS) \ + $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(dist_X11_bin_SOURCES) $(nodist_X11_bin_SOURCES) \ + $(dist_Xquartz_SOURCES) $(nodist_Xquartz_SOURCES) +DIST_SOURCES = $(dist_X11_bin_SOURCES) $(dist_Xquartz_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ +ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@ +APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ +APP_MAN_DIR = @APP_MAN_DIR@ +APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASE_FONT_PATH = @BASE_FONT_PATH@ +BUILD_DATE = @BUILD_DATE@ +BUILD_TIME = @BUILD_TIME@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DARWIN_LIBS = @DARWIN_LIBS@ +DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_LIBS = @DBUS_LIBS@ +DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ +DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ +DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DGA_CFLAGS = @DGA_CFLAGS@ +DGA_LIBS = @DGA_LIBS@ +DIX_CFLAGS = @DIX_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ +DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ +DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ +DMXMODULES_LIBS = @DMXMODULES_LIBS@ +DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ +DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ +DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ +DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ +DOLT_BASH = @DOLT_BASH@ +DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ +DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ +DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ +DRIPROTO_LIBS = @DRIPROTO_LIBS@ +DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ +DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ +DSYMUTIL = @DSYMUTIL@ +DTRACE = @DTRACE@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILE_MAN_DIR = @FILE_MAN_DIR@ +FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ +GLX_DEFINES = @GLX_DEFINES@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +GREP = @GREP@ +HAL_CFLAGS = @HAL_CFLAGS@ +HAL_LIBS = @HAL_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ +KDRIVE_INCS = @KDRIVE_INCS@ +KDRIVE_LIBS = @KDRIVE_LIBS@ +KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ +KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ +KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ +LIBDRM_LIBS = @LIBDRM_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_MAN_DIR = @LIB_MAN_DIR@ +LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ +LINUXDOC = @LINUXDOC@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTCOMPILE = @LTCOMPILE@ +LTCXXCOMPILE = @LTCXXCOMPILE@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MAKE_HTML = @MAKE_HTML@ +MAKE_PDF = @MAKE_PDF@ +MAKE_PS = @MAKE_PS@ +MAKE_TEXT = @MAKE_TEXT@ +MESA_SOURCE = @MESA_SOURCE@ +MISC_MAN_DIR = @MISC_MAN_DIR@ +MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCCLD = @OBJCCLD@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJCLINK = @OBJCLINK@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ +PCIACCESS_LIBS = @PCIACCESS_LIBS@ +PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ +PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +PROJECTROOT = @PROJECTROOT@ +PS2PDF = @PS2PDF@ +RANLIB = @RANLIB@ +RAWCPP = @RAWCPP@ +RAWCPPFLAGS = @RAWCPPFLAGS@ +SED = @SED@ +SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@ +SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ +STRIP = @STRIP@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ +VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@ +VENDOR_NAME = @VENDOR_NAME@ +VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ +VENDOR_RELEASE = @VENDOR_RELEASE@ +VERSION = @VERSION@ +X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ +X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ +XDMCP_CFLAGS = @XDMCP_CFLAGS@ +XDMCP_LIBS = @XDMCP_LIBS@ +XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ +XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ +XDMX_CFLAGS = @XDMX_CFLAGS@ +XDMX_LIBS = @XDMX_LIBS@ +XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ +XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ +XEPHYR_INCS = @XEPHYR_INCS@ +XEPHYR_LIBS = @XEPHYR_LIBS@ +XF86CONFIGFILE = @XF86CONFIGFILE@ +XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ +XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ +XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ +XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ +XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ +XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ +XLIB_CFLAGS = @XLIB_CFLAGS@ +XLIB_LIBS = @XLIB_LIBS@ +XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ +XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ +XNEST_LIBS = @XNEST_LIBS@ +XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ +XORG_CFLAGS = @XORG_CFLAGS@ +XORG_INCS = @XORG_INCS@ +XORG_LIBS = @XORG_LIBS@ +XORG_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@ +XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ +XPBPROXY_LIBS = @XPBPROXY_LIBS@ +XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ +XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ +XSDL_INCS = @XSDL_INCS@ +XSDL_LIBS = @XSDL_LIBS@ +XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ +XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ +XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ +XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ +XSERVER_LIBS = @XSERVER_LIBS@ +XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ +XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ +XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ +XVFB_LIBS = @XVFB_LIBS@ +XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ +XWINMODULES_LIBS = @XWINMODULES_LIBS@ +XWIN_LIBS = @XWIN_LIBS@ +XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ +XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +__XCONFIGFILE__ = @__XCONFIGFILE__@ +abi_ansic = @abi_ansic@ +abi_extension = @abi_extension@ +abi_font = @abi_font@ +abi_videodrv = @abi_videodrv@ +abi_xinput = @abi_xinput@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +driverdir = @driverdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +extdir = @extdir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +logdir = @logdir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +moduledir = @moduledir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sdkdir = @sdkdir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = \ + -DBUILD_DATE=\"$(BUILD_DATE)\" \ + -DXSERVER_VERSION=\"$(VERSION)\" \ + -DX11BINDIR=\"$(bindir)\" + +x11appdir = $(APPLE_APPLICATIONS_DIR)/X11.app/Contents/MacOS +dist_X11_bin_SOURCES = \ + bundle-main.c + +nodist_X11_bin_SOURCES = \ + mach_startupServer.c \ + mach_startupUser.c + +X11_bin_LDADD = $(top_builddir)/hw/xquartz/libXquartz.la \ + $(top_builddir)/hw/xquartz/xpr/libXquartzXpr.la \ + $(top_builddir)/dix/dixfonts.lo \ + $(top_builddir)/miext/rootless/librootless.la \ + $(top_builddir)/hw/xquartz/pbproxy/libxpbproxy.la \ + $(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin \ + $(am__append_1) $(am__append_3) +X11_bin_LDFLAGS = -XCClinker -Objc -Wl,-u,_miDCInitialize \ + -Wl,-framework,Carbon -Wl,-framework,Cocoa \ + -Wl,-framework,CoreAudio -Wl,-framework,IOKit $(am__append_2) +dist_Xquartz_SOURCES = \ + stub.c \ + launchd_fd.c + +nodist_Xquartz_SOURCES = \ + mach_startupUser.c + +Xquartz_LDFLAGS = \ + -Wl,-framework,CoreServices + +BUILT_SOURCES = \ + mach_startupServer.c \ + mach_startupUser.c \ + mach_startupServer.h \ + mach_startup.h + +CLEANFILES = \ + $(BUILT_SOURCES) + +EXTRA_DIST = \ + launchd_fd.h \ + mach_startup.defs \ + mach_startup_types.h + +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xquartz/mach-startup/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/xquartz/mach-startup/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +install-x11appPROGRAMS: $(x11app_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(x11appdir)" || $(MKDIR_P) "$(DESTDIR)$(x11appdir)" + @list='$(x11app_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(x11appPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(x11appdir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(x11appPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(x11appdir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-x11appPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(x11app_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(x11appdir)/$$f'"; \ + rm -f "$(DESTDIR)$(x11appdir)/$$f"; \ + done + +clean-x11appPROGRAMS: + @list='$(x11app_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +X11.bin$(EXEEXT): $(X11_bin_OBJECTS) $(X11_bin_DEPENDENCIES) + @rm -f X11.bin$(EXEEXT) + $(X11_bin_LINK) $(X11_bin_OBJECTS) $(X11_bin_LDADD) $(LIBS) +Xquartz$(EXEEXT): $(Xquartz_OBJECTS) $(Xquartz_DEPENDENCIES) + @rm -f Xquartz$(EXEEXT) + $(Xquartz_LINK) $(Xquartz_OBJECTS) $(Xquartz_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bundle-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/launchd_fd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach_startupServer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach_startupUser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stub.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(x11appdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool \ + clean-x11appPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-x11appPROGRAMS + +install-dvi: install-dvi-am + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-x11appPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool clean-x11appPROGRAMS ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + install-x11appPROGRAMS 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-binPROGRAMS uninstall-x11appPROGRAMS + + +$(BUILT_SOURCES): $(srcdir)/mach_startup.defs + mig -sheader mach_startupServer.h $(srcdir)/mach_startup.defs +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/xorg-server/hw/xquartz/mach-startup/bundle-main.c b/xorg-server/hw/xquartz/mach-startup/bundle-main.c new file mode 100644 index 000000000..fd70f26ed --- /dev/null +++ b/xorg-server/hw/xquartz/mach-startup/bundle-main.c @@ -0,0 +1,581 @@ +/* main.c -- X application launcher + + Copyright (c) 2007 Jeremy Huddleston + Copyright (c) 2007 Apple Inc + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation files + (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT + HOLDER(S) 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(s) of the above + copyright holders shall not be used in advertising or otherwise to + promote the sale, use or other dealings in this Software without + prior written authorization. */ + +#include <CoreFoundation/CoreFoundation.h> +#include <AvailabilityMacros.h> + +#include <X11/Xlib.h> +#include <unistd.h> +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <pthread.h> +#include <stdbool.h> +#include <signal.h> + +#include <sys/socket.h> +#include <sys/un.h> + +#include <sys/time.h> + +#include <mach/mach.h> +#include <mach/mach_error.h> +#include <servers/bootstrap.h> +#include "mach_startup.h" +#include "mach_startupServer.h" + +#include "launchd_fd.h" +/* From darwinEvents.c ... but don't want to pull in all the server cruft */ +void DarwinListenOnOpenFD(int fd); + +extern int noPanoramiXExtension; + +extern int xquartz_resetenv_display; + +#define DEFAULT_CLIENT X11BINDIR "/xterm" +#define DEFAULT_STARTX X11BINDIR "/startx" +#define DEFAULT_SHELL "/bin/sh" + +#ifndef BUILD_DATE +#define BUILD_DATE "" +#endif +#ifndef XSERVER_VERSION +#define XSERVER_VERSION "?" +#endif + +const int __crashreporter_info__len = 4096; +const char *__crashreporter_info__base = "X.Org X Server " XSERVER_VERSION " Build Date: " BUILD_DATE; +char __crashreporter_info__buf[4096]; +char *__crashreporter_info__ = __crashreporter_info__buf; + +static char *server_bootstrap_name = "org.x.X11"; + +#define DEBUG 1 + +/* This is in quartzStartup.c */ +int server_main(int argc, char **argv, char **envp); + +static int execute(const char *command); +static char *command_from_prefs(const char *key, const char *default_value); + +/*** Pthread Magics ***/ +static pthread_t create_thread(void *func, void *arg) { + pthread_attr_t attr; + pthread_t tid; + + pthread_attr_init (&attr); + pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM); + pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); + pthread_create (&tid, &attr, func, arg); + pthread_attr_destroy (&attr); + + return tid; +} + +/*** Mach-O IPC Stuffs ***/ + +union MaxMsgSize { + union __RequestUnion__mach_startup_subsystem req; + union __ReplyUnion__mach_startup_subsystem rep; +}; + +static mach_port_t checkin_or_register(char *bname) { + kern_return_t kr; + mach_port_t mp; + + /* If we're started by launchd or the old mach_init */ + kr = bootstrap_check_in(bootstrap_port, bname, &mp); + if (kr == KERN_SUCCESS) + return mp; + + /* We probably were not started by launchd or the old mach_init */ + kr = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &mp); + if (kr != KERN_SUCCESS) { + fprintf(stderr, "mach_port_allocate(): %s\n", mach_error_string(kr)); + exit(EXIT_FAILURE); + } + + kr = mach_port_insert_right(mach_task_self(), mp, mp, MACH_MSG_TYPE_MAKE_SEND); + if (kr != KERN_SUCCESS) { + fprintf(stderr, "mach_port_insert_right(): %s\n", mach_error_string(kr)); + exit(EXIT_FAILURE); + } + + kr = bootstrap_register(bootstrap_port, bname, mp); + if (kr != KERN_SUCCESS) { + fprintf(stderr, "bootstrap_register(): %s\n", mach_error_string(kr)); + exit(EXIT_FAILURE); + } + + return mp; +} + +/*** $DISPLAY handoff ***/ +static int accept_fd_handoff(int connected_fd) { + int launchd_fd; + + char databuf[] = "display"; + struct iovec iov[1]; + + iov[0].iov_base = databuf; + iov[0].iov_len = sizeof(databuf); + + union { + struct cmsghdr hdr; + char bytes[CMSG_SPACE(sizeof(int))]; + } buf; + + struct msghdr msg; + msg.msg_iov = iov; + msg.msg_iovlen = 1; + msg.msg_control = buf.bytes; + msg.msg_controllen = sizeof(buf); + msg.msg_name = 0; + msg.msg_namelen = 0; + msg.msg_flags = 0; + + struct cmsghdr *cmsg = CMSG_FIRSTHDR (&msg); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(int)); + + msg.msg_controllen = cmsg->cmsg_len; + + *((int*)CMSG_DATA(cmsg)) = -1; + + if(recvmsg(connected_fd, &msg, 0) < 0) { + fprintf(stderr, "X11.app: Error receiving $DISPLAY file descriptor. recvmsg() error: %s\n", strerror(errno)); + return -1; + } + + launchd_fd = *((int*)CMSG_DATA(cmsg)); + + return launchd_fd; +} + +typedef struct { + int fd; + string_t filename; +} socket_handoff_t; + +/* This thread accepts an incoming connection and hands off the file + * descriptor for the new connection to accept_fd_handoff() + */ +static void socket_handoff_thread(void *arg) { + socket_handoff_t *handoff_data = (socket_handoff_t *)arg; + int launchd_fd = -1; + int connected_fd; + + /* Now actually get the passed file descriptor from this connection + * If we encounter an error, keep listening. + */ + while(launchd_fd == -1) { + connected_fd = accept(handoff_data->fd, NULL, NULL); + if(connected_fd == -1) { + fprintf(stderr, "X11.app: Failed to accept incoming connection on socket (fd=%d): %s\n", handoff_data->fd, strerror(errno)); + sleep(2); + continue; + } + + launchd_fd = accept_fd_handoff(connected_fd); + if(launchd_fd == -1) + fprintf(stderr, "X11.app: Error receiving $DISPLAY file descriptor, no descriptor received? Waiting for another connection.\n"); + + close(connected_fd); + } + + close(handoff_data->fd); + unlink(handoff_data->filename); + free(handoff_data); + + /* TODO: Clean up this race better... giving xinitrc time to run... need to wait for 1.5 branch: + * + * From ajax: + * There's already an internal callback chain for setting selection [in 1.5] + * ownership. See the CallSelectionCallback at the bottom of + * ProcSetSelectionOwner, and xfixes/select.c for an example of how to hook + * into it. + */ + + unsigned remain = 3000000; + fprintf(stderr, "X11.app: Received new $DISPLAY fd: %d ... sleeping to allow xinitrc to catchup.\n", launchd_fd); + while((remain = usleep(remain)) > 0); + + fprintf(stderr, "X11.app Handing off fd to server thread via DarwinListenOnOpenFD(%d)\n", launchd_fd); + DarwinListenOnOpenFD(launchd_fd); +} + +static int create_socket(char *filename_out) { + struct sockaddr_un servaddr_un; + struct sockaddr *servaddr; + socklen_t servaddr_len; + int ret_fd; + size_t try, try_max; + + for(try=0, try_max=5; try < try_max; try++) { + tmpnam(filename_out); + + /* Setup servaddr_un */ + memset (&servaddr_un, 0, sizeof (struct sockaddr_un)); + servaddr_un.sun_family = AF_UNIX; + strlcpy(servaddr_un.sun_path, filename_out, sizeof(servaddr_un.sun_path)); + + servaddr = (struct sockaddr *) &servaddr_un; + servaddr_len = sizeof(struct sockaddr_un) - sizeof(servaddr_un.sun_path) + strlen(filename_out); + + ret_fd = socket(PF_UNIX, SOCK_STREAM, 0); + if(ret_fd == -1) { + fprintf(stderr, "X11.app: Failed to create socket (try %d / %d): %s - %s\n", (int)try+1, (int)try_max, filename_out, strerror(errno)); + continue; + } + + if(bind(ret_fd, servaddr, servaddr_len) != 0) { + fprintf(stderr, "X11.app: Failed to bind socket: %d - %s\n", errno, strerror(errno)); + close(ret_fd); + return 0; + } + + if(listen(ret_fd, 10) != 0) { + fprintf(stderr, "X11.app: Failed to listen to socket: %s - %d - %s\n", filename_out, errno, strerror(errno)); + close(ret_fd); + return 0; + } + +#ifdef DEBUG + fprintf(stderr, "X11.app: Listening on socket for fd handoff: (%d) %s\n", ret_fd, filename_out); +#endif + + return ret_fd; + } + + return 0; +} + +static int launchd_socket_handed_off = 0; + +kern_return_t do_request_fd_handoff_socket(mach_port_t port, string_t filename) { + socket_handoff_t *handoff_data; + + launchd_socket_handed_off = 1; + + handoff_data = (socket_handoff_t *)calloc(1,sizeof(socket_handoff_t)); + if(!handoff_data) { + fprintf(stderr, "X11.app: Error allocating memory for handoff_data\n"); + return KERN_FAILURE; + } + + handoff_data->fd = create_socket(handoff_data->filename); + if(!handoff_data->fd) { + return KERN_FAILURE; + } + + strlcpy(filename, handoff_data->filename, STRING_T_SIZE); + + create_thread(socket_handoff_thread, handoff_data); + +#ifdef DEBUG + fprintf(stderr, "X11.app: Thread created for handoff. Returning success to tell caller to connect and push the fd.\n"); +#endif + + return KERN_SUCCESS; +} + +kern_return_t do_request_pid(mach_port_t port, int *my_pid) { + *my_pid = getpid(); + return KERN_SUCCESS; +} + +/*** Server Startup ***/ +kern_return_t do_start_x11_server(mach_port_t port, string_array_t argv, + mach_msg_type_number_t argvCnt, + string_array_t envp, + mach_msg_type_number_t envpCnt) { + /* And now back to char ** */ + char **_argv = alloca((argvCnt + 1) * sizeof(char *)); + char **_envp = alloca((envpCnt + 1) * sizeof(char *)); + size_t i; + + /* If we didn't get handed a launchd DISPLAY socket, we shoul + * unset DISPLAY or we can run into problems with pbproxy + */ + if(!launchd_socket_handed_off) + unsetenv("DISPLAY"); + + if(!_argv || !_envp) { + return KERN_FAILURE; + } + + fprintf(stderr, "X11.app: do_start_x11_server(): argc=%d\n", argvCnt); + for(i=0; i < argvCnt; i++) { + _argv[i] = argv[i]; + fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]); + } + _argv[argvCnt] = NULL; + + for(i=0; i < envpCnt; i++) { + _envp[i] = envp[i]; + } + _envp[envpCnt] = NULL; + + if(server_main(argvCnt, _argv, _envp) == 0) + return KERN_SUCCESS; + else + return KERN_FAILURE; +} + +int startup_trigger(int argc, char **argv, char **envp) { + Display *display; + const char *s; + + /* Take care of the case where we're called like a normal DDX */ + if(argc > 1 && argv[1][0] == ':') { + size_t i; + kern_return_t kr; + mach_port_t mp; + string_array_t newenvp; + string_array_t newargv; + + /* We need to count envp */ + int envpc; + for(envpc=0; envp[envpc]; envpc++); + + /* We have fixed-size string lengths due to limitations in IPC, + * so we need to copy our argv and envp. + */ + newargv = (string_array_t)alloca(argc * sizeof(string_t)); + newenvp = (string_array_t)alloca(envpc * sizeof(string_t)); + + if(!newargv || !newenvp) { + fprintf(stderr, "Memory allocation failure\n"); + exit(EXIT_FAILURE); + } + + for(i=0; i < argc; i++) { + strlcpy(newargv[i], argv[i], STRING_T_SIZE); + } + for(i=0; i < envpc; i++) { + strlcpy(newenvp[i], envp[i], STRING_T_SIZE); + } + + kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp); + if (kr != KERN_SUCCESS) { +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 + fprintf(stderr, "bootstrap_look_up(): %s\n", bootstrap_strerror(kr)); +#else + fprintf(stderr, "bootstrap_look_up(): %ul\n", (unsigned long)kr); +#endif + exit(EXIT_FAILURE); + } + + kr = start_x11_server(mp, newargv, argc, newenvp, envpc); + if (kr != KERN_SUCCESS) { + fprintf(stderr, "start_x11_server: %s\n", mach_error_string(kr)); + exit(EXIT_FAILURE); + } + exit(EXIT_SUCCESS); + } + + /* If we have a process serial number and it's our only arg, act as if + * the user double clicked the app bundle: launch app_to_run if possible + */ + if(argc == 1 || (argc == 2 && !strncmp(argv[1], "-psn_", 5))) { + /* Now, try to open a display, if so, run the launcher */ + display = XOpenDisplay(NULL); + if(display) { + /* Could open the display, start the launcher */ + XCloseDisplay(display); + + return execute(command_from_prefs("app_to_run", DEFAULT_CLIENT)); + } + } + + /* Start the server */ + if((s = getenv("DISPLAY"))) { + fprintf(stderr, "X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting). Starting X server.\n", s); + unsetenv("DISPLAY"); + + /* This tells X11Controller to not use the environment's DISPLAY and reset it based on the server's display */ + xquartz_resetenv_display = 1; + } else { + fprintf(stderr, "X11.app: Could not connect to server (DISPLAY is not set). Starting X server.\n"); + } + return execute(command_from_prefs("startx_script", DEFAULT_STARTX)); +} + +/** Setup the environment we want our child processes to inherit */ +static void ensure_path(const char *dir) { + char buf[1024], *temp; + + /* Make sure /usr/X11/bin is in the $PATH */ + temp = getenv("PATH"); + if(temp == NULL || temp[0] == 0) { + snprintf(buf, sizeof(buf), "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:%s", dir); + setenv("PATH", buf, TRUE); + } else if(strnstr(temp, X11BINDIR, sizeof(temp)) == NULL) { + snprintf(buf, sizeof(buf), "%s:%s", temp, dir); + setenv("PATH", buf, TRUE); + } +} + +static void setup_env() { + char *temp; + const char *pds = NULL; + + /* Pass on our prefs domain to startx and its inheritors (mainly for + * quartz-wm and the Xquartz stub's MachIPC) + */ + CFBundleRef bundle = CFBundleGetMainBundle(); + if(bundle) { + CFStringRef pd = CFBundleGetIdentifier(bundle); + if(pd) { + pds = CFStringGetCStringPtr(pd, 0); + if(pds) { + server_bootstrap_name = malloc(sizeof(char) * (strlen(pds) + 1)); + strcpy(server_bootstrap_name, pds); + setenv("X11_PREFS_DOMAIN", pds, 1); + } + } + } + + /* If we're not org.x.X11, we want to unset DISPLAY, so we don't + * use the launchd DISPLAY socket. + */ + if(pds == NULL || strcmp(pds, "org.x.X11") != 0) + unsetenv("DISPLAY"); + + /* Make sure PATH is right */ + ensure_path(X11BINDIR); + + /* cd $HOME */ + temp = getenv("HOME"); + if(temp != NULL && temp[0] != '\0') + chdir(temp); +} + +/*** Main ***/ +int main(int argc, char **argv, char **envp) { + Bool listenOnly = FALSE; + int i; + mach_msg_size_t mxmsgsz = sizeof(union MaxMsgSize) + MAX_TRAILER_SIZE; + mach_port_t mp; + kern_return_t kr; + + /* Setup our environment for our children */ + setup_env(); + + /* The server must not run the PanoramiX operations. */ + noPanoramiXExtension = TRUE; + + /* Setup the initial crasherporter info */ + strlcpy(__crashreporter_info__, __crashreporter_info__base, __crashreporter_info__len); + + fprintf(stderr, "X11.app: main(): argc=%d\n", argc); + for(i=0; i < argc; i++) { + fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]); + if(!strcmp(argv[i], "--listenonly")) { + listenOnly = TRUE; + } + } + + mp = checkin_or_register(server_bootstrap_name); + if(mp == MACH_PORT_NULL) { + fprintf(stderr, "NULL mach service: %s", server_bootstrap_name); + return EXIT_FAILURE; + } + + /* Check if we need to do something other than listen, and make another + * thread handle it. + */ + if(!listenOnly) { + if(fork() == 0) { + return startup_trigger(argc, argv, envp); + } + } + + /* Main event loop */ + fprintf(stderr, "Waiting for startup parameters via Mach IPC.\n"); + kr = mach_msg_server(mach_startup_server, mxmsgsz, mp, 0); + if (kr != KERN_SUCCESS) { + fprintf(stderr, "org.x.X11(mp): %s\n", mach_error_string(kr)); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} + +static int execute(const char *command) { + const char *newargv[4]; + const char **p; + + newargv[0] = command_from_prefs("login_shell", DEFAULT_SHELL); + newargv[1] = "-c"; + newargv[2] = command; + newargv[3] = NULL; + + fprintf(stderr, "X11.app: Launching %s:\n", command); + for(p=newargv; *p; p++) { + fprintf(stderr, "\targv[%ld] = %s\n", (long int)(p - newargv), *p); + } + + execvp (newargv[0], (char * const *) newargv); + perror ("X11.app: Couldn't exec."); + return(1); +} + +static char *command_from_prefs(const char *key, const char *default_value) { + char *command = NULL; + + CFStringRef cfKey = CFStringCreateWithCString(NULL, key, kCFStringEncodingASCII); + CFPropertyListRef PlistRef = CFPreferencesCopyAppValue(cfKey, kCFPreferencesCurrentApplication); + + if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) { + CFStringRef cfDefaultValue = CFStringCreateWithCString(NULL, default_value, kCFStringEncodingASCII); + + CFPreferencesSetAppValue(cfKey, cfDefaultValue, kCFPreferencesCurrentApplication); + CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication); + + int len = strlen(default_value) + 1; + command = (char *)malloc(len * sizeof(char)); + if(!command) + return NULL; + strcpy(command, default_value); + } else { + int len = CFStringGetLength((CFStringRef)PlistRef) + 1; + command = (char *)malloc(len * sizeof(char)); + if(!command) + return NULL; + CFStringGetCString((CFStringRef)PlistRef, command, len, kCFStringEncodingASCII); + } + + if (PlistRef) + CFRelease(PlistRef); + + return command; +} diff --git a/xorg-server/hw/xquartz/mach-startup/launchd_fd.c b/xorg-server/hw/xquartz/mach-startup/launchd_fd.c new file mode 100644 index 000000000..44a243a58 --- /dev/null +++ b/xorg-server/hw/xquartz/mach-startup/launchd_fd.c @@ -0,0 +1,82 @@ +/* Copyright (c) 2008 Apple Inc. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT + * HOLDER(S) 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(s) of the above + * copyright holders shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization. + */ + +#include <launch.h> +#include <stdio.h> +#include <errno.h> + +#include "launchd_fd.h" + +int launchd_display_fd() { + launch_data_t sockets_dict, checkin_request, checkin_response; + launch_data_t listening_fd_array, listening_fd; + + /* Get launchd fd */ + if ((checkin_request = launch_data_new_string(LAUNCH_KEY_CHECKIN)) == NULL) { + fprintf(stderr,"launch_data_new_string(\"" LAUNCH_KEY_CHECKIN "\") Unable to create string.\n"); + return ERROR_FD; + } + + if ((checkin_response = launch_msg(checkin_request)) == NULL) { + fprintf(stderr,"launch_msg(\"" LAUNCH_KEY_CHECKIN "\") IPC failure: %s\n",strerror(errno)); + return ERROR_FD; + } + + if (LAUNCH_DATA_ERRNO == launch_data_get_type(checkin_response)) { + // ignore EACCES, which is common if we weren't started by launchd + if (launch_data_get_errno(checkin_response) != EACCES) + fprintf(stderr,"launchd check-in failed: %s\n", strerror(launch_data_get_errno(checkin_response))); + return ERROR_FD; + } + + sockets_dict = launch_data_dict_lookup(checkin_response, LAUNCH_JOBKEY_SOCKETS); + if (NULL == sockets_dict) { + fprintf(stderr,"launchd check-in: no sockets found to answer requests on!\n"); + return ERROR_FD; + } + + if (launch_data_dict_get_count(sockets_dict) > 1) { + fprintf(stderr,"launchd check-in: some sockets will be ignored!\n"); + return ERROR_FD; + } + + listening_fd_array = launch_data_dict_lookup(sockets_dict, ":0"); + if (NULL == listening_fd_array) { + fprintf(stderr,"launchd check-in: No known sockets found to answer requests on!\n"); + return ERROR_FD; + } + + if (launch_data_array_get_count(listening_fd_array)!=1) { + fprintf(stderr,"launchd check-in: Expected 1 socket from launchd, got %u)\n", + (unsigned)launch_data_array_get_count(listening_fd_array)); + return ERROR_FD; + } + + listening_fd=launch_data_array_get_index(listening_fd_array, 0); + return launch_data_get_fd(listening_fd); +} diff --git a/xorg-server/hw/xquartz/mach-startup/launchd_fd.h b/xorg-server/hw/xquartz/mach-startup/launchd_fd.h new file mode 100644 index 000000000..5083fae21 --- /dev/null +++ b/xorg-server/hw/xquartz/mach-startup/launchd_fd.h @@ -0,0 +1,36 @@ +/* Copyright (c) 2008 Apple Inc. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT + * HOLDER(S) 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(s) of the above + * copyright holders shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization. + */ + +#ifndef _XQUARTZ_LAUNCHD_FD_H_ +#define _XQUARTZ_LAUNCHD_FD_H_ + +#define ERROR_FD -1 + +int launchd_display_fd(void); + +#endif /* _XQUARTZ_LAUNCHD_FD_H_ */
\ No newline at end of file diff --git a/xorg-server/hw/xquartz/mach-startup/mach_startup.defs b/xorg-server/hw/xquartz/mach-startup/mach_startup.defs new file mode 100644 index 000000000..e47f49c3c --- /dev/null +++ b/xorg-server/hw/xquartz/mach-startup/mach_startup.defs @@ -0,0 +1,50 @@ +/* Copyright (c) 2008 Apple Inc. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT + * HOLDER(S) 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(s) of the above + * copyright holders shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization. + */ + +#include <mach/std_types.defs> +#include <mach/mach_types.defs> +import "mach_startup_types.h"; + +subsystem mach_startup 1000; +serverprefix do_; + +type string_t = c_string[1024]; +type string_array_t = array[] of string_t; + +routine start_x11_server( + port : mach_port_t; + argv : string_array_t; + envp : string_array_t); + +routine request_fd_handoff_socket ( + port : mach_port_t; + out socket_filename : string_t); + +routine request_pid ( + port : mach_port_t; + out pid : int); diff --git a/xorg-server/hw/xquartz/mach-startup/mach_startup_types.h b/xorg-server/hw/xquartz/mach-startup/mach_startup_types.h new file mode 100644 index 000000000..459c750db --- /dev/null +++ b/xorg-server/hw/xquartz/mach-startup/mach_startup_types.h @@ -0,0 +1,9 @@ +#ifndef _MACH_STARTUP_TYPES_H_ +#define _MACH_STARTUP_TYPES_H_ + +#define STRING_T_SIZE 1024 + +typedef char string_t[STRING_T_SIZE]; +typedef string_t * string_array_t; + +#endif diff --git a/xorg-server/hw/xquartz/mach-startup/stub.c b/xorg-server/hw/xquartz/mach-startup/stub.c new file mode 100644 index 000000000..893d19c8d --- /dev/null +++ b/xorg-server/hw/xquartz/mach-startup/stub.c @@ -0,0 +1,345 @@ +/* Copyright (c) 2008 Apple Inc. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT + * HOLDER(S) 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(s) of the above + * copyright holders shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization. + */ + +#include <CoreServices/CoreServices.h> + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <string.h> +#include <stdio.h> +#include <unistd.h> +#include <errno.h> + +#include <sys/socket.h> +#include <sys/un.h> + +static char *server_bootstrap_name = "org.x.X11"; + +/* The launchd startup is only designed for the primary X11.app that is + * org.x.X11... server_bootstrap_name might be differnet if we were triggered to + * start by another X11.app. + */ +#define kX11AppBundleId "org.x.X11" +#define kX11AppBundlePath "/Contents/MacOS/X11" + +#include <mach/mach.h> +#include <mach/mach_error.h> +#include <servers/bootstrap.h> +#include "mach_startup.h" + +#include <signal.h> + +#include <AvailabilityMacros.h> + +#include "launchd_fd.h" + +#ifndef BUILD_DATE +#define BUILD_DATE "?" +#endif +#ifndef XSERVER_VERSION +#define XSERVER_VERSION "?" +#endif + +#define DEBUG 1 + +static char x11_path[PATH_MAX + 1]; + +static pid_t x11app_pid = 0; + +static void set_x11_path() { +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 + + CFURLRef appURL = NULL; + CFBundleRef bundle = NULL; + OSStatus osstatus = LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(kX11AppBundleId), nil, nil, &appURL); + UInt32 ver; + + switch (osstatus) { + case noErr: + if (appURL == NULL) { + fprintf(stderr, "Xquartz: Invalid response from LSFindApplicationForInfo(%s)\n", + kX11AppBundleId); + exit(1); + } + + bundle = CFBundleCreate(NULL, appURL); + if(!bundle) { + fprintf(stderr, "Xquartz: Null value returned from CFBundleCreate().\n"); + exit(2); + } + + if (!CFURLGetFileSystemRepresentation(appURL, true, (unsigned char *)x11_path, sizeof(x11_path))) { + fprintf(stderr, "Xquartz: Error resolving URL for %s\n", kX11AppBundleId); + exit(3); + } + + ver = CFBundleGetVersionNumber(bundle); + if(ver < 0x02308000) { + CFStringRef versionStr = CFBundleGetValueForInfoDictionaryKey(bundle, kCFBundleVersionKey); + const char * versionCStr = "Unknown"; + + if(versionStr) + versionCStr = CFStringGetCStringPtr(versionStr, kCFStringEncodingMacRoman); + + fprintf(stderr, "Xquartz: Could not find a new enough X11.app LSFindApplicationForInfo() returned\n"); + fprintf(stderr, " X11.app = %s\n", x11_path); + fprintf(stderr, " Version = %s (%x), Expected Version > 2.3.0\n", versionCStr, (unsigned)ver); + exit(9); + } + + strlcat(x11_path, kX11AppBundlePath, sizeof(x11_path)); +#ifdef DEBUG + fprintf(stderr, "Xquartz: X11.app = %s\n", x11_path); +#endif + break; + case kLSApplicationNotFoundErr: + fprintf(stderr, "Xquartz: Unable to find application for %s\n", kX11AppBundleId); + exit(10); + default: + fprintf(stderr, "Xquartz: Unable to find application for %s, error code = %d\n", + kX11AppBundleId, (int)osstatus); + exit(11); + } +#else + /* TODO: Make Tiger smarter... but TBH, this should never get called on Tiger... */ + strlcpy(x11_path, "/Applications/Utilities/X11.app/Contents/MacOS/X11", sizeof(x11_path)); +#endif +} + +static int connect_to_socket(const char *filename) { + struct sockaddr_un servaddr_un; + struct sockaddr *servaddr; + socklen_t servaddr_len; + int ret_fd; + + /* Setup servaddr_un */ + memset (&servaddr_un, 0, sizeof (struct sockaddr_un)); + servaddr_un.sun_family = AF_UNIX; + strlcpy(servaddr_un.sun_path, filename, sizeof(servaddr_un.sun_path)); + + servaddr = (struct sockaddr *) &servaddr_un; + servaddr_len = sizeof(struct sockaddr_un) - sizeof(servaddr_un.sun_path) + strlen(filename); + + ret_fd = socket(PF_UNIX, SOCK_STREAM, 0); + if(ret_fd == -1) { + fprintf(stderr, "Xquartz: Failed to create socket: %s - %s\n", filename, strerror(errno)); + return -1; + } + + if(connect(ret_fd, servaddr, servaddr_len) < 0) { + fprintf(stderr, "Xquartz: Failed to connect to socket: %s - %d - %s\n", filename, errno, strerror(errno)); + close(ret_fd); + return -1; + } + + return ret_fd; +} + +static void send_fd_handoff(int connected_fd, int launchd_fd) { + char databuf[] = "display"; + struct iovec iov[1]; + + iov[0].iov_base = databuf; + iov[0].iov_len = sizeof(databuf); + + union { + struct cmsghdr hdr; + char bytes[CMSG_SPACE(sizeof(int))]; + } buf; + + struct msghdr msg; + msg.msg_iov = iov; + msg.msg_iovlen = 1; + msg.msg_control = buf.bytes; + msg.msg_controllen = sizeof(buf); + msg.msg_name = 0; + msg.msg_namelen = 0; + msg.msg_flags = 0; + + struct cmsghdr *cmsg = CMSG_FIRSTHDR (&msg); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(int)); + + msg.msg_controllen = cmsg->cmsg_len; + + *((int*)CMSG_DATA(cmsg)) = launchd_fd; + + if(sendmsg(connected_fd, &msg, 0) < 0) { + fprintf(stderr, "Xquartz: Error sending $DISPLAY file descriptor over fd %d: %d -- %s\n", connected_fd, errno, strerror(errno)); + return; + } + +#ifdef DEBUG + fprintf(stderr, "Xquartz: Message sent. Closing handoff fd.\n"); +#endif + + close(connected_fd); +} + +static void signal_handler(int sig) { + if(x11app_pid) + kill(x11app_pid, sig); + _exit(0); +} + +int main(int argc, char **argv, char **envp) { + int envpc; + kern_return_t kr; + mach_port_t mp; + string_array_t newenvp; + string_array_t newargv; + size_t i; + int launchd_fd; + string_t handoff_socket_filename; + sig_t handler; + + if(argc == 2 && !strcmp(argv[1], "-version")) { + fprintf(stderr, "X.org Release 7.3\n"); + fprintf(stderr, "X.Org X Server %s\n", XSERVER_VERSION); + fprintf(stderr, "Build Date: %s\n", BUILD_DATE); + return EXIT_SUCCESS; + } + + if(getenv("X11_PREFS_DOMAIN")) + server_bootstrap_name = getenv("X11_PREFS_DOMAIN"); + + /* We don't have a mechanism in place to handle this interrupt driven + * server-start notification, so just send the signal now, so xinit doesn't + * time out waiting for it and will just poll for the server. + */ + handler = signal(SIGUSR1, SIG_IGN); + if(handler == SIG_IGN) + kill(getppid(), SIGUSR1); + signal(SIGUSR1, handler); + + /* Pass on SIGs to X11.app */ + signal(SIGINT, signal_handler); + signal(SIGTERM, signal_handler); + + /* Get the $DISPLAY FD */ + launchd_fd = launchd_display_fd(); + + kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp); + if(kr != KERN_SUCCESS) { + set_x11_path(); + + /* This forking is ugly and will be cleaned up later */ + pid_t child = fork(); + if(child == -1) { + fprintf(stderr, "Xquartz: Could not fork: %s\n", strerror(errno)); + return EXIT_FAILURE; + } + + if(child == 0) { + char *_argv[3]; + _argv[0] = x11_path; + _argv[1] = "--listenonly"; + _argv[2] = NULL; + fprintf(stderr, "Xquartz: Starting X server: %s --listenonly\n", x11_path); + return execvp(x11_path, _argv); + } + + /* Try connecting for 10 seconds */ + for(i=0; i < 80; i++) { + usleep(250000); + kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp); + if(kr == KERN_SUCCESS) + break; + } + + if(kr != KERN_SUCCESS) { +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 + fprintf(stderr, "Xquartz: bootstrap_look_up(): %s\n", bootstrap_strerror(kr)); +#else + fprintf(stderr, "Xquartz: bootstrap_look_up(): %ul\n", (unsigned long)kr); +#endif + return EXIT_FAILURE; + } + } + + /* Get X11.app's pid */ + request_pid(mp, &x11app_pid); + + /* Handoff the $DISPLAY FD */ + if(launchd_fd != -1) { + size_t try, try_max; + int handoff_fd = -1; + + for(try=0, try_max=5; try < try_max; try++) { + if(request_fd_handoff_socket(mp, handoff_socket_filename) != KERN_SUCCESS) { + fprintf(stderr, "Xquartz: Failed to request a socket from the server to send the $DISPLAY fd over (try %d of %d)\n", (int)try+1, (int)try_max); + continue; + } + + handoff_fd = connect_to_socket(handoff_socket_filename); + if(handoff_fd == -1) { + fprintf(stderr, "Xquartz: Failed to connect to socket (try %d of %d)\n", (int)try+1, (int)try_max); + continue; + } + +#ifdef DEBUG + fprintf(stderr, "Xquartz: Handoff connection established (try %d of %d) on fd %d, \"%s\". Sending message.\n", (int)try+1, (int)try_max, handoff_fd, handoff_socket_filename); +#endif + + send_fd_handoff(handoff_fd, launchd_fd); + close(handoff_fd); + break; + } + } + + /* Count envp */ + for(envpc=0; envp[envpc]; envpc++); + + /* We have fixed-size string lengths due to limitations in IPC, + * so we need to copy our argv and envp. + */ + newargv = (string_array_t)alloca(argc * sizeof(string_t)); + newenvp = (string_array_t)alloca(envpc * sizeof(string_t)); + + if(!newargv || !newenvp) { + fprintf(stderr, "Xquartz: Memory allocation failure\n"); + exit(EXIT_FAILURE); + } + + for(i=0; i < argc; i++) { + strlcpy(newargv[i], argv[i], STRING_T_SIZE); + } + for(i=0; i < envpc; i++) { + strlcpy(newenvp[i], envp[i], STRING_T_SIZE); + } + + kr = start_x11_server(mp, newargv, argc, newenvp, envpc); + if (kr != KERN_SUCCESS) { + fprintf(stderr, "Xquartz: start_x11_server: %s\n", mach_error_string(kr)); + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +} diff --git a/xorg-server/hw/xquartz/pbproxy/Makefile.am b/xorg-server/hw/xquartz/pbproxy/Makefile.am new file mode 100644 index 000000000..e1c537fbb --- /dev/null +++ b/xorg-server/hw/xquartz/pbproxy/Makefile.am @@ -0,0 +1,23 @@ +AM_CPPFLAGS=-F/System/Library/Frameworks/ApplicationServices.framework/Frameworks +AM_CFLAGS=$(XPBPROXY_CFLAGS) + +noinst_LTLIBRARIES = libxpbproxy.la +libxpbproxy_la_SOURCES = \ + trick_autotools.c \ + main.m \ + x-input.m \ + x-selection.m + +libxpbproxy_la_LDFLAGS=$(XPBPROXY_LIBS) + +if STANDALONE_XPBPROXY + +bin_PROGRAMS = xpbproxy +xpbproxy_SOURCES = app-main.m +xpbproxy_LDADD = libxpbproxy.la + +endif + +EXTRA_DIST = \ + pbproxy.h \ + x-selection.h diff --git a/xorg-server/hw/xquartz/pbproxy/Makefile.in b/xorg-server/hw/xquartz/pbproxy/Makefile.in new file mode 100644 index 000000000..b31445e39 --- /dev/null +++ b/xorg-server/hw/xquartz/pbproxy/Makefile.in @@ -0,0 +1,698 @@ +# Makefile.in generated by automake 1.10.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@STANDALONE_XPBPROXY_TRUE@bin_PROGRAMS = xpbproxy$(EXEEXT) +subdir = hw/xquartz/pbproxy +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ + $(top_builddir)/include/xorg-server.h \ + $(top_builddir)/include/dix-config.h \ + $(top_builddir)/include/xorg-config.h \ + $(top_builddir)/include/xkb-config.h \ + $(top_builddir)/include/xwin-config.h \ + $(top_builddir)/include/kdrive-config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libxpbproxy_la_LIBADD = +am_libxpbproxy_la_OBJECTS = trick_autotools.lo main.lo x-input.lo \ + x-selection.lo +libxpbproxy_la_OBJECTS = $(am_libxpbproxy_la_OBJECTS) +libxpbproxy_la_LINK = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) \ + $(libxpbproxy_la_LDFLAGS) $(LDFLAGS) -o $@ +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am__xpbproxy_SOURCES_DIST = app-main.m +@STANDALONE_XPBPROXY_TRUE@am_xpbproxy_OBJECTS = app-main.$(OBJEXT) +xpbproxy_OBJECTS = $(am_xpbproxy_OBJECTS) +@STANDALONE_XPBPROXY_TRUE@xpbproxy_DEPENDENCIES = libxpbproxy.la +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +OBJCCOMPILE = $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) +LTOBJCCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) +OBJCLD = $(OBJC) +SOURCES = $(libxpbproxy_la_SOURCES) $(xpbproxy_SOURCES) +DIST_SOURCES = $(libxpbproxy_la_SOURCES) $(am__xpbproxy_SOURCES_DIST) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ +ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@ +APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ +APP_MAN_DIR = @APP_MAN_DIR@ +APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASE_FONT_PATH = @BASE_FONT_PATH@ +BUILD_DATE = @BUILD_DATE@ +BUILD_TIME = @BUILD_TIME@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DARWIN_LIBS = @DARWIN_LIBS@ +DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_LIBS = @DBUS_LIBS@ +DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ +DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ +DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DGA_CFLAGS = @DGA_CFLAGS@ +DGA_LIBS = @DGA_LIBS@ +DIX_CFLAGS = @DIX_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ +DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ +DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ +DMXMODULES_LIBS = @DMXMODULES_LIBS@ +DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ +DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ +DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ +DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ +DOLT_BASH = @DOLT_BASH@ +DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ +DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ +DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ +DRIPROTO_LIBS = @DRIPROTO_LIBS@ +DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ +DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ +DSYMUTIL = @DSYMUTIL@ +DTRACE = @DTRACE@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILE_MAN_DIR = @FILE_MAN_DIR@ +FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ +GLX_DEFINES = @GLX_DEFINES@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +GREP = @GREP@ +HAL_CFLAGS = @HAL_CFLAGS@ +HAL_LIBS = @HAL_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ +KDRIVE_INCS = @KDRIVE_INCS@ +KDRIVE_LIBS = @KDRIVE_LIBS@ +KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ +KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ +KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ +LIBDRM_LIBS = @LIBDRM_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_MAN_DIR = @LIB_MAN_DIR@ +LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ +LINUXDOC = @LINUXDOC@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTCOMPILE = @LTCOMPILE@ +LTCXXCOMPILE = @LTCXXCOMPILE@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MAKE_HTML = @MAKE_HTML@ +MAKE_PDF = @MAKE_PDF@ +MAKE_PS = @MAKE_PS@ +MAKE_TEXT = @MAKE_TEXT@ +MESA_SOURCE = @MESA_SOURCE@ +MISC_MAN_DIR = @MISC_MAN_DIR@ +MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCCLD = @OBJCCLD@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJCLINK = @OBJCLINK@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ +PCIACCESS_LIBS = @PCIACCESS_LIBS@ +PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ +PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +PROJECTROOT = @PROJECTROOT@ +PS2PDF = @PS2PDF@ +RANLIB = @RANLIB@ +RAWCPP = @RAWCPP@ +RAWCPPFLAGS = @RAWCPPFLAGS@ +SED = @SED@ +SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@ +SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ +STRIP = @STRIP@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ +VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@ +VENDOR_NAME = @VENDOR_NAME@ +VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ +VENDOR_RELEASE = @VENDOR_RELEASE@ +VERSION = @VERSION@ +X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ +X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ +XDMCP_CFLAGS = @XDMCP_CFLAGS@ +XDMCP_LIBS = @XDMCP_LIBS@ +XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ +XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ +XDMX_CFLAGS = @XDMX_CFLAGS@ +XDMX_LIBS = @XDMX_LIBS@ +XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ +XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ +XEPHYR_INCS = @XEPHYR_INCS@ +XEPHYR_LIBS = @XEPHYR_LIBS@ +XF86CONFIGFILE = @XF86CONFIGFILE@ +XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ +XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ +XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ +XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ +XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ +XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ +XLIB_CFLAGS = @XLIB_CFLAGS@ +XLIB_LIBS = @XLIB_LIBS@ +XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ +XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ +XNEST_LIBS = @XNEST_LIBS@ +XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ +XORG_CFLAGS = @XORG_CFLAGS@ +XORG_INCS = @XORG_INCS@ +XORG_LIBS = @XORG_LIBS@ +XORG_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@ +XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ +XPBPROXY_LIBS = @XPBPROXY_LIBS@ +XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ +XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ +XSDL_INCS = @XSDL_INCS@ +XSDL_LIBS = @XSDL_LIBS@ +XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ +XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ +XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ +XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ +XSERVER_LIBS = @XSERVER_LIBS@ +XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ +XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ +XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ +XVFB_LIBS = @XVFB_LIBS@ +XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ +XWINMODULES_LIBS = @XWINMODULES_LIBS@ +XWIN_LIBS = @XWIN_LIBS@ +XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ +XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +__XCONFIGFILE__ = @__XCONFIGFILE__@ +abi_ansic = @abi_ansic@ +abi_extension = @abi_extension@ +abi_font = @abi_font@ +abi_videodrv = @abi_videodrv@ +abi_xinput = @abi_xinput@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +driverdir = @driverdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +extdir = @extdir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +logdir = @logdir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +moduledir = @moduledir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sdkdir = @sdkdir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks +AM_CFLAGS = $(XPBPROXY_CFLAGS) +noinst_LTLIBRARIES = libxpbproxy.la +libxpbproxy_la_SOURCES = \ + trick_autotools.c \ + main.m \ + x-input.m \ + x-selection.m + +libxpbproxy_la_LDFLAGS = $(XPBPROXY_LIBS) +@STANDALONE_XPBPROXY_TRUE@xpbproxy_SOURCES = app-main.m +@STANDALONE_XPBPROXY_TRUE@xpbproxy_LDADD = libxpbproxy.la +EXTRA_DIST = \ + pbproxy.h \ + x-selection.h + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .m .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/xquartz/pbproxy/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/xquartz/pbproxy/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libxpbproxy.la: $(libxpbproxy_la_OBJECTS) $(libxpbproxy_la_DEPENDENCIES) + $(libxpbproxy_la_LINK) $(libxpbproxy_la_OBJECTS) $(libxpbproxy_la_LIBADD) $(LIBS) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +xpbproxy$(EXEEXT): $(xpbproxy_OBJECTS) $(xpbproxy_DEPENDENCIES) + @rm -f xpbproxy$(EXEEXT) + $(OBJCLINK) $(xpbproxy_OBJECTS) $(xpbproxy_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/app-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trick_autotools.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x-input.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x-selection.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +.m.o: +@am__fastdepOBJC_TRUE@ $(OBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepOBJC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepOBJC_FALSE@ $(OBJCCOMPILE) -c -o $@ $< + +.m.obj: +@am__fastdepOBJC_TRUE@ $(OBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepOBJC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepOBJC_FALSE@ $(OBJCCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.m.lo: +@am__fastdepOBJC_TRUE@ $(LTOBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepOBJC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepOBJC_FALSE@ $(LTOBJCCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool \ + clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool clean-noinstLTLIBRARIES ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/xorg-server/hw/xquartz/pbproxy/app-main.m b/xorg-server/hw/xquartz/pbproxy/app-main.m new file mode 100644 index 000000000..cb0fa5744 --- /dev/null +++ b/xorg-server/hw/xquartz/pbproxy/app-main.m @@ -0,0 +1,92 @@ +/* app-main.m + Copyright (c) 2002, 2008 Apple Computer, 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, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT + HOLDER(S) 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(s) of the above + copyright holders shall not be used in advertising or otherwise to + promote the sale, use or other dealings in this Software without + prior written authorization. + */ + +#include "pbproxy.h" +#import "x-selection.h" + +#include <pthread.h> +#include <unistd.h> /*for getpid*/ +#include <Cocoa/Cocoa.h> + +static const char *app_prefs_domain = "org.x.X11"; +CFStringRef app_prefs_domain_cfstr; + +char *display = NULL; + +static void signal_handler (int sig) { + switch(sig) { + case SIGHUP: + xpbproxy_prefs_reload = YES; + break; + default: + _exit(EXIT_SUCCESS); + } +} + +int main (int argc, const char *argv[]) { +#ifdef DEBUG + printf("pid: %u\n", getpid()); +#endif + + xpbproxy_is_standalone = YES; + + if((s = getenv("X11_PREFS_DOMAIN"))) + app_prefs_domain = s; + + for (i = 1; i < argc; i++) { + if(strcmp (argv[i], "--prefs-domain") == 0 && i+1 < argc) { + app_prefs_domain = argv[++i]; + } else if (strcmp (argv[i], "--help") == 0) { + printf("usage: xpbproxy OPTIONS\n" + "Pasteboard proxying for X11.\n\n" + "--prefs-domain <domain> Change the domain used for reading preferences\n" + " (default: org.x.X11)\n"); + return 0; + } else { + fprintf(stderr, "usage: xpbproxy OPTIONS...\n" + "Try 'xpbproxy --help' for more information.\n"); + return 1; + } + } + + app_prefs_domain_cfstr = CFStringCreateWithCString(NULL, app_prefs_domain, kCFStringEncodingUTF8); + + if(!xpbproxy_init()) + return EXIT_FAILURE; + + signal (SIGINT, signal_handler); + signal (SIGTERM, signal_handler); + signal (SIGHUP, signal_handler); + signal (SIGPIPE, SIG_IGN); + + [NSApplication sharedApplication]; + [NSApp run]; + + return EXIT_SUCCESS; +} diff --git a/xorg-server/hw/xquartz/pbproxy/main.m b/xorg-server/hw/xquartz/pbproxy/main.m new file mode 100644 index 000000000..5bc518243 --- /dev/null +++ b/xorg-server/hw/xquartz/pbproxy/main.m @@ -0,0 +1,164 @@ +/* main.m + Copyright (c) 2002, 2008 Apple Computer, 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, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT + HOLDER(S) 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(s) of the above + copyright holders shall not be used in advertising or otherwise to + promote the sale, use or other dealings in this Software without + prior written authorization. + */ + +#include "pbproxy.h" +#import "x-selection.h" + +#include <pthread.h> +#include <unistd.h> +#include <X11/extensions/applewm.h> + +Display *xpbproxy_dpy; +int xpbproxy_apple_wm_event_base, xpbproxy_apple_wm_error_base; +int xpbproxy_xfixes_event_base, xpbproxy_xfixes_error_base; +BOOL xpbproxy_have_xfixes; + +extern char *display; + +#ifdef STANDALONE_XPBPROXY +BOOL xpbproxy_is_standalone = NO; +#endif + +x_selection *_selection_object; + +static int x_io_error_handler (Display *dpy) { + /* We lost our connection to the server. */ + + TRACE (); + + /* trigger the thread to restart? + * NO - this would be to a "deeper" problem, and restarts would just + * make things worse... + */ +#ifdef STANDALONE_XPBPROXY + if(xpbproxy_is_standalone) + exit(EXIT_FAILURE); +#endif + + return 0; +} + +static int x_error_handler (Display *dpy, XErrorEvent *errevent) { + return 0; +} + +static inline pthread_t create_thread(void *func, void *arg) { + pthread_attr_t attr; + pthread_t tid; + + pthread_attr_init(&attr); + pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_create(&tid, &attr, func, arg); + pthread_attr_destroy(&attr); + + return tid; +} + +static void *xpbproxy_x_thread(void *args) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + size_t i; + + for(i=0, xpbproxy_dpy=NULL; !xpbproxy_dpy && i<5; i++) { + xpbproxy_dpy = XOpenDisplay(NULL); + + if(!xpbproxy_dpy && display) { + char _display[32]; + snprintf(_display, sizeof(_display), ":%s", display); + setenv("DISPLAY", _display, TRUE); + + xpbproxy_dpy=XOpenDisplay(_display); + } + if(!xpbproxy_dpy) + sleep(1); + } + + if (xpbproxy_dpy == NULL) { + fprintf (stderr, "xpbproxy: can't open default display\n"); + [pool release]; + return NULL; + } + + XSetIOErrorHandler (x_io_error_handler); + XSetErrorHandler (x_error_handler); + + if (!XAppleWMQueryExtension (xpbproxy_dpy, &xpbproxy_apple_wm_event_base, + &xpbproxy_apple_wm_error_base)) { + fprintf (stderr, "xpbproxy: can't open AppleWM server extension\n"); + [pool release]; + return NULL; + } + + xpbproxy_have_xfixes = XFixesQueryExtension(xpbproxy_dpy, &xpbproxy_xfixes_event_base, &xpbproxy_xfixes_error_base); + + XAppleWMSelectInput (xpbproxy_dpy, AppleWMActivationNotifyMask | + AppleWMPasteboardNotifyMask); + + _selection_object = [[x_selection alloc] init]; + + if(!xpbproxy_input_register()) { + [pool release]; + return NULL; + } + + [pool release]; + + xpbproxy_input_loop(); + return NULL; +} + +BOOL xpbproxy_init (void) { + create_thread(xpbproxy_x_thread, NULL); + return TRUE; +} + +id xpbproxy_selection_object (void) { + return _selection_object; +} + +Time xpbproxy_current_timestamp (void) { + /* FIXME: may want to fetch a timestamp from the server.. */ + return CurrentTime; +} + +void debug_printf (const char *fmt, ...) { + static int spew = -1; + + if (spew == -1) { + char *x = getenv ("DEBUG"); + spew = (x != NULL && atoi (x) != 0); + } + + if (spew) { + va_list args; + va_start(args, fmt); + vfprintf (stderr, fmt, args); + va_end(args); + } +} diff --git a/xorg-server/hw/xquartz/pbproxy/pbproxy.h b/xorg-server/hw/xquartz/pbproxy/pbproxy.h new file mode 100644 index 000000000..a6798efea --- /dev/null +++ b/xorg-server/hw/xquartz/pbproxy/pbproxy.h @@ -0,0 +1,91 @@ +/* pbproxy.h + Copyright (c) 2002, 2008 Apple Computer, 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, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT + HOLDER(S) 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(s) of the above + copyright holders shall not be used in advertising or otherwise to + promote the sale, use or other dealings in this Software without + prior written authorization. +*/ + +#ifndef PBPROXY_H +#define PBPROXY_H 1 + +#import <Foundation/Foundation.h> + +#include <AvailabilityMacros.h> +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050 +#if __LP64__ || NS_BUILD_32_LIKE_64 +typedef long NSInteger; +typedef unsigned long NSUInteger; +#else +typedef int NSInteger; +typedef unsigned int NSUInteger; +#endif +#endif + +#define Cursor X_Cursor +#undef _SHAPE_H_ +#include <X11/Xlib.h> +#include <X11/extensions/shape.h> +#undef Cursor + +#ifdef STANDALONE_XPBPROXY +/* Just used for the standalone to respond to SIGHUP to reload prefs */ +extern BOOL xpbproxy_prefs_reload; + +/* Setting this to YES (for the standalone app) causes us to ignore the + * 'sync_pasteboard' defaults preference since we assume it to be on... this is + * mainly useful for debugging/developing xpbproxy with XQuartz still running. + * Just disable the one in the server with X11's preference pane, then run + * the standalone app. + */ +extern BOOL xpbproxy_is_standalone; +#endif + +/* from main.m */ +extern void xpbproxy_set_is_active (BOOL state); +extern BOOL xpbproxy_get_is_active (void); +extern id xpbproxy_selection_object (void); +extern Time xpbproxy_current_timestamp (void); +extern BOOL xpbproxy_init (void); + +extern Display *xpbproxy_dpy; +extern int xpbproxy_apple_wm_event_base, xpbproxy_apple_wm_error_base; +extern int xpbproxy_xfixes_event_base, xpbproxy_xfixes_error_base; +extern BOOL xpbproxy_have_xfixes; + +/* from x-input.m */ +extern BOOL xpbproxy_input_register (void); +extern void xpbproxy_input_loop(); + +#ifdef DEBUG +/* BEWARE: this can cause a string memory leak, according to the leaks program. */ +# define DB(msg, args...) debug_printf("%s:%s:%d " msg, __FILE__, __FUNCTION__, __LINE__, ##args) +#else +# define DB(msg, args...) do {} while (0) +#endif + +#define TRACE() DB("TRACE\n") +extern void debug_printf (const char *fmt, ...); + +#endif /* PBPROXY_H */ diff --git a/xorg-server/hw/xquartz/pbproxy/trick_autotools.c b/xorg-server/hw/xquartz/pbproxy/trick_autotools.c new file mode 100644 index 000000000..a38f077b1 --- /dev/null +++ b/xorg-server/hw/xquartz/pbproxy/trick_autotools.c @@ -0,0 +1,3 @@ +int this_is_just_here_to_make_automake_work() { + return 0; +} diff --git a/xorg-server/hw/xquartz/pbproxy/x-input.m b/xorg-server/hw/xquartz/pbproxy/x-input.m new file mode 100644 index 000000000..6ba30c610 --- /dev/null +++ b/xorg-server/hw/xquartz/pbproxy/x-input.m @@ -0,0 +1,187 @@ +/* x-input.m -- event handling + Copyright (c) 2002, 2008 Apple Computer, 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, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT + HOLDER(S) 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(s) of the above + copyright holders shall not be used in advertising or otherwise to + promote the sale, use or other dealings in this Software without + prior written authorization. + */ + +#include "pbproxy.h" +#import "x-selection.h" + +#include <CoreFoundation/CFSocket.h> +#include <CoreFoundation/CFRunLoop.h> + +#include <X11/Xatom.h> +#include <X11/keysym.h> +#include <X11/extensions/applewm.h> + +#include <unistd.h> + +#include <pthread.h> + +static CFRunLoopSourceRef xpbproxy_dpy_source; + +#ifdef STANDALONE_XPBPROXY +BOOL xpbproxy_prefs_reload = NO; +#endif + +static pthread_mutex_t xpbproxy_dpy_rdy_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_cond_t xpbproxy_dpy_rdy_cond = PTHREAD_COND_INITIALIZER; + +/* Timestamp when the X server last told us it's active */ +static Time last_activation_time; + +static void x_event_apple_wm_notify(XAppleWMNotifyEvent *e) { + int type = e->type - xpbproxy_apple_wm_event_base; + int kind = e->kind; + + /* We want to reload prefs even if we're not active */ + if(type == AppleWMActivationNotify && + kind == AppleWMReloadPreferences) + [xpbproxy_selection_object() reload_preferences]; + + if(![xpbproxy_selection_object() is_active]) + return; + + switch (type) { + case AppleWMActivationNotify: + switch (kind) { + case AppleWMIsActive: + last_activation_time = e->time; + [xpbproxy_selection_object() x_active:e->time]; + break; + + case AppleWMIsInactive: + [xpbproxy_selection_object() x_inactive:e->time]; + break; + } + break; + + case AppleWMPasteboardNotify: + switch (kind) { + case AppleWMCopyToPasteboard: + [xpbproxy_selection_object() x_copy:e->time]; + } + break; + } +} + +void xpbproxy_input_loop() { + pthread_mutex_lock(&xpbproxy_dpy_rdy_lock); + while(true) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + if(pool == nil) { + fprintf(stderr, "unable to allocate/init auto release pool!\n"); + break; + } + + while (XPending(xpbproxy_dpy) != 0) { + XEvent e; + + pthread_mutex_unlock(&xpbproxy_dpy_rdy_lock); + XNextEvent (xpbproxy_dpy, &e); + + switch (e.type) { + case SelectionClear: + if([xpbproxy_selection_object() is_active]) + [xpbproxy_selection_object () clear_event:&e.xselectionclear]; + break; + + case SelectionRequest: + [xpbproxy_selection_object () request_event:&e.xselectionrequest]; + break; + + case SelectionNotify: + [xpbproxy_selection_object () notify_event:&e.xselection]; + break; + + case PropertyNotify: + [xpbproxy_selection_object () property_event:&e.xproperty]; + break; + + default: + if(e.type >= xpbproxy_apple_wm_event_base && + e.type < xpbproxy_apple_wm_event_base + AppleWMNumberEvents) { + x_event_apple_wm_notify((XAppleWMNotifyEvent *) &e); + } else if(e.type == xpbproxy_xfixes_event_base + XFixesSelectionNotify) { + [xpbproxy_selection_object() xfixes_selection_notify:(XFixesSelectionNotifyEvent *)&e]; + } + break; + } + + XFlush(xpbproxy_dpy); + pthread_mutex_lock(&xpbproxy_dpy_rdy_lock); + } + + [pool release]; + + pthread_cond_wait(&xpbproxy_dpy_rdy_cond, &xpbproxy_dpy_rdy_lock); + } +} + +static BOOL add_input_socket (int sock, CFOptionFlags callback_types, + CFSocketCallBack callback, const CFSocketContext *ctx, + CFRunLoopSourceRef *cf_source) { + CFSocketRef cf_sock; + + cf_sock = CFSocketCreateWithNative (kCFAllocatorDefault, sock, + callback_types, callback, ctx); + if (cf_sock == NULL) { + close (sock); + return FALSE; + } + + *cf_source = CFSocketCreateRunLoopSource (kCFAllocatorDefault, + cf_sock, 0); + CFRelease (cf_sock); + + if (*cf_source == NULL) + return FALSE; + + CFRunLoopAddSource (CFRunLoopGetMain (), + *cf_source, kCFRunLoopDefaultMode); + return TRUE; +} + +static void x_input_callback (CFSocketRef sock, CFSocketCallBackType type, + CFDataRef address, const void *data, void *info) { + +#ifdef STANDALONE_XPBPROXY + if(xpbproxy_prefs_reload) { + [xpbproxy_selection_object() reload_preferences]; + xpbproxy_prefs_reload = NO; + } +#endif + + pthread_mutex_lock(&xpbproxy_dpy_rdy_lock); + pthread_cond_broadcast(&xpbproxy_dpy_rdy_cond); + pthread_mutex_unlock(&xpbproxy_dpy_rdy_lock); +} + +BOOL xpbproxy_input_register(void) { + return add_input_socket(ConnectionNumber(xpbproxy_dpy), kCFSocketReadCallBack, + x_input_callback, NULL, &xpbproxy_dpy_source); +} diff --git a/xorg-server/hw/xquartz/pbproxy/x-selection.h b/xorg-server/hw/xquartz/pbproxy/x-selection.h new file mode 100644 index 000000000..d5bfcb5e7 --- /dev/null +++ b/xorg-server/hw/xquartz/pbproxy/x-selection.h @@ -0,0 +1,116 @@ +/* x-selection.h -- proxies between NSPasteboard and X11 selections + + Copyright (c) 2002, 2008 Apple Computer, 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, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT + HOLDER(S) 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(s) of the above + copyright holders shall not be used in advertising or otherwise to + promote the sale, use or other dealings in this Software without + prior written authorization. +*/ + +#ifndef X_SELECTION_H +#define X_SELECTION_H 1 + +#include "pbproxy.h" + +#include <X11/extensions/Xfixes.h> + +#include <AppKit/NSPasteboard.h> + +/* This stores image data or text. */ +struct propdata { + unsigned char *data; + size_t length; +}; + +struct atom_list { + Atom primary, clipboard, text, utf8_string, string, targets, multiple, + cstring, image_png, image_jpeg, incr, atom, clipboard_manager, + compound_text, atom_pair; +}; + + +@interface x_selection : NSObject +{ +@private + + /* The unmapped window we use for fetching selections. */ + Window _selection_window; + + /* Last time we declared anything on the pasteboard. */ + int _my_last_change; + + /* Name of the selection we're proxying onto the pasteboard. */ + Atom _proxied_selection; + + /* When true, we're expecting a SelectionNotify event. */ + unsigned int _pending_notify :1; + + Atom request_atom; + + struct { + struct propdata propdata; + Window requestor; + Atom selection; + } pending; + + /* + * This is the number of times the user has requested a copy. + * Once the copy is completed, we --pending_copy, and if the + * pending_copy is > 0 we do it again. + */ + int pending_copy; + /* + * This is used for the same purpose as pending_copy, but for the + * CLIPBOARD. It also prevents a race with INCR transfers. + */ + int pending_clipboard; + + struct atom_list atoms[1]; +} + +- (void) x_active:(Time)timestamp; +- (void) x_inactive:(Time)timestamp; + +- (void) x_copy:(Time)timestamp; + +- (void) clear_event:(XSelectionClearEvent *)e; +- (void) request_event:(XSelectionRequestEvent *)e; +- (void) notify_event:(XSelectionEvent *)e; +- (void) property_event:(XPropertyEvent *)e; +- (void) xfixes_selection_notify:(XFixesSelectionNotifyEvent *)e; +- (void) handle_selection:(Atom)selection type:(Atom)type propdata:(struct propdata *)pdata; +- (void) claim_clipboard; +- (BOOL) set_clipboard_manager_status:(BOOL)value; +- (void) own_clipboard; +- (void) copy_completed:(Atom)selection; + +- (void) reload_preferences; +- (BOOL) is_active; +- (void) send_none:(XSelectionRequestEvent *)e; +@end + +/* main.m */ +extern x_selection *_selection_object; + +#endif /* X_SELECTION_H */ diff --git a/xorg-server/hw/xquartz/pbproxy/x-selection.m b/xorg-server/hw/xquartz/pbproxy/x-selection.m new file mode 100644 index 000000000..cd540be98 --- /dev/null +++ b/xorg-server/hw/xquartz/pbproxy/x-selection.m @@ -0,0 +1,1545 @@ +/* x-selection.m -- proxies between NSPasteboard and X11 selections + + Copyright (c) 2002, 2008 Apple Computer, 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, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT + HOLDER(S) 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(s) of the above + copyright holders shall not be used in advertising or otherwise to + promote the sale, use or other dealings in this Software without + prior written authorization. +*/ + +#import "x-selection.h" + +#include <stdio.h> +#include <stdlib.h> +#include <X11/Xatom.h> +#include <X11/Xutil.h> +#import <AppKit/NSGraphics.h> +#import <AppKit/NSImage.h> +#import <AppKit/NSBitmapImageRep.h> + +/* + * The basic design of the pbproxy code is as follows. + * + * When a client selects text, say from an xterm - we only copy it when the + * X11 Edit->Copy menu item is pressed or the shortcut activated. In this + * case we take the PRIMARY selection, and set it as the NSPasteboard data. + * + * When an X11 client copies something to the CLIPBOARD, pbproxy greedily grabs + * the data, sets it as the NSPasteboard data, and finally sets itself as + * owner of the CLIPBOARD. + * + * When an X11 window is activated we check to see if the NSPasteboard has + * changed. If the NSPasteboard has changed, then we set pbproxy as owner + * of the PRIMARY and CLIPBOARD and respond to requests for text and images. + * + * The behavior is now dynamic since the information above was written. + * The behavior is now dependent on the pbproxy_prefs below. + */ + +/* + * TODO: + * 1. handle MULTIPLE - I need to study the ICCCM further, and find a test app. + * 2. Handle NSPasteboard updates immediately, not on active/inactive + * - Open xterm, run 'cat readme.txt | pbcopy' + */ + +static struct { + BOOL active ; + BOOL primary_on_grab; /* This is provided as an option for people who + * want it and has issues that won't ever be + * addressed to make it *always* work. + */ + BOOL clipboard_to_pasteboard; + BOOL pasteboard_to_primary; + BOOL pasteboard_to_clipboard; +} pbproxy_prefs = { YES, NO, YES, YES, YES }; + +@implementation x_selection + +static struct propdata null_propdata = {NULL, 0}; + +#ifdef DEBUG +static void +dump_prefs (FILE *fp) { + fprintf(fp, + "pbproxy preferences:\n" + "\tactive %u\n" + "\tprimary_on_grab %u\n" + "\tclipboard_to_pasteboard %u\n" + "\tpasteboard_to_primary %u\n" + "\tpasteboard_to_clipboard %u\n", + pbproxy_prefs.active, + pbproxy_prefs.primary_on_grab, + pbproxy_prefs.clipboard_to_pasteboard, + pbproxy_prefs.pasteboard_to_primary, + pbproxy_prefs.pasteboard_to_clipboard); +} +#endif + +extern CFStringRef app_prefs_domain_cfstr; + +static BOOL +prefs_get_bool (CFStringRef key, BOOL defaultValue) { + Boolean value, ok; + + value = CFPreferencesGetAppBooleanValue (key, app_prefs_domain_cfstr, &ok); + + return ok ? (BOOL) value : defaultValue; +} + +static void +init_propdata (struct propdata *pdata) +{ + *pdata = null_propdata; +} + +static void +free_propdata (struct propdata *pdata) +{ + free (pdata->data); + *pdata = null_propdata; +} + +/* + * Return True if an error occurs. Return False if pdata has data + * and we finished. + * The property is only deleted when bytesleft is 0 if delete is True. + */ +static Bool +get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Atom *type) +{ + long offset = 0; + unsigned long numitems, bytesleft = 0; +#ifdef TEST + /* This is used to test the growth handling. */ + unsigned long length = 4UL; +#else + unsigned long length = (100000UL + 3) / 4; +#endif + unsigned char *buf = NULL, *chunk = NULL; + size_t buflen = 0, chunkbytesize = 0; + int format; + + TRACE (); + + if(None == property) + return True; + + do + { + unsigned long newbuflen = 0; + unsigned char *newbuf = NULL; + +#ifdef TEST + printf("bytesleft %lu\n", bytesleft); +#endif + + if (Success != XGetWindowProperty (xpbproxy_dpy, win, property, + offset, length, delete, + AnyPropertyType, + type, &format, &numitems, + &bytesleft, &chunk)) + { + DB ("Error while getting window property.\n"); + *pdata = null_propdata; + free (buf); + return True; + } + +#ifdef TEST + printf("format %d numitems %lu bytesleft %lu\n", + format, numitems, bytesleft); + + printf("type %s\n", XGetAtomName (xpbproxy_dpy, *type)); +#endif + + /* Format is the number of bits. */ + chunkbytesize = numitems * (format / 8); + +#ifdef TEST + printf("chunkbytesize %zu\n", chunkbytesize); +#endif + newbuflen = buflen + chunkbytesize; + if (newbuflen > 0) + { + newbuf = realloc (buf, newbuflen); + + if (NULL == newbuf) + { + XFree (chunk); + free (buf); + return True; + } + + memcpy (newbuf + buflen, chunk, chunkbytesize); + XFree (chunk); + buf = newbuf; + buflen = newbuflen; + /* offset is a multiple of 32 bits*/ + offset += chunkbytesize / 4; + } + else + { + if (chunk) + XFree (chunk); + } + +#ifdef TEST + printf("bytesleft %lu\n", bytesleft); +#endif + } while (bytesleft > 0); + + pdata->data = buf; + pdata->length = buflen; + + return /*success*/ False; +} + + +/* Implementation methods */ + +/* This finds the preferred type from a TARGETS list.*/ +- (Atom) find_preferred:(struct propdata *)pdata +{ + Atom a = None; + size_t i; + Bool png = False, jpeg = False, utf8 = False, string = False; + + TRACE (); + + if (pdata->length % sizeof (a)) + { + fprintf(stderr, "Atom list is not a multiple of the size of an atom!\n"); + return None; + } + + for (i = 0; i < pdata->length; i += sizeof (a)) + { + a = None; + memcpy (&a, pdata->data + i, sizeof (a)); + + if (a == atoms->image_png) + { + png = True; + } + else if (a == atoms->image_jpeg) + { + jpeg = True; + } + else if (a == atoms->utf8_string) + { + utf8 = True; + } + else if (a == atoms->string) + { + string = True; + } + else + { + char *type = XGetAtomName(xpbproxy_dpy, a); + if (type) + { + DB("Unhandled X11 mime type: %s", type); + XFree(type); + } + } + } + + /*We prefer PNG over strings, and UTF8 over a Latin-1 string.*/ + if (png) + return atoms->image_png; + + if (jpeg) + return atoms->image_jpeg; + + if (utf8) + return atoms->utf8_string; + + if (string) + return atoms->string; + + /* This is evidently something we don't know how to handle.*/ + return None; +} + +/* Return True if this is an INCR-style transfer. */ +- (Bool) is_incr_type:(XSelectionEvent *)e +{ + Atom seltype; + int format; + unsigned long numitems = 0UL, bytesleft = 0UL; + unsigned char *chunk; + + TRACE (); + + if (Success != XGetWindowProperty (xpbproxy_dpy, e->requestor, e->property, + /*offset*/ 0L, /*length*/ 4UL, + /*Delete*/ False, + AnyPropertyType, &seltype, &format, + &numitems, &bytesleft, &chunk)) + { + return False; + } + + if(chunk) + XFree(chunk); + + return (seltype == atoms->incr) ? True : False; +} + +/* + * This should be called after a selection has been copied, + * or when the selection is unfinished before a transfer completes. + */ +- (void) release_pending +{ + TRACE (); + + free_propdata (&pending.propdata); + pending.requestor = None; + pending.selection = None; +} + +/* Return True if an error occurs during an append.*/ +/* Return False if the append succeeds. */ +- (Bool) append_to_pending:(struct propdata *)pdata requestor:(Window)requestor +{ + unsigned char *newdata; + size_t newlength; + + TRACE (); + + if (requestor != pending.requestor) + { + [self release_pending]; + pending.requestor = requestor; + } + + newlength = pending.propdata.length + pdata->length; + newdata = realloc(pending.propdata.data, newlength); + + if(NULL == newdata) + { + perror("realloc propdata"); + [self release_pending]; + return True; + } + + memcpy(newdata + pending.propdata.length, pdata->data, pdata->length); + pending.propdata.data = newdata; + pending.propdata.length = newlength; + + return False; +} + + + +/* Called when X11 becomes active (i.e. has key focus) */ +- (void) x_active:(Time)timestamp +{ + static NSInteger changeCount; + NSInteger countNow; + NSPasteboard *pb; + + TRACE (); + + pb = [NSPasteboard generalPasteboard]; + + if (nil == pb) + return; + + countNow = [pb changeCount]; + + if (countNow != changeCount) + { + DB ("changed pasteboard!\n"); + changeCount = countNow; + + if (pbproxy_prefs.pasteboard_to_primary) + { + XSetSelectionOwner (xpbproxy_dpy, atoms->primary, _selection_window, CurrentTime); + } + + if (pbproxy_prefs.pasteboard_to_clipboard) { + [self own_clipboard]; + } + } + +#if 0 + /*gstaplin: we should perhaps investigate something like this branch above...*/ + if ([_pasteboard availableTypeFromArray: _known_types] != nil) + { + /* Pasteboard has data we should proxy; I think it makes + sense to put it on both CLIPBOARD and PRIMARY */ + + XSetSelectionOwner (xpbproxy_dpy, atoms->clipboard, + _selection_window, timestamp); + XSetSelectionOwner (xpbproxy_dpy, atoms->primary, + _selection_window, timestamp); + } +#endif +} + +/* Called when X11 loses key focus */ +- (void) x_inactive:(Time)timestamp +{ + TRACE (); +} + +/* This requests the TARGETS list from the PRIMARY selection owner. */ +- (void) x_copy_request_targets +{ + TRACE (); + + request_atom = atoms->targets; + XConvertSelection (xpbproxy_dpy, atoms->primary, atoms->targets, + atoms->primary, _selection_window, CurrentTime); +} + +/* Called when the Edit/Copy item on the main X11 menubar is selected + * and no appkit window claims it. */ +- (void) x_copy:(Time)timestamp +{ + Window w; + + TRACE (); + + w = XGetSelectionOwner (xpbproxy_dpy, atoms->primary); + + if (None != w) + { + ++pending_copy; + + if (1 == pending_copy) { + /* + * There are no other copy operations in progress, so we + * can proceed safely. Otherwise the copy_completed method + * will see that the pending_copy is > 1, and do another copy. + */ + [self x_copy_request_targets]; + } + } + else + { + XBell (xpbproxy_dpy, 0); + } +} + +/* Set pbproxy as owner of the SELECTION_MANAGER selection. + * This prevents tools like xclipboard from causing havoc. + * Returns TRUE on success + */ +- (BOOL) set_clipboard_manager_status:(BOOL)value +{ + TRACE (); + + Window owner = XGetSelectionOwner (xpbproxy_dpy, atoms->clipboard_manager); + + if(value) { + if(owner == _selection_window) + return TRUE; + + if(owner != None) { + fprintf (stderr, "A clipboard manager using window 0x%lx " + "already owns the clipboard selection. " + "pbproxy will not sync clipboard to pasteboard.\n", owner); + return FALSE; + } + + XSetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager, _selection_window, CurrentTime); + return (_selection_window == XGetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager)); + } else { + if(owner != _selection_window) + return TRUE; + + XSetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager, None, CurrentTime); + return(None == XGetSelectionOwner(xpbproxy_dpy, atoms->clipboard_manager)); + } + + return FALSE; +} + +/* + * This occurs when we previously owned a selection, + * and then lost it from another client. + */ +- (void) clear_event:(XSelectionClearEvent *)e +{ + + + TRACE (); + + DB ("e->selection %s\n", XGetAtomName (xpbproxy_dpy, e->selection)); + + if(e->selection == atoms->clipboard) { + /* + * We lost ownership of the CLIPBOARD. + */ + ++pending_clipboard; + + if (1 == pending_clipboard) { + /* Claim the clipboard contents from the new owner. */ + [self claim_clipboard]; + } + } else if(e->selection == atoms->clipboard_manager) { + if(pbproxy_prefs.clipboard_to_pasteboard) { + /* Another CLIPBOARD_MANAGER has set itself as owner. Disable syncing + * to avoid a race. + */ + fprintf(stderr, "Another clipboard manager was started! " + "xpbproxy is disabling syncing with clipboard.\n"); + pbproxy_prefs.clipboard_to_pasteboard = NO; + } + } +} + +/* + * We greedily acquire the clipboard after it changes, and on startup. + */ +- (void) claim_clipboard +{ + Window owner; + + TRACE (); + + if (!pbproxy_prefs.clipboard_to_pasteboard) + return; + + owner = XGetSelectionOwner (xpbproxy_dpy, atoms->clipboard); + if (None == owner) { + /* + * The owner probably died or we are just starting up pbproxy. + * Set pbproxy's _selection_window as the owner, and continue. + */ + DB ("No clipboard owner.\n"); + [self copy_completed:atoms->clipboard]; + return; + } else if (owner == _selection_window) { + [self copy_completed:atoms->clipboard]; + return; + } + + DB ("requesting targets\n"); + + request_atom = atoms->targets; + XConvertSelection (xpbproxy_dpy, atoms->clipboard, atoms->targets, + atoms->clipboard, _selection_window, CurrentTime); + XFlush (xpbproxy_dpy); + /* Now we will get a SelectionNotify event in the future. */ +} + +/* Greedily acquire the clipboard. */ +- (void) own_clipboard +{ + + TRACE (); + + /* We should perhaps have a boundary limit on the number of iterations... */ + do + { + XSetSelectionOwner (xpbproxy_dpy, atoms->clipboard, _selection_window, + CurrentTime); + } while (_selection_window != XGetSelectionOwner (xpbproxy_dpy, + atoms->clipboard)); +} + +- (void) init_reply:(XEvent *)reply request:(XSelectionRequestEvent *)e +{ + reply->xselection.type = SelectionNotify; + reply->xselection.selection = e->selection; + reply->xselection.target = e->target; + reply->xselection.requestor = e->requestor; + reply->xselection.time = e->time; + reply->xselection.property = None; +} + +- (void) send_reply:(XEvent *)reply +{ + /* + * We are supposed to use an empty event mask, and not propagate + * the event, according to the ICCCM. + */ + DB ("reply->xselection.requestor 0x%lx\n", reply->xselection.requestor); + + XSendEvent (xpbproxy_dpy, reply->xselection.requestor, False, 0, reply); + XFlush (xpbproxy_dpy); +} + +/* + * This responds to a TARGETS request. + * The result is a list of a ATOMs that correspond to the types available + * for a selection. + * For instance an application might provide a UTF8_STRING and a STRING + * (in Latin-1 encoding). The requestor can then make the choice based on + * the list. + */ +- (void) send_targets:(XSelectionRequestEvent *)e pasteboard:(NSPasteboard *)pb +{ + XEvent reply; + NSArray *pbtypes; + + [self init_reply:&reply request:e]; + + pbtypes = [pb types]; + if (pbtypes) + { + long list[7]; /* Don't forget to increase this if we handle more types! */ + long count = 0; + + /* + * I'm not sure if this is needed, but some toolkits/clients list + * TARGETS in response to targets. + */ + list[count] = atoms->targets; + ++count; + + if ([pbtypes containsObject:NSStringPboardType]) + { + /* We have a string type that we can convert to UTF8, or Latin-1... */ + DB ("NSStringPboardType\n"); + list[count] = atoms->utf8_string; + ++count; + list[count] = atoms->string; + ++count; + list[count] = atoms->compound_text; + ++count; + } + + /* TODO add the NSPICTPboardType back again, once we have conversion + * functionality in send_image. + */ + + if ([pbtypes containsObject:NSPICTPboardType] + || [pbtypes containsObject:NSTIFFPboardType]) + { + /* We can convert a TIFF to a PNG or JPEG. */ + DB ("NSTIFFPboardType\n"); + list[count] = atoms->image_png; + ++count; + list[count] = atoms->image_jpeg; + ++count; + } + + if (count) + { + /* We have a list of ATOMs to send. */ + XChangeProperty (xpbproxy_dpy, e->requestor, e->property, atoms->atom, 32, + PropModeReplace, (unsigned char *) list, count); + + reply.xselection.property = e->property; + } + } + + [self send_reply:&reply]; +} + + +- (void) send_string:(XSelectionRequestEvent *)e utf8:(BOOL)utf8 pasteboard:(NSPasteboard *)pb +{ + XEvent reply; + NSArray *pbtypes; + NSString *data; + const char *bytes; + NSUInteger length; + + TRACE (); + + [self init_reply:&reply request:e]; + + pbtypes = [pb types]; + + if (![pbtypes containsObject:NSStringPboardType]) + { + [self send_reply:&reply]; + return; + } + + DB ("pbtypes retainCount after containsObject: %u\n", [pbtypes retainCount]); + + data = [pb stringForType:NSStringPboardType]; + + if (nil == data) + { + [self send_reply:&reply]; + return; + } + + if (utf8) + { + bytes = [data UTF8String]; + /* + * We don't want the UTF-8 string length here. + * We want the length in bytes. + */ + length = strlen (bytes); + + if (length < 50) { + DB ("UTF-8: %s\n", bytes); + DB ("UTF-8 length: %u\n", length); + } + } + else + { + DB ("Latin-1\n"); + bytes = [data cStringUsingEncoding:NSISOLatin1StringEncoding]; + /*WARNING: bytes is not NUL-terminated. */ + length = [data lengthOfBytesUsingEncoding:NSISOLatin1StringEncoding]; + } + + DB ("e->target %s\n", XGetAtomName (xpbproxy_dpy, e->target)); + + XChangeProperty (xpbproxy_dpy, e->requestor, e->property, e->target, + 8, PropModeReplace, (unsigned char *) bytes, length); + + reply.xselection.property = e->property; + + [self send_reply:&reply]; +} + +- (void) send_compound_text:(XSelectionRequestEvent *)e pasteboard:(NSPasteboard *)pb +{ + XEvent reply; + NSArray *pbtypes; + + TRACE (); + + [self init_reply:&reply request:e]; + + pbtypes = [pb types]; + + if ([pbtypes containsObject: NSStringPboardType]) + { + NSString *data = [pb stringForType:NSStringPboardType]; + if (nil != data) + { + /* + * Cast to (void *) to avoid a const warning. + * AFAIK Xutf8TextListToTextProperty does not modify the input memory. + */ + void *utf8 = (void *)[data UTF8String]; + char *list[] = { utf8, NULL }; + XTextProperty textprop; + + textprop.value = NULL; + + if (Success == Xutf8TextListToTextProperty (xpbproxy_dpy, list, 1, + XCompoundTextStyle, + &textprop)) + { + + if (8 != textprop.format) + DB ("textprop.format is unexpectedly not 8 - it's %d instead\n", + textprop.format); + + XChangeProperty (xpbproxy_dpy, e->requestor, e->property, + atoms->compound_text, textprop.format, + PropModeReplace, textprop.value, + textprop.nitems); + + reply.xselection.property = e->property; + } + + if (textprop.value) + XFree (textprop.value); + + } + } + + [self send_reply:&reply]; +} + +/* Finding a test application that uses MULTIPLE has proven to be difficult. */ +- (void) send_multiple:(XSelectionRequestEvent *)e +{ + XEvent reply; + + TRACE (); + + [self init_reply:&reply request:e]; + + if (None != e->property) + { + + } + + [self send_reply:&reply]; +} + +/* Return nil if an error occured. */ +/* DO NOT retain the encdata for longer than the length of an event response. + * The autorelease pool will reuse/free it. + */ +- (NSData *) encode_image_data:(NSData *)data type:(NSBitmapImageFileType)enctype +{ + NSBitmapImageRep *bmimage = nil; + NSData *encdata = nil; + NSDictionary *dict = nil; + + bmimage = [[NSBitmapImageRep alloc] initWithData:data]; + + if (nil == bmimage) + return nil; + + dict = [[NSDictionary alloc] init]; + encdata = [bmimage representationUsingType:enctype properties:dict]; + + if (nil == encdata) + { + [dict autorelease]; + [bmimage autorelease]; + return nil; + } + + [dict autorelease]; + [bmimage autorelease]; + + return encdata; +} + +/* Return YES when an error has occured when trying to send the PICT. */ +/* The caller should send a default reponse with a property of None when an error occurs. */ +- (BOOL) send_image_pict_reply:(XSelectionRequestEvent *)e + pasteboard:(NSPasteboard *)pb + type:(NSBitmapImageFileType)imagetype +{ + XEvent reply; + NSImage *img = nil; + NSData *data = nil, *encdata = nil; + NSUInteger length; + const void *bytes = NULL; + + img = [[NSImage alloc] initWithPasteboard:pb]; + + if (nil == img) + { + return YES; + } + + data = [img TIFFRepresentation]; + + if (nil == data) + { + [img autorelease]; + fprintf(stderr, "unable to convert PICT to TIFF!\n"); + return YES; + } + + encdata = [self encode_image_data:data type:imagetype]; + if(nil == encdata) + { + [img autorelease]; + return YES; + } + + [self init_reply:&reply request:e]; + + length = [encdata length]; + bytes = [encdata bytes]; + + XChangeProperty (xpbproxy_dpy, e->requestor, e->property, e->target, + 8, PropModeReplace, bytes, length); + reply.xselection.property = e->property; + + [self send_reply:&reply]; + + [img autorelease]; + + return NO; /*no error*/ +} + +/* Return YES if an error occured. */ +/* The caller should send a reply with a property of None when an error occurs. */ +- (BOOL) send_image_tiff_reply:(XSelectionRequestEvent *)e + pasteboard:(NSPasteboard *)pb + type:(NSBitmapImageFileType)imagetype +{ + XEvent reply; + NSData *data = nil; + NSData *encdata = nil; + NSUInteger length; + const void *bytes = NULL; + + data = [pb dataForType:NSTIFFPboardType]; + + if (nil == data) + return YES; + + encdata = [self encode_image_data:data type:imagetype]; + + if(nil == encdata) + return YES; + + [self init_reply:&reply request:e]; + + length = [encdata length]; + bytes = [encdata bytes]; + + XChangeProperty (xpbproxy_dpy, e->requestor, e->property, e->target, + 8, PropModeReplace, bytes, length); + reply.xselection.property = e->property; + + [self send_reply:&reply]; + + return NO; /*no error*/ +} + +- (void) send_image:(XSelectionRequestEvent *)e pasteboard:(NSPasteboard *)pb +{ + NSArray *pbtypes = nil; + NSBitmapImageFileType imagetype = NSPNGFileType; + + TRACE (); + + if (e->target == atoms->image_png) + imagetype = NSPNGFileType; + else if (e->target == atoms->image_jpeg) + imagetype = NSJPEGFileType; + else + { + fprintf(stderr, "internal failure in xpbproxy! imagetype being sent isn't PNG or JPEG.\n"); + } + + pbtypes = [pb types]; + + if (pbtypes) + { + if ([pbtypes containsObject:NSTIFFPboardType]) + { + if (NO == [self send_image_tiff_reply:e pasteboard:pb type:imagetype]) + return; + } + else if ([pbtypes containsObject:NSPICTPboardType]) + { + if (NO == [self send_image_pict_reply:e pasteboard:pb type:imagetype]) + return; + + /* Fall through intentionally to the send_none: */ + } + } + + [self send_none:e]; +} + +- (void)send_none:(XSelectionRequestEvent *)e +{ + XEvent reply; + + TRACE (); + + [self init_reply:&reply request:e]; + [self send_reply:&reply]; +} + + +/* Another client requested the data or targets of data available from the clipboard. */ +- (void)request_event:(XSelectionRequestEvent *)e +{ + NSPasteboard *pb; + + TRACE (); + + /* TODO We should also keep track of the time of the selection, and + * according to the ICCCM "refuse the request" if the event timestamp + * is before we owned it. + * What should we base the time on? How can we get the current time just + * before an XSetSelectionOwner? Is it the server's time, or the clients? + * According to the XSelectionRequestEvent manual page, the Time value + * may be set to CurrentTime or a time, so that makes it a bit different. + * Perhaps we should just punt and ignore races. + */ + + /*TODO we need a COMPOUND_TEXT test app*/ + /*TODO we need a MULTIPLE test app*/ + + pb = [NSPasteboard generalPasteboard]; + if (nil == pb) + { + [self send_none:e]; + return; + } + + + if (None != e->target) + DB ("e->target %s\n", XGetAtomName (xpbproxy_dpy, e->target)); + + if (e->target == atoms->targets) + { + /* The paste requestor wants to know what TARGETS we support. */ + [self send_targets:e pasteboard:pb]; + } + else if (e->target == atoms->multiple) + { + /* + * This isn't finished, and may never be, unless I can find + * a good test app. + */ + [self send_multiple:e]; + } + else if (e->target == atoms->utf8_string) + { + [self send_string:e utf8:YES pasteboard:pb]; + } + else if (e->target == atoms->string) + { + [self send_string:e utf8:NO pasteboard:pb]; + } + else if (e->target == atoms->compound_text) + { + [self send_compound_text:e pasteboard:pb]; + } + else if (e->target == atoms->multiple) + { + [self send_multiple:e]; + } + else if (e->target == atoms->image_png || e->target == atoms->image_jpeg) + { + [self send_image:e pasteboard:pb]; + } + else + { + [self send_none:e]; + } +} + +/* This handles the events resulting from an XConvertSelection request. */ +- (void) notify_event:(XSelectionEvent *)e +{ + Atom type; + struct propdata pdata; + + TRACE (); + + [self release_pending]; + + if (None == e->property) { + DB ("e->property is None.\n"); + [self copy_completed:e->selection]; + /* Nothing is selected. */ + return; + } + +#if 0 + printf ("e->selection %s\n", XGetAtomName (xpbproxy_dpy, e->selection)); + printf ("e->property %s\n", XGetAtomName (xpbproxy_dpy, e->property)); +#endif + + if ([self is_incr_type:e]) + { + /* + * This is an INCR-style transfer, which means that we + * will get the data after a series of PropertyNotify events. + */ + DB ("is INCR\n"); + + if (get_property (e->requestor, e->property, &pdata, /*Delete*/ True, &type)) + { + /* + * An error occured, so we should invoke the copy_completed:, but + * not handle_selection:type:propdata: + */ + [self copy_completed:e->selection]; + return; + } + + free_propdata (&pdata); + + pending.requestor = e->requestor; + pending.selection = e->selection; + + DB ("set pending.requestor to 0x%lx\n", pending.requestor); + } + else + { + if (get_property (e->requestor, e->property, &pdata, /*Delete*/ True, &type)) + { + [self copy_completed:e->selection]; + return; + } + + /* We have the complete selection data.*/ + [self handle_selection:e->selection type:type propdata:&pdata]; + + DB ("handled selection with the first notify_event\n"); + } +} + +/* This is used for INCR transfers. See the ICCCM for the details. */ +/* This is used to retrieve PRIMARY and CLIPBOARD selections. */ +- (void) property_event:(XPropertyEvent *)e +{ + struct propdata pdata; + Atom type; + + TRACE (); + + if (None != e->atom) + { +#ifdef DEBUG + char *name = XGetAtomName (xpbproxy_dpy, e->atom); + + if (name) + { + DB ("e->atom %s\n", name); + XFree(name); + } +#endif + } + + if (None != pending.requestor && PropertyNewValue == e->state) + { + DB ("pending.requestor 0x%lx\n", pending.requestor); + + if (get_property (e->window, e->atom, &pdata, /*Delete*/ True, &type)) + { + [self copy_completed:pending.selection]; + [self release_pending]; + return; + } + + if (0 == pdata.length) + { + /* + * We completed the transfer. + * handle_selection will call copy_completed: for us. + */ + [self handle_selection:pending.selection type:type propdata:&pending.propdata]; + free_propdata(&pdata); + pending.propdata = null_propdata; + pending.requestor = None; + pending.selection = None; + } + else + { + [self append_to_pending:&pdata requestor:e->window]; + free_propdata (&pdata); + } + } +} + +- (void) xfixes_selection_notify:(XFixesSelectionNotifyEvent *)e { + if(!pbproxy_prefs.active) + return; + + switch(e->subtype) { + case XFixesSetSelectionOwnerNotify: + if(e->selection == atoms->primary && pbproxy_prefs.primary_on_grab) + [self x_copy:e->timestamp]; + break; + + case XFixesSelectionWindowDestroyNotify: + case XFixesSelectionClientCloseNotify: + default: + fprintf(stderr, "Unhandled XFixesSelectionNotifyEvent: subtype=%d\n", e->subtype); + break; + } +} + +- (void) handle_targets: (Atom)selection propdata:(struct propdata *)pdata +{ + /* Find a type we can handle and prefer from the list of ATOMs. */ + Atom preferred; + char *name; + + TRACE (); + + preferred = [self find_preferred:pdata]; + + if (None == preferred) + { + /* + * This isn't required by the ICCCM, but some apps apparently + * don't respond to TARGETS properly. + */ + preferred = atoms->string; + } + + (void)name; /* Avoid a warning with non-debug compiles. */ +#ifdef DEBUG + name = XGetAtomName (xpbproxy_dpy, preferred); + + if (name) + { + DB ("requesting %s\n", name); + } +#endif + request_atom = preferred; + XConvertSelection (xpbproxy_dpy, selection, preferred, selection, + _selection_window, CurrentTime); +} + +/* This handles the image type of selection (typically in CLIPBOARD). */ +/* We convert to a TIFF, so that other applications can paste more easily. */ +- (void) handle_image: (struct propdata *)pdata pasteboard:(NSPasteboard *)pb +{ + NSArray *pbtypes; + NSUInteger length; + NSData *data, *tiff; + NSBitmapImageRep *bmimage; + + TRACE (); + + length = pdata->length; + data = [[NSData alloc] initWithBytes:pdata->data length:length]; + + if (nil == data) + { + DB ("unable to create NSData object!\n"); + return; + } + + DB ("data retainCount before NSBitmapImageRep initWithData: %u\n", + [data retainCount]); + + bmimage = [[NSBitmapImageRep alloc] initWithData:data]; + + if (nil == bmimage) + { + [data autorelease]; + DB ("unable to create NSBitmapImageRep!\n"); + return; + } + + DB ("data retainCount after NSBitmapImageRep initWithData: %u\n", + [data retainCount]); + + @try + { + tiff = [bmimage TIFFRepresentation]; + } + + @catch (NSException *e) + { + DB ("NSTIFFException!\n"); + [data autorelease]; + [bmimage autorelease]; + return; + } + + DB ("bmimage retainCount after TIFFRepresentation %u\n", [bmimage retainCount]); + + pbtypes = [NSArray arrayWithObjects:NSTIFFPboardType, nil]; + + if (nil == pbtypes) + { + [data autorelease]; + [bmimage autorelease]; + return; + } + + [pb declareTypes:pbtypes owner:nil]; + if (YES != [pb setData:tiff forType:NSTIFFPboardType]) + { + DB ("writing pasteboard data failed!\n"); + } + + [data autorelease]; + + DB ("bmimage retainCount before release %u\n", [bmimage retainCount]); + [bmimage autorelease]; +} + +/* This handles the UTF8_STRING type of selection. */ +- (void) handle_utf8_string:(struct propdata *)pdata pasteboard:(NSPasteboard *)pb +{ + NSString *string; + NSArray *pbtypes; + + TRACE (); + + string = [[NSString alloc] initWithBytes:pdata->data length:pdata->length encoding:NSUTF8StringEncoding]; + + if (nil == string) + return; + + pbtypes = [NSArray arrayWithObjects:NSStringPboardType, nil]; + + if (nil == pbtypes) + { + [string autorelease]; + return; + } + + [pb declareTypes:pbtypes owner:nil]; + + if (YES != [pb setString:string forType:NSStringPboardType]) { + fprintf(stderr, "pasteboard setString:forType: failed!\n"); + } + [string autorelease]; + DB ("done handling utf8 string\n"); +} + +/* This handles the STRING type, which should be in Latin-1. */ +- (void) handle_string: (struct propdata *)pdata pasteboard:(NSPasteboard *)pb +{ + NSString *string; + NSArray *pbtypes; + + TRACE (); + + string = [[NSString alloc] initWithBytes:pdata->data length:pdata->length encoding:NSISOLatin1StringEncoding]; + + if (nil == string) + return; + + pbtypes = [NSArray arrayWithObjects:NSStringPboardType, nil]; + + if (nil == pbtypes) + { + [string autorelease]; + return; + } + + [pb declareTypes:pbtypes owner:nil]; + if (YES != [pb setString:string forType:NSStringPboardType]) { + fprintf(stderr, "pasteboard setString:forType failed in handle_string!\n"); + } + [string autorelease]; +} + +/* This is called when the selection is completely retrieved from another client. */ +/* Warning: this frees the propdata. */ +- (void) handle_selection:(Atom)selection type:(Atom)type propdata:(struct propdata *)pdata +{ + NSPasteboard *pb; + + TRACE (); + + pb = [NSPasteboard generalPasteboard]; + + if (nil == pb) + { + [self copy_completed:selection]; + free_propdata (pdata); + return; + } + + /* + * Some apps it seems set the type to TARGETS instead of ATOM, such as Eterm. + * These aren't ICCCM compliant apps, but we need these to work... + */ + if (request_atom == atoms->targets + && (type == atoms->atom || type == atoms->targets)) + { + [self handle_targets:selection propdata:pdata]; + free_propdata(pdata); + return; + } + else if (type == atoms->image_png) + { + [self handle_image:pdata pasteboard:pb]; + } + else if (type == atoms->image_jpeg) + { + [self handle_image:pdata pasteboard:pb]; + } + else if (type == atoms->utf8_string) + { + [self handle_utf8_string:pdata pasteboard:pb]; + } + else if (type == atoms->string) + { + [self handle_string:pdata pasteboard:pb]; + } + + free_propdata(pdata); + + [self copy_completed:selection]; +} + + +- (void) copy_completed:(Atom)selection +{ + TRACE (); + char *name; + + (void)name; /* Avoid warning with non-debug compiles. */ +#ifdef DEBUG + name = XGetAtomName (xpbproxy_dpy, selection); + if (name) + { + DB ("copy_completed: %s\n", name); + XFree (name); + } +#endif + + if (selection == atoms->primary && pending_copy > 0) + { + --pending_copy; + if (pending_copy > 0) + { + /* Copy PRIMARY again. */ + [self x_copy_request_targets]; + return; + } + } + else if (selection == atoms->clipboard && pending_clipboard > 0) + { + --pending_clipboard; + if (pending_clipboard > 0) + { + /* Copy CLIPBOARD. */ + [self claim_clipboard]; + return; + } + else + { + /* We got the final data. Now set pbproxy as the owner. */ + [self own_clipboard]; + return; + } + } + + /* + * We had 1 or more primary in progress, and the clipboard arrived + * while we were busy. + */ + if (pending_clipboard > 0) + { + [self claim_clipboard]; + } +} + +- (void) reload_preferences +{ + /* + * It's uncertain how we could handle the synchronization failing, so cast to void. + * The prefs_get_bool should fall back to defaults if the org.x.X11 plist doesn't exist or is invalid. + */ + (void)CFPreferencesAppSynchronize(app_prefs_domain_cfstr); +#ifdef STANDALONE_XPBPROXY + if(xpbproxy_is_standalone) + pbproxy_prefs.active = YES; + else +#endif + pbproxy_prefs.active = prefs_get_bool(CFSTR("sync_pasteboard"), pbproxy_prefs.active); + pbproxy_prefs.primary_on_grab = prefs_get_bool(CFSTR("sync_primary_on_select"), pbproxy_prefs.primary_on_grab); + pbproxy_prefs.clipboard_to_pasteboard = prefs_get_bool(CFSTR("sync_clipboard_to_pasteboard"), pbproxy_prefs.clipboard_to_pasteboard); + pbproxy_prefs.pasteboard_to_primary = prefs_get_bool(CFSTR("sync_pasteboard_to_primary"), pbproxy_prefs.pasteboard_to_primary); + pbproxy_prefs.pasteboard_to_clipboard = prefs_get_bool(CFSTR("sync_pasteboard_to_clipboard"), pbproxy_prefs.pasteboard_to_clipboard); + + /* This is used for debugging. */ + //dump_prefs(stdout); + + if(pbproxy_prefs.active && pbproxy_prefs.primary_on_grab && !xpbproxy_have_xfixes) { + fprintf(stderr, "Disabling sync_primary_on_select functionality due to missing XFixes extension.\n"); + pbproxy_prefs.primary_on_grab = NO; + } + + /* Claim or release the CLIPBOARD_MANAGER atom */ + if(![self set_clipboard_manager_status:(pbproxy_prefs.active && pbproxy_prefs.clipboard_to_pasteboard)]) + pbproxy_prefs.clipboard_to_pasteboard = NO; + + if(pbproxy_prefs.active && pbproxy_prefs.clipboard_to_pasteboard) + [self claim_clipboard]; +} + +- (BOOL) is_active +{ + return pbproxy_prefs.active; +} + +/* NSPasteboard-required methods */ + +- (void) paste:(id)sender +{ + TRACE (); +} + +- (void) pasteboard:(NSPasteboard *)pb provideDataForType:(NSString *)type +{ + TRACE (); +} + +- (void) pasteboardChangedOwner:(NSPasteboard *)pb +{ + TRACE (); + + /* Right now we don't care with this. */ +} + +/* Allocation */ + +- init +{ + unsigned long pixel; + + self = [super init]; + if (self == nil) + return nil; + + atoms->primary = XInternAtom (xpbproxy_dpy, "PRIMARY", False); + atoms->clipboard = XInternAtom (xpbproxy_dpy, "CLIPBOARD", False); + atoms->text = XInternAtom (xpbproxy_dpy, "TEXT", False); + atoms->utf8_string = XInternAtom (xpbproxy_dpy, "UTF8_STRING", False); + atoms->string = XInternAtom (xpbproxy_dpy, "STRING", False); + atoms->targets = XInternAtom (xpbproxy_dpy, "TARGETS", False); + atoms->multiple = XInternAtom (xpbproxy_dpy, "MULTIPLE", False); + atoms->cstring = XInternAtom (xpbproxy_dpy, "CSTRING", False); + atoms->image_png = XInternAtom (xpbproxy_dpy, "image/png", False); + atoms->image_jpeg = XInternAtom (xpbproxy_dpy, "image/jpeg", False); + atoms->incr = XInternAtom (xpbproxy_dpy, "INCR", False); + atoms->atom = XInternAtom (xpbproxy_dpy, "ATOM", False); + atoms->clipboard_manager = XInternAtom (xpbproxy_dpy, "CLIPBOARD_MANAGER", False); + atoms->compound_text = XInternAtom (xpbproxy_dpy, "COMPOUND_TEXT", False); + atoms->atom_pair = XInternAtom (xpbproxy_dpy, "ATOM_PAIR", False); + + pixel = BlackPixel (xpbproxy_dpy, DefaultScreen (xpbproxy_dpy)); + _selection_window = XCreateSimpleWindow (xpbproxy_dpy, DefaultRootWindow (xpbproxy_dpy), + 0, 0, 1, 1, 0, pixel, pixel); + + /* This is used to get PropertyNotify events when doing INCR transfers. */ + XSelectInput (xpbproxy_dpy, _selection_window, PropertyChangeMask); + + request_atom = None; + + init_propdata (&pending.propdata); + pending.requestor = None; + pending.selection = None; + + pending_copy = 0; + pending_clipboard = 0; + + if(xpbproxy_have_xfixes) + XFixesSelectSelectionInput(xpbproxy_dpy, _selection_window, atoms->primary, + XFixesSetSelectionOwnerNotifyMask); + + [self reload_preferences]; + + return self; +} + +- (void) dealloc +{ + if (None != _selection_window) + { + XDestroyWindow (xpbproxy_dpy, _selection_window); + _selection_window = None; + } + + free_propdata (&pending.propdata); + + [super dealloc]; +} + +@end diff --git a/xorg-server/hw/xquartz/pseudoramiX.c b/xorg-server/hw/xquartz/pseudoramiX.c index 49d5eb6d4..f4ceff32b 100644 --- a/xorg-server/hw/xquartz/pseudoramiX.c +++ b/xorg-server/hw/xquartz/pseudoramiX.c @@ -37,6 +37,7 @@ Equipment Corporation. #include <dix-config.h> #endif +#include "darwin.h" #include "pseudoramiX.h" #include "extnsionst.h" #include "dixstruct.h" @@ -45,7 +46,6 @@ Equipment Corporation. #include "globals.h" Bool noPseudoramiXExtension = FALSE; -extern int noPanoramiXExtension; extern int ProcPanoramiXQueryVersion (ClientPtr client); @@ -99,6 +99,8 @@ PseudoramiXAddScreen(int x, int y, int w, int h) sizeof(PseudoramiXScreenRec)); } + DEBUG_LOG("x: %d, y: %d, w: %d, h: %d\n", x, y, w, h); + s = &pseudoramiXScreens[pseudoramiXNumScreens++]; s->x = x; s->y = y; @@ -116,6 +118,8 @@ void PseudoramiXExtensionInit(int argc, char *argv[]) if (noPseudoramiXExtension) return; + TRACE(); + /* Even with only one screen we need to enable PseudoramiX to allow dynamic screen configuration changes. */ #if 0 @@ -126,9 +130,6 @@ void PseudoramiXExtensionInit(int argc, char *argv[]) } #endif - // The server must not run the PanoramiX operations. - noPanoramiXExtension = TRUE; - if (pseudoramiXGeneration != serverGeneration) { extEntry = AddExtension(PANORAMIX_PROTOCOL_NAME, 0, 0, ProcPseudoramiXDispatch, @@ -153,12 +154,16 @@ void PseudoramiXExtensionInit(int argc, char *argv[]) void PseudoramiXResetScreens(void) { + TRACE(); + pseudoramiXNumScreens = 0; } static void PseudoramiXResetProc(ExtensionEntry *extEntry) { + TRACE(); + PseudoramiXResetScreens(); } @@ -166,6 +171,8 @@ static void PseudoramiXResetProc(ExtensionEntry *extEntry) // was PanoramiX static int ProcPseudoramiXQueryVersion(ClientPtr client) { + TRACE(); + return ProcPanoramiXQueryVersion(client); } @@ -178,6 +185,8 @@ static int ProcPseudoramiXGetState(ClientPtr client) xPanoramiXGetStateReply rep; register int n, rc; + TRACE(); + REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) @@ -205,6 +214,8 @@ static int ProcPseudoramiXGetScreenCount(ClientPtr client) xPanoramiXGetScreenCountReply rep; register int n, rc; + TRACE(); + REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) @@ -232,6 +243,8 @@ static int ProcPseudoramiXGetScreenSize(ClientPtr client) xPanoramiXGetScreenSizeReply rep; register int n, rc; + TRACE(); + REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) @@ -262,6 +275,8 @@ static int ProcPseudoramiXIsActive(ClientPtr client) /* REQUEST(xXineramaIsActiveReq); */ xXineramaIsActiveReply rep; + TRACE(); + REQUEST_SIZE_MATCH(xXineramaIsActiveReq); rep.type = X_Reply; @@ -285,6 +300,8 @@ static int ProcPseudoramiXQueryScreens(ClientPtr client) /* REQUEST(xXineramaQueryScreensReq); */ xXineramaQueryScreensReply rep; + DEBUG_LOG("noPseudoramiXExtension=%d, pseudoramiXNumScreens=%d\n", noPseudoramiXExtension, pseudoramiXNumScreens); + REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); rep.type = X_Reply; @@ -327,6 +344,7 @@ static int ProcPseudoramiXQueryScreens(ClientPtr client) // was PanoramiX static int ProcPseudoramiXDispatch (ClientPtr client) { REQUEST(xReq); + TRACE(); switch (stuff->data) { case X_PanoramiXQueryVersion: @@ -353,6 +371,8 @@ SProcPseudoramiXQueryVersion (ClientPtr client) REQUEST(xPanoramiXQueryVersionReq); register int n; + TRACE(); + swaps(&stuff->length,n); REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq); return ProcPseudoramiXQueryVersion(client); @@ -364,6 +384,8 @@ SProcPseudoramiXGetState(ClientPtr client) REQUEST(xPanoramiXGetStateReq); register int n; + TRACE(); + swaps (&stuff->length, n); REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); return ProcPseudoramiXGetState(client); @@ -375,6 +397,8 @@ SProcPseudoramiXGetScreenCount(ClientPtr client) REQUEST(xPanoramiXGetScreenCountReq); register int n; + TRACE(); + swaps (&stuff->length, n); REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); return ProcPseudoramiXGetScreenCount(client); @@ -386,6 +410,8 @@ SProcPseudoramiXGetScreenSize(ClientPtr client) REQUEST(xPanoramiXGetScreenSizeReq); register int n; + TRACE(); + swaps (&stuff->length, n); REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); return ProcPseudoramiXGetScreenSize(client); @@ -398,6 +424,8 @@ SProcPseudoramiXIsActive(ClientPtr client) REQUEST(xXineramaIsActiveReq); register int n; + TRACE(); + swaps (&stuff->length, n); REQUEST_SIZE_MATCH(xXineramaIsActiveReq); return ProcPseudoramiXIsActive(client); @@ -410,6 +438,8 @@ SProcPseudoramiXQueryScreens(ClientPtr client) REQUEST(xXineramaQueryScreensReq); register int n; + TRACE(); + swaps (&stuff->length, n); REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); return ProcPseudoramiXQueryScreens(client); @@ -419,6 +449,9 @@ SProcPseudoramiXQueryScreens(ClientPtr client) static int SProcPseudoramiXDispatch (ClientPtr client) { REQUEST(xReq); + + TRACE(); + switch (stuff->data) { case X_PanoramiXQueryVersion: diff --git a/xorg-server/hw/xquartz/quartz.c b/xorg-server/hw/xquartz/quartz.c index 6f42c538f..1f0b0048b 100644 --- a/xorg-server/hw/xquartz/quartz.c +++ b/xorg-server/hw/xquartz/quartz.c @@ -28,15 +28,17 @@ * use or other dealings in this Software without prior written authorization. */ +#include "sanitizedCarbon.h" + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif #include "quartzCommon.h" +#include "inputstr.h" #include "quartz.h" #include "darwin.h" #include "darwinEvents.h" -#include "quartzAudio.h" #include "pseudoramiX.h" #define _APPLEWM_SERVER_ #include "applewmExt.h" @@ -51,7 +53,7 @@ #include "windowstr.h" #include "colormapst.h" #include "globals.h" -#include "rootlessWindow.h" +#include "mi.h" // System headers #include <sys/types.h> @@ -59,20 +61,24 @@ #include <fcntl.h> #include <IOKit/pwr_mgt/IOPMLib.h> +#include <rootlessCommon.h> +#include <Xplugin.h> + #define FAKE_RANDR 1 // Shared global variables for Quartz modes int quartzEventWriteFD = -1; -int quartzRootless = -1; int quartzUseSysBeep = 0; int quartzUseAGL = 1; int quartzEnableKeyEquivalents = 1; -int quartzServerVisible = TRUE; +int quartzServerVisible = FALSE; int quartzServerQuitting = FALSE; -DevPrivateKey quartzScreenKey = &quartzScreenKey; +static int quartzScreenKeyIndex; +DevPrivateKey quartzScreenKey = &quartzScreenKeyIndex; int aquaMenuBarHeight = 0; QuartzModeProcsPtr quartzProcs = NULL; const char *quartzOpenGLBundle = NULL; +int quartzFullscreenDisableHotkeys = TRUE; #if defined(RANDR) && !defined(FAKE_RANDR) Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) { @@ -153,10 +159,6 @@ void QuartzInitOutput( int argc, char **argv ) { - if (serverGeneration == 0) { - QuartzAudioInit(); - } - if (!RegisterBlockAndWakeupHandlers(QuartzBlockHandler, QuartzWakeupHandler, NULL)) @@ -186,9 +188,8 @@ void QuartzInitInput( #ifdef FAKE_RANDR -extern char *ConnectionInfo; -static int padlength[4] = {0, 3, 2, 1}; +static const int padlength[4] = {0, 3, 2, 1}; static void RREditConnectionInfo (ScreenPtr pScreen) @@ -230,33 +231,27 @@ RREditConnectionInfo (ScreenPtr pScreen) } #endif -/* - * QuartzUpdateScreens - * Adjust for screen arrangement changes. - */ -static void QuartzUpdateScreens(void) -{ +static void QuartzUpdateScreens(void) { ScreenPtr pScreen; WindowPtr pRoot; int x, y, width, height, sx, sy; xEvent e; - - DEBUG_LOG("QuartzUpdateScreens()\n"); + if (noPseudoramiXExtension || screenInfo.numScreens != 1) { /* FIXME: if not using Xinerama, we have multiple screens, and - to do this properly may need to add or remove screens. Which - isn't possible. So don't do anything. Another reason why - we default to running with Xinerama. */ - + to do this properly may need to add or remove screens. Which + isn't possible. So don't do anything. Another reason why + we default to running with Xinerama. */ + return; } - + pScreen = screenInfo.screens[0]; - + PseudoramiXResetScreens(); quartzProcs->AddPseudoramiXScreens(&x, &y, &width, &height); - + dixScreenOrigins[pScreen->myNum].x = x; dixScreenOrigins[pScreen->myNum].y = y; pScreen->mmWidth = pScreen->mmWidth * ((double) width / pScreen->width); @@ -266,23 +261,25 @@ static void QuartzUpdateScreens(void) #ifndef FAKE_RANDR if(!QuartzRandRInit(pScreen)) - FatalError("Failed to init RandR extension.\n"); + FatalError("Failed to init RandR extension.\n"); #endif - + DarwinAdjustScreenOrigins(&screenInfo); quartzProcs->UpdateScreen(pScreen); - + sx = dixScreenOrigins[pScreen->myNum].x + darwinMainScreenX; sy = dixScreenOrigins[pScreen->myNum].y + darwinMainScreenY; - + /* Adjust the root window. */ pRoot = WindowTable[pScreen->myNum]; AppleWMSetScreenOrigin(pRoot); pScreen->ResizeWindow(pRoot, x - sx, y - sy, width, height, NULL); + //pScreen->PaintWindowBackground (pRoot, &pRoot->borderClip, PW_BACKGROUND); miPaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND); -// QuartzIgnoreNextWarpCursor(); DefineInitialRootWindow(pRoot); + DEBUG_LOG("Root Window: %dx%d @ (%d, %d) darwinMainScreen (%d, %d) xy (%d, %d) dixScreenOrigins (%d, %d)\n", width, height, x - sx, y - sy, darwinMainScreenX, darwinMainScreenY, x, y, dixScreenOrigins[pScreen->myNum].x, dixScreenOrigins[pScreen->myNum].y); + /* Send an event for the root reconfigure */ e.u.u.type = ConfigureNotify; e.u.configureNotify.window = pRoot->drawable.id; @@ -294,12 +291,73 @@ static void QuartzUpdateScreens(void) e.u.configureNotify.borderWidth = wBorderWidth(pRoot); e.u.configureNotify.override = pRoot->overrideRedirect; DeliverEvents(pRoot, &e, 1, NullWindow); - + #ifdef FAKE_RANDR RREditConnectionInfo(pScreen); -#endif +#endif +} + +/* + * QuartzDisplayChangeHandler + * Adjust for screen arrangement changes. + */ +void QuartzDisplayChangedHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) { + QuartzUpdateScreens(); } +void QuartzSetFullscreen(Bool state) { + + DEBUG_LOG("QuartzSetFullscreen: state=%d\n", state); + + if(quartzHasRoot == state) + return; + + quartzHasRoot = state; + + xp_disable_update (); + + if (!quartzHasRoot && !quartzEnableRootless) + RootlessHideAllWindows(); + + RootlessUpdateRooted(quartzHasRoot); + + if (quartzHasRoot && !quartzEnableRootless) + RootlessShowAllWindows (); + + if (quartzHasRoot || quartzEnableRootless) { + RootlessRepositionWindows(screenInfo.screens[0]); + } + + /* Somehow the menubar manages to interfere with our event stream + * in fullscreen mode, even though it's not visible. + */ + X11ApplicationShowHideMenubar(!quartzHasRoot); + + xp_reenable_update (); + + if (quartzFullscreenDisableHotkeys) + xp_disable_hot_keys(quartzHasRoot); +} + +void QuartzSetRootless(Bool state) { + if(quartzEnableRootless == state) + return; + + quartzEnableRootless = state; + + xp_disable_update(); + + /* When in rootless, the menubar is not part of the screen, so we need to update our screens on toggle */ + QuartzUpdateScreens(); + + if (!quartzEnableRootless && !quartzHasRoot) { + RootlessHideAllWindows(); + } else if (quartzEnableRootless && !quartzHasRoot) { + RootlessShowAllWindows(); + } + + xp_reenable_update(); +} /* * QuartzShow @@ -307,20 +365,24 @@ static void QuartzUpdateScreens(void) * Calls mode specific screen resume to restore the X clip regions * (if needed) and the X server cursor state. */ -static void QuartzShow( +void QuartzShow( int x, // cursor location int y ) { int i; - if (!quartzServerVisible) { - quartzServerVisible = TRUE; - for (i = 0; i < screenInfo.numScreens; i++) { - if (screenInfo.screens[i]) { - quartzProcs->ResumeScreen(screenInfo.screens[i], x, y); - } + if (quartzServerVisible) + return; + + quartzServerVisible = TRUE; + for (i = 0; i < screenInfo.numScreens; i++) { + if (screenInfo.screens[i]) { + quartzProcs->ResumeScreen(screenInfo.screens[i], x, y); } } + + if (!quartzEnableRootless) + QuartzSetFullscreen(TRUE); } @@ -330,7 +392,7 @@ static void QuartzShow( * hidden. Calls mode specific screen suspend to set X clip regions to * prevent drawing (if needed) and restore the Aqua cursor. */ -static void QuartzHide(void) +void QuartzHide(void) { int i; @@ -341,6 +403,8 @@ static void QuartzHide(void) } } } + + QuartzSetFullscreen(FALSE); quartzServerVisible = FALSE; } @@ -349,7 +413,7 @@ static void QuartzHide(void) * QuartzSetRootClip * Enable or disable rendering to the X screen. */ -static void QuartzSetRootClip( +void QuartzSetRootClip( BOOL enable) { int i; @@ -364,137 +428,11 @@ static void QuartzSetRootClip( } } - -/* - * QuartzMessageServerThread - * Send the X server thread a message by placing it on the event queue. - */ -void -QuartzMessageServerThread( - int type, - int argc, ...) -{ - xEvent xe; - INT32 *argv; - int i, max_args; - va_list args; - - memset(&xe, 0, sizeof(xe)); - xe.u.u.type = type; - xe.u.clientMessage.u.l.type = type; - - argv = &xe.u.clientMessage.u.l.longs0; - max_args = 4; - - if (argc > 0 && argc <= max_args) { - va_start (args, argc); - for (i = 0; i < argc; i++) - argv[i] = (int) va_arg (args, int); - va_end (args); - } - - DarwinEQEnqueue(&xe); -} - - -/* - * QuartzProcessEvent - * Process Quartz specific events. +/* + * QuartzSpaceChanged + * Unmap offscreen windows, map onscreen windows */ -void QuartzProcessEvent(xEvent *xe) { - switch (xe->u.u.type) { - case kXDarwinControllerNotify: - DEBUG_LOG("kXDarwinControllerNotify\n"); - AppleWMSendEvent(AppleWMControllerNotify, - AppleWMControllerNotifyMask, - xe->u.clientMessage.u.l.longs0, - xe->u.clientMessage.u.l.longs1); - break; - - case kXDarwinPasteboardNotify: - DEBUG_LOG("kXDarwinPasteboardNotify\n"); - AppleWMSendEvent(AppleWMPasteboardNotify, - AppleWMPasteboardNotifyMask, - xe->u.clientMessage.u.l.longs0, - xe->u.clientMessage.u.l.longs1); - break; - - case kXDarwinActivate: - DEBUG_LOG("kXDarwinActivate\n"); - QuartzShow(xe->u.keyButtonPointer.rootX, - xe->u.keyButtonPointer.rootY); - AppleWMSendEvent(AppleWMActivationNotify, - AppleWMActivationNotifyMask, - AppleWMIsActive, 0); - break; - - case kXDarwinDeactivate: - DEBUG_LOG("kXDarwinDeactivate\n"); - AppleWMSendEvent(AppleWMActivationNotify, - AppleWMActivationNotifyMask, - AppleWMIsInactive, 0); - QuartzHide(); - break; - - case kXDarwinDisplayChanged: - DEBUG_LOG("kXDarwinDisplayChanged\n"); - QuartzUpdateScreens(); - break; - - case kXDarwinWindowState: - DEBUG_LOG("kXDarwinWindowState\n"); - RootlessNativeWindowStateChanged(xe->u.clientMessage.u.l.longs0, - xe->u.clientMessage.u.l.longs1); - break; - - case kXDarwinWindowMoved: - DEBUG_LOG("kXDarwinWindowMoved\n"); - RootlessNativeWindowMoved ((WindowPtr)xe->u.clientMessage.u.l.longs0); - break; - - case kXDarwinToggleFullscreen: - DEBUG_LOG("kXDarwinToggleFullscreen\n"); -#ifdef DARWIN_DDX_MISSING - if (quartzEnableRootless) QuartzSetFullscreen(!quartzHasRoot); - else if (quartzHasRoot) QuartzHide(); - else QuartzShow(); -#else - // ErrorF("kXDarwinToggleFullscreen not implemented\n"); -#endif - break; - - case kXDarwinSetRootless: - DEBUG_LOG("kXDarwinSetRootless\n"); -#ifdef DARWIN_DDX_MISSING - QuartzSetRootless(xe->u.clientMessage.u.l.longs0); - if (!quartzEnableRootless && !quartzHasRoot) QuartzHide(); -#else - // ErrorF("kXDarwinSetRootless not implemented\n"); -#endif - break; - - case kXDarwinSetRootClip: - QuartzSetRootClip((BOOL)xe->u.clientMessage.u.l.longs0); - break; - - case kXDarwinQuit: - GiveUp(0); - break; - - case kXDarwinReadPasteboard: - QuartzReadPasteboard(); - break; - - case kXDarwinWritePasteboard: - QuartzWritePasteboard(); - break; - - case kXDarwinBringAllToFront: - DEBUG_LOG("kXDarwinBringAllToFront\n"); - RootlessOrderAllWindows(); - break; - - default: - ErrorF("Unknown application defined event type %d.\n", xe->u.u.type); - } +void QuartzSpaceChanged(uint32_t space_id) { + /* Do something special here, so we don't depend on quartz-wm for spaces to work... */ + DEBUG_LOG("Space Changed (%u) ... do something interesting...\n", space_id); } diff --git a/xorg-server/hw/xquartz/quartz.h b/xorg-server/hw/xquartz/quartz.h index fbe308a92..c5da4c510 100644 --- a/xorg-server/hw/xquartz/quartz.h +++ b/xorg-server/hw/xquartz/quartz.h @@ -54,20 +54,16 @@ typedef void (*InitInputProc)(int argc, char **argv); * Cursor functions */ typedef Bool (*InitCursorProc)(ScreenPtr pScreen); -typedef void (*CursorUpdateProc)(void); /* * Suspend and resume X11 activity */ typedef void (*SuspendScreenProc)(ScreenPtr pScreen); typedef void (*ResumeScreenProc)(ScreenPtr pScreen, int x, int y); -typedef void (*CaptureScreensProc)(void); -typedef void (*ReleaseScreensProc)(void); /* * Screen state change support */ -typedef void (*ScreenChangedProc)(void); typedef void (*AddPseudoramiXScreensProc)(int *x, int *y, int *width, int *height); typedef void (*UpdateScreenProc)(ScreenPtr pScreen); @@ -101,14 +97,10 @@ typedef struct _QuartzModeProcs { InitInputProc InitInput; InitCursorProc InitCursor; - CursorUpdateProc CursorUpdate; // Not used if NULL SuspendScreenProc SuspendScreen; ResumeScreenProc ResumeScreen; - CaptureScreensProc CaptureScreens; // Only called in fullscreen - ReleaseScreensProc ReleaseScreens; // Only called in fullscreen - ScreenChangedProc ScreenChanged; AddPseudoramiXScreensProc AddPseudoramiXScreens; UpdateScreenProc UpdateScreen; @@ -128,7 +120,16 @@ Bool QuartzAddScreen(int index, ScreenPtr pScreen); Bool QuartzSetupScreen(int index, ScreenPtr pScreen); void QuartzInitOutput(int argc,char **argv); void QuartzInitInput(int argc, char **argv); +void QuartzInitServer(int argc, char **argv, char **envp); void QuartzGiveUp(void); void QuartzProcessEvent(xEvent *xe); +void QuartzDisplayChangedHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents); +void QuartzShow(int x, int y); // (x, y) = cursor loc +void QuartzHide(void); +void QuartzSetRootClip(BOOL enable); +void QuartzSpaceChanged(uint32_t space_id); + +void QuartzSetFullscreen(Bool state); +void QuartzSetRootless(Bool state); #endif diff --git a/xorg-server/hw/xquartz/quartzAudio.c b/xorg-server/hw/xquartz/quartzAudio.c index 5dee32f54..21232665a 100644 --- a/xorg-server/hw/xquartz/quartzAudio.c +++ b/xorg-server/hw/xquartz/quartzAudio.c @@ -36,6 +36,8 @@ * use or other dealings in this Software without prior written authorization. */ +#include "sanitizedCarbon.h" + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -45,6 +47,7 @@ #include <CoreAudio/CoreAudio.h> #include <pthread.h> +#include <AvailabilityMacros.h> #include "inputstr.h" #include <X11/extensions/XI.h> @@ -236,7 +239,7 @@ static void QuartzCoreAudioBell( OSStatus status; status = AudioDeviceStart(quartzAudioDevice, QuartzAudioIOProc); if (status) { - ErrorF("QuartzAudioBell: AudioDeviceStart returned %ld\n", status); + ErrorF("QuartzAudioBell: AudioDeviceStart returned %ld\n", (long)status); } else { data.playing = TRUE; } @@ -297,7 +300,7 @@ void QuartzAudioInit(void) &propertySize, &outputDevice); if (status) { ErrorF("QuartzAudioInit: AudioHardwareGetProperty returned %ld\n", - status); + (long)status); return; } if (outputDevice == kAudioDeviceUnknown) { @@ -312,7 +315,7 @@ void QuartzAudioInit(void) &propertySize, &outputStreamDescription); if (status) { ErrorF("QuartzAudioInit: GetProperty(stream format) returned %ld\n", - status); + (long)status); return; } sampleRate = outputStreamDescription.mSampleRate; @@ -335,9 +338,14 @@ void QuartzAudioInit(void) // fixme assert fadeLength<framesPerBuffer // Prepare for playback +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 + AudioDeviceIOProcID sInputIOProcID = NULL; + status = AudioDeviceCreateIOProcID( outputDevice, QuartzAudioIOProc, &data, &sInputIOProcID ); +#else status = AudioDeviceAddIOProc(outputDevice, QuartzAudioIOProc, &data); +#endif if (status) { - ErrorF("QuartzAudioInit: AddIOProc returned %ld\n", status); + ErrorF("QuartzAudioInit: AddIOProc returned %ld\n", (long)status); return; } diff --git a/xorg-server/hw/xquartz/quartzCocoa.m b/xorg-server/hw/xquartz/quartzCocoa.m index 53e3f0897..0ab94936c 100644 --- a/xorg-server/hw/xquartz/quartzCocoa.m +++ b/xorg-server/hw/xquartz/quartzCocoa.m @@ -32,24 +32,17 @@ * use or other dealings in this Software without prior written authorization. */ +#include "sanitizedCocoa.h" + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif #include "quartzCommon.h" +#include "inputstr.h" #include "quartzPasteboard.h" -#define BOOL xBOOL #include "darwin.h" -#undef BOOL - -#include <Cocoa/Cocoa.h> - -#include "pseudoramiX.h" - -extern void FatalError(const char *, ...); -extern char *display; -extern int noPanoramiXExtension; /* * QuartzWriteCocoaPasteboard diff --git a/xorg-server/hw/xquartz/quartzCommon.h b/xorg-server/hw/xquartz/quartzCommon.h index a0d467389..1c0eeba9c 100644 --- a/xorg-server/hw/xquartz/quartzCommon.h +++ b/xorg-server/hw/xquartz/quartzCommon.h @@ -35,17 +35,6 @@ #ifndef _QUARTZCOMMON_H #define _QUARTZCOMMON_H -// QuickDraw in ApplicationServices has the following conflicts with -// the basic X server headers. Use QD_<name> to use the QuickDraw -// definition of any of these symbols, or the normal name for the -// X11 definition. -#define Cursor QD_Cursor -#define WindowPtr QD_WindowPtr -#define Picture QD_Picture -#include <ApplicationServices/ApplicationServices.h> -#undef Cursor -#undef WindowPtr -#undef Picture #include <X11/Xdefs.h> #include "privates.h" @@ -66,10 +55,11 @@ typedef struct { extern int quartzEventWriteFD; // User preferences used by Quartz modes -extern int quartzRootless; extern int quartzUseSysBeep; +extern int focusOnNewWindow; extern int quartzUseAGL; extern int quartzEnableKeyEquivalents; +extern int quartzFullscreenDisableHotkeys; // Other shared data extern int quartzServerVisible; @@ -91,17 +81,4 @@ int QuartzFSUseQDCursor(int depth); void QuartzBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask); void QuartzWakeupHandler(pointer blockData, int result, pointer pReadmask); -// Messages that can be sent to the main thread. -enum { - kQuartzServerHidden, - kQuartzServerStarted, - kQuartzServerDied, - kQuartzCursorUpdate, - kQuartzPostEvent, - kQuartzSetWindowMenu, - kQuartzSetWindowMenuCheck, - kQuartzSetFrontProcess, - kQuartzSetCanQuit -}; - #endif /* _QUARTZCOMMON_H */ diff --git a/xorg-server/hw/xquartz/quartzCursor.c b/xorg-server/hw/xquartz/quartzCursor.c deleted file mode 100644 index f82ccd380..000000000 --- a/xorg-server/hw/xquartz/quartzCursor.c +++ /dev/null @@ -1,646 +0,0 @@ -/************************************************************** - * - * Support for using the Quartz Window Manager cursor - * - * Copyright (c) 2001-2003 Torrey T. Lyons and Greg Parker. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT HOLDER(S) 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(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "quartzCommon.h" -#include "quartzCursor.h" -#include "darwin.h" - -#include <pthread.h> - -#include "mi.h" -#include "scrnintstr.h" -#include "cursorstr.h" -#include "mipointrst.h" -#include "globals.h" - -// Size of the QuickDraw cursor -#define CURSORWIDTH 16 -#define CURSORHEIGHT 16 - -typedef struct { - int qdCursorMode; - int qdCursorVisible; - int useQDCursor; - QueryBestSizeProcPtr QueryBestSize; - miPointerSpriteFuncPtr spriteFuncs; -} QuartzCursorScreenRec, *QuartzCursorScreenPtr; - -static DevPrivateKey darwinCursorScreenKey = &darwinCursorScreenKey; -static CursorPtr quartzLatentCursor = NULL; -static QD_Cursor gQDArrow; // QuickDraw arrow cursor - -// Cursor for the main thread to set (NULL = arrow cursor). -static CCrsrHandle currentCursor = NULL; -static pthread_mutex_t cursorMutex; -static pthread_cond_t cursorCondition; - -#define CURSOR_PRIV(pScreen) ((QuartzCursorScreenPtr) \ - dixLookupPrivate(&pScreen->devPrivates, darwinCursorScreenKey)) - -#define HIDE_QD_CURSOR(pScreen, visible) \ - if (visible) { \ - int ix; \ - for (ix = 0; ix < QUARTZ_PRIV(pScreen)->displayCount; ix++) { \ - CGDisplayHideCursor(QUARTZ_PRIV(pScreen)->displayIDs[ix]); \ - } \ - visible = FALSE; \ - } ((void)0) - -#define SHOW_QD_CURSOR(pScreen, visible) \ - { \ - int ix; \ - for (ix = 0; ix < QUARTZ_PRIV(pScreen)->displayCount; ix++) { \ - CGDisplayShowCursor(QUARTZ_PRIV(pScreen)->displayIDs[ix]); \ - } \ - visible = TRUE; \ - } ((void)0) - -#define CHANGE_QD_CURSOR(cursorH) \ - if (!quartzServerQuitting) { \ - /* Acquire lock and tell the main thread to change cursor */ \ - pthread_mutex_lock(&cursorMutex); \ - currentCursor = (CCrsrHandle) (cursorH); \ - QuartzMessageMainThread(kQuartzCursorUpdate, NULL, 0); \ - \ - /* Wait for the main thread to change the cursor */ \ - pthread_cond_wait(&cursorCondition, &cursorMutex); \ - pthread_mutex_unlock(&cursorMutex); \ - } ((void)0) - - -/* - * MakeQDCursor helpers: CTAB_ENTER, interleave - */ - -// Add a color entry to a ctab -#define CTAB_ENTER(ctab, index, r, g, b) \ - ctab->ctTable[index].value = index; \ - ctab->ctTable[index].rgb.red = r; \ - ctab->ctTable[index].rgb.green = g; \ - ctab->ctTable[index].rgb.blue = b - -// Make an unsigned short by interleaving the bits of bytes c1 and c2. -// High bit of c1 is first; low bit of c2 is last. -// Interleave is a built-in INTERCAL operator. -static unsigned short -interleave( - unsigned char c1, - unsigned char c2 ) -{ - return - ((c1 & 0x80) << 8) | ((c2 & 0x80) << 7) | - ((c1 & 0x40) << 7) | ((c2 & 0x40) << 6) | - ((c1 & 0x20) << 6) | ((c2 & 0x20) << 5) | - ((c1 & 0x10) << 5) | ((c2 & 0x10) << 4) | - ((c1 & 0x08) << 4) | ((c2 & 0x08) << 3) | - ((c1 & 0x04) << 3) | ((c2 & 0x04) << 2) | - ((c1 & 0x02) << 2) | ((c2 & 0x02) << 1) | - ((c1 & 0x01) << 1) | ((c2 & 0x01) << 0) ; -} - -/* - * MakeQDCursor - * Make a QuickDraw color cursor from the given X11 cursor. - * Warning: This code is nasty. Color cursors were meant to be read - * from resources; constructing the structures programmatically is messy. - */ -/* - QuickDraw cursor representation: - Our color cursor is a 2 bit per pixel pixmap. - Each pixel's bits are (source<<1 | mask) from the original X cursor pixel. - The cursor's color table maps the colors like this: - (2-bit value | X result | colortable | Mac result) - 00 | transparent | white | transparent (white outside mask) - 01 | back color | back color | back color - 10 | undefined | black | invert background (just for fun) - 11 | fore color | fore color | fore color -*/ -static CCrsrHandle -MakeQDCursor( - CursorPtr pCursor ) -{ - CCrsrHandle result; - CCrsrPtr curs; - int i, w, h; - unsigned short rowMask; - PixMap *pix; - ColorTable *ctab; - unsigned short *image; - - result = (CCrsrHandle) NewHandleClear(sizeof(CCrsr)); - if (!result) return NULL; - HLock((Handle)result); - curs = *result; - - // Initialize CCrsr - curs->crsrType = 0x8001; // 0x8000 = b&w, 0x8001 = color - curs->crsrMap = (PixMapHandle) NewHandleClear(sizeof(PixMap)); - if (!curs->crsrMap) goto pixAllocFailed; - HLock((Handle)curs->crsrMap); - pix = *curs->crsrMap; - curs->crsrData = NULL; // raw cursor image data (set below) - curs->crsrXData = NULL; // QD's processed data - curs->crsrXValid = 0; // zero means QD must re-process cursor data - curs->crsrXHandle = NULL; // reserved - memset(curs->crsr1Data, 0, CURSORWIDTH*CURSORHEIGHT/8); // b&w data - memset(curs->crsrMask, 0, CURSORWIDTH*CURSORHEIGHT/8); // b&w & color mask - curs->crsrHotSpot.h = min(CURSORWIDTH, pCursor->bits->xhot); // hot spot - curs->crsrHotSpot.v = min(CURSORHEIGHT, pCursor->bits->yhot); // hot spot - curs->crsrXTable = 0; // reserved - curs->crsrID = GetCTSeed(); // unique ID from Color Manager - - // Set the b&w data and mask - w = min(pCursor->bits->width, CURSORWIDTH); - h = min(pCursor->bits->height, CURSORHEIGHT); - rowMask = ~((1 << (CURSORWIDTH - w)) - 1); - for (i = 0; i < h; i++) { - curs->crsr1Data[i] = rowMask & - ((pCursor->bits->source[i*4]<<8) | pCursor->bits->source[i*4+1]); - curs->crsrMask[i] = rowMask & - ((pCursor->bits->mask[i*4]<<8) | pCursor->bits->mask[i*4+1]); - } - - // Set the color data and mask - // crsrMap: defines bit depth and size and colortable only - pix->rowBytes = (CURSORWIDTH * 2 / 8) | 0x8000; // last bit on means PixMap - SetRect(&pix->bounds, 0, 0, CURSORWIDTH, CURSORHEIGHT); // see TN 1020 - pix->pixelSize = 2; - pix->cmpCount = 1; - pix->cmpSize = 2; - // pix->pmTable set below - - // crsrData is the pixel data. crsrMap's baseAddr is not used. - curs->crsrData = NewHandleClear(CURSORWIDTH*CURSORHEIGHT * 2 / 8); - if (!curs->crsrData) goto imageAllocFailed; - HLock((Handle)curs->crsrData); - image = (unsigned short *) *curs->crsrData; - // Pixel data is just 1-bit data and mask interleaved (see above) - for (i = 0; i < h; i++) { - unsigned char s, m; - s = pCursor->bits->source[i*4] & (rowMask >> 8); - m = pCursor->bits->mask[i*4] & (rowMask >> 8); - image[2*i] = interleave(s, m); - s = pCursor->bits->source[i*4+1] & (rowMask & 0x00ff); - m = pCursor->bits->mask[i*4+1] & (rowMask & 0x00ff); - image[2*i+1] = interleave(s, m); - } - - // Build the color table (entries described above) - // NewPixMap allocates a color table handle. - pix->pmTable = (CTabHandle) NewHandleClear(sizeof(ColorTable) + 3 - * sizeof(ColorSpec)); - if (!pix->pmTable) goto ctabAllocFailed; - HLock((Handle)pix->pmTable); - ctab = *pix->pmTable; - ctab->ctSeed = GetCTSeed(); - ctab->ctFlags = 0; - ctab->ctSize = 3; // color count - 1 - CTAB_ENTER(ctab, 0, 0xffff, 0xffff, 0xffff); - CTAB_ENTER(ctab, 1, pCursor->backRed, pCursor->backGreen, - pCursor->backBlue); - CTAB_ENTER(ctab, 2, 0x0000, 0x0000, 0x0000); - CTAB_ENTER(ctab, 3, pCursor->foreRed, pCursor->foreGreen, - pCursor->foreBlue); - - HUnlock((Handle)pix->pmTable); // ctab - HUnlock((Handle)curs->crsrData); // image data - HUnlock((Handle)curs->crsrMap); // pix - HUnlock((Handle)result); // cursor - - return result; - - // "What we have here is a failure to allocate" -ctabAllocFailed: - HUnlock((Handle)curs->crsrData); - DisposeHandle((Handle)curs->crsrData); -imageAllocFailed: - HUnlock((Handle)curs->crsrMap); - DisposeHandle((Handle)curs->crsrMap); -pixAllocFailed: - HUnlock((Handle)result); - DisposeHandle((Handle)result); - return NULL; -} - - -/* - * FreeQDCursor - * Destroy a QuickDraw color cursor created with MakeQDCursor(). - * The cursor must not currently be on screen. - */ -static void FreeQDCursor(CCrsrHandle cursHandle) -{ - CCrsrPtr curs; - PixMap *pix; - - HLock((Handle)cursHandle); - curs = *cursHandle; - HLock((Handle)curs->crsrMap); - pix = *curs->crsrMap; - DisposeHandle((Handle)pix->pmTable); - HUnlock((Handle)curs->crsrMap); - DisposeHandle((Handle)curs->crsrMap); - DisposeHandle((Handle)curs->crsrData); - HUnlock((Handle)cursHandle); - DisposeHandle((Handle)cursHandle); -} - - -/* -=========================================================================== - - Pointer sprite functions - -=========================================================================== -*/ - -/* - * QuartzRealizeCursor - * Convert the X cursor representation to QuickDraw format if possible. - */ -Bool -QuartzRealizeCursor( - ScreenPtr pScreen, - CursorPtr pCursor ) -{ - CCrsrHandle qdCursor; - QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); - - if(!pCursor || !pCursor->bits) - return FALSE; - - // if the cursor is too big we use a software cursor - if ((pCursor->bits->height > CURSORHEIGHT) || - (pCursor->bits->width > CURSORWIDTH) || !ScreenPriv->useQDCursor) - { - if (quartzRootless) { - // rootless can't use a software cursor - return TRUE; - } else { - return (*ScreenPriv->spriteFuncs->RealizeCursor) - (pScreen, pCursor); - } - } - - // make new cursor image - qdCursor = MakeQDCursor(pCursor); - if (!qdCursor) return FALSE; - - // save the result - dixSetPrivate(&pCursor->devPrivates, pScreen, qdCursor); - - return TRUE; -} - - -/* - * QuartzUnrealizeCursor - * Free the storage space associated with a realized cursor. - */ -Bool -QuartzUnrealizeCursor( - ScreenPtr pScreen, - CursorPtr pCursor ) -{ - QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); - - if ((pCursor->bits->height > CURSORHEIGHT) || - (pCursor->bits->width > CURSORWIDTH) || !ScreenPriv->useQDCursor) - { - if (quartzRootless) { - return TRUE; - } else { - return (*ScreenPriv->spriteFuncs->UnrealizeCursor) - (pScreen, pCursor); - } - } else { - CCrsrHandle oldCursor = dixLookupPrivate(&pCursor->devPrivates, - pScreen); - if (currentCursor != oldCursor) { - // This should only fail when quitting, in which case we just leak. - FreeQDCursor(oldCursor); - } - dixSetPrivate(&pCursor->devPrivates, pScreen, NULL); - return TRUE; - } -} - - -/* - * QuartzSetCursor - * Set the cursor sprite and position. - * Use QuickDraw cursor if possible. - */ -static void -QuartzSetCursor( - ScreenPtr pScreen, - CursorPtr pCursor, - int x, - int y) -{ - QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); - - quartzLatentCursor = pCursor; - - // Don't touch Mac OS cursor if X is hidden! - if (!quartzServerVisible) - return; - - if (!pCursor) { - // Remove the cursor completely. - HIDE_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible); - if (! ScreenPriv->qdCursorMode) - (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y); - } - else if ((pCursor->bits->height <= CURSORHEIGHT) && - (pCursor->bits->width <= CURSORWIDTH) && ScreenPriv->useQDCursor) - { - // Cursor is small enough to use QuickDraw directly. - if (! ScreenPriv->qdCursorMode) // remove the X cursor - (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y); - ScreenPriv->qdCursorMode = TRUE; - - CHANGE_QD_CURSOR(dixLookupPrivate(&pCursor->devPrivates, pScreen)); - SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible); - } - else if (quartzRootless) { - // Rootless can't use a software cursor, so we just use Mac OS arrow. - CHANGE_QD_CURSOR(NULL); - SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible); - } - else { - // Cursor is too big for QuickDraw. Use X software cursor. - HIDE_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible); - ScreenPriv->qdCursorMode = FALSE; - (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, pCursor, x, y); - } -} - - -/* - * QuartzReallySetCursor - * Set the QuickDraw cursor. Called from the main thread since changing the - * cursor with QuickDraw is not thread safe on dual processor machines. - */ -void -QuartzReallySetCursor() -{ - pthread_mutex_lock(&cursorMutex); - - if (currentCursor) { - SetCCursor(currentCursor); - } else { - SetCursor(&gQDArrow); - } - - pthread_cond_signal(&cursorCondition); - pthread_mutex_unlock(&cursorMutex); -} - - -/* - * QuartzMoveCursor - * Move the cursor. This is a noop for QuickDraw. - */ -static void -QuartzMoveCursor( - ScreenPtr pScreen, - int x, - int y) -{ - QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); - - // only the X cursor needs to be explicitly moved - if (!ScreenPriv->qdCursorMode) - (*ScreenPriv->spriteFuncs->MoveCursor)(pScreen, x, y); -} - - -static miPointerSpriteFuncRec quartzSpriteFuncsRec = { - QuartzRealizeCursor, - QuartzUnrealizeCursor, - QuartzSetCursor, - QuartzMoveCursor -}; - - -/* -=========================================================================== - - Pointer screen functions - -=========================================================================== -*/ - -/* - * QuartzCursorOffScreen - */ -static Bool QuartzCursorOffScreen(ScreenPtr *pScreen, int *x, int *y) -{ - return FALSE; -} - - -/* - * QuartzCrossScreen - */ -static void QuartzCrossScreen(ScreenPtr pScreen, Bool entering) -{ - return; -} - - -/* - * QuartzWarpCursor - * Change the cursor position without generating an event or motion history. - * The input coordinates (x,y) are in pScreen-local X11 coordinates. - * - */ -static void -QuartzWarpCursor( - ScreenPtr pScreen, - int x, - int y) -{ - static int neverMoved = TRUE; - - if (neverMoved) { - // Don't move the cursor the first time. This is the jump-to-center - // initialization, and it's annoying because we may still be in MacOS. - neverMoved = FALSE; - return; - } - - if (quartzServerVisible) { - CGDisplayErr cgErr; - CGPoint cgPoint; - // Only need to do this for one display. Any display will do. - CGDirectDisplayID cgID = QUARTZ_PRIV(pScreen)->displayIDs[0]; - CGRect cgRect = CGDisplayBounds(cgID); - - // Convert (x,y) to CoreGraphics screen-local CG coordinates. - // This is necessary because the X11 screen and CG screen may not - // coincide. (e.g. X11 screen may be moved to dodge the menu bar) - - // Make point in X11 global coordinates - cgPoint = CGPointMake(x + dixScreenOrigins[pScreen->myNum].x, - y + dixScreenOrigins[pScreen->myNum].y); - // Shift to CoreGraphics global screen coordinates - cgPoint.x += darwinMainScreenX; - cgPoint.y += darwinMainScreenY; - // Shift to CoreGraphics screen-local coordinates - cgPoint.x -= cgRect.origin.x; - cgPoint.y -= cgRect.origin.y; - - cgErr = CGDisplayMoveCursorToPoint(cgID, cgPoint); - if (cgErr != CGDisplayNoErr) { - ErrorF("Could not set cursor position with error code 0x%x.\n", - cgErr); - } - } - - miPointerWarpCursor(pScreen, x, y); - miPointerUpdate(); -} - - -static miPointerScreenFuncRec quartzScreenFuncsRec = { - QuartzCursorOffScreen, - QuartzCrossScreen, - QuartzWarpCursor, - DarwinEQPointerPost, - DarwinEQSwitchScreen -}; - - -/* -=========================================================================== - - Other screen functions - -=========================================================================== -*/ - -/* - * QuartzCursorQueryBestSize - * Handle queries for best cursor size - */ -static void -QuartzCursorQueryBestSize( - int class, - unsigned short *width, - unsigned short *height, - ScreenPtr pScreen) -{ - QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); - - if (class == CursorShape) { - *width = CURSORWIDTH; - *height = CURSORHEIGHT; - } else { - (*ScreenPriv->QueryBestSize)(class, width, height, pScreen); - } -} - - -/* - * QuartzInitCursor - * Initialize cursor support - */ -Bool -QuartzInitCursor( - ScreenPtr pScreen ) -{ - QuartzCursorScreenPtr ScreenPriv; - miPointerScreenPtr PointPriv; - DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen); - - // initialize software cursor handling (always needed as backup) - if (!miDCInitialize(pScreen, &quartzScreenFuncsRec)) { - return FALSE; - } - - ScreenPriv = xcalloc( 1, sizeof(QuartzCursorScreenRec) ); - if (!ScreenPriv) return FALSE; - - CURSOR_PRIV(pScreen) = ScreenPriv; - - // override some screen procedures - ScreenPriv->QueryBestSize = pScreen->QueryBestSize; - pScreen->QueryBestSize = QuartzCursorQueryBestSize; - - // initialize QuickDraw cursor handling - GetQDGlobalsArrow(&gQDArrow); - PointPriv = (miPointerScreenPtr) - dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); - - ScreenPriv->spriteFuncs = PointPriv->spriteFuncs; - PointPriv->spriteFuncs = &quartzSpriteFuncsRec; - - if (!quartzRootless) - ScreenPriv->useQDCursor = QuartzFSUseQDCursor(dfb->colorBitsPerPixel); - else - ScreenPriv->useQDCursor = TRUE; - ScreenPriv->qdCursorMode = TRUE; - ScreenPriv->qdCursorVisible = TRUE; - - // initialize cursor mutex lock - pthread_mutex_init(&cursorMutex, NULL); - - // initialize condition for waiting - pthread_cond_init(&cursorCondition, NULL); - - return TRUE; -} - - -// X server is hiding. Restore the Aqua cursor. -void QuartzSuspendXCursor( - ScreenPtr pScreen ) -{ - QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); - - CHANGE_QD_CURSOR(NULL); - SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible); -} - - -// X server is showing. Restore the X cursor. -void QuartzResumeXCursor( - ScreenPtr pScreen, - int x, - int y ) -{ - QuartzSetCursor(pScreen, quartzLatentCursor, x, y); -} diff --git a/xorg-server/hw/xquartz/quartzForeground.c b/xorg-server/hw/xquartz/quartzForeground.c deleted file mode 100644 index 0e724de76..000000000 --- a/xorg-server/hw/xquartz/quartzForeground.c +++ /dev/null @@ -1,47 +0,0 @@ -/* foreground.c - Push the current process into the foreground. - - This is in a separate file because of Quartz/X type conflicts. - - Copyright (c) 2007 Jeremy Huddleston - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation files - (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of the Software, - and to permit persons to whom the Software is furnished to do so, - subject to the following conditions: - - The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT - HOLDER(S) 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(s) of the above - copyright holders shall not be used in advertising or otherwise to - promote the sale, use or other dealings in this Software without - prior written authorization. */ - -#include <ApplicationServices/ApplicationServices.h> -#include <stdio.h> - -#include "quartzForeground.h" - -int QuartzMoveToForeground() { - ProcessSerialNumber psn = { 0, kCurrentProcess }; - OSStatus returnCode = TransformProcessType(& psn, kProcessTransformToForegroundApplication); - if( returnCode == 0) { - fprintf(stderr, "TransformProcessType: Success\n"); - SetFrontProcess(&psn); - } else { - fprintf(stderr, "TransformProcessType: Failure\n"); - } - return (int)returnCode; -} diff --git a/xorg-server/hw/xquartz/quartzForeground.h b/xorg-server/hw/xquartz/quartzForeground.h deleted file mode 100644 index b5422ff9c..000000000 --- a/xorg-server/hw/xquartz/quartzForeground.h +++ /dev/null @@ -1,37 +0,0 @@ -/* foreground.h - Push the current process into the foreground. - - This is in a separate file because of Quartz/X type conflicts. - - Copyright (c) 2007 Jeremy Huddleston - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation files - (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of the Software, - and to permit persons to whom the Software is furnished to do so, - subject to the following conditions: - - The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT - HOLDER(S) 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(s) of the above - copyright holders shall not be used in advertising or otherwise to - promote the sale, use or other dealings in this Software without - prior written authorization. */ - -#ifndef _QUARTZ_FOREGROUND_H_ -#define _QUARTZ_FOREGROUND_H_ - -int QuartzMoveToForeground(void); - -#endif /* _QUARTZ_FOREGROUND_H_ */ diff --git a/xorg-server/hw/xquartz/quartzKeyboard.c b/xorg-server/hw/xquartz/quartzKeyboard.c index 9b899ca67..72f94b443 100644 --- a/xorg-server/hw/xquartz/quartzKeyboard.c +++ b/xorg-server/hw/xquartz/quartzKeyboard.c @@ -1,52 +1,73 @@ /* - quartzKeyboard.c - - Code to build a keymap using the Carbon Keyboard Layout API. - - Copyright (c) 2003-2007 Apple Inc. - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation files - (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of the Software, - and to permit persons to whom the Software is furnished to do so, - subject to the following conditions: - - The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT - HOLDER(S) 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(s) of the above - copyright holders shall not be used in advertising or otherwise to - promote the sale, use or other dealings in this Software without - prior written authorization. + quartzKeyboard.c: Keyboard support for Xquartz + + Copyright (c) 2003-2008 Apple Inc. + Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved. + Copyright 2004 Kaleb S. KEITHLEY. All Rights Reserved. + + Copyright (C) 1999,2000 by Eric Sunshine <sunshine@sunshineco.com> + 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. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. */ +#include "sanitizedCarbon.h" + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif -#include "quartzCommon.h" +#define HACK_MISSING 1 +#define HACK_KEYPAD 1 -#include <CoreServices/CoreServices.h> -#include <Carbon/Carbon.h> +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include <sys/stat.h> +#include <AvailabilityMacros.h> + +#include "quartzCommon.h" +#include "darwin.h" #include "quartzKeyboard.h" +#include "quartzAudio.h" + +#include "threadSafety.h" + +#ifdef NDEBUG +#undef NDEBUG +#include <assert.h> +#define NDEBUG 1 +#else +#include <assert.h> +#endif +#include <pthread.h> + +#include "xkbsrv.h" +#include "exevents.h" #include "X11/keysym.h" #include "keysym2ucs.h" -#define HACK_MISSING 1 -#define HACK_KEYPAD 1 - enum { MOD_COMMAND = 256, MOD_SHIFT = 512, @@ -124,7 +145,9 @@ const static struct { KeySym normal, dead; } dead_keys[] = { {XK_grave, XK_dead_grave}, + {XK_apostrophe, XK_dead_acute}, /* US:"=" on a Czech keyboard */ {XK_acute, XK_dead_acute}, + {UKEYSYM (0x384), XK_dead_acute}, /* US:";" on a Greek keyboard */ {XK_asciicircum, XK_dead_circumflex}, {UKEYSYM (0x2c6), XK_dead_circumflex}, /* MODIFIER LETTER CIRCUMFLEX ACCENT */ {XK_asciitilde, XK_dead_tilde}, @@ -146,16 +169,383 @@ const static struct { {UKEYSYM (0x31b), XK_dead_horn}, /* COMBINING HORN */ }; -unsigned int QuartzSystemKeymapSeed(void) { - static unsigned int seed; - static KeyboardLayoutRef last_key_layout; - KeyboardLayoutRef key_layout; +darwinKeyboardInfo keyInfo; +pthread_mutex_t keyInfo_mutex = PTHREAD_MUTEX_INITIALIZER; + +static void DarwinChangeKeyboardControl(DeviceIntPtr device, KeybdCtrl *ctrl) { + // FIXME: to be implemented + // keyclick, bell volume / pitch, autorepead, LED's +} + +//----------------------------------------------------------------------------- +// Utility functions to help parse Darwin keymap +//----------------------------------------------------------------------------- + +/* + * DarwinBuildModifierMaps + * Use the keyMap field of keyboard info structure to populate + * the modMap and modifierKeycodes fields. + */ +static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) { + int i; + KeySym *k; + + memset(info->modMap, NoSymbol, sizeof(info->modMap)); + memset(info->modifierKeycodes, 0, sizeof(info->modifierKeycodes)); + + for (i = 0; i < NUM_KEYCODES; i++) { + k = info->keyMap + i * GLYPHS_PER_KEY; + + switch (*k) { + case XK_Shift_L: + info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i; + info->modMap[MIN_KEYCODE + i] = ShiftMask; + break; + + case XK_Shift_R: +#ifdef NX_MODIFIERKEY_RSHIFT + info->modifierKeycodes[NX_MODIFIERKEY_RSHIFT][0] = i; +#else + info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i; +#endif + info->modMap[MIN_KEYCODE + i] = ShiftMask; + break; + + case XK_Control_L: + info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i; + info->modMap[MIN_KEYCODE + i] = ControlMask; + break; + + case XK_Control_R: +#ifdef NX_MODIFIERKEY_RCONTROL + info->modifierKeycodes[NX_MODIFIERKEY_RCONTROL][0] = i; +#else + info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i; +#endif + info->modMap[MIN_KEYCODE + i] = ControlMask; + break; + + case XK_Caps_Lock: + info->modifierKeycodes[NX_MODIFIERKEY_ALPHALOCK][0] = i; + info->modMap[MIN_KEYCODE + i] = LockMask; + break; + + case XK_Alt_L: + info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i; + info->modMap[MIN_KEYCODE + i] = Mod1Mask; + *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor. + break; + + case XK_Alt_R: +#ifdef NX_MODIFIERKEY_RALTERNATE + info->modifierKeycodes[NX_MODIFIERKEY_RALTERNATE][0] = i; +#else + info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i; +#endif + *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor. + info->modMap[MIN_KEYCODE + i] = Mod1Mask; + break; + + case XK_Mode_switch: + info->modMap[MIN_KEYCODE + i] = Mod1Mask; + break; + + case XK_Meta_L: + info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i; + info->modMap[MIN_KEYCODE + i] = Mod2Mask; + break; + + case XK_Meta_R: +#ifdef NX_MODIFIERKEY_RCOMMAND + info->modifierKeycodes[NX_MODIFIERKEY_RCOMMAND][0] = i; +#else + info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i; +#endif + info->modMap[MIN_KEYCODE + i] = Mod2Mask; + break; + + case XK_Num_Lock: + info->modMap[MIN_KEYCODE + i] = Mod3Mask; + break; + } + } +} + +/* + * DarwinLoadKeyboardMapping + * Load the keyboard map from a file or system and convert + * it to an equivalent X keyboard map and modifier map. + */ +static void DarwinLoadKeyboardMapping(KeySymsRec *keySyms) { + pthread_mutex_lock(&keyInfo_mutex); + + DarwinBuildModifierMaps(&keyInfo); + + keySyms->map = keyInfo.keyMap; + keySyms->mapWidth = GLYPHS_PER_KEY; + keySyms->minKeyCode = MIN_KEYCODE; + keySyms->maxKeyCode = MAX_KEYCODE; + + pthread_mutex_unlock(&keyInfo_mutex); +} + +/* + * DarwinKeyboardSetDeviceKeyMap + * Load a keymap into the keyboard device + */ +static void DarwinKeyboardSetDeviceKeyMap(KeySymsRec *keySyms) { + DeviceIntPtr pDev; + + /* From ProcSetModifierMapping */ + SendMappingNotify(darwinKeyboard, MappingModifier, 0, 0, serverClient); + for (pDev = inputInfo.devices; pDev; pDev = pDev->next) + if (pDev->key && pDev->coreEvents) + SendDeviceMappingNotify(serverClient, MappingModifier, 0, 0, pDev); + + /* From ProcChangeKeyboardMapping */ + for (pDev = inputInfo.devices; pDev; pDev = pDev->next) + if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) + assert(SetKeySymsMap(&pDev->key->curKeySyms, keySyms)); + + SendMappingNotify(darwinKeyboard, MappingKeyboard, keySyms->minKeyCode, + keySyms->maxKeyCode - keySyms->minKeyCode + 1, serverClient); + for (pDev = inputInfo.devices; pDev; pDev = pDev->next) + if (pDev->key && pDev->coreEvents) + SendDeviceMappingNotify(serverClient, MappingKeyboard, keySyms->minKeyCode, + keySyms->maxKeyCode - keySyms->minKeyCode + 1, pDev); +} + +/* + * DarwinKeyboardInit + * Get the Darwin keyboard map and compute an equivalent + * X keyboard map and modifier map. Set the new keyboard + * device structure. + */ +void DarwinKeyboardInit(DeviceIntPtr pDev) { + KeySymsRec keySyms; + XkbComponentNamesRec names; + CFIndex value; + BOOL ok; + + // Open a shared connection to the HID System. + // Note that the Event Status Driver is really just a wrapper + // for a kIOHIDParamConnectType connection. + assert(darwinParamConnect = NXOpenEventStatus()); + + DarwinLoadKeyboardMapping(&keySyms); + + bzero(&names, sizeof(names)); + + /* We need to really have rules... or something... */ + //XkbSetRulesDflts("base", "pc105", "us", NULL, NULL); + + pthread_mutex_lock(&keyInfo_mutex); + assert(XkbInitKeyboardDeviceStruct(pDev, &names, &keySyms, keyInfo.modMap, + QuartzBell, DarwinChangeKeyboardControl)); + pthread_mutex_unlock(&keyInfo_mutex); + + /* Get our key repeat settings from GlobalPreferences */ + (void)CFPreferencesAppSynchronize(CFSTR(".GlobalPreferences")); + value = CFPreferencesGetAppIntegerValue(CFSTR("InitialKeyRepeat"), CFSTR(".GlobalPreferences"), &ok); + if(!ok) + value = 35; + + if(value == 300000) { // off + XkbSetRepeatKeys(pDev, -1, AutoRepeatModeOff); + } else { + pDev->key->xkbInfo->desc->ctrls->repeat_delay = value * 15; + + value = CFPreferencesGetAppIntegerValue(CFSTR("KeyRepeat"), CFSTR(".GlobalPreferences"), &ok); + if(!ok) + value = 6; + pDev->key->xkbInfo->desc->ctrls->repeat_interval = value * 15; + + XkbSetRepeatKeys(pDev, -1, AutoRepeatModeOn); + } + + DarwinKeyboardSetDeviceKeyMap(&keySyms); +} + +void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr pDev, int nevents) { + KeySymsRec keySyms; + + DEBUG_LOG("DarwinKeyboardReloadHandler\n"); + + DarwinLoadKeyboardMapping(&keySyms); + DarwinKeyboardSetDeviceKeyMap(&keySyms); +} - KLGetCurrentKeyboardLayout (&key_layout); - if (key_layout != last_key_layout) seed++; - last_key_layout = key_layout; +//----------------------------------------------------------------------------- +// Modifier translation functions +// +// There are three different ways to specify a Mac modifier key: +// keycode - specifies hardware key, read from keymapping +// key - NX_MODIFIERKEY_*, really an index +// mask - NX_*MASK, mask for modifier flags in event record +// Left and right side have different keycodes but the same key and mask. +//----------------------------------------------------------------------------- - return seed; +/* + * DarwinModifierNXKeyToNXKeycode + * Return the keycode for an NX_MODIFIERKEY_* modifier. + * side = 0 for left or 1 for right. + * Returns 0 if key+side is not a known modifier. + */ +int DarwinModifierNXKeyToNXKeycode(int key, int side) { + int retval; + pthread_mutex_lock(&keyInfo_mutex); + retval = keyInfo.modifierKeycodes[key][side]; + pthread_mutex_unlock(&keyInfo_mutex); + + return retval; +} + +/* + * DarwinModifierNXKeycodeToNXKey + * Returns -1 if keycode+side is not a modifier key + * outSide may be NULL, else it gets 0 for left and 1 for right. + */ +int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide) { + int key, side; + + pthread_mutex_lock(&keyInfo_mutex); + keycode += MIN_KEYCODE; + // search modifierKeycodes for this keycode+side + for (key = 0; key < NX_NUMMODIFIERS; key++) { + for (side = 0; side <= 1; side++) { + if (keyInfo.modifierKeycodes[key][side] == keycode) break; + } + } + if (key == NX_NUMMODIFIERS) { + pthread_mutex_unlock(&keyInfo_mutex); + return -1; + } + if (outSide) *outSide = side; + + pthread_mutex_unlock(&keyInfo_mutex); + return key; +} + +/* + * DarwinModifierNXMaskToNXKey + * Returns -1 if mask is not a known modifier mask. + */ +int DarwinModifierNXMaskToNXKey(int mask) { + switch (mask) { + case NX_ALPHASHIFTMASK: return NX_MODIFIERKEY_ALPHALOCK; + case NX_SHIFTMASK: return NX_MODIFIERKEY_SHIFT; +#ifdef NX_DEVICELSHIFTKEYMASK + case NX_DEVICELSHIFTKEYMASK: return NX_MODIFIERKEY_SHIFT; + case NX_DEVICERSHIFTKEYMASK: return NX_MODIFIERKEY_RSHIFT; +#endif + case NX_CONTROLMASK: return NX_MODIFIERKEY_CONTROL; +#ifdef NX_DEVICELCTLKEYMASK + case NX_DEVICELCTLKEYMASK: return NX_MODIFIERKEY_CONTROL; + case NX_DEVICERCTLKEYMASK: return NX_MODIFIERKEY_RCONTROL; +#endif + case NX_ALTERNATEMASK: return NX_MODIFIERKEY_ALTERNATE; +#ifdef NX_DEVICELALTKEYMASK + case NX_DEVICELALTKEYMASK: return NX_MODIFIERKEY_ALTERNATE; + case NX_DEVICERALTKEYMASK: return NX_MODIFIERKEY_RALTERNATE; +#endif + case NX_COMMANDMASK: return NX_MODIFIERKEY_COMMAND; +#ifdef NX_DEVICELCMDKEYMASK + case NX_DEVICELCMDKEYMASK: return NX_MODIFIERKEY_COMMAND; + case NX_DEVICERCMDKEYMASK: return NX_MODIFIERKEY_RCOMMAND; +#endif + case NX_NUMERICPADMASK: return NX_MODIFIERKEY_NUMERICPAD; + case NX_HELPMASK: return NX_MODIFIERKEY_HELP; + case NX_SECONDARYFNMASK: return NX_MODIFIERKEY_SECONDARYFN; + } + return -1; +} + +/* + * DarwinModifierNXKeyToNXMask + * Returns 0 if key is not a known modifier key. + */ +int DarwinModifierNXKeyToNXMask(int key) { + switch (key) { + case NX_MODIFIERKEY_ALPHALOCK: return NX_ALPHASHIFTMASK; +#ifdef NX_DEVICELSHIFTKEYMASK + case NX_MODIFIERKEY_SHIFT: return NX_DEVICELSHIFTKEYMASK; + case NX_MODIFIERKEY_RSHIFT: return NX_DEVICERSHIFTKEYMASK; + case NX_MODIFIERKEY_CONTROL: return NX_DEVICELCTLKEYMASK; + case NX_MODIFIERKEY_RCONTROL: return NX_DEVICERCTLKEYMASK; + case NX_MODIFIERKEY_ALTERNATE: return NX_DEVICELALTKEYMASK; + case NX_MODIFIERKEY_RALTERNATE: return NX_DEVICERALTKEYMASK; + case NX_MODIFIERKEY_COMMAND: return NX_DEVICELCMDKEYMASK; + case NX_MODIFIERKEY_RCOMMAND: return NX_DEVICERCMDKEYMASK; +#else + case NX_MODIFIERKEY_SHIFT: return NX_SHIFTMASK; + case NX_MODIFIERKEY_CONTROL: return NX_CONTROLMASK; + case NX_MODIFIERKEY_ALTERNATE: return NX_ALTERNATEMASK; + case NX_MODIFIERKEY_COMMAND: return NX_COMMANDMASK; +#endif + case NX_MODIFIERKEY_NUMERICPAD: return NX_NUMERICPADMASK; + case NX_MODIFIERKEY_HELP: return NX_HELPMASK; + case NX_MODIFIERKEY_SECONDARYFN: return NX_SECONDARYFNMASK; + } + return 0; +} + +/* + * DarwinModifierStringToNXMask + * Returns 0 if string is not a known modifier. + */ +int DarwinModifierStringToNXMask(const char *str, int separatelr) { +#ifdef NX_DEVICELSHIFTKEYMASK + if(separatelr) { + if (!strcasecmp(str, "shift")) return NX_DEVICELSHIFTKEYMASK | NX_DEVICERSHIFTKEYMASK; + if (!strcasecmp(str, "control")) return NX_DEVICELCTLKEYMASK | NX_DEVICERCTLKEYMASK; + if (!strcasecmp(str, "option")) return NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK; + if (!strcasecmp(str, "alt")) return NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK; + if (!strcasecmp(str, "command")) return NX_DEVICELCMDKEYMASK | NX_DEVICERCMDKEYMASK; + if (!strcasecmp(str, "lshift")) return NX_DEVICELSHIFTKEYMASK; + if (!strcasecmp(str, "rshift")) return NX_DEVICERSHIFTKEYMASK; + if (!strcasecmp(str, "lcontrol")) return NX_DEVICELCTLKEYMASK; + if (!strcasecmp(str, "rcontrol")) return NX_DEVICERCTLKEYMASK; + if (!strcasecmp(str, "loption")) return NX_DEVICELALTKEYMASK; + if (!strcasecmp(str, "roption")) return NX_DEVICERALTKEYMASK; + if (!strcasecmp(str, "lalt")) return NX_DEVICELALTKEYMASK; + if (!strcasecmp(str, "ralt")) return NX_DEVICERALTKEYMASK; + if (!strcasecmp(str, "lcommand")) return NX_DEVICELCMDKEYMASK; + if (!strcasecmp(str, "rcommand")) return NX_DEVICERCMDKEYMASK; + } else { +#endif + if (!strcasecmp(str, "shift")) return NX_SHIFTMASK; + if (!strcasecmp(str, "control")) return NX_CONTROLMASK; + if (!strcasecmp(str, "option")) return NX_ALTERNATEMASK; + if (!strcasecmp(str, "alt")) return NX_ALTERNATEMASK; + if (!strcasecmp(str, "command")) return NX_COMMANDMASK; + if (!strcasecmp(str, "lshift")) return NX_SHIFTMASK; + if (!strcasecmp(str, "rshift")) return NX_SHIFTMASK; + if (!strcasecmp(str, "lcontrol")) return NX_CONTROLMASK; + if (!strcasecmp(str, "rcontrol")) return NX_CONTROLMASK; + if (!strcasecmp(str, "loption")) return NX_ALTERNATEMASK; + if (!strcasecmp(str, "roption")) return NX_ALTERNATEMASK; + if (!strcasecmp(str, "lalt")) return NX_ALTERNATEMASK; + if (!strcasecmp(str, "ralt")) return NX_ALTERNATEMASK; + if (!strcasecmp(str, "lcommand")) return NX_COMMANDMASK; + if (!strcasecmp(str, "rcommand")) return NX_COMMANDMASK; +#ifdef NX_DEVICELSHIFTKEYMASK + } +#endif + if (!strcasecmp(str, "lock")) return NX_ALPHASHIFTMASK; + if (!strcasecmp(str, "fn")) return NX_SECONDARYFNMASK; + if (!strcasecmp(str, "help")) return NX_HELPMASK; + if (!strcasecmp(str, "numlock")) return NX_NUMERICPADMASK; + return 0; +} + +/* + * LegalModifier + * This allows the ddx layer to prevent some keys from being remapped + * as modifier keys. + */ +Bool LegalModifier(unsigned int key, DeviceIntPtr pDev) +{ + return 1; } static inline UniChar macroman2ucs(unsigned char c) { @@ -196,41 +586,78 @@ static KeySym make_dead_key(KeySym in) { } Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) { +#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050 KeyboardLayoutRef key_layout; + int is_uchr = 1; +#endif const void *chr_data = NULL; int num_keycodes = NUM_KEYCODES; - UInt32 keyboard_type = 0; - int is_uchr = 1, i, j; + UInt32 keyboard_type = LMGetKbdType(); + int i, j; OSStatus err; KeySym *k; + CFDataRef currentKeyLayoutDataRef = NULL; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 TISInputSourceRef currentKeyLayoutRef = TISCopyCurrentKeyboardLayoutInputSource(); - keyboard_type = LMGetKbdType (); + if (currentKeyLayoutRef) { - CFDataRef currentKeyLayoutDataRef = (CFDataRef )TISGetInputSourceProperty(currentKeyLayoutRef, kTISPropertyUnicodeKeyLayoutData); - if (currentKeyLayoutDataRef) chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef); + currentKeyLayoutDataRef = (CFDataRef )TISGetInputSourceProperty(currentKeyLayoutRef, kTISPropertyUnicodeKeyLayoutData); + if (currentKeyLayoutDataRef) + chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef); } - +#endif + +#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050 if (chr_data == NULL) { - KLGetCurrentKeyboardLayout (&key_layout); - KLGetKeyboardLayoutProperty (key_layout, kKLuchrData, &chr_data); +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 + ErrorF("X11.app: Error detected in determining keyboard layout. If you are using an Apple-provided keyboard layout, please report this error at http://xquartz.macosforge.org and http://bugreport.apple.com\n"); + ErrorF("X11.app: Debug Info: keyboard_type=%u, currentKeyLayoutRef=%p, currentKeyLayoutDataRef=%p, chr_data=%p\n", + (unsigned)keyboard_type, currentKeyLayoutRef, currentKeyLayoutDataRef, chr_data); +#endif + + KLGetCurrentKeyboardLayout (&key_layout); + KLGetKeyboardLayoutProperty (key_layout, kKLuchrData, &chr_data); + +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 + if(chr_data != NULL) { + ErrorF("X11.app: Fallback succeeded, but this is still a bug. Please report the above information.\n"); + } +#endif } - + if (chr_data == NULL) { - KLGetKeyboardLayoutProperty (key_layout, kKLKCHRData, &chr_data); - is_uchr = 0; - num_keycodes = 128; + ErrorF("X11.app: Debug Info: kKLuchrData failed, trying kKLKCHRData.\n"); + ErrorF("If you are using a 3rd party keyboard layout, please see http://xquartz.macosforge.org/trac/ticket/154\n"); + KLGetKeyboardLayoutProperty (key_layout, kKLKCHRData, &chr_data); + is_uchr = 0; + num_keycodes = 128; + +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 + if(chr_data != NULL) { + ErrorF("X11.app: Fallback succeeded, but this is still a bug. Please report the above information.\n"); + } +#endif } +#endif + +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 + if(currentKeyLayoutRef) + CFRelease(currentKeyLayoutRef); +#endif if (chr_data == NULL) { ErrorF ( "Couldn't get uchr or kchr resource\n"); return FALSE; } - + /* Scan the keycode range for the Unicode character that each key produces in the four shift states. Then convert that to an X11 keysym (which may just the bit that says "this is Unicode" if it can't find the real symbol.) */ + + /* KeyTranslate is not available on 64-bit platforms; UCKeyTranslate + must be used instead. */ for (i = 0; i < num_keycodes; i++) { static const int mods[4] = {0, MOD_SHIFT, MOD_OPTION, @@ -239,7 +666,9 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) { k = info->keyMap + i * GLYPHS_PER_KEY; for (j = 0; j < 4; j++) { +#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050 if (is_uchr) { +#endif UniChar s[8]; UniCharCount len; UInt32 dead_key_state = 0, extra_dead = 0; @@ -263,6 +692,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) { k[j] = ucs2keysym (s[0]); if (dead_key_state != 0) k[j] = make_dead_key (k[j]); } +#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050 } else { // kchr UInt32 c, state = 0, state2 = 0; UInt16 code; @@ -286,6 +716,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) { if (state != 0) k[j] = make_dead_key (k[j]); } } +#endif } if (k[3] == k[2]) k[3] = NoSymbol; @@ -318,7 +749,6 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) { k[0] = known_numeric_keys[i].keypad; } } - if(currentKeyLayoutRef) CFRelease(currentKeyLayoutRef); - + return TRUE; } diff --git a/xorg-server/hw/xquartz/quartzKeyboard.h b/xorg-server/hw/xquartz/quartzKeyboard.h index 0c7e70e48..215a4a9a5 100644 --- a/xorg-server/hw/xquartz/quartzKeyboard.h +++ b/xorg-server/hw/xquartz/quartzKeyboard.h @@ -32,6 +32,8 @@ #include "X11/keysym.h" #include "inputstr.h" +#include <pthread.h> + // Each key can generate 4 glyphs. They are, in order: // unshifted, shifted, modeswitch unshifted, modeswitch shifted #define GLYPHS_PER_KEY 4 @@ -45,9 +47,20 @@ typedef struct darwinKeyboardInfo_struct { unsigned char modifierKeycodes[32][2]; } darwinKeyboardInfo; -/* These functions need to be implemented by XQuartz, XDarwin, etc. */ -void DarwinKeyboardReload(DeviceIntPtr pDev); +/* These functions need to be implemented by Xquartz, XDarwin, etc. */ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info); -unsigned int QuartzSystemKeymapSeed(void); + +/* Provided for darwinEvents.c */ +extern darwinKeyboardInfo keyInfo; +extern pthread_mutex_t keyInfo_mutex; +void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents); +int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide); +int DarwinModifierNXKeyToNXKeycode(int key, int side); +int DarwinModifierNXKeyToNXMask(int key); +int DarwinModifierNXMaskToNXKey(int mask); +int DarwinModifierStringToNXMask(const char *string, int separatelr); + +/* Provided for darwin.c */ +void DarwinKeyboardInit(DeviceIntPtr pDev); #endif /* QUARTZ_KEYBOARD_H */ diff --git a/xorg-server/hw/xquartz/quartzPasteboard.c b/xorg-server/hw/xquartz/quartzPasteboard.c index 0bf84f5d5..60bcabe4c 100644 --- a/xorg-server/hw/xquartz/quartzPasteboard.c +++ b/xorg-server/hw/xquartz/quartzPasteboard.c @@ -34,6 +34,8 @@ #include <dix-config.h> #endif +#include "misc.h" +#include "inputstr.h" #include "quartzPasteboard.h" #include <X11/Xatom.h> @@ -76,8 +78,8 @@ static char * QuartzReadCutBuffer(void) } // Write X cut buffer to Mac OS X pasteboard -// Called by ProcessInputEvents() in response to request from X server thread. -void QuartzWritePasteboard(void) +// Called by mieqProcessInputEvents() in response to request from X server thread. +void QuartzWritePasteboard(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) { char *text; text = QuartzReadCutBuffer(); @@ -90,8 +92,8 @@ void QuartzWritePasteboard(void) #define strequal(a, b) (0 == strcmp((a), (b))) // Read Mac OS X pasteboard into X cut buffer -// Called by ProcessInputEvents() in response to request from X server thread. -void QuartzReadPasteboard(void) +// Called by mieqProcessInputEvents() in response to request from X server thread. +void QuartzReadPasteboard(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) { char *oldText = QuartzReadCutBuffer(); char *text = QuartzReadCocoaPasteboard(); @@ -129,7 +131,7 @@ void QuartzReadPasteboard(void) event.u.selectionClear.time = GetTimeInMillis(); event.u.selectionClear.window = pSel->window; event.u.selectionClear.atom = pSel->selection; - TryClientEvents(pSel->client, &event, 1, NoEventMask, + TryClientEvents(pSel->client, dev, &event, 1, NoEventMask, NoEventMask /*CantBeFiltered*/, NullGrab); } diff --git a/xorg-server/hw/xquartz/quartzPasteboard.h b/xorg-server/hw/xquartz/quartzPasteboard.h index d6a8ee815..b51cd88e0 100644 --- a/xorg-server/hw/xquartz/quartzPasteboard.h +++ b/xorg-server/hw/xquartz/quartzPasteboard.h @@ -34,11 +34,11 @@ #define _QUARTZPASTEBOARD_H // Aqua->X -void QuartzReadPasteboard(void); +void QuartzReadPasteboard(int, xEventPtr, DeviceIntPtr, int); char * QuartzReadCocoaPasteboard(void); // caller must free string // X->Aqua -void QuartzWritePasteboard(void); +void QuartzWritePasteboard(int, xEventPtr, DeviceIntPtr, int); void QuartzWriteCocoaPasteboard(char *text); #endif /* _QUARTZPASTEBOARD_H */ diff --git a/xorg-server/hw/xquartz/quartzStartup.c b/xorg-server/hw/xquartz/quartzStartup.c index e25e15583..ba92ecef6 100644 --- a/xorg-server/hw/xquartz/quartzStartup.c +++ b/xorg-server/hw/xquartz/quartzStartup.c @@ -27,6 +27,8 @@ * use or other dealings in this Software without prior written authorization. */ +#include "sanitizedCarbon.h" + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -37,46 +39,69 @@ #include "quartzCommon.h" #include "X11Controller.h" #include "darwin.h" +#include "darwinEvents.h" +#include "quartzAudio.h" #include "quartz.h" #include "opaque.h" #include "micmap.h" -#ifdef NDEBUG -#undef NDEBUG -#include <assert.h> -#define NDEBUG 1 -#else #include <assert.h> -#endif -char **envpGlobal; // argcGlobal and argvGlobal - // are from dix/globals.c +#include <pthread.h> + +int dix_main(int argc, char **argv, char **envp); -int main(int argc, char **argv, char **envp); -void _InitHLTB(void); -void DarwinHandleGUI(int argc, char **argv, char **envp); +struct arg { + int argc; + char **argv; + char **envp; +}; static void server_thread (void *arg) { - exit (main (argcGlobal, argvGlobal, envpGlobal)); + struct arg args = *((struct arg *)arg); + free(arg); + exit (dix_main(args.argc, args.argv, args.envp)); } -/* - * DarwinHandleGUI - * This function is called first from main(). The first time - * it is called we start the Mac OS X front end. The front end - * will call main() again from another thread to run the X - * server. On the second call this function loads the user - * preferences set by the Mac OS X front end. - */ -void DarwinHandleGUI(int argc, char **argv, char **envp) { - static Bool been_here = FALSE; +static pthread_t create_thread (void *func, void *arg) { + pthread_attr_t attr; + pthread_t tid; + + pthread_attr_init (&attr); + pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM); + pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); + pthread_create (&tid, &attr, func, arg); + pthread_attr_destroy (&attr); + + return tid; +} + +void QuartzInitServer(int argc, char **argv, char **envp) { + struct arg *args = (struct arg*)malloc(sizeof(struct arg)); + if(!args) + FatalError("Could not allocate memory.\n"); + + args->argc = argc; + args->argv = argv; + args->envp = envp; + + APPKIT_THREAD_ID = pthread_self(); + SERVER_THREAD_ID = create_thread(server_thread, args); + + if (!SERVER_THREAD_ID) { + FatalError("can't create secondary thread\n"); + } +} + +int server_main(int argc, char **argv, char **envp) { int i; int fd[2]; - if (been_here) { - return; - } - been_here = TRUE; + /* Unset CFProcessPath, so our children don't inherit this kludge we need + * to load our nib. If an xterm gets this set, then it fails to + * 'open hi.txt' properly. + */ + unsetenv("CFProcessPath"); // Make a pipe to pass events assert( pipe(fd) == 0 ); @@ -84,11 +109,6 @@ void DarwinHandleGUI(int argc, char **argv, char **envp) { darwinEventWriteFD = fd[1]; fcntl(darwinEventReadFD, F_SETFL, O_NONBLOCK); - // Store command line arguments to pass back to main() - argcGlobal = argc; - argvGlobal = argv; - envpGlobal = envp; - for (i = 1; i < argc; i++) { // Display version info without starting Mac OS X UI if requested if (!strcmp( argv[i], "-showconfig" ) || !strcmp( argv[i], "-version" )) { @@ -97,16 +117,9 @@ void DarwinHandleGUI(int argc, char **argv, char **envp) { } } - /* Initially I ran the X server on the main thread, and received - events on the second thread. But now we may be using Carbon, - that needs to run on the main thread. (Otherwise, when it's - prebound, it will initialize itself on the wrong thread) - - grr.. but doing that means that if the X thread gets scheduled - before the main thread when we're _not_ prebound, things fail, - so initialize by hand. */ - - _InitHLTB(); - X11ControllerMain(argc, (const char **)argv, server_thread, NULL); + /* Create the audio mutex */ + QuartzAudioInit(); + + X11ControllerMain(argc, argv, envp); exit(0); } diff --git a/xorg-server/hw/xquartz/sanitizedCarbon.h b/xorg-server/hw/xquartz/sanitizedCarbon.h new file mode 100644 index 000000000..cc6ef198d --- /dev/null +++ b/xorg-server/hw/xquartz/sanitizedCarbon.h @@ -0,0 +1,32 @@ +/* + * Don't #include any of the AppKit, etc stuff directly since it will + * pollute the X11 namespace. + */ + +#ifndef _XQ_SANITIZED_CARBON_H_ +#define _XQ_SANITIZED_CARBON_H_ + +// QuickDraw in ApplicationServices has the following conflicts with +// the basic X server headers. Use QD_<name> to use the QuickDraw +// definition of any of these symbols, or the normal name for the +// X11 definition. +#define Cursor QD_Cursor +#define WindowPtr QD_WindowPtr +#define Picture QD_Picture +#define BOOL OSX_BOOL +#define EventType HIT_EventType + +#include <ApplicationServices/ApplicationServices.h> +#include <CoreServices/CoreServices.h> +#include <Carbon/Carbon.h> +#include <IOKit/hidsystem/event_status_driver.h> +#include <IOKit/hidsystem/ev_keymap.h> +#include <architecture/byte_order.h> // For the NXSwap* + +#undef Cursor +#undef WindowPtr +#undef Picture +#undef BOOL +#undef EventType + +#endif /* _XQ_SANITIZED_CARBON_H_ */ diff --git a/xorg-server/hw/xquartz/sanitizedCocoa.h b/xorg-server/hw/xquartz/sanitizedCocoa.h new file mode 100644 index 000000000..58de64c1c --- /dev/null +++ b/xorg-server/hw/xquartz/sanitizedCocoa.h @@ -0,0 +1,27 @@ +/* + * Don't #include any of the AppKit, etc stuff directly since it will + * pollute the X11 namespace. + */ + +#ifndef _XQ_SANITIZED_COCOA_H_ +#define _XQ_SANITIZED_COCOA_H_ + +// QuickDraw in ApplicationServices has the following conflicts with +// the basic X server headers. Use QD_<name> to use the QuickDraw +// definition of any of these symbols, or the normal name for the +// X11 definition. +#define Cursor QD_Cursor +#define WindowPtr QD_WindowPtr +#define Picture QD_Picture +#define BOOL OSX_BOOL +#define EventType HIT_EventType + +#include <Cocoa/Cocoa.h> + +#undef Cursor +#undef WindowPtr +#undef Picture +#undef BOOL +#undef EventType + +#endif /* _XQ_SANITIZED_COCOA_H_ */ diff --git a/xorg-server/hw/xquartz/threadSafety.c b/xorg-server/hw/xquartz/threadSafety.c new file mode 100644 index 000000000..85f85bd0a --- /dev/null +++ b/xorg-server/hw/xquartz/threadSafety.c @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2008 Apple, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT HOLDER(S) 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(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the sale, + * use or other dealings in this Software without prior written authorization. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "threadSafety.h" +#include "os.h" + +pthread_t APPKIT_THREAD_ID; +pthread_t SERVER_THREAD_ID; + +#include <AvailabilityMacros.h> + +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 +#include <execinfo.h> + +void spewCallStack(void) { + void* callstack[128]; + int i, frames = backtrace(callstack, 128); + char** strs = backtrace_symbols(callstack, frames); + + for (i = 0; i < frames; ++i) { + ErrorF("%s\n", strs[i]); + } + + free(strs); +} +#else +void spewCallStack(void) { + return; +} +#endif + +void _threadSafetyAssert(pthread_t tid, const char *file, const char *fun, int line) { + if(pthread_equal(pthread_self(), tid)) + return; + + /* NOOOO! */ + ErrorF("Thread Assertion Failed: self=%s, expected=%s\n%s:%s:%d\n", + threadSafetyID(pthread_self()), threadSafetyID(tid), + file, fun, line); + spewCallStack(); +} + +const char *threadSafetyID(pthread_t tid) { + if(pthread_equal(tid, APPKIT_THREAD_ID)) { + return "Appkit Thread"; + } else if(pthread_equal(tid, SERVER_THREAD_ID)) { + return "Xserver Thread"; + } else { + return "Unknown Thread"; + } +} diff --git a/xorg-server/hw/xquartz/darwinKeyboard.h b/xorg-server/hw/xquartz/threadSafety.h index 5cf64c7d1..7b009103a 100644 --- a/xorg-server/hw/xquartz/darwinKeyboard.h +++ b/xorg-server/hw/xquartz/threadSafety.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2004 Torrey T. Lyons. All Rights Reserved. + * Copyright (C) 2008 Apple, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -24,22 +24,33 @@ * use or other dealings in this Software without prior written authorization. */ -#ifndef DARWIN_KEYBOARD_H -#define DARWIN_KEYBOARD_H 1 +#ifndef _XQ_THREAD_SAFETY_H_ +#define _XQ_THREAD_SAFETY_H_ -#include "quartzKeyboard.h" +#define DEBUG_THREADS 1 -/* Provided for darwinEvents.c */ -extern darwinKeyboardInfo keyInfo; -void DarwinKeyboardReload(DeviceIntPtr pDev); -void DarwinKeyboardInit(DeviceIntPtr pDev); -int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide); -int DarwinModifierNXKeyToNXKeycode(int key, int side); -int DarwinModifierNXKeyToNXMask(int key); -int DarwinModifierNXMaskToNXKey(int mask); -int DarwinModifierStringToNXKey(const char *string); +#include <pthread.h> -/* Provided for darwin.c */ -void DarwinKeyboardInit(DeviceIntPtr pDev); +extern pthread_t APPKIT_THREAD_ID; +extern pthread_t SERVER_THREAD_ID; -#endif /* DARWIN_KEYBOARD_H */ +/* Dump the call stack */ +void spewCallStack(void); + +/* Print message to ErrorF if we're in the wrong thread */ +void _threadSafetyAssert(pthread_t tid, const char *file, const char *fun, int line); + +/* Get a string that identifies our thread nicely */ +const char *threadSafetyID(pthread_t tid); + +#define threadSafetyAssert(tid) _threadSafetyAssert(tid, __FILE__, __FUNCTION__, __LINE__) + +#ifdef DEBUG_THREADS +#define TA_APPKIT() threadSafetyAssert(APPKIT_THREAD_ID) +#define TA_SERVER() threadSafetyAssert(SERVER_THREAD_ID) +#else +#define TA_SERVER() +#define TA_APPKIT() +#endif + +#endif _XQ_THREAD_SAFETY_H_ diff --git a/xorg-server/hw/xquartz/xpr/Makefile.am b/xorg-server/hw/xquartz/xpr/Makefile.am index ae1b19297..e74580f73 100644 --- a/xorg-server/hw/xquartz/xpr/Makefile.am +++ b/xorg-server/hw/xquartz/xpr/Makefile.am @@ -1,72 +1,23 @@ -bin_PROGRAMS = Xquartz +noinst_LTLIBRARIES = libXquartzXpr.la AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS) AM_CPPFLAGS = \ -I$(srcdir) -I$(srcdir)/.. \ -I$(top_srcdir)/miext \ - -I$(top_srcdir)/miext/rootless \ - -I$(top_srcdir)/miext/rootless/safeAlpha + -I$(top_srcdir)/miext/rootless -Xquartz_SOURCES = \ +libXquartzXpr_la_SOURCES = \ appledri.c \ dri.c \ xprAppleWM.c \ xprCursor.c \ + xprEvent.c \ xprFrame.c \ xprScreen.c \ x-hash.c \ x-hook.c \ x-list.c -Xquartz_LDADD = \ - $(top_builddir)/hw/xquartz/libXquartz.la \ - $(top_builddir)/dix/dixfonts.lo \ - $(top_builddir)/config/libconfig.a \ - $(top_builddir)/dix/libdix.la \ - $(top_builddir)/os/libos.la \ - $(top_builddir)/dix/libxpstubs.la \ - $(top_builddir)/miext/shadow/libshadow.la \ - $(top_builddir)/fb/libfb.la \ - $(top_builddir)/mi/libmi.la \ - $(top_builddir)/composite/libcomposite.la \ - $(top_builddir)/damageext/libdamageext.la \ - $(top_builddir)/miext/damage/libdamage.la \ - $(top_builddir)/xfixes/libxfixes.la \ - $(top_builddir)/miext/cw/libcw.la \ - $(top_builddir)/Xext/libXext.la \ - $(top_builddir)/xkb/libxkb.la \ - $(top_builddir)/xkb/libxkbstubs.la \ - $(top_builddir)/Xi/libXi.la \ - $(top_builddir)/dbe/libdbe.la \ - $(top_builddir)/record/librecord.la \ - $(top_builddir)/XTrap/libxtrap.la \ - $(top_builddir)/miext/rootless/librootless.la \ - $(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \ - $(top_builddir)/miext/rootless/accel/librlAccel.la \ - $(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin - -Xquartz_LDFLAGS = \ - -XCClinker -Objc \ - -Wl,-u,_miDCInitialize \ - -Wl,-framework,Carbon \ - -L/System/Library/Frameworks/OpenGL.framework/Libraries -lGL \ - -Wl,-framework,OpenGL \ - -Wl,-framework,Cocoa \ - -Wl,-framework,CoreAudio \ - -Wl,-framework,IOKit - -appmandir = $(APP_MAN_DIR) -appman_PRE = Xquartz.man.pre -appman_PROCESSED = $(appman_PRE:man.pre=man) -appman_DATA = $(appman_PRE:man.pre=@APP_MAN_SUFFIX@) - -CLEANFILES = $(appman_PROCESSED) $(appman_DATA) - -include $(top_srcdir)/cpprules.in - -.man.$(APP_MAN_SUFFIX): - cp $< $@ - EXTRA_DIST = \ dri.h \ dristruct.h \ @@ -75,4 +26,5 @@ EXTRA_DIST = \ x-hash.h \ x-hook.h \ x-list.h \ - xpr.h + xpr.h \ + xprEvent.h diff --git a/xorg-server/hw/xquartz/xpr/Makefile.in b/xorg-server/hw/xquartz/xpr/Makefile.in index 6f3dcb75c..11d36bb49 100644 --- a/xorg-server/hw/xquartz/xpr/Makefile.in +++ b/xorg-server/hw/xquartz/xpr/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -14,11 +14,6 @@ @SET_MAKE@ -# -*- Makefile -*- -# Rules for generating files using the C pre-processor -# (Replaces CppFileTarget from Imake) - - VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -37,10 +32,8 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -bin_PROGRAMS = Xquartz$(EXEEXT) -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(top_srcdir)/cpprules.in subdir = hw/xquartz/xpr +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac @@ -50,68 +43,28 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ - $(top_builddir)/include/xgl-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ $(top_builddir)/include/kdrive-config.h CONFIG_CLEAN_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)" -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -PROGRAMS = $(bin_PROGRAMS) -am_Xquartz_OBJECTS = appledri.$(OBJEXT) dri.$(OBJEXT) \ - xprAppleWM.$(OBJEXT) xprCursor.$(OBJEXT) xprFrame.$(OBJEXT) \ - xprScreen.$(OBJEXT) x-hash.$(OBJEXT) x-hook.$(OBJEXT) \ - x-list.$(OBJEXT) -Xquartz_OBJECTS = $(am_Xquartz_OBJECTS) -am__DEPENDENCIES_1 = -Xquartz_DEPENDENCIES = $(top_builddir)/hw/xquartz/libXquartz.la \ - $(top_builddir)/dix/dixfonts.lo \ - $(top_builddir)/config/libconfig.a \ - $(top_builddir)/dix/libdix.la $(top_builddir)/os/libos.la \ - $(top_builddir)/dix/libxpstubs.la \ - $(top_builddir)/miext/shadow/libshadow.la \ - $(top_builddir)/fb/libfb.la $(top_builddir)/mi/libmi.la \ - $(top_builddir)/composite/libcomposite.la \ - $(top_builddir)/damageext/libdamageext.la \ - $(top_builddir)/miext/damage/libdamage.la \ - $(top_builddir)/xfixes/libxfixes.la \ - $(top_builddir)/miext/cw/libcw.la \ - $(top_builddir)/Xext/libXext.la $(top_builddir)/xkb/libxkb.la \ - $(top_builddir)/xkb/libxkbstubs.la $(top_builddir)/Xi/libXi.la \ - $(top_builddir)/dbe/libdbe.la \ - $(top_builddir)/record/librecord.la \ - $(top_builddir)/XTrap/libxtrap.la \ - $(top_builddir)/miext/rootless/librootless.la \ - $(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \ - $(top_builddir)/miext/rootless/accel/librlAccel.la \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) -Xquartz_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(Xquartz_LDFLAGS) \ - $(LDFLAGS) -o $@ +LTLIBRARIES = $(noinst_LTLIBRARIES) +libXquartzXpr_la_LIBADD = +am_libXquartzXpr_la_OBJECTS = appledri.lo dri.lo xprAppleWM.lo \ + xprCursor.lo xprEvent.lo xprFrame.lo xprScreen.lo x-hash.lo \ + x-hook.lo x-list.lo +libXquartzXpr_la_OBJECTS = $(am_libXquartzXpr_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ -SOURCES = $(Xquartz_SOURCES) -DIST_SOURCES = $(Xquartz_SOURCES) -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|^.*/||'`; -appmanDATA_INSTALL = $(INSTALL_DATA) -DATA = $(appman_DATA) +SOURCES = $(libXquartzXpr_la_SOURCES) +DIST_SOURCES = $(libXquartzXpr_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -120,8 +73,9 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ -APPDEFAULTDIR = @APPDEFAULTDIR@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@ +APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ @@ -142,10 +96,6 @@ CFLAGS = @CFLAGS@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DARWIN_LIBS = @DARWIN_LIBS@ DBUS_CFLAGS = @DBUS_CFLAGS@ @@ -167,6 +117,7 @@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ +DOLT_BASH = @DOLT_BASH@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ @@ -176,18 +127,15 @@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ -ECHO = @ECHO@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ -FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ -FREETYPE_LIBS = @FREETYPE_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ @@ -206,7 +154,7 @@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ -LAUNCHD = @LAUNCHD@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LEX = @LEX@ @@ -220,7 +168,10 @@ LIBTOOL = @LIBTOOL@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LINUXDOC = @LINUXDOC@ +LIPO = @LIPO@ LN_S = @LN_S@ +LTCOMPILE = @LTCOMPILE@ +LTCXXCOMPILE = @LTCXXCOMPILE@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -232,8 +183,7 @@ MESA_SOURCE = @MESA_SOURCE@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ -MKFONTDIR = @MKFONTDIR@ -MKFONTSCALE = @MKFONTSCALE@ +NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ @@ -242,8 +192,8 @@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -261,7 +211,7 @@ PS2PDF = @PS2PDF@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ -SED = sed +SED = @SED@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -276,7 +226,6 @@ VENDOR_NAME = @VENDOR_NAME@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VENDOR_RELEASE = @VENDOR_RELEASE@ VERSION = @VERSION@ -X11APP_ARCHS = @X11APP_ARCHS@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ @@ -286,27 +235,12 @@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ -XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@ -XEGL_LIBS = @XEGL_LIBS@ -XEGL_SYS_LIBS = @XEGL_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ -XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGFILE = @XF86CONFIGFILE@ -XF86MISC_CFLAGS = @XF86MISC_CFLAGS@ -XF86MISC_LIBS = @XF86MISC_LIBS@ XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ -XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@ -XGLMODULES_LIBS = @XGLMODULES_LIBS@ -XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@ -XGLXMODULES_LIBS = @XGLXMODULES_LIBS@ -XGLX_LIBS = @XGLX_LIBS@ -XGLX_SYS_LIBS = @XGLX_SYS_LIBS@ -XGL_LIBS = @XGL_LIBS@ -XGL_MODULE_PATH = @XGL_MODULE_PATH@ -XGL_SYS_LIBS = @XGL_SYS_LIBS@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ @@ -317,10 +251,6 @@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ -XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@ -XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@ -XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@ -XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ @@ -329,13 +259,8 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ -XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ -XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ -XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ -XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ -XPRINT_CFLAGS = @XPRINT_CFLAGS@ -XPRINT_LIBS = @XPRINT_LIBS@ -XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ +XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ +XPBPROXY_LIBS = @XPBPROXY_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ @@ -368,8 +293,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -389,7 +313,6 @@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ -ft_config = @ft_config@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -399,12 +322,12 @@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ -launchagentsdir = @launchagentsdir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ +lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ @@ -422,102 +345,25 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -xglmoduledir = @xglmoduledir@ -xpconfigdir = @xpconfigdir@ +noinst_LTLIBRARIES = libXquartzXpr.la AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS) AM_CPPFLAGS = \ -I$(srcdir) -I$(srcdir)/.. \ -I$(top_srcdir)/miext \ - -I$(top_srcdir)/miext/rootless \ - -I$(top_srcdir)/miext/rootless/safeAlpha + -I$(top_srcdir)/miext/rootless -Xquartz_SOURCES = \ +libXquartzXpr_la_SOURCES = \ appledri.c \ dri.c \ xprAppleWM.c \ xprCursor.c \ + xprEvent.c \ xprFrame.c \ xprScreen.c \ x-hash.c \ x-hook.c \ x-list.c -Xquartz_LDADD = \ - $(top_builddir)/hw/xquartz/libXquartz.la \ - $(top_builddir)/dix/dixfonts.lo \ - $(top_builddir)/config/libconfig.a \ - $(top_builddir)/dix/libdix.la \ - $(top_builddir)/os/libos.la \ - $(top_builddir)/dix/libxpstubs.la \ - $(top_builddir)/miext/shadow/libshadow.la \ - $(top_builddir)/fb/libfb.la \ - $(top_builddir)/mi/libmi.la \ - $(top_builddir)/composite/libcomposite.la \ - $(top_builddir)/damageext/libdamageext.la \ - $(top_builddir)/miext/damage/libdamage.la \ - $(top_builddir)/xfixes/libxfixes.la \ - $(top_builddir)/miext/cw/libcw.la \ - $(top_builddir)/Xext/libXext.la \ - $(top_builddir)/xkb/libxkb.la \ - $(top_builddir)/xkb/libxkbstubs.la \ - $(top_builddir)/Xi/libXi.la \ - $(top_builddir)/dbe/libdbe.la \ - $(top_builddir)/record/librecord.la \ - $(top_builddir)/XTrap/libxtrap.la \ - $(top_builddir)/miext/rootless/librootless.la \ - $(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \ - $(top_builddir)/miext/rootless/accel/librlAccel.la \ - $(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin - -Xquartz_LDFLAGS = \ - -XCClinker -Objc \ - -Wl,-u,_miDCInitialize \ - -Wl,-framework,Carbon \ - -L/System/Library/Frameworks/OpenGL.framework/Libraries -lGL \ - -Wl,-framework,OpenGL \ - -Wl,-framework,Cocoa \ - -Wl,-framework,CoreAudio \ - -Wl,-framework,IOKit - -appmandir = $(APP_MAN_DIR) -appman_PRE = Xquartz.man.pre -appman_PROCESSED = $(appman_PRE:man.pre=man) -appman_DATA = $(appman_PRE:man.pre=@APP_MAN_SUFFIX@) -CLEANFILES = $(appman_PROCESSED) $(appman_DATA) -SUFFIXES = .pre .man .man.pre - -# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM -# to cpp, because that trick does not work on all ANSI C preprocessors. -# Delete line numbers from the cpp output (-P is not portable, I guess). -# Allow XCOMM to be preceded by whitespace and provide a means of generating -# output lines with trailing backslashes. -# Allow XHASH to always be substituted, even in cases where XCOMM isn't. -CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \ - -e '/^\#line *[0-9][0-9]* *.*$$/d' \ - -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \ - -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \ - -e '/^[ ]*XHASH/s/XHASH/\#/' \ - -e '/\@\@$$/s/\@\@$$/\\/' - - -# Strings to replace in man pages -XORGRELSTRING = @PACKAGE_STRING@ -XORGMANNAME = X Version 11 -XSERVERNAME = Xorg -MANDEFS = \ - -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \ - -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \ - -D__appmansuffix__=$(APP_MAN_SUFFIX) \ - -D__filemansuffix__=$(FILE_MAN_SUFFIX) \ - -D__libmansuffix__=$(LIB_MAN_SUFFIX) \ - -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \ - -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \ - -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \ - -D__mandir__=$(mandir) \ - -D__projectroot__=$(prefix) \ - -D__xconfigfile__=$(__XCONFIGFILE__) -D__xconfigdir__=$(XCONFIGDIR) \ - -D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME) - EXTRA_DIST = \ dri.h \ dristruct.h \ @@ -526,18 +372,19 @@ EXTRA_DIST = \ x-hash.h \ x-hook.h \ x-list.h \ - xpr.h + xpr.h \ + xprEvent.h all: all-am .SUFFIXES: -.SUFFIXES: .pre .man .man.pre .$(APP_MAN_SUFFIX) .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/cpprules.in $(am__configure_deps) +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ @@ -561,37 +408,17 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - || test -f $$p1 \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ - rm -f "$(DESTDIR)$(bindir)/$$f"; \ - done -clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ done -Xquartz$(EXEEXT): $(Xquartz_OBJECTS) $(Xquartz_DEPENDENCIES) - @rm -f Xquartz$(EXEEXT) - $(Xquartz_LINK) $(Xquartz_OBJECTS) $(Xquartz_LDADD) $(LIBS) +libXquartzXpr.la: $(libXquartzXpr_la_OBJECTS) $(libXquartzXpr_la_DEPENDENCIES) + $(LINK) $(libXquartzXpr_la_OBJECTS) $(libXquartzXpr_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -599,15 +426,16 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/appledri.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dri.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x-hash.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x-hook.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x-list.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xprAppleWM.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xprCursor.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xprFrame.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xprScreen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/appledri.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dri.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x-hash.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x-hook.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x-list.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xprAppleWM.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xprCursor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xprEvent.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xprFrame.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xprScreen.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -635,30 +463,13 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -install-appmanDATA: $(appman_DATA) - @$(NORMAL_INSTALL) - test -z "$(appmandir)" || $(MKDIR_P) "$(DESTDIR)$(appmandir)" - @list='$(appman_DATA)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(appmanDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(appmandir)/$$f'"; \ - $(appmanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(appmandir)/$$f"; \ - done - -uninstall-appmanDATA: - @$(NORMAL_UNINSTALL) - @list='$(appman_DATA)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(appmandir)/$$f'"; \ - rm -f "$(DESTDIR)$(appmandir)/$$f"; \ - done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -728,11 +539,8 @@ distdir: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile $(PROGRAMS) $(DATA) +all-am: Makefile $(LTLIBRARIES) installdirs: - for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done install: install-am install-exec: install-exec-am install-data: install-data-am @@ -750,7 +558,6 @@ install-strip: mostlyclean-generic: clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -760,7 +567,8 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) @@ -778,11 +586,11 @@ info: info-am info-am: -install-data-am: install-appmanDATA +install-data-am: install-dvi: install-dvi-am -install-exec-am: install-binPROGRAMS +install-exec-am: install-html: install-html-am @@ -814,34 +622,23 @@ ps: ps-am ps-am: -uninstall-am: uninstall-appmanDATA uninstall-binPROGRAMS +uninstall-am: .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic clean-libtool ctags distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-appmanDATA install-binPROGRAMS install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-appmanDATA \ - uninstall-binPROGRAMS - - -.pre: - $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@ - -.man.pre.man: - $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@ - -.man.$(APP_MAN_SUFFIX): - cp $< $@ +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/xorg-server/hw/xquartz/xpr/appledri.c b/xorg-server/hw/xquartz/xpr/appledri.c index b4a4725e2..3667c0dea 100644 --- a/xorg-server/hw/xquartz/xpr/appledri.c +++ b/xorg-server/hw/xquartz/xpr/appledri.c @@ -56,6 +56,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "dri.h" #include "dristruct.h" #include "xpr.h" +#include "x-hash.h" static int DRIErrorBase = 0; @@ -190,7 +191,7 @@ static void surface_notify( ) { DRISurfaceNotifyArg *arg = _arg; - int client_index = (int) data; + int client_index = (int) x_cvt_vptr_to_uint(data); ClientPtr client; xAppleDRINotifyEvent se; @@ -236,7 +237,8 @@ ProcAppleDRICreateSurface( if (!DRICreateSurface( screenInfo.screens[stuff->screen], (Drawable)stuff->drawable, pDrawable, stuff->client_id, &sid, key, - surface_notify, (void *) client->index)) { + surface_notify, + x_cvt_uint_to_vptr(client->index))) { return BadValue; } diff --git a/xorg-server/hw/xquartz/xpr/dri.c b/xorg-server/hw/xquartz/xpr/dri.c index 3aacb192d..50b478b9c 100644 --- a/xorg-server/hw/xquartz/xpr/dri.c +++ b/xorg-server/hw/xquartz/xpr/dri.c @@ -71,9 +71,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <AvailabilityMacros.h> -static DevPrivateKey DRIScreenPrivKey = &DRIScreenPrivKey; -static DevPrivateKey DRIWindowPrivKey = &DRIWindowPrivKey; -static DevPrivateKey DRIPixmapPrivKey = &DRIPixmapPrivKey; +static int DRIScreenPrivKeyIndex; +static DevPrivateKey DRIScreenPrivKey = &DRIScreenPrivKeyIndex; +static int DRIWindowPrivKeyIndex; +static DevPrivateKey DRIWindowPrivKey = &DRIWindowPrivKeyIndex; +static int DRIPixmapPrivKeyIndex; +static DevPrivateKey DRIPixmapPrivKey = &DRIPixmapPrivKeyIndex; static RESTYPE DRIDrawablePrivResType; @@ -343,6 +346,121 @@ DRIUpdateSurface(DRIDrawablePrivPtr pDRIDrawablePriv, DrawablePtr pDraw) xp_configure_surface(pDRIDrawablePriv->sid, flags, &wc); } +/* Return NULL if an error occurs. */ +static DRIDrawablePrivPtr +CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, xp_window_id *widPtr) { + DRIDrawablePrivPtr pDRIDrawablePriv; + xp_window_id wid = 0; + + *widPtr = 0; + + pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); + + if (pDRIDrawablePriv == NULL) { + xp_error err; + xp_window_changes wc; + + /* allocate a DRI Window Private record */ + if (!(pDRIDrawablePriv = xalloc(sizeof(*pDRIDrawablePriv)))) { + return NULL; + } + + pDRIDrawablePriv->pDraw = (DrawablePtr)pWin; + pDRIDrawablePriv->pScreen = pScreen; + pDRIDrawablePriv->refCount = 0; + pDRIDrawablePriv->drawableIndex = -1; + pDRIDrawablePriv->notifiers = NULL; + + /* find the physical window */ + wid = x_cvt_vptr_to_uint(RootlessFrameForWindow(pWin, TRUE)); + + if (wid == 0) { + xfree(pDRIDrawablePriv); + return NULL; + } + + /* allocate the physical surface */ + err = xp_create_surface(wid, &pDRIDrawablePriv->sid); + + if (err != Success) { + xfree(pDRIDrawablePriv); + return NULL; + } + + /* Make it visible */ + wc.stack_mode = XP_MAPPED_ABOVE; + wc.sibling = 0; + err = xp_configure_surface(pDRIDrawablePriv->sid, XP_STACKING, &wc); + + if (err != Success) { + xp_destroy_surface(pDRIDrawablePriv->sid); + xfree(pDRIDrawablePriv); + return NULL; + } + + /* save private off of preallocated index */ + dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, + pDRIDrawablePriv); + } + + *widPtr = wid; + + return pDRIDrawablePriv; +} + +/* Return FALSE if an error occurs. */ +static DRIDrawablePrivPtr +CreateSurfaceForPixmap(ScreenPtr pScreen, PixmapPtr pPix) { + DRIDrawablePrivPtr pDRIDrawablePriv; + + pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix); + + if (pDRIDrawablePriv == NULL) { + xp_error err; + xp_window_changes wc; + + /* allocate a DRI Window Private record */ + if (!(pDRIDrawablePriv = xcalloc(1, sizeof(*pDRIDrawablePriv)))) { + return NULL; + } + + pDRIDrawablePriv->pDraw = (DrawablePtr)pPix; + pDRIDrawablePriv->pScreen = pScreen; + pDRIDrawablePriv->refCount = 0; + pDRIDrawablePriv->drawableIndex = -1; + pDRIDrawablePriv->notifiers = NULL; + + /* Passing a null window id to Xplugin in 10.3+ asks for + an accelerated offscreen surface. */ + + err = xp_create_surface(0, &pDRIDrawablePriv->sid); + if (err != Success) { + xfree(pDRIDrawablePriv); + return NULL; + } + + wc.x = 0; + wc.y = 0; + wc.width = pPix->drawable.width; + wc.height = pPix->drawable.height; + + err = xp_configure_surface(pDRIDrawablePriv->sid, XP_BOUNDS, &wc); + + if(err != Success) { + xp_destroy_surface(pDRIDrawablePriv->sid); + xfree(pDRIDrawablePriv); + return NULL; + } + + /* save private off of preallocated index */ + dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, + pDRIDrawablePriv); + } + + return pDRIDrawablePriv; +} + + Bool DRICreateSurface(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable, xp_client_id client_id, @@ -350,107 +468,39 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id, void (*notify) (void *arg, void *data), void *notify_data) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIDrawablePrivPtr pDRIDrawablePriv; xp_window_id wid = 0; + DRIDrawablePrivPtr pDRIDrawablePriv; if (pDrawable->type == DRAWABLE_WINDOW) { - WindowPtr pWin = (WindowPtr)pDrawable; - - pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); - if (pDRIDrawablePriv == NULL) { - xp_error err; - xp_window_changes wc; - - /* allocate a DRI Window Private record */ - if (!(pDRIDrawablePriv = xalloc(sizeof(DRIDrawablePrivRec)))) { - return FALSE; - } - - pDRIDrawablePriv->pDraw = pDrawable; - pDRIDrawablePriv->pScreen = pScreen; - pDRIDrawablePriv->refCount = 0; - pDRIDrawablePriv->drawableIndex = -1; - pDRIDrawablePriv->notifiers = NULL; - - /* find the physical window */ - wid = (xp_window_id) RootlessFrameForWindow(pWin, TRUE); - if (wid == 0) { - xfree(pDRIDrawablePriv); - return FALSE; - } - - /* allocate the physical surface */ - err = xp_create_surface(wid, &pDRIDrawablePriv->sid); - if (err != Success) { - xfree(pDRIDrawablePriv); - return FALSE; - } - - /* Make it visible */ - wc.stack_mode = XP_MAPPED_ABOVE; - wc.sibling = 0; - err = xp_configure_surface(pDRIDrawablePriv->sid, XP_STACKING, &wc); - if (err != Success) - { - xp_destroy_surface(pDRIDrawablePriv->sid); - xfree(pDRIDrawablePriv); - return FALSE; - } + pDRIDrawablePriv = CreateSurfaceForWindow(pScreen, + (WindowPtr)pDrawable, &wid); - /* save private off of preallocated index */ - dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, - pDRIDrawablePriv); - } + if(NULL == pDRIDrawablePriv) + return FALSE; /*error*/ } - #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 else if (pDrawable->type == DRAWABLE_PIXMAP) { - PixmapPtr pPix = (PixmapPtr)pDrawable; - - pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix); - if (pDRIDrawablePriv == NULL) { - xp_error err; + pDRIDrawablePriv = CreateSurfaceForPixmap(pScreen, + (PixmapPtr)pDrawable); - /* allocate a DRI Window Private record */ - if (!(pDRIDrawablePriv = xcalloc(1, sizeof(DRIDrawablePrivRec)))) { - return FALSE; - } - - pDRIDrawablePriv->pDraw = pDrawable; - pDRIDrawablePriv->pScreen = pScreen; - pDRIDrawablePriv->refCount = 0; - pDRIDrawablePriv->drawableIndex = -1; - pDRIDrawablePriv->notifiers = NULL; - - /* Passing a null window id to Xplugin in 10.3+ asks for - an accelerated offscreen surface. */ - - err = xp_create_surface(0, &pDRIDrawablePriv->sid); - if (err != Success) { - xfree(pDRIDrawablePriv); - return FALSE; - } - - /* save private off of preallocated index */ - dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, - pDRIDrawablePriv); - } + if(NULL == pDRIDrawablePriv) + return FALSE; /*error*/ } #endif - else { /* for GLX 1.3, a PBuffer */ /* NOT_DONE */ return FALSE; } + + /* Finish initialization of new surfaces */ if (pDRIDrawablePriv->refCount == 0) { unsigned int key[2] = {0}; xp_error err; /* try to give the client access to the surface */ - if (client_id != 0 && wid != 0) - { + if (client_id != 0 && wid != 0) { err = xp_export_surface(wid, pDRIDrawablePriv->sid, client_id, key); if (err != Success) { @@ -469,7 +519,7 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id, if (surface_hash == NULL) surface_hash = x_hash_table_new(NULL, NULL, NULL, NULL); x_hash_table_insert(surface_hash, - (void *) pDRIDrawablePriv->sid, pDRIDrawablePriv); + x_cvt_uint_to_vptr(pDRIDrawablePriv->sid), pDRIDrawablePriv); /* track this in case this window is destroyed */ AddResource(id, DRIDrawablePrivResType, (pointer)pDrawable); @@ -551,7 +601,7 @@ DRIDrawablePrivDelete(pointer pResource, XID id) if (pDRIDrawablePriv->sid != 0) { xp_destroy_surface(pDRIDrawablePriv->sid); - x_hash_table_remove(surface_hash, (void *) pDRIDrawablePriv->sid); + x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(pDRIDrawablePriv->sid)); } if (pDRIDrawablePriv->notifiers != NULL) @@ -713,7 +763,7 @@ DRISurfaceNotify(xp_surface_id id, int kind) if (surface_hash != NULL) { pDRIDrawablePriv = x_hash_table_lookup(surface_hash, - (void *) id, NULL); + x_cvt_uint_to_vptr(id), NULL); } if (pDRIDrawablePriv == NULL) @@ -722,7 +772,7 @@ DRISurfaceNotify(xp_surface_id id, int kind) if (kind == AppleDRISurfaceNotifyDestroyed) { pDRIDrawablePriv->sid = 0; - x_hash_table_remove(surface_hash, (void *) id); + x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(id)); } x_hook_run(pDRIDrawablePriv->notifiers, &arg); diff --git a/xorg-server/hw/xquartz/xpr/dri.h b/xorg-server/hw/xquartz/xpr/dri.h index cf2638a9f..8bb2e9e80 100644 --- a/xorg-server/hw/xquartz/xpr/dri.h +++ b/xorg-server/hw/xquartz/xpr/dri.h @@ -41,7 +41,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "scrnintstr.h" #define _APPLEDRI_SERVER_ #include "appledri.h" -#include "Xplugin.h" +#include <Xplugin.h> typedef void (*ClipNotifyPtr)( WindowPtr, int, int ); diff --git a/xorg-server/hw/xquartz/xpr/x-hash.c b/xorg-server/hw/xquartz/xpr/x-hash.c index 55d28bacd..7c6a67bd1 100644 --- a/xorg-server/hw/xquartz/xpr/x-hash.c +++ b/xorg-server/hw/xquartz/xpr/x-hash.c @@ -80,13 +80,13 @@ hash_table_destroy_item (x_hash_table *h, void *k, void *v) (*h->destroy_value) (v); } -static inline unsigned int +static inline size_t hash_table_hash_key (x_hash_table *h, void *k) { if (h->hash_key != 0) return (*h->hash_key) (k); else - return (unsigned int) k; + return (size_t) k; } static inline int @@ -104,7 +104,7 @@ hash_table_split (x_hash_table *h) x_list **new, **old; x_list *node, *item, *next; int new_size, old_size; - unsigned int b; + size_t b; int i; if (h->bucket_index == N_BUCKET_SIZES - 1) @@ -207,7 +207,7 @@ X_PFX (hash_table_size) (x_hash_table *h) static void hash_table_modify (x_hash_table *h, void *k, void *v, int replace) { - unsigned int hash_value; + size_t hash_value; x_list *node, *item; assert (h != NULL); @@ -266,7 +266,7 @@ X_PFX (hash_table_replace) (x_hash_table *h, void *k, void *v) X_EXTERN void X_PFX (hash_table_remove) (x_hash_table *h, void *k) { - unsigned int hash_value; + size_t hash_value; x_list **ptr, *item; assert (h != NULL); @@ -294,7 +294,7 @@ X_PFX (hash_table_remove) (x_hash_table *h, void *k) X_EXTERN void * X_PFX (hash_table_lookup) (x_hash_table *h, void *k, void **k_ret) { - unsigned int hash_value; + size_t hash_value; x_list *node, *item; assert (h != NULL); diff --git a/xorg-server/hw/xquartz/xpr/x-hash.h b/xorg-server/hw/xquartz/xpr/x-hash.h index 3456dbedf..78bc7b317 100644 --- a/xorg-server/hw/xquartz/xpr/x-hash.h +++ b/xorg-server/hw/xquartz/xpr/x-hash.h @@ -30,6 +30,9 @@ #ifndef X_HASH_H #define X_HASH_H 1 +#include <stdlib.h> +#include <assert.h> + typedef struct x_hash_table_struct x_hash_table; typedef int (x_compare_fun) (const void *a, const void *b); @@ -57,4 +60,32 @@ X_EXTERN void X_PFX (hash_table_foreach) (x_hash_table *h, x_hash_foreach_fun *fun, void *data); +/* Conversion between unsigned int (e.g. xp_resource_id) and void pointer */ + +/* Forward declarations */ +static __inline__ void * +X_PFX (cvt_uint_to_vptr) (unsigned int val) __attribute__((always_inline)); +static __inline__ unsigned int +X_PFX (cvt_vptr_to_uint) (void * val) __attribute__((always_inline)); + +/* Implementations */ +static __inline__ void * +X_PFX (cvt_uint_to_vptr) (unsigned int val) +{ + return (void*)((size_t)(val)); +} + +static __inline__ unsigned int +X_PFX (cvt_vptr_to_uint) (void * val) +{ + size_t sv = (size_t)val; + unsigned int uv = (unsigned int)sv; + + /* If this assert fails, chances are val actually is a pointer, + or there's been memory corruption */ + assert(sv == uv); + + return uv; +} + #endif /* X_HASH_H */ diff --git a/xorg-server/hw/xquartz/xpr/xpr.h b/xorg-server/hw/xquartz/xpr/xpr.h index b8c69df0d..ab79a42cd 100644 --- a/xorg-server/hw/xquartz/xpr/xpr.h +++ b/xorg-server/hw/xquartz/xpr/xpr.h @@ -29,7 +29,9 @@ #ifndef XPR_H #define XPR_H +#include "windowstr.h" #include "screenint.h" +#include <Xplugin.h> Bool QuartzModeBundleInit(void); @@ -37,6 +39,7 @@ void AppleDRIExtensionInit(void); void xprAppleWMInit(void); Bool xprInit(ScreenPtr pScreen); Bool xprIsX11Window(void *nsWindow, int windowNumber); +WindowPtr xprGetXWindow(xp_window_id wid); void xprHideWindows(Bool hide); diff --git a/xorg-server/hw/xquartz/xpr/xprAppleWM.c b/xorg-server/hw/xquartz/xpr/xprAppleWM.c index bd82df03c..fae9a0422 100644 --- a/xorg-server/hw/xquartz/xpr/xprAppleWM.c +++ b/xorg-server/hw/xquartz/xpr/xprAppleWM.c @@ -32,10 +32,26 @@ #endif #include "xpr.h" + +#define _APPLEWM_SERVER_ +#include <X11/extensions/applewmstr.h> + #include "applewmExt.h" #include "rootless.h" -#include "Xplugin.h" +#include <Xplugin.h> #include <X11/X.h> +#include "quartz.h" +#include "x-hash.h" + +/* This lookup table came straight from the Tiger X11 source. I tried to figure + * it out based on CGWindowLevel.h, but I dunno... -JH + */ +static const int normal_window_levels[AppleWMNumWindowLevels+1] = { +0, 3, 4, 5, INT_MIN + 30, INT_MIN + 29, +}; +static const int rooted_window_levels[AppleWMNumWindowLevels+1] = { +202, 203, 204, 205, 201, 200 +}; static int xprSetWindowLevel( WindowPtr pWin, @@ -44,13 +60,18 @@ static int xprSetWindowLevel( xp_window_id wid; xp_window_changes wc; - wid = (xp_window_id) RootlessFrameForWindow (pWin, TRUE); + wid = x_cvt_vptr_to_uint(RootlessFrameForWindow (pWin, TRUE)); if (wid == 0) return BadWindow; RootlessStopDrawing (pWin, FALSE); - wc.window_level = level; + //if (WINREC(WindowTable[pWin->drawable.pScreen->myNum]) == NULL) + if (quartzHasRoot) + wc.window_level = normal_window_levels[level]; + else + wc.window_level = rooted_window_levels[level]; + if (xp_configure_window (wid, XP_WINDOW_LEVEL, &wc) != Success) { return BadValue; } @@ -70,7 +91,7 @@ static int xprFrameDraw( { xp_window_id wid; - wid = (xp_window_id) RootlessFrameForWindow (pWin, FALSE); + wid = x_cvt_vptr_to_uint(RootlessFrameForWindow (pWin, FALSE)); if (wid == 0) return BadWindow; diff --git a/xorg-server/hw/xquartz/xpr/xprCursor.c b/xorg-server/hw/xquartz/xpr/xprCursor.c index e084ef90e..4345beea4 100644 --- a/xorg-server/hw/xquartz/xpr/xprCursor.c +++ b/xorg-server/hw/xquartz/xpr/xprCursor.c @@ -29,6 +29,8 @@ * use or other dealings in this Software without prior written authorization. */ +#include "sanitizedCarbon.h" + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -37,7 +39,7 @@ #include "xpr.h" #include "darwin.h" #include "darwinEvents.h" -#include "Xplugin.h" +#include <Xplugin.h> #include "mi.h" #include "scrnintstr.h" @@ -47,6 +49,7 @@ #include "globals.h" #include "servermd.h" #include "dixevents.h" +#include "x-hash.h" typedef struct { int cursorVisible; @@ -54,7 +57,8 @@ typedef struct { miPointerSpriteFuncPtr spriteFuncs; } QuartzCursorScreenRec, *QuartzCursorScreenPtr; -static DevPrivateKey darwinCursorScreenKey = &darwinCursorScreenKey; +static int darwinCursorScreenKeyIndex; +static DevPrivateKey darwinCursorScreenKey = &darwinCursorScreenKeyIndex; #define CURSOR_PRIV(pScreen) ((QuartzCursorScreenPtr) \ dixLookupPrivate(&pScreen->devPrivates, darwinCursorScreenKey)) @@ -181,7 +185,7 @@ load_cursor(CursorPtr src, int screen) * Convert the X cursor representation to native format if possible. */ static Bool -QuartzRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) +QuartzRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { if(pCursor == NULL || pCursor->bits == NULL) return FALSE; @@ -197,7 +201,7 @@ QuartzRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) * Free the storage space associated with a realized cursor. */ static Bool -QuartzUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) +QuartzUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { return TRUE; } @@ -208,7 +212,7 @@ QuartzUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) * Set the cursor sprite and position. */ static void -QuartzSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y) +QuartzSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y) { QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); @@ -235,25 +239,15 @@ QuartzSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y) } } - /* * QuartzMoveCursor * Move the cursor. This is a noop for us. */ static void -QuartzMoveCursor(ScreenPtr pScreen, int x, int y) +QuartzMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { } - -static miPointerSpriteFuncRec quartzSpriteFuncsRec = { - QuartzRealizeCursor, - QuartzUnrealizeCursor, - QuartzSetCursor, - QuartzMoveCursor -}; - - /* =========================================================================== @@ -289,18 +283,8 @@ QuartzCrossScreen(ScreenPtr pScreen, Bool entering) * */ static void -QuartzWarpCursor(ScreenPtr pScreen, int x, int y) +QuartzWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { - static Bool neverMoved = TRUE; - - if (neverMoved) - { - /* Don't move the cursor the first time. This is the - jump-to-center initialization, and it's annoying. */ - neverMoved = FALSE; - return; - } - if (quartzServerVisible) { int sx, sy; @@ -311,8 +295,8 @@ QuartzWarpCursor(ScreenPtr pScreen, int x, int y) CGWarpMouseCursorPosition(CGPointMake(sx + x, sy + y)); } - miPointerWarpCursor(pScreen, x, y); - miPointerUpdate(); + miPointerWarpCursor(pDev, pScreen, x, y); + miPointerUpdateSprite(pDev); } @@ -320,8 +304,8 @@ static miPointerScreenFuncRec quartzScreenFuncsRec = { QuartzCursorOffScreen, QuartzCrossScreen, QuartzWarpCursor, - DarwinEQPointerPost, - DarwinEQSwitchScreen + NULL, + NULL }; @@ -383,13 +367,16 @@ QuartzInitCursor(ScreenPtr pScreen) PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); ScreenPriv->spriteFuncs = PointPriv->spriteFuncs; - PointPriv->spriteFuncs = &quartzSpriteFuncsRec; + PointPriv->spriteFuncs->RealizeCursor = QuartzRealizeCursor; + PointPriv->spriteFuncs->UnrealizeCursor = QuartzUnrealizeCursor; + PointPriv->spriteFuncs->SetCursor = QuartzSetCursor; + PointPriv->spriteFuncs->MoveCursor = QuartzMoveCursor; + ScreenPriv->cursorVisible = TRUE; return TRUE; } - /* * QuartzSuspendXCursor * X server is hiding. Restore the Aqua cursor. @@ -410,13 +397,15 @@ QuartzResumeXCursor(ScreenPtr pScreen, int x, int y) WindowPtr pWin; CursorPtr pCursor; - pWin = GetSpriteWindow(); + /* TODO: Tablet? */ + + pWin = GetSpriteWindow(darwinPointer); if (pWin->drawable.pScreen != pScreen) return; - pCursor = GetSpriteCursor(); + pCursor = GetSpriteCursor(darwinPointer); if (pCursor == NULL) return; - QuartzSetCursor(pScreen, pCursor, x, y); + QuartzSetCursor(darwinPointer, pScreen, pCursor, x, y); } diff --git a/xorg-server/hw/xquartz/xpr/xprEvent.c b/xorg-server/hw/xquartz/xpr/xprEvent.c new file mode 100644 index 000000000..08581c0e3 --- /dev/null +++ b/xorg-server/hw/xquartz/xpr/xprEvent.c @@ -0,0 +1,91 @@ +/* Copyright (c) 2008 Apple Inc. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT + * HOLDER(S) 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(s) of the above + * copyright holders shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "xpr.h" + +#define NEED_EVENTS +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xproto.h> +#include "misc.h" +#include "windowstr.h" +#include "pixmapstr.h" +#include "inputstr.h" +#include "mi.h" +#include "scrnintstr.h" +#include "mipointer.h" + +#include "darwin.h" +#include "quartz.h" +#include "quartzKeyboard.h" +#include "darwinEvents.h" + +#include <sys/types.h> +#include <sys/uio.h> +#include <unistd.h> + +#include "rootlessWindow.h" +#include "xprEvent.h" + +static void xprEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) { + int i; + + TA_SERVER(); + + DEBUG_LOG("DarwinEventHandler(%d, %p, %p, %d)\n", screenNum, xe, dev, nevents); + for (i=0; i<nevents; i++) { + switch(xe[i].u.u.type) { + + case kXquartzWindowState: + DEBUG_LOG("kXquartzWindowState\n"); + RootlessNativeWindowStateChanged(xprGetXWindow(xe[i].u.clientMessage.u.l.longs0), + xe[i].u.clientMessage.u.l.longs1); + break; + + case kXquartzWindowMoved: + DEBUG_LOG("kXquartzWindowMoved\n"); + RootlessNativeWindowMoved(xprGetXWindow(xe[i].u.clientMessage.u.l.longs0)); + break; + + case kXquartzBringAllToFront: + DEBUG_LOG("kXquartzBringAllToFront\n"); + RootlessOrderAllWindows(); + break; + } + } +} + +void QuartzModeEQInit(void) { + mieqSetHandler(kXquartzWindowState, xprEventHandler); + mieqSetHandler(kXquartzWindowMoved, xprEventHandler); + mieqSetHandler(kXquartzBringAllToFront, xprEventHandler); +} diff --git a/xorg-server/hw/xquartz/xpr/xprEvent.h b/xorg-server/hw/xquartz/xpr/xprEvent.h new file mode 100644 index 000000000..5af9dfd77 --- /dev/null +++ b/xorg-server/hw/xquartz/xpr/xprEvent.h @@ -0,0 +1,34 @@ +/* Copyright (c) 2008 Apple Inc. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice 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 ABOVE LISTED COPYRIGHT + * HOLDER(S) 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(s) of the above + * copyright holders shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization. + */ + +#ifndef __XPR_EVENT_H__ +#define __XPR_EVENT_H__ + +void QuartzModeEQInit(void); + +#endif diff --git a/xorg-server/hw/xquartz/xpr/xprFrame.c b/xorg-server/hw/xquartz/xpr/xprFrame.c index 864ef0d40..9a143ade0 100644 --- a/xorg-server/hw/xquartz/xpr/xprFrame.c +++ b/xorg-server/hw/xquartz/xpr/xprFrame.c @@ -33,7 +33,7 @@ #include "xpr.h" #include "rootlessCommon.h" -#include "Xplugin.h" +#include <Xplugin.h> #include "x-hash.h" #include "x-list.h" #include "applewmExt.h" @@ -43,6 +43,8 @@ #include <X11/Xatom.h> #include "windowstr.h" +#include "threadSafety.h" + #include <pthread.h> #define DEFINE_ATOM_HELPER(func,atom_name) \ @@ -62,18 +64,35 @@ DEFINE_ATOM_HELPER(xa_native_window_id, "_NATIVE_WINDOW_ID") static x_hash_table *window_hash; static pthread_mutex_t window_hash_mutex; -static Bool no_configure_window; +/* Prototypes for static functions */ +static Bool xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, + int newX, int newY, RegionPtr pShape); +static void xprDestroyFrame(RootlessFrameID wid); +static void xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY); +static void xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen, + int newX, int newY, unsigned int newW, unsigned int newH, + unsigned int gravity); +static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid); +static void xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape); +static void xprUnmapFrame(RootlessFrameID wid); +static void xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow); +static void xprStopDrawing(RootlessFrameID wid, Bool flush); +static void xprUpdateRegion(RootlessFrameID wid, RegionPtr pDamage); +static void xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects, + int shift_x, int shift_y); +static void xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin); +static Bool xprDoReorderWindow(RootlessWindowPtr pFrame); +static void xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec *dstRects, + int dx, int dy); static inline xp_error xprConfigureWindow(xp_window_id id, unsigned int mask, const xp_window_changes *values) { - // ErrorF("xprConfigureWindow()\n"); - if (!no_configure_window) - return xp_configure_window(id, mask, values); - else - return XP_Success; + TA_SERVER(); + + return xp_configure_window(id, mask, values); } @@ -84,7 +103,9 @@ xprSetNativeProperty(RootlessWindowPtr pFrame) unsigned int native_id; long data; - err = xp_get_native_window((xp_window_id) pFrame->wid, &native_id); + TA_SERVER(); + + err = xp_get_native_window(x_cvt_vptr_to_uint(pFrame->wid), &native_id); if (err == Success) { /* FIXME: move this to AppleWM extension */ @@ -108,6 +129,8 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, unsigned int mask = 0; xp_error err; + TA_SERVER(); + wc.x = newX; wc.y = newY; wc.width = pFrame->width; @@ -118,11 +141,9 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, if (pWin->drawable.depth == 8) { wc.depth = XP_DEPTH_INDEX8; -#if 0 - wc.colormap = xprColormapCallback; + wc.colormap = RootlessColormapCallback; wc.colormap_data = pScreen; mask |= XP_COLORMAP; -#endif } else if (pWin->drawable.depth == 15) wc.depth = XP_DEPTH_RGB555; @@ -169,11 +190,13 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, void xprDestroyFrame(RootlessFrameID wid) { + TA_SERVER(); + pthread_mutex_lock(&window_hash_mutex); x_hash_table_remove(window_hash, wid); pthread_mutex_unlock(&window_hash_mutex); - xp_destroy_window((xp_window_id) wid); + xp_destroy_window(x_cvt_vptr_to_uint(wid)); } @@ -183,12 +206,14 @@ xprDestroyFrame(RootlessFrameID wid) void xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY) { + TA_SERVER(); + xp_window_changes wc; wc.x = newX; wc.y = newY; // ErrorF("xprMoveFrame(%d, %p, %d, %d)\n", wid, pScreen, newX, newY); - xprConfigureWindow((xp_window_id) wid, XP_ORIGIN, &wc); + xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_ORIGIN, &wc); } @@ -202,6 +227,8 @@ xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen, { xp_window_changes wc; + TA_SERVER(); + wc.x = newX; wc.y = newY; wc.width = newW; @@ -211,7 +238,7 @@ xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen, /* It's unlikely that being async will save us anything here. But it can't hurt. */ - xprConfigureWindow((xp_window_id) wid, XP_BOUNDS, &wc); + xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_BOUNDS, &wc); } @@ -223,7 +250,9 @@ xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) { xp_window_changes wc; - /* Stack frame below nextWid it if it exists, or raise + TA_SERVER(); + + /* Stack frame below nextWid it if it exists, or raise frame above everything otherwise. */ if (nextWid == NULL) @@ -234,10 +263,10 @@ xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) else { wc.stack_mode = XP_MAPPED_BELOW; - wc.sibling = (xp_window_id) nextWid; + wc.sibling = x_cvt_vptr_to_uint(nextWid); } - xprConfigureWindow((xp_window_id) wid, XP_STACKING, &wc); + xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_STACKING, &wc); } @@ -249,6 +278,8 @@ xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape) { xp_window_changes wc; + TA_SERVER(); + if (pShape != NULL) { wc.shape_nrects = REGION_NUM_RECTS(pShape); @@ -262,7 +293,7 @@ xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape) wc.shape_tx = wc.shape_ty = 0; - xprConfigureWindow((xp_window_id) wid, XP_SHAPE, &wc); + xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_SHAPE, &wc); } @@ -274,10 +305,12 @@ xprUnmapFrame(RootlessFrameID wid) { xp_window_changes wc; + TA_SERVER(); + wc.stack_mode = XP_UNMAPPED; wc.sibling = 0; - xprConfigureWindow((xp_window_id) wid, XP_STACKING, &wc); + xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_STACKING, &wc); } @@ -292,9 +325,11 @@ xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow) unsigned int rowbytes[2]; xp_error err; - err = xp_lock_window((xp_window_id) wid, NULL, NULL, data, rowbytes, NULL); + TA_SERVER(); + + err = xp_lock_window(x_cvt_vptr_to_uint(wid), NULL, NULL, data, rowbytes, NULL); if (err != Success) - FatalError("Could not lock window %i for drawing.", (int) wid); + FatalError("Could not lock window %i for drawing.", (int)x_cvt_vptr_to_uint(wid)); *pixelData = data[0]; *bytesPerRow = rowbytes[0]; @@ -307,7 +342,9 @@ xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow) void xprStopDrawing(RootlessFrameID wid, Bool flush) { - xp_unlock_window((xp_window_id) wid, flush); + TA_SERVER(); + + xp_unlock_window(x_cvt_vptr_to_uint(wid), flush); } @@ -317,7 +354,9 @@ xprStopDrawing(RootlessFrameID wid, Bool flush) void xprUpdateRegion(RootlessFrameID wid, RegionPtr pDamage) { - xp_flush_window((xp_window_id) wid); + TA_SERVER(); + + xp_flush_window(x_cvt_vptr_to_uint(wid)); } @@ -328,7 +367,9 @@ void xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects, int shift_x, int shift_y) { - xp_mark_window((xp_window_id) wid, nrects, rects, shift_x, shift_y); + TA_SERVER(); + + xp_mark_window(x_cvt_vptr_to_uint(wid), nrects, rects, shift_x, shift_y); } @@ -341,6 +382,8 @@ xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin) { DeleteProperty(serverClient, oldWin, xa_native_window_id()); + TA_SERVER(); + xprSetNativeProperty(pFrame); } @@ -352,6 +395,8 @@ Bool xprDoReorderWindow(RootlessWindowPtr pFrame) { WindowPtr pWin = pFrame->win; + TA_SERVER(); + return AppleWMDoReorderWindow(pWin); } @@ -364,7 +409,9 @@ void xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec *dstRects, int dx, int dy) { - xp_copy_window((xp_window_id) wid, (xp_window_id) wid, + TA_SERVER(); + + xp_copy_window(x_cvt_vptr_to_uint(wid), x_cvt_vptr_to_uint(wid), dstNrects, dstRects, dx, dy); } @@ -398,13 +445,13 @@ xprInit(ScreenPtr pScreen) { RootlessInit(pScreen, &xprRootlessProcs); + TA_SERVER(); + rootless_CopyBytes_threshold = xp_copy_bytes_threshold; rootless_FillBytes_threshold = xp_fill_bytes_threshold; rootless_CompositePixels_threshold = xp_composite_area_threshold; rootless_CopyWindow_threshold = xp_scroll_area_threshold; - no_configure_window = FALSE; - return TRUE; } @@ -421,7 +468,7 @@ xprGetXWindow(xp_window_id wid) if (window_hash == NULL) return NULL; - winRec = x_hash_table_lookup(window_hash, (void *) wid, NULL); + winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), NULL); return winRec != NULL ? winRec->win : NULL; } @@ -452,7 +499,7 @@ xprGetXWindowFromAppKit(int windowNumber) pthread_mutex_unlock(&window_hash_mutex); if (!ret) return NULL; - winRec = x_hash_table_lookup(window_hash, (void *) wid, NULL); + winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), NULL); return winRec != NULL ? winRec->win : NULL; } @@ -498,6 +545,8 @@ xprHideWindows(Bool hide) int screen; WindowPtr pRoot, pWin; + TA_SERVER(); + for (screen = 0; screen < screenInfo.numScreens; screen++) { pRoot = WindowTable[screenInfo.screens[screen]->myNum]; RootlessFrameID prevWid = NULL; diff --git a/xorg-server/hw/xquartz/xpr/xprScreen.c b/xorg-server/hw/xquartz/xpr/xprScreen.c index e4e1fda7e..da262f654 100644 --- a/xorg-server/hw/xquartz/xpr/xprScreen.c +++ b/xorg-server/hw/xquartz/xpr/xprScreen.c @@ -27,26 +27,27 @@ * use or other dealings in this Software without prior written authorization. */ +#include "sanitizedCarbon.h" + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif #include "quartzCommon.h" +#include "inputstr.h" #include "quartz.h" #include "xpr.h" +#include "xprEvent.h" #include "pseudoramiX.h" #include "darwin.h" +#include "darwinEvents.h" #include "rootless.h" -#include "safeAlpha/safeAlpha.h" #include "dri.h" #include "globals.h" -#include "Xplugin.h" +#include <Xplugin.h> #include "applewmExt.h" #include "micmap.h" -// From xprFrame.c -WindowPtr xprGetXWindow(xp_window_id wid); - #ifdef DAMAGE # include "damage.h" #endif @@ -64,10 +65,11 @@ static const char *xprOpenGLBundle = "glxCGL.bundle"; */ static void eventHandler(unsigned int type, const void *arg, unsigned int arg_size, void *data) { + switch (type) { case XP_EVENT_DISPLAY_CHANGED: DEBUG_LOG("XP_EVENT_DISPLAY_CHANGED\n"); - QuartzMessageServerThread(kXDarwinDisplayChanged, 0); + DarwinSendDDXEvent(kXquartzDisplayChanged, 0); break; case XP_EVENT_WINDOW_STATE_CHANGED: @@ -75,7 +77,7 @@ static void eventHandler(unsigned int type, const void *arg, const xp_window_state_event *ws_arg = arg; DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: id=%d, state=%d\n", ws_arg->id, ws_arg->state); - QuartzMessageServerThread(kXDarwinWindowState, 2, + DarwinSendDDXEvent(kXquartzWindowState, 2, ws_arg->id, ws_arg->state); } else { DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: ignored\n"); @@ -86,8 +88,7 @@ static void eventHandler(unsigned int type, const void *arg, DEBUG_LOG("XP_EVENT_WINDOW_MOVED\n"); if (arg_size == sizeof(xp_window_id)) { xp_window_id id = * (xp_window_id *) arg; - WindowPtr pWin = xprGetXWindow(id); - QuartzMessageServerThread(kXDarwinWindowMoved, 1, pWin); + DarwinSendDDXEvent(kXquartzWindowMoved, 1, id); } break; @@ -106,6 +107,15 @@ static void eventHandler(unsigned int type, const void *arg, DRISurfaceNotify(*(xp_surface_id *) arg, kind); } break; +#ifdef XP_EVENT_SPACE_CHANGED + case XP_EVENT_SPACE_CHANGED: + DEBUG_LOG("XP_EVENT_SPACE_CHANGED\n"); + if(arg_size == sizeof(uint32_t)) { + uint32_t space_id = *(uint32_t *)arg; + DarwinSendDDXEvent(kXquartzSpaceChanged, 1, space_id); + } + break; +#endif default: ErrorF("Unknown XP_EVENT type (%d) in xprScreen:eventHandler\n", type); } @@ -140,14 +150,21 @@ displayScreenBounds(CGDirectDisplayID id) frame = CGDisplayBounds(id); + DEBUG_LOG(" %dx%d @ (%d,%d).\n", + (int)frame.size.width, (int)frame.size.height, + (int)frame.origin.x, (int)frame.origin.y); + /* Remove menubar to help standard X11 window managers. */ - - if (frame.origin.x == 0 && frame.origin.y == 0) - { + if (quartzEnableRootless && + frame.origin.x == 0 && frame.origin.y == 0) { frame.origin.y += aquaMenuBarHeight; frame.size.height -= aquaMenuBarHeight; } + DEBUG_LOG(" %dx%d @ (%d,%d).\n", + (int)frame.size.width, (int)frame.size.height, + (int)frame.origin.x, (int)frame.origin.y); + return frame; } @@ -169,8 +186,7 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height) CGGetActiveDisplayList(displayCount, displayList, &displayCount); /* Get the union of all screens */ - for (i = 0; i < displayCount; i++) - { + for (i = 0; i < displayCount; i++) { CGDirectDisplayID dpy = displayList[i]; frame = displayScreenBounds(dpy); unionRect = CGRectUnion(unionRect, frame); @@ -182,22 +198,20 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height) *width = unionRect.size.width; *height = unionRect.size.height; + DEBUG_LOG(" screen union origin: (%d,%d) size: (%d,%d).\n", + *x, *y, *width, *height); + /* Tell PseudoramiX about the real screens. */ for (i = 0; i < displayCount; i++) { CGDirectDisplayID dpy = displayList[i]; frame = displayScreenBounds(dpy); - - /* ErrorF("PseudoramiX screen %d added: %dx%d @ (%d,%d).\n", i, - (int)frame.size.width, (int)frame.size.height, - (int)frame.origin.x, (int)frame.origin.y); */ - frame.origin.x -= unionRect.origin.x; frame.origin.y -= unionRect.origin.y; - /* ErrorF("PseudoramiX screen %d placed at X11 coordinate (%d,%d).\n", - i, (int)frame.origin.x, (int)frame.origin.y); */ + DEBUG_LOG(" placed at X11 coordinate (%d,%d).\n", + (int)frame.origin.x, (int)frame.origin.y); PseudoramiXAddScreen(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); @@ -215,7 +229,7 @@ xprDisplayInit(void) { CGDisplayCount displayCount; - // ErrorF("Display mode: Rootless Quartz -- Xplugin implementation\n"); + DEBUG_LOG(""); CGGetActiveDisplayList(0, NULL, &displayCount); @@ -233,6 +247,9 @@ xprDisplayInit(void) xp_select_events(XP_EVENT_DISPLAY_CHANGED | XP_EVENT_WINDOW_STATE_CHANGED | XP_EVENT_WINDOW_MOVED +#ifdef XP_EVENT_SPACE_CHANGED + | XP_EVENT_SPACE_CHANGED +#endif | XP_EVENT_SURFACE_CHANGED | XP_EVENT_SURFACE_DESTROYED, eventHandler, NULL); @@ -250,6 +267,8 @@ xprAddScreen(int index, ScreenPtr pScreen) { DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen); int depth = darwinDesiredDepth; + + DEBUG_LOG("index=%d depth=%d\n", index, depth); if(depth == -1) { depth = CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * CGDisplayBitsPerSample(kCGDirectMainDisplay); @@ -259,18 +278,17 @@ xprAddScreen(int index, ScreenPtr pScreen) } switch(depth) { - case -8: // broken - FatalError("Unsupported color depth %d\n", darwinDesiredDepth); - dfb->visuals = (1 << StaticGray) | (1 << GrayScale); - dfb->preferredCVC = GrayScale; - dfb->depth = 8; - dfb->bitsPerRGB = 8; - dfb->bitsPerPixel = 8; - dfb->redMask = 0; - dfb->greenMask = 0; - dfb->blueMask = 0; - break; - case 8: // broken +// case -8: // broken +// dfb->visuals = (1 << StaticGray) | (1 << GrayScale); +// dfb->preferredCVC = GrayScale; +// dfb->depth = 8; +// dfb->bitsPerRGB = 8; +// dfb->bitsPerPixel = 8; +// dfb->redMask = 0; +// dfb->greenMask = 0; +// dfb->blueMask = 0; +// break; + case 8: // pseudo-working dfb->visuals = PseudoColorMask; dfb->preferredCVC = PseudoColor; dfb->depth = 8; @@ -290,7 +308,10 @@ xprAddScreen(int index, ScreenPtr pScreen) dfb->greenMask = 0x03e0; dfb->blueMask = 0x001f; break; - case 24: +// case 24: + default: + if(depth != 24) + ErrorF("Unsupported color depth requested. Defaulting to 24bit. (depth=%d darwinDesiredDepth=%d CGDisplaySamplesPerPixel=%d CGDisplayBitsPerSample=%d)\n", darwinDesiredDepth, depth, (int)CGDisplaySamplesPerPixel(kCGDirectMainDisplay), (int)CGDisplayBitsPerSample(kCGDirectMainDisplay)); dfb->visuals = LARGE_VISUALS; dfb->preferredCVC = TrueColor; dfb->depth = 24; @@ -300,12 +321,12 @@ xprAddScreen(int index, ScreenPtr pScreen) dfb->greenMask = 0x0000ff00; dfb->blueMask = 0x000000ff; break; - default: - FatalError("Unsupported color depth %d\n", darwinDesiredDepth); } if (noPseudoramiXExtension) { + ErrorF("Warning: noPseudoramiXExtension!\n"); + CGDirectDisplayID dpy; CGRect frame; @@ -341,18 +362,11 @@ xprAddScreen(int index, ScreenPtr pScreen) static Bool xprSetupScreen(int index, ScreenPtr pScreen) { - // Add alpha protecting replacements for fb screen functions - -#ifdef RENDER - { - PictureScreenPtr ps = GetPictureScreen(pScreen); - ps->Composite = SafeAlphaComposite; - } -#endif /* RENDER */ - // Initialize accelerated rootless drawing // Note that this must be done before DamageSetup(). - RootlessAccelInit(pScreen); + + // These are crashing ugly... better to be stable and not crash for now. + //RootlessAccelInit(pScreen); #ifdef DAMAGE // The Damage extension needs to wrap underneath the @@ -409,12 +423,8 @@ static QuartzModeProcsRec xprModeProcs = { xprSetupScreen, xprInitInput, QuartzInitCursor, - NULL, // No need to update cursor QuartzSuspendXCursor, QuartzResumeXCursor, - NULL, // No capture or release in rootless mode - NULL, - NULL, // Xplugin sends screen change events directly xprAddPseudoramiXScreens, xprUpdateScreen, xprIsX11Window, |