Child window/popover fixes

- Added CPWindow -_parentWindowDidOrderInChild to notify a window when it is directly ordered in by a parent.
- Fixed observing of target view frame changes to work in all possible cases.
- Fixed typo in code introduced in last commit in CPApplication -sendEvent.
This commit is contained in:
Aparajita Fishman
2013-01-28 12:36:59 +08:00
parent fdbef474f0
commit b7d1ccf9b6
4 changed files with 28 additions and 7 deletions
+1 -1
View File
@@ -624,7 +624,7 @@ CPRunContinuesResponse = -1002;
var listener = _eventListeners.pop();
listener._callback(anEvent);
if (listener._shouldDequeue)
if (listener._dequeue)
return;
}
}
+8
View File
@@ -800,6 +800,14 @@ CPTexturedBackgroundWindowMask
[self makeMainWindow];
}
/*
Called when a parent window orders in a child window directly.
without going through the ordering methods in CPWindow.
*/
- (void)_parentDidOrderInChild
{
}
/*
Makes the receiver the last window in the screen ordering.
@param aSender the object that requested this
+6 -4
View File
@@ -1489,10 +1489,11 @@ var resizeTimer = nil;
for (var i = 0; i < count; ++i)
{
var child = children[i];
var child = children[i],
childWasVisible = [child isVisible];
// If a child is not visible and has not yet been ordered in, skip it
if (![child isVisible] && ![child _hasBeenOrderedIn])
if (!childWasVisible && ![child _hasBeenOrderedIn])
continue;
var ordering = [child _childOrdering];
@@ -1505,13 +1506,14 @@ var resizeTimer = nil;
[aLayer insertWindow:child atIndex:index];
if (!childWasVisible)
[child _parentDidOrderInChild];
if ([[child childWindows] count])
[self _orderChildWindowsOf:child furthestParent:furthestParent layer:aLayer];
parent = child;
}
return index;
}
- (void)_removeLayers
+13 -2
View File
@@ -329,8 +329,6 @@ var _CPPopoverWindow_shouldClose_ = 1 << 0,
_targetView = positioningView;
}
[_targetView addObserver:self forKeyPath:@"frame" options:0 context:nil];
/*
If _targetView's window is not a full platform window,
add us as a child, because when we close we are detached from
@@ -486,6 +484,19 @@ var _CPPopoverWindow_shouldClose_ = 1 << 0,
_isClosing = NO;
}
- (void)_orderFront
{
if (![self isVisible])
[_targetView addObserver:self forKeyPath:@"frame" options:0 context:nil];
[super _orderFront];
}
- (void)_parentDidOrderInChild
{
[_targetView addObserver:self forKeyPath:@"frame" options:0 context:nil];
}
/*!
@ignore
Animate window closing.