1 diff --git a/src/gui/.obj/qcoregraphics.o b/src/gui/.obj/qcoregraphics.o
2 index 00f0647..2d1b7da 100644
3 Binary files a/src/gui/.obj/qcoregraphics.o and b/src/gui/.obj/qcoregraphics.o differ
4 diff --git a/src/gui/painting/qcoregraphics.mm b/src/gui/painting/qcoregraphics.mm
5 index c4fb8af..91875cd 100644
6 --- a/src/gui/painting/qcoregraphics.mm
7 +++ b/src/gui/painting/qcoregraphics.mm
9 #include <QtCore/qcoreapplication.h>
10 #include <QtCore/qoperatingsystemversion.h>
12 +@interface NSGraphicsContext (QtAdditions)
14 ++ (NSGraphicsContext *)qt_graphicsContextWithCGContext:(CGContextRef)graphicsPort flipped:(BOOL)initialFlippedState;
18 +@implementation NSGraphicsContext (QtAdditions)
20 ++ (NSGraphicsContext *)qt_graphicsContextWithCGContext:(CGContextRef)graphicsPort flipped:(BOOL)initialFlippedState
22 + return [self graphicsContextWithGraphicsPort:graphicsPort flipped:initialFlippedState];
29 // ---------------------- Images ----------------------
30 @@ -147,7 +162,7 @@ QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size)
31 QMacCGContext ctx(&pixmap);
34 - NSGraphicsContext *gc = [NSGraphicsContext graphicsContextWithCGContext:ctx flipped:YES];
35 + NSGraphicsContext *gc = [NSGraphicsContext qt_graphicsContextWithCGContext:ctx flipped:YES];
38 [NSGraphicsContext saveGraphicsState];
39 diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
40 index bac49cf..83b51cd 100644
41 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
42 +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
43 @@ -144,7 +144,7 @@ void QCocoaScreen::updateGeometry()
44 // The reference screen for the geometry is always the primary screen, but since
45 // we may be in the process of creating and registering the primary screen, we
46 // must special-case that and assign it direcly.
47 - QCocoaScreen *primaryScreen = (nsScreen == [[NSScreen screens] firstObject]) ?
48 + QCocoaScreen *primaryScreen = (nsScreen == [[NSScreen screens] objectAtIndex:0]) ?
49 this : static_cast<QCocoaScreen*>(QGuiApplication::primaryScreen()->handle());
51 m_geometry = primaryScreen->mapFromNative(m_geometry).toRect();
52 diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
53 index 56eb291..5d63dea 100644
54 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm
55 +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
56 @@ -858,12 +858,7 @@ void QCocoaWindow::setVisible(bool visible)
57 applyWindowState(window()->windowState());
59 if (window()->windowState() != Qt::WindowMinimized) {
60 - if ((window()->modality() == Qt::WindowModal
61 - || window()->type() == Qt::Sheet)
62 - && parentCocoaWindow) {
63 - // show the window as a sheet
64 - [parentCocoaWindow->m_nsWindow beginSheet:m_nsWindow completionHandler:nil];
65 - } else if (window()->modality() != Qt::NonModal) {
66 + if (window()->modality() != Qt::NonModal) {
67 // show the window as application modal
68 QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast<QCocoaEventDispatcher *>(QGuiApplication::instance()->eventDispatcher());
69 Q_ASSERT(cocoaEventDispatcher != 0);
70 @@ -923,11 +918,6 @@ void QCocoaWindow::setVisible(bool visible)
71 if (cocoaEventDispatcherPrivate)
72 cocoaEventDispatcherPrivate->endModalSession(window());
73 m_hasModalSession = false;
75 - if ([m_nsWindow isSheet]) {
76 - Q_ASSERT_X(parentCocoaWindow, "QCocoaWindow", "Window modal dialog has no transient parent.");
77 - [parentCocoaWindow->m_nsWindow endSheet:m_nsWindow];
82 diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
83 index e6436f8..db1878a 100644
84 --- a/src/widgets/styles/qmacstyle_mac.mm
85 +++ b/src/widgets/styles/qmacstyle_mac.mm
87 #include <qpa/qplatformtheme.h>
88 #include <QtGui/private/qcoregraphics_p.h>
90 +@interface NSGraphicsContext (QtAdditions)
92 ++ (NSGraphicsContext *)qt_graphicsContextWithCGContext:(CGContextRef)graphicsPort flipped:(BOOL)initialFlippedState;
96 +@implementation NSGraphicsContext (QtAdditions)
98 ++ (NSGraphicsContext *)qt_graphicsContextWithCGContext:(CGContextRef)graphicsPort flipped:(BOOL)initialFlippedState
100 + return [self graphicsContextWithGraphicsPort:graphicsPort flipped:initialFlippedState];
107 static QWindow *qt_getWindow(const QWidget *widget)
108 @@ -1036,8 +1051,8 @@ void QMacStylePrivate::drawFocusRing(QPainter *p, const QRect &targetRect, int h
109 CGContextSetAlpha(ctx, 0.5); // As applied to the stroke color below
111 [NSGraphicsContext saveGraphicsState];
112 - [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithCGContext:ctx
114 + [NSGraphicsContext setCurrentContext:[NSGraphicsContext qt_graphicsContextWithCGContext:ctx
116 CGRect focusRingRect = CGRectMake(hMargin, vMargin, size, size);
117 NSBezierPath *focusRingPath;