From 89b09958ef1ad9cdc228517d2acaa0dc27aa559f Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Fri, 29 Jun 2012 03:59:22 +0200
Subject: Minor cleanup

---
 src/jogl/classes/javax/media/opengl/GLContext.java     |  7 ++-----
 src/jogl/classes/jogamp/opengl/GLDrawableHelper.java   |  8 ++++----
 .../jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java  | 18 ++++++++++--------
 3 files changed, 16 insertions(+), 17 deletions(-)

(limited to 'src/jogl')

diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index dfae76e73..bf6ee31df 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -52,7 +52,6 @@ import com.jogamp.common.util.locks.RecursiveLock;
 
 import jogamp.opengl.Debug;
 import jogamp.opengl.GLContextImpl;
-import jogamp.opengl.GLContextShareSet;
 
 /** Abstraction for an OpenGL rendering context. In order to perform
     OpenGL rendering, a context must be "made current" on the current
@@ -190,10 +189,8 @@ public abstract class GLContext {
    * a value of CONTEXT_NOT_CURRENT is returned.
    * </p>
    * <p>
-   * If the context is in use by another thread at the time of the
-   * call, then if isSynchronized() is true the call will
-   * block. If isSynchronized() is false, an exception will be
-   * thrown and the context will remain current on the other thread.
+   * This method is blocking, i.e. waits until another thread has
+   * released the context. 
    * </p>
    * <p>
    * The drawable's surface is being locked at entry
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
index c992b3cb2..e7651eaab 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
@@ -413,10 +413,10 @@ public class GLDrawableHelper {
   
     try {
       res = context.makeCurrent();
-      if (res != GLContext.CONTEXT_NOT_CURRENT) {
+      if (GLContext.CONTEXT_NOT_CURRENT != res) {
         if(!isDisposeAction) {
             perThreadInitAction.set(initAction);
-            if (res == GLContext.CONTEXT_CURRENT_NEW) {
+            if (GLContext.CONTEXT_CURRENT_NEW == res) {
               if (DEBUG) {
                 System.err.println("GLDrawableHelper " + this + ".invokeGL(): Running initAction");
               }
@@ -427,7 +427,7 @@ public class GLDrawableHelper {
                 drawable.swapBuffers();
             }
         } else {
-            if(res == GLContext.CONTEXT_CURRENT_NEW) {
+            if(GLContext.CONTEXT_CURRENT_NEW == res) {
                 throw new GLException(currentThread.getName()+" GLDrawableHelper " + this + ".invokeGL(): Dispose case (no init action given): Native context was not created (new ctx): "+context);
             }
             if(listeners.size()>0) {
@@ -439,7 +439,7 @@ public class GLDrawableHelper {
       try {
           if(isDisposeAction) {
               context.destroy();
-          } else if( res != GLContext.CONTEXT_NOT_CURRENT ) {
+          } else if( GLContext.CONTEXT_NOT_CURRENT != res ) {
               context.release();
           }
       } catch (Exception e) {
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java
index 734716677..9e22afa6d 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java
@@ -57,22 +57,24 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable {
     useGLXWindow=false;
   }
 
-  @SuppressWarnings("unused")
   @Override
   public long getHandle() {
-    if(USE_GLXWINDOW && useGLXWindow) {
-        return glXWindow;
+    if(USE_GLXWINDOW) {
+        if(useGLXWindow) {
+            return glXWindow;
+        }
     }
     return super.getHandle();
   }
 
-  @SuppressWarnings("unused")
   @Override
   protected void destroyHandle() {
-    if(USE_GLXWINDOW && 0!=glXWindow) {
-        GLX.glXDestroyWindow(getNativeSurface().getDisplayHandle(), glXWindow);
-        glXWindow = 0;
-        useGLXWindow=false;
+    if(USE_GLXWINDOW) {
+        if(0!=glXWindow) {
+            GLX.glXDestroyWindow(getNativeSurface().getDisplayHandle(), glXWindow);
+            glXWindow = 0;
+            useGLXWindow=false;
+        }
     }
   }
 
-- 
cgit v1.2.3