summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2010-02-10 08:04:50 (GMT)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2010-02-10 09:15:03 (GMT)
commit5be0f78985f73515645762b2895b6969be69a6e4 (patch)
treef6823851470d4de322c71b1e1f09cf7c29ddd097 /src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
parent8b112609b7d86572fbb41dc59354da1f958d1910 (diff)
downloadQt-5be0f78985f73515645762b2895b6969be69a6e4.zip
Qt-5be0f78985f73515645762b2895b6969be69a6e4.tar.gz
Qt-5be0f78985f73515645762b2895b6969be69a6e4.tar.bz2
Cocoa: Implement our own NSApplication subclass
We have avoided doing so up till now, since we cannot always know if we will be able to use it. If some 3rd-party application creates NSApplication before Qt, our subclass will never be used (because of the singleton pattern that NSApplication follows). However, in most cases, Qt will be used in standalone applications, or the 3rd-party application will not subclass NSApplication. And in those cases, we can make certain functionallity more robust. Rev-By:msorvig
Diffstat (limited to 'src/gui/kernel/qcocoasharedwindowmethods_mac_p.h')
-rw-r--r--src/gui/kernel/qcocoasharedwindowmethods_mac_p.h24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
index 3b92ce2..24a3bb5 100644
--- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
+++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
@@ -178,28 +178,20 @@ QT_END_NAMESPACE
[NSApp terminate:sender];
}
-- (void)sendPostedMessage:(NSEvent *)event
-{
- // WARNING: data1 and data2 is truncated to from 64-bit to 32-bit on OS 10.5!
- // That is why we need to split the address in two parts:
- quint64 lower = [event data1];
- quint64 upper = [event data2];
- QCocoaPostCallArgs *args = reinterpret_cast<QCocoaPostCallArgs *>(lower | (upper << 32));
- if (args != 0) {
- [args->target performSelector:args->selector];
- delete args;
- }
-}
-
- (void)sendEvent:(NSEvent *)event
{
if ([event type] == NSApplicationDefined) {
- if ([event subtype] == QtCocoaEventSubTypePostMessage)
- [self sendPostedMessage:event];
+ switch ([event subtype]) {
+ case QtCocoaEventSubTypePostMessage:
+ [NSApp qt_sendPostedMessage:event];
+ return;
+ default:
+ break;
+ }
return;
}
- QWidget *widget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self];
+ QWidget *widget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self];
// Cocoa can hold onto the window after we've disavowed its knowledge. So,
// if we get sent an event afterwards just have it go through the super's
// version and don't do any stuff with Qt.