Ticket #45421: patch-10.10.diff
File patch-10.10.diff, 45.9 KB (added by nneonneo (Robert Xiao), 10 years ago) |
---|
-
src/corelib/global/qglobal.cpp
old new bool qSharedBuild() 1185 1185 \value MV_10_7 OS X 10.7 1186 1186 \value MV_10_8 OS X 10.8 1187 1187 \value MV_10_9 OS X 10.9 1188 \value MV_10_10 OS X 10.10 1188 1189 \value MV_Unknown An unknown and currently unsupported platform 1189 1190 1190 1191 \value MV_CHEETAH Apple codename for MV_10_0 … … bool qSharedBuild() 1197 1198 \value MV_LION Apple codename for MV_10_7 1198 1199 \value MV_MOUNTAINLION Apple codename for MV_10_8 1199 1200 \value MV_MAVERICKS Apple codename for MV_10_9 1201 \value MV_YOSEMITE Apple codename for MV_10_10 1200 1202 1201 1203 \sa WinVersion, SymbianVersion 1202 1204 */ … … static QSysInfo::MacVersion macVersion() 1674 1676 { 1675 1677 #if !defined(Q_OS_IOS) 1676 1678 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); 1679 1682 } 1680 1683 #endif 1681 1684 return QSysInfo::MV_Unknown; -
src/corelib/global/qglobal.h
old new namespace QT_NAMESPACE {} 304 304 #endif 305 305 306 306 #ifdef Q_OS_DARWIN 307 # ifdef MAC_OS_X_VERSION_MIN_REQUIRED308 # undef MAC_OS_X_VERSION_MIN_REQUIRED309 # endif310 # define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_4311 307 # 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 314 349 # endif 315 350 # if !defined(MAC_OS_X_VERSION_10_4) 316 # define MAC_OS_X_VERSION_10_4 MAC_OS_X_VERSION_10_3 + 1351 # define MAC_OS_X_VERSION_10_4 1040 317 352 # endif 318 353 # if !defined(MAC_OS_X_VERSION_10_5) 319 # define MAC_OS_X_VERSION_10_5 MAC_OS_X_VERSION_10_4 + 1354 # define MAC_OS_X_VERSION_10_5 1050 320 355 # endif 321 356 # if !defined(MAC_OS_X_VERSION_10_6) 322 # define MAC_OS_X_VERSION_10_6 MAC_OS_X_VERSION_10_5 + 1357 # define MAC_OS_X_VERSION_10_6 1060 323 358 # endif 324 359 # if !defined(MAC_OS_X_VERSION_10_7) 325 # define MAC_OS_X_VERSION_10_7 MAC_OS_X_VERSION_10_6 + 1360 # define MAC_OS_X_VERSION_10_7 1070 326 361 # endif 327 362 # if !defined(MAC_OS_X_VERSION_10_8) 328 # define MAC_OS_X_VERSION_10_8 MAC_OS_X_VERSION_10_7 + 1363 # define MAC_OS_X_VERSION_10_8 1080 329 364 # endif 330 365 # 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 332 370 # endif 333 371 #endif 334 372 … … public: 1630 1668 MV_10_7 = 0x0009, 1631 1669 MV_10_8 = 0x000A, 1632 1670 MV_10_9 = 0x000B, 1671 MV_10_10 = 0x000C, 1633 1672 1634 1673 /* codenames */ 1635 1674 MV_CHEETAH = MV_10_0, … … public: 1641 1680 MV_SNOWLEOPARD = MV_10_6, 1642 1681 MV_LION = MV_10_7, 1643 1682 MV_MOUNTAINLION = MV_10_8, 1644 MV_MAVERICKS = MV_10_9 1683 MV_MAVERICKS = MV_10_9, 1684 MV_YOSEMITE = MV_10_10 1645 1685 }; 1646 1686 static const MacVersion MacintoshVersion; 1647 1687 #endif -
src/gui/dialogs/qcolordialog_mac.mm
old new QT_USE_NAMESPACE 318 318 // It's important that the modal event loop is stopped before 319 319 // we accept/reject QColorDialog, since QColorDialog has its 320 320 // own event loop that needs to be stopped last. 321 [ NSAppstopModalWithCode:code];321 [[NSApplication sharedApplication] stopModalWithCode:code]; 322 322 } else { 323 323 // Since we are not in a modal event loop, we can safely close 324 324 // down QColorDialog … … QT_USE_NAMESPACE 350 350 while (!modalEnded) { 351 351 #ifndef QT_NO_EXCEPTIONS 352 352 @try { 353 [ NSApprunModalForWindow:mColorPanel];353 [[NSApplication sharedApplication] runModalForWindow:mColorPanel]; 354 354 modalEnded = true; 355 355 } @catch (NSException *) { 356 356 // For some reason, NSColorPanel throws an exception when … … QT_USE_NAMESPACE 358 358 // palette (tab three). 359 359 } 360 360 #else 361 [ NSApprunModalForWindow:mColorPanel];361 [[NSApplication sharedApplication] runModalForWindow:mColorPanel]; 362 362 modalEnded = true; 363 363 #endif 364 364 } … … void QColorDialogPrivate::mac_nativeDialogModalHelp() 469 469 // Do a queued meta-call to open the native modal dialog so it opens after the new 470 470 // event loop has started to execute (in QDialog::exec). Using a timer rather than 471 471 // 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 NSAppis not472 // [NSApplication run] runs (timers are handeled special in cocoa). If NSApplication is not 473 473 // running (which is the case if e.g a top-most QEventLoop has been 474 474 // 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. 476 476 if (delegate){ 477 477 Q_Q(QColorDialog); 478 478 QTimer::singleShot(1, q, SLOT(_q_macRunNativeAppModalPanel())); -
src/gui/dialogs/qfiledialog_mac.mm
old new QT_USE_NAMESPACE 229 229 if ([mSavePanel respondsToSelector:@selector(close)]) 230 230 [mSavePanel close]; 231 231 if ([mSavePanel isSheet]) 232 [ NSAppendSheet: mSavePanel];232 [[NSApplication sharedApplication] endSheet: mSavePanel]; 233 233 } 234 234 235 235 - (void)showModelessPanel … … void QFileDialogPrivate::mac_nativeDialogModalHelp() 1162 1162 // Do a queued meta-call to open the native modal dialog so it opens after the new 1163 1163 // event loop has started to execute (in QDialog::exec). Using a timer rather than 1164 1164 // 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 NSAppis not1165 // [NSApplication run] runs (timers are handeled special in cocoa). If NSApplication is not 1166 1166 // running (which is the case if e.g a top-most QEventLoop has been 1167 1167 // 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. 1169 1169 if (nativeDialogInUse){ 1170 1170 Q_Q(QFileDialog); 1171 1171 QTimer::singleShot(1, q, SLOT(_q_macRunNativeAppModalPanel())); -
src/gui/dialogs/qfontdialog_mac.mm
old new static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) 230 230 mAppModal = true; 231 231 NSWindow *ourPanel = [mStolenContentView window]; 232 232 [ourPanel setReleasedWhenClosed:NO]; 233 [ NSApprunModalForWindow:ourPanel];233 [[NSApplication sharedApplication] runModalForWindow:ourPanel]; 234 234 QAbstractEventDispatcher::instance()->interrupt(); 235 235 236 236 if (mReturnCode == NSOKButton) … … static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) 256 256 257 257 mAppModal = false; 258 258 NSWindow *ourPanel = [mStolenContentView window]; 259 [ NSAppbeginSheet:ourPanel259 [[NSApplication sharedApplication] beginSheet:ourPanel 260 260 modalForWindow:window 261 261 modalDelegate:0 262 262 didEndSelector:0 … … static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) 456 456 457 457 if (mAppModal) { 458 458 mReturnCode = code; 459 [ NSAppstopModalWithCode:code];459 [[NSApplication sharedApplication] stopModalWithCode:code]; 460 460 } else { 461 461 if (code == NSOKButton) 462 462 mPriv->fontDialog()->accept(); … … void QFontDialogPrivate::mac_nativeDialogModalHelp() 636 636 // Do a queued meta-call to open the native modal dialog so it opens after the new 637 637 // event loop has started to execute (in QDialog::exec). Using a timer rather than 638 638 // 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 NSAppis not639 // [NSApplication run] runs (timers are handeled special in cocoa). If NSApplication is not 640 640 // running (which is the case if e.g a top-most QEventLoop has been 641 641 // 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. 643 643 if (nativeDialogInUse) { 644 644 Q_Q(QFontDialog); 645 645 QTimer::singleShot(1, q, SLOT(_q_macRunNativeAppModalPanel())); -
src/gui/kernel/qapplication_mac.mm
old new void qt_mac_set_app_icon(const QPixmap &pixmap) 468 468 image = static_cast<NSImage *>(qt_mac_create_nsimage(pixmap)); 469 469 } 470 470 471 [ NSAppsetApplicationIconImage:image];471 [[NSApplication sharedApplication] setApplicationIconImage:image]; 472 472 [image release]; 473 473 #endif 474 474 } … … void qt_event_request_showsheet(QWidget *w) 750 750 Q_ASSERT(qt_mac_is_macsheet(w)); 751 751 #ifdef QT_MAC_USE_COCOA 752 752 w->repaint(); 753 [ NSAppbeginSheet: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()) 754 754 modalDelegate:nil didEndSelector:nil contextInfo:0]; 755 755 #else 756 756 qt_mac_event_remove(request_showsheet_pending); … … Q_GUI_EXPORT void qt_mac_set_dock_menu(QMenu *menu) 992 992 { 993 993 qt_mac_dock_menu = menu; 994 994 #ifdef QT_MAC_USE_COCOA 995 [ NSAppsetDockMenu:menu->macMenu()];995 [[NSApplication sharedApplication] setDockMenu:menu->macMenu()]; 996 996 #else 997 997 SetApplicationDockTileMenu(menu->macMenu()); 998 998 #endif … … void qt_mac_event_release(QWidget *w) 1011 1011 #ifndef QT_MAC_USE_COCOA 1012 1012 SetApplicationDockTileMenu(0); 1013 1013 #else 1014 [ NSAppsetDockMenu:0];1014 [[NSApplication sharedApplication] setDockMenu:0]; 1015 1015 #endif 1016 1016 } 1017 1017 } … … QWidget *QApplication::topLevelAt(const QPoint &p) 1463 1463 NSWindowList(windowCount, windowList.data()); 1464 1464 int firstQtWindowFound = -1; 1465 1465 for (int i = 0; i < windowCount; ++i) { 1466 NSWindow *window = [ NSAppwindowWithWindowNumber:windowList[i]];1466 NSWindow *window = [[NSApplication sharedApplication] windowWithWindowNumber:windowList[i]]; 1467 1467 if (window) { 1468 1468 QWidget *candidateWindow = [window QT_MANGLE_NAMESPACE(qt_qwidget)]; 1469 1469 if (candidateWindow && firstQtWindowFound == -1) … … bool QApplicationPrivate::canQuit() 3071 3071 #else 3072 3072 Q_Q(QApplication); 3073 3073 #ifdef QT_MAC_USE_COCOA 3074 [[ NSAppmainMenu] cancelTracking];3074 [[[NSApplication sharedApplication] mainMenu] cancelTracking]; 3075 3075 #else 3076 3076 HiliteMenu(0); 3077 3077 #endif … … void onApplicationChangedActivation( bool activated ) 3146 3146 } 3147 3147 3148 3148 if (!app->activeWindow()) { 3149 OSWindowRef wp = [ NSAppkeyWindow];3149 OSWindowRef wp = [[NSApplication sharedApplication] keyWindow]; 3150 3150 if (QWidget *tmp_w = qt_mac_find_window(wp)) 3151 3151 app->setActiveWindow(tmp_w); 3152 3152 } -
src/gui/kernel/qcocoaapplication_mac.mm
old new QT_USE_NAMESPACE 147 147 if ([event type] == NSApplicationDefined) { 148 148 switch ([event subtype]) { 149 149 case QtCocoaEventSubTypePostMessage: 150 [ NSAppQT_MANGLE_NAMESPACE(qt_sendPostedMessage):event];150 [[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_sendPostedMessage):event]; 151 151 return true; 152 152 default: 153 153 break; … … QT_USE_NAMESPACE 174 174 // be called instead of sendEvent if redirection occurs. 175 175 // 'self' will then be an instance of NSApplication 176 176 // (and not QNSApplication) 177 if (![ NSAppQT_MANGLE_NAMESPACE(qt_filterEvent):event])177 if (![[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_filterEvent):event]) 178 178 [self QT_MANGLE_NAMESPACE(qt_sendEvent_original):event]; 179 179 } 180 180 … … QT_USE_NAMESPACE 182 182 { 183 183 // This method will be called if 184 184 // no redirection occurs 185 if (![ NSAppQT_MANGLE_NAMESPACE(qt_filterEvent):event])185 if (![[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_filterEvent):event]) 186 186 [super sendEvent:event]; 187 187 } 188 188 … … QT_USE_NAMESPACE 194 194 // visible on screen. Note: If Qt is used as a plugin, Qt will not use a 195 195 // native menu bar. Hence, we will also not need to do any redirection etc. as 196 196 // we do with sendEvent. 197 [[ NSAppQT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender];197 [[[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender]; 198 198 } 199 199 200 200 @end … … QT_BEGIN_NAMESPACE 203 203 204 204 void qt_redirectNSApplicationSendEvent() 205 205 { 206 if ([ NSAppisMemberOfClass:[QT_MANGLE_NAMESPACE(QNSApplication) class]]) {206 if ([[NSApplication sharedApplication] isMemberOfClass:[QT_MANGLE_NAMESPACE(QNSApplication) class]]) { 207 207 // No need to change implementation since Qt 208 208 // already controls a subclass of NSApplication 209 209 return; -
src/gui/kernel/qcocoaapplicationdelegate_mac.mm
old new static void cleanupCocoaApplicationDelegate() 122 122 [dockMenu release]; 123 123 [qtMenuLoader release]; 124 124 if (reflectionDelegate) { 125 [ NSAppsetDelegate:reflectionDelegate];125 [[NSApplication sharedApplication] setDelegate:reflectionDelegate]; 126 126 [reflectionDelegate release]; 127 127 } 128 128 [super dealloc]; … … static void cleanupCocoaApplicationDelegate() 183 183 return [[qtMenuLoader retain] autorelease]; 184 184 } 185 185 186 // This function will only be called when NSApp is actually running. Before186 // This function will only be called when NSApplication is actually running. Before 187 187 // that, the kAEQuitApplication Apple event will be sent to 188 188 // QApplicationPrivate::globalAppleEventProcessor in qapplication_mac.mm 189 189 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender … … static void cleanupCocoaApplicationDelegate() 249 249 && [reflectionDelegate respondsToSelector: 250 250 @selector(applicationShouldTerminateAfterLastWindowClosed:)]) 251 251 return [reflectionDelegate applicationShouldTerminateAfterLastWindowClosed:sender]; 252 return NO; // Someday qApp->quitOnLastWindowClosed(); when QApp and NSAppwork closer together.252 return NO; // Someday qApp->quitOnLastWindowClosed(); when qApp and NSApplication work closer together. 253 253 } 254 254 255 255 … … static void cleanupCocoaApplicationDelegate() 289 289 qt_button_down = 0; 290 290 } 291 291 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 292 305 - (void)applicationDidChangeScreenParameters:(NSNotification *)notification 293 306 { 294 307 Q_UNUSED(notification); 295 308 QDesktopWidgetImplementation::instance()->onResize(); 296 309 } 297 310 298 - (void)setReflectionDelegate:( NSObject <NSApplicationDelegate> *)oldDelegate311 - (void)setReflectionDelegate:(id <NSApplicationDelegate>)oldDelegate 299 312 { 300 313 [oldDelegate retain]; 301 314 [reflectionDelegate release]; … … static void cleanupCocoaApplicationDelegate() 342 355 { 343 356 Q_UNUSED(event); 344 357 Q_UNUSED(replyEvent); 345 [ NSAppterminate:self];358 [[NSApplication sharedApplication] terminate:self]; 346 359 } 347 360 348 361 - (void)qtDispatcherToQAction:(id)sender 349 362 { 350 [[ NSAppQT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender];363 [[[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender]; 351 364 } 352 365 353 366 @end -
src/gui/kernel/qcocoaapplicationdelegate_mac_p.h
old new QT_FORWARD_DECLARE_CLASS(QApplicationPrivate); 113 113 QApplicationPrivate *qtPrivate; 114 114 NSMenu *dockMenu; 115 115 QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader; 116 NSObject <NSApplicationDelegate> *reflectionDelegate;116 id <NSApplicationDelegate> reflectionDelegate; 117 117 bool inLaunch; 118 118 } 119 119 + (QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate)*)sharedDelegate; … … QT_FORWARD_DECLARE_CLASS(QApplicationPrivate); 122 122 - (QApplicationPrivate *)qAppPrivate; 123 123 - (void)setMenuLoader:(QT_MANGLE_NAMESPACE(QCocoaMenuLoader)*)menuLoader; 124 124 - (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)menuLoader; 125 - (void)setReflectionDelegate:( NSObject <NSApplicationDelegate> *)oldDelegate;125 - (void)setReflectionDelegate:(id <NSApplicationDelegate>)oldDelegate; 126 126 - (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent; 127 127 @end 128 128 #endif -
src/gui/kernel/qcocoamenuloader_mac.mm
old new QT_USE_NAMESPACE 92 92 // 'Quit' item. When changing menu bar (e.g when switching between 93 93 // windows with different menu bars), we never recreate this menu, but 94 94 // instead pull it out the current menu bar and place into the new one: 95 NSMenu *mainMenu = [ NSAppmainMenu];96 if ([ NSAppmainMenu] == menu)95 NSMenu *mainMenu = [[NSApplication sharedApplication] mainMenu]; 96 if ([[NSApplication sharedApplication] mainMenu] == menu) 97 97 return; // nothing to do (menu is the current menu bar)! 98 98 99 99 #ifndef QT_NAMESPACE … … QT_USE_NAMESPACE 201 201 202 202 - (void)terminate:(id)sender 203 203 { 204 [ NSAppterminate:sender];204 [[NSApplication sharedApplication] terminate:sender]; 205 205 } 206 206 207 207 - (void)orderFrontStandardAboutPanel:(id)sender 208 208 { 209 [ NSApporderFrontStandardAboutPanel:sender];209 [[NSApplication sharedApplication] orderFrontStandardAboutPanel:sender]; 210 210 } 211 211 212 212 - (void)hideOtherApplications:(id)sender 213 213 { 214 [ NSApphideOtherApplications:sender];214 [[NSApplication sharedApplication] hideOtherApplications:sender]; 215 215 } 216 216 217 217 - (void)unhideAllApplications:(id)sender 218 218 { 219 [ NSAppunhideAllApplications:sender];219 [[NSApplication sharedApplication] unhideAllApplications:sender]; 220 220 } 221 221 222 222 - (void)hide:(id)sender 223 223 { 224 [ NSApphide:sender];224 [[NSApplication sharedApplication] hide:sender]; 225 225 } 226 226 227 227 - (void)qtUpdateMenubar … … QT_USE_NAMESPACE 258 258 259 259 - (void)orderFrontCharacterPalette:(id)sender 260 260 { 261 [ NSApporderFrontCharacterPalette:sender];261 [[NSApplication sharedApplication] orderFrontCharacterPalette:sender]; 262 262 } 263 263 264 264 - (BOOL)validateMenuItem:(NSMenuItem*)menuItem … … QT_USE_NAMESPACE 266 266 if ([menuItem action] == @selector(hide:) 267 267 || [menuItem action] == @selector(hideOtherApplications:) 268 268 || [menuItem action] == @selector(unhideAllApplications:)) { 269 return [ NSAppvalidateMenuItem:menuItem];269 return [[NSApplication sharedApplication] validateMenuItem:menuItem]; 270 270 } else { 271 271 return [menuItem isEnabled]; 272 272 } -
src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
old new QT_END_NAMESPACE 143 143 { 144 144 // This function is called from the quit item in the menubar when this window 145 145 // is in the first responder chain (see also qtDispatcherToQAction above) 146 [ NSAppterminate:sender];146 [[NSApplication sharedApplication] terminate:sender]; 147 147 } 148 148 149 149 - (void)setLevel:(NSInteger)windowLevel … … QT_END_NAMESPACE 364 364 365 365 if ([sender draggingSource] != nil) { 366 366 // modifier flags might have changed, update it here since we don't send any input events. 367 QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[ NSAppcurrentEvent] modifierFlags]);367 QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[[NSApplication sharedApplication] currentEvent] modifierFlags]); 368 368 modifiers = QApplication::keyboardModifiers(); 369 369 } else { 370 370 // when the source is from another application the above technique will not work. … … QT_END_NAMESPACE 456 456 457 457 // Update modifiers: 458 458 if ([sender draggingSource] != nil) { 459 QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[ NSAppcurrentEvent] modifierFlags]);459 QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[[NSApplication sharedApplication] currentEvent] modifierFlags]); 460 460 modifiers = QApplication::keyboardModifiers(); 461 461 } else { 462 462 modifiers = qt_cocoaDragOperation2QtModifiers(nsActions); -
src/gui/kernel/qeventdispatcher_mac.mm
old new static bool qt_mac_send_event(QEventLoop::ProcessEventsFlags, OSEventRef event, 461 461 if (pt) 462 462 [pt sendEvent:event]; 463 463 else 464 [ NSAppsendEvent:event];464 [[NSApplication sharedApplication] sendEvent:event]; 465 465 return true; 466 466 #endif 467 467 } … … static inline void qt_mac_waitForMoreEvents() 521 521 // (and free up cpu time) until at least one event occur. 522 522 // This implementation is a bit on the edge, but seems to 523 523 // work fine: 524 NSEvent* event = [ NSAppnextEventMatchingMask:NSAnyEventMask524 NSEvent* event = [[NSApplication sharedApplication] nextEventMatchingMask:NSAnyEventMask 525 525 untilDate:[NSDate distantFuture] 526 526 inMode:NSDefaultRunLoopMode 527 527 dequeue:YES]; 528 528 if (event) 529 [ NSApppostEvent:event atStart:YES];529 [[NSApplication sharedApplication] postEvent:event atStart:YES]; 530 530 #endif 531 531 } 532 532 … … static inline void qt_mac_waitForMoreModalSessionEvents() 537 537 // (and free up cpu time) until at least one event occur. 538 538 // This implementation is a bit on the edge, but seems to 539 539 // work fine: 540 NSEvent* event = [ NSAppnextEventMatchingMask:NSAnyEventMask540 NSEvent* event = [[NSApplication sharedApplication] nextEventMatchingMask:NSAnyEventMask 541 541 untilDate:[NSDate distantFuture] 542 542 inMode:NSModalPanelRunLoopMode 543 543 dequeue:YES]; 544 544 if (event) 545 [ NSApppostEvent:event atStart:YES];545 [[NSApplication sharedApplication] postEvent:event atStart:YES]; 546 546 } 547 547 #endif 548 548 … … bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) 588 588 // done from the application itself. And if processEvents is called 589 589 // manually (rather than from a QEventLoop), we cannot enter a tight 590 590 // 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] 592 592 // as we then loose control over which events gets dispatched: 593 const bool canExec_3rdParty = d->nsAppRunCalledByQt || ![ NSAppisRunning];593 const bool canExec_3rdParty = d->nsAppRunCalledByQt || ![[NSApplication sharedApplication] isRunning]; 594 594 const bool canExec_Qt = !excludeUserEvents && 595 595 (flags & QEventLoop::DialogExec || flags & QEventLoop::EventLoopExec) ; 596 596 597 597 if (canExec_Qt && canExec_3rdParty) { 598 598 // We can use exec-mode, meaning that we can stay in a tight loop until 599 599 // 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. 601 601 if (NSModalSession session = d->currentModalSession()) { 602 602 QBoolBlocker execGuard(d->currentExecIsNSAppRun, false); 603 while ([ NSApprunModalSession:session] == NSRunContinuesResponse && !d->interrupt)603 while ([[NSApplication sharedApplication] runModalSession:session] == NSRunContinuesResponse && !d->interrupt) 604 604 qt_mac_waitForMoreModalSessionEvents(); 605 605 606 606 if (!d->interrupt && session == d->currentModalSessionCached) { 607 // Someone called [ NSAppstopModal:] from outside the event607 // Someone called [[NSApplication sharedApplication] stopModal:] from outside the event 608 608 // dispatcher (e.g to stop a native dialog). But that call wrongly stopped 609 609 // 'session' as well. As a result, we need to restart all internal sessions: 610 610 d->temporarilyStopAllModalSessions(); … … bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) 612 612 } else { 613 613 d->nsAppRunCalledByQt = true; 614 614 QBoolBlocker execGuard(d->currentExecIsNSAppRun, true); 615 [ NSApprun];615 [[NSApplication sharedApplication] run]; 616 616 } 617 617 retVal = true; 618 618 } else { … … bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) 626 626 // to use cocoa's native way of running modal sessions: 627 627 if (flags & QEventLoop::WaitForMoreEvents) 628 628 qt_mac_waitForMoreModalSessionEvents(); 629 NSInteger status = [ NSApprunModalSession:session];629 NSInteger status = [[NSApplication sharedApplication] runModalSession:session]; 630 630 if (status != NSRunContinuesResponse && session == d->currentModalSessionCached) { 631 // INVARIANT: Someone called [NSApp stopModal:] from outside the event631 // INVARIANT: Someone called [NSApplication stopModal:] from outside the event 632 632 // dispatcher (e.g to stop a native dialog). But that call wrongly stopped 633 633 // 'session' as well. As a result, we need to restart all internal sessions: 634 634 d->temporarilyStopAllModalSessions(); … … bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) 637 637 } else do { 638 638 // Dispatch all non-user events (but que non-user events up for later). In 639 639 // this case, we need more control over which events gets dispatched, and 640 // cannot use [NSApp runModalSession:session]:641 event = [ NSAppnextEventMatchingMask:NSAnyEventMask640 // cannot use [NSApplication runModalSession:session]: 641 event = [[NSApplication sharedApplication] nextEventMatchingMask:NSAnyEventMask 642 642 untilDate:nil 643 643 inMode:NSModalPanelRunLoopMode 644 644 dequeue: YES]; … … bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) 655 655 } while (!d->interrupt && event != nil); 656 656 } else do { 657 657 // INVARIANT: No modal window is executing. 658 event = [ NSAppnextEventMatchingMask:NSAnyEventMask658 event = [[NSApplication sharedApplication] nextEventMatchingMask:NSAnyEventMask 659 659 untilDate:nil 660 660 inMode:NSDefaultRunLoopMode 661 661 dequeue: YES]; … … void QEventDispatcherMacPrivate::ensureNSAppInitialized() 798 798 // we let Cocoa finish the initialization it seems to need. We'll only 799 799 // apply this trick at most once for any application, and we avoid doing it 800 800 // for the common case where main just starts QApplication::exec. 801 if (nsAppRunCalledByQt || [ NSAppisRunning])801 if (nsAppRunCalledByQt || [[NSApplication sharedApplication] isRunning]) 802 802 return; 803 803 nsAppRunCalledByQt = true; 804 804 QBoolBlocker block1(interrupt, true); 805 805 QBoolBlocker block2(currentExecIsNSAppRun, true); 806 [ NSApprun];806 [[NSApplication sharedApplication] run]; 807 807 } 808 808 809 809 void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions() … … void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions() 812 812 // such, make them pending again. The next call to 813 813 // currentModalSession will recreate them again. The 814 814 // reason to stop all session like this is that otherwise 815 // a call [NSApp stop] would not stop NSApp, but rather816 // 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 817 817 // we need to stop all the modal session first. To avoid changing 818 818 // the stacking order of the windows while doing so, we put 819 819 // up a block that is used in QCocoaWindow and QCocoaPanel: … … void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions() 821 821 for (int i=0; i<stackSize; ++i) { 822 822 QCocoaModalSessionInfo &info = cocoaModalSessionStack[i]; 823 823 if (info.session) { 824 [ NSAppendModalSession:info.session];824 [[NSApplication sharedApplication] endModalSession:info.session]; 825 825 info.session = 0; 826 826 } 827 827 } … … NSModalSession QEventDispatcherMacPrivate::currentModalSession() 856 856 info.nswindow = window; 857 857 [(NSWindow*) info.nswindow retain]; 858 858 int levelBeforeEnterModal = [window level]; 859 info.session = [ NSAppbeginModalSessionForWindow:window];859 info.session = [[NSApplication sharedApplication] beginModalSessionForWindow:window]; 860 860 // Make sure we don't stack the window lower that it was before 861 861 // entering modal, in case it e.g. had the stays-on-top flag set: 862 862 if (levelBeforeEnterModal > [window level]) … … void QEventDispatcherMacPrivate::cleanupModalSessions() 926 926 cocoaModalSessionStack.remove(i); 927 927 currentModalSessionCached = 0; 928 928 if (info.session) { 929 [ NSAppendModalSession:info.session];929 [[NSApplication sharedApplication] endModalSession:info.session]; 930 930 [(NSWindow *)info.nswindow release]; 931 931 } 932 932 } … … inline static void processPostedEvents(QEventDispatcherMacPrivate *const d, cons 1057 1057 // pending cocoa events first). 1058 1058 if (d->currentModalSessionCached) 1059 1059 d->temporarilyStopAllModalSessions(); 1060 [ NSApp stop:NSApp];1060 [[NSApplication sharedApplication] stop:[NSApplication sharedApplication]]; 1061 1061 d->cancelWaitForMoreEvents(); 1062 1062 } 1063 1063 #endif … … void QEventDispatcherMacPrivate::cancelWaitForMoreEvents() 1093 1093 // In case the event dispatcher is waiting for more 1094 1094 // events somewhere, we post a dummy event to wake it up: 1095 1095 QMacCocoaAutoReleasePool pool; 1096 [NSApp postEvent:[NSEvent otherEventWithType:NSApplicationDefined location:NSZeroPoint 1096 [[NSApplication sharedApplication] postEvent:[NSEvent otherEventWithType:NSApplicationDefined 1097 location:NSZeroPoint 1097 1098 modifierFlags:0 timestamp:0. windowNumber:0 context:0 1098 1099 subtype:QtCocoaEventSubTypeWakeup data1:0 data2:0] atStart:NO]; 1099 1100 } … … void QEventDispatcherMac::interrupt() 1110 1111 #else 1111 1112 // We do nothing more here than setting d->interrupt = true, and 1112 1113 // poke the event loop if it is sleeping. Actually stopping 1113 // NSApp , or the current modal session, is done inside the send1114 // NSApplication, or the current modal session, is done inside the send 1114 1115 // posted events callback. We do this to ensure that all current pending 1115 1116 // cocoa events gets delivered before we stop. Otherwise, if we now stop 1116 1117 // the last event loop recursion, cocoa will just drop pending posted … … QtMacInterruptDispatcherHelp::QtMacInterruptDispatcherHelp() : cancelled(false) 1165 1166 // The whole point of this class is that we enable a way to interrupt 1166 1167 // the event dispatcher when returning back to a lower recursion level 1167 1168 // 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. 1169 1170 // Since the interrupt is canceled if processEvents is called before 1170 1171 // this object gets deleted, we also avoid interrupting unnecessary. 1171 1172 deleteLater(); -
src/gui/kernel/qt_cocoa_helpers_mac.mm
old new void qt_cocoaPostMessage(id target, SEL selector, int argCount, id arg1, id arg2 1697 1697 NSEvent *e = [NSEvent otherEventWithType:NSApplicationDefined 1698 1698 location:NSZeroPoint modifierFlags:0 timestamp:0 windowNumber:0 1699 1699 context:nil subtype:QtCocoaEventSubTypePostMessage data1:lower data2:upper]; 1700 [ NSApppostEvent:e atStart:NO];1700 [[NSApplication sharedApplication] postEvent:e atStart:NO]; 1701 1701 } 1702 1702 1703 1703 void qt_cocoaPostMessageAfterEventLoopExit(id target, SEL selector, int argCount, id arg1, id arg2) … … void qt_mac_post_retranslateAppMenu() 1727 1727 { 1728 1728 #ifdef QT_MAC_USE_COCOA 1729 1729 QMacCocoaAutoReleasePool pool; 1730 qt_cocoaPostMessage([ NSAppQT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)], @selector(qtTranslateApplicationMenu));1730 qt_cocoaPostMessage([[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)], @selector(qtTranslateApplicationMenu)); 1731 1731 #endif 1732 1732 } 1733 1733 -
src/gui/kernel/qt_mac_p.h
old new 75 75 76 76 #include <Carbon/Carbon.h> 77 77 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 78 134 QT_BEGIN_NAMESPACE 79 135 class QWidget; 80 136 class QDragMoveEvent; -
src/gui/kernel/qwidget_mac.mm
old new static QSize qt_mac_desktopSize() 220 220 static NSDrawer *qt_mac_drawer_for(const QWidget *widget) 221 221 { 222 222 NSView *widgetView = reinterpret_cast<NSView *>(widget->window()->effectiveWinId()); 223 NSArray *windows = [ NSAppwindows];223 NSArray *windows = [[NSApplication sharedApplication] windows]; 224 224 for (NSWindow *window in windows) { 225 225 NSArray *drawers = [window drawers]; 226 226 for (NSDrawer *drawer in drawers) { … … static void qt_mac_destructWindow(OSWindowRef window) 254 254 { 255 255 #ifdef QT_MAC_USE_COCOA 256 256 if ([window isVisible] && [window isSheet]){ 257 [ NSAppendSheet:window];257 [[NSApplication sharedApplication] endSheet:window]; 258 258 [window orderOut:window]; 259 259 } 260 260 … … void QWidgetPrivate::recreateMacWindow() 2439 2439 } 2440 2440 if ([oldWindow isVisible]){ 2441 2441 if ([oldWindow isSheet]) 2442 [ NSAppendSheet:oldWindow];2442 [[NSApplication sharedApplication] endSheet:oldWindow]; 2443 2443 [oldWindow orderOut:oldWindow]; 2444 2444 show_sys(); 2445 2445 } … … void QWidgetPrivate::show_sys() 3554 3554 } 3555 3555 3556 3556 #ifdef QT_MAC_USE_COCOA 3557 if ([ NSAppisActive] && !qt_button_down && !QWidget::mouseGrabber()){3557 if ([[NSApplication sharedApplication] isActive] && !qt_button_down && !QWidget::mouseGrabber()){ 3558 3558 // Update enter/leave immidiatly, don't wait for a move event. But only 3559 3559 // if no grab exists (even if the grab points to this widget, it seems, ref X11) 3560 3560 QPoint qlocal, qglobal; … … void QWidgetPrivate::hide_sys() 3605 3605 else 3606 3606 HideSheetWindow(window); 3607 3607 #else 3608 [ NSAppendSheet:window];3608 [[NSApplication sharedApplication] endSheet:window]; 3609 3609 [window orderOut:window]; 3610 3610 #endif 3611 3611 } else if(qt_mac_is_macdrawer(q)) { … … void QWidgetPrivate::hide_sys() 3716 3716 } 3717 3717 3718 3718 #ifdef QT_MAC_USE_COCOA 3719 if ([ NSAppisActive] && !qt_button_down && !QWidget::mouseGrabber()){3719 if ([[NSApplication sharedApplication] isActive] && !qt_button_down && !QWidget::mouseGrabber()){ 3720 3720 // Update enter/leave immidiatly, don't wait for a move event. But only 3721 3721 // if no grab exists (even if the grab points to this widget, it seems, ref X11) 3722 3722 QPoint qlocal, qglobal; -
src/gui/styles/qmacstyle_mac.mm
old new static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg 780 780 if (!GetThemeMenuBarHeight(&size)) 781 781 ret = QSize(-1, size); 782 782 #else 783 ret = QSize(-1, [[ NSAppmainMenu] menuBarHeight]);783 ret = QSize(-1, [[[NSApplication sharedApplication] mainMenu] menuBarHeight]); 784 784 // In the qt_mac_set_native_menubar(false) case, 785 785 // we come it here with a zero-height main menu, 786 786 // preventing the in-window menu from displaying. … … void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai 3024 3024 fdi.version = qt_mac_hitheme_version; 3025 3025 fdi.state = tds; 3026 3026 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; 3037 3035 fdi.isFocused = (frame->state & State_HasFocus); 3038 3036 int lw = frame->lineWidth; 3039 3037 if (lw <= 0) -
src/gui/util/qsystemtrayicon_mac.mm
old new private: 536 536 #ifndef QT_MAC_USE_COCOA 537 537 const short scale = GetMBarHeight(); 538 538 #else 539 const short scale = [[ NSAppmainMenu] menuBarHeight];539 const short scale = [[[NSApplication sharedApplication] mainMenu] menuBarHeight]; 540 540 #endif 541 541 NSImage *nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(icon.pixmap(QSize(scale, scale)))); 542 542 [item setImage: nsimage]; -
src/gui/widgets/qcocoamenu_mac.mm
old new QT_USE_NAMESPACE 202 202 static SEL selForOFCP = NSSelectorFromString(@"orderFrontCharacterPalette:"); 203 203 if (index == -1 && selForOFCP == actionSelector) { 204 204 // Check if the 'orderFrontCharacterPalette' SEL exists for QCocoaMenuLoader object 205 QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = [ NSAppQT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];205 QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = [[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)]; 206 206 return [super indexOfItemWithTarget:loader andAction:actionSelector]; 207 207 } 208 208 return index; -
src/gui/widgets/qmenu_mac.mm
old new static void cancelAllMenuTracking() 179 179 { 180 180 #ifdef QT_MAC_USE_COCOA 181 181 QMacCocoaAutoReleasePool pool; 182 NSMenu *mainMenu = [ NSAppmainMenu];182 NSMenu *mainMenu = [[NSApplication sharedApplication] mainMenu]; 183 183 [mainMenu cancelTracking]; 184 184 for (NSMenuItem *item in [mainMenu itemArray]) { 185 185 if ([item submenu]) { … … static inline void syncMenuBarItemsVisiblity(const QMenuBarPrivate::QMacMenuBarP 633 633 634 634 static inline QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *getMenuLoader() 635 635 { 636 return [ NSAppQT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];636 return [[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)]; 637 637 } 638 638 639 639 static NSMenuItem *createNSMenuItem(const QString &title) … … void qt_mac_clear_menubar() 2033 2033 QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); 2034 2034 NSMenu *menu = [loader menu]; 2035 2035 [loader ensureAppMenuInMenu:menu]; 2036 [ NSAppsetMainMenu:menu];2036 [[NSApplication sharedApplication] setMainMenu:menu]; 2037 2037 const bool modal = qt_mac_should_disable_menu(0); 2038 2038 if (qt_mac_current_menubar.qmenubar || modal != qt_mac_current_menubar.modal) 2039 2039 qt_mac_set_modal_state(menu, modal); … … bool QMenuBarPrivate::macUpdateMenuBarImmediatly() 2100 2100 #else 2101 2101 QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); 2102 2102 [loader ensureAppMenuInMenu:menu]; 2103 [ NSAppsetMainMenu:menu];2103 [[NSApplication sharedApplication] setMainMenu:menu]; 2104 2104 syncMenuBarItemsVisiblity(mb->d_func()->mac_menubar); 2105 2105 2106 2106 if (OSMenuRef tmpMerge = QMenuPrivate::mergeMenuHash.value(menu)) { … … bool QMenuBarPrivate::macUpdateMenuBarImmediatly() 2140 2140 #else 2141 2141 QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); 2142 2142 [loader ensureAppMenuInMenu:menu]; 2143 [ NSAppsetMainMenu:menu];2143 [[NSApplication sharedApplication] setMainMenu:menu]; 2144 2144 syncMenuBarItemsVisiblity(qt_mac_current_menubar.qmenubar->d_func()->mac_menubar); 2145 2145 #endif 2146 2146 qt_mac_set_modal_state(menu, modal);