xserver: Branch 'master' - 2 commits
Jeremy Huddleston
jeremyhu at kemper.freedesktop.org
Thu Dec 20 17:41:24 PST 2007
hw/xquartz/X11Application.h | 2
hw/xquartz/X11Application.m | 4 -
hw/xquartz/X11Controller.h | 2
hw/xquartz/X11Controller.m | 4 +
hw/xquartz/bundle/X11.xcodeproj/project.pbxproj | 4 -
hw/xquartz/bundle/bundle-main.c | 59 ++++++++++++++++++++----
hw/xquartz/darwin.c | 5 +-
hw/xquartz/quartzStartup.c | 4 -
8 files changed, 64 insertions(+), 20 deletions(-)
New commits:
commit 1f74bef1ad1399323fc0d2e309b808bf32c622e4
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...
(cherry picked from commit ae302db472f127be082d05b418ede332fae8ccc5)
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 828cd30..56db2c4 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -153,7 +153,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
tem = [infoDict objectForKey:@"CFBundleShortVersionString"];
- [dict setObject:[NSString stringWithFormat:@"X11.app %@ - X.org X11R7.3", tem]
+ [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 06e88bd..d6eb100 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -150,8 +150,9 @@ void
DarwinPrintBanner(void)
{
// this should change depending on which specific server we are building
- ErrorF("X11.app starting:\n");
- ErrorF("Xquartz server based on X.org %s, built on %s\n", XORG_RELEASE, BUILD_DATE );
+ 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 X Server %s\nBuild Date: %s\n", XSERVER_VERSION, BUILD_DATE );
}
commit 2d15d439f844d4016f169664a338595c11b91b77
Author: Jeremy Huddleston <jeremy at yuffie.local>
Date: Thu Dec 20 15:46:40 2007 -0800
Xquartz: Use X11ControllerMain()
(cherry picked from commit a9ac932543374aa2540f5a12cc85ef82c85b0e0c)
diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index c42e6a5..a1be751 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -72,7 +72,7 @@ void X11ApplicationSetCanQuit (int state);
void X11ApplicationServerReady (void);
void X11ApplicationShowHideMenubar (int state);
-void X11ApplicationMain(int argc, char **argv, void (*server_thread) (void *), void *server_arg);
+void X11ApplicationMain(int argc, const char **argv, void (*server_thread) (void *), void *server_arg);
extern int X11EnableKeyEquivalents;
extern int quartzHasRoot, quartzEnableRootless;
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 92a503b..828cd30 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -790,7 +790,7 @@ environment?", @"Startup xinitrc dialog");
[X11App prefs_synchronize];
}
-void X11ApplicationMain (int argc, char **argv, void (*server_thread) (void *), void *server_arg) {
+void X11ApplicationMain (int argc, const char **argv, void (*server_thread) (void *), void *server_arg) {
NSAutoreleasePool *pool;
#ifdef DEBUG
diff --git a/hw/xquartz/X11Controller.h b/hw/xquartz/X11Controller.h
index bfbb04f..47f5220 100644
--- a/hw/xquartz/X11Controller.h
+++ b/hw/xquartz/X11Controller.h
@@ -78,4 +78,6 @@
#endif /* __OBJC__ */
+void X11ControllerMain(int argc, const char **argv, void (*server_thread) (void *), void *server_arg);
+
#endif /* X11CONTROLLER_H */
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index ecd88ab..6b7c351 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -741,3 +741,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
}
@end
+
+void X11ControllerMain(int argc, const char **argv, void (*server_thread) (void *), void *server_arg) {
+ X11ApplicationMain (argc, argv, server_thread, server_arg);
+}
diff --git a/hw/xquartz/quartzStartup.c b/hw/xquartz/quartzStartup.c
index 50ce2a6..8600ec8 100644
--- a/hw/xquartz/quartzStartup.c
+++ b/hw/xquartz/quartzStartup.c
@@ -35,7 +35,7 @@
#include <unistd.h>
#include <CoreFoundation/CoreFoundation.h>
#include "quartzCommon.h"
-#include "X11Application.h"
+#include "X11Controller.h"
#include "darwin.h"
#include "quartz.h"
#include "opaque.h"
@@ -106,6 +106,6 @@ void DarwinHandleGUI(int argc, char **argv, char **envp) {
extern void _InitHLTB(void);
_InitHLTB();
- X11ApplicationMain(argc, argv, server_thread, NULL);
+ X11ControllerMain(argc, argv, server_thread, NULL);
exit(0);
}
More information about the xorg-commit
mailing list