Changeset 126922


Ignore:
Timestamp:
Oct 17, 2014, 6:50:56 PM (5 years ago)
Author:
ryandesign@…
Message:

qt4-mac: fix patch-10.10.diff (#45421)

Location:
trunk/dports/aqua/qt4-mac
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/aqua/qt4-mac/Portfile

    r126865 r126922  
    1616#conflicts           qt3 qt3-mac qt4-mac-devel
    1717conflicts           qt3 qt3-mac qt5-mac
    18 version             4.8.6
     18version             4.8.6 
    1919set branch          [join [lrange [split ${version} .] 0 1] .]
    2020
  • trunk/dports/aqua/qt4-mac/files/patch-10.10.diff

    r126865 r126922  
    983983 #endif
    984984                 qt_mac_set_modal_state(menu, modal);
    985 --- src/corelib/global/qglobal.cpp.orig
    986 +++ src/corelib/global/qglobal.cpp
    987 @@ -1185,6 +1185,7 @@ bool qSharedBuild()
    988      \value MV_10_7     OS X 10.7
    989      \value MV_10_8     OS X 10.8
    990      \value MV_10_9     OS X 10.9
    991 +    \value MV_10_10    OS X 10.10
    992      \value MV_Unknown  An unknown and currently unsupported platform
    993  
    994      \value MV_CHEETAH  Apple codename for MV_10_0
    995 @@ -1197,6 +1198,7 @@ bool qSharedBuild()
    996      \value MV_LION     Apple codename for MV_10_7
    997      \value MV_MOUNTAINLION Apple codename for MV_10_8
    998      \value MV_MAVERICKS    Apple codename for MV_10_9
    999 +    \value MV_YOSEMITE     Apple codename for MV_10_10
    1000  
    1001      \sa WinVersion, SymbianVersion
    1002  */
    1003 @@ -1674,8 +1676,9 @@ static QSysInfo::MacVersion macVersion()
    1004  {
    1005  #if !defined(Q_OS_IOS)
    1006      SInt32 gestalt_version;
    1007 -    if (Gestalt(gestaltSystemVersion, &gestalt_version) == noErr) {
    1008 -        return QSysInfo::MacVersion(((gestalt_version & 0x00F0) >> 4) + 2);
    1009 +    if (Gestalt(gestaltSystemVersionMinor, &gestalt_version) == noErr) {
    1010 +        // add 2 because OS X 10.0 is 0x02 in the enum
    1011 +        return QSysInfo::MacVersion(gestalt_version + 2);
    1012      }
    1013  #endif
    1014      return QSysInfo::MV_Unknown;
    1015 --- src/corelib/global/qglobal.h.orig
    1016 +++ src/corelib/global/qglobal.h
    1017 @@ -304,31 +304,69 @@ namespace QT_NAMESPACE {}
    1018  #endif
    1019  
    1020  #ifdef Q_OS_DARWIN
    1021 -#  ifdef MAC_OS_X_VERSION_MIN_REQUIRED
    1022 -#    undef MAC_OS_X_VERSION_MIN_REQUIRED
    1023 -#  endif
    1024 -#  define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_4
    1025  #  include <AvailabilityMacros.h>
    1026 -#  if !defined(MAC_OS_X_VERSION_10_3)
    1027 -#     define MAC_OS_X_VERSION_10_3 MAC_OS_X_VERSION_10_2 + 1
    1028 +#
    1029 +#  // Availability.h was introduced with the OS X 10.6 SDK
    1030 +#  if (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060) || \
    1031 +      (defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)
    1032 +#    include <Availability.h>
    1033 +#  endif
    1034 +#
    1035 +#  ifdef Q_OS_MACX
    1036 +#    if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED < 1040
    1037 +#       undef __MAC_OS_X_VERSION_MIN_REQUIRED
    1038 +#       define __MAC_OS_X_VERSION_MIN_REQUIRED 1040
    1039 +#    endif
    1040 +#    if !defined(MAC_OS_X_VERSION_MIN_REQUIRED) || MAC_OS_X_VERSION_MIN_REQUIRED < 1040
    1041 +#       undef MAC_OS_X_VERSION_MIN_REQUIRED
    1042 +#       define MAC_OS_X_VERSION_MIN_REQUIRED 1040
    1043 +#    endif
    1044 +#  endif
    1045 +#
    1046 +#  // Numerical checks are preferred to named checks, but to be safe
    1047 +#  // we define the missing version names in case Qt uses them.
    1048 +#
    1049 +#  if !defined(__MAC_10_4)
    1050 +#       define __MAC_10_4 1040
    1051 +#  endif
    1052 +#  if !defined(__MAC_10_5)
    1053 +#       define __MAC_10_5 1050
    1054 +#  endif
    1055 +#  if !defined(__MAC_10_6)
    1056 +#       define __MAC_10_6 1060
    1057 +#  endif
    1058 +#  if !defined(__MAC_10_7)
    1059 +#       define __MAC_10_7 1070
    1060 +#  endif
    1061 +#  if !defined(__MAC_10_8)
    1062 +#       define __MAC_10_8 1080
    1063 +#  endif
    1064 +#  if !defined(__MAC_10_9)
    1065 +#       define __MAC_10_9 1090
    1066 +#  endif
    1067 +#  if !defined(__MAC_10_10)
    1068 +#       define __MAC_10_10 101000
    1069  #  endif
    1070  #  if !defined(MAC_OS_X_VERSION_10_4)
    1071 -#       define MAC_OS_X_VERSION_10_4 MAC_OS_X_VERSION_10_3 + 1
    1072 +#       define MAC_OS_X_VERSION_10_4 1040
    1073  #  endif
    1074  #  if !defined(MAC_OS_X_VERSION_10_5)
    1075 -#       define MAC_OS_X_VERSION_10_5 MAC_OS_X_VERSION_10_4 + 1
    1076 +#       define MAC_OS_X_VERSION_10_5 1050
    1077  #  endif
    1078  #  if !defined(MAC_OS_X_VERSION_10_6)
    1079 -#       define MAC_OS_X_VERSION_10_6 MAC_OS_X_VERSION_10_5 + 1
    1080 +#       define MAC_OS_X_VERSION_10_6 1060
    1081  #  endif
    1082  #  if !defined(MAC_OS_X_VERSION_10_7)
    1083 -#       define MAC_OS_X_VERSION_10_7 MAC_OS_X_VERSION_10_6 + 1
    1084 +#       define MAC_OS_X_VERSION_10_7 1070
    1085  #  endif
    1086  #  if !defined(MAC_OS_X_VERSION_10_8)
    1087 -#       define MAC_OS_X_VERSION_10_8 MAC_OS_X_VERSION_10_7 + 1
    1088 +#       define MAC_OS_X_VERSION_10_8 1080
    1089  #  endif
    1090  #  if !defined(MAC_OS_X_VERSION_10_9)
    1091 -#       define MAC_OS_X_VERSION_10_9 MAC_OS_X_VERSION_10_8 + 1
    1092 +#       define MAC_OS_X_VERSION_10_9 1090
    1093 +#  endif
    1094 +#  if !defined(MAC_OS_X_VERSION_10_10)
    1095 +#       define MAC_OS_X_VERSION_10_10 101000
    1096  #  endif
    1097  #endif
    1098  
    1099 @@ -1630,6 +1668,7 @@ public:
    1100          MV_10_7 = 0x0009,
    1101          MV_10_8 = 0x000A,
    1102          MV_10_9 = 0x000B,
    1103 +        MV_10_10 = 0x000C,
    1104  
    1105          /* codenames */
    1106          MV_CHEETAH = MV_10_0,
    1107 @@ -1641,7 +1680,8 @@ public:
    1108          MV_SNOWLEOPARD = MV_10_6,
    1109          MV_LION = MV_10_7,
    1110          MV_MOUNTAINLION = MV_10_8,
    1111 -        MV_MAVERICKS = MV_10_9
    1112 +        MV_MAVERICKS = MV_10_9,
    1113 +        MV_YOSEMITE = MV_10_10
    1114      };
    1115      static const MacVersion MacintoshVersion;
    1116  #endif
    1117 --- src/gui/dialogs/qcolordialog_mac.mm.orig
    1118 +++ src/gui/dialogs/qcolordialog_mac.mm
    1119 @@ -318,7 +318,7 @@ QT_USE_NAMESPACE
    1120          // It's important that the modal event loop is stopped before
    1121          // we accept/reject QColorDialog, since QColorDialog has its
    1122          // own event loop that needs to be stopped last.
    1123 -        [NSApp stopModalWithCode:code];
    1124 +        [[NSApplication sharedApplication] stopModalWithCode:code];
    1125      } else {
    1126          // Since we are not in a modal event loop, we can safely close
    1127          // down QColorDialog
    1128 @@ -350,7 +350,7 @@ QT_USE_NAMESPACE
    1129      while (!modalEnded) {
    1130  #ifndef QT_NO_EXCEPTIONS
    1131          @try {
    1132 -            [NSApp runModalForWindow:mColorPanel];
    1133 +            [[NSApplication sharedApplication] runModalForWindow:mColorPanel];
    1134              modalEnded = true;
    1135          } @catch (NSException *) {
    1136              // For some reason, NSColorPanel throws an exception when
    1137 @@ -358,7 +358,7 @@ QT_USE_NAMESPACE
    1138              // palette (tab three).
    1139          }
    1140  #else
    1141 -        [NSApp runModalForWindow:mColorPanel];
    1142 +        [[NSApplication sharedApplication] runModalForWindow:mColorPanel];
    1143          modalEnded = true;
    1144  #endif
    1145      }
    1146 @@ -469,10 +469,10 @@ void QColorDialogPrivate::mac_nativeDialogModalHelp()
    1147      // Do a queued meta-call to open the native modal dialog so it opens after the new
    1148      // event loop has started to execute (in QDialog::exec). Using a timer rather than
    1149      // a queued meta call is intentional to ensure that the call is only delivered when
    1150 -    // [NSApp run] runs (timers are handeled special in cocoa). If NSApp is not
    1151 +    // [NSApplication run] runs (timers are handeled special in cocoa). If NSApplication is not
    1152      // running (which is the case if e.g a top-most QEventLoop has been
    1153      // interrupted, and the second-most event loop has not yet been reactivated (regardless
    1154 -    // if [NSApp run] is still on the stack)), showing a native modal dialog will fail.
    1155 +    // if [NSApplication run] is still on the stack)), showing a native modal dialog will fail.
    1156      if (delegate){
    1157          Q_Q(QColorDialog);
    1158          QTimer::singleShot(1, q, SLOT(_q_macRunNativeAppModalPanel()));
    1159 --- src/gui/dialogs/qfiledialog_mac.mm.orig
    1160 +++ src/gui/dialogs/qfiledialog_mac.mm
    1161 @@ -229,7 +229,7 @@ QT_USE_NAMESPACE
    1162      if ([mSavePanel respondsToSelector:@selector(close)])
    1163          [mSavePanel close];
    1164      if ([mSavePanel isSheet])
    1165 -        [NSApp endSheet: mSavePanel];
    1166 +        [[NSApplication sharedApplication] endSheet: mSavePanel];
    1167  }
    1168  
    1169  - (void)showModelessPanel
    1170 @@ -1162,10 +1162,10 @@ void QFileDialogPrivate::mac_nativeDialogModalHelp()
    1171      // Do a queued meta-call to open the native modal dialog so it opens after the new
    1172      // event loop has started to execute (in QDialog::exec). Using a timer rather than
    1173      // a queued meta call is intentional to ensure that the call is only delivered when
    1174 -    // [NSApp run] runs (timers are handeled special in cocoa). If NSApp is not
    1175 +    // [NSApplication run] runs (timers are handeled special in cocoa). If NSApplication is not
    1176      // running (which is the case if e.g a top-most QEventLoop has been
    1177      // interrupted, and the second-most event loop has not yet been reactivated (regardless
    1178 -    // if [NSApp run] is still on the stack)), showing a native modal dialog will fail.
    1179 +    // if [NSApplication run] is still on the stack)), showing a native modal dialog will fail.
    1180      if (nativeDialogInUse){
    1181          Q_Q(QFileDialog);
    1182          QTimer::singleShot(1, q, SLOT(_q_macRunNativeAppModalPanel()));
    1183 --- src/gui/dialogs/qfontdialog_mac.mm.orig
    1184 +++ src/gui/dialogs/qfontdialog_mac.mm
    1185 @@ -230,7 +230,7 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
    1186      mAppModal = true;
    1187      NSWindow *ourPanel = [mStolenContentView window];
    1188      [ourPanel setReleasedWhenClosed:NO];
    1189 -    [NSApp runModalForWindow:ourPanel];
    1190 +    [[NSApplication sharedApplication] runModalForWindow:ourPanel];
    1191      QAbstractEventDispatcher::instance()->interrupt();
    1192  
    1193      if (mReturnCode == NSOKButton)
    1194 @@ -256,7 +256,7 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
    1195  
    1196      mAppModal = false;
    1197      NSWindow *ourPanel = [mStolenContentView window];
    1198 -    [NSApp beginSheet:ourPanel
    1199 +    [[NSApplication sharedApplication] beginSheet:ourPanel
    1200          modalForWindow:window
    1201          modalDelegate:0
    1202          didEndSelector:0
    1203 @@ -456,7 +456,7 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
    1204  
    1205      if (mAppModal) {
    1206          mReturnCode = code;
    1207 -        [NSApp stopModalWithCode:code];
    1208 +        [[NSApplication sharedApplication] stopModalWithCode:code];
    1209      } else {
    1210          if (code == NSOKButton)
    1211              mPriv->fontDialog()->accept();
    1212 @@ -636,10 +636,10 @@ void QFontDialogPrivate::mac_nativeDialogModalHelp()
    1213      // Do a queued meta-call to open the native modal dialog so it opens after the new
    1214      // event loop has started to execute (in QDialog::exec). Using a timer rather than
    1215      // a queued meta call is intentional to ensure that the call is only delivered when
    1216 -    // [NSApp run] runs (timers are handeled special in cocoa). If NSApp is not
    1217 +    // [NSApplication run] runs (timers are handeled special in cocoa). If NSApplication is not
    1218      // running (which is the case if e.g a top-most QEventLoop has been
    1219      // interrupted, and the second-most event loop has not yet been reactivated (regardless
    1220 -    // if [NSApp run] is still on the stack)), showing a native modal dialog will fail.
    1221 +    // if [NSApplication run] is still on the stack)), showing a native modal dialog will fail.
    1222      if (nativeDialogInUse) {
    1223          Q_Q(QFontDialog);
    1224          QTimer::singleShot(1, q, SLOT(_q_macRunNativeAppModalPanel()));
    1225 --- src/gui/kernel/qapplication_mac.mm.orig
    1226 +++ src/gui/kernel/qapplication_mac.mm
    1227 @@ -468,7 +468,7 @@ void qt_mac_set_app_icon(const QPixmap &pixmap)
    1228          image = static_cast<NSImage *>(qt_mac_create_nsimage(pixmap));
    1229      }
    1230  
    1231 -    [NSApp setApplicationIconImage:image];
    1232 +    [[NSApplication sharedApplication] setApplicationIconImage:image];
    1233      [image release];
    1234  #endif
    1235  }
    1236 @@ -750,7 +750,7 @@ void qt_event_request_showsheet(QWidget *w)
    1237      Q_ASSERT(qt_mac_is_macsheet(w));
    1238  #ifdef QT_MAC_USE_COCOA
    1239      w->repaint();
    1240 -    [NSApp beginSheet:qt_mac_window_for(w) modalForWindow:qt_mac_window_for(w->parentWidget())
    1241 +    [[NSApplication sharedApplication] beginSheet:qt_mac_window_for(w) modalForWindow:qt_mac_window_for(w->parentWidget())
    1242          modalDelegate:nil didEndSelector:nil contextInfo:0];
    1243  #else
    1244      qt_mac_event_remove(request_showsheet_pending);
    1245 @@ -992,7 +992,7 @@ Q_GUI_EXPORT void qt_mac_set_dock_menu(QMenu *menu)
    1246  {
    1247      qt_mac_dock_menu = menu;
    1248  #ifdef QT_MAC_USE_COCOA
    1249 -    [NSApp setDockMenu:menu->macMenu()];
    1250 +    [[NSApplication sharedApplication] setDockMenu:menu->macMenu()];
    1251  #else
    1252      SetApplicationDockTileMenu(menu->macMenu());
    1253  #endif
    1254 @@ -1011,7 +1011,7 @@ void qt_mac_event_release(QWidget *w)
    1255  #ifndef QT_MAC_USE_COCOA
    1256              SetApplicationDockTileMenu(0);
    1257  #else
    1258 -            [NSApp setDockMenu:0];
    1259 +            [[NSApplication sharedApplication] setDockMenu:0];
    1260  #endif
    1261          }
    1262      }
    1263 @@ -1463,7 +1463,7 @@ QWidget *QApplication::topLevelAt(const QPoint &p)
    1264      NSWindowList(windowCount, windowList.data());
    1265      int firstQtWindowFound = -1;
    1266      for (int i = 0; i < windowCount; ++i) {
    1267 -        NSWindow *window = [NSApp windowWithWindowNumber:windowList[i]];
    1268 +        NSWindow *window = [[NSApplication sharedApplication] windowWithWindowNumber:windowList[i]];
    1269          if (window) {
    1270              QWidget *candidateWindow = [window QT_MANGLE_NAMESPACE(qt_qwidget)];
    1271              if (candidateWindow && firstQtWindowFound == -1)
    1272 @@ -3071,7 +3071,7 @@ bool QApplicationPrivate::canQuit()
    1273  #else
    1274      Q_Q(QApplication);
    1275  #ifdef QT_MAC_USE_COCOA
    1276 -    [[NSApp mainMenu] cancelTracking];
    1277 +    [[[NSApplication sharedApplication] mainMenu] cancelTracking];
    1278  #else
    1279      HiliteMenu(0);
    1280  #endif
    1281 @@ -3146,7 +3146,7 @@ void onApplicationChangedActivation( bool activated )
    1282          }
    1283  
    1284          if (!app->activeWindow()) {
    1285 -            OSWindowRef wp = [NSApp keyWindow];
    1286 +            OSWindowRef wp = [[NSApplication sharedApplication] keyWindow];
    1287              if (QWidget *tmp_w = qt_mac_find_window(wp))
    1288                  app->setActiveWindow(tmp_w);
    1289          }
    1290 --- src/gui/kernel/qcocoaapplication_mac.mm.orig
    1291 +++ src/gui/kernel/qcocoaapplication_mac.mm
    1292 @@ -147,7 +147,7 @@ QT_USE_NAMESPACE
    1293      if ([event type] == NSApplicationDefined) {
    1294          switch ([event subtype]) {
    1295              case QtCocoaEventSubTypePostMessage:
    1296 -                [NSApp QT_MANGLE_NAMESPACE(qt_sendPostedMessage):event];
    1297 +                [[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_sendPostedMessage):event];
    1298                  return true;
    1299              default:
    1300                  break;
    1301 @@ -174,7 +174,7 @@ QT_USE_NAMESPACE
    1302      // be called instead of sendEvent if redirection occurs.
    1303      // 'self' will then be an instance of NSApplication
    1304      // (and not QNSApplication)
    1305 -    if (![NSApp QT_MANGLE_NAMESPACE(qt_filterEvent):event])
    1306 +    if (![[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_filterEvent):event])
    1307          [self QT_MANGLE_NAMESPACE(qt_sendEvent_original):event];
    1308  }
    1309  
    1310 @@ -182,7 +182,7 @@ QT_USE_NAMESPACE
    1311  {
    1312      // This method will be called if
    1313      // no redirection occurs
    1314 -    if (![NSApp QT_MANGLE_NAMESPACE(qt_filterEvent):event])
    1315 +    if (![[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_filterEvent):event])
    1316          [super sendEvent:event];
    1317  }
    1318  
    1319 @@ -194,7 +194,7 @@ QT_USE_NAMESPACE
    1320      // visible on screen. Note: If Qt is used as a plugin, Qt will not use a
    1321      // native menu bar. Hence, we will also not need to do any redirection etc. as
    1322      // we do with sendEvent.
    1323 -    [[NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender];
    1324 +    [[[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender];
    1325  }
    1326  
    1327  @end
    1328 @@ -203,7 +203,7 @@ QT_BEGIN_NAMESPACE
    1329  
    1330  void qt_redirectNSApplicationSendEvent()
    1331  {
    1332 -    if ([NSApp isMemberOfClass:[QT_MANGLE_NAMESPACE(QNSApplication) class]]) {
    1333 +    if ([[NSApplication sharedApplication] isMemberOfClass:[QT_MANGLE_NAMESPACE(QNSApplication) class]]) {
    1334          // No need to change implementation since Qt
    1335          // already controls a subclass of NSApplication
    1336          return;
    1337 --- src/gui/kernel/qcocoaapplicationdelegate_mac.mm.orig
    1338 +++ src/gui/kernel/qcocoaapplicationdelegate_mac.mm
    1339 @@ -122,7 +122,7 @@ static void cleanupCocoaApplicationDelegate()
    1340      [dockMenu release];
    1341      [qtMenuLoader release];
    1342      if (reflectionDelegate) {
    1343 -        [NSApp setDelegate:reflectionDelegate];
    1344 +        [[NSApplication sharedApplication] setDelegate:reflectionDelegate];
    1345          [reflectionDelegate release];
    1346      }
    1347      [super dealloc];
    1348 @@ -183,7 +183,7 @@ static void cleanupCocoaApplicationDelegate()
    1349      return [[qtMenuLoader retain] autorelease];
    1350  }
    1351  
    1352 -// This function will only be called when NSApp is actually running. Before
    1353 +// This function will only be called when NSApplication is actually running. Before
    1354  // that, the kAEQuitApplication Apple event will be sent to
    1355  // QApplicationPrivate::globalAppleEventProcessor in qapplication_mac.mm
    1356  - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
    1357 @@ -249,7 +249,7 @@ static void cleanupCocoaApplicationDelegate()
    1358          && [reflectionDelegate respondsToSelector:
    1359                              @selector(applicationShouldTerminateAfterLastWindowClosed:)])
    1360          return [reflectionDelegate applicationShouldTerminateAfterLastWindowClosed:sender];
    1361 -    return NO; // Someday qApp->quitOnLastWindowClosed(); when QApp and NSApp work closer together.
    1362 +    return NO; // Someday qApp->quitOnLastWindowClosed(); when qApp and NSApplication work closer together.
    1363  }
    1364  
    1365  
    1366 @@ -289,13 +289,26 @@ static void cleanupCocoaApplicationDelegate()
    1367      qt_button_down = 0;
    1368  }
    1369  
    1370 +- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag
    1371 +{
    1372 +    Q_UNUSED(theApplication);
    1373 +    Q_UNUSED(flag);
    1374 +    // The reflection delegate gets precedence
    1375 +    if (reflectionDelegate
    1376 +        && [reflectionDelegate respondsToSelector:@selector(applicationShouldHandleReopen:hasVisibleWindows:)])
    1377 +        return [reflectionDelegate applicationShouldHandleReopen:theApplication hasVisibleWindows:flag];
    1378 +
    1379 +    onApplicationChangedActivation(true);
    1380 +    return NO;
    1381 +}
    1382 +
    1383  - (void)applicationDidChangeScreenParameters:(NSNotification *)notification
    1384  {
    1385      Q_UNUSED(notification);
    1386      QDesktopWidgetImplementation::instance()->onResize();
    1387  }
    1388  
    1389 -- (void)setReflectionDelegate:(NSObject <NSApplicationDelegate> *)oldDelegate
    1390 +- (void)setReflectionDelegate:(id <NSApplicationDelegate>)oldDelegate
    1391  {
    1392      [oldDelegate retain];
    1393      [reflectionDelegate release];
    1394 @@ -342,12 +355,12 @@ static void cleanupCocoaApplicationDelegate()
    1395  {
    1396      Q_UNUSED(event);
    1397      Q_UNUSED(replyEvent);
    1398 -    [NSApp terminate:self];
    1399 +    [[NSApplication sharedApplication] terminate:self];
    1400  }
    1401  
    1402  - (void)qtDispatcherToQAction:(id)sender
    1403  {
    1404 -    [[NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender];
    1405 +    [[[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender];
    1406  }
    1407  
    1408  @end
    1409 --- src/gui/kernel/qcocoaapplicationdelegate_mac_p.h.orig
    1410 +++ src/gui/kernel/qcocoaapplicationdelegate_mac_p.h
    1411 @@ -113,7 +113,7 @@ QT_FORWARD_DECLARE_CLASS(QApplicationPrivate);
    1412      QApplicationPrivate *qtPrivate;
    1413      NSMenu *dockMenu;
    1414      QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader;
    1415 -    NSObject <NSApplicationDelegate> *reflectionDelegate;
    1416 +    id <NSApplicationDelegate> reflectionDelegate;
    1417      bool inLaunch;
    1418  }
    1419  + (QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate)*)sharedDelegate;
    1420 @@ -122,7 +122,7 @@ QT_FORWARD_DECLARE_CLASS(QApplicationPrivate);
    1421  - (QApplicationPrivate *)qAppPrivate;
    1422  - (void)setMenuLoader:(QT_MANGLE_NAMESPACE(QCocoaMenuLoader)*)menuLoader;
    1423  - (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)menuLoader;
    1424 -- (void)setReflectionDelegate:(NSObject <NSApplicationDelegate> *)oldDelegate;
    1425 +- (void)setReflectionDelegate:(id <NSApplicationDelegate>)oldDelegate;
    1426  - (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent;
    1427  @end
    1428  #endif
    1429 --- src/gui/kernel/qcocoamenuloader_mac.mm.orig
    1430 +++ src/gui/kernel/qcocoamenuloader_mac.mm
    1431 @@ -92,8 +92,8 @@ QT_USE_NAMESPACE
    1432      // 'Quit' item. When changing menu bar (e.g when switching between
    1433      // windows with different menu bars), we never recreate this menu, but
    1434      // instead pull it out the current menu bar and place into the new one:
    1435 -    NSMenu *mainMenu = [NSApp mainMenu];
    1436 -    if ([NSApp mainMenu] == menu)
    1437 +    NSMenu *mainMenu = [[NSApplication sharedApplication] mainMenu];
    1438 +    if ([[NSApplication sharedApplication] mainMenu] == menu)
    1439          return; // nothing to do (menu is the current menu bar)!
    1440  
    1441  #ifndef QT_NAMESPACE
    1442 @@ -201,27 +201,27 @@ QT_USE_NAMESPACE
    1443  
    1444  - (void)terminate:(id)sender
    1445  {
    1446 -    [NSApp terminate:sender];
    1447 +    [[NSApplication sharedApplication] terminate:sender];
    1448  }
    1449  
    1450  - (void)orderFrontStandardAboutPanel:(id)sender
    1451  {
    1452 -    [NSApp orderFrontStandardAboutPanel:sender];
    1453 +    [[NSApplication sharedApplication] orderFrontStandardAboutPanel:sender];
    1454  }
    1455  
    1456  - (void)hideOtherApplications:(id)sender
    1457  {
    1458 -    [NSApp hideOtherApplications:sender];
    1459 +    [[NSApplication sharedApplication] hideOtherApplications:sender];
    1460  }
    1461  
    1462  - (void)unhideAllApplications:(id)sender
    1463  {
    1464 -    [NSApp unhideAllApplications:sender];
    1465 +    [[NSApplication sharedApplication] unhideAllApplications:sender];
    1466  }
    1467  
    1468  - (void)hide:(id)sender
    1469  {
    1470 -    [NSApp hide:sender];
    1471 +    [[NSApplication sharedApplication] hide:sender];
    1472  }
    1473  
    1474  - (void)qtUpdateMenubar
    1475 @@ -258,7 +258,7 @@ QT_USE_NAMESPACE
    1476  
    1477   - (void)orderFrontCharacterPalette:(id)sender
    1478   {
    1479 -     [NSApp orderFrontCharacterPalette:sender];
    1480 +     [[NSApplication sharedApplication] orderFrontCharacterPalette:sender];
    1481   }
    1482  
    1483  - (BOOL)validateMenuItem:(NSMenuItem*)menuItem
    1484 @@ -266,7 +266,7 @@ QT_USE_NAMESPACE
    1485      if ([menuItem action] == @selector(hide:)
    1486          || [menuItem action] == @selector(hideOtherApplications:)
    1487          || [menuItem action] == @selector(unhideAllApplications:)) {
    1488 -        return [NSApp validateMenuItem:menuItem];
    1489 +        return [[NSApplication sharedApplication] validateMenuItem:menuItem];
    1490      } else {
    1491          return [menuItem isEnabled];
    1492      }
    1493 --- src/gui/kernel/qcocoasharedwindowmethods_mac_p.h.orig
    1494 +++ src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
    1495 @@ -143,7 +143,7 @@ QT_END_NAMESPACE
    1496  {
    1497      // This function is called from the quit item in the menubar when this window
    1498      // is in the first responder chain (see also qtDispatcherToQAction above)
    1499 -    [NSApp terminate:sender];
    1500 +    [[NSApplication sharedApplication] terminate:sender];
    1501  }
    1502  
    1503  - (void)setLevel:(NSInteger)windowLevel
    1504 @@ -364,7 +364,7 @@ QT_END_NAMESPACE
    1505  
    1506      if ([sender draggingSource] != nil) {
    1507          // modifier flags might have changed, update it here since we don't send any input events.
    1508 -        QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[NSApp currentEvent] modifierFlags]);
    1509 +        QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[[NSApplication sharedApplication] currentEvent] modifierFlags]);
    1510          modifiers = QApplication::keyboardModifiers();
    1511      } else {
    1512          // when the source is from another application the above technique will not work.
    1513 @@ -456,7 +456,7 @@ QT_END_NAMESPACE
    1514  
    1515      // Update modifiers:
    1516      if ([sender draggingSource] != nil) {
    1517 -        QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[NSApp currentEvent] modifierFlags]);
    1518 +        QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[[NSApplication sharedApplication] currentEvent] modifierFlags]);
    1519          modifiers = QApplication::keyboardModifiers();
    1520      } else {
    1521          modifiers = qt_cocoaDragOperation2QtModifiers(nsActions);
    1522 --- src/gui/kernel/qeventdispatcher_mac.mm.orig
    1523 +++ src/gui/kernel/qeventdispatcher_mac.mm
    1524 @@ -461,7 +461,7 @@ static bool qt_mac_send_event(QEventLoop::ProcessEventsFlags, OSEventRef event,
    1525      if (pt)
    1526          [pt sendEvent:event];
    1527      else
    1528 -        [NSApp sendEvent:event];
    1529 +        [[NSApplication sharedApplication] sendEvent:event];
    1530      return true;
    1531  #endif
    1532  }
    1533 @@ -521,12 +521,12 @@ static inline void qt_mac_waitForMoreEvents()
    1534      // (and free up cpu time) until at least one event occur.
    1535      // This implementation is a bit on the edge, but seems to
    1536      // work fine:
    1537 -    NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
    1538 +    NSEvent* event = [[NSApplication sharedApplication] nextEventMatchingMask:NSAnyEventMask
    1539          untilDate:[NSDate distantFuture]
    1540          inMode:NSDefaultRunLoopMode
    1541          dequeue:YES];
    1542      if (event)
    1543 -        [NSApp postEvent:event atStart:YES];
    1544 +        [[NSApplication sharedApplication] postEvent:event atStart:YES];
    1545  #endif
    1546  }
    1547  
    1548 @@ -537,12 +537,12 @@ static inline void qt_mac_waitForMoreModalSessionEvents()
    1549      // (and free up cpu time) until at least one event occur.
    1550      // This implementation is a bit on the edge, but seems to
    1551      // work fine:
    1552 -    NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
    1553 +    NSEvent* event = [[NSApplication sharedApplication] nextEventMatchingMask:NSAnyEventMask
    1554          untilDate:[NSDate distantFuture]
    1555          inMode:NSModalPanelRunLoopMode
    1556          dequeue:YES];
    1557      if (event)
    1558 -        [NSApp postEvent:event atStart:YES];
    1559 +        [[NSApplication sharedApplication] postEvent:event atStart:YES];
    1560  }
    1561  #endif
    1562  
    1563 @@ -588,23 +588,23 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags)
    1564          // done from the application itself. And if processEvents is called
    1565          // manually (rather than from a QEventLoop), we cannot enter a tight
    1566          // loop and block this call, but instead we need to return after one flush.
    1567 -        // Finally, if we are to exclude user input events, we cannot call [NSApp run]
    1568 +        // Finally, if we are to exclude user input events, we cannot call [NSApplication run]
    1569          // as we then loose control over which events gets dispatched:
    1570 -        const bool canExec_3rdParty = d->nsAppRunCalledByQt || ![NSApp isRunning];
    1571 +        const bool canExec_3rdParty = d->nsAppRunCalledByQt || ![[NSApplication sharedApplication] isRunning];
    1572          const bool canExec_Qt = !excludeUserEvents &&
    1573                  (flags & QEventLoop::DialogExec || flags & QEventLoop::EventLoopExec) ;
    1574  
    1575          if (canExec_Qt && canExec_3rdParty) {
    1576              // We can use exec-mode, meaning that we can stay in a tight loop until
    1577              // interrupted. This is mostly an optimization, but it allow us to use
    1578 -            // [NSApp run], which is the normal code path for cocoa applications.
    1579 +            // [NSApplication run], which is the normal code path for cocoa applications.
    1580              if (NSModalSession session = d->currentModalSession()) {
    1581                  QBoolBlocker execGuard(d->currentExecIsNSAppRun, false);
    1582 -                while ([NSApp runModalSession:session] == NSRunContinuesResponse && !d->interrupt)
    1583 +                while ([[NSApplication sharedApplication] runModalSession:session] == NSRunContinuesResponse && !d->interrupt)
    1584                      qt_mac_waitForMoreModalSessionEvents();
    1585  
    1586                  if (!d->interrupt && session == d->currentModalSessionCached) {
    1587 -                    // Someone called [NSApp stopModal:] from outside the event
    1588 +                    // Someone called [[NSApplication sharedApplication] stopModal:] from outside the event
    1589                      // dispatcher (e.g to stop a native dialog). But that call wrongly stopped
    1590                      // 'session' as well. As a result, we need to restart all internal sessions:
    1591                      d->temporarilyStopAllModalSessions();
    1592 @@ -612,7 +612,7 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags)
    1593              } else {
    1594                  d->nsAppRunCalledByQt = true;
    1595                  QBoolBlocker execGuard(d->currentExecIsNSAppRun, true);
    1596 -                [NSApp run];
    1597 +                [[NSApplication sharedApplication] run];
    1598              }
    1599              retVal = true;
    1600          } else {
    1601 @@ -626,9 +626,9 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags)
    1602                      // to use cocoa's native way of running modal sessions:
    1603                      if (flags & QEventLoop::WaitForMoreEvents)
    1604                          qt_mac_waitForMoreModalSessionEvents();
    1605 -                    NSInteger status = [NSApp runModalSession:session];
    1606 +                    NSInteger status = [[NSApplication sharedApplication] runModalSession:session];
    1607                      if (status != NSRunContinuesResponse && session == d->currentModalSessionCached) {
    1608 -                        // INVARIANT: Someone called [NSApp stopModal:] from outside the event
    1609 +                        // INVARIANT: Someone called [NSApplication stopModal:] from outside the event
    1610                          // dispatcher (e.g to stop a native dialog). But that call wrongly stopped
    1611                          // 'session' as well. As a result, we need to restart all internal sessions:
    1612                          d->temporarilyStopAllModalSessions();
    1613 @@ -637,8 +637,8 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags)
    1614                  } else do {
    1615                      // Dispatch all non-user events (but que non-user events up for later). In
    1616                      // this case, we need more control over which events gets dispatched, and
    1617 -                    // cannot use [NSApp runModalSession:session]:
    1618 -                    event = [NSApp nextEventMatchingMask:NSAnyEventMask
    1619 +                    // cannot use [NSApplication runModalSession:session]:
    1620 +                    event = [[NSApplication sharedApplication] nextEventMatchingMask:NSAnyEventMask
    1621                      untilDate:nil
    1622                      inMode:NSModalPanelRunLoopMode
    1623                      dequeue: YES];
    1624 @@ -655,7 +655,7 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags)
    1625                  } while (!d->interrupt && event != nil);
    1626              } else do {
    1627                  // INVARIANT: No modal window is executing.
    1628 -                event = [NSApp nextEventMatchingMask:NSAnyEventMask
    1629 +                event = [[NSApplication sharedApplication] nextEventMatchingMask:NSAnyEventMask
    1630                  untilDate:nil
    1631                  inMode:NSDefaultRunLoopMode
    1632                  dequeue: YES];
    1633 @@ -798,12 +798,12 @@ void QEventDispatcherMacPrivate::ensureNSAppInitialized()
    1634      // we let Cocoa finish the initialization it seems to need. We'll only
    1635      // apply this trick at most once for any application, and we avoid doing it
    1636      // for the common case where main just starts QApplication::exec.
    1637 -    if (nsAppRunCalledByQt || [NSApp isRunning])
    1638 +    if (nsAppRunCalledByQt || [[NSApplication sharedApplication] isRunning])
    1639          return;
    1640      nsAppRunCalledByQt = true;
    1641      QBoolBlocker block1(interrupt, true);
    1642      QBoolBlocker block2(currentExecIsNSAppRun, true);
    1643 -    [NSApp run];
    1644 +    [[NSApplication sharedApplication] run];
    1645  }
    1646  
    1647  void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions()
    1648 @@ -812,8 +812,8 @@ void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions()
    1649      // such, make them pending again. The next call to
    1650      // currentModalSession will recreate them again. The
    1651      // reason to stop all session like this is that otherwise
    1652 -    // a call [NSApp stop] would not stop NSApp, but rather
    1653 -    // the current modal session. So if we need to stop NSApp
    1654 +    // a call [NSApplication stop] would not stop NSApplication, but rather
    1655 +    // the current modal session. So if we need to stop NSApplication
    1656      // we need to stop all the modal session first. To avoid changing
    1657      // the stacking order of the windows while doing so, we put
    1658      // up a block that is used in QCocoaWindow and QCocoaPanel:
    1659 @@ -821,7 +821,7 @@ void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions()
    1660      for (int i=0; i<stackSize; ++i) {
    1661          QCocoaModalSessionInfo &info = cocoaModalSessionStack[i];
    1662          if (info.session) {
    1663 -            [NSApp endModalSession:info.session];
    1664 +            [[NSApplication sharedApplication] endModalSession:info.session];
    1665              info.session = 0;
    1666          }
    1667      }
    1668 @@ -856,7 +856,7 @@ NSModalSession QEventDispatcherMacPrivate::currentModalSession()
    1669              info.nswindow = window;
    1670              [(NSWindow*) info.nswindow retain];
    1671              int levelBeforeEnterModal = [window level];
    1672 -            info.session = [NSApp beginModalSessionForWindow:window];
    1673 +            info.session = [[NSApplication sharedApplication] beginModalSessionForWindow:window];
    1674              // Make sure we don't stack the window lower that it was before
    1675              // entering modal, in case it e.g. had the stays-on-top flag set:
    1676              if (levelBeforeEnterModal > [window level])
    1677 @@ -926,7 +926,7 @@ void QEventDispatcherMacPrivate::cleanupModalSessions()
    1678          cocoaModalSessionStack.remove(i);
    1679          currentModalSessionCached = 0;
    1680          if (info.session) {
    1681 -            [NSApp endModalSession:info.session];
    1682 +            [[NSApplication sharedApplication] endModalSession:info.session];
    1683              [(NSWindow *)info.nswindow release];
    1684          }
    1685      }
    1686 @@ -1057,7 +1057,7 @@ inline static void processPostedEvents(QEventDispatcherMacPrivate *const d, cons
    1687              // pending cocoa events first).
    1688              if (d->currentModalSessionCached)
    1689                  d->temporarilyStopAllModalSessions();
    1690 -            [NSApp stop:NSApp];
    1691 +            [[NSApplication sharedApplication] stop:[NSApplication sharedApplication]];
    1692              d->cancelWaitForMoreEvents();
    1693          }
    1694  #endif
    1695 @@ -1093,7 +1093,8 @@ void QEventDispatcherMacPrivate::cancelWaitForMoreEvents()
    1696      // In case the event dispatcher is waiting for more
    1697      // events somewhere, we post a dummy event to wake it up:
    1698      QMacCocoaAutoReleasePool pool;
    1699 -    [NSApp postEvent:[NSEvent otherEventWithType:NSApplicationDefined location:NSZeroPoint
    1700 +    [[NSApplication sharedApplication] postEvent:[NSEvent otherEventWithType:NSApplicationDefined
    1701 +        location:NSZeroPoint
    1702          modifierFlags:0 timestamp:0. windowNumber:0 context:0
    1703          subtype:QtCocoaEventSubTypeWakeup data1:0 data2:0] atStart:NO];
    1704  }
    1705 @@ -1110,7 +1111,7 @@ void QEventDispatcherMac::interrupt()
    1706  #else
    1707      // We do nothing more here than setting d->interrupt = true, and
    1708      // poke the event loop if it is sleeping. Actually stopping
    1709 -    // NSApp, or the current modal session, is done inside the send
    1710 +    // NSApplication, or the current modal session, is done inside the send
    1711      // posted events callback. We do this to ensure that all current pending
    1712      // cocoa events gets delivered before we stop. Otherwise, if we now stop
    1713      // the last event loop recursion, cocoa will just drop pending posted
    1714 @@ -1165,7 +1166,7 @@ QtMacInterruptDispatcherHelp::QtMacInterruptDispatcherHelp() : cancelled(false)
    1715      // The whole point of this class is that we enable a way to interrupt
    1716      // the event dispatcher when returning back to a lower recursion level
    1717      // than where interruptLater was called. This is needed to detect if
    1718 -    // [NSApp run] should still be running at the recursion level it is at.
    1719 +    // [NSApplication run] should still be running at the recursion level it is at.
    1720      // Since the interrupt is canceled if processEvents is called before
    1721      // this object gets deleted, we also avoid interrupting unnecessary.
    1722      deleteLater();
    1723 --- src/gui/kernel/qt_cocoa_helpers_mac.mm.orig
    1724 +++ src/gui/kernel/qt_cocoa_helpers_mac.mm
    1725 @@ -1697,7 +1697,7 @@ void qt_cocoaPostMessage(id target, SEL selector, int argCount, id arg1, id arg2
    1726      NSEvent *e = [NSEvent otherEventWithType:NSApplicationDefined
    1727          location:NSZeroPoint modifierFlags:0 timestamp:0 windowNumber:0
    1728          context:nil subtype:QtCocoaEventSubTypePostMessage data1:lower data2:upper];
    1729 -    [NSApp postEvent:e atStart:NO];
    1730 +    [[NSApplication sharedApplication] postEvent:e atStart:NO];
    1731  }
    1732  
    1733  void qt_cocoaPostMessageAfterEventLoopExit(id target, SEL selector, int argCount, id arg1, id arg2)
    1734 @@ -1727,7 +1727,7 @@ void qt_mac_post_retranslateAppMenu()
    1735  {
    1736  #ifdef QT_MAC_USE_COCOA
    1737      QMacCocoaAutoReleasePool pool;
    1738 -    qt_cocoaPostMessage([NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)], @selector(qtTranslateApplicationMenu));
    1739 +    qt_cocoaPostMessage([[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)], @selector(qtTranslateApplicationMenu));
    1740  #endif
    1741  }
    1742  
    1743 --- src/gui/kernel/qt_mac_p.h.orig
    1744 +++ src/gui/kernel/qt_mac_p.h
    1745 @@ -75,6 +75,62 @@
    1746  
    1747  #include <Carbon/Carbon.h>
    1748  
    1749 +#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
    1750 +    // Some deprecated functions have been removed from the the 10.7 SDK, but the symbols are
    1751 +    // still exported by the 32-bit QD.framework (a subframework of ApplicationServices).
    1752 +    extern "C" {
    1753 +        // from QuickdrawAPI.h
    1754 +        // https://developer.apple.com/legacy/library/documentation/Carbon/reference/QuickDraw_Ref/QuickDraw_Ref.pdf
    1755 +        void          CopyBits(const BitMap *srcBits, const BitMap *dstBits, const Rect *srcRect, const Rect *dstRect, short mode, RgnHandle maskRgn);
    1756 +        void          CopyRgn(RgnHandle srcRgn, RgnHandle dstRgn);
    1757 +        void          DisposeRgn(RgnHandle rgn);
    1758 +        GDHandle      GetMainDevice(void);
    1759 +        const BitMap *GetPortBitMapForCopyBits(CGrafPtr port);
    1760 +        Rect         *GetRegionBounds(RgnHandle region, Rect *bounds);
    1761 +        RgnHandle     NewRgn(void);
    1762 +        OSStatus      QDRegionToRects(RgnHandle rgn, QDRegionParseDirection dir, RegionToRectsUPP proc, void *userData);
    1763 +        void          SetEmptyRgn(RgnHandle rgn);
    1764 +        void          SetRect(Rect* r, short left, short top, short right, short bottom);
    1765 +        void          SetRectRgn(RgnHandle rgn, short left, short top, short right, short bottom);
    1766 +        void          UnionRgn(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn);
    1767 +        enum {
    1768 +            kQDRegionToRectsMsgInit       = 1,
    1769 +            kQDRegionToRectsMsgParse      = 2,
    1770 +            kQDRegionToRectsMsgTerminate  = 3
    1771 +        };
    1772 +        enum {
    1773 +            kQDParseRegionFromTop         = (1 << 0),
    1774 +            kQDParseRegionFromBottom      = (1 << 1),
    1775 +            kQDParseRegionFromLeft        = (1 << 2),
    1776 +            kQDParseRegionFromRight       = (1 << 3),
    1777 +            kQDParseRegionFromTopLeft     = kQDParseRegionFromTop | kQDParseRegionFromLeft,
    1778 +            kQDParseRegionFromBottomRight = kQDParseRegionFromBottom | kQDParseRegionFromRight
    1779 +        };
    1780 +
    1781 +        // from Fonts.h
    1782 +        // https://developer.apple.com/legacy/library/documentation/Carbon/reference/Font_Manager/fm_reference.pdf
    1783 +        OSStatus         FMCreateFontIterator(const FMFilter *iFilter, void *iRefCon, OptionBits iOptions, FMFontIterator *ioIterator);
    1784 +        OSStatus         FMDisposeFontIterator(FMFontIterator *ioIterator);
    1785 +        ATSFontFamilyRef FMGetATSFontFamilyRefFromFont(FMFontFamily iFamily);
    1786 +        ATSFontFamilyRef FMGetATSFontFamilyRefFromFontFamily(FMFontFamily iFamily);
    1787 +        ATSFontRef       FMGetATSFontRefFromFont(FMFont iFont);
    1788 +        OSStatus         FMGetFontFamilyInstanceFromFont(FMFont iFont, FMFontFamily *oFontFamily, FMFontStyle *oStyle);
    1789 +        FMFontFamily     FMGetFontFamilyFromATSFontFamilyRef(ATSFontFamilyRef iFamily);
    1790 +        FMFont           FMGetFontFromATSFontRef(ATSFontRef iFont);
    1791 +        OSStatus         FMGetFontFromFontFamilyInstance(FMFontFamily iFontFamily, FMFontStyle iStyle, FMFont *oFont, FMFontStyle *oIntrinsicStyle);
    1792 +        OSStatus         FMGetNextFont(FMFontIterator *ioIterator, FMFont *oFont);
    1793 +        enum {
    1794 +            kFMUseGlobalScopeOption       = 0x00000001
    1795 +        };
    1796 +        enum {
    1797 +            commandMark                   = 17,
    1798 +            checkMark                     = 18,
    1799 +            diamondMark                   = 19,
    1800 +            appleMark                     = 20
    1801 +        };
    1802 +    }
    1803 +#endif
    1804 +
    1805  QT_BEGIN_NAMESPACE
    1806  class QWidget;
    1807  class QDragMoveEvent;
    1808 --- src/gui/kernel/qwidget_mac.mm.orig
    1809 +++ src/gui/kernel/qwidget_mac.mm
    1810 @@ -220,7 +220,7 @@ static QSize qt_mac_desktopSize()
    1811  static NSDrawer *qt_mac_drawer_for(const QWidget *widget)
    1812  {
    1813      NSView *widgetView = reinterpret_cast<NSView *>(widget->window()->effectiveWinId());
    1814 -    NSArray *windows = [NSApp windows];
    1815 +    NSArray *windows = [[NSApplication sharedApplication] windows];
    1816      for (NSWindow *window in windows) {
    1817          NSArray *drawers = [window drawers];
    1818          for (NSDrawer *drawer in drawers) {
    1819 @@ -254,7 +254,7 @@ static void qt_mac_destructWindow(OSWindowRef window)
    1820  {
    1821  #ifdef QT_MAC_USE_COCOA
    1822      if ([window isVisible] && [window isSheet]){
    1823 -        [NSApp endSheet:window];
    1824 +        [[NSApplication sharedApplication] endSheet:window];
    1825          [window orderOut:window];
    1826      }
    1827  
    1828 @@ -2439,7 +2439,7 @@ void QWidgetPrivate::recreateMacWindow()
    1829      }
    1830      if ([oldWindow isVisible]){
    1831          if ([oldWindow isSheet])
    1832 -            [NSApp endSheet:oldWindow];
    1833 +            [[NSApplication sharedApplication] endSheet:oldWindow];
    1834          [oldWindow orderOut:oldWindow];
    1835          show_sys();
    1836      }
    1837 @@ -3554,7 +3554,7 @@ void QWidgetPrivate::show_sys()
    1838      }
    1839  
    1840  #ifdef QT_MAC_USE_COCOA
    1841 -    if ([NSApp isActive] && !qt_button_down && !QWidget::mouseGrabber()){
    1842 +    if ([[NSApplication sharedApplication] isActive] && !qt_button_down && !QWidget::mouseGrabber()){
    1843          // Update enter/leave immidiatly, don't wait for a move event. But only
    1844          // if no grab exists (even if the grab points to this widget, it seems, ref X11)
    1845          QPoint qlocal, qglobal;
    1846 @@ -3605,7 +3605,7 @@ void QWidgetPrivate::hide_sys()
    1847              else
    1848                  HideSheetWindow(window);
    1849  #else
    1850 -            [NSApp endSheet:window];
    1851 +            [[NSApplication sharedApplication] endSheet:window];
    1852              [window orderOut:window];
    1853  #endif
    1854          } else if(qt_mac_is_macdrawer(q)) {
    1855 @@ -3716,7 +3716,7 @@ void QWidgetPrivate::hide_sys()
    1856      }
    1857  
    1858  #ifdef QT_MAC_USE_COCOA
    1859 -    if ([NSApp isActive] && !qt_button_down && !QWidget::mouseGrabber()){
    1860 +    if ([[NSApplication sharedApplication] isActive] && !qt_button_down && !QWidget::mouseGrabber()){
    1861          // Update enter/leave immidiatly, don't wait for a move event. But only
    1862          // if no grab exists (even if the grab points to this widget, it seems, ref X11)
    1863          QPoint qlocal, qglobal;
    1864 --- src/gui/styles/qmacstyle_mac.mm.orig
    1865 +++ src/gui/styles/qmacstyle_mac.mm
    1866 @@ -780,7 +780,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
    1867              if (!GetThemeMenuBarHeight(&size))
    1868                  ret = QSize(-1, size);
    1869  #else
    1870 -            ret = QSize(-1, [[NSApp mainMenu] menuBarHeight]);
    1871 +            ret = QSize(-1, [[[NSApplication sharedApplication] mainMenu] menuBarHeight]);
    1872              // In the qt_mac_set_native_menubar(false) case,
    1873              // we come it here with a zero-height main menu,
    1874              // preventing the in-window menu from displaying.
    1875 @@ -3024,16 +3024,14 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
    1876                  fdi.version = qt_mac_hitheme_version;
    1877                  fdi.state = tds;
    1878                  SInt32 frame_size;
    1879 -                if (pe == PE_FrameLineEdit) {
    1880 -                    fdi.kind = kHIThemeFrameTextFieldSquare;
    1881 -                    GetThemeMetric(kThemeMetricEditTextFrameOutset, &frame_size);
    1882 -                    if ((frame->state & State_ReadOnly) || !(frame->state & State_Enabled))
    1883 -                        fdi.state = kThemeStateInactive;
    1884 -                } else {
    1885 -                    baseColor = QColor(150, 150, 150); //hardcoded since no query function --Sam
    1886 -                    fdi.kind = kHIThemeFrameListBox;
    1887 -                    GetThemeMetric(kThemeMetricListBoxFrameOutset, &frame_size);
    1888 -                }
    1889 +                fdi.kind = kHIThemeFrameTextFieldSquare;
    1890 +                GetThemeMetric(kThemeMetricEditTextFrameOutset, &frame_size);
    1891 +                if ((frame->state & State_ReadOnly) || !(frame->state & State_Enabled))
    1892 +                    fdi.state = kThemeStateInactive;
    1893 +                else if (fdi.state == kThemeStatePressed)
    1894 +                    // This pressed state doesn't make sense for a line edit frame.
    1895 +                    // And Yosemite agrees with us. Otherwise it starts showing yellow pixels.
    1896 +                    fdi.state = kThemeStateActive;
    1897                  fdi.isFocused = (frame->state & State_HasFocus);
    1898                  int lw = frame->lineWidth;
    1899                  if (lw <= 0)
    1900 --- src/gui/util/qsystemtrayicon_mac.mm.orig
    1901 +++ src/gui/util/qsystemtrayicon_mac.mm
    1902 @@ -536,7 +536,7 @@ private:
    1903  #ifndef QT_MAC_USE_COCOA
    1904                  const short scale = GetMBarHeight();
    1905  #else
    1906 -                const short scale = [[NSApp mainMenu] menuBarHeight];
    1907 +                const short scale = [[[NSApplication sharedApplication] mainMenu] menuBarHeight];
    1908  #endif
    1909                  NSImage *nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(icon.pixmap(QSize(scale, scale))));
    1910                  [item setImage: nsimage];
    1911 --- src/gui/widgets/qcocoamenu_mac.mm.orig
    1912 +++ src/gui/widgets/qcocoamenu_mac.mm
    1913 @@ -202,7 +202,7 @@ QT_USE_NAMESPACE
    1914       static SEL selForOFCP = NSSelectorFromString(@"orderFrontCharacterPalette:");
    1915       if (index == -1 && selForOFCP == actionSelector) {
    1916           // Check if the 'orderFrontCharacterPalette' SEL exists for QCocoaMenuLoader object
    1917 -         QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];
    1918 +         QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = [[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];
    1919           return [super indexOfItemWithTarget:loader andAction:actionSelector];
    1920       }
    1921       return index;
    1922 --- src/gui/widgets/qmenu_mac.mm.orig
    1923 +++ src/gui/widgets/qmenu_mac.mm
    1924 @@ -179,7 +179,7 @@ static void cancelAllMenuTracking()
    1925  {
    1926  #ifdef QT_MAC_USE_COCOA
    1927      QMacCocoaAutoReleasePool pool;
    1928 -    NSMenu *mainMenu = [NSApp mainMenu];
    1929 +    NSMenu *mainMenu = [[NSApplication sharedApplication] mainMenu];
    1930      [mainMenu cancelTracking];
    1931      for (NSMenuItem *item in [mainMenu itemArray]) {
    1932          if ([item submenu]) {
    1933 @@ -633,7 +633,7 @@ static inline void syncMenuBarItemsVisiblity(const QMenuBarPrivate::QMacMenuBarP
    1934  
    1935  static inline QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *getMenuLoader()
    1936  {
    1937 -    return [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];
    1938 +    return [[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];
    1939  }
    1940  
    1941  static NSMenuItem *createNSMenuItem(const QString &title)
    1942 @@ -2033,7 +2033,7 @@ void qt_mac_clear_menubar()
    1943      QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader();
    1944      NSMenu *menu = [loader menu];
    1945      [loader ensureAppMenuInMenu:menu];
    1946 -    [NSApp setMainMenu:menu];
    1947 +    [[NSApplication sharedApplication] setMainMenu:menu];
    1948      const bool modal = qt_mac_should_disable_menu(0);
    1949      if (qt_mac_current_menubar.qmenubar || modal != qt_mac_current_menubar.modal)
    1950          qt_mac_set_modal_state(menu, modal);
    1951 @@ -2100,7 +2100,7 @@ bool QMenuBarPrivate::macUpdateMenuBarImmediatly()
    1952  #else
    1953              QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader();
    1954              [loader ensureAppMenuInMenu:menu];
    1955 -            [NSApp setMainMenu:menu];
    1956 +            [[NSApplication sharedApplication] setMainMenu:menu];
    1957              syncMenuBarItemsVisiblity(mb->d_func()->mac_menubar);
    1958  
    1959              if (OSMenuRef tmpMerge = QMenuPrivate::mergeMenuHash.value(menu)) {
    1960 @@ -2140,7 +2140,7 @@ bool QMenuBarPrivate::macUpdateMenuBarImmediatly()
    1961  #else
    1962                  QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader();
    1963                  [loader ensureAppMenuInMenu:menu];
    1964 -                [NSApp setMainMenu:menu];
    1965 +                [[NSApplication sharedApplication] setMainMenu:menu];
    1966                  syncMenuBarItemsVisiblity(qt_mac_current_menubar.qmenubar->d_func()->mac_menubar);
    1967  #endif
    1968                  qt_mac_set_modal_state(menu, modal);
Note: See TracChangeset for help on using the changeset viewer.