I have an NSComboBox child of an NSPopover. The popover is transient and is configured to dismiss when the user clicks outside its bounds.
When its combobox popup is active and displayed, and when the user mouses down on the popovers owning view, the view receives the mouse down as expected, the popover disappears and the combobox dismisses, however the very next mouseUp is never received by the view.
It turns out the NSComboBoxCell's trackMouse method (tracking loop) is not returning until it receives a mouseUp but unlike the case of mouseDown where it redispatches it nicely to the view that was clicked on, it never propagates the mouseUp.
I had to work around the issue with the following NSComboBoxCell trackMouse override.
Has anyone seen this issue prior or understand what may be going on?
--------
- (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame
ofView:(NSView *)controlView untilMouseUp:(BOOL)untilMouseUp {
BOOL trackingResult = [super trackMouse:theEvent inRect:cellFrame
ofView:controlView untilMouseUp:untilMouseUp];
// If we were dismissed due to mouse event and the current
// event (that NSComboBoxCell is currently eating), just redispatch
// it so it lands with its intended destination.
if (trackingResult) {
NSEvent* currentEvent = [NSApp currentEvent];
if (currentEvent.type == NSLeftMouseUp && currentEvent.window != nil) {
[NSApp postEvent:currentEvent atStart:YES];
}
}
return trackingResult;
}