diff --git a/AppKit/CPMenu/_CPMenuManager.j b/AppKit/CPMenu/_CPMenuManager.j index 3361eea90..479963ae1 100644 --- a/AppKit/CPMenu/_CPMenuManager.j +++ b/AppKit/CPMenu/_CPMenuManager.j @@ -1,7 +1,10 @@ -@import +@import +@import "CPWindow.j" +@import "CPEvent.j" @class _CPMenuWindow + @global CPApp @global CPMenuDidEndTrackingNotification @global _CPMenuWindowMenuBarBackgroundStyle @@ -133,15 +136,6 @@ var STICKY_TIME_INTERVAL = 0.5, return; } - if (_keyBuffer) - { - if (([anEvent timestamp] - _startTime) > (STICKY_TIME_INTERVAL + [activeMenu numberOfItems] / 2)) - [self selectNextItemBeginningWith:_keyBuffer inMenu:menu clearBuffer:YES]; - - if (type === CPPeriodic) - return; - } - // Periodic events don't have a valid location. var globalLocation = type === CPPeriodic ? _lastGlobalLocation : [anEvent globalLocation]; @@ -157,6 +151,15 @@ var STICKY_TIME_INTERVAL = 0.5, activeItemIndex = activeMenuContainer ? [activeMenuContainer itemIndexAtPoint:menuLocation] : CPNotFound, activeItem = activeItemIndex !== CPNotFound ? [activeMenu itemAtIndex:activeItemIndex] : nil; + if (_keyBuffer) + { + if (([anEvent timestamp] - _startTime) > (STICKY_TIME_INTERVAL + [activeMenu numberOfItems] / 2)) + [self selectNextItemBeginningWith:_keyBuffer inMenu:menu clearBuffer:YES]; + + if (type === CPPeriodic) + return; + } + // unhighlight when mouse is moved off the menu if (_lastGlobalLocation && CGRectContainsPoint([activeMenuContainer globalFrame], _lastGlobalLocation) && !CGRectContainsPoint([activeMenuContainer globalFrame], globalLocation))