diff options
Diffstat (limited to 'src/nativewindow/classes')
64 files changed, 504 insertions, 492 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookMutableSize.java b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookMutableSize.java index 7ae614158..e785af788 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookMutableSize.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookMutableSize.java @@ -11,20 +11,20 @@ public class DelegatedUpstreamSurfaceHookMutableSize extends UpstreamSurfaceHook * @param width initial width * @param height initial height */ - public DelegatedUpstreamSurfaceHookMutableSize(UpstreamSurfaceHook upstream, int width, int height) { + public DelegatedUpstreamSurfaceHookMutableSize(final UpstreamSurfaceHook upstream, final int width, final int height) { super(width, height); this.upstream = upstream; } @Override - public final void create(ProxySurface s) { + public final void create(final ProxySurface s) { if(null != upstream) { upstream.create(s); } } @Override - public final void destroy(ProxySurface s) { + public final void destroy(final ProxySurface s) { if(null != upstream) { upstream.destroy(s); } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java index 568ac20fa..abcc166cb 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java @@ -12,7 +12,7 @@ public class DelegatedUpstreamSurfaceHookWithSurfaceSize implements UpstreamSurf * @param upstream optional upstream UpstreamSurfaceHook used for {@link #create(ProxySurface)} and {@link #destroy(ProxySurface)}. * @param surface mandatory {@link NativeSurface} used for {@link #getSurfaceWidth(ProxySurface)} and {@link #getSurfaceHeight(ProxySurface)}, not used for {@link #getUpstreamSurface()}. */ - public DelegatedUpstreamSurfaceHookWithSurfaceSize(UpstreamSurfaceHook upstream, NativeSurface surface) { + public DelegatedUpstreamSurfaceHookWithSurfaceSize(final UpstreamSurfaceHook upstream, final NativeSurface surface) { this.upstream = upstream; this.surface = surface; if(null == surface) { @@ -32,26 +32,26 @@ public class DelegatedUpstreamSurfaceHookWithSurfaceSize implements UpstreamSurf } @Override - public final void create(ProxySurface s) { + public final void create(final ProxySurface s) { if(null != upstream) { upstream.create(s); } } @Override - public final void destroy(ProxySurface s) { + public final void destroy(final ProxySurface s) { if(null != upstream) { upstream.destroy(s); } } @Override - public final int getSurfaceWidth(ProxySurface s) { + public final int getSurfaceWidth(final ProxySurface s) { return surface.getSurfaceWidth(); } @Override - public final int getSurfaceHeight(ProxySurface s) { + public final int getSurfaceHeight(final ProxySurface s) { return surface.getSurfaceHeight(); } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/MutableGraphicsConfiguration.java b/src/nativewindow/classes/com/jogamp/nativewindow/MutableGraphicsConfiguration.java index 8b8ccb191..a137d46c3 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/MutableGraphicsConfiguration.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/MutableGraphicsConfiguration.java @@ -32,18 +32,18 @@ import javax.media.nativewindow.CapabilitiesImmutable; import javax.media.nativewindow.DefaultGraphicsConfiguration; public class MutableGraphicsConfiguration extends DefaultGraphicsConfiguration { - public MutableGraphicsConfiguration(AbstractGraphicsScreen screen, - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested) { + public MutableGraphicsConfiguration(final AbstractGraphicsScreen screen, + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested) { super(screen, capsChosen, capsRequested); } @Override - public void setChosenCapabilities(CapabilitiesImmutable caps) { + public void setChosenCapabilities(final CapabilitiesImmutable caps) { super.setChosenCapabilities(caps); } @Override - public void setScreen(AbstractGraphicsScreen screen) { + public void setScreen(final AbstractGraphicsScreen screen) { super.setScreen(screen); } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowVersion.java b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowVersion.java index a8dd9165c..7c1a88e6a 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowVersion.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowVersion.java @@ -38,7 +38,7 @@ public class NativeWindowVersion extends JogampVersion { protected static volatile NativeWindowVersion jogampCommonVersionInfo; - protected NativeWindowVersion(String packageName, Manifest mf) { + protected NativeWindowVersion(final String packageName, final Manifest mf) { super(packageName, mf); } @@ -56,7 +56,7 @@ public class NativeWindowVersion extends JogampVersion { return jogampCommonVersionInfo; } - public static void main(String args[]) { + public static void main(final String args[]) { System.err.println(VersionUtil.getPlatformInfo()); System.err.println(GlueGenVersion.getInstance()); System.err.println(NativeWindowVersion.getInstance()); diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java index eca64db37..45d12be5e 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java @@ -11,31 +11,31 @@ public class UpstreamSurfaceHookMutableSize implements UpstreamSurfaceHook.Mutab * @param width initial width * @param height initial height */ - public UpstreamSurfaceHookMutableSize(int width, int height) { + public UpstreamSurfaceHookMutableSize(final int width, final int height) { this.pixWidth = width; this.pixHeight = height; } @Override - public final void setSurfaceSize(int width, int height) { + public final void setSurfaceSize(final int width, final int height) { this.pixWidth = width; this.pixHeight = height; } @Override - public final int getSurfaceWidth(ProxySurface s) { + public final int getSurfaceWidth(final ProxySurface s) { return pixWidth; } @Override - public final int getSurfaceHeight(ProxySurface s) { + public final int getSurfaceHeight(final ProxySurface s) { return pixHeight; } @Override - public void create(ProxySurface s) { /* nop */ } + public void create(final ProxySurface s) { /* nop */ } @Override - public void destroy(ProxySurface s) { /* nop */ } + public void destroy(final ProxySurface s) { /* nop */ } @Override public String toString() { diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamWindowHookMutableSizePos.java b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamWindowHookMutableSizePos.java index 5f9720a0e..b509f118a 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamWindowHookMutableSizePos.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamWindowHookMutableSizePos.java @@ -11,7 +11,7 @@ public class UpstreamWindowHookMutableSizePos extends UpstreamSurfaceHookMutable * @param pixWidth initial surface pixel width, FIXME: pixel-dim == window-dim 'for now' ? * @param pixHeight initial surface pixel height, FIXME: pixel-dim == window-dim 'for now' ? */ - public UpstreamWindowHookMutableSizePos(int winX, int winY, int winWidth, int winHeight, int pixWidth, int pixHeight) { + public UpstreamWindowHookMutableSizePos(final int winX, final int winY, final int winWidth, final int winHeight, final int pixWidth, final int pixHeight) { super(pixWidth, pixHeight); this.winX= winX; this.winY= winY; @@ -20,12 +20,12 @@ public class UpstreamWindowHookMutableSizePos extends UpstreamSurfaceHookMutable } // @Override - public final void setWinPos(int winX, int winY) { + public final void setWinPos(final int winX, final int winY) { this.winX= winX; this.winY= winY; } // @Override - public final void setWinSize(int winWidth, int winHeight) { + public final void setWinSize(final int winWidth, final int winHeight) { this.winWidth= winWidth; this.winHeight= winHeight; // FIXME HiDPI: Use pixelScale ?! diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsConfiguration.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsConfiguration.java index aa9b876dd..3a62825a2 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsConfiguration.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsConfiguration.java @@ -54,19 +54,19 @@ import jogamp.nativewindow.Debug; handled in a toolkit-independent manner. */ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration implements Cloneable { - private GraphicsConfiguration config; + private final GraphicsConfiguration config; AbstractGraphicsConfiguration encapsulated; - public AWTGraphicsConfiguration(AWTGraphicsScreen screen, - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, - GraphicsConfiguration config, AbstractGraphicsConfiguration encapsulated) { + public AWTGraphicsConfiguration(final AWTGraphicsScreen screen, + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, + final GraphicsConfiguration config, final AbstractGraphicsConfiguration encapsulated) { super(screen, capsChosen, capsRequested); this.config = config; this.encapsulated=encapsulated; } - private AWTGraphicsConfiguration(AWTGraphicsScreen screen, CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, - GraphicsConfiguration config) { + private AWTGraphicsConfiguration(final AWTGraphicsScreen screen, final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, + final GraphicsConfiguration config) { super(screen, capsChosen, capsRequested); this.config = config; this.encapsulated=null; @@ -78,7 +78,7 @@ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple * Otherwise the <code>capsChosen</code> is used. * @param capsRequested if null, default {@link Capabilities} are used, otherwise the given values. */ - public static AWTGraphicsConfiguration create(Component awtComp, CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested) { + public static AWTGraphicsConfiguration create(final Component awtComp, CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested) { final GraphicsConfiguration awtGfxConfig = awtComp.getGraphicsConfiguration(); if(null==awtGfxConfig) { throw new NativeWindowException("AWTGraphicsConfiguration.create: Null AWT GraphicsConfiguration @ "+awtComp); @@ -96,7 +96,7 @@ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple capsRequested = new Capabilities(); } if(null==capsChosen) { - GraphicsConfiguration gc = awtGraphicsDevice.getDefaultConfiguration(); + final GraphicsConfiguration gc = awtGraphicsDevice.getDefaultConfiguration(); capsChosen = AWTGraphicsConfiguration.setupCapabilitiesRGBABits(capsRequested, gc); } final GraphicsConfigurationFactory factory = GraphicsConfigurationFactory.getFactory(awtDevice, capsChosen); @@ -110,7 +110,7 @@ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple // open access to superclass method @Override - public void setChosenCapabilities(CapabilitiesImmutable capsChosen) { + public void setChosenCapabilities(final CapabilitiesImmutable capsChosen) { super.setChosenCapabilities(capsChosen); } @@ -136,16 +136,16 @@ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple * @param gc the GraphicsConfiguration from which to derive the RGBA bit depths * @return the passed Capabilities */ - public static CapabilitiesImmutable setupCapabilitiesRGBABits(CapabilitiesImmutable capabilitiesIn, GraphicsConfiguration gc) { - Capabilities capabilities = (Capabilities) capabilitiesIn.cloneMutable(); + public static CapabilitiesImmutable setupCapabilitiesRGBABits(final CapabilitiesImmutable capabilitiesIn, final GraphicsConfiguration gc) { + final Capabilities capabilities = (Capabilities) capabilitiesIn.cloneMutable(); - ColorModel cm = gc.getColorModel(); + final ColorModel cm = gc.getColorModel(); if(null==cm) { throw new NativeWindowException("Could not determine AWT ColorModel"); } - int cmBitsPerPixel = cm.getPixelSize(); + final int cmBitsPerPixel = cm.getPixelSize(); int bitsPerPixel = 0; - int[] bitesPerComponent = cm.getComponentSize(); + final int[] bitesPerComponent = cm.getComponentSize(); if(bitesPerComponent.length>=3) { capabilities.setRedBits(bitesPerComponent[0]); bitsPerPixel += bitesPerComponent[0]; diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsDevice.java index d72eabb02..219f4bb92 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsDevice.java @@ -56,7 +56,7 @@ public class AWTGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl } public static AWTGraphicsDevice createDefault() { - GraphicsDevice awtDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); + final GraphicsDevice awtDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); return new AWTGraphicsDevice(awtDevice, AbstractGraphicsDevice.DEFAULT_UNIT); } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsScreen.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsScreen.java index 83d6efa75..6fc35f719 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsScreen.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsScreen.java @@ -51,35 +51,35 @@ import javax.media.nativewindow.*; public class AWTGraphicsScreen extends DefaultGraphicsScreen implements Cloneable { - public AWTGraphicsScreen(AWTGraphicsDevice device) { + public AWTGraphicsScreen(final AWTGraphicsDevice device) { super(device, findScreenIndex(device.getGraphicsDevice())); } - public static GraphicsDevice getScreenDevice(int index) { + public static GraphicsDevice getScreenDevice(final int index) { if(index<0) return null; - GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - GraphicsDevice[] gs = ge.getScreenDevices(); + final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + final GraphicsDevice[] gs = ge.getScreenDevices(); if(index<gs.length) { return gs[index]; } return null; } - public static int findScreenIndex(GraphicsDevice awtDevice) { + public static int findScreenIndex(final GraphicsDevice awtDevice) { if(null==awtDevice) return -1; - GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - GraphicsDevice[] gs = ge.getScreenDevices(); + final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + final GraphicsDevice[] gs = ge.getScreenDevices(); for (int j = 0; j < gs.length; j++) { if(gs[j] == awtDevice) return j; } return -1; } - public static AbstractGraphicsScreen createScreenDevice(GraphicsDevice awtDevice, int unitID) { + public static AbstractGraphicsScreen createScreenDevice(final GraphicsDevice awtDevice, final int unitID) { return new AWTGraphicsScreen(new AWTGraphicsDevice(awtDevice, unitID)); } - public static AbstractGraphicsScreen createScreenDevice(int index, int unitID) { + public static AbstractGraphicsScreen createScreenDevice(final int index, final int unitID) { return createScreenDevice(getScreenDevice(index), unitID); } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTPrintLifecycle.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTPrintLifecycle.java index 44163fc73..b0a7fbc76 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTPrintLifecycle.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTPrintLifecycle.java @@ -120,7 +120,7 @@ public interface AWTPrintLifecycle { * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. * @return the context */ - public static Context setupPrint(Container c, double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight) { + public static Context setupPrint(final Container c, final double scaleMatX, final double scaleMatY, final int numSamples, final int tileWidth, final int tileHeight) { final Context t = new Context(c, scaleMatX, scaleMatY, numSamples, tileWidth, tileHeight); t.setupPrint(c); return t; @@ -150,16 +150,16 @@ public interface AWTPrintLifecycle { private final AWTMisc.ComponentAction setupAction = new AWTMisc.ComponentAction() { @Override - public void run(Component c) { + public void run(final Component c) { ((AWTPrintLifecycle)c).setupPrint(scaleMatX, scaleMatY, numSamples, tileWidth, tileHeight); } }; private final AWTMisc.ComponentAction releaseAction = new AWTMisc.ComponentAction() { @Override - public void run(Component c) { + public void run(final Component c) { ((AWTPrintLifecycle)c).releasePrint(); } }; - private Context(Container c, double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight) { + private Context(final Container c, final double scaleMatX, final double scaleMatY, final int numSamples, final int tileWidth, final int tileHeight) { this.cont = c; this.scaleMatX = scaleMatX; this.scaleMatY = scaleMatY; @@ -168,7 +168,7 @@ public interface AWTPrintLifecycle { this.tileHeight = tileHeight; this.count = 0; } - private void setupPrint(Container c) { + private void setupPrint(final Container c) { count = AWTMisc.performAction(c, AWTPrintLifecycle.class, setupAction); } } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java index aadecb455..496e6e07b 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java @@ -53,7 +53,7 @@ public class AWTWindowClosingProtocol implements WindowClosingProtocol { * @param closingOperationClose mandatory closing operation, triggered if windowClosing and {@link WindowClosingMode#DISPOSE_ON_CLOSE} * @param closingOperationNOP optional closing operation, triggered if windowClosing and {@link WindowClosingMode#DO_NOTHING_ON_CLOSE} */ - public AWTWindowClosingProtocol(Component comp, Runnable closingOperationClose, Runnable closingOperationNOP) { + public AWTWindowClosingProtocol(final Component comp, final Runnable closingOperationClose, final Runnable closingOperationNOP) { this.comp = comp; this.listenTo = null; this.closingOperationClose = closingOperationClose; @@ -62,7 +62,7 @@ public class AWTWindowClosingProtocol implements WindowClosingProtocol { class WindowClosingAdapter extends WindowAdapter { @Override - public void windowClosing(WindowEvent e) { + public void windowClosing(final WindowEvent e) { final WindowClosingMode op = AWTWindowClosingProtocol.this.getDefaultCloseOperation(); if( WindowClosingMode.DISPOSE_ON_CLOSE == op ) { @@ -128,7 +128,7 @@ public class AWTWindowClosingProtocol implements WindowClosingProtocol { } @Override - public final WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) { + public final WindowClosingMode setDefaultCloseOperation(final WindowClosingMode op) { synchronized(closingListenerLock) { final WindowClosingMode _op = defaultCloseOperation; defaultCloseOperation = op; diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AppContextInfo.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AppContextInfo.java index 54762bb77..c637ec59e 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AppContextInfo.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AppContextInfo.java @@ -32,8 +32,8 @@ public class AppContextInfo { try { final Class<?> appContextClass = Class.forName("sun.awt.AppContext"); _getAppContextMethod[0] = appContextClass.getMethod("getAppContext"); - } catch(Throwable ex) { - System.err.println("Bug 1004: Catched @ static: "+ex.getMessage()); + } catch(final Throwable ex) { + System.err.println("Bug 1004: Caught @ static: "+ex.getMessage()); ex.printStackTrace(); } return null; @@ -185,8 +185,8 @@ public class AppContextInfo { private static Object fetchAppContext() { try { return getAppContextMethod.invoke(null); - } catch(Exception ex) { - System.err.println("Bug 1004: Catched: "+ex.getMessage()); + } catch(final Exception ex) { + System.err.println("Bug 1004: Caught: "+ex.getMessage()); ex.printStackTrace(); return null; } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/DirectDataBufferInt.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/DirectDataBufferInt.java index eeec66376..c7055099f 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/DirectDataBufferInt.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/DirectDataBufferInt.java @@ -47,14 +47,14 @@ import com.jogamp.common.nio.Buffers; public final class DirectDataBufferInt extends DataBuffer { public static class DirectWritableRaster extends WritableRaster { - protected DirectWritableRaster(SampleModel sampleModel, DirectDataBufferInt dataBuffer, Point origin) { + protected DirectWritableRaster(final SampleModel sampleModel, final DirectDataBufferInt dataBuffer, final Point origin) { super(sampleModel, dataBuffer, origin); } } public static class BufferedImageInt extends BufferedImage { final int customImageType; - public BufferedImageInt (int customImageType, ColorModel cm, WritableRaster raster, Hashtable<?,?> properties) { + public BufferedImageInt (final int customImageType, final ColorModel cm, final WritableRaster raster, final Hashtable<?,?> properties) { super(cm, raster, false /* isRasterPremultiplied */, properties); this.customImageType = customImageType; } @@ -97,7 +97,7 @@ public final class DirectDataBufferInt extends DataBuffer { * <code>String</code>/<code>Object</code> pairs. Used for {@link BufferedImage#getProperty(String)} etc. * @return */ - public static BufferedImageInt createBufferedImage(int width, int height, int imageType, Point location, Hashtable<?,?> properties) { + public static BufferedImageInt createBufferedImage(final int width, final int height, final int imageType, Point location, final Hashtable<?,?> properties) { final ColorSpace colorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB); final int transferType = DataBuffer.TYPE_INT; final int bpp, rmask, gmask, bmask, amask; @@ -167,10 +167,10 @@ public final class DirectDataBufferInt extends DataBuffer { } /** Default data bank. */ - private IntBuffer data; + private final IntBuffer data; /** All data banks */ - private IntBuffer bankdata[]; + private final IntBuffer bankdata[]; /** * Constructs an nio integer-based {@link DataBuffer} with a single bank @@ -178,7 +178,7 @@ public final class DirectDataBufferInt extends DataBuffer { * * @param size The size of the {@link DataBuffer}. */ - public DirectDataBufferInt(int size) { + public DirectDataBufferInt(final int size) { super(TYPE_INT, size); data = Buffers.newDirectIntBuffer(size); bankdata = new IntBuffer[1]; @@ -192,7 +192,7 @@ public final class DirectDataBufferInt extends DataBuffer { * @param size The size of the banks in the {@link DataBuffer}. * @param numBanks The number of banks in the a{@link DataBuffer}. */ - public DirectDataBufferInt(int size, int numBanks) { + public DirectDataBufferInt(final int size, final int numBanks) { super(TYPE_INT,size,numBanks); bankdata = new IntBuffer[numBanks]; for (int i= 0; i < numBanks; i++) { @@ -213,7 +213,7 @@ public final class DirectDataBufferInt extends DataBuffer { * @param dataArray The integer array for the {@link DataBuffer}. * @param size The size of the {@link DataBuffer} bank. */ - public DirectDataBufferInt(IntBuffer dataArray, int size) { + public DirectDataBufferInt(final IntBuffer dataArray, final int size) { super(TYPE_INT,size); data = dataArray; bankdata = new IntBuffer[1]; @@ -235,7 +235,7 @@ public final class DirectDataBufferInt extends DataBuffer { * @param bank The bank whose data array you want to get. * @return The data array for the specified bank. */ - public IntBuffer getData(int bank) { + public IntBuffer getData(final int bank) { return bankdata[bank]; } @@ -248,7 +248,7 @@ public final class DirectDataBufferInt extends DataBuffer { * @see #setElem(int, int, int) */ @Override - public int getElem(int i) { + public int getElem(final int i) { return data.get(i+offset); } @@ -262,7 +262,7 @@ public final class DirectDataBufferInt extends DataBuffer { * @see #setElem(int, int, int) */ @Override - public int getElem(int bank, int i) { + public int getElem(final int bank, final int i) { return bankdata[bank].get(i+offsets[bank]); } @@ -276,7 +276,7 @@ public final class DirectDataBufferInt extends DataBuffer { * @see #getElem(int, int) */ @Override - public void setElem(int i, int val) { + public void setElem(final int i, final int val) { data.put(i+offset, val); } @@ -290,7 +290,7 @@ public final class DirectDataBufferInt extends DataBuffer { * @see #getElem(int, int) */ @Override - public void setElem(int bank, int i, int val) { + public void setElem(final int bank, final int i, final int val) { bankdata[bank].put(i+offsets[bank], val); } } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java index 62710830f..6498ebd1e 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java @@ -71,6 +71,7 @@ import javax.media.nativewindow.util.PointImmutable; import javax.media.nativewindow.util.Rectangle; import javax.media.nativewindow.util.RectangleImmutable; +import jogamp.common.os.PlatformPropsImpl; import jogamp.nativewindow.SurfaceScaleUtils; import jogamp.nativewindow.SurfaceUpdatedHelper; import jogamp.nativewindow.awt.AWTMisc; @@ -114,7 +115,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, * @param comp * @param config */ - protected JAWTWindow(Object comp, AbstractGraphicsConfiguration config) { + protected JAWTWindow(final Object comp, final AbstractGraphicsConfiguration config) { if (config == null) { throw new NativeWindowException("Error: AbstractGraphicsConfiguration is null"); } @@ -129,7 +130,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, this.isApplet = false; this.offscreenSurfaceLayer = 0; } - private static String id(Object obj) { return ( null!=obj ? toHexString(obj.hashCode()) : "nil" ); } + private static String id(final Object obj) { return ( null!=obj ? toHexString(obj.hashCode()) : "nil" ); } private String jawtStr() { return "JAWTWindow["+id(JAWTWindow.this)+"]"; } private class JAWTComponentListener implements ComponentListener, HierarchyListener { @@ -195,7 +196,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, } @Override - public final void componentResized(ComponentEvent e) { + public final void componentResized(final ComponentEvent e) { if(DEBUG) { System.err.println(jawtStr()+".componentResized: "+s(e)); } @@ -203,7 +204,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, } @Override - public final void componentMoved(ComponentEvent e) { + public final void componentMoved(final ComponentEvent e) { if(DEBUG) { System.err.println(jawtStr()+".componentMoved: "+s(e)); } @@ -211,7 +212,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, } @Override - public final void componentShown(ComponentEvent e) { + public final void componentShown(final ComponentEvent e) { if(DEBUG) { System.err.println(jawtStr()+".componentShown: "+s(e)); } @@ -219,7 +220,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, } @Override - public final void componentHidden(ComponentEvent e) { + public final void componentHidden(final ComponentEvent e) { if(DEBUG) { System.err.println(jawtStr()+".componentHidden: "+s(e)); } @@ -227,7 +228,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, } @Override - public final void hierarchyChanged(HierarchyEvent e) { + public final void hierarchyChanged(final HierarchyEvent e) { final boolean wasShowing = isShowing; isShowing = component.isShowing(); int action = 0; @@ -306,7 +307,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, * Updates bounds and pixelScale * @return true if bounds or pixelScale has changed, otherwise false */ - protected final boolean updateLockedData(JAWT_Rectangle jawtBounds) { + protected final boolean updateLockedData(final JAWT_Rectangle jawtBounds) { final Rectangle jb = new Rectangle(jawtBounds.getX(), jawtBounds.getY(), jawtBounds.getWidth(), jawtBounds.getHeight()); final boolean changedBounds = !bounds.equals(jb); @@ -372,7 +373,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, // @Override - public void setShallUseOffscreenLayer(boolean v) { + public void setShallUseOffscreenLayer(final boolean v) { shallUseOffscreenLayer = v; } @@ -428,9 +429,9 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, * @see #isOffscreenLayerSurfaceEnabled() * @throws NativeWindowException if {@link #isOffscreenLayerSurfaceEnabled()} == false */ - protected void layoutSurfaceLayerImpl(long layerHandle, boolean visible) {} + protected void layoutSurfaceLayerImpl(final long layerHandle, final boolean visible) {} - private final void layoutSurfaceLayerIfEnabled(boolean visible) throws NativeWindowException { + private final void layoutSurfaceLayerIfEnabled(final boolean visible) throws NativeWindowException { if( isOffscreenLayerSurfaceEnabled() && 0 != offscreenSurfaceLayer ) { layoutSurfaceLayerImpl(offscreenSurfaceLayer, visible); } @@ -473,7 +474,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, } @Override - public final void setChosenCapabilities(CapabilitiesImmutable caps) { + public final void setChosenCapabilities(final CapabilitiesImmutable caps) { ((MutableGraphicsConfiguration)getGraphicsConfiguration()).setChosenCapabilities(caps); config.setChosenCapabilities(caps); } @@ -494,7 +495,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, final java.awt.Point awtHotspot = new java.awt.Point(hotSpot.getX(), hotSpot.getY()); try { c = AWTMisc.getCursor(pixelrect, awtHotspot); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } @@ -628,22 +629,22 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, } @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); } @@ -772,7 +773,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, getLocationOnScreenNonBlocking(storage, component); return storage; } - java.awt.Point awtLOS = component.getLocationOnScreen(); + final java.awt.Point awtLOS = component.getLocationOnScreen(); if(null!=storage) { los = storage.translate(awtLOS.x, awtLOS.y); } else { @@ -782,8 +783,8 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, return los; } - protected Point getLocationOnScreenNative(Point storage) { - int lockRes = lockSurface(); + protected Point getLocationOnScreenNative(final Point storage) { + final int lockRes = lockSurface(); if(LOCK_SURFACE_NOT_READY == lockRes) { if(DEBUG) { System.err.println("Warning: JAWT Lock couldn't be acquired: "+this); @@ -792,7 +793,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, return null; } try { - Point d = getLocationOnScreenNativeImpl(0, 0); + final Point d = getLocationOnScreenNativeImpl(0, 0); if(null!=d) { if(null!=storage) { storage.translate(d.getX(),d.getY()); @@ -806,7 +807,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, } protected abstract Point getLocationOnScreenNativeImpl(int x, int y); - protected static Component getLocationOnScreenNonBlocking(Point storage, Component comp) { + protected static Component getLocationOnScreenNonBlocking(final Point storage, Component comp) { final java.awt.Insets insets = new java.awt.Insets(0, 0, 0, 0); // DEBUG Component last = null; while(null != comp) { @@ -844,9 +845,9 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, if( null == sb ) { sb = new StringBuilder(); } - sb.append("JVM version: ").append(Platform.JAVA_VERSION).append(" ("). - append(Platform.JAVA_VERSION_NUMBER). - append(" update ").append(Platform.JAVA_VERSION_UPDATE).append(")").append(Platform.getNewline()); + sb.append("JVM version: ").append(PlatformPropsImpl.JAVA_VERSION).append(" ("). + append(PlatformPropsImpl.JAVA_VERSION_NUMBER). + append(" update ").append(PlatformPropsImpl.JAVA_VERSION_UPDATE).append(")").append(Platform.getNewline()); if(null != jawt) { sb.append("JAWT version: ").append(toHexString(jawt.getCachedVersion())). append(", CA_LAYER: ").append(JAWTUtil.isJAWTUsingOffscreenLayer(jawt)). @@ -861,7 +862,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(jawtStr()+"["); jawt2String(sb); diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java index ffcbb8626..d21994ea5 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java @@ -137,7 +137,7 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl return eglLifecycleCallback; } @Override - protected Object setHandleOwnership(Object newOwnership) { + protected Object setHandleOwnership(final Object newOwnership) { final EGLDisplayLifecycleCallback oldOwnership = eglLifecycleCallback; eglLifecycleCallback = (EGLDisplayLifecycleCallback) newOwnership; return oldOwnership; diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java index 02cec5bbf..6c63fc08d 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java @@ -112,7 +112,7 @@ public class SWTAccessor { private static final VersionNumber GTK_VERSION_2_24_0 = new VersionNumber(2, 24, 0); private static final VersionNumber GTK_VERSION_3_0_0 = new VersionNumber(3, 0, 0); - private static VersionNumber GTK_VERSION(int version) { + private static VersionNumber GTK_VERSION(final int version) { // return (major << 16) + (minor << 8) + micro; final int micro = ( version ) & 0x0f; final int minor = ( version >> 8 ) & 0x0f; @@ -137,7 +137,7 @@ public class SWTAccessor { if( !isOSX ) { try { f = Control.class.getField(str_handle); - } catch (Exception ex) { + } catch (final Exception ex) { throw new NativeWindowException(ex); } } @@ -156,7 +156,7 @@ public class SWTAccessor { Method m=null; try { m = ReflectionUtil.getMethod(Control.class, str_internal_new_GC, new Class[] { GCData.class }); - } catch (Exception ex) { + } catch (final Exception ex) { throw new NativeWindowException(ex); } swt_control_internal_new_GC = m; @@ -167,7 +167,7 @@ public class SWTAccessor { } else { m = Control.class.getDeclaredMethod(str_internal_dispose_GC, new Class[] { int.class, GCData.class }); } - } catch (NoSuchMethodException ex) { + } catch (final NoSuchMethodException ex) { throw new NativeWindowException(ex); } swt_control_internal_dispose_GC = m; @@ -180,7 +180,7 @@ public class SWTAccessor { // mandatory try { c = ReflectionUtil.getClass(str_OS_gtk_class, false, SWTAccessor.class.getClassLoader()); - Field field_OS_gtk_version = c.getField(str_OS_gtk_version); + final Field field_OS_gtk_version = c.getField(str_OS_gtk_version); _gtk_version = GTK_VERSION(field_OS_gtk_version.getInt(null)); m1 = c.getDeclaredMethod(str_gtk_widget_realize, handleType); if (_gtk_version.compareTo(GTK_VERSION_2_14_0) >= 0) { @@ -200,11 +200,11 @@ public class SWTAccessor { m8 = c.getDeclaredMethod(str_gdk_x11_drawable_get_xid, handleType); } ma = c.getDeclaredMethod(str_gdk_window_set_back_pixmap, handleType, handleType, boolean.class); - } catch (Exception ex) { throw new NativeWindowException(ex); } + } catch (final Exception ex) { throw new NativeWindowException(ex); } // optional try { m2 = c.getDeclaredMethod(str_gtk_widget_unrealize, handleType); - } catch (Exception ex) { } + } catch (final Exception ex) { } } OS_gtk_class = c; OS_gtk_version = _gtk_version; @@ -226,23 +226,23 @@ public class SWTAccessor { } } - private static Number getIntOrLong(long arg) { + private static Number getIntOrLong(final long arg) { if(swt_uses_long_handles) { return new Long(arg); } return new Integer((int) arg); } - private static void callStaticMethodL2V(Method m, long arg) { + private static void callStaticMethodL2V(final Method m, final long arg) { ReflectionUtil.callMethod(null, m, new Object[] { getIntOrLong(arg) }); } - private static void callStaticMethodLLZ2V(Method m, long arg0, long arg1, boolean arg3) { + private static void callStaticMethodLLZ2V(final Method m, final long arg0, final long arg1, final boolean arg3) { ReflectionUtil.callMethod(null, m, new Object[] { getIntOrLong(arg0), getIntOrLong(arg1), Boolean.valueOf(arg3) }); } - private static long callStaticMethodL2L(Method m, long arg) { - Object o = ReflectionUtil.callMethod(null, m, new Object[] { getIntOrLong(arg) }); + private static long callStaticMethodL2L(final Method m, final long arg) { + final Object o = ReflectionUtil.callMethod(null, m, new Object[] { getIntOrLong(arg) }); if(o instanceof Number) { return ((Number)o).longValue(); } else { @@ -265,7 +265,7 @@ public class SWTAccessor { // Common GTK // - public static long gdk_widget_get_window(long handle) { + public static long gdk_widget_get_window(final long handle) { final long window; if (OS_gtk_version.compareTo(GTK_VERSION_2_14_0) >= 0) { window = callStaticMethodL2L(OS_gtk_widget_get_window, handle); @@ -278,7 +278,7 @@ public class SWTAccessor { return window; } - public static long gdk_window_get_xdisplay(long window) { + public static long gdk_window_get_xdisplay(final long window) { final long xdisplay; if (OS_gtk_version.compareTo(GTK_VERSION_2_24_0) >= 0) { final long display = callStaticMethodL2L(OS_gdk_window_get_display, window); @@ -295,7 +295,7 @@ public class SWTAccessor { return xdisplay; } - public static long gdk_window_get_xwindow(long window) { + public static long gdk_window_get_xwindow(final long window) { final long xWindow; if (OS_gtk_version.compareTo(GTK_VERSION_3_0_0) >= 0) { xWindow = callStaticMethodL2L(OS_gdk_x11_window_get_xid, window); @@ -308,7 +308,7 @@ public class SWTAccessor { return xWindow; } - public static void gdk_window_set_back_pixmap(long window, long pixmap, boolean parent_relative) { + public static void gdk_window_set_back_pixmap(final long window, final long pixmap, final boolean parent_relative) { callStaticMethodLLZ2V(OS_gdk_window_set_back_pixmap, window, pixmap, parent_relative); } @@ -321,27 +321,27 @@ public class SWTAccessor { * @return the native widget-handle * @throws NativeWindowException if the widget handle is null */ - public static long getHandle(Control swtControl) throws NativeWindowException { + public static long getHandle(final Control swtControl) throws NativeWindowException { long h = 0; if( isOSX ) { synchronized(swt_osx_init) { try { if(null == swt_osx_view_id) { swt_osx_control_view = Control.class.getField(str_osx_view); - Object view = swt_osx_control_view.get(swtControl); + final Object view = swt_osx_control_view.get(swtControl); swt_osx_view_id = view.getClass().getField(str_osx_id); h = swt_osx_view_id.getLong(view); } else { h = swt_osx_view_id.getLong( swt_osx_control_view.get(swtControl) ); } - } catch (Exception ex) { + } catch (final Exception ex) { throw new NativeWindowException(ex); } } } else { try { h = swt_control_handle.getLong(swtControl); - } catch (Exception ex) { + } catch (final Exception ex) { throw new NativeWindowException(ex); } } @@ -379,7 +379,7 @@ public class SWTAccessor { * @throws NativeWindowException if the widget handle is null * @throws UnsupportedOperationException if the windowing system is not supported */ - public static AbstractGraphicsDevice getDevice(Control swtControl) throws NativeWindowException, UnsupportedOperationException { + public static AbstractGraphicsDevice getDevice(final Control swtControl) throws NativeWindowException, UnsupportedOperationException { final long handle = getHandle(swtControl); if( isX11GTK ) { final long xdisplay0 = gdk_window_get_xdisplay( gdk_widget_get_window( handle ) ); @@ -399,11 +399,11 @@ public class SWTAccessor { * @param screen -1 is default screen of the given device, e.g. maybe 0 or determined by native API. >= 0 is specific screen * @return */ - public static AbstractGraphicsScreen getScreen(AbstractGraphicsDevice device, int screen) { + public static AbstractGraphicsScreen getScreen(final AbstractGraphicsDevice device, final int screen) { return NativeWindowFactory.createScreen(device, screen); } - public static int getNativeVisualID(AbstractGraphicsDevice device, long windowHandle) { + public static int getNativeVisualID(final AbstractGraphicsDevice device, final long windowHandle) { if( isX11 ) { return X11Lib.GetVisualIDFromWindow(device.getHandle(), windowHandle); } @@ -419,7 +419,7 @@ public class SWTAccessor { * @throws NativeWindowException if the widget handle is null * @throws UnsupportedOperationException if the windowing system is not supported */ - public static long getWindowHandle(Control swtControl) throws NativeWindowException, UnsupportedOperationException { + public static long getWindowHandle(final Control swtControl) throws NativeWindowException, UnsupportedOperationException { final long handle = getHandle(swtControl); if(0 == handle) { throw new NativeWindowException("Null SWT handle of SWT control "+swtControl); @@ -477,7 +477,7 @@ public class SWTAccessor { * @see Platform#AWT_AVAILABLE * @see Platform#getOSType() */ - public static void invoke(boolean wait, Runnable runnable) { + public static void invoke(final boolean wait, final Runnable runnable) { if( isOSX ) { // Use SWT main thread! Only reliable config w/ -XStartOnMainThread !? OSXUtil.RunOnMainThread(wait, false, runnable); @@ -493,7 +493,7 @@ public class SWTAccessor { * {@link #invoke(boolean, Runnable)} is being used. * @see #invoke(boolean, Runnable) */ - public static void invoke(org.eclipse.swt.widgets.Display display, boolean wait, Runnable runnable) { + public static void invoke(final org.eclipse.swt.widgets.Display display, final boolean wait, final Runnable runnable) { if( display.isDisposed() || Thread.currentThread() == display.getThread() ) { invoke(wait, runnable); } else if( wait ) { @@ -507,7 +507,7 @@ public class SWTAccessor { // Specific X11 GTK ChildWindow - Using plain X11 native parenting (works well) // - public static long createCompatibleX11ChildWindow(AbstractGraphicsScreen screen, Control swtControl, int visualID, int width, int height) { + public static long createCompatibleX11ChildWindow(final AbstractGraphicsScreen screen, final Control swtControl, final int visualID, final int width, final int height) { final long handle = getHandle(swtControl); final long parentWindow = gdk_widget_get_window( handle ); gdk_window_set_back_pixmap (parentWindow, 0, false); @@ -518,10 +518,10 @@ public class SWTAccessor { return x11WindowHandle; } - public static void resizeX11Window(AbstractGraphicsDevice device, Rectangle clientArea, long x11Window) { + public static void resizeX11Window(final AbstractGraphicsDevice device, final Rectangle clientArea, final long x11Window) { X11Lib.SetWindowPosSize(device.getHandle(), x11Window, clientArea.x, clientArea.y, clientArea.width, clientArea.height); } - public static void destroyX11Window(AbstractGraphicsDevice device, long x11Window) { + public static void destroyX11Window(final AbstractGraphicsDevice device, final long x11Window) { X11Lib.DestroyWindow(device.getHandle(), x11Window); } @@ -534,7 +534,7 @@ public class SWTAccessor { // public static final int GDK_WA_TYPE_HINT = 1 << 9; // public static final int GDK_WA_VISUAL = 1 << 6; - public static long createCompatibleGDKChildWindow(Control swtControl, int visualID, int width, int height) { + public static long createCompatibleGDKChildWindow(final Control swtControl, final int visualID, final int width, final int height) { return 0; /** final long handle = SWTAccessor.getHandle(swtControl); @@ -564,24 +564,24 @@ public class SWTAccessor { return childWindow; */ } - public static void showGDKWindow(long gdkWindow) { + public static void showGDKWindow(final long gdkWindow) { /* OS.gdk_window_show (gdkWindow); OS.gdk_flush(); */ } - public static void focusGDKWindow(long gdkWindow) { + public static void focusGDKWindow(final long gdkWindow) { /* OS.gdk_window_show (gdkWindow); OS.gdk_window_focus(gdkWindow, 0); OS.gdk_flush(); */ } - public static void resizeGDKWindow(Rectangle clientArea, long gdkWindow) { + public static void resizeGDKWindow(final Rectangle clientArea, final long gdkWindow) { /** OS.gdk_window_move (gdkWindow, clientArea.x, clientArea.y); OS.gdk_window_resize (gdkWindow, clientArea.width, clientArea.height); OS.gdk_flush(); */ } - public static void destroyGDKWindow(long gdkWindow) { + public static void destroyGDKWindow(final long gdkWindow) { // OS.gdk_window_destroy (gdkWindow); } } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsConfiguration.java b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsConfiguration.java index 120c86584..223cb5194 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsConfiguration.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsConfiguration.java @@ -48,9 +48,9 @@ import jogamp.nativewindow.x11.XVisualInfo; public class X11GraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable { private XVisualInfo info; - public X11GraphicsConfiguration(X11GraphicsScreen screen, - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, - XVisualInfo info) { + public X11GraphicsConfiguration(final X11GraphicsScreen screen, + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, + final XVisualInfo info) { super(screen, capsChosen, capsRequested); this.info = info; } @@ -64,7 +64,7 @@ public class X11GraphicsConfiguration extends MutableGraphicsConfiguration imple return info; } - final protected void setXVisualInfo(XVisualInfo info) { + final protected void setXVisualInfo(final XVisualInfo info) { this.info = info; } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java index 633b9eaf0..fea4e7019 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java @@ -98,7 +98,7 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl isXineramaEnabled = X11Util.XineramaIsEnabled(this); } - private static int getDefaultScreenImpl(long dpy) { + private static int getDefaultScreenImpl(final long dpy) { return X11Lib.DefaultScreen(dpy); } @@ -176,7 +176,7 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl return Boolean.valueOf(handleOwner); } @Override - protected Object setHandleOwnership(Object newOwnership) { + protected Object setHandleOwnership(final Object newOwnership) { final Boolean oldOwnership = Boolean.valueOf(handleOwner); handleOwner = ((Boolean) newOwnership).booleanValue(); return oldOwnership; diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsScreen.java b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsScreen.java index 700937829..8ebf3c379 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsScreen.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsScreen.java @@ -49,11 +49,11 @@ import jogamp.nativewindow.x11.X11Lib; public class X11GraphicsScreen extends DefaultGraphicsScreen implements Cloneable { /** Constructs a new X11GraphicsScreen corresponding to the given native screen index. */ - public X11GraphicsScreen(X11GraphicsDevice device, int screen) { + public X11GraphicsScreen(final X11GraphicsDevice device, final int screen) { super(device, device.isXineramaEnabled() ? 0 : screen); } - public static AbstractGraphicsScreen createScreenDevice(long display, int screenIdx, boolean owner) { + public static AbstractGraphicsScreen createScreenDevice(final long display, final int screenIdx, final boolean owner) { if(0==display) throw new NativeWindowException("display is null"); return new X11GraphicsScreen(new X11GraphicsDevice(display, AbstractGraphicsDevice.DEFAULT_UNIT, owner), screenIdx); } diff --git a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java index 9eed887b5..bf8952565 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java +++ b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java @@ -79,7 +79,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { public Object clone() { try { return super.clone(); - } catch (CloneNotSupportedException e) { + } catch (final CloneNotSupportedException e) { throw new NativeWindowException(e); } } @@ -89,7 +89,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { * from <code>source</code> into this instance. * @return this instance */ - public Capabilities copyFrom(CapabilitiesImmutable other) { + public Capabilities copyFrom(final CapabilitiesImmutable other) { redBits = other.getRedBits(); greenBits = other.getGreenBits(); blueBits = other.getBlueBits(); @@ -122,12 +122,12 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if(this == obj) { return true; } if(!(obj instanceof CapabilitiesImmutable)) { return false; } - CapabilitiesImmutable other = (CapabilitiesImmutable)obj; + final CapabilitiesImmutable other = (CapabilitiesImmutable)obj; boolean res = other.getRedBits()==redBits && other.getGreenBits()==greenBits && other.getBlueBits()==blueBits && @@ -171,7 +171,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { } @Override - public int getVisualID(VIDType type) throws NativeWindowException { + public int getVisualID(final VIDType type) throws NativeWindowException { switch(type) { case INTRINSIC: case NATIVE: @@ -189,7 +189,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { /** Sets the number of bits requested for the color buffer's red component. On some systems only the color depth, which is the sum of the red, green, and blue bits, is considered. */ - public void setRedBits(int redBits) { + public void setRedBits(final int redBits) { this.redBits = redBits; } @@ -201,7 +201,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { /** Sets the number of bits requested for the color buffer's green component. On some systems only the color depth, which is the sum of the red, green, and blue bits, is considered. */ - public void setGreenBits(int greenBits) { + public void setGreenBits(final int greenBits) { this.greenBits = greenBits; } @@ -213,7 +213,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { /** Sets the number of bits requested for the color buffer's blue component. On some systems only the color depth, which is the sum of the red, green, and blue bits, is considered. */ - public void setBlueBits(int blueBits) { + public void setBlueBits(final int blueBits) { this.blueBits = blueBits; } @@ -234,7 +234,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { * not to <i>reflect</i> a current state. Nevertheless if this is the case - call it at last. * </p> */ - public void setAlphaBits(int alphaBits) { + public void setAlphaBits(final int alphaBits) { this.alphaBits = alphaBits; } @@ -253,7 +253,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { * due to the composite work required by the window manager. * </p> */ - public void setBackgroundOpaque(boolean opaque) { + public void setBackgroundOpaque(final boolean opaque) { backgroundOpaque = opaque; if(!opaque && getAlphaBits()==0) { setAlphaBits(1); @@ -277,7 +277,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { * </p> * @param onscreen */ - public void setOnscreen(boolean onscreen) { + public void setOnscreen(final boolean onscreen) { this.onscreen=onscreen; } @@ -298,7 +298,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { * Requesting offscreen bitmap mode disables the offscreen auto selection. * </p> */ - public void setBitmap(boolean enable) { + public void setBitmap(final boolean enable) { if(enable) { setOnscreen(false); } @@ -327,31 +327,31 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { This value is ignored if {@link #isBackgroundOpaque()} equals true.<br> It defaults to half of the frambuffer value for red. <br> A value of -1 is interpreted as any value. */ - public void setTransparentRedValue(int transValueRed) { transparentValueRed=transValueRed; } + public void setTransparentRedValue(final int transValueRed) { transparentValueRed=transValueRed; } /** Sets the transparent green value for the frame buffer configuration, ranging from 0 to the maximum frame buffer value for green. This value is ignored if {@link #isBackgroundOpaque()} equals true.<br> It defaults to half of the frambuffer value for green.<br> A value of -1 is interpreted as any value. */ - public void setTransparentGreenValue(int transValueGreen) { transparentValueGreen=transValueGreen; } + public void setTransparentGreenValue(final int transValueGreen) { transparentValueGreen=transValueGreen; } /** Sets the transparent blue value for the frame buffer configuration, ranging from 0 to the maximum frame buffer value for blue. This value is ignored if {@link #isBackgroundOpaque()} equals true.<br> It defaults to half of the frambuffer value for blue.<br> A value of -1 is interpreted as any value. */ - public void setTransparentBlueValue(int transValueBlue) { transparentValueBlue=transValueBlue; } + public void setTransparentBlueValue(final int transValueBlue) { transparentValueBlue=transValueBlue; } /** Sets the transparent alpha value for the frame buffer configuration, ranging from 0 to the maximum frame buffer value for alpha. This value is ignored if {@link #isBackgroundOpaque()} equals true.<br> It defaults to half of the frambuffer value for alpha.<br> A value of -1 is interpreted as any value. */ - public void setTransparentAlphaValue(int transValueAlpha) { transparentValueAlpha=transValueAlpha; } + public void setTransparentAlphaValue(final int transValueAlpha) { transparentValueAlpha=transValueAlpha; } @Override - public StringBuilder toString(StringBuilder sink) { + public StringBuilder toString(final StringBuilder sink) { return toString(sink, true); } @@ -359,7 +359,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { object. */ @Override public String toString() { - StringBuilder msg = new StringBuilder(); + final StringBuilder msg = new StringBuilder(); msg.append("Caps["); toString(msg); msg.append("]"); @@ -393,7 +393,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { /** Component separator */ protected static final String CSEP = ", "; - protected StringBuilder toString(StringBuilder sink, boolean withOnOffScreen) { + protected StringBuilder toString(StringBuilder sink, final boolean withOnOffScreen) { if(null == sink) { sink = new StringBuilder(); } @@ -410,5 +410,5 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable { return sink; } - protected final String toHexString(int val) { return Integer.toHexString(val); } + protected final String toHexString(final int val) { return Integer.toHexString(val); } } diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java index 77cbe2995..d0c1a9b85 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java +++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java @@ -42,6 +42,8 @@ package javax.media.nativewindow; import java.util.List; +import com.jogamp.common.util.PropertyAccess; + import jogamp.nativewindow.Debug; /** <P> The default implementation of the {@link @@ -70,7 +72,7 @@ public class DefaultCapabilitiesChooser implements CapabilitiesChooser { static { Debug.initSingleton(); - DEBUG = Debug.isPropertyDefined("nativewindow.debug.CapabilitiesChooser", true); + DEBUG = PropertyAccess.isPropertyDefined("nativewindow.debug.CapabilitiesChooser", true); } private final static int NO_SCORE = -9999999; @@ -100,7 +102,7 @@ public class DefaultCapabilitiesChooser implements CapabilitiesChooser { } // Create score array - int[] scores = new int[availnum]; + final int[] scores = new int[availnum]; for (int i = 0; i < availnum; i++) { scores[i] = NO_SCORE; } @@ -137,7 +139,7 @@ public class DefaultCapabilitiesChooser implements CapabilitiesChooser { int scoreClosestToZero = NO_SCORE; int chosenIndex = -1; for (int i = 0; i < availnum; i++) { - int score = scores[i]; + final int score = scores[i]; if (score == NO_SCORE) { continue; } @@ -161,7 +163,7 @@ public class DefaultCapabilitiesChooser implements CapabilitiesChooser { return chosenIndex; } - private static int sign(int score) { + private static int sign(final int score) { if (score < 0) { return -1; } diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java index 42d7f3a23..7912832c1 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java +++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java @@ -41,8 +41,8 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics protected CapabilitiesImmutable capabilitiesChosen; protected CapabilitiesImmutable capabilitiesRequested; - public DefaultGraphicsConfiguration(AbstractGraphicsScreen screen, - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested) { + public DefaultGraphicsConfiguration(final AbstractGraphicsScreen screen, + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested) { if(null == screen) { throw new IllegalArgumentException("Null screen"); } @@ -64,7 +64,7 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics public Object clone() { try { return super.clone(); - } catch (CloneNotSupportedException e) { + } catch (final CloneNotSupportedException e) { throw new NativeWindowException(e); } } @@ -90,7 +90,7 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics } @Override - final public int getVisualID(VIDType type) throws NativeWindowException { + final public int getVisualID(final VIDType type) throws NativeWindowException { return capabilitiesChosen.getVisualID(type); } @@ -103,7 +103,7 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics * </p> * @see javax.media.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen) */ - protected void setChosenCapabilities(CapabilitiesImmutable capsChosen) { + protected void setChosenCapabilities(final CapabilitiesImmutable capsChosen) { this.capabilitiesChosen = capsChosen; } @@ -115,7 +115,7 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics * a change of the graphics device in a multi-screen environment. * </p> */ - protected void setScreen(AbstractGraphicsScreen screen) { + protected void setScreen(final AbstractGraphicsScreen screen) { this.screen = screen; } @@ -127,11 +127,11 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics "]"; } - public static String toHexString(int val) { + public static String toHexString(final int val) { return "0x"+Integer.toHexString(val); } - public static String toHexString(long val) { + public static String toHexString(final long val) { return "0x"+Long.toHexString(val); } } diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java index f733f91de..ab9286b3f 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java +++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java @@ -82,7 +82,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice public Object clone() { try { return super.clone(); - } catch (CloneNotSupportedException e) { + } catch (final CloneNotSupportedException e) { throw new NativeWindowException(e); } } @@ -178,7 +178,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice * Set the native handle of the underlying native device * and return the previous one. */ - protected final long setHandle(long newHandle) { + protected final long setHandle(final long newHandle) { final long oldHandle = handle; handle = newHandle; return oldHandle; @@ -187,7 +187,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice protected Object getHandleOwnership() { return null; } - protected Object setHandleOwnership(Object newOwnership) { + protected Object setHandleOwnership(final Object newOwnership) { return null; } @@ -222,7 +222,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice * @param locker the ToolkitLock, if null, {@link jogamp.nativewindow.NullToolkitLock} is being used * @return the previous ToolkitLock instance */ - protected ToolkitLock setToolkitLock(ToolkitLock locker) { + protected ToolkitLock setToolkitLock(final ToolkitLock locker) { final ToolkitLock _toolkitLock = toolkitLock; _toolkitLock.lock(); try { diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java index 4bd548916..3ee775904 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java +++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java @@ -36,12 +36,12 @@ public class DefaultGraphicsScreen implements Cloneable, AbstractGraphicsScreen private final AbstractGraphicsDevice device; private final int idx; - public DefaultGraphicsScreen(AbstractGraphicsDevice device, int idx) { + public DefaultGraphicsScreen(final AbstractGraphicsDevice device, final int idx) { this.device = device; this.idx = idx; } - public static AbstractGraphicsScreen createDefault(String type) { + public static AbstractGraphicsScreen createDefault(final String type) { return new DefaultGraphicsScreen(new DefaultGraphicsDevice(type, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT), 0); } @@ -49,7 +49,7 @@ public class DefaultGraphicsScreen implements Cloneable, AbstractGraphicsScreen public Object clone() { try { return super.clone(); - } catch (CloneNotSupportedException e) { + } catch (final CloneNotSupportedException e) { throw new NativeWindowException(e); } } diff --git a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java index c09e6eaa4..3f8113baa 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java @@ -70,7 +70,7 @@ public abstract class GraphicsConfigurationFactory { public final Class<?> capsType; private final int hash32; - public DeviceCapsType(Class<?> deviceType, Class<?> capsType) { + public DeviceCapsType(final Class<?> deviceType, final Class<?> capsType) { this.deviceType = deviceType; this.capsType = capsType; @@ -86,10 +86,10 @@ public abstract class GraphicsConfigurationFactory { } @Override - public final boolean equals(Object obj) { + public final boolean equals(final Object obj) { if(this == obj) { return true; } if (obj instanceof DeviceCapsType) { - DeviceCapsType dct = (DeviceCapsType)obj; + final DeviceCapsType dct = (DeviceCapsType)obj; return deviceType == dct.deviceType && capsType == dct.capsType; } return false; @@ -135,14 +135,14 @@ public abstract class GraphicsConfigurationFactory { try { ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.X11GraphicsConfigurationFactory", "registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader()); - } catch (Exception e) { + } catch (final Exception e) { throw new RuntimeException(e); } if(NativeWindowFactory.isAWTAvailable()) { try { ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.awt.X11AWTGraphicsConfigurationFactory", "registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader()); - } catch (Exception e) { /* n/a */ } + } catch (final Exception e) { /* n/a */ } } } } @@ -162,11 +162,11 @@ public abstract class GraphicsConfigurationFactory { return Thread.currentThread().getName(); } - protected static String toHexString(int val) { + protected static String toHexString(final int val) { return "0x" + Integer.toHexString(val); } - protected static String toHexString(long val) { + protected static String toHexString(final long val) { return "0x" + Long.toHexString(val); } @@ -181,7 +181,7 @@ public abstract class GraphicsConfigurationFactory { * * @see #getFactory(Class, Class) */ - public static GraphicsConfigurationFactory getFactory(AbstractGraphicsDevice device, CapabilitiesImmutable caps) { + public static GraphicsConfigurationFactory getFactory(final AbstractGraphicsDevice device, final CapabilitiesImmutable caps) { if (device == null) { throw new IllegalArgumentException("null device"); } @@ -216,7 +216,7 @@ public abstract class GraphicsConfigurationFactory { * @throws IllegalArgumentException if the deviceType does not implement {@link AbstractGraphicsDevice} or * capabilitiesType does not implement {@link CapabilitiesImmutable} */ - public static GraphicsConfigurationFactory getFactory(Class<?> deviceType, Class<?> capabilitiesType) + public static GraphicsConfigurationFactory getFactory(final Class<?> deviceType, final Class<?> capabilitiesType) throws IllegalArgumentException, NativeWindowException { if (!(defaultDeviceCapsType.deviceType.isAssignableFrom(deviceType))) { @@ -242,7 +242,7 @@ public abstract class GraphicsConfigurationFactory { for(int j=0; j<deviceTypes.size(); j++) { final Class<?> interfaceDevice = deviceTypes.get(j); for(int i=0; i<capabilitiesTypes.size(); i++) { - Class<?> interfaceCaps = capabilitiesTypes.get(i); + final Class<?> interfaceCaps = capabilitiesTypes.get(i); final DeviceCapsType dct = new DeviceCapsType(interfaceDevice, interfaceCaps); final GraphicsConfigurationFactory factory = registeredFactories.get(dct); if (factory != null) { @@ -260,7 +260,7 @@ public abstract class GraphicsConfigurationFactory { } return factory; } - private static ArrayList<Class<?>> getAllAssignableClassesFrom(Class<?> superClassOrInterface, Class<?> fromClass, boolean interfacesOnly) { + private static ArrayList<Class<?>> getAllAssignableClassesFrom(final Class<?> superClassOrInterface, final Class<?> fromClass, final boolean interfacesOnly) { // Using a todo list avoiding a recursive loop! final ArrayList<Class<?>> inspectClasses = new ArrayList<Class<?>>(); final ArrayList<Class<?>> resolvedInterfaces = new ArrayList<Class<?>>(); @@ -271,7 +271,7 @@ public abstract class GraphicsConfigurationFactory { } return resolvedInterfaces; } - private static void getAllAssignableClassesFrom(Class<?> superClassOrInterface, Class<?> fromClass, boolean interfacesOnly, List<Class<?>> resolvedInterfaces, List<Class<?>> inspectClasses) { + private static void getAllAssignableClassesFrom(final Class<?> superClassOrInterface, final Class<?> fromClass, final boolean interfacesOnly, final List<Class<?>> resolvedInterfaces, final List<Class<?>> inspectClasses) { final ArrayList<Class<?>> types = new ArrayList<Class<?>>(); if( superClassOrInterface.isAssignableFrom(fromClass) && !resolvedInterfaces.contains(fromClass)) { if( !interfacesOnly || fromClass.isInterface() ) { @@ -295,10 +295,10 @@ public abstract class GraphicsConfigurationFactory { } } private static void dumpFactories() { - Set<DeviceCapsType> dcts = registeredFactories.keySet(); + final Set<DeviceCapsType> dcts = registeredFactories.keySet(); int i=0; - for(Iterator<DeviceCapsType> iter = dcts.iterator(); iter.hasNext(); ) { - DeviceCapsType dct = iter.next(); + for(final Iterator<DeviceCapsType> iter = dcts.iterator(); iter.hasNext(); ) { + final DeviceCapsType dct = iter.next(); System.err.println("Factory #"+i+": "+dct+" -> "+registeredFactories.get(dct)); i++; } @@ -323,7 +323,7 @@ public abstract class GraphicsConfigurationFactory { * @return the previous registered factory, or null if none * @throws IllegalArgumentException if the given class does not implement AbstractGraphicsDevice */ - protected static GraphicsConfigurationFactory registerFactory(Class<?> abstractGraphicsDeviceImplementor, Class<?> capabilitiesType, GraphicsConfigurationFactory factory) + protected static GraphicsConfigurationFactory registerFactory(final Class<?> abstractGraphicsDeviceImplementor, final Class<?> capabilitiesType, final GraphicsConfigurationFactory factory) throws IllegalArgumentException { if (!(defaultDeviceCapsType.deviceType.isAssignableFrom(abstractGraphicsDeviceImplementor))) { @@ -400,9 +400,9 @@ public abstract class GraphicsConfigurationFactory { * @see javax.media.nativewindow.DefaultGraphicsConfiguration#setChosenCapabilities(Capabilities caps) */ public final AbstractGraphicsConfiguration - chooseGraphicsConfiguration(CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, - CapabilitiesChooser chooser, - AbstractGraphicsScreen screen, int nativeVisualID) + chooseGraphicsConfiguration(final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, + final CapabilitiesChooser chooser, + final AbstractGraphicsScreen screen, final int nativeVisualID) throws IllegalArgumentException, NativeWindowException { if(null==capsChosen) { throw new NativeWindowException("Chosen Capabilities are null"); @@ -413,7 +413,7 @@ public abstract class GraphicsConfigurationFactory { if(null==screen) { throw new NativeWindowException("Screen is null"); } - AbstractGraphicsDevice device = screen.getDevice(); + final AbstractGraphicsDevice device = screen.getDevice(); if(null==device) { throw new NativeWindowException("Screen's Device is null"); } diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java index 0943c8c09..16355032f 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java @@ -50,19 +50,19 @@ public class NativeWindowException extends RuntimeException { /** Constructs a NativeWindowException object with the specified detail message. */ - public NativeWindowException(String message) { + public NativeWindowException(final String message) { super(message); } /** Constructs a NativeWindowException object with the specified detail message and root cause. */ - public NativeWindowException(String message, Throwable cause) { + public NativeWindowException(final String message, final Throwable cause) { super(message, cause); } /** Constructs a NativeWindowException object with the specified root cause. */ - public NativeWindowException(Throwable cause) { + public NativeWindowException(final Throwable cause) { super(cause); } } diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java index 5ef32a5aa..b2889fdcf 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java @@ -45,6 +45,7 @@ import java.util.Map; import javax.media.nativewindow.util.PointImmutable; +import jogamp.common.os.PlatformPropsImpl; import jogamp.nativewindow.Debug; import jogamp.nativewindow.NativeWindowFactoryImpl; import jogamp.nativewindow.ToolkitProperties; @@ -55,6 +56,7 @@ import jogamp.nativewindow.windows.GDIUtil; import jogamp.nativewindow.x11.X11Lib; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; import com.jogamp.nativewindow.UpstreamWindowHookMutableSizePos; import com.jogamp.nativewindow.awt.AWTGraphicsDevice; @@ -143,7 +145,7 @@ public abstract class NativeWindowFactory { } private static String _getNativeWindowingType() { - switch(Platform.OS_TYPE) { + switch(PlatformPropsImpl.OS_TYPE) { case ANDROID: return TYPE_ANDROID; case MACOS: @@ -174,7 +176,7 @@ public abstract class NativeWindowFactory { public Object run() { Platform.initSingleton(); // last resort .. _DEBUG[0] = Debug.debug("NativeWindow"); - _tmp[0] = Debug.getProperty("nativewindow.ws.name", true); + _tmp[0] = PropertyAccess.getProperty("nativewindow.ws.name", true); Runtime.getRuntime().addShutdownHook( new Thread(new Runnable() { @Override @@ -234,7 +236,7 @@ public abstract class NativeWindowFactory { * @param head if true add runnable at the start, otherwise at the end * @param runnable runnable to be added. */ - public static void addCustomShutdownHook(boolean head, Runnable runnable) { + public static void addCustomShutdownHook(final boolean head, final Runnable runnable) { synchronized( customShutdownHooks ) { if( !customShutdownHooks.contains( runnable ) ) { if( head ) { @@ -249,7 +251,7 @@ public abstract class NativeWindowFactory { /** * Cleanup resources at JVM shutdown */ - public static synchronized void shutdown(boolean _isJVMShuttingDown) { + public static synchronized void shutdown(final boolean _isJVMShuttingDown) { isJVMShuttingDown = _isJVMShuttingDown; if(DEBUG) { System.err.println("NativeWindowFactory.shutdown() START: JVM Shutdown "+isJVMShuttingDown+", on thread "+Thread.currentThread().getName()); @@ -262,8 +264,8 @@ public abstract class NativeWindowFactory { System.err.println("NativeWindowFactory.shutdown - customShutdownHook #"+(i+1)+"/"+cshCount); } customShutdownHooks.get(i).run(); - } catch(Throwable t) { - System.err.println("NativeWindowFactory.shutdown: Catched "+t.getClass().getName()+" during customShutdownHook #"+(i+1)+"/"+cshCount); + } catch(final Throwable t) { + System.err.println("NativeWindowFactory.shutdown: Caught "+t.getClass().getName()+" during customShutdownHook #"+(i+1)+"/"+cshCount); if( DEBUG ) { t.printStackTrace(); } @@ -329,19 +331,19 @@ public abstract class NativeWindowFactory { if( Platform.AWT_AVAILABLE && ReflectionUtil.isClassAvailable("com.jogamp.nativewindow.awt.AWTGraphicsDevice", cl) ) { - Method[] jawtUtilMethods = AccessController.doPrivileged(new PrivilegedAction<Method[]>() { + final Method[] jawtUtilMethods = AccessController.doPrivileged(new PrivilegedAction<Method[]>() { @Override public Method[] run() { try { - Class<?> _jawtUtilClass = Class.forName(JAWTUtilClassName, true, NativeWindowFactory.class.getClassLoader()); - Method jawtUtilIsHeadlessMethod = _jawtUtilClass.getDeclaredMethod("isHeadlessMode", (Class[])null); + final Class<?> _jawtUtilClass = Class.forName(JAWTUtilClassName, true, NativeWindowFactory.class.getClassLoader()); + final Method jawtUtilIsHeadlessMethod = _jawtUtilClass.getDeclaredMethod("isHeadlessMode", (Class[])null); jawtUtilIsHeadlessMethod.setAccessible(true); - Method jawtUtilInitMethod = _jawtUtilClass.getDeclaredMethod("initSingleton", (Class[])null); + final Method jawtUtilInitMethod = _jawtUtilClass.getDeclaredMethod("initSingleton", (Class[])null); jawtUtilInitMethod.setAccessible(true); - Method jawtUtilGetJAWTToolkitLockMethod = _jawtUtilClass.getDeclaredMethod("getJAWTToolkitLock", new Class[]{}); + final Method jawtUtilGetJAWTToolkitLockMethod = _jawtUtilClass.getDeclaredMethod("getJAWTToolkitLock", new Class[]{}); jawtUtilGetJAWTToolkitLockMethod.setAccessible(true); return new Method[] { jawtUtilInitMethod, jawtUtilIsHeadlessMethod, jawtUtilGetJAWTToolkitLockMethod }; - } catch (Exception e) { + } catch (final Exception e) { if(DEBUG) { e.printStackTrace(); } @@ -382,7 +384,7 @@ public abstract class NativeWindowFactory { registeredFactories = Collections.synchronizedMap(new HashMap<Class<?>, NativeWindowFactory>()); // register our default factory -> NativeWindow - NativeWindowFactory factory = new NativeWindowFactoryImpl(); + final NativeWindowFactory factory = new NativeWindowFactoryImpl(); nativeWindowClass = javax.media.nativewindow.NativeWindow.class; registerFactory(nativeWindowClass, factory); defaultFactory = factory; @@ -414,7 +416,7 @@ public abstract class NativeWindowFactory { * @return the native window type, e.g. {@link #TYPE_X11}, which is canonical via {@link String#intern()}. * Hence {@link String#equals(Object)} and <code>==</code> produce the same result. */ - public static String getNativeWindowType(boolean useCustom) { + public static String getNativeWindowType(final boolean useCustom) { return useCustom?nativeWindowingTypeCustom:nativeWindowingTypePure; } @@ -431,7 +433,7 @@ public abstract class NativeWindowFactory { } */ /** Sets the default NativeWindowFactory. */ - public static void setDefaultFactory(NativeWindowFactory factory) { + public static void setDefaultFactory(final NativeWindowFactory factory) { defaultFactory = factory; } @@ -472,7 +474,7 @@ public abstract class NativeWindowFactory { * <li> {@link jogamp.nativewindow.NullToolkitLock} </li> * </ul> */ - public static ToolkitLock getDefaultToolkitLock(String type) { + public static ToolkitLock getDefaultToolkitLock(final String type) { if( requiresToolkitLock ) { if( TYPE_AWT == type && isAWTAvailable() ) { return getAWTToolkitLock(); @@ -490,7 +492,7 @@ public abstract class NativeWindowFactory { * <li> {@link jogamp.nativewindow.NullToolkitLock} </li> * </ul> */ - public static ToolkitLock getDefaultToolkitLock(String type, long deviceHandle) { + public static ToolkitLock getDefaultToolkitLock(final String type, final long deviceHandle) { if( requiresToolkitLock ) { if( TYPE_AWT == type && isAWTAvailable() ) { return getAWTToolkitLock(); @@ -505,7 +507,7 @@ public abstract class NativeWindowFactory { * @param screen -1 is default screen of the given device, e.g. maybe 0 or determined by native API. >= 0 is specific screen * @return newly created AbstractGraphicsScreen matching device's native type */ - public static AbstractGraphicsScreen createScreen(AbstractGraphicsDevice device, int screen) { + public static AbstractGraphicsScreen createScreen(final AbstractGraphicsDevice device, int screen) { final String type = device.getType(); if( TYPE_X11 == type ) { final X11GraphicsDevice x11Device = (X11GraphicsDevice)device; @@ -530,13 +532,13 @@ public abstract class NativeWindowFactory { already assumed the responsibility of creating a compatible NativeWindow implementation, or it might be that of a toolkit class like {@link java.awt.Component Component}. */ - public static NativeWindowFactory getFactory(Class<?> windowClass) throws IllegalArgumentException { + public static NativeWindowFactory getFactory(final Class<?> windowClass) throws IllegalArgumentException { if (nativeWindowClass.isAssignableFrom(windowClass)) { return registeredFactories.get(nativeWindowClass); } Class<?> clazz = windowClass; while (clazz != null) { - NativeWindowFactory factory = registeredFactories.get(clazz); + final NativeWindowFactory factory = registeredFactories.get(clazz); if (factory != null) { return factory; } @@ -548,7 +550,7 @@ public abstract class NativeWindowFactory { /** Registers a NativeWindowFactory handling window objects of the given class. This does not need to be called by end users, only implementors of new NativeWindowFactory subclasses. */ - protected static void registerFactory(Class<?> windowClass, NativeWindowFactory factory) { + protected static void registerFactory(final Class<?> windowClass, final NativeWindowFactory factory) { if(DEBUG) { System.err.println("NativeWindowFactory.registerFactory() "+windowClass+" -> "+factory); } @@ -574,7 +576,7 @@ public abstract class NativeWindowFactory { @see javax.media.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen) */ - public static NativeWindow getNativeWindow(Object winObj, AbstractGraphicsConfiguration config) throws IllegalArgumentException, NativeWindowException { + public static NativeWindow getNativeWindow(final Object winObj, final AbstractGraphicsConfiguration config) throws IllegalArgumentException, NativeWindowException { if (winObj == null) { throw new IllegalArgumentException("Null window object"); } @@ -600,7 +602,7 @@ public abstract class NativeWindowFactory { * @param ifEnabled If true, only return the enabled {@link OffscreenLayerSurface}, see {@link OffscreenLayerOption#isOffscreenLayerSurfaceEnabled()}. * @return */ - public static OffscreenLayerSurface getOffscreenLayerSurface(NativeSurface surface, boolean ifEnabled) { + public static OffscreenLayerSurface getOffscreenLayerSurface(final NativeSurface surface, final boolean ifEnabled) { if(surface instanceof OffscreenLayerSurface && ( !ifEnabled || surface instanceof OffscreenLayerOption ) ) { final OffscreenLayerSurface ols = (OffscreenLayerSurface) surface; @@ -631,7 +633,7 @@ public abstract class NativeWindowFactory { * at creation time (see above), it is not valid for further processing. * </p> */ - public static boolean isNativeVisualIDValidForProcessing(int visualID) { + public static boolean isNativeVisualIDValidForProcessing(final int visualID) { return NativeWindowFactory.TYPE_X11 != NativeWindowFactory.getNativeWindowType(false) || VisualIDHolder.VID_UNDEFINED != visualID ; } @@ -642,7 +644,7 @@ public abstract class NativeWindowFactory { * The device will be opened if <code>own</code> is true, otherwise no native handle will ever be acquired. * </p> */ - public static AbstractGraphicsDevice createDevice(String displayConnection, boolean own) { + public static AbstractGraphicsDevice createDevice(final String displayConnection, final boolean own) { final String nwt = NativeWindowFactory.getNativeWindowType(true); if( NativeWindowFactory.TYPE_X11 == nwt ) { if( own ) { @@ -679,8 +681,8 @@ public abstract class NativeWindowFactory { * or a simple <i>dummy</i> instance, see {@link #createDevice(String, boolean)}. * </p> */ - public static NativeWindow createWrappedWindow(AbstractGraphicsScreen aScreen, long surfaceHandle, long windowHandle, - UpstreamWindowHookMutableSizePos hook) { + public static NativeWindow createWrappedWindow(final AbstractGraphicsScreen aScreen, final long surfaceHandle, final long windowHandle, + final UpstreamWindowHookMutableSizePos hook) { final CapabilitiesImmutable caps = new Capabilities(); final AbstractGraphicsConfiguration config = new DefaultGraphicsConfiguration(aScreen, caps, caps); return new WrappedWindow(config, surfaceHandle, hook, true, windowHandle); @@ -690,7 +692,7 @@ public abstract class NativeWindowFactory { * @param nw * @return top-left client-area position in window units */ - public static PointImmutable getLocationOnScreen(NativeWindow nw) { + public static PointImmutable getLocationOnScreen(final NativeWindow nw) { final String nwt = NativeWindowFactory.getNativeWindowType(true); if( NativeWindowFactory.TYPE_X11 == nwt ) { return X11Lib.GetRelativeLocation(nw.getDisplayHandle(), nw.getScreenIndex(), nw.getWindowHandle(), 0, 0, 0); diff --git a/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java b/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java index 4ed79b1dc..e337166d4 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java +++ b/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java @@ -51,7 +51,7 @@ public interface VisualIDHolder { public final int id; - VIDType(int id){ + VIDType(final int id){ this.id = id; } } @@ -114,14 +114,14 @@ public interface VisualIDHolder { /** Comparing {@link VIDType#NATIVE} */ public static class VIDComparator implements Comparator<VisualIDHolder> { - private VIDType type; + private final VIDType type; - public VIDComparator(VIDType type) { + public VIDComparator(final VIDType type) { this.type = type; } @Override - public int compare(VisualIDHolder vid1, VisualIDHolder vid2) { + public int compare(final VisualIDHolder vid1, final VisualIDHolder vid2) { final int id1 = vid1.getVisualID(type); final int id2 = vid2.getVisualID(type); diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java b/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java index 5c9dc279d..4c9672c26 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java @@ -58,7 +58,7 @@ public class Dimension implements Cloneable, DimensionImmutable { public Object clone() { try { return super.clone(); - } catch (CloneNotSupportedException ex) { + } catch (final CloneNotSupportedException ex) { throw new InternalError(); } } @@ -68,22 +68,22 @@ public class Dimension implements Cloneable, DimensionImmutable { @Override public final int getHeight() { return height; } - public final void set(int width, int height) { + public final void set(final int width, final int height) { this.width = width; this.height = height; } - public final void setWidth(int width) { + public final void setWidth(final int width) { this.width = width; } - public final void setHeight(int height) { + public final void setHeight(final int height) { this.height = height; } - public final Dimension scale(int s) { + public final Dimension scale(final int s) { width *= s; height *= s; return this; } - public final Dimension add(Dimension pd) { + public final Dimension add(final Dimension pd) { width += pd.width ; height += pd.height ; return this; @@ -108,10 +108,10 @@ public class Dimension implements Cloneable, DimensionImmutable { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if(this == obj) { return true; } if (obj instanceof Dimension) { - Dimension p = (Dimension)obj; + final Dimension p = (Dimension)obj; return height == p.height && width == p.width ; } @@ -121,7 +121,7 @@ public class Dimension implements Cloneable, DimensionImmutable { @Override public int hashCode() { // 31 * x == (x << 5) - x - int hash = 31 + width; + final int hash = 31 + width; return ((hash << 5) - hash) + height; } } diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java index dfe78b06f..5ec4c758f 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java @@ -42,7 +42,7 @@ public class Insets implements Cloneable, InsetsImmutable { this(0, 0, 0, 0); } - public Insets(int left, int right, int top, int bottom) { + public Insets(final int left, final int right, final int top, final int bottom) { this.l=left; this.r=right; this.t=top; @@ -58,7 +58,7 @@ public class Insets implements Cloneable, InsetsImmutable { protected Object clone() { try { return super.clone(); - } catch (CloneNotSupportedException ex) { + } catch (final CloneNotSupportedException ex) { throw new InternalError(); } } @@ -83,35 +83,35 @@ public class Insets implements Cloneable, InsetsImmutable { * @param top top inset width in window units. * @param bottom bottom inset width in window units. */ - public final void set(int left, int right, int top, int bottom) { + public final void set(final int left, final int right, final int top, final int bottom) { l = left; r = right; t = top; b = bottom; } /** * Set the left inset value of this instance in window units. * @param left left inset width in window units. */ - public final void setLeftWidth(int left) { l = left; } + public final void setLeftWidth(final int left) { l = left; } /** * Set the right inset value of this instance in window units. * @param right right inset width in window units. */ - public final void setRightWidth(int right) { r = right; } + public final void setRightWidth(final int right) { r = right; } /** * Set the top inset value of this instance in window units. * @param top top inset width in window units. */ - public final void setTopHeight(int top) { t = top; } + public final void setTopHeight(final int top) { t = top; } /** * Set the bottom inset value of this instance in window units. * @param bottom bottom inset width in window units. */ - public final void setBottomHeight(int bottom) { b = bottom; } + public final void setBottomHeight(final int bottom) { b = bottom; } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if(this == obj) { return true; } if (obj instanceof Insets) { - Insets insets = (Insets)obj; + final Insets insets = (Insets)obj; return (r == insets.r) && (l == insets.l) && (b == insets.b) && (t == insets.t); } @@ -120,11 +120,11 @@ public class Insets implements Cloneable, InsetsImmutable { @Override public int hashCode() { - int sum1 = l + b; - int sum2 = t + r; - int val1 = sum1 * (sum1 + 1)/2 + l; - int val2 = sum2 * (sum2 + 1)/2 + r; - int sum3 = val1 + val2; + final int sum1 = l + b; + final int sum2 = t + r; + final int val1 = sum1 * (sum1 + 1)/2 + l; + final int val2 = sum2 * (sum2 + 1)/2 + r; + final int sum3 = val1 + val2; return sum3 * (sum3 + 1)/2 + val2; } diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormat.java b/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormat.java index 823496a92..fd3c31f7f 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormat.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormat.java @@ -189,7 +189,7 @@ public enum PixelFormat { /** Number of bytes per pixel, e.g. 4 for RGBA. */ public final int bytesPerPixel() { return (7+bitsPerPixel)/8; } - private PixelFormat(int componentCount, int bpp) { + private PixelFormat(final int componentCount, final int bpp) { this.componentCount = componentCount; this.bitsPerPixel = bpp; } diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormatUtil.java b/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormatUtil.java index 87a9ca4fc..21bfa8a54 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormatUtil.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/PixelFormatUtil.java @@ -85,7 +85,7 @@ public class PixelFormatUtil { * Returns the {@link PixelFormat} with reversed components of <code>fmt</code>. * If no reversed {@link PixelFormat} is available, returns <code>fmt</code>. */ - public static PixelFormat getReversed(PixelFormat fmt) { + public static PixelFormat getReversed(final PixelFormat fmt) { switch(fmt) { case LUMINANCE: return PixelFormat.LUMINANCE; @@ -106,7 +106,7 @@ public class PixelFormatUtil { } } - public static int getValue32(PixelFormat src_fmt, ByteBuffer src, int srcOff) { + public static int getValue32(final PixelFormat src_fmt, final ByteBuffer src, int srcOff) { switch(src_fmt) { case LUMINANCE: { final byte c1 = src.get(srcOff++); @@ -134,7 +134,7 @@ public class PixelFormatUtil { } } - public static int convertToInt32(PixelFormat dest_fmt, final byte r, final byte g, final byte b, final byte a) { + public static int convertToInt32(final PixelFormat dest_fmt, final byte r, final byte g, final byte b, final byte a) { switch(dest_fmt) { case LUMINANCE: { final byte l = ( byte) ( ( ( ( 0xff & r ) + ( 0xff & g ) + ( 0xff & b ) ) / 3 ) ); @@ -157,7 +157,7 @@ public class PixelFormatUtil { } } - public static int convertToInt32(PixelFormat dest_fmt, PixelFormat src_fmt, ByteBuffer src, int srcOff) { + public static int convertToInt32(final PixelFormat dest_fmt, final PixelFormat src_fmt, final ByteBuffer src, int srcOff) { final byte r, g, b, a; switch(src_fmt) { case LUMINANCE: @@ -208,7 +208,7 @@ public class PixelFormatUtil { return convertToInt32(dest_fmt, r, g, b, a); } - public static int convertToInt32(PixelFormat dest_fmt, PixelFormat src_fmt, final int src_pixel) { + public static int convertToInt32(final PixelFormat dest_fmt, final PixelFormat src_fmt, final int src_pixel) { final byte r, g, b, a; switch(src_fmt) { case LUMINANCE: @@ -260,7 +260,7 @@ public class PixelFormatUtil { } public static PixelRectangle convert32(final PixelRectangle src, - final PixelFormat destFmt, int ddestStride, final boolean isGLOriented, + final PixelFormat destFmt, final int ddestStride, final boolean isGLOriented, final boolean destIsDirect) { final int width = src.getSize().getWidth(); final int height = src.getSize().getHeight(); @@ -281,7 +281,7 @@ public class PixelFormatUtil { // System.err.println("XXX: DEST fmt "+destFmt+", stride "+destStride+" ("+ddestStride+"), isGL "+isGLOriented+", "+width+"x"+height+", capacity "+capacity+", "+bb); 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) { int o = destStride*y+x*bpp; bb.put(o++, (byte) ( pixel )); // 1 if( 3 <= bpp ) { @@ -309,7 +309,7 @@ public class PixelFormatUtil { return new PixelRectangle.GenericPixelRect(destFmt, src.getSize(), destStride, isGLOriented, bb); } - public static void convert32(PixelSink32 destInt32, final PixelRectangle src) { + public static void convert32(final PixelSink32 destInt32, final PixelRectangle src) { convert32(destInt32, src.getPixels(), src.getPixelformat(), src.isGLOriented(), @@ -333,7 +333,7 @@ public class PixelFormatUtil { * Must be >= {@link PixelFormat#bytesPerPixel() src_fmt.bytesPerPixel()} * width. * @throws IllegalArgumentException if <code>strideInBytes</code> is invalid */ - public static void convert32(PixelSink32 dest32, + public static void convert32(final PixelSink32 dest32, final ByteBuffer src_bb, final PixelFormat src_fmt, final boolean src_glOriented, final int width, final int height, int stride_bytes) { final int src_bpp = src_fmt.bytesPerPixel(); if( 0 != stride_bytes ) { diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java b/src/nativewindow/classes/javax/media/nativewindow/util/Point.java index e544118d0..3576a7dd0 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/Point.java @@ -33,7 +33,7 @@ public class Point implements Cloneable, PointImmutable { int x; int y; - public Point(int x, int y) { + public Point(final int x, final int y) { this.x=x; this.y=y; } @@ -51,7 +51,7 @@ public class Point implements Cloneable, PointImmutable { public Object clone() { try { return super.clone(); - } catch (CloneNotSupportedException ex) { + } catch (final CloneNotSupportedException ex) { throw new InternalError(); } } @@ -70,10 +70,10 @@ public class Point implements Cloneable, PointImmutable { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if(this == obj) { return true; } if (obj instanceof Point) { - Point p = (Point)obj; + final Point p = (Point)obj; return y == p.y && x == p.x; } return false; @@ -102,9 +102,9 @@ public class Point implements Cloneable, PointImmutable { return x + " / " + y; } - public final void set(int x, int y) { this.x = x; this.y = y; } - public final void setX(int x) { this.x = x; } - public final void setY(int y) { this.y = y; } + public final void set(final int x, final int y) { this.x = x; this.y = y; } + public final void setX(final int x) { this.x = x; } + public final void setY(final int y) { this.y = y; } /** * Translate this instance's x- and y-components, @@ -112,7 +112,7 @@ public class Point implements Cloneable, PointImmutable { * @param pd delta point * @return this instance for scaling */ - public final Point translate(Point pd) { + public final Point translate(final Point pd) { x += pd.x ; y += pd.y ; return this; @@ -125,7 +125,7 @@ public class Point implements Cloneable, PointImmutable { * @param dy delta for y * @return this instance for scaling */ - public final Point translate(int dx, int dy) { + public final Point translate(final int dx, final int dy) { x += dx ; y += dy ; return this; @@ -138,7 +138,7 @@ public class Point implements Cloneable, PointImmutable { * @param sy scale factor for y * @return this instance for scaling */ - public final Point scale(int sx, int sy) { + public final Point scale(final int sx, final int sy) { x *= sx ; y *= sy ; return this; @@ -151,7 +151,7 @@ public class Point implements Cloneable, PointImmutable { * @param sy inverse scale factor for y * @return this instance for scaling */ - public final Point scaleInv(int sx, int sy) { + public final Point scaleInv(final int sx, final int sy) { x /= sx ; y /= sy ; return this; diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java b/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java index 57535c26e..acc7b722d 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java @@ -56,7 +56,7 @@ public class Rectangle implements Cloneable, RectangleImmutable { protected Object clone() { try { return super.clone(); - } catch (CloneNotSupportedException ex) { + } catch (final CloneNotSupportedException ex) { throw new InternalError(); } } @@ -154,7 +154,7 @@ public class Rectangle implements Cloneable, RectangleImmutable { * @param sy scale factor for y * @return this instance for scaling */ - public final Rectangle scale(int sx, int sy) { + public final Rectangle scale(final int sx, final int sy) { x *= sx ; y *= sy ; width *= sx ; @@ -169,7 +169,7 @@ public class Rectangle implements Cloneable, RectangleImmutable { * @param sy inverse scale factor for y * @return this instance for scaling */ - public final Rectangle scaleInv(int sx, int sy) { + public final Rectangle scaleInv(final int sx, final int sy) { x /= sx ; y /= sy ; width /= sx ; @@ -203,10 +203,10 @@ public class Rectangle implements Cloneable, RectangleImmutable { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if(this == obj) { return true; } if (obj instanceof Rectangle) { - Rectangle rect = (Rectangle)obj; + final Rectangle rect = (Rectangle)obj; return (y == rect.y) && (x == rect.x) && (height == rect.height) && (width == rect.width); } @@ -215,11 +215,11 @@ public class Rectangle implements Cloneable, RectangleImmutable { @Override public int hashCode() { - int sum1 = x + height; - int sum2 = width + y; - int val1 = sum1 * (sum1 + 1)/2 + x; - int val2 = sum2 * (sum2 + 1)/2 + y; - int sum3 = val1 + val2; + final int sum1 = x + height; + final int sum2 = width + y; + final int val1 = sum1 * (sum1 + 1)/2 + x; + final int val2 = sum2 * (sum2 + 1)/2 + y; + final int sum3 = val1 + val2; return sum3 * (sum3 + 1)/2 + val2; } diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java b/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java index 6b4d2f19c..601e6dd71 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java @@ -40,7 +40,7 @@ public class SurfaceSize implements Comparable<SurfaceSize> { final DimensionImmutable resolution; final int bitsPerPixel; - public SurfaceSize(DimensionImmutable resolution, int bitsPerPixel) { + public SurfaceSize(final DimensionImmutable resolution, final int bitsPerPixel) { if(null==resolution || bitsPerPixel<=0) { throw new IllegalArgumentException("resolution must be set and bitsPerPixel greater 0"); } @@ -92,10 +92,10 @@ public class SurfaceSize implements Comparable<SurfaceSize> { * otherwise <code>false</code>. */ @Override - public final boolean equals(Object obj) { + public final boolean equals(final Object obj) { if(this == obj) { return true; } if (obj instanceof SurfaceSize) { - SurfaceSize p = (SurfaceSize)obj; + final SurfaceSize p = (SurfaceSize)obj; return getResolution().equals(p.getResolution()) && getBitsPerPixel() == p.getBitsPerPixel(); } 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 738936078..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,9 +182,9 @@ 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("Catched exception: "+he.getMessage()); + 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 02e43791c..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,8 +550,8 @@ public class X11Util implements ToolkitProperties { int res = -1; try { res = X11Lib.XCloseDisplay(display); - } catch (Exception ex) { - System.err.println("X11Util: Catched Exception:"); + } catch (final Exception ex) { + System.err.println("X11Util: Caught exception:"); ex.printStackTrace(); } return res; @@ -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) { |