summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver/hw/darwin/bundle
diff options
context:
space:
mode:
authordawes <dawes>2001-04-09 16:26:57 +0000
committerdawes <dawes>2001-04-09 16:26:57 +0000
commitacda79cb882d0fd8b59b52d61ec88dde275017e2 (patch)
treec4bec0e3e7d2412ae2074b1755b469a26bd48a93 /xc/programs/Xserver/hw/darwin/bundle
parentd95729913540a637b66655271b83288368a59775 (diff)
Initial revision
Diffstat (limited to 'xc/programs/Xserver/hw/darwin/bundle')
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/English.lproj/Credits.rtf10
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/English.lproj/InfoPlist.strings4
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/English.lproj/Localizable.strings14
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/classes.nib39
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/info.nib27
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/objects.nibbin0 -> 6947 bytes
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/English.lproj/XDarwinHelp.html60
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/Imakefile53
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/Credits.rtf10
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/InfoPlist.stringsbin0 -> 412 bytes
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/Localizable.stringsbin0 -> 722 bytes
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/classes.nib39
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/info.nib27
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/objects.nibbin0 -> 7489 bytes
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/XDarwinHelp.html126
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/Preferences.h44
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/Preferences.m177
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/XApplication.h20
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/XApplication.m20
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/XDarwin.icnsbin0 -> 38261 bytes
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/XDarwin.pbproj/project.pbxproj735
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/XDarwinStartup.c71
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/Xserver.h57
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/Xserver.m301
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/quartz.c234
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/quartz.h23
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/quartzAudio.c316
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/quartzAudio.h16
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/quartzCocoa.m78
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/quartzCursor.c310
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/quartzPasteboard.c56
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/quartzPasteboard.h20
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/quartzShared.h38
-rw-r--r--xc/programs/Xserver/hw/darwin/bundle/quartzStartup.c61
34 files changed, 2986 insertions, 0 deletions
diff --git a/xc/programs/Xserver/hw/darwin/bundle/English.lproj/Credits.rtf b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/Credits.rtf
new file mode 100644
index 000000000..a823101ac
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/Credits.rtf
@@ -0,0 +1,10 @@
+{\rtf1\mac\ansicpg10000{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\paperw9240\paperh9000
+\pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural
+
+\f0\fs24 \cf0 John Carmack - Original XFree86 port to Mac OS X Server\
+Dave Zarzycki - XFree86 4.0 port to Darwin 1.0\
+Torrey T. Lyons - Improvements and bug fixes\
+Gregory Robert Parker - Original Quartz implementation\
+Andreas Monitzer - Cocoa version of Xmaster}
diff --git a/xc/programs/Xserver/hw/darwin/bundle/English.lproj/InfoPlist.strings b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/InfoPlist.strings
new file mode 100644
index 000000000..52b64973d
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/InfoPlist.strings
@@ -0,0 +1,4 @@
+/* English localized versions of Info.plist keys. */
+/* Most of these are set in the target application settings. */
+
+NSHumanReadableCopyright = "XFree86 Version 4.0.2 / X Window System";
diff --git a/xc/programs/Xserver/hw/darwin/bundle/English.lproj/Localizable.strings b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/Localizable.strings
new file mode 100644
index 000000000..6e95eccc4
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/Localizable.strings
@@ -0,0 +1,14 @@
+/* English localized versions of strings used by the Mac OS X front end. */
+/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/English.lproj/Localizable.strings,v 1.1 2001/03/27 20:42:39 torrey Exp $ */
+
+/* Title of alert panel */
+"Quit X server?" = "Quit X server?";
+
+/* Text of alert panel */
+"Quitting the X server will terminate any running X Window programs." = "Quitting the X server will terminate any running X Window programs.";
+
+/* Quit */
+"Quit" = "Quit";
+
+/* Cancel */
+"Cancel" = "Cancel";
diff --git a/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/classes.nib b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/classes.nib
new file mode 100644
index 000000000..3c4afe987
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/classes.nib
@@ -0,0 +1,39 @@
+{
+ IBClasses = (
+ {
+ ACTIONS = {showHelp = id; };
+ CLASS = FirstResponder;
+ LANGUAGE = ObjC;
+ SUPERCLASS = NSObject;
+ },
+ {
+ ACTIONS = {close = id; saveChanges = id; setKey = id; };
+ CLASS = Preferences;
+ LANGUAGE = ObjC;
+ OUTLETS = {
+ displayNumber = id;
+ fakeButton = id;
+ keyField = id;
+ splashStartupHelpButton = id;
+ startupHelpButton = id;
+ systemBeepButton = id;
+ window = id;
+ };
+ SUPERCLASS = NSObject;
+ },
+ {
+ CLASS = XApplication;
+ LANGUAGE = ObjC;
+ OUTLETS = {preferences = id; xserver = id; };
+ SUPERCLASS = NSApplication;
+ },
+ {
+ ACTIONS = {applicationWillResignActive = id; closeHelpAndShow = id; };
+ CLASS = Xserver;
+ LANGUAGE = ObjC;
+ OUTLETS = {helpWindow = id; startupHelpButton = id; };
+ SUPERCLASS = NSObject;
+ }
+ );
+ IBVersion = 1;
+} \ No newline at end of file
diff --git a/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/info.nib b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/info.nib
new file mode 100644
index 000000000..7c8a23fe9
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/info.nib
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
+<plist version="0.9">
+<dict>
+ <key>IBDocumentLocation</key>
+ <string>11 9 367 304 0 4 800 574 </string>
+ <key>IBMainMenuLocation</key>
+ <string>19 268 220 44 0 4 800 574 </string>
+ <key>IBUserGuides</key>
+ <dict>
+ <key>HelpPanel</key>
+ <dict>
+ <key>guideLocations</key>
+ <array/>
+ <key>guidesLocked</key>
+ <string>NO</string>
+ </dict>
+ <key>PrefPanel</key>
+ <dict>
+ <key>guideLocations</key>
+ <array/>
+ <key>guidesLocked</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+</dict>
+</plist>
diff --git a/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/objects.nib b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/objects.nib
new file mode 100644
index 000000000..5a21abc46
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/MainMenu.nib/objects.nib
Binary files differ
diff --git a/xc/programs/Xserver/hw/darwin/bundle/English.lproj/XDarwinHelp.html b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/XDarwinHelp.html
new file mode 100644
index 000000000..9b4024ec7
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/English.lproj/XDarwinHelp.html
@@ -0,0 +1,60 @@
+<html>
+<head>
+<title>XFree86 for Mac OS X</title>
+</head>
+<body>
+<center>
+ <h1>XFree86 on Darwin and Mac OS X</h1>
+</center>
+<h2>Contents</h2>
+<ol>
+ <li><A HREF="#notice">Important Notice</A></li>
+ <li><A HREF="#usage">Usage</A></li>
+ <li><A HREF="#path">Setting Your Path</A></li>
+ <li><A HREF="#license">License</A></li>
+</ol>
+<center>
+ <h2><a NAME="notice">Important Notice</a></h2>
+</center>
+<blockquote>This is a pre-release version of XFree86, and is not supported in any way. This software is distributed under the terms of the <A HREF="#license">MIT X11 / X Consortium License</A> and is provided AS IS, with no warranty. Please read the <A HREF="#license">License</A> before using. Bugs may be reported and patches may be submitted to the <A HREF="http://sourceforge.net/projects/xonx/">XonX project page</A> at SourceForge. Before reporting bugs in pre-release versions, please check the latest version from <A HREF="http://sourceforge.net/projects/xonx/">XonX</A> or in the <A HREF="http://www.XFree86.Org/cvs">XFree86 CVS repository</A>.</blockquote>
+<h2><a NAME="usage">Usage</a></h2>
+<p>XFree86 runs on Mac OS X in full screen mode. When the X window desktop is active, it takes over the entire screen. You can switch back to the Mac OS X desktop by holding down Command-Option-A. (This key combination can be changed in the user preferences.) From the Mac OS X desktop, just click on the XDarwin icon in the dock to switch back to the X window desktop.</p>
+<h3>Multi-Button Mouse Emulation</h3>
+<p>Many X11 applications rely on the use of a 3-button mouse. To emulate a 3-button mouse with a single button, select "Enable emulation of multiple mouse buttons" in the Preferences. This will take effect the next time the X server is started. When emulating a 3-button mouse, holding down the left command key and clicking the mouse button will simulate clicking the second mouse button. Holding down the left option key and clicking will simulate the third button.</p>
+<p>Notes:</p>
+<ul>
+ <li>With most keyboards the left and right command and option keys are not differentiated so either will work.
+ <li>Even with command and/or option keys mapped to some other key with xmodmap, you still must use the original command and option keys for multibutton mouse emulation.
+ <li>The only way to simulate holding down the left command key and clicking the second mouse button is to map some other key to be the left command key. The same is true for simulating holding down the left option key and clicking the third mouse button.
+</ul>
+<h2><a NAME="path">Setting Your Path</a></h2>
+<p>The X11 binaries are located in /usr/X11R6/bin, which you may need to add to your path. Your path is the list of directories to be searched for executable commands. The way to do this depends on the shell you are using. With tcsh, you can check your path by typing "printenv PATH". You should see /usr/X11R6/bin listed as one of the directories. If not, you should add it to your default path. To do so, you can add the following line to a file in your home directory called .cshrc: (Create this file if you don't have one yet.)</p>
+<blockquote>setenv PATH "${PATH}:/usr/X11R6/bin"</blockquote>
+<p>Note that you will need to start a new Terminal window for any changes you make in .cshrc to take effect. You may also want to add the man pages from XFree86 to the list of pages to be searched when you are looking for documentation. The X11 man pages are located in /usr/X11R6/man and the MANPATH environment variable contains the list of directories to search.</p>
+<h2><a NAME="license">License</a></h2>
+The XFree86 Project is commited to providing freely redistributable binary and source releases. The main license we use is one based on the traditional MIT X11 / X Consortium License, which doesn't impose any conditions on modification or redistribution of source code or binaries other than requiring that copyright/license notices are left intact. For more information and additional copyright/licensing notices covering some sections of the code, please see the <A HREF="http://www.xfree86.org/legal/licence.html">XFree86
+License page</A>.
+<H3><A NAME="3"></A>X Consortium License</H3>
+<p>Copyright (C) 1996 X Consortium</p>
+<p>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:</p>
+<p>The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.</p>
+<p>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 X CONSORTIUM 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.</p>
+<p>Except as contained in this notice, the name of the X Consortium 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 X Consortium.</p>
+<p>X Window System is a trademark of X Consortium, Inc.</p>
+</body>
+</html>
diff --git a/xc/programs/Xserver/hw/darwin/bundle/Imakefile b/xc/programs/Xserver/hw/darwin/bundle/Imakefile
new file mode 100644
index 000000000..a8c0416ce
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/Imakefile
@@ -0,0 +1,53 @@
+XCOMM $XFree86: xc/programs/Xserver/hw/darwin/bundle/Imakefile,v 1.7 2001/04/02 05:18:50 torrey Exp $
+
+#include <Server.tmpl>
+
+SRCS = Preferences.m \
+ XApplication.m \
+ Xserver.m \
+ quartz.c \
+ quartzAudio.c \
+ quartzCocoa.m \
+ quartzCursor.c \
+ quartzPasteboard.c
+
+OBJS = Preferences.o \
+ XApplication.o \
+ Xserver.o \
+ quartz.o \
+ quartzAudio.o \
+ quartzCocoa.o \
+ quartzCursor.o \
+ quartzPasteboard.o
+
+INCLUDES = -I. -I$(SERVERSRC)/mi -I$(SERVERSRC)/include -I$(XINCLUDESRC) \
+ -I$(FONTINCSRC)
+
+#if defined(XFree86CustomVersion)
+CUSTOMVERSION = XFree86CustomVersion
+CUSTOMVERDEF = -DXF86_CUSTOM_VERSION='$(CUSTOMVERSION)'
+#endif
+
+DEFINES = $(CUSTOMVERDEF) -DXBINDIR=$(DESTDIR)$(BINDIR)
+XDARWINBINDIR = $(DESTDIR)$(BINDIR)/XDarwin.app/Contents/MacOS
+
+NormalLibraryObjectRule()
+NormalLibraryTarget(XQuartz,$(OBJS))
+
+AllTarget(quartzStartup.o)
+
+AllTarget(XDarwinStartup)
+NormalProgramTarget(XDarwinStartup,XDarwinStartup.o,NullParameter, \
+ NullParameter,NullParameter)
+InstallProgram(XDarwinStartup,$(DESTDIR)$(BINDIR))
+install::
+ -(cd $(DESTDIR)$(BINDIR); $(RM) X; $(LN) XDarwinStartup X)
+
+install::
+ pbxbuild install -target XDarwin DSTROOT=$(DESTDIR)$(BINDIR)
+
+clean::
+ pbxbuild "clean" -target XDarwin
+
+DependTarget()
+
diff --git a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/Credits.rtf b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/Credits.rtf
new file mode 100644
index 000000000..452a4a044
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/Credits.rtf
@@ -0,0 +1,10 @@
+{\rtf1\mac\ansicpg10000{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx1440\tx2880\tx4320\tx5760\tx7200\ql\qnatural
+
+\f0\fs24 \cf0 John Carmack - Original XFree86 port to Mac OS X Server\
+Dave Zarzycki - XFree86 4.0 port to Darwin 1.0\
+Torrey T. Lyons - Improvements and bug fixes\
+Gregory Robert Parker - Original Quartz implementation\
+Andreas Monitzer - Cocoa version of Xmaster\
+Toshimitsu Tanaka - Japanese translation}
diff --git a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/InfoPlist.strings b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/InfoPlist.strings
new file mode 100644
index 000000000..600065eb8
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/InfoPlist.strings
Binary files differ
diff --git a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/Localizable.strings b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/Localizable.strings
new file mode 100644
index 000000000..eedf1299d
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/Localizable.strings
Binary files differ
diff --git a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/classes.nib b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/classes.nib
new file mode 100644
index 000000000..3c4afe987
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/classes.nib
@@ -0,0 +1,39 @@
+{
+ IBClasses = (
+ {
+ ACTIONS = {showHelp = id; };
+ CLASS = FirstResponder;
+ LANGUAGE = ObjC;
+ SUPERCLASS = NSObject;
+ },
+ {
+ ACTIONS = {close = id; saveChanges = id; setKey = id; };
+ CLASS = Preferences;
+ LANGUAGE = ObjC;
+ OUTLETS = {
+ displayNumber = id;
+ fakeButton = id;
+ keyField = id;
+ splashStartupHelpButton = id;
+ startupHelpButton = id;
+ systemBeepButton = id;
+ window = id;
+ };
+ SUPERCLASS = NSObject;
+ },
+ {
+ CLASS = XApplication;
+ LANGUAGE = ObjC;
+ OUTLETS = {preferences = id; xserver = id; };
+ SUPERCLASS = NSApplication;
+ },
+ {
+ ACTIONS = {applicationWillResignActive = id; closeHelpAndShow = id; };
+ CLASS = Xserver;
+ LANGUAGE = ObjC;
+ OUTLETS = {helpWindow = id; startupHelpButton = id; };
+ SUPERCLASS = NSObject;
+ }
+ );
+ IBVersion = 1;
+} \ No newline at end of file
diff --git a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/info.nib b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/info.nib
new file mode 100644
index 000000000..e2f8cf545
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/info.nib
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
+<plist version="0.9">
+<dict>
+ <key>IBDocumentLocation</key>
+ <string>14 4 367 304 0 4 800 574 </string>
+ <key>IBMainMenuLocation</key>
+ <string>18 269 262 44 0 4 800 574 </string>
+ <key>IBUserGuides</key>
+ <dict>
+ <key>HelpPanel</key>
+ <dict>
+ <key>guideLocations</key>
+ <array/>
+ <key>guidesLocked</key>
+ <string>NO</string>
+ </dict>
+ <key>PrefPanel</key>
+ <dict>
+ <key>guideLocations</key>
+ <array/>
+ <key>guidesLocked</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+</dict>
+</plist>
diff --git a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/objects.nib b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/objects.nib
new file mode 100644
index 000000000..1d79a36c7
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/MainMenu.nib/objects.nib
Binary files differ
diff --git a/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/XDarwinHelp.html b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/XDarwinHelp.html
new file mode 100644
index 000000000..b4b1a4741
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/XDarwinHelp.html
@@ -0,0 +1,126 @@
+<!-- $XFree86: xc/programs/Xserver/hw/darwin/bundle/Japanese.lproj/XDarwinHelp.html,v 1.2 2001/04/05 06:08:47 torrey Exp $ -->
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=EUC-JP">
+<title>
+XFree86 for Mac OS X</title></head>
+<body>
+<center>
+<h1>
+Darwin と Mac OS X 上の XFree86
+</h1>
+</center>
+<h2>
+目次
+</h2>
+<ol>
+<li>
+<A HREF="#notice">注意事項</A>
+</li>
+<li>
+<A HREF="#usage">使用法</A>
+</li>
+<li>
+<A HREF="#path">パスの設定</A>
+</li>
+<li>
+<A HREF="#license">ライセンス</A>
+</li>
+</ol>
+<center>
+<h2>
+<a NAME="notice">注意事項</a>
+</h2>
+</center>
+<blockquote>
+これは,XFree86 のプレリリースバージョンであり,いかなる場合においてもサポートされません。
+本ソフトウェアは,<A HREF="#license">MIT X11/X Consortium License</A> の条件に基づき,保証無しで,「そのまま」の形で供給されます。
+ご使用になる前に,<A HREF="#license">ライセンス</A>を読んで下さい。
+バグの報告やパッチが SourceForge の <A HREF="http://sourceforge.net/projects/xonx/">XonX プロジェクトページ</A>に提出されているかもしれません。
+プレリリースバージョンのバグを報告する前に,<A HREF="http://sourceforge.net/projects/xonx/">XonX</A> プロジェクトページまたは <A HREF="http://www.XFree86.Org/cvs">XFree86 CVS 倉庫</A>で最新版のチェックをして下さい。
+</blockquote>
+<h2>
+<a NAME="usage">使用法</a>
+</h2>
+<p>
+Mac OS X 上で,XFree86はフルスクリーンモードで動作します。
+X Window デスクトップがアクティブな時,それは全画面を占有します。
+あなたは,Command-Option-A キーを押すことによって Mac OS X デスクトップへ切り替えることができます。
+(このキーの組み合わせは,環境設定で変更可能です)
+Mac OS X デスクトップから,X Window デスクトップへ切り替える場合は,ドックに表示された XDarwin アイコンをクリックして下さい。
+</p>
+<h3>
+複数ボタンマウスのエミュレーション
+</h3>
+<p>
+多くの X11 アプリケーションは,3 ボタンマウスを必要とします。
+1 ボタンマウスで 3 ボタンマウスをエミュレーションするには,環境設定で「複数ボタンマウスのエミュレーションを有効にする」を選択します。
+これは,次回の X サーバーの起動時より有効となります。
+
+3 ボタンマウスをエミュレーションする時,左のコマンドキーを押しながらマウスボタンをクリックすることは第 2 マウスボタンのクリックに相当します。左のオプションキーを押しながらクリックすることは第 3 マウスボタンのクリックに相当します。
+</p>
+<p>
+注:
+</p>
+<ul>
+<li>
+多くのキーボードでは,左右のコマンドキーとオプションキーは区別されず,同じ動作をします。
+<li>
+xmodmap でコマンドキーやオプションキーを他のキーに割り当てている場合でも,複数ボタンマウスのエミュレーションでは本来のコマンドキーやオプションキーを使わなければなりません。
+<li>
+左のコマンドキーを押しながら第 2 マウスボタンをクリックすることを実現するには,左のコマンドキーを他のキーに割り当てる必要があります。左のオプションキーを押しながら第 3 マウスボタンをクリックする場合も同様です。
+</ul>
+<h2>
+<a NAME="path">パスの設定</a>
+</h2>
+<p>
+X11 バイナリは,/usr/X11R6/bin に置かれます。あなたはそれをパスに加える必要があるかもしれません。
+パスは, 実行可能なコマンドを検索するディレクトリのリストです。
+これを確認する方法は,使用しているシェルに依存します。
+tcsh では,「printenv PATH」とタイプすることでパスをチェックすることができます。
+パスをチェックした時,/usr/X11R6/bin がディレクトリのひとつとして表示されなければなりません。
+もしそうでなければ,あなたはそれをデフォルトのパスに追加する必要があります。
+そのために,あなたのホームディレクトリにある「.cshrc」という名称のファイルに次の行を追加して下さい。
+(もしこのファイルがまだ無ければ作成して下さい)
+</p>
+<blockquote>
+setenv PATH "${PATH}:/usr/X11R6/bin"
+</blockquote>
+<p>
+「.cshrc」ファイルへの変更を有効にするためには,新たに Terminal ウィンドウを開始する必要があることに注意して下さい。
+また,あなたはドキュメントを探している時,XFree86 のマニュアルページを検索されるページのリストに追加したいと思うかもしれません。
+X11 のマニュアルページは /usr/X11R6/man に置かれます。そして MANPATH 環境変数は検索するディレクトリのリストを含んでいます。
+</p>
+<h2>
+<a NAME="license">ライセンス</a>
+</h2>
+XFree86 Project は,自由に再配布可能なバイナリとソースコードを提供することを約束します。
+私たちが使用する主なライセンスは,伝統的な MIT X11/X Consortium License に基づくものです。
+そして,それは修正または再配布されるソースコードまたはバイナリに,その Copyright/ライセンス告示がそのまま残されることを要求する以外の条件を強制しません。
+より多くの情報と,コードの一部をカバーする追加の Copyright/ライセンス告示のために,<A HREF="http://www.xfree86.org/legal/licence.html">XFree86 の License ページ</A>を参照して下さい。
+<H3>
+<A NAME="3"></A>
+X Consortium License</H3>
+<p>Copyright (C) 1996 X Consortium</p>
+<p>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:</p>
+<p>The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.</p>
+<p>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 X CONSORTIUM 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.</p>
+<p>Except as contained in this notice, the name of the X Consortium 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 X Consortium.</p>
+<p>X Window System is a trademark of X Consortium, Inc.</p>
+</body>
+</html>
diff --git a/xc/programs/Xserver/hw/darwin/bundle/Preferences.h b/xc/programs/Xserver/hw/darwin/bundle/Preferences.h
new file mode 100644
index 000000000..f2a6ba724
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/Preferences.h
@@ -0,0 +1,44 @@
+/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/Preferences.h,v 1.2 2001/04/05 06:08:46 torrey Exp $ */
+
+#import <Cocoa/Cocoa.h>
+
+@interface Preferences : NSObject
+{
+ IBOutlet NSPanel *window;
+ IBOutlet id keyField;
+ IBOutlet id fakeButton;
+ IBOutlet id displayNumber;
+ IBOutlet id startupHelpButton;
+ IBOutlet id systemBeepButton;
+ IBOutlet id splashStartupHelpButton;
+
+ BOOL isGettingKeyCode;
+ int keyCode;
+ int modifiers;
+ NSMutableString *switchString;
+}
+- (IBAction)close:(id)sender;
+- (IBAction)saveChanges:(id)sender;
+- (IBAction)setKey:(id)sender;
+
+- (BOOL)sendEvent:(NSEvent*)anEvent;
+
+- (void)awakeFromNib;
+
++ (void)setSwitchString:(NSString*)newString;
++ (void)setKeyCode:(int)newKeyCode;
++ (void)setModifiers:(int)newModifiers;
++ (void)setDisplay:(int)newDisplay;
++ (void)setFakeButtons:(BOOL)newFakeButtons;
++ (void)setStartupHelp:(BOOL)newStartupHelp;
++ (void)setSystemBeep:(BOOL)newSystemBeep;
+
++ (NSString*)switchString;
++ (unsigned int)keyCode;
++ (unsigned int)modifiers;
++ (int)display;
++ (BOOL)fakeButtons;
++ (BOOL)startupHelp;
++ (BOOL)systemBeep;
+
+@end
diff --git a/xc/programs/Xserver/hw/darwin/bundle/Preferences.m b/xc/programs/Xserver/hw/darwin/bundle/Preferences.m
new file mode 100644
index 000000000..968f9aff7
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/Preferences.m
@@ -0,0 +1,177 @@
+//
+// Preferences.m
+//
+// This class keeps track of the user preferences.
+//
+/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/Preferences.m,v 1.2 2001/04/05 06:08:46 torrey Exp $ */
+
+#import "Preferences.h"
+#import "quartzShared.h"
+
+@implementation Preferences
+
+// Initialize internal state info of switch key button
+- (void)initSwitchKey {
+ keyCode = [Preferences keyCode];
+ modifiers = [Preferences modifiers];
+ [switchString setString:[Preferences switchString]];
+}
+
+- (id)init {
+ self=[super init];
+
+ isGettingKeyCode=NO;
+ switchString=[[NSMutableString alloc] init];
+
+ // Provide user defaults if needed
+ if([[NSUserDefaults standardUserDefaults] stringForKey:@"SwitchKeyCode"]==nil) {
+ [Preferences setKeyCode:0];
+ [Preferences setModifiers:(NSCommandKeyMask | NSAlternateKeyMask)];
+ [Preferences setSwitchString:@"Cmd-Opt-a"];
+ [Preferences setDisplay:0];
+ [Preferences setFakeButtons:YES];
+ [Preferences setStartupHelp:YES];
+ [Preferences setSystemBeep:NO];
+ }
+
+ [self initSwitchKey];
+
+ return self;
+}
+
+// Set the window controls to the state in user defaults
+- (void)resetWindow {
+ [keyField setTitle:[Preferences switchString]];
+ [displayNumber setIntValue:[Preferences display]];
+ [fakeButton setIntValue:[Preferences fakeButtons]];
+ [startupHelpButton setIntValue:[Preferences startupHelp]];
+ [systemBeepButton setIntValue:[Preferences systemBeep]];
+}
+
+- (void)awakeFromNib {
+ [self resetWindow];
+ [splashStartupHelpButton setIntValue:[Preferences startupHelp]];
+}
+
+// User cancelled the changes
+- (IBAction)close:(id)sender
+{
+ [window orderOut:nil];
+ [self resetWindow]; // reset window controls
+ [self initSwitchKey]; // reset switch key state
+}
+
+// User saved changes
+- (IBAction)saveChanges:(id)sender
+{
+ [Preferences setKeyCode:keyCode];
+ [Preferences setModifiers:modifiers];
+ [Preferences setSwitchString:switchString];
+ [Preferences setDisplay:[displayNumber intValue]];
+ [Preferences setFakeButtons:[fakeButton intValue]];
+ [Preferences setStartupHelp:[startupHelpButton intValue]];
+ [Preferences setSystemBeep:[systemBeepButton intValue]];
+
+ // Update the settings used by the X server thread
+ quartzUseSysBeep = [Preferences systemBeep];
+ darwinFakeButtons = [Preferences fakeButton];
+
+ [window orderOut:nil];
+}
+
+- (IBAction)setKey:(id)sender
+{
+ [keyField setTitle:@"Press key"];
+ isGettingKeyCode=YES;
+ [switchString setString:@""];
+}
+
+- (BOOL)sendEvent:(NSEvent*)anEvent {
+ if(isGettingKeyCode) {
+ if([anEvent type]==NSKeyDown) //wait for keyup
+ return YES;
+ if([anEvent type]!=NSKeyUp)
+ return NO;
+
+ if([anEvent modifierFlags] & NSCommandKeyMask)
+ [switchString appendString:@"Cmd-"];
+ if([anEvent modifierFlags] & NSControlKeyMask)
+ [switchString appendString:@"Ctrl-"];
+ if([anEvent modifierFlags] & NSAlternateKeyMask)
+ [switchString appendString:@"Opt-"];
+ if([anEvent modifierFlags] & NSNumericPadKeyMask) // doesn't work
+ [switchString appendString:@"Num-"];
+ if([anEvent modifierFlags] & NSHelpKeyMask)
+ [switchString appendString:@"Help-"];
+ if([anEvent modifierFlags] & NSFunctionKeyMask) // powerbooks only
+ [switchString appendString:@"Fn-"];
+
+ [switchString appendString:[anEvent charactersIgnoringModifiers]];
+ [keyField setTitle:switchString];
+
+ keyCode = [anEvent keyCode];
+ modifiers = [anEvent modifierFlags];
+ isGettingKeyCode=NO;
+
+ return YES;
+ }
+ return NO;
+}
+
++ (void)setSwitchString:(NSString*)newString {
+ [[NSUserDefaults standardUserDefaults] setObject:newString forKey:@"SwitchString"];
+}
+
++ (void)setKeyCode:(int)newKeyCode {
+ [[NSUserDefaults standardUserDefaults] setInteger:newKeyCode forKey:@"SwitchKeyCode"];
+}
+
++ (void)setModifiers:(int)newModifiers {
+ [[NSUserDefaults standardUserDefaults] setInteger:newModifiers forKey:@"SwitchModifiers"];
+}
+
++ (void)setDisplay:(int)newDisplay {
+ [[NSUserDefaults standardUserDefaults] setInteger:newDisplay forKey:@"Display"];
+}
+
++ (void)setFakeButtons:(BOOL)newFakeButtons {
+ [[NSUserDefaults standardUserDefaults] setBool:newFakeButtons forKey:@"FakeButtons"];
+}
+
++ (void)setStartupHelp:(BOOL)newStartupHelp {
+ [[NSUserDefaults standardUserDefaults] setBool:newStartupHelp forKey:@"ShowStartupHelp"];
+}
+
++ (void)setSystemBeep:(BOOL)newSystemBeep {
+ [[NSUserDefaults standardUserDefaults] setBool:newSystemBeep forKey:@"UseSystemBeep"];
+}
+
++ (NSString*)switchString {
+ return [[NSUserDefaults standardUserDefaults] stringForKey:@"SwitchString"];
+}
+
++ (unsigned int)keyCode {
+ return [[NSUserDefaults standardUserDefaults] integerForKey:@"SwitchKeyCode"];
+}
+
++ (unsigned int)modifiers {
+ return [[NSUserDefaults standardUserDefaults] integerForKey:@"SwitchModifiers"];
+}
+
++ (int)display {
+ return [[NSUserDefaults standardUserDefaults] integerForKey:@"Display"];
+}
+
++ (BOOL)fakeButtons {
+ return [[NSUserDefaults standardUserDefaults] boolForKey:@"FakeButtons"];
+}
+
++ (BOOL)startupHelp {
+ return [[NSUserDefaults standardUserDefaults] boolForKey:@"ShowStartupHelp"];
+}
+
++ (BOOL)systemBeep {
+ return [[NSUserDefaults standardUserDefaults] boolForKey:@"UseSystemBeep"];
+}
+
+@end
diff --git a/xc/programs/Xserver/hw/darwin/bundle/XApplication.h b/xc/programs/Xserver/hw/darwin/bundle/XApplication.h
new file mode 100644
index 000000000..40b2046eb
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/XApplication.h
@@ -0,0 +1,20 @@
+//
+// NSXApplication.h
+// Xmaster project
+//
+// Created by Andreas Monitzer on January 6, 2001.
+//
+
+#import <Cocoa/Cocoa.h>
+
+#import "Xserver.h"
+#import "Preferences.h"
+
+@interface XApplication : NSApplication {
+ IBOutlet Xserver *xserver;
+ IBOutlet Preferences *preferences;
+}
+
+- (void)sendEvent:(NSEvent *)anEvent;
+
+@end
diff --git a/xc/programs/Xserver/hw/darwin/bundle/XApplication.m b/xc/programs/Xserver/hw/darwin/bundle/XApplication.m
new file mode 100644
index 000000000..4920e0688
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/XApplication.m
@@ -0,0 +1,20 @@
+//
+// XApplication.m
+// Xmaster project
+//
+// Created by Andreas Monitzer on January 6, 2001.
+//
+
+#import "XApplication.h"
+
+
+@implementation XApplication
+
+- (void)sendEvent:(NSEvent*)anEvent {
+ if(![xserver translateEvent:anEvent]) {
+ if(![preferences sendEvent:anEvent])
+ [super sendEvent:anEvent];
+ }
+}
+
+@end
diff --git a/xc/programs/Xserver/hw/darwin/bundle/XDarwin.icns b/xc/programs/Xserver/hw/darwin/bundle/XDarwin.icns
new file mode 100644
index 000000000..36b0c834d
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/XDarwin.icns
Binary files differ
diff --git a/xc/programs/Xserver/hw/darwin/bundle/XDarwin.pbproj/project.pbxproj b/xc/programs/Xserver/hw/darwin/bundle/XDarwin.pbproj/project.pbxproj
new file mode 100644
index 000000000..877e20104
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/XDarwin.pbproj/project.pbxproj
@@ -0,0 +1,735 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 32;
+ objects = {
+ 01279092000747AA0A000002 = {
+ isa = PBXFileReference;
+ path = Xserver.m;
+ refType = 4;
+ };
+ 0127909600074AF60A000002 = {
+ isa = PBXFileReference;
+ path = XApplication.m;
+ refType = 4;
+ };
+ 0127909800074B1A0A000002 = {
+ isa = PBXFileReference;
+ path = XApplication.h;
+ refType = 4;
+ };
+ 015698ED003DF345CE6F79C2 = {
+ isa = PBXFileReference;
+ path = XDarwin.icns;
+ refType = 4;
+ };
+ 0157A37D002CF6D7CE6F79C2 = {
+ children = (
+ 0157A37E002CF6D7CE6F79C2,
+ 43B962E200617B93416877C2,
+ );
+ isa = PBXVariantGroup;
+ name = Credits.rtf;
+ path = "";
+ refType = 4;
+ };
+ 0157A37E002CF6D7CE6F79C2 = {
+ isa = PBXFileReference;
+ name = English;
+ path = English.lproj/Credits.rtf;
+ refType = 4;
+ };
+ 015EDCC000420083CE6F79C2 = {
+ isa = PBXFileReference;
+ name = libdix.a;
+ path = dix/libdix.a;
+ refType = 4;
+ };
+ 015EDCC20042012ACE6F79C2 = {
+ isa = PBXFileReference;
+ name = libos.a;
+ path = os/libos.a;
+ refType = 4;
+ };
+ 015EDCC400420160CE6F79C2 = {
+ isa = PBXFileReference;
+ name = libXau.a;
+ path = ../../lib/Xau/libXau.a;
+ refType = 4;
+ };
+ 015EDCC60042017CCE6F79C2 = {
+ isa = PBXFileReference;
+ name = libXdmcp.a;
+ path = ../../lib/Xdmcp/libXdmcp.a;
+ refType = 4;
+ };
+ 015EDCC8004201A8CE6F79C2 = {
+ isa = PBXFileReference;
+ name = libdarwin.a;
+ path = hw/darwin/libdarwin.a;
+ refType = 4;
+ };
+ 015EDCCA004201C1CE6F79C2 = {
+ isa = PBXFileReference;
+ name = libcfb.a;
+ path = cfb/libcfb.a;
+ refType = 4;
+ };
+ 015EDCCC004201E4CE6F79C2 = {
+ isa = PBXFileReference;
+ name = libcfb16.a;
+ path = cfb16/libcfb16.a;
+ refType = 4;
+ };
+ 015EDCCE004201F2CE6F79C2 = {
+ isa = PBXFileReference;
+ name = libcfb.a;
+ path = cfb/libcfb.a;
+ refType = 4;
+ };
+ 015EDCD0004201FCCE6F79C2 = {
+ isa = PBXFileReference;
+ name = libcfb32.a;
+ path = cfb32/libcfb32.a;
+ refType = 4;
+ };
+ 015EDCD20042020BCE6F79C2 = {
+ isa = PBXFileReference;
+ name = libcfb.a;
+ path = cfb/libcfb.a;
+ refType = 4;
+ };
+ 015EDCD400420227CE6F79C2 = {
+ isa = PBXFileReference;
+ name = libmfb.a;
+ path = mfb/libmfb.a;
+ refType = 4;
+ };
+ 015EDCD60042023DCE6F79C2 = {
+ isa = PBXFileReference;
+ name = libxpstubs.a;
+ path = dix/libxpstubs.a;
+ refType = 4;
+ };
+ 015EDCD80042024ECE6F79C2 = {
+ isa = PBXFileReference;
+ name = libmi.a;
+ path = mi/libmi.a;
+ refType = 4;
+ };
+ 015EDCDA00420266CE6F79C2 = {
+ isa = PBXFileReference;
+ name = libext.a;
+ path = Xext/libext.a;
+ refType = 4;
+ };
+ 015EDCDC00420279CE6F79C2 = {
+ isa = PBXFileReference;
+ name = libxkb.a;
+ path = xkb/libxkb.a;
+ refType = 4;
+ };
+ 015EDCDE00420295CE6F79C2 = {
+ isa = PBXFileReference;
+ name = liblbx.a;
+ path = lbx/liblbx.a;
+ refType = 4;
+ };
+ 015EDCE0004202BACE6F79C2 = {
+ isa = PBXFileReference;
+ name = liblbxutil.a;
+ path = ../../lib/lbxutil/liblbxutil.a;
+ refType = 4;
+ };
+ 015EDCE2004202DECE6F79C2 = {
+ isa = PBXFileReference;
+ name = libdbe.a;
+ path = dbe/libdbe.a;
+ refType = 4;
+ };
+ 015EDCE4004202F2CE6F79C2 = {
+ isa = PBXFileReference;
+ name = librecord.a;
+ path = record/librecord.a;
+ refType = 4;
+ };
+ 015EDCE600420319CE6F79C2 = {
+ isa = PBXFileReference;
+ name = libXfont.a;
+ path = ../../lib/font/libXfont.a;
+ refType = 4;
+ };
+ 015EDCE800420346CE6F79C2 = {
+ isa = PBXFileReference;
+ name = libxpstubs.a;
+ path = dix/libxpstubs.a;
+ refType = 4;
+ };
+ 015EDCEA004203A8CE6F79C2 = {
+ isa = PBXFrameworkReference;
+ name = IOKit.framework;
+ path = /System/Library/Frameworks/IOKit.framework;
+ refType = 0;
+ };
+ 018F40F2003E1902CE6F79C2 = {
+ children = (
+ 018F40F3003E1916CE6F79C2,
+ 021D6BA9003E1BACCE6F79C2,
+ 018F40F6003E1974CE6F79C2,
+ );
+ isa = PBXGroup;
+ name = "X Server";
+ path = ..;
+ refType = 2;
+ };
+ 018F40F3003E1916CE6F79C2 = {
+ isa = PBXFileReference;
+ path = darwin.c;
+ refType = 4;
+ };
+ 018F40F6003E1974CE6F79C2 = {
+ isa = PBXFileReference;
+ path = darwinKeyboard.c;
+ refType = 4;
+ };
+ 018F40F8003E1979CE6F79C2 = {
+ isa = PBXFileReference;
+ path = quartz.c;
+ refType = 4;
+ };
+ 018F40FA003E197ECE6F79C2 = {
+ isa = PBXFileReference;
+ path = quartz.h;
+ refType = 4;
+ };
+ 018F40FC003E1983CE6F79C2 = {
+ isa = PBXFileReference;
+ path = xfIOKit.c;
+ refType = 4;
+ };
+ 018F40FE003E1988CE6F79C2 = {
+ isa = PBXFileReference;
+ path = xfIOKit.h;
+ refType = 4;
+ };
+ 018F4100003E19E4CE6F79C2 = {
+ isa = PBXFileReference;
+ path = xfIOKitCursor.c;
+ refType = 4;
+ };
+ 021D6BA9003E1BACCE6F79C2 = {
+ isa = PBXFileReference;
+ path = darwin.h;
+ refType = 4;
+ };
+ 02A1FEA6006D34BE416877C2 = {
+ isa = PBXFileReference;
+ path = xfIOKitStartup.c;
+ refType = 4;
+ };
+ 02A1FEA8006D38F0416877C2 = {
+ isa = PBXFileReference;
+ path = quartzStartup.c;
+ refType = 4;
+ };
+ 02E03CA000348209CE6F79C2 = {
+ children = (
+ 02E03CA100348209CE6F79C2,
+ 43B962E300617B93416877C2,
+ );
+ isa = PBXVariantGroup;
+ name = XDarwinHelp.html;
+ path = "";
+ refType = 4;
+ };
+ 02E03CA100348209CE6F79C2 = {
+ isa = PBXFileReference;
+ name = English;
+ path = English.lproj/XDarwinHelp.html;
+ refType = 4;
+ };
+ 04329610000763920A000002 = {
+ isa = PBXFileReference;
+ path = Preferences.m;
+ refType = 4;
+ };
+ 04329611000763920A000002 = {
+ isa = PBXFileReference;
+ path = Preferences.h;
+ refType = 4;
+ };
+ 06EB6C3B004099E7CE6F79C2 = {
+ isa = PBXFileReference;
+ path = quartzShared.h;
+ refType = 4;
+ };
+ 080E96DDFE201D6D7F000001 = {
+ children = (
+ 01279092000747AA0A000002,
+ 1C4A3109004D8F24CE6F79C2,
+ 0127909600074AF60A000002,
+ 0127909800074B1A0A000002,
+ 04329610000763920A000002,
+ 04329611000763920A000002,
+ );
+ isa = PBXGroup;
+ name = Classes;
+ refType = 4;
+ };
+ 089C165CFE840E0CC02AAC07 = {
+ children = (
+ 089C165DFE840E0CC02AAC07,
+ 43B962E100617B49416877C2,
+ );
+ isa = PBXVariantGroup;
+ name = InfoPlist.strings;
+ refType = 4;
+ };
+ 089C165DFE840E0CC02AAC07 = {
+ isa = PBXFileReference;
+ name = English;
+ path = English.lproj/InfoPlist.strings;
+ refType = 4;
+ };
+ 0A79E19E004499A1CE6F79C2 = {
+ isa = PBXApplicationReference;
+ path = XDarwin.app;
+ refType = 3;
+ };
+ 0A79E19F004499A1CE6F79C2 = {
+ buildPhases = (
+ 0A79E1A0004499A1CE6F79C2,
+ 0A79E1A1004499A1CE6F79C2,
+ 0A79E1A2004499A1CE6F79C2,
+ 0A79E1A3004499A1CE6F79C2,
+ 0A79E1A4004499A1CE6F79C2,
+ );
+ buildSettings = {
+ INSTALL_PATH = "";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = XDarwin;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
+ WRAPPER_EXTENSION = app;
+ };
+ conditionalBuildSettings = {
+ };
+ dependencies = (
+ );
+ isa = PBXApplicationTarget;
+ name = XDarwin;
+ productInstallPath = "";
+ productName = XDarwin;
+ productReference = 0A79E19E004499A1CE6F79C2;
+ productSettingsXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
+<!DOCTYPE plist SYSTEM \"file://localhost/System/Library/DTDs/PropertyList.dtd\">
+<plist version=\"0.9\">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>XDarwin</string>
+ <key>CFBundleGetInfoString</key>
+ <string>XFree86 Version 4.1</string>
+ <key>CFBundleIconFile</key>
+ <string>XDarwin.icns</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.xfree86.XDarwin</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>XDarwin</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>XDarwin (v0.5)</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>0.5</string>
+ <key>NSHelpFile</key>
+ <string>XDarwinHelp.html</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>XApplication</string>
+</dict>
+</plist>
+";
+ shouldUseHeadermap = 0;
+ };
+ 0A79E1A0004499A1CE6F79C2 = {
+ buildActionMask = 2147483647;
+ files = (
+ );
+ isa = PBXHeadersBuildPhase;
+ name = Headers;
+ };
+ 0A79E1A1004499A1CE6F79C2 = {
+ buildActionMask = 2147483647;
+ files = (
+ 0A79E1A600449EB2CE6F79C2,
+ 0A79E1A700449EB2CE6F79C2,
+ 0A79E1A800449EB2CE6F79C2,
+ 0A79E1A900449EB2CE6F79C2,
+ 0A79E1AA00449EB2CE6F79C2,
+ 1220774500712D2D416877C2,
+ );
+ isa = PBXResourcesBuildPhase;
+ name = "Bundle Resources";
+ };
+ 0A79E1A2004499A1CE6F79C2 = {
+ buildActionMask = 2147483647;
+ files = (
+ );
+ isa = PBXSourcesBuildPhase;
+ name = Sources;
+ };
+ 0A79E1A3004499A1CE6F79C2 = {
+ buildActionMask = 2147483647;
+ files = (
+ );
+ isa = PBXFrameworksBuildPhase;
+ name = "Frameworks & Libraries";
+ };
+ 0A79E1A4004499A1CE6F79C2 = {
+ buildActionMask = 2147483647;
+ files = (
+ );
+ isa = PBXRezBuildPhase;
+ name = "ResourceManager Resources";
+ };
+ 0A79E1A600449EB2CE6F79C2 = {
+ fileRef = 29B97318FDCFA39411CA2CEA;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ 0A79E1A700449EB2CE6F79C2 = {
+ fileRef = 089C165CFE840E0CC02AAC07;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ 0A79E1A800449EB2CE6F79C2 = {
+ fileRef = 0157A37D002CF6D7CE6F79C2;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ 0A79E1A900449EB2CE6F79C2 = {
+ fileRef = 02E03CA000348209CE6F79C2;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ 0A79E1AA00449EB2CE6F79C2 = {
+ fileRef = 015698ED003DF345CE6F79C2;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ 1058C7A0FEA54F0111CA2CBB = {
+ children = (
+ 1058C7A1FEA54F0111CA2CBB,
+ 1BE4F84D0006C9890A000002,
+ 015EDCEA004203A8CE6F79C2,
+ );
+ isa = PBXGroup;
+ name = "Linked Frameworks";
+ refType = 4;
+ };
+ 1058C7A1FEA54F0111CA2CBB = {
+ isa = PBXFrameworkReference;
+ name = Cocoa.framework;
+ path = /System/Library/Frameworks/Cocoa.framework;
+ refType = 0;
+ };
+ 1058C7A2FEA54F0111CA2CBB = {
+ children = (
+ 29B97325FDCFA39411CA2CEA,
+ 29B97324FDCFA39411CA2CEA,
+ );
+ isa = PBXGroup;
+ name = "Other Frameworks";
+ refType = 4;
+ };
+ 1220774300712D2D416877C2 = {
+ children = (
+ 1220774400712D2D416877C2,
+ 1220774600712D75416877C2,
+ );
+ isa = PBXVariantGroup;
+ name = Localizable.strings;
+ path = "";
+ refType = 4;
+ };
+ 1220774400712D2D416877C2 = {
+ isa = PBXFileReference;
+ name = English;
+ path = English.lproj/Localizable.strings;
+ refType = 4;
+ };
+ 1220774500712D2D416877C2 = {
+ fileRef = 1220774300712D2D416877C2;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ 1220774600712D75416877C2 = {
+ isa = PBXFileReference;
+ name = Japanese;
+ path = Japanese.lproj/Localizable.strings;
+ refType = 4;
+ };
+ 170DFAFF00729A35416877C2 = {
+ isa = PBXFileReference;
+ path = XDarwinStartup.c;
+ refType = 4;
+ };
+ 170DFB0000729C86416877C2 = {
+ children = (
+ 018F40FC003E1983CE6F79C2,
+ 018F40FE003E1988CE6F79C2,
+ 018F4100003E19E4CE6F79C2,
+ 02A1FEA6006D34BE416877C2,
+ );
+ isa = PBXGroup;
+ name = "IOKit Support";
+ path = ..;
+ refType = 2;
+ };
+ 19C28FACFE9D520D11CA2CBB = {
+ children = (
+ 0A79E19E004499A1CE6F79C2,
+ );
+ isa = PBXGroup;
+ name = Products;
+ refType = 4;
+ };
+ 1BE4F84D0006C9890A000002 = {
+ isa = PBXFrameworkReference;
+ name = Carbon.framework;
+ path = /System/Library/Frameworks/Carbon.framework;
+ refType = 0;
+ };
+ 1C4A3109004D8F24CE6F79C2 = {
+ isa = PBXFileReference;
+ path = Xserver.h;
+ refType = 4;
+ };
+ 237A34C10076E37E7F000001 = {
+ isa = PBXFileReference;
+ path = quartzAudio.c;
+ refType = 4;
+ };
+ 237A34C20076E37E7F000001 = {
+ buildRules = (
+ );
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ };
+ isa = PBXBuildStyle;
+ name = Development;
+ };
+ 237A34C30076E37E7F000001 = {
+ buildRules = (
+ );
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ };
+ isa = PBXBuildStyle;
+ name = Deployment;
+ };
+ 237A34C40076F4F07F000001 = {
+ isa = PBXFileReference;
+ path = quartzAudio.h;
+ refType = 4;
+ };
+ 29B97313FDCFA39411CA2CEA = {
+ buildStyles = (
+ 237A34C20076E37E7F000001,
+ 237A34C30076E37E7F000001,
+ );
+ isa = PBXProject;
+ mainGroup = 29B97314FDCFA39411CA2CEA;
+ targets = (
+ 0A79E19F004499A1CE6F79C2,
+ );
+ };
+ 29B97314FDCFA39411CA2CEA = {
+ children = (
+ 080E96DDFE201D6D7F000001,
+ 29B97315FDCFA39411CA2CEA,
+ 29B97317FDCFA39411CA2CEA,
+ 618092480041B0E4CE6F79C2,
+ 29B97323FDCFA39411CA2CEA,
+ 19C28FACFE9D520D11CA2CBB,
+ );
+ isa = PBXGroup;
+ name = "Xmaster-Cocoa";
+ path = "";
+ refType = 4;
+ };
+ 29B97315FDCFA39411CA2CEA = {
+ children = (
+ 170DFAFF00729A35416877C2,
+ 018F40F2003E1902CE6F79C2,
+ 170DFB0000729C86416877C2,
+ 43B962CE00617089416877C2,
+ );
+ isa = PBXGroup;
+ name = "Other Sources";
+ path = "";
+ refType = 2;
+ };
+ 29B97317FDCFA39411CA2CEA = {
+ children = (
+ 29B97318FDCFA39411CA2CEA,
+ 089C165CFE840E0CC02AAC07,
+ 1220774300712D2D416877C2,
+ 0157A37D002CF6D7CE6F79C2,
+ 02E03CA000348209CE6F79C2,
+ 015698ED003DF345CE6F79C2,
+ );
+ isa = PBXGroup;
+ name = Resources;
+ path = "";
+ refType = 4;
+ };
+ 29B97318FDCFA39411CA2CEA = {
+ children = (
+ 29B97319FDCFA39411CA2CEA,
+ 43B962E000617B49416877C2,
+ );
+ isa = PBXVariantGroup;
+ name = MainMenu.nib;
+ path = "";
+ refType = 4;
+ };
+ 29B97319FDCFA39411CA2CEA = {
+ isa = PBXFileReference;
+ name = English;
+ path = English.lproj/MainMenu.nib;
+ refType = 4;
+ };
+ 29B97323FDCFA39411CA2CEA = {
+ children = (
+ 1058C7A0FEA54F0111CA2CBB,
+ 1058C7A2FEA54F0111CA2CBB,
+ );
+ isa = PBXGroup;
+ name = Frameworks;
+ path = "";
+ refType = 4;
+ };
+ 29B97324FDCFA39411CA2CEA = {
+ isa = PBXFrameworkReference;
+ name = AppKit.framework;
+ path = /System/Library/Frameworks/AppKit.framework;
+ refType = 0;
+ };
+ 29B97325FDCFA39411CA2CEA = {
+ isa = PBXFrameworkReference;
+ name = Foundation.framework;
+ path = /System/Library/Frameworks/Foundation.framework;
+ refType = 0;
+ };
+ 3576829A0077B8F17F000001 = {
+ isa = PBXFileReference;
+ path = quartzCursor.c;
+ refType = 4;
+ };
+ 43B962CE00617089416877C2 = {
+ children = (
+ 018F40F8003E1979CE6F79C2,
+ 018F40FA003E197ECE6F79C2,
+ 237A34C10076E37E7F000001,
+ 237A34C40076F4F07F000001,
+ 3576829A0077B8F17F000001,
+ 43B962D000617089416877C2,
+ 43B962CF00617089416877C2,
+ 43B962D100617089416877C2,
+ 06EB6C3B004099E7CE6F79C2,
+ 02A1FEA8006D38F0416877C2,
+ );
+ isa = PBXGroup;
+ name = "Quartz Support";
+ refType = 4;
+ };
+ 43B962CF00617089416877C2 = {
+ isa = PBXFileReference;
+ path = quartzCocoa.m;
+ refType = 4;
+ };
+ 43B962D000617089416877C2 = {
+ isa = PBXFileReference;
+ path = quartzPasteboard.c;
+ refType = 4;
+ };
+ 43B962D100617089416877C2 = {
+ isa = PBXFileReference;
+ path = quartzPasteboard.h;
+ refType = 4;
+ };
+ 43B962E000617B49416877C2 = {
+ isa = PBXFileReference;
+ name = Japanese;
+ path = Japanese.lproj/MainMenu.nib;
+ refType = 4;
+ };
+ 43B962E100617B49416877C2 = {
+ isa = PBXFileReference;
+ name = Japanese;
+ path = Japanese.lproj/InfoPlist.strings;
+ refType = 4;
+ };
+ 43B962E200617B93416877C2 = {
+ isa = PBXFileReference;
+ name = Japanese;
+ path = Japanese.lproj/Credits.rtf;
+ refType = 4;
+ };
+ 43B962E300617B93416877C2 = {
+ isa = PBXFileReference;
+ name = Japanese;
+ path = Japanese.lproj/XDarwinHelp.html;
+ refType = 4;
+ };
+ 618092480041B0E4CE6F79C2 = {
+ children = (
+ 015EDCC000420083CE6F79C2,
+ 015EDCC20042012ACE6F79C2,
+ 015EDCC400420160CE6F79C2,
+ 015EDCC60042017CCE6F79C2,
+ 015EDCC8004201A8CE6F79C2,
+ 015EDCCA004201C1CE6F79C2,
+ 015EDCCC004201E4CE6F79C2,
+ 015EDCCE004201F2CE6F79C2,
+ 015EDCD0004201FCCE6F79C2,
+ 015EDCD20042020BCE6F79C2,
+ 015EDCD400420227CE6F79C2,
+ 015EDCD60042023DCE6F79C2,
+ 015EDCD80042024ECE6F79C2,
+ 015EDCDA00420266CE6F79C2,
+ 015EDCDC00420279CE6F79C2,
+ 015EDCDE00420295CE6F79C2,
+ 015EDCE0004202BACE6F79C2,
+ 015EDCE2004202DECE6F79C2,
+ 015EDCE4004202F2CE6F79C2,
+ 015EDCE600420319CE6F79C2,
+ 015EDCE800420346CE6F79C2,
+ );
+ isa = PBXGroup;
+ name = Libraries;
+ path = ../../..;
+ refType = 2;
+ };
+ };
+ rootObject = 29B97313FDCFA39411CA2CEA;
+}
diff --git a/xc/programs/Xserver/hw/darwin/bundle/XDarwinStartup.c b/xc/programs/Xserver/hw/darwin/bundle/XDarwinStartup.c
new file mode 100644
index 000000000..f321cb0be
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/XDarwinStartup.c
@@ -0,0 +1,71 @@
+/**************************************************************
+ *
+ * Startup program for Darwin X servers
+ *
+ * This program selects the appropriate X server to launch:
+ * XDarwin IOKit X server (default)
+ * XDarwin.app Quartz X server (-quartz option)
+ *
+ * If told to idle, the program will simply pause and not
+ * launch any X server. This is to support startx being
+ * run by XDarwin.app.
+ *
+ **************************************************************/
+/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/XDarwinStartup.c,v 1.1 2001/03/29 02:06:51 torrey Exp $ */
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+extern int errno;
+
+// Macros to build the path name
+#ifndef XBINDIR
+#define XBINDIR /usr/X11R6/bin
+#endif
+#define STR(s) #s
+#define XSTRPATH(s) STR(s) "/"
+#define XPATH(file) XSTRPATH(XBINDIR) STR(file)
+
+int main(
+ int argc,
+ char *argv[] )
+{
+ int i, j;
+ char **newargv;
+
+ // Check if we are going to run in Quartz mode or idle
+ // to support startx from the Quartz server. The last
+ // parameter in the list is the one used.
+ for (i = argc-1; i; i--) {
+ if (!strcmp(argv[i], "-idle")) {
+ pause();
+ return 0;
+
+ } else if (!strcmp(argv[i], "-quartz")) {
+ // Build the new argument list
+ newargv = (char **) malloc((argc+2) + sizeof(char *));
+ for (j = argc; j; j--)
+ newargv[j] = argv[j];
+ newargv[0] = XPATH(XDarwin.app/Contents/MacOS/XDarwin);
+ newargv[argc] = "-nostartx";
+ newargv[argc+1] = NULL;
+
+ execv(newargv[0], newargv);
+ fprintf(stderr, "Could not start XDarwin Quartz X server.\n");
+ return errno;
+ }
+ }
+
+ // Build the new argument list
+ newargv = (char **) malloc((argc+1) + sizeof(char *));
+ for (j = argc; j; j--)
+ newargv[j] = argv[j];
+ newargv[0] = XPATH(XDarwin);
+ newargv[argc] = NULL;
+
+ // Launch the IOKit X server
+ execv(newargv[0], newargv);
+ fprintf(stderr, "Could not start XDarwin IOKit X server.\n");
+ return errno;
+}
diff --git a/xc/programs/Xserver/hw/darwin/bundle/Xserver.h b/xc/programs/Xserver/hw/darwin/bundle/Xserver.h
new file mode 100644
index 000000000..87d4ae09a
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/Xserver.h
@@ -0,0 +1,57 @@
+//
+// Xserver.h
+//
+// Created by Andreas Monitzer on January 6, 2001.
+//
+/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/Xserver.h,v 1.4 2001/04/02 08:50:56 torrey Exp $ */
+
+#import <Cocoa/Cocoa.h>
+
+#include <drivers/event_status_driver.h> // for NXEvent
+#include <unistd.h>
+#include <stdlib.h>
+
+@interface Xserver : NSObject {
+ // server state
+ NSLock *serverLock;
+ BOOL serverVisible;
+ BOOL appQuitting;
+ UInt32 mouseState;
+
+ // communication
+ int eventWriteFD;
+
+ // Aqua interface
+ IBOutlet NSPanel *helpWindow;
+ IBOutlet id startupHelpButton;
+}
+
+- (id)init;
+
+- (BOOL)translateEvent:(NSEvent *)anEvent;
+
+- (void)getNXMouse:(NXEvent*)ev;
++ (void)append:(NSString*)value toEnv:(NSString*)name;
+
+- (void)run;
+- (void)startClients;
+- (void)toggle;
+- (void)show;
+- (void)hide;
+- (void)kill;
+- (void)readPasteboard;
+- (void)writePasteboard;
+- (void)sendNXEvent:(NXEvent*)ev;
+- (void)sendShowHide:(BOOL)show;
+
+- (IBAction)closeHelpAndShow:(id)sender;
+
+// NSApplication delegate
+- (BOOL)applicationShouldTerminate:(NSApplication *)sender;
+- (void)applicationDidFinishLaunching:(NSNotification *)aNotification;
+- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag;
+- (void)applicationWillResignActive:(NSNotification *)aNotification;
+- (void)applicationWillBecomeActive:(NSNotification *)aNotification;
+
+@end
+
diff --git a/xc/programs/Xserver/hw/darwin/bundle/Xserver.m b/xc/programs/Xserver/hw/darwin/bundle/Xserver.m
new file mode 100644
index 000000000..e0f86790f
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/Xserver.m
@@ -0,0 +1,301 @@
+//
+// Xserver.m
+//
+// This class handles the interaction between the Cocoa front-end
+// and the Darwin X server thread.
+//
+// Created by Andreas Monitzer on January 6, 2001.
+//
+/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/Xserver.m,v 1.7 2001/04/05 06:08:46 torrey Exp $ */
+
+#import "Xserver.h"
+#import "Preferences.h"
+#import "quartzShared.h"
+
+// Macros to build the path name
+#ifndef XBINDIR
+#define XBINDIR /usr/X11R6/bin
+#endif
+#define STR(s) #s
+#define XSTRPATH(s) STR(s)
+#define XPATH(file) XSTRPATH(XBINDIR) "/" STR(file)
+
+extern int argcGlobal;
+extern char **argvGlobal;
+extern char **envpGlobal;
+
+@implementation Xserver
+
+- (id)init {
+ self=[super init];
+
+ serverLock = [[NSLock alloc] init];
+ serverVisible = NO;
+ appQuitting = NO;
+ mouseState = 0;
+ eventWriteFD = quartzEventWriteFD;
+
+ return self;
+}
+
+- (BOOL)applicationShouldTerminate:(NSApplication *)sender {
+ int but;
+
+ if ([serverLock tryLock])
+ return YES;
+ if (serverVisible)
+ [self hide];
+
+ but = NSRunAlertPanel(NSLocalizedString(@"Quit X server?",@""),
+ NSLocalizedString(@"Quitting the X server will terminate any running X Window programs.",@""),
+ NSLocalizedString(@"Quit",@""),
+ NSLocalizedString(@"Cancel",@""),
+ nil);
+
+ switch (but) {
+ case NSAlertDefaultReturn: // quit
+ appQuitting = YES;
+ [self kill];
+ // Try to wait until the X server shuts down
+ [serverLock lockBeforeDate:[NSDate dateWithTimeIntervalSinceNow:10]];
+ return YES;
+ case NSAlertAlternateReturn: // cancel
+ break;
+ }
+ return NO;
+}
+
+// returns YES when event was handled
+- (BOOL)translateEvent:(NSEvent *)anEvent {
+ NXEvent ev;
+
+ if(([anEvent type]==NSKeyDown) && (![anEvent isARepeat]) &&
+ ([anEvent keyCode]==[Preferences keyCode]) &&
+ ([anEvent modifierFlags]==[Preferences modifiers])) {
+ [self toggle];
+ return YES;
+ }
+
+ if(!serverVisible)
+ return NO;
+
+ [self getNXMouse:&ev];
+ ev.type=[anEvent type];
+ ev.flags=[anEvent modifierFlags];
+ switch(ev.type) {
+ case NSLeftMouseDown:
+ case NSLeftMouseUp:
+ case NSMouseMoved:
+ break;
+ case NSLeftMouseDragged:
+ case NSRightMouseDragged:
+ ev.type=NSMouseMoved;
+ break;
+ case NSSystemDefined:
+ if(([anEvent subtype]==7) && ([anEvent data1] & 1))
+ return YES; // skip mouse button 1 events
+ if(mouseState==[anEvent data2])
+ return YES; // ignore double events
+ ev.data.compound.subType=[anEvent subtype];
+ ev.data.compound.misc.L[0]=[anEvent data1];
+ ev.data.compound.misc.L[1]=mouseState=[anEvent data2];
+ break;
+ case NSScrollWheel:
+ ev.data.scrollWheel.deltaAxis1=[anEvent deltaY];
+ break;
+ case NSKeyDown:
+ case NSKeyUp:
+ ev.data.key.keyCode = [anEvent keyCode];
+ ev.data.key.repeat = [anEvent isARepeat];
+ break;
+ case NSFlagsChanged:
+ ev.data.key.keyCode = [anEvent keyCode];
+ break;
+ default:
+ return YES;
+ }
+
+ [self sendNXEvent:&ev];
+
+ return YES;
+}
+
+- (void)getNXMouse:(NXEvent*)ev {
+ NSPoint pt=[NSEvent mouseLocation];
+ ev->location.x=(int)(pt.x);
+ ev->location.y=[[NSScreen mainScreen] frame].size.height-(int)(pt.y); // invert mouse
+}
+
+// Append a string to the given enviroment variable
++ (void)append:(NSString*)value toEnv:(NSString*)name {
+ setenv([name cString],
+ [[[NSString stringWithCString:getenv([name cString])]
+ stringByAppendingString:value] cString],1);
+}
+
+- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
+ // Start the X server thread
+ [NSThread detachNewThreadSelector:@selector(run) toTarget:self withObject:nil];
+
+ // Start the X clients if started from GUI
+ if (quartzStartClients)
+ [NSThread detachNewThreadSelector:@selector(startClients) toTarget:self withObject:nil];
+
+ // Make sure the menu bar gets drawn
+ [NSApp setWindowsNeedUpdate:YES];
+
+ // Display the help splash screen or show the X server
+ if ([Preferences startupHelp]) {
+ [self sendShowHide:NO];
+ [helpWindow makeKeyAndOrderFront:self];
+ } else {
+ [self closeHelpAndShow:self];
+ }
+}
+
+// Run the X server thread
+- (void)run {
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ [serverLock lock];
+ main(argcGlobal, argvGlobal, envpGlobal);
+ serverVisible = NO;
+ [serverLock unlock];
+ [pool release];
+ if (!appQuitting)
+ [NSApp terminate:nil]; // quit if we aren't already
+}
+
+// Start the X clients in a separate thread
+- (void)startClients {
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ char *home;
+
+ // Change to user's home directory (so xterms etc. start there)
+ home = getenv("HOME");
+ if (home) chdir(home);
+
+ [Xserver append:@":" toEnv:@"PATH"];
+ [Xserver append:@XSTRPATH(XBINDIR) toEnv:@"PATH"];
+ system(XPATH(startx -- -idle &));
+ // FIXME: quit when startx dies
+ [pool release];
+}
+
+// Close the help splash screen and show the X server
+- (IBAction)closeHelpAndShow:(id)sender {
+ int helpVal;
+
+ helpVal = [startupHelpButton intValue];
+ [Preferences setStartupHelp:helpVal];
+ [helpWindow close];
+ serverVisible = YES;
+ [self sendShowHide:YES];
+ [NSApp activateIgnoringOtherApps:YES];
+}
+
+// Show or hide the X server
+- (void)toggle {
+ if (serverVisible)
+ [self hide];
+ else
+ [self show];
+}
+
+// Show the X server on screen
+- (void)show {
+ if (!serverVisible) {
+ [self sendShowHide:YES];
+ }
+}
+
+// Hide the X server from the screen
+- (void)hide {
+ if (serverVisible) {
+ [self sendShowHide:NO];
+ }
+}
+
+// Kill the Xserver process
+- (void)kill {
+ NXEvent ev;
+
+ if (serverVisible)
+ [self hide];
+
+ ev.type = NX_APPDEFINED;
+ ev.data.compound.subType = kXDarwinQuit;
+ [self sendNXEvent:&ev];
+}
+
+// Tell the X server to show or hide itself.
+// This ignores the current X server visible state.
+- (void)sendShowHide:(BOOL)show {
+ NXEvent ev;
+
+ [self getNXMouse:&ev];
+ ev.type = NX_APPDEFINED;
+
+ if (show) {
+ ev.data.compound.subType = kXDarwinShow;
+ [self sendNXEvent:&ev];
+
+ // inform the X server of the current modifier state
+ ev.flags = [[NSApp currentEvent] modifierFlags];
+ ev.data.compound.subType = kXDarwinUpdateModifiers;
+ [self sendNXEvent:&ev];
+
+ // put the pasteboard into the X cut buffer
+ [self readPasteboard];
+ } else {
+ // put the X cut buffer on the pasteboard
+ [self writePasteboard];
+
+ ev.data.compound.subType = kXDarwinHide;
+ [self sendNXEvent:&ev];
+ }
+
+ serverVisible = show;
+}
+
+// Tell the X server to read from the pasteboard into the X cut buffer
+- (void)readPasteboard
+{
+ NXEvent ev;
+
+ ev.type = NX_APPDEFINED;
+ ev.data.compound.subType = kXDarwinReadPasteboard;
+ [self sendNXEvent:&ev];
+}
+
+// Tell the X server to write the X cut buffer into the pasteboard
+- (void)writePasteboard
+{
+ NXEvent ev;
+
+ ev.type = NX_APPDEFINED;
+ ev.data.compound.subType = kXDarwinWritePasteboard;
+ [self sendNXEvent:&ev];
+}
+
+- (void)sendNXEvent:(NXEvent*)ev {
+ if (write(eventWriteFD, ev, sizeof(*ev)) == sizeof(*ev))
+ return;
+ ErrorF("Bad write to event pipe.\n");
+ // FIXME: handle bad writes better?
+}
+
+- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag {
+ [self show];
+ return NO;
+}
+
+- (void)applicationWillResignActive:(NSNotification *)aNotification {
+ [self hide];
+}
+
+- (void)applicationWillBecomeActive:(NSNotification *)aNotification {
+ [self readPasteboard];
+}
+
+@end
diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartz.c b/xc/programs/Xserver/hw/darwin/bundle/quartz.c
new file mode 100644
index 000000000..f3965d55e
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/quartz.c
@@ -0,0 +1,234 @@
+/**************************************************************
+ *
+ * Quartz-specific support for the Darwin X Server
+ *
+ * By Gregory Robert Parker
+ *
+ **************************************************************/
+/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartz.c,v 1.4 2001/04/02 05:18:50 torrey Exp $ */
+
+// X headers
+#include "scrnintstr.h"
+
+// System headers
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <IOKit/pwr_mgt/IOPMLib.h>
+
+// We need CoreGraphics in ApplicationServices, but we leave out
+// QuickDraw, which has symbol conflicts with the basic X includes.
+#define __QD__
+#define __PRINTCORE__
+#include <ApplicationServices/ApplicationServices.h>
+
+#include "../darwin.h"
+#include "quartz.h"
+#include "quartzAudio.h"
+
+#define kDarwinMaxScreens 100
+static ScreenPtr darwinScreens[kDarwinMaxScreens];
+static int darwinNumScreens = 0;
+static BOOL xhidden = FALSE;
+
+
+/*
+ * QuartzStoreColors
+ * FIXME: need to implement if Quartz supports PsuedoColor
+ */
+static void QuartzStoreColors(
+ ColormapPtr pmap,
+ int numEntries,
+ xColorItem *pdefs)
+{
+}
+
+/*
+===========================================================================
+
+ Screen functions
+
+===========================================================================
+*/
+
+/*
+ * QuartzPMThread
+ * Handle power state notifications, FIXME
+ */
+#if 0
+static void *QuartzPMThread(void *arg)
+{
+ for (;;) {
+ mach_msg_return_t kr;
+ mach_msg_empty_rcv_t msg;
+
+ kr = mach_msg((mach_msg_header_t*) &msg, MACH_RCV_MSG, 0,
+ sizeof(msg), pmNotificationPort, 0, MACH_PORT_NULL);
+ kern_assert(kr);
+
+ // computer just woke up
+ if (msg.header.msgh_id == 1) {
+ if (!xhidden) {
+ int i;
+
+ for (i = 0; i < darwinNumScreens; i++) {
+ if (darwinScreens[i])
+ xf86SetRootClip(darwinScreens[i], true);
+ }
+ }
+ }
+ }
+ return NULL;
+}
+#endif
+
+
+/*
+ * QuartzAddScreen
+ * Quartz keeps a list of all screens for QuartzShow and QuartzHide.
+ * FIXME: So does ddx, use that instead.
+ */
+Bool QuartzAddScreen(ScreenPtr pScreen)
+{
+ if (darwinNumScreens == kDarwinMaxScreens) {
+ return FALSE;
+ }
+
+ darwinScreens[darwinNumScreens++] = pScreen;
+
+ // setup cursor support
+ if (! QuartzInitCursor(pScreen)) {
+ return FALSE;
+ }
+
+ // initialize colormap handling as needed
+ if (dfb.pixelInfo.pixelType == kIOCLUTPixels) {
+ pScreen->StoreColors = QuartzStoreColors;
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * QuartzCapture
+ * Capture the screen so we can draw and hide the Aqua cursor.
+ */
+static void QuartzCapture(void)
+{
+ if (! CGDisplayIsCaptured(kCGDirectMainDisplay)) {
+ CGDisplayCapture(kCGDirectMainDisplay);
+// FIXME: Properly initialize X cursor
+#if 0
+ CGDisplayHideCursor(kCGDirectMainDisplay);
+#endif
+ HideMenuBar();
+ }
+}
+
+
+/*
+ * QuartzRelease
+ * Release the screen so others can draw and restore the Aqua cursor.
+ */
+static void QuartzRelease(void)
+{
+ if (CGDisplayIsCaptured(kCGDirectMainDisplay)) {
+ InitCursor();
+ CGDisplayRelease(kCGDirectMainDisplay);
+ ShowMenuBar();
+ }
+}
+
+
+/*
+ * QuartzDisplayInit
+ * Init the framebuffer and claim the display from CoreGraphics.
+ */
+static void QuartzDisplayInit(void)
+{
+ dfb.pixelInfo.pixelType = kIORGBDirectPixels;
+ dfb.pixelInfo.bitsPerComponent=CGDisplayBitsPerSample(kCGDirectMainDisplay);
+ dfb.pixelInfo.componentCount=CGDisplaySamplesPerPixel(kCGDirectMainDisplay);
+#if FALSE
+ // FIXME: endian and 24 bit color specific
+ dfb.pixelInfo.componentMasks[0] = 0x00ff0000;
+ dfb.pixelInfo.componentMasks[1] = 0x0000ff00;
+ dfb.pixelInfo.componentMasks[2] = 0x000000ff;
+#endif
+
+ dfb.width = CGDisplayPixelsWide(kCGDirectMainDisplay);
+ dfb.height = CGDisplayPixelsHigh(kCGDirectMainDisplay);
+ dfb.pitch = CGDisplayBytesPerRow(kCGDirectMainDisplay);
+ dfb.bitsPerPixel = CGDisplayBitsPerPixel(kCGDirectMainDisplay);
+ dfb.colorBitsPerPixel = (dfb.pixelInfo.componentCount *
+ dfb.pixelInfo.bitsPerComponent);
+
+ dfb.framebuffer = CGDisplayBaseAddress(kCGDirectMainDisplay);
+
+ // need to capture because X doesn't like read-only framebuffer...
+ QuartzCapture();
+ atexit(QuartzRelease);
+}
+
+
+/*
+ * QuartzOsVendorInit
+ * Quartz display initialization.
+ */
+void QuartzOsVendorInit(void)
+{
+ QuartzAudioInit();
+ QuartzDisplayInit();
+}
+
+
+/*
+ * QuartzShow
+ * Show the X server on screen. Does nothing if already shown.
+ * recapture the screen, restore the X clip regions.
+ */
+void QuartzShow(void) {
+ int i;
+
+ QuartzCapture();
+ if (xhidden) {
+ for (i = 0; i < darwinNumScreens; i++) {
+ if (darwinScreens[i])
+ xf86SetRootClip(darwinScreens[i], true);
+ }
+ }
+ xhidden = false;
+}
+
+
+/*
+ * QuartzHide
+ * Remove the X server display from the screen. Does nothing if already hidden.
+ * Release the screen, set X clip regions to prevent drawing.
+ */
+void QuartzHide(void)
+{
+ int i;
+
+ if (!xhidden) {
+ for (i = 0; i < darwinNumScreens; i++) {
+ if (darwinScreens[i])
+ xf86SetRootClip(darwinScreens[i], false);
+ }
+ }
+ QuartzRelease();
+ xhidden = true;
+}
+
+
+/*
+ * QuartzGiveUp
+ * Cleanup before X server shutdown
+ * Release the screen
+ */
+void QuartzGiveUp(void)
+{
+ QuartzRelease();
+}
+
diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartz.h b/xc/programs/Xserver/hw/darwin/bundle/quartz.h
new file mode 100644
index 000000000..01c52eaae
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/quartz.h
@@ -0,0 +1,23 @@
+/*
+ quartz.h
+
+ Quartz-specific functions and definitions
+*/
+/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartz.h,v 1.2 2001/04/02 05:18:50 torrey Exp $ */
+
+#ifndef _QUARTZ_H
+#define _QUARTZ_H
+
+#include "X11/Xproto.h"
+#include "screenint.h"
+#include "quartzShared.h"
+#include "quartzPasteboard.h"
+
+void QuartzOsVendorInit(void);
+Bool QuartzAddScreen(ScreenPtr screen);
+Bool QuartzInitCursor(ScreenPtr pScreen);
+void QuartzGiveUp(void);
+void QuartzHide(void);
+void QuartzShow(void);
+
+#endif
diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzAudio.c b/xc/programs/Xserver/hw/darwin/bundle/quartzAudio.c
new file mode 100644
index 000000000..a794a2b35
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/quartzAudio.c
@@ -0,0 +1,316 @@
+//
+// QuartzAudio.m
+//
+// X Window bell support using CoreAudio or AppKit.
+// Greg Parker gparker@cs.stanford.edu 19 Feb 2001
+//
+// Info about sine wave sound playback:
+// CoreAudio code derived from macosx-dev posting by Tim Wood
+// http://www.omnigroup.com/mailman/archive/macosx-dev/2000-May/002004.html
+// Smoothing transitions between sounds
+// http://www.wam.umd.edu/~mphoenix/dss/dss.html
+//
+/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzAudio.c,v 1.2 2001/04/05 06:08:46 torrey Exp $ */
+
+#include <CoreAudio/AudioHardware.h>
+#include <pthread.h>
+
+#include "inputstr.h"
+#include "extensions/XI.h"
+
+#include "quartzAudio.h"
+#include "quartzShared.h"
+
+typedef struct QuartzAudioRec {
+ double frequency;
+ double amplitude;
+
+ UInt32 curFrame;
+ UInt32 remainingFrames;
+ UInt32 totalFrames;
+ UInt32 bytesPerFrame;
+ double sampleRate;
+ UInt32 fadeLength;
+
+ UInt32 bufferByteCount;
+ Boolean playing;
+ pthread_mutex_t lock;
+
+ // used to fade out interrupted sound and avoid 'pop'
+ double prevFrequency;
+ double prevAmplitude;
+ UInt32 prevFrame;
+} QuartzAudioRec;
+
+static AudioDeviceID quartzAudioDevice = kAudioDeviceUnknown;
+static QuartzAudioRec data;
+
+
+/*
+ * QuartzAudioEnvelope
+ * Fade sound in and out to avoid pop.
+ * Sounds with shorter duration will never reach full amplitude. Deal.
+ */
+static double QuartzAudioEnvelope(
+ UInt32 curFrame,
+ UInt32 totalFrames,
+ UInt32 fadeLength )
+{
+ double fadeFrames = min(fadeLength, totalFrames / 2);
+ if (fadeFrames < 1) return 0;
+
+ if (curFrame < fadeFrames) {
+ return curFrame / fadeFrames;
+ } else if (curFrame > totalFrames - fadeFrames) {
+ return (totalFrames-curFrame) / fadeFrames;
+ } else {
+ return 1.0;
+ }
+}
+
+
+/*
+ * QuartzFillBuffer
+ * Fill this buffer with data and update the data position.
+ * FIXME: this is ugly
+ */
+static void QuartzFillBuffer(
+ AudioBuffer *audiobuffer,
+ QuartzAudioRec *data )
+{
+ float *buffer, *b;
+ unsigned int frame, frameCount;
+ unsigned int bufferFrameCount;
+ float multiplier, v;
+ int i;
+
+ buffer = (float *)audiobuffer->mData;
+ bufferFrameCount = audiobuffer->mDataByteSize / data->bytesPerFrame;
+
+ frameCount = min(bufferFrameCount, data->remainingFrames);
+
+ // Fade out previous sine wave, if any.
+ b = buffer;
+ if (data->prevFrame) {
+ multiplier = 2*M_PI*(data->prevFrequency/data->sampleRate);
+ for (frame = 0; frame < data->fadeLength; frame++) {
+ v = data->prevAmplitude *
+ QuartzAudioEnvelope(frame+data->fadeLength,
+ 2*data->fadeLength,
+ data->fadeLength) *
+ sin(multiplier * (data->prevFrame+frame));
+ for (i = 0; i < audiobuffer->mNumberChannels; i++) {
+ *b++ = v;
+ }
+ }
+ // no more prev fade
+ data->prevFrame = 0;
+
+ // adjust for space eaten by prev fade
+ buffer += audiobuffer->mNumberChannels*frame;
+ bufferFrameCount -= frame;
+ frameCount = min(bufferFrameCount, data->remainingFrames);
+ }
+
+ // Write a sine wave with the specified frequency and amplitude
+ multiplier = 2*M_PI*(data->frequency/data->sampleRate);
+ for (frame = 0; frame < frameCount; frame++) {
+ v = data->amplitude *
+ QuartzAudioEnvelope(data->curFrame+frame, data->totalFrames,
+ data->fadeLength) *
+ sin(multiplier * (data->curFrame+frame));
+ for (i = 0; i < audiobuffer->mNumberChannels; i++) {
+ *b++ = v;
+ }
+ }
+
+ // Zero out the rest of the buffer, if any
+ memset(b, 0, sizeof(float) * audiobuffer->mNumberChannels *
+ (bufferFrameCount-frame));
+
+ data->curFrame += frameCount;
+ data->remainingFrames -= frameCount;
+ if (data->remainingFrames == 0) {
+ data->playing = FALSE;
+ data->curFrame = 0;
+ }
+}
+
+
+/*
+ * QuartzAudioIOProc
+ * Callback function for audio playback.
+ * FIXME: use inOutputTime to correct for skipping
+ */
+static OSStatus
+QuartzAudioIOProc(
+ AudioDeviceID inDevice,
+ const AudioTimeStamp *inNow,
+ const AudioBufferList *inInputData,
+ const AudioTimeStamp *inInputTime,
+ AudioBufferList *outOutputData,
+ const AudioTimeStamp *inOutputTime,
+ void *inClientData )
+{
+ QuartzAudioRec *data = (QuartzAudioRec *)inClientData;
+ int i;
+ Boolean wasPlaying;
+
+ pthread_mutex_lock(&data->lock);
+ wasPlaying = data->playing;
+ for (i = 0; i < outOutputData->mNumberBuffers; i++) {
+ if (data->playing) {
+ QuartzFillBuffer(outOutputData->mBuffers+i, data);
+ }
+ else {
+ memset(outOutputData->mBuffers[i].mData, 0,
+ outOutputData->mBuffers[i].mDataByteSize);
+ }
+ }
+ if (wasPlaying && !data->playing) {
+ OSStatus err;
+ err = AudioDeviceStop(inDevice, QuartzAudioIOProc);
+ }
+ pthread_mutex_unlock(&data->lock);
+ return 0;
+}
+
+
+/*
+ * QuartzCoreAudioBell
+ * Play a tone using the CoreAudio API
+ */
+static void QuartzCoreAudioBell(
+ int volume, // volume is % of max
+ int pitch, // pitch is Hz
+ int duration ) // duration is milliseconds
+{
+ if (quartzAudioDevice == kAudioDeviceUnknown) return;
+
+ pthread_mutex_lock(&data.lock);
+
+ // fade previous sound, if any
+ data.prevFrequency = data.frequency;
+ data.prevAmplitude = data.amplitude;
+ data.prevFrame = data.curFrame;
+
+ // set new sound
+ data.frequency = pitch;
+ data.amplitude = volume / 100.0;
+ data.curFrame = 0;
+ data.totalFrames = (int)(data.sampleRate * duration / 1000.0);
+ data.remainingFrames = data.totalFrames;
+
+ if (! data.playing) {
+ OSStatus status;
+ status = AudioDeviceStart(quartzAudioDevice, QuartzAudioIOProc);
+ if (status) {
+ ErrorF("QuartzAudioBell: AudioDeviceStart returned %d\n", status);
+ } else {
+ data.playing = TRUE;
+ }
+ }
+ pthread_mutex_unlock(&data.lock);
+}
+
+
+/*
+ * QuartzBell
+ * Ring the bell
+ */
+void QuartzBell(
+ int volume, // volume in percent of max
+ DeviceIntPtr pDevice,
+ pointer ctrl,
+ int class )
+{
+ int pitch; // pitch in Hz
+ int duration; // duration in milliseconds
+
+ if (class == BellFeedbackClass) {
+ pitch = ((BellCtrl*)ctrl)->pitch;
+ duration = ((BellCtrl*)ctrl)->duration;
+ } else if (class == KbdFeedbackClass) {
+ pitch = ((KeybdCtrl*)ctrl)->bell_pitch;
+ duration = ((KeybdCtrl*)ctrl)->bell_duration;
+ } else {
+ ErrorF("QuartzBell: bad bell class %d\n", class);
+ return;
+ }
+
+ // FIXME: how is NSBeep volume set?
+ if (quartzUseSysBeep) {
+ NSBeep();
+ return;
+ } else {
+ QuartzCoreAudioBell(volume, pitch, duration);
+ }
+}
+
+
+/*
+ * QuartzAudioInit
+ * Prepare to play the bell with the CoreAudio API
+ */
+void QuartzAudioInit(void)
+{
+ UInt32 propertySize;
+ OSStatus status;
+ AudioDeviceID outputDevice;
+ AudioStreamBasicDescription outputStreamDescription;
+ double sampleRate;
+
+ // Get the default output device
+ propertySize = sizeof(outputDevice);
+ status = AudioHardwareGetProperty(
+ kAudioHardwarePropertyDefaultOutputDevice,
+ &propertySize, &outputDevice);
+ if (status) {
+ ErrorF("QuartzAudioInit: AudioHardwareGetProperty returned %d\n",
+ status);
+ return;
+ }
+ if (outputDevice == kAudioDeviceUnknown) {
+ ErrorF("QuartzAudioInit: No audio output devices available.\n");
+ return;
+ }
+
+ // Get the basic device description
+ propertySize = sizeof(outputStreamDescription);
+ status = AudioDeviceGetProperty(outputDevice, 0, FALSE,
+ kAudioDevicePropertyStreamFormat,
+ &propertySize, &outputStreamDescription);
+ if (status) {
+ ErrorF("QuartzAudioInit: GetProperty(stream format) returned %d\n",
+ status);
+ return;
+ }
+ sampleRate = outputStreamDescription.mSampleRate;
+
+ // Fill in the playback data
+ data.frequency = 0;
+ data.amplitude = 0;
+ data.curFrame = 0;
+ data.remainingFrames = 0;
+ data.bytesPerFrame = outputStreamDescription.mBytesPerFrame;
+ data.sampleRate = sampleRate;
+ // data.bufferByteCount = bufferByteCount;
+ data.playing = FALSE;
+ data.prevAmplitude = 0;
+ data.prevFrame = 0;
+ data.prevFrequency = 0;
+ data.fadeLength = data.sampleRate / 200;
+ pthread_mutex_init(&data.lock, NULL); // fixme error check
+
+ // fixme assert fadeLength<framesPerBuffer
+
+ // Prepare for playback
+ status = AudioDeviceAddIOProc(outputDevice, QuartzAudioIOProc, &data);
+ if (status) {
+ ErrorF("QuartzAudioInit: AddIOProc returned %d\n", status);
+ return;
+ }
+
+ // success!
+ quartzAudioDevice = outputDevice;
+}
diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzAudio.h b/xc/programs/Xserver/hw/darwin/bundle/quartzAudio.h
new file mode 100644
index 000000000..4edd87ce4
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/quartzAudio.h
@@ -0,0 +1,16 @@
+//
+// QuartzAudio.h
+//
+// X Window bell support using CoreAudio or AppKit.
+// Greg Parker gparker@cs.stanford.edu 19 Feb 2001
+/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzAudio.h,v 1.2 2001/04/01 20:45:43 tsi Exp $ */
+
+#ifndef _QUARTZAUDIO_H
+#define _QUARTZAUDIO_H
+
+#include "input.h"
+
+void QuartzAudioInit(void);
+void QuartzBell(int volume, DeviceIntPtr pDevice, pointer ctrl, int class);
+
+#endif
diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzCocoa.m b/xc/programs/Xserver/hw/darwin/bundle/quartzCocoa.m
new file mode 100644
index 000000000..d9168df75
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/quartzCocoa.m
@@ -0,0 +1,78 @@
+/**************************************************************
+ *
+ * Quartz-specific support for the Darwin X Server
+ * that requires Cocoa and Objective-C.
+ *
+ * This file is separate from the parts of Quartz support
+ * that use X include files to avoid symbol collisions.
+ *
+ **************************************************************/
+/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzCocoa.m,v 1.2 2001/04/05 06:08:46 torrey Exp $ */
+
+#include <Cocoa/Cocoa.h>
+
+#import "Preferences.h"
+#include "quartzShared.h"
+
+static NSArray *pasteboardTypes = nil;
+
+// Read the user preferences from the Cocoa front end
+void QuartzReadPreferences(void)
+{
+ darwinFakeButtons = [Preferences fakeButtons];
+ quartzUseSysBeep = [Preferences systemBeep];
+}
+
+// Write text to the Mac OS X pasteboard.
+void QuartzWriteCocoaPasteboard(char *text)
+{
+ NSPasteboard *pasteboard;
+ NSString *string;
+
+ if (! text) return;
+ pasteboard = [NSPasteboard generalPasteboard];
+ if (! pasteboard) return;
+ string = [NSString stringWithCString:text];
+ if (! string) return;
+ if (! pasteboardTypes) {
+ pasteboardTypes = [NSArray arrayWithObject:NSStringPboardType];
+ [pasteboardTypes retain];
+ }
+
+ // nil owner because we don't provide type translations
+ [pasteboard declareTypes:pasteboardTypes owner:nil];
+ [pasteboard setString:string forType:NSStringPboardType];
+ [string release];
+}
+
+// Read text from the Mac OS X pasteboard and return it as a heap string.
+// The caller must free the string.
+char *QuartzReadCocoaPasteboard(void)
+{
+ NSPasteboard *pasteboard;
+ NSString *existingType;
+ char *text = NULL;
+
+ if (! pasteboardTypes) {
+ pasteboardTypes = [NSArray arrayWithObject:NSStringPboardType];
+ [[pasteboardTypes retain] autorelease];
+ }
+
+ pasteboard = [NSPasteboard generalPasteboard];
+ if (! pasteboard) return NULL;
+
+ existingType = [pasteboard availableTypeFromArray:pasteboardTypes];
+ if (existingType) {
+ NSString *string = [pasteboard stringForType:existingType];
+ char *buffer;
+
+ if (! string) return NULL;
+ buffer = [string lossyCString];
+ text = (char *) malloc(strlen(buffer));
+ if (text)
+ strcpy(text, buffer);
+ [string release];
+ }
+
+ return text;
+}
diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzCursor.c b/xc/programs/Xserver/hw/darwin/bundle/quartzCursor.c
new file mode 100644
index 000000000..9435d96e9
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/quartzCursor.c
@@ -0,0 +1,310 @@
+/**************************************************************
+ *
+ * Support for using the Quartz Window Manager cursor
+ *
+ **************************************************************/
+/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzCursor.c,v 1.1 2001/04/02 05:18:50 torrey Exp $ */
+
+#include "mi.h"
+#include "scrnintstr.h"
+#include "cursorstr.h"
+#include "mipointrst.h"
+
+#undef AllocCursor
+#define Cursor QD_Cursor
+#define WindowPtr QD_WindowPtr
+#include <ApplicationServices/ApplicationServices.h>
+
+// Size of the QuickDraw cursor
+#define CURSORWIDTH 16
+#define CURSORHEIGHT 16
+
+typedef struct {
+ int cursorMode;
+ QueryBestSizeProcPtr QueryBestSize;
+ miPointerSpriteFuncPtr spriteFuncs;
+} QuartzCursorScreenRec, *QuartzCursorScreenPtr;
+
+static int darwinCursorScreenIndex = -1;
+static unsigned long darwinCursorGeneration = 0;
+
+/*
+===========================================================================
+
+ Pointer sprite functions
+
+===========================================================================
+*/
+
+/*
+ * QuartzRealizeCursor
+ * Convert the X cursor representation to QuickDraw format if possible.
+ */
+Bool
+QuartzRealizeCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor )
+{
+ int i;
+ QD_Cursor *curs;
+ QuartzCursorScreenPtr ScreenPriv = (QuartzCursorScreenPtr)
+ pScreen->devPrivates[darwinCursorScreenIndex].ptr;
+
+ if(!pCursor || !pCursor->bits)
+ return FALSE;
+
+ // if the cursor is too big we use a software cursor
+ if ((pCursor->bits->height > CURSORHEIGHT) ||
+ (pCursor->bits->width > CURSORWIDTH))
+ return (*ScreenPriv->spriteFuncs->RealizeCursor)(pScreen, pCursor);
+
+ // allocate memory for new cursor image
+ curs = xalloc( sizeof(QD_Cursor) );
+ if (!curs)
+ return FALSE;
+
+ // X cursor max size is 32x32 (rowbytes 4).
+ // Copy top left 16x16 for now.
+ for (i = 0; i < 16; i++)
+ {
+ curs->data[i] = (pCursor->bits->source[i*4]<<8) |
+ pCursor->bits->source[i*4+1];
+ curs->mask[i] = (pCursor->bits->mask[i*4]<<8) |
+ pCursor->bits->mask[i*4+1];
+ }
+ curs->hotSpot.h = pCursor->bits->xhot;
+ if(curs->hotSpot.h >= 16)
+ curs->hotSpot.h = 15;
+ curs->hotSpot.v = pCursor->bits->yhot;
+ if(curs->hotSpot.v >= 16)
+ curs->hotSpot.v = 15;
+
+ // save the result
+ pCursor->devPriv[pScreen->myNum] = (pointer) curs;
+ return TRUE;
+}
+
+
+/*
+ * QuartzUnrealizeCursor
+ * Free the storage space associated with a realized cursor.
+ */
+Bool
+QuartzUnrealizeCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor )
+{
+ QuartzCursorScreenPtr ScreenPriv = (QuartzCursorScreenPtr)
+ pScreen->devPrivates[darwinCursorScreenIndex].ptr;
+
+ if ((pCursor->bits->height > CURSORHEIGHT) ||
+ (pCursor->bits->width > CURSORWIDTH)) {
+ return (*ScreenPriv->spriteFuncs->UnrealizeCursor)(pScreen, pCursor);
+ } else {
+ xfree( pCursor->devPriv[pScreen->myNum] );
+ return TRUE;
+ }
+}
+
+
+/*
+ * QuartzSetCursor
+ * Set the cursor sprite and position.
+ * Use QuickDraw cursor if possible.
+ */
+static void
+QuartzSetCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor,
+ int x,
+ int y)
+{
+ QD_Cursor *curs;
+ QuartzCursorScreenPtr ScreenPriv = (QuartzCursorScreenPtr)
+ pScreen->devPrivates[darwinCursorScreenIndex].ptr;
+
+ // are we supposed to remove the cursor?
+ if (!pCursor) {
+ if (ScreenPriv->cursorMode == 0)
+ (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y);
+ else
+ CGDisplayHideCursor(kCGDirectMainDisplay);
+ return;
+ }
+
+ // can we use QuickDraw cursor?
+ if ((pCursor->bits->height <= CURSORHEIGHT) &&
+ (pCursor->bits->width <= CURSORWIDTH)) {
+
+ if (ScreenPriv->cursorMode == 0) // remove the X cursor
+ (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y);
+
+ ScreenPriv->cursorMode = 1;
+ curs = (QD_Cursor *) pCursor->devPriv[pScreen->myNum];
+ SetCursor(curs);
+ return;
+ }
+
+ // otherwise we use a software cursor
+ if (ScreenPriv->cursorMode) {
+ // remove the QuickDraw cursor
+ QuartzSetCursor(pScreen, 0, x, y);
+ }
+
+ ScreenPriv->cursorMode = 0;
+ (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, pCursor, x, y);
+}
+
+
+/*
+ * QuartzMoveCursor
+ * Move the cursor. This is a noop for QuickDraw.
+ */
+static void
+QuartzMoveCursor(
+ ScreenPtr pScreen,
+ int x,
+ int y)
+{
+ QuartzCursorScreenPtr ScreenPriv = (QuartzCursorScreenPtr)
+ pScreen->devPrivates[darwinCursorScreenIndex].ptr;
+
+ // only the X cursor needs to be explicitly moved
+ if (!ScreenPriv->cursorMode)
+ (*ScreenPriv->spriteFuncs->MoveCursor)(pScreen, x, y);
+}
+
+
+static miPointerSpriteFuncRec quartzSpriteFuncsRec = {
+ QuartzRealizeCursor,
+ QuartzUnrealizeCursor,
+ QuartzSetCursor,
+ QuartzMoveCursor
+};
+
+/*
+===========================================================================
+
+ Pointer screen functions
+
+===========================================================================
+*/
+
+/*
+ * QuartzCursorOffScreen
+ */
+static Bool QuartzCursorOffScreen(ScreenPtr *pScreen, int *x, int *y)
+{
+ return FALSE;
+}
+
+
+/*
+ * QuartzCrossScreen
+ */
+static void QuartzCrossScreen(ScreenPtr pScreen, Bool entering)
+{
+ return;
+}
+
+
+/*
+ * QuartzWarpCursor
+ * Change the cursor position without generating an event or motion history
+ */
+static void
+QuartzWarpCursor(
+ ScreenPtr pScreen,
+ int x,
+ int y)
+{
+ CGDisplayErr cgErr;
+ CGPoint cgPoint;
+
+ cgPoint = CGPointMake(x, y);
+ cgErr = CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgPoint);
+ if (cgErr != CGDisplayNoErr) {
+ ErrorF("Could not set cursor position with error code 0x%x.\n", cgErr);
+ }
+ miPointerWarpCursor(pScreen, x, y);
+}
+
+
+static miPointerScreenFuncRec quartzScreenFuncsRec = {
+ QuartzCursorOffScreen,
+ QuartzCrossScreen,
+ QuartzWarpCursor,
+};
+
+/*
+===========================================================================
+
+ Other screen functions
+
+===========================================================================
+*/
+
+/*
+ * QuartzCursorQueryBestSize
+ * Handle queries for best cursor size
+ */
+static void
+QuartzCursorQueryBestSize(
+ int class,
+ unsigned short *width,
+ unsigned short *height,
+ ScreenPtr pScreen)
+{
+ QuartzCursorScreenPtr ScreenPriv = (QuartzCursorScreenPtr)
+ pScreen->devPrivates[darwinCursorScreenIndex].ptr;
+
+ if (class == CursorShape) {
+ *width = CURSORWIDTH;
+ *height = CURSORHEIGHT;
+ } else
+ (*ScreenPriv->QueryBestSize)(class, width, height, pScreen);
+}
+
+
+/*
+ * QuartzInitCursor
+ * Initialize cursor support
+ */
+Bool
+QuartzInitCursor(
+ ScreenPtr pScreen )
+{
+ QuartzCursorScreenPtr ScreenPriv;
+ miPointerScreenPtr PointPriv;
+
+ // initialize software cursor handling (always needed as backup)
+ if (!miDCInitialize(pScreen, &quartzScreenFuncsRec)) {
+ return FALSE;
+ }
+
+ // allocate private storage for this screen's QuickDraw cursor info
+ if (darwinCursorGeneration != serverGeneration) {
+ if ((darwinCursorScreenIndex = AllocateScreenPrivateIndex()) < 0)
+ return FALSE;
+ darwinCursorGeneration = serverGeneration;
+ }
+
+ ScreenPriv = xcalloc( 1, sizeof(QuartzCursorScreenRec) );
+ if (!ScreenPriv) return FALSE;
+
+ pScreen->devPrivates[darwinCursorScreenIndex].ptr = (pointer) ScreenPriv;
+
+ // override some screen procedures
+ ScreenPriv->QueryBestSize = pScreen->QueryBestSize;
+ pScreen->QueryBestSize = QuartzCursorQueryBestSize;
+
+ // initialize QuickDraw cursor handling
+ PointPriv = (miPointerScreenPtr)
+ pScreen->devPrivates[miPointerScreenIndex].ptr;
+
+ ScreenPriv->spriteFuncs = PointPriv->spriteFuncs;
+ PointPriv->spriteFuncs = &quartzSpriteFuncsRec;
+
+ ScreenPriv->cursorMode = 1;
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzPasteboard.c b/xc/programs/Xserver/hw/darwin/bundle/quartzPasteboard.c
new file mode 100644
index 000000000..d387d8a73
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/quartzPasteboard.c
@@ -0,0 +1,56 @@
+/**************************************************************
+ * quartzPasteboard.c
+ *
+ * Aqua pasteboard <-> X cut buffer
+ * Greg Parker gparker@cs.stanford.edu March 8, 2001
+ **************************************************************/
+/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzPasteboard.c,v 1.1 2001/03/15 22:24:27 torrey Exp $ */
+
+#include "quartzPasteboard.h"
+
+#include "Xatom.h"
+#include "windowstr.h"
+#include "propertyst.h"
+
+// fixme is there a GetRootWindow() anywhere?
+// fixme wrong for multiple screens
+extern WindowPtr *WindowTable;
+
+// Write X cut buffer to Mac OS X pasteboard
+// Called by ProcessInputEvents() in response to request from X server thread.
+void QuartzWritePasteboard(void)
+{
+ PropertyPtr pProp;
+ char *text = NULL;
+
+ pProp = wUserProps (WindowTable[0]);
+ while (pProp) {
+ if (pProp->propertyName == XA_CUT_BUFFER0)
+ break;
+ pProp = pProp->next;
+ }
+ if (! pProp) return;
+ if (pProp->type != XA_STRING) return;
+ if (pProp->format != 8) return;
+
+ text = xalloc(1 + pProp->size);
+ if (! text) return;
+ memcpy(text, pProp->data, pProp->size);
+ text[pProp->size] = '\0';
+ QuartzWriteCocoaPasteboard(text);
+ free(text);
+}
+
+
+// Read Mac OS X pasteboard into X cut buffer
+// Called by ProcessInputEvents() in response to request from X server thread.
+void QuartzReadPasteboard(void)
+{
+ char *text = QuartzReadCocoaPasteboard();
+ if (text) {
+ ChangeWindowProperty(WindowTable[0], XA_CUT_BUFFER0, XA_STRING, 8,
+ PropModeReplace, strlen(text), (pointer)text,TRUE);
+ free(text);
+ // fixme erase any current X selections
+ }
+}
diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzPasteboard.h b/xc/programs/Xserver/hw/darwin/bundle/quartzPasteboard.h
new file mode 100644
index 000000000..048de532d
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/quartzPasteboard.h
@@ -0,0 +1,20 @@
+/*
+ QuartzPasteboard.h
+
+ Mac OS X pasteboard <-> X cut buffer
+ Greg Parker gparker@cs.stanford.edu March 8, 2001
+*/
+/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzPasteboard.h,v 1.1 2001/03/15 22:24:27 torrey Exp $ */
+
+#ifndef _QUARTZPASTEBOARD_H
+#define _QUARTZPASTEBOARD_H
+
+// Aqua->X
+void QuartzReadPasteboard();
+char * QuartzReadCocoaPasteboard(void); // caller must free string
+
+// X->Aqua
+void QuartzWritePasteboard();
+void QuartzWriteCocoaPasteboard(char *text);
+
+#endif /* _QUARTZPASTEBOARD_H */ \ No newline at end of file
diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzShared.h b/xc/programs/Xserver/hw/darwin/bundle/quartzShared.h
new file mode 100644
index 000000000..9a69295ce
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/quartzShared.h
@@ -0,0 +1,38 @@
+/*
+ * Shared definitions between the Darwin X Server
+ * and the Cocoa front end.
+ */
+/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzShared.h,v 1.3 2001/04/05 06:08:46 torrey Exp $ */
+
+#ifndef _QUARTZSHARED_H
+#define _QUARTZSHARED_H
+
+// Data stored at startup for Cocoa front end
+extern int quartzEventWriteFD;
+extern int quartzStartClients;
+
+// User preferences used by X server
+extern int quartzUseSysBeep;
+extern int darwinFakeButtons;
+
+void QuartzReadPreferences(void);
+
+// NX_APPDEFINED event subtypes for special commands to the X server
+// update modifiers: update all modifier keys
+// show: vt switch to X server; recapture screen and restore X drawing
+// hide: vt switch away from X server; release screen and clip X drawing
+// quit: kill the X server and release the display
+// read pasteboard: copy Mac OS X pasteboard into X cut buffer
+// write pasteboard: copy X cut buffer onto Mac OS X pasteboard
+
+enum {
+ kXDarwinUpdateModifiers,
+ kXDarwinShow,
+ kXDarwinHide,
+ kXDarwinQuit,
+ kXDarwinReadPasteboard,
+ kXDarwinWritePasteboard
+};
+
+#endif /* _QUARTZSHARED_H */
+
diff --git a/xc/programs/Xserver/hw/darwin/bundle/quartzStartup.c b/xc/programs/Xserver/hw/darwin/bundle/quartzStartup.c
new file mode 100644
index 000000000..28bc1489f
--- /dev/null
+++ b/xc/programs/Xserver/hw/darwin/bundle/quartzStartup.c
@@ -0,0 +1,61 @@
+/**************************************************************
+ *
+ * Startup code for the Quartz Darwin X Server
+ *
+ **************************************************************/
+/* $XFree86: xc/programs/Xserver/hw/darwin/bundle/quartzStartup.c,v 1.3 2001/04/05 06:08:46 torrey Exp $ */
+
+#include <fcntl.h>
+#include "opaque.h"
+#include "../darwin.h"
+#include "quartzShared.h"
+
+char **envpGlobal; // argcGlobal and argvGlobal
+ // are from dix/globals.c
+
+/*
+ * DarwinHandleGUI
+ * This function is called first from main(). The first time
+ * it is called we start the Mac OS X front end. The front end
+ * will call main() again from another thread to run the X
+ * server. On the second call this function loads the user
+ * preferences set by the Mac OS X front end.
+ */
+void DarwinHandleGUI(
+ int argc,
+ char *argv[],
+ char *envp[] )
+{
+ static Bool been_here = FALSE;
+ int main_exit, i;
+ int fd[2];
+
+ if (been_here) {
+ QuartzReadPreferences();
+ return;
+ }
+ been_here = TRUE;
+
+ // Make a pipe to pass events
+ assert( pipe(fd) == 0 );
+ darwinEventFD = fd[0];
+ quartzEventWriteFD = fd[1];
+ fcntl(darwinEventFD, F_SETFL, O_NONBLOCK);
+
+ // Store command line arguments to pass back to main()
+ argcGlobal = argc;
+ argvGlobal = argv;
+ envpGlobal = envp;
+
+ // Determine if we need to start X clients
+ quartzStartClients = 1;
+ for (i = argc-1; i; i--) {
+ if (!strcmp(argv[i], "-nostartx")) {
+ quartzStartClients = 0;
+ }
+ }
+
+ quartz = TRUE;
+ main_exit = NSApplicationMain(argc, argv);
+ exit(main_exit);
+}