summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-02-15 01:00:50 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-02-15 01:00:51 +0100
commitef2ddcf551dec13215cb45cb000731f94b2f8e34 (patch)
treec8810f6ee77a81c3003ccc8783c9d3b17f0b8a5e /src/plugins/platforms/cocoa
parente2cf6ade3535467bc2f21b54b82ed007d5ce279b (diff)
parent501cca2c4b0851cea7133ba56c3a05d71c25ce6d (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r--src/plugins/platforms/cocoa/qcocoascreen.mm5
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm6
-rw-r--r--src/plugins/platforms/cocoa/qnswindowdelegate.mm34
3 files changed, 5 insertions, 40 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoascreen.mm b/src/plugins/platforms/cocoa/qcocoascreen.mm
index 36c11ba8af..830a387fd1 100644
--- a/src/plugins/platforms/cocoa/qcocoascreen.mm
+++ b/src/plugins/platforms/cocoa/qcocoascreen.mm
@@ -269,15 +269,14 @@ struct DeferredDebugHelper
void QCocoaScreen::deliverUpdateRequests()
{
- if (!QGuiApplication::instance())
- return;
+ QMacAutoReleasePool pool;
// The CVDisplayLink callback is a notification that it's a good time to produce a new frame.
// Since the callback is delivered on a separate thread we have to marshal it over to the
// main thread, as Qt requires update requests to be delivered there. This needs to happen
// asynchronously, as otherwise we may end up deadlocking if the main thread calls back
// into any of the CVDisplayLink APIs.
- if (QThread::currentThread() != QGuiApplication::instance()->thread()) {
+ if (!NSThread.isMainThread) {
// We're explicitly not using the data of the GCD source to track the pending updates,
// as the data isn't reset to 0 until after the event handler, and also doesn't update
// during the event handler, both of which we need to track late frames.
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index bf0a1216be..6bedbb556d 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -1513,9 +1513,9 @@ void QCocoaWindow::deliverUpdateRequest()
void QCocoaWindow::requestActivateWindow()
{
- NSWindow *window = [m_view window];
- [window makeFirstResponder:m_view];
- [window makeKeyWindow];
+ QMacAutoReleasePool pool;
+ [m_view.window makeFirstResponder:m_view];
+ [m_view.window makeKeyWindow];
}
QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel)
diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm
index 14f1ca0114..087cb3651f 100644
--- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm
+++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm
@@ -102,40 +102,6 @@ static QCocoaWindow *toPlatformWindow(NSWindow *window)
return QCocoaScreen::mapToNative(maximizedFrame);
}
-#pragma clang diagnostic push
-// NSDisableScreenUpdates and NSEnableScreenUpdates are deprecated, but the
-// NSAnimationContext API that replaces them doesn't handle the use-case of
-// cross-thread screen update synchronization.
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
-- (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)frameSize
-{
- Q_ASSERT(toPlatformWindow(window));
-
- qCDebug(lcQpaWindow) << window << "will resize to" << QSizeF::fromCGSize(frameSize)
- << "- disabling screen updates temporarily";
-
- // There may be separate threads rendering to CA layers in this window,
- // and if any of them do a swap while the resize is still in progress,
- // the visual bounds of that layer will be updated before the visual
- // bounds of the window frame, resulting in flickering while resizing.
-
- // To prevent this we disable screen updates for the whole process until
- // the resize is complete, which makes the whole thing visually atomic.
- NSDisableScreenUpdates();
-
- return frameSize;
-}
-
-- (void)windowDidResize:(NSNotification *)notification
-{
- NSWindow *window = notification.object;
- Q_ASSERT(toPlatformWindow(window));
-
- qCDebug(lcQpaWindow) << window << "was resized - re-enabling screen updates";
- NSEnableScreenUpdates();
-}
-#pragma clang diagnostic pop
-
- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu
{
Q_UNUSED(menu);