mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
Added a short delay to item unhighlighting when using key. eqs. and
some corrections to submenu attaching. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5229 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e714be0c09
commit
e2a2a1a7ce
3 changed files with 50 additions and 18 deletions
|
@ -1,3 +1,11 @@
|
|||
1999-11-18 David Lazaro Saz <khelekir@encomix.es>
|
||||
|
||||
* Source/NSMenuView.m ([NSMenuView
|
||||
-performActionWithHighlightingForItemAtIndex:]): Added a short delay to
|
||||
item unhiglighting (100ms).
|
||||
([NSMenuView -trackWithEvent:]): When an attached menu is present other
|
||||
items only highlight when the cursor stops at them.
|
||||
|
||||
1999-11-17 David Lazaro Saz <khelekir@encomix.es>
|
||||
|
||||
* Source/NSWindow.m ([NSWindow -setLevel:]):
|
||||
|
|
|
@ -1147,7 +1147,7 @@ static NSString* NSMenuLocationsKey = @"NSMenuLocations";
|
|||
}
|
||||
}
|
||||
|
||||
#define SHIFT_DELTA 15.0
|
||||
#define SHIFT_DELTA 18.0
|
||||
|
||||
- (void) shiftOnScreen
|
||||
{
|
||||
|
|
|
@ -670,9 +670,12 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
|
|||
|
||||
[menuv_menu performActionForItemAtIndex: index];
|
||||
|
||||
[NSThread sleepUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.1]];
|
||||
[targetMenuView setHighlightedItemIndex: -1];
|
||||
}
|
||||
|
||||
#define MOVE_THRESHOLD_DELTA 1
|
||||
|
||||
- (BOOL)trackWithEvent: (NSEvent *)event
|
||||
{
|
||||
NSApplication *theApp = [NSApplication sharedApplication];
|
||||
|
@ -681,25 +684,31 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
|
|||
| NSPeriodicMask;
|
||||
NSDate *theDistantFuture = [NSDate distantFuture];
|
||||
|
||||
NSPoint location;
|
||||
int index;
|
||||
NSPoint location;
|
||||
NSPoint lastLocation = {0,0};
|
||||
NSMenu *alreadyAttachedMenu = NO;
|
||||
BOOL delayedSelect = NO;
|
||||
|
||||
do
|
||||
{
|
||||
location = [window mouseLocationOutsideOfEventStream];
|
||||
index = [self indexOfItemAtPoint: location];
|
||||
location = [window mouseLocationOutsideOfEventStream];
|
||||
index = [self indexOfItemAtPoint: location];
|
||||
|
||||
if ([event type] == NSPeriodic)
|
||||
if ([menuv_menu isPartlyOffScreen])
|
||||
{
|
||||
NSPoint pointerLoc = [window convertBaseToScreen: location];
|
||||
{
|
||||
if ([menuv_menu isPartlyOffScreen])
|
||||
{
|
||||
NSPoint pointerLoc = [window convertBaseToScreen:
|
||||
location];
|
||||
|
||||
// TODO: Why 1 in the Y axis?
|
||||
if (pointerLoc.x == 0 || pointerLoc.y == 1 ||
|
||||
pointerLoc.x == [[window screen] frame].size.width - 1)
|
||||
[menuv_menu shiftOnScreen];
|
||||
}
|
||||
// TODO: Why 1 in the Y axis?
|
||||
if (pointerLoc.x == 0 || pointerLoc.y == 1 ||
|
||||
pointerLoc.x == [[window screen] frame].size.width
|
||||
- 1)
|
||||
[menuv_menu shiftOnScreen];
|
||||
}
|
||||
}
|
||||
|
||||
if (index == -1)
|
||||
{
|
||||
|
@ -722,14 +731,29 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
|
|||
{
|
||||
if (index != menuv_highlightedItemIndex)
|
||||
{
|
||||
[self setHighlightedItemIndex: index];
|
||||
if ([event type] == NSPeriodic && delayedSelect)
|
||||
{
|
||||
if (location.x - lastLocation.x < MOVE_THRESHOLD_DELTA ||
|
||||
abs(location.y - lastLocation.y) < MOVE_THRESHOLD_DELTA)
|
||||
delayedSelect = NO;
|
||||
|
||||
if ([menuv_menu attachedMenu])
|
||||
[self detachSubmenu];
|
||||
lastLocation = location;
|
||||
}
|
||||
|
||||
if ((alreadyAttachedMenu =
|
||||
[[menuv_items_link objectAtIndex: index] submenu]))
|
||||
[self attachSubmenuForItemAtIndex: index];
|
||||
if (![menuv_menu attachedMenu] || !delayedSelect)
|
||||
{
|
||||
[self setHighlightedItemIndex: index];
|
||||
|
||||
if ([menuv_menu attachedMenu])
|
||||
[self detachSubmenu];
|
||||
|
||||
if ((alreadyAttachedMenu =
|
||||
[[menuv_items_link objectAtIndex: index] submenu]))
|
||||
{
|
||||
[self attachSubmenuForItemAtIndex: index];
|
||||
delayedSelect = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue