diff options
author | Jeremy Huddleston <jeremy@tifa.local> | 2007-11-21 21:59:59 -0800 |
---|---|---|
committer | Jeremy Huddleston <jeremy@tifa.local> | 2007-11-21 21:59:59 -0800 |
commit | 7f2972d47a5d74fe92268c6d609b1eb6ad845824 (patch) | |
tree | f77792eb070f33735ad006cef5e951deaf173bb6 | |
parent | bcbaf2a0ce34b6c5e41d2831b8b87dbd0617a89b (diff) |
Darwin: Really add launcher this time
-rw-r--r-- | hw/darwin/launcher/Info.plist | 30 | ||||
-rw-r--r-- | hw/darwin/launcher/X11.icns | bin | 0 -> 65908 bytes | |||
-rw-r--r-- | hw/darwin/launcher/X11.xcodeproj/project.pbxproj | 290 | ||||
-rw-r--r-- | hw/darwin/launcher/bundle-main.c | 81 |
4 files changed, 401 insertions, 0 deletions
diff --git a/hw/darwin/launcher/Info.plist b/hw/darwin/launcher/Info.plist new file mode 100644 index 000000000..b5385b61a --- /dev/null +++ b/hw/darwin/launcher/Info.plist @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//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>CFBundleExecutable</key> + <string>X11</string> + <key>CFBundleGetInfoString</key> + <string>2.0, Copyright © 2003-2007, Apple Inc.</string> + <key>CFBundleIconFile</key> + <string>X11.icns</string> + <key>CFBundleIdentifier</key> + <string>org.x.X11_launcher</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>x11l</string> + <key>LSUIElement</key> + <string>1</string> + <key>NSHumanReadableCopyright</key> + <string>Copyright © 2007, Apple Inc.</string> +</dict> +</plist> diff --git a/hw/darwin/launcher/X11.icns b/hw/darwin/launcher/X11.icns Binary files differnew file mode 100644 index 000000000..d770e617d --- /dev/null +++ b/hw/darwin/launcher/X11.icns diff --git a/hw/darwin/launcher/X11.xcodeproj/project.pbxproj b/hw/darwin/launcher/X11.xcodeproj/project.pbxproj new file mode 100644 index 000000000..34b76dafb --- /dev/null +++ b/hw/darwin/launcher/X11.xcodeproj/project.pbxproj @@ -0,0 +1,290 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXBuildFile section */ + 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 */; }; + 527F24370B5D9D89007840A7 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 527F24260B5D938C007840A7 /* Info.plist */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 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; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 527F241E0B5D938C007840A7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 527F241F0B5D938C007840A7 /* CoreFoundation.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 */, + ); + name = Resources; + sourceTree = "<group>"; + }; + 20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.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 */, + 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 XCBuildConfiguration section */ + 527F24090B5D8FFC007840A7 /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + INSTALL_MODE_FLAG = "a+rX"; + }; + name = Development; + }; + 527F240A0B5D8FFC007840A7 /* Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + INSTALL_MODE_FLAG = "a+rX"; + }; + name = Deployment; + }; + 527F240B0B5D8FFC007840A7 /* Default */ = { + isa = XCBuildConfiguration; + buildSettings = { + INSTALL_MODE_FLAG = "a+rX"; + }; + name = Default; + }; + 527F24230B5D938C007840A7 /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ""; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + HEADER_SEARCH_PATHS = /usr/X11/include; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = $DSTROOT/Applications/Utilties; + LIBRARY_SEARCH_PATHS = /usr/X11/lib; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ( + "-lXau", + "-lxcb", + "-lX11", + ); + OTHER_REZFLAGS = ""; + PRODUCT_NAME = X11; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + WRAPPER_EXTENSION = app; + }; + name = Development; + }; + 527F24240B5D938C007840A7 /* Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + FRAMEWORK_SEARCH_PATHS = ""; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + HEADER_SEARCH_PATHS = /usr/X11/include; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = /Applications/Utilties; + LIBRARY_SEARCH_PATHS = /usr/X11/lib; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = X11; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + WRAPPER_EXTENSION = app; + }; + name = Deployment; + }; + 527F24250B5D938C007840A7 /* Default */ = { + isa = XCBuildConfiguration; + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ""; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + HEADER_SEARCH_PATHS = /usr/X11/include; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = /Applications/Utilties; + LIBRARY_SEARCH_PATHS = /usr/X11/lib; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ( + "-lXau", + "-lxcb", + "-lX11", + ); + OTHER_REZFLAGS = ""; + PRODUCT_NAME = X11; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + WRAPPER_EXTENSION = app; + }; + name = Default; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 527F24090B5D8FFC007840A7 /* Development */, + 527F240A0B5D8FFC007840A7 /* Deployment */, + 527F240B0B5D8FFC007840A7 /* Default */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Default; + }; + 527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 527F24230B5D938C007840A7 /* Development */, + 527F24240B5D938C007840A7 /* Deployment */, + 527F24250B5D938C007840A7 /* Default */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Default; + }; +/* End XCConfigurationList section */ + }; + rootObject = 20286C28FDCF999611CA2CEA /* Project object */; +} diff --git a/hw/darwin/launcher/bundle-main.c b/hw/darwin/launcher/bundle-main.c new file mode 100644 index 000000000..ca6255307 --- /dev/null +++ b/hw/darwin/launcher/bundle-main.c @@ -0,0 +1,81 @@ +/* main.c -- X application launcher + + 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 <stdio.h> +#include <unistd.h> +#include <stdlib.h> + +#include <CoreFoundation/CoreFoundation.h> + +#define DEFAULT_APP "/usr/X11/bin/xterm" + +int main (int argc, char **argv) { + char *command = DEFAULT_APP; + const char *newargv[7]; + int child; + + + 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; + + child = fork(); + + switch (child) { + case -1: /* error */ + perror ("fork"); + return EXIT_FAILURE; + case 0: /* child */ + execvp (newargv[0], (char **const) newargv); + perror ("Couldn't exec"); + _exit (1); + } + + return 0; +} |