Ticket #45421: patch-10.10.diff

File patch-10.10.diff, 45.9 KB (added by nneonneo (Robert Xiao), 10 years ago)

Fixed patch file

  • src/corelib/global/qglobal.cpp

    old new bool qSharedBuild() 
    11851185    \value MV_10_7     OS X 10.7
    11861186    \value MV_10_8     OS X 10.8
    11871187    \value MV_10_9     OS X 10.9
     1188    \value MV_10_10    OS X 10.10
    11881189    \value MV_Unknown  An unknown and currently unsupported platform
    11891190
    11901191    \value MV_CHEETAH  Apple codename for MV_10_0
    bool qSharedBuild() 
    11971198    \value MV_LION     Apple codename for MV_10_7
    11981199    \value MV_MOUNTAINLION Apple codename for MV_10_8
    11991200    \value MV_MAVERICKS    Apple codename for MV_10_9
     1201    \value MV_YOSEMITE     Apple codename for MV_10_10
    12001202
    12011203    \sa WinVersion, SymbianVersion
    12021204*/
    static QSysInfo::MacVersion macVersion() 
    16741676{
    16751677#if !defined(Q_OS_IOS)
    16761678    SInt32 gestalt_version;
    1677     if (Gestalt(gestaltSystemVersion, &gestalt_version) == noErr) {
    1678         return QSysInfo::MacVersion(((gestalt_version & 0x00F0) >> 4) + 2);
     1679    if (Gestalt(gestaltSystemVersionMinor, &gestalt_version) == noErr) {
     1680        // add 2 because OS X 10.0 is 0x02 in the enum
     1681        return QSysInfo::MacVersion(gestalt_version + 2);
    16791682    }
    16801683#endif
    16811684    return QSysInfo::MV_Unknown;
  • src/corelib/global/qglobal.h

    old new namespace QT_NAMESPACE {} 
    304304#endif
    305305
    306306#ifdef Q_OS_DARWIN
    307 #  ifdef MAC_OS_X_VERSION_MIN_REQUIRED
    308 #    undef MAC_OS_X_VERSION_MIN_REQUIRED
    309 #  endif
    310 #  define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_4
    311307#  include <AvailabilityMacros.h>
    312 #  if !defined(MAC_OS_X_VERSION_10_3)
    313 #     define MAC_OS_X_VERSION_10_3 MAC_OS_X_VERSION_10_2 + 1
     308#
     309#  // Availability.h was introduced with the OS X 10.6 SDK
     310#  if (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060) || \
     311      (defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)
     312#    include <Availability.h>
     313#  endif
     314#
     315#  ifdef Q_OS_MACX
     316#    if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED < 1040
     317#       undef __MAC_OS_X_VERSION_MIN_REQUIRED
     318#       define __MAC_OS_X_VERSION_MIN_REQUIRED 1040
     319#    endif
     320#    if !defined(MAC_OS_X_VERSION_MIN_REQUIRED) || MAC_OS_X_VERSION_MIN_REQUIRED < 1040
     321#       undef MAC_OS_X_VERSION_MIN_REQUIRED
     322#       define MAC_OS_X_VERSION_MIN_REQUIRED 1040
     323#    endif
     324#  endif
     325#
     326#  // Numerical checks are preferred to named checks, but to be safe
     327#  // we define the missing version names in case Qt uses them.
     328#
     329#  if !defined(__MAC_10_4)
     330#       define __MAC_10_4 1040
     331#  endif
     332#  if !defined(__MAC_10_5)
     333#       define __MAC_10_5 1050
     334#  endif
     335#  if !defined(__MAC_10_6)
     336#       define __MAC_10_6 1060
     337#  endif
     338#  if !defined(__MAC_10_7)
     339#       define __MAC_10_7 1070
     340#  endif
     341#  if !defined(__MAC_10_8)
     342#       define __MAC_10_8 1080
     343#  endif
     344#  if !defined(__MAC_10_9)
     345#       define __MAC_10_9 1090
     346#  endif
     347#  if !defined(__MAC_10_10)
     348#       define __MAC_10_10 101000
    314349#  endif
    315350#  if !defined(MAC_OS_X_VERSION_10_4)
    316 #       define MAC_OS_X_VERSION_10_4 MAC_OS_X_VERSION_10_3 + 1
     351#       define MAC_OS_X_VERSION_10_4 1040
    317352#  endif
    318353#  if !defined(MAC_OS_X_VERSION_10_5)
    319 #       define MAC_OS_X_VERSION_10_5 MAC_OS_X_VERSION_10_4 + 1
     354#       define MAC_OS_X_VERSION_10_5 1050
    320355#  endif
    321356#  if !defined(MAC_OS_X_VERSION_10_6)
    322 #       define MAC_OS_X_VERSION_10_6 MAC_OS_X_VERSION_10_5 + 1
     357#       define MAC_OS_X_VERSION_10_6 1060
    323358#  endif
    324359#  if !defined(MAC_OS_X_VERSION_10_7)
    325 #       define MAC_OS_X_VERSION_10_7 MAC_OS_X_VERSION_10_6 + 1
     360#       define MAC_OS_X_VERSION_10_7 1070
    326361#  endif
    327362#  if !defined(MAC_OS_X_VERSION_10_8)
    328 #       define MAC_OS_X_VERSION_10_8 MAC_OS_X_VERSION_10_7 + 1
     363#       define MAC_OS_X_VERSION_10_8 1080
    329364#  endif
    330365#  if !defined(MAC_OS_X_VERSION_10_9)
    331 #       define MAC_OS_X_VERSION_10_9 MAC_OS_X_VERSION_10_8 + 1
     366#       define MAC_OS_X_VERSION_10_9 1090
     367#  endif
     368#  if !defined(MAC_OS_X_VERSION_10_10)
     369#       define MAC_OS_X_VERSION_10_10 101000
    332370#  endif
    333371#endif
    334372
    public: 
    16301668        MV_10_7 = 0x0009,
    16311669        MV_10_8 = 0x000A,
    16321670        MV_10_9 = 0x000B,
     1671        MV_10_10 = 0x000C,
    16331672
    16341673        /* codenames */
    16351674        MV_CHEETAH = MV_10_0,
    public: 
    16411680        MV_SNOWLEOPARD = MV_10_6,
    16421681        MV_LION = MV_10_7,
    16431682        MV_MOUNTAINLION = MV_10_8,
    1644         MV_MAVERICKS = MV_10_9
     1683        MV_MAVERICKS = MV_10_9,
     1684        MV_YOSEMITE = MV_10_10
    16451685    };
    16461686    static const MacVersion MacintoshVersion;
    16471687#endif
  • src/gui/dialogs/qcolordialog_mac.mm

    old new QT_USE_NAMESPACE 
    318318        // It's important that the modal event loop is stopped before
    319319        // we accept/reject QColorDialog, since QColorDialog has its
    320320        // own event loop that needs to be stopped last.
    321         [NSApp stopModalWithCode:code];
     321        [[NSApplication sharedApplication] stopModalWithCode:code];
    322322    } else {
    323323        // Since we are not in a modal event loop, we can safely close
    324324        // down QColorDialog
    QT_USE_NAMESPACE 
    350350    while (!modalEnded) {
    351351#ifndef QT_NO_EXCEPTIONS
    352352        @try {
    353             [NSApp runModalForWindow:mColorPanel];
     353            [[NSApplication sharedApplication] runModalForWindow:mColorPanel];
    354354            modalEnded = true;
    355355        } @catch (NSException *) {
    356356            // For some reason, NSColorPanel throws an exception when
    QT_USE_NAMESPACE 
    358358            // palette (tab three).
    359359        }
    360360#else
    361         [NSApp runModalForWindow:mColorPanel];
     361        [[NSApplication sharedApplication] runModalForWindow:mColorPanel];
    362362        modalEnded = true;
    363363#endif
    364364    }
    void QColorDialogPrivate::mac_nativeDialogModalHelp() 
    469469    // Do a queued meta-call to open the native modal dialog so it opens after the new
    470470    // event loop has started to execute (in QDialog::exec). Using a timer rather than
    471471    // a queued meta call is intentional to ensure that the call is only delivered when
    472     // [NSApp run] runs (timers are handeled special in cocoa). If NSApp is not
     472    // [NSApplication run] runs (timers are handeled special in cocoa). If NSApplication is not
    473473    // running (which is the case if e.g a top-most QEventLoop has been
    474474    // interrupted, and the second-most event loop has not yet been reactivated (regardless
    475     // if [NSApp run] is still on the stack)), showing a native modal dialog will fail.
     475    // if [NSApplication run] is still on the stack)), showing a native modal dialog will fail.
    476476    if (delegate){
    477477        Q_Q(QColorDialog);
    478478        QTimer::singleShot(1, q, SLOT(_q_macRunNativeAppModalPanel()));
  • src/gui/dialogs/qfiledialog_mac.mm

    old new QT_USE_NAMESPACE 
    229229    if ([mSavePanel respondsToSelector:@selector(close)])
    230230        [mSavePanel close];
    231231    if ([mSavePanel isSheet])
    232         [NSApp endSheet: mSavePanel];
     232        [[NSApplication sharedApplication] endSheet: mSavePanel];
    233233}
    234234
    235235- (void)showModelessPanel
    void QFileDialogPrivate::mac_nativeDialogModalHelp() 
    11621162    // Do a queued meta-call to open the native modal dialog so it opens after the new
    11631163    // event loop has started to execute (in QDialog::exec). Using a timer rather than
    11641164    // a queued meta call is intentional to ensure that the call is only delivered when
    1165     // [NSApp run] runs (timers are handeled special in cocoa). If NSApp is not
     1165    // [NSApplication run] runs (timers are handeled special in cocoa). If NSApplication is not
    11661166    // running (which is the case if e.g a top-most QEventLoop has been
    11671167    // interrupted, and the second-most event loop has not yet been reactivated (regardless
    1168     // if [NSApp run] is still on the stack)), showing a native modal dialog will fail.
     1168    // if [NSApplication run] is still on the stack)), showing a native modal dialog will fail.
    11691169    if (nativeDialogInUse){
    11701170        Q_Q(QFileDialog);
    11711171        QTimer::singleShot(1, q, SLOT(_q_macRunNativeAppModalPanel()));
  • src/gui/dialogs/qfontdialog_mac.mm

    old new static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) 
    230230    mAppModal = true;
    231231    NSWindow *ourPanel = [mStolenContentView window];
    232232    [ourPanel setReleasedWhenClosed:NO];
    233     [NSApp runModalForWindow:ourPanel];
     233    [[NSApplication sharedApplication] runModalForWindow:ourPanel];
    234234    QAbstractEventDispatcher::instance()->interrupt();
    235235
    236236    if (mReturnCode == NSOKButton)
    static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) 
    256256
    257257    mAppModal = false;
    258258    NSWindow *ourPanel = [mStolenContentView window];
    259     [NSApp beginSheet:ourPanel
     259    [[NSApplication sharedApplication] beginSheet:ourPanel
    260260        modalForWindow:window
    261261        modalDelegate:0
    262262        didEndSelector:0
    static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) 
    456456
    457457    if (mAppModal) {
    458458        mReturnCode = code;
    459         [NSApp stopModalWithCode:code];
     459        [[NSApplication sharedApplication] stopModalWithCode:code];
    460460    } else {
    461461        if (code == NSOKButton)
    462462            mPriv->fontDialog()->accept();
    void QFontDialogPrivate::mac_nativeDialogModalHelp() 
    636636    // Do a queued meta-call to open the native modal dialog so it opens after the new
    637637    // event loop has started to execute (in QDialog::exec). Using a timer rather than
    638638    // a queued meta call is intentional to ensure that the call is only delivered when
    639     // [NSApp run] runs (timers are handeled special in cocoa). If NSApp is not
     639    // [NSApplication run] runs (timers are handeled special in cocoa). If NSApplication is not
    640640    // running (which is the case if e.g a top-most QEventLoop has been
    641641    // interrupted, and the second-most event loop has not yet been reactivated (regardless
    642     // if [NSApp run] is still on the stack)), showing a native modal dialog will fail.
     642    // if [NSApplication run] is still on the stack)), showing a native modal dialog will fail.
    643643    if (nativeDialogInUse) {
    644644        Q_Q(QFontDialog);
    645645        QTimer::singleShot(1, q, SLOT(_q_macRunNativeAppModalPanel()));
  • src/gui/kernel/qapplication_mac.mm

    old new void qt_mac_set_app_icon(const QPixmap &pixmap) 
    468468        image = static_cast<NSImage *>(qt_mac_create_nsimage(pixmap));
    469469    }
    470470
    471     [NSApp setApplicationIconImage:image];
     471    [[NSApplication sharedApplication] setApplicationIconImage:image];
    472472    [image release];
    473473#endif
    474474}
    void qt_event_request_showsheet(QWidget *w) 
    750750    Q_ASSERT(qt_mac_is_macsheet(w));
    751751#ifdef QT_MAC_USE_COCOA
    752752    w->repaint();
    753     [NSApp beginSheet:qt_mac_window_for(w) modalForWindow:qt_mac_window_for(w->parentWidget())
     753    [[NSApplication sharedApplication] beginSheet:qt_mac_window_for(w) modalForWindow:qt_mac_window_for(w->parentWidget())
    754754        modalDelegate:nil didEndSelector:nil contextInfo:0];
    755755#else
    756756    qt_mac_event_remove(request_showsheet_pending);
    Q_GUI_EXPORT void qt_mac_set_dock_menu(QMenu *menu) 
    992992{
    993993    qt_mac_dock_menu = menu;
    994994#ifdef QT_MAC_USE_COCOA
    995     [NSApp setDockMenu:menu->macMenu()];
     995    [[NSApplication sharedApplication] setDockMenu:menu->macMenu()];
    996996#else
    997997    SetApplicationDockTileMenu(menu->macMenu());
    998998#endif
    void qt_mac_event_release(QWidget *w) 
    10111011#ifndef QT_MAC_USE_COCOA
    10121012            SetApplicationDockTileMenu(0);
    10131013#else
    1014             [NSApp setDockMenu:0];
     1014            [[NSApplication sharedApplication] setDockMenu:0];
    10151015#endif
    10161016        }
    10171017    }
    QWidget *QApplication::topLevelAt(const QPoint &p) 
    14631463    NSWindowList(windowCount, windowList.data());
    14641464    int firstQtWindowFound = -1;
    14651465    for (int i = 0; i < windowCount; ++i) {
    1466         NSWindow *window = [NSApp windowWithWindowNumber:windowList[i]];
     1466        NSWindow *window = [[NSApplication sharedApplication] windowWithWindowNumber:windowList[i]];
    14671467        if (window) {
    14681468            QWidget *candidateWindow = [window QT_MANGLE_NAMESPACE(qt_qwidget)];
    14691469            if (candidateWindow && firstQtWindowFound == -1)
    bool QApplicationPrivate::canQuit() 
    30713071#else
    30723072    Q_Q(QApplication);
    30733073#ifdef QT_MAC_USE_COCOA
    3074     [[NSApp mainMenu] cancelTracking];
     3074    [[[NSApplication sharedApplication] mainMenu] cancelTracking];
    30753075#else
    30763076    HiliteMenu(0);
    30773077#endif
    void onApplicationChangedActivation( bool activated ) 
    31463146        }
    31473147
    31483148        if (!app->activeWindow()) {
    3149             OSWindowRef wp = [NSApp keyWindow];
     3149            OSWindowRef wp = [[NSApplication sharedApplication] keyWindow];
    31503150            if (QWidget *tmp_w = qt_mac_find_window(wp))
    31513151                app->setActiveWindow(tmp_w);
    31523152        }
  • src/gui/kernel/qcocoaapplication_mac.mm

    old new QT_USE_NAMESPACE 
    147147    if ([event type] == NSApplicationDefined) {
    148148        switch ([event subtype]) {
    149149            case QtCocoaEventSubTypePostMessage:
    150                 [NSApp QT_MANGLE_NAMESPACE(qt_sendPostedMessage):event];
     150                [[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_sendPostedMessage):event];
    151151                return true;
    152152            default:
    153153                break;
    QT_USE_NAMESPACE 
    174174    // be called instead of sendEvent if redirection occurs.
    175175    // 'self' will then be an instance of NSApplication
    176176    // (and not QNSApplication)
    177     if (![NSApp QT_MANGLE_NAMESPACE(qt_filterEvent):event])
     177    if (![[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_filterEvent):event])
    178178        [self QT_MANGLE_NAMESPACE(qt_sendEvent_original):event];
    179179}
    180180
    QT_USE_NAMESPACE 
    182182{
    183183    // This method will be called if
    184184    // no redirection occurs
    185     if (![NSApp QT_MANGLE_NAMESPACE(qt_filterEvent):event])
     185    if (![[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_filterEvent):event])
    186186        [super sendEvent:event];
    187187}
    188188
    QT_USE_NAMESPACE 
    194194    // visible on screen. Note: If Qt is used as a plugin, Qt will not use a
    195195    // native menu bar. Hence, we will also not need to do any redirection etc. as
    196196    // we do with sendEvent.
    197     [[NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender];
     197    [[[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender];
    198198}
    199199
    200200@end
    QT_BEGIN_NAMESPACE 
    203203
    204204void qt_redirectNSApplicationSendEvent()
    205205{
    206     if ([NSApp isMemberOfClass:[QT_MANGLE_NAMESPACE(QNSApplication) class]]) {
     206    if ([[NSApplication sharedApplication] isMemberOfClass:[QT_MANGLE_NAMESPACE(QNSApplication) class]]) {
    207207        // No need to change implementation since Qt
    208208        // already controls a subclass of NSApplication
    209209        return;
  • src/gui/kernel/qcocoaapplicationdelegate_mac.mm

    old new static void cleanupCocoaApplicationDelegate() 
    122122    [dockMenu release];
    123123    [qtMenuLoader release];
    124124    if (reflectionDelegate) {
    125         [NSApp setDelegate:reflectionDelegate];
     125        [[NSApplication sharedApplication] setDelegate:reflectionDelegate];
    126126        [reflectionDelegate release];
    127127    }
    128128    [super dealloc];
    static void cleanupCocoaApplicationDelegate() 
    183183    return [[qtMenuLoader retain] autorelease];
    184184}
    185185
    186 // This function will only be called when NSApp is actually running. Before
     186// This function will only be called when NSApplication is actually running. Before
    187187// that, the kAEQuitApplication Apple event will be sent to
    188188// QApplicationPrivate::globalAppleEventProcessor in qapplication_mac.mm
    189189- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
    static void cleanupCocoaApplicationDelegate() 
    249249        && [reflectionDelegate respondsToSelector:
    250250                            @selector(applicationShouldTerminateAfterLastWindowClosed:)])
    251251        return [reflectionDelegate applicationShouldTerminateAfterLastWindowClosed:sender];
    252     return NO; // Someday qApp->quitOnLastWindowClosed(); when QApp and NSApp work closer together.
     252    return NO; // Someday qApp->quitOnLastWindowClosed(); when qApp and NSApplication work closer together.
    253253}
    254254
    255255
    static void cleanupCocoaApplicationDelegate() 
    289289    qt_button_down = 0;
    290290}
    291291
     292- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag
     293{
     294    Q_UNUSED(theApplication);
     295    Q_UNUSED(flag);
     296    // The reflection delegate gets precedence
     297    if (reflectionDelegate
     298        && [reflectionDelegate respondsToSelector:@selector(applicationShouldHandleReopen:hasVisibleWindows:)])
     299        return [reflectionDelegate applicationShouldHandleReopen:theApplication hasVisibleWindows:flag];
     300
     301    onApplicationChangedActivation(true);
     302    return NO;
     303}
     304
    292305- (void)applicationDidChangeScreenParameters:(NSNotification *)notification
    293306{
    294307    Q_UNUSED(notification);
    295308    QDesktopWidgetImplementation::instance()->onResize();
    296309}
    297310
    298 - (void)setReflectionDelegate:(NSObject <NSApplicationDelegate> *)oldDelegate
     311- (void)setReflectionDelegate:(id <NSApplicationDelegate>)oldDelegate
    299312{
    300313    [oldDelegate retain];
    301314    [reflectionDelegate release];
    static void cleanupCocoaApplicationDelegate() 
    342355{
    343356    Q_UNUSED(event);
    344357    Q_UNUSED(replyEvent);
    345     [NSApp terminate:self];
     358    [[NSApplication sharedApplication] terminate:self];
    346359}
    347360
    348361- (void)qtDispatcherToQAction:(id)sender
    349362{
    350     [[NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender];
     363    [[[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender];
    351364}
    352365
    353366@end
  • src/gui/kernel/qcocoaapplicationdelegate_mac_p.h

    old new QT_FORWARD_DECLARE_CLASS(QApplicationPrivate); 
    113113    QApplicationPrivate *qtPrivate;
    114114    NSMenu *dockMenu;
    115115    QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader;
    116     NSObject <NSApplicationDelegate> *reflectionDelegate;
     116    id <NSApplicationDelegate> reflectionDelegate;
    117117    bool inLaunch;
    118118}
    119119+ (QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate)*)sharedDelegate;
    QT_FORWARD_DECLARE_CLASS(QApplicationPrivate); 
    122122- (QApplicationPrivate *)qAppPrivate;
    123123- (void)setMenuLoader:(QT_MANGLE_NAMESPACE(QCocoaMenuLoader)*)menuLoader;
    124124- (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)menuLoader;
    125 - (void)setReflectionDelegate:(NSObject <NSApplicationDelegate> *)oldDelegate;
     125- (void)setReflectionDelegate:(id <NSApplicationDelegate>)oldDelegate;
    126126- (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent;
    127127@end
    128128#endif
  • src/gui/kernel/qcocoamenuloader_mac.mm

    old new QT_USE_NAMESPACE 
    9292    // 'Quit' item. When changing menu bar (e.g when switching between
    9393    // windows with different menu bars), we never recreate this menu, but
    9494    // instead pull it out the current menu bar and place into the new one:
    95     NSMenu *mainMenu = [NSApp mainMenu];
    96     if ([NSApp mainMenu] == menu)
     95    NSMenu *mainMenu = [[NSApplication sharedApplication] mainMenu];
     96    if ([[NSApplication sharedApplication] mainMenu] == menu)
    9797        return; // nothing to do (menu is the current menu bar)!
    9898
    9999#ifndef QT_NAMESPACE
    QT_USE_NAMESPACE 
    201201
    202202- (void)terminate:(id)sender
    203203{
    204     [NSApp terminate:sender];
     204    [[NSApplication sharedApplication] terminate:sender];
    205205}
    206206
    207207- (void)orderFrontStandardAboutPanel:(id)sender
    208208{
    209     [NSApp orderFrontStandardAboutPanel:sender];
     209    [[NSApplication sharedApplication] orderFrontStandardAboutPanel:sender];
    210210}
    211211
    212212- (void)hideOtherApplications:(id)sender
    213213{
    214     [NSApp hideOtherApplications:sender];
     214    [[NSApplication sharedApplication] hideOtherApplications:sender];
    215215}
    216216
    217217- (void)unhideAllApplications:(id)sender
    218218{
    219     [NSApp unhideAllApplications:sender];
     219    [[NSApplication sharedApplication] unhideAllApplications:sender];
    220220}
    221221
    222222- (void)hide:(id)sender
    223223{
    224     [NSApp hide:sender];
     224    [[NSApplication sharedApplication] hide:sender];
    225225}
    226226
    227227- (void)qtUpdateMenubar
    QT_USE_NAMESPACE 
    258258
    259259 - (void)orderFrontCharacterPalette:(id)sender
    260260 {
    261      [NSApp orderFrontCharacterPalette:sender];
     261     [[NSApplication sharedApplication] orderFrontCharacterPalette:sender];
    262262 }
    263263
    264264- (BOOL)validateMenuItem:(NSMenuItem*)menuItem
    QT_USE_NAMESPACE 
    266266    if ([menuItem action] == @selector(hide:)
    267267        || [menuItem action] == @selector(hideOtherApplications:)
    268268        || [menuItem action] == @selector(unhideAllApplications:)) {
    269         return [NSApp validateMenuItem:menuItem];
     269        return [[NSApplication sharedApplication] validateMenuItem:menuItem];
    270270    } else {
    271271        return [menuItem isEnabled];
    272272    }
  • src/gui/kernel/qcocoasharedwindowmethods_mac_p.h

    old new QT_END_NAMESPACE 
    143143{
    144144    // This function is called from the quit item in the menubar when this window
    145145    // is in the first responder chain (see also qtDispatcherToQAction above)
    146     [NSApp terminate:sender];
     146    [[NSApplication sharedApplication] terminate:sender];
    147147}
    148148
    149149- (void)setLevel:(NSInteger)windowLevel
    QT_END_NAMESPACE 
    364364
    365365    if ([sender draggingSource] != nil) {
    366366        // modifier flags might have changed, update it here since we don't send any input events.
    367         QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[NSApp currentEvent] modifierFlags]);
     367        QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[[NSApplication sharedApplication] currentEvent] modifierFlags]);
    368368        modifiers = QApplication::keyboardModifiers();
    369369    } else {
    370370        // when the source is from another application the above technique will not work.
    QT_END_NAMESPACE 
    456456
    457457    // Update modifiers:
    458458    if ([sender draggingSource] != nil) {
    459         QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[NSApp currentEvent] modifierFlags]);
     459        QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[[NSApplication sharedApplication] currentEvent] modifierFlags]);
    460460        modifiers = QApplication::keyboardModifiers();
    461461    } else {
    462462        modifiers = qt_cocoaDragOperation2QtModifiers(nsActions);
  • src/gui/kernel/qeventdispatcher_mac.mm

    old new static bool qt_mac_send_event(QEventLoop::ProcessEventsFlags, OSEventRef event, 
    461461    if (pt)
    462462        [pt sendEvent:event];
    463463    else
    464         [NSApp sendEvent:event];
     464        [[NSApplication sharedApplication] sendEvent:event];
    465465    return true;
    466466#endif
    467467}
    static inline void qt_mac_waitForMoreEvents() 
    521521    // (and free up cpu time) until at least one event occur.
    522522    // This implementation is a bit on the edge, but seems to
    523523    // work fine:
    524     NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
     524    NSEvent* event = [[NSApplication sharedApplication] nextEventMatchingMask:NSAnyEventMask
    525525        untilDate:[NSDate distantFuture]
    526526        inMode:NSDefaultRunLoopMode
    527527        dequeue:YES];
    528528    if (event)
    529         [NSApp postEvent:event atStart:YES];
     529        [[NSApplication sharedApplication] postEvent:event atStart:YES];
    530530#endif
    531531}
    532532
    static inline void qt_mac_waitForMoreModalSessionEvents() 
    537537    // (and free up cpu time) until at least one event occur.
    538538    // This implementation is a bit on the edge, but seems to
    539539    // work fine:
    540     NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
     540    NSEvent* event = [[NSApplication sharedApplication] nextEventMatchingMask:NSAnyEventMask
    541541        untilDate:[NSDate distantFuture]
    542542        inMode:NSModalPanelRunLoopMode
    543543        dequeue:YES];
    544544    if (event)
    545         [NSApp postEvent:event atStart:YES];
     545        [[NSApplication sharedApplication] postEvent:event atStart:YES];
    546546}
    547547#endif
    548548
    bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) 
    588588        // done from the application itself. And if processEvents is called
    589589        // manually (rather than from a QEventLoop), we cannot enter a tight
    590590        // loop and block this call, but instead we need to return after one flush.
    591         // Finally, if we are to exclude user input events, we cannot call [NSApp run]
     591        // Finally, if we are to exclude user input events, we cannot call [NSApplication run]
    592592        // as we then loose control over which events gets dispatched:
    593         const bool canExec_3rdParty = d->nsAppRunCalledByQt || ![NSApp isRunning];
     593        const bool canExec_3rdParty = d->nsAppRunCalledByQt || ![[NSApplication sharedApplication] isRunning];
    594594        const bool canExec_Qt = !excludeUserEvents &&
    595595                (flags & QEventLoop::DialogExec || flags & QEventLoop::EventLoopExec) ;
    596596
    597597        if (canExec_Qt && canExec_3rdParty) {
    598598            // We can use exec-mode, meaning that we can stay in a tight loop until
    599599            // interrupted. This is mostly an optimization, but it allow us to use
    600             // [NSApp run], which is the normal code path for cocoa applications.
     600            // [NSApplication run], which is the normal code path for cocoa applications.
    601601            if (NSModalSession session = d->currentModalSession()) {
    602602                QBoolBlocker execGuard(d->currentExecIsNSAppRun, false);
    603                 while ([NSApp runModalSession:session] == NSRunContinuesResponse && !d->interrupt)
     603                while ([[NSApplication sharedApplication] runModalSession:session] == NSRunContinuesResponse && !d->interrupt)
    604604                    qt_mac_waitForMoreModalSessionEvents();
    605605
    606606                if (!d->interrupt && session == d->currentModalSessionCached) {
    607                     // Someone called [NSApp stopModal:] from outside the event
     607                    // Someone called [[NSApplication sharedApplication] stopModal:] from outside the event
    608608                    // dispatcher (e.g to stop a native dialog). But that call wrongly stopped
    609609                    // 'session' as well. As a result, we need to restart all internal sessions:
    610610                    d->temporarilyStopAllModalSessions();
    bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) 
    612612            } else {
    613613                d->nsAppRunCalledByQt = true;
    614614                QBoolBlocker execGuard(d->currentExecIsNSAppRun, true);
    615                 [NSApp run];
     615                [[NSApplication sharedApplication] run];
    616616            }
    617617            retVal = true;
    618618        } else {
    bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) 
    626626                    // to use cocoa's native way of running modal sessions:
    627627                    if (flags & QEventLoop::WaitForMoreEvents)
    628628                        qt_mac_waitForMoreModalSessionEvents();
    629                     NSInteger status = [NSApp runModalSession:session];
     629                    NSInteger status = [[NSApplication sharedApplication] runModalSession:session];
    630630                    if (status != NSRunContinuesResponse && session == d->currentModalSessionCached) {
    631                         // INVARIANT: Someone called [NSApp stopModal:] from outside the event
     631                        // INVARIANT: Someone called [NSApplication stopModal:] from outside the event
    632632                        // dispatcher (e.g to stop a native dialog). But that call wrongly stopped
    633633                        // 'session' as well. As a result, we need to restart all internal sessions:
    634634                        d->temporarilyStopAllModalSessions();
    bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) 
    637637                } else do {
    638638                    // Dispatch all non-user events (but que non-user events up for later). In
    639639                    // this case, we need more control over which events gets dispatched, and
    640                     // cannot use [NSApp runModalSession:session]:
    641                     event = [NSApp nextEventMatchingMask:NSAnyEventMask
     640                    // cannot use [NSApplication runModalSession:session]:
     641                    event = [[NSApplication sharedApplication] nextEventMatchingMask:NSAnyEventMask
    642642                    untilDate:nil
    643643                    inMode:NSModalPanelRunLoopMode
    644644                    dequeue: YES];
    bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) 
    655655                } while (!d->interrupt && event != nil);
    656656            } else do {
    657657                // INVARIANT: No modal window is executing.
    658                 event = [NSApp nextEventMatchingMask:NSAnyEventMask
     658                event = [[NSApplication sharedApplication] nextEventMatchingMask:NSAnyEventMask
    659659                untilDate:nil
    660660                inMode:NSDefaultRunLoopMode
    661661                dequeue: YES];
    void QEventDispatcherMacPrivate::ensureNSAppInitialized() 
    798798    // we let Cocoa finish the initialization it seems to need. We'll only
    799799    // apply this trick at most once for any application, and we avoid doing it
    800800    // for the common case where main just starts QApplication::exec.
    801     if (nsAppRunCalledByQt || [NSApp isRunning])
     801    if (nsAppRunCalledByQt || [[NSApplication sharedApplication] isRunning])
    802802        return;
    803803    nsAppRunCalledByQt = true;
    804804    QBoolBlocker block1(interrupt, true);
    805805    QBoolBlocker block2(currentExecIsNSAppRun, true);
    806     [NSApp run];
     806    [[NSApplication sharedApplication] run];
    807807}
    808808
    809809void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions()
    void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions() 
    812812    // such, make them pending again. The next call to
    813813    // currentModalSession will recreate them again. The
    814814    // reason to stop all session like this is that otherwise
    815     // a call [NSApp stop] would not stop NSApp, but rather
    816     // the current modal session. So if we need to stop NSApp
     815    // a call [NSApplication stop] would not stop NSApplication, but rather
     816    // the current modal session. So if we need to stop NSApplication
    817817    // we need to stop all the modal session first. To avoid changing
    818818    // the stacking order of the windows while doing so, we put
    819819    // up a block that is used in QCocoaWindow and QCocoaPanel:
    void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions() 
    821821    for (int i=0; i<stackSize; ++i) {
    822822        QCocoaModalSessionInfo &info = cocoaModalSessionStack[i];
    823823        if (info.session) {
    824             [NSApp endModalSession:info.session];
     824            [[NSApplication sharedApplication] endModalSession:info.session];
    825825            info.session = 0;
    826826        }
    827827    }
    NSModalSession QEventDispatcherMacPrivate::currentModalSession() 
    856856            info.nswindow = window;
    857857            [(NSWindow*) info.nswindow retain];
    858858            int levelBeforeEnterModal = [window level];
    859             info.session = [NSApp beginModalSessionForWindow:window];
     859            info.session = [[NSApplication sharedApplication] beginModalSessionForWindow:window];
    860860            // Make sure we don't stack the window lower that it was before
    861861            // entering modal, in case it e.g. had the stays-on-top flag set:
    862862            if (levelBeforeEnterModal > [window level])
    void QEventDispatcherMacPrivate::cleanupModalSessions() 
    926926        cocoaModalSessionStack.remove(i);
    927927        currentModalSessionCached = 0;
    928928        if (info.session) {
    929             [NSApp endModalSession:info.session];
     929            [[NSApplication sharedApplication] endModalSession:info.session];
    930930            [(NSWindow *)info.nswindow release];
    931931        }
    932932    }
    inline static void processPostedEvents(QEventDispatcherMacPrivate *const d, cons 
    10571057            // pending cocoa events first).
    10581058            if (d->currentModalSessionCached)
    10591059                d->temporarilyStopAllModalSessions();
    1060             [NSApp stop:NSApp];
     1060            [[NSApplication sharedApplication] stop:[NSApplication sharedApplication]];
    10611061            d->cancelWaitForMoreEvents();
    10621062        }
    10631063#endif
    void QEventDispatcherMacPrivate::cancelWaitForMoreEvents() 
    10931093    // In case the event dispatcher is waiting for more
    10941094    // events somewhere, we post a dummy event to wake it up:
    10951095    QMacCocoaAutoReleasePool pool;
    1096     [NSApp postEvent:[NSEvent otherEventWithType:NSApplicationDefined location:NSZeroPoint
     1096    [[NSApplication sharedApplication] postEvent:[NSEvent otherEventWithType:NSApplicationDefined
     1097        location:NSZeroPoint
    10971098        modifierFlags:0 timestamp:0. windowNumber:0 context:0
    10981099        subtype:QtCocoaEventSubTypeWakeup data1:0 data2:0] atStart:NO];
    10991100}
    void QEventDispatcherMac::interrupt() 
    11101111#else
    11111112    // We do nothing more here than setting d->interrupt = true, and
    11121113    // poke the event loop if it is sleeping. Actually stopping
    1113     // NSApp, or the current modal session, is done inside the send
     1114    // NSApplication, or the current modal session, is done inside the send
    11141115    // posted events callback. We do this to ensure that all current pending
    11151116    // cocoa events gets delivered before we stop. Otherwise, if we now stop
    11161117    // the last event loop recursion, cocoa will just drop pending posted
    QtMacInterruptDispatcherHelp::QtMacInterruptDispatcherHelp() : cancelled(false) 
    11651166    // The whole point of this class is that we enable a way to interrupt
    11661167    // the event dispatcher when returning back to a lower recursion level
    11671168    // than where interruptLater was called. This is needed to detect if
    1168     // [NSApp run] should still be running at the recursion level it is at.
     1169    // [NSApplication run] should still be running at the recursion level it is at.
    11691170    // Since the interrupt is canceled if processEvents is called before
    11701171    // this object gets deleted, we also avoid interrupting unnecessary.
    11711172    deleteLater();
  • src/gui/kernel/qt_cocoa_helpers_mac.mm

    old new void qt_cocoaPostMessage(id target, SEL selector, int argCount, id arg1, id arg2 
    16971697    NSEvent *e = [NSEvent otherEventWithType:NSApplicationDefined
    16981698        location:NSZeroPoint modifierFlags:0 timestamp:0 windowNumber:0
    16991699        context:nil subtype:QtCocoaEventSubTypePostMessage data1:lower data2:upper];
    1700     [NSApp postEvent:e atStart:NO];
     1700    [[NSApplication sharedApplication] postEvent:e atStart:NO];
    17011701}
    17021702
    17031703void qt_cocoaPostMessageAfterEventLoopExit(id target, SEL selector, int argCount, id arg1, id arg2)
    void qt_mac_post_retranslateAppMenu() 
    17271727{
    17281728#ifdef QT_MAC_USE_COCOA
    17291729    QMacCocoaAutoReleasePool pool;
    1730     qt_cocoaPostMessage([NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)], @selector(qtTranslateApplicationMenu));
     1730    qt_cocoaPostMessage([[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)], @selector(qtTranslateApplicationMenu));
    17311731#endif
    17321732}
    17331733
  • src/gui/kernel/qt_mac_p.h

    old new  
    7575
    7676#include <Carbon/Carbon.h>
    7777
     78#if !defined(QT_MAC_USE_COCOA) && defined(MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
     79    // Some deprecated functions have been removed from the the 10.7 SDK, but the symbols are
     80    // still exported by the 32-bit QD.framework (a subframework of ApplicationServices).
     81    extern "C" {
     82        // from QuickdrawAPI.h
     83        // https://developer.apple.com/legacy/library/documentation/Carbon/reference/QuickDraw_Ref/QuickDraw_Ref.pdf
     84        void          CopyBits(const BitMap *srcBits, const BitMap *dstBits, const Rect *srcRect, const Rect *dstRect, short mode, RgnHandle maskRgn);
     85        void          CopyRgn(RgnHandle srcRgn, RgnHandle dstRgn);
     86        void          DisposeRgn(RgnHandle rgn);
     87        GDHandle      GetMainDevice(void);
     88        const BitMap *GetPortBitMapForCopyBits(CGrafPtr port);
     89        Rect         *GetRegionBounds(RgnHandle region, Rect *bounds);
     90        RgnHandle     NewRgn(void);
     91        OSStatus      QDRegionToRects(RgnHandle rgn, QDRegionParseDirection dir, RegionToRectsUPP proc, void *userData);
     92        void          SetEmptyRgn(RgnHandle rgn);
     93        void          SetRect(Rect* r, short left, short top, short right, short bottom);
     94        void          SetRectRgn(RgnHandle rgn, short left, short top, short right, short bottom);
     95        void          UnionRgn(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn);
     96        enum {
     97            kQDRegionToRectsMsgInit       = 1,
     98            kQDRegionToRectsMsgParse      = 2,
     99            kQDRegionToRectsMsgTerminate  = 3
     100        };
     101        enum {
     102            kQDParseRegionFromTop         = (1 << 0),
     103            kQDParseRegionFromBottom      = (1 << 1),
     104            kQDParseRegionFromLeft        = (1 << 2),
     105            kQDParseRegionFromRight       = (1 << 3),
     106            kQDParseRegionFromTopLeft     = kQDParseRegionFromTop | kQDParseRegionFromLeft,
     107            kQDParseRegionFromBottomRight = kQDParseRegionFromBottom | kQDParseRegionFromRight
     108        };
     109
     110        // from Fonts.h
     111        // https://developer.apple.com/legacy/library/documentation/Carbon/reference/Font_Manager/fm_reference.pdf
     112        OSStatus         FMCreateFontIterator(const FMFilter *iFilter, void *iRefCon, OptionBits iOptions, FMFontIterator *ioIterator);
     113        OSStatus         FMDisposeFontIterator(FMFontIterator *ioIterator);
     114        ATSFontFamilyRef FMGetATSFontFamilyRefFromFont(FMFontFamily iFamily);
     115        ATSFontFamilyRef FMGetATSFontFamilyRefFromFontFamily(FMFontFamily iFamily);
     116        ATSFontRef       FMGetATSFontRefFromFont(FMFont iFont);
     117        OSStatus         FMGetFontFamilyInstanceFromFont(FMFont iFont, FMFontFamily *oFontFamily, FMFontStyle *oStyle);
     118        FMFontFamily     FMGetFontFamilyFromATSFontFamilyRef(ATSFontFamilyRef iFamily);
     119        FMFont           FMGetFontFromATSFontRef(ATSFontRef iFont);
     120        OSStatus         FMGetFontFromFontFamilyInstance(FMFontFamily iFontFamily, FMFontStyle iStyle, FMFont *oFont, FMFontStyle *oIntrinsicStyle);
     121        OSStatus         FMGetNextFont(FMFontIterator *ioIterator, FMFont *oFont);
     122        enum {
     123            kFMUseGlobalScopeOption       = 0x00000001
     124        };
     125        enum {
     126            commandMark                   = 17,
     127            checkMark                     = 18,
     128            diamondMark                   = 19,
     129            appleMark                     = 20
     130        };
     131    }
     132#endif
     133
    78134QT_BEGIN_NAMESPACE
    79135class QWidget;
    80136class QDragMoveEvent;
  • src/gui/kernel/qwidget_mac.mm

    old new static QSize qt_mac_desktopSize() 
    220220static NSDrawer *qt_mac_drawer_for(const QWidget *widget)
    221221{
    222222    NSView *widgetView = reinterpret_cast<NSView *>(widget->window()->effectiveWinId());
    223     NSArray *windows = [NSApp windows];
     223    NSArray *windows = [[NSApplication sharedApplication] windows];
    224224    for (NSWindow *window in windows) {
    225225        NSArray *drawers = [window drawers];
    226226        for (NSDrawer *drawer in drawers) {
    static void qt_mac_destructWindow(OSWindowRef window) 
    254254{
    255255#ifdef QT_MAC_USE_COCOA
    256256    if ([window isVisible] && [window isSheet]){
    257         [NSApp endSheet:window];
     257        [[NSApplication sharedApplication] endSheet:window];
    258258        [window orderOut:window];
    259259    }
    260260
    void QWidgetPrivate::recreateMacWindow() 
    24392439    }
    24402440    if ([oldWindow isVisible]){
    24412441        if ([oldWindow isSheet])
    2442             [NSApp endSheet:oldWindow];
     2442            [[NSApplication sharedApplication] endSheet:oldWindow];
    24432443        [oldWindow orderOut:oldWindow];
    24442444        show_sys();
    24452445    }
    void QWidgetPrivate::show_sys() 
    35543554    }
    35553555
    35563556#ifdef QT_MAC_USE_COCOA
    3557     if ([NSApp isActive] && !qt_button_down && !QWidget::mouseGrabber()){
     3557    if ([[NSApplication sharedApplication] isActive] && !qt_button_down && !QWidget::mouseGrabber()){
    35583558        // Update enter/leave immidiatly, don't wait for a move event. But only
    35593559        // if no grab exists (even if the grab points to this widget, it seems, ref X11)
    35603560        QPoint qlocal, qglobal;
    void QWidgetPrivate::hide_sys() 
    36053605            else
    36063606                HideSheetWindow(window);
    36073607#else
    3608             [NSApp endSheet:window];
     3608            [[NSApplication sharedApplication] endSheet:window];
    36093609            [window orderOut:window];
    36103610#endif
    36113611        } else if(qt_mac_is_macdrawer(q)) {
    void QWidgetPrivate::hide_sys() 
    37163716    }
    37173717
    37183718#ifdef QT_MAC_USE_COCOA
    3719     if ([NSApp isActive] && !qt_button_down && !QWidget::mouseGrabber()){
     3719    if ([[NSApplication sharedApplication] isActive] && !qt_button_down && !QWidget::mouseGrabber()){
    37203720        // Update enter/leave immidiatly, don't wait for a move event. But only
    37213721        // if no grab exists (even if the grab points to this widget, it seems, ref X11)
    37223722        QPoint qlocal, qglobal;
  • src/gui/styles/qmacstyle_mac.mm

    old new static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg 
    780780            if (!GetThemeMenuBarHeight(&size))
    781781                ret = QSize(-1, size);
    782782#else
    783             ret = QSize(-1, [[NSApp mainMenu] menuBarHeight]);
     783            ret = QSize(-1, [[[NSApplication sharedApplication] mainMenu] menuBarHeight]);
    784784            // In the qt_mac_set_native_menubar(false) case,
    785785            // we come it here with a zero-height main menu,
    786786            // preventing the in-window menu from displaying.
    void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai 
    30243024                fdi.version = qt_mac_hitheme_version;
    30253025                fdi.state = tds;
    30263026                SInt32 frame_size;
    3027                 if (pe == PE_FrameLineEdit) {
    3028                     fdi.kind = kHIThemeFrameTextFieldSquare;
    3029                     GetThemeMetric(kThemeMetricEditTextFrameOutset, &frame_size);
    3030                     if ((frame->state & State_ReadOnly) || !(frame->state & State_Enabled))
    3031                         fdi.state = kThemeStateInactive;
    3032                 } else {
    3033                     baseColor = QColor(150, 150, 150); //hardcoded since no query function --Sam
    3034                     fdi.kind = kHIThemeFrameListBox;
    3035                     GetThemeMetric(kThemeMetricListBoxFrameOutset, &frame_size);
    3036                 }
     3027                fdi.kind = kHIThemeFrameTextFieldSquare;
     3028                GetThemeMetric(kThemeMetricEditTextFrameOutset, &frame_size);
     3029                if ((frame->state & State_ReadOnly) || !(frame->state & State_Enabled))
     3030                    fdi.state = kThemeStateInactive;
     3031                else if (fdi.state == kThemeStatePressed)
     3032                    // This pressed state doesn't make sense for a line edit frame.
     3033                    // And Yosemite agrees with us. Otherwise it starts showing yellow pixels.
     3034                    fdi.state = kThemeStateActive;
    30373035                fdi.isFocused = (frame->state & State_HasFocus);
    30383036                int lw = frame->lineWidth;
    30393037                if (lw <= 0)
  • src/gui/util/qsystemtrayicon_mac.mm

    old new private: 
    536536#ifndef QT_MAC_USE_COCOA
    537537                const short scale = GetMBarHeight();
    538538#else
    539                 const short scale = [[NSApp mainMenu] menuBarHeight];
     539                const short scale = [[[NSApplication sharedApplication] mainMenu] menuBarHeight];
    540540#endif
    541541                NSImage *nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(icon.pixmap(QSize(scale, scale))));
    542542                [item setImage: nsimage];
  • src/gui/widgets/qcocoamenu_mac.mm

    old new QT_USE_NAMESPACE 
    202202     static SEL selForOFCP = NSSelectorFromString(@"orderFrontCharacterPalette:");
    203203     if (index == -1 && selForOFCP == actionSelector) {
    204204         // Check if the 'orderFrontCharacterPalette' SEL exists for QCocoaMenuLoader object
    205          QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];
     205         QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = [[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];
    206206         return [super indexOfItemWithTarget:loader andAction:actionSelector];
    207207     }
    208208     return index;
  • src/gui/widgets/qmenu_mac.mm

    old new static void cancelAllMenuTracking() 
    179179{
    180180#ifdef QT_MAC_USE_COCOA
    181181    QMacCocoaAutoReleasePool pool;
    182     NSMenu *mainMenu = [NSApp mainMenu];
     182    NSMenu *mainMenu = [[NSApplication sharedApplication] mainMenu];
    183183    [mainMenu cancelTracking];
    184184    for (NSMenuItem *item in [mainMenu itemArray]) {
    185185        if ([item submenu]) {
    static inline void syncMenuBarItemsVisiblity(const QMenuBarPrivate::QMacMenuBarP 
    633633
    634634static inline QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *getMenuLoader()
    635635{
    636     return [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];
     636    return [[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];
    637637}
    638638
    639639static NSMenuItem *createNSMenuItem(const QString &title)
    void qt_mac_clear_menubar() 
    20332033    QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader();
    20342034    NSMenu *menu = [loader menu];
    20352035    [loader ensureAppMenuInMenu:menu];
    2036     [NSApp setMainMenu:menu];
     2036    [[NSApplication sharedApplication] setMainMenu:menu];
    20372037    const bool modal = qt_mac_should_disable_menu(0);
    20382038    if (qt_mac_current_menubar.qmenubar || modal != qt_mac_current_menubar.modal)
    20392039        qt_mac_set_modal_state(menu, modal);
    bool QMenuBarPrivate::macUpdateMenuBarImmediatly() 
    21002100#else
    21012101            QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader();
    21022102            [loader ensureAppMenuInMenu:menu];
    2103             [NSApp setMainMenu:menu];
     2103            [[NSApplication sharedApplication] setMainMenu:menu];
    21042104            syncMenuBarItemsVisiblity(mb->d_func()->mac_menubar);
    21052105
    21062106            if (OSMenuRef tmpMerge = QMenuPrivate::mergeMenuHash.value(menu)) {
    bool QMenuBarPrivate::macUpdateMenuBarImmediatly() 
    21402140#else
    21412141                QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader();
    21422142                [loader ensureAppMenuInMenu:menu];
    2143                 [NSApp setMainMenu:menu];
     2143                [[NSApplication sharedApplication] setMainMenu:menu];
    21442144                syncMenuBarItemsVisiblity(qt_mac_current_menubar.qmenubar->d_func()->mac_menubar);
    21452145#endif
    21462146                qt_mac_set_modal_state(menu, modal);