mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-19 04:59:22 +00:00
Actual fix for disabled items in CPMenu. Previous fix still selected disabled items and showed submenus for disabled items.
Reviewed by me.
This commit is contained in:
1 parent
1411410f4e
commit
a9bc949679
2 files changed
+18
-5
No files matched your search
@@ -648,6 +648,9 @@ var _CPMenuBarVisible = NO,
|
||||
while ([highlightedItem submenu] && [highlightedItem action] === @selector(submenuAction:))
|
||||
highlightedItem = [[highlightedItem submenu] highlightedItem];
|
||||
|
||||
// FIXME: It is theoretically not necessarily to check isEnabled here since
|
||||
// highlightedItem is always enabled. Do there exist edge cases: disabling on closing a menu,
|
||||
// etc.? Requires further investigation and tests.
|
||||
if (highlightedItem && [highlightedItem isEnabled])
|
||||
[CPApp sendAction:[highlightedItem action] to:[highlightedItem target] from:highlightedItem];
|
||||
}
|
||||
|
||||
@@ -113,11 +113,21 @@ var SharedMenuManager = nil;
|
||||
|
||||
// Find which menu window the mouse is currently on top of
|
||||
var activeMenuContainer = [self menuContainerForPoint:globalLocation],
|
||||
menuLocation = [activeMenuContainer convertGlobalToBase:globalLocation],
|
||||
activeItemIndex = activeMenuContainer ? [activeMenuContainer itemIndexAtPoint:menuLocation] : CPNotFound,
|
||||
activeMenu = activeMenuContainer ? [activeMenuContainer menu] : nil,
|
||||
activeItem = activeItemIndex !== CPNotFound ? [activeMenu itemAtIndex:activeItemIndex] : nil,
|
||||
mouseOverMenuView = activeMenuContainer ? [activeItem view] : nil;
|
||||
activeMenu = [activeMenuContainer menu],
|
||||
menuLocation = [activeMenuContainer convertGlobalToBase:globalLocation];
|
||||
|
||||
// Find out the item the mouse is currently on top of
|
||||
var activeItemIndex = activeMenuContainer ? [activeMenuContainer itemIndexAtPoint:menuLocation] : CPNotFound,
|
||||
activeItem = activeItemIndex !== CPNotFound ? [activeMenu itemAtIndex:activeItemIndex] : nil;
|
||||
|
||||
// If the item isn't enabled its as if we clicked on nothing.
|
||||
if (![activeItem isEnabled])
|
||||
{
|
||||
activeItemIndex = CPNotFound;
|
||||
activeItem = nil;
|
||||
}
|
||||
|
||||
var mouseOverMenuView = [activeItem view];
|
||||
|
||||
if (type === CPPeriodic)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user