From 8bda7ef823703a34e32de604bbe074ffc2922faf Mon Sep 17 00:00:00 2001 From: nico Date: Tue, 21 Jan 2003 01:19:44 +0000 Subject: [PATCH] Fix to display highlighted menu items when they are triggered from the keyboard; fix for wrong highlighting of menu items in popupbuttons when used from the keyboard git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@15661 72102866-910b-0410-8b05-ffd578937521 --- Source/NSMenuView.m | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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