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>
bb10
Tor Arne Vestbø 2017-09-04 20:36:01 +02:00 committed by Shawn Rutledge
parent 67a075f485
commit 54c3ab7a10
1 changed files with 12 additions and 0 deletions

View File

@ -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