xserver: Branch 'xorg-server-1.4-apple' - 5 commits
Jeremy Huddleston
jeremyhu at kemper.freedesktop.org
Tue Nov 25 00:51:53 PST 2008
hw/xquartz/X11Application.h | 2
hw/xquartz/X11Application.m | 17 ++--
hw/xquartz/mach-startup/bundle-main.c | 14 ++-
hw/xquartz/pbproxy/app-main.m | 26 ++++++
hw/xquartz/pbproxy/main.m | 25 +++++-
hw/xquartz/pbproxy/x-selection.m | 7 -
hw/xquartz/quartzKeyboard.c | 137 ----------------------------------
7 files changed, 73 insertions(+), 155 deletions(-)
New commits:
commit 7a8c6665949d7804a97ef2539a74ec4aa682e1cc
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Tue Nov 25 00:51:01 2008 -0800
XQuartz: Add fallback for xpbproxy's display for Tiger or no-launchd-Leopard
diff --git a/hw/xquartz/pbproxy/app-main.m b/hw/xquartz/pbproxy/app-main.m
index e4a4652..cb0fa57 100644
--- a/hw/xquartz/pbproxy/app-main.m
+++ b/hw/xquartz/pbproxy/app-main.m
@@ -37,6 +37,8 @@
static const char *app_prefs_domain = "org.x.X11";
CFStringRef app_prefs_domain_cfstr;
+char *display = NULL;
+
static void signal_handler (int sig) {
switch(sig) {
case SIGHUP:
diff --git a/hw/xquartz/pbproxy/main.m b/hw/xquartz/pbproxy/main.m
index efa42e3..17720ab 100644
--- a/hw/xquartz/pbproxy/main.m
+++ b/hw/xquartz/pbproxy/main.m
@@ -31,6 +31,7 @@
#import "x-selection.h"
#include <pthread.h>
+#include <unistd.h>
#include <X11/extensions/applewm.h>
Display *xpbproxy_dpy;
@@ -38,6 +39,8 @@ int xpbproxy_apple_wm_event_base, xpbproxy_apple_wm_error_base;
int xpbproxy_xfixes_event_base, xpbproxy_xfixes_error_base;
BOOL xpbproxy_have_xfixes;
+extern char *display;
+
#ifdef STANDALONE_XPBPROXY
BOOL xpbproxy_is_standalone = NO;
#endif
@@ -67,10 +70,24 @@ static int x_error_handler (Display *dpy, XErrorEvent *errevent) {
BOOL xpbproxy_init (void) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- xpbproxy_dpy = XOpenDisplay (NULL);
+ size_t i;
+
+ for(i=0, xpbproxy_dpy=NULL; !xpbproxy_dpy && i<5; i++) {
+ xpbproxy_dpy = XOpenDisplay(NULL);
+
+ if(!xpbproxy_dpy && display) {
+ char *_display = alloca(sizeof(char) * (strlen(display) + 2));
+ strcpy(_display+1, display);
+ *_display=':';
+
+ xpbproxy_dpy=XOpenDisplay(_display);
+ }
+ if(!xpbproxy_dpy)
+ sleep(1);
+ }
+
if (xpbproxy_dpy == NULL) {
- fprintf (stderr, "can't open default display\n");
+ fprintf (stderr, "xpbproxy: can't open default display\n");
[pool release];
return FALSE;
}
@@ -80,7 +97,7 @@ BOOL xpbproxy_init (void) {
if (!XAppleWMQueryExtension (xpbproxy_dpy, &xpbproxy_apple_wm_event_base,
&xpbproxy_apple_wm_error_base)) {
- fprintf (stderr, "can't open AppleWM server extension\n");
+ fprintf (stderr, "xpbproxy: can't open AppleWM server extension\n");
[pool release];
return FALSE;
}
commit fbf4b0d33fa5dc618c3191a4e823232dfa33cd95
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Tue Nov 25 00:39:52 2008 -0800
XQuartz: Use the environment to pass the bundle's prefs domain on to xinit/quartz-wm for Tiger or no-launchd-LEOPARD
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index 058fe78..fa19eab 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -426,6 +426,17 @@ int main(int argc, char **argv, char **envp) {
/* Setup the initial crasherporter info */
strlcpy(__crashreporter_info__, __crashreporter_info__base, __crashreporter_info__len);
+ /* Pass on our prefs domain to startx and its inheritors (mainly for quartz-wm) */
+ CFBundleRef bundle = CFBundleGetMainBundle();
+ if(bundle) {
+ CFStringRef pd = CFBundleGetIdentifier(bundle);
+ if(pd) {
+ const char *pds = CFStringGetCStringPtr(pd, 0);
+ if(pds)
+ setenv("X11_PREFS_DOMAIN", pds, 1);
+ }
+ }
+
fprintf(stderr, "X11.app: main(): argc=%d\n", argc);
for(i=0; i < argc; i++) {
fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]);
commit eeb323612e0adbea37befed31bbaa1d295728385
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Tue Nov 25 00:20:57 2008 -0800
XQuartz: Dead code removal
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index d9c895e..058fe78 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -75,9 +75,6 @@ char *__crashreporter_info__ = __crashreporter_info__buf;
#define DEBUG 1
-static int execute(const char *command);
-static char *command_from_prefs(const char *key, const char *default_value);
-
/* This is in quartzStartup.c */
int server_main(int argc, char **argv, char **envp);
commit 3a500d9247cf34686ec17b4a88c34d51ecd38ecd
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Tue Nov 25 00:15:53 2008 -0800
XQuartz: Don't hardcode values of org.x.X11 for the preferences domain
diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index 91debd6..1cfbe08 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -75,8 +75,6 @@ void X11ApplicationMain(int argc, char **argv, char **envp);
extern int X11EnableKeyEquivalents;
extern int quartzHasRoot, quartzEnableRootless, quartzFullscreenMenu;
-#define APP_PREFS "org.x.X11"
-
#define PREFS_APPSMENU "apps_menu"
#define PREFS_FAKEBUTTONS "enable_fake_buttons"
#define PREFS_SYSBEEP "enable_system_beep"
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 9df4bce..eb0b8ba 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -76,6 +76,8 @@ extern int darwinFakeButtons;
X11Application *X11App;
+CFStringRef app_prefs_domain_cfstr = NULL;
+
#define ALL_KEY_MASKS (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask)
@interface X11Application (Private)
@@ -466,7 +468,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
- (CFPropertyListRef) prefs_get:(NSString *)key {
CFPropertyListRef value;
- value = CFPreferencesCopyAppValue ((CFStringRef) key, CFSTR (APP_PREFS));
+ value = CFPreferencesCopyAppValue ((CFStringRef) key, app_prefs_domain_cfstr);
if (value == NULL) {
static CFDictionaryRef defaults;
@@ -618,7 +620,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
x = CFNumberCreate (NULL, kCFNumberIntType, &value);
- CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, CFSTR (APP_PREFS),
+ CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, app_prefs_domain_cfstr,
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
CFRelease (x);
@@ -629,7 +631,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
x = CFNumberCreate (NULL, kCFNumberFloatType, &value);
- CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, CFSTR (APP_PREFS),
+ CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, app_prefs_domain_cfstr,
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
CFRelease (x);
@@ -638,7 +640,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
- (void) prefs_set_boolean:(NSString *)key value:(int)value {
CFPreferencesSetValue ((CFStringRef) key,
(CFTypeRef) (value ? kCFBooleanTrue
- : kCFBooleanFalse), CFSTR (APP_PREFS),
+ : kCFBooleanFalse), app_prefs_domain_cfstr,
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
}
@@ -649,14 +651,14 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
cfarray = nsarray_to_cfarray (value);
CFPreferencesSetValue ((CFStringRef) key,
(CFTypeRef) cfarray,
- CFSTR (APP_PREFS),
+ app_prefs_domain_cfstr,
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
CFRelease (cfarray);
}
- (void) prefs_set_string:(NSString *)key value:(NSString *)value {
CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) value,
- CFSTR (APP_PREFS), kCFPreferencesCurrentUser,
+ app_prefs_domain_cfstr, kCFPreferencesCurrentUser,
kCFPreferencesAnyHost);
}
@@ -856,6 +858,9 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
pool = [[NSAutoreleasePool alloc] init];
X11App = (X11Application *) [X11Application sharedApplication];
init_ports ();
+
+ app_prefs_domain_cfstr = (CFStringRef)[[NSBundle mainBundle] bundleIdentifier];
+
[NSApp read_defaults];
[NSBundle loadNibNamed:@"main" owner:NSApp];
[[NSNotificationCenter defaultCenter] addObserver:NSApp
diff --git a/hw/xquartz/pbproxy/app-main.m b/hw/xquartz/pbproxy/app-main.m
index b5748da..e4a4652 100644
--- a/hw/xquartz/pbproxy/app-main.m
+++ b/hw/xquartz/pbproxy/app-main.m
@@ -34,6 +34,9 @@
#include <unistd.h> /*for getpid*/
#include <Cocoa/Cocoa.h>
+static const char *app_prefs_domain = "org.x.X11";
+CFStringRef app_prefs_domain_cfstr;
+
static void signal_handler (int sig) {
switch(sig) {
case SIGHUP:
@@ -50,6 +53,27 @@ int main (int argc, const char *argv[]) {
#endif
xpbproxy_is_standalone = YES;
+
+ if((s = getenv("X11_PREFS_DOMAIN")))
+ app_prefs_domain = s;
+
+ for (i = 1; i < argc; i++) {
+ if(strcmp (argv[i], "--prefs-domain") == 0 && i+1 < argc) {
+ app_prefs_domain = argv[++i];
+ } else if (strcmp (argv[i], "--help") == 0) {
+ printf("usage: xpbproxy OPTIONS\n"
+ "Pasteboard proxying for X11.\n\n"
+ "--prefs-domain <domain> Change the domain used for reading preferences\n"
+ " (default: org.x.X11)\n");
+ return 0;
+ } else {
+ fprintf(stderr, "usage: xpbproxy OPTIONS...\n"
+ "Try 'xpbproxy --help' for more information.\n");
+ return 1;
+ }
+ }
+
+ app_prefs_domain_cfstr = CFStringCreateWithCString(NULL, app_prefs_domain, kCFStringEncodingUTF8);
if(!xpbproxy_init())
return EXIT_FAILURE;
diff --git a/hw/xquartz/pbproxy/x-selection.m b/hw/xquartz/pbproxy/x-selection.m
index 9604995..cd540be 100644
--- a/hw/xquartz/pbproxy/x-selection.m
+++ b/hw/xquartz/pbproxy/x-selection.m
@@ -97,12 +97,13 @@ dump_prefs (FILE *fp) {
}
#endif
-#define APP_PREFS "org.x.X11"
+extern CFStringRef app_prefs_domain_cfstr;
+
static BOOL
prefs_get_bool (CFStringRef key, BOOL defaultValue) {
Boolean value, ok;
- value = CFPreferencesGetAppBooleanValue (key, CFSTR (APP_PREFS), &ok);
+ value = CFPreferencesGetAppBooleanValue (key, app_prefs_domain_cfstr, &ok);
return ok ? (BOOL) value : defaultValue;
}
@@ -1425,7 +1426,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
* It's uncertain how we could handle the synchronization failing, so cast to void.
* The prefs_get_bool should fall back to defaults if the org.x.X11 plist doesn't exist or is invalid.
*/
- (void)CFPreferencesAppSynchronize(CFSTR(APP_PREFS));
+ (void)CFPreferencesAppSynchronize(app_prefs_domain_cfstr);
#ifdef STANDALONE_XPBPROXY
if(xpbproxy_is_standalone)
pbproxy_prefs.active = YES;
commit dcb0f6a2e62823a671051874d14a33ce59505892
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Mon Nov 24 23:33:54 2008 -0800
XQuartz: More dead code removal
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 8670cd4..8ac05dd 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -77,143 +77,6 @@ enum {
#define UKEYSYM(u) ((u) | 0x01000000)
-#define AltMask Mod1Mask
-#define MetaMask Mod2Mask
-#define FunctionMask Mod3Mask
-
-#define UK(a) NoSymbol // unknown symbol
-
-static KeySym const next_to_x[256] = {
- NoSymbol, NoSymbol, NoSymbol, XK_KP_Enter,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, XK_Return, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
-// 128
- NoSymbol, XK_Agrave, XK_Aacute, XK_Acircumflex,
- XK_Atilde, XK_Adiaeresis, XK_Aring, XK_Ccedilla,
- XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
- XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
-// 144
- XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
- XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_Ugrave,
- XK_Uacute, XK_Ucircumflex, XK_Udiaeresis, XK_Yacute,
- XK_THORN, XK_mu, XK_multiply, XK_division,
-// 160
- XK_copyright, XK_exclamdown, XK_cent, XK_sterling,
- UK(fraction), XK_yen, UK(fhook), XK_section,
- XK_currency, XK_rightsinglequotemark,
- XK_leftdoublequotemark,
- XK_guillemotleft,
- XK_leftanglebracket,
- XK_rightanglebracket,
- UK(filigature), UK(flligature),
-// 176
- XK_registered, XK_endash, XK_dagger, XK_doubledagger,
- XK_periodcentered,XK_brokenbar, XK_paragraph, UK(bullet),
- XK_singlelowquotemark,
- XK_doublelowquotemark,
- XK_rightdoublequotemark,
- XK_guillemotright,
- XK_ellipsis, UK(permille), XK_notsign, XK_questiondown,
-// 192
- XK_onesuperior, XK_dead_grave, XK_dead_acute, XK_dead_circumflex,
- XK_dead_tilde, XK_dead_macron, XK_dead_breve, XK_dead_abovedot,
- XK_dead_diaeresis,
- XK_twosuperior, XK_dead_abovering,
- XK_dead_cedilla,
- XK_threesuperior,
- XK_dead_doubleacute,
- XK_dead_ogonek, XK_dead_caron,
-// 208
- XK_emdash, XK_plusminus, XK_onequarter, XK_onehalf,
- XK_threequarters,
- XK_agrave, XK_aacute, XK_acircumflex,
- XK_atilde, XK_adiaeresis, XK_aring, XK_ccedilla,
- XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
-// 224
- XK_igrave, XK_AE, XK_iacute, XK_ordfeminine,
- XK_icircumflex, XK_idiaeresis, XK_eth, XK_ntilde,
- XK_Lstroke, XK_Ooblique, XK_OE, XK_masculine,
- XK_ograve, XK_oacute, XK_ocircumflex, XK_otilde,
-// 240
- XK_odiaeresis, XK_ae, XK_ugrave, XK_uacute,
- XK_ucircumflex, XK_idotless, XK_udiaeresis, XK_ygrave,
- XK_lstroke, XK_ooblique, XK_oe, XK_ssharp,
- XK_thorn, XK_ydiaeresis, NoSymbol, NoSymbol,
- };
-
-#define MIN_SYMBOL 0xAC
-static KeySym const symbol_to_x[] = {
- XK_Left, XK_Up, XK_Right, XK_Down
- };
-static int const NUM_SYMBOL = sizeof(symbol_to_x) / sizeof(symbol_to_x[0]);
-
-#define MIN_FUNCKEY 0x20
-static KeySym const funckey_to_x[] = {
- XK_F1, XK_F2, XK_F3, XK_F4,
- XK_F5, XK_F6, XK_F7, XK_F8,
- XK_F9, XK_F10, XK_F11, XK_F12,
- XK_Insert, XK_Delete, XK_Home, XK_End,
- XK_Page_Up, XK_Page_Down, XK_F13, XK_F14,
- XK_F15
- };
-static int const NUM_FUNCKEY = sizeof(funckey_to_x) / sizeof(funckey_to_x[0]);
-
-typedef struct {
- KeySym normalSym;
- KeySym keypadSym;
-} darwinKeyPad_t;
-
-static darwinKeyPad_t const normal_to_keypad[] = {
- { XK_0, XK_KP_0 },
- { XK_1, XK_KP_1 },
- { XK_2, XK_KP_2 },
- { XK_3, XK_KP_3 },
- { XK_4, XK_KP_4 },
- { XK_5, XK_KP_5 },
- { XK_6, XK_KP_6 },
- { XK_7, XK_KP_7 },
- { XK_8, XK_KP_8 },
- { XK_9, XK_KP_9 },
- { XK_equal, XK_KP_Equal },
- { XK_asterisk, XK_KP_Multiply },
- { XK_plus, XK_KP_Add },
- { XK_comma, XK_KP_Separator },
- { XK_minus, XK_KP_Subtract },
- { XK_period, XK_KP_Decimal },
- { XK_slash, XK_KP_Divide }
-};
-
-static int const NUM_KEYPAD = sizeof(normal_to_keypad) / sizeof(normal_to_keypad[0]);
-
/* Table of keycode->keysym mappings we use to fallback on for important
keys that are often not in the Unicode mapping. */
More information about the xorg-commit
mailing list