Fixed: floating windows did not become keyWindow and mainWindow of the application when jumping from platformWindow to another platformWindow

Previously, when having several platformWindows, jumping from another platform to another platform did not update the good key window of the application, specially when the expected windows was a panel.

Now it does. The CPPlatformWindow keeps a reference to the previous keyWindow when the window browser is about to blur. The we use this reference to update the keyWindow of the application.
This commit is contained in:
Alexandre Wilhelm
2015-04-07 17:40:26 -07:00
parent 769b379a8b
commit 01ba6ddecd
3 changed files with 13 additions and 13 deletions
+1
View File
@@ -2060,6 +2060,7 @@ CPTexturedBackgroundWindowMask
[self _setupFirstResponder];
_hasBecomeKeyWindow = YES;
_platformWindow._currentKeyWindow = self;
[_windowView noteKeyWindowStateChanged];
[_contentView _notifyWindowDidBecomeKey];
+3
View File
@@ -75,6 +75,9 @@ var PrimaryPlatformWindow = NULL;
CPPlatformPasteboard _platformPasteboard;
CPString _overriddenEventType;
CPWindow _currentKeyWindow;
CPWindow _previousKeyWindow;
#endif
}
+9 -13
View File
@@ -1057,10 +1057,10 @@ _CPPlatformWindowWillCloseNotification = @"_CPPlatformWindowWillCloseNotificatio
*/
- (void)blurEvent:(DOMEvent)aDOMEvent
{
var location = _lastMouseEventLocation || CGPointMakeZero(),
theWindow = [self _hitTest:location withTest:@selector(_isValidMousePoint:) returnsDefaultWindowIfNull:YES];
_previousKeyWindow = _currentKeyWindow;
[_previousKeyWindow resignKeyWindow];
[theWindow resignKeyWindow];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
}
/*!
@@ -1068,10 +1068,14 @@ _CPPlatformWindowWillCloseNotification = @"_CPPlatformWindowWillCloseNotificatio
*/
- (void)focusEvent:(DOMEvent)aDOMEvent
{
var location = _lastMouseEventLocation || CGPointMakeZero(),
theWindow = [self _hitTest:location withTest:@selector(_isValidMousePoint:) returnsDefaultWindowIfNull:YES];
var theWindow = _previousKeyWindow;
if (!theWindow)
theWindow = [[[_windowLayers objectForKey:[_windowLevels firstObject]] orderedWindows] firstObject];
[theWindow makeKeyAndOrderFront:self];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
}
- (void)touchEvent:(DOMEvent)aDOMEvent
@@ -1560,11 +1564,6 @@ _CPPlatformWindowWillCloseNotification = @"_CPPlatformWindowWillCloseNotificatio
}
- (CPWindow)_hitTest:(CGPoint)location withTest:(SEL)aTest
{
return [self _hitTest:location withTest:aTest returnsDefaultWindowIfNull:NO];
}
- (CPWindow)_hitTest:(CGPoint)location withTest:(SEL)aTest returnsDefaultWindowIfNull:(BOOL)returnsDefaultWindowIfNull
{
if (self._only)
return self._only;
@@ -1588,9 +1587,6 @@ _CPPlatformWindowWillCloseNotification = @"_CPPlatformWindowWillCloseNotificatio
}
}
if (!theWindow && returnsDefaultWindowIfNull)
theWindow = [[[layers objectForKey:[levels firstObject]] orderedWindows] firstObject];
return theWindow;
}