diff options
26 files changed, 142 insertions, 56 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index b7ec1ec1a..78038500e 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -242,6 +242,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing * Overridden to choose a GraphicsConfiguration on a parent container's * GraphicsDevice because both devices */ + @Override public GraphicsConfiguration getGraphicsConfiguration() { /* * Workaround for problems with Xinerama and java.awt.Component.checkGD @@ -457,6 +458,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing <B>Overrides:</B> <DL><DD><CODE>paint</CODE> in class <CODE>java.awt.Component</CODE></DD></DL> */ + @Override public void paint(Graphics g) { if (Beans.isDesignTime()) { // Make GLCanvas behave better in NetBeans GUI builder @@ -492,6 +494,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing <B>Overrides:</B> <DL><DD><CODE>addNotify</CODE> in class <CODE>java.awt.Component</CODE></DD></DL> */ + @Override public void addNotify() { if(DEBUG) { Exception ex1 = new Exception(Thread.currentThread().getName()+" - Info: addNotify - start, bounds: "+this.getBounds()); @@ -576,6 +579,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing about this.</p> <B>Overrides:</B> <DL><DD><CODE>removeNotify</CODE> in class <CODE>java.awt.Component</CODE></DD></DL> */ + @Override public void removeNotify() { if(DEBUG) { Exception ex1 = new Exception(Thread.currentThread().getName()+" - Info: removeNotify - start"); @@ -610,6 +614,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing <B>Overrides:</B> <DL><DD><CODE>reshape</CODE> in class <CODE>java.awt.Component</CODE></DD></DL> */ + @Override public void reshape(int x, int y, int width, int height) { super.reshape(x, y, width, height); sendReshape = true; @@ -617,8 +622,11 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing /** <B>Overrides:</B> <DL><DD><CODE>update</CODE> in class <CODE>java.awt.Component</CODE></DD></DL> */ - // Overridden from Canvas to prevent the AWT's clearing of the - // canvas from interfering with the OpenGL rendering. + /** + * Overridden from Canvas to prevent the AWT's clearing of the + * canvas from interfering with the OpenGL rendering. + */ + @Override public void update(Graphics g) { paint(g); } @@ -659,14 +667,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing if (Beans.isDesignTime()) { return null; } - GLContext context = getContext(); - return (context == null) ? null : context.getGL(); + GLContext ctx = getContext(); + return (ctx == null) ? null : ctx.getGL(); } public GL setGL(GL gl) { - GLContext context = getContext(); - if (context != null) { - context.setGL(gl); + GLContext ctx = getContext(); + if (ctx != null) { + ctx.setGL(gl); return gl; } return null; @@ -732,6 +740,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } } + @Override public String toString() { return "AWT-GLCanvas[ "+awtConfig+", "+((null!=drawable)?drawable.getClass().getName():"null-drawable")+"]"; } @@ -922,8 +931,6 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing try { disableBackgroundEraseMethod.invoke(getToolkit(), new Object[] { this }); } catch (Exception e) { - // FIXME: workaround for 6504460 (incorrect backport of 6333613 in 5.0u10) - // throw new GLException(e); t = e; } if(DEBUG) { @@ -1013,7 +1020,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing glCanvas.addGLEventListener(new GLEventListener() { public void init(GLAutoDrawable drawable) { GL gl = drawable.getGL(); - System.err.println(JoglVersion.getInstance().getGLInfo(gl, null)); + System.err.println(JoglVersion.getGLInfo(gl, null)); } public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java index fe2b374a0..d079a1bd1 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java @@ -75,8 +75,9 @@ public class GLDrawableHelper { animatorCtrl = null; } + @Override public final String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("GLAnimatorControl: "+animatorCtrl+", "); synchronized(listenersLock) { sb.append("GLEventListeners num "+listeners.size()+" ["); @@ -149,7 +150,7 @@ public class GLDrawableHelper { } } - private final boolean init(GLEventListener l, GLAutoDrawable drawable, boolean sendReshape) { + private boolean init(GLEventListener l, GLAutoDrawable drawable, boolean sendReshape) { if(listenersToBeInit.remove(l)) { l.init(drawable); if(sendReshape) { @@ -194,7 +195,7 @@ public class GLDrawableHelper { execGLRunnables(drawable); } - private final void reshape(GLEventListener listener, GLAutoDrawable drawable, + private void reshape(GLEventListener listener, GLAutoDrawable drawable, int x, int y, int width, int height, boolean setViewport) { if(setViewport) { drawable.getGL().glViewport(x, y, width, height); @@ -212,7 +213,7 @@ public class GLDrawableHelper { } } - private final void execGLRunnables(GLAutoDrawable drawable) { + private void execGLRunnables(GLAutoDrawable drawable) { if(glRunnables.size()>0) { // swap one-shot list asap ArrayList _glRunnables = null; diff --git a/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java b/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java index d514b662d..3db8f32d2 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java +++ b/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java @@ -38,8 +38,6 @@ import java.lang.reflect.*; import javax.media.nativewindow.*; public class NativeWindowFactoryImpl extends NativeWindowFactory { - protected static final boolean DEBUG = Debug.debug("NativeWindow"); - private static final ToolkitLock nullToolkitLock = new NullToolkitLock(); public static ToolkitLock getNullToolkitLock() { @@ -96,14 +94,14 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory { windowClassName, new Class[] { Object.class, AbstractGraphicsConfiguration.class }, getClass().getClassLoader()); } catch (Exception e) { - throw (IllegalArgumentException) new IllegalArgumentException().initCause(e); + throw new IllegalArgumentException(e); } } try { return (NativeWindow) nativeWindowConstructor.newInstance(new Object[] { winObj, config }); } catch (Exception ie) { - throw (IllegalArgumentException) new IllegalArgumentException().initCause(ie); + throw new IllegalArgumentException(ie); } } } diff --git a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java index c3518ed85..834d8a703 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java +++ b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java @@ -40,28 +40,28 @@ import javax.swing.MenuSelectionManager; public class AWTMisc { - public static final JFrame getJFrame(Component c) { + public static JFrame getJFrame(Component c) { while (c != null && !(c instanceof JFrame)) { c = c.getParent(); } return (JFrame) c; } - public static final Frame getFrame(Component c) { + public static Frame getFrame(Component c) { while (c != null && !(c instanceof Frame)) { c = c.getParent(); } return (Frame) c; } - public static final Window getWindow(Component c) { + public static Window getWindow(Component c) { while (c != null && !(c instanceof Window)) { c = c.getParent(); } return (Window) c; } - public static final Container getContainer(Component c) { + public static Container getContainer(Component c) { while (c != null && !(c instanceof Container)) { c = c.getParent(); } @@ -71,11 +71,11 @@ public class AWTMisc { /** * Issue this when your non AWT toolkit gains focus to clear AWT menu path */ - public static final void clearAWTMenus() { + public static void clearAWTMenus() { MenuSelectionManager.defaultManager().clearSelectedPath(); } - public final static int AWT2NWClosingOperation(int awtClosingOperation) { + public static int AWT2NWClosingOperation(int awtClosingOperation) { switch (awtClosingOperation) { case WindowConstants.DISPOSE_ON_CLOSE: case WindowConstants.EXIT_ON_CLOSE: @@ -88,7 +88,7 @@ public class AWTMisc { } } - public final static int getNWClosingOperation(Component c) { + public static int getNWClosingOperation(Component c) { JFrame jf = getJFrame(c); int op = (null != jf) ? jf.getDefaultCloseOperation() : WindowConstants.DO_NOTHING_ON_CLOSE ; return AWT2NWClosingOperation(op); diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java index adbd0885f..1ac9e1709 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java @@ -43,8 +43,6 @@ import javax.media.nativewindow.NativeWindowFactory; import jogamp.nativewindow.NWJNILibLoader; import java.awt.Toolkit; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java index 781882f08..61be51b8a 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java @@ -68,7 +68,7 @@ public abstract class JAWTWindow implements NativeWindow { init((Component)comp); } - private final void init(Component windowObject) throws NativeWindowException { + private void init(Component windowObject) throws NativeWindowException { invalidate(); this.component = windowObject; validateNative(); diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWT_PlatformInfo.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWT_PlatformInfo.java index 11651ac15..40d7b8032 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWT_PlatformInfo.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWT_PlatformInfo.java @@ -39,8 +39,6 @@ package jogamp.nativewindow.jawt; -import jogamp.nativewindow.*; - /** Marker class for all window system-specific JAWT data structures. */ public interface JAWT_PlatformInfo { diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java index 612d571f2..982b94888 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java @@ -61,6 +61,7 @@ public class WindowsJAWTWindow extends JAWTWindow { protected void validateNative() throws NativeWindowException { } + @Override protected synchronized void invalidate() { super.invalidate(); windowHandle = 0; @@ -125,6 +126,7 @@ public class WindowsJAWTWindow extends JAWTWindow { win32dsi = null; } + @Override public long getWindowHandle() { return windowHandle; } diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java index 16f1046a7..afb3daf7c 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java +++ b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java @@ -40,5 +40,6 @@ public class RegisteredClass { public final long getHandle() { return hInstance; } public final String getName() { return className; } + @Override public final String toString() { return "RegisteredClass[handle 0x"+Long.toHexString(hInstance)+", "+className+"]"; } } diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java index 9154ab7d8..0eda5c2a3 100644 --- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java +++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java @@ -113,6 +113,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto FocusAction focusAction = new FocusAction(); WindowListener clearAWTMenusOnNewtFocus = new WindowAdapter() { + @Override public void windowGainedFocus(WindowEvent arg0) { MenuSelectionManager.defaultManager().clearSelectedPath(); } @@ -173,6 +174,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } } + @Override public void addNotify() { // before native peer is valid: X11 @@ -194,6 +196,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto reparentWindow(true, cont); } + @Override public void removeNotify() { java.awt.Container cont = AWTMisc.getContainer(this); if(DEBUG) { @@ -262,12 +265,14 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } } + @Override public void paint(Graphics g) { awtWindowClosingProtocol.addClosingListenerOneShot(); if(null!=newtChild) { newtChild.windowRepaint(0, 0, getWidth(), getHeight()); } } + @Override public void update(Graphics g) { awtWindowClosingProtocol.addClosingListenerOneShot(); if(null!=newtChild) { @@ -287,11 +292,13 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } } + @Override public void requestFocus() { requestFocusAWTParent(); requestFocusNEWTChild(); } + @Override public boolean requestFocus(boolean temporary) { boolean res = super.requestFocus(temporary); if(res) { @@ -300,6 +307,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto return res; } + @Override public boolean requestFocusInWindow() { boolean res = super.requestFocusInWindow(); if(res) { @@ -308,6 +316,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto return res; } + @Override public boolean requestFocusInWindow(boolean temporary) { boolean res = super.requestFocusInWindow(temporary); if(res) { @@ -358,8 +367,6 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto try { disableBackgroundEraseMethod.invoke(getToolkit(), new Object[] { this }); } catch (Exception e) { - // FIXME: workaround for 6504460 (incorrect backport of 6333613 in 5.0u10) - // throw new GLException(e); t = e; } if(DEBUG) { diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index fee188768..5eec746a8 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -75,12 +75,14 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer { this.window = (WindowImpl) window; ((WindowImpl)this.window).setHandleDestroyNotify(false); window.addWindowListener(new WindowAdapter() { + @Override public void windowRepaint(WindowUpdateEvent e) { if( !GLWindow.this.window.isWindowLockedByOtherThread() && !GLWindow.this.helper.isExternalAnimatorAnimating() ) { display(); } } + @Override public void windowResized(WindowEvent e) { sendReshape = true; if( !GLWindow.this.window.isWindowLockedByOtherThread() && !GLWindow.this.helper.isExternalAnimatorAnimating() ) { @@ -88,6 +90,7 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer { } } + @Override public void windowDestroyNotify(WindowEvent e) { if( DISPOSE_ON_CLOSE == GLWindow.this.getDefaultCloseOperation() ) { // Is an animator thread perform rendering? @@ -248,6 +251,7 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer { return window.isVisible(); } + @Override public final String toString() { return "NEWT-GLWindow[ \n\tHelper: " + helper + ", \n\tDrawable: " + drawable + ", \n\tContext: " + context + /** ", \n\tWindow: "+window+", \n\tFactory: "+factory+ */ "]"; @@ -314,7 +318,7 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer { public synchronized void destroyActionInLock() { if(Window.DEBUG_WINDOW_EVENT || Window.DEBUG_IMPLEMENTATION) { - String msg = new String("GLWindow.destroy() "+Thread.currentThread()+", start"); + String msg = "GLWindow.destroy() "+Thread.currentThread()+", start"; System.err.println(msg); //Exception e1 = new Exception(msg); //e1.printStackTrace(); @@ -343,7 +347,7 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer { public synchronized void invalidate(boolean unrecoverable) { if(Window.DEBUG_WINDOW_EVENT || Window.DEBUG_IMPLEMENTATION) { - String msg = new String("GLWindow.invalidate("+unrecoverable+") "+Thread.currentThread()+", start"); + String msg = "GLWindow.invalidate("+unrecoverable+") "+Thread.currentThread()+", start"; System.err.println(msg); //Exception e1 = new Exception(msg); //e1.printStackTrace(); @@ -366,7 +370,7 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer { public synchronized void setVisibleActionPost(boolean visible, boolean nativeWindowCreated) { if(Window.DEBUG_WINDOW_EVENT || Window.DEBUG_IMPLEMENTATION) { - String msg = new String("GLWindow.setVisibleActionPost("+visible+", "+nativeWindowCreated+") "+Thread.currentThread()+", start"); + String msg = "GLWindow.setVisibleActionPost("+visible+", "+nativeWindowCreated+") "+Thread.currentThread()+", start"; System.err.println(msg); // Exception e1 = new Exception(msg); // e1.printStackTrace(); @@ -393,7 +397,7 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer { context = drawable.createContext(sharedContext); } if(Window.DEBUG_WINDOW_EVENT || Window.DEBUG_IMPLEMENTATION) { - String msg = new String("GLWindow.setVisibleActionPost("+visible+", "+nativeWindowCreated+") "+Thread.currentThread()+", fin"); + String msg = "GLWindow.setVisibleActionPost("+visible+", "+nativeWindowCreated+") "+Thread.currentThread()+", fin"; System.err.println(msg); //Exception e1 = new Exception(msg); //e1.printStackTrace(); @@ -648,7 +652,7 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer { } /** Reset all counter (startTime, currentTime, frame number) */ - public synchronized void resetCounter() { + public final synchronized void resetCounter() { startTime = System.currentTimeMillis(); // overwrite startTime to real init one curTime = startTime; lastCheck = startTime; @@ -914,7 +918,7 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer { glWindow.addGLEventListener(new GLEventListener() { public void init(GLAutoDrawable drawable) { GL gl = drawable.getGL(); - System.err.println(JoglVersion.getInstance().getGLInfo(gl, null)); + System.err.println(JoglVersion.getGLInfo(gl, null)); } public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { diff --git a/src/newt/classes/jogamp/newt/DisplayImpl.java b/src/newt/classes/jogamp/newt/DisplayImpl.java index 0485c4603..83f4ca47c 100644 --- a/src/newt/classes/jogamp/newt/DisplayImpl.java +++ b/src/newt/classes/jogamp/newt/DisplayImpl.java @@ -108,6 +108,27 @@ public abstract class DisplayImpl extends Display { } } + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final DisplayImpl other = (DisplayImpl) obj; + if (this.id != other.id) { + return false; + } + if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { + return false; + } + if ((this.type == null) ? (other.type != null) : !this.type.equals(other.type)) { + return false; + } + return true; + } + public int hashCode() { return hashCode; } @@ -289,10 +310,10 @@ public abstract class DisplayImpl extends Display { return ( null == name ) ? nilString : name ; } - private static final String getFQName(String type, String name, int id) { + private static String getFQName(String type, String name, int id) { if(null==type) type=nilString; if(null==name) name=nilString; - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(type); sb.append("_"); sb.append(name); @@ -323,6 +344,7 @@ public abstract class DisplayImpl extends Display { return false; } + @Override public String toString() { return "NEWT-Display["+getFQName()+", refCount "+refCount+", hasEDT "+(null!=edtUtil)+", edtRunning "+isEDTRunning()+", "+aDevice+"]"; } diff --git a/src/newt/classes/jogamp/newt/OffscreenWindow.java b/src/newt/classes/jogamp/newt/OffscreenWindow.java index 1465e084c..a79b1a5a1 100644 --- a/src/newt/classes/jogamp/newt/OffscreenWindow.java +++ b/src/newt/classes/jogamp/newt/OffscreenWindow.java @@ -69,11 +69,13 @@ public class OffscreenWindow extends WindowImpl implements SurfaceChangeable { // nop } + @Override protected void invalidate(boolean unrecoverable) { super.invalidate(unrecoverable); surfaceHandle = 0; } + @Override public synchronized void destroy() { super.destroy(); surfaceHandle = 0; @@ -83,6 +85,7 @@ public class OffscreenWindow extends WindowImpl implements SurfaceChangeable { surfaceHandle = handle ; } + @Override public long getSurfaceHandle() { return surfaceHandle; } @@ -95,14 +98,17 @@ public class OffscreenWindow extends WindowImpl implements SurfaceChangeable { protected void requestFocusImpl(boolean reparented) { } + @Override public void setSize(int width, int height) { if(!visible) { sizeChanged(width, height, false); } } + @Override public void setPosition(int x, int y) { // nop } + @Override public boolean setFullscreen(boolean fullscreen) { // nop return false; @@ -112,6 +118,7 @@ public class OffscreenWindow extends WindowImpl implements SurfaceChangeable { return false; } + @Override public Point getLocationOnScreen(Point storage) { if(null!=storage) { storage.setX(0); diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java index e940512a3..065cd88eb 100644 --- a/src/newt/classes/jogamp/newt/ScreenImpl.java +++ b/src/newt/classes/jogamp/newt/ScreenImpl.java @@ -126,6 +126,24 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener { } } + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final ScreenImpl other = (ScreenImpl) obj; + if (this.display != other.display && (this.display == null || !this.display.equals(other.display))) { + return false; + } + if (this.screen_idx != other.screen_idx) { + return false; + } + return true; + } + public int hashCode() { return hashCode; } @@ -239,6 +257,7 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener { return (usrHeight>0) ? usrHeight : (height>0) ? height : 480; } + @Override public String toString() { return "NEWT-Screen["+getFQName()+", idx "+screen_idx+", refCount "+refCount+", "+getWidth()+"x"+getHeight()+", "+aScreen+", "+display+"]"; } diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 815fd705e..391f918cf 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -692,7 +692,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } if(DEBUG_IMPLEMENTATION) { - String msg = new String("Window setVisible: START ("+getThreadName()+") "+x+"/"+y+" "+width+"x"+height+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible: "+this.visible+" -> "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+(null!=parentWindow)/*+", "+this*/); + String msg = "Window setVisible: START ("+getThreadName()+") "+x+"/"+y+" "+width+"x"+height+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible: "+this.visible+" -> "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+(null!=parentWindow); System.err.println(msg); Thread.dumpStack(); } @@ -717,7 +717,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer try { if ( !fullscreen && ( width != WindowImpl.this.width || WindowImpl.this.height != height ) ) { if(DEBUG_IMPLEMENTATION) { - String msg = new String("Window setSize: START "+WindowImpl.this.width+"x"+WindowImpl.this.height+" -> "+width+"x"+height+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible "+visible); + String msg = "Window setSize: START "+WindowImpl.this.width+"x"+WindowImpl.this.height+" -> "+width+"x"+height+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible "+visible; System.err.println(msg); } if ( 0 != windowHandle && 0>=width*height && visible ) { @@ -803,7 +803,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer public void destroy() { if( isValid() ) { if(DEBUG_IMPLEMENTATION) { - String msg = new String("Window.destroy() START "+getThreadName()/*+", "+this*/); + String msg = "Window.destroy() START "+getThreadName(); System.err.println(msg); //Exception ee = new Exception(msg); //ee.printStackTrace(); @@ -839,7 +839,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer windowLock.lock(); try { if(DEBUG_IMPLEMENTATION || DEBUG_WINDOW_EVENT) { - String msg = new String("!!! Window Invalidate(unrecoverable: "+unrecoverable+") "+getThreadName()); + String msg = "!!! Window Invalidate(unrecoverable: "+unrecoverable+") "+getThreadName(); System.err.println(msg); // Throwable t = new Throwable(msg); // t.printStackTrace(); @@ -915,7 +915,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return reparentAction; } - private final void setScreen(ScreenImpl newScreen) { + private void setScreen(ScreenImpl newScreen) { WindowImpl.this.removeScreenReference(); screen = newScreen; } @@ -1381,8 +1381,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return parentWindowHandle; } + @Override public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(getClass().getName()+"[Config "+config+ "\n, "+screen+ @@ -1422,11 +1423,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } public void runOnEDTIfAvail(boolean wait, final Runnable task) { - Screen screen = getScreen(); - if(null==screen) { + Screen scrn = getScreen(); + if(null==scrn) { throw new RuntimeException("Null screen of inner class: "+this); } - DisplayImpl d = (DisplayImpl) screen.getDisplay(); + DisplayImpl d = (DisplayImpl) scrn.getDisplay(); d.runOnEDTIfAvail(wait, task); } @@ -2208,7 +2209,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } private static String getArgsStrList(Object[] args) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for(int i=0; i<args.length; i++) { sb.append(args[i].getClass()); if(i<args.length) { @@ -2219,7 +2220,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } private static String getTypeStrList(Class[] types) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for(int i=0; i<types.length; i++) { sb.append(types[i]); if(i<types.length) { diff --git a/src/newt/classes/jogamp/newt/awt/AWTEDTUtil.java b/src/newt/classes/jogamp/newt/awt/AWTEDTUtil.java index 914a73f4d..7b638af31 100644 --- a/src/newt/classes/jogamp/newt/awt/AWTEDTUtil.java +++ b/src/newt/classes/jogamp/newt/awt/AWTEDTUtil.java @@ -38,7 +38,7 @@ public class AWTEDTUtil implements EDTUtil { private static AWTEDTUtil singletonMainThread = new AWTEDTUtil(); // one singleton MainThread - public static final AWTEDTUtil getSingleton() { + public static AWTEDTUtil getSingleton() { return singletonMainThread; } diff --git a/src/newt/classes/jogamp/newt/awt/AWTWindow.java b/src/newt/classes/jogamp/newt/awt/AWTWindow.java index ae18fcfa6..b07a9e313 100644 --- a/src/newt/classes/jogamp/newt/awt/AWTWindow.java +++ b/src/newt/classes/jogamp/newt/awt/AWTWindow.java @@ -80,6 +80,7 @@ public class AWTWindow extends WindowImpl { container.requestFocus(); } + @Override protected void setTitleImpl(final String title) { if (frame != null) { frame.setTitle(title); @@ -141,6 +142,7 @@ public class AWTWindow extends WindowImpl { } } + @Override public boolean hasDeviceChanged() { boolean res = canvas.hasDeviceChanged(); if(res) { @@ -179,6 +181,7 @@ public class AWTWindow extends WindowImpl { } + @Override public javax.media.nativewindow.util.Insets getInsets() { final int insets[] = new int[] { 0, 0, 0, 0 }; Insets contInsets = container.getInsets(); @@ -217,17 +220,20 @@ public class AWTWindow extends WindowImpl { return new Point((int)(ap.getX()+0.5),(int)(ap.getY()+0.5)); } + @Override public Object getWrappedWindow() { return canvas; } class LocalWindowListener extends com.jogamp.newt.event.WindowAdapter { + @Override public void windowMoved(com.jogamp.newt.event.WindowEvent e) { if(null!=container) { x = container.getX(); y = container.getY(); } } + @Override public void windowResized(com.jogamp.newt.event.WindowEvent e) { if(null!=canvas) { width = canvas.getWidth(); diff --git a/src/newt/classes/jogamp/newt/awt/opengl/VersionApplet.java b/src/newt/classes/jogamp/newt/awt/opengl/VersionApplet.java index 7f234a0f8..18524d0ba 100644 --- a/src/newt/classes/jogamp/newt/awt/opengl/VersionApplet.java +++ b/src/newt/classes/jogamp/newt/awt/opengl/VersionApplet.java @@ -156,7 +156,7 @@ public class VersionApplet extends Applet { class GLInfo implements GLEventListener { public void init(GLAutoDrawable drawable) { GL gl = drawable.getGL(); - String s = JoglVersion.getInstance().getGLInfo(gl, null).toString(); + String s = JoglVersion.getGLInfo(gl, null).toString(); System.err.println(s); tareaVersion.append(s); } diff --git a/src/newt/classes/jogamp/newt/intel/gdl/Window.java b/src/newt/classes/jogamp/newt/intel/gdl/Window.java index 8ba861c7d..d6003beae 100644 --- a/src/newt/classes/jogamp/newt/intel/gdl/Window.java +++ b/src/newt/classes/jogamp/newt/intel/gdl/Window.java @@ -119,6 +119,7 @@ public class Window extends jogamp.newt.WindowImpl { ((Display)getScreen().getDisplay()).setFocus(this); } + @Override public final long getSurfaceHandle() { return surfaceHandle; } diff --git a/src/newt/classes/jogamp/newt/macosx/MacDisplay.java b/src/newt/classes/jogamp/newt/macosx/MacDisplay.java index e4639080e..49f2ff5d8 100644 --- a/src/newt/classes/jogamp/newt/macosx/MacDisplay.java +++ b/src/newt/classes/jogamp/newt/macosx/MacDisplay.java @@ -35,10 +35,8 @@ package jogamp.newt.macosx; import javax.media.nativewindow.*; import javax.media.nativewindow.macosx.*; -import com.jogamp.common.util.ReflectionUtil; import com.jogamp.newt.*; import jogamp.newt.*; -import com.jogamp.newt.util.EDTUtil; import com.jogamp.newt.util.MainThread; public class MacDisplay extends DisplayImpl { @@ -73,6 +71,7 @@ public class MacDisplay extends DisplayImpl { protected void closeNativeImpl() { } + @Override protected void createEDTUtil() { if(NewtFactory.useEDT()) { final Display f_dpy = this; diff --git a/src/newt/classes/jogamp/newt/macosx/MacWindow.java b/src/newt/classes/jogamp/newt/macosx/MacWindow.java index 62f0cf458..a27f04797 100644 --- a/src/newt/classes/jogamp/newt/macosx/MacWindow.java +++ b/src/newt/classes/jogamp/newt/macosx/MacWindow.java @@ -168,10 +168,12 @@ public class MacWindow extends WindowImpl { } } + @Override public final long getSurfaceHandle() { return surfaceHandle; } + @Override public Insets getInsets() { // in order to properly calculate insets we need the window to be // created @@ -186,11 +188,13 @@ public class MacWindow extends WindowImpl { private RecursiveLock nsViewLock = new RecursiveLock(); + @Override protected int lockSurfaceImpl() { nsViewLock.lock(); return LOCK_SUCCESS; } + @Override protected void unlockSurfaceImpl() { nsViewLock.unlock(); } @@ -214,6 +218,7 @@ public class MacWindow extends WindowImpl { } } + @Override protected void setTitleImpl(final String title) { // FIXME: move nsViewLock up to window lock nsViewLock.lock(); @@ -364,6 +369,7 @@ public class MacWindow extends WindowImpl { return keyChar; } + @Override public void enqueueKeyEvent(boolean wait, int eventType, int modifiers, int keyCode, char keyChar) { int key = convertKeyChar(keyChar); if(DEBUG_IMPLEMENTATION) System.err.println("MacWindow.enqueueKeyEvent "+Thread.currentThread().getName()); diff --git a/src/newt/classes/jogamp/newt/opengl/broadcom/egl/Window.java b/src/newt/classes/jogamp/newt/opengl/broadcom/egl/Window.java index 0db21c3be..9532178f3 100644 --- a/src/newt/classes/jogamp/newt/opengl/broadcom/egl/Window.java +++ b/src/newt/classes/jogamp/newt/opengl/broadcom/egl/Window.java @@ -120,6 +120,7 @@ public class Window extends jogamp.newt.WindowImpl { } + @Override public boolean surfaceSwap() { SwapWindow(getDisplayHandle(), getWindowHandle()); return true; diff --git a/src/newt/classes/jogamp/newt/opengl/kd/KDWindow.java b/src/newt/classes/jogamp/newt/opengl/kd/KDWindow.java index b902441d3..9cfa13cd9 100644 --- a/src/newt/classes/jogamp/newt/opengl/kd/KDWindow.java +++ b/src/newt/classes/jogamp/newt/opengl/kd/KDWindow.java @@ -134,6 +134,7 @@ public class KDWindow extends WindowImpl { windowUserData=userData; } + @Override protected void sizeChanged(int newWidth, int newHeight, boolean force) { if(fullscreen) { ((KDScreen)getScreen()).setScreenSize(width, height); diff --git a/src/newt/classes/jogamp/newt/windows/WindowsWindow.java b/src/newt/classes/jogamp/newt/windows/WindowsWindow.java index 05d169c5e..653de295d 100644 --- a/src/newt/classes/jogamp/newt/windows/WindowsWindow.java +++ b/src/newt/classes/jogamp/newt/windows/WindowsWindow.java @@ -55,6 +55,7 @@ public class WindowsWindow extends WindowImpl { public WindowsWindow() { } + @Override protected int lockSurfaceImpl() { if (0 != hdc) { throw new InternalError("surface not released"); @@ -64,6 +65,7 @@ public class WindowsWindow extends WindowImpl { return ( 0 != hdc ) ? LOCK_SUCCESS : LOCK_SURFACE_NOT_READY; } + @Override protected void unlockSurfaceImpl() { if (0 == hdc) { throw new InternalError("surface not acquired"); @@ -72,10 +74,12 @@ public class WindowsWindow extends WindowImpl { hdc=0; } + @Override public final long getSurfaceHandle() { return hdc; } + @Override public boolean hasDeviceChanged() { if(0!=getWindowHandle()) { long _hmon = MonitorFromWindow0(getWindowHandle()); @@ -158,10 +162,12 @@ public class WindowsWindow extends WindowImpl { requestFocus0(getWindowHandle(), force); } + @Override protected void setTitleImpl(final String title) { setTitle0(getWindowHandle(), title); } + @Override public Insets getInsets() { return (Insets)insets.clone(); } diff --git a/src/newt/classes/jogamp/newt/x11/X11Window.java b/src/newt/classes/jogamp/newt/x11/X11Window.java index 6f8eb0380..8f9455629 100644 --- a/src/newt/classes/jogamp/newt/x11/X11Window.java +++ b/src/newt/classes/jogamp/newt/x11/X11Window.java @@ -106,6 +106,7 @@ public class X11Window extends WindowImpl { requestFocus0(getDisplayHandle(), getWindowHandle(), force); } + @Override protected void setTitleImpl(String title) { setTitle0(getDisplayHandle(), getWindowHandle(), title); } diff --git a/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java b/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java index d31bf3421..e49679dc3 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java +++ b/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java @@ -37,7 +37,7 @@ public class DumpGLInfo implements GLEventListener { public void init(GLAutoDrawable drawable) { GL gl = drawable.getGL(); - System.err.println(JoglVersion.getInstance().getGLInfo(gl, null)); + System.err.println(JoglVersion.getGLInfo(gl, null)); } public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { |