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
This commit is contained in:
Nicola Pero 2003-01-21 01:19:44 +00:00
parent cc6e0ba4cc
commit 0cd3adbe8a

View file

@ -28,7 +28,7 @@
*/
#include <Foundation/NSThread.h>
#include <Foundation/NSRunLoop.h>
#include <AppKit/NSApplication.h>
#include <AppKit/NSEvent.h>
@ -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