xserver: Branch 'xorg-server-1.2-apple'
Ben Byer
bbyer at kemper.freedesktop.org
Fri Oct 26 15:40:41 PDT 2007
hw/darwin/apple/English.lproj/InfoPlist.strings |binary
hw/darwin/apple/English.lproj/Localizable.strings |binary
hw/darwin/apple/English.lproj/main.nib/classes.nib | 318 ++++
hw/darwin/apple/English.lproj/main.nib/info.nib | 18
hw/darwin/apple/English.lproj/main.nib/keyedobjects.nib |binary
hw/darwin/apple/Info.plist | 35
hw/darwin/apple/X11.icns |binary
hw/darwin/apple/X11.xcodeproj/project.pbxproj | 344 ++++
hw/darwin/apple/X11Application.h | 104 +
hw/darwin/apple/X11Application.m | 1131 ++++++++++++++++
hw/darwin/apple/X11Controller.h | 86 +
hw/darwin/apple/X11Controller.m | 748 ++++++++++
hw/darwin/apple/Xquartz.man | 158 ++
hw/darwin/apple/bundle-main.c | 914 ++++++++++++
hw/darwin/bundle/Dutch.lproj/Localizable.strings |binary
hw/darwin/bundle/Dutch.lproj/Makefile.am | 39
hw/darwin/bundle/English.lproj/Localizable.strings |binary
hw/darwin/bundle/English.lproj/Makefile.am | 39
hw/darwin/bundle/French.lproj/Makefile.am | 41
hw/darwin/bundle/German.lproj/Makefile.am | 39
hw/darwin/bundle/Info.plist | 66
hw/darwin/bundle/Japanese.lproj/Makefile.am | 40
hw/darwin/bundle/Makefile.am | 38
hw/darwin/bundle/Portuguese.lproj/Makefile.am | 39
hw/darwin/bundle/Spanish.lproj/Makefile.am | 39
hw/darwin/bundle/Swedish.lproj/Makefile.am | 39
hw/darwin/bundle/ko.lproj/Makefile.am | 40
hw/darwin/iokit/Makefile.am | 17
hw/darwin/launcher/Info.plist | 30
hw/darwin/launcher/X11.icns |binary
hw/darwin/launcher/X11.xcodeproj/project.pbxproj | 297 ++++
hw/darwin/launcher/bundle-main.c | 79 +
hw/darwin/quartz/Makefile.am | 57
hw/darwin/quartz/cr/Makefile.am | 21
hw/darwin/quartz/fullscreen/Makefile.am | 9
hw/darwin/quartz/xpr/Makefile.am | 30
hw/darwin/quartz/xpr/appledri.h | 107 +
hw/darwin/quartz/xpr/appledristr.h | 176 ++
hw/darwin/utils/Makefile.am | 12
hw/darwin/utils/event_status_driver.h | 133 +
40 files changed, 5283 insertions(+)
New commits:
commit cc9b4723ecdcb4ccc612a166c34433b7c0aa1764
Author: Ben Byer <bbyer at bbyer.apple.com>
Date: Fri Oct 26 15:40:35 2007 -0700
added missing file from Apple version of 7.2
diff --git a/hw/darwin/apple/English.lproj/InfoPlist.strings b/hw/darwin/apple/English.lproj/InfoPlist.strings
new file mode 100644
index 0000000..88e1f04
Binary files /dev/null and b/hw/darwin/apple/English.lproj/InfoPlist.strings differ
diff --git a/hw/darwin/apple/English.lproj/Localizable.strings b/hw/darwin/apple/English.lproj/Localizable.strings
new file mode 100644
index 0000000..c83b085
Binary files /dev/null and b/hw/darwin/apple/English.lproj/Localizable.strings differ
diff --git a/hw/darwin/apple/English.lproj/main.nib/classes.nib b/hw/darwin/apple/English.lproj/main.nib/classes.nib
new file mode 100644
index 0000000..a82159b
--- /dev/null
+++ b/hw/darwin/apple/English.lproj/main.nib/classes.nib
@@ -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>
diff --git a/hw/darwin/apple/English.lproj/main.nib/info.nib b/hw/darwin/apple/English.lproj/main.nib/info.nib
new file mode 100644
index 0000000..88bc626
--- /dev/null
+++ b/hw/darwin/apple/English.lproj/main.nib/info.nib
@@ -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>
diff --git a/hw/darwin/apple/English.lproj/main.nib/keyedobjects.nib b/hw/darwin/apple/English.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 0000000..8b31450
Binary files /dev/null and b/hw/darwin/apple/English.lproj/main.nib/keyedobjects.nib differ
diff --git a/hw/darwin/apple/Info.plist b/hw/darwin/apple/Info.plist
new file mode 100644
index 0000000..66f1f6b
--- /dev/null
+++ b/hw/darwin/apple/Info.plist
@@ -0,0 +1,35 @@
+<?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>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>x11a</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>
diff --git a/hw/darwin/apple/X11.icns b/hw/darwin/apple/X11.icns
new file mode 100644
index 0000000..d770e61
Binary files /dev/null and b/hw/darwin/apple/X11.icns differ
diff --git a/hw/darwin/apple/X11.xcodeproj/project.pbxproj b/hw/darwin/apple/X11.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..a47e4d1
--- /dev/null
+++ b/hw/darwin/apple/X11.xcodeproj/project.pbxproj
@@ -0,0 +1,344 @@
+// !$*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 */; };
+ 52D9C0ED0BCDDF6B00CD2AFC /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */; };
+/* 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; };
+ 52D9C0EC0BCDDF6B00CD2AFC /* English */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 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 = (
+ 52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */,
+ 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 */,
+ 52D9C0ED0BCDDF6B00CD2AFC /* Localizable.strings 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>";
+ };
+ 52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 52D9C0EC0BCDDF6B00CD2AFC /* English */,
+ );
+ name = Localizable.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",
+ "-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;
+ 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",
+ "-lxcb",
+ "-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",
+ "-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/apple/X11Application.h b/hw/darwin/apple/X11Application.h
new file mode 100644
index 0000000..fb153e7
--- /dev/null
+++ b/hw/darwin/apple/X11Application.h
@@ -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"
+
+ at 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;
+
+ at 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 "org.x.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 */
diff --git a/hw/darwin/apple/X11Application.m b/hw/darwin/apple/X11Application.m
new file mode 100644
index 0000000..9ae470e
--- /dev/null
+++ b/hw/darwin/apple/X11Application.m
@@ -0,0 +1,1131 @@
+/* X11Application.m -- subclass of NSApplication to multiplex events
+
+ 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. */
+
+#include "../quartz/quartzCommon.h"
+
+#import "X11Application.h"
+#include <Carbon/Carbon.h>
+
+/* ouch! */
+#define BOOL X_BOOL
+//# include "Xproto.h"
+# include "darwin.h"
+# include "../quartz/quartz.h"
+# define _APPLEWM_SERVER_
+# include "X11/extensions/applewm.h"
+//# include "X.h"
+# include "micmap.h"
+#undef BOOL
+
+#include "xf86Version.h"
+
+#include <mach/mach.h>
+#include <unistd.h>
+#include <pthread.h>
+
+#define DEFAULTS_FILE "/usr/X11/lib/X11/xserver/Xquartz.plist"
+
+int X11EnableKeyEquivalents = TRUE;
+int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
+
+extern int darwinFakeButtons;
+extern Bool enable_stereo;
+
+X11Application *X11App;
+
+#define ALL_KEY_MASKS (NSShiftKeyMask | NSControlKeyMask \
+| NSAlternateKeyMask | NSCommandKeyMask)
+
+ at 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)
+ fprintf (stderr, "%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.2",
+ 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)
+ {
+ if (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];
+ if ([e data2] & 0x10) X11ApplicationSetFrontProcess();
+ }
+ 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;
+}
+
+ at end
+
+static NSArray *
+array_with_strings_and_numbers (int nitems, const char **items,
+ const char *numbers)
+{
+ NSMutableArray *array, *subarray;
+ NSString *string;
+ NSString *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];
+
+ 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))
+ {
+ fprintf (stderr, "can't create secondary thread\n");
+ exit (1);
+ }
+
+ [NSApp run];
+
+ /* not reached */
+}
+
+
+/* event conversion */
+
+static inline unsigned short
+convert_flags (unsigned int nsflags)
+{
+ unsigned int xflags;
+
+ if (nsflags == ~0) return 0xffff;
+
+ xflags = 0;
+
+ 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;
+}
+
+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;
+ xEvent xe;
+
+ memset (&xe, 0, sizeof (xe));
+
+ /* This field should be filled in for every event */
+ xe.u.keyButtonPointer.time = GetTimeInMillis();
+
+ /* 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;
+ }
+
+ xe.u.keyButtonPointer.rootX = pointer_x;
+ xe.u.keyButtonPointer.rootY = pointer_y;
+
+ switch (type) {
+ float count;
+
+ case NSLeftMouseDown:
+ xe.u.u.type = ButtonPress;
+ xe.u.u.detail = 1;
+ goto do_press_event;
+
+ case NSRightMouseDown:
+ xe.u.u.type = ButtonPress;
+ xe.u.u.detail = 3;
+ goto do_press_event;
+
+ case NSOtherMouseDown:
+ xe.u.u.type = ButtonPress;
+ xe.u.u.detail = 2; /* FIXME? */
+ goto do_press_event;
+
+do_press_event:
+ if (!quartzProcs->IsX11Window([e window], [e windowNumber])) {
+ /* X server doesn't grok this window, drop the event.
+
+ Note: theoretically this isn't necessary, but if I click
+ on the menubar, we get sent a LeftMouseDown when the
+ release happens, but no LeftMouseUp is ever seen! */
+
+ break;
+ }
+ goto do_event;
+
+ case NSLeftMouseUp:
+ xe.u.u.type = ButtonRelease;
+ xe.u.u.detail = 1;
+ goto do_release_event;
+
+ case NSRightMouseUp:
+ xe.u.u.type = ButtonRelease;
+ xe.u.u.detail = 3;
+ goto do_release_event;
+
+ case NSOtherMouseUp:
+ xe.u.u.type = ButtonRelease;
+ xe.u.u.detail = 2; /* FIXME? */
+ goto do_release_event;
+
+do_release_event:
+ if ((button_state & (1 << xe.u.u.detail)) == 0)
+ {
+ /* X didn't see the button press for this release, so skip it */
+ break;
+ }
+ goto do_event;
+
+ case NSMouseMoved:
+ case NSLeftMouseDragged:
+ case NSRightMouseDragged:
+ case NSOtherMouseDragged:
+ xe.u.u.type = MotionNotify;
+ goto do_event;
+
+ case NSKeyDown:
+ xe.u.u.type = KeyPress;
+ xe.u.u.detail = [e keyCode];
+ goto do_event;
+
+ case NSKeyUp:
+ xe.u.u.type = KeyRelease;
+ xe.u.u.detail = [e keyCode];
+ goto do_event;
+
+ case NSScrollWheel:
+ xe.u.keyButtonPointer.state = convert_flags ([e modifierFlags]);
+ count = [e deltaY];
+ xe.u.u.detail = count > 0.0f ? 4 : 5;
+ for (count = fabs(count); count > 0.0; count = count - 1.0f) {
+ xe.u.u.type = ButtonPress;
+ DarwinEQEnqueue(&xe);
+ xe.u.u.type = ButtonRelease;
+ DarwinEQEnqueue(&xe);
+ }
+ xe.u.u.type = 0;
+ break;
+
+ case NSFlagsChanged:
+ xe.u.u.type = kXDarwinUpdateModifiers;
+ xe.u.clientMessage.u.l.longs0 = [e modifierFlags];
+ DarwinEQEnqueue (&xe);
+ break;
+
+do_event:
+ // xe.u.keyButtonPointer.state = convert_flags ([e modifierFlags]);
+ DarwinEQEnqueue (&xe);
+ break;
+
+ default: break; /* for gcc */
+ }
+
+ if (xe.u.u.type == ButtonPress)
+ button_state |= (1 << xe.u.u.detail);
+ else if (xe.u.u.type == ButtonRelease)
+ button_state &= ~(1 << xe.u.u.detail);
+}
diff --git a/hw/darwin/apple/X11Controller.h b/hw/darwin/apple/X11Controller.h
new file mode 100644
index 0000000..954d0ab
--- /dev/null
+++ b/hw/darwin/apple/X11Controller.h
@@ -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"
+
+ at 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;
+
+ at end
+
+#endif /* __OBJC__ */
+
+extern void X11ControllerMain (int argc, const char *argv[],
+ void (*server_thread) (void *),
+ void *server_arg);
+
+#endif /* X11CONTROLLER_H */
diff --git a/hw/darwin/apple/X11Controller.m b/hw/darwin/apple/X11Controller.m
new file mode 100644
index 0000000..cc039b1
--- /dev/null
+++ b/hw/darwin/apple/X11Controller.m
@@ -0,0 +1,748 @@
+/* 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__)
+
+ at 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 *argv[5];
+ int child1, child2 = 0;
+ int status;
+
+ argv[0] = "/usr/bin/login";
+ argv[1] = "-fp";
+ argv[2] = getlogin();
+ 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 ((CFStringRef)NSLocalizedString(@"Mac Help", no comment), 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;
+}
+
+ at 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/darwin/apple/Xquartz.man b/hw/darwin/apple/Xquartz.man
new file mode 100644
index 0000000..edac30e
--- /dev/null
+++ b/hw/darwin/apple/Xquartz.man
@@ -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
diff --git a/hw/darwin/apple/bundle-main.c b/hw/darwin/apple/bundle-main.c
new file mode 100644
index 0000000..34cbcba
--- /dev/null
+++ b/hw/darwin/apple/bundle-main.c
@@ -0,0 +1,914 @@
+/* bundle-main.c -- X server launcher
+
+ 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 <xcb/xcb.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/bin/quartz-wm"
+#define DEFAULT_XINITRC "/usr/X11/lib/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];
+ xcb_connection_t *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); */
+ conn = xcb_connect(buf, NULL);
+
+ if (conn == NULL)
+ return FALSE;
+
+ // _XDisconnectDisplay (conn);
+ xcb_disconnect(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;
+}
diff --git a/hw/darwin/bundle/Dutch.lproj/Localizable.strings b/hw/darwin/bundle/Dutch.lproj/Localizable.strings
index 6abd910..4fe16b3 100644
Binary files a/hw/darwin/bundle/Dutch.lproj/Localizable.strings and b/hw/darwin/bundle/Dutch.lproj/Localizable.strings differ
diff --git a/hw/darwin/bundle/Dutch.lproj/Makefile.am b/hw/darwin/bundle/Dutch.lproj/Makefile.am
new file mode 100644
index 0000000..49a3ec5
--- /dev/null
+++ b/hw/darwin/bundle/Dutch.lproj/Makefile.am
@@ -0,0 +1,39 @@
+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 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' | iconv -t UTF-16 > $@
+
+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
+
diff --git a/hw/darwin/bundle/English.lproj/Localizable.strings b/hw/darwin/bundle/English.lproj/Localizable.strings
index 2c25c1d..f2e8e3c 100644
Binary files a/hw/darwin/bundle/English.lproj/Localizable.strings and b/hw/darwin/bundle/English.lproj/Localizable.strings differ
diff --git a/hw/darwin/bundle/English.lproj/Makefile.am b/hw/darwin/bundle/English.lproj/Makefile.am
new file mode 100644
index 0000000..8d6f7e5
--- /dev/null
+++ b/hw/darwin/bundle/English.lproj/Makefile.am
@@ -0,0 +1,39 @@
+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' | iconv -t UTF-16 > $@
+
+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 \
+ InfoPlist.strings.cpp
+
diff --git a/hw/darwin/bundle/French.lproj/Makefile.am b/hw/darwin/bundle/French.lproj/Makefile.am
new file mode 100644
index 0000000..4dca934
--- /dev/null
+++ b/hw/darwin/bundle/French.lproj/Makefile.am
@@ -0,0 +1,41 @@
+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' | iconv -t UTF-16 > $@
+
+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
+
diff --git a/hw/darwin/bundle/German.lproj/Makefile.am b/hw/darwin/bundle/German.lproj/Makefile.am
new file mode 100644
index 0000000..fcb5dd2
--- /dev/null
+++ b/hw/darwin/bundle/German.lproj/Makefile.am
@@ -0,0 +1,39 @@
+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 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' | iconv -t UTF-16 > $@
+
+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
+
diff --git a/hw/darwin/bundle/Info.plist b/hw/darwin/bundle/Info.plist
new file mode 100644
index 0000000..7e17708
--- /dev/null
+++ b/hw/darwin/bundle/Info.plist
@@ -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.X11</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>XDarwin</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>2.0.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>
diff --git a/hw/darwin/bundle/Japanese.lproj/Makefile.am b/hw/darwin/bundle/Japanese.lproj/Makefile.am
new file mode 100644
index 0000000..8d891ed
--- /dev/null
+++ b/hw/darwin/bundle/Japanese.lproj/Makefile.am
@@ -0,0 +1,40 @@
+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' | iconv -t UTF-16 > $@
+
+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
+
diff --git a/hw/darwin/bundle/Makefile.am b/hw/darwin/bundle/Makefile.am
new file mode 100644
index 0000000..dee34fd
--- /dev/null
+++ b/hw/darwin/bundle/Makefile.am
@@ -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
diff --git a/hw/darwin/bundle/Portuguese.lproj/Makefile.am b/hw/darwin/bundle/Portuguese.lproj/Makefile.am
new file mode 100644
index 0000000..540649c
--- /dev/null
+++ b/hw/darwin/bundle/Portuguese.lproj/Makefile.am
@@ -0,0 +1,39 @@
+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' | iconv -t UTF-16 > $@
+
+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
+
diff --git a/hw/darwin/bundle/Spanish.lproj/Makefile.am b/hw/darwin/bundle/Spanish.lproj/Makefile.am
new file mode 100644
index 0000000..978ac35
--- /dev/null
+++ b/hw/darwin/bundle/Spanish.lproj/Makefile.am
@@ -0,0 +1,39 @@
+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' | iconv -t UTF-16 > $@
+
+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
+
diff --git a/hw/darwin/bundle/Swedish.lproj/Makefile.am b/hw/darwin/bundle/Swedish.lproj/Makefile.am
new file mode 100644
index 0000000..3cf542c
--- /dev/null
+++ b/hw/darwin/bundle/Swedish.lproj/Makefile.am
@@ -0,0 +1,39 @@
+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' | iconv -t UTF-16 > $@
+
+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
+
diff --git a/hw/darwin/bundle/ko.lproj/Makefile.am b/hw/darwin/bundle/ko.lproj/Makefile.am
new file mode 100644
index 0000000..a5462ff
--- /dev/null
+++ b/hw/darwin/bundle/ko.lproj/Makefile.am
@@ -0,0 +1,40 @@
+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' | iconv -t UTF-16 > $@
+
+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
+
diff --git a/hw/darwin/iokit/Makefile.am b/hw/darwin/iokit/Makefile.am
new file mode 100644
index 0000000..77227d7
--- /dev/null
+++ b/hw/darwin/iokit/Makefile.am
@@ -0,0 +1,17 @@
+noinst_LIBRARIES = libiokit.a
+
+AM_CFLAGS = @XORG_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
diff --git a/hw/darwin/launcher/Info.plist b/hw/darwin/launcher/Info.plist
new file mode 100644
index 0000000..b5385b6
--- /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
new file mode 100644
index 0000000..d770e61
Binary files /dev/null and b/hw/darwin/launcher/X11.icns differ
diff --git a/hw/darwin/launcher/X11.xcodeproj/project.pbxproj b/hw/darwin/launcher/X11.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..f82552a
--- /dev/null
+++ b/hw/darwin/launcher/X11.xcodeproj/project.pbxproj
@@ -0,0 +1,297 @@
+// !$*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 = {
+ 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",
+ "-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;
+ 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 = "";
+ 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",
+ "-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 0000000..988c04f
--- /dev/null
+++ b/hw/darwin/launcher/bundle-main.c
@@ -0,0 +1,79 @@
+/* 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[5];
+ 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] = command;
+ newargv[4] = 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;
+}
diff --git a/hw/darwin/quartz/Makefile.am b/hw/darwin/quartz/Makefile.am
new file mode 100644
index 0000000..bc6d4fc
--- /dev/null
+++ b/hw/darwin/quartz/Makefile.am
@@ -0,0 +1,57 @@
+noinst_LIBRARIES = libXQuartz.a
+
+AM_CFLAGS = @XORG_CFLAGS@
+AM_OBJCFLAGS = @XORG_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
+XPR = xpr
+endif
+DEFS = @DEFS@ $(AM_DEFS) -DXBINDIR=\"${bindir}\"
+SUBDIRS = cr fullscreen $(XPR)
+
+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
diff --git a/hw/darwin/quartz/cr/Makefile.am b/hw/darwin/quartz/cr/Makefile.am
new file mode 100644
index 0000000..abfac99
--- /dev/null
+++ b/hw/darwin/quartz/cr/Makefile.am
@@ -0,0 +1,21 @@
+noinst_LIBRARIES = libcr.a
+AM_CFLAGS = @XORG_CFLAGS@
+AM_OBJCFLAGS = @XORG_CFLAGS@
+DEFS = @DEFS@ -DDEFER_NSWINDOW
+INCLUDES = @XORG_INCS@ \
+ -I../fullscreen \
+ -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../.. \
+ -I$(top_srcdir)/miext/rootless \
+ -I$(top_srcdir)/miext/rootless/safeAlpha \
+ -I$(top_srcdir)/mi
+
+libcr_a_SOURCES = crAppleWM.m \
+ crFrame.m \
+ crScreen.m \
+ ../fullscreen/quartzCursor.c \
+ XView.m
+
+EXTRA_DIST = \
+ cr.h \
+ XView.h
+
diff --git a/hw/darwin/quartz/fullscreen/Makefile.am b/hw/darwin/quartz/fullscreen/Makefile.am
new file mode 100644
index 0000000..37c767c
--- /dev/null
+++ b/hw/darwin/quartz/fullscreen/Makefile.am
@@ -0,0 +1,9 @@
+noinst_LIBRARIES = libfullscreen.a
+AM_CFLAGS = @XORG_CFLAGS@
+INCLUDES = @XORG_INCS@ -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../..
+
+libfullscreen_a_SOURCES = fullscreen.c \
+ quartzCursor.c
+
+EXTRA_DIST = \
+ quartzCursor.h
diff --git a/hw/darwin/quartz/xpr/Makefile.am b/hw/darwin/quartz/xpr/Makefile.am
new file mode 100644
index 0000000..980c7a4
--- /dev/null
+++ b/hw/darwin/quartz/xpr/Makefile.am
@@ -0,0 +1,30 @@
+noinst_LIBRARIES = libxpr.a
+AM_CFLAGS = @XORG_CFLAGS@
+INCLUDES = @XORG_INCS@ \
+ -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../.. \
+ -I$(top_srcdir)/miext/rootless \
+ -I$(top_srcdir)/miext/rootless/safeAlpha \
+ -I$(top_srcdir)/miext
+
+libxpr_a_SOURCES = \
+ appledri.c \
+ dri.c \
+ xprAppleWM.c \
+ xprCursor.c \
+ xprFrame.c \
+ xprScreen.c \
+ x-hash.c \
+ x-hook.c \
+ x-list.c
+
+xprbundledir = @APPLE_APPLICATIONS_DIR@/Resources/xpr.bundle/Contents/MacOS
+
+EXTRA_DIST = \
+ dri.h \
+ dristruct.h \
+ x-hash.h \
+ x-hook.h \
+ x-list.h \
+ Xplugin.h \
+ xpr.h
+
diff --git a/hw/darwin/quartz/xpr/appledri.h b/hw/darwin/quartz/xpr/appledri.h
new file mode 100644
index 0000000..9c63037
--- /dev/null
+++ b/hw/darwin/quartz/xpr/appledri.h
@@ -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 at valinux.com>
+ * Jens Owen <jens at valinux.com>
+ * Rickard E. (Rik) Faith <faith at 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_ */
+
diff --git a/hw/darwin/quartz/xpr/appledristr.h b/hw/darwin/quartz/xpr/appledristr.h
new file mode 100644
index 0000000..36a2e89
--- /dev/null
+++ b/hw/darwin/quartz/xpr/appledristr.h
@@ -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 at valinux.com>
+ * Jens Owen <jens at valinux.com>
+ * Rickard E. (Rik) Fiath <faith at 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_ */
diff --git a/hw/darwin/utils/Makefile.am b/hw/darwin/utils/Makefile.am
new file mode 100644
index 0000000..92bf151
--- /dev/null
+++ b/hw/darwin/utils/Makefile.am
@@ -0,0 +1,12 @@
+bin_PROGRAMS = dumpkeymap
+
+dumpkeymap_SOURCES = dumpkeymap.c
+
+dumpkeymap_LDFLAGS = -Wl,-framework,IOKit
+
+man1_MANS = dumpkeymap.man
+
+EXTRA_DIST = \
+ README.txt \
+ dumpkeymap.man
+
diff --git a/hw/darwin/utils/event_status_driver.h b/hw/darwin/utils/event_status_driver.h
new file mode 100644
index 0000000..8948f33
--- /dev/null
+++ b/hw/darwin/utils/event_status_driver.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * The contents of this file constitute Original Code as defined in and
+ * are subject to the Apple Public Source License Version 1.1 (the
+ * "License"). You may not use this file except in compliance with the
+ * License. Please obtain a copy of the License at
+ * http://www.apple.com/publicsource and read it before using this file.
+ *
+ * This Original Code and all software distributed under the License are
+ * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+/******************************************************************************
+ event_status_driver.h
+ API for the events status driver.
+ This file contains public API.
+ mpaque 11Oct91
+
+ Copyright 1991 NeXT Computer, Inc.
+
+ Modified:
+
+******************************************************************************/
+
+#ifndef _DRIVERS_EVENT_STATUS_DRIVER_
+#define _DRIVERS_EVENT_STATUS_DRIVER_
+
+__BEGIN_DECLS
+
+#include <mach/port.h>
+#include <IOKit/hidsystem/IOLLEvent.h>
+#include <IOKit/hidsystem/IOHIDTypes.h>
+#include <AvailabilityMacros.h>
+
+/*
+ * Event System Handle:
+ *
+ * Information used by the system between calls to NXOpenEventSystem and
+ * NXCloseEventSystem. The application should not
+ * access any of the elements of this structure.
+ */
+typedef mach_port_t NXEventHandle;
+
+/* Open and Close */
+NXEventHandle NXOpenEventStatus(void);
+void NXCloseEventStatus(NXEventHandle handle);
+
+/* Status */
+extern NXEventSystemInfoType NXEventSystemInfo(NXEventHandle handle,
+ char *flavor,
+ int *evs_info,
+ unsigned int *evs_info_cnt);
+/* Keyboard */
+extern void NXSetKeyRepeatInterval(NXEventHandle handle, double seconds);
+extern double NXKeyRepeatInterval(NXEventHandle handle);
+extern void NXSetKeyRepeatThreshold(NXEventHandle handle, double threshold);
+extern double NXKeyRepeatThreshold(NXEventHandle handle);
+extern void NXResetKeyboard(NXEventHandle handle);
+
+/* Mouse */
+extern void NXSetClickTime(NXEventHandle handle, double seconds);
+extern double NXClickTime(NXEventHandle handle);
+extern void NXSetClickSpace(NXEventHandle handle, _NXSize_ *area);
+extern void NXGetClickSpace(NXEventHandle handle, _NXSize_ *area);
+extern void NXResetMouse(NXEventHandle handle);
+
+/* DEPRECATED API */
+
+/* NXIdleTime has been deprecated as this API does not take into account
+ events posted through the CG API set. Instead, we strongly encourage
+ developers to make use of the CGSSecondsSinceLastInputEvent API. */
+extern double NXIdleTime(NXEventHandle handle)
+AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4;
+
+/* These methods are NOT supported. */
+extern NXKeyMapping *NXSetKeyMapping(NXEventHandle h, NXKeyMapping *keymap)
+AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4;
+
+extern int NXKeyMappingLength(NXEventHandle handle)
+AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4;
+
+extern NXKeyMapping *NXGetKeyMapping(NXEventHandle h, NXKeyMapping *keymap)
+AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4;
+
+/* These methods are NOT supported and will return NULL values. */
+extern void NXSetMouseScaling(NXEventHandle handle, NXMouseScaling *scaling)
+AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4;
+
+extern void NXGetMouseScaling(NXEventHandle handle, NXMouseScaling *scaling)
+AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4;
+
+extern void NXSetAutoDimThreshold(NXEventHandle handle, double seconds)
+AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4;
+
+extern double NXAutoDimThreshold(NXEventHandle handle)
+AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4;
+
+extern double NXAutoDimTime(NXEventHandle handle)
+AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4;
+
+extern void NXSetAutoDimState(NXEventHandle handle, boolean_t dimmed)
+AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4;
+
+extern boolean_t NXAutoDimState(NXEventHandle handle)
+AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4;
+
+extern void NXSetAutoDimBrightness(NXEventHandle handle, double level)
+AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4;
+
+extern double NXAutoDimBrightness(NXEventHandle handle)
+AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4;
+
+extern void NXSetScreenBrightness(NXEventHandle handle, double level)
+AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4;
+
+extern double NXScreenBrightness(NXEventHandle handle)
+AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_4;
+
+/* END DEPRECATED API */
+
+__END_DECLS
+
+#endif /*_DRIVERS_EVENT_STATUS_DRIVER_ */
+
More information about the xorg-commit
mailing list