aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/sun/opengl/impl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/sun/opengl/impl')
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java33
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java31
2 files changed, 32 insertions, 32 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java
index 42b0f2a5f..84f32d43e 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java
@@ -296,7 +296,38 @@ public abstract class X11GLXContext extends GLContextImpl {
GLContextShareSet.contextCreated(this);
}
+ // Note: Usually the surface shall be locked within [makeCurrent .. swap .. release]
protected int makeCurrentImpl() throws GLException {
+ int lockRes = drawable.lockSurface();
+ boolean exceptionOccurred = false;
+ try {
+ if (lockRes == NativeWindow.LOCK_SURFACE_NOT_READY) {
+ return CONTEXT_NOT_CURRENT;
+ }
+ return makeCurrentImplAfterLock();
+ } catch (RuntimeException e) {
+ exceptionOccurred = true;
+ throw e;
+ } finally {
+ if (exceptionOccurred ||
+ (isOptimizable() && lockRes != NativeWindow.LOCK_SURFACE_NOT_READY) && drawable.isSurfaceLocked()) {
+ drawable.unlockSurface();
+ }
+ }
+ }
+
+ // Note: Usually the surface shall be locked within [makeCurrent .. swap .. release]
+ protected void releaseImpl() throws GLException {
+ try {
+ releaseImplAfterLock();
+ } finally {
+ if (!isOptimizable() && drawable.isSurfaceLocked()) {
+ drawable.unlockSurface();
+ }
+ }
+ }
+
+ protected int makeCurrentImplAfterLock() throws GLException {
getDrawableImpl().getFactoryImpl().lockToolkit();
try {
if (drawable.getNativeWindow().getSurfaceHandle() == 0) {
@@ -341,7 +372,7 @@ public abstract class X11GLXContext extends GLContextImpl {
}
}
- protected void releaseImpl() throws GLException {
+ protected void releaseImplAfterLock() throws GLException {
getDrawableImpl().getFactoryImpl().lockToolkit();
try {
if (!GLX.glXMakeContextCurrent(drawable.getNativeWindow().getDisplayHandle(), 0, 0, 0)) {
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java
index c37ddd49c..a73b41146 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java
+++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java
@@ -57,37 +57,6 @@ public class X11OnscreenGLXContext extends X11GLXContext {
super(drawable, shareWith);
}
- // Note: Usually the surface shall be locked within [makeCurrent .. swap .. release]
- protected int makeCurrentImpl() throws GLException {
- int lockRes = drawable.lockSurface();
- boolean exceptionOccurred = false;
- try {
- if (lockRes == NativeWindow.LOCK_SURFACE_NOT_READY) {
- return CONTEXT_NOT_CURRENT;
- }
- return super.makeCurrentImpl();
- } catch (RuntimeException e) {
- exceptionOccurred = true;
- throw e;
- } finally {
- if (exceptionOccurred ||
- (isOptimizable() && lockRes != NativeWindow.LOCK_SURFACE_NOT_READY) && drawable.isSurfaceLocked()) {
- drawable.unlockSurface();
- }
- }
- }
-
- // Note: Usually the surface shall be locked within [makeCurrent .. swap .. release]
- protected void releaseImpl() throws GLException {
- try {
- super.releaseImpl();
- } finally {
- if (!isOptimizable() && drawable.isSurfaceLocked()) {
- drawable.unlockSurface();
- }
- }
- }
-
public boolean isOptimizable() {
return super.isOptimizable() && !isIndirect;
}