diff --git a/Source/NSMenuView.m b/Source/NSMenuView.m index 07bf40839..e6eb0d7e4 100644 --- a/Source/NSMenuView.m +++ b/Source/NSMenuView.m @@ -28,7 +28,7 @@ */ -#include +#include #include #include @@ -878,10 +878,18 @@ _addLeftBorderOffsetToRect(NSRect aRect, BOOL isHorizontal) [targetMenuView setHighlightedItemIndex: indexToHighlight]; - [_menu performActionForItemAtIndex: index]; - [NSThread sleepUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.1]]; + /* We need to let the run loop run a little so that the fact that + * the item is highlighted gets displayed on screen. + */ + [[NSRunLoop currentRunLoop] + runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.1]]; - [targetMenuView setHighlightedItemIndex: -1]; + [_menu performActionForItemAtIndex: index]; + + if (![_menu _ownedByPopUp]) + { + [targetMenuView setHighlightedItemIndex: -1]; + } } #define MOVE_THRESHOLD_DELTA 2.0