Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/kernel/qcocoaapplication_mac.mm

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    8080#include <private/qt_cocoa_helpers_mac_p.h>
    8181
     82QT_USE_NAMESPACE
     83
    8284@implementation NSApplication (QT_MANGLE_NAMESPACE(QApplicationIntegration))
    8385
     
    108110}
    109111
     112- (void)qt_sendPostedMessage:(NSEvent *)event
     113{
     114    // WARNING: data1 and data2 is truncated to from 64-bit to 32-bit on OS 10.5!
     115    // That is why we need to split the address in two parts:
     116    quint64 lower = [event data1];
     117    quint64 upper = [event data2];
     118    QCocoaPostMessageArgs *args = reinterpret_cast<QCocoaPostMessageArgs *>(lower | (upper << 32));
     119    [args->target performSelector:args->selector];
     120    delete args;
     121}
     122
     123- (BOOL)qt_sendEvent:(NSEvent *)event
     124{
     125    if ([event type] == NSApplicationDefined) {
     126        switch ([event subtype]) {
     127            case QtCocoaEventSubTypePostMessage:
     128                [NSApp qt_sendPostedMessage:event];
     129                return true;
     130            default:
     131                break;
     132        }
     133    }
     134    return false;
     135}
     136
    110137@end
     138
     139@implementation QNSApplication
     140
     141// WARNING: If Qt did not create NSApplication (this can e.g.
     142// happend if Qt is used as a plugin from a 3rd-party cocoa
     143// application), QNSApplication::sendEvent will never be called.
     144// SO DO NOT RELY ON THIS FUNCTION BEING AVAILABLE.
     145// Plugin developers that _do_ control the NSApplication sub-class
     146// implementation of the 3rd-party application can call qt_sendEvent
     147// from the sub-class event handler (like we do here) to work around
     148// any issues.
     149- (void)sendEvent:(NSEvent *)event
     150{
     151    if (![self qt_sendEvent:event])
     152        [super sendEvent:event];
     153}
     154
     155@end
     156
    111157#endif
Note: See TracChangeset for help on using the changeset viewer.