mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
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:
parent
cc6e0ba4cc
commit
0cd3adbe8a
1 changed files with 12 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue