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

Jeremy Huddleston jeremyhu at freedesktop.org
Wed Jun 22 11:55:05 PDT 2011


Rebased ref, commits from common ancestor:
commit ad6905c0f6f31749a826dced2d260bf39e32b021
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Jun 22 11:54:01 2011 -0700

    mor hacky work for app focus
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 0af3d68..c1902f2 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -343,7 +343,9 @@ extern CGSConnectionID _xp_cid;
             switch ([e subtype]) {
                 case NSApplicationActivatedEventType:
                     for_x = NO;
-                    if ([self modalWindow] == nil) {
+
+                    ErrorF("NSApplicationActivatedEventType: %p %p %p 0x%lx\n", [self modalWindow], [self keyWindow], [e window], (unsigned long)[e data2]);                    
+                    if ([e window] == nil) {
                         BOOL order_all_windows = YES, workspaces, ok;
                         for_appkit = NO;
 
@@ -351,7 +353,9 @@ 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 setActive:YES];
+
                         [self activateX:YES];
 
                         /* Get the Spaces preference for SwitchOnActivate */
commit 89dc2cf8438c7460efe21bf8883cb24b94f5fcf8
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Jun 22 11:32:32 2011 -0700

    try using cgs
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 723b7c8..0af3d68 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -218,6 +218,9 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
 	[self activateX:NO];
 }
 
+#include <CoreGraphics/CoreGraphicsPrivate.h>
+extern CGSConnectionID _xp_cid;
+
 - (void) sendEvent:(NSEvent *)e {
     OSX_BOOL for_appkit, for_x;
     
@@ -344,12 +347,12 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
                         BOOL order_all_windows = YES, workspaces, ok;
                         for_appkit = NO;
 
-                       /* FIXME: This causes us to pass the event to AppKit
-                        * which may result in it raising one of its windows.
-                        * We need SetFrontProcessWithOptions to take an option
-                        * to not bring any windows forward.
-                        */
-                        X11ApplicationSetFrontProcess();
+                        /* FIXME: This can result in raising one of AppKits windows.
+                         * We need to change SetFrontProcessWithOptions to take an option
+                         * to not bring any windows forward.
+                         */
+                        _appFlags._active = YES; // [self setActive:YES];
+                        [self activateX:YES];
 
                         /* Get the Spaces preference for SwitchOnActivate */
                         (void)CFPreferencesAppSynchronize(CFSTR("com.apple.dock"));
@@ -372,7 +375,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
                          *       be restoring one of them.
                          */
                         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);
+                            //DarwinSendDDXEvent(kXquartzBringAllToFront, 1, order_all_windows);
                     }
                     break;
                     
commit ae7f410418ae6462e28557ae33eefdbee32e975b
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Tue Jun 21 22:54:16 2011 -0700

    Always set front process
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index f9109ab..723b7c8 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -344,6 +344,13 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
                         BOOL order_all_windows = YES, workspaces, ok;
                         for_appkit = NO;
 
+                       /* FIXME: This causes us to pass the event to AppKit
+                        * which may result in it raising one of its windows.
+                        * We need SetFrontProcessWithOptions to take an option
+                        * to not bring any windows forward.
+                        */
+                        X11ApplicationSetFrontProcess();
+
                         /* Get the Spaces preference for SwitchOnActivate */
                         (void)CFPreferencesAppSynchronize(CFSTR("com.apple.dock"));
                         workspaces = CFPreferencesGetAppBooleanValue(CFSTR("workspaces"), CFSTR("com.apple.dock"), &ok);
@@ -364,21 +371,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
                          *       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
-                           /* FIXME: This causes us to pass the event to AppKit
-                            * which may result in it raising one of its windows.
-                            * We need SetFrontProcessWithOptions to take an option
-                            * to not bring any windows forward.
-                            */
-                            X11ApplicationSetFrontProcess();
+                        if ([e data2] & 0x10) // 0x10 (bfCPSOrderAllWindowsForward) is set when we use cmd-tab or the dock icon
                             DarwinSendDDXEvent(kXquartzBringAllToFront, 1, order_all_windows);
-                        } else {
-                            /* FIXME: hack to avoid having to pass the event to appkit,
-                             * which would cause it to raise one of its windows.
-                             */
-                            _appFlags._active = YES;
-                            [self activateX:YES];
-                        }
                     }
                     break;
                     
commit 49214b4872dde840ba711ea5efb87103eef52968
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Tue Jun 21 21:14:46 2011 -0700

    XQuartz: Avoid editing AppKit internals when setting ourselves as the active process
    
    This changes us from setting _active directly to calling X11ApplicationSetFrontProcess
    which calls into activateIgnoringOtherApps and eventually SetFrontProcessWithOptions.
    
    This should hopefully solve some issues with process switching, but we may have some
    AppKit/X11 interaction regressions.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 31aa9b9..f9109ab 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -343,13 +343,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
                     if ([self modalWindow] == nil) {
                         BOOL order_all_windows = YES, workspaces, ok;
                         for_appkit = NO;
-                        
-                        /* FIXME: hack to avoid having to pass the event to appkit,
-                         which would cause it to raise one of its windows. */
-                        _appFlags._active = YES;
-                        
-                        [self activateX:YES];
-                        
+
                         /* Get the Spaces preference for SwitchOnActivate */
                         (void)CFPreferencesAppSynchronize(CFSTR("com.apple.dock"));
                         workspaces = CFPreferencesGetAppBooleanValue(CFSTR("workspaces"), CFSTR("com.apple.dock"), &ok);
@@ -370,8 +364,21 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
                          *       If there are no active windows, and there are minimized windows, we should
                          *       be restoring one of them.
                          */
-                        if ([e data2] & 0x10) // 0x10 is set when we use cmd-tab or the dock icon
+                        if ([e data2] & 0x10) { // 0x10 (bfCPSOrderAllWindowsForward) is set when we use cmd-tab or the dock icon
+                           /* FIXME: This causes us to pass the event to AppKit
+                            * which may result in it raising one of its windows.
+                            * We need SetFrontProcessWithOptions to take an option
+                            * to not bring any windows forward.
+                            */
+                            X11ApplicationSetFrontProcess();
                             DarwinSendDDXEvent(kXquartzBringAllToFront, 1, order_all_windows);
+                        } else {
+                            /* FIXME: hack to avoid having to pass the event to appkit,
+                             * which would cause it to raise one of its windows.
+                             */
+                            _appFlags._active = YES;
+                            [self activateX:YES];
+                        }
                     }
                     break;
                     


More information about the Xquartz-changes mailing list