From bf561a06b2bf60395d26026ac7627d0cb254bc07 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Thu, 23 Oct 2008 11:37:13 -0700 Subject: [PATCH] XQuartz: Honor the Spaces preference for "When switching to an application, switch to a space with open windows for the application" --- hw/xquartz/X11Application.m | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index 4851b3122..57dfcc98e 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -293,7 +293,15 @@ static void message_kit_thread (SEL selector, NSObject *arg) { _appFlags._active = YES; [self activateX:YES]; - if ([e data2] & 0x10) + + /* Get the Spaces preference for SwitchOnActivate */ + (void)CFPreferencesAppSynchronize(CFSTR(".GlobalPreferences")); + BOOL switch_on_activate, ok; + switch_on_activate = CFPreferencesGetAppBooleanValue(CFSTR("AppleSpacesSwitchOnActivate"), CFSTR(".GlobalPreferences"), &ok); + if(!ok) + switch_on_activate = YES; + + if ([e data2] & 0x10 && switch_on_activate) DarwinSendDDXEvent(kXquartzBringAllToFront, 0); } break;