summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2014-11-18 16:10:51 +0000
committerMichael Meeks <michael.meeks@collabora.com>2014-11-18 16:11:38 +0000
commit0867564863457b3bb45af040e8ffa05b780a74e4 (patch)
treed848fd330a3c97c623543458973734d05c62d38d
parentba6af6f9d3048673f69fac41a0b61db316d16d03 (diff)
vcl: check the OpenGL drawable as well as the context.
Change-Id: Idac493dfb3239f7ae5b5e49158d79c4f3e707509
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index d30ac171da83..6267a9f0e517 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -1137,7 +1137,8 @@ SystemWindowData OpenGLContext::generateWinData(vcl::Window* pParent, bool)
void OpenGLContext::makeCurrent()
{
#if defined( WNT )
- if (wglGetCurrentContext() == m_aGLWin.hRC)
+ if (wglGetCurrentContext() == m_aGLWin.hRC &&
+ wglGetCurrentDC() == m_aGLWin.hDC)
{
SAL_INFO("vcl.opengl", "OpenGLContext::makeCurrent(): Avoid setting the same context");
}
@@ -1151,11 +1152,13 @@ void OpenGLContext::makeCurrent()
#elif defined( IOS ) || defined( ANDROID )
// nothing
#elif defined( UNX )
- if (glXGetCurrentContext() == m_aGLWin.ctx)
+ GLXDrawable nDrawable = mbPixmap ? m_aGLWin.glPix : m_aGLWin.win;
+ if (glXGetCurrentContext() == m_aGLWin.ctx &&
+ glXGetCurrentDrawable() == nDrawable)
{
SAL_INFO("vcl.opengl", "OpenGLContext::makeCurrent(): Avoid setting the same context");
}
- else if (!glXMakeCurrent( m_aGLWin.dpy, mbPixmap ? m_aGLWin.glPix : m_aGLWin.win, m_aGLWin.ctx ))
+ else if (!glXMakeCurrent( m_aGLWin.dpy, nDrawable, m_aGLWin.ctx ))
SAL_WARN("vcl.opengl", "OpenGLContext::makeCurrent failed");
#endif
}