summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h3
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm18
2 files changed, 9 insertions, 12 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h
index 20e82940bd..85f72a4dbb 100644
--- a/src/plugins/platforms/cocoa/qnsview.h
+++ b/src/plugins/platforms/cocoa/qnsview.h
@@ -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;
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 3fbe06f555..6fd5cf59e1 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -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)