Merge branch 'master' into mpx

Conflicts:

	configure.ac
	dix/getevents.c
	hw/xfree86/ramdac/xf86Cursor.c
	mi/mipointer.c
	xkb/xkbUtils.c
This commit is contained in:
Peter Hutterer 2007-03-05 12:37:17 +10:30
commit 1f0075786f
176 changed files with 14386 additions and 1443 deletions

View File

@ -1,16 +1,16 @@
SUBDIRS = glx mesa
# someone could get really crazy someday and add support for the SI...
# xwin/darwin/xfree86 have their accel support under the DDX
APPLE_EXTRAS = \
apple/aglGlx.c \
apple/indirect.c
if BUILD_DARWIN
DARWIN_SUBDIRS = apple
endif
SUBDIRS = glx mesa $(DARWIN_SUBDIRS)
WINDOWS_EXTRAS = \
windows/ChangeLog \
windows/glwindows.h \
windows/glwrap.c \
windows/indirect.c
EXTRA_DIST = symlink-mesa.sh $(APPLE_EXTRAS) $(WINDOWS_EXTRAS)
EXTRA_DIST = symlink-mesa.sh $(WINDOWS_EXTRAS)

15
GL/apple/Makefile.am Normal file
View File

@ -0,0 +1,15 @@
AM_CFLAGS = -I$(top_srcdir) \
-I$(top_srcdir)/hw/darwin/quartz \
-I$(top_srcdir)/GL/glx \
-I$(top_srcdir)/hw/darwin/quartz/cr \
-I$(top_srcdir)/GL/include
if HAVE_AGL_FRAMEWORK
noinst_LIBRARIES = libAGLcore.a
libAGLcore_a_SOURCES = aglGlx.c \
$(top_srcdir)/hw/darwin/quartz/xpr/x-list.c \
$(top_srcdir)/hw/darwin/quartz/xpr/x-list.h \
$(top_srcdir)/hw/darwin/quartz/xpr/x-hash.c \
$(top_srcdir)/hw/darwin/quartz/xpr/x-hash.h \
$(top_srcdir)/hw/dmx/glxProxy/compsize.c
endif

File diff suppressed because it is too large Load Diff

View File

@ -39,6 +39,11 @@
#include <byteswap.h>
#elif defined(USE_SYS_ENDIAN_H)
#include <sys/endian.h>
#elif defined(__APPLE__)
#include <libkern/OSByteOrder.h>
#define bswap_16 OSSwapInt16
#define bswap_32 OSSwapInt32
#define bswap_64 OSSwapInt64
#else
#define bswap_16(value) \
((((value) & 0xff) << 8) | ((value) >> 8))

4
GL/mesa/.gitignore vendored
View File

@ -2,8 +2,6 @@ X/drivers
X/glxheader.h
X/xmesaP.h
X/xm*.c
array_cache/*.c
array_cache/*.h
mesa/drivers
mesa/glxheader.h
mesa/xm*.c
@ -30,3 +28,5 @@ tnl/*.c
tnl/*.h
x86
x86-64
vbo/*.c
vbo/*.h

View File

@ -1,15 +1,15 @@
SUBDIRS = main math array_cache swrast swrast_setup tnl shader X glapi
SUBDIRS = main math swrast swrast_setup tnl shader X glapi vbo
noinst_LTLIBRARIES = libGLcore.la
libGLcore_la_SOURCES = dummy.c
libGLcore_la_LIBADD = main/libmain.la \
math/libmath.la \
array_cache/libac.la \
swrast/libswrast.la \
swrast_setup/libss.la \
tnl/libtnl.la \
shader/libshader.la \
shader/grammar/libgrammar.la \
shader/slang/libslang.la \
vbo/libvbo.la \
X/libX.la

View File

@ -2,7 +2,6 @@ noinst_LTLIBRARIES = libX.la
INCLUDES = -I@MESA_SOURCE@/include \
-I../X \
-I../array_cache \
-I../glapi \
-I../main \
-I../math \

View File

@ -1,21 +0,0 @@
noinst_LTLIBRARIES = libac.la
AM_CFLAGS = \
$(DIX_CFLAGS) \
-DXFree86Server \
@GLX_DEFINES@
INCLUDES = -I@MESA_SOURCE@/include \
-I../X \
-I../array_cache \
-I../glapi \
-I../main \
-I../math \
-I../shader \
-I../swrast \
-I../swrast_setup \
-I../tnl \
-I.. \
-I$(top_srcdir)/hw/xfree86/os-support
nodist_libac_la_SOURCES = ac_context.c ac_import.c

View File

@ -7,7 +7,6 @@ AM_CFLAGS = \
INCLUDES = -I@MESA_SOURCE@/include \
-I../X \
-I../array_cache \
-I../glapi \
-I../main \
-I../math \

View File

@ -7,7 +7,6 @@ AM_CFLAGS = \
INCLUDES = -I@MESA_SOURCE@/include \
-I../X \
-I../array_cache \
-I../glapi \
-I../main \
-I../math \

View File

@ -7,7 +7,6 @@ AM_CFLAGS = \
INCLUDES = -I@MESA_SOURCE@/include \
-I../X \
-I../array_cache \
-I../glapi \
-I../main \
-I../math \

View File

@ -9,7 +9,6 @@ AM_CFLAGS = \
INCLUDES = -I@MESA_SOURCE@/include \
-I../X \
-I../array_cache \
-I../glapi \
-I../main \
-I../math \

View File

@ -7,7 +7,6 @@ AM_CFLAGS = \
INCLUDES = -I@MESA_SOURCE@/include \
-I../../X \
-I../../array_cache \
-I../../glapi \
-I../../main \
-I../../math \

View File

@ -8,7 +8,6 @@ AM_CFLAGS = \
INCLUDES = -I@MESA_SOURCE@/include \
-I../grammar \
-I../../X \
-I../../array_cache \
-I../../glapi \
-I../../main \
-I../../math \

View File

@ -7,7 +7,6 @@ AM_CFLAGS = \
INCLUDES = -I@MESA_SOURCE@/include \
-I../X \
-I../array_cache \
-I../glapi \
-I../main \
-I../math \

View File

@ -7,7 +7,6 @@ AM_CFLAGS = \
INCLUDES = -I@MESA_SOURCE@/include \
-I../X \
-I../array_cache \
-I../glapi \
-I../main \
-I../math \

View File

@ -7,7 +7,6 @@ AM_CFLAGS = \
INCLUDES = -I@MESA_SOURCE@/include \
-I../X \
-I../array_cache \
-I../glapi \
-I../main \
-I../math \
@ -19,13 +18,9 @@ INCLUDES = -I@MESA_SOURCE@/include \
-I.. \
-I$(top_srcdir)/hw/xfree86/os-support
nodist_libtnl_la_SOURCES = t_array_api.c \
t_array_import.c \
t_context.c \
nodist_libtnl_la_SOURCES = t_context.c \
t_draw.c \
t_pipeline.c \
t_save_api.c \
t_save_loopback.c \
t_save_playback.c \
t_vb_arbprogram.c \
t_vb_arbprogram_sse.c \
t_vb_arbshader.c \
@ -42,9 +37,4 @@ nodist_libtnl_la_SOURCES = t_array_api.c \
t_vertex.c \
t_vertex_generic.c \
t_vertex_sse.c \
t_vp_build.c \
t_vtx_api.c \
t_vtx_eval.c \
t_vtx_exec.c \
t_vtx_generic.c \
t_vtx_x86.c
t_vp_build.c

35
GL/mesa/vbo/Makefile.am Normal file
View File

@ -0,0 +1,35 @@
noinst_LTLIBRARIES = libvbo.la
AM_CFLAGS = \
$(DIX_CFLAGS) \
-DXFree86Server \
@GLX_DEFINES@
INCLUDES = -I@MESA_SOURCE@/include \
-I../X \
-I../glapi \
-I../main \
-I../math \
-I../shader \
-I../shader/slang \
-I../shader/slang \
-I../swrast \
-I../swrast_setup \
-I../tnl \
-I.. \
-I$(top_srcdir)/hw/xfree86/os-support
nodist_libvbo_la_SOURCES = vbo_context.c \
vbo_exec_api.c \
vbo_exec_array.c \
vbo_exec.c \
vbo_exec_draw.c \
vbo_exec_eval.c \
vbo_rebase.c \
vbo_save_api.c \
vbo_save.c \
vbo_save_draw.c \
vbo_save_loopback.c \
vbo_split.c \
vbo_split_copy.c \
vbo_split_inplace.c

View File

@ -85,15 +85,6 @@ symlink_mesa_math() {
done
}
symlink_mesa_ac() {
src_dir src/mesa/array_cache
dst_dir mesa/array_cache
for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
action `basename $src`
done
}
symlink_mesa_swrast() {
src_dir src/mesa/swrast
dst_dir mesa/swrast
@ -157,6 +148,15 @@ symlink_mesa_shader_slang_library() {
done
}
symlink_mesa_vbo() {
src_dir src/mesa/vbo
dst_dir mesa/vbo
for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
action `basename $src`
done
}
symlink_mesa_x() {
src_dir src/mesa/drivers/x11
dst_dir mesa/X
@ -203,7 +203,6 @@ symlink_mesa_x8664() {
symlink_mesa() {
symlink_mesa_main
symlink_mesa_math
symlink_mesa_ac
symlink_mesa_swrast
symlink_mesa_ss
symlink_mesa_tnl
@ -215,6 +214,7 @@ symlink_mesa() {
symlink_mesa_glapi
symlink_mesa_ppc
symlink_mesa_sparc
symlink_mesa_vbo
symlink_mesa_x86
symlink_mesa_x8664
}

View File

@ -1187,6 +1187,7 @@ CALLBACK(SecurityCheckMapAccess)
if (STATEPTR(rec->client) &&
(TRUSTLEVEL(rec->client) != XSecurityClientTrusted) &&
(pWin->drawable.class == InputOnly) &&
pWin->parent && pWin->parent->parent &&
(TRUSTLEVEL(wClient(pWin->parent)) == XSecurityClientTrusted))
rec->rval = FALSE;

View File

@ -303,15 +303,15 @@ configSetup(void)
if (!configData)
configData = (struct config_data *) xcalloc(sizeof(struct config_data), 1);
if (!configData) {
ErrorF("[dbus] failed to allocate data struct.\n");
ErrorF("[dbus] failed to allocate data struct\n");
return FALSE;
}
dbus_error_init(&error);
configData->connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
if (!configData->connection || dbus_error_is_set(&error)) {
ErrorF("[dbus] some kind of error occurred: %s (%s)\n", error.name,
error.message);
DebugF("[dbus] some kind of error occurred while connecting: %s (%s)\n",
error.name, error.message);
dbus_error_free(&error);
xfree(configData);
configData = NULL;

View File

@ -25,7 +25,7 @@ dnl Process this file with autoconf to create configure.
AC_PREREQ(2.57)
dnl This is the not the Xorg version number, it's the server version number.
dnl Yes, that's weird.
AC_INIT([xorg-server], 1.2.99.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
AC_INIT([xorg-server], 1.3.99.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([dist-bzip2 foreign])
AM_MAINTAINER_MODE
@ -280,6 +280,7 @@ case $host_cpu in
use_x86_asm="yes"
I386_VIDEO=yes
case $host_os in
darwin*) use_x86_asm="no" ;;
*linux*) DEFAULT_INT10=vm86 ;;
*freebsd*) AC_DEFINE(USE_DEV_IO) ;;
*netbsd*) AC_DEFINE(USE_I386_IOPL)
@ -305,6 +306,7 @@ case $host_cpu in
use_x86_asm="yes"
I386_VIDEO=yes
case $host_os in
darwin*) use_x86_asm="no" ;;
*freebsd*) AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
*netbsd*) AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl])
SYS_LIBS=-lx86_64
@ -448,6 +450,9 @@ AC_ARG_WITH(os-name, AS_HELP_STRING([--with-os-name=OSNAME], [Name of OS
AC_ARG_WITH(os-vendor, AS_HELP_STRING([--with-os-vendor=OSVENDOR], [Name of OS vendor]),
[ OSVENDOR="$withval" ],
[ OSVENDOR="" ])
AC_ARG_WITH(builderstring, AS_HELP_STRING([--with-builderstring=BUILDERSTRING], [Additional builder string]),
[ BUILDERSTRING="$withval" ]
[ ])
AC_ARG_WITH(mesa-source, AS_HELP_STRING([--with-mesa-source=MESA_SOURCE], [Path to Mesa source tree]),
[ MESA_SOURCE="$withval" ],
[ MESA_SOURCE="" ])
@ -470,6 +475,10 @@ AC_ARG_WITH(rgb-path, AS_HELP_STRING([--with-rgb-path=PATH], [Path to RG
AC_ARG_WITH(dri-driver-path, AS_HELP_STRING([--with-dri-driver-path=PATH], [Path to DRI drivers (default: ${libdir}/dri)]),
[ DRI_DRIVER_PATH="$withval" ],
[ DRI_DRIVER_PATH="${libdir}/dri" ])
APPLE_APPLICATIONS_DIR="${bindir}/Applications"
AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir=PATH], [Path to the Applications directory (default: ${bindir}/Applications)]),
[ APPLE_APPLICATIONS_DIR="${withval}" ].
[ APPLE_APPLICATIONS_DIR="${bindir}/Applications" ])
AC_ARG_ENABLE(builddocs, AS_HELP_STRING([--enable-builddocs], [Build docs (default: disabled)]),
[BUILDDOCS=$enableval],
[BUILDDOCS=no])
@ -491,6 +500,7 @@ AC_ARG_ENABLE(xres, AS_HELP_STRING([--disable-xres], [Build XRes exten
AC_ARG_ENABLE(xtrap, AS_HELP_STRING([--disable-xtrap], [Build XTrap extension (default: enabled)]), [XTRAP=$enableval], [XTRAP=yes])
AC_ARG_ENABLE(record, AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
AC_ARG_ENABLE(xv, AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
AC_ARG_ENABLE(quartz, AS_HELP_STRING([--enable-quartz], [Build with darwin quartz support (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes])
AC_ARG_ENABLE(dga, AS_HELP_STRING([--disable-dga], [Build DGA extension (default: auto)]), [DGA=$enableval], [DGA=auto])
AC_ARG_ENABLE(screensaver, AS_HELP_STRING([--disable-screensaver], [Build ScreenSaver extension (default: enabled)]), [SCREENSAVER=$enableval], [SCREENSAVER=yes])
@ -521,7 +531,7 @@ AC_ARG_ENABLE(xfree86-utils, AS_HELP_STRING([--enable-xfree86-utils], [Build
dnl DDXes.
AC_ARG_ENABLE(xorg, AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (default: auto)]), [DMX=$enableval], [DMX=auto])
AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (default: no)]), [DMX=$enableval], [DMX=no])
AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
@ -529,6 +539,10 @@ AC_ARG_ENABLE(xprint, AS_HELP_STRING([--enable-xprint], [Build Xprint ex
AC_ARG_ENABLE(xgl, AS_HELP_STRING([--enable-xgl], [Build Xgl server (default: no)]), [XGL=$enableval], [XGL=no])
AC_ARG_ENABLE(xglx, AS_HELP_STRING([--enable-xglx], [Build Xglx xgl module (default: no)]), [XGLX=$enableval], [XGLX=no])
AC_ARG_ENABLE(xegl, AS_HELP_STRING([--enable-xegl], [Build Xegl xgl module (default: no)]), [XEGL=$enableval], [XEGL=no])
dnl legacy fb support
AC_ARG_ENABLE(mfb, AS_HELP_STRING([--enable-mfb], [Build legacy mono framebuffer support (default: enabled)]), [MFB=$enableval], [MFB=$XORG])
AC_ARG_ENABLE(cfb, AS_HELP_STRING([--enable-cfb], [Build legacy color framebuffer support (default: enabled)]), [CFB=$enableval], [CFB=$XORG])
AC_ARG_ENABLE(afb, AS_HELP_STRING([--enable-afb], [Build legacy advanced framebuffer support (default: enabled)]), [AFB=$enableval], [AFB=$XORG])
dnl kdrive and its subsystems
AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
@ -933,6 +947,8 @@ AC_DEFINE_UNQUOTED(XORG_MAN_VERSION, ["$VENDOR_MAN_VERSION"], [Vendor man versio
AC_DEFINE_UNQUOTED(BUILDERADDR, ["$BUILDERADDR"], [Builder address])
AC_DEFINE_UNQUOTED(OSNAME, ["$OSNAME"], [Operating System Name])
AC_DEFINE_UNQUOTED(OSVENDOR, ["$OSVENDOR"], [Operating System Vendor])
AC_DEFINE_UNQUOTED(BUILDERSTRING, ["$BUILDERSTRING"], [Builder string])
AC_SUBST([VENDOR_STRING])
AC_SUBST([VENDOR_STRING_SHORT])
AC_SUBST([VENDOR_RELEASE])
@ -1001,6 +1017,9 @@ if test "x$GCC" = "xyes"; then
LD_EXPORT_SYMBOLS_FLAG="-rdynamic"
fi
case $host_os in
darwin*)
LD_EXPORT_SYMBOLS_FLAG=""
;;
openbsd*)
LD_EXPORT_SYMBOLS_FLAG="-Wl,--export-dynamic"
;;
@ -1057,8 +1076,20 @@ AC_EGREP_CPP([I_AM_SVR4],[
AC_DEFINE([SVR4],1,[Define to 1 on systems derived from System V Release 4])
AC_MSG_RESULT([yes])], AC_MSG_RESULT([no]))
XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC"
AC_DEFINE_UNQUOTED(X_BYTE_ORDER,[$ENDIAN],[Endian order])
XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC"
AC_DEFINE_UNQUOTED(_X_BYTE_ORDER,[$ENDIAN],[Endian order])
AH_VERBATIM([X_BYTE_ORDER],[
/* Deal with multiple architecture compiles on Mac OS X */
#ifndef __APPLE_CC__
#define X_BYTE_ORDER _X_BYTE_ORDER
#else
#ifdef __BIG_ENDIAN__
#define X_BYTE_ORDER X_BIG_ENDIAN
#else
#define X_BYTE_ORDER X_LITTLE_ENDIAN
#endif
#endif
])
AC_SUBST([XSERVER_LIBS])
@ -1149,7 +1180,6 @@ if test "x$XORG" = xauto; then
XORG="yes"
case $host_os in
cygwin*) XORG="no" ;;
darwin*) XORG="no" ;;
esac
fi
AC_MSG_RESULT([$XORG])
@ -1226,43 +1256,68 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H"
XORG_LIBS="$COMPOSITE_LIB $MI_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XPSTUBS_LIB $OS_LIB"
if test "x$DGA" = xauto; then
PKG_CHECK_MODULES(DGA, xf86dgaproto, [DGA=yes], [DGA=no])
fi
if test "x$DGA" = xyes; then
XORG_MODULES="$XORG_MODULES xf86dgaproto"
AC_DEFINE(DGA, 1, [Support DGA extension])
AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
fi
if test "x$XF86MISC" = xauto; then
PKG_CHECK_MODULES(XF86MISC, xf86miscproto, [XF86MISC=yes], [XF86MISC=no])
fi
if test "x$XF86MISC" = xyes; then
XORG_MODULES="$XORG_MODULES xf86miscproto"
AC_DEFINE(XF86MISC, 1, [Support XFree86 miscellaneous extensions])
fi
if test "x$XF86VIDMODE" = xauto; then
PKG_CHECK_MODULES(XF86VIDMODE, xf86vidmodeproto, [XF86VIDMODE=yes], [XF86VIDMODE=no])
fi
if test "x$XF86VIDMODE" = xyes; then
XORG_MODULES="$XORG_MODULES xf86vidmodeproto"
AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
fi
if test -n "$XORG_MODULES"; then
PKG_CHECK_MODULES(XORG_MODULES, [$XORG_MODULES])
XORG_CFLAGS="$XORG_CFLAGS $XORG_MODULES_CFLAGS"
XORG_LIBS="$XORG_LIBS $XORG_MODULES_LIBS"
fi
dnl Check to see if dlopen is in default libraries (like Solaris, which
dnl has it in libc), or if libdl is needed to get it.
AC_CHECK_FUNC([dlopen], [],
AC_CHECK_LIB([dl], [dlopen], XORG_LIBS="$XORG_LIBS -ldl"))
case $host_os in
darwin*)
XORG_OS="Darwin"
build_darwin=yes
if test "X$XQUARTZ" = Xauto; then
AC_CACHE_CHECK([for Carbon framework],xorg_cv_Carbon_framework,[
save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -framework Carbon"
AC_LINK_IFELSE([char FSFindFolder();
int main() {
FSFindFolder();
return 0;}
],[xorg_cv_Carbon_framework=yes],
[xorg_cv_Carbon_framework=no])
LDFLAGS=$save_LDFLAGS])
if test "X$xorg_cv_Carbon_framework" = Xyes; then
AC_DEFINE([DARWIN_WITH_QUARTZ],[1],
[Have Quartz])
XQUARTZ=yes
else
XQUARTZ=no
fi
fi
# glxAGL / glxCGL don't work yet
# AC_CACHE_CHECK([for AGL framework],xorg_cv_AGL_framework,[
# save_LDFLAGS=$LDFLAGS
# LDFLAGS="$LDFLAGS -framework AGL"
# AC_LINK_IFELSE([char aglEnable();
#int main() {
#aglEnable();
#return 0;}
# ],[xorg_cv_AGL_framework=yes],
# [xorg_cv_AGL_framework=no])
# LDFLAGS=$save_LDFLAGS
# ])
xorg_cv_AGL_framework=no
AC_CHECK_LIB([Xplugin],[xp_init],[:])
AC_SUBST([APPLE_APPLICATIONS_DIR])
CFLAGS="${CFLAGS} -D__DARWIN__"
PLIST_VERSION_STRING=$VENDOR_VERSION_STRING
AC_SUBST([PLIST_VERSION_STRING])
PLIST_VENDOR_WEB=$VENDOR_WEB
AC_SUBST([PLIST_VENDOR_WEB])
# Not sure that we should be disabling all these...
if test "x$XF86MISC" = xyes || test "x$XF86MISC" = xauto; then
AC_MSG_NOTICE([Disabling XF86Misc extension])
XF86MISC=no
fi
if test "x$XF86VIDMODE" = xyes || test "x$XF86VIDMODE" = xauto; then
AC_MSG_NOTICE([Disabling XF86VidMode extension])
XF86VIDMODE=no
fi
if test "x$DGA" = xyes || test "x$DGA" = xauto; then
AC_MSG_NOTICE([Disabling DGA extension])
DGA=no
fi
;;
linux*)
if test "x$LNXAPM" = xyes; then
XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
@ -1385,11 +1440,14 @@ dnl has it in libc), or if libdl is needed to get it.
case $host_cpu in
i*86)
xorg_bus_ix86pci=yes
case $host_os in
darwin*) ;;
*) xorg_bus_ix86pci=yes ;;
esac
;;
powerpc*)
case $host_os in
linux*|freebsd*|netbsd*|openbsd*|kfreebsd*-gnu)
darwin*|linux*|freebsd*|netbsd*|openbsd*|kfreebsd*-gnu)
;;
*)
xorg_bus_ppcpci="yes"
@ -1402,7 +1460,7 @@ dnl has it in libc), or if libdl is needed to get it.
;;
x86_64*|amd64*)
case $host_os in
freebsd*|kfreebsd*-gnu)
darwin*|freebsd*|kfreebsd*-gnu)
# FreeBSD uses the system pci interface
;;
*)
@ -1415,6 +1473,37 @@ dnl has it in libc), or if libdl is needed to get it.
if test "x$XORG_OS_PCI" = x ; then
XORG_OS_PCI=$XORG_OS
fi
if test "x$DGA" = xauto; then
PKG_CHECK_MODULES(DGA, xf86dgaproto, [DGA=yes], [DGA=no])
fi
if test "x$DGA" = xyes; then
XORG_MODULES="$XORG_MODULES xf86dgaproto"
AC_DEFINE(DGA, 1, [Support DGA extension])
AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
fi
if test "x$XF86MISC" = xauto; then
PKG_CHECK_MODULES(XF86MISC, xf86miscproto, [XF86MISC=yes], [XF86MISC=no])
fi
if test "x$XF86MISC" = xyes; then
XORG_MODULES="$XORG_MODULES xf86miscproto"
AC_DEFINE(XF86MISC, 1, [Support XFree86 miscellaneous extensions])
fi
if test "x$XF86VIDMODE" = xauto; then
PKG_CHECK_MODULES(XF86VIDMODE, xf86vidmodeproto, [XF86VIDMODE=yes], [XF86VIDMODE=no])
fi
if test "x$XF86VIDMODE" = xyes; then
XORG_MODULES="$XORG_MODULES xf86vidmodeproto"
AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
fi
if test -n "$XORG_MODULES"; then
PKG_CHECK_MODULES(XORG_MODULES, [$XORG_MODULES])
XORG_CFLAGS="$XORG_CFLAGS $XORG_MODULES_CFLAGS"
XORG_LIBS="$XORG_LIBS $XORG_MODULES_LIBS"
fi
AC_SUBST([XORG_LIBS])
AC_SUBST([XORG_INCS])
AC_SUBST([XORG_OS])
@ -1475,11 +1564,23 @@ AM_CONDITIONAL([LINUX_ALPHA], [test "x$linux_alpha" = xyes])
AM_CONDITIONAL([LNXACPI], [test "x$linux_acpi" = xyes])
AM_CONDITIONAL([SOLARIS_USL_CONSOLE], [test "x$solaris_usl_console" = xyes])
AM_CONDITIONAL([SOLARIS_ASM_INLINE], [test "x$solaris_asm_inline" = xyes])
AM_CONDITIONAL(MFB, [test "x$XORG" = xyes])
AM_CONDITIONAL(CFB, [test "x$XORG" = xyes])
AM_CONDITIONAL(AFB, [test "x$XORG" = xyes])
AM_CONDITIONAL([BUILD_DARWIN],[test "X$build_darwin" = Xyes])
AM_CONDITIONAL([XQUARTZ],[test "X$XQUARTZ" = Xyes])
AM_CONDITIONAL(DGA, [test "x$DGA" = xyes])
dnl legacy fb support
test "x$MFB" = xauto && MFB="$XORG"
test "x$CFB" = xauto && CFB="$XORG"
test "x$AFB" = xauto && AFB="$XORG"
AM_CONDITIONAL(MFB, [test "x$MFB" = xyes])
AM_CONDITIONAL(CFB, [test "x$CFB" = xyes])
AM_CONDITIONAL(AFB, [test "x$AFB" = xyes])
if test "x$MFB" = xyes -o "x$CFB" = xyes -o "x$AFB" = xyes; then
if test "x$XORG" != xyes; then
AC_MSG_ERROR([legacy fb support requires the Xorg server])
fi
fi
dnl Xprint DDX
AC_MSG_CHECKING([whether to build Xprint DDX])
@ -1488,7 +1589,7 @@ AC_MSG_RESULT([$XPRINT])
if test "x$XPRINT" = xyes; then
PKG_CHECK_MODULES([XPRINT], [printproto x11 xfont $XDMCP_MODULES xau])
XPRINT_EXTENSIONS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS"
XPRINT_LIBS="$XPRINT_LIBS $DIX_LIB $CONFIG_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB $LIBS"
XPRINT_LIBS="$DIX_LIB $CONFIG_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB $LIBS $XPRINT_LIBS"
AC_SUBST([XPRINT_CFLAGS])
AC_SUBST([XPRINT_LIBS])
@ -1602,6 +1703,21 @@ AM_CONDITIONAL(XWIN_PRIMARYFB, [test "x$XWIN" = xyes && false])
AM_CONDITIONAL(XWIN_RANDR, [test "x$XWIN" = xyes])
AM_CONDITIONAL(XWIN_XV, [test "x$XWIN" = xyes && test "x$XV" = xyes])
dnl Darwin / OS X DDX
AM_CONDITIONAL(HAVE_X_PLUGIN, [test "x$ac_cv_lib_Xplugin_xp_init" = xyes])
AM_CONDITIONAL(HAVE_AGL_FRAMEWORK, [test "x$xorg_cv_AGL_framework" = xyes])
# Support for objc in autotools is minimal and not
# documented.
OBJC='$(CC)'
OBJCLD='$(CCLD)'
OBJCLINK='$(LINK)'
OBJCFLAGS='$(CFLAGS)'
AC_SUBST([OBJC])
AC_SUBST([OBJCCLD])
AC_SUBST([OBJCLINK])
AC_SUBST([OBJCFLAGS])
# internal, undocumented automake func follows :(
_AM_DEPENDENCIES([OBJC])
dnl kdrive DDX
@ -1835,9 +1951,9 @@ XORG_RELEASE_VERSION
AC_OUTPUT([
Makefile
GL/Makefile
GL/apple/Makefile
GL/glx/Makefile
GL/mesa/Makefile
GL/mesa/array_cache/Makefile
GL/mesa/glapi/Makefile
GL/mesa/main/Makefile
GL/mesa/math/Makefile
@ -1847,6 +1963,7 @@ GL/mesa/shader/slang/Makefile
GL/mesa/swrast/Makefile
GL/mesa/swrast_setup/Makefile
GL/mesa/tnl/Makefile
GL/mesa/vbo/Makefile
GL/mesa/X/Makefile
include/Makefile
afb/Makefile
@ -1868,6 +1985,8 @@ miext/damage/Makefile
miext/shadow/Makefile
miext/cw/Makefile
miext/rootless/Makefile
miext/rootless/safeAlpha/Makefile
miext/rootless/accel/Makefile
os/Makefile
randr/Makefile
render/Makefile
@ -1894,6 +2013,7 @@ hw/xfree86/fbdevhw/Makefile
hw/xfree86/i2c/Makefile
hw/xfree86/int10/Makefile
hw/xfree86/loader/Makefile
hw/xfree86/modes/Makefile
hw/xfree86/os-support/Makefile
hw/xfree86/os-support/bsd/Makefile
hw/xfree86/os-support/bus/Makefile
@ -1944,6 +2064,19 @@ hw/xgl/glxext/module/Makefile
hw/xnest/Makefile
hw/xwin/Makefile
hw/darwin/Makefile
hw/darwin/bundle/Makefile
hw/darwin/bundle/Dutch.lproj/Makefile
hw/darwin/bundle/English.lproj/Makefile
hw/darwin/bundle/French.lproj/Makefile
hw/darwin/bundle/German.lproj/Makefile
hw/darwin/bundle/Japanese.lproj/Makefile
hw/darwin/bundle/Portuguese.lproj/Makefile
hw/darwin/bundle/Spanish.lproj/Makefile
hw/darwin/bundle/Swedish.lproj/Makefile
hw/darwin/bundle/ko.lproj/Makefile
hw/darwin/iokit/Makefile
hw/darwin/quartz/Makefile
hw/darwin/utils/Makefile
hw/kdrive/Makefile
hw/kdrive/ati/Makefile
hw/kdrive/chips/Makefile

View File

@ -35,6 +35,13 @@ int DamageClientPrivateIndex;
RESTYPE DamageExtType;
RESTYPE DamageExtWinType;
/* Version of the damage extension supported by the server, as opposed to the
* DAMAGE_* defines from damageproto for what version the proto header
* supports.
*/
#define SERVER_DAMAGE_MAJOR 1
#define SERVER_DAMAGE_MINOR 1
#define prScreen screenInfo.screens[0]
static void
@ -143,16 +150,16 @@ ProcDamageQueryVersion(ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (stuff->majorVersion < DAMAGE_MAJOR) {
if (stuff->majorVersion < SERVER_DAMAGE_MAJOR) {
rep.majorVersion = stuff->majorVersion;
rep.minorVersion = stuff->minorVersion;
} else {
rep.majorVersion = DAMAGE_MAJOR;
if (stuff->majorVersion == DAMAGE_MAJOR &&
stuff->minorVersion < DAMAGE_MINOR)
rep.majorVersion = SERVER_DAMAGE_MAJOR;
if (stuff->majorVersion == SERVER_DAMAGE_MAJOR &&
stuff->minorVersion < SERVER_DAMAGE_MINOR)
rep.minorVersion = stuff->minorVersion;
else
rep.minorVersion = DAMAGE_MINOR;
rep.minorVersion = SERVER_DAMAGE_MINOR;
}
pDamageClient->major_version = rep.majorVersion;
pDamageClient->minor_version = rep.minorVersion;

View File

@ -64,6 +64,7 @@ Equipment Corporation.
#include "opaque.h"
#include "dixfontstr.h"
#include "closestr.h"
#include "dixfont.h"
#ifdef DEBUG
#include <stdio.h>

View File

@ -619,7 +619,7 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
kbp->deviceid |= MORE_EVENTS;
clipValuators(pDev, first_valuator, num_valuators, valuators);
events = getValuatorEvents(events, pDev, first_valuator,
num_valuators, valuators);
num_valuators, valuators);
}
}

View File

@ -1,25 +1,35 @@
appmandir = $(APP_MAN_DIR)
filemandir = $(FILE_MAN_DIR)
# Xserver.man covers options generic to all X servers built in this tree
# (i.e. those handled in the os/utils.c options processing instead of in
# the DDX-level options processing)
appman_PRE = Xserver.man.pre
fileman_PRE = SecurityPolicy.man.pre
appman_PROCESSED = $(appman_PRE:man.pre=man)
fileman_PROCESSED = $(fileman_PRE:man.pre=man)
appman_DATA = $(appman_PRE:man.pre=@APP_MAN_SUFFIX@)
fileman_DATA = $(fileman_PRE:man.pre=@FILE_MAN_SUFFIX@)
BUILT_SOURCES = $(appman_PROCESSED)
BUILT_SOURCES = $(appman_PROCESSED) $(fileman_PROCESSED)
CLEANFILES = $(appman_PROCESSED) $(appman_DATA)
CLEANFILES = $(appman_PROCESSED) $(appman_DATA) \
$(fileman_PROCESSED) $(fileman_DATA)
include $(top_srcdir)/cpprules.in
.man.$(APP_MAN_SUFFIX):
cp $< $@
.man.$(FILE_MAN_SUFFIX):
cp $< $@
EXTRAMANDEFS = -D__default_font_path__="`echo $(COMPILEDDEFAULTFONTPATH) | sed -e 's/,/, /g'`"
# Docs about X server internals that we ship with source but don't install
DEVEL_DOCS = smartsched
EXTRA_DIST = $(DEVEL_DOCS) $(appman_PRE)
EXTRA_DIST = $(DEVEL_DOCS) $(appman_PRE) $(fileman_PRE)

258
doc/SecurityPolicy.man.pre Normal file
View File

@ -0,0 +1,258 @@
.\" Split out of Xserver.man, which was covered by this notice:
.\" Copyright 1984 - 1991, 1993, 1994, 1998 The Open Group
.\"
.\" Permission to use, copy, modify, distribute, and sell this software and its
.\" documentation for any purpose is hereby granted without fee, provided that
.\" the above copyright notice appear in all copies and that both that
.\" copyright notice and this permission notice appear in supporting
.\" documentation.
.\"
.\" The above copyright notice and this permission notice shall be included
.\" in all copies or substantial portions of the Software.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
.\" OTHER DEALINGS IN THE SOFTWARE.
.\"
.\" Except as contained in this notice, the name of The Open Group shall
.\" not be used in advertising or otherwise to promote the sale, use or
.\" other dealings in this Software without prior written authorization
.\" from The Open Group.
.\" $XFree86: xc/programs/Xserver/Xserver.man,v 3.31 2004/01/10 22:27:46 dawes Exp $
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH SecurityPolicy __filemansuffix__ __xorgversion__
.SH NAME
SecurityPolicy \- X Window System SECURITY Extension Policy file format
.SH DESCRIPTION
The SECURITY extension to the X Window System uses a policy file to determine
which operations should be allowed or denied. The default location for this
file is
.IR __projectroot__/lib/xserver/SecurityPolicy .
.PP
The syntax of the security policy file is as follows.
Notation: "*" means zero or more occurrences of the preceding element,
and "+" means one or more occurrences. To interpret <foo/bar>, ignore
the text after the /; it is used to distinguish between instances of
<foo> in the next section.
.PP
.nf
<policy file> ::= <version line> <other line>*
<version line> ::= <string/v> '\en'
<other line > ::= <comment> | <access rule> | <site policy> | <blank line>
<comment> ::= # <not newline>* '\en'
<blank line> ::= <space> '\en'
<site policy> ::= sitepolicy <string/sp> '\en'
<access rule> ::= property <property/ar> <window> <perms> '\en'
<property> ::= <string>
<window> ::= any | root | <required property>
<required property> ::= <property/rp> | <property with value>
<property with value> ::= <property/rpv> = <string/rv>
<perms> ::= [ <operation> | <action> | <space> ]*
<operation> ::= r | w | d
<action> ::= a | i | e
<string> ::= <dbl quoted string> | <single quoted string> | <unquoted string>
<dbl quoted string> ::= <space> " <not dquote>* " <space>
<single quoted string> ::= <space> ' <not squote>* ' <space>
<unquoted string> ::= <space> <not space>+ <space>
<space> ::= [ ' ' | '\et' ]*
Character sets:
<not newline> ::= any character except '\en'
<not dquote> ::= any character except "
<not squote> ::= any character except '
<not space> ::= any character except those in <space>
.fi
.PP
The semantics associated with the above syntax are as follows.
.PP
<version line>, the first line in the file, specifies the file format
version. If the server does not recognize the version <string/v>, it
ignores the rest of the file. The version string for the file format
described here is "version-1" .
.PP
Once past the <version line>, lines that do not match the above syntax
are ignored.
.PP
<comment> lines are ignored.
.PP
<sitepolicy> lines are currently ignored. They are intended to
specify the site policies used by the XC-QUERY-SECURITY-1
authorization method.
.PP
<access rule> lines specify how the server should react to untrusted
client requests that affect the X Window property named <property/ar>.
The rest of this section describes the interpretation of an
<access rule>.
.PP
For an <access rule> to apply to a given instance of <property/ar>,
<property/ar> must be on a window that is in the set of windows
specified by <window>. If <window> is any, the rule applies to
<property/ar> on any window. If <window> is root, the rule applies to
<property/ar> only on root windows.
.PP
If <window> is <required property>, the following apply. If <required
property> is a <property/rp>, the rule applies when the window also
has that <property/rp>, regardless of its value. If <required
property> is a <property with value>, <property/rpv> must also have
the value specified by <string/rv>. In this case, the property must
have type STRING and format 8, and should contain one or more
null-terminated strings. If any of the strings match <string/rv>, the
rule applies.
.PP
The definition of string matching is simple case-sensitive string
comparison with one elaboration: the occurrence of the character '*' in
<string/rv> is a wildcard meaning "any string." A <string/rv> can
contain multiple wildcards anywhere in the string. For example, "x*"
matches strings that begin with x, "*x" matches strings that end with
x, "*x*" matches strings containing x, and "x*y*" matches strings that
start with x and subsequently contain y.
.PP
There may be multiple <access rule> lines for a given <property/ar>.
The rules are tested in the order that they appear in the file. The
first rule that applies is used.
.PP
<perms> specify operations that untrusted clients may attempt, and
the actions that the server should take in response to those operations.
.PP
<operation> can be r (read), w (write), or d (delete). The following
table shows how X Protocol property requests map to these operations
in the X.Org server implementation.
.PP
.nf
GetProperty r, or r and d if delete = True
ChangeProperty w
RotateProperties r and w
DeleteProperty d
ListProperties none, untrusted clients can always list all properties
.fi
.PP
<action> can be a (allow), i (ignore), or e (error). Allow means
execute the request as if it had been issued by a trusted client.
Ignore means treat the request as a no-op. In the case of
GetProperty, ignore means return an empty property value if the
property exists, regardless of its actual value. Error means do not
execute the request and return a BadAtom error with the atom set to
the property name. Error is the default action for all properties,
including those not listed in the security policy file.
.PP
An <action> applies to all <operation>s that follow it, until the next
<action> is encountered. Thus, irwad means ignore read and write,
allow delete.
.PP
GetProperty and RotateProperties may do multiple operations (r and d,
or r and w). If different actions apply to the operations, the most
severe action is applied to the whole request; there is no partial
request execution. The severity ordering is: allow < ignore < error.
Thus, if the <perms> for a property are ired (ignore read, error
delete), and an untrusted client attempts GetProperty on that property
with delete = True, an error is returned, but the property value is
not. Similarly, if any of the properties in a RotateProperties do not
allow both read and write, an error is returned without changing any
property values.
.PP
Here is an example security policy file.
.PP
.ta 3i 4i
.nf
version-1
XCOMM Allow reading of application resources, but not writing.
property RESOURCE_MANAGER root ar iw
property SCREEN_RESOURCES root ar iw
XCOMM Ignore attempts to use cut buffers. Giving errors causes apps to crash,
XCOMM and allowing access may give away too much information.
property CUT_BUFFER0 root irw
property CUT_BUFFER1 root irw
property CUT_BUFFER2 root irw
property CUT_BUFFER3 root irw
property CUT_BUFFER4 root irw
property CUT_BUFFER5 root irw
property CUT_BUFFER6 root irw
property CUT_BUFFER7 root irw
XCOMM If you are using Motif, you probably want these.
property _MOTIF_DEFAULT_BINDINGS root ar iw
property _MOTIF_DRAG_WINDOW root ar iw
property _MOTIF_DRAG_TARGETS any ar iw
property _MOTIF_DRAG_ATOMS any ar iw
property _MOTIF_DRAG_ATOM_PAIRS any ar iw
XCOMM The next two rules let xwininfo -tree work when untrusted.
property WM_NAME any ar
XCOMM Allow read of WM_CLASS, but only for windows with WM_NAME.
XCOMM This might be more restrictive than necessary, but demonstrates
XCOMM the <required property> facility, and is also an attempt to
XCOMM say "top level windows only."
property WM_CLASS WM_NAME ar
XCOMM These next three let xlsclients work untrusted. Think carefully
XCOMM before including these; giving away the client machine name and command
XCOMM may be exposing too much.
property WM_STATE WM_NAME ar
property WM_CLIENT_MACHINE WM_NAME ar
property WM_COMMAND WM_NAME ar
XCOMM To let untrusted clients use the standard colormaps created by
XCOMM xstdcmap, include these lines.
property RGB_DEFAULT_MAP root ar
property RGB_BEST_MAP root ar
property RGB_RED_MAP root ar
property RGB_GREEN_MAP root ar
property RGB_BLUE_MAP root ar
property RGB_GRAY_MAP root ar
XCOMM To let untrusted clients use the color management database created
XCOMM by xcmsdb, include these lines.
property XDCCC_LINEAR_RGB_CORRECTION root ar
property XDCCC_LINEAR_RGB_MATRICES root ar
property XDCCC_GRAY_SCREENWHITEPOINT root ar
property XDCCC_GRAY_CORRECTION root ar
XCOMM To let untrusted clients use the overlay visuals that many vendors
XCOMM support, include this line.
property SERVER_OVERLAY_VISUALS root ar
XCOMM Dumb examples to show other capabilities.
XCOMM oddball property names and explicit specification of error conditions
property "property with spaces" 'property with "' aw er ed
XCOMM Allow deletion of Woo-Hoo if window also has property OhBoy with value
XCOMM ending in "son". Reads and writes will cause an error.
property Woo-Hoo OhBoy = "*son" ad
.fi
.SH FILES
.TP 30
.I __projectroot__/lib/xserver/SecurityPolicy
Default X server security policy
.SH "SEE ALSO"
.PP
\fIXserver\fp(__appmansuffix__),
.I "Security Extension Specification"

View File

@ -414,221 +414,8 @@ X servers that support the SECURITY extension accept the following option:
causes the server to attempt to read and interpret filename as a security
policy file with the format described below. The file is read at server
startup and reread at each server reset.
.PP
The syntax of the security policy file is as follows.
Notation: "*" means zero or more occurrences of the preceding element,
and "+" means one or more occurrences. To interpret <foo/bar>, ignore
the text after the /; it is used to distinguish between instances of
<foo> in the next section.
.PP
.nf
<policy file> ::= <version line> <other line>*
<version line> ::= <string/v> '\en'
<other line > ::= <comment> | <access rule> | <site policy> | <blank line>
<comment> ::= # <not newline>* '\en'
<blank line> ::= <space> '\en'
<site policy> ::= sitepolicy <string/sp> '\en'
<access rule> ::= property <property/ar> <window> <perms> '\en'
<property> ::= <string>
<window> ::= any | root | <required property>
<required property> ::= <property/rp> | <property with value>
<property with value> ::= <property/rpv> = <string/rv>
<perms> ::= [ <operation> | <action> | <space> ]*
<operation> ::= r | w | d
<action> ::= a | i | e
<string> ::= <dbl quoted string> | <single quoted string> | <unquoted string>
<dbl quoted string> ::= <space> " <not dqoute>* " <space>
<single quoted string> ::= <space> ' <not squote>* ' <space>
<unquoted string> ::= <space> <not space>+ <space>
<space> ::= [ ' ' | '\et' ]*
Character sets:
<not newline> ::= any character except '\en'
<not dqoute> ::= any character except "
<not squote> ::= any character except '
<not space> ::= any character except those in <space>
.fi
.PP
The semantics associated with the above syntax are as follows.
.PP
<version line>, the first line in the file, specifies the file format
version. If the server does not recognize the version <string/v>, it
ignores the rest of the file. The version string for the file format
described here is "version-1" .
.PP
Once past the <version line>, lines that do not match the above syntax
are ignored.
.PP
<comment> lines are ignored.
.PP
<sitepolicy> lines are currently ignored. They are intended to
specify the site policies used by the XC-QUERY-SECURITY-1
authorization method.
.PP
<access rule> lines specify how the server should react to untrusted
client requests that affect the X Window property named <property/ar>.
The rest of this section describes the interpretation of an
<access rule>.
.PP
For an <access rule> to apply to a given instance of <property/ar>,
<property/ar> must be on a window that is in the set of windows
specified by <window>. If <window> is any, the rule applies to
<property/ar> on any window. If <window> is root, the rule applies to
<property/ar> only on root windows.
.PP
If <window> is <required property>, the following apply. If <required
property> is a <property/rp>, the rule applies when the window also
has that <property/rp>, regardless of its value. If <required
property> is a <property with value>, <property/rpv> must also have
the value specified by <string/rv>. In this case, the property must
have type STRING and format 8, and should contain one or more
null-terminated strings. If any of the strings match <string/rv>, the
rule applies.
.PP
The definition of string matching is simple case-sensitive string
comparison with one elaboration: the occurrence of the character '*' in
<string/rv> is a wildcard meaning "any string." A <string/rv> can
contain multiple wildcards anywhere in the string. For example, "x*"
matches strings that begin with x, "*x" matches strings that end with
x, "*x*" matches strings containing x, and "x*y*" matches strings that
start with x and subsequently contain y.
.PP
There may be multiple <access rule> lines for a given <property/ar>.
The rules are tested in the order that they appear in the file. The
first rule that applies is used.
.PP
<perms> specify operations that untrusted clients may attempt, and
the actions that the server should take in response to those operations.
.PP
<operation> can be r (read), w (write), or d (delete). The following
table shows how X Protocol property requests map to these operations
in The Open Group server implementation.
.PP
.nf
GetProperty r, or r and d if delete = True
ChangeProperty w
RotateProperties r and w
DeleteProperty d
ListProperties none, untrusted clients can always list all properties
.fi
.PP
<action> can be a (allow), i (ignore), or e (error). Allow means
execute the request as if it had been issued by a trusted client.
Ignore means treat the request as a no-op. In the case of
GetProperty, ignore means return an empty property value if the
property exists, regardless of its actual value. Error means do not
execute the request and return a BadAtom error with the atom set to
the property name. Error is the default action for all properties,
including those not listed in the security policy file.
.PP
An <action> applies to all <operation>s that follow it, until the next
<action> is encountered. Thus, irwad means ignore read and write,
allow delete.
.PP
GetProperty and RotateProperties may do multiple operations (r and d,
or r and w). If different actions apply to the operations, the most
severe action is applied to the whole request; there is no partial
request execution. The severity ordering is: allow < ignore < error.
Thus, if the <perms> for a property are ired (ignore read, error
delete), and an untrusted client attempts GetProperty on that property
with delete = True, an error is returned, but the property value is
not. Similarly, if any of the properties in a RotateProperties do not
allow both read and write, an error is returned without changing any
property values.
.PP
Here is an example security policy file.
.PP
.ta 3i 4i
.nf
version-1
XCOMM Allow reading of application resources, but not writing.
property RESOURCE_MANAGER root ar iw
property SCREEN_RESOURCES root ar iw
XCOMM Ignore attempts to use cut buffers. Giving errors causes apps to crash,
XCOMM and allowing access may give away too much information.
property CUT_BUFFER0 root irw
property CUT_BUFFER1 root irw
property CUT_BUFFER2 root irw
property CUT_BUFFER3 root irw
property CUT_BUFFER4 root irw
property CUT_BUFFER5 root irw
property CUT_BUFFER6 root irw
property CUT_BUFFER7 root irw
XCOMM If you are using Motif, you probably want these.
property _MOTIF_DEFAULT_BINDINGS root ar iw
property _MOTIF_DRAG_WINDOW root ar iw
property _MOTIF_DRAG_TARGETS any ar iw
property _MOTIF_DRAG_ATOMS any ar iw
property _MOTIF_DRAG_ATOM_PAIRS any ar iw
XCOMM The next two rules let xwininfo -tree work when untrusted.
property WM_NAME any ar
XCOMM Allow read of WM_CLASS, but only for windows with WM_NAME.
XCOMM This might be more restrictive than necessary, but demonstrates
XCOMM the <required property> facility, and is also an attempt to
XCOMM say "top level windows only."
property WM_CLASS WM_NAME ar
XCOMM These next three let xlsclients work untrusted. Think carefully
XCOMM before including these; giving away the client machine name and command
XCOMM may be exposing too much.
property WM_STATE WM_NAME ar
property WM_CLIENT_MACHINE WM_NAME ar
property WM_COMMAND WM_NAME ar
XCOMM To let untrusted clients use the standard colormaps created by
XCOMM xstdcmap, include these lines.
property RGB_DEFAULT_MAP root ar
property RGB_BEST_MAP root ar
property RGB_RED_MAP root ar
property RGB_GREEN_MAP root ar
property RGB_BLUE_MAP root ar
property RGB_GRAY_MAP root ar
XCOMM To let untrusted clients use the color management database created
XCOMM by xcmsdb, include these lines.
property XDCCC_LINEAR_RGB_CORRECTION root ar
property XDCCC_LINEAR_RGB_MATRICES root ar
property XDCCC_GRAY_SCREENWHITEPOINT root ar
property XDCCC_GRAY_CORRECTION root ar
XCOMM To let untrusted clients use the overlay visuals that many vendors
XCOMM support, include this line.
property SERVER_OVERLAY_VISUALS root ar
XCOMM Dumb examples to show other capabilities.
XCOMM oddball property names and explicit specification of error conditions
property "property with spaces" 'property with "' aw er ed
XCOMM Allow deletion of Woo-Hoo if window also has property OhBoy with value
XCOMM ending in "son". Reads and writes will cause an error.
property Woo-Hoo OhBoy = "*son" ad
.fi
The syntax of the security policy file is described in
\fISecurityPolicy\fP(__filemansuffix__).
.SH "NETWORK CONNECTIONS"
The X server supports client connections via a platform-dependent subset of
the following transport types: TCP\/IP, Unix Domain sockets, DECnet,
@ -757,6 +544,9 @@ Error log file for display number \fBn\fP if run from \fIinit\fP(__adminmansuffi
.TP 30
.I __projectroot__/lib/X11/xdm/xdm-errors
Default error log file if the server is run from \fIxdm\fP(1)
.TP 30
.I __projectroot__/lib/xserver/SecurityPolicy
Default X server security policy
.SH "SEE ALSO"
General information: \fIX\fP(__miscmansuffix__)
.PP
@ -771,6 +561,7 @@ Fonts: \fIbdftopcf\fP(1), \fImkfontdir\fP(1), \fImkfontscale\fP(1),
.PP
Security: \fIXsecurity\fP(__miscmansuffix__), \fIxauth\fP(1), \fIXau\fP(1),
\fIxdm\fP(1), \fIxhost\fP(1), \fIxfwp\fP(1),
\fISecurityPolicy\fP(__filemansuffix__),
.I "Security Extension Specification"
.PP
Starting the server: \fIxdm\fP(1), \fIxinit\fP(1)

View File

@ -648,6 +648,14 @@ exaPolyFillRect(DrawablePtr pDrawable,
{
exaDoMigration (pixmaps, 1, FALSE);
ExaCheckPolyFillRect (pDrawable, pGC, nrect, prect);
while (nrect-- >= 0) {
exaDrawableDirty(pDrawable,
pDrawable->x + prect->x,
pDrawable->y + prect->y,
pDrawable->x + prect->x + prect->width,
pDrawable->y + prect->y + prect->height);
prect++;
}
return;
} else {
exaDoMigration (pixmaps, 1, TRUE);

View File

@ -572,9 +572,7 @@ exaComposite(CARD8 op,
if (pExaScr->swappedOut ||
pSrc->pDrawable == NULL || (pMask != NULL && pMask->pDrawable == NULL))
{
ExaCheckComposite (op, pSrc, pMask, pDst, xSrc, ySrc,
xMask, yMask, xDst, yDst, width, height);
return;
goto fallback;
}
/* Remove repeat in source if useless */
@ -683,12 +681,18 @@ exaComposite(CARD8 op,
}
}
fallback:
#if DEBUG_TRACE_FALL
exaPrintCompositeFallback (op, pSrc, pMask, pDst);
#endif
ExaCheckComposite (op, pSrc, pMask, pDst, xSrc, ySrc,
xMask, yMask, xDst, yDst, width, height);
exaDrawableDirty(pDst->pDrawable,
pDst->pDrawable->x + xDst,
pDst->pDrawable->y + yDst,
pDst->pDrawable->x + xDst + width,
pDst->pDrawable->y + yDst + height);
done:
pSrc->repeat = saveSrcRepeat;
@ -995,15 +999,17 @@ exaGlyphs (CARD8 op,
* First we try to use UploadToScreen, if we can, then we fall back
* to a plain exaCopyArea in case of failure.
*/
if (!pExaScr->info->UploadToScreen ||
!exaPixmapIsOffscreen(pPixmap) ||
!(*pExaScr->info->UploadToScreen) (pPixmap, 0, 0,
if (pExaScr->info->UploadToScreen &&
exaPixmapIsOffscreen(pPixmap) &&
(*pExaScr->info->UploadToScreen) (pPixmap, 0, 0,
glyph->info.width,
glyph->info.height,
glyphdata,
PixmapBytePad(glyph->info.width,
list->format->depth)))
{
exaMarkSync (pScreen);
} else {
/* Set up the scratch pixmap/GC for doing a CopyArea. */
if (pScratchPixmap == NULL) {
/* Get a scratch pixmap to wrap the original glyph data */

View File

@ -1338,6 +1338,104 @@ fbCompositeSrc_8888x8888mmx (CARD8 op,
_mm_empty();
}
void
fbCompositeSrc_8888x0565mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height)
{
CARD16 *dstLine, *dst;
CARD32 *srcLine, *src;
FbStride dstStride, srcStride;
CARD16 w;
CHECKPOINT();
fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1);
fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
assert (pSrc->pDrawable == pMask->pDrawable);
while (height--)
{
dst = dstLine;
dstLine += dstStride;
src = srcLine;
srcLine += srcStride;
w = width;
CHECKPOINT();
while (w && (unsigned long)dst & 7)
{
__m64 vsrc = load8888 (*src);
ullong d = *dst;
__m64 vdest = expand565 ((__m64)d, 0);
vdest = pack565(over(vsrc, expand_alpha(vsrc), vdest), vdest, 0);
*dst = (ullong)vdest;
w--;
dst++;
src++;
}
CHECKPOINT();
while (w >= 4)
{
__m64 vsrc0, vsrc1, vsrc2, vsrc3;
__m64 vdest;
vsrc0 = load8888(*(src + 0));
vsrc1 = load8888(*(src + 1));
vsrc2 = load8888(*(src + 2));
vsrc3 = load8888(*(src + 3));
vdest = *(__m64 *)dst;
vdest = pack565(over(vsrc0, expand_alpha(vsrc0), expand565(vdest, 0)), vdest, 0);
vdest = pack565(over(vsrc1, expand_alpha(vsrc1), expand565(vdest, 1)), vdest, 1);
vdest = pack565(over(vsrc2, expand_alpha(vsrc2), expand565(vdest, 2)), vdest, 2);
vdest = pack565(over(vsrc3, expand_alpha(vsrc3), expand565(vdest, 3)), vdest, 3);
*(__m64 *)dst = vdest;
w -= 4;
dst += 4;
src += 4;
}
CHECKPOINT();
while (w)
{
__m64 vsrc = load8888 (*src);
ullong d = *dst;
__m64 vdest = expand565 ((__m64)d, 0);
vdest = pack565(over(vsrc, expand_alpha(vsrc), vdest), vdest, 0);
*dst = (ullong)vdest;
w--;
dst++;
src++;
}
}
_mm_empty();
}
void
fbCompositeSolidMask_nx8x8888mmx (CARD8 op,
PicturePtr pSrc,

View File

@ -130,6 +130,18 @@ void fbCompositeSrc_8888RevNPx8888mmx (CARD8 op,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSrc_8888x0565mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSrc_8888RevNPx0565mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,

View File

@ -1175,7 +1175,12 @@ fbComposite (CARD8 op,
func = fbCompositeSrc_8888x0888;
break;
case PICT_r5g6b5:
func = fbCompositeSrc_8888x0565;
#ifdef USE_MMX
if (fbHaveMMX())
func = fbCompositeSrc_8888x0565mmx;
else
#endif
func = fbCompositeSrc_8888x0565;
break;
default:
break;
@ -1221,7 +1226,12 @@ fbComposite (CARD8 op,
func = fbCompositeSrc_8888x0888;
break;
case PICT_b5g6r5:
func = fbCompositeSrc_8888x0565;
#ifdef USE_MMX
if (fbHaveMMX())
func = fbCompositeSrc_8888x0565mmx;
else
#endif
func = fbCompositeSrc_8888x0565;
break;
default:
break;
@ -1516,7 +1526,9 @@ static unsigned int detectCPUFeatures(void) {
features |= SSE;
if (result & (1 << 26))
features |= SSE2;
if ((result & MMX) && !(result & SSE) && (strcmp(vendor, "AuthenticAMD") == 0)) {
if ((features & MMX) && !(features & SSE) &&
(strcmp(vendor, "AuthenticAMD") == 0 ||
strcmp(vendor, "Geode by NSC") == 0)) {
/* check for AMD MMX extensions */
unsigned int result;

View File

@ -1,10 +1,18 @@
if DMX
if BUILD_DARWIN
# Darwin does not need the dmx subdir
else
DMX_SUBDIRS = dmx
endif
endif
if XORG
if BUILD_DARWIN
# Darwin does not need the xfree86 subdir
else
XORG_SUBDIRS = xfree86
endif
endif
if XVFB
XVFB_SUBDIRS = vfb
@ -30,12 +38,15 @@ if XPRINT
XPRINT_SUBDIRS = xprint
endif
# need to add darwin support here
if BUILD_DARWIN
DARWIN_SUBDIRS = darwin
endif
SUBDIRS = \
$(XORG_SUBDIRS) \
$(XGL_SUBDIRS) \
$(XWIN_SUBDIRS) \
$(DARWIN_SUBDIRS) \
$(XVFB_SUBDIRS) \
$(XNEST_SUBDIRS) \
$(DMX_SUBDIRS) \

View File

@ -1,52 +1,325 @@
noinst_LIBRARIES = libdarwinShared.a
libdarwin_XINPUT_SRCS = darwinXinput.c
AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@
AM_CPPFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@
INCLUDES = @XORG_INCS@ -I../../miext/rootless
DEFS = @DEFS@ -DUSE_NEW_CLUT
if XQUARTZ
XQUARTZ_SUBDIRS = bundle quartz
endif
SUBDIRS = \
iokit \
$(XQUARTZ_SUBDIRS) \
utils \
.
darwinappdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app
libdarwinShared_a_SOURCES = darwin.c \
darwinEvents.c \
darwinKeyboard.c \
$(darwin_XINPUT_SRCS)
bin_PROGRAMS = XDarwin Xquartz
XDarwin_SOURCES = \
$(top_srcdir)/fb/fbcmap.c \
$(top_srcdir)/mi/miinitext.c \
$(top_srcdir)/Xi/stubs.c
Xquartz_SOURCES = \
$(top_srcdir)/fb/fbcmap.c \
$(top_srcdir)/mi/miinitext.c \
$(top_srcdir)/Xi/stubs.c \
apple/X11Application.m \
apple/X11Controller.m \
quartz/Xserver.m \
quartz/Preferences.m \
quartz/applewm.c \
quartz/keysym2ucs.c \
quartz/pseudoramiX.c \
quartz/quartz.c \
quartz/quartzAudio.c \
quartz/quartzCocoa.m \
quartz/quartzKeyboard.c \
quartz/quartzPasteboard.c \
quartz/quartzStartup.c \
quartz/xpr/appledri.c \
quartz/xpr/dri.c \
quartz/xpr/xprAppleWM.c \
quartz/xpr/xprCursor.c \
quartz/xpr/xprFrame.c \
quartz/xpr/xprScreen.c \
quartz/xpr/x-hash.c \
quartz/xpr/x-hook.c \
quartz/xpr/x-list.c
XDarwin_LDADD = \
$(top_builddir)/dix/dixfonts.lo \
$(top_builddir)/dix/libdix.la \
$(top_builddir)/config/libconfig.a \
$(top_builddir)/os/libos.la \
./libdarwinShared.a \
./iokit/libiokit.a \
$(top_builddir)/dix/libxpstubs.la \
$(top_builddir)/miext/shadow/libshadow.la \
$(top_builddir)/fb/libfb.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 \
$(XGLX_LIBS) \
$(top_builddir)/miext/rootless/librootless.la \
$(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \
$(top_builddir)/miext/rootless/accel/librlAccel.la \
@XORG_LIBS@ \
$(XSERVER_LIBS)
Xquartz_LDADD = \
$(top_builddir)/dix/dixfonts.lo \
$(top_builddir)/dix/libdix.la \
$(top_builddir)/config/libconfig.a \
$(top_builddir)/os/libos.la \
./libdarwinShared.a \
$(top_builddir)/dix/libxpstubs.la \
$(top_builddir)/miext/shadow/libshadow.la \
$(top_builddir)/fb/libfb.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 \
@XORG_LIBS@ \
$(XSERVER_LIBS) -lXplugin
XDarwin_LDFLAGS = \
-XCClinker -Objc \
-Wl,-u,_miDCInitialize \
-Wl,-framework,IOKit
Xquartz_LDFLAGS = \
-XCClinker -Objc \
-Wl,-u,_miDCInitialize \
-Wl,-framework,Carbon \
-Wl,-framework,OpenGL \
-Wl,-framework,Cocoa \
-Wl,-framework,CoreAudio \
-Wl,-framework,IOKit
XDarwin_CFLAGS = -DINXDARWIN
Xquartz_CFLAGS = -DINXQUARTZ -DHAS_CG_MACH_PORT -DHAS_KL_API -DHAVE_XORG_CONFIG_H
if XQUARTZ
macosdir = $(darwinappdir)/Contents/MacOS
DEFS += -DDARWIN_WITH_QUARTZ -DXFree86Server
macos_PROGRAMS = XDarwinApp
macos_SCRIPTS = x11app
x11app:
cd apple && xcodebuild
XDarwinApp_SOURCES = \
$(top_srcdir)/fb/fbcmap.c \
$(top_srcdir)/mi/miinitext.c \
$(top_srcdir)/Xi/stubs.c
XDarwinApp_LDADD = \
$(top_builddir)/dix/dixfonts.lo \
$(top_builddir)/dix/libdix.la \
$(top_builddir)/config/libconfig.a \
$(top_builddir)/os/libos.la \
./quartz/XApplication.o \
./libdarwinShared.a \
./quartz/libXQuartz.a \
$(top_builddir)/dix/libxpstubs.la \
$(top_builddir)/miext/shadow/libshadow.la \
$(top_builddir)/fb/libfb.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 \
$(XGLX_LIBS) \
$(top_builddir)/miext/rootless/librootless.la \
$(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \
$(top_builddir)/miext/rootless/accel/librlAccel.la \
@XORG_LIBS@ \
$(XSERVER_LIBS) \
$(top_builddir)/fb/libfb.la
XDarwinApp_LDFLAGS = \
-XCClinker -Objc \
-Wl,-u,_miDCInitialize \
-Wl,-framework,Carbon \
-Wl,-framework,ApplicationServices \
-Wl,-framework,Cocoa \
-Wl,-framework,CoreAudio \
-Wl,-framework,IOKit
XDarwinApp_CFLAGS = -DINXDARWINAPP
HOOK_TARGETS = xquartz-install-hook
crplugindir = $(darwinappdir)/Contents/Resources/cr.bundle/Contents/MacOS
crplugin_LTLIBRARIES = cr.la
cr_la_SOURCES = \
quartz/cr/crAppleWM.m \
quartz/cr/crFrame.m \
quartz/cr/crScreen.m \
quartz/fullscreen/quartzCursor.c \
quartz/cr/XView.m
cr_la_LIBADD = \
$(top_builddir)/miext/rootless/librootless.la \
$(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \
$(top_builddir)/miext/rootless/accel/librlAccel.la
cr_la_LDFLAGS = -shrext '' -Wl,-framework,ApplicationServices \
-Wl,-framework,Cocoa \
-Wl,-framework,Carbon \
-XCClinker -ObjC \
-XCClinker -bundle_loader -XCClinker XDarwinApp \
-module -avoid-version -no-undefined
cr_la_DEPENDENCIES = XDarwinApp
fullscreenplugindir = $(darwinappdir)/Contents/Resources/fullscreen.bundle/Contents/MacOS
fullscreenplugin_LTLIBRARIES = fullscreen.la
fullscreen_la_SOURCES = \
quartz/fullscreen/fullscreen.c \
quartz/fullscreen/quartzCursor.c
fullscreen_la_LIBADD = \
$(top_builddir)/miext/shadow/libshadow.la
fullscreen_la_LDFLAGS = -shrext '' -Wl,-framework,ApplicationServices \
-XCClinker -bundle_loader -XCClinker XDarwinApp \
-module -avoid-version -no-undefined
fullscreen_la_DEPENDENCIES = XDarwinApp
if GLX
glxMesaplugindir = $(darwinappdir)/Contents/Resources/glxMesa.bundle/Contents/MacOS
glxMesaplugin_LTLIBRARIES = glxMesa.la
glxMesa_la_SOURCES =
glxMesa_la_LIBADD = \
$(top_builddir)/GL/glx/libglx.la \
$(top_builddir)/GL/mesa/libGLcore.la
glxMesa_la_LDFLAGS = -shrext '' \
-Wl,-framework,AGL \
-Wl,-framework,OpenGL \
-XCClinker -ObjC \
-XCClinker -bundle_loader -XCClinker XDarwinApp \
-module -avoid-version -no-undefined
glxMesa_la_DEPENDENCIES = XDarwinApp
endif
endif
if HAVE_X_PLUGIN
xprplugindir = $(darwinappdir)/Contents/Resources/xpr.bundle/Contents/MacOS
xprplugin_LTLIBRARIES = xpr.la
xpr_la_SOURCES = \
quartz/xpr/appledri.c \
quartz/xpr/dri.c \
quartz/xpr/xprAppleWM.c \
quartz/xpr/xprCursor.c \
quartz/xpr/xprFrame.c \
quartz/xpr/xprScreen.c \
quartz/xpr/x-hash.c \
quartz/xpr/x-hook.c \
quartz/xpr/x-list.c
xpr_la_LIBADD = \
$(top_builddir)/miext/rootless/librootless.la \
$(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \
$(top_builddir)/miext/rootless/accel/librlAccel.la
xpr_la_LDFLAGS = -shrext '' -Wl,-framework,ApplicationServices \
-lXplugin \
-XCClinker -bundle_loader -XCClinker XDarwinApp \
-module -avoid-version -no-undefined
xpr_la_DEPENDENCIES = XDarwinApp
endif
if HAVE_AGL_FRAMEWORK
glxCGLplugindir = $(darwinappdir)/Contents/Resources/glxCGL.bundle/Contents/MacOS
glxCGLplugin_LTLIBRARIES = glxCGL.la
glxCGL_la_SOURCES =
glxCGL_la_LIBADD = \
$(top_builddir)/GL/glx/glxext.o \
$(top_builddir)/GL/glx/libglx.a \
$(top_builddir)/GL/apple/libAGLcore.a
glxCGL_la_LDFLAGS = -shrext '' -Wl,-framework,ApplicationServices \
-Wl,-framework,AGL \
-Wl,-framework,OpenGL \
-XCClinker -ObjC \
-XCClinker -bundle_loader -XCClinker XDarwinApp \
-module -avoid-version -no-undefined
glxCGL_la_DEPENDENCIES = XDarwinApp
glxAGLplugindir = $(darwinappdir)/Contents/Resources/glxAGL.bundle/Contents/MacOS
glxAGLplugin_LTLIBRARIES = glxAGL.la
glxAGL_la_SOURCES =
glxAGL_la_LIBADD = \
$(top_builddir)/GL/glx/glxext.o \
$(top_builddir)/GL/glx/libglx.a \
$(top_builddir)/GL/apple/libAGLcore.a
glxAGL_la_LDFLAGS = -shrext '' \
-Wl,-framework,AGL \
-Wl,-framework,OpenGL \
-XCClinker -ObjC \
-XCClinker -bundle_loader -XCClinker XDarwinApp \
-module -avoid-version -no-undefined
glxAGL_la_DEPENDENCIES = XDarwinApp
endif
man1_MANS = XDarwin.man
uninstall-hook:
rm -rf $(DESTDIR)$(macosdir)/XDarwin
install-data-hook: $(HOOK_TARGETS)
xquartz-install-hook:
mv $(DESTDIR)$(macosdir)/XDarwinApp $(DESTDIR)$(macosdir)/XDarwin
cd apple && xcodebuild install
EXTRA_DIST = \
bundle/Dutch.lproj/Credits.rtf \
bundle/Dutch.lproj/Localizable.strings \
bundle/Dutch.lproj/MainMenu.nib/classes.nib \
bundle/Dutch.lproj/MainMenu.nib/objects.nib \
bundle/Dutch.lproj/XDarwinHelp.html.cpp \
bundle/English.lproj/Credits.rtf \
bundle/English.lproj/InfoPlist.strings.cpp \
bundle/English.lproj/Localizable.strings \
bundle/English.lproj/MainMenu.nib/classes.nib \
bundle/English.lproj/MainMenu.nib/objects.nib \
bundle/English.lproj/XDarwinHelp.html.cpp \
bundle/French.lproj/Credits.rtf \
bundle/French.lproj/Localizable.strings \
bundle/French.lproj/MainMenu.nib/classes.nib \
bundle/French.lproj/MainMenu.nib/objects.nib \
bundle/French.lproj/XDarwinHelp.html.cpp \
bundle/German.lproj/Credits.rtf \
bundle/German.lproj/Localizable.strings \
bundle/German.lproj/MainMenu.nib/classes.nib \
bundle/German.lproj/MainMenu.nib/objects.nib \
bundle/German.lproj/XDarwinHelp.html.cpp \
bundle/Japanese.lproj/Credits.rtf \
bundle/Japanese.lproj/Localizable.strings \
bundle/Japanese.lproj/MainMenu.nib/classes.nib \
bundle/Japanese.lproj/MainMenu.nib/objects.nib \
bundle/Japanese.lproj/XDarwinHelp.html.cpp \
bundle/ko.lproj/Credits.rtf \
bundle/ko.lproj/Localizable.strings \
bundle/ko.lproj/MainMenu.nib/classes.nib \
bundle/ko.lproj/MainMenu.nib/objects.nib \
bundle/ko.lproj/XDarwinHelp.html.cpp \
bundle/Portuguese.lproj/Credits.rtf \
bundle/Portuguese.lproj/Localizable.strings \
bundle/Portuguese.lproj/MainMenu.nib/classes.nib \
bundle/Portuguese.lproj/MainMenu.nib/objects.nib \
bundle/Portuguese.lproj/XDarwinHelp.html.cpp \
bundle/Spanish.lproj/Credits.rtf \
bundle/Spanish.lproj/Localizable.strings \
bundle/Spanish.lproj/MainMenu.nib/classes.nib \
bundle/Spanish.lproj/MainMenu.nib/objects.nib \
bundle/Spanish.lproj/XDarwinHelp.html.cpp \
bundle/startXClients.cpp \
bundle/Swedish.lproj/Credits.rtf \
bundle/Swedish.lproj/Localizable.strings \
bundle/Swedish.lproj/MainMenu.nib/classes.nib \
bundle/Swedish.lproj/MainMenu.nib/objects.nib \
bundle/Swedish.lproj/XDarwinHelp.html.cpp \
bundle/XDarwin.icns \
darwin.c \
darwinClut8.h \
darwinEvents.c \
@ -54,64 +327,4 @@ EXTRA_DIST = \
darwinKeyboard.c \
darwinKeyboard.h \
darwinXinput.c \
iokit/xfIOKit.c \
iokit/xfIOKitCursor.c \
iokit/xfIOKit.h \
iokit/xfIOKitStartup.c \
Makefile.am \
quartz/applewm.c \
quartz/applewmExt.h \
quartz/cr/crAppleWM.m \
quartz/cr/crFrame.m \
quartz/cr/cr.h \
quartz/cr/crScreen.m \
quartz/cr/XView.h \
quartz/cr/XView.m \
quartz/fullscreen/fullscreen.c \
quartz/fullscreen/quartzCursor.c \
quartz/fullscreen/quartzCursor.h \
quartz/keysym2ucs.c \
quartz/keysym2ucs.h \
quartz/Preferences.h \
quartz/Preferences.m \
quartz/pseudoramiX.c \
quartz/pseudoramiX.h \
quartz/quartzAudio.c \
quartz/quartzAudio.h \
quartz/quartz.c \
quartz/quartzCocoa.m \
quartz/quartzCommon.h \
quartz/quartzCursor.c \
quartz/quartzCursor.h \
quartz/quartz.h \
quartz/quartzKeyboard.c \
quartz/quartzPasteboard.c \
quartz/quartzPasteboard.h \
quartz/quartzStartup.c \
quartz/XApplication.h \
quartz/XApplication.m \
quartz/XDarwin.pbproj/project.pbxproj \
quartz/XDarwinStartup.c \
quartz/XDarwinStartup.man \
quartz/xpr/appledri.c \
quartz/xpr/dri.c \
quartz/xpr/dri.h \
quartz/xpr/dristruct.h \
quartz/xpr/x-hash.c \
quartz/xpr/x-hash.h \
quartz/xpr/x-hook.c \
quartz/xpr/x-hook.h \
quartz/xpr/x-list.c \
quartz/xpr/x-list.h \
quartz/xpr/Xplugin.h \
quartz/xpr/xprAppleWM.c \
quartz/xpr/xprCursor.c \
quartz/xpr/xprFrame.c \
quartz/xpr/xpr.h \
quartz/xpr/xprScreen.c \
quartz/XServer.h \
quartz/XServer.m \
utils/dumpkeymap.c \
utils/dumpkeymap.man \
utils/README.txt \
XDarwin.man

41
hw/darwin/README.apple Normal file
View File

@ -0,0 +1,41 @@
This directory contains a port of the XDarwin code to the modular X.org
codebase to be compiled on Darwin/OS X; this would not have been possible
without the help of Torrey Lyons and Peter O'Gorman, to whom I am
grateful for their patches, time and moral support.
The server builds 4 targets:
* XDarwin: this server runs on Darwin systems without Quartz
(i.e. non-OS X); it has not been well-tested.
* XDarwinApp: this builds XDarwin.app, which is a full X server using
Quartz. It has loadable module support for AGL and CGL, and well as
fullscreen and rootless support.
* Xquartz: this server runs on Quartz-based systems, and is meant to
work with X11.app
* x11app: this builds a version of Apple's X11.app using patches by
Torrey Lyons; most, but not all, functionality of Apple's original
X11.app is present in this release.
Known issues:
* AGL and CGL support for 3D indirect acceleration does not work;
indirect.c needs to be rewritten.
* Fullscreen mode does not work; I don't know why.
* The keyboard and mouse do not work at all; they worked in X11R7.1,
and I believe that they were broken by the events changes in dix/.
* Some features in X11.app are not yet implemented; these are marked
with #ifdef DARWIN_DDX_MISSING in the code.
* The build system code could probably be cleaned up slightly.
* Most testing of this code has occurred under 10.5, but it should
also work under 10.4.
Any patches or code contributions would be most welcome and may be
sent to me at bbyer@apple.com.

Binary file not shown.

View File

@ -0,0 +1,65 @@
8
dir
29110
svn+ssh://src.apple.com/svn/BSD/X11server/trunk/darwin/apple/English.lproj/main.nib
svn+ssh://src.apple.com/svn/BSD
2007-02-03T03:06:20.842932Z
28761
bbyer
svn:special svn:externals svn:needs-lock
e92bca22-270c-0410-9cea-e3f1106b6a1c
info.nib
file
2007-02-27T01:00:07.000000Z
456347804c516786b1d1339ce2ef50a2
2007-02-03T03:06:20.842932Z
28761
bbyer
keyedobjects.nib
file
2007-02-27T01:00:07.000000Z
eb3010372b09768c846df0d996cfdd8d
2007-02-03T03:06:20.842932Z
28761
bbyer
has-props
classes.nib
file
2007-02-27T01:00:07.000000Z
0ae2660c3afabbd5aa02fc34712c96e6
2007-02-03T03:06:20.842932Z
28761
bbyer

View File

@ -0,0 +1 @@
8

View File

@ -0,0 +1,5 @@
K 13
svn:mime-type
V 24
application/octet-stream
END

View File

@ -0,0 +1,318 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBClasses</key>
<array>
<dict>
<key>CLASS</key>
<string>IBLibraryObjectTemplate</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>OUTLETS</key>
<dict>
<key>draggedView</key>
<string>NSView</string>
<key>representedObject</key>
<string>NSObject</string>
</dict>
<key>SUPERCLASS</key>
<string>NSView</string>
</dict>
<dict>
<key>CLASS</key>
<string>IBInspector</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>OUTLETS</key>
<dict>
<key>inspectorView</key>
<string>NSView</string>
</dict>
<key>SUPERCLASS</key>
<string>NSObject</string>
</dict>
<dict>
<key>CLASS</key>
<string>NSDateFormatter</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
<string>NSFormatter</string>
</dict>
<dict>
<key>ACTIONS</key>
<dict>
<key>apps_table_cancel</key>
<string>id</string>
<key>apps_table_delete</key>
<string>id</string>
<key>apps_table_done</key>
<string>id</string>
<key>apps_table_duplicate</key>
<string>id</string>
<key>apps_table_new</key>
<string>id</string>
<key>apps_table_show</key>
<string>id</string>
<key>bring_to_front</key>
<string>id</string>
<key>close_window</key>
<string>id</string>
<key>enable_fullscreen_changed</key>
<string>id</string>
<key>minimize_window</key>
<string>id</string>
<key>next_window</key>
<string>id</string>
<key>prefs_changed</key>
<string>id</string>
<key>prefs_show</key>
<string>id</string>
<key>previous_window</key>
<string>id</string>
<key>toggle_fullscreen</key>
<string>id</string>
<key>x11_help</key>
<string>id</string>
<key>zoom_window</key>
<string>id</string>
</dict>
<key>CLASS</key>
<string>X11Controller</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>OUTLETS</key>
<dict>
<key>apps_separator</key>
<string>id</string>
<key>apps_table</key>
<string>id</string>
<key>depth</key>
<string>id</string>
<key>dock_apps_menu</key>
<string>id</string>
<key>dock_menu</key>
<string>id</string>
<key>dock_window_separator</key>
<string>id</string>
<key>enable_auth</key>
<string>id</string>
<key>enable_fullscreen</key>
<string>id</string>
<key>enable_keyequivs</key>
<string>id</string>
<key>enable_tcp</key>
<string>id</string>
<key>fake_buttons</key>
<string>id</string>
<key>prefs_panel</key>
<string>id</string>
<key>sync_keymap</key>
<string>id</string>
<key>toggle_fullscreen_item</key>
<string>id</string>
<key>use_sysbeep</key>
<string>id</string>
<key>window_separator</key>
<string>id</string>
<key>x11_about_item</key>
<string>id</string>
</dict>
<key>SUPERCLASS</key>
<string>NSObject</string>
</dict>
<dict>
<key>CLASS</key>
<string>NSNumberFormatter</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
<string>NSFormatter</string>
</dict>
<dict>
<key>CLASS</key>
<string>NSFormatter</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
<string>NSObject</string>
</dict>
<dict>
<key>ACTIONS</key>
<dict>
<key>alignCenter:</key>
<string>id</string>
<key>alignJustified:</key>
<string>id</string>
<key>alignLeft:</key>
<string>id</string>
<key>alignRight:</key>
<string>id</string>
<key>arrangeInFront:</key>
<string>id</string>
<key>centerSelectionInVisibleArea:</key>
<string>id</string>
<key>changeFont:</key>
<string>id</string>
<key>checkSpelling:</key>
<string>id</string>
<key>clear:</key>
<string>id</string>
<key>clearRecentDocuments:</key>
<string>id</string>
<key>complete:</key>
<string>id</string>
<key>copy:</key>
<string>id</string>
<key>copyFont:</key>
<string>id</string>
<key>copyRuler:</key>
<string>id</string>
<key>cut:</key>
<string>id</string>
<key>delete:</key>
<string>id</string>
<key>deminiaturize:</key>
<string>id</string>
<key>fax:</key>
<string>id</string>
<key>hide:</key>
<string>id</string>
<key>hideOtherApplications:</key>
<string>id</string>
<key>loosenKerning:</key>
<string>id</string>
<key>lowerBaseline:</key>
<string>id</string>
<key>makeKeyAndOrderFront:</key>
<string>id</string>
<key>miniaturize:</key>
<string>id</string>
<key>newDocument:</key>
<string>id</string>
<key>openDocument:</key>
<string>id</string>
<key>orderBack:</key>
<string>id</string>
<key>orderFront:</key>
<string>id</string>
<key>orderFrontColorPanel:</key>
<string>id</string>
<key>orderFrontHelpPanel:</key>
<string>id</string>
<key>orderOut:</key>
<string>id</string>
<key>outline:</key>
<string>id</string>
<key>paste:</key>
<string>id</string>
<key>pasteAsPlainText:</key>
<string>id</string>
<key>pasteAsRichText:</key>
<string>id</string>
<key>pasteFont:</key>
<string>id</string>
<key>pasteRuler:</key>
<string>id</string>
<key>pause:</key>
<string>id</string>
<key>performClose:</key>
<string>id</string>
<key>performFindPanelAction:</key>
<string>id</string>
<key>performMiniaturize:</key>
<string>id</string>
<key>performZoom:</key>
<string>id</string>
<key>play:</key>
<string>id</string>
<key>print:</key>
<string>id</string>
<key>printDocument:</key>
<string>id</string>
<key>raiseBaseline:</key>
<string>id</string>
<key>record:</key>
<string>id</string>
<key>redo:</key>
<string>id</string>
<key>resume:</key>
<string>id</string>
<key>revertDocumentToSaved:</key>
<string>id</string>
<key>run:</key>
<string>id</string>
<key>runPageLayout:</key>
<string>id</string>
<key>runToolbarCustomizationPalette:</key>
<string>id</string>
<key>saveAllDocuments:</key>
<string>id</string>
<key>saveDocument:</key>
<string>id</string>
<key>saveDocumentAs:</key>
<string>id</string>
<key>saveDocumentTo:</key>
<string>id</string>
<key>selectAll:</key>
<string>id</string>
<key>selectText:</key>
<string>id</string>
<key>showGuessPanel:</key>
<string>id</string>
<key>showHelp:</key>
<string>id</string>
<key>start:</key>
<string>id</string>
<key>startSpeaking:</key>
<string>id</string>
<key>stop:</key>
<string>id</string>
<key>stopSpeaking:</key>
<string>id</string>
<key>subscript:</key>
<string>id</string>
<key>superscript:</key>
<string>id</string>
<key>terminate:</key>
<string>id</string>
<key>tightenKerning:</key>
<string>id</string>
<key>toggleContinuousSpellChecking:</key>
<string>id</string>
<key>toggleRuler:</key>
<string>id</string>
<key>toggleToolbarShown:</key>
<string>id</string>
<key>turnOffKerning:</key>
<string>id</string>
<key>turnOffLigatures:</key>
<string>id</string>
<key>underline:</key>
<string>id</string>
<key>undo:</key>
<string>id</string>
<key>unhideAllApplications:</key>
<string>id</string>
<key>unscript:</key>
<string>id</string>
<key>useAllLigatures:</key>
<string>id</string>
<key>useStandardKerning:</key>
<string>id</string>
<key>useStandardLigatures:</key>
<string>id</string>
</dict>
<key>CLASS</key>
<string>FirstResponder</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
<string>NSObject</string>
</dict>
</array>
<key>IBVersion</key>
<integer>1</integer>
</dict>
</plist>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBFramework Version</key>
<string>588</string>
<key>IBOpenObjects</key>
<array>
<integer>244</integer>
<integer>29</integer>
<integer>423</integer>
</array>
<key>IBSystem Version</key>
<string>9A356</string>
<key>targetFramework</key>
<string>IBCocoaFramework</string>
</dict>
</plist>

View File

@ -0,0 +1,318 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBClasses</key>
<array>
<dict>
<key>CLASS</key>
<string>IBLibraryObjectTemplate</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>OUTLETS</key>
<dict>
<key>draggedView</key>
<string>NSView</string>
<key>representedObject</key>
<string>NSObject</string>
</dict>
<key>SUPERCLASS</key>
<string>NSView</string>
</dict>
<dict>
<key>CLASS</key>
<string>IBInspector</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>OUTLETS</key>
<dict>
<key>inspectorView</key>
<string>NSView</string>
</dict>
<key>SUPERCLASS</key>
<string>NSObject</string>
</dict>
<dict>
<key>CLASS</key>
<string>NSDateFormatter</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
<string>NSFormatter</string>
</dict>
<dict>
<key>ACTIONS</key>
<dict>
<key>apps_table_cancel</key>
<string>id</string>
<key>apps_table_delete</key>
<string>id</string>
<key>apps_table_done</key>
<string>id</string>
<key>apps_table_duplicate</key>
<string>id</string>
<key>apps_table_new</key>
<string>id</string>
<key>apps_table_show</key>
<string>id</string>
<key>bring_to_front</key>
<string>id</string>
<key>close_window</key>
<string>id</string>
<key>enable_fullscreen_changed</key>
<string>id</string>
<key>minimize_window</key>
<string>id</string>
<key>next_window</key>
<string>id</string>
<key>prefs_changed</key>
<string>id</string>
<key>prefs_show</key>
<string>id</string>
<key>previous_window</key>
<string>id</string>
<key>toggle_fullscreen</key>
<string>id</string>
<key>x11_help</key>
<string>id</string>
<key>zoom_window</key>
<string>id</string>
</dict>
<key>CLASS</key>
<string>X11Controller</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>OUTLETS</key>
<dict>
<key>apps_separator</key>
<string>id</string>
<key>apps_table</key>
<string>id</string>
<key>depth</key>
<string>id</string>
<key>dock_apps_menu</key>
<string>id</string>
<key>dock_menu</key>
<string>id</string>
<key>dock_window_separator</key>
<string>id</string>
<key>enable_auth</key>
<string>id</string>
<key>enable_fullscreen</key>
<string>id</string>
<key>enable_keyequivs</key>
<string>id</string>
<key>enable_tcp</key>
<string>id</string>
<key>fake_buttons</key>
<string>id</string>
<key>prefs_panel</key>
<string>id</string>
<key>sync_keymap</key>
<string>id</string>
<key>toggle_fullscreen_item</key>
<string>id</string>
<key>use_sysbeep</key>
<string>id</string>
<key>window_separator</key>
<string>id</string>
<key>x11_about_item</key>
<string>id</string>
</dict>
<key>SUPERCLASS</key>
<string>NSObject</string>
</dict>
<dict>
<key>CLASS</key>
<string>NSNumberFormatter</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
<string>NSFormatter</string>
</dict>
<dict>
<key>CLASS</key>
<string>NSFormatter</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
<string>NSObject</string>
</dict>
<dict>
<key>ACTIONS</key>
<dict>
<key>alignCenter:</key>
<string>id</string>
<key>alignJustified:</key>
<string>id</string>
<key>alignLeft:</key>
<string>id</string>
<key>alignRight:</key>
<string>id</string>
<key>arrangeInFront:</key>
<string>id</string>
<key>centerSelectionInVisibleArea:</key>
<string>id</string>
<key>changeFont:</key>
<string>id</string>
<key>checkSpelling:</key>
<string>id</string>
<key>clear:</key>
<string>id</string>
<key>clearRecentDocuments:</key>
<string>id</string>
<key>complete:</key>
<string>id</string>
<key>copy:</key>
<string>id</string>
<key>copyFont:</key>
<string>id</string>
<key>copyRuler:</key>
<string>id</string>
<key>cut:</key>
<string>id</string>
<key>delete:</key>
<string>id</string>
<key>deminiaturize:</key>
<string>id</string>
<key>fax:</key>
<string>id</string>
<key>hide:</key>
<string>id</string>
<key>hideOtherApplications:</key>
<string>id</string>
<key>loosenKerning:</key>
<string>id</string>
<key>lowerBaseline:</key>
<string>id</string>
<key>makeKeyAndOrderFront:</key>
<string>id</string>
<key>miniaturize:</key>
<string>id</string>
<key>newDocument:</key>
<string>id</string>
<key>openDocument:</key>
<string>id</string>
<key>orderBack:</key>
<string>id</string>
<key>orderFront:</key>
<string>id</string>
<key>orderFrontColorPanel:</key>
<string>id</string>
<key>orderFrontHelpPanel:</key>
<string>id</string>
<key>orderOut:</key>
<string>id</string>
<key>outline:</key>
<string>id</string>
<key>paste:</key>
<string>id</string>
<key>pasteAsPlainText:</key>
<string>id</string>
<key>pasteAsRichText:</key>
<string>id</string>
<key>pasteFont:</key>
<string>id</string>
<key>pasteRuler:</key>
<string>id</string>
<key>pause:</key>
<string>id</string>
<key>performClose:</key>
<string>id</string>
<key>performFindPanelAction:</key>
<string>id</string>
<key>performMiniaturize:</key>
<string>id</string>
<key>performZoom:</key>
<string>id</string>
<key>play:</key>
<string>id</string>
<key>print:</key>
<string>id</string>
<key>printDocument:</key>
<string>id</string>
<key>raiseBaseline:</key>
<string>id</string>
<key>record:</key>
<string>id</string>
<key>redo:</key>
<string>id</string>
<key>resume:</key>
<string>id</string>
<key>revertDocumentToSaved:</key>
<string>id</string>
<key>run:</key>
<string>id</string>
<key>runPageLayout:</key>
<string>id</string>
<key>runToolbarCustomizationPalette:</key>
<string>id</string>
<key>saveAllDocuments:</key>
<string>id</string>
<key>saveDocument:</key>
<string>id</string>
<key>saveDocumentAs:</key>
<string>id</string>
<key>saveDocumentTo:</key>
<string>id</string>
<key>selectAll:</key>
<string>id</string>
<key>selectText:</key>
<string>id</string>
<key>showGuessPanel:</key>
<string>id</string>
<key>showHelp:</key>
<string>id</string>
<key>start:</key>
<string>id</string>
<key>startSpeaking:</key>
<string>id</string>
<key>stop:</key>
<string>id</string>
<key>stopSpeaking:</key>
<string>id</string>
<key>subscript:</key>
<string>id</string>
<key>superscript:</key>
<string>id</string>
<key>terminate:</key>
<string>id</string>
<key>tightenKerning:</key>
<string>id</string>
<key>toggleContinuousSpellChecking:</key>
<string>id</string>
<key>toggleRuler:</key>
<string>id</string>
<key>toggleToolbarShown:</key>
<string>id</string>
<key>turnOffKerning:</key>
<string>id</string>
<key>turnOffLigatures:</key>
<string>id</string>
<key>underline:</key>
<string>id</string>
<key>undo:</key>
<string>id</string>
<key>unhideAllApplications:</key>
<string>id</string>
<key>unscript:</key>
<string>id</string>
<key>useAllLigatures:</key>
<string>id</string>
<key>useStandardKerning:</key>
<string>id</string>
<key>useStandardLigatures:</key>
<string>id</string>
</dict>
<key>CLASS</key>
<string>FirstResponder</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
<string>NSObject</string>
</dict>
</array>
<key>IBVersion</key>
<integer>1</integer>
</dict>
</plist>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBFramework Version</key>
<string>588</string>
<key>IBOpenObjects</key>
<array>
<integer>244</integer>
<integer>29</integer>
<integer>423</integer>
</array>
<key>IBSystem Version</key>
<string>9A356</string>
<key>targetFramework</key>
<string>IBCocoaFramework</string>
</dict>
</plist>

Binary file not shown.

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>x11app</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>X11.icns</string>
<key>CFBundleTypeName</key>
<string>X11 Application</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>****</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSIsAppleDefaultForType</key>
<true/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>tool</string>
<string>*</string>
</array>
<key>CFBundleTypeName</key>
<string>UNIX Application</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>****</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>X11</string>
<key>CFBundleGetInfoString</key>
<string>X11</string>
<key>CFBundleIconFile</key>
<string>X11.icns</string>
<key>CFBundleIdentifier</key>
<string>org.x.X11</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>X11</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2003-2007, Apple Inc.
Copyright © 2003, XFree86 Project, Inc.</string>
<key>NSMainNibFile</key>
<string>main</string>
<key>NSPrincipalClass</key>
<string>X11Application</string>
</dict>
</plist>

BIN
hw/darwin/apple/X11.icns Normal file

Binary file not shown.

View File

@ -0,0 +1,329 @@
// !$*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 */; };
/* 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>"; };
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; };
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 = (
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;
mainGroup = 20286C29FDCF999611CA2CEA /* X11 */;
projectDirPath = "";
projectRoot = "";
shouldCheckCompatibility = 1;
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 */,
);
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 */,
);
name = main.nib;
sourceTree = "<group>";
};
0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
0867D6ABFE840B52C02AAC07 /* English */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
527F24090B5D8FFC007840A7 /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
DSTROOT = "$(DSTROOT)";
SKIP_INSTALL = YES;
};
name = Development;
};
527F240A0B5D8FFC007840A7 /* Deployment */ = {
isa = XCBuildConfiguration;
buildSettings = {
DSTROOT = "$(DSTROOT)";
SKIP_INSTALL = YES;
};
name = Deployment;
};
527F240B0B5D8FFC007840A7 /* Default */ = {
isa = XCBuildConfiguration;
buildSettings = {
DSTROOT = "$(DSTROOT)";
SKIP_INSTALL = YES;
};
name = Default;
};
527F24230B5D938C007840A7 /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(NATIVE_ARCH_32_BIT)";
COPY_PHASE_STRIP = NO;
DSTROOT = "$(DSTROOT)";
FRAMEWORK_SEARCH_PATHS = "";
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = /usr/X11/include;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = $DSTROOT/Applications/Utilties;
LIBRARY_SEARCH_PATHS = /usr/X11/lib;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = (
"-lXau",
"-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;
DSTROOT = "$(DSTROOT)";
FRAMEWORK_SEARCH_PATHS = "";
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = /usr/X11/include;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = $DSTROOT/Applications/Utilties;
LIBRARY_SEARCH_PATHS = /usr/X11/lib;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = (
"-lXau",
"-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 = {
DSTROOT = "$(DSTROOT)";
FRAMEWORK_SEARCH_PATHS = "";
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = /usr/X11/include;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = $DSTROOT/Applications/Utilties;
LIBRARY_SEARCH_PATHS = /usr/X11/lib;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = (
"-lXau",
"-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 */;
}

View File

@ -0,0 +1,104 @@
/* X11Application.h -- subclass of NSApplication to multiplex events
$Id: X11Application.h,v 1.26 2003/08/08 19:16:13 jharper Exp $
Copyright (c) 2002-2007 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
(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 X11APPLICATION_H
#define X11APPLICATION_H 1
#if __OBJC__
#import <Cocoa/Cocoa.h>
#import "X11Controller.h"
@interface X11Application : NSApplication {
X11Controller *_controller;
unsigned int _x_active :1;
}
- (void) set_controller:controller;
- (void) set_window_menu:(NSArray *)list;
- (int) prefs_get_integer:(NSString *)key default:(int)def;
- (const char *) prefs_get_string:(NSString *)key default:(const char *)def;
- (float) prefs_get_float:(NSString *)key default:(float)def;
- (int) prefs_get_boolean:(NSString *)key default:(int)def;
- (NSArray *) prefs_get_array:(NSString *)key;
- (void) prefs_set_integer:(NSString *)key value:(int)value;
- (void) prefs_set_float:(NSString *)key value:(float)value;
- (void) prefs_set_boolean:(NSString *)key value:(int)value;
- (void) prefs_set_array:(NSString *)key value:(NSArray *)value;
- (void) prefs_set_string:(NSString *)key value:(NSString *)value;
- (void) prefs_synchronize;
- (BOOL) x_active;
@end
extern X11Application *X11App;
#endif /* __OBJC__ */
extern void X11ApplicationSetWindowMenu (int nitems, const char **items,
const char *shortcuts);
extern void X11ApplicationSetWindowMenuCheck (int idx);
extern void X11ApplicationSetFrontProcess (void);
extern void X11ApplicationSetCanQuit (int state);
extern void X11ApplicationServerReady (void);
extern void X11ApplicationShowHideMenubar (int state);
extern void X11ApplicationMain (int argc, const char *argv[],
void (*server_thread) (void *),
void *server_arg);
extern int X11EnableKeyEquivalents;
extern int quartzHasRoot, quartzEnableRootless;
#define APP_PREFS "com.apple.x11"
#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_SYNC_KEYMAP "sync_keymap"
#define PREFS_DEPTH "depth"
#define PREFS_NO_AUTH "no_auth"
#define PREFS_NO_TCP "nolisten_tcp"
#define PREFS_DONE_XINIT_CHECK "done_xinit_check"
#define PREFS_NO_QUIT_ALERT "no_quit_alert"
#define PREFS_FAKE_BUTTON2 "fake_button2"
#define PREFS_FAKE_BUTTON3 "fake_button3"
#define PREFS_ROOTLESS "rootless"
#define PREFS_FULLSCREEN_HOTKEYS "fullscreen_hotkeys"
#define PREFS_SWAP_ALT_META "swap_alt_meta"
#define PREFS_XP_OPTIONS "xp_options"
#define PREFS_ENABLE_STEREO "enable_stereo"
#endif /* X11APPLICATION_H */

View File

@ -0,0 +1,955 @@
/* X11Application.m -- subclass of NSApplication to multiplex events
Copyright (c) 2002-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 "../quartz/quartzCommon.h"
#import "X11Application.h"
#include <Carbon/Carbon.h>
/* ouch! */
#define BOOL X_BOOL
# include "darwin.h"
# include "../quartz/quartz.h"
# define _APPLEWM_SERVER_
# include "X11/extensions/applewm.h"
# include "micmap.h"
#undef BOOL
#include "xf86Version.h"
#include <mach/mach.h>
#include <unistd.h>
#include <pthread.h>
#define DEFAULTS_FILE "/etc/X11/xserver/Xquartz.plist"
int X11EnableKeyEquivalents = TRUE;
int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
extern int darwinFakeButtons, input_check_flag;
// extern Bool enable_stereo;
Bool enable_stereo; //<-- this needs to go back to being an extern once glxCGL is fixed
static xEvent *quartzEvents;
X11Application *X11App;
#define ALL_KEY_MASKS (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask)
@implementation X11Application
typedef struct message_struct message;
struct message_struct {
mach_msg_header_t hdr;
SEL selector;
NSObject *arg;
};
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. */
extern Bool QuartzModeBundleInit(void);
static void init_ports (void) {
kern_return_t r;
NSPort *p;
if (_port != MACH_PORT_NULL) return;
r = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, &_port);
if (r != KERN_SUCCESS) return;
p = [NSMachPort portWithMachPort:_port];
[p setDelegate:NSApp];
[p scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
}
static void message_kit_thread (SEL selector, NSObject *arg) {
message msg;
kern_return_t r;
msg.hdr.msgh_bits = MACH_MSGH_BITS (MACH_MSG_TYPE_MAKE_SEND, 0);
msg.hdr.msgh_size = sizeof (msg);
msg.hdr.msgh_remote_port = _port;
msg.hdr.msgh_local_port = MACH_PORT_NULL;
msg.hdr.msgh_reserved = 0;
msg.hdr.msgh_id = 0;
msg.selector = selector;
msg.arg = [arg retain];
r = mach_msg (&msg.hdr, MACH_SEND_MSG, msg.hdr.msgh_size,
0, MACH_PORT_NULL, 0, MACH_PORT_NULL);
if (r != KERN_SUCCESS)
ErrorF("%s: mach_msg failed: %x\n", __FUNCTION__, r);
}
- (void) handleMachMessage:(void *)_msg {
message *msg = _msg;
[self performSelector:msg->selector withObject:msg->arg];
[msg->arg release];
}
- (void) set_controller:obj {
if (_controller == nil) _controller = [obj retain];
}
- (void) dealloc {
if (_controller != nil) [_controller release];
if (_port != MACH_PORT_NULL)
mach_port_deallocate (mach_task_self (), _port);
[super dealloc];
}
- (void) orderFrontStandardAboutPanel: (id) sender {
NSMutableDictionary *dict;
NSDictionary *infoDict;
NSString *tem;
dict = [NSMutableDictionary dictionaryWithCapacity:2];
infoDict = [[NSBundle mainBundle] infoDictionary];
[dict setObject: NSLocalizedString (@"The X Window System", @"About panel")
forKey:@"ApplicationName"];
tem = [infoDict objectForKey:@"CFBundleShortVersionString"];
[dict setObject:[NSString stringWithFormat:@"X11.app %@ - X.org X11R7.3", tem]
forKey:@"ApplicationVersion"];
[self orderFrontStandardAboutPanelWithOptions: dict];
}
- (void) activateX:(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) */
static TSMDocumentID x11_document;
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);
}
} else {
QuartzMessageServerThread (kXDarwinDeactivate, 0);
if (_x_active && x11_document != 0)
DeactivateTSMDocument (x11_document);
}
_x_active = state;
}
- (void) became_key:(NSWindow *)win {
[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 a 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];
}
}
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;
case NSFlagsChanged:
/* For the l33t X users who remap modifier keys to normal keysyms. */
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];
#ifdef DARWIN_DDX_MISSING
if ([e data2] & 0x10) QuartzMessageServerThread (kXDarwinBringAllToFront, 0);
#endif
}
break;
case 18: /* ApplicationDidReactivate */
if (quartzHasRoot) for_appkit = NO;
break;
case NSApplicationDeactivatedEventType:
for_x = NO;
[self activateX:NO];
break;
}
break;
default: break; /* for gcc */
}
if (for_appkit) [super sendEvent:e];
if (for_x) send_nsevent (type, e);
}
- (void) set_window_menu:(NSArray *)list {
[_controller set_window_menu:list];
}
- (void) set_window_menu_check:(NSNumber *)n {
[_controller set_window_menu_check:n];
}
- (void) set_apps_menu:(NSArray *)list {
[_controller set_apps_menu:list];
}
- (void) set_front_process:unused {
[NSApp activateIgnoringOtherApps:YES];
if ([self modalWindow] == nil) [self activateX:YES];
}
- (void) set_can_quit:(NSNumber *)state {
[_controller set_can_quit:[state boolValue]];
}
- (void) server_ready:unused {
[_controller server_ready];
}
- (void) show_hide_menubar:(NSNumber *)state {
if ([state boolValue]) ShowMenuBar ();
else HideMenuBar ();
}
/* user preferences */
/* Note that these functions only work for arrays whose elements
can be toll-free-bridged between NS and CF worlds. */
static const void *cfretain (CFAllocatorRef a, const void *b) {
return CFRetain (b);
}
static void cfrelease (CFAllocatorRef a, const void *b) {
CFRelease (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;
}
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;
}
- (CFPropertyListRef) prefs_get:(NSString *)key {
CFPropertyListRef value;
value = CFPreferencesCopyAppValue ((CFStringRef) key, CFSTR (APP_PREFS));
if (value == NULL) {
static CFDictionaryRef defaults;
if (defaults == NULL) {
CFStringRef error = NULL;
CFDataRef data;
CFURLRef url;
SInt32 error_code;
url = (CFURLCreateFromFileSystemRepresentation
(NULL, (unsigned char *)DEFAULTS_FILE, strlen (DEFAULTS_FILE), false));
if (CFURLCreateDataAndPropertiesFromResource (NULL, url, &data,
NULL, NULL, &error_code)) {
defaults = (CFPropertyListCreateFromXMLData
(NULL, data, kCFPropertyListMutableContainersAndLeaves, &error));
if (error != NULL) CFRelease (error);
CFRelease (data);
}
CFRelease (url);
if (defaults != NULL) {
NSMutableArray *apps, *elt;
int count, i;
NSString *name, *nname;
/* Localize the names in the default apps menu. */
apps = [(NSDictionary *)defaults objectForKey:@PREFS_APPSMENU];
if (apps != nil) {
count = [apps count];
for (i = 0; i < count; i++) {
elt = [apps objectAtIndex:i];
if (elt != nil && [elt isKindOfClass:[NSArray class]]) {
name = [elt objectAtIndex:0];
if (name != nil) {
nname = NSLocalizedString (name, nil);
if (nname != nil && nname != name)
[elt replaceObjectAtIndex:0 withObject:nname];
}
}
}
}
}
}
if (defaults != NULL) value = CFDictionaryGetValue (defaults, key);
if (value != NULL) CFRetain (value);
}
return value;
}
- (int) prefs_get_integer:(NSString *)key default:(int)def {
CFPropertyListRef value;
int ret;
value = [self prefs_get:key];
if (value != NULL && CFGetTypeID (value) == CFNumberGetTypeID ())
CFNumberGetValue (value, kCFNumberIntType, &ret);
else if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ())
ret = CFStringGetIntValue (value);
else
ret = def;
if (value != NULL) CFRelease (value);
return ret;
}
- (const char *) prefs_get_string:(NSString *)key default:(const char *)def {
CFPropertyListRef value;
const char *ret = NULL;
value = [self prefs_get:key];
if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ()) {
NSString *s = (NSString *) value;
ret = [s UTF8String];
}
if (value != NULL) CFRelease (value);
return ret != NULL ? ret : def;
}
- (float) prefs_get_float:(NSString *)key default:(float)def {
CFPropertyListRef value;
float ret = def;
value = [self prefs_get:key];
if (value != NULL
&& CFGetTypeID (value) == CFNumberGetTypeID ()
&& CFNumberIsFloatType (value))
CFNumberGetValue (value, kCFNumberFloatType, &ret);
else if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ())
ret = CFStringGetDoubleValue (value);
if (value != NULL) CFRelease (value);
return ret;
}
- (int) prefs_get_boolean:(NSString *)key default:(int)def {
CFPropertyListRef value;
int ret = def;
value = [self prefs_get:key];
if (value != NULL) {
if (CFGetTypeID (value) == CFNumberGetTypeID ())
CFNumberGetValue (value, kCFNumberIntType, &ret);
else if (CFGetTypeID (value) == CFBooleanGetTypeID ())
ret = CFBooleanGetValue (value);
else if (CFGetTypeID (value) == CFStringGetTypeID ()) {
const char *tem = [(NSString *) value lossyCString];
if (strcasecmp (tem, "true") == 0 || strcasecmp (tem, "yes") == 0)
ret = YES;
else
ret = NO;
}
CFRelease (value);
}
return ret;
}
- (NSArray *) prefs_get_array:(NSString *)key {
NSArray *ret = nil;
CFPropertyListRef value;
value = [self prefs_get:key];
if (value != NULL) {
if (CFGetTypeID (value) == CFArrayGetTypeID ())
ret = [cfarray_to_nsarray (value) autorelease];
CFRelease (value);
}
return ret;
}
- (void) prefs_set_integer:(NSString *)key value:(int)value {
CFNumberRef x;
x = CFNumberCreate (NULL, kCFNumberIntType, &value);
CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, CFSTR (APP_PREFS),
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
CFRelease (x);
}
- (void) prefs_set_float:(NSString *)key value:(float)value {
CFNumberRef x;
x = CFNumberCreate (NULL, kCFNumberFloatType, &value);
CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, CFSTR (APP_PREFS),
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
CFRelease (x);
}
- (void) prefs_set_boolean:(NSString *)key value:(int)value {
CFPreferencesSetValue ((CFStringRef) key,
(CFTypeRef) value ? kCFBooleanTrue
: kCFBooleanFalse, CFSTR (APP_PREFS),
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
}
- (void) prefs_set_array:(NSString *)key value:(NSArray *)value {
CFArrayRef cfarray;
cfarray = nsarray_to_cfarray (value);
CFPreferencesSetValue ((CFStringRef) key,
(CFTypeRef) cfarray,
CFSTR (APP_PREFS),
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
CFRelease (cfarray);
}
- (void) prefs_set_string:(NSString *)key value:(NSString *)value {
CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) value,
CFSTR (APP_PREFS), kCFPreferencesCurrentUser,
kCFPreferencesAnyHost);
}
- (void) prefs_synchronize {
CFPreferencesAppSynchronize (kCFPreferencesCurrentApplication);
}
- (void) read_defaults {
const char *tem;
quartzUseSysBeep = [self prefs_get_boolean:@PREFS_SYSBEEP
default:quartzUseSysBeep];
quartzEnableRootless = [self prefs_get_boolean:@PREFS_ROOTLESS
default:quartzEnableRootless];
#ifdef DARWIN_DDX_MISSING
quartzFullscreenDisableHotkeys = ![self prefs_get_boolean:
@PREFS_FULLSCREEN_HOTKEYS default:
!quartzFullscreenDisableHotkeys];
quartzXpluginOptions = [self prefs_get_integer:@PREFS_XP_OPTIONS
default:quartzXpluginOptions];
#endif
darwinSwapAltMeta = [self prefs_get_boolean:@PREFS_SWAP_ALT_META
default:darwinSwapAltMeta];
darwinFakeButtons = [self prefs_get_boolean:@PREFS_FAKEBUTTONS
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);
}
X11EnableKeyEquivalents = [self prefs_get_boolean:@PREFS_KEYEQUIVS
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;
darwinDesiredDepth = [self prefs_get_integer:@PREFS_DEPTH
default:darwinDesiredDepth];
enable_stereo = [self prefs_get_boolean:@PREFS_ENABLE_STEREO
default:false];
}
/* This will end up at the end of the responder chain. */
- (void) copy:sender {
QuartzMessageServerThread (kXDarwinPasteboardNotify, 1,
AppleWMCopyToPasteboard);
}
- (BOOL) x_active {
return _x_active;
}
@end
static NSArray *
array_with_strings_and_numbers (int nitems, const char **items,
const char *numbers) {
NSMutableArray *array, *subarray;
NSString *string, *number;
int i;
/* (Can't autorelease on the X server thread) */
array = [[NSMutableArray alloc] initWithCapacity:nitems];
for (i = 0; i < nitems; i++) {
subarray = [[NSMutableArray alloc] initWithCapacity:2];
string = [[NSString alloc] initWithUTF8String:items[i]];
[subarray addObject:string];
[string release];
if (numbers[i] != 0) {
number = [[NSString alloc] initWithFormat:@"%d", numbers[i]];
[subarray addObject:number];
[number release];
} else
[subarray addObject:@""];
[array addObject:subarray];
[subarray release];
}
return array;
}
void X11ApplicationSetWindowMenu (int nitems, const char **items,
const char *shortcuts) {
NSArray *array;
array = array_with_strings_and_numbers (nitems, items, shortcuts);
/* Send the array of strings over to the appkit thread */
message_kit_thread (@selector (set_window_menu:), array);
[array release];
}
void X11ApplicationSetWindowMenuCheck (int idx) {
NSNumber *n;
n = [[NSNumber alloc] initWithInt:idx];
message_kit_thread (@selector (set_window_menu_check:), n);
[n release];
}
void X11ApplicationSetFrontProcess (void) {
message_kit_thread (@selector (set_front_process:), nil);
}
void X11ApplicationSetCanQuit (int state) {
NSNumber *n;
n = [[NSNumber alloc] initWithBool:state];
message_kit_thread (@selector (set_can_quit:), n);
[n release];
}
void X11ApplicationServerReady (void) {
message_kit_thread (@selector (server_ready:), nil);
}
void X11ApplicationShowHideMenubar (int state) {
NSNumber *n;
n = [[NSNumber alloc] initWithBool:state];
message_kit_thread (@selector (show_hide_menubar:), n);
[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;
if ([X11App prefs_get_boolean:@PREFS_DONE_XINIT_CHECK default:NO])
return;
tem = getenv ("HOME");
if (tem == NULL) goto done;
snprintf (buf, sizeof (buf), "%s/.xinitrc", tem);
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);
for (i = 1; access (buf2, F_OK) == 0; i++)
snprintf (buf2, sizeof (buf2), "%s.old.%d", buf, i);
rename (buf, buf2);
}
done:
[X11App prefs_set_boolean:@PREFS_DONE_XINIT_CHECK value:YES];
[X11App prefs_synchronize];
}
void X11ApplicationMain (int argc, const char *argv[],
void (*server_thread) (void *), void *server_arg) {
NSAutoreleasePool *pool;
#ifdef DEBUG
while (access ("/tmp/x11-block", F_OK) == 0) sleep (1);
#endif
pool = [[NSAutoreleasePool alloc] init];
X11App = (X11Application *) [X11Application sharedApplication];
quartzEvents = (xEvent *)malloc(sizeof(xEvent) * GetMaximumEventsNum());
init_ports ();
[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.
* Initialize all the Quartz functions.
*/
QuartzModeBundleInit();
/* Calculate the height of the menubar so we can avoid it. */
aquaMenuBarHeight = NSHeight([[NSScreen mainScreen] frame]) -
NSMaxY([[NSScreen mainScreen] visibleFrame]) - 1;
if (!create_thread (server_thread, server_arg)) {
ErrorF("can't create secondary thread\n");
exit(1);
}
[NSApp run];
}
/* 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;
}
// 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;
NSRect screen;
NSPoint location;
NSWindow *window;
int pointer_x, pointer_y, ev_button, ev_type;
int num_events=0, i=0, state;
int valuators[2];
float count;
xEvent xe;
char nullbyte=0;
bzero(&xe, sizeof(xe));
input_check_flag++;
/* convert location to global top-left coordinates */
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);
} else {
pointer_x = location.x;
pointer_y = (screen.origin.y + screen.size.height) - location.y;
}
// ErrorF("send_nsevent: type=%d pointer=(%d,%d)\n", type, pointer_x, pointer_y);
valuators[0] = pointer_x;
valuators[1] = pointer_y - aquaMenuBarHeight;
state = convert_flags ([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:
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);
} else if (ev_type==ButtonRelease && (button_state & (1 << ev_button)) == 0) break;
num_events = GetPointerEvents(quartzEvents, darwinPointer, ev_type, ev_button,
POINTER_ABSOLUTE, 0, 2, valuators);
for(i=0; i<num_events; i++)
mieqEnqueue (darwinPointer,&quartzEvents[i]);
break;
case NSScrollWheel:
count = [e deltaY];
ev_button = count > 0.0f ? 4 : 5;
for (count = fabs(count); count > 0.0; count = count - 1.0f) {
num_events = GetPointerEvents(quartzEvents, darwinPointer, ButtonPress, ev_button,
POINTER_ABSOLUTE, 0, 2, valuators);
for(i=0; i<num_events; i++)
mieqEnqueue(darwinPointer,&quartzEvents[i]);
num_events = GetPointerEvents(quartzEvents, darwinPointer, ButtonRelease, ev_button,
POINTER_ABSOLUTE, 0, 2, valuators);
for(i=0; i<num_events; i++)
mieqEnqueue(darwinPointer,&quartzEvents[i]);
}
break;
case NSKeyDown: // do we need to translate these keyCodes?
case NSKeyUp:
num_events = GetKeyboardEvents(quartzEvents, darwinKeyboard,
(type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]);
for(i=0; i<num_events; i++)
mieqEnqueue(darwinKeyboard,&quartzEvents[i]);
break;
case NSFlagsChanged:
xe.u.u.type = kXDarwinUpdateModifiers;
xe.u.clientMessage.u.l.longs0 = [e modifierFlags];
DarwinEQEnqueue (&xe);
break;
default: break; /* for gcc */
}
// <daniels> bushing: oh, i ... er ... christ.
write(darwinEventWriteFD, &nullbyte, 1);
}

View File

@ -0,0 +1,86 @@
/* X11Controller.h -- connect the IB ui
$Id: X11Controller.h,v 1.21 2003/07/24 17:52:29 jharper Exp $
Copyright (c) 2002 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 X11CONTROLLER_H
#define X11CONTROLLER_H 1
#if __OBJC__
#import <Cocoa/Cocoa.h>
#include "../quartz/xpr/x-list.h"
@interface X11Controller : NSObject
{
NSPanel *prefs_panel;
NSButton *fake_buttons;
NSButton *enable_fullscreen;
NSButton *use_sysbeep;
NSButton *enable_keyequivs;
NSButton *sync_keymap;
NSButton *enable_auth;
NSButton *enable_tcp;
NSPopUpButton *depth;
NSMenuItem *x11_about_item;
NSMenuItem *window_separator;
NSMenuItem *dock_window_separator;
NSMenuItem *apps_separator;
NSMenuItem *toggle_fullscreen_item;
NSMenu *dock_apps_menu;
NSTableView *apps_table;
NSArray *apps;
NSMutableArray *table_apps;
NSMenu *dock_menu;
int checked_window_item;
x_list *pending_apps;
BOOL finished_launching;
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) server_ready;
@end
#endif /* __OBJC__ */
extern void X11ControllerMain (int argc, const char *argv[],
void (*server_thread) (void *),
void *server_arg);
#endif /* X11CONTROLLER_H */

View File

@ -0,0 +1,752 @@
/* X11Controller.m -- connect the IB ui, also the NSApp delegate
$Id: X11Controller.m,v 1.40 2006/09/06 21:19:32 jharper Exp $
Copyright (c) 2002-2007 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
(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. */
#define DEFAULT_PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11/bin"
#include "../quartz/quartzCommon.h"
#import "X11Controller.h"
#import "X11Application.h"
#import <Carbon/Carbon.h>
/* ouch! */
#define BOOL X_BOOL
//# include "Xproto.h"
#include "opaque.h"
# include "darwin.h"
# include "../quartz/quartz.h"
# define _APPLEWM_SERVER_
# include "X11/extensions/applewm.h"
# include "../quartz/applewmExt.h"
//# include "X.h"
#undef BOOL
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/wait.h>
#define TRACE() fprintf (stderr, "%s\n", __FUNCTION__)
@implementation X11Controller
- (void) awakeFromNib
{
X11Application *xapp = NSApp;
NSArray *array;
/* Point X11Application at ourself. */
[xapp set_controller:self];
array = [xapp prefs_get_array:@PREFS_APPSMENU];
if (array != nil)
{
int count;
/* convert from [TITLE1 COMMAND1 TITLE2 COMMAND2 ...]
to [[TITLE1 COMMAND1] [TITLE2 COMMAND2] ...] format. */
count = [array count];
if (count > 0
&& ![[array objectAtIndex:0] isKindOfClass:[NSArray class]])
{
int i;
NSMutableArray *copy, *sub;
copy = [NSMutableArray arrayWithCapacity:(count / 2)];
for (i = 0; i < count / 2; i++)
{
sub = [[NSMutableArray alloc] initWithCapacity:3];
[sub addObject:[array objectAtIndex:i*2]];
[sub addObject:[array objectAtIndex:i*2+1]];
[sub addObject:@""];
[copy addObject:sub];
[sub release];
}
array = copy;
}
[self set_apps_menu:array];
}
}
- (void) item_selected:sender
{
[NSApp activateIgnoringOtherApps:YES];
QuartzMessageServerThread (kXDarwinControllerNotify, 2,
AppleWMWindowMenuItem, [sender tag]);
}
- (void) remove_window_menu
{
NSMenu *menu;
int first, count, i;
/* Work backwards so we don't mess up the indices */
menu = [window_separator menu];
first = [menu indexOfItem:window_separator] + 1;
count = [menu numberOfItems];
for (i = count - 1; i >= first; i--)
[menu removeItemAtIndex:i];
menu = [dock_window_separator menu];
count = [menu indexOfItem:dock_window_separator];
for (i = 0; i < count; i++)
[dock_menu removeItemAtIndex:0];
}
- (void) install_window_menu:(NSArray *)list
{
NSMenu *menu;
NSMenuItem *item;
int first, count, i;
menu = [window_separator menu];
first = [menu indexOfItem:window_separator] + 1;
count = [list count];
for (i = 0; i < count; i++)
{
NSString *name, *shortcut;
name = [[list objectAtIndex:i] objectAtIndex:0];
shortcut = [[list objectAtIndex:i] objectAtIndex:1];
item = (NSMenuItem *) [menu addItemWithTitle:name action:@selector
(item_selected:) keyEquivalent:shortcut];
[item setTarget:self];
[item setTag:i];
[item setEnabled:YES];
item = (NSMenuItem *) [dock_menu insertItemWithTitle:name
action:@selector
(item_selected:) keyEquivalent:shortcut
atIndex:i];
[item setTarget:self];
[item setTag:i];
[item setEnabled:YES];
}
if (checked_window_item >= 0 && checked_window_item < count)
{
item = (NSMenuItem *) [menu itemAtIndex:first + checked_window_item];
[item setState:NSOnState];
item = (NSMenuItem *) [dock_menu itemAtIndex:checked_window_item];
[item setState:NSOnState];
}
}
- (void) remove_apps_menu
{
NSMenu *menu;
NSMenuItem *item;
int i;
if (apps == nil || apps_separator == nil) return;
menu = [apps_separator menu];
if (menu != nil)
{
for (i = [menu numberOfItems] - 1; i >= 0; i--)
{
item = (NSMenuItem *) [menu itemAtIndex:i];
if ([item tag] != 0)
[menu removeItemAtIndex:i];
}
}
if (dock_apps_menu != nil)
{
for (i = [dock_apps_menu numberOfItems] - 1; i >= 0; i--)
{
item = (NSMenuItem *) [dock_apps_menu itemAtIndex:i];
if ([item tag] != 0)
[dock_apps_menu removeItemAtIndex:i];
}
}
[apps release];
apps = nil;
}
- (void) prepend_apps_item:(NSArray *)list index:(int)i menu:(NSMenu *)menu
{
NSString *title, *shortcut = @"";
NSArray *group;
NSMenuItem *item;
group = [list objectAtIndex:i];
title = [group objectAtIndex:0];
if ([group count] >= 3)
shortcut = [group objectAtIndex:2];
if ([title length] != 0)
{
item = (NSMenuItem *) [menu insertItemWithTitle:title
action:@selector (app_selected:)
keyEquivalent:shortcut atIndex:0];
[item setTarget:self];
[item setEnabled:YES];
}
else
{
item = (NSMenuItem *) [NSMenuItem separatorItem];
[menu insertItem:item atIndex:0];
}
[item setTag:i+1]; /* can't be zero, so add one */
}
- (void) install_apps_menu:(NSArray *)list
{
NSMenu *menu;
int i, count;
count = [list count];
if (count == 0 || apps_separator == nil) return;
menu = [apps_separator menu];
for (i = count - 1; i >= 0; i--)
{
if (menu != nil)
[self prepend_apps_item:list index:i menu:menu];
if (dock_apps_menu != nil)
[self prepend_apps_item:list index:i menu:dock_apps_menu];
}
apps = [list retain];
}
- (void) set_window_menu:(NSArray *)list
{
[self remove_window_menu];
[self install_window_menu:list];
QuartzMessageServerThread (kXDarwinControllerNotify, 1,
AppleWMWindowMenuNotify);
}
- (void) set_window_menu_check:(NSNumber *)nn
{
NSMenu *menu;
NSMenuItem *item;
int first, count;
int n = [nn intValue];
menu = [window_separator menu];
first = [menu indexOfItem:window_separator] + 1;
count = [menu numberOfItems] - first;
if (checked_window_item >= 0 && checked_window_item < count)
{
item = (NSMenuItem *) [menu itemAtIndex:first + checked_window_item];
[item setState:NSOffState];
item = (NSMenuItem *) [dock_menu itemAtIndex:checked_window_item];
[item setState:NSOffState];
}
if (n >= 0 && n < count)
{
item = (NSMenuItem *) [menu itemAtIndex:first + n];
[item setState:NSOnState];
item = (NSMenuItem *) [dock_menu itemAtIndex:n];
[item setState:NSOnState];
}
checked_window_item = n;
}
- (void) set_apps_menu:(NSArray *)list
{
[self remove_apps_menu];
[self install_apps_menu:list];
}
- (void) launch_client:(NSString *)filename
{
const char *command = [filename UTF8String];
const char *shell;
const char *argv[5];
int child1, child2 = 0;
int status;
shell = getenv("SHELL");
if (shell == NULL) shell = "/bin/bash";
argv[0] = shell;
argv[1] = "-l";
argv[2] = "-c";
argv[3] = command;
argv[4] = NULL;
/* Do the fork-twice trick to avoid having to reap zombies */
child1 = fork();
switch (child1) {
case -1: /* error */
break;
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;
default: /* parent */
waitpid(child1, &status, 0);
}
}
- (void) app_selected:sender
{
int tag;
NSString *item;
tag = [sender tag] - 1;
if (apps == nil || tag < 0 || tag >= [apps count])
return;
item = [[apps objectAtIndex:tag] objectAtIndex:1];
[self launch_client:item];
}
- (IBAction) apps_table_show:sender
{
NSArray *columns;
if (table_apps == nil) {
table_apps = [[NSMutableArray alloc] initWithCapacity:1];
if (apps != nil)[table_apps addObjectsFromArray:apps];
}
columns = [apps_table tableColumns];
[[columns objectAtIndex:0] setIdentifier:@"0"];
[[columns objectAtIndex:1] setIdentifier:@"1"];
[[columns objectAtIndex:2] setIdentifier:@"2"];
[apps_table setDataSource:self];
[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;
}
- (IBAction) apps_table_done:sender
{
[apps_table deselectAll:sender]; /* flush edits? */
[self remove_apps_menu];
[self install_apps_menu:table_apps];
[NSApp prefs_set_array:@PREFS_APPSMENU value:table_apps];
[NSApp prefs_synchronize];
[[apps_table window] orderOut:sender];
[table_apps release];
table_apps = nil;
}
- (IBAction) apps_table_new:sender
{
NSMutableArray *item;
int row = [apps_table selectedRow], i;
if (row < 0) row = 0;
else row = row + 1;
i = row;
if (i > [table_apps count])
return; /* avoid exceptions */
[apps_table deselectAll:sender];
item = [[NSMutableArray alloc] initWithCapacity:3];
[item addObject:@""];
[item addObject:@""];
[item addObject:@""];
[table_apps insertObject:item atIndex:i];
[item release];
[apps_table reloadData];
[apps_table selectRow:row byExtendingSelection:NO];
}
- (IBAction) apps_table_duplicate:sender
{
int row = [apps_table selectedRow], i;
NSObject *item;
if (row < 0) {
[self apps_table_new:sender];
return;
}
i = row;
if (i > [table_apps count] - 1) return; /* avoid exceptions */
[apps_table deselectAll:sender];
item = [[table_apps objectAtIndex:i] mutableCopy];
[table_apps insertObject:item atIndex:i];
[item release];
[apps_table reloadData];
[apps_table selectRow:row+1 byExtendingSelection:NO];
}
- (IBAction) apps_table_delete:sender
{
int row = [apps_table selectedRow];
if (row >= 0)
{
int i = row;
if (i > [table_apps count] - 1) return; /* avoid exceptions */
[apps_table deselectAll:sender];
[table_apps removeObjectAtIndex:i];
}
[apps_table reloadData];
row = MIN (row, [table_apps count] - 1);
if (row >= 0)
[apps_table selectRow:row byExtendingSelection:NO];
}
- (int) numberOfRowsInTableView:(NSTableView *)tableView
{
if (table_apps == nil) return 0;
return [table_apps count];
}
- (id) tableView:(NSTableView *)tableView
objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
{
NSArray *item;
int col;
if (table_apps == nil) return nil;
col = [[tableColumn identifier] intValue];
item = [table_apps objectAtIndex:row];
if ([item count] > col)
return [item objectAtIndex:col];
else
return @"";
}
- (void) tableView:(NSTableView *)tableView setObjectValue:(id)object
forTableColumn:(NSTableColumn *)tableColumn row:(int)row
{
NSMutableArray *item;
int col;
if (table_apps == nil) return;
col = [[tableColumn identifier] intValue];
item = [table_apps objectAtIndex:row];
[item replaceObjectAtIndex:col withObject:object];
}
- (void) hide_window:sender
{
if ([X11App x_active])
QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMHideWindow);
else
NSBeep (); /* FIXME: something here */
}
- (IBAction)bring_to_front:sender
{
QuartzMessageServerThread(kXDarwinControllerNotify, 1, AppleWMBringAllToFront);
}
- (IBAction)close_window:sender
{
if ([X11App x_active])
QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMCloseWindow);
else
[[NSApp keyWindow] performClose:sender];
}
- (IBAction)minimize_window:sender
{
if ([X11App x_active])
QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMMinimizeWindow);
else
[[NSApp keyWindow] performMiniaturize:sender];
}
- (IBAction)zoom_window:sender
{
if ([X11App x_active])
QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMZoomWindow);
else
[[NSApp keyWindow] performZoom:sender];
}
- (IBAction) next_window:sender
{
QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMNextWindow);
}
- (IBAction) previous_window:sender
{
QuartzMessageServerThread (kXDarwinControllerNotify, 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) toggle_fullscreen:sender
{
#ifdef DARWIN_DDX_MISSING
QuartzMessageServerThread (kXDarwinToggleFullscreen, 0);
#endif
}
- (void) set_can_quit:(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_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];
}
- (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];
[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];
[prefs_panel makeKeyAndOrderFront:sender];
}
- (IBAction) quit:sender
{
QuartzMessageServerThread (kXDarwinQuit, 0);
}
- (IBAction) x11_help:sender
{
AHLookupAnchor (CFSTR ("Mac Help"), CFSTR ("mchlp2276"));
}
- (BOOL) validateMenuItem:(NSMenuItem *)item
{
NSMenu *menu = [item menu];
if (item == toggle_fullscreen_item)
return !quartzEnableRootless;
else if (menu == [window_separator menu] || menu == dock_menu
|| (menu == [x11_about_item menu] && [item tag] == 42))
return (AppleWMSelectedEvents () & AppleWMControllerNotifyMask) != 0;
else
return TRUE;
}
- (void) applicationDidHide:(NSNotification *)notify
{
QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMHideAll);
}
- (void) applicationDidUnhide:(NSNotification *)notify
{
QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMShowAll);
}
- (NSApplicationTerminateReply) applicationShouldTerminate:sender
{
NSString *msg;
if (can_quit || [X11App prefs_get_boolean:@PREFS_NO_QUIT_ALERT default:NO])
return NSTerminateNow;
/* Make sure we're frontmost. */
[NSApp activateIgnoringOtherApps:YES];
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");
/* 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;
}
- (void) applicationWillTerminate:(NSNotification *)aNotification
{
[X11App prefs_synchronize];
/* shutdown the X server, it will exit () for us. */
QuartzMessageServerThread (kXDarwinQuit, 0);
/* In case it doesn't, exit anyway after a while. */
while (sleep (10) != 0) ;
exit (1);
}
- (void) server_ready
{
x_list *node;
finished_launching = YES;
for (node = pending_apps; node != NULL; node = node->next)
{
NSString *filename = node->data;
[self launch_client:filename];
[filename release];
}
x_list_free (pending_apps);
pending_apps = NULL;
}
- (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;
}
@end
void X11ControllerMain (int argc, const char *argv[],
void (*server_thread) (void *), void *server_arg)
{
X11ApplicationMain (argc, argv, server_thread, server_arg);
}

158
hw/darwin/apple/Xquartz.man Normal file
View File

@ -0,0 +1,158 @@
.\" $XFree86: xc/programs/Xserver/hw/darwin/XDarwin.man,v 1.4 2002/01/09 18:01:58 torrey Exp $
.\"
.TH XQUARTZ 1 __vendorversion__
.SH NAME
Xquartz \- X window system server for Quartz operating system
.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 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
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 \-nofakebuttons
Do not emulate a 3 button mouse. This is the default.
.TP 8
.B "\-fakemouse2 \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: Shift, Option, Control, Command, Fn. For example,
.B \-fakemouse2 """Option,Shift""
will set holding Option, Shift and clicking on button one as equivalent to
clicking the second mouse button.
.TP 8
.B "\-fakemouse3 \fImodifiers\fP"
Change the modifier keys used to emulate the third mouse button. By default,
Option is used to emulate the third button. Any combination of the following
modifier names may be used: Shift, Option, Control, Command, Fn. For example,
.B \-fakemouse3 """Control,Shift""
will set holding Control, Shift and clicking on button one as equivalent to
clicking the third mouse button.
.TP 8
.B "\-swapAltMeta"
Swaps the meaning of the Alt and Meta modifier keys.
.TP 8
.B "\-keymap \fIfile\fP"
On startup \fIXquartz\fP translates a Darwin keymapping into an X keymap.
The default is to read this keymapping from USA.keymapping. With this option
the keymapping will be read from \fIfile\fP instead. If the file's path is
not specified, it will be searched for in Library/Keyboards/ underneath the
following directories (in order): ~, /, /Network, /System.
.TP 8
.B \-nokeymap
On startup \fIXquartz\fP translates a Darwin keymapping into an X keymap.
With this option \fIXquartz\fP queries the kernel for the current keymapping
instead of reading it from a file. This will often fail on newer kernels.
.TP 8
.B "\-depth \fIdepth\fP"
Specifies the color bit depth to use. Currently only 15, and 24 color
bits per pixel are supported. If not specified, defaults to the depth
of the main display.
.SH CUSTOMIZATION
\fIXquartz\fP can also be customized using the defaults(1) command. The available options are:
.TP 8
.B defaults write com.apple.x11 enable_fake_buttons -boolean true
Equivalent to the \fB-fakebuttons\fP command line option.
.TP 8
.B defaults write com.apple.x11 fake_button2 \fImodifiers\fP
Equivalent to the \fB-fakemouse2\fP option.
.TP 8
.B defaults write com.apple.x11 fake_button3 \fImodifiers\fP
Equivalent to the \fB-fakemouse3\fP option.
.TP 8
.B defaults write com.apple.x11 swap_alt_meta -boolean true
Equivalent to the \fB-swapAltMeta\fP option.
.TP 8
.B defaults write com.apple.x11 keymap_file \fIfilename\fP
Equivalent to the \fB-keymap\fP option.
.TP 8
.B defaults write com.apple.x11 no_quit_alert -boolean true
Disables the alert dialog displayed when attempting to quit X11.
.TP 8
.B defaults write com.apple.x11 no_auth -boolean true
Stops the X server requiring that clients authenticate themselves when
connecting. See Xsecurity(__miscmansuffix__).
.TP 8
.B defaults write com.apple.x11 nolisten_tcp -boolean true
Prevents the X server accepting remote connections.
.TP 8
.B defaults write com.apple.x11 xinit_kills_server -boolean false
Stops the X server exiting when the xinitrc script terminates.
.TP 8
.B defaults write com.apple.x11 fullscreen_hotkeys -boolean false
Allows system hotkeys to be handled while in X11 fullscreen mode.
.TP 8
.B defaults write com.apple.x11 enable_system_beep -boolean false
Don't use the standard system beep effect for X11 alerts.
.TP 8
.B defaults write com.apple.x11 enable_key_equivalents -boolean false
Disable menu keyboard equivalents while X11 windows are focused.
.TP 8
.B defaults write com.apple.x11 depth \fIdepth\fP
Equivalent to the \fB-depth\fP option.
.SH "SEE ALSO"
.PP
X(__miscmansuffix__), XFree86(1), Xserver(1), xdm(1), xinit(1)
.PP
.SH AUTHORS
XFree86 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

View File

@ -0,0 +1,911 @@
/* bundle-main.c -- X server launcher
$Id: bundle-main.c,v 1.17 2003/09/11 00:17:10 jharper Exp $
Copyright (c) 2002-2007 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
(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.
Parts of this file are derived from xdm, which has this copyright:
Copyright 1988, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without fee,
provided that the above copyright notice appear in all copies and
that both that copyright notice and this permission notice appear in
supporting documentation.
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group. */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/utsname.h>
#include <ifaddrs.h>
#include <netdb.h>
#include <netinet/in.h>
#include <time.h>
#include <sys/wait.h>
#include <setjmp.h>
#include <sys/ioctl.h>
#include <X11/Xlib.h>
#include <X11/Xauth.h>
#include <CoreFoundation/CoreFoundation.h>
#include <SystemConfiguration/SystemConfiguration.h>
#define X_SERVER "/usr/X11/bin/Xquartz"
#define XTERM_PATH "/usr/X11/bin/xterm"
#define WM_PATH "/usr/X11/bin/quartz-wm"
#define DEFAULT_XINITRC "/etc/X11/xinit/xinitrc"
#define DEFAULT_PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11/bin"
/* what xinit does */
#ifndef SHELL
# define SHELL "sh"
#endif
#undef FALSE
#define FALSE 0
#undef TRUE
#define TRUE 1
#define MAX_DISPLAYS 64
static int server_pid = -1, client_pid = -1;
static int xinit_kills_server = FALSE;
static jmp_buf exit_continuation;
static const char *server_name = NULL;
static Display *server_dpy;
static char *auth_file;
typedef struct addr_list_struct addr_list;
struct addr_list_struct {
addr_list *next;
Xauth auth;
};
static addr_list *addresses;
/* Utility functions. */
/* Return the current host name. Matches what Xlib does. */
static char *
host_name (void)
{
#ifdef NEED_UTSNAME
static struct utsname name;
uname(&name);
return name.nodename;
#else
static char buf[100];
gethostname(buf, sizeof(buf));
return buf;
#endif
}
static int
read_boolean_pref (CFStringRef name, int default_)
{
int value;
Boolean ok;
value = CFPreferencesGetAppBooleanValue (name,
CFSTR ("com.apple.x11"), &ok);
return ok ? value : default_;
}
static inline int
binary_equal (const void *a, const void *b, int length)
{
return memcmp (a, b, length) == 0;
}
static inline void *
binary_dup (const void *a, int length)
{
void *b = malloc (length);
if (b != NULL)
memcpy (b, a, length);
return b;
}
static inline void
binary_free (void *data, int length)
{
if (data != NULL)
free (data);
}
/* Functions for managing the authentication entries. */
/* Returns true if something matching AUTH is in our list of auth items */
static int
check_auth_item (Xauth *auth)
{
addr_list *a;
for (a = addresses; a != NULL; a = a->next)
{
if (a->auth.family == auth->family
&& a->auth.address_length == auth->address_length
&& binary_equal (a->auth.address, auth->address, auth->address_length)
&& a->auth.number_length == auth->number_length
&& binary_equal (a->auth.number, auth->number, auth->number_length)
&& a->auth.name_length == auth->name_length
&& binary_equal (a->auth.name, auth->name, auth->name_length))
{
return TRUE;
}
}
return FALSE;
}
/* Add one item to our list of auth items. */
static void
add_auth_item (Xauth *auth)
{
addr_list *a = malloc (sizeof (addr_list));
a->auth.family = auth->family;
a->auth.address_length = auth->address_length;
a->auth.address = binary_dup (auth->address, auth->address_length);
a->auth.number_length = auth->number_length;
a->auth.number = binary_dup (auth->number, auth->number_length);
a->auth.name_length = auth->name_length;
a->auth.name = binary_dup (auth->name, auth->name_length);
a->auth.data_length = auth->data_length;
a->auth.data = binary_dup (auth->data, auth->data_length);
a->next = addresses;
addresses = a;
}
/* Free all allocated auth items. */
static void
free_auth_items (void)
{
addr_list *a;
while ((a = addresses) != NULL)
{
addresses = a->next;
binary_free (a->auth.address, a->auth.address_length);
binary_free (a->auth.number, a->auth.number_length);
binary_free (a->auth.name, a->auth.name_length);
binary_free (a->auth.data, a->auth.data_length);
free (a);
}
}
/* Add the unix domain auth item. */
static void
define_local (Xauth *auth)
{
char *host = host_name ();
#ifdef DEBUG
fprintf (stderr, "x11: hostname is %s\n", host);
#endif
auth->family = FamilyLocal;
auth->address_length = strlen (host);
auth->address = host;
add_auth_item (auth);
}
/* Add the tcp auth item. */
static void
define_named (Xauth *auth, const char *name)
{
struct ifaddrs *addrs, *ptr;
if (getifaddrs (&addrs) != 0)
return;
for (ptr = addrs; ptr != NULL; ptr = ptr->ifa_next)
{
if (ptr->ifa_addr->sa_family != AF_INET)
continue;
auth->family = FamilyInternet;
auth->address_length = sizeof (struct in_addr);
auth->address = (char *) &(((struct sockaddr_in *) ptr->ifa_addr)->sin_addr);
#ifdef DEBUG
fprintf (stderr, "x11: ipaddr is %d.%d.%d.%d\n",
(unsigned char) auth->address[0],
(unsigned char) auth->address[1],
(unsigned char) auth->address[2],
(unsigned char) auth->address[3]);
#endif
add_auth_item (auth);
}
freeifaddrs (addrs);
}
/* Parse the display number from NAME and add it to AUTH. */
static void
set_auth_number (Xauth *auth, const char *name)
{
char *colon;
char *dot, *number;
colon = strrchr(name, ':');
if (colon != NULL)
{
colon++;
dot = strchr(colon, '.');
if (dot != NULL)
auth->number_length = dot - colon;
else
auth->number_length = strlen (colon);
number = malloc (auth->number_length + 1);
if (number != NULL)
{
strncpy (number, colon, auth->number_length);
number[auth->number_length] = '\0';
}
else
{
auth->number_length = 0;
}
auth->number = number;
}
}
/* Put 128 bits of random data into DATA. If possible, it will be "high
quality" */
static int
generate_mit_magic_cookie (char data[16])
{
int fd, ret, i;
long *ldata = (long *) data;
fd = open ("/dev/random", O_RDONLY);
if (fd > 0) {
ret = read (fd, data, 16);
close (fd);
if (ret == 16) return TRUE;
}
/* fall back to the usual crappy rng */
srand48 (getpid () ^ time (NULL));
for (i = 0; i < 4; i++)
ldata[i] = lrand48 ();
return TRUE;
}
/* Create the keys we'll be using for the display named NAME. */
static int
make_auth_keys (const char *name)
{
Xauth auth;
char key[16];
if (auth_file == NULL)
return FALSE;
auth.name = "MIT-MAGIC-COOKIE-1";
auth.name_length = strlen (auth.name);
if (!generate_mit_magic_cookie (key))
{
auth_file = NULL;
return FALSE;
}
auth.data = key;
auth.data_length = 16;
set_auth_number (&auth, name);
define_named (&auth, host_name ());
define_local (&auth);
free (auth.number);
return TRUE;
}
/* If ADD-ENTRIES is true, merge our auth entries into the existing
Xauthority file. If ADD-ENTRIES is false, remove our entries. */
static int
write_auth_file (int add_entries)
{
char *home, newname[1024];
int fd, ret;
FILE *new_fh, *old_fh;
addr_list *addr;
Xauth *auth;
if (auth_file == NULL)
return FALSE;
home = getenv ("HOME");
if (home == NULL)
{
auth_file = NULL;
return FALSE;
}
snprintf (newname, sizeof (newname), "%s/.XauthorityXXXXXX", home);
mktemp (newname);
if (XauLockAuth (auth_file, 1, 2, 10) != LOCK_SUCCESS)
{
/* FIXME: do something here? */
auth_file = NULL;
return FALSE;
}
fd = open (newname, O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd >= 0)
{
new_fh = fdopen (fd, "w");
if (new_fh != NULL)
{
if (add_entries)
{
for (addr = addresses; addr != NULL; addr = addr->next)
{
XauWriteAuth (new_fh, &addr->auth);
}
}
old_fh = fopen (auth_file, "r");
if (old_fh != NULL)
{
while ((auth = XauReadAuth (old_fh)) != NULL)
{
if (!check_auth_item (auth))
XauWriteAuth (new_fh, auth);
XauDisposeAuth (auth);
}
fclose (old_fh);
}
fclose (new_fh);
unlink (auth_file);
ret = rename (newname, auth_file);
if (ret != 0)
auth_file = NULL;
XauUnlockAuth (auth_file);
return ret == 0;
}
close (fd);
}
XauUnlockAuth (auth_file);
auth_file = NULL;
return FALSE;
}
/* Subprocess management functions. */
static int
start_server (char **xargv)
{
int child;
child = fork ();
switch (child)
{
case -1: /* error */
perror ("fork");
return FALSE;
case 0: /* child */
execv (X_SERVER, xargv);
perror ("Couldn't exec " X_SERVER);
_exit (1);
default: /* parent */
server_pid = child;
return TRUE;
}
}
static int
wait_for_server (void)
{
int count = 100;
while (count-- > 0)
{
int status;
server_dpy = XOpenDisplay (server_name);
if (server_dpy != NULL)
return TRUE;
if (waitpid (server_pid, &status, WNOHANG) == server_pid)
return FALSE;
sleep (1);
}
return FALSE;
}
static int
start_client (void)
{
int child;
child = fork();
switch (child) {
char *temp, buf[1024];
case -1: /* error */
perror("fork");
return FALSE;
case 0: /* child */
/* Setup environment */
temp = getenv("DISPLAY");
if (temp != NULL && temp[0] != 0)
setenv("DISPLAY", server_name, 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);
}
/* First try value of $XINITRC, if set. */
temp = getenv("XINITRC");
if (temp != NULL && temp[0] != 0 && access(temp, R_OK) == 0)
execlp (SHELL, SHELL, temp, NULL);
/* Then look for .xinitrc in user's home directory. */
temp = getenv("HOME");
if (temp != NULL && temp[0] != 0) {
chdir(temp);
snprintf (buf, sizeof (buf), "%s/.xinitrc", temp);
if (access(buf, R_OK) == 0)
execlp(SHELL, SHELL, buf, NULL);
}
/* Then try the default xinitrc in the lib directory. */
if (access(DEFAULT_XINITRC, R_OK) == 0)
execlp(SHELL, SHELL, DEFAULT_XINITRC, NULL);
/* Then fallback to hardcoding an xterm and the window manager. */
// system(XTERM_PATH " &");
execl(WM_PATH, WM_PATH, NULL);
perror("exec");
_exit(1);
default: /* parent */
client_pid = child;
return TRUE;
}
}
static void
sigchld_handler (int sig)
{
int pid, status;
again:
pid = waitpid (WAIT_ANY, &status, WNOHANG);
if (pid > 0)
{
if (pid == server_pid)
{
server_pid = -1;
if (client_pid >= 0)
kill (client_pid, SIGTERM);
}
else if (pid == client_pid)
{
client_pid = -1;
if (server_pid >= 0 && xinit_kills_server)
kill (server_pid, SIGTERM);
}
goto again;
}
if (server_pid == -1 && client_pid == -1)
longjmp (exit_continuation, 1);
signal (SIGCHLD, sigchld_handler);
}
/* Server utilities. */
static Boolean
display_exists_p (int number)
{
char buf[64];
void *conn;
char *fullname = NULL;
int idisplay, iscreen;
char *conn_auth_name, *conn_auth_data;
int conn_auth_namelen, conn_auth_datalen;
extern void *_X11TransConnectDisplay ();
extern void _XDisconnectDisplay ();
/* Since connecting to the display waits for a few seconds if the
display doesn't exist, check for trivial non-existence - if the
socket in /tmp exists or not.. (note: if the socket exists, the
server may still not, so we need to try to connect in that case..) */
sprintf (buf, "/tmp/.X11-unix/X%d", number);
if (access (buf, F_OK) != 0)
return FALSE;
/* This is a private function that we shouldn't really be calling,
but it's the best way to see if the server exists (without
needing to hold the necessary authentication to use it) */
sprintf (buf, ":%d", number);
conn = _X11TransConnectDisplay (buf, &fullname, &idisplay, &iscreen,
&conn_auth_name, &conn_auth_namelen,
&conn_auth_data, &conn_auth_datalen);
if (conn == NULL)
return FALSE;
_XDisconnectDisplay (conn);
return TRUE;
}
/* Monitoring when the system's ip addresses change. */
static Boolean pending_timer;
static void
timer_callback (CFRunLoopTimerRef timer, void *info)
{
pending_timer = FALSE;
/* Update authentication names. Need to write .Xauthority file first
without the existing entries, then again with the new entries.. */
write_auth_file (FALSE);
free_auth_items ();
make_auth_keys (server_name);
write_auth_file (TRUE);
}
/* This function is called when the system's ip addresses may have changed. */
static void
ipaddr_callback (SCDynamicStoreRef store, CFArrayRef changed_keys, void *info)
{
#if DEBUG
if (changed_keys != NULL) {
fprintf (stderr, "x11: changed sc keys: ");
CFShow (changed_keys);
}
#endif
if (auth_file != NULL && !pending_timer)
{
CFRunLoopTimerRef timer;
timer = CFRunLoopTimerCreate (NULL, CFAbsoluteTimeGetCurrent () + 1.0,
0.0, 0, 0, timer_callback, NULL);
CFRunLoopAddTimer (CFRunLoopGetCurrent (), timer,
kCFRunLoopDefaultMode);
CFRelease (timer);
pending_timer = TRUE;
}
}
/* This code adapted from "Living in a Dynamic TCP/IP Environment" technote. */
static Boolean
install_ipaddr_source (void)
{
CFRunLoopSourceRef source = NULL;
SCDynamicStoreContext context = {0};
SCDynamicStoreRef ref;
ref = SCDynamicStoreCreate (NULL,
CFSTR ("AddIPAddressListChangeCallbackSCF"),
ipaddr_callback, &context);
if (ref != NULL)
{
const void *keys[4], *patterns[2];
int i;
keys[0] = SCDynamicStoreKeyCreateNetworkGlobalEntity (NULL, kSCDynamicStoreDomainState, kSCEntNetIPv4);
keys[1] = SCDynamicStoreKeyCreateNetworkGlobalEntity (NULL, kSCDynamicStoreDomainState, kSCEntNetIPv6);
keys[2] = SCDynamicStoreKeyCreateComputerName (NULL);
keys[3] = SCDynamicStoreKeyCreateHostNames (NULL);
patterns[0] = SCDynamicStoreKeyCreateNetworkInterfaceEntity (NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv4);
patterns[1] = SCDynamicStoreKeyCreateNetworkInterfaceEntity (NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv6);
if (keys[0] != NULL && keys[1] != NULL && keys[2] != NULL
&& keys[3] != NULL && patterns[0] != NULL && patterns[1] != NULL)
{
CFArrayRef key_array, pattern_array;
key_array = CFArrayCreate (NULL, keys, 4, &kCFTypeArrayCallBacks);
pattern_array = CFArrayCreate (NULL, patterns, 2, &kCFTypeArrayCallBacks);
if (key_array != NULL || pattern_array != NULL)
{
SCDynamicStoreSetNotificationKeys (ref, key_array, pattern_array);
source = SCDynamicStoreCreateRunLoopSource (NULL, ref, 0);
}
if (key_array != NULL)
CFRelease (key_array);
if (pattern_array != NULL)
CFRelease (pattern_array);
}
for (i = 0; i < 4; i++)
if (keys[i] != NULL)
CFRelease (keys[i]);
for (i = 0; i < 2; i++)
if (patterns[i] != NULL)
CFRelease (patterns[i]);
CFRelease (ref);
}
if (source != NULL)
{
CFRunLoopAddSource (CFRunLoopGetCurrent (),
source, kCFRunLoopDefaultMode);
CFRelease (source);
}
return source != NULL;
}
/* Entrypoint. */
void
termination_signal_handler (int unused_sig)
{
signal (SIGTERM, SIG_DFL);
signal (SIGHUP, SIG_DFL);
signal (SIGINT, SIG_DFL);
signal (SIGQUIT, SIG_DFL);
longjmp (exit_continuation, 1);
}
int
main (int argc, char **argv)
{
char **xargv;
int i, j;
int fd;
xargv = alloca (sizeof (char *) * (argc + 32));
if (!read_boolean_pref (CFSTR ("no_auth"), FALSE))
auth_file = XauFileName ();
/* The standard X11 behaviour is for the server to quit when the first
client exits. But it can be useful for debugging (and to mimic our
behaviour in the beta releases) to not do that. */
xinit_kills_server = read_boolean_pref (CFSTR ("xinit_kills_server"), TRUE);
for (i = 1; i < argc; i++)
{
if (argv[i][0] == ':')
server_name = argv[i];
}
if (server_name == NULL)
{
static char name[8];
/* No display number specified, so search for the first unused.
There's a big old race condition here if two servers start at
the same time, but that's fairly unlikely. We could create
lockfiles or something, but that's seems more likely to cause
problems than the race condition itself.. */
for (i = 0; i < MAX_DISPLAYS; i++)
{
if (!display_exists_p (i))
break;
}
if (i == MAX_DISPLAYS)
{
fprintf (stderr, "%s: couldn't allocate a display number", argv[0]);
exit (1);
}
sprintf (name, ":%d", i);
server_name = name;
}
if (auth_file != NULL)
{
/* Create new Xauth keys and add them to the .Xauthority file */
make_auth_keys (server_name);
write_auth_file (TRUE);
}
/* Construct our new argv */
i = j = 0;
xargv[i++] = argv[j++];
if (auth_file != NULL)
{
xargv[i++] = "-auth";
xargv[i++] = auth_file;
}
/* By default, don't listen on tcp sockets if Xauth is disabled. */
if (read_boolean_pref (CFSTR ("nolisten_tcp"), auth_file == NULL))
{
xargv[i++] = "-nolisten";
xargv[i++] = "tcp";
}
while (j < argc)
{
if (argv[j++][0] != ':')
xargv[i++] = argv[j-1];
}
xargv[i++] = (char *) server_name;
xargv[i++] = NULL;
/* Detach from any controlling terminal and connect stdin to /dev/null */
#ifdef TIOCNOTTY
fd = open ("/dev/tty", O_RDONLY);
if (fd != -1)
{
ioctl (fd, TIOCNOTTY, 0);
close (fd);
}
#endif
fd = open ("/dev/null", O_RDWR, 0);
if (fd >= 0)
{
dup2 (fd, 0);
if (fd > 0)
close (fd);
}
if (!start_server (xargv))
return 1;
if (!wait_for_server ())
{
kill (server_pid, SIGTERM);
return 1;
}
if (!start_client ())
{
kill (server_pid, SIGTERM);
return 1;
}
signal (SIGCHLD, sigchld_handler);
signal (SIGTERM, termination_signal_handler);
signal (SIGHUP, termination_signal_handler);
signal (SIGINT, termination_signal_handler);
signal (SIGQUIT, termination_signal_handler);
if (setjmp (exit_continuation) == 0)
{
if (install_ipaddr_source ())
CFRunLoopRun ();
else
while (1) pause ();
}
signal (SIGCHLD, SIG_IGN);
if (client_pid >= 0) kill (client_pid, SIGTERM);
if (server_pid >= 0) kill (server_pid, SIGTERM);
if (auth_file != NULL)
{
/* Remove our Xauth keys */
write_auth_file (FALSE);
}
free_auth_items ();
return 0;
}

View File

@ -0,0 +1,35 @@
BINDIR = ${bindir}
include $(top_srcdir)/cpprules.in
XINITDIR = $(libdir)/X11/xinit
XDEFS = \
-DX_VERSION="$(PLIST_VERSION_STRING)" \
-DX_PRE_RELEASE="$(PRE)" \
-DX_REL_DATE="$(XORG_DATE)" \
-DX_VENDOR_NAME="$(VENDOR_STRING)" \
-DX_VENDOR_LINK="$(PLIST_VENDOR_WEB)"
resourcesdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app/Contents/Resources
Dutchlprojdir = $(resourcesdir)/Dutch.lproj
Dutchlproj_DATA = \
XDarwinHelp.html \
InfoPlist.strings \
Credits.rtf Localizable.strings
Dutchlprojnibdir = $(Dutchlprojdir)/MainMenu.nib
Dutchlprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib
InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp
$(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@
XDarwinHelp.html: XDarwinHelp.html.cpp
$(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@
CLEANFILES = XDarwinHelp.html InfoPlist.strings
EXTRA_DIST = \
Credits.rtf Localizable.strings \
MainMenu.nib/classes.nib \
MainMenu.nib/objects.nib \
XDarwinHelp.html.cpp

View File

@ -0,0 +1,35 @@
BINDIR = ${bindir}
include $(top_srcdir)/cpprules.in
XINITDIR = $(libdir)/X11/xinit
XDEFS = \
-DX_VERSION="$(PLIST_VERSION_STRING)" \
-DX_PRE_RELEASE="$(PRE)" \
-DX_REL_DATE="$(XORG_DATE)" \
-DX_VENDOR_NAME="$(VENDOR_STRING)" \
-DX_VENDOR_LINK="$(PLIST_VENDOR_WEB)"
resourcesdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app/Contents/Resources
Englishlprojdir = $(resourcesdir)/English.lproj
Englishlproj_DATA = \
XDarwinHelp.html \
InfoPlist.strings \
Credits.rtf Localizable.strings
Englishlprojnibdir = $(Englishlprojdir)/MainMenu.nib
Englishlprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib
InfoPlist.strings: InfoPlist.strings.cpp
$(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@
XDarwinHelp.html: XDarwinHelp.html.cpp
$(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@
CLEANFILES = XDarwinHelp.html InfoPlist.strings
EXTRA_DIST = \
Credits.rtf Localizable.strings \
MainMenu.nib/classes.nib \
MainMenu.nib/objects.nib \
XDarwinHelp.html.cpp \
InfoPlist.strings.cpp

View File

@ -0,0 +1,38 @@
BINDIR = ${bindir}
include $(top_srcdir)/cpprules.in
XINITDIR = $(libdir)/X11/xinit
XDEFS = \
-DX_VERSION="$(PLIST_VERSION_STRING)" \
-DX_PRE_RELEASE="$(PRE)" \
-DX_REL_DATE="$(XORG_DATE)" \
-DX_VENDOR_NAME="$(VENDOR_STRING)" \
-DX_VENDOR_LINK="$(PLIST_VENDOR_WEB)"
resourcesdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app/Contents/Resources
Frenchlprojdir = $(resourcesdir)/French.lproj
Frenchlproj_DATA = \
XDarwinHelp.html \
InfoPlist.strings \
Credits.rtf Localizable.strings
Frenchlprojnibdir = $(Frenchlprojdir)/MainMenu.nib
Frenchlprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib
InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp
$(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@
XDarwinHelp.html: XDarwinHelp.html.cpp
$(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@
CLEANFILES = XDarwinHelp.html InfoPlist.strings
EXTRA_DIST = \
Credits.rtf Localizable.strings \
Localizable.strings \
MainMenu.nib/classes.nib \
MainMenu.nib/objects.nib \
XDarwinHelp.html.cpp

View File

@ -0,0 +1,36 @@
BINDIR = ${bindir}
include $(top_srcdir)/cpprules.in
XINITDIR = $(libdir)/X11/xinit
XDEFS = \
-DX_VERSION="$(PLIST_VERSION_STRING)" \
-DX_PRE_RELEASE="$(PRE)" \
-DX_REL_DATE="$(XORG_DATE)" \
-DX_VENDOR_NAME="$(VENDOR_STRING)" \
-DX_VENDOR_LINK="$(PLIST_VENDOR_WEB)"
resourcesdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app/Contents/Resources
Germanlprojdir = $(resourcesdir)/German.lproj
Germanlproj_DATA = \
XDarwinHelp.html \
InfoPlist.strings \
Credits.rtf Localizable.strings
Germanlprojnibdir = $(Germanlprojdir)/MainMenu.nib
Germanlprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib
InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp
$(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@
XDarwinHelp.html: XDarwinHelp.html.cpp
$(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@
CLEANFILES = XDarwinHelp.html InfoPlist.strings
EXTRA_DIST = \
Credits.rtf Localizable.strings \
Localizable.strings \
MainMenu.nib/classes.nib \
MainMenu.nib/objects.nib \
XDarwinHelp.html.cpp

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>x11app</string>
</array>
<key>CFBundleTypeName</key>
<string>X11 Application</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>****</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>tool</string>
<string>*</string>
</array>
<key>CFBundleTypeName</key>
<string>UNIX Application</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>****</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>XDarwin</string>
<key>CFBundleGetInfoString</key>
<string>XDarwin 1.4.0, X.Org Foundation</string>
<key>CFBundleIconFile</key>
<string>XDarwin.icns</string>
<key>CFBundleIdentifier</key>
<string>org.x.XDarwin</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>XDarwin</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>XDarwin 1.4.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string></string>
<key>NSHelpFile</key>
<string>XDarwinHelp.html</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>XApplication</string>
</dict>
</plist>

View File

@ -0,0 +1,37 @@
BINDIR = ${bindir}
include $(top_srcdir)/cpprules.in
XINITDIR = $(libdir)/X11/xinit
XDEFS = \
-DX_VERSION="$(PLIST_VERSION_STRING)" \
-DX_PRE_RELEASE="$(PRE)" \
-DX_REL_DATE="$(XORG_DATE)" \
-DX_VENDOR_NAME="$(VENDOR_STRING)" \
-DX_VENDOR_LINK="$(PLIST_VENDOR_WEB)"
resourcesdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app/Contents/Resources
Japaneselprojdir = $(resourcesdir)/Japanese.lproj
Japaneselproj_DATA = \
XDarwinHelp.html \
InfoPlist.strings \
Credits.rtf Localizable.strings
Japaneselprojnibdir = $(Japaneselprojdir)/MainMenu.nib
Japaneselprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib
InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp
$(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@
XDarwinHelp.html: XDarwinHelp.html.cpp
$(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@
CLEANFILES = XDarwinHelp.html InfoPlist.strings
EXTRA_DIST = \
Credits.rtf Localizable.strings \
Localizable.strings \
MainMenu.nib/classes.nib \
MainMenu.nib/objects.nib \
XDarwinHelp.html.cpp

View File

@ -0,0 +1,38 @@
BINDIR = ${bindir}
include $(top_srcdir)/cpprules.in
XINITDIR = $(libdir)/X11/xinit
XDEFS = \
-DX_VERSION="$(PLIST_VERSION_STRING)" \
-DX_PRE_RELEASE="$(PRE)" \
-DX_REL_DATE="$(XORG_DATE)" \
-DX_VENDOR_NAME="$(VENDOR_STRING)" \
-DX_VENDOR_LINK="$(PLIST_VENDOR_WEB)"
SUBDIRS = English.lproj Dutch.lproj French.lproj German.lproj Japanese.lproj \
ko.lproj Portuguese.lproj Spanish.lproj Swedish.lproj
bin_SCRIPTS = startXClients
startXClients: $(srcdir)/startXClients.cpp
$(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) -DXINITDIR=$(XINITDIR) -DXBINDIR=$(BINDIR) $< | $(CPP_SED_MAGIC) > $@
-chmod 755 startXClients
contentsdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app/Contents
resourcesdir = $(contentsdir)/Resources
contents_DATA = Info.plist
resources_DATA = XDarwin.icns startXClients
install-data-hook:
chmod 755 $(DESTDIR)$(resourcesdir)/startXClients
echo "APPL????" > $(DESTDIR)$(contentsdir)/PkgInfo
touch $(DESTDIR)@APPLE_APPLICATIONS_DIR@/XDarwin.app
uninstall-hook:
rm -rf $(DESTDIR)$(contentsdir)/PkgInfo
CLEANFILES = startXClients
EXTRA_DIST = \
XDarwin.icns \
Info.plist

View File

@ -0,0 +1,36 @@
BINDIR = ${bindir}
include $(top_srcdir)/cpprules.in
XINITDIR = $(libdir)/X11/xinit
XDEFS = \
-DX_VERSION="$(PLIST_VERSION_STRING)" \
-DX_PRE_RELEASE="$(PRE)" \
-DX_REL_DATE="$(XORG_DATE)" \
-DX_VENDOR_NAME="$(VENDOR_STRING)" \
-DX_VENDOR_LINK="$(PLIST_VENDOR_WEB)"
resourcesdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app/Contents/Resources
Portugueselprojdir = $(resourcesdir)/Portuguese.lproj
Portugueselproj_DATA = \
XDarwinHelp.html \
InfoPlist.strings \
Credits.rtf Localizable.strings
Portugueselprojnibdir = $(Portugueselprojdir)/MainMenu.nib
Portugueselprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib
InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp
$(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@
XDarwinHelp.html: XDarwinHelp.html.cpp
$(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@
CLEANFILES = XDarwinHelp.html InfoPlist.strings
EXTRA_DIST = \
Credits.rtf Localizable.strings \
Localizable.strings \
MainMenu.nib/classes.nib \
MainMenu.nib/objects.nib \
XDarwinHelp.html.cpp

View File

@ -0,0 +1,36 @@
BINDIR = ${bindir}
include $(top_srcdir)/cpprules.in
XINITDIR = $(libdir)/X11/xinit
XDEFS = \
-DX_VERSION="$(PLIST_VERSION_STRING)" \
-DX_PRE_RELEASE="$(PRE)" \
-DX_REL_DATE="$(XORG_DATE)" \
-DX_VENDOR_NAME="$(VENDOR_STRING)" \
-DX_VENDOR_LINK="$(PLIST_VENDOR_WEB)"
resourcesdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app/Contents/Resources
Spanishlprojdir = $(resourcesdir)/Spanish.lproj
Spanishlproj_DATA = \
XDarwinHelp.html \
InfoPlist.strings \
Credits.rtf Localizable.strings
Spanishlprojnibdir = $(Spanishlprojdir)/MainMenu.nib
Spanishlprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib
InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp
$(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@
XDarwinHelp.html: XDarwinHelp.html.cpp
$(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@
CLEANFILES = XDarwinHelp.html InfoPlist.strings
EXTRA_DIST = \
Credits.rtf Localizable.strings \
Localizable.strings \
MainMenu.nib/classes.nib \
MainMenu.nib/objects.nib \
XDarwinHelp.html.cpp

View File

@ -0,0 +1,36 @@
BINDIR = ${bindir}
include $(top_srcdir)/cpprules.in
XINITDIR = $(libdir)/X11/xinit
XDEFS = \
-DX_VERSION="$(PLIST_VERSION_STRING)" \
-DX_PRE_RELEASE="$(PRE)" \
-DX_REL_DATE="$(XORG_DATE)" \
-DX_VENDOR_NAME="$(VENDOR_STRING)" \
-DX_VENDOR_LINK="$(PLIST_VENDOR_WEB)"
resourcesdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app/Contents/Resources
Swedishlprojdir = $(resourcesdir)/Swedish.lproj
Swedishlproj_DATA = \
XDarwinHelp.html \
InfoPlist.strings \
Credits.rtf Localizable.strings
Swedishlprojnibdir = $(Swedishlprojdir)/MainMenu.nib
Swedishlprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib
InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp
$(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@
XDarwinHelp.html: XDarwinHelp.html.cpp
$(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@
CLEANFILES = XDarwinHelp.html InfoPlist.strings
EXTRA_DIST = \
Credits.rtf Localizable.strings \
Localizable.strings \
MainMenu.nib/classes.nib \
MainMenu.nib/objects.nib \
XDarwinHelp.html.cpp

View File

@ -0,0 +1,37 @@
BINDIR = ${bindir}
include $(top_srcdir)/cpprules.in
XINITDIR = $(libdir)/X11/xinit
XDEFS = \
-DX_VERSION="$(PLIST_VERSION_STRING)" \
-DX_PRE_RELEASE="$(PRE)" \
-DX_REL_DATE="$(XORG_DATE)" \
-DX_VENDOR_NAME="$(VENDOR_STRING)" \
-DX_VENDOR_LINK="$(PLIST_VENDOR_WEB)"
resourcesdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app/Contents/Resources
kolprojdir = $(resourcesdir)/ko.lproj
kolproj_DATA = \
XDarwinHelp.html \
InfoPlist.strings \
Credits.rtf Localizable.strings
kolprojnibdir = $(kolprojdir)/MainMenu.nib
kolprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib
InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp
$(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@
XDarwinHelp.html: XDarwinHelp.html.cpp
$(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@
CLEANFILES = XDarwinHelp.html InfoPlist.strings
EXTRA_DIST = \
Credits.rtf Localizable.strings \
Localizable.strings \
MainMenu.nib/classes.nib \
MainMenu.nib/objects.nib \
XDarwinHelp.html.cpp

View File

@ -30,6 +30,10 @@
* use or other dealings in this Software without prior written authorization.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include "os.h"
@ -200,6 +204,12 @@ DarwinPrintBanner()
}
void DDXRingBell(int volume, int pitch, int duration)
{
// FIXME -- make some noise, yo
}
/*
* DarwinSaveScreen
* X screensaver support. Not implemented.
@ -409,9 +419,9 @@ static int DarwinMouseProc(
InitPointerDeviceStruct( (DevicePtr)pPointer,
map,
5, // numbuttons (4 & 5 are scroll wheel)
miPointerGetMotionEvents,
GetMotionHistory,
DarwinChangePointerControl,
0 );
GetMotionHistorySize(), 2 );
#ifdef XINPUT
InitValuatorAxisStruct( pPointer,
0, // X axis

View File

@ -31,6 +31,7 @@
#include "inputstr.h"
#include "scrnintstr.h"
#include <X11/extensions/XKB.h>
#include <assert.h>
typedef struct {
void *framebuffer;

View File

@ -1,9 +1,9 @@
/*
* Darwin event queue and event handling
*/
/*
Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved.
Darwin event queue and event handling
Copyright 2007 Apple Inc.
Copyright 2004 Kaleb S. KEITHLEY. All Rights Reserved.
Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved.
This file is based on mieq.c by Keith Packard,
which contains the following copyright:
@ -61,6 +61,8 @@ typedef struct _Event {
ScreenPtr pScreen;
} EventRec, *EventPtr;
int input_check_zero, input_check_flag;
typedef struct _EventQueue {
HWEventQueueType head, tail; /* long for SetInputCheck */
CARD32 lastEventTime; /* to avoid time running backwards */
@ -73,7 +75,6 @@ typedef struct _EventQueue {
static EventQueueRec darwinEventQueue;
/*
* DarwinPressModifierMask
* Press or release the given modifier key, specified by its mask.
@ -177,18 +178,15 @@ static void DarwinSimulateMouseClick(
}
Bool
DarwinEQInit(
DevicePtr pKbd,
DevicePtr pPtr)
{
Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
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 (&darwinEventQueue.head, &darwinEventQueue.tail);
SetInputCheck(&input_check_zero, &input_check_flag);
return TRUE;
}
@ -199,11 +197,10 @@ DarwinEQInit(
* 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
*/
void
DarwinEQEnqueue(
const xEvent *e)
{
void DarwinEQEnqueue(const xEvent *e) {
HWEventQueueType oldtail, newtail;
char byte = 0;
@ -213,13 +210,12 @@ DarwinEQEnqueue(
// This is difficult to do in a thread-safe way and rarely useful.
newtail = oldtail + 1;
if (newtail == QUEUE_SIZE)
newtail = 0;
if (newtail == QUEUE_SIZE) newtail = 0;
/* Toss events which come in late */
if (newtail == darwinEventQueue.head)
return;
if (newtail == darwinEventQueue.head) return;
darwinEventQueue.events[oldtail].event = *e;
/*
* Make sure that event times don't go backwards - this
* is "unnecessary", but very useful
@ -244,20 +240,13 @@ DarwinEQEnqueue(
* DarwinEQPointerPost
* Post a pointer event. Used by the mipointer.c routines.
*/
void
DarwinEQPointerPost(
xEvent *e)
{
void DarwinEQPointerPost(xEvent *e) {
(*darwinEventQueue.pPtr->processInputProc)
(e, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
}
void
DarwinEQSwitchScreen(
ScreenPtr pScreen,
Bool fromDIX)
{
void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX) {
darwinEventQueue.pEnqueueScreen = pScreen;
if (fromDIX)
darwinEventQueue.pDequeueScreen = pScreen;
@ -268,8 +257,7 @@ DarwinEQSwitchScreen(
* ProcessInputEvents
* Read and process events from the event queue until it is empty.
*/
void ProcessInputEvents(void)
{
void ProcessInputEvents(void) {
EventRec *e;
int x, y;
xEvent xe;
@ -277,12 +265,15 @@ void ProcessInputEvents(void)
// button number and modifier mask of currently pressed fake button
static int darwinFakeMouseButtonDown = 0;
static int darwinFakeMouseButtonMask = 0;
input_check_flag=0;
ErrorF("calling mieqProcessInputEvents\n");
mieqProcessInputEvents();
// Empty the signaling pipe
x = sizeof(xe);
while (x == sizeof(xe)) {
while (x == sizeof(xe))
x = read(darwinEventReadFD, &xe, sizeof(xe));
}
while (darwinEventQueue.head != darwinEventQueue.tail)
{
@ -298,10 +289,16 @@ void ProcessInputEvents(void)
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
/*
* Assumption - screen switching can only occur on motion events
*/
if (e->pScreen != darwinEventQueue.pDequeueScreen)
{
darwinEventQueue.pDequeueScreen = e->pScreen;

View File

@ -72,7 +72,7 @@
#include <architecture/byte_order.h> // For the NXSwap*
#include "darwin.h"
#include "darwinKeyboard.h"
#include <assert.h>
#define AltMask Mod1Mask
#define MetaMask Mod2Mask
#define FunctionMask Mod3Mask

View File

@ -29,7 +29,7 @@
#define XK_TECHNICAL // needed to get XK_Escape
#define XK_PUBLISHING
#include "keysym.h"
#include "X11/keysym.h"
#include "inputstr.h"
// Each key can generate 4 glyphs. They are, in order:

View File

@ -0,0 +1,17 @@
noinst_LIBRARIES = libiokit.a
AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@
INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. @XORG_INCS@
AM_DEFS =
if XQUARTZ
AM_DEFS += -DDARWIN_WITH_QUARTZ -DXFree86Server
XQUARTZ_SUBDIRS = bundle quartz
endif
DEFS = @DEFS@ $(AM_DEFS)
libiokit_a_SOURCES = xfIOKit.c \
xfIOKitCursor.c \
xfIOKitStartup.c
EXTRA_DIST = \
xfIOKit.h

View File

@ -34,6 +34,10 @@
* use or other dealings in this Software without prior written authorization.
*/
#if HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include "os.h"
@ -51,6 +55,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <pthread.h>
#include <assert.h>
#include <mach/mach_interface.h>

View File

@ -58,6 +58,9 @@
* use or other dealings in this Software without prior written authorization.
*/
#if HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "scrnintstr.h"
#include "cursorstr.h"
#include "mipointrst.h"
@ -67,7 +70,7 @@
#include <IOKit/hidsystem/IOHIDLib.h>
#include "darwin.h"
#include "xfIOKit.h"
#include <assert.h>
#define DUMP_DARWIN_CURSOR FALSE
#define CURSOR_PRIV(pScreen) \

View File

@ -29,6 +29,11 @@
* use or other dealings in this Software without prior written authorization.
*/
#if HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "darwin.h"
#include "darwinKeyboard.h"
#include "micmap.h"
@ -57,7 +62,9 @@ void DarwinHandleGUI(
*/
void DarwinGlxExtensionInit(void)
{
GlxExtensionInit();
#ifdef GLXEXT
GlxExtensionInit();
#endif
}
@ -67,7 +74,9 @@ void DarwinGlxExtensionInit(void)
void DarwinGlxWrapInitVisuals(
miInitVisualsProcPtr *procPtr)
{
#ifdef GLXEXT
GlxWrapInitVisuals(procPtr);
#endif
}

View File

@ -0,0 +1,54 @@
noinst_LIBRARIES = libXQuartz.a
AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@
AM_OBJCFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@
INCLUDES = -I$(srcdir) -I$(srcdir)/.. @XORG_INCS@
AM_DEFS = -DHAS_CG_MACH_PORT -DHAS_KL_API
if HAVE_X_PLUGIN
AM_DEFS += -DBUILD_XPR
endif
DEFS = @DEFS@ $(AM_DEFS) -DXBINDIR=\"${bindir}\"
libXQuartz_a_SOURCES = \
Preferences.m \
XApplication.m \
XServer.m \
applewm.c \
keysym2ucs.c \
quartz.c \
quartzAudio.c \
quartzCocoa.m \
quartzPasteboard.c \
quartzKeyboard.c \
quartzStartup.c \
pseudoramiX.c
bin_PROGRAMS = XDarwinStartup
XDarwinStartup_SOURCES = XDarwinStartup.c
XDarwinStartup_LDFLAGS = -Wl,-framework,CoreFoundation \
-Wl,-framework,ApplicationServices
XDarwinStartupCFLAGS = -DXBINDIR="${bindir}"
XDARWINROOT = @APPLE_APPLICATIONS_DIR@
BINDIR = $(bindir)
install-exec-local:
-(cd $(DESTDIR)$(BINDIR); rm X; $(LN_S) XDarwinStartup X)
man1_MANS = XDarwinStartup.man
EXTRA_DIST = \
applewmExt.h \
keysym2ucs.h \
Preferences.h \
pseudoramiX.h \
quartzAudio.h \
quartzCommon.h \
quartzCursor.c \
quartzCursor.h \
quartz.h \
quartzPasteboard.h \
XApplication.h \
XDarwin.pbproj/project.pbxproj \
XServer.h \
XDarwinStartup.man

View File

@ -31,7 +31,9 @@
* authorization.
*/
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/Preferences.m,v 1.5 2004/06/08 22:58:10 torrey Exp $ */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#import "quartzCommon.h"
#define BOOL xBOOL
@ -44,7 +46,7 @@
// Macros to build the path name
#ifndef XBINDIR
#define XBINDIR /usr/X11R6/bin
#define XBINDIR /usr/X11/bin
#endif
#define STR(s) #s
#define XSTRPATH(s) STR(s)

View File

@ -387,7 +387,7 @@
<key>CFBundleIconFile</key>
<string>XDarwin.icns</string>
<key>CFBundleIdentifier</key>
<string>org.xfree86.XDarwin</string>
<string>org.x.x11</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>

View File

@ -48,7 +48,7 @@
// Macros to build the path name
#ifndef XBINDIR
#define XBINDIR /usr/X11R6/bin
#define XBINDIR /usr/X11/bin
#endif
#define STR(s) #s
#define XSTRPATH(s) STR(s) "/"
@ -124,7 +124,7 @@ int main(
// Otherwise query LaunchServices for the location of the XDarwin application
theStatus = LSFindApplicationForInfo(kLSUnknownCreator,
CFSTR("org.xfree86.XDarwin"),
CFSTR("org.x.x11"),
NULL, NULL, &appURL);
if (theStatus) {
fprintf(stderr, "Could not find the XDarwin application. (Error = 0x%lx)\n", theStatus);

View File

@ -36,18 +36,20 @@
*/
/* $XdotOrg: xc/programs/Xserver/hw/darwin/quartz/XServer.m,v 1.3 2004/07/30 19:12:17 torrey Exp $ */
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/XServer.m,v 1.19 2003/11/24 05:39:01 torrey Exp $ */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "quartzCommon.h"
#define BOOL xBOOL
#include "X.h"
#include "Xproto.h"
#include "X11/X.h"
#include "X11/Xproto.h"
#include "os.h"
#include "opaque.h"
#include "darwin.h"
#include "quartz.h"
#define _APPLEWM_SERVER_
#include "applewm.h"
#include "X11/extensions/applewm.h"
#include "applewmExt.h"
#undef BOOL
@ -830,13 +832,13 @@ static io_connect_t root_port;
chdir(tem);
/* Setup environment */
snprintf(buf, sizeof(buf), ":%s", display);
setenv("DISPLAY", buf, TRUE);
// snprintf(buf, sizeof(buf), ":%s", display);
// setenv("DISPLAY", buf, TRUE);
tem = getenv("PATH");
if (tem != NULL && tem[0] != NULL)
snprintf(buf, sizeof(buf), "%s:/usr/X11R6/bin", tem);
snprintf(buf, sizeof(buf), "%s:/usr/X11/bin", tem);
else
snprintf(buf, sizeof(buf), "/bin:/usr/bin:/usr/X11R6/bin");
snprintf(buf, sizeof(buf), "/bin:/usr/bin:/usr/X11/bin");
setenv("PATH", buf, TRUE);
execvp(argv[0], (char **const) argv);

View File

@ -24,7 +24,9 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "quartzCommon.h"
#define NEED_REPLIES
@ -43,7 +45,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <X11/Xatom.h>
#include "darwin.h"
#define _APPLEWM_SERVER_
#include "applewmstr.h"
#include "X11/extensions/applewmstr.h"
#include "applewmExt.h"
#define DEFINE_ATOM_HELPER(func,atom_name) \
@ -444,7 +446,11 @@ ProcAppleWMSetWindowMenu(
}
}
#ifdef INXQUARTZ
X11ApplicationSetWindowMenu (nitems, items, shortcuts);
#else
QuartzSetWindowMenu (nitems, items, shortcuts);
#endif
free(items);
free(shortcuts);
@ -460,10 +466,12 @@ ProcAppleWMSetWindowMenuCheck(
REQUEST(xAppleWMSetWindowMenuCheckReq);
REQUEST_SIZE_MATCH(xAppleWMSetWindowMenuCheckReq);
#ifdef INXQUARTZ
X11ApplicationSetWindowMenuCheck(stuff->index);
#else
QuartzMessageMainThread(kQuartzSetWindowMenuCheck, &stuff->index,
sizeof(stuff->index));
#endif
return (client->noClientException);
}
@ -473,9 +481,11 @@ ProcAppleWMSetFrontProcess(
)
{
REQUEST_SIZE_MATCH(xAppleWMSetFrontProcessReq);
#ifdef INXQUARTZ
X11ApplicationSetFrontProcess();
#else
QuartzMessageMainThread(kQuartzSetFrontProcess, NULL, 0);
#endif
return (client->noClientException);
}
@ -514,9 +524,12 @@ ProcAppleWMSetCanQuit(
REQUEST(xAppleWMSetCanQuitReq);
REQUEST_SIZE_MATCH(xAppleWMSetCanQuitReq);
#ifdef INXQUARTZ
X11ApplicationSetCanQuit(stuff->state);
#else
QuartzMessageMainThread(kQuartzSetCanQuit, &stuff->state,
sizeof(stuff->state));
#endif
return (client->noClientException);
}

View File

@ -30,7 +30,9 @@
* use or other dealings in this Software without prior written authorization.
*/
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/cr/XView.m,v 1.1 2003/06/07 05:49:07 torrey Exp $ */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#import "XView.h"

View File

@ -27,17 +27,19 @@
* use or other dealings in this Software without prior written authorization.
*/
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/xpr/xprFrame.c,v 1.2 2003/06/30 01:45:13 torrey Exp $ */
#include "quartzCommon.h"
#include "cr.h"
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "quartz/quartzCommon.h"
#include "quartz/cr/cr.h"
#undef BOOL
#define BOOL xBOOL
#include "rootless.h"
#include "X.h"
#include "X11/X.h"
#define _APPLEWM_SERVER_
#include "applewm.h"
#include "applewmExt.h"
#include "X11/extensions/applewm.h"
#include "quartz/applewmExt.h"
#undef BOOL
#define StdDocumentStyleMask (NSTitledWindowMask | \

View File

@ -29,14 +29,16 @@
*/
/* $XdotOrg: xc/programs/Xserver/hw/darwin/quartz/cr/crFrame.m,v 1.2 2004/04/23 19:15:51 eich Exp $ */
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/cr/crFrame.m,v 1.9 2004/03/19 02:05:29 torrey Exp $ */
#include "quartzCommon.h"
#include "cr.h"
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "quartz/quartzCommon.h"
#include "quartz/cr/cr.h"
#undef BOOL
#define BOOL xBOOL
#include "rootless.h"
#include "applewmExt.h"
#include "quartz/applewmExt.h"
#include "windowstr.h"
#undef BOOL

View File

@ -29,19 +29,21 @@
* use or other dealings in this Software without prior written authorization.
*/
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/cr/crScreen.m,v 1.5 2003/11/12 20:21:52 torrey Exp $ */
#include "quartzCommon.h"
#include "cr.h"
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "quartz/quartzCommon.h"
#include "quartz/cr/cr.h"
#undef BOOL
#define BOOL xBOOL
#include "darwin.h"
#include "quartz.h"
#include "quartzCursor.h"
#include "quartz/quartz.h"
#include "quartz/quartzCursor.h"
#include "rootless.h"
#include "safeAlpha.h"
#include "pseudoramiX.h"
#include "applewmExt.h"
#include "safeAlpha/safeAlpha.h"
#include "quartz/pseudoramiX.h"
#include "quartz/applewmExt.h"
#include "regionstr.h"
#include "scrnintstr.h"

View File

@ -25,11 +25,13 @@
* 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 "quartzCommon.h"
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "quartz/quartzCommon.h"
#include "darwin.h"
#include "quartz.h"
#include "quartzCursor.h"
#include "quartz/quartz.h"
#include "quartz/quartzCursor.h"
#include "colormapst.h"
#include "scrnintstr.h"
#include "micmap.h"

View File

@ -29,9 +29,11 @@
* 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 "quartzCommon.h"
#include "quartzCursor.h"
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "quartz/quartzCommon.h"
#include "quartz/quartzCursor.h"
#include "darwin.h"
#include <pthread.h>

View File

@ -34,7 +34,9 @@ Equipment Corporation.
******************************************************************/
#include "pseudoramiX.h"
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "extnsionst.h"
#include "dixstruct.h"
#include "window.h"

View File

@ -29,14 +29,16 @@
* 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "quartzCommon.h"
#include "quartz.h"
#include "darwin.h"
#include "quartzAudio.h"
#include "pseudoramiX.h"
#define _APPLEWM_SERVER_
#include "applewm.h"
#include "X11/extensions/applewm.h"
#include "applewmExt.h"
// X headers
@ -158,7 +160,11 @@ void DarwinModeInitInput(
int argc,
char **argv )
{
#ifdef INXQUARTZ
X11ApplicationServerReady();
#else
QuartzMessageMainThread(kQuartzServerStarted, NULL, 0);
#endif
// Do final display mode specific initialization before handling events
if (quartzProcs->InitInput)
@ -272,7 +278,9 @@ static void QuartzHide(void)
}
}
quartzServerVisible = FALSE;
#ifndef INXQUARTZ
QuartzMessageMainThread(kQuartzServerHidden, NULL, 0);
#endif
}

View File

@ -35,7 +35,9 @@
* 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "quartzCommon.h"
#include "quartzAudio.h"
@ -44,6 +46,7 @@
#include "inputstr.h"
#include <X11/extensions/XI.h>
#include <assert.h>
void NSBeep();

View File

@ -35,6 +35,9 @@
* use or other dealings in this Software without prior written authorization.
*/
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/quartzCocoa.m,v 1.5 2004/06/08 22:58:10 torrey Exp $ */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "quartzCommon.h"

View File

@ -30,6 +30,9 @@
* use or other dealings in this Software without prior written authorization.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "quartzCommon.h"
#include "quartzCursor.h"
#include "darwin.h"
@ -90,7 +93,9 @@ static pthread_cond_t cursorCondition;
/* Acquire lock and tell the main thread to change cursor */ \
pthread_mutex_lock(&cursorMutex); \
currentCursor = (CCrsrHandle) (cursorH); \
#ifndef INXQUARTZ
QuartzMessageMainThread(kQuartzCursorUpdate, NULL, 0); \
#endif
\
/* Wait for the main thread to change the cursor */ \
pthread_cond_wait(&cursorCondition, &cursorMutex); \

View File

@ -36,6 +36,7 @@
#include "screenint.h"
Bool QuartzInitCursor(ScreenPtr pScreen);
void QuartzReallySetCursor(void);
void QuartzSuspendXCursor(ScreenPtr pScreen);
void QuartzResumeXCursor(ScreenPtr pScreen, int x, int y);

View File

@ -33,13 +33,16 @@
prior written authorization.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "quartzCommon.h"
#include <CoreServices/CoreServices.h>
#include <Carbon/Carbon.h>
#include "darwinKeyboard.h"
#include "keysym.h"
#include "X11/keysym.h"
#include "keysym2ucs.h"
#ifdef HAS_KL_API

View File

@ -30,6 +30,9 @@
* use or other dealings in this Software without prior written authorization.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "quartzPasteboard.h"
#include <X11/Xatom.h>

View File

@ -37,21 +37,37 @@
#include "quartz.h"
#include "opaque.h"
#include "micmap.h"
int NSApplicationMain(int argc, char *argv[]);
#include <assert.h>
char **envpGlobal; // argcGlobal and argvGlobal
// are from dix/globals.c
#ifdef INXQUARTZ
void X11ControllerMain(int argc, char *argv[], void (*server_thread) (void *), void *server_arg);
# ifdef GLXEXT
void GlxExtensionInit(void);
void GlxWrapInitVisuals(miInitVisualsProcPtr *);
# endif
static void server_thread (void *arg) {
extern int main (int argc, char **argv, char **envp);
exit (main (argcGlobal, argvGlobal, envpGlobal));
}
#else
int NSApplicationMain(int argc, char *argv[]);
typedef Bool (*QuartzModeBundleInitPtr)(void);
# ifdef GLXEXT
// GLX bundle function pointers
typedef void (*GlxExtensionInitPtr)(void);
static GlxExtensionInitPtr GlxExtensionInit = NULL;
typedef void (*GlxWrapInitVisualsPtr)(miInitVisualsProcPtr *);
static GlxWrapInitVisualsPtr GlxWrapInitVisuals = NULL;
typedef Bool (*QuartzModeBundleInitPtr)(void);
void * __DarwinglXMesaProvider = NULL;
typedef void (*GlxPushProviderPtr)(void *);
GlxPushProviderPtr GlxPushProvider = NULL;
# endif
#endif
/*
* DarwinHandleGUI
@ -71,7 +87,9 @@ void DarwinHandleGUI(
int fd[2];
if (been_here) {
#ifdef INXDARWINAPP
QuartzReadPreferences();
#endif
return;
}
been_here = TRUE;
@ -106,11 +124,27 @@ void DarwinHandleGUI(
}
}
#ifdef INXQUARTZ
/* 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. */
extern void _InitHLTB(void);
_InitHLTB();
X11ControllerMain(argc, argv, server_thread, NULL);
#else
main_exit = NSApplicationMain(argc, argv);
#endif
exit(main_exit);
}
#ifndef INXQUARTZ
/*
* QuartzLoadDisplayBundle
* Try to load the appropriate bundle containing the back end display code.
@ -168,7 +202,7 @@ Bool QuartzLoadDisplayBundle(
return TRUE;
}
#ifdef GLXEXT
/*
* LoadGlxBundle
* The Quartz mode X server needs to dynamically load the appropriate
@ -186,7 +220,7 @@ static void LoadGlxBundle(void)
// Choose the bundle to load
ErrorF("Loading GLX bundle ");
if (quartzUseAGL) {
if (/*quartzUseAGL*/0) {
bundleName = CFStringCreateWithCStringNoCopy(kCFAllocatorDefault,
quartzOpenGLBundle,
kCFStringEncodingASCII,
@ -213,6 +247,14 @@ static void LoadGlxBundle(void)
}
// Find the GLX init functions
__DarwinglXMesaProvider = (void *) CFBundleGetDataPointerForName(
glxBundle, CFSTR("__glXMesaProvider"));
GlxPushProvider = (void *) CFBundleGetFunctionPointerForName(
glxBundle, CFSTR("GlxPushProvider"));
GlxExtensionInit = (void *) CFBundleGetFunctionPointerForName(
glxBundle, CFSTR("GlxExtensionInit"));
@ -227,7 +269,26 @@ static void LoadGlxBundle(void)
CFRelease(bundleName);
CFRelease(bundleURL);
}
# endif
#else
Bool QuartzLoadDisplayBundle(const char *dpyBundleName)
{
return TRUE;
}
#endif
#ifdef GLXEXT
void DarwinGlxPushProvider(void *impl)
{
#ifndef INXQUARTZ
if (!GlxExtensionInit)
LoadGlxBundle();
#endif
GlxPushProvider(impl);
}
/*
* DarwinGlxExtensionInit
@ -235,9 +296,10 @@ static void LoadGlxBundle(void)
*/
void DarwinGlxExtensionInit(void)
{
#ifndef INXQUARTZ
if (!GlxExtensionInit)
LoadGlxBundle();
#endif
GlxExtensionInit();
}
@ -248,12 +310,13 @@ void DarwinGlxExtensionInit(void)
void DarwinGlxWrapInitVisuals(
miInitVisualsProcPtr *procPtr)
{
#ifndef INXQUARTZ
if (!GlxWrapInitVisuals)
LoadGlxBundle();
#endif
GlxWrapInitVisuals(procPtr);
}
#endif
int DarwinModeProcessArgument( int argc, char *argv[], int i )
{

View File

@ -35,6 +35,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#define NEED_REPLIES
#define NEED_EVENTS
#include <X11/X.h>

View File

@ -0,0 +1,107 @@
/* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.7 2000/12/07 20:26:02 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
Copyright 2000 VA Linux Systems, Inc.
Copyright (c) 2002 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, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
**************************************************************************/
/*
* Authors:
* Kevin E. Martin <martin@valinux.com>
* Jens Owen <jens@valinux.com>
* Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
#ifndef _APPLEDRI_H_
#define _APPLEDRI_H_
#include <X11/Xfuncproto.h>
#define X_AppleDRIQueryVersion 0
#define X_AppleDRIQueryDirectRenderingCapable 1
#define X_AppleDRICreateSurface 2
#define X_AppleDRIDestroySurface 3
#define X_AppleDRIAuthConnection 4
/* Requests up to and including 18 were used in a previous version */
/* Events */
#define AppleDRIObsoleteEvent1 0
#define AppleDRIObsoleteEvent2 1
#define AppleDRIObsoleteEvent3 2
#define AppleDRISurfaceNotify 3
#define AppleDRINumberEvents 4
/* Errors */
#define AppleDRIClientNotLocal 0
#define AppleDRIOperationNotSupported 1
#define AppleDRINumberErrors (AppleDRIOperationNotSupported + 1)
/* Kinds of SurfaceNotify events: */
#define AppleDRISurfaceNotifyChanged 0
#define AppleDRISurfaceNotifyDestroyed 1
#ifndef _APPLEDRI_SERVER_
typedef struct {
int type; /* of event */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came frome a SendEvent request */
Display *display; /* Display the event was read from */
Window window; /* window of event */
Time time; /* server timestamp when event happened */
int kind; /* subtype of event */
int arg;
} XAppleDRINotifyEvent;
_XFUNCPROTOBEGIN
Bool XAppleDRIQueryExtension (Display *dpy, int *event_base, int *error_base);
Bool XAppleDRIQueryVersion (Display *dpy, int *majorVersion,
int *minorVersion, int *patchVersion);
Bool XAppleDRIQueryDirectRenderingCapable (Display *dpy, int screen,
Bool *isCapable);
void *XAppleDRISetSurfaceNotifyHandler (void (*fun) (Display *dpy,
unsigned uid, int kind));
Bool XAppleDRIAuthConnection (Display *dpy, int screen, unsigned int magic);
Bool XAppleDRICreateSurface (Display *dpy, int screen, Drawable drawable,
unsigned int client_id, unsigned int key[2],
unsigned int* uid);
Bool XAppleDRIDestroySurface (Display *dpy, int screen, Drawable drawable);
Bool XAppleDRISynchronizeSurfaces (Display *dpy);
_XFUNCPROTOEND
#endif /* _APPLEDRI_SERVER_ */
#endif /* _APPLEDRI_H_ */

View File

@ -0,0 +1,176 @@
/* $XFree86: xc/lib/GL/dri/xf86dristr.h,v 1.9 2001/03/21 16:01:08 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
Copyright 2000 VA Linux Systems, Inc.
Copyright (c) 2002 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, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
**************************************************************************/
/*
* Authors:
* Kevin E. Martin <martin@valinux.com>
* Jens Owen <jens@valinux.com>
* Rickard E. (Rik) Fiath <faith@valinux.com>
*
*/
#ifndef _APPLEDRISTR_H_
#define _APPLEDRISTR_H_
#include "appledri.h"
#define APPLEDRINAME "Apple-DRI"
#define APPLE_DRI_MAJOR_VERSION 1 /* current version numbers */
#define APPLE_DRI_MINOR_VERSION 0
#define APPLE_DRI_PATCH_VERSION 0
typedef struct _AppleDRIQueryVersion {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIQueryVersion */
CARD16 length B16;
} xAppleDRIQueryVersionReq;
#define sz_xAppleDRIQueryVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD16 majorVersion B16; /* major version of DRI protocol */
CARD16 minorVersion B16; /* minor version of DRI protocol */
CARD32 patchVersion B32; /* patch version of DRI protocol */
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xAppleDRIQueryVersionReply;
#define sz_xAppleDRIQueryVersionReply 32
typedef struct _AppleDRIQueryDirectRenderingCapable {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */
CARD16 length B16;
CARD32 screen B32;
} xAppleDRIQueryDirectRenderingCapableReq;
#define sz_xAppleDRIQueryDirectRenderingCapableReq 8
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
BOOL isCapable;
BOOL pad2;
BOOL pad3;
BOOL pad4;
CARD32 pad5 B32;
CARD32 pad6 B32;
CARD32 pad7 B32;
CARD32 pad8 B32;
CARD32 pad9 B32;
} xAppleDRIQueryDirectRenderingCapableReply;
#define sz_xAppleDRIQueryDirectRenderingCapableReply 32
typedef struct _AppleDRIAuthConnection {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRICloseConnection */
CARD16 length B16;
CARD32 screen B32;
CARD32 magic B32;
} xAppleDRIAuthConnectionReq;
#define sz_xAppleDRIAuthConnectionReq 12
typedef struct {
BYTE type;
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 authenticated B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xAppleDRIAuthConnectionReply;
#define zx_xAppleDRIAuthConnectionReply 32
typedef struct _AppleDRICreateSurface {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRICreateSurface */
CARD16 length B16;
CARD32 screen B32;
CARD32 drawable B32;
CARD32 client_id B32;
} xAppleDRICreateSurfaceReq;
#define sz_xAppleDRICreateSurfaceReq 16
typedef struct {
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 key_0 B32;
CARD32 key_1 B32;
CARD32 uid B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xAppleDRICreateSurfaceReply;
#define sz_xAppleDRICreateSurfaceReply 32
typedef struct _AppleDRIDestroySurface {
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIDestroySurface */
CARD16 length B16;
CARD32 screen B32;
CARD32 drawable B32;
} xAppleDRIDestroySurfaceReq;
#define sz_xAppleDRIDestroySurfaceReq 12
typedef struct _AppleDRINotify {
BYTE type; /* always eventBase + event type */
BYTE kind;
CARD16 sequenceNumber B16;
Time time B32; /* time of change */
CARD16 pad1 B16;
CARD32 arg B32;
CARD32 pad3 B32;
} xAppleDRINotifyEvent;
#define sz_xAppleDRINotifyEvent 20
#ifdef _APPLEDRI_SERVER_
void AppleDRISendEvent (
#if NeedFunctionPrototypes
int /* type */,
unsigned int /* mask */,
int /* which */,
int /* arg */
#endif
);
#endif /* _APPLEDRI_SERVER_ */
#endif /* _APPLEDRISTR_H_ */

View File

@ -33,6 +33,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <sys/time.h>
#include <unistd.h>

Some files were not shown because too many files have changed in this diff Show More