From fc8759064c1f5200f46efd97eb18cdf058024d72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 25 Mar 2013 09:31:47 +0100 Subject: [PATCH] Make qt_setDockMenu work and call it. The application delegate code from Qt 4 implements a non-working qt_setDockMenu. Correct the signature of the applicationDockMenu method. Change-Id: I6f531a78f91e0550b0e66cc4f2fa072006a030f4 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm | 3 ++- src/plugins/platforms/cocoa/qcocoanativeinterface.mm | 6 +----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm index e1569d4f44..f676d613bc 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm @@ -145,8 +145,9 @@ static void cleanupCocoaApplicationDelegate() dockMenu = newMenu; } -- (NSMenu *)applicationDockMenu +- (NSMenu *)applicationDockMenu:(NSApplication *)sender { + Q_UNUSED(sender); return [[dockMenu retain] autorelease]; } diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index ededb63487..da53fe9c26 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -192,11 +192,7 @@ void QCocoaNativeInterface::setDockMenu(QPlatformMenu *platformMenu) { QCocoaMenu *cocoaPlatformMenu = static_cast(platformMenu); NSMenu *menu = cocoaPlatformMenu->nsMenu(); - // setDockMenu seems to be undocumented, but this is what Qt 4 did. - if ([NSApp respondsToSelector:@selector(setDockMenu:)]) - [NSApp setDockMenu: menu]; - else - qWarning("Could not set dock menu: [NSApp setDockMenu] is not available."); + [NSApp QT_MANGLE_NAMESPACE(qt_setDockMenu): menu]; } void *QCocoaNativeInterface::qMenuToNSMenu(QPlatformMenu *platformMenu)