|
|
@@ -0,0 +1,751 @@ |
|
|
|
diff --git a/mkspecs/common/clang-mac.conf b/mkspecs/common/clang-mac.conf |
|
|
|
index cbae2e6..ed6132c 100644 |
|
|
|
--- a/mkspecs/common/clang-mac.conf |
|
|
|
+++ b/mkspecs/common/clang-mac.conf |
|
|
|
@@ -10,4 +10,4 @@ QMAKE_CXXFLAGS += -stdlib=libc++ |
|
|
|
QMAKE_LFLAGS += -stdlib=libc++ |
|
|
|
QMAKE_AR_LTCG = libtool -static -o |
|
|
|
|
|
|
|
-QMAKE_CFLAGS_APPLICATION_EXTENSION = -fapplication-extension |
|
|
|
+QMAKE_CFLAGS_APPLICATION_EXTENSION = |
|
|
|
diff --git a/src/corelib/global/qoperatingsystemversion_darwin.mm b/src/corelib/global/qoperatingsystemversion_darwin.mm |
|
|
|
index d8b927f..9a690ad 100644 |
|
|
|
--- a/src/corelib/global/qoperatingsystemversion_darwin.mm |
|
|
|
+++ b/src/corelib/global/qoperatingsystemversion_darwin.mm |
|
|
|
@@ -40,16 +40,37 @@ |
|
|
|
#include "qoperatingsystemversion_p.h" |
|
|
|
#import <Foundation/Foundation.h> |
|
|
|
|
|
|
|
+typedef qint16 (*GestaltFunction)(quint32 selector, qint32 *response); |
|
|
|
+ |
|
|
|
QT_BEGIN_NAMESPACE |
|
|
|
|
|
|
|
QOperatingSystemVersion QOperatingSystemVersion::current() |
|
|
|
{ |
|
|
|
- NSOperatingSystemVersion osv = NSProcessInfo.processInfo.operatingSystemVersion; |
|
|
|
QOperatingSystemVersion v; |
|
|
|
v.m_os = currentType(); |
|
|
|
- v.m_major = osv.majorVersion; |
|
|
|
- v.m_minor = osv.minorVersion; |
|
|
|
- v.m_micro = osv.patchVersion; |
|
|
|
+ v.m_major = -1; |
|
|
|
+ v.m_minor = -1; |
|
|
|
+ v.m_micro = -1; |
|
|
|
+ static GestaltFunction pGestalt = 0; |
|
|
|
+ if (!pGestalt) { |
|
|
|
+ CFBundleRef b = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.CoreServices")); |
|
|
|
+ pGestalt = reinterpret_cast<GestaltFunction>(CFBundleGetFunctionPointerForName(b, |
|
|
|
+ CFSTR("Gestalt"))); |
|
|
|
+ } |
|
|
|
+ // Use temporary variables so we can return 0.0.0 (unknown version) |
|
|
|
+ // in case of an error partway through determining the OS version |
|
|
|
+ qint32 major = 0, minor = 0, patch = 0; |
|
|
|
+ if (!pGestalt) |
|
|
|
+ return v; |
|
|
|
+ if (pGestalt('sys1', &major) != 0) |
|
|
|
+ return v; |
|
|
|
+ if (pGestalt('sys2', &minor) != 0) |
|
|
|
+ return v; |
|
|
|
+ if (pGestalt('sys3', &patch) != 0) |
|
|
|
+ return v; |
|
|
|
+ v.m_major = major; |
|
|
|
+ v.m_minor = minor; |
|
|
|
+ v.m_micro = patch; |
|
|
|
return v; |
|
|
|
} |
|
|
|
|
|
|
|
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp |
|
|
|
index 7fed54f..bbf5e6d 100644 |
|
|
|
--- a/src/corelib/io/qfilesystemengine_unix.cpp |
|
|
|
+++ b/src/corelib/io/qfilesystemengine_unix.cpp |
|
|
|
@@ -126,8 +126,11 @@ static bool isPackage(const QFileSystemMetaData &data, const QFileSystemEntry &e |
|
|
|
|
|
|
|
#ifdef Q_OS_MACOS |
|
|
|
// Find if an application other than Finder claims to know how to handle the package |
|
|
|
- QCFType<CFURLRef> application = LSCopyDefaultApplicationURLForURL(url, |
|
|
|
- kLSRolesEditor | kLSRolesViewer, nullptr); |
|
|
|
+ QCFType<CFURLRef> application; |
|
|
|
+ LSGetApplicationForURL(url, |
|
|
|
+ kLSRolesEditor|kLSRolesViewer, |
|
|
|
+ NULL, |
|
|
|
+ &application); |
|
|
|
|
|
|
|
if (application) { |
|
|
|
QCFType<CFBundleRef> bundle = CFBundleCreate(kCFAllocatorDefault, application); |
|
|
|
diff --git a/src/corelib/kernel/qcore_foundation.mm b/src/corelib/kernel/qcore_foundation.mm |
|
|
|
index 56eabc4..c48a797 100644 |
|
|
|
--- a/src/corelib/kernel/qcore_foundation.mm |
|
|
|
+++ b/src/corelib/kernel/qcore_foundation.mm |
|
|
|
@@ -46,7 +46,7 @@ |
|
|
|
#include <QtCore/qbytearray.h> |
|
|
|
#include <QtCore/qrect.h> |
|
|
|
|
|
|
|
-#if QT_CONFIG(timezone) && !defined(QT_NO_SYSTEMLOCALE) |
|
|
|
+#if 0 |
|
|
|
#include <QtCore/qtimezone.h> |
|
|
|
#include <QtCore/private/qtimezoneprivate_p.h> |
|
|
|
#include <QtCore/private/qcore_mac_p.h> |
|
|
|
@@ -433,7 +433,7 @@ NSDate *QDateTime::toNSDate() const |
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------- |
|
|
|
|
|
|
|
-#if QT_CONFIG(timezone) && !defined(QT_NO_SYSTEMLOCALE) |
|
|
|
+#if 0 |
|
|
|
/*! |
|
|
|
\since 5.9 |
|
|
|
|
|
|
|
diff --git a/src/corelib/tools/qtimezone.h b/src/corelib/tools/qtimezone.h |
|
|
|
index bd87139..d154cbf 100644 |
|
|
|
--- a/src/corelib/tools/qtimezone.h |
|
|
|
+++ b/src/corelib/tools/qtimezone.h |
|
|
|
@@ -47,7 +47,7 @@ |
|
|
|
|
|
|
|
QT_REQUIRE_CONFIG(timezone); |
|
|
|
|
|
|
|
-#if (defined(Q_OS_DARWIN) || defined(Q_QDOC)) && !defined(QT_NO_SYSTEMLOCALE) |
|
|
|
+#if 0 |
|
|
|
Q_FORWARD_DECLARE_CF_TYPE(CFTimeZone); |
|
|
|
Q_FORWARD_DECLARE_OBJC_CLASS(NSTimeZone); |
|
|
|
#endif |
|
|
|
@@ -147,7 +147,7 @@ public: |
|
|
|
static QList<QByteArray> windowsIdToIanaIds(const QByteArray &windowsId, |
|
|
|
QLocale::Country country); |
|
|
|
|
|
|
|
-#if (defined(Q_OS_DARWIN) || defined(Q_QDOC)) && !defined(QT_NO_SYSTEMLOCALE) |
|
|
|
+#if 0 |
|
|
|
static QTimeZone fromCFTimeZone(CFTimeZoneRef timeZone); |
|
|
|
CFTimeZoneRef toCFTimeZone() const Q_DECL_CF_RETURNS_RETAINED; |
|
|
|
static QTimeZone fromNSTimeZone(const NSTimeZone *timeZone); |
|
|
|
diff --git a/src/gui/painting/qcoregraphics.mm b/src/gui/painting/qcoregraphics.mm |
|
|
|
index c4fb8af..91875cd 100644 |
|
|
|
--- a/src/gui/painting/qcoregraphics.mm |
|
|
|
+++ b/src/gui/painting/qcoregraphics.mm |
|
|
|
@@ -47,6 +47,21 @@ |
|
|
|
#include <QtCore/qcoreapplication.h> |
|
|
|
#include <QtCore/qoperatingsystemversion.h> |
|
|
|
|
|
|
|
+@interface NSGraphicsContext (QtAdditions) |
|
|
|
+ |
|
|
|
+ |
|
|
|
+@end |
|
|
|
+ |
|
|
|
+@implementation NSGraphicsContext (QtAdditions) |
|
|
|
+ |
|
|
|
+{ |
|
|
|
+ return [self graphicsContextWithGraphicsPort:graphicsPort flipped:initialFlippedState]; |
|
|
|
+} |
|
|
|
+ |
|
|
|
+@end |
|
|
|
+ |
|
|
|
QT_BEGIN_NAMESPACE |
|
|
|
|
|
|
|
// ---------------------- Images ---------------------- |
|
|
|
@@ -147,7 +162,7 @@ QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size) |
|
|
|
QMacCGContext ctx(&pixmap); |
|
|
|
if (!ctx) |
|
|
|
return QPixmap(); |
|
|
|
- NSGraphicsContext *gc = [NSGraphicsContext graphicsContextWithCGContext:ctx flipped:YES]; |
|
|
|
+ NSGraphicsContext *gc = [NSGraphicsContext qt_graphicsContextWithCGContext:ctx flipped:YES]; |
|
|
|
if (!gc) |
|
|
|
return QPixmap(); |
|
|
|
[NSGraphicsContext saveGraphicsState]; |
|
|
|
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm |
|
|
|
index f8fe160..3c350b3 100644 |
|
|
|
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm |
|
|
|
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm |
|
|
|
@@ -456,7 +456,6 @@ QFontEngine *QCoreTextFontDatabaseEngineFactory<QFontEngineFT>::fontEngine(const |
|
|
|
return QFontEngineFT::create(*fontData, fontDef.pixelSize, |
|
|
|
static_cast<QFont::HintingPreference>(fontDef.hintingPreference)); |
|
|
|
} else if (NSURL *url = descriptorAttribute<NSURL>(descriptor, kCTFontURLAttribute)) { |
|
|
|
- Q_ASSERT(url.fileURL); |
|
|
|
QFontEngine::FaceId faceId; |
|
|
|
faceId.filename = QString::fromNSString(url.path).toUtf8(); |
|
|
|
return QFontEngineFT::create(fontDef, faceId); |
|
|
|
diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm |
|
|
|
index aa61245..2423378 100644 |
|
|
|
--- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm |
|
|
|
+++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm |
|
|
|
@@ -78,7 +78,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); |
|
|
|
mHelper = 0; |
|
|
|
mStolenContentView = 0; |
|
|
|
mPanelButtons = nil; |
|
|
|
- mResultCode = NSModalResponseCancel; |
|
|
|
+ mResultCode = NSCancelButton; |
|
|
|
mDialogIsExecuting = false; |
|
|
|
mResultSet = false; |
|
|
|
mClosingDueToKnownButton = false; |
|
|
|
@@ -166,7 +166,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); |
|
|
|
mClosingDueToKnownButton = true; |
|
|
|
[mColorPanel close]; |
|
|
|
[self updateQtColor]; |
|
|
|
- [self finishOffWithCode:NSModalResponseOK]; |
|
|
|
+ [self finishOffWithCode:NSOKButton]; |
|
|
|
} |
|
|
|
|
|
|
|
- (void)onCancelClicked |
|
|
|
@@ -175,7 +175,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); |
|
|
|
mClosingDueToKnownButton = true; |
|
|
|
[mColorPanel close]; |
|
|
|
mQtColor = QColor(); |
|
|
|
- [self finishOffWithCode:NSModalResponseCancel]; |
|
|
|
+ [self finishOffWithCode:NSCancelButton]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@@ -236,12 +236,12 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); |
|
|
|
|
|
|
|
[NSApp runModalForWindow:mColorPanel]; |
|
|
|
mDialogIsExecuting = false; |
|
|
|
- return (mResultCode == NSModalResponseOK); |
|
|
|
+ return (mResultCode == NSOKButton); |
|
|
|
} |
|
|
|
|
|
|
|
- (QPlatformDialogHelper::DialogCode)dialogResultCode |
|
|
|
{ |
|
|
|
- return (mResultCode == NSModalResponseOK) ? QPlatformDialogHelper::Accepted : QPlatformDialogHelper::Rejected; |
|
|
|
+ return (mResultCode == NSOKButton) ? QPlatformDialogHelper::Accepted : QPlatformDialogHelper::Rejected; |
|
|
|
} |
|
|
|
|
|
|
|
- (BOOL)windowShouldClose:(id)window |
|
|
|
@@ -250,7 +250,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); |
|
|
|
if (!mPanelButtons) |
|
|
|
[self updateQtColor]; |
|
|
|
if (mDialogIsExecuting) { |
|
|
|
- [self finishOffWithCode:NSModalResponseCancel]; |
|
|
|
+ [self finishOffWithCode:NSCancelButton]; |
|
|
|
} else { |
|
|
|
mResultSet = true; |
|
|
|
if (mHelper) |
|
|
|
@@ -276,7 +276,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); |
|
|
|
// This check will prevent any such recursion. |
|
|
|
if (!mResultSet) { |
|
|
|
mResultSet = true; |
|
|
|
- if (mResultCode == NSModalResponseCancel) { |
|
|
|
+ if (mResultCode == NSCancelButton) { |
|
|
|
emit mHelper->reject(); |
|
|
|
} else { |
|
|
|
emit mHelper->accept(); |
|
|
|
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm |
|
|
|
index b22f1b1..d2dd645 100644 |
|
|
|
--- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm |
|
|
|
+++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm |
|
|
|
@@ -401,7 +401,7 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags) |
|
|
|
// [NSApp run], which is the normal code path for cocoa applications. |
|
|
|
if (NSModalSession session = d->currentModalSession()) { |
|
|
|
QBoolBlocker execGuard(d->currentExecIsNSAppRun, false); |
|
|
|
- while ([NSApp runModalSession:session] == NSModalResponseContinue && !d->interrupt) { |
|
|
|
+ while ([NSApp runModalSession:session] == NSRunContinuesResponse && !d->interrupt) { |
|
|
|
qt_mac_waitForMoreEvents(NSModalPanelRunLoopMode); |
|
|
|
if (session != d->currentModalSessionCached) { |
|
|
|
// It's possible to release the current modal session |
|
|
|
@@ -445,7 +445,7 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags) |
|
|
|
if (flags & QEventLoop::WaitForMoreEvents) |
|
|
|
qt_mac_waitForMoreEvents(NSModalPanelRunLoopMode); |
|
|
|
NSInteger status = [NSApp runModalSession:session]; |
|
|
|
- if (status != NSModalResponseContinue && session == d->currentModalSessionCached) { |
|
|
|
+ if (status != NSRunContinuesResponse && session == d->currentModalSessionCached) { |
|
|
|
// INVARIANT: Someone called [NSApp stopModal:] from outside the event |
|
|
|
// dispatcher (e.g to stop a native dialog). But that call wrongly stopped |
|
|
|
// 'session' as well. As a result, we need to restart all internal sessions: |
|
|
|
diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm |
|
|
|
index 9a96895..b227794 100644 |
|
|
|
--- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm |
|
|
|
+++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm |
|
|
|
@@ -104,7 +104,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); |
|
|
|
mHelper = 0; |
|
|
|
mStolenContentView = 0; |
|
|
|
mPanelButtons = 0; |
|
|
|
- mResultCode = NSModalResponseCancel; |
|
|
|
+ mResultCode = NSCancelButton; |
|
|
|
mDialogIsExecuting = false; |
|
|
|
mResultSet = false; |
|
|
|
|
|
|
|
@@ -169,7 +169,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); |
|
|
|
- (void)onOkClicked |
|
|
|
{ |
|
|
|
[mFontPanel close]; |
|
|
|
- [self finishOffWithCode:NSModalResponseOK]; |
|
|
|
+ [self finishOffWithCode:NSOKButton]; |
|
|
|
} |
|
|
|
|
|
|
|
- (void)onCancelClicked |
|
|
|
@@ -177,7 +177,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); |
|
|
|
if (mPanelButtons) { |
|
|
|
[mFontPanel close]; |
|
|
|
mQtFont = QFont(); |
|
|
|
- [self finishOffWithCode:NSModalResponseCancel]; |
|
|
|
+ [self finishOffWithCode:NSCancelButton]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@@ -222,12 +222,12 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); |
|
|
|
|
|
|
|
[NSApp runModalForWindow:mFontPanel]; |
|
|
|
mDialogIsExecuting = false; |
|
|
|
- return (mResultCode == NSModalResponseOK); |
|
|
|
+ return (mResultCode == NSOKButton); |
|
|
|
} |
|
|
|
|
|
|
|
- (QPlatformDialogHelper::DialogCode)dialogResultCode |
|
|
|
{ |
|
|
|
- return (mResultCode == NSModalResponseOK) ? QPlatformDialogHelper::Accepted : QPlatformDialogHelper::Rejected; |
|
|
|
+ return (mResultCode == NSOKButton) ? QPlatformDialogHelper::Accepted : QPlatformDialogHelper::Rejected; |
|
|
|
} |
|
|
|
|
|
|
|
- (BOOL)windowShouldClose:(id)window |
|
|
|
@@ -236,7 +236,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); |
|
|
|
if (!mPanelButtons) |
|
|
|
[self updateQtFont]; |
|
|
|
if (mDialogIsExecuting) { |
|
|
|
- [self finishOffWithCode:NSModalResponseCancel]; |
|
|
|
+ [self finishOffWithCode:NSCancelButton]; |
|
|
|
} else { |
|
|
|
mResultSet = true; |
|
|
|
if (mHelper) |
|
|
|
@@ -262,7 +262,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); |
|
|
|
// This check will prevent any such recursion. |
|
|
|
if (!mResultSet) { |
|
|
|
mResultSet = true; |
|
|
|
- if (mResultCode == NSModalResponseCancel) { |
|
|
|
+ if (mResultCode == NSCancelButton) { |
|
|
|
emit mHelper->reject(); |
|
|
|
} else { |
|
|
|
emit mHelper->accept(); |
|
|
|
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm |
|
|
|
index bac49cf..83b51cd 100644 |
|
|
|
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm |
|
|
|
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm |
|
|
|
@@ -144,7 +144,7 @@ void QCocoaScreen::updateGeometry() |
|
|
|
// The reference screen for the geometry is always the primary screen, but since |
|
|
|
// we may be in the process of creating and registering the primary screen, we |
|
|
|
// must special-case that and assign it direcly. |
|
|
|
- QCocoaScreen *primaryScreen = (nsScreen == [[NSScreen screens] firstObject]) ? |
|
|
|
+ QCocoaScreen *primaryScreen = (nsScreen == [[NSScreen screens] objectAtIndex:0]) ? |
|
|
|
this : static_cast<QCocoaScreen*>(QGuiApplication::primaryScreen()->handle()); |
|
|
|
|
|
|
|
m_geometry = primaryScreen->mapFromNative(m_geometry).toRect(); |
|
|
|
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm |
|
|
|
index e41c70b..815028b 100644 |
|
|
|
--- a/src/plugins/platforms/cocoa/qcocoamenu.mm |
|
|
|
+++ b/src/plugins/platforms/cocoa/qcocoamenu.mm |
|
|
|
@@ -329,13 +329,6 @@ void QCocoaMenu::insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem * |
|
|
|
} |
|
|
|
|
|
|
|
insertNative(cocoaItem, beforeItem); |
|
|
|
- |
|
|
|
- // Empty menus on a menubar are hidden by default. If the menu gets |
|
|
|
- // added to the menubar before it contains any item, we need to sync. |
|
|
|
- if (isVisible() && attachedItem().hidden) { |
|
|
|
- if (auto *mb = qobject_cast<QCocoaMenuBar *>(menuParent())) |
|
|
|
- mb->syncMenu(this); |
|
|
|
- } |
|
|
|
} |
|
|
|
|
|
|
|
void QCocoaMenu::insertNative(QCocoaMenuItem *item, QCocoaMenuItem *beforeItem) |
|
|
|
diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm |
|
|
|
index a4cd465..06d63f7 100644 |
|
|
|
--- a/src/plugins/platforms/cocoa/qcocoamenubar.mm |
|
|
|
+++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm |
|
|
|
@@ -369,7 +369,7 @@ void QCocoaMenuBar::updateMenuBarImmediately() |
|
|
|
QCocoaMenuLoader *loader = [QCocoaMenuLoader sharedMenuLoader]; |
|
|
|
[loader ensureAppMenuInMenu:mb->nsMenu()]; |
|
|
|
|
|
|
|
- NSMutableSet *mergedItems = [[NSMutableSet setWithCapacity:mb->merged().count()] retain]; |
|
|
|
+ NSMutableSet *mergedItems = [[NSMutableSet setWithCapacity:0] retain]; |
|
|
|
foreach (QCocoaMenuItem *m, mb->merged()) { |
|
|
|
[mergedItems addObject:m->nsItem()]; |
|
|
|
m->syncMerged(); |
|
|
|
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm |
|
|
|
index 5504c24..fa0b7f7 100644 |
|
|
|
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm |
|
|
|
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm |
|
|
|
@@ -172,12 +172,11 @@ void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine |
|
|
|
|
|
|
|
QPixmap QCocoaNativeInterface::defaultBackgroundPixmapForQWizard() |
|
|
|
{ |
|
|
|
+ QCFType<CFURLRef> url; |
|
|
|
const int ExpectedImageWidth = 242; |
|
|
|
const int ExpectedImageHeight = 414; |
|
|
|
- QCFType<CFArrayRef> urls = LSCopyApplicationURLsForBundleIdentifier( |
|
|
|
- CFSTR("com.apple.KeyboardSetupAssistant"), nullptr); |
|
|
|
- if (urls && CFArrayGetCount(urls) > 0) { |
|
|
|
- CFURLRef url = (CFURLRef)CFArrayGetValueAtIndex(urls, 0); |
|
|
|
+ if (LSFindApplicationForInfo(kLSUnknownCreator, CFSTR("com.apple.KeyboardSetupAssistant"), |
|
|
|
+ 0, 0, &url) == noErr) { |
|
|
|
QCFType<CFBundleRef> bundle = CFBundleCreate(kCFAllocatorDefault, url); |
|
|
|
if (bundle) { |
|
|
|
url = CFBundleCopyResourceURL(bundle, CFSTR("Background"), CFSTR("png"), 0); |
|
|
|
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h |
|
|
|
index aa8fffd..e6abf49 100644 |
|
|
|
--- a/src/plugins/platforms/cocoa/qcocoawindow.h |
|
|
|
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h |
|
|
|
@@ -217,7 +217,9 @@ public: |
|
|
|
Q_NOTIFICATION_HANDLER(NSWindowDidExitFullScreenNotification) void windowDidExitFullScreen(); |
|
|
|
Q_NOTIFICATION_HANDLER(NSWindowDidOrderOffScreenNotification) void windowDidOrderOffScreen(); |
|
|
|
Q_NOTIFICATION_HANDLER(NSWindowDidOrderOnScreenAndFinishAnimatingNotification) void windowDidOrderOnScreen(); |
|
|
|
+#if 0 |
|
|
|
Q_NOTIFICATION_HANDLER(NSWindowDidChangeOcclusionStateNotification) void windowDidChangeOcclusionState(); |
|
|
|
+#endif |
|
|
|
Q_NOTIFICATION_HANDLER(NSWindowDidChangeScreenNotification) void windowDidChangeScreen(); |
|
|
|
Q_NOTIFICATION_HANDLER(NSWindowWillCloseNotification) void windowWillClose(); |
|
|
|
|
|
|
|
@@ -316,6 +318,8 @@ public: // for QNSView |
|
|
|
bool m_viewIsEmbedded; // true if the m_view is actually embedded in a "foreign" NSView hiearchy |
|
|
|
bool m_viewIsToBeEmbedded; // true if the m_view is intended to be embedded in a "foreign" NSView hiearchy |
|
|
|
|
|
|
|
+ QCocoaWindow *m_parentCocoaWindow; |
|
|
|
+ |
|
|
|
Qt::WindowFlags m_windowFlags; |
|
|
|
Qt::WindowState m_lastReportedWindowState; |
|
|
|
Qt::WindowModality m_windowModality; |
|
|
|
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm |
|
|
|
index 86fd7b8..5d63dea 100644 |
|
|
|
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm |
|
|
|
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm |
|
|
|
@@ -325,7 +325,7 @@ static void qt_closePopups() |
|
|
|
+ (void)applicationActivationChanged:(NSNotification*)notification |
|
|
|
{ |
|
|
|
const id sender = self; |
|
|
|
- NSEnumerator<NSWindow*> *windowEnumerator = nullptr; |
|
|
|
+ NSEnumerator* windowEnumerator = nullptr; |
|
|
|
NSApplication *application = [NSApplication sharedApplication]; |
|
|
|
|
|
|
|
#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12) |
|
|
|
@@ -526,6 +526,7 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw, WId nativeHandle) |
|
|
|
, m_nsWindow(0) |
|
|
|
, m_viewIsEmbedded(false) |
|
|
|
, m_viewIsToBeEmbedded(false) |
|
|
|
+ , m_parentCocoaWindow(0) |
|
|
|
, m_lastReportedWindowState(Qt::WindowNoState) |
|
|
|
, m_windowModality(Qt::NonModal) |
|
|
|
, m_windowUnderMouse(false) |
|
|
|
@@ -594,10 +595,12 @@ QCocoaWindow::~QCocoaWindow() |
|
|
|
[m_nsWindow makeFirstResponder:nil]; |
|
|
|
[m_nsWindow setContentView:nil]; |
|
|
|
[m_nsWindow.helper detachFromPlatformWindow]; |
|
|
|
- if (m_view.window.parentWindow) |
|
|
|
- [m_view.window.parentWindow removeChildWindow:m_view.window]; |
|
|
|
- else if ([m_view superview]) |
|
|
|
+ if (m_view.window.parentWindow) { |
|
|
|
+ if (m_parentCocoaWindow) |
|
|
|
+ m_parentCocoaWindow->removeChildWindow(this); |
|
|
|
+ } else if ([m_view superview]) { |
|
|
|
[m_view removeFromSuperview]; |
|
|
|
+ } |
|
|
|
|
|
|
|
removeMonitor(); |
|
|
|
|
|
|
|
@@ -614,6 +617,7 @@ QCocoaWindow::~QCocoaWindow() |
|
|
|
|
|
|
|
foreachChildNSWindow(^(QCocoaWindow *childWindow) { |
|
|
|
[m_nsWindow removeChildWindow:childWindow->m_nsWindow]; |
|
|
|
+ childWindow->m_parentCocoaWindow = 0; |
|
|
|
}); |
|
|
|
|
|
|
|
[m_view release]; |
|
|
|
@@ -690,7 +694,7 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect) |
|
|
|
|
|
|
|
if (isChildNSWindow()) { |
|
|
|
QPlatformWindow::setGeometry(rect); |
|
|
|
- NSWindow *parentNSWindow = m_view.window.parentWindow; |
|
|
|
+ NSWindow *parentNSWindow = m_parentCocoaWindow->m_nsWindow; |
|
|
|
NSRect parentWindowFrame = [parentNSWindow contentRectForFrameRect:parentNSWindow.frame]; |
|
|
|
clipWindow(parentWindowFrame); |
|
|
|
|
|
|
|
@@ -744,7 +748,7 @@ void QCocoaWindow::clipWindow(const NSRect &clipRect) |
|
|
|
m_hiddenByClipping = false; |
|
|
|
if (!m_hiddenByAncestor) { |
|
|
|
[m_nsWindow orderFront:nil]; |
|
|
|
- static_cast<QCocoaWindow *>(QPlatformWindow::parent())->reinsertChildWindow(this); |
|
|
|
+ m_parentCocoaWindow->reinsertChildWindow(this); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@@ -781,7 +785,7 @@ void QCocoaWindow::show(bool becauseOfAncestor) |
|
|
|
if ([m_nsWindow isVisible]) |
|
|
|
return; |
|
|
|
|
|
|
|
- if (m_view.window.parentWindow && !m_view.window.parentWindow.visible) { |
|
|
|
+ if (m_parentCocoaWindow && ![m_parentCocoaWindow->m_nsWindow isVisible]) { |
|
|
|
m_hiddenByAncestor = true; // Parent still hidden, don't show now |
|
|
|
} else if ((becauseOfAncestor == m_hiddenByAncestor) // Was NEITHER explicitly hidden |
|
|
|
&& !m_hiddenByClipping) { // ... NOR clipped |
|
|
|
@@ -792,7 +796,7 @@ void QCocoaWindow::show(bool becauseOfAncestor) |
|
|
|
if (!m_hiddenByClipping) { // setCocoaGeometry() can change the clipping status |
|
|
|
[m_nsWindow orderFront:nil]; |
|
|
|
if (isChildNSWindow()) |
|
|
|
- static_cast<QCocoaWindow *>(QPlatformWindow::parent())->reinsertChildWindow(this); |
|
|
|
+ m_parentCocoaWindow->reinsertChildWindow(this); |
|
|
|
foreachChildNSWindow(^(QCocoaWindow *childWindow) { |
|
|
|
childWindow->show(true); |
|
|
|
}); |
|
|
|
@@ -854,12 +858,7 @@ void QCocoaWindow::setVisible(bool visible) |
|
|
|
applyWindowState(window()->windowState()); |
|
|
|
|
|
|
|
if (window()->windowState() != Qt::WindowMinimized) { |
|
|
|
- if ((window()->modality() == Qt::WindowModal |
|
|
|
- || window()->type() == Qt::Sheet) |
|
|
|
- && parentCocoaWindow) { |
|
|
|
- // show the window as a sheet |
|
|
|
- [parentCocoaWindow->m_nsWindow beginSheet:m_nsWindow completionHandler:nil]; |
|
|
|
- } else if (window()->modality() != Qt::NonModal) { |
|
|
|
+ if (window()->modality() != Qt::NonModal) { |
|
|
|
// show the window as application modal |
|
|
|
QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast<QCocoaEventDispatcher *>(QGuiApplication::instance()->eventDispatcher()); |
|
|
|
Q_ASSERT(cocoaEventDispatcher != 0); |
|
|
|
@@ -919,11 +918,6 @@ void QCocoaWindow::setVisible(bool visible) |
|
|
|
if (cocoaEventDispatcherPrivate) |
|
|
|
cocoaEventDispatcherPrivate->endModalSession(window()); |
|
|
|
m_hasModalSession = false; |
|
|
|
- } else { |
|
|
|
- if ([m_nsWindow isSheet]) { |
|
|
|
- Q_ASSERT_X(parentCocoaWindow, "QCocoaWindow", "Window modal dialog has no transient parent."); |
|
|
|
- [parentCocoaWindow->m_nsWindow endSheet:m_nsWindow]; |
|
|
|
- } |
|
|
|
} |
|
|
|
|
|
|
|
hide(); |
|
|
|
@@ -1190,7 +1184,7 @@ void QCocoaWindow::raise() |
|
|
|
// -[NSWindow orderFront:] doesn't work with attached windows. |
|
|
|
// The only solution is to remove and add the child window. |
|
|
|
// This will place it on top of all the other NSWindows. |
|
|
|
- NSWindow *parentNSWindow = m_view.window.parentWindow; |
|
|
|
+ NSWindow *parentNSWindow = m_parentCocoaWindow->m_nsWindow; |
|
|
|
[parentNSWindow removeChildWindow:m_nsWindow]; |
|
|
|
[parentNSWindow addChildWindow:m_nsWindow ordered:NSWindowAbove]; |
|
|
|
} else { |
|
|
|
@@ -1226,7 +1220,7 @@ void QCocoaWindow::lower() |
|
|
|
// The only solution is to remove and add all the child windows except this one. |
|
|
|
// This will keep the current window at the bottom while adding the others on top of it, |
|
|
|
// hopefully in the same order (this is not documented anywhere in the Cocoa documentation). |
|
|
|
- NSWindow *parentNSWindow = m_view.window.parentWindow; |
|
|
|
+ NSWindow *parentNSWindow = m_parentCocoaWindow->m_nsWindow; |
|
|
|
NSArray *children = [parentNSWindow.childWindows copy]; |
|
|
|
for (NSWindow *child in children) |
|
|
|
if (m_nsWindow != child) { |
|
|
|
@@ -1528,6 +1522,7 @@ void QCocoaWindow::windowDidOrderOnScreen() |
|
|
|
exposeWindow(); |
|
|
|
} |
|
|
|
|
|
|
|
+#if 0 |
|
|
|
void QCocoaWindow::windowDidChangeOcclusionState() |
|
|
|
{ |
|
|
|
// Several unit tests expect paint and/or expose events for windows that are |
|
|
|
@@ -1543,6 +1538,7 @@ void QCocoaWindow::windowDidChangeOcclusionState() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
+#endif |
|
|
|
|
|
|
|
void QCocoaWindow::windowDidChangeScreen() |
|
|
|
{ |
|
|
|
@@ -1698,14 +1694,15 @@ void QCocoaWindow::recreateWindowIfNeeded() |
|
|
|
|
|
|
|
qCDebug(lcQpaCocoaWindow) << "Reconfiguring NSWindow due to" << recreateReason; |
|
|
|
|
|
|
|
- QCocoaWindow *parentCocoaWindow = static_cast<QCocoaWindow *>(parentWindow); |
|
|
|
+ // FIXME: Replace member with direct parentWindow usage (possibly cast) |
|
|
|
+ m_parentCocoaWindow = static_cast<QCocoaWindow *>(parentWindow); |
|
|
|
|
|
|
|
if (shouldBeChildNSWindow) { |
|
|
|
QWindow *parentQWindow = parentWindow->window(); |
|
|
|
// Ensure that all parents in the hierarchy are also child NSWindows |
|
|
|
if (!parentQWindow->property("_q_platform_MacUseNSWindow").toBool()) { |
|
|
|
parentQWindow->setProperty("_q_platform_MacUseNSWindow", QVariant(true)); |
|
|
|
- parentCocoaWindow->recreateWindowIfNeeded(); |
|
|
|
+ m_parentCocoaWindow->recreateWindowIfNeeded(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@@ -1713,8 +1710,8 @@ void QCocoaWindow::recreateWindowIfNeeded() |
|
|
|
if ((isContentView() && !shouldBeContentView) || (recreateReason & PanelChanged)) { |
|
|
|
qCDebug(lcQpaCocoaWindow) << "Getting rid of existing window" << m_nsWindow; |
|
|
|
[m_nsWindow closeAndRelease]; |
|
|
|
- if (isChildNSWindow()) |
|
|
|
- [m_view.window.parentWindow removeChildWindow:m_view.window]; |
|
|
|
+ if (isChildNSWindow() && oldParentCocoaWindow) |
|
|
|
+ oldParentCocoaWindow->removeChildWindow(this); |
|
|
|
if (isContentView()) { |
|
|
|
// We explicitly disassociate m_view from the window's contentView, |
|
|
|
// as AppKit does not automatically do this in response to removing |
|
|
|
@@ -1730,9 +1727,9 @@ void QCocoaWindow::recreateWindowIfNeeded() |
|
|
|
if (noPreviousWindow) |
|
|
|
m_nsWindow = createNSWindow(shouldBeChildNSWindow, shouldBePanel); |
|
|
|
|
|
|
|
- if (m_view.window.parentWindow) { |
|
|
|
- if (!shouldBeChildNSWindow || (recreateReason & ParentChanged)) |
|
|
|
- [m_view.window.parentWindow removeChildWindow:m_view.window]; |
|
|
|
+ if (oldParentCocoaWindow) { |
|
|
|
+ if (!shouldBeChildNSWindow || oldParentCocoaWindow != m_parentCocoaWindow) |
|
|
|
+ oldParentCocoaWindow->removeChildWindow(this); |
|
|
|
m_forwardWindow = oldParentCocoaWindow; |
|
|
|
} |
|
|
|
|
|
|
|
@@ -1759,8 +1756,8 @@ void QCocoaWindow::recreateWindowIfNeeded() |
|
|
|
setWindowState(window()->windowState()); |
|
|
|
} else if (shouldBeChildNSWindow) { |
|
|
|
if (!m_hiddenByClipping) { |
|
|
|
- [parentCocoaWindow->m_nsWindow addChildWindow:m_nsWindow ordered:NSWindowAbove]; |
|
|
|
- parentCocoaWindow->reinsertChildWindow(this); |
|
|
|
+ [m_parentCocoaWindow->m_nsWindow addChildWindow:m_nsWindow ordered:NSWindowAbove]; |
|
|
|
+ m_parentCocoaWindow->reinsertChildWindow(this); |
|
|
|
} |
|
|
|
|
|
|
|
// Set properties after the window has been made a child NSWindow |
|
|
|
@@ -1771,7 +1768,7 @@ void QCocoaWindow::recreateWindowIfNeeded() |
|
|
|
if ([m_view superview]) |
|
|
|
[m_view removeFromSuperview]; |
|
|
|
|
|
|
|
- [parentCocoaWindow->m_view addSubview:m_view]; |
|
|
|
+ [m_parentCocoaWindow->m_view addSubview:m_view]; |
|
|
|
QRect rect = windowGeometry(); |
|
|
|
// Prevent setting a (0,0) window size; causes opengl context |
|
|
|
// "Invalid Drawable" warnings. |
|
|
|
@@ -1915,6 +1912,11 @@ bool QCocoaWindow::alwaysShowToolWindow() const |
|
|
|
return qt_mac_resolveOption(false, window(), "_q_macAlwaysShowToolWindow", ""); |
|
|
|
} |
|
|
|
|
|
|
|
+void QCocoaWindow::removeChildWindow(QCocoaWindow *child) |
|
|
|
+{ |
|
|
|
+ [m_nsWindow removeChildWindow:child->m_nsWindow]; |
|
|
|
+} |
|
|
|
+ |
|
|
|
void QCocoaWindow::removeMonitor() |
|
|
|
{ |
|
|
|
if (!monitor) |
|
|
|
@@ -2046,12 +2048,14 @@ Qt::WindowState QCocoaWindow::windowState() const |
|
|
|
// FIXME: Support compound states (Qt::WindowStates) |
|
|
|
|
|
|
|
NSWindow *window = m_view.window; |
|
|
|
+ /* |
|
|
|
if (window.miniaturized) |
|
|
|
return Qt::WindowMinimized; |
|
|
|
+ */ |
|
|
|
if (window.qt_fullScreen) |
|
|
|
return Qt::WindowFullScreen; |
|
|
|
- if ((window.zoomed && !isTransitioningToFullScreen()) |
|
|
|
- || (m_lastReportedWindowState == Qt::WindowMaximized && isTransitioningToFullScreen())) |
|
|
|
+ if (/*(window.zoomed && !isTransitioningToFullScreen()) |
|
|
|
+ ||*/ (m_lastReportedWindowState == Qt::WindowMaximized && isTransitioningToFullScreen())) |
|
|
|
return Qt::WindowMaximized; |
|
|
|
|
|
|
|
// Note: We do not report Qt::WindowActive, even if isActive() |
|
|
|
@@ -2181,7 +2185,6 @@ void QCocoaWindow::applyContentBorderThickness(NSWindow *window) |
|
|
|
if (!m_drawContentBorderGradient) { |
|
|
|
[window setStyleMask:[window styleMask] & ~NSTexturedBackgroundWindowMask]; |
|
|
|
[[[window contentView] superview] setNeedsDisplay:YES]; |
|
|
|
- window.titlebarAppearsTransparent = NO; |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
@@ -2206,7 +2209,6 @@ void QCocoaWindow::applyContentBorderThickness(NSWindow *window) |
|
|
|
int effectiveBottomContentBorderThickness = m_bottomContentBorderThickness; |
|
|
|
|
|
|
|
[window setStyleMask:[window styleMask] | NSTexturedBackgroundWindowMask]; |
|
|
|
- window.titlebarAppearsTransparent = YES; |
|
|
|
|
|
|
|
[window setContentBorderThickness:effectiveTopContentBorderThickness forEdge:NSMaxYEdge]; |
|
|
|
[window setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge]; |
|
|
|
diff --git a/src/printsupport/dialogs/qpagesetupdialog_mac.mm b/src/printsupport/dialogs/qpagesetupdialog_mac.mm |
|
|
|
index 1e39845..9305566 100644 |
|
|
|
--- a/src/printsupport/dialogs/qpagesetupdialog_mac.mm |
|
|
|
+++ b/src/printsupport/dialogs/qpagesetupdialog_mac.mm |
|
|
|
@@ -77,7 +77,7 @@ QT_USE_NAMESPACE |
|
|
|
QPageSetupDialog *dialog = static_cast<QPageSetupDialog *>(contextInfo); |
|
|
|
QPrinter *printer = dialog->printer(); |
|
|
|
|
|
|
|
- if (returnCode == NSModalResponseOK) { |
|
|
|
+ if (returnCode == NSOKButton) { |
|
|
|
PMPageFormat format = static_cast<PMPageFormat>([printInfo PMPageFormat]); |
|
|
|
PMRect paperRect; |
|
|
|
PMGetUnadjustedPaperRect(format, &paperRect); |
|
|
|
@@ -88,7 +88,7 @@ QT_USE_NAMESPACE |
|
|
|
printer->printEngine()->setProperty(QPrintEngine::PPK_Orientation, orientation == kPMLandscape ? QPrinter::Landscape : QPrinter::Portrait); |
|
|
|
} |
|
|
|
|
|
|
|
- dialog->done((returnCode == NSModalResponseOK) ? QDialog::Accepted : QDialog::Rejected); |
|
|
|
+ dialog->done((returnCode == NSOKButton) ? QDialog::Accepted : QDialog::Rejected); |
|
|
|
} |
|
|
|
@end |
|
|
|
|
|
|
|
diff --git a/src/printsupport/dialogs/qprintdialog_mac.mm b/src/printsupport/dialogs/qprintdialog_mac.mm |
|
|
|
index 8547799..f7bbb59 100644 |
|
|
|
--- a/src/printsupport/dialogs/qprintdialog_mac.mm |
|
|
|
+++ b/src/printsupport/dialogs/qprintdialog_mac.mm |
|
|
|
@@ -101,7 +101,7 @@ QT_USE_NAMESPACE |
|
|
|
QPrintDialog *dialog = static_cast<QPrintDialog *>(contextInfo); |
|
|
|
QPrinter *printer = dialog->printer(); |
|
|
|
|
|
|
|
- if (returnCode == NSModalResponseOK) { |
|
|
|
+ if (returnCode == NSOKButton) { |
|
|
|
PMPrintSession session = static_cast<PMPrintSession>([printInfo PMPrintSession]); |
|
|
|
PMPrintSettings settings = static_cast<PMPrintSettings>([printInfo PMPrintSettings]); |
|
|
|
|
|
|
|
@@ -190,7 +190,7 @@ QT_USE_NAMESPACE |
|
|
|
printer->setPageSize(pageSize); |
|
|
|
printer->setOrientation(orientation == kPMLandscape ? QPrinter::Landscape : QPrinter::Portrait); |
|
|
|
|
|
|
|
- dialog->done((returnCode == NSModalResponseOK) ? QDialog::Accepted : QDialog::Rejected); |
|
|
|
+ dialog->done((returnCode == NSOKButton) ? QDialog::Accepted : QDialog::Rejected); |
|
|
|
} |
|
|
|
@end |
|
|
|
|
|
|
|
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp |
|
|
|
index 4c5c9e1..5b4a95e 100644 |
|
|
|
--- a/src/testlib/qtestcase.cpp |
|
|
|
+++ b/src/testlib/qtestcase.cpp |
|
|
|
@@ -147,6 +147,7 @@ static bool debuggerPresent() |
|
|
|
return CFStringCompare(str1, str2, kCFCompareCaseInsensitive) == kCFCompareEqualTo; |
|
|
|
}; |
|
|
|
|
|
|
|
+#if 0 |
|
|
|
// Check if there is an exception handler for the process: |
|
|
|
mach_msg_type_number_t portCount = 0; |
|
|
|
exception_mask_t masks[EXC_TYPES_COUNT]; |
|
|
|
@@ -163,6 +164,7 @@ static bool debuggerPresent() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
+#endif |
|
|
|
|
|
|
|
// Ok, no debugger attached. So, let's see if CrashReporter will throw up a dialog. If so, we |
|
|
|
// leave it to the OS to do the stack trace. |
|
|
|
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm |
|
|
|
index e6436f8..db1878a 100644 |
|
|
|
--- a/src/widgets/styles/qmacstyle_mac.mm |
|
|
|
+++ b/src/widgets/styles/qmacstyle_mac.mm |
|
|
|
@@ -137,6 +137,21 @@ |
|
|
|
#include <qpa/qplatformtheme.h> |
|
|
|
#include <QtGui/private/qcoregraphics_p.h> |
|
|
|
|
|
|
|
+@interface NSGraphicsContext (QtAdditions) |
|
|
|
+ |
|
|
|
+ |
|
|
|
+@end |
|
|
|
+ |
|
|
|
+@implementation NSGraphicsContext (QtAdditions) |
|
|
|
+ |
|
|
|
+{ |
|
|
|
+ return [self graphicsContextWithGraphicsPort:graphicsPort flipped:initialFlippedState]; |
|
|
|
+} |
|
|
|
+ |
|
|
|
+@end |
|
|
|
+ |
|
|
|
QT_USE_NAMESPACE |
|
|
|
|
|
|
|
static QWindow *qt_getWindow(const QWidget *widget) |
|
|
|
@@ -1036,8 +1051,8 @@ void QMacStylePrivate::drawFocusRing(QPainter *p, const QRect &targetRect, int h |
|
|
|
CGContextSetAlpha(ctx, 0.5); // As applied to the stroke color below |
|
|
|
|
|
|
|
[NSGraphicsContext saveGraphicsState]; |
|
|
|
- [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithCGContext:ctx |
|
|
|
- flipped:NO]]; |
|
|
|
+ [NSGraphicsContext setCurrentContext:[NSGraphicsContext qt_graphicsContextWithCGContext:ctx |
|
|
|
+ flipped:NO]]; |
|
|
|
CGRect focusRingRect = CGRectMake(hMargin, vMargin, size, size); |
|
|
|
NSBezierPath *focusRingPath; |
|
|
|
if (radius > 0) { |