summaryrefslogtreecommitdiff
path: root/hw/darwin/apple
diff options
context:
space:
mode:
authorBen Byer <bbyer@bbyer.apple.com>2007-09-20 16:50:49 -0700
committerBen Byer <bbyer@bbyer.apple.com>2007-09-20 16:51:06 -0700
commit374bd88d1025835fe36ca0ff6620eb1d3b0a06b0 (patch)
tree5b6111132c99a614d8d1aaf23a5754c08dceacb8 /hw/darwin/apple
parent3a965fdadccea7beff09a28c9c0ef4b4975eae38 (diff)
XDarwin: Merging misc changes from downstream.
The only functional changes in this patch are a removal of use of Xtrans internals -- replaced by xcb, which doesn't seem to be used elsewhere in the server? Pity. Also, a fix to make all X11 windows pop to the front of the display when the X11.app icon is clicked -- currently takes two clicks, not sure why.
Diffstat (limited to 'hw/darwin/apple')
-rw-r--r--hw/darwin/apple/Info.plist38
-rw-r--r--hw/darwin/apple/X11Application.h2
-rw-r--r--hw/darwin/apple/X11Application.m8
-rw-r--r--hw/darwin/apple/X11Controller.m15
-rw-r--r--hw/darwin/apple/bundle-main.c42
5 files changed, 30 insertions, 75 deletions
diff --git a/hw/darwin/apple/Info.plist b/hw/darwin/apple/Info.plist
index ae47e9590..66f1f6be1 100644
--- a/hw/darwin/apple/Info.plist
+++ b/hw/darwin/apple/Info.plist
@@ -4,42 +4,6 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
- <key>CFBundleDocumentTypes</key>
- <array>
- <dict>
- <key>CFBundleTypeExtensions</key>
- <array>
- <string>x11app</string>
- </array>
- <key>CFBundleTypeIconFile</key>
- <string>X11.icns</string>
- <key>CFBundleTypeName</key>
- <string>X11 Application</string>
- <key>CFBundleTypeOSTypes</key>
- <array>
- <string>****</string>
- </array>
- <key>CFBundleTypeRole</key>
- <string>Viewer</string>
- <key>LSIsAppleDefaultForType</key>
- <true/>
- </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>X11</string>
<key>CFBundleGetInfoString</key>
@@ -57,7 +21,7 @@
<key>CFBundleShortVersionString</key>
<string>2.0</string>
<key>CFBundleSignature</key>
- <string>????</string>
+ <string>x11a</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
diff --git a/hw/darwin/apple/X11Application.h b/hw/darwin/apple/X11Application.h
index 6b1d72643..eb205a1cd 100644
--- a/hw/darwin/apple/X11Application.h
+++ b/hw/darwin/apple/X11Application.h
@@ -79,7 +79,7 @@ extern void X11ApplicationMain (int argc, const char *argv[],
extern int X11EnableKeyEquivalents;
extern int quartzHasRoot, quartzEnableRootless;
-#define APP_PREFS "com.apple.x11"
+#define APP_PREFS "org.x.x11"
#define PREFS_APPSMENU "apps_menu"
#define PREFS_FAKEBUTTONS "enable_fake_buttons"
diff --git a/hw/darwin/apple/X11Application.m b/hw/darwin/apple/X11Application.m
index 2d2132102..41cf425c6 100644
--- a/hw/darwin/apple/X11Application.m
+++ b/hw/darwin/apple/X11Application.m
@@ -41,13 +41,11 @@
# include "micmap.h"
#undef BOOL
-//#include "xf86Version.h"
-
#include <mach/mach.h>
#include <unistd.h>
#include <pthread.h>
-#define DEFAULTS_FILE "/etc/X11/xserver/Xquartz.plist"
+#define DEFAULTS_FILE "/usr/X11/lib/X11xserver/Xquartz.plist"
int X11EnableKeyEquivalents = TRUE;
int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
@@ -275,9 +273,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
_appFlags._active = YES;
[self activateX:YES];
-#ifdef DARWIN_DDX_MISSING
- if ([e data2] & 0x10) QuartzMessageServerThread (kXDarwinBringAllToFront, 0);
-#endif
+ if ([e data2] & 0x10) X11ApplicationSetFrontProcess();
}
break;
diff --git a/hw/darwin/apple/X11Controller.m b/hw/darwin/apple/X11Controller.m
index 3dc965b69..acac313f4 100644
--- a/hw/darwin/apple/X11Controller.m
+++ b/hw/darwin/apple/X11Controller.m
@@ -38,14 +38,12 @@
/* 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>
@@ -301,6 +299,7 @@
int child1, child2 = 0;
int status;
+ /* this old code doesn't work with csh ...
shell = getenv("SHELL");
if (shell == NULL) shell = "/bin/bash";
@@ -308,8 +307,14 @@
argv[1] = "-l";
argv[2] = "-c";
argv[3] = command;
- argv[4] = NULL;
-
+ argv[4] = NULL;
+ ... but the new code doesn't work with spaces in a command :(
+ */
+
+ argv[0] = "/usr/bin/login";
+ argv[1] = "-fp";
+ argv[2] = getlogin();
+
/* Do the fork-twice trick to avoid having to reap zombies */
child1 = fork();
@@ -655,7 +660,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
- (IBAction) x11_help:sender
{
- AHLookupAnchor (CFSTR ("Mac Help"), CFSTR ("mchlp2276"));
+ AHLookupAnchor ((CFStringRef)NSLocalizedString(@"Mac Help", no comment), CFSTR ("mchlp2276"));
}
- (BOOL) validateMenuItem:(NSMenuItem *)item
diff --git a/hw/darwin/apple/bundle-main.c b/hw/darwin/apple/bundle-main.c
index ec7820dc6..452da768a 100644
--- a/hw/darwin/apple/bundle-main.c
+++ b/hw/darwin/apple/bundle-main.c
@@ -70,14 +70,16 @@
#include <X11/Xlib.h>
#include <X11/Xauth.h>
-
+#ifdef USE_XCB
+#include <xcb/xcb.h>
+#endif
#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/X11/bin/quartz-wm"
-#define DEFAULT_XINITRC "/etc/X11/xinit/xinitrc"
+#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 */
@@ -595,37 +597,25 @@ static Boolean
display_exists_p (int number)
{
char buf[64];
- void *conn;
- char *fullname = NULL;
- int idisplay, iscreen;
- char *conn_auth_name, *conn_auth_data;
- int conn_auth_namelen, conn_auth_datalen;
-#ifdef USE_XTRANS_INTERNALS
- extern void *_X11TransConnectDisplay ();
- extern void _XDisconnectDisplay ();
-#endif
+#ifdef USE_XCB
+ xcb_connection_t *conn;
+#endif
+
/* 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;
-#ifdef USE_XTRANS_INTERNALS
- /* 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) */
-
+ if (access (buf, F_OK) != 0) return FALSE;
+
+#ifdef USE_XCB
sprintf (buf, ":%d", number);
- conn = _X11TransConnectDisplay (buf, &fullname, &idisplay, &iscreen,
- &conn_auth_name, &conn_auth_namelen,
- &conn_auth_data, &conn_auth_datalen);
- if (conn == NULL)
- return FALSE;
-
- _XDisconnectDisplay (conn);
+ conn = xcb_connect(buf, NULL);
+ if (conn == NULL) return FALSE;
+ xcb_disconnect(conn);
#endif
+
return TRUE;
}