From 0dad10d6ab9b0c4ee83b40b01c57f773432c7eb6 Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Fri, 10 Apr 2015 10:57:34 -0700 Subject: [PATCH] Fixed: notifications becomeActive and willActive were called even if the application was already active. The method run sends now an event CPAppKitDefined as in cocoa, this event will raise the notification becomeActive and willActive of the application when the application just finished to load --- AppKit/CPApplication.j | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/AppKit/CPApplication.j b/AppKit/CPApplication.j index 27f0e3367..457fe8a49 100644 --- a/AppKit/CPApplication.j +++ b/AppKit/CPApplication.j @@ -445,6 +445,9 @@ var CPMainCibFile = @"CPMainCibFile", - (void)activateIgnoringOtherApps:(BOOL)shouldIgnoreOtherApps { + if (_isActive) + return; + [self _willBecomeActive]; [CPPlatform activateIgnoringOtherApps:shouldIgnoreOtherApps]; @@ -455,6 +458,9 @@ var CPMainCibFile = @"CPMainCibFile", - (void)deactivate { + if (!_isActive) + return; + [self _willResignActive]; [CPPlatform deactivate]; @@ -480,6 +486,15 @@ var CPMainCibFile = @"CPMainCibFile", - (void)run { [self finishLaunching]; + [self sendEvent:[CPEvent otherEventWithType:CPAppKitDefined + location:CGPointMakeZero() + modifierFlags:0 + timestamp:[CPEvent currentTimestamp] + windowNumber:[_keyWindow windowNumber] + context:nil + subtype:nil + data1:nil + data2:nil]]; } // Managing the Event Loop