Fixed: transient popover windows would close on mouse interaction with certain controls.

Without this fix, a transient popover would close if the autocomplete menu of a token field contained in it was clicked.

This happened because the popover considered the click to be on a different window. Although not tested, it's likely the same thing would happen if the menu of a combo pop or a pop up button was clicked.

This fix makes it so that any child window of a popover can be clicked without the popover closing.
This commit is contained in:
Alexander Ljungberg committed 2013-03-10 22:48:26 +00:00
1 parent abadc6298d
commit ff15f11927
2 files changed
+19 -1

No files matched your search

+16
View File
@@ -2453,6 +2453,22 @@ CPTexturedBackgroundWindowMask
return _parentWindow;
}
/*!
Return YES if anAncestor is the parent or a higher ancestor of the receiver.
@ignore
*/
- (BOOL)_hasAncestorWindow:(CPWindow)anAncestor
{
if (!_parentWindow || !anAncestor)
return NO;
if (anAncestor === _parentWindow)
return YES;
return [_parentWindow _hasAncestorWindow:anAncestor];
}
- (CPWindow)setParentWindow:(CPWindow)parentWindow
{
_parentWindow = parentWindow;
+3 -1
View File
@@ -569,7 +569,9 @@ var _CPPopoverWindow_shouldClose_ = 1 << 0,
var mouseWindow = [anEvent window];
if (mouseWindow === self)
// Consider clicks in child windows to be "inside". This keeps a transient popover from
// closing if e.g. the window containing the menu of a token field is clicked.
if (mouseWindow === self || [mouseWindow _hasAncestorWindow:self])
[self _trapNextMouseDown];
else
{