xserver: Branch 'xorg-server-1.4-apple' - 3 commits
Jeremy Huddleston
jeremyhu at kemper.freedesktop.org
Sun Dec 21 14:55:17 PST 2008
hw/xquartz/X11Controller.m | 30 +--------
hw/xquartz/bundle/X11.sh | 4 -
hw/xquartz/mach-startup/bundle-main.c | 32 +---------
hw/xquartz/pbproxy/pbproxy.h | 1
hw/xquartz/pbproxy/x-input.m | 108 +++++++++++++++++-----------------
5 files changed, 67 insertions(+), 108 deletions(-)
New commits:
commit 67455e716e3ecffd528930479192785958d37988
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Sun Dec 21 14:54:11 2008 -0800
XQuartz: Run applications via '/bin/sh -c ...' to support users who expect shell parsing
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index 7222f46..9b30fa6 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -314,36 +314,16 @@ BOOL xquartz_resetenv_display = NO;
- (void) launch_client:(NSString *)filename
{
- const char *command = [filename UTF8String];
int child1, child2 = 0;
int status;
- char newcommand[1024];
- char *newargv[1024];
+ const char *newargv[4];
char buf[128];
- size_t newargc;
char *s;
- if(strlen(command) > 1023) {
- fprintf(stderr, "Error: command is too long: %s\n", command);
- return;
- }
-
- strlcpy(newcommand, command, 1024);
-
- for(newargc=0, s=newcommand; *s; newargc++) {
- for(; *s && *s == ' '; s++);
- if(!*s)
- break;
-
- newargv[newargc] = s;
- for(; *s && *s != ' '; s++);
-
- if(*s) {
- *s='\0';
- s++;
- }
- }
- newargv[newargc] = NULL;
+ newargv[0] = [X11App prefs_get_string:@PREFS_LOGIN_SHELL default:"/bin/sh"];
+ newargv[1] = "-c";
+ newargv[2] = [filename UTF8String];
+ newargv[3] = NULL;
s = getenv("DISPLAY");
if (xquartz_resetenv_display || s == NULL || s[0] == 0) {
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index 7677a9a..fd70f26 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -531,33 +531,13 @@ int main(int argc, char **argv, char **envp) {
}
static int execute(const char *command) {
- char newcommand[1024];
- char *newargv[1024];
- size_t newargc;
- char *s;
- char **p;
-
- if(strlen(command) > 1023) {
- fprintf(stderr, "Error: command is too long: %s\n", command);
- return 1;
- }
-
- strlcpy(newcommand, command, 1024);
+ const char *newargv[4];
+ const char **p;
- for(newargc=0, s=newcommand; *s; newargc++) {
- for(; *s && *s == ' '; s++);
- if(!*s)
- break;
-
- newargv[newargc] = s;
- for(; *s && *s != ' '; s++);
-
- if(*s) {
- *s='\0';
- s++;
- }
- }
- newargv[newargc] = NULL;
+ newargv[0] = command_from_prefs("login_shell", DEFAULT_SHELL);
+ newargv[1] = "-c";
+ newargv[2] = command;
+ newargv[3] = NULL;
fprintf(stderr, "X11.app: Launching %s:\n", command);
for(p=newargv; *p; p++) {
commit 22f664ab95a0cae981e9cefad6f075d051583ca5
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Sun Dec 21 14:43:12 2008 -0800
XQuartz: pbproxy: Release display notification lock when not needed to avoid deadlock
diff --git a/hw/xquartz/pbproxy/pbproxy.h b/hw/xquartz/pbproxy/pbproxy.h
index eb1f3ba..d24d08b 100644
--- a/hw/xquartz/pbproxy/pbproxy.h
+++ b/hw/xquartz/pbproxy/pbproxy.h
@@ -76,7 +76,6 @@ extern BOOL xpbproxy_have_xfixes;
/* from x-input.m */
extern BOOL xpbproxy_input_register (void);
-extern void xpbproxy_input_run (void);
#ifdef DEBUG
/* BEWARE: this can cause a string memory leak, according to the leaks program. */
diff --git a/hw/xquartz/pbproxy/x-input.m b/hw/xquartz/pbproxy/x-input.m
index ca7c30d..acd01af 100644
--- a/hw/xquartz/pbproxy/x-input.m
+++ b/hw/xquartz/pbproxy/x-input.m
@@ -47,8 +47,8 @@ static CFRunLoopSourceRef xpbproxy_dpy_source;
BOOL xpbproxy_prefs_reload = NO;
#endif
-static pthread_mutex_t xpbproxy_dpy_lock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t xpbproxy_dpy_cond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t xpbproxy_dpy_rdy_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t xpbproxy_dpy_rdy_cond = PTHREAD_COND_INITIALIZER;
static inline pthread_t create_thread(void *func, void *arg) {
pthread_attr_t attr;
@@ -63,15 +63,6 @@ static inline pthread_t create_thread(void *func, void *arg) {
return tid;
}
-static void *xpbproxy_input_thread(void *args) {
- pthread_mutex_lock(&xpbproxy_dpy_lock);
- while(true) {
- xpbproxy_input_run();
- pthread_cond_wait(&xpbproxy_dpy_cond, &xpbproxy_dpy_lock);
- }
-}
-
-
/* Timestamp when the X server last told us it's active */
static Time last_activation_time;
@@ -110,51 +101,60 @@ static void x_event_apple_wm_notify(XAppleWMNotifyEvent *e) {
}
}
-void xpbproxy_input_run (void) {
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- if (nil == pool)
- {
- fprintf(stderr, "unable to allocate/init auto release pool!\n");
- return;
- }
-
- while (XPending (xpbproxy_dpy) != 0) {
- XEvent e;
- XNextEvent (xpbproxy_dpy, &e);
+static void *xpbproxy_input_thread(void *args) {
+ pthread_mutex_lock(&xpbproxy_dpy_rdy_lock);
+ while(true) {
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- switch (e.type) {
- case SelectionClear:
- if([xpbproxy_selection_object() is_active])
- [xpbproxy_selection_object () clear_event:&e.xselectionclear];
- break;
-
- case SelectionRequest:
- [xpbproxy_selection_object () request_event:&e.xselectionrequest];
- break;
-
- case SelectionNotify:
- [xpbproxy_selection_object () notify_event:&e.xselection];
- break;
-
- case PropertyNotify:
- [xpbproxy_selection_object () property_event:&e.xproperty];
- break;
-
- default:
- if(e.type >= xpbproxy_apple_wm_event_base &&
- e.type < xpbproxy_apple_wm_event_base + AppleWMNumberEvents) {
- x_event_apple_wm_notify((XAppleWMNotifyEvent *) &e);
- } else if(e.type == xpbproxy_xfixes_event_base + XFixesSelectionNotify) {
- [xpbproxy_selection_object() xfixes_selection_notify:(XFixesSelectionNotifyEvent *)&e];
- }
- break;
+ if(pool == nil) {
+ fprintf(stderr, "unable to allocate/init auto release pool!\n");
+ break;
}
- XFlush(xpbproxy_dpy);
+ while (XPending(xpbproxy_dpy) != 0) {
+ XEvent e;
+
+ pthread_mutex_unlock(&xpbproxy_dpy_rdy_lock);
+ XNextEvent (xpbproxy_dpy, &e);
+
+ switch (e.type) {
+ case SelectionClear:
+ if([xpbproxy_selection_object() is_active])
+ [xpbproxy_selection_object () clear_event:&e.xselectionclear];
+ break;
+
+ case SelectionRequest:
+ [xpbproxy_selection_object () request_event:&e.xselectionrequest];
+ break;
+
+ case SelectionNotify:
+ [xpbproxy_selection_object () notify_event:&e.xselection];
+ break;
+
+ case PropertyNotify:
+ [xpbproxy_selection_object () property_event:&e.xproperty];
+ break;
+
+ default:
+ if(e.type >= xpbproxy_apple_wm_event_base &&
+ e.type < xpbproxy_apple_wm_event_base + AppleWMNumberEvents) {
+ x_event_apple_wm_notify((XAppleWMNotifyEvent *) &e);
+ } else if(e.type == xpbproxy_xfixes_event_base + XFixesSelectionNotify) {
+ [xpbproxy_selection_object() xfixes_selection_notify:(XFixesSelectionNotifyEvent *)&e];
+ }
+ break;
+ }
+
+ XFlush(xpbproxy_dpy);
+ pthread_mutex_lock(&xpbproxy_dpy_rdy_lock);
+ }
+
+ [pool release];
+
+ pthread_cond_wait(&xpbproxy_dpy_rdy_cond, &xpbproxy_dpy_rdy_lock);
}
- [pool release];
+ return NULL;
}
static BOOL add_input_socket (int sock, CFOptionFlags callback_types,
@@ -191,9 +191,9 @@ static void x_input_callback (CFSocketRef sock, CFSocketCallBackType type,
}
#endif
- pthread_mutex_lock(&xpbproxy_dpy_lock);
- pthread_cond_broadcast(&xpbproxy_dpy_cond);
- pthread_mutex_unlock(&xpbproxy_dpy_lock);
+ pthread_mutex_lock(&xpbproxy_dpy_rdy_lock);
+ pthread_cond_broadcast(&xpbproxy_dpy_rdy_cond);
+ pthread_mutex_unlock(&xpbproxy_dpy_rdy_lock);
}
BOOL xpbproxy_input_register(void) {
commit cc805dc799efa37c8dcefa3db04d87e9b835ffbd
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Sun Dec 21 14:42:26 2008 -0800
XQuartz: update quoting in case X11.app is moved to a directory with a space.
diff --git a/hw/xquartz/bundle/X11.sh b/hw/xquartz/bundle/X11.sh
index f6fac9f..4295da9 100755
--- a/hw/xquartz/bundle/X11.sh
+++ b/hw/xquartz/bundle/X11.sh
@@ -1,8 +1,8 @@
#!/bin/bash --login
if [ -x ~/.x11run ]; then
- exec ~/.x11run "$(dirname $0)"/X11.bin "${@}"
+ exec ~/.x11run "$(dirname "$0")"/X11.bin "${@}"
else
- exec "$(dirname $0)"/X11.bin "${@}"
+ exec "$(dirname "$0")"/X11.bin "${@}"
fi
More information about the xorg-commit
mailing list