xserver: Branch 'xorg-server-1.5-apple' - 8 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Sun Dec 21 21:36:07 PST 2008


 hw/xquartz/X11Application.m           |   22 ++++--
 hw/xquartz/X11Controller.m            |   30 +--------
 hw/xquartz/bundle/X11.sh              |    7 +-
 hw/xquartz/mach-startup/bundle-main.c |   32 +---------
 hw/xquartz/pbproxy/pbproxy.h          |    1 
 hw/xquartz/pbproxy/x-input.m          |  108 +++++++++++++++++-----------------
 hw/xquartz/quartz.c                   |   13 +---
 miext/rootless/rootlessScreen.c       |    2 
 miext/rootless/rootlessWindow.c       |    7 +-
 9 files changed, 94 insertions(+), 128 deletions(-)

New commits:
commit c53455ceeaab92c868cf2fb38f763c4360452c50
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Sun Dec 21 21:03:59 2008 -0800

    XQuartz: Don't use keycode 0 to determine !swallow since our most common key to swallow is actual keycode 0 (a)
    (cherry picked from commit 33f43a7f03023bfbab25a957cb81fc25b4afa4ca)

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index ac2e300..97382f5 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -266,7 +266,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
         case NSKeyDown: case NSKeyUp:
             
             if(_x_active) {
-                static int swallow_up;
+                static BOOL do_swallow = NO;
+                static int swallow_keycode;
                 
                 if([e type] == NSKeyDown) {
                     /* Before that though, see if there are any global
@@ -274,17 +275,20 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
 
                     if(darwinAppKitModMask & [e modifierFlags]) {
                         /* Override to force sending to Appkit */
-                        swallow_up = [e keyCode];
+                        swallow_keycode = [e keyCode];
+                        do_swallow = YES;
                         for_x = NO;
 #if XPLUGIN_VERSION >= 1
                     } else if(X11EnableKeyEquivalents &&
-                              xp_is_symbolic_hotkey_event([e eventRef])) {
-                        swallow_up = [e keyCode];
+                             xp_is_symbolic_hotkey_event([e eventRef])) {
+                        swallow_keycode = [e keyCode];
+                        do_swallow = YES;
                         for_x = NO;
 #endif
                     } else if(X11EnableKeyEquivalents &&
                               [[self mainMenu] performKeyEquivalent:e]) {
-                        swallow_up = [e keyCode];
+                        swallow_keycode = [e keyCode];
+                        do_swallow = YES;
                         for_appkit = NO;
                         for_x = NO;
                     } else if(!quartzEnableRootless
@@ -292,7 +296,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
                               && ([e keyCode] == 0 /*a*/ || [e keyCode] == 53 /*Esc*/)) {
                         /* We have this here to force processing fullscreen 
                          * toggle even if X11EnableKeyEquivalents is disabled */
-                        swallow_up = [e keyCode];
+                        swallow_keycode = [e keyCode];
+                        do_swallow = YES;
                         for_x = NO;
                         for_appkit = NO;
                         DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
@@ -303,9 +308,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
                 } else { /* KeyUp */
                     /* If we saw a key equivalent on the down, don't pass
                      * the up through to X. */
-                    
-                    if (swallow_up != 0 && [e keyCode] == swallow_up) {
-                        swallow_up = 0;
+                    if (do_swallow && [e keyCode] == swallow_keycode) {
+                        do_swallow = NO;
                         for_x = NO;
                     }
                 }
commit ea0d28bd0e6be247ff6fd5da9eb24c85c738986a
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Sun Dec 21 20:40:36 2008 -0800

    XQuartz: Update our "screens" when we toggle rootless rather than when we toggle fullscreen
    
    This old behavior was used as a workaround for the menubar behavior in the older server,
    but we handle it better now and need to update our screens when we toggle the rootless
    state instead.
    (cherry picked from commit 508aa95bc2cd3fdc3dff448ec090919bf807d153)

diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index ab73dff..ee94486 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -324,16 +324,9 @@ void QuartzSetFullscreen(Bool state) {
     if (quartzHasRoot && !quartzEnableRootless)
         RootlessShowAllWindows ();
     
-    /* Only update screen info when something is visible. Avoids the wm
-     * moving the windows out from under the menubar when it shouldn't
-     */
-    if (quartzHasRoot || quartzEnableRootless)
-        QuartzUpdateScreens();
-    
     /* Somehow the menubar manages to interfere with our event stream
      * in fullscreen mode, even though it's not visible. 
      */
-    
     X11ApplicationShowHideMenubar(!quartzHasRoot);
     
     xp_reenable_update ();
@@ -347,7 +340,10 @@ void QuartzSetRootless(Bool state) {
         return;
     
     quartzEnableRootless = state;
-    
+
+    /* When in rootless, the menubar is not part of the screen, so we need to update our screens on toggle */    
+    QuartzUpdateScreens();
+
     if (!quartzEnableRootless && !quartzHasRoot) {
         xp_disable_update();
         RootlessHideAllWindows();
@@ -355,7 +351,6 @@ void QuartzSetRootless(Bool state) {
     } else if (quartzEnableRootless && !quartzHasRoot) {
         xp_disable_update();
         RootlessShowAllWindows();
-        QuartzUpdateScreens();
         xp_reenable_update();
     }
 }
commit 10203479d1bc8e590c4aea99c4f39738cb7d842f
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
    (cherry picked from commit 67455e716e3ecffd528930479192785958d37988)

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 20e2d76dca6b0db09d4244161f4e84bf82be89bc
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
    (cherry picked from commit 22f664ab95a0cae981e9cefad6f075d051583ca5)

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 e9e2783e23697da87973e90e4b21385e2d282541
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.
    (cherry picked from commit cc805dc799efa37c8dcefa3db04d87e9b835ffbd)

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
 
commit dd48afc8e75dbe29035f1c9893d9f3eea16da6c8
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Thu Dec 18 09:14:16 2008 -0800

    XQuartz: Changed X11.sh to allow use of a ~/.x11run as requested by users of alternate shells
    (cherry picked from commit b62ed1f8eaf041a946bb591165bb18ee481dedbf)

diff --git a/hw/xquartz/bundle/X11.sh b/hw/xquartz/bundle/X11.sh
index 87c52b3..f6fac9f 100755
--- a/hw/xquartz/bundle/X11.sh
+++ b/hw/xquartz/bundle/X11.sh
@@ -1,3 +1,8 @@
 #!/bin/bash --login
 
-"$(dirname $0)"/X11.bin "${@}"
+if [ -x ~/.x11run ]; then
+	exec ~/.x11run "$(dirname $0)"/X11.bin "${@}"
+else
+	exec "$(dirname $0)"/X11.bin "${@}"
+fi
+
commit d3c22e660f3286094447e31a95e102f65c66d782
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Dec 17 15:09:35 2008 -0800

    XQuartz: Get rid of white rectangle bug
    (cherry picked from commit 3269959033ed0c675a3a906666454df34086896a)

diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index cffc164..1f2d478 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -636,7 +636,7 @@ RootlessReorderWindow(WindowPtr pWin)
 {
     RootlessWindowRec *winRec = WINREC(pWin);
 
-    if (winRec != NULL && !winRec->is_reorder_pending) {
+    if (pWin->realized && winRec != NULL && !winRec->is_reorder_pending && !windows_hidden) {
         WindowPtr newPrevW;
         RootlessWindowRec *newPrev;
         RootlessFrameID newPrevID;
@@ -1575,7 +1575,10 @@ RootlessOrderAllWindows (void)
 {
     int i;
     WindowPtr pWin;
-    
+
+    if (windows_hidden)
+        return;    
+
     RL_DEBUG_MSG("RootlessOrderAllWindows() ");
     for (i = 0; i < screenInfo.numScreens; i++) {
       if (screenInfo.screens[i] == NULL) continue;
commit e30fdf27bb6100aacbbdccd49358ddc34f73fb93
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Dec 17 14:43:02 2008 -0800

    rootless: Make expose_1 static
    (cherry picked from commit 60c8d2697036a125ca5381df8e2eaedabad4d242)

diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c
index 87d4c1c..4345c92 100644
--- a/miext/rootless/rootlessScreen.c
+++ b/miext/rootless/rootlessScreen.c
@@ -471,7 +471,7 @@ RootlessMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst,
     return result;
 }
 
-void expose_1 (WindowPtr pWin) {
+static void expose_1 (WindowPtr pWin) {
     WindowPtr pChild;
     
     if (!pWin->realized)


More information about the xorg-commit mailing list