xserver: Branch 'xorg-server-1.2-apple'
Jeremy Huddleston
jeremyhu at kemper.freedesktop.org
Thu Dec 20 17:36:35 PST 2007
hw/xquartz/X11Application.m | 2
hw/xquartz/bundle/X11.xcodeproj/project.pbxproj | 4 -
hw/xquartz/bundle/bundle-main.c | 59 ++++++++++++++++++++----
hw/xquartz/darwin.c | 4 -
4 files changed, 53 insertions(+), 16 deletions(-)
New commits:
commit ae302db472f127be082d05b418ede332fae8ccc5
Author: Jeremy Huddleston <jeremy at yuffie.local>
Date: Thu Dec 20 17:33:38 2007 -0800
XQuartz: Don't fork to exec app_to_run.
Plus other housecleaning...
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 8d200a6..23f7ef7 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -163,7 +163,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
tem = [infoDict objectForKey:@"CFBundleShortVersionString"];
- [dict setObject:[NSString stringWithFormat:@"X11.app %@ - (xorg-server %s)", tem, XSERVER_VERSION]
+ [dict setObject:[NSString stringWithFormat:@"XQuartz %@ - (xorg-server %s)", tem, XSERVER_VERSION]
forKey:@"ApplicationVersion"];
[self orderFrontStandardAboutPanelWithOptions: dict];
diff --git a/hw/xquartz/bundle/X11.xcodeproj/project.pbxproj b/hw/xquartz/bundle/X11.xcodeproj/project.pbxproj
index 225f371..9d5c5d6 100644
--- a/hw/xquartz/bundle/X11.xcodeproj/project.pbxproj
+++ b/hw/xquartz/bundle/X11.xcodeproj/project.pbxproj
@@ -7,7 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
- 3F5E1BE00D04BF110020CA24 /* launcher-main.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F5E1BDE0D04BF110020CA24 /* launcher-main.c */; };
3F5E1BE10D04BF110020CA24 /* server-main.c in Sources */ = {isa = PBXBuildFile; fileRef = 3F5E1BDF0D04BF110020CA24 /* server-main.c */; };
527F24190B5D938C007840A7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */; };
527F241A0B5D938C007840A7 /* main.nib in Resources */ = {isa = PBXBuildFile; fileRef = 02345980000FD03B11CA0E72 /* main.nib */; };
@@ -22,7 +21,6 @@
/* 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>"; };
- 3F5E1BDE0D04BF110020CA24 /* launcher-main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "launcher-main.c"; sourceTree = "<group>"; };
3F5E1BDF0D04BF110020CA24 /* server-main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "server-main.c"; 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>"; };
@@ -69,7 +67,6 @@
20286C2AFDCF999611CA2CEA /* Sources */ = {
isa = PBXGroup;
children = (
- 3F5E1BDE0D04BF110020CA24 /* launcher-main.c */,
3F5E1BDF0D04BF110020CA24 /* server-main.c */,
50EE2AB703849F0B0ECA21EC /* bundle-main.c */,
);
@@ -176,7 +173,6 @@
buildActionMask = 2147483647;
files = (
527F241D0B5D938C007840A7 /* bundle-main.c in Sources */,
- 3F5E1BE00D04BF110020CA24 /* launcher-main.c in Sources */,
3F5E1BE10D04BF110020CA24 /* server-main.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
diff --git a/hw/xquartz/bundle/bundle-main.c b/hw/xquartz/bundle/bundle-main.c
index 681e1a8..ed41e68 100644
--- a/hw/xquartz/bundle/bundle-main.c
+++ b/hw/xquartz/bundle/bundle-main.c
@@ -32,18 +32,23 @@
#include <unistd.h>
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
-int launcher_main(int argc, char **argv);
+#include <CoreFoundation/CoreFoundation.h>
+
+#define DEFAULT_APP "/usr/X11/bin/xterm"
+
+static int launcher_main(int argc, char **argv);
int server_main(int argc, char **argv);
int main(int argc, char **argv) {
Display *display;
- //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]);
- //}
+ size_t i;
+ fprintf(stderr, "X11.app: main(): argc=%d\n", argc);
+ for(i=0; i < argc; i++) {
+ fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]);
+ }
/* If we have a process serial number and it's our only arg, act as if
* the user double clicked the app bundle: launch app_to_run if possible
@@ -52,7 +57,7 @@ int main(int argc, char **argv) {
/* Now, try to open a display, if so, run the launcher */
display = XOpenDisplay(NULL);
if(display) {
- fprintf(stderr, "X11.app: main(): closing the display and sleeping");
+ 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);
@@ -60,13 +65,49 @@ int main(int argc, char **argv) {
* TODO: *Really* fix this race condition
*/
usleep(2000);
- //fprintf(stderr, "X11.app: main(): running launcher_main()");
return launcher_main(argc, argv);
}
}
/* Start the server */
- //fprintf(stderr, "X11.app: main(): running server_main()");
+ fprintf(stderr, "X11.app: main(): running server_main()");
return server_main(argc, argv);
}
+int launcher_main (int argc, char **argv) {
+ char *command = DEFAULT_APP;
+ const char *newargv[7];
+ int child;
+ const char **s;
+
+ CFPropertyListRef PlistRef = CFPreferencesCopyAppValue(CFSTR("app_to_run"), kCFPreferencesCurrentApplication);
+
+ if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) {
+ CFPreferencesSetAppValue(CFSTR("app_to_run"), CFSTR(DEFAULT_APP), kCFPreferencesCurrentApplication);
+ CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
+ } else {
+ int len = CFStringGetLength((CFStringRef)PlistRef)+1;
+ command = (char *)malloc(len);
+ CFStringGetCString((CFStringRef)PlistRef, command, len, kCFStringEncodingASCII);
+ fprintf(stderr, "command=%s\n", command);
+ }
+
+ if (PlistRef) CFRelease(PlistRef);
+
+ newargv[0] = "/usr/bin/login";
+ newargv[1] = "-fp";
+ newargv[2] = getlogin();
+ newargv[3] = "/bin/sh";
+ newargv[4] = "-c";
+ newargv[5] = command;
+ newargv[6] = NULL;
+
+ fprintf(stderr, "X11.app: Launching X11 Application:\n");
+ for(s=newargv; *s; s++) {
+ fprintf(stderr, "\targv[%d] = %s\n", s - newargv, *s);
+ }
+
+ execvp (newargv[0], (const char **) newargv);
+ perror ("X11.app: Couldn't exec.");
+ return(1);
+}
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index f81e431..2210e2d 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -150,9 +150,9 @@ void
DarwinPrintBanner(void)
{
// this should change depending on which specific server we are building
- ErrorF("X11.app starting:\n");
+ ErrorF("XQuartz starting:\n");
ErrorF("X.org Release 7.2\n"); // This is here to help fink until they fix their packages.
- ErrorF("X.Org Xquartz X Server %s\nBuild Date: %s\n", XSERVER_VERSION, BUILD_DATE );
+ ErrorF("X.Org X Server %s\nBuild Date: %s\n", XSERVER_VERSION, BUILD_DATE );
}
More information about the xorg-commit
mailing list