Fix breakage of tst_qquickwindow::grab(invisible)
Instead of waiting for -drawRect to call -setView on the NSOpenGLContext, we go ahead and attempt to set the context as soon as possible. If it is indeed required that we call -drawRect first then will try to call -setView again during -drawRect with the new NSOpenGLContext. Change-Id: I33d9f2ba241b49e8cfa6c9156dd5bf5e4cc6b164 Reviewed-by: Liang Qi <liang.qi@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
This commit is contained in:
parent
32f09caa35
commit
27cbb58a92
@ -70,8 +70,7 @@ QT_END_NAMESPACE
|
||||
Qt::KeyboardModifiers currentWheelModifiers;
|
||||
bool m_subscribesForGlobalFrameNotifications;
|
||||
QCocoaGLContext *m_glContext;
|
||||
bool m_glContextDirty;
|
||||
bool m_drawRectHasBeenCalled;
|
||||
bool m_shouldSetGLContextinDrawRect;
|
||||
}
|
||||
|
||||
- (id)init;
|
||||
|
@ -86,8 +86,7 @@ static QTouchDevice *touchDevice = 0;
|
||||
m_sendKeyEvent = false;
|
||||
m_subscribesForGlobalFrameNotifications = false;
|
||||
m_glContext = 0;
|
||||
m_glContextDirty = false;
|
||||
m_drawRectHasBeenCalled = false;
|
||||
m_shouldSetGLContextinDrawRect = false;
|
||||
currentCustomDragTypes = 0;
|
||||
m_sendUpAsRightButton = false;
|
||||
|
||||
@ -154,11 +153,12 @@ static QTouchDevice *touchDevice = 0;
|
||||
- (void) setQCocoaGLContext:(QCocoaGLContext *)context
|
||||
{
|
||||
m_glContext = context;
|
||||
if (m_drawRectHasBeenCalled) {
|
||||
[m_glContext->nsOpenGLContext() setView:self];
|
||||
} else {
|
||||
m_glContextDirty = true;
|
||||
[m_glContext->nsOpenGLContext() setView:self];
|
||||
if (![m_glContext->nsOpenGLContext() view]) {
|
||||
//was unable to set view
|
||||
m_shouldSetGLContextinDrawRect = true;
|
||||
}
|
||||
|
||||
if (!m_subscribesForGlobalFrameNotifications) {
|
||||
// NSOpenGLContext expects us to repaint (or update) the view when
|
||||
// it changes position on screen. Since this happens unnoticed for
|
||||
@ -352,11 +352,9 @@ static QTouchDevice *touchDevice = 0;
|
||||
|
||||
- (void) drawRect:(NSRect)dirtyRect
|
||||
{
|
||||
if (m_glContext && m_glContextDirty) {
|
||||
if (m_glContext && m_shouldSetGLContextinDrawRect) {
|
||||
[m_glContext->nsOpenGLContext() setView:self];
|
||||
m_glContextDirty = false;
|
||||
} else {
|
||||
m_drawRectHasBeenCalled = true;
|
||||
m_shouldSetGLContextinDrawRect = false;
|
||||
}
|
||||
|
||||
if (!m_backingStore)
|
||||
|
Loading…
Reference in New Issue
Block a user