diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-09-04 20:36:01 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-09-05 05:50:40 +0000 |
commit | 54c3ab7a1018ee2e5c1767d233e1c1d9e42425c7 (patch) | |
tree | 89afac3cd0af660ee5a2414ac751400e4b37b891 | |
parent | 67a075f485841838005b3ede86bd49b5430d4587 (diff) |
macOS: Fix support for issuing requestUpdate during expose event
AppKit will clear the needsDisplay state of a view when finishing the
display cycle, so if the client requested an update when delivering
the expose event, the update request would not be delivered unless
the view was otherwise exposed in some way at a later point.
Task-number: QTBUG-62964
Task-number: QTBUG-62963
Change-Id: I5ac9bf2f19af775294d093c8b7a414af22efee92
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index f75ee59142..16207d8de8 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -53,6 +53,7 @@ #include <QtCore/qsysinfo.h> #include <private/qguiapplication_p.h> #include <private/qcoregraphics_p.h> +#include <private/qwindow_p.h> #include "qcocoabackingstore.h" #ifndef QT_NO_OPENGL #include "qcocoaglcontext.h" @@ -332,6 +333,17 @@ static QTouchDevice *touchDevice = 0; #endif m_platformWindow->handleExposeEvent(exposedRegion); + + // A call to QWindow::requestUpdate was issued during the expose event, but + // AppKit will reset the needsDisplay state of the view after completing the + // current display cycle, so we need to defer the request to redisplay. + // FIXME: Perhaps this should be a trigger to enable CADisplayLink? + if (qt_window_private(m_platformWindow->window())->updateRequestPending) { + qCDebug(lcQpaCocoaWindow) << "[QNSView drawRect:] deferring setNeedsDisplay"; + dispatch_async(dispatch_get_main_queue (), ^{ + [self setNeedsDisplay:YES]; + }); + } } - (BOOL)wantsUpdateLayer |