don't close a menu item with a submenu

A submenu item should only close the menu if it has a non default action.
This is compliant with how Cocoa behavior.
This commit is contained in:
Klaas Pieter Annema
2011-07-21 12:23:11 +02:00
parent bd6294b806
commit f0561844d8
+7
View File
@@ -230,7 +230,14 @@ var STICKY_TIME_INTERVAL = 500,
else if (type === CPLeftMouseUp || type === CPRightMouseUp)
{
if (_hasMouseGoneUpAfterStartedTracking)
{
// Don't close the menu if the current item has a submenu
// and did not override it's default action
if ([activeItem action] === @selector(submenuAction:))
return;
[trackingMenu cancelTracking];
}
else
_hasMouseGoneUpAfterStartedTracking = YES;
}