[Libreoffice-commits] core.git: vcl/source

Michael Meeks michael.meeks at collabora.com
Tue Nov 18 08:12:21 PST 2014


 vcl/source/opengl/OpenGLContext.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 6f5a948612a541fff845cbef44e79adaf9c45793
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Tue Nov 18 16:10:51 2014 +0000

    vcl: check the OpenGL drawable as well as the context.
    
    Change-Id: Idac493dfb3239f7ae5b5e49158d79c4f3e707509

diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index d30ac17..6267a9f 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
 }


More information about the Libreoffice-commits mailing list