diff options
author | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
commit | 556d92b63555a085b25e32b1cd55afce24edd07a (patch) | |
tree | 6be2b02c62a77d5aba81ffbe34c46960608be163 /src/nativewindow/classes/jogamp | |
parent | a90f4a51dffec3247278e3c683ed4462b1dd9ab5 (diff) |
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
- Remove trailing white spaces on all lines
Diffstat (limited to 'src/nativewindow/classes/jogamp')
29 files changed, 205 insertions, 198 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/Debug.java b/src/nativewindow/classes/jogamp/nativewindow/Debug.java index b7197dbca..1c4874fba 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/Debug.java +++ b/src/nativewindow/classes/jogamp/nativewindow/Debug.java @@ -63,7 +63,7 @@ public class Debug extends PropertyAccess { verbose = isPropertyDefined("nativewindow.verbose", true); debugAll = isPropertyDefined("nativewindow.debug", true); if (verbose) { - Package p = Package.getPackage("javax.media.nativewindow"); + final Package p = Package.getPackage("javax.media.nativewindow"); System.err.println("NativeWindow specification version " + p.getSpecificationVersion()); System.err.println("NativeWindow implementation version " + p.getImplementationVersion()); System.err.println("NativeWindow implementation vendor " + p.getImplementationVendor()); @@ -81,7 +81,7 @@ public class Debug extends PropertyAccess { return debugAll; } - public static final boolean debug(String subcomponent) { + public static final boolean debug(final String subcomponent) { return debugAll() || isPropertyDefined("nativewindow.debug." + subcomponent, true); } } diff --git a/src/nativewindow/classes/jogamp/nativewindow/DefaultGraphicsConfigurationFactoryImpl.java b/src/nativewindow/classes/jogamp/nativewindow/DefaultGraphicsConfigurationFactoryImpl.java index 8fb819251..6061c4e79 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/DefaultGraphicsConfigurationFactoryImpl.java +++ b/src/nativewindow/classes/jogamp/nativewindow/DefaultGraphicsConfigurationFactoryImpl.java @@ -38,7 +38,7 @@ import javax.media.nativewindow.*; public class DefaultGraphicsConfigurationFactoryImpl extends GraphicsConfigurationFactory { @Override protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen screen, int nativeVisualID) { + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, final CapabilitiesChooser chooser, final AbstractGraphicsScreen screen, final int nativeVisualID) { return new DefaultGraphicsConfiguration(screen, capsChosen, capsRequested); } } diff --git a/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java b/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java index e6b68f87b..40fca0f7b 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java +++ b/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java @@ -52,7 +52,7 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory { // This subclass of NativeWindowFactory handles the case of // NativeWindows being passed in @Override - protected NativeWindow getNativeWindowImpl(Object winObj, AbstractGraphicsConfiguration config) throws IllegalArgumentException { + protected NativeWindow getNativeWindowImpl(final Object winObj, final AbstractGraphicsConfiguration config) throws IllegalArgumentException { if (winObj instanceof NativeWindow) { // Use the NativeWindow directly return (NativeWindow) winObj; @@ -73,7 +73,7 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory { private Constructor<?> nativeWindowConstructor = null; - private NativeWindow getAWTNativeWindow(Object winObj, AbstractGraphicsConfiguration config) { + private NativeWindow getAWTNativeWindow(final Object winObj, final AbstractGraphicsConfiguration config) { if (nativeWindowConstructor == null) { try { final String windowingType = getNativeWindowType(true); @@ -96,14 +96,14 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory { nativeWindowConstructor = ReflectionUtil.getConstructor( windowClassName, new Class[] { Object.class, AbstractGraphicsConfiguration.class }, true, getClass().getClassLoader()); - } catch (Exception e) { + } catch (final Exception e) { throw new IllegalArgumentException(e); } } try { return (NativeWindow) nativeWindowConstructor.newInstance(new Object[] { winObj, config }); - } catch (Exception ie) { + } catch (final Exception ie) { throw new IllegalArgumentException(ie); } } diff --git a/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java b/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java index 53daa2acd..deb685b51 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java +++ b/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java @@ -55,7 +55,7 @@ public abstract class ProxySurfaceImpl implements ProxySurface { * owns the {@link AbstractGraphicsConfiguration}'s {@link AbstractGraphicsDevice}, * otherwise <code>false</code>. Owning the device implies closing it at {@link #destroyNotify()}. */ - protected ProxySurfaceImpl(AbstractGraphicsConfiguration cfg, UpstreamSurfaceHook upstream, boolean ownsDevice) { + protected ProxySurfaceImpl(final AbstractGraphicsConfiguration cfg, final UpstreamSurfaceHook upstream, final boolean ownsDevice) { if(null == cfg) { throw new IllegalArgumentException("null AbstractGraphicsConfiguration"); } @@ -81,7 +81,7 @@ public abstract class ProxySurfaceImpl implements ProxySurface { public final UpstreamSurfaceHook getUpstreamSurfaceHook() { return upstream; } @Override - public void setUpstreamSurfaceHook(UpstreamSurfaceHook hook) { + public void setUpstreamSurfaceHook(final UpstreamSurfaceHook hook) { if(null == hook) { throw new IllegalArgumentException("null UpstreamSurfaceHook"); } @@ -89,7 +89,7 @@ public abstract class ProxySurfaceImpl implements ProxySurface { } @Override - public final void enableUpstreamSurfaceHookLifecycle(boolean enable) { + public final void enableUpstreamSurfaceHookLifecycle(final boolean enable) { upstreamSurfaceHookLifecycleEnabled = enable; } @@ -134,7 +134,7 @@ public abstract class ProxySurfaceImpl implements ProxySurface { } @Override - public final void setGraphicsConfiguration(AbstractGraphicsConfiguration cfg) { + public final void setGraphicsConfiguration(final AbstractGraphicsConfiguration cfg) { config = cfg; } @@ -165,22 +165,22 @@ public abstract class ProxySurfaceImpl implements ProxySurface { } @Override - public void addSurfaceUpdatedListener(SurfaceUpdatedListener l) { + public void addSurfaceUpdatedListener(final SurfaceUpdatedListener l) { surfaceUpdatedHelper.addSurfaceUpdatedListener(l); } @Override - public void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l) throws IndexOutOfBoundsException { + public void addSurfaceUpdatedListener(final int index, final SurfaceUpdatedListener l) throws IndexOutOfBoundsException { surfaceUpdatedHelper.addSurfaceUpdatedListener(index, l); } @Override - public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l) { + public void removeSurfaceUpdatedListener(final SurfaceUpdatedListener l) { surfaceUpdatedHelper.removeSurfaceUpdatedListener(l); } @Override - public void surfaceUpdated(Object updater, NativeSurface ns, long when) { + public void surfaceUpdated(final Object updater, final NativeSurface ns, final long when) { surfaceUpdatedHelper.surfaceUpdated(updater, ns, when); } @@ -287,15 +287,15 @@ public abstract class ProxySurfaceImpl implements ProxySurface { public final int getUpstreamOptionBits() { return implBitfield; } @Override - public final boolean containsUpstreamOptionBits(int v) { + public final boolean containsUpstreamOptionBits(final int v) { return v == ( implBitfield & v ) ; } @Override - public final void addUpstreamOptionBits(int v) { implBitfield |= v; } + public final void addUpstreamOptionBits(final int v) { implBitfield |= v; } @Override - public final void clearUpstreamOptionBits(int v) { implBitfield &= ~v; } + public final void clearUpstreamOptionBits(final int v) { implBitfield &= ~v; } @Override public StringBuilder toString(StringBuilder sink) { @@ -316,7 +316,7 @@ public abstract class ProxySurfaceImpl implements ProxySurface { @Override public String toString() { - StringBuilder msg = new StringBuilder(); + final StringBuilder msg = new StringBuilder(); msg.append(getClass().getSimpleName()).append("[ "); toString(msg); msg.append(" ]"); diff --git a/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java index 7b74e1f1f..d0174b2f5 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java +++ b/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java @@ -58,7 +58,7 @@ public class SharedResourceToolkitLock implements ToolkitLock { /** * @return number of unclosed EGL Displays.<br> */ - public static int shutdown(boolean verbose) { + public static int shutdown(final boolean verbose) { if(DEBUG || verbose || handle2Lock.size() > 0 ) { System.err.println("SharedResourceToolkitLock: Shutdown (open: "+handle2Lock.size()+")"); if(DEBUG) { @@ -74,13 +74,13 @@ public class SharedResourceToolkitLock implements ToolkitLock { public static void dumpOpenDisplayConnections() { System.err.println("SharedResourceToolkitLock: Open ResourceToolkitLock's: "+handle2Lock.size()); int i=0; - for(Iterator<LongObjectHashMap.Entry> iter = handle2Lock.iterator(); iter.hasNext(); i++) { + for(final Iterator<LongObjectHashMap.Entry> iter = handle2Lock.iterator(); iter.hasNext(); i++) { final LongObjectHashMap.Entry e = iter.next(); System.err.println("SharedResourceToolkitLock: Open["+i+"]: "+e.value); } } - public static final SharedResourceToolkitLock get(long handle) { + public static final SharedResourceToolkitLock get(final long handle) { SharedResourceToolkitLock res; synchronized(handle2Lock) { res = (SharedResourceToolkitLock) handle2Lock.get(handle); @@ -101,7 +101,7 @@ public class SharedResourceToolkitLock implements ToolkitLock { private final long handle; private volatile int refCount; - private SharedResourceToolkitLock(long handle) { + private SharedResourceToolkitLock(final long handle) { this.lock = LockFactory.createRecursiveLock(); this.handle = handle; this.refCount = 0; diff --git a/src/nativewindow/classes/jogamp/nativewindow/SurfaceScaleUtils.java b/src/nativewindow/classes/jogamp/nativewindow/SurfaceScaleUtils.java index 3aea58852..73413cf59 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/SurfaceScaleUtils.java +++ b/src/nativewindow/classes/jogamp/nativewindow/SurfaceScaleUtils.java @@ -62,7 +62,7 @@ public class SurfaceScaleUtils { * @param DEBUG_PREFIX if set, dumps debug info on stderr using this prefix * @return true if pixelScale has changed, otherwise false */ - public static boolean computePixelScale(int[] result, final int[] prePixelScale, final int[] reqPixelScale, final int[] newPixelScaleRaw, final String DEBUG_PREFIX) { + public static boolean computePixelScale(final int[] result, final int[] prePixelScale, final int[] reqPixelScale, final int[] newPixelScaleRaw, final String DEBUG_PREFIX) { final int newPixelScaleSafeX = 0 < newPixelScaleRaw[0] ? newPixelScaleRaw[0] : ScalableSurface.IDENTITY_PIXELSCALE; final int newPixelScaleSafeY = 0 < newPixelScaleRaw[1] ? newPixelScaleRaw[1] : ScalableSurface.IDENTITY_PIXELSCALE; final boolean useHiDPI = ScalableSurface.IDENTITY_PIXELSCALE != reqPixelScale[0] || ScalableSurface.IDENTITY_PIXELSCALE != reqPixelScale[1]; diff --git a/src/nativewindow/classes/jogamp/nativewindow/SurfaceUpdatedHelper.java b/src/nativewindow/classes/jogamp/nativewindow/SurfaceUpdatedHelper.java index 0b033955e..a7e136f76 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/SurfaceUpdatedHelper.java +++ b/src/nativewindow/classes/jogamp/nativewindow/SurfaceUpdatedHelper.java @@ -42,17 +42,17 @@ public class SurfaceUpdatedHelper implements SurfaceUpdatedListener { // Management Utils // public final int size() { return surfaceUpdatedListeners.size(); } - public final SurfaceUpdatedListener get(int i) { return surfaceUpdatedListeners.get(i); } + public final SurfaceUpdatedListener get(final int i) { return surfaceUpdatedListeners.get(i); } // // Implementation of NativeSurface SurfaceUpdatedListener methods // - public final void addSurfaceUpdatedListener(SurfaceUpdatedListener l) { + public final void addSurfaceUpdatedListener(final SurfaceUpdatedListener l) { addSurfaceUpdatedListener(-1, l); } - public final void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l) + public final void addSurfaceUpdatedListener(int index, final SurfaceUpdatedListener l) throws IndexOutOfBoundsException { if(l == null) { @@ -67,7 +67,7 @@ public class SurfaceUpdatedHelper implements SurfaceUpdatedListener { } } - public final boolean removeSurfaceUpdatedListener(SurfaceUpdatedListener l) { + public final boolean removeSurfaceUpdatedListener(final SurfaceUpdatedListener l) { if (l == null) { return false; } @@ -79,7 +79,7 @@ public class SurfaceUpdatedHelper implements SurfaceUpdatedListener { } @Override - public final void surfaceUpdated(Object updater, NativeSurface ns, long when) { + public final void surfaceUpdated(final Object updater, final NativeSurface ns, final long when) { if( isEmpty ) { return; } diff --git a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java index 752057a49..d3439b53f 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java +++ b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java @@ -57,7 +57,7 @@ public class WrappedSurface extends ProxySurfaceImpl implements ScalableSurface * owns the {@link AbstractGraphicsConfiguration}'s {@link AbstractGraphicsDevice}, * otherwise <code>false</code>. Owning the device implies closing it at {@link #destroyNotify()}. */ - public WrappedSurface(AbstractGraphicsConfiguration cfg, long handle, int initialWidth, int initialHeight, boolean ownsDevice) { + public WrappedSurface(final AbstractGraphicsConfiguration cfg, final long handle, final int initialWidth, final int initialHeight, final boolean ownsDevice) { super(cfg, new UpstreamSurfaceHookMutableSize(initialWidth, initialHeight), ownsDevice); surfaceHandle=handle; } @@ -70,7 +70,7 @@ public class WrappedSurface extends ProxySurfaceImpl implements ScalableSurface * owns the {@link AbstractGraphicsConfiguration}'s {@link AbstractGraphicsDevice}, * otherwise <code>false</code>. */ - public WrappedSurface(AbstractGraphicsConfiguration cfg, long handle, UpstreamSurfaceHook upstream, boolean ownsDevice) { + public WrappedSurface(final AbstractGraphicsConfiguration cfg, final long handle, final UpstreamSurfaceHook upstream, final boolean ownsDevice) { super(cfg, upstream, ownsDevice); surfaceHandle=handle; } @@ -88,7 +88,7 @@ public class WrappedSurface extends ProxySurfaceImpl implements ScalableSurface } @Override - public final void setSurfaceHandle(long surfaceHandle) { + public final void setSurfaceHandle(final long surfaceHandle) { this.surfaceHandle=surfaceHandle; } diff --git a/src/nativewindow/classes/jogamp/nativewindow/WrappedWindow.java b/src/nativewindow/classes/jogamp/nativewindow/WrappedWindow.java index 949243b0d..fd39a3b4a 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/WrappedWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/WrappedWindow.java @@ -32,10 +32,10 @@ public class WrappedWindow extends WrappedSurface implements NativeWindow { * owns the {@link AbstractGraphicsConfiguration}'s {@link AbstractGraphicsDevice}, * otherwise <code>false</code>. Owning the device implies closing it at {@link #destroyNotify()}. */ - public WrappedWindow(AbstractGraphicsConfiguration cfg, long surfaceHandle, - int initialWinX, int initialWinY, int initialWinWidth, int initialWinHeight, - int initialPixelWidth, int initialPixelHeight, - boolean ownsDevice, long windowHandle) { + public WrappedWindow(final AbstractGraphicsConfiguration cfg, final long surfaceHandle, + final int initialWinX, final int initialWinY, final int initialWinWidth, final int initialWinHeight, + final int initialPixelWidth, final int initialPixelHeight, + final boolean ownsDevice, final long windowHandle) { this(cfg, surfaceHandle, new UpstreamWindowHookMutableSizePos(initialWinX, initialWinY, initialWinWidth, initialWinHeight, initialPixelWidth, initialPixelHeight), @@ -50,7 +50,7 @@ public class WrappedWindow extends WrappedSurface implements NativeWindow { * owns the {@link AbstractGraphicsConfiguration}'s {@link AbstractGraphicsDevice}, * otherwise <code>false</code>. */ - public WrappedWindow(AbstractGraphicsConfiguration cfg, long surfaceHandle, UpstreamWindowHookMutableSizePos upstream, boolean ownsDevice, long windowHandle) { + public WrappedWindow(final AbstractGraphicsConfiguration cfg, final long surfaceHandle, final UpstreamWindowHookMutableSizePos upstream, final boolean ownsDevice, final long windowHandle) { super(cfg, surfaceHandle, upstream, ownsDevice); this.windowHandle = windowHandle; } @@ -105,7 +105,7 @@ public class WrappedWindow extends WrappedSurface implements NativeWindow { } @Override - public Point getLocationOnScreen(Point point) { + public Point getLocationOnScreen(final Point point) { if(null!=point) { return point; } else { diff --git a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java index b2067c143..b0eda63b6 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java +++ b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java @@ -95,7 +95,7 @@ public class AWTMisc { * @param topLevelOnly if true only returns insets of top-level components, i.e. Window and JRootPanel, * otherwise for JComponent as well. */ - public static Insets getInsets(Component c, boolean topLevelOnly) { + public static Insets getInsets(final Component c, final boolean topLevelOnly) { if( c instanceof Window ) { return ((Window)c).getInsets(); } @@ -119,7 +119,7 @@ public class AWTMisc { public void run(Component c); } - public static int performAction(Container c, Class<?> cType, ComponentAction action) { + public static int performAction(final Container c, final Class<?> cType, final ComponentAction action) { int count = 0; final int cc = c.getComponentCount(); for(int i=0; i<cc; i++) { @@ -147,7 +147,7 @@ public class AWTMisc { * @param forward if true, returns the next focus component, otherwise the previous one. * @return */ - public static Component getNextFocus(Component comp, boolean forward) { + public static Component getNextFocus(Component comp, final boolean forward) { Container focusContainer = comp.getFocusCycleRootAncestor(); while ( focusContainer != null && ( !focusContainer.isShowing() || !focusContainer.isFocusable() || !focusContainer.isEnabled() ) ) @@ -182,7 +182,7 @@ public class AWTMisc { final Toolkit toolkit = Toolkit.getDefaultToolkit(); final BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_4BYTE_ABGR); _nulCursor = toolkit.createCustomCursor(img, new Point(0,0), "nullCursor"); - } catch (Exception he) { + } catch (final Exception he) { if( JAWTUtil.DEBUG ) { System.err.println("Caught exception: "+he.getMessage()); he.printStackTrace(); @@ -194,7 +194,7 @@ public class AWTMisc { public static synchronized Cursor getNullCursor() { return nulCursor; } - public static synchronized Cursor getCursor(PixelRectangle pixelrect, Point hotSpot) { + public static synchronized Cursor getCursor(final PixelRectangle pixelrect, final Point hotSpot) { // 31 * x == (x << 5) - x int hash = 31 + pixelrect.hashCode(); hash = ((hash << 5) - hash) + hotSpot.hashCode(); @@ -207,12 +207,12 @@ public class AWTMisc { } return cursor; } - private static synchronized Cursor createCursor(PixelRectangle pixelrect, Point hotSpot) { + private static synchronized Cursor createCursor(final PixelRectangle pixelrect, final Point hotSpot) { final int width = pixelrect.getSize().getWidth(); final int height = pixelrect.getSize().getHeight(); final BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); // PixelFormat.BGRA8888 final PixelFormatUtil.PixelSink32 imgSink = new PixelFormatUtil.PixelSink32() { - public void store(int x, int y, int pixel) { + public void store(final int x, final int y, final int pixel) { img.setRGB(x, y, pixel); } @Override @@ -233,7 +233,7 @@ public class AWTMisc { return toolkit.createCustomCursor(img, hotSpot, pixelrect.toString()); } - public static WindowClosingProtocol.WindowClosingMode AWT2NWClosingOperation(int awtClosingOperation) { + public static WindowClosingProtocol.WindowClosingMode AWT2NWClosingOperation(final int awtClosingOperation) { switch (awtClosingOperation) { case WindowConstants.DISPOSE_ON_CLOSE: case WindowConstants.EXIT_ON_CLOSE: @@ -246,7 +246,7 @@ public class AWTMisc { } } - public static WindowClosingProtocol.WindowClosingMode getNWClosingOperation(Component c) { + public static WindowClosingProtocol.WindowClosingMode getNWClosingOperation(final Component c) { final JFrame jf = getJFrame(c); final 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 a5da41424..8aaffbd84 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java @@ -64,7 +64,7 @@ public class JAWTJNILibLoader extends NWJNILibLoader { if ( NativeWindowFactory.TYPE_MACOSX != NativeWindowFactory.getNativeWindowType(false) ) { try { loadLibrary("jawt", null, true, JAWTJNILibLoader.class.getClassLoader()); - } catch (Throwable t) { + } catch (final Throwable t) { // It might be ok .. if it's already loaded if(DEBUG) { t.printStackTrace(); diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java index 49b941698..231a89c26 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java @@ -53,9 +53,12 @@ import javax.media.nativewindow.NativeWindowException; import javax.media.nativewindow.NativeWindowFactory; import javax.media.nativewindow.ToolkitLock; +import jogamp.common.os.PlatformPropsImpl; import jogamp.nativewindow.Debug; +import jogamp.nativewindow.NWJNILibLoader; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.VersionNumber; import com.jogamp.common.util.locks.LockFactory; import com.jogamp.common.util.locks.RecursiveLock; @@ -105,16 +108,16 @@ public class JAWTUtil { * Returns true if this platform's JAWT implementation supports offscreen layer. */ public static boolean isOffscreenLayerSupported() { - return Platform.OS_TYPE == Platform.OSType.MACOS && - Platform.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0; + return PlatformPropsImpl.OS_TYPE == Platform.OSType.MACOS && + PlatformPropsImpl.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0; } /** * Returns true if this platform's JAWT implementation requires using offscreen layer. */ public static boolean isOffscreenLayerRequired() { - return Platform.OS_TYPE == Platform.OSType.MACOS && - Platform.JAVA_VERSION_NUMBER.compareTo(JAWT_MacOSXCALayerRequiredForJavaVersion)>=0; + return PlatformPropsImpl.OS_TYPE == Platform.OSType.MACOS && + PlatformPropsImpl.JAVA_VERSION_NUMBER.compareTo(JAWT_MacOSXCALayerRequiredForJavaVersion)>=0; } /** @@ -218,14 +221,14 @@ public class JAWTUtil { */ public static int getOSXCALayerQuirks() { int res = 0; - if( Platform.OS_TYPE == Platform.OSType.MACOS && - Platform.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0 ) { + if( PlatformPropsImpl.OS_TYPE == Platform.OSType.MACOS && + PlatformPropsImpl.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0 ) { /** Knowing impl. all expose the SIZE bug */ res |= JAWT_OSX_CALAYER_QUIRK_SIZE; - final int c = Platform.JAVA_VERSION_NUMBER.compareTo(Platform.Version17); - if( c < 0 || c == 0 && Platform.JAVA_VERSION_UPDATE < 40 ) { + final int c = PlatformPropsImpl.JAVA_VERSION_NUMBER.compareTo(PlatformPropsImpl.Version17); + if( c < 0 || c == 0 && PlatformPropsImpl.JAVA_VERSION_UPDATE < 40 ) { res |= JAWT_OSX_CALAYER_QUIRK_POSITION; } else { res |= JAWT_OSX_CALAYER_QUIRK_LAYOUT; @@ -238,9 +241,9 @@ public class JAWTUtil { * @param useOffscreenLayerIfAvailable * @return */ - public static JAWT getJAWT(boolean useOffscreenLayerIfAvailable) { + public static JAWT getJAWT(final boolean useOffscreenLayerIfAvailable) { final int jawt_version_flags = JAWTFactory.JAWT_VERSION_1_4; - JAWT jawt = JAWT.create(); + final JAWT jawt = JAWT.create(); // default queries boolean tryOffscreenLayer; @@ -248,24 +251,24 @@ public class JAWTUtil { int jawt_version_flags_offscreen = jawt_version_flags; if(isOffscreenLayerRequired()) { - if(Platform.OS_TYPE == Platform.OSType.MACOS) { - if(Platform.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0) { + if(PlatformPropsImpl.OS_TYPE == Platform.OSType.MACOS) { + if(PlatformPropsImpl.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0) { jawt_version_flags_offscreen |= JAWTUtil.JAWT_MACOSX_USE_CALAYER; tryOffscreenLayer = true; tryOnscreen = false; } else { - throw new RuntimeException("OSX: Invalid version of Java ("+Platform.JAVA_VERSION_NUMBER+") / OS X ("+Platform.OS_VERSION_NUMBER+")"); + throw new RuntimeException("OSX: Invalid version of Java ("+PlatformPropsImpl.JAVA_VERSION_NUMBER+") / OS X ("+PlatformPropsImpl.OS_VERSION_NUMBER+")"); } } else { - throw new InternalError("offscreen required, but n/a for: "+Platform.OS_TYPE); + throw new InternalError("offscreen required, but n/a for: "+PlatformPropsImpl.OS_TYPE); } } else if(useOffscreenLayerIfAvailable && isOffscreenLayerSupported()) { - if(Platform.OS_TYPE == Platform.OSType.MACOS) { + if(PlatformPropsImpl.OS_TYPE == Platform.OSType.MACOS) { jawt_version_flags_offscreen |= JAWTUtil.JAWT_MACOSX_USE_CALAYER; tryOffscreenLayer = true; tryOnscreen = true; } else { - throw new InternalError("offscreen requested and supported, but n/a for: "+Platform.OS_TYPE); + throw new InternalError("offscreen requested and supported, but n/a for: "+PlatformPropsImpl.OS_TYPE); } } else { tryOffscreenLayer = false; @@ -275,7 +278,7 @@ public class JAWTUtil { System.err.println("JAWTUtil.getJAWT(tryOffscreenLayer "+tryOffscreenLayer+", tryOnscreen "+tryOnscreen+")"); } - StringBuilder errsb = new StringBuilder(); + final StringBuilder errsb = new StringBuilder(); if(tryOffscreenLayer) { errsb.append("Offscreen 0x").append(Integer.toHexString(jawt_version_flags_offscreen)); if( JAWT.getJAWT(jawt, jawt_version_flags_offscreen) ) { @@ -294,12 +297,12 @@ public class JAWTUtil { throw new RuntimeException("Unable to initialize JAWT, trials: "+errsb.toString()); } - public static boolean isJAWTUsingOffscreenLayer(JAWT jawt) { + public static boolean isJAWTUsingOffscreenLayer(final JAWT jawt) { return 0 != ( jawt.getCachedVersion() & JAWTUtil.JAWT_MACOSX_USE_CALAYER ); } static { - SKIP_AWT_HIDPI = Debug.isPropertyDefined("nativewindow.awt.nohidpi", true); + SKIP_AWT_HIDPI = PropertyAccess.isPropertyDefined("nativewindow.awt.nohidpi", true); if(DEBUG) { System.err.println("JAWTUtil initialization (JAWT/JNI/...); SKIP_AWT_HIDPI "+SKIP_AWT_HIDPI); @@ -321,7 +324,7 @@ public class JAWTUtil { } else { // Non-headless case JAWTJNILibLoader.initSingleton(); // load libjawt.so - if(!JAWTJNILibLoader.loadNativeWindow("awt")) { // load libnativewindow_awt.so + if(!NWJNILibLoader.loadNativeWindow("awt")) { // load libnativewindow_awt.so throw new NativeWindowException("NativeWindow AWT native library load error."); } jawtLockObject = getJAWT(false); // don't care for offscreen layer here @@ -333,15 +336,15 @@ public class JAWTUtil { java2DClass = Class.forName("jogamp.opengl.awt.Java2D"); isQueueFlusherThreadTmp = java2DClass.getMethod("isQueueFlusherThread", (Class[])null); j2dExistTmp = true; - } catch (Exception e) { + } catch (final Exception e) { } isQueueFlusherThread = isQueueFlusherThreadTmp; j2dExist = j2dExistTmp; - PrivilegedDataBlob1 pdb1 = (PrivilegedDataBlob1) AccessController.doPrivileged(new PrivilegedAction<Object>() { + final PrivilegedDataBlob1 pdb1 = (PrivilegedDataBlob1) AccessController.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { - PrivilegedDataBlob1 d = new PrivilegedDataBlob1(); + final PrivilegedDataBlob1 d = new PrivilegedDataBlob1(); try { final Class<?> sunToolkitClass = Class.forName("sun.awt.SunToolkit"); d.sunToolkitAWTLockMethod = sunToolkitClass.getDeclaredMethod("awtLock", new Class[]{}); @@ -349,14 +352,14 @@ public class JAWTUtil { d.sunToolkitAWTUnlockMethod = sunToolkitClass.getDeclaredMethod("awtUnlock", new Class[]{}); d.sunToolkitAWTUnlockMethod.setAccessible(true); d.ok=true; - } catch (Exception e) { + } catch (final Exception e) { // Either not a Sun JDK or the interfaces have changed since 1.4.2 / 1.5 } try { - GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); + final GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); d.getScaleFactorMethod = gd.getClass().getDeclaredMethod("getScaleFactor"); d.getScaleFactorMethod.setAccessible(true); - } catch (Throwable t) {} + } catch (final Throwable t) {} return d; } }); @@ -370,7 +373,7 @@ public class JAWTUtil { sunToolkitAWTLockMethod.invoke(null, (Object[])null); sunToolkitAWTUnlockMethod.invoke(null, (Object[])null); _hasSunToolkitAWTLock = true; - } catch (Exception e) { + } catch (final Exception e) { } } hasSunToolkitAWTLock = _hasSunToolkitAWTLock; @@ -412,7 +415,7 @@ public class JAWTUtil { EventQueue.invokeAndWait(new Runnable() { @Override public void run() { - Map<?,?> _desktophints = (Map<?,?>)(Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints")); + final Map<?,?> _desktophints = (Map<?,?>)(Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints")); if(null!=_desktophints) { desktophintsBucket.add(_desktophints); } @@ -420,9 +423,9 @@ public class JAWTUtil { }); desktophints = ( desktophintsBucket.size() > 0 ) ? desktophintsBucket.get(0) : null ; } - } catch (InterruptedException ex) { + } catch (final InterruptedException ex) { ex.printStackTrace(); - } catch (InvocationTargetException ex) { + } catch (final InvocationTargetException ex) { ex.printStackTrace(); } @@ -430,7 +433,7 @@ public class JAWTUtil { System.err.println("JAWTUtil: Has sun.awt.SunToolkit.awtLock/awtUnlock " + hasSunToolkitAWTLock); System.err.println("JAWTUtil: Has Java2D " + j2dExist); System.err.println("JAWTUtil: Is headless " + headlessMode); - int hints = ( null != desktophints ) ? desktophints.size() : 0 ; + final int hints = ( null != desktophints ) ? desktophints.size() : 0 ; System.err.println("JAWTUtil: AWT Desktop hints " + hints); System.err.println("JAWTUtil: OffscreenLayer Supported: "+isOffscreenLayerSupported()+" - Required "+isOffscreenLayerRequired()); } @@ -458,7 +461,7 @@ public class JAWTUtil { if(j2dExist) { try { b = ((Boolean)isQueueFlusherThread.invoke(null, (Object[])null)).booleanValue(); - } catch (Exception e) {} + } catch (final Exception e) {} } return b; } @@ -484,7 +487,7 @@ public class JAWTUtil { if(hasSunToolkitAWTLock) { try { sunToolkitAWTLockMethod.invoke(null, (Object[])null); - } catch (Exception e) { + } catch (final Exception e) { throw new NativeWindowException("SunToolkit.awtLock failed", e); } } else { @@ -513,7 +516,7 @@ public class JAWTUtil { if(hasSunToolkitAWTLock) { try { sunToolkitAWTUnlockMethod.invoke(null, (Object[])null); - } catch (Exception e) { + } catch (final Exception e) { throw new NativeWindowException("SunToolkit.awtUnlock failed", e); } } else { @@ -552,7 +555,7 @@ public class JAWTUtil { if (res instanceof Integer) { return ((Integer)res).intValue(); } - } catch (Throwable t) {} + } catch (final Throwable t) {} } } return 1; diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java index e64525fbe..fae8db52a 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java @@ -47,11 +47,13 @@ import java.security.PrivilegedAction; import javax.media.nativewindow.AbstractGraphicsConfiguration; import javax.media.nativewindow.Capabilities; +import javax.media.nativewindow.NativeSurface; import javax.media.nativewindow.NativeWindow; import javax.media.nativewindow.NativeWindowException; import javax.media.nativewindow.MutableSurface; import javax.media.nativewindow.util.Point; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.nativewindow.awt.JAWTWindow; import jogamp.nativewindow.Debug; @@ -70,10 +72,10 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { static { Debug.initSingleton(); - DEBUG_CALAYER_POS_CRITICAL = Debug.isPropertyDefined("nativewindow.debug.JAWT.OSXCALayerPos", true /* jnlpAlias */); + DEBUG_CALAYER_POS_CRITICAL = PropertyAccess.isPropertyDefined("nativewindow.debug.JAWT.OSXCALayerPos", true /* jnlpAlias */); } - public MacOSXJAWTWindow(Object comp, AbstractGraphicsConfiguration config) { + public MacOSXJAWTWindow(final Object comp, final AbstractGraphicsConfiguration config) { super(comp, config); if(DEBUG) { dumpInfo(); @@ -170,7 +172,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { } @Override - protected void layoutSurfaceLayerImpl(long layerHandle, boolean visible) { + protected void layoutSurfaceLayerImpl(final long layerHandle, final boolean visible) { final int caLayerQuirks = JAWTUtil.getOSXCALayerQuirks(); // AWT position is top-left w/ insets, where CALayer position is bottom/left from root CALayer w/o insets. // Determine p0: components location on screen w/o insets. @@ -223,7 +225,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { } @Override - public void setSurfaceHandle(long surfaceHandle) { + public void setSurfaceHandle(final long surfaceHandle) { if( !isOffscreenLayerSurfaceEnabled() ) { throw new java.lang.UnsupportedOperationException("Not using CALAYER"); } @@ -242,14 +244,14 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { @Override protected int lockSurfaceImpl() throws NativeWindowException { - int ret = NativeWindow.LOCK_SURFACE_NOT_READY; + int ret = NativeSurface.LOCK_SURFACE_NOT_READY; ds = getJAWT().GetDrawingSurface(component); if (ds == null) { // Widget not yet realized unlockSurfaceImpl(); - return NativeWindow.LOCK_SURFACE_NOT_READY; + return NativeSurface.LOCK_SURFACE_NOT_READY; } - int res = ds.Lock(); + final int res = ds.Lock(); dsLocked = ( 0 == ( res & JAWTFactory.JAWT_LOCK_ERROR ) ) ; if (!dsLocked) { unlockSurfaceImpl(); @@ -261,7 +263,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { // conditions can cause this code to be triggered -- should test // more) if ((res & JAWTFactory.JAWT_LOCK_SURFACE_CHANGED) != 0) { - ret = NativeWindow.LOCK_SURFACE_CHANGED; + ret = NativeSurface.LOCK_SURFACE_CHANGED; } if (firstLock) { AccessController.doPrivileged(new PrivilegedAction<Object>() { @@ -276,7 +278,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { } if (dsi == null) { unlockSurfaceImpl(); - return NativeWindow.LOCK_SURFACE_NOT_READY; + return NativeSurface.LOCK_SURFACE_NOT_READY; } updateLockedData(dsi.getBounds()); if (DEBUG && firstLock ) { @@ -287,16 +289,16 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { macosxdsi = (JAWT_MacOSXDrawingSurfaceInfo) dsi.platformInfo(getJAWT()); if (macosxdsi == null) { unlockSurfaceImpl(); - return NativeWindow.LOCK_SURFACE_NOT_READY; + return NativeSurface.LOCK_SURFACE_NOT_READY; } drawable = macosxdsi.getCocoaViewRef(); if (drawable == 0) { unlockSurfaceImpl(); - return NativeWindow.LOCK_SURFACE_NOT_READY; + return NativeSurface.LOCK_SURFACE_NOT_READY; } else { windowHandle = OSXUtil.GetNSWindow(drawable); - ret = NativeWindow.LOCK_SUCCESS; + ret = NativeSurface.LOCK_SUCCESS; } } else { /** @@ -337,7 +339,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { } else { try { SetJAWTRootSurfaceLayer0(jawtSurfaceLayersHandle, rootSurfaceLayer); - } catch(Exception e) { + } catch(final Exception e) { errMsg = "Could not set JAWT rootSurfaceLayerHandle "+toHexString(rootSurfaceLayer)+", cause: "+e.getMessage(); } } @@ -360,7 +362,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { unlockSurfaceImpl(); throw new NativeWindowException(errMsg+": "+this); } - ret = NativeWindow.LOCK_SUCCESS; + ret = NativeSurface.LOCK_SUCCESS; } return ret; diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java index 8b9dfabfd..ce39db79c 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java @@ -75,7 +75,7 @@ public class Win32SunJDKReflection { win32GraphicsConfigGetVisualMethod = win32GraphicsConfigClass.getDeclaredMethod("getVisual", new Class[] {}); win32GraphicsConfigGetVisualMethod.setAccessible(true); initted = true; - } catch (Exception e) { + } catch (final Exception e) { // Either not a Sun JDK or the interfaces have changed since 1.4.2 / 1.5 } return null; @@ -83,37 +83,37 @@ public class Win32SunJDKReflection { }); } - public static GraphicsConfiguration graphicsConfigurationGet(GraphicsDevice device, int pfdID) { + public static GraphicsConfiguration graphicsConfigurationGet(final GraphicsDevice device, final int pfdID) { if (!initted) { return null; } try { return (GraphicsConfiguration) win32GraphicsConfigGetConfigMethod.invoke(null, new Object[] { device, new Integer(pfdID) }); - } catch (Exception e) { + } catch (final Exception e) { return null; } } - public static int graphicsConfigurationGetPixelFormatID(AbstractGraphicsConfiguration config) { + public static int graphicsConfigurationGetPixelFormatID(final AbstractGraphicsConfiguration config) { try { if (config instanceof AWTGraphicsConfiguration) { return graphicsConfigurationGetPixelFormatID(((AWTGraphicsConfiguration) config).getAWTGraphicsConfiguration()); } return 0; - } catch (Exception e) { + } catch (final Exception e) { return 0; } } - public static int graphicsConfigurationGetPixelFormatID(GraphicsConfiguration config) { + public static int graphicsConfigurationGetPixelFormatID(final GraphicsConfiguration config) { if (!initted) { return 0; } try { return ((Integer) win32GraphicsConfigGetVisualMethod.invoke(config, (Object[])null)).intValue(); - } catch (Exception e) { + } catch (final Exception e) { return 0; } } diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java index 90688258d..7ad914e0a 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java @@ -41,6 +41,7 @@ package jogamp.nativewindow.jawt.windows; import javax.media.nativewindow.AbstractGraphicsConfiguration; +import javax.media.nativewindow.NativeSurface; import javax.media.nativewindow.NativeWindow; import javax.media.nativewindow.NativeWindowException; import javax.media.nativewindow.util.Point; @@ -56,7 +57,7 @@ import jogamp.nativewindow.windows.GDIUtil; public class WindowsJAWTWindow extends JAWTWindow { - public WindowsJAWTWindow(Object comp, AbstractGraphicsConfiguration config) { + public WindowsJAWTWindow(final Object comp, final AbstractGraphicsConfiguration config) { super(comp, config); } @@ -72,14 +73,14 @@ public class WindowsJAWTWindow extends JAWTWindow { @Override protected int lockSurfaceImpl() throws NativeWindowException { - int ret = NativeWindow.LOCK_SUCCESS; + int ret = NativeSurface.LOCK_SUCCESS; ds = getJAWT().GetDrawingSurface(component); if (ds == null) { // Widget not yet realized unlockSurfaceImpl(); return LOCK_SURFACE_NOT_READY; } - int res = ds.Lock(); + final int res = ds.Lock(); dsLocked = ( 0 == ( res & JAWTFactory.JAWT_LOCK_ERROR ) ) ; if (!dsLocked) { unlockSurfaceImpl(); @@ -136,7 +137,7 @@ public class WindowsJAWTWindow extends JAWTWindow { } @Override - protected Point getLocationOnScreenNativeImpl(int x, int y) { + protected Point getLocationOnScreenNativeImpl(final int x, final int y) { return GDIUtil.GetRelativeLocation( getWindowHandle(), 0 /*root win*/, x, y); } diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java index b5a519fcc..9abaed731 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java @@ -38,6 +38,7 @@ package jogamp.nativewindow.jawt.x11; import javax.media.nativewindow.AbstractGraphicsConfiguration; +import javax.media.nativewindow.NativeSurface; import javax.media.nativewindow.NativeWindow; import javax.media.nativewindow.NativeWindowException; import javax.media.nativewindow.util.Point; @@ -53,7 +54,7 @@ import jogamp.nativewindow.x11.X11Lib; public class X11JAWTWindow extends JAWTWindow { - public X11JAWTWindow(Object comp, AbstractGraphicsConfiguration config) { + public X11JAWTWindow(final Object comp, final AbstractGraphicsConfiguration config) { super(comp, config); } @@ -67,14 +68,14 @@ public class X11JAWTWindow extends JAWTWindow { @Override protected int lockSurfaceImpl() throws NativeWindowException { - int ret = NativeWindow.LOCK_SUCCESS; + int ret = NativeSurface.LOCK_SUCCESS; ds = getJAWT().GetDrawingSurface(component); if (ds == null) { // Widget not yet realized unlockSurfaceImpl(); return LOCK_SURFACE_NOT_READY; } - int res = ds.Lock(); + final int res = ds.Lock(); dsLocked = ( 0 == ( res & JAWTFactory.JAWT_LOCK_ERROR ) ) ; if (!dsLocked) { unlockSurfaceImpl(); @@ -124,7 +125,7 @@ public class X11JAWTWindow extends JAWTWindow { } @Override - protected Point getLocationOnScreenNativeImpl(int x, int y) { + protected Point getLocationOnScreenNativeImpl(final int x, final int y) { // surface is locked and hence the device return X11Lib.GetRelativeLocation(getDisplayHandle(), getScreenIndex(), getWindowHandle(), 0 /*root win*/, x, y); } diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java index b2c3a931b..fea1be11a 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java @@ -76,7 +76,7 @@ public class X11SunJDKReflection { x11GraphicsConfigGetVisualMethod = x11GraphicsConfigClass.getDeclaredMethod("getVisual", new Class[] {}); x11GraphicsConfigGetVisualMethod.setAccessible(true); initialized = true; - } catch (Exception e) { + } catch (final Exception e) { // Either not a Sun JDK or the interfaces have changed since 1.4.2 / 1.5 } return null; @@ -84,37 +84,37 @@ public class X11SunJDKReflection { }); } - public static long graphicsDeviceGetDisplay(GraphicsDevice device) { + public static long graphicsDeviceGetDisplay(final GraphicsDevice device) { if (!initialized) { return 0; } try { return ((Long) x11GraphicsDeviceGetDisplayMethod.invoke(device, (Object[])null)).longValue(); - } catch (Exception e) { + } catch (final Exception e) { return 0; } } - public static int graphicsConfigurationGetVisualID(AbstractGraphicsConfiguration config) { + public static int graphicsConfigurationGetVisualID(final AbstractGraphicsConfiguration config) { try { if (config instanceof AWTGraphicsConfiguration) { return graphicsConfigurationGetVisualID(((AWTGraphicsConfiguration) config).getAWTGraphicsConfiguration()); } return 0; - } catch (Exception e) { + } catch (final Exception e) { return 0; } } - public static int graphicsConfigurationGetVisualID(GraphicsConfiguration config) { + public static int graphicsConfigurationGetVisualID(final GraphicsConfiguration config) { if (!initialized) { return 0; } try { return ((Integer) x11GraphicsConfigGetVisualMethod.invoke(config, (Object[])null)).intValue(); - } catch (Exception e) { + } catch (final Exception e) { return 0; } } diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java index 98ea68f4f..6b54c32ea 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java +++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java @@ -18,19 +18,19 @@ public class OSXDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize * not the actual dummy surface height, * The latter is platform specific and small */ - public OSXDummyUpstreamSurfaceHook(int width, int height) { + public OSXDummyUpstreamSurfaceHook(final int width, final int height) { super(width, height); nsWindow = 0; } @Override - public final void create(ProxySurface s) { + public final void create(final ProxySurface s) { if(0 == nsWindow && 0 == s.getSurfaceHandle()) { nsWindow = OSXUtil.CreateNSWindow(0, 0, 64, 64); if(0 == nsWindow) { throw new NativeWindowException("Error NS window 0"); } - long nsView = OSXUtil.GetNSView(nsWindow); + final long nsView = OSXUtil.GetNSView(nsWindow); if(0 == nsView) { throw new NativeWindowException("Error NS view 0"); } @@ -41,7 +41,7 @@ public class OSXDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize } @Override - public final void destroy(ProxySurface s) { + public final void destroy(final ProxySurface s) { if( s.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) { if( 0 == nsWindow || 0 == s.getSurfaceHandle() ) { throw new InternalError("Owns upstream surface, but no OSX view/window: "+s+", nsWindow 0x"+Long.toHexString(nsWindow)); diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java index 22ac9c355..cf163bd82 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java @@ -85,11 +85,11 @@ public class OSXUtil implements ToolkitProperties { */ public static final boolean hasThreadingIssues() { return false; } - public static boolean isNSView(long object) { + public static boolean isNSView(final long object) { return 0 != object ? isNSView0(object) : false; } - public static boolean isNSWindow(long object) { + public static boolean isNSWindow(final long object) { return 0 != object ? isNSWindow0(object) : false; } @@ -99,32 +99,32 @@ public class OSXUtil implements ToolkitProperties { * @param src_y * @return top-left client-area position in window units */ - public static Point GetLocationOnScreen(long windowOrView, int src_x, int src_y) { + public static Point GetLocationOnScreen(final long windowOrView, final int src_x, final int src_y) { return (Point) GetLocationOnScreen0(windowOrView, src_x, src_y); } - public static Insets GetInsets(long windowOrView) { + public static Insets GetInsets(final long windowOrView) { return (Insets) GetInsets0(windowOrView); } - public static double GetPixelScale(int screenIndex) { + public static double GetPixelScale(final int screenIndex) { return GetPixelScale0(screenIndex); } - public static double GetPixelScale(long windowOrView) { + public static double GetPixelScale(final long windowOrView) { return GetPixelScale1(windowOrView); } - public static long CreateNSWindow(int x, int y, int width, int height) { + public static long CreateNSWindow(final int x, final int y, final int width, final int height) { return CreateNSWindow0(x, y, width, height); } - public static void DestroyNSWindow(long nsWindow) { + public static void DestroyNSWindow(final long nsWindow) { DestroyNSWindow0(nsWindow); } - public static long GetNSView(long nsWindow) { + public static long GetNSView(final long nsWindow) { return GetNSView0(nsWindow); } - public static long GetNSWindow(long nsView) { + public static long GetNSWindow(final long nsView) { return GetNSWindow0(nsView); } @@ -268,7 +268,7 @@ public class OSXUtil implements ToolkitProperties { if( waitUntilDone ) { try { sync.wait(); - } catch (InterruptedException ie) { + } catch (final InterruptedException ie) { throwable = ie; } if(null==throwable) { @@ -288,7 +288,7 @@ public class OSXUtil implements ToolkitProperties { * @param runnable * @param delay delay to run the runnable in milliseconds */ - public static void RunLater(boolean onMain, Runnable runnable, int delay) { + public static void RunLater(final boolean onMain, final Runnable runnable, final int delay) { RunLater0(onMain, false /* kickNSApp */, new RunnableTask( runnable, null, true, System.err ), delay); } @@ -343,7 +343,7 @@ public class OSXUtil implements ToolkitProperties { if( waitUntilDone ) { try { sync.wait(); - } catch (InterruptedException ie) { + } catch (final InterruptedException ie) { throwable = ie; } if(null==throwable) { @@ -363,7 +363,7 @@ public class OSXUtil implements ToolkitProperties { } /** Returns the screen refresh rate in Hz. If unavailable, returns 60Hz. */ - public static int GetScreenRefreshRate(int scrn_idx) { + public static int GetScreenRefreshRate(final int scrn_idx) { return GetScreenRefreshRate0(scrn_idx); } diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java index bf59a6639..a08cf9b51 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java +++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java @@ -16,12 +16,12 @@ public class GDIDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize * not the actual dummy surface height, * The latter is platform specific and small */ - public GDIDummyUpstreamSurfaceHook(int width, int height) { + public GDIDummyUpstreamSurfaceHook(final int width, final int height) { super(width, height); } @Override - public final void create(ProxySurface s) { + public final void create(final ProxySurface s) { final GDISurface ms = (GDISurface)s; if(0 == ms.getWindowHandle()) { final long windowHandle = GDIUtil.CreateDummyWindow(0, 0, 64, 64); @@ -35,7 +35,7 @@ public class GDIDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize } @Override - public final void destroy(ProxySurface s) { + public final void destroy(final ProxySurface s) { final GDISurface ms = (GDISurface)s; if( ms.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) { if( 0 == ms.getWindowHandle() ) { diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java index 4369158cf..2f335c428 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java +++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java @@ -58,7 +58,7 @@ public class GDISurface extends ProxySurfaceImpl { * owns the {@link AbstractGraphicsConfiguration}'s {@link AbstractGraphicsDevice}, * otherwise <code>false</code>. Owning the device implies closing it at {@link #destroyNotify()}. */ - public GDISurface(AbstractGraphicsConfiguration cfg, long windowHandle, UpstreamSurfaceHook upstream, boolean ownsDevice) { + public GDISurface(final AbstractGraphicsConfiguration cfg, final long windowHandle, final UpstreamSurfaceHook upstream, final boolean ownsDevice) { super(cfg, upstream, ownsDevice); this.windowHandle=windowHandle; this.surfaceHandle=0; @@ -81,14 +81,14 @@ public class GDISurface extends ProxySurfaceImpl { * </p> */ @Override - public final void setSurfaceHandle(long surfaceHandle) { + public final void setSurfaceHandle(final long surfaceHandle) { this.windowHandle = surfaceHandle; } /** * Sets the window handle (HWND). */ - public final void setWindowHandle(long windowHandle) { + public final void setWindowHandle(final long windowHandle) { this.windowHandle = windowHandle; } diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java index 720ff9bdb..8203a804b 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java @@ -93,7 +93,7 @@ public class GDIUtil implements ToolkitProperties { private static RegisteredClass dummyWindowClass = null; private static Object dummyWindowSync = new Object(); - public static long CreateDummyWindow(int x, int y, int width, int height) { + public static long CreateDummyWindow(final int x, final int y, final int width, final int height) { synchronized(dummyWindowSync) { dummyWindowClass = dummyWindowClassFactory.getSharedClass(); if(DEBUG) { @@ -104,7 +104,7 @@ public class GDIUtil implements ToolkitProperties { } } - public static boolean DestroyDummyWindow(long hwnd) { + public static boolean DestroyDummyWindow(final long hwnd) { boolean res; synchronized(dummyWindowSync) { if( null == dummyWindowClass ) { @@ -116,15 +116,15 @@ public class GDIUtil implements ToolkitProperties { return res; } - public static Point GetRelativeLocation(long src_win, long dest_win, int src_x, int src_y) { + public static Point GetRelativeLocation(final long src_win, final long dest_win, final int src_x, final int src_y) { return (Point) GetRelativeLocation0(src_win, dest_win, src_x, src_y); } - public static boolean IsUndecorated(long win) { + public static boolean IsUndecorated(final long win) { return IsUndecorated0(win); } - public static boolean IsChild(long win) { + public static boolean IsChild(final long win) { return IsChild0(win); } diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java index 1f6cb7c05..3c7b1adfb 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java +++ b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java @@ -33,7 +33,7 @@ public class RegisteredClass { private final String className; private final long hDDTCtx; - RegisteredClass(long hInst, String name, long hDispatchThreadCtx) { + RegisteredClass(final long hInst, final String name, final long hDispatchThreadCtx) { this.hInstance = hInst; this.className = name; this.hDDTCtx = hDispatchThreadCtx; diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java index c4b4d145c..e3ea49314 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java +++ b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java @@ -57,7 +57,7 @@ public class RegisteredClassFactory { private int sharedRefCount = 0; private final Object sync = new Object(); - private String toHexString(long l) { return "0x"+Long.toHexString(l); } + private String toHexString(final long l) { return "0x"+Long.toHexString(l); } @Override public final String toString() { return "RegisteredClassFactory[moduleHandle "+toHexString(hInstance)+", "+classBaseName+ @@ -93,7 +93,7 @@ public class RegisteredClassFactory { /** Application handle. */ public static long getHInstance() { return hInstance; } - public RegisteredClassFactory(String classBaseName, long wndProc, boolean useDummyDispatchThread, long iconSmallHandle, long iconBigHandle) { + public RegisteredClassFactory(final String classBaseName, final long wndProc, final boolean useDummyDispatchThread, final long iconSmallHandle, final long iconBigHandle) { this.classBaseName = classBaseName; this.wndProc = wndProc; this.useDummyDispatchThread = useDummyDispatchThread; diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java index 4f8cff8c5..0ac3d4a2e 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java @@ -35,7 +35,7 @@ import javax.media.nativewindow.VisualIDHolder; public class X11Capabilities extends Capabilities { final private XVisualInfo xVisualInfo; // maybe null if !onscreen - public X11Capabilities(XVisualInfo xVisualInfo) { + public X11Capabilities(final XVisualInfo xVisualInfo) { super(); this.xVisualInfo = xVisualInfo; } @@ -49,7 +49,7 @@ public class X11Capabilities extends Capabilities { public Object clone() { try { return super.clone(); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { throw new NativeWindowException(e); } } @@ -59,7 +59,7 @@ public class X11Capabilities extends Capabilities { final public boolean hasXVisualInfo() { return null!=xVisualInfo; } @Override - final public int getVisualID(VIDType type) throws NativeWindowException { + final public int getVisualID(final VIDType type) throws NativeWindowException { switch(type) { case INTRINSIC: case NATIVE: diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java index 53b303071..7e61ba6d0 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java @@ -21,12 +21,12 @@ public class X11DummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize * not the actual dummy surface height, * The latter is platform specific and small */ - public X11DummyUpstreamSurfaceHook(int width, int height) { + public X11DummyUpstreamSurfaceHook(final int width, final int height) { super(width, height); } @Override - public final void create(ProxySurface s) { + public final void create(final ProxySurface s) { final X11GraphicsConfiguration cfg = (X11GraphicsConfiguration) s.getGraphicsConfiguration(); final X11GraphicsScreen screen = (X11GraphicsScreen) cfg.getScreen(); final X11GraphicsDevice device = (X11GraphicsDevice) screen.getDevice(); @@ -51,7 +51,7 @@ public class X11DummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize } @Override - public final void destroy(ProxySurface s) { + public final void destroy(final ProxySurface s) { if( s.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) { final X11GraphicsDevice device = (X11GraphicsDevice) s.getGraphicsConfiguration().getScreen().getDevice(); if( 0 == s.getSurfaceHandle() ) { diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java index 6258632cd..e12c3fd13 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java @@ -53,7 +53,7 @@ public class X11GraphicsConfigurationFactory extends GraphicsConfigurationFactor @Override protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen screen, int nativeVisualID) + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, final CapabilitiesChooser chooser, final AbstractGraphicsScreen screen, final int nativeVisualID) throws IllegalArgumentException, NativeWindowException { if(!(screen instanceof X11GraphicsScreen)) { @@ -72,15 +72,15 @@ public class X11GraphicsConfigurationFactory extends GraphicsConfigurationFactor return res; } - public static XVisualInfo getXVisualInfo(AbstractGraphicsScreen screen, int visualID) + public static XVisualInfo getXVisualInfo(final AbstractGraphicsScreen screen, final int visualID) { - XVisualInfo xvi_temp = XVisualInfo.create(); + final XVisualInfo xvi_temp = XVisualInfo.create(); xvi_temp.setVisualid(visualID); xvi_temp.setScreen(screen.getIndex()); - int num[] = { -1 }; - long display = screen.getDevice().getHandle(); + final int num[] = { -1 }; + final long display = screen.getDevice().getHandle(); - XVisualInfo[] xvis = X11Lib.XGetVisualInfo(display, X11Lib.VisualIDMask|X11Lib.VisualScreenMask, xvi_temp, num, 0); + final XVisualInfo[] xvis = X11Lib.XGetVisualInfo(display, X11Lib.VisualIDMask|X11Lib.VisualScreenMask, xvi_temp, num, 0); if(xvis==null || num[0]<1) { return null; @@ -89,26 +89,26 @@ public class X11GraphicsConfigurationFactory extends GraphicsConfigurationFactor return XVisualInfo.create(xvis[0]); } - public static XVisualInfo getXVisualInfo(AbstractGraphicsScreen screen, CapabilitiesImmutable capabilities) + public static XVisualInfo getXVisualInfo(final AbstractGraphicsScreen screen, final CapabilitiesImmutable capabilities) { - XVisualInfo xv = getXVisualInfoImpl(screen, capabilities, 4 /* TrueColor */); + final XVisualInfo xv = getXVisualInfoImpl(screen, capabilities, 4 /* TrueColor */); if(null!=xv) return xv; return getXVisualInfoImpl(screen, capabilities, 5 /* DirectColor */); } - private static XVisualInfo getXVisualInfoImpl(AbstractGraphicsScreen screen, CapabilitiesImmutable capabilities, int c_class) + private static XVisualInfo getXVisualInfoImpl(final AbstractGraphicsScreen screen, final CapabilitiesImmutable capabilities, final int c_class) { XVisualInfo ret = null; - int[] num = { -1 }; + final int[] num = { -1 }; - XVisualInfo vinfo_template = XVisualInfo.create(); + final XVisualInfo vinfo_template = XVisualInfo.create(); vinfo_template.setScreen(screen.getIndex()); vinfo_template.setC_class(c_class); - long display = screen.getDevice().getHandle(); + final long display = screen.getDevice().getHandle(); - XVisualInfo[] vinfos = X11Lib.XGetVisualInfo(display, X11Lib.VisualScreenMask, vinfo_template, num, 0); + final XVisualInfo[] vinfos = X11Lib.XGetVisualInfo(display, X11Lib.VisualScreenMask, vinfo_template, num, 0); XVisualInfo best=null; - int rdepth = capabilities.getRedBits() + capabilities.getGreenBits() + capabilities.getBlueBits() + capabilities.getAlphaBits(); + final int rdepth = capabilities.getRedBits() + capabilities.getGreenBits() + capabilities.getBlueBits() + capabilities.getAlphaBits(); for (int i = 0; vinfos!=null && i < num[0]; i++) { if ( best == null || best.getDepth() < vinfos[i].getDepth() ) diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java index 2f825e8d4..2414248b4 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java @@ -243,7 +243,7 @@ public class X11Util implements ToolkitProperties { return hasThreadingIssues; // JOGL impl. may utilize special locking "somewhere" } - public static void setX11ErrorHandler(boolean onoff, boolean quiet) { + public static void setX11ErrorHandler(final boolean onoff, final boolean quiet) { synchronized(setX11ErrorHandlerLock) { setX11ErrorHandler0(onoff, quiet); } @@ -282,7 +282,7 @@ public class X11Util implements ToolkitProperties { boolean unCloseable; Throwable creationStack; - protected NamedDisplay(String name, long handle) { + protected NamedDisplay(final String name, final long handle) { this.name=name; this.handle=handle; this.refCount=0; @@ -306,7 +306,7 @@ public class X11Util implements ToolkitProperties { } @Override - public final boolean equals(Object obj) { + public final boolean equals(final Object obj) { if(this == obj) { return true; } if(obj instanceof NamedDisplay) { return handle == ((NamedDisplay) obj).handle; @@ -321,7 +321,7 @@ public class X11Util implements ToolkitProperties { public final long getHandle() { return handle; } public final int getRefCount() { return refCount; } - public final void setUncloseable(boolean v) { unCloseable = v; } + public final void setUncloseable(final boolean v) { unCloseable = v; } public final boolean isUncloseable() { return unCloseable; } public final Throwable getCreationStack() { return creationStack; } @@ -341,7 +341,7 @@ public class X11Util implements ToolkitProperties { synchronized(globalLock) { if( getMarkAllDisplaysUnclosable() ) { for(int i=0; i<pendingDisplayList.size(); i++) { - final NamedDisplay ndpy = (NamedDisplay) pendingDisplayList.get(i); + final NamedDisplay ndpy = pendingDisplayList.get(i); if(DEBUG) { final boolean closeAttempted = !openDisplayMap.containsKey(ndpy.getHandle()); System.err.println("X11Util.closePendingDisplayConnections(): Closing ["+i+"]: "+ndpy+" - closeAttempted "+closeAttempted); @@ -367,10 +367,10 @@ public class X11Util implements ToolkitProperties { synchronized(globalLock) { System.err.println("X11Util: Open X11 Display Connections: "+openDisplayList.size()); for(int i=0; i<openDisplayList.size(); i++) { - NamedDisplay ndpy = openDisplayList.get(i); + final NamedDisplay ndpy = openDisplayList.get(i); System.err.println("X11Util: Open["+i+"]: "+ndpy); if(null!=ndpy) { - Throwable t = ndpy.getCreationStack(); + final Throwable t = ndpy.getCreationStack(); if(null!=t) { t.printStackTrace(); } @@ -395,10 +395,10 @@ public class X11Util implements ToolkitProperties { synchronized(globalLock) { System.err.println("X11Util: Reusable X11 Display Connections: "+reusableDisplayList.size()); for(int i=0; i<reusableDisplayList.size(); i++) { - NamedDisplay ndpy = (NamedDisplay) reusableDisplayList.get(i); + final NamedDisplay ndpy = reusableDisplayList.get(i); System.err.println("X11Util: Reusable["+i+"]: "+ndpy); if(null!=ndpy) { - Throwable t = ndpy.getCreationStack(); + final Throwable t = ndpy.getCreationStack(); if(null!=t) { t.printStackTrace(); } @@ -406,10 +406,10 @@ public class X11Util implements ToolkitProperties { } System.err.println("X11Util: Pending X11 Display Connections (creation order): "+pendingDisplayList.size()); for(int i=0; i<pendingDisplayList.size(); i++) { - NamedDisplay ndpy = (NamedDisplay) pendingDisplayList.get(i); + final NamedDisplay ndpy = pendingDisplayList.get(i); System.err.println("X11Util: Pending["+i+"]: "+ndpy); if(null!=ndpy) { - Throwable t = ndpy.getCreationStack(); + final Throwable t = ndpy.getCreationStack(); if(null!=t) { t.printStackTrace(); } @@ -418,7 +418,7 @@ public class X11Util implements ToolkitProperties { } } - public static boolean markDisplayUncloseable(long handle) { + public static boolean markDisplayUncloseable(final long handle) { NamedDisplay ndpy; synchronized(globalLock) { ndpy = (NamedDisplay) openDisplayMap.get(handle); @@ -470,7 +470,7 @@ public class X11Util implements ToolkitProperties { return namedDpy.getHandle(); } - public static void closeDisplay(long handle) { + public static void closeDisplay(final long handle) { synchronized(globalLock) { final NamedDisplay namedDpy = (NamedDisplay) openDisplayMap.remove(handle); if(null==namedDpy) { @@ -504,7 +504,7 @@ public class X11Util implements ToolkitProperties { } } - public static NamedDisplay getNamedDisplay(long handle) { + public static NamedDisplay getNamedDisplay(final long handle) { synchronized(globalLock) { return (NamedDisplay) openDisplayMap.get(handle); } @@ -513,11 +513,11 @@ public class X11Util implements ToolkitProperties { /** * @return If name is null, it returns the previous queried NULL display name, * otherwise the name. */ - public static String validateDisplayName(String name) { + public static String validateDisplayName(final String name) { return ( null == name || AbstractGraphicsDevice.DEFAULT_CONNECTION.equals(name) ) ? getNullDisplayName() : name ; } - public static String validateDisplayName(String name, long handle) { + public static String validateDisplayName(String name, final long handle) { if( ( null==name || AbstractGraphicsDevice.DEFAULT_CONNECTION.equals(name) ) && 0!=handle) { name = X11Lib.XDisplayString(handle); } @@ -530,8 +530,8 @@ public class X11Util implements ToolkitProperties { ** *******************************/ - public static long XOpenDisplay(String arg0) { - long handle = X11Lib.XOpenDisplay(arg0); + public static long XOpenDisplay(final String arg0) { + final long handle = X11Lib.XOpenDisplay(arg0); if(XSYNC_ENABLED && 0 != handle) { X11Lib.XSynchronize(handle, true); } @@ -542,7 +542,7 @@ public class X11Util implements ToolkitProperties { return handle; } - public static int XCloseDisplay(long display) { + public static int XCloseDisplay(final long display) { if(TRACE_DISPLAY_LIFECYCLE) { System.err.println(Thread.currentThread()+" - X11Util.XCloseDisplay() 0x"+Long.toHexString(display)); // Thread.dumpStack(); @@ -550,7 +550,7 @@ public class X11Util implements ToolkitProperties { int res = -1; try { res = X11Lib.XCloseDisplay(display); - } catch (Exception ex) { + } catch (final Exception ex) { System.err.println("X11Util: Caught exception:"); ex.printStackTrace(); } @@ -561,7 +561,7 @@ public class X11Util implements ToolkitProperties { static long XineramaLibHandle = 0; static long XineramaQueryFunc = 0; - public static boolean XineramaIsEnabled(X11GraphicsDevice device) { + public static boolean XineramaIsEnabled(final X11GraphicsDevice device) { if(null == device) { throw new IllegalArgumentException("X11 Display device is NULL"); } @@ -573,7 +573,7 @@ public class X11Util implements ToolkitProperties { } } - public static boolean XineramaIsEnabled(long displayHandle) { + public static boolean XineramaIsEnabled(final long displayHandle) { if( 0 == displayHandle ) { throw new IllegalArgumentException("X11 Display handle is NULL"); } diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java b/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java index 062040232..6b606df97 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java @@ -68,8 +68,8 @@ public class X11AWTGraphicsConfigurationFactory extends GraphicsConfigurationFac @Override protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, - CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, + final CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, final int nativeVisualID) { if (absScreen != null && !(absScreen instanceof AWTGraphicsScreen)) { throw new IllegalArgumentException("This GraphicsConfigurationFactory accepts only AWTGraphicsScreen objects"); @@ -82,8 +82,8 @@ public class X11AWTGraphicsConfigurationFactory extends GraphicsConfigurationFac } public static AWTGraphicsConfiguration chooseGraphicsConfigurationStatic( - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, - CapabilitiesChooser chooser, AWTGraphicsScreen awtScreen, int nativeVisualID) { + CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, + final CapabilitiesChooser chooser, final AWTGraphicsScreen awtScreen, final int nativeVisualID) { if(DEBUG) { System.err.println("X11AWTGraphicsConfigurationFactory: got "+awtScreen); } @@ -143,7 +143,7 @@ public class X11AWTGraphicsConfigurationFactory extends GraphicsConfigurationFac int visualID = aConfig.getVisualID(VIDType.NATIVE); if(VisualIDHolder.VID_UNDEFINED != visualID) { for (int i = 0; i < configs.length; i++) { - GraphicsConfiguration gc = configs[i]; + final GraphicsConfiguration gc = configs[i]; if (gc != null) { if (X11SunJDKReflection.graphicsConfigurationGetVisualID(gc) == visualID) { if(DEBUG) { |