From 6076185da7bdd76edc1b2b8fc861a3b4ad72fc00 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Sun, 18 Oct 2009 17:35:53 -0700 Subject: [PATCH] Added application activation. Reviewed by me. --- AppKit/CPApplication.j | 5 +++++ AppKit/CPWindow/CPWindow.j | 2 ++ AppKit/Platform/CPPlatform.j | 8 ++++++++ 3 files changed, 15 insertions(+) diff --git a/AppKit/CPApplication.j b/AppKit/CPApplication.j index 72f88a420..717d02993 100644 --- a/AppKit/CPApplication.j +++ b/AppKit/CPApplication.j @@ -298,6 +298,11 @@ CPRunContinuesResponse = -1002; [CPPlatform terminateApplication]; } +- (void)activateIgnoringOtherApps:(BOOL)shouldIgnoreOtherApps +{ + [CPPlatform activateIgnoringOtherApps:shouldIgnoreOtherApps]; +} + /*! Calls \c -finishLaunching method which results in starting the main event loop. diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index 2c0c0693d..58f051a88 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -1264,6 +1264,8 @@ CPTexturedBackgroundWindowMask if (_leftMouseDownView != _firstResponder && [_leftMouseDownView acceptsFirstResponder]) [self makeFirstResponder:_leftMouseDownView]; + [CPApp activateIgnoringOtherApps:YES]; + var theWindow = [anEvent window]; if ([theWindow isKeyWindow] || [theWindow becomesKeyOnlyIfNeeded]) diff --git a/AppKit/Platform/CPPlatform.j b/AppKit/Platform/CPPlatform.j index 851e538bc..a5eac3712 100644 --- a/AppKit/Platform/CPPlatform.j +++ b/AppKit/Platform/CPPlatform.j @@ -45,4 +45,12 @@ window.cpTerminate(); } ++ (void)activateIgnoringOtherApps:(BOOL)shouldIgnoreOtherApps +{ +#if PLATFORM(DOM) + if (typeof window["cpActivateIgnoringOtherApps"] === "function") + window.cpActivateIgnoringOtherApps(!!shouldIgnoreOtherApps); +#endif +} + @end