refactured front detection logic to own method _isFrontmostWindow

fixes travis error
This commit is contained in:
daboe01 committed 2018-03-20 14:25:42 +01:00
1 parent f55fa789c4
commit df462774aa
1 file changed
+15 -1
+15 -1
View File
@@ -1983,7 +1983,7 @@ CPTexturedBackgroundWindowMask
var theWindow = [anEvent window],
selector = type == CPRightMouseDown ? @selector(rightMouseDown:) : @selector(mouseDown:);
if (([[CPApp orderedWindows] objectAtIndex:0] === self && [theWindow isKeyWindow]) || ([theWindow becomesKeyOnlyIfNeeded] && ![_leftMouseDownView needsPanelToBecomeKey]))
if (([theWindow _isFrontmostWindow] && [theWindow isKeyWindow]) || ([theWindow becomesKeyOnlyIfNeeded] && ![_leftMouseDownView needsPanelToBecomeKey]))
return [_leftMouseDownView performSelector:selector withObject:anEvent];
else
{
@@ -2114,6 +2114,20 @@ CPTexturedBackgroundWindowMask
return [CPApp keyWindow] == self;
}
/* @ignore */
- (BOOL)_isFrontmostWindow
{
var orderedWindows = [CPApp orderedWindows];
if ([orderedWindows count] == 0)
return YES;
if ([orderedWindows objectAtIndex:0] === self)
return YES;
return NO;
}
/*!
Makes the window the key window and brings it to the front of the screen list.
@param aSender the object requesting this