mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
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:
@@ -2060,6 +2060,7 @@ CPTexturedBackgroundWindowMask
|
||||
|
||||
[self _setupFirstResponder];
|
||||
_hasBecomeKeyWindow = YES;
|
||||
_platformWindow._currentKeyWindow = self;
|
||||
|
||||
[_windowView noteKeyWindowStateChanged];
|
||||
[_contentView _notifyWindowDidBecomeKey];
|
||||
|
||||
@@ -75,6 +75,9 @@ var PrimaryPlatformWindow = NULL;
|
||||
CPPlatformPasteboard _platformPasteboard;
|
||||
|
||||
CPString _overriddenEventType;
|
||||
|
||||
CPWindow _currentKeyWindow;
|
||||
CPWindow _previousKeyWindow;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user