From 361d7b493860c1b9aa7414bbf9bf4bd27d703744 Mon Sep 17 00:00:00 2001 From: Roberto Perpuly Date: Tue, 5 Sep 2017 18:28:45 +0000 Subject: [PATCH] Fix popup menu items being always disabled in Mac OS X (#549) Menus on Mac use automatic menu enabling, meaning that the system will enable menu items only if the app responds to the menu item action. If I understand correctly, the responder chain for menus in popup dialogs stop at the dialog window, so the system thinks that the app does not handle the menu items. This fix should not affect existing code since the wxWidgets user-facing API dictates that apps specifically disable menu items. Fix #17459 See Apple docs on automatic menu enabling at https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/MenuList/Articles/EnablingMenuItems.html#//apple_ref/doc/uid/20000261-BAJBFGED --- src/osx/cocoa/menu.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/osx/cocoa/menu.mm b/src/osx/cocoa/menu.mm index 0ec0225098..e58cee10fa 100644 --- a/src/osx/cocoa/menu.mm +++ b/src/osx/cocoa/menu.mm @@ -239,6 +239,9 @@ public : { win->ScreenToClient( &x , &y ) ; NSView *view = win->GetPeer()->GetWXWidget(); + // Turn off auto-enable; it caused popup menus inside of dialogs + // to be entirely disabled. + [m_osxMenu setAutoenablesItems:NO]; [m_osxMenu popUpMenuPositioningItem:nil atLocation:NSMakePoint(x, y) inView:view]; }