From 315f089056da67d4c463ed002eb2b74e38493b49 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Thu, 8 May 2008 19:46:03 -0700 Subject: XQuartz: Reorganized some of the build system in prep for the Mach IPC startup work. (cherry picked from commit 2232c91d5c277673929eab2abb5e0495c00877cb) --- configure.ac | 3 +- hw/xquartz/Makefile.am | 3 +- hw/xquartz/bundle/Makefile.am | 1 - hw/xquartz/bundle/bundle-main.c | 143 ------------------------------- hw/xquartz/doc/Makefile.am | 14 +++ hw/xquartz/doc/Xquartz.man.pre | 156 ++++++++++++++++++++++++++++++++++ hw/xquartz/mach-startup/Makefile.am | 34 ++++++++ hw/xquartz/mach-startup/bundle-main.c | 143 +++++++++++++++++++++++++++++++ hw/xquartz/mach-startup/stub.c | 96 +++++++++++++++++++++ hw/xquartz/stub/Makefile.am | 11 --- hw/xquartz/stub/stub.c | 96 --------------------- hw/xquartz/xpr/Makefile.am | 34 +------- hw/xquartz/xpr/Xquartz.man.pre | 156 ---------------------------------- 13 files changed, 448 insertions(+), 442 deletions(-) delete mode 100644 hw/xquartz/bundle/bundle-main.c create mode 100644 hw/xquartz/doc/Makefile.am create mode 100644 hw/xquartz/doc/Xquartz.man.pre create mode 100644 hw/xquartz/mach-startup/Makefile.am create mode 100644 hw/xquartz/mach-startup/bundle-main.c create mode 100644 hw/xquartz/mach-startup/stub.c delete mode 100644 hw/xquartz/stub/Makefile.am delete mode 100644 hw/xquartz/stub/stub.c delete mode 100644 hw/xquartz/xpr/Xquartz.man.pre diff --git a/configure.ac b/configure.ac index 9671adaa9..99b10e36d 100644 --- a/configure.ac +++ b/configure.ac @@ -2164,7 +2164,8 @@ hw/xwin/Makefile hw/xquartz/Makefile hw/xquartz/GL/Makefile hw/xquartz/bundle/Makefile -hw/xquartz/stub/Makefile +hw/xquartz/doc/Makefile +hw/xquartz/mach-startup/Makefile hw/xquartz/xpr/Makefile hw/kdrive/Makefile hw/kdrive/ati/Makefile diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am index bbd21f816..77d662f97 100644 --- a/hw/xquartz/Makefile.am +++ b/hw/xquartz/Makefile.am @@ -9,12 +9,11 @@ AM_CPPFLAGS = \ -DXFree86Server \ -I$(top_srcdir)/miext/rootless -SUBDIRS = bundle . GL xpr stub +SUBDIRS = bundle . GL xpr mach-startup doc libXquartz_la_SOURCES = \ $(top_srcdir)/fb/fbcmap_mi.c \ $(top_srcdir)/mi/miinitext.c \ - bundle/bundle-main.c \ X11Application.m \ X11Controller.m \ applewm.c \ diff --git a/hw/xquartz/bundle/Makefile.am b/hw/xquartz/bundle/Makefile.am index c61b0490c..a8f45f8d5 100644 --- a/hw/xquartz/bundle/Makefile.am +++ b/hw/xquartz/bundle/Makefile.am @@ -7,7 +7,6 @@ resource_DATA = Xquartz.plist EXTRA_DIST = \ mk_bundke.sh \ $(resource_DATA) \ - bundle-main.c \ Resources/da.lproj/InfoPlist.strings \ Resources/da.lproj/Localizable.strings \ Resources/da.lproj/main.nib/keyedobjects.nib \ diff --git a/hw/xquartz/bundle/bundle-main.c b/hw/xquartz/bundle/bundle-main.c deleted file mode 100644 index 042fa3ab8..000000000 --- a/hw/xquartz/bundle/bundle-main.c +++ /dev/null @@ -1,143 +0,0 @@ -/* main.c -- X application launcher - - Copyright (c) 2007 Jeremy Huddleston - Copyright (c) 2007 Apple Inc - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation files - (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of the Software, - and to permit persons to whom the Software is furnished to do so, - subject to the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - Except as contained in this notice, the name(s) of the above - copyright holders shall not be used in advertising or otherwise to - promote the sale, use or other dealings in this Software without - prior written authorization. */ - -#include -#include -#include -#include -#include - -#include - -#define DEFAULT_CLIENT "/usr/X11/bin/xterm" -#define DEFAULT_STARTX "/usr/X11/bin/startx" -#define DEFAULT_SHELL "/bin/sh" - -static int execute(const char *command); -static char *command_from_prefs(const char *key, const char *default_value); - -int server_main(int argc, char **argv, char **envp); - -int main(int argc, char **argv, char **envp) { - Display *display; - const char *s; - - size_t i; - fprintf(stderr, "X11.app: main(): argc=%d\n", argc); - for(i=0; i < argc; i++) { - fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]); - } - - /* Take care of the case where we're called like a normal DDX */ - if(argc > 1 && argv[1][0] == ':') { - exit(server_main(argc, argv, envp)); - } - - /* If we have a process serial number and it's our only arg, act as if - * the user double clicked the app bundle: launch app_to_run if possible - */ - if(argc == 1 || (argc == 2 && !strncmp(argv[1], "-psn_", 5))) { - /* Now, try to open a display, if so, run the launcher */ - display = XOpenDisplay(NULL); - if(display) { - fprintf(stderr, "X11.app: Closing the display and sleeping for 2s to allow the X server to start up.\n"); - /* Could open the display, start the launcher */ - XCloseDisplay(display); - - /* Give 2 seconds for the server to start... - * TODO: *Really* fix this race condition - */ - usleep(2000); - return execute(command_from_prefs("app_to_run", DEFAULT_CLIENT)); - } - } - - /* Start the server */ - if((s = getenv("DISPLAY"))) { - fprintf(stderr, "X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting). Starting X server.\n", s); - unsetenv("DISPLAY"); - } else { - fprintf(stderr, "X11.app: Could not connect to server (DISPLAY is not set). Starting X server.\n"); - } - return execute(command_from_prefs("startx_script", DEFAULT_STARTX)); -} - -static int execute(const char *command) { - const char *newargv[7]; - const char **s; - - newargv[0] = "/usr/bin/login"; - newargv[1] = "-fp"; - newargv[2] = getlogin(); - newargv[3] = command_from_prefs("login_shell", DEFAULT_SHELL); - newargv[4] = "-c"; - newargv[5] = command; - newargv[6] = NULL; - - fprintf(stderr, "X11.app: Launching %s:\n", command); - for(s=newargv; *s; s++) { - fprintf(stderr, "\targv[%d] = %s\n", s - newargv, *s); - } - - execvp (newargv[0], (char * const *) newargv); - perror ("X11.app: Couldn't exec."); - return(1); -} - -static char *command_from_prefs(const char *key, const char *default_value) { - char *command = NULL; - - CFStringRef cfKey = CFStringCreateWithCString(NULL, key, kCFStringEncodingASCII); - CFPropertyListRef PlistRef = CFPreferencesCopyAppValue(cfKey, kCFPreferencesCurrentApplication); - - if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) { - CFStringRef cfDefaultValue = CFStringCreateWithCString(NULL, default_value, kCFStringEncodingASCII); - - CFPreferencesSetAppValue(cfKey, cfDefaultValue, kCFPreferencesCurrentApplication); - CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication); - - int len = strlen(default_value) + 1; - command = (char *)malloc(len * sizeof(char)); - if(!command) - return NULL; - strcpy(command, default_value); - } else { - int len = CFStringGetLength((CFStringRef)PlistRef) + 1; - command = (char *)malloc(len * sizeof(char)); - if(!command) - return NULL; - CFStringGetCString((CFStringRef)PlistRef, command, len, kCFStringEncodingASCII); - } - - if (PlistRef) - CFRelease(PlistRef); - - return command; -} diff --git a/hw/xquartz/doc/Makefile.am b/hw/xquartz/doc/Makefile.am new file mode 100644 index 000000000..b812af1cb --- /dev/null +++ b/hw/xquartz/doc/Makefile.am @@ -0,0 +1,14 @@ +appmandir = $(APP_MAN_DIR) +appman_PRE = Xquartz.man.pre +appman_PROCESSED = $(appman_PRE:man.pre=man) +appman_DATA = $(appman_PRE:man.pre=@APP_MAN_SUFFIX@) + +CLEANFILES = $(appman_PROCESSED) $(appman_DATA) + +include $(top_srcdir)/cpprules.in + +.man.$(APP_MAN_SUFFIX): + cp $< $@ + +EXTRA_DIST = \ + Xquartz.man.pre diff --git a/hw/xquartz/doc/Xquartz.man.pre b/hw/xquartz/doc/Xquartz.man.pre new file mode 100644 index 000000000..315db1ca4 --- /dev/null +++ b/hw/xquartz/doc/Xquartz.man.pre @@ -0,0 +1,156 @@ +.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 org.x.X11 enable_fake_buttons -boolean true +Equivalent to the \fB-fakebuttons\fP command line option. +.TP 8 +.B defaults write org.x.X11 fake_button2 \fImodifiers\fP +Equivalent to the \fB-fakemouse2\fP option. +.TP 8 +.B defaults write org.x.X11 fake_button3 \fImodifiers\fP +Equivalent to the \fB-fakemouse3\fP option. +.TP 8 +.B defaults write org.x.X11 swap_alt_meta -boolean true +Equivalent to the \fB-swapAltMeta\fP option. +.TP 8 +.B defaults write org.x.X11 keymap_file \fIfilename\fP +Equivalent to the \fB-keymap\fP option. +.TP 8 +.B defaults write org.x.X11 no_quit_alert -boolean true +Disables the alert dialog displayed when attempting to quit X11. +.TP 8 +.B defaults write org.x.X11 no_auth -boolean true +Stops the X server requiring that clients authenticate themselves when +connecting. See Xsecurity(__miscmansuffix__). +.TP 8 +.B defaults write org.x.X11 nolisten_tcp -boolean true +Prevents the X server accepting remote connections. +.TP 8 +.B defaults write org.x.X11 xinit_kills_server -boolean false +Stops the X server exiting when the xinitrc script terminates. +.TP 8 +.B defaults write org.x.X11 fullscreen_hotkeys -boolean false +Allows system hotkeys to be handled while in X11 fullscreen mode. +.TP 8 +.B defaults write org.x.X11 enable_system_beep -boolean false +Don't use the standard system beep effect for X11 alerts. +.TP 8 +.B defaults write org.x.X11 enable_key_equivalents -boolean false +Disable menu keyboard equivalents while X11 windows are focused. +.TP 8 +.B defaults write org.x.X11 depth \fIdepth\fP +Equivalent to the \fB-depth\fP option. +.SH "SEE ALSO" +.PP +X(__miscmansuffix__), 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 diff --git a/hw/xquartz/mach-startup/Makefile.am b/hw/xquartz/mach-startup/Makefile.am new file mode 100644 index 000000000..966871126 --- /dev/null +++ b/hw/xquartz/mach-startup/Makefile.am @@ -0,0 +1,34 @@ +AM_CPPFLAGS = \ + -DBUILD_DATE=\"$(BUILD_DATE)\" \ + -DXSERVER_VERSION=\"$(VERSION)\" + +x11appdir = $(APPLE_APPLICATIONS_DIR)/X11.app/Contents/MacOS +x11app_PROGRAMS = X11 + +X11_SOURCES = \ + bundle-main.c + +X11_LDADD = \ + $(top_builddir)/hw/xquartz/libXquartz.la \ + $(top_builddir)/hw/xquartz/xpr/libXquartzXpr.la \ + $(top_builddir)/dix/dixfonts.lo \ + $(top_builddir)/miext/rootless/librootless.la \ + $(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin -lX11 + +X11_LDFLAGS = \ + -XCClinker -Objc \ + -Wl,-u,_miDCInitialize \ + -Wl,-framework,Carbon \ + -L/System/Library/Frameworks/OpenGL.framework/Libraries -lGL \ + -Wl,-framework,OpenGL \ + -Wl,-framework,Cocoa \ + -Wl,-framework,CoreAudio \ + -Wl,-framework,IOKit + +bin_PROGRAMS = Xquartz + +Xquartz_SOURCES = \ + stub.c + +Xquartz_LDFLAGS = \ + -Wl,-framework,CoreServices diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c new file mode 100644 index 000000000..042fa3ab8 --- /dev/null +++ b/hw/xquartz/mach-startup/bundle-main.c @@ -0,0 +1,143 @@ +/* main.c -- X application launcher + + Copyright (c) 2007 Jeremy Huddleston + Copyright (c) 2007 Apple Inc + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation files + (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT + HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the name(s) of the above + copyright holders shall not be used in advertising or otherwise to + promote the sale, use or other dealings in this Software without + prior written authorization. */ + +#include +#include +#include +#include +#include + +#include + +#define DEFAULT_CLIENT "/usr/X11/bin/xterm" +#define DEFAULT_STARTX "/usr/X11/bin/startx" +#define DEFAULT_SHELL "/bin/sh" + +static int execute(const char *command); +static char *command_from_prefs(const char *key, const char *default_value); + +int server_main(int argc, char **argv, char **envp); + +int main(int argc, char **argv, char **envp) { + Display *display; + const char *s; + + size_t i; + fprintf(stderr, "X11.app: main(): argc=%d\n", argc); + for(i=0; i < argc; i++) { + fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]); + } + + /* Take care of the case where we're called like a normal DDX */ + if(argc > 1 && argv[1][0] == ':') { + exit(server_main(argc, argv, envp)); + } + + /* If we have a process serial number and it's our only arg, act as if + * the user double clicked the app bundle: launch app_to_run if possible + */ + if(argc == 1 || (argc == 2 && !strncmp(argv[1], "-psn_", 5))) { + /* Now, try to open a display, if so, run the launcher */ + display = XOpenDisplay(NULL); + if(display) { + fprintf(stderr, "X11.app: Closing the display and sleeping for 2s to allow the X server to start up.\n"); + /* Could open the display, start the launcher */ + XCloseDisplay(display); + + /* Give 2 seconds for the server to start... + * TODO: *Really* fix this race condition + */ + usleep(2000); + return execute(command_from_prefs("app_to_run", DEFAULT_CLIENT)); + } + } + + /* Start the server */ + if((s = getenv("DISPLAY"))) { + fprintf(stderr, "X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting). Starting X server.\n", s); + unsetenv("DISPLAY"); + } else { + fprintf(stderr, "X11.app: Could not connect to server (DISPLAY is not set). Starting X server.\n"); + } + return execute(command_from_prefs("startx_script", DEFAULT_STARTX)); +} + +static int execute(const char *command) { + const char *newargv[7]; + const char **s; + + newargv[0] = "/usr/bin/login"; + newargv[1] = "-fp"; + newargv[2] = getlogin(); + newargv[3] = command_from_prefs("login_shell", DEFAULT_SHELL); + newargv[4] = "-c"; + newargv[5] = command; + newargv[6] = NULL; + + fprintf(stderr, "X11.app: Launching %s:\n", command); + for(s=newargv; *s; s++) { + fprintf(stderr, "\targv[%d] = %s\n", s - newargv, *s); + } + + execvp (newargv[0], (char * const *) newargv); + perror ("X11.app: Couldn't exec."); + return(1); +} + +static char *command_from_prefs(const char *key, const char *default_value) { + char *command = NULL; + + CFStringRef cfKey = CFStringCreateWithCString(NULL, key, kCFStringEncodingASCII); + CFPropertyListRef PlistRef = CFPreferencesCopyAppValue(cfKey, kCFPreferencesCurrentApplication); + + if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) { + CFStringRef cfDefaultValue = CFStringCreateWithCString(NULL, default_value, kCFStringEncodingASCII); + + CFPreferencesSetAppValue(cfKey, cfDefaultValue, kCFPreferencesCurrentApplication); + CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication); + + int len = strlen(default_value) + 1; + command = (char *)malloc(len * sizeof(char)); + if(!command) + return NULL; + strcpy(command, default_value); + } else { + int len = CFStringGetLength((CFStringRef)PlistRef) + 1; + command = (char *)malloc(len * sizeof(char)); + if(!command) + return NULL; + CFStringGetCString((CFStringRef)PlistRef, command, len, kCFStringEncodingASCII); + } + + if (PlistRef) + CFRelease(PlistRef); + + return command; +} diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c new file mode 100644 index 000000000..70f222c27 --- /dev/null +++ b/hw/xquartz/mach-startup/stub.c @@ -0,0 +1,96 @@ +/* Copyright (c) 2008 Apple Inc. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT + * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above + * copyright holders shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization. + */ + +#include + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include +#include +#include + +#define kX11AppBundleId "org.x.X11" +#define kX11AppBundlePath "/Contents/MacOS/X11" + +static char x11_path[PATH_MAX + 1]; + +static void set_x11_path() { + CFURLRef appURL = NULL; + OSStatus osstatus = LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(kX11AppBundleId), nil, nil, &appURL); + + switch (osstatus) { + case noErr: + if (appURL == NULL) { + fprintf(stderr, "xinit: Invalid response from LSFindApplicationForInfo(%s)\n", + kX11AppBundleId); + exit(1); + } + + if (!CFURLGetFileSystemRepresentation(appURL, true, (unsigned char *)x11_path, sizeof(x11_path))) { + fprintf(stderr, "xinit: Error resolving URL for %s\n", kX11AppBundleId); + exit(2); + } + + strlcat(x11_path, kX11AppBundlePath, sizeof(x11_path)); +#ifdef DEBUG + fprintf(stderr, "XQuartz: X11.app = %s\n", x11_path); +#endif + break; + case kLSApplicationNotFoundErr: + fprintf(stderr, "XQuartz: Unable to find application for %s\n", kX11AppBundleId); + exit(4); + default: + fprintf(stderr, "XQuartz: Unable to find application for %s, error code = %d\n", + kX11AppBundleId, (int)osstatus); + exit(5); + } +} + +#ifndef BUILD_DATE +#define BUILD_DATE "?" +#endif +#ifndef XSERVER_VERSION +#define XSERVER_VERSION "?" +#endif + +int main(int argc, char **argv) { + + if(argc == 2 && !strcmp(argv[1], "-version")) { + fprintf(stderr, "X.org Release 7.3\n"); + fprintf(stderr, "X.Org X Server %s\n", XSERVER_VERSION); + fprintf(stderr, "Build Date: %s\n", BUILD_DATE); + return 0; + } + + set_x11_path(); + + argv[0] = x11_path; + return execvp(x11_path, argv); +} diff --git a/hw/xquartz/stub/Makefile.am b/hw/xquartz/stub/Makefile.am deleted file mode 100644 index 3752dc111..000000000 --- a/hw/xquartz/stub/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -AM_CPPFLAGS = \ - -DBUILD_DATE=\"$(BUILD_DATE)\" \ - -DXSERVER_VERSION=\"$(VERSION)\" - -bin_PROGRAMS = Xquartz - -Xquartz_SOURCES = \ - stub.c - -Xquartz_LDFLAGS = \ - -framework CoreServices diff --git a/hw/xquartz/stub/stub.c b/hw/xquartz/stub/stub.c deleted file mode 100644 index 70f222c27..000000000 --- a/hw/xquartz/stub/stub.c +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright (c) 2008 Apple Inc. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name(s) of the above - * copyright holders shall not be used in advertising or otherwise to - * promote the sale, use or other dealings in this Software without - * prior written authorization. - */ - -#include - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include - -#define kX11AppBundleId "org.x.X11" -#define kX11AppBundlePath "/Contents/MacOS/X11" - -static char x11_path[PATH_MAX + 1]; - -static void set_x11_path() { - CFURLRef appURL = NULL; - OSStatus osstatus = LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(kX11AppBundleId), nil, nil, &appURL); - - switch (osstatus) { - case noErr: - if (appURL == NULL) { - fprintf(stderr, "xinit: Invalid response from LSFindApplicationForInfo(%s)\n", - kX11AppBundleId); - exit(1); - } - - if (!CFURLGetFileSystemRepresentation(appURL, true, (unsigned char *)x11_path, sizeof(x11_path))) { - fprintf(stderr, "xinit: Error resolving URL for %s\n", kX11AppBundleId); - exit(2); - } - - strlcat(x11_path, kX11AppBundlePath, sizeof(x11_path)); -#ifdef DEBUG - fprintf(stderr, "XQuartz: X11.app = %s\n", x11_path); -#endif - break; - case kLSApplicationNotFoundErr: - fprintf(stderr, "XQuartz: Unable to find application for %s\n", kX11AppBundleId); - exit(4); - default: - fprintf(stderr, "XQuartz: Unable to find application for %s, error code = %d\n", - kX11AppBundleId, (int)osstatus); - exit(5); - } -} - -#ifndef BUILD_DATE -#define BUILD_DATE "?" -#endif -#ifndef XSERVER_VERSION -#define XSERVER_VERSION "?" -#endif - -int main(int argc, char **argv) { - - if(argc == 2 && !strcmp(argv[1], "-version")) { - fprintf(stderr, "X.org Release 7.3\n"); - fprintf(stderr, "X.Org X Server %s\n", XSERVER_VERSION); - fprintf(stderr, "Build Date: %s\n", BUILD_DATE); - return 0; - } - - set_x11_path(); - - argv[0] = x11_path; - return execvp(x11_path, argv); -} diff --git a/hw/xquartz/xpr/Makefile.am b/hw/xquartz/xpr/Makefile.am index 6bf99a402..e74580f73 100644 --- a/hw/xquartz/xpr/Makefile.am +++ b/hw/xquartz/xpr/Makefile.am @@ -1,5 +1,4 @@ -x11appdir = $(APPLE_APPLICATIONS_DIR)/X11.app/Contents/MacOS -x11app_PROGRAMS = X11 +noinst_LTLIBRARIES = libXquartzXpr.la AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS) AM_CPPFLAGS = \ @@ -7,7 +6,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/miext \ -I$(top_srcdir)/miext/rootless -X11_SOURCES = \ +libXquartzXpr_la_SOURCES = \ appledri.c \ dri.c \ xprAppleWM.c \ @@ -19,36 +18,7 @@ X11_SOURCES = \ x-hook.c \ x-list.c -X11_LDADD = \ - $(top_builddir)/hw/xquartz/libXquartz.la \ - $(top_builddir)/dix/dixfonts.lo \ - $(top_builddir)/miext/rootless/librootless.la \ - $(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin -lX11 - -X11_LDFLAGS = \ - -XCClinker -Objc \ - -Wl,-u,_miDCInitialize \ - -Wl,-framework,Carbon \ - -L/System/Library/Frameworks/OpenGL.framework/Libraries -lGL \ - -Wl,-framework,OpenGL \ - -Wl,-framework,Cocoa \ - -Wl,-framework,CoreAudio \ - -Wl,-framework,IOKit - -appmandir = $(APP_MAN_DIR) -appman_PRE = Xquartz.man.pre -appman_PROCESSED = $(appman_PRE:man.pre=man) -appman_DATA = $(appman_PRE:man.pre=@APP_MAN_SUFFIX@) - -CLEANFILES = $(appman_PROCESSED) $(appman_DATA) - -include $(top_srcdir)/cpprules.in - -.man.$(APP_MAN_SUFFIX): - cp $< $@ - EXTRA_DIST = \ - Xquartz.man.pre \ dri.h \ dristruct.h \ appledri.h \ diff --git a/hw/xquartz/xpr/Xquartz.man.pre b/hw/xquartz/xpr/Xquartz.man.pre deleted file mode 100644 index 315db1ca4..000000000 --- a/hw/xquartz/xpr/Xquartz.man.pre +++ /dev/null @@ -1,156 +0,0 @@ -.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 org.x.X11 enable_fake_buttons -boolean true -Equivalent to the \fB-fakebuttons\fP command line option. -.TP 8 -.B defaults write org.x.X11 fake_button2 \fImodifiers\fP -Equivalent to the \fB-fakemouse2\fP option. -.TP 8 -.B defaults write org.x.X11 fake_button3 \fImodifiers\fP -Equivalent to the \fB-fakemouse3\fP option. -.TP 8 -.B defaults write org.x.X11 swap_alt_meta -boolean true -Equivalent to the \fB-swapAltMeta\fP option. -.TP 8 -.B defaults write org.x.X11 keymap_file \fIfilename\fP -Equivalent to the \fB-keymap\fP option. -.TP 8 -.B defaults write org.x.X11 no_quit_alert -boolean true -Disables the alert dialog displayed when attempting to quit X11. -.TP 8 -.B defaults write org.x.X11 no_auth -boolean true -Stops the X server requiring that clients authenticate themselves when -connecting. See Xsecurity(__miscmansuffix__). -.TP 8 -.B defaults write org.x.X11 nolisten_tcp -boolean true -Prevents the X server accepting remote connections. -.TP 8 -.B defaults write org.x.X11 xinit_kills_server -boolean false -Stops the X server exiting when the xinitrc script terminates. -.TP 8 -.B defaults write org.x.X11 fullscreen_hotkeys -boolean false -Allows system hotkeys to be handled while in X11 fullscreen mode. -.TP 8 -.B defaults write org.x.X11 enable_system_beep -boolean false -Don't use the standard system beep effect for X11 alerts. -.TP 8 -.B defaults write org.x.X11 enable_key_equivalents -boolean false -Disable menu keyboard equivalents while X11 windows are focused. -.TP 8 -.B defaults write org.x.X11 depth \fIdepth\fP -Equivalent to the \fB-depth\fP option. -.SH "SEE ALSO" -.PP -X(__miscmansuffix__), 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 -- cgit v1.2.3