[Xquartz-changes] xserver: Branch 'server-1.11-apple'

Jeremy Huddleston jeremyhu at freedesktop.org
Wed Jun 22 12:17:07 PDT 2011


 hw/xquartz/X11Application.m |   24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

New commits:
commit f50e445e479d05123ca24bf656662aa7bdaf65e1
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Jun 22 12:16:38 2011 -0700

    Seems to work on Lion...
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index c1902f2..840c0cf 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -341,11 +341,13 @@ extern CGSConnectionID _xp_cid;
             
         case NSAppKitDefined:
             switch ([e subtype]) {
+                static BOOL x_was_active = NO;
+
                 case NSApplicationActivatedEventType:
                     for_x = NO;
 
-                    ErrorF("NSApplicationActivatedEventType: %p %p %p 0x%lx\n", [self modalWindow], [self keyWindow], [e window], (unsigned long)[e data2]);                    
-                    if ([e window] == nil) {
+                    ErrorF("NSApplicationActivatedEventType: %s %p %p %p 0x%lx\n", x_was_active ? "YES" : "NO", [self modalWindow], [self keyWindow], [e window], (unsigned long)[e data2]);                    
+                    if ([e window] == nil && x_was_active) {
                         BOOL order_all_windows = YES, workspaces, ok;
                         for_appkit = NO;
 
@@ -353,10 +355,10 @@ extern CGSConnectionID _xp_cid;
                          * We need to change SetFrontProcessWithOptions to take an option
                          * to not bring any windows forward.
                          */
-                        //_appFlags._active = YES;
-                        [self setActive:YES];
+                        _appFlags._active = YES;
 
                         [self activateX:YES];
+                        X11ApplicationSetFrontProcess();
 
                         /* Get the Spaces preference for SwitchOnActivate */
                         (void)CFPreferencesAppSynchronize(CFSTR("com.apple.dock"));
@@ -378,19 +380,25 @@ extern CGSConnectionID _xp_cid;
                          *       If there are no active windows, and there are minimized windows, we should
                          *       be restoring one of them.
                          */
-                        if ([e data2] & 0x10) // 0x10 (bfCPSOrderAllWindowsForward) is set when we use cmd-tab or the dock icon
-                            CGSReorderWindows(_xp_cid);
-                            //DarwinSendDDXEvent(kXquartzBringAllToFront, 1, order_all_windows);
+                        if ([e data2] & 0x10) { // 0x10 (bfCPSOrderAllWindowsForward) is set when we use cmd-tab or the dock icon
+                            DarwinSendDDXEvent(kXquartzBringAllToFront, 1, order_all_windows);
+                            //CGSReorderWindows(_xp_cid);
+                        }
                     }
                     break;
                     
                 case 18: /* ApplicationDidReactivate */
+                    ErrorF("NSApplicationDidReActivate\n");
                     if (XQuartzFullscreenVisible) for_appkit = NO;
                     break;
                     
                 case NSApplicationDeactivatedEventType:
+                    ErrorF("NSApplicationDeactivatedEventType\n");
                     for_x = NO;
-                    [self activateX:NO];
+
+                    x_was_active = _x_active;
+                    if(_x_active)
+                        [self activateX:NO];
                     break;
             }
             break;


More information about the Xquartz-changes mailing list