From 1dc96612c8c4e2a46ffe7db05e2fa95c945f0b5c Mon Sep 17 00:00:00 2001 From: Melanie Cappelaere Date: Fri, 19 Jun 2015 14:37:36 +0200 Subject: Mangle QNSApplication and methods into a namespace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [OS X] Mangle the event handle related calls on QNSApplication, so that the events are passed through the correct QApplications when several Qt5's with different namespaces do UI in the same process. Change-Id: Ibb44246fbcf4a2bc3af5a93c48db0382a1380328 Reviewed-by: Christoph Schleifenbaum Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoaapplication.mm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.mm b/src/plugins/platforms/cocoa/qcocoaapplication.mm index 227ab05c25..d9919f1120 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplication.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplication.mm @@ -79,12 +79,12 @@ QT_USE_NAMESPACE - (void)QT_MANGLE_NAMESPACE(qt_setDockMenu):(NSMenu *)newMenu { - [[QCocoaApplicationDelegate sharedDelegate] setDockMenu:newMenu]; + [[QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) sharedDelegate] setDockMenu:newMenu]; } - (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader) { - return [[QCocoaApplicationDelegate sharedDelegate] menuLoader]; + return [[QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) sharedDelegate] menuLoader]; } - (int)QT_MANGLE_NAMESPACE(qt_validModesForFontPanel):(NSFontPanel *)fontPanel @@ -147,9 +147,9 @@ static const QByteArray q_macLocalEventType = QByteArrayLiteral("mac_generic_NSE @end -@implementation QNSApplication +@implementation QT_MANGLE_NAMESPACE(QNSApplication) -- (void)qt_sendEvent_original:(NSEvent *)event +- (void)QT_MANGLE_NAMESPACE(qt_sendEvent_original):(NSEvent *)event { Q_UNUSED(event); // This method will only be used as a signature @@ -157,14 +157,14 @@ static const QByteArray q_macLocalEventType = QByteArrayLiteral("mac_generic_NSE // containing the original [NSApplication sendEvent:] implementation } -- (void)qt_sendEvent_replacement:(NSEvent *)event +- (void)QT_MANGLE_NAMESPACE(qt_sendEvent_replacement):(NSEvent *)event { // This method (or its implementation to be precise) will // be called instead of sendEvent if redirection occurs. // 'self' will then be an instance of NSApplication // (and not QNSApplication) if (![NSApp QT_MANGLE_NAMESPACE(qt_filterEvent):event]) - [self qt_sendEvent_original:event]; + [self QT_MANGLE_NAMESPACE(qt_sendEvent_original):event]; } - (void)sendEvent:(NSEvent *)event @@ -187,7 +187,7 @@ void qt_redirectNSApplicationSendEvent() // can be unloaded. return; - if ([NSApp isMemberOfClass:[QNSApplication class]]) { + if ([NSApp isMemberOfClass:[QT_MANGLE_NAMESPACE(QNSApplication) class]]) { // No need to change implementation since Qt // already controls a subclass of NSApplication return; @@ -200,9 +200,9 @@ void qt_redirectNSApplicationSendEvent() qt_cocoa_change_implementation( [NSApplication class], @selector(sendEvent:), - [QNSApplication class], - @selector(qt_sendEvent_replacement:), - @selector(qt_sendEvent_original:)); + [QT_MANGLE_NAMESPACE(QNSApplication) class], + @selector(QT_MANGLE_NAMESPACE(qt_sendEvent_replacement):), + @selector(QT_MANGLE_NAMESPACE(qt_sendEvent_original):)); } void qt_resetNSApplicationSendEvent() -- cgit v1.2.3