diff options
author | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
commit | 556d92b63555a085b25e32b1cd55afce24edd07a (patch) | |
tree | 6be2b02c62a77d5aba81ffbe34c46960608be163 /src/newt | |
parent | a90f4a51dffec3247278e3c683ed4462b1dd9ab5 (diff) |
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
- Remove trailing white spaces on all lines
Diffstat (limited to 'src/newt')
89 files changed, 1132 insertions, 1104 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Display.java b/src/newt/classes/com/jogamp/newt/Display.java index 847c9698a..7091060b3 100644 --- a/src/newt/classes/com/jogamp/newt/Display.java +++ b/src/newt/classes/com/jogamp/newt/Display.java @@ -55,10 +55,10 @@ public abstract class Display { /** return true if obj is of type Display and both FQN {@link #getFQName()} equals */ @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj instanceof Display) { - Display d = (Display)obj; + final Display d = (Display)obj; return d.getFQName().equals(getFQName()); } return false; @@ -353,7 +353,7 @@ public abstract class Display { protected static final ArrayList<WeakReference<Display>> displayList = new ArrayList<WeakReference<Display>>(); protected static int displaysActive = 0; - public static void dumpDisplayList(String prefix) { + public static void dumpDisplayList(final String prefix) { synchronized(displayList) { System.err.println(prefix+" DisplayList[] entries: "+displayList.size()+" - "+getThreadName()); final Iterator<WeakReference<Display>> ri = displayList.iterator(); @@ -372,7 +372,7 @@ public abstract class Display { * @paran shared if true, only shared instances are found, otherwise also exclusive * @return */ - public static Display getFirstDisplayOf(String type, String name, int fromIndex, boolean shared) { + public static Display getFirstDisplayOf(final String type, final String name, final int fromIndex, final boolean shared) { return getDisplayOfImpl(type, name, fromIndex, 1, shared); } @@ -384,11 +384,11 @@ public abstract class Display { * @paran shared if true, only shared instances are found, otherwise also exclusive * @return */ - public static Display getLastDisplayOf(String type, String name, int fromIndex, boolean shared) { + public static Display getLastDisplayOf(final String type, final String name, final int fromIndex, final boolean shared) { return getDisplayOfImpl(type, name, fromIndex, -1, shared); } - private static Display getDisplayOfImpl(String type, String name, final int fromIndex, final int incr, boolean shared) { + private static Display getDisplayOfImpl(final String type, final String name, final int fromIndex, final int incr, final boolean shared) { synchronized(displayList) { int i = fromIndex >= 0 ? fromIndex : displayList.size() - 1 ; while( ( incr > 0 ) ? i < displayList.size() : i >= 0 ) { @@ -414,7 +414,7 @@ public abstract class Display { return null; } - protected static void addDisplay2List(Display display) { + protected static void addDisplay2List(final Display display) { synchronized(displayList) { // GC before add int i=0; @@ -458,15 +458,15 @@ public abstract class Display { return Thread.currentThread().getName(); } - public static String toHexString(int hex) { + public static String toHexString(final int hex) { return "0x" + Integer.toHexString(hex); } - public static String toHexString(long hex) { + public static String toHexString(final long hex) { return "0x" + Long.toHexString(hex); } - public static int hashCodeNullSafe(Object o) { + public static int hashCodeNullSafe(final Object o) { return ( null != o ) ? o.hashCode() : 0; } } diff --git a/src/newt/classes/com/jogamp/newt/MonitorDevice.java b/src/newt/classes/com/jogamp/newt/MonitorDevice.java index a65675204..126162006 100644 --- a/src/newt/classes/com/jogamp/newt/MonitorDevice.java +++ b/src/newt/classes/com/jogamp/newt/MonitorDevice.java @@ -68,7 +68,7 @@ public abstract class MonitorDevice { protected Rectangle viewportPU; // in pixel units protected Rectangle viewportWU; // in window units - protected MonitorDevice(Screen screen, int nativeId, DimensionImmutable sizeMM, Rectangle viewportPU, Rectangle viewportWU, MonitorMode currentMode, ArrayHashSet<MonitorMode> supportedModes) { + protected MonitorDevice(final Screen screen, final int nativeId, final DimensionImmutable sizeMM, final Rectangle viewportPU, final Rectangle viewportWU, final MonitorMode currentMode, final ArrayHashSet<MonitorMode> supportedModes) { this.screen = screen; this.nativeId = nativeId; this.sizeMM = sizeMM; @@ -94,10 +94,10 @@ public abstract class MonitorDevice { * <br> */ @Override - public final boolean equals(Object obj) { + public final boolean equals(final Object obj) { if (this == obj) { return true; } if (obj instanceof MonitorDevice) { - MonitorDevice md = (MonitorDevice)obj; + final MonitorDevice md = (MonitorDevice)obj; return md.nativeId == nativeId; } return false; diff --git a/src/newt/classes/com/jogamp/newt/MonitorMode.java b/src/newt/classes/com/jogamp/newt/MonitorMode.java index ba21df22a..09bc06ebd 100644 --- a/src/newt/classes/com/jogamp/newt/MonitorMode.java +++ b/src/newt/classes/com/jogamp/newt/MonitorMode.java @@ -115,14 +115,14 @@ public class MonitorMode implements Comparable<MonitorMode> { /** Comparator for 2 {@link MonitorMode}s, following comparison order as described in {@link MonitorMode#compareTo(MonitorMode)}, returning the ascending order. */ public static final Comparator<MonitorMode> monitorModeComparator = new Comparator<MonitorMode>() { @Override - public int compare(MonitorMode mm1, MonitorMode mm2) { + public int compare(final MonitorMode mm1, final MonitorMode mm2) { return mm1.compareTo(mm2); } }; /** Comparator for 2 {@link MonitorMode}s, following comparison order as described in {@link MonitorMode#compareTo(MonitorMode)}, returning the descending order. */ public static final Comparator<MonitorMode> monitorModeComparatorInv = new Comparator<MonitorMode>() { @Override - public int compare(MonitorMode mm1, MonitorMode mm2) { + public int compare(final MonitorMode mm1, final MonitorMode mm2) { return mm2.compareTo(mm1); } }; @@ -144,7 +144,7 @@ public class MonitorMode implements Comparable<MonitorMode> { public final float refreshRate; public final int hashCode; - public SizeAndRRate(SurfaceSize surfaceSize, float refreshRate, int flags) { + public SizeAndRRate(final SurfaceSize surfaceSize, final float refreshRate, final int flags) { if(null==surfaceSize) { throw new IllegalArgumentException("surfaceSize must be set ("+surfaceSize+")"); } @@ -158,7 +158,7 @@ public class MonitorMode implements Comparable<MonitorMode> { private final static String STR_DOUBLESCAN = "DoubleScan"; private final static String STR_SEP = ", "; - public static final StringBuilder flags2String(int flags) { + public static final StringBuilder flags2String(final int flags) { final StringBuilder sb = new StringBuilder(); boolean sp = false; if( 0 != ( flags & FLAG_INTERLACE ) ) { @@ -232,7 +232,7 @@ public class MonitorMode implements Comparable<MonitorMode> { * </ul> */ @Override - public final boolean equals(Object obj) { + public final boolean equals(final Object obj) { if (this == obj) { return true; } if (obj instanceof SizeAndRRate) { final SizeAndRRate p = (SizeAndRRate)obj; @@ -288,7 +288,7 @@ public class MonitorMode implements Comparable<MonitorMode> { private final int rotation; private final int hashCode; - public static boolean isRotationValid(int rotation) { + public static boolean isRotationValid(final int rotation) { return rotation == MonitorMode.ROTATE_0 || rotation == MonitorMode.ROTATE_90 || rotation == MonitorMode.ROTATE_180 || rotation == MonitorMode.ROTATE_270 ; } @@ -297,7 +297,7 @@ public class MonitorMode implements Comparable<MonitorMode> { * @param sizeAndRRate the surface size and refresh rate mode * @param rotation the screen rotation, measured counter clockwise (CCW) */ - public MonitorMode(int nativeId, SizeAndRRate sizeAndRRate, int rotation) { + public MonitorMode(final int nativeId, final SizeAndRRate sizeAndRRate, final int rotation) { if ( !isRotationValid(rotation) ) { throw new RuntimeException("invalid rotation: "+rotation); } @@ -317,7 +317,7 @@ public class MonitorMode implements Comparable<MonitorMode> { * @param flags * @param rotation */ - public MonitorMode(SurfaceSize surfaceSize, float refreshRate, int flags, int rotation) { + public MonitorMode(final SurfaceSize surfaceSize, final float refreshRate, final int flags, final int rotation) { this(0, new SizeAndRRate(surfaceSize, refreshRate, flags), rotation); } @@ -416,10 +416,10 @@ public class MonitorMode implements Comparable<MonitorMode> { * </ul> */ @Override - public final boolean equals(Object obj) { + public final boolean equals(final Object obj) { if (this == obj) { return true; } if (obj instanceof MonitorMode) { - MonitorMode sm = (MonitorMode)obj; + final MonitorMode sm = (MonitorMode)obj; return sm.nativeId == this.nativeId && sm.sizeAndRRate.equals(sizeAndRRate) && sm.rotation == this.rotation ; @@ -447,7 +447,7 @@ public class MonitorMode implements Comparable<MonitorMode> { return hash; } - private final int getRotatedWH(boolean width) { + private final int getRotatedWH(final boolean width) { final DimensionImmutable d = sizeAndRRate.surfaceSize.getResolution(); final boolean swap = MonitorMode.ROTATE_90 == rotation || MonitorMode.ROTATE_270 == rotation ; if ( ( width && swap ) || ( !width && !swap ) ) { diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java index 9685200eb..9606fae08 100644 --- a/src/newt/classes/com/jogamp/newt/NewtFactory.java +++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java @@ -46,6 +46,7 @@ import javax.media.nativewindow.NativeWindow; import javax.media.nativewindow.NativeWindowFactory; import com.jogamp.common.util.IOUtil; +import com.jogamp.common.util.PropertyAccess; import jogamp.newt.Debug; import jogamp.newt.DisplayImpl; @@ -66,7 +67,7 @@ public class NewtFactory { NativeWindowFactory.initSingleton(); // last resort .. { /** See API Doc in {@link Window} ! */ - final String[] paths = Debug.getProperty("newt.window.icons", true, "newt/data/jogamp-16x16.png newt/data/jogamp-32x32.png").split("\\s"); + final String[] paths = PropertyAccess.getProperty("newt.window.icons", true, "newt/data/jogamp-16x16.png newt/data/jogamp-32x32.png").split("\\s"); if( paths.length < 2 ) { throw new IllegalArgumentException("Property 'newt.window.icons' did not specify at least two PNG icons, but "+Arrays.toString(paths)); } @@ -95,9 +96,9 @@ public class NewtFactory { * Shall reference at least two PNG icons, from lower (16x16) to higher (>= 32x32) resolution. * </p> */ - public static void setWindowIcons(IOUtil.ClassResources cres) { defaultWindowIcons = cres; } + public static void setWindowIcons(final IOUtil.ClassResources cres) { defaultWindowIcons = cres; } - public static Class<?> getCustomClass(String packageName, String classBaseName) { + public static Class<?> getCustomClass(final String packageName, final String classBaseName) { Class<?> clazz = null; if(packageName!=null && classBaseName!=null) { final String clazzName; @@ -108,7 +109,7 @@ public class NewtFactory { } try { clazz = Class.forName(clazzName); - } catch (Throwable t) { + } catch (final Throwable t) { if(DEBUG_IMPLEMENTATION) { System.err.println("Warning: Failed to find class <"+clazzName+">: "+t.getMessage()); t.printStackTrace(); @@ -125,7 +126,7 @@ public class NewtFactory { * The default is enabled.<br> * The EventDispatchThread is thread local to the Display instance.<br> */ - public static synchronized void setUseEDT(boolean onoff) { + public static synchronized void setUseEDT(final boolean onoff) { useEDT = onoff; } @@ -144,7 +145,7 @@ public class NewtFactory { * see {@link AbstractGraphicsDevice#getConnection()}. Use <code>null</code> for default. * @return the new or reused Display instance */ - public static Display createDisplay(String name) { + public static Display createDisplay(final String name) { return createDisplay(name, true); } @@ -162,7 +163,7 @@ public class NewtFactory { * @param reuse attempt to reuse an existing Display with same <code>name</code> if set true, otherwise create a new instance. * @return the new or reused Display instance */ - public static Display createDisplay(String name, boolean reuse) { + public static Display createDisplay(final String name, final boolean reuse) { return DisplayImpl.create(NativeWindowFactory.getNativeWindowType(true), name, 0, reuse); } @@ -179,7 +180,7 @@ public class NewtFactory { * see {@link AbstractGraphicsDevice#getConnection()}. Use <code>null</code> for default. * @return the new or reused Display instance */ - public static Display createDisplay(String type, String name) { + public static Display createDisplay(final String type, final String name) { return createDisplay(type, name, true); } @@ -198,7 +199,7 @@ public class NewtFactory { * @param reuse attempt to reuse an existing Display with same <code>name</code> if set true, otherwise create a new instance. * @return the new or reused Display instance */ - public static Display createDisplay(String type, String name, boolean reuse) { + public static Display createDisplay(final String type, final String name, final boolean reuse) { return DisplayImpl.create(type, name, 0, reuse); } @@ -212,7 +213,7 @@ public class NewtFactory { * and {@link Display#removeReference()}. * </p> */ - public static Screen createScreen(Display display, int index) { + public static Screen createScreen(final Display display, final int index) { return ScreenImpl.create(display, index); } @@ -229,7 +230,7 @@ public class NewtFactory { * and {@link Screen#removeReference()}. * </p> */ - public static Window createWindow(CapabilitiesImmutable caps) { + public static Window createWindow(final CapabilitiesImmutable caps) { return createWindowImpl(NativeWindowFactory.getNativeWindowType(true), caps); } @@ -243,7 +244,7 @@ public class NewtFactory { * and {@link Screen#removeReference()}. * </p> */ - public static Window createWindow(Screen screen, CapabilitiesImmutable caps) { + public static Window createWindow(final Screen screen, final CapabilitiesImmutable caps) { return WindowImpl.create(null, 0, screen, caps); } @@ -269,7 +270,7 @@ public class NewtFactory { * * @param parentWindowObject either a NativeWindow instance */ - public static Window createWindow(NativeWindow parentWindow, CapabilitiesImmutable caps) { + public static Window createWindow(final NativeWindow parentWindow, final CapabilitiesImmutable caps) { final String type = NativeWindowFactory.getNativeWindowType(true); if( null == parentWindow ) { return createWindowImpl(type, caps); @@ -283,14 +284,14 @@ public class NewtFactory { screen = newtParentWindow.getScreen(); } else { // create a Display/Screen compatible to the NativeWindow - AbstractGraphicsConfiguration parentConfig = parentWindow.getGraphicsConfiguration(); + final AbstractGraphicsConfiguration parentConfig = parentWindow.getGraphicsConfiguration(); if(null!=parentConfig) { - AbstractGraphicsScreen parentScreen = parentConfig.getScreen(); - AbstractGraphicsDevice parentDevice = parentScreen.getDevice(); - Display display = NewtFactory.createDisplay(type, parentDevice.getHandle(), true); + final AbstractGraphicsScreen parentScreen = parentConfig.getScreen(); + final AbstractGraphicsDevice parentDevice = parentScreen.getDevice(); + final Display display = NewtFactory.createDisplay(type, parentDevice.getHandle(), true); screen = NewtFactory.createScreen(display, parentScreen.getIndex()); } else { - Display display = NewtFactory.createDisplay(type, null, true); // local display + final Display display = NewtFactory.createDisplay(type, null, true); // local display screen = NewtFactory.createScreen(display, 0); // screen 0 } } @@ -304,9 +305,9 @@ public class NewtFactory { return win; } - private static Window createWindowImpl(String type, CapabilitiesImmutable caps) { - Display display = NewtFactory.createDisplay(type, null, true); // local display - Screen screen = NewtFactory.createScreen(display, 0); // screen 0 + private static Window createWindowImpl(final String type, final CapabilitiesImmutable caps) { + final Display display = NewtFactory.createDisplay(type, null, true); // local display + final Screen screen = NewtFactory.createScreen(display, 0); // screen 0 return WindowImpl.create(null, 0, screen, caps); } @@ -319,10 +320,10 @@ public class NewtFactory { * @param caps the desired capabilities * @return */ - public static Window createWindow(String displayConnection, int screenIdx, long parentWindowHandle, CapabilitiesImmutable caps) { + public static Window createWindow(final String displayConnection, final int screenIdx, final long parentWindowHandle, final CapabilitiesImmutable caps) { final String type = NativeWindowFactory.getNativeWindowType(true); - Display display = NewtFactory.createDisplay(type, displayConnection, true); - Screen screen = NewtFactory.createScreen(display, screenIdx); + final Display display = NewtFactory.createDisplay(type, displayConnection, true); + final Screen screen = NewtFactory.createScreen(display, screenIdx); return WindowImpl.create(null, parentWindowHandle, screen, caps); } @@ -333,26 +334,26 @@ public class NewtFactory { * * @param undecorated only impacts if the window is in top-level state, while attached to a parent window it's rendered undecorated always */ - public static Window createWindow(Object[] cstrArguments, Screen screen, CapabilitiesImmutable caps) { + public static Window createWindow(final Object[] cstrArguments, final Screen screen, final CapabilitiesImmutable caps) { return WindowImpl.create(cstrArguments, screen, caps); } /** * Instantiate a Display entity using the native handle. */ - public static Display createDisplay(String type, long handle, boolean reuse) { + public static Display createDisplay(final String type, final long handle, final boolean reuse) { return DisplayImpl.create(type, null, handle, reuse); } - public static boolean isScreenCompatible(NativeWindow parent, Screen childScreen) { + public static boolean isScreenCompatible(final NativeWindow parent, final Screen childScreen) { // Get parent's NativeWindow details - AbstractGraphicsConfiguration parentConfig = parent.getGraphicsConfiguration(); - AbstractGraphicsScreen parentScreen = parentConfig.getScreen(); - AbstractGraphicsDevice parentDevice = parentScreen.getDevice(); + final AbstractGraphicsConfiguration parentConfig = parent.getGraphicsConfiguration(); + final AbstractGraphicsScreen parentScreen = parentConfig.getScreen(); + final AbstractGraphicsDevice parentDevice = parentScreen.getDevice(); - DisplayImpl childDisplay = (DisplayImpl) childScreen.getDisplay(); - String parentDisplayName = childDisplay.validateDisplayName(null, parentDevice.getHandle()); - String childDisplayName = childDisplay.getName(); + final DisplayImpl childDisplay = (DisplayImpl) childScreen.getDisplay(); + final String parentDisplayName = childDisplay.validateDisplayName(null, parentDevice.getHandle()); + final String childDisplayName = childDisplay.getName(); if( ! parentDisplayName.equals( childDisplayName ) ) { return false; } @@ -363,23 +364,23 @@ public class NewtFactory { return true; } - public static Screen createCompatibleScreen(NativeWindow parent) { + public static Screen createCompatibleScreen(final NativeWindow parent) { return createCompatibleScreen(parent, null); } - public static Screen createCompatibleScreen(NativeWindow parent, Screen childScreen) { + public static Screen createCompatibleScreen(final NativeWindow parent, final Screen childScreen) { // Get parent's NativeWindow details - AbstractGraphicsConfiguration parentConfig = parent.getGraphicsConfiguration(); - AbstractGraphicsScreen parentScreen = parentConfig.getScreen(); - AbstractGraphicsDevice parentDevice = parentScreen.getDevice(); + final AbstractGraphicsConfiguration parentConfig = parent.getGraphicsConfiguration(); + final AbstractGraphicsScreen parentScreen = parentConfig.getScreen(); + final AbstractGraphicsDevice parentDevice = parentScreen.getDevice(); if(null != childScreen) { // check if child Display/Screen is compatible already - DisplayImpl childDisplay = (DisplayImpl) childScreen.getDisplay(); - String parentDisplayName = childDisplay.validateDisplayName(null, parentDevice.getHandle()); - String childDisplayName = childDisplay.getName(); - boolean displayEqual = parentDisplayName.equals( childDisplayName ); - boolean screenEqual = parentScreen.getIndex() == childScreen.getIndex(); + final DisplayImpl childDisplay = (DisplayImpl) childScreen.getDisplay(); + final String parentDisplayName = childDisplay.validateDisplayName(null, parentDevice.getHandle()); + final String childDisplayName = childDisplay.getName(); + final boolean displayEqual = parentDisplayName.equals( childDisplayName ); + final boolean screenEqual = parentScreen.getIndex() == childScreen.getIndex(); if(DEBUG_IMPLEMENTATION) { System.err.println("NewtFactory.createCompatibleScreen: Display: "+ parentDisplayName+" =? "+childDisplayName+" : "+displayEqual+"; Screen: "+ @@ -393,7 +394,7 @@ public class NewtFactory { // Prep NEWT's Display and Screen according to the parent final String type = NativeWindowFactory.getNativeWindowType(true); - Display display = NewtFactory.createDisplay(type, parentDevice.getHandle(), true); + final Display display = NewtFactory.createDisplay(type, parentDevice.getHandle(), true); return NewtFactory.createScreen(display, parentScreen.getIndex()); } } diff --git a/src/newt/classes/com/jogamp/newt/NewtVersion.java b/src/newt/classes/com/jogamp/newt/NewtVersion.java index e70d63f88..f4cdee487 100644 --- a/src/newt/classes/com/jogamp/newt/NewtVersion.java +++ b/src/newt/classes/com/jogamp/newt/NewtVersion.java @@ -38,7 +38,7 @@ public class NewtVersion extends JogampVersion { protected static volatile NewtVersion jogampCommonVersionInfo; - protected NewtVersion(String packageName, Manifest mf) { + protected NewtVersion(final String packageName, final Manifest mf) { super(packageName, mf); } @@ -56,7 +56,7 @@ public class NewtVersion 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/newt/classes/com/jogamp/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java index cef254634..0ba557972 100644 --- a/src/newt/classes/com/jogamp/newt/Screen.java +++ b/src/newt/classes/com/jogamp/newt/Screen.java @@ -71,10 +71,10 @@ public abstract class Screen { /** return true if obj is of type Display and both FQN {@link #getFQName()} equals */ @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj instanceof Screen) { - Screen s = (Screen)obj; + final Screen s = (Screen)obj; return s.getFQName().equals(getFQName()); } return false; @@ -268,7 +268,7 @@ public abstract class Screen { * @param fromIndex start index, then increasing until found or end of list * * @return */ - public static Screen getFirstScreenOf(Display display, int idx, int fromIndex) { + public static Screen getFirstScreenOf(final Display display, final int idx, final int fromIndex) { return getScreenOfImpl(display, idx, fromIndex, 1); } @@ -279,11 +279,11 @@ public abstract class Screen { * @param fromIndex start index, then decreasing until found or end of list. -1 is interpreted as size - 1. * @return */ - public static Screen getLastScreenOf(Display display, int idx, int fromIndex) { + public static Screen getLastScreenOf(final Display display, final int idx, final int fromIndex) { return getScreenOfImpl(display, idx, fromIndex, -1); } - private static Screen getScreenOfImpl(Display display, int idx, int fromIndex, int incr) { + private static Screen getScreenOfImpl(final Display display, final int idx, final int fromIndex, final int incr) { synchronized(screenList) { int i = fromIndex >= 0 ? fromIndex : screenList.size() - 1 ; while( ( incr > 0 ) ? i < screenList.size() : i >= 0 ) { @@ -307,7 +307,7 @@ public abstract class Screen { return null; } - protected static void addScreen2List(Screen screen) { + protected static void addScreen2List(final Screen screen) { synchronized(screenList) { // GC before add int i=0; diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java index 4efd60765..c44584d78 100644 --- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java +++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java @@ -147,7 +147,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto /** * Instantiates a NewtCanvas without a NEWT child.<br> */ - public NewtCanvasAWT(GraphicsConfiguration gc) { + public NewtCanvasAWT(final GraphicsConfiguration gc) { super(gc); awtMouseAdapter = new AWTMouseAdapter().addTo(this); awtKeyAdapter = new AWTKeyAdapter().addTo(this); @@ -158,7 +158,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto /** * Instantiates a NewtCanvas with a NEWT child. */ - public NewtCanvasAWT(Window child) { + public NewtCanvasAWT(final Window child) { super(); awtMouseAdapter = new AWTMouseAdapter().addTo(this); awtKeyAdapter = new AWTKeyAdapter().addTo(this); @@ -170,7 +170,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto /** * Instantiates a NewtCanvas with a NEWT child. */ - public NewtCanvasAWT(GraphicsConfiguration gc, Window child) { + public NewtCanvasAWT(final GraphicsConfiguration gc, final Window child) { super(gc); awtMouseAdapter = new AWTMouseAdapter().addTo(this); awtKeyAdapter = new AWTKeyAdapter().addTo(this); @@ -180,7 +180,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } @Override - public void setShallUseOffscreenLayer(boolean v) { + public void setShallUseOffscreenLayer(final boolean v) { shallUseOffscreenLayer = v; } @@ -253,11 +253,11 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto }; private final WindowListener clearAWTMenusOnNewtFocus = new WindowAdapter() { @Override - public void windowResized(WindowEvent e) { + public void windowResized(final WindowEvent e) { updateLayoutSize(); } @Override - public void windowGainedFocus(WindowEvent arg0) { + public void windowGainedFocus(final WindowEvent arg0) { if( isParent() && !isFullscreen() ) { AWTEDTExecutor.singleton.invoke(false, awtClearSelectedMenuPath); } @@ -266,19 +266,19 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto class FocusTraversalKeyListener implements KeyListener { @Override - public void keyPressed(KeyEvent e) { + public void keyPressed(final KeyEvent e) { if( isParent() && !isFullscreen() ) { handleKey(e, false); } } @Override - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { if( isParent() && !isFullscreen() ) { handleKey(e, true); } } - void handleKey(KeyEvent evt, boolean onRelease) { + void handleKey(final KeyEvent evt, final boolean onRelease) { if(null == keyboardFocusManager) { throw new InternalError("XXX"); } @@ -317,7 +317,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto class FocusPropertyChangeListener implements PropertyChangeListener { @Override - public void propertyChange(PropertyChangeEvent evt) { + public void propertyChange(final PropertyChangeEvent evt) { final Object oldF = evt.getOldValue(); final Object newF = evt.getNewValue(); final boolean isParent = isParent(); @@ -374,7 +374,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto * </p> * @return the previous attached newt child. */ - public Window setNEWTChild(Window newChild) { + public Window setNEWTChild(final Window newChild) { synchronized(sync) { final Window prevChild = newtChild; if(DEBUG) { @@ -400,7 +400,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto final Window w = newtChild; if( null != w ) { // use NEWT child's size for min/pref size! - java.awt.Dimension minSize = new java.awt.Dimension(w.getWidth(), w.getHeight()); + final java.awt.Dimension minSize = new java.awt.Dimension(w.getWidth(), w.getHeight()); setMinimumSize(minSize); setPreferredSize(minSize); } @@ -421,7 +421,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } @Override - public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) { + public WindowClosingMode setDefaultCloseOperation(final WindowClosingMode op) { return awtWindowClosingProtocol.setDefaultCloseOperation(op); } @@ -435,7 +435,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto * which finally will perform the pending JAWT destruction. * </p> */ - public final void setSkipJAWTDestroy(boolean v) { skipJAWTDestroy = v; } + public final void setSkipJAWTDestroy(final boolean v) { skipJAWTDestroy = v; } /** See {@link #setSkipJAWTDestroy(boolean)}. */ public final boolean getSkipJAWTDestroy() { return skipJAWTDestroy; } @@ -524,7 +524,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } } ); } - private final void destroyImpl(boolean removeNotify, boolean windowClosing) { + private final void destroyImpl(final boolean removeNotify, final boolean windowClosing) { synchronized(sync) { final java.awt.Container cont = AWTMisc.getContainer(this); if(DEBUG) { @@ -562,7 +562,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } @Override - public void paint(Graphics g) { + public void paint(final Graphics g) { synchronized(sync) { if( validateComponent(true) && !printActive ) { newtChild.windowRepaint(0, 0, getWidth(), getHeight()); @@ -570,13 +570,13 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } } @Override - public void update(Graphics g) { + public void update(final Graphics g) { paint(g); } @SuppressWarnings("deprecation") @Override - public void reshape(int x, int y, int width, int height) { + public void reshape(final int x, final int y, final int width, final int height) { synchronized (getTreeLock()) { // super.reshape(..) claims tree lock, so we do extend it's lock over reshape synchronized(sync) { super.reshape(x, y, width, height); @@ -603,7 +603,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } @Override - public void setupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight) { + public void setupPrint(final double scaleMatX, final double scaleMatY, final int numSamples, final int tileWidth, final int tileHeight) { printActive = true; final int componentCount = isOpaque() ? 3 : 4; final TileRenderer printRenderer = new TileRenderer(); @@ -720,7 +720,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto }; @Override - public void print(Graphics graphics) { + public void print(final Graphics graphics) { synchronized(sync) { if( !printActive || null == printGLAD ) { throw new IllegalStateException("setupPrint() not called"); @@ -750,7 +750,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto printAWTTiles.resetGraphics2D(); } } - } catch (NoninvertibleTransformException nte) { + } catch (final NoninvertibleTransformException nte) { System.err.println("Caught: Inversion failed of: "+g2d.getTransform()); nte.printStackTrace(); } @@ -760,7 +760,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } } - private final boolean validateComponent(boolean attachNewtChild) { + private final boolean validateComponent(final boolean attachNewtChild) { if( Beans.isDesignTime() || !isDisplayable() ) { return false; } @@ -778,7 +778,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto return true; } - private final void configureNewtChild(boolean attach) { + private final void configureNewtChild(final boolean attach) { awtWinAdapter.clear(); awtKeyAdapter.clear(); awtMouseAdapter.clear(); @@ -904,7 +904,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto } } }; - private final void detachNewtChild(java.awt.Container cont) { + private final void detachNewtChild(final java.awt.Container cont) { if( null == newtChild || null == jawtWindow || !newtChildAttached ) { return; // nop } @@ -951,16 +951,16 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto clazz.getDeclaredMethod("disableBackgroundErase", new Class[] { Canvas.class }); disableBackgroundEraseMethod.setAccessible(true); - } catch (Exception e) { + } catch (final Exception e) { clazz = clazz.getSuperclass(); } } - } catch (Exception e) { + } catch (final Exception e) { } return null; } }); - } catch (Exception e) { + } catch (final Exception e) { } disableBackgroundEraseInitialized = true; if(DEBUG) { @@ -972,7 +972,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto Throwable t=null; try { disableBackgroundEraseMethod.invoke(getToolkit(), new Object[] { this }); - } catch (Exception e) { + } catch (final Exception e) { t = e; } if(DEBUG) { @@ -983,10 +983,10 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto protected static String currentThreadName() { return "["+Thread.currentThread().getName()+", isAWT-EDT "+EventQueue.isDispatchThread()+"]"; } - static String newtWinHandleToHexString(Window w) { + static String newtWinHandleToHexString(final Window w) { return null != w ? toHexString(w.getWindowHandle()) : "nil"; } - static String toHexString(long l) { + static String toHexString(final long l) { return "0x"+Long.toHexString(l); } } diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java index 9cecca9c5..496bd93eb 100644 --- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java +++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java @@ -146,7 +146,7 @@ public class JOGLNewtApplet1Run extends Applet { glHeight = JOGLNewtAppletBase.str2Int(getParameter("gl_height"), glHeight); glNoDefaultKeyListener = JOGLNewtAppletBase.str2Bool(getParameter("gl_nodefaultkeyListener"), glNoDefaultKeyListener); appletDebugTestBorder = JOGLNewtAppletBase.str2Bool(getParameter("appletDebugTestBorder"), appletDebugTestBorder); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } if(null==glEventListenerClazzName) { @@ -181,7 +181,7 @@ public class JOGLNewtApplet1Run extends Applet { glTrace); try { - GLCapabilities caps = new GLCapabilities(GLProfile.get(glProfileName)); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(glProfileName)); caps.setAlphaBits(glAlphaBits); if(0<glNumMultisampleBuffer) { caps.setSampleBuffers(true); @@ -205,7 +205,7 @@ public class JOGLNewtApplet1Run extends Applet { } base.init(glWindow); if(base.isValid()) { - GLEventListener glEventListener = base.getGLEventListener(); + final GLEventListener glEventListener = base.getGLEventListener(); if(glEventListener instanceof MouseListener) { addMouseListener((MouseListener)glEventListener); @@ -226,7 +226,7 @@ public class JOGLNewtApplet1Run extends Applet { container.validate(); } } ); } - } catch (Throwable t) { + } catch (final Throwable t) { throw new RuntimeException(t); } if(DEBUG) { diff --git a/src/newt/classes/com/jogamp/newt/event/DoubleTapScrollGesture.java b/src/newt/classes/com/jogamp/newt/event/DoubleTapScrollGesture.java index edb2429bb..7fec29259 100644 --- a/src/newt/classes/com/jogamp/newt/event/DoubleTapScrollGesture.java +++ b/src/newt/classes/com/jogamp/newt/event/DoubleTapScrollGesture.java @@ -27,6 +27,8 @@ */ package com.jogamp.newt.event; +import com.jogamp.common.util.PropertyAccess; + import jogamp.newt.Debug; /** @@ -83,10 +85,10 @@ public class DoubleTapScrollGesture implements GestureHandler { static { Debug.initSingleton(); - SCROLL_SLOP_PIXEL = Debug.getIntProperty("newt.event.scroll_slop_pixel", true, 16); - DOUBLE_TAP_SLOP_PIXEL = Debug.getIntProperty("newt.event.double_tap_slop_pixel", true, 104); - SCROLL_SLOP_MM = Debug.getIntProperty("newt.event.scroll_slop_mm", true, 3); - DOUBLE_TAP_SLOP_MM = Debug.getIntProperty("newt.event.double_tap_slop_mm", true, 20); + SCROLL_SLOP_PIXEL = PropertyAccess.getIntProperty("newt.event.scroll_slop_pixel", true, 16); + DOUBLE_TAP_SLOP_PIXEL = PropertyAccess.getIntProperty("newt.event.double_tap_slop_pixel", true, 104); + SCROLL_SLOP_MM = PropertyAccess.getIntProperty("newt.event.scroll_slop_mm", true, 3); + DOUBLE_TAP_SLOP_MM = PropertyAccess.getIntProperty("newt.event.double_tap_slop_mm", true, 20); } private static final int ST_NONE = 0; @@ -97,7 +99,7 @@ public class DoubleTapScrollGesture implements GestureHandler { private final int scrollSlop, scrollSlopSquare, doubleTapSlop, doubleTapSlopSquare; private final float[] scrollDistance = new float[] { 0f, 0f }; - private int[] pIds = new int[] { -1, -1 }; + private final int[] pIds = new int[] { -1, -1 }; /** See class docu */ private int gestureState; private int sqStartDist; @@ -105,7 +107,7 @@ public class DoubleTapScrollGesture implements GestureHandler { private int pointerDownCount; private MouseEvent hitGestureEvent; - private static final int getSquareDistance(float x1, float y1, float x2, float y2) { + private static final int getSquareDistance(final float x1, final float y1, final float x2, final float y2) { final int deltaX = (int) x1 - (int) x2; final int deltaY = (int) y1 - (int) y2; return deltaX * deltaX + deltaY * deltaY; @@ -129,7 +131,7 @@ public class DoubleTapScrollGesture implements GestureHandler { * @param scaledScrollSlop Distance a pointer can wander before we think the user is scrolling in <i>pixels</i>. * @param scaledDoubleTapSlop Distance in <i>pixels</i> between the first touch and second touch to still be considered a double tap. */ - public DoubleTapScrollGesture(int scaledScrollSlop, int scaledDoubleTapSlop) { + public DoubleTapScrollGesture(final int scaledScrollSlop, final int scaledDoubleTapSlop) { scrollSlop = scaledScrollSlop; scrollSlopSquare = scaledScrollSlop * scaledScrollSlop; doubleTapSlop = scaledDoubleTapSlop; @@ -148,7 +150,7 @@ public class DoubleTapScrollGesture implements GestureHandler { } @Override - public void clear(boolean clearStarted) { + public void clear(final boolean clearStarted) { scrollDistance[0] = 0f; scrollDistance[1] = 0f; hitGestureEvent = null; diff --git a/src/newt/classes/com/jogamp/newt/event/InputEvent.java b/src/newt/classes/com/jogamp/newt/event/InputEvent.java index 7889098ea..fbda79d46 100644 --- a/src/newt/classes/com/jogamp/newt/event/InputEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/InputEvent.java @@ -176,7 +176,7 @@ public abstract class InputEvent extends NEWTEvent * @param button the button to test * @return true if the given button is down */ - public final boolean isButtonDown(int button) { + public final boolean isButtonDown(final int button) { return ( modifiers & getButtonMask(button) ) != 0; } diff --git a/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java index 5cef734bb..0f147a722 100644 --- a/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java @@ -32,10 +32,10 @@ package com.jogamp.newt.event; public abstract class KeyAdapter implements KeyListener { @Override - public void keyPressed(KeyEvent e) { + public void keyPressed(final KeyEvent e) { } @Override - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { } } diff --git a/src/newt/classes/com/jogamp/newt/event/KeyEvent.java b/src/newt/classes/com/jogamp/newt/event/KeyEvent.java index 8cdfb0db3..f29e9eb8c 100644 --- a/src/newt/classes/com/jogamp/newt/event/KeyEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/KeyEvent.java @@ -377,7 +377,7 @@ public class KeyEvent extends InputEvent public short max; /** true if valid for keyChar values as well, otherwise only valid for keyCode and keySym due to collision. */ public final boolean inclKeyChar; - private NonPrintableRange(short min, short max, boolean inclKeyChar) { + private NonPrintableRange(final short min, final short max, final boolean inclKeyChar) { this.min = min; this.max = max; this.inclKeyChar = inclKeyChar; diff --git a/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java index 98252fe14..679155d10 100644 --- a/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java @@ -31,28 +31,28 @@ package com.jogamp.newt.event; public abstract class MouseAdapter implements MouseListener { @Override - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { } @Override - public void mouseEntered(MouseEvent e) { + public void mouseEntered(final MouseEvent e) { } @Override - public void mouseExited(MouseEvent e) { + public void mouseExited(final MouseEvent e) { } @Override - public void mousePressed(MouseEvent e) { + public void mousePressed(final MouseEvent e) { } @Override - public void mouseReleased(MouseEvent e) { + public void mouseReleased(final MouseEvent e) { } @Override - public void mouseMoved(MouseEvent e) { + public void mouseMoved(final MouseEvent e) { } @Override - public void mouseDragged(MouseEvent e) { + public void mouseDragged(final MouseEvent e) { } @Override - public void mouseWheelMoved(MouseEvent e) { + public void mouseWheelMoved(final MouseEvent e) { } } diff --git a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java index 43cac31bb..982b855a7 100644 --- a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java @@ -124,7 +124,7 @@ public class MouseEvent extends InputEvent return types; } - private PointerType(PointerClass pc) { + private PointerType(final PointerClass pc) { this.pc = pc; } PointerClass pc; diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java index 78bb7420a..a9d9d8bdb 100644 --- a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java @@ -143,7 +143,7 @@ public class NEWTEvent extends java.util.EventObject { return sb.append("NEWTEvent[source:").append(getSource().getClass().getName()).append(", consumed ").append(isConsumed()).append(", when:").append(getWhen()).append(" d ").append((System.currentTimeMillis()-getWhen())).append("ms]"); } - public static String toHexString(short hex) { + public static String toHexString(final short hex) { return "0x" + Integer.toHexString( hex & 0x0000FFFF ); } } diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java b/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java index 7dd56ad1e..dd6395354 100644 --- a/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java +++ b/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java @@ -32,10 +32,10 @@ import java.util.LinkedList; public class NEWTEventFiFo { - private LinkedList/*<NEWTEvent>*/ events = new LinkedList/*<NEWTEvent>*/(); + private final LinkedList/*<NEWTEvent>*/ events = new LinkedList/*<NEWTEvent>*/(); /** Add NEWTEvent to tail */ - public synchronized void put(NEWTEvent event) { + public synchronized void put(final NEWTEvent event) { events.addLast(event); notifyAll(); } diff --git a/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java b/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java index 1521036d6..9c7a4bcb8 100644 --- a/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java +++ b/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java @@ -98,7 +98,7 @@ public class PinchToZoomGesture implements GestureHandler { * @param surface the {@link NativeSurface}, which size is used to compute the relative zoom factor * @param allowMorePointer if false, allow only 2 pressed pointers (safe and recommended), otherwise accept other pointer to be pressed. */ - public PinchToZoomGesture(NativeSurface surface, boolean allowMorePointer) { + public PinchToZoomGesture(final NativeSurface surface, final boolean allowMorePointer) { clear(true); this.surface = surface; this.allowMorePointer = allowMorePointer; @@ -124,7 +124,7 @@ public class PinchToZoomGesture implements GestureHandler { } @Override - public void clear(boolean clearStarted) { + public void clear(final boolean clearStarted) { zoomEvent = null; if( clearStarted ) { zoomLastEdgeDist = 0; @@ -155,7 +155,7 @@ public class PinchToZoomGesture implements GestureHandler { return zoom; } /** Set zoom value within [0..2], with 1 as <i>1:1</i>. */ - public final void setZoom(float zoom) { + public final void setZoom(final float zoom) { this.zoom=zoom; } diff --git a/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java index bbc170958..50eae9626 100644 --- a/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java @@ -36,17 +36,17 @@ public class TraceKeyAdapter implements KeyListener { this.downstream = null; } - public TraceKeyAdapter(KeyListener downstream) { + public TraceKeyAdapter(final KeyListener downstream) { this.downstream = downstream; } @Override - public void keyPressed(KeyEvent e) { + public void keyPressed(final KeyEvent e) { System.err.println(e); if(null!=downstream) { downstream.keyPressed(e); } } @Override - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { System.err.println(e); if(null!=downstream) { downstream.keyReleased(e); } } diff --git a/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java index db8376034..e54c3730f 100644 --- a/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java @@ -36,47 +36,47 @@ public class TraceMouseAdapter implements MouseListener { this.downstream = null; } - public TraceMouseAdapter(MouseListener downstream) { + public TraceMouseAdapter(final MouseListener downstream) { this.downstream = downstream; } @Override - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { System.err.println(e); if(null!=downstream) { downstream.mouseClicked(e); } } @Override - public void mouseEntered(MouseEvent e) { + public void mouseEntered(final MouseEvent e) { System.err.println(e); if(null!=downstream) { downstream.mouseEntered(e); } } @Override - public void mouseExited(MouseEvent e) { + public void mouseExited(final MouseEvent e) { System.err.println(e); if(null!=downstream) { downstream.mouseExited(e); } } @Override - public void mousePressed(MouseEvent e) { + public void mousePressed(final MouseEvent e) { System.err.println(e); if(null!=downstream) { downstream.mousePressed(e); } } @Override - public void mouseReleased(MouseEvent e) { + public void mouseReleased(final MouseEvent e) { System.err.println(e); if(null!=downstream) { downstream.mouseReleased(e); } } @Override - public void mouseMoved(MouseEvent e) { + public void mouseMoved(final MouseEvent e) { System.err.println(e); if(null!=downstream) { downstream.mouseMoved(e); } } @Override - public void mouseDragged(MouseEvent e) { + public void mouseDragged(final MouseEvent e) { System.err.println(e); if(null!=downstream) { downstream.mouseDragged(e); } } @Override - public void mouseWheelMoved(MouseEvent e) { + public void mouseWheelMoved(final MouseEvent e) { System.err.println(e); if(null!=downstream) { downstream.mouseWheelMoved(e); } } diff --git a/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java index 7b844f059..299a6ff90 100644 --- a/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java @@ -36,42 +36,42 @@ public class TraceWindowAdapter implements WindowListener { this.downstream = null; } - public TraceWindowAdapter(WindowListener downstream) { + public TraceWindowAdapter(final WindowListener downstream) { this.downstream = downstream; } @Override - public void windowResized(WindowEvent e) { + public void windowResized(final WindowEvent e) { System.err.println(e); if(null!=downstream) { downstream.windowResized(e); } } @Override - public void windowMoved(WindowEvent e) { + public void windowMoved(final WindowEvent e) { System.err.println(e); if(null!=downstream) { downstream.windowMoved(e); } } @Override - public void windowDestroyNotify(WindowEvent e) { + public void windowDestroyNotify(final WindowEvent e) { System.err.println(e); if(null!=downstream) { downstream.windowDestroyNotify(e); } } @Override - public void windowDestroyed(WindowEvent e) { + public void windowDestroyed(final WindowEvent e) { System.err.println(e); if(null!=downstream) { downstream.windowDestroyed(e); } } @Override - public void windowGainedFocus(WindowEvent e) { + public void windowGainedFocus(final WindowEvent e) { System.err.println(e); if(null!=downstream) { downstream.windowGainedFocus(e); } } @Override - public void windowLostFocus(WindowEvent e) { + public void windowLostFocus(final WindowEvent e) { System.err.println(e); if(null!=downstream) { downstream.windowLostFocus(e); } } @Override - public void windowRepaint(WindowUpdateEvent e) { + public void windowRepaint(final WindowUpdateEvent e) { System.err.println(e); if(null!=downstream) { downstream.windowRepaint(e); } } diff --git a/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java index ccc627444..c1bae40ea 100644 --- a/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java @@ -31,24 +31,24 @@ package com.jogamp.newt.event; public abstract class WindowAdapter implements WindowListener { @Override - public void windowResized(WindowEvent e) { + public void windowResized(final WindowEvent e) { } @Override - public void windowMoved(WindowEvent e) { + public void windowMoved(final WindowEvent e) { } @Override - public void windowDestroyNotify(WindowEvent e) { + public void windowDestroyNotify(final WindowEvent e) { } @Override - public void windowDestroyed(WindowEvent e) { + public void windowDestroyed(final WindowEvent e) { } @Override - public void windowGainedFocus(WindowEvent e) { + public void windowGainedFocus(final WindowEvent e) { } @Override - public void windowLostFocus(WindowEvent e) { + public void windowLostFocus(final WindowEvent e) { } @Override - public void windowRepaint(WindowUpdateEvent e) { + public void windowRepaint(final WindowUpdateEvent e) { } } diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java index 9b1348288..a49c10a1e 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java @@ -128,7 +128,7 @@ public abstract class AWTAdapter implements java.util.EventListener * where the given {@link NativeSurfaceHolder} impersonates the event's source. * The NEWT EventListener will be called when an event happens.<br> */ - protected AWTAdapter(com.jogamp.newt.event.NEWTEventListener newtListener, NativeSurfaceHolder nsProxy) { + protected AWTAdapter(final com.jogamp.newt.event.NEWTEventListener newtListener, final NativeSurfaceHolder nsProxy) { if(null==newtListener) { throw new IllegalArgumentException("Argument newtListener is null"); } @@ -147,7 +147,7 @@ public abstract class AWTAdapter implements java.util.EventListener * where the given {@link com.jogamp.newt.Window NEWT Window}, a {@link NativeSurfaceHolder}, impersonates the event's source. * The NEWT EventListener will be called when an event happens.<br> */ - protected AWTAdapter(com.jogamp.newt.event.NEWTEventListener newtListener, com.jogamp.newt.Window newtProxy) { + protected AWTAdapter(final com.jogamp.newt.event.NEWTEventListener newtListener, final com.jogamp.newt.Window newtProxy) { if(null==newtListener) { throw new IllegalArgumentException("Argument newtListener is null"); } @@ -167,7 +167,7 @@ public abstract class AWTAdapter implements java.util.EventListener * This is only supported with EDT enabled! * @throws IllegalStateException if EDT is not enabled */ - protected AWTAdapter(com.jogamp.newt.Window downstream) throws IllegalStateException { + protected AWTAdapter(final com.jogamp.newt.Window downstream) throws IllegalStateException { this(); setDownstream(downstream); } @@ -183,7 +183,7 @@ public abstract class AWTAdapter implements java.util.EventListener * This is only supported with EDT enabled! * @throws IllegalStateException if EDT is not enabled */ - public synchronized AWTAdapter setDownstream(com.jogamp.newt.Window downstream) throws IllegalStateException { + public synchronized AWTAdapter setDownstream(final com.jogamp.newt.Window downstream) throws IllegalStateException { if(null==downstream) { throw new RuntimeException("Argument downstream is null"); } @@ -212,7 +212,7 @@ public abstract class AWTAdapter implements java.util.EventListener return this; } - public final synchronized void setConsumeAWTEvent(boolean v) { + public final synchronized void setConsumeAWTEvent(final boolean v) { this.consumeAWTEvent = v; } diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java index 5ea36bac8..4f11e8772 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java @@ -39,15 +39,15 @@ import jogamp.newt.awt.event.AWTNewtEventFactory; */ public class AWTKeyAdapter extends AWTAdapter implements java.awt.event.KeyListener { - public AWTKeyAdapter(com.jogamp.newt.event.KeyListener newtListener, NativeSurfaceHolder nsProxy) { + public AWTKeyAdapter(final com.jogamp.newt.event.KeyListener newtListener, final NativeSurfaceHolder nsProxy) { super(newtListener, nsProxy); } - public AWTKeyAdapter(com.jogamp.newt.event.KeyListener newtListener, com.jogamp.newt.Window newtProxy) { + public AWTKeyAdapter(final com.jogamp.newt.event.KeyListener newtListener, final com.jogamp.newt.Window newtProxy) { super(newtListener, newtProxy); } - public AWTKeyAdapter(com.jogamp.newt.Window downstream) { + public AWTKeyAdapter(final com.jogamp.newt.Window downstream) { super(downstream); } @@ -56,19 +56,19 @@ public class AWTKeyAdapter extends AWTAdapter implements java.awt.event.KeyListe } @Override - public synchronized AWTAdapter addTo(java.awt.Component awtComponent) { + public synchronized AWTAdapter addTo(final java.awt.Component awtComponent) { awtComponent.addKeyListener(this); return this; } @Override - public synchronized AWTAdapter removeFrom(java.awt.Component awtComponent) { + public synchronized AWTAdapter removeFrom(final java.awt.Component awtComponent) { awtComponent.removeKeyListener(this); return this; } @Override - public synchronized void keyPressed(java.awt.event.KeyEvent e) { + public synchronized void keyPressed(final java.awt.event.KeyEvent e) { if( !isSetup ) { return; } final com.jogamp.newt.event.KeyEvent event = AWTNewtEventFactory.createKeyEvent(com.jogamp.newt.event.KeyEvent.EVENT_KEY_PRESSED, e, nsHolder); if( consumeAWTEvent ) { @@ -80,7 +80,7 @@ public class AWTKeyAdapter extends AWTAdapter implements java.awt.event.KeyListe } @Override - public synchronized void keyReleased(java.awt.event.KeyEvent e) { + public synchronized void keyReleased(final java.awt.event.KeyEvent e) { if( !isSetup ) { return; } final com.jogamp.newt.event.KeyEvent event = AWTNewtEventFactory.createKeyEvent(com.jogamp.newt.event.KeyEvent.EVENT_KEY_RELEASED, e, nsHolder); if( consumeAWTEvent ) { @@ -92,7 +92,7 @@ public class AWTKeyAdapter extends AWTAdapter implements java.awt.event.KeyListe } @Override - public synchronized void keyTyped(java.awt.event.KeyEvent e) { + public synchronized void keyTyped(final java.awt.event.KeyEvent e) { if( !isSetup ) { return; } if( consumeAWTEvent ) { e.consume(); diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java index 53fe70bf7..d9531cd5f 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java @@ -36,15 +36,15 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener { - public AWTMouseAdapter(com.jogamp.newt.event.MouseListener newtListener, NativeSurfaceHolder nsProxy) { + public AWTMouseAdapter(final com.jogamp.newt.event.MouseListener newtListener, final NativeSurfaceHolder nsProxy) { super(newtListener, nsProxy); } - public AWTMouseAdapter(com.jogamp.newt.event.MouseListener newtListener, com.jogamp.newt.Window newtProxy) { + public AWTMouseAdapter(final com.jogamp.newt.event.MouseListener newtListener, final com.jogamp.newt.Window newtProxy) { super(newtListener, newtProxy); } - public AWTMouseAdapter(com.jogamp.newt.Window downstream) { + public AWTMouseAdapter(final com.jogamp.newt.Window downstream) { super(downstream); } @@ -53,7 +53,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL } @Override - public synchronized AWTAdapter addTo(java.awt.Component awtComponent) { + public synchronized AWTAdapter addTo(final java.awt.Component awtComponent) { awtComponent.addMouseListener(this); awtComponent.addMouseMotionListener(this); awtComponent.addMouseWheelListener(this); @@ -61,7 +61,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL } @Override - public synchronized AWTAdapter removeFrom(java.awt.Component awtComponent) { + public synchronized AWTAdapter removeFrom(final java.awt.Component awtComponent) { awtComponent.removeMouseListener(this); awtComponent.removeMouseMotionListener(this); awtComponent.removeMouseWheelListener(this); @@ -69,9 +69,9 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL } @Override - public synchronized void mouseClicked(java.awt.event.MouseEvent e) { + public synchronized void mouseClicked(final java.awt.event.MouseEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); + final com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); if( consumeAWTEvent ) { e.consume(); } @@ -81,9 +81,9 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL } @Override - public synchronized void mouseEntered(java.awt.event.MouseEvent e) { + public synchronized void mouseEntered(final java.awt.event.MouseEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); + final com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); if( consumeAWTEvent ) { e.consume(); } @@ -93,9 +93,9 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL } @Override - public synchronized void mouseExited(java.awt.event.MouseEvent e) { + public synchronized void mouseExited(final java.awt.event.MouseEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); + final com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); if( consumeAWTEvent ) { e.consume(); } @@ -105,9 +105,9 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL } @Override - public synchronized void mousePressed(java.awt.event.MouseEvent e) { + public synchronized void mousePressed(final java.awt.event.MouseEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); + final com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); if( consumeAWTEvent ) { e.consume(); } @@ -117,9 +117,9 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL } @Override - public synchronized void mouseReleased(java.awt.event.MouseEvent e) { + public synchronized void mouseReleased(final java.awt.event.MouseEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); + final com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); if( consumeAWTEvent ) { e.consume(); } @@ -129,9 +129,9 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL } @Override - public synchronized void mouseDragged(java.awt.event.MouseEvent e) { + public synchronized void mouseDragged(final java.awt.event.MouseEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); + final com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); if( consumeAWTEvent ) { e.consume(); } @@ -141,9 +141,9 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL } @Override - public synchronized void mouseMoved(java.awt.event.MouseEvent e) { + public synchronized void mouseMoved(final java.awt.event.MouseEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); + final com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); if( consumeAWTEvent ) { e.consume(); } @@ -153,9 +153,9 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL } @Override - public synchronized void mouseWheelMoved(java.awt.event.MouseWheelEvent e) { + public synchronized void mouseWheelMoved(final java.awt.event.MouseWheelEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); + final com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder); if( consumeAWTEvent ) { e.consume(); } diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java index 698fe86f4..65d927157 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java @@ -40,15 +40,15 @@ public class AWTWindowAdapter { WindowClosingListener windowClosingListener; - public AWTWindowAdapter(com.jogamp.newt.event.WindowListener newtListener, NativeSurfaceHolder nsProxy) { + public AWTWindowAdapter(final com.jogamp.newt.event.WindowListener newtListener, final NativeSurfaceHolder nsProxy) { super(newtListener, nsProxy); } - public AWTWindowAdapter(com.jogamp.newt.event.WindowListener newtListener, com.jogamp.newt.Window newtProxy) { + public AWTWindowAdapter(final com.jogamp.newt.event.WindowListener newtListener, final com.jogamp.newt.Window newtProxy) { super(newtListener, newtProxy); } - public AWTWindowAdapter(com.jogamp.newt.Window downstream) { + public AWTWindowAdapter(final com.jogamp.newt.Window downstream) { super(downstream); } @@ -57,8 +57,8 @@ public class AWTWindowAdapter } @Override - public synchronized AWTAdapter addTo(java.awt.Component awtComponent) { - java.awt.Window win = getWindow(awtComponent); + public synchronized AWTAdapter addTo(final java.awt.Component awtComponent) { + final java.awt.Window win = getWindow(awtComponent); awtComponent.addComponentListener(this); awtComponent.addFocusListener(this); if( null != win && null == windowClosingListener ) { @@ -71,8 +71,8 @@ public class AWTWindowAdapter return this; } - public synchronized AWTAdapter removeWindowClosingFrom(java.awt.Component awtComponent) { - java.awt.Window win = getWindow(awtComponent); + public synchronized AWTAdapter removeWindowClosingFrom(final java.awt.Component awtComponent) { + final java.awt.Window win = getWindow(awtComponent); if( null != win && null != windowClosingListener ) { win.removeWindowListener(windowClosingListener); } @@ -80,7 +80,7 @@ public class AWTWindowAdapter } @Override - public synchronized AWTAdapter removeFrom(java.awt.Component awtComponent) { + public synchronized AWTAdapter removeFrom(final java.awt.Component awtComponent) { awtComponent.removeFocusListener(this); awtComponent.removeComponentListener(this); removeWindowClosingFrom(awtComponent); @@ -101,9 +101,9 @@ public class AWTWindowAdapter } @Override - public synchronized void focusGained(java.awt.event.FocusEvent e) { + public synchronized void focusGained(final java.awt.event.FocusEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); + final com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); if(DEBUG_IMPLEMENTATION) { System.err.println("AWT: focusGained: "+e+" -> "+event); } @@ -113,9 +113,9 @@ public class AWTWindowAdapter } @Override - public synchronized void focusLost(java.awt.event.FocusEvent e) { + public synchronized void focusLost(final java.awt.event.FocusEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); + final com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); if(DEBUG_IMPLEMENTATION) { System.err.println("AWT: focusLost: "+e+" -> "+event); } @@ -125,9 +125,9 @@ public class AWTWindowAdapter } @Override - public synchronized void componentResized(java.awt.event.ComponentEvent e) { + public synchronized void componentResized(final java.awt.event.ComponentEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); + final com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); if(DEBUG_IMPLEMENTATION) { final java.awt.Component c = e.getComponent(); final java.awt.Dimension sz = c.getSize(); @@ -149,9 +149,9 @@ public class AWTWindowAdapter } @Override - public synchronized void componentMoved(java.awt.event.ComponentEvent e) { + public synchronized void componentMoved(final java.awt.event.ComponentEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); + final com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); if(DEBUG_IMPLEMENTATION) { System.err.println("AWT: componentMoved: "+e+" -> "+event); } @@ -161,7 +161,7 @@ public class AWTWindowAdapter } @Override - public synchronized void componentShown(java.awt.event.ComponentEvent e) { + public synchronized void componentShown(final java.awt.event.ComponentEvent e) { if( !isSetup ) { return; } final java.awt.Component comp = e.getComponent(); if(DEBUG_IMPLEMENTATION) { @@ -180,7 +180,7 @@ public class AWTWindowAdapter } @Override - public synchronized void componentHidden(java.awt.event.ComponentEvent e) { + public synchronized void componentHidden(final java.awt.event.ComponentEvent e) { if( !isSetup ) { return; } final java.awt.Component comp = e.getComponent(); if(DEBUG_IMPLEMENTATION) { @@ -199,54 +199,54 @@ public class AWTWindowAdapter } @Override - public synchronized void windowActivated(java.awt.event.WindowEvent e) { + public synchronized void windowActivated(final java.awt.event.WindowEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); + final com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); if( EventProcRes.DISPATCH == processEvent(false, event) ) { ((com.jogamp.newt.event.WindowListener)newtListener).windowGainedFocus(event); } } @Override - public synchronized void windowClosed(java.awt.event.WindowEvent e) { } + public synchronized void windowClosed(final java.awt.event.WindowEvent e) { } @Override - public synchronized void windowClosing(java.awt.event.WindowEvent e) { } + public synchronized void windowClosing(final java.awt.event.WindowEvent e) { } @Override - public synchronized void windowDeactivated(java.awt.event.WindowEvent e) { + public synchronized void windowDeactivated(final java.awt.event.WindowEvent e) { if( !isSetup ) { return; } - com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); + final com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); if( EventProcRes.DISPATCH == processEvent(false, event) ) { ((com.jogamp.newt.event.WindowListener)newtListener).windowLostFocus(event); } } @Override - public synchronized void windowDeiconified(java.awt.event.WindowEvent e) { } + public synchronized void windowDeiconified(final java.awt.event.WindowEvent e) { } @Override - public synchronized void windowIconified(java.awt.event.WindowEvent e) { } + public synchronized void windowIconified(final java.awt.event.WindowEvent e) { } @Override - public synchronized void windowOpened(java.awt.event.WindowEvent e) { } + public synchronized void windowOpened(final java.awt.event.WindowEvent e) { } class WindowClosingListener implements java.awt.event.WindowListener { @Override - public void windowClosing(java.awt.event.WindowEvent e) { + public void windowClosing(final java.awt.event.WindowEvent e) { synchronized( AWTWindowAdapter.this ) { if( !isSetup ) { return; } - com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); + final com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); if( EventProcRes.DISPATCH == processEvent(true, event) ) { ((com.jogamp.newt.event.WindowListener)newtListener).windowDestroyNotify(event); } } } @Override - public void windowClosed(java.awt.event.WindowEvent e) { + public void windowClosed(final java.awt.event.WindowEvent e) { synchronized( AWTWindowAdapter.this ) { if( !isSetup ) { return; } - com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); + final com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder); if( EventProcRes.DISPATCH == processEvent(true, event) ) { ((com.jogamp.newt.event.WindowListener)newtListener).windowDestroyed(event); } @@ -254,15 +254,15 @@ public class AWTWindowAdapter } @Override - public void windowActivated(java.awt.event.WindowEvent e) { } + public void windowActivated(final java.awt.event.WindowEvent e) { } @Override - public void windowDeactivated(java.awt.event.WindowEvent e) { } + public void windowDeactivated(final java.awt.event.WindowEvent e) { } @Override - public void windowDeiconified(java.awt.event.WindowEvent e) { } + public void windowDeiconified(final java.awt.event.WindowEvent e) { } @Override - public void windowIconified(java.awt.event.WindowEvent e) { } + public void windowIconified(final java.awt.event.WindowEvent e) { } @Override - public void windowOpened(java.awt.event.WindowEvent e) { } + public void windowOpened(final java.awt.event.WindowEvent e) { } } } diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index 992cc4284..b9c4e35f2 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -115,7 +115,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind /** * Constructor. Do not call this directly -- use {@link #create()} instead. */ - protected GLWindow(Window window) { + protected GLWindow(final Window window) { super(null, null, false /* always handle device lifecycle ourselves */); this.window = (WindowImpl) window; this.window.setWindowDestroyNotifyAction( new Runnable() { @@ -125,12 +125,12 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } } ); window.addWindowListener(new WindowAdapter() { @Override - public void windowRepaint(WindowUpdateEvent e) { + public void windowRepaint(final WindowUpdateEvent e) { defaultWindowRepaintOp(); } @Override - public void windowResized(WindowEvent e) { + public void windowResized(final WindowEvent e) { defaultWindowResizedOp(getSurfaceWidth(), getSurfaceHeight()); } @@ -152,7 +152,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind * </p> * The default Display will be reused if already instantiated. */ - public static GLWindow create(GLCapabilitiesImmutable caps) { + public static GLWindow create(final GLCapabilitiesImmutable caps) { return new GLWindow(NewtFactory.createWindow(caps)); } @@ -164,7 +164,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind * and {@link Screen#removeReference()}. * </p> */ - public static GLWindow create(Screen screen, GLCapabilitiesImmutable caps) { + public static GLWindow create(final Screen screen, final GLCapabilitiesImmutable caps) { return new GLWindow(NewtFactory.createWindow(screen, caps)); } @@ -175,7 +175,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind * and {@link Screen#removeReference()}. * </p> */ - public static GLWindow create(Window window) { + public static GLWindow create(final Window window) { return new GLWindow(window); } @@ -192,7 +192,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind * and {@link Screen#removeReference()}. * </p> */ - public static GLWindow create(NativeWindow parentNativeWindow, GLCapabilitiesImmutable caps) { + public static GLWindow create(final NativeWindow parentNativeWindow, final GLCapabilitiesImmutable caps) { return new GLWindow(NewtFactory.createWindow(parentNativeWindow, caps)); } @@ -205,7 +205,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) { + public WindowClosingMode setDefaultCloseOperation(final WindowClosingMode op) { return window.setDefaultCloseOperation(op); } @@ -214,7 +214,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind // @Override - public CapabilitiesChooser setCapabilitiesChooser(CapabilitiesChooser chooser) { + public CapabilitiesChooser setCapabilitiesChooser(final CapabilitiesChooser chooser) { return window.setCapabilitiesChooser(chooser); } @@ -250,7 +250,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void setTitle(String title) { + public final void setTitle(final String title) { window.setTitle(title); } @@ -265,7 +265,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void setPointerVisible(boolean mouseVisible) { + public final void setPointerVisible(final boolean mouseVisible) { window.setPointerVisible(mouseVisible); } @@ -285,17 +285,17 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void confinePointer(boolean grab) { + public final void confinePointer(final boolean grab) { window.confinePointer(grab); } @Override - public final void setUndecorated(boolean value) { + public final void setUndecorated(final boolean value) { window.setUndecorated(value); } @Override - public final void warpPointer(int x, int y) { + public final void warpPointer(final int x, final int y) { window.warpPointer(x, y); } @Override @@ -304,7 +304,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void setAlwaysOnTop(boolean value) { + public final void setAlwaysOnTop(final boolean value) { window.setAlwaysOnTop(value); } @@ -314,12 +314,12 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void setFocusAction(FocusRunnable focusAction) { + public final void setFocusAction(final FocusRunnable focusAction) { window.setFocusAction(focusAction); } @Override - public void setKeyboardFocusHandler(KeyListener l) { + public void setKeyboardFocusHandler(final KeyListener l) { window.setKeyboardFocusHandler(l); } @@ -329,7 +329,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void requestFocus(boolean wait) { + public final void requestFocus(final boolean wait) { window.requestFocus(wait); } @@ -414,21 +414,21 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void setPosition(int x, int y) { + public final void setPosition(final int x, final int y) { window.setPosition(x, y); } @Override - public void setTopLevelPosition(int x, int y) { + public void setTopLevelPosition(final int x, final int y) { window.setTopLevelPosition(x, y); } @Override - public final boolean setFullscreen(boolean fullscreen) { + public final boolean setFullscreen(final boolean fullscreen) { return window.setFullscreen(fullscreen); } @Override - public boolean setFullscreen(List<MonitorDevice> monitors) { + public boolean setFullscreen(final List<MonitorDevice> monitors) { return window.setFullscreen(monitors); } @@ -449,17 +449,17 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final ReparentOperation reparentWindow(NativeWindow newParent, int x, int y, int hints) { + public final ReparentOperation reparentWindow(final NativeWindow newParent, final int x, final int y, final int hints) { return window.reparentWindow(newParent, x, y, hints); } @Override - public final boolean removeChild(NativeWindow win) { + public final boolean removeChild(final NativeWindow win) { return window.removeChild(win); } @Override - public final boolean addChild(NativeWindow win) { + public final boolean addChild(final NativeWindow win) { return window.addChild(win); } @@ -473,30 +473,30 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public void setWindowDestroyNotifyAction(Runnable r) { + public void setWindowDestroyNotifyAction(final Runnable r) { window.setWindowDestroyNotifyAction(r); } @Override - public final void setVisible(boolean visible) { + public final void setVisible(final boolean visible) { window.setVisible(visible); } @Override - public void setVisible(boolean wait, boolean visible) { + public void setVisible(final boolean wait, final boolean visible) { window.setVisible(wait, visible); } @Override - public final void setSize(int width, int height) { + public final void setSize(final int width, final int height) { window.setSize(width, height); } @Override - public final void setSurfaceSize(int pixelWidth, int pixelHeight) { + public final void setSurfaceSize(final int pixelWidth, final int pixelHeight) { window.setSurfaceSize(pixelWidth, pixelHeight); } @Override - public void setTopLevelSize(int width, int height) { + public void setTopLevelSize(final int width, final int height) { window.setTopLevelSize(width, height); } @@ -506,7 +506,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public Point getLocationOnScreen(Point storage) { + public Point getLocationOnScreen(final Point storage) { return window.getLocationOnScreen(storage); } @@ -514,7 +514,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind protected class GLLifecycleHook implements WindowImpl.LifecycleHook { @Override - public void preserveGLStateAtDestroy(boolean value) { + public void preserveGLStateAtDestroy(final boolean value) { GLWindow.this.preserveGLStateAtDestroy(value); } @@ -526,7 +526,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind @Override public synchronized void destroyActionInLock() { if(Window.DEBUG_IMPLEMENTATION) { - String msg = "GLWindow.destroy() "+WindowImpl.getThreadName()+", start"; + final String msg = "GLWindow.destroy() "+WindowImpl.getThreadName()+", start"; System.err.println(msg); //Exception e1 = new Exception(msg); //e1.printStackTrace(); @@ -552,7 +552,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public synchronized void setVisibleActionPost(boolean visible, boolean nativeWindowCreated) { + public synchronized void setVisibleActionPost(final boolean visible, final boolean nativeWindowCreated) { long t0; if(Window.DEBUG_IMPLEMENTATION) { t0 = System.nanoTime(); @@ -624,7 +624,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind if( anim.isAnimating() && null != animThread ) { try { animThread.stop(); - } catch(Throwable t) { + } catch(final Throwable t) { if( DEBUG ) { System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); @@ -705,7 +705,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind // NEWTEventConsumer // @Override - public boolean consumeEvent(NEWTEvent event) { + public boolean consumeEvent(final NEWTEvent event) { return window.consumeEvent(event); } @@ -713,27 +713,27 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind // Window completion // @Override - public final void windowRepaint(int x, int y, int width, int height) { + public final void windowRepaint(final int x, final int y, final int width, final int height) { window.windowRepaint(x, y, width, height); } @Override - public final void enqueueEvent(boolean wait, com.jogamp.newt.event.NEWTEvent event) { + public final void enqueueEvent(final boolean wait, final com.jogamp.newt.event.NEWTEvent event) { window.enqueueEvent(wait, event); } @Override - public final void runOnEDTIfAvail(boolean wait, final Runnable task) { + public final void runOnEDTIfAvail(final boolean wait, final Runnable task) { window.runOnEDTIfAvail(wait, task); } @Override - public void sendWindowEvent(int eventType) { + public void sendWindowEvent(final int eventType) { window.sendWindowEvent(eventType); } @Override - public final WindowListener getWindowListener(int index) { + public final WindowListener getWindowListener(final int index) { return window.getWindowListener(index); } @@ -743,22 +743,22 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void removeWindowListener(WindowListener l) { + public final void removeWindowListener(final WindowListener l) { window.removeWindowListener(l); } @Override - public final void addWindowListener(WindowListener l) { + public final void addWindowListener(final WindowListener l) { window.addWindowListener(l); } @Override - public final void addWindowListener(int index, WindowListener l) throws IndexOutOfBoundsException { + public final void addWindowListener(final int index, final WindowListener l) throws IndexOutOfBoundsException { window.addWindowListener(index, l); } @Override - public final void setKeyboardVisible(boolean visible) { + public final void setKeyboardVisible(final boolean visible) { window.setKeyboardVisible(visible); } @@ -768,22 +768,22 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void addKeyListener(KeyListener l) { + public final void addKeyListener(final KeyListener l) { window.addKeyListener(l); } @Override - public final void addKeyListener(int index, KeyListener l) { + public final void addKeyListener(final int index, final KeyListener l) { window.addKeyListener(index, l); } @Override - public final void removeKeyListener(KeyListener l) { + public final void removeKeyListener(final KeyListener l) { window.removeKeyListener(l); } @Override - public final KeyListener getKeyListener(int index) { + public final KeyListener getKeyListener(final int index) { return window.getKeyListener(index); } @@ -793,22 +793,22 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void addMouseListener(MouseListener l) { + public final void addMouseListener(final MouseListener l) { window.addMouseListener(l); } @Override - public final void addMouseListener(int index, MouseListener l) { + public final void addMouseListener(final int index, final MouseListener l) { window.addMouseListener(index, l); } @Override - public final void removeMouseListener(MouseListener l) { + public final void removeMouseListener(final MouseListener l) { window.removeMouseListener(l); } @Override - public final MouseListener getMouseListener(int index) { + public final MouseListener getMouseListener(final int index) { return window.getMouseListener(index); } @@ -818,7 +818,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public void setDefaultGesturesEnabled(boolean enable) { + public void setDefaultGesturesEnabled(final boolean enable) { window.setDefaultGesturesEnabled(enable); } @Override @@ -826,27 +826,27 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind return window.areDefaultGesturesEnabled(); } @Override - public final void addGestureHandler(GestureHandler gh) { + public final void addGestureHandler(final GestureHandler gh) { window.addGestureHandler(gh); } @Override - public final void addGestureHandler(int index, GestureHandler gh) { + public final void addGestureHandler(final int index, final GestureHandler gh) { window.addGestureHandler(index, gh); } @Override - public final void removeGestureHandler(GestureHandler gh) { + public final void removeGestureHandler(final GestureHandler gh) { window.removeGestureHandler(gh); } @Override - public final void addGestureListener(GestureHandler.GestureListener gl) { + public final void addGestureListener(final GestureHandler.GestureListener gl) { window.addGestureListener(-1, gl); } @Override - public final void addGestureListener(int index, GestureHandler.GestureListener gl) { + public final void addGestureListener(final int index, final GestureHandler.GestureListener gl) { window.addGestureListener(index, gl); } @Override - public final void removeGestureListener(GestureHandler.GestureListener gl) { + public final void removeGestureListener(final GestureHandler.GestureListener gl) { window.removeGestureListener(gl); } @@ -881,22 +881,22 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final void removeSurfaceUpdatedListener(SurfaceUpdatedListener l) { + public final void removeSurfaceUpdatedListener(final SurfaceUpdatedListener l) { window.removeSurfaceUpdatedListener(l); } @Override - public final void addSurfaceUpdatedListener(SurfaceUpdatedListener l) { + public final void addSurfaceUpdatedListener(final SurfaceUpdatedListener l) { window.addSurfaceUpdatedListener(l); } @Override - public final void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l) throws IndexOutOfBoundsException { + public final void addSurfaceUpdatedListener(final int index, final SurfaceUpdatedListener l) throws IndexOutOfBoundsException { window.addSurfaceUpdatedListener(index, l); } @Override - public final void surfaceUpdated(Object updater, NativeSurface ns, long when) { + public final void surfaceUpdated(final Object updater, final NativeSurface ns, final long when) { window.surfaceUpdated(updater, ns, when); } @@ -930,7 +930,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind /** * A most simple JOGL AWT test entry */ - public static void main(String args[]) { + public static void main(final String args[]) { final boolean forceES2; final boolean forceES3; final boolean forceGL3; @@ -984,45 +984,45 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind final GLCapabilitiesImmutable caps = new GLCapabilities( glp ); System.err.println("Requesting: "+caps); - GLWindow glWindow = GLWindow.create(caps); + final GLWindow glWindow = GLWindow.create(caps); glWindow.setSize(128, 128); glWindow.addGLEventListener(new GLEventListener() { @Override - public void init(GLAutoDrawable drawable) { - GL gl = drawable.getGL(); + public void init(final GLAutoDrawable drawable) { + final GL gl = drawable.getGL(); System.err.println(JoglVersion.getGLInfo(gl, null)); System.err.println("Requested: "+drawable.getNativeSurface().getGraphicsConfiguration().getRequestedCapabilities()); System.err.println("Chosen : "+drawable.getChosenGLCapabilities()); System.err.println("GL impl. class "+gl.getClass().getName()); if( gl.isGL4ES3() ) { - GL4ES3 _gl = gl.getGL4ES3(); + final GL4ES3 _gl = gl.getGL4ES3(); System.err.println("GL4ES3 retrieved, impl. class "+_gl.getClass().getName()); } if( gl.isGL3() ) { - GL3 _gl = gl.getGL3(); + final GL3 _gl = gl.getGL3(); System.err.println("GL3 retrieved, impl. class "+_gl.getClass().getName()); } if( gl.isGLES3() ) { - GLES3 _gl = gl.getGLES3(); + final GLES3 _gl = gl.getGLES3(); System.err.println("GLES3 retrieved, impl. class "+_gl.getClass().getName()); } if( gl.isGLES2() ) { - GLES2 _gl = gl.getGLES2(); + final GLES2 _gl = gl.getGLES2(); System.err.println("GLES2 retrieved, impl. class "+_gl.getClass().getName()); } } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { } }); diff --git a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java index 674d467f9..76af2d0ec 100644 --- a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java +++ b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java @@ -121,7 +121,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { * @param style additional styles to SWT#NO_BACKGROUND * @param child optional preassigned {@link #Window}, maybe null */ - public NewtCanvasSWT(final Composite parent, final int style, Window child) { + public NewtCanvasSWT(final Composite parent, final int style, final Window child) { super(parent, style | SWT.NO_BACKGROUND); SWTAccessor.setRealized(this, true); @@ -138,7 +138,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { final Listener listener = new Listener () { @Override - public void handleEvent (Event event) { + public void handleEvent (final Event event) { switch (event.type) { case SWT.Paint: if( DEBUG ) { @@ -339,7 +339,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } @Override - public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) { + public WindowClosingMode setDefaultCloseOperation(final WindowClosingMode op) { return newtChildCloseOp = op; // TODO: implement ?! } @@ -392,11 +392,11 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } @Override - public boolean setParent(Composite parent) { + public boolean setParent(final Composite parent) { return super.setParent(parent); } - /* package */ void configureNewtChild(boolean attach) { + /* package */ void configureNewtChild(final boolean attach) { newtChildReady = attach; if( null != newtChild ) { newtChild.setKeyboardFocusHandler(null); @@ -409,7 +409,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } } - void reparentWindow(boolean add) { + void reparentWindow(final boolean add) { if( null == newtChild ) { return; // nop } @@ -469,7 +469,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { private final long nativeWindowHandle; private final InsetsImmutable insets; // only required to allow proper client position calculation on OSX - public SWTNativeWindow(AbstractGraphicsConfiguration config, long nativeWindowHandle) { + public SWTNativeWindow(final AbstractGraphicsConfiguration config, final long nativeWindowHandle) { this.config = config; this.nativeWindowHandle = nativeWindowHandle; if( SWTAccessor.isOSX ) { @@ -503,14 +503,14 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } @Override - public void addSurfaceUpdatedListener(SurfaceUpdatedListener l) { } + public void addSurfaceUpdatedListener(final SurfaceUpdatedListener l) { } @Override - public void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l) throws IndexOutOfBoundsException { + public void addSurfaceUpdatedListener(final int index, final SurfaceUpdatedListener l) throws IndexOutOfBoundsException { } @Override - public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l) { } + public void removeSurfaceUpdatedListener(final SurfaceUpdatedListener l) { } @Override public long getSurfaceHandle() { @@ -566,7 +566,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } @Override - public void surfaceUpdated(Object updater, NativeSurface ns, long when) { } + public void surfaceUpdated(final Object updater, final NativeSurface ns, final long when) { } @Override public void destroy() { } @@ -597,7 +597,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } @Override - public Point getLocationOnScreen(Point point) { + public Point getLocationOnScreen(final Point point) { final Point los; // client window location on screen if( SWTAccessor.isOSX ) { // let getLOS provide the point where the child window may be placed @@ -625,10 +625,10 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } }; - static String newtWinHandleToHexString(Window w) { + static String newtWinHandleToHexString(final Window w) { return null != w ? toHexString(w.getWindowHandle()) : "nil"; } - static String toHexString(long l) { + static String toHexString(final long l) { return "0x"+Long.toHexString(l); } } diff --git a/src/newt/classes/com/jogamp/newt/util/MainThread.java b/src/newt/classes/com/jogamp/newt/util/MainThread.java index 049320b21..80da1ce3b 100644 --- a/src/newt/classes/com/jogamp/newt/util/MainThread.java +++ b/src/newt/classes/com/jogamp/newt/util/MainThread.java @@ -45,6 +45,7 @@ import java.util.List; import javax.media.nativewindow.NativeWindowFactory; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; import jogamp.newt.Debug; @@ -104,7 +105,7 @@ public class MainThread { NativeWindowFactory.initSingleton(); NEWTJNILibLoader.loadNEWT(); HINT_USE_MAIN_THREAD = !NativeWindowFactory.isAWTAvailable() || - Debug.getBooleanProperty("newt.MainThread.force", true); + PropertyAccess.getBooleanProperty("newt.MainThread.force", true); osType = Platform.getOSType(); isMacOSX = osType == Platform.OSType.MACOS; rootThreadGroup = getRootThreadGroup(); @@ -125,7 +126,7 @@ public class MainThread { return rootGroup; } - private static final Thread[] getAllThreads(int[] count) { + private static final Thread[] getAllThreads(final int[] count) { int tn; Thread[] threads = new Thread[ rootThreadGroup.activeCount() ]; while ( ( tn = rootThreadGroup.enumerate( threads, true ) ) == threads.length ) { @@ -135,9 +136,9 @@ public class MainThread { return threads; } private static final List<Thread> getNonDaemonThreads() { - List<Thread> res = new ArrayList<Thread>(); - int[] tn = { 0 }; - Thread[] threads = getAllThreads(tn); + final List<Thread> res = new ArrayList<Thread>(); + final int[] tn = { 0 }; + final Thread[] threads = getAllThreads(tn); for(int i = tn[0] - 1; i >= 0; i--) { final Thread thread = threads[i]; try { @@ -145,16 +146,16 @@ public class MainThread { res.add(thread); if(DEBUG) System.err.println("XXX0: "+thread.getName()+", "+thread); } - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); } } return res; } - private static final int getNonDaemonThreadCount(List<Thread> ignoreThreads) { + private static final int getNonDaemonThreadCount(final List<Thread> ignoreThreads) { int res = 0; - int[] tn = { 0 }; - Thread[] threads = getAllThreads(tn); + final int[] tn = { 0 }; + final Thread[] threads = getAllThreads(tn); for(int i = tn[0] - 1; i >= 0; i--) { final Thread thread = threads[i]; @@ -163,7 +164,7 @@ public class MainThread { res++; if(DEBUG) System.err.println("MainAction.run(): non daemon thread: "+thread); } - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); } } @@ -177,7 +178,7 @@ public class MainThread { private final Method mainClassMain; private List<Thread> nonDaemonThreadsAtStart; - public UserApp(String mainClassName, String[] mainClassArgs) throws SecurityException, NoSuchMethodException, ClassNotFoundException { + public UserApp(final String mainClassName, final String[] mainClassArgs) throws SecurityException, NoSuchMethodException, ClassNotFoundException { super(); this.mainClassName=mainClassName; this.mainClassArgs=mainClassArgs; @@ -204,10 +205,10 @@ public class MainThread { try { if(DEBUG) System.err.println("MainAction.run(): "+Thread.currentThread().getName()+" invoke "+mainClassName); mainClassMain.invoke(null, new Object[] { mainClassArgs } ); - } catch (InvocationTargetException ite) { + } catch (final InvocationTargetException ite) { ite.getTargetException().printStackTrace(); return; - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); return; } @@ -219,7 +220,7 @@ public class MainThread { if(DEBUG) System.err.println("MainAction.run(): post user app, non daemon threads alive: "+ndtr); try { Thread.sleep(1000); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } } @@ -237,7 +238,7 @@ public class MainThread { if(DEBUG) { System.err.println("MainAction.main(): "+Thread.currentThread()+" MainAction fin - stopNSApp.X"); } - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } else { @@ -253,7 +254,7 @@ public class MainThread { * @throws ClassNotFoundException * @throws NoSuchMethodException * @throws SecurityException */ - public static void main(String[] args) throws SecurityException, NoSuchMethodException, ClassNotFoundException { + public static void main(final String[] args) throws SecurityException, NoSuchMethodException, ClassNotFoundException { final Thread cur = Thread.currentThread(); useMainThread = HINT_USE_MAIN_THREAD; @@ -273,8 +274,8 @@ public class MainThread { return; } - String mainClassName=args[0]; - String[] mainClassArgs=new String[args.length-1]; + final String mainClassName=args[0]; + final String[] mainClassArgs=new String[args.length-1]; if(args.length>1) { System.arraycopy(args, 1, mainClassArgs, 0, args.length-1); } @@ -289,7 +290,7 @@ public class MainThread { if ( useMainThread ) { try { cur.setName(cur.getName()+"-MainThread"); - } catch (Exception e) {} + } catch (final Exception e) {} // dispatch user's main thread .. mainAction.start(); @@ -301,7 +302,7 @@ public class MainThread { } ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "runNSApplication", null, null, MainThread.class.getClassLoader()); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } diff --git a/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java b/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java index e019068f5..e5f8ff17c 100644 --- a/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java +++ b/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java @@ -43,11 +43,11 @@ import javax.media.nativewindow.util.SurfaceSize; */ public class MonitorModeUtil { - public static int getIndex(List<MonitorMode> monitorModes, MonitorMode search) { + public static int getIndex(final List<MonitorMode> monitorModes, final MonitorMode search) { return monitorModes.indexOf(search); } - public static int getIndexByHashCode(List<MonitorMode> monitorModes, MonitorMode search) { + public static int getIndexByHashCode(final List<MonitorMode> monitorModes, final MonitorMode search) { if( null!=monitorModes && monitorModes.size()>0 ) { for (int i=0; i<monitorModes.size(); i++) { if ( search.hashCode() == monitorModes.get(i).hashCode() ) { @@ -58,7 +58,7 @@ public class MonitorModeUtil { return -1; } - public static MonitorMode getByNativeSizeRateIdAndRotation(List<MonitorMode> monitorModes, MonitorMode.SizeAndRRate sizeAndRate, int modeId, int rotation) { + public static MonitorMode getByNativeSizeRateIdAndRotation(final List<MonitorMode> monitorModes, final MonitorMode.SizeAndRRate sizeAndRate, final int modeId, final int rotation) { if( null!=monitorModes && monitorModes.size()>0 ) { for (int i=0; i<monitorModes.size(); i++) { final MonitorMode mode = monitorModes.get(i); @@ -71,7 +71,7 @@ public class MonitorModeUtil { } /** Sort the given {@link MonitorMode} collection w/ {@link MonitorMode#compareTo(MonitorMode)} function. */ - public static void sort(List<MonitorMode> monitorModes, boolean ascendingOrder) { + public static void sort(final List<MonitorMode> monitorModes, final boolean ascendingOrder) { if( ascendingOrder ) { Collections.sort(monitorModes); } else { @@ -85,7 +85,7 @@ public class MonitorModeUtil { * @param surfaceSize * @return modes with exact {@link SurfaceSize}. May return zero sized list for non. */ - public static List<MonitorMode> filterBySurfaceSize(List<MonitorMode> monitorModes, SurfaceSize surfaceSize) { + public static List<MonitorMode> filterBySurfaceSize(final List<MonitorMode> monitorModes, final SurfaceSize surfaceSize) { final List<MonitorMode> out = new ArrayList<MonitorMode>(); if( null!=monitorModes && monitorModes.size()>0 ) { for (int i=0; null!=monitorModes && i<monitorModes.size(); i++) { @@ -104,7 +104,7 @@ public class MonitorModeUtil { * @param rotation * @return modes with exact rotation. May return zero sized list for non. */ - public static List<MonitorMode> filterByRotation(List<MonitorMode> monitorModes, int rotation) { + public static List<MonitorMode> filterByRotation(final List<MonitorMode> monitorModes, final int rotation) { final List<MonitorMode> out = new ArrayList<MonitorMode>(); if( null!=monitorModes && monitorModes.size()>0 ) { for (int i=0; null!=monitorModes && i<monitorModes.size(); i++) { @@ -123,7 +123,7 @@ public class MonitorModeUtil { * @param bitsPerPixel * @return modes with exact bpp. May return zero sized list for non. */ - public static List<MonitorMode> filterByBpp(List<MonitorMode> monitorModes, int bitsPerPixel) { + public static List<MonitorMode> filterByBpp(final List<MonitorMode> monitorModes, final int bitsPerPixel) { final List<MonitorMode> out = new ArrayList<MonitorMode>(); if( null!=monitorModes && monitorModes.size()>0 ) { for (int i=0; null!=monitorModes && i<monitorModes.size(); i++) { @@ -142,7 +142,7 @@ public class MonitorModeUtil { * @param flags * @return modes with exact flags. May return zero sized list for non. */ - public static List<MonitorMode> filterByFlags(List<MonitorMode> monitorModes, int flags) { + public static List<MonitorMode> filterByFlags(final List<MonitorMode> monitorModes, final int flags) { final List<MonitorMode> out = new ArrayList<MonitorMode>(); if( null!=monitorModes && monitorModes.size()>0 ) { for (int i=0; null!=monitorModes && i<monitorModes.size(); i++) { @@ -160,7 +160,7 @@ public class MonitorModeUtil { * @param resolution in pixel units * @return modes with nearest resolution, or matching ones. May return zero sized list for non. */ - public static List<MonitorMode> filterByResolution(List<MonitorMode> monitorModes, DimensionImmutable resolution) { + public static List<MonitorMode> filterByResolution(final List<MonitorMode> monitorModes, final DimensionImmutable resolution) { final List<MonitorMode> out = new ArrayList<MonitorMode>(); if( null!=monitorModes && monitorModes.size()>0 ) { final int resolution_sq = resolution.getHeight()*resolution.getWidth(); @@ -192,14 +192,14 @@ public class MonitorModeUtil { * @param refreshRate * @return modes with nearest refreshRate, or matching ones. May return zero sized list for non. */ - public static List<MonitorMode> filterByRate(List<MonitorMode> monitorModes, float refreshRate) { + public static List<MonitorMode> filterByRate(final List<MonitorMode> monitorModes, final float refreshRate) { final List<MonitorMode> out = new ArrayList<MonitorMode>(); if( null!=monitorModes && monitorModes.size()>0 ) { float mode_dr = Float.MAX_VALUE; int mode_dr_idx = -1; for (int i=0; null!=monitorModes && i<monitorModes.size(); i++) { final MonitorMode mode = monitorModes.get(i); - float dr = Math.abs(refreshRate - mode.getRefreshRate()); + final float dr = Math.abs(refreshRate - mode.getRefreshRate()); if(dr<mode_dr) { mode_dr = dr; mode_dr_idx = i; @@ -220,7 +220,7 @@ public class MonitorModeUtil { * @param monitorModes * @return modes with highest available bpp (color depth). May return zero sized list for non. */ - public static List<MonitorMode> getHighestAvailableBpp(List<MonitorMode> monitorModes) { + public static List<MonitorMode> getHighestAvailableBpp(final List<MonitorMode> monitorModes) { if( null!=monitorModes && monitorModes.size()>0 ) { int highest = -1; for (int i=0; null!=monitorModes && i < monitorModes.size(); i++) { @@ -240,7 +240,7 @@ public class MonitorModeUtil { * @param monitorModes * @return modes with highest available refresh rate. May return zero sized list for non. */ - public static List<MonitorMode> getHighestAvailableRate(List<MonitorMode> monitorModes) { + public static List<MonitorMode> getHighestAvailableRate(final List<MonitorMode> monitorModes) { if( null!=monitorModes && monitorModes.size()>0 ) { float highest = -1; for (int i=0; null!=monitorModes && i < monitorModes.size(); i++) { diff --git a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java index 459db11b2..9a3e79a8f 100644 --- a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java +++ b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java @@ -107,7 +107,7 @@ public class JOGLNewtApplet3Run implements Applet3 { PointImmutable upstreamLocOnScreen; NativeWindow browserWin; - final String getParameter(String name) { + final String getParameter(final String name) { return ctx.getParameter(name); } @@ -132,7 +132,7 @@ public class JOGLNewtApplet3Run implements Applet3 { glHeight = JOGLNewtAppletBase.str2Int(getParameter("gl_height"), glHeight); glUndecorated = JOGLNewtAppletBase.str2Bool(getParameter("gl_undecorated"), glUndecorated); glAlwaysOnTop = JOGLNewtAppletBase.str2Bool(getParameter("gl_alwaysontop"), glAlwaysOnTop); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } glStandalone = Integer.MAX_VALUE>glXd && Integer.MAX_VALUE>glYd && Integer.MAX_VALUE>glWidth && Integer.MAX_VALUE>glHeight; @@ -176,14 +176,14 @@ public class JOGLNewtApplet3Run implements Applet3 { return new NativeWindowDownstream() { @Override - public void setVisible(boolean v) { + public void setVisible(final boolean v) { if( null != glWindow ) { glWindow.setVisible(v); } } @Override - public void setSize(int width, int height) { + public void setSize(final int width, final int height) { upstreamSizePosHook.setWinSize(width, height); if( null != glWindow ) { glWindow.setSize(width, height); @@ -226,7 +226,7 @@ public class JOGLNewtApplet3Run implements Applet3 { } @Override - public void notifyPositionChanged(NativeWindowUpstream nw) { + public void notifyPositionChanged(final NativeWindowUpstream nw) { upstreamSizePosHook.setWinPos(nw.getX(), nw.getY()); if( null != glWindow ) { glWindow.setPosition(nw.getX(), nw.getY()); @@ -236,7 +236,7 @@ public class JOGLNewtApplet3Run implements Applet3 { } @Override - public void init(Applet3Context ctx) { + public void init(final Applet3Context ctx) { if(DEBUG) { System.err.println("JOGLNewtApplet1Run.init() START - "+currentThreadName()); } @@ -255,7 +255,7 @@ public class JOGLNewtApplet3Run implements Applet3 { glTrace = JOGLNewtAppletBase.str2Bool(getParameter("gl_trace"), glTrace); glNoDefaultKeyListener = JOGLNewtAppletBase.str2Bool(getParameter("gl_nodefaultkeyListener"), glNoDefaultKeyListener); glCloseable = JOGLNewtAppletBase.str2Bool(getParameter("gl_closeable"), glCloseable); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } if(null==glEventListenerClazzName) { @@ -282,7 +282,7 @@ public class JOGLNewtApplet3Run implements Applet3 { glWindow.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); glWindow.setDefaultCloseOperation(glCloseable ? WindowClosingMode.DISPOSE_ON_CLOSE : WindowClosingMode.DO_NOTHING_ON_CLOSE); base.init(glWindow); - } catch (Throwable t) { + } catch (final Throwable t) { throw new RuntimeException(t); } if(DEBUG) { diff --git a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java index eee8ab23e..d40e09d96 100644 --- a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java +++ b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java @@ -54,6 +54,7 @@ import com.jogamp.newt.event.WindowEvent; import com.jogamp.newt.event.WindowListener; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.util.Animator; +import com.jogamp.opengl.util.AnimatorBase; /** Shows how to deploy an applet using JOGL. This demo must be @@ -76,12 +77,12 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { boolean isValid = false; NativeWindow parentWin; - public JOGLNewtAppletBase(String glEventListenerClazzName, - int glSwapInterval, - boolean noDefaultKeyListener, - boolean glClosable, - boolean glDebug, - boolean glTrace) { + public JOGLNewtAppletBase(final String glEventListenerClazzName, + final int glSwapInterval, + final boolean noDefaultKeyListener, + final boolean glClosable, + final boolean glDebug, + final boolean glTrace) { this.glEventListenerClazzName=glEventListenerClazzName; this.glSwapInterval=glSwapInterval; @@ -96,19 +97,19 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { public Animator getGLAnimator() { return glAnimator; } public boolean isValid() { return isValid; } - public static boolean str2Bool(String str, boolean def) { + public static boolean str2Bool(final String str, final boolean def) { if(null==str) return def; try { return Boolean.valueOf(str).booleanValue(); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } return def; } - public static int str2Int(String str, int def) { + public static int str2Int(final String str, final int def) { if(null==str) return def; try { return Integer.parseInt(str); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } return def; } @@ -123,14 +124,14 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { Class<?> clazz = null; try { clazz = Class.forName(clazzName, false, cl); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); } return clazz; } }); instance = clazz.newInstance(); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); throw new RuntimeException("Error while instantiating demo: "+clazzName); } @@ -143,28 +144,28 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { return (GLEventListener) instance; } - public static boolean setField(Object instance, String fieldName, Object value) { + public static boolean setField(final Object instance, final String fieldName, final Object value) { try { - Field f = instance.getClass().getField(fieldName); + final Field f = instance.getClass().getField(fieldName); if(f.getType().isInstance(value)) { f.set(instance, value); return true; } else { System.out.println(instance.getClass()+" '"+fieldName+"' field not assignable with "+value.getClass()+", it's a: "+f.getType()); } - } catch (NoSuchFieldException nsfe) { + } catch (final NoSuchFieldException nsfe) { System.out.println(instance.getClass()+" has no '"+fieldName+"' field"); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); } return false; } - public void init(GLWindow glWindow) { + public void init(final GLWindow glWindow) { init(Thread.currentThread().getThreadGroup(), glWindow); } - public void init(ThreadGroup tg, final GLWindow glWindow) { + public void init(final ThreadGroup tg, final GLWindow glWindow) { isValid = false; this.glWindow = glWindow; glEventListener = createInstance(glEventListenerClazzName); @@ -200,12 +201,12 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { // glAnimator = new FPSAnimator(canvas, 60); glAnimator = new Animator(); - glAnimator.setModeBits(false, Animator.MODE_EXPECT_AWT_RENDERING_THREAD); // No AWT thread involved! + glAnimator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); // No AWT thread involved! glAnimator.setThreadGroup(tg); glAnimator.add(glWindow); glAnimator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, null); - } catch (Throwable t) { + } catch (final Throwable t) { throw new RuntimeException(t); } isValid = true; @@ -214,7 +215,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { private final WindowListener reparentHomeListener = new WindowAdapter() { // Closing action: back to parent! @Override - public void windowDestroyNotify(WindowEvent e) { + public void windowDestroyNotify(final WindowEvent e) { if( isValid() && WindowClosingMode.DO_NOTHING_ON_CLOSE == glWindow.getDefaultCloseOperation() && null == glWindow.getParent() && null != parentWin && 0 != parentWin.getWindowHandle() ) { @@ -239,7 +240,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { final Display disp = glWindow.getScreen().getDisplay(); try { pointerIconTest = disp.createPointerIcon(res, 8, 8); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } @@ -275,20 +276,20 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { // *********************************************************************************** @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { GL _gl = drawable.getGL(); if(glDebug) { try { _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, _gl, null) ); - } catch (Exception e) {e.printStackTrace();} + } catch (final Exception e) {e.printStackTrace();} } if(glTrace) { try { // Trace .. _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, _gl, new Object[] { System.err } ) ); - } catch (Exception e) {e.printStackTrace();} + } catch (final Exception e) {e.printStackTrace();} } if(glSwapInterval>=0) { @@ -296,13 +297,13 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { } } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { } // *********************************************************************************** @@ -310,7 +311,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { // *********************************************************************************** @Override - public void keyPressed(KeyEvent e) { + public void keyPressed(final KeyEvent e) { if( !e.isPrintableKey() || e.isAutoRepeat() ) { return; } @@ -384,7 +385,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { } @Override - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { } } diff --git a/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java b/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java index db0e8fc45..1a5c83609 100644 --- a/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java +++ b/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java @@ -25,8 +25,8 @@ import com.jogamp.opengl.JoglVersion; public class VersionApplet3 implements Applet3 { - public static void main(String[] args) { - VersionApplet3 va = new VersionApplet3(); + public static void main(final String[] args) { + final VersionApplet3 va = new VersionApplet3(); final NativeWindowDownstream nwc = va.createNativeWindow(null, new NativeWindowUpstream() { @Override @@ -50,7 +50,7 @@ public class VersionApplet3 implements Applet3 { return 0; // default } @Override - public void notifySurfaceUpdated(NativeWindowDownstream swappedWin) { + public void notifySurfaceUpdated(final NativeWindowDownstream swappedWin) { // NOP } @Override @@ -80,14 +80,14 @@ public class VersionApplet3 implements Applet3 { return new NativeWindowDownstream() { @Override - public void setVisible(boolean v) { + public void setVisible(final boolean v) { if( null != canvas ) { canvas.setVisible(v); } } @Override - public void setSize(int width, int height) { + public void setSize(final int width, final int height) { if( null != canvas ) { canvas.setSize(width, height); } @@ -129,7 +129,7 @@ public class VersionApplet3 implements Applet3 { } @Override - public void notifyPositionChanged(NativeWindowUpstream nw) { + public void notifyPositionChanged(final NativeWindowUpstream nw) { if( null != canvas ) { canvas.setPosition(nw.getX(), nw.getY()); } @@ -138,7 +138,7 @@ public class VersionApplet3 implements Applet3 { } @Override - public void init(Applet3Context ctx) { + public void init(final Applet3Context ctx) { System.err.println("VersionApplet: init() - begin"); canvas.addGLEventListener(new GLInfo()); System.err.println("VersionApplet: init() - end"); @@ -164,8 +164,8 @@ public class VersionApplet3 implements Applet3 { s = JoglVersion.getInstance().toString(); System.err.println(s); - GLDrawableFactory factory = GLDrawableFactory.getFactory(canvas.getGLProfile()); - List<GLCapabilitiesImmutable> availCaps = factory.getAvailableCapabilities(null); + final GLDrawableFactory factory = GLDrawableFactory.getFactory(canvas.getGLProfile()); + final List<GLCapabilitiesImmutable> availCaps = factory.getAvailableCapabilities(null); for(int i=0; i<availCaps.size(); i++) { s = availCaps.get(i).toString(); System.err.println(s); @@ -208,19 +208,19 @@ public class VersionApplet3 implements Applet3 { class GLInfo implements GLEventListener { @Override - public void init(GLAutoDrawable drawable) { - GL gl = drawable.getGL(); - String s = JoglVersion.getGLInfo(gl, null).toString(); + public void init(final GLAutoDrawable drawable) { + final GL gl = drawable.getGL(); + final String s = JoglVersion.getGLInfo(gl, null).toString(); System.err.println(s); } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { } } } diff --git a/src/newt/classes/jogamp/newt/Debug.java b/src/newt/classes/jogamp/newt/Debug.java index 7ef2d7ffc..773820c33 100644 --- a/src/newt/classes/jogamp/newt/Debug.java +++ b/src/newt/classes/jogamp/newt/Debug.java @@ -63,7 +63,7 @@ public class Debug extends PropertyAccess { verbose = isPropertyDefined("newt.verbose", true); debugAll = isPropertyDefined("newt.debug", true); if (verbose) { - Package p = Package.getPackage("com.jogamp.newt"); + final Package p = Package.getPackage("com.jogamp.newt"); System.err.println("NEWT specification version " + p.getSpecificationVersion()); System.err.println("NEWT implementation version " + p.getImplementationVersion()); System.err.println("NEWT 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("newt.debug." + subcomponent, true); } } diff --git a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java index ae72c8c73..ec5126932 100644 --- a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java +++ b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java @@ -63,7 +63,7 @@ public class DefaultEDTUtil implements EDTUtil { private int start_iter=0; private static long pollPeriod = EDTUtil.defaultEDTPollPeriod; - public DefaultEDTUtil(ThreadGroup tg, String name, Runnable dispatchMessages) { + public DefaultEDTUtil(final ThreadGroup tg, final String name, final Runnable dispatchMessages) { this.threadGroup = tg; this.name=Thread.currentThread().getName()+"-"+name+"-EDT-"; this.dispatchMessages=dispatchMessages; @@ -77,7 +77,7 @@ public class DefaultEDTUtil implements EDTUtil { } @Override - final public void setPollPeriod(long ms) { + final public void setPollPeriod(final long ms) { pollPeriod = ms; } @@ -141,7 +141,7 @@ public class DefaultEDTUtil implements EDTUtil { } @Override - public final boolean invokeStop(boolean wait, Runnable task) { + public final boolean invokeStop(final boolean wait, final Runnable task) { if(DEBUG) { System.err.println(Thread.currentThread()+": Default-EDT.invokeStop wait "+wait); Thread.dumpStack(); @@ -149,7 +149,7 @@ public class DefaultEDTUtil implements EDTUtil { return invokeImpl(wait, task, true /* stop */, false /* provokeError */); } - public final boolean invokeAndWaitError(Runnable task) { + public final boolean invokeAndWaitError(final Runnable task) { if(DEBUG) { System.err.println(Thread.currentThread()+": Default-EDT.invokeAndWaitError"); Thread.dumpStack(); @@ -158,7 +158,7 @@ public class DefaultEDTUtil implements EDTUtil { } @Override - public final boolean invoke(boolean wait, Runnable task) { + public final boolean invoke(final boolean wait, final Runnable task) { return invokeImpl(wait, task, false /* stop */, false /* provokeError */); } @@ -167,7 +167,7 @@ public class DefaultEDTUtil implements EDTUtil { public void run() { } }; - private final boolean invokeImpl(boolean wait, Runnable task, boolean stop, boolean provokeError) { + private final boolean invokeImpl(boolean wait, Runnable task, final boolean stop, final boolean provokeError) { Throwable throwable = null; RunnableTask rTask = null; final Object rTaskLock = new Object(); @@ -235,7 +235,7 @@ public class DefaultEDTUtil implements EDTUtil { if( wait ) { try { rTaskLock.wait(); // free lock, allow execution of rTask - } catch (InterruptedException ie) { + } catch (final InterruptedException ie) { throwable = ie; } if(null==throwable) { @@ -271,7 +271,7 @@ public class DefaultEDTUtil implements EDTUtil { try { _edt.tasks.notifyAll(); _edt.tasks.wait(); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } } @@ -286,7 +286,7 @@ public class DefaultEDTUtil implements EDTUtil { while( edt.isRunning ) { try { edtLock.wait(); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } } @@ -302,7 +302,7 @@ public class DefaultEDTUtil implements EDTUtil { volatile boolean isRunning = false; final ArrayList<RunnableTask> tasks = new ArrayList<RunnableTask>(); // one shot tasks - public NEDT(ThreadGroup tg, String name) { + public NEDT(final ThreadGroup tg, final String name) { super(tg, name); } @@ -349,7 +349,7 @@ public class DefaultEDTUtil implements EDTUtil { if(!shouldStop && tasks.size()==0) { try { tasks.wait(pollPeriod); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } } @@ -379,7 +379,7 @@ public class DefaultEDTUtil implements EDTUtil { } } } while(!shouldStop) ; - } catch (Throwable t) { + } catch (final Throwable t) { // handle errors .. shouldStop = true; if(t instanceof RuntimeException) { diff --git a/src/newt/classes/jogamp/newt/DisplayImpl.java b/src/newt/classes/jogamp/newt/DisplayImpl.java index 952e611f2..84ce45238 100644 --- a/src/newt/classes/jogamp/newt/DisplayImpl.java +++ b/src/newt/classes/jogamp/newt/DisplayImpl.java @@ -142,7 +142,7 @@ public abstract class DisplayImpl extends Display { System.err.println("createPointerIconPNG.0: "+res[0]); } } - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } } ); @@ -199,7 +199,7 @@ public abstract class DisplayImpl extends Display { res[0] = new PointerIconImpl(DisplayImpl.this, fpixelrect, new Point(hotX, hotY), handle); } } - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } } ); @@ -222,7 +222,7 @@ public abstract class DisplayImpl extends Display { * @param hotY the PointerIcon's hot-spot x-coord * @return if successful a valid handle (not null), otherwise null. */ - protected final long createPointerIconImplChecked(PixelFormat pixelformat, int width, int height, final ByteBuffer pixels, final int hotX, final int hotY) { + protected final long createPointerIconImplChecked(final PixelFormat pixelformat, final int width, final int height, final ByteBuffer pixels, final int hotX, final int hotY) { if( getNativePointerIconPixelFormat() != pixelformat ) { throw new IllegalArgumentException("Pixelformat no "+getNativePointerIconPixelFormat()+", but "+pixelformat); } @@ -243,17 +243,17 @@ public abstract class DisplayImpl extends Display { * @param hotY the PointerIcon's hot-spot x-coord * @return if successful a valid handle (not null), otherwise null. */ - protected long createPointerIconImpl(PixelFormat pixelformat, int width, int height, final ByteBuffer pixels, final int hotX, final int hotY) { + protected long createPointerIconImpl(final PixelFormat pixelformat, final int width, final int height, final ByteBuffer pixels, final int hotX, final int hotY) { return 0; } /** Executed from EDT! */ - protected void destroyPointerIconImpl(final long displayHandle, long piHandle) { } + protected void destroyPointerIconImpl(final long displayHandle, final long piHandle) { } /** Ensure static init has been run. */ /* pp */static void initSingleton() { } - private static Class<?> getDisplayClass(String type) + private static Class<?> getDisplayClass(final String type) throws ClassNotFoundException { final Class<?> displayClass = NewtFactory.getCustomClass(type, "DisplayDriver"); @@ -264,7 +264,7 @@ public abstract class DisplayImpl extends Display { } /** Make sure to reuse a Display with the same name */ - public static Display create(String type, String name, final long handle, boolean reuse) { + public static Display create(final String type, String name, final long handle, final boolean reuse) { try { final Class<?> displayClass = getDisplayClass(type); final DisplayImpl display = (DisplayImpl) displayClass.newInstance(); @@ -294,13 +294,13 @@ public abstract class DisplayImpl extends Display { System.err.println("Display.create() NEW: "+display+" "+getThreadName()); } return display; - } catch (Exception e) { + } catch (final Exception e) { throw new RuntimeException(e); } } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (obj == null) { return false; } @@ -340,7 +340,7 @@ public abstract class DisplayImpl extends Display { public void run() { f_dpy.createNativeImpl(); }}); - } catch (Throwable t) { + } catch (final Throwable t) { throw new NativeWindowException(t); } if( null == aDevice ) { @@ -409,7 +409,7 @@ public abstract class DisplayImpl extends Display { } } - public void runOnEDTIfAvail(boolean wait, final Runnable task) { + public void runOnEDTIfAvail(final boolean wait, final Runnable task) { final EDTUtil _edtUtil = edtUtil; if( !_edtUtil.isRunning() ) { // start EDT if not running yet synchronized( this ) { @@ -516,7 +516,7 @@ public abstract class DisplayImpl extends Display { } try { Thread.sleep( coopSleep < 50 ? coopSleep : 50 ); - } catch (InterruptedException e) { } + } catch (final InterruptedException e) { } } else { closeNativeTask.run(); } @@ -527,7 +527,7 @@ public abstract class DisplayImpl extends Display { @Override public synchronized final int addReference() { if(DEBUG) { - System.err.println("Display.addReference() ("+DisplayImpl.getThreadName()+"): "+refCount+" -> "+(refCount+1)); + System.err.println("Display.addReference() ("+Display.getThreadName()+"): "+refCount+" -> "+(refCount+1)); } if ( 0 == refCount ) { createNative(); @@ -542,7 +542,7 @@ public abstract class DisplayImpl extends Display { @Override public synchronized final int removeReference() { if(DEBUG) { - System.err.println("Display.removeReference() ("+DisplayImpl.getThreadName()+"): "+refCount+" -> "+(refCount-1)); + System.err.println("Display.removeReference() ("+Display.getThreadName()+"): "+refCount+" -> "+(refCount-1)); } refCount--; // could become < 0, in case of manual destruction without actual creation/addReference if(0>=refCount) { @@ -587,17 +587,17 @@ public abstract class DisplayImpl extends Display { public static final String nilString = "nil" ; - public String validateDisplayName(String name, long handle) { + public String validateDisplayName(String name, final long handle) { if(null==name && 0!=handle) { name="wrapping-"+toHexString(handle); } return ( null == name ) ? nilString : name ; } - private static String getFQName(String type, String name, int id) { + private static String getFQName(String type, String name, final int id) { if(null==type) type=nilString; if(null==name) name=nilString; - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(type); sb.append("_"); sb.append(name); @@ -668,7 +668,7 @@ public abstract class DisplayImpl extends Display { } else { throw new RuntimeException("Event source not NEWT: "+source.getClass().getName()+", "+source); } - } catch (Throwable t) { + } catch (final Throwable t) { final RuntimeException re; if(t instanceof RuntimeException) { re = (RuntimeException) t; @@ -689,7 +689,7 @@ public abstract class DisplayImpl extends Display { return; } dispatchMessage(event); - } catch (RuntimeException re) { + } catch (final RuntimeException re) { if( eventTask.isCallerWaiting() ) { // propagate exception to caller eventTask.setException(re); @@ -733,7 +733,7 @@ public abstract class DisplayImpl extends Display { dispatchMessagesNative(); } - public void enqueueEvent(boolean wait, NEWTEvent e) { + public void enqueueEvent(final boolean wait, final NEWTEvent e) { final EDTUtil _edtUtil = edtUtil; if( !_edtUtil.isRunning() ) { // oops .. we are already dead @@ -761,7 +761,7 @@ public abstract class DisplayImpl extends Display { if( wait ) { try { lock.wait(); - } catch (InterruptedException ie) { + } catch (final InterruptedException ie) { throw new RuntimeException(ie); } if( null != eTask.getException() ) { @@ -774,7 +774,7 @@ public abstract class DisplayImpl extends Display { public interface DisplayRunnable<T> { T run(long dpy); } - public static final <T> T runWithLockedDevice(AbstractGraphicsDevice device, DisplayRunnable<T> action) { + public static final <T> T runWithLockedDevice(final AbstractGraphicsDevice device, final DisplayRunnable<T> action) { T res; device.lock(); try { @@ -784,7 +784,7 @@ public abstract class DisplayImpl extends Display { } return res; } - public final <T> T runWithLockedDisplayDevice(DisplayRunnable<T> action) { + public final <T> T runWithLockedDisplayDevice(final DisplayRunnable<T> action) { final AbstractGraphicsDevice device = getGraphicsDevice(); if(null == device) { throw new RuntimeException("null device - not initialized: "+this); diff --git a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java index e9e41a0ef..72300740f 100644 --- a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java +++ b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java @@ -38,7 +38,7 @@ import com.jogamp.newt.Screen; public class MonitorDeviceImpl extends MonitorDevice { - public MonitorDeviceImpl(ScreenImpl screen, int nativeId, DimensionImmutable sizeMM, Rectangle viewportPU, Rectangle viewportWU, MonitorMode currentMode, ArrayHashSet<MonitorMode> supportedModes) { + public MonitorDeviceImpl(final ScreenImpl screen, final int nativeId, final DimensionImmutable sizeMM, final Rectangle viewportPU, final Rectangle viewportWU, final MonitorMode currentMode, final ArrayHashSet<MonitorMode> supportedModes) { super(screen, nativeId, sizeMM, viewportPU, viewportWU, currentMode, supportedModes); } @@ -73,7 +73,7 @@ public class MonitorDeviceImpl extends MonitorDevice { } @Override - public final boolean setCurrentMode(MonitorMode mode) { + public final boolean setCurrentMode(final MonitorMode mode) { if(Screen.DEBUG) { System.err.println("Screen.setCurrentMode.0: "+this+" -> "+mode); } @@ -132,7 +132,7 @@ public class MonitorDeviceImpl extends MonitorDevice { } } - private final void setCurrentModeValue(MonitorMode currentMode) { + private final void setCurrentModeValue(final MonitorMode currentMode) { this.currentMode = currentMode; } diff --git a/src/newt/classes/jogamp/newt/MonitorModeProps.java b/src/newt/classes/jogamp/newt/MonitorModeProps.java index 74935977c..0fc0da9bc 100644 --- a/src/newt/classes/jogamp/newt/MonitorModeProps.java +++ b/src/newt/classes/jogamp/newt/MonitorModeProps.java @@ -157,26 +157,26 @@ public class MonitorModeProps { } /** WARNING: must be synchronized with ScreenMode.h, native implementation */ - private static DimensionImmutable streamInResolution(int[] resolutionProperties, int offset) { - Dimension resolution = new Dimension(resolutionProperties[offset++], resolutionProperties[offset++]); + private static DimensionImmutable streamInResolution(final int[] resolutionProperties, int offset) { + final Dimension resolution = new Dimension(resolutionProperties[offset++], resolutionProperties[offset++]); return resolution; } /** WARNING: must be synchronized with ScreenMode.h, native implementation */ - private static SurfaceSize streamInSurfaceSize(DimensionImmutable resolution, int[] sizeProperties, int offset) { - SurfaceSize surfaceSize = new SurfaceSize(resolution, sizeProperties[offset++]); + private static SurfaceSize streamInSurfaceSize(final DimensionImmutable resolution, final int[] sizeProperties, int offset) { + final SurfaceSize surfaceSize = new SurfaceSize(resolution, sizeProperties[offset++]); return surfaceSize; } /** WARNING: must be synchronized with ScreenMode.h, native implementation */ - private static MonitorMode.SizeAndRRate streamInSizeAndRRate(SurfaceSize surfaceSize, int[] sizeAndRRateProperties, int offset) { + private static MonitorMode.SizeAndRRate streamInSizeAndRRate(final SurfaceSize surfaceSize, final int[] sizeAndRRateProperties, int offset) { final float refreshRate = sizeAndRRateProperties[offset++]/100.0f; final int flags = sizeAndRRateProperties[offset++]; return new MonitorMode.SizeAndRRate(surfaceSize, refreshRate, flags); } /** WARNING: must be synchronized with ScreenMode.h, native implementation */ - private static MonitorMode streamInMonitorMode0(MonitorMode.SizeAndRRate sizeAndRate, int[] modeProperties, int offset) { + private static MonitorMode streamInMonitorMode0(final MonitorMode.SizeAndRRate sizeAndRate, final int[] modeProperties, int offset) { final int id = modeProperties[offset++]; final int rotation = modeProperties[offset++]; return new MonitorMode(id, sizeAndRate, rotation); @@ -192,8 +192,8 @@ public class MonitorModeProps { * @return {@link MonitorMode} of the identical (old or new) element in {@link Cache#monitorModes}, * matching the input <code>modeProperties</code>, or null if input could not be processed. */ - public static MonitorMode streamInMonitorMode(int[] mode_idx, Cache cache, - int[] modeProperties, int offset) { + public static MonitorMode streamInMonitorMode(final int[] mode_idx, final Cache cache, + final int[] modeProperties, int offset) { final int count = modeProperties[offset]; if(NUM_MONITOR_MODE_PROPERTIES_ALL != count) { throw new RuntimeException("property count should be "+NUM_MONITOR_MODE_PROPERTIES_ALL+", but is "+count+", len "+(modeProperties.length-offset)); @@ -225,7 +225,7 @@ public class MonitorModeProps { monitorMode = cache.monitorModes.getOrAdd(monitorMode); } if( null != mode_idx && null!=cache) { - int _modeIdx = cache.monitorModes.indexOf(monitorMode); + final int _modeIdx = cache.monitorModes.indexOf(monitorMode); if( 0 > _modeIdx ) { throw new InternalError("Invalid index of current unified mode "+monitorMode); } @@ -235,8 +235,8 @@ public class MonitorModeProps { } /** WARNING: must be synchronized with ScreenMode.h, native implementation */ - public static int[] streamOutMonitorMode (MonitorMode monitorMode) { - int[] data = new int[NUM_MONITOR_MODE_PROPERTIES_ALL]; + public static int[] streamOutMonitorMode (final MonitorMode monitorMode) { + final int[] data = new int[NUM_MONITOR_MODE_PROPERTIES_ALL]; int idx=0; data[idx++] = NUM_MONITOR_MODE_PROPERTIES_ALL; data[idx++] = monitorMode.getSurfaceSize().getResolution().getWidth(); @@ -264,7 +264,7 @@ public class MonitorModeProps { * @return {@link MonitorDevice} of the identical (old or new) element in {@link Cache#monitorDevices}, * matching the input <code>modeProperties</code>, or null if input could not be processed. */ - public static MonitorDevice streamInMonitorDevice(int[] monitor_idx, Cache cache, ScreenImpl screen, int[] monitorProperties, int offset) { + public static MonitorDevice streamInMonitorDevice(final int[] monitor_idx, final Cache cache, final ScreenImpl screen, final int[] monitorProperties, int offset) { // min 11: count, id, ScreenSizeMM[width, height], Viewport[x, y, width, height], currentMonitorModeId, rotation, supportedModeId+ final int count = monitorProperties[offset]; if(MIN_MONITOR_DEVICE_PROPERTIES > count) { @@ -304,7 +304,7 @@ public class MonitorModeProps { monitorDevice = cache.monitorDevices.getOrAdd(monitorDevice); } if( null != monitor_idx ) { - int _monitorIdx = cache.monitorDevices.indexOf(monitorDevice); + final int _monitorIdx = cache.monitorDevices.indexOf(monitorDevice); if( 0 > _monitorIdx ) { throw new InternalError("Invalid index of current unified mode "+monitorDevice); } @@ -312,7 +312,7 @@ public class MonitorModeProps { } return monitorDevice; } - private static MonitorMode getByNativeIdAndRotation(List<MonitorMode> monitorModes, int modeId, int rotation) { + private static MonitorMode getByNativeIdAndRotation(final List<MonitorMode> monitorModes, final int modeId, final int rotation) { if( null!=monitorModes && monitorModes.size()>0 ) { for (int i=0; i<monitorModes.size(); i++) { final MonitorMode mode = monitorModes.get(i); @@ -340,7 +340,7 @@ public class MonitorModeProps { * @return {@link MonitorDevice} of the identical (old or new) element in {@link Cache#monitorDevices}, * matching the input <code>modeProperties</code>, or null if input could not be processed. */ - public static MonitorDevice streamInMonitorDevice(int[] monitor_idx, Cache cache, ScreenImpl screen, ArrayHashSet<MonitorMode> supportedModes, MonitorMode currentMode, int[] monitorProperties, int offset) { + public static MonitorDevice streamInMonitorDevice(final int[] monitor_idx, final Cache cache, final ScreenImpl screen, final ArrayHashSet<MonitorMode> supportedModes, final MonitorMode currentMode, final int[] monitorProperties, int offset) { // min 11: count, id, ScreenSizeMM[width, height], Viewport[x, y, width, height], currentMonitorModeId, rotation, supportedModeId+ final int count = monitorProperties[offset]; if(MIN_MONITOR_DEVICE_PROPERTIES - 1 - NUM_MONITOR_MODE_PROPERTIES != count) { @@ -362,7 +362,7 @@ public class MonitorModeProps { monitorDevice = cache.monitorDevices.getOrAdd(monitorDevice); } if( null != monitor_idx ) { - int _monitorIdx = cache.monitorDevices.indexOf(monitorDevice); + final int _monitorIdx = cache.monitorDevices.indexOf(monitorDevice); if( 0 > _monitorIdx ) { throw new InternalError("Invalid index of current unified mode "+monitorDevice); } @@ -372,13 +372,13 @@ public class MonitorModeProps { } /** WARNING: must be synchronized with ScreenMode.h, native implementation */ - public static int[] streamOutMonitorDevice (MonitorDevice monitorDevice) { + public static int[] streamOutMonitorDevice (final MonitorDevice monitorDevice) { // min 11: count, id, ScreenSizeMM[width, height], Viewport[x, y, width, height], currentMonitorModeId, rotation, supportedModeId+ - int supportedModeCount = monitorDevice.getSupportedModes().size(); + final int supportedModeCount = monitorDevice.getSupportedModes().size(); if( 0 == supportedModeCount ) { throw new RuntimeException("no supported modes: "+monitorDevice); } - int[] data = new int[MIN_MONITOR_DEVICE_PROPERTIES + supportedModeCount - 1]; + final int[] data = new int[MIN_MONITOR_DEVICE_PROPERTIES + supportedModeCount - 1]; int idx=0; data[idx++] = data.length; data[idx++] = monitorDevice.getId(); @@ -404,7 +404,7 @@ public class MonitorModeProps { return data; } - public final void swapRotatePair(int rotation, int[] pairs, int offset, int numPairs) { + public final void swapRotatePair(final int rotation, final int[] pairs, int offset, final int numPairs) { if( MonitorMode.ROTATE_0 == rotation || MonitorMode.ROTATE_180 == rotation ) { // nop return; diff --git a/src/newt/classes/jogamp/newt/OffscreenWindow.java b/src/newt/classes/jogamp/newt/OffscreenWindow.java index 2478b1e5d..749391f1f 100644 --- a/src/newt/classes/jogamp/newt/OffscreenWindow.java +++ b/src/newt/classes/jogamp/newt/OffscreenWindow.java @@ -88,7 +88,7 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface { } @Override - public void setSurfaceHandle(long handle) { + public void setSurfaceHandle(final long handle) { surfaceHandle = handle ; } @@ -98,27 +98,27 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface { } @Override - protected void requestFocusImpl(boolean reparented) { + protected void requestFocusImpl(final boolean reparented) { } @Override - public void setPosition(int x, int y) { + public void setPosition(final int x, final int y) { // nop } @Override - public boolean setFullscreen(boolean fullscreen) { + public boolean setFullscreen(final boolean fullscreen) { return false; // nop } @Override - public boolean setFullscreen(List<MonitorDevice> monitors) { + public boolean setFullscreen(final List<MonitorDevice> monitors) { return false; // nop } @Override - protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) { + protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, final int flags) { sizeChanged(false, width, height, false); if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) { visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags)); @@ -135,7 +135,7 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface { } @Override - public Point getLocationOnScreen(Point storage) { + public Point getLocationOnScreen(final Point storage) { if(null!=storage) { storage.set(0, 0); return storage; @@ -144,12 +144,12 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface { } @Override - protected Point getLocationOnScreenImpl(int x, int y) { + protected Point getLocationOnScreenImpl(final int x, final int y) { return new Point(x,y); } @Override - protected void updateInsetsImpl(Insets insets) { + protected void updateInsetsImpl(final Insets insets) { // nop .. } } diff --git a/src/newt/classes/jogamp/newt/PointerIconImpl.java b/src/newt/classes/jogamp/newt/PointerIconImpl.java index 840799d55..546a463de 100644 --- a/src/newt/classes/jogamp/newt/PointerIconImpl.java +++ b/src/newt/classes/jogamp/newt/PointerIconImpl.java @@ -95,7 +95,7 @@ public class PointerIconImpl implements PointerIcon { try { handle = display.createPointerIconImpl(pixelformat, size.getWidth(), size.getHeight(), pixels, hotspot.getX(), hotspot.getY()); return handle; - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); return 0; } @@ -121,8 +121,8 @@ public class PointerIconImpl implements PointerIcon { @Override public synchronized void destroy() { - if(DisplayImpl.DEBUG) { - System.err.println("PointerIcon.destroy: "+this+", "+display+", "+DisplayImpl.getThreadName()); + if(Display.DEBUG) { + System.err.println("PointerIcon.destroy: "+this+", "+display+", "+Display.getThreadName()); } if( 0 != handle ) { synchronized(display.pointerIconList) { @@ -143,7 +143,7 @@ public class PointerIconImpl implements PointerIcon { handle = 0; try { display.destroyPointerIconImpl(dpy, h); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java index a31a1e421..e73e153ad 100644 --- a/src/newt/classes/jogamp/newt/ScreenImpl.java +++ b/src/newt/classes/jogamp/newt/ScreenImpl.java @@ -45,6 +45,7 @@ import javax.media.nativewindow.util.Rectangle; import javax.media.nativewindow.util.RectangleImmutable; import com.jogamp.common.util.ArrayHashSet; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.newt.Display; import com.jogamp.newt.MonitorDevice; import com.jogamp.newt.MonitorMode; @@ -59,7 +60,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { static { Debug.initSingleton(); - DEBUG_TEST_SCREENMODE_DISABLED = Debug.isPropertyDefined("newt.test.Screen.disableScreenMode", true); + DEBUG_TEST_SCREENMODE_DISABLED = PropertyAccess.isPropertyDefined("newt.test.Screen.disableScreenMode", true); } public static final int default_sm_bpp = 32; @@ -89,7 +90,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { private long tCreated; // creationTime - private static Class<?> getScreenClass(String type) throws ClassNotFoundException + private static Class<?> getScreenClass(final String type) throws ClassNotFoundException { final Class<?> screenClass = NewtFactory.getCustomClass(type, "ScreenDriver"); if(null==screenClass) { @@ -98,14 +99,14 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { return screenClass; } - public static Screen create(Display display, int idx) { + public static Screen create(final Display display, int idx) { try { if(!usrSizeQueried) { synchronized (Screen.class) { if(!usrSizeQueried) { usrSizeQueried = true; - final int w = Debug.getIntProperty("newt.ws.swidth", true, 0); - final int h = Debug.getIntProperty("newt.ws.sheight", true, 0); + final int w = PropertyAccess.getIntProperty("newt.ws.swidth", true, 0); + final int h = PropertyAccess.getIntProperty("newt.ws.sheight", true, 0); if(w>0 && h>0) { usrSize = new Dimension(w, h); System.err.println("User screen size "+usrSize); @@ -114,12 +115,12 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { } } synchronized(screenList) { - Class<?> screenClass = getScreenClass(display.getType()); + final Class<?> screenClass = getScreenClass(display.getType()); ScreenImpl screen = (ScreenImpl) screenClass.newInstance(); screen.display = (DisplayImpl) display; idx = screen.validateScreenIndex(idx); { - Screen screen0 = ScreenImpl.getLastScreenOf(display, idx, -1); + final Screen screen0 = Screen.getLastScreenOf(display, idx, -1); if(null != screen0) { if(DEBUG) { System.err.println("Screen.create() REUSE: "+screen0+" "+Display.getThreadName()); @@ -138,7 +139,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { } return screen; } - } catch (Exception e) { + } catch (final Exception e) { throw new RuntimeException(e); } } @@ -152,7 +153,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (obj == null) { return false; } @@ -181,7 +182,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { if(null == aScreen) { if(DEBUG) { tCreated = System.nanoTime(); - System.err.println("Screen.createNative() START ("+DisplayImpl.getThreadName()+", "+this+")"); + System.err.println("Screen.createNative() START ("+Display.getThreadName()+", "+this+")"); } else { tCreated = 0; } @@ -196,7 +197,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { synchronized(screenList) { screensActive++; if(DEBUG) { - System.err.println("Screen.createNative() END ("+DisplayImpl.getThreadName()+", "+this+"), active "+screensActive+", total "+ (System.nanoTime()-tCreated)/1e6 +"ms"); + System.err.println("Screen.createNative() END ("+Display.getThreadName()+", "+this+"), active "+screensActive+", total "+ (System.nanoTime()-tCreated)/1e6 +"ms"); } } ScreenMonitorState.getScreenMonitorState(this.getFQName()).addListener(this); @@ -210,7 +211,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { screensActive--; } if(DEBUG) { - System.err.println("Screen.destroy() ("+DisplayImpl.getThreadName()+"): active "+screensActive); + System.err.println("Screen.destroy() ("+Display.getThreadName()+"): active "+screensActive); // Thread.dumpStack(); } } @@ -227,7 +228,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { @Override public synchronized final int addReference() throws NativeWindowException { if(DEBUG) { - System.err.println("Screen.addReference() ("+DisplayImpl.getThreadName()+"): "+refCount+" -> "+(refCount+1)); + System.err.println("Screen.addReference() ("+Display.getThreadName()+"): "+refCount+" -> "+(refCount+1)); // Thread.dumpStack(); } if ( 0 == refCount ) { @@ -241,7 +242,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { @Override public synchronized final int removeReference() { if(DEBUG) { - System.err.println("Screen.removeReference() ("+DisplayImpl.getThreadName()+"): "+refCount+" -> "+(refCount-1)); + System.err.println("Screen.removeReference() ("+Display.getThreadName()+"): "+refCount+" -> "+(refCount-1)); // Thread.dumpStack(); } refCount--; // could become < 0, in case of manual destruction without actual creation/addReference @@ -404,7 +405,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { return null != sms ? sms.getMonitorDevices().getData() : null; } - final ScreenMonitorState getScreenMonitorStatus(boolean throwException) { + final ScreenMonitorState getScreenMonitorStatus(final boolean throwException) { final String key = this.getFQName(); final ScreenMonitorState res = ScreenMonitorState.getScreenMonitorState(key); if(null == res & throwException) { @@ -414,7 +415,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { } @Override - public void monitorModeChangeNotify(MonitorEvent me) { + public void monitorModeChangeNotify(final MonitorEvent me) { if(DEBUG) { System.err.println("monitorModeChangeNotify @ "+Thread.currentThread().getName()+": "+me); } @@ -435,7 +436,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { } @Override - public void monitorModeChanged(MonitorEvent me, boolean success) { + public void monitorModeChanged(final MonitorEvent me, final boolean success) { if(success) { updateNativeMonitorDevicesViewport(); updateVirtualScreenOriginAndSize(); @@ -449,12 +450,12 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { } @Override - public synchronized final void addMonitorModeListener(MonitorModeListener sml) { + public synchronized final void addMonitorModeListener(final MonitorModeListener sml) { refMonitorModeListener.add(sml); } @Override - public synchronized final void removeMonitorModeListener(MonitorModeListener sml) { + public synchronized final void removeMonitorModeListener(final MonitorModeListener sml) { refMonitorModeListener.remove(sml); } @@ -464,7 +465,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { * @param modeId * @return */ - private final MonitorMode getVirtualMonitorMode(MonitorModeProps.Cache cache, int modeId) { + private final MonitorMode getVirtualMonitorMode(final MonitorModeProps.Cache cache, final int modeId) { final int[] props = new int[MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL]; int i = 0; props[i++] = MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL; @@ -488,7 +489,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { * @param currentMode * @return */ - private final MonitorDevice getVirtualMonitorDevice(MonitorModeProps.Cache cache, int monitorId, MonitorMode currentMode) { + private final MonitorDevice getVirtualMonitorDevice(final MonitorModeProps.Cache cache, final int monitorId, final MonitorMode currentMode) { final int[] props = new int[MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES]; int i = 0; props[i++] = MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES; @@ -516,7 +517,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { * Utilizes {@link #getCurrentMonitorModeImpl()}, if the latter returns null it uses * the current screen size and dummy values. */ - protected final MonitorMode queryCurrentMonitorModeIntern(MonitorDevice monitor) { + protected final MonitorMode queryCurrentMonitorModeIntern(final MonitorDevice monitor) { MonitorMode res; if(DEBUG_TEST_SCREENMODE_DISABLED) { res = null; @@ -536,7 +537,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { long t0; if(DEBUG) { t0 = System.nanoTime(); - System.err.println("Screen.initMonitorState() START ("+DisplayImpl.getThreadName()+", "+this+")"); + System.err.println("Screen.initMonitorState() START ("+Display.getThreadName()+", "+this+")"); } else { t0 = 0; } @@ -558,20 +559,20 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { } // Sort MonitorModes (all and per device) in descending order - default! MonitorModeUtil.sort(cache.monitorModes.getData(), false ); // descending order - for(Iterator<MonitorDevice> iMonitor=cache.monitorDevices.iterator(); iMonitor.hasNext(); ) { + for(final Iterator<MonitorDevice> iMonitor=cache.monitorDevices.iterator(); iMonitor.hasNext(); ) { MonitorModeUtil.sort(iMonitor.next().getSupportedModes(), false ); // descending order } if(DEBUG) { int i=0; - for(Iterator<MonitorMode> iMode=cache.monitorModes.iterator(); iMode.hasNext(); i++) { + for(final Iterator<MonitorMode> iMode=cache.monitorModes.iterator(); iMode.hasNext(); i++) { System.err.println("All["+i+"]: "+iMode.next()); } i=0; - for(Iterator<MonitorDevice> iMonitor=cache.monitorDevices.iterator(); iMonitor.hasNext(); i++) { + for(final Iterator<MonitorDevice> iMonitor=cache.monitorDevices.iterator(); iMonitor.hasNext(); i++) { final MonitorDevice crt = iMonitor.next(); System.err.println("["+i+"]: "+crt); int j=0; - for(Iterator<MonitorMode> iMode=crt.getSupportedModes().iterator(); iMode.hasNext(); j++) { + for(final Iterator<MonitorMode> iMode=crt.getSupportedModes().iterator(); iMode.hasNext(); j++) { System.err.println("["+i+"]["+j+"]: "+iMode.next()); } } @@ -598,7 +599,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { * Collects {@link MonitorDevice}s and {@link MonitorMode}s within the given cache. * </p> */ - private final int collectNativeMonitorModes(MonitorModeProps.Cache cache) { + private final int collectNativeMonitorModes(final MonitorModeProps.Cache cache) { if(!DEBUG_TEST_SCREENMODE_DISABLED) { collectNativeMonitorModesAndDevicesImpl(cache); } @@ -646,7 +647,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { System.err.println("Screen.destroy(): Reset "+monitor); try { monitor.setCurrentMode(monitor.getOriginalMode()); - } catch (Throwable t) { + } catch (final Throwable t) { // be verbose but continue t.printStackTrace(); } @@ -664,7 +665,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { } private final void shutdown() { - ScreenMonitorState sms = ScreenMonitorState.getScreenMonitorStateUnlocked(getFQName()); + final ScreenMonitorState sms = ScreenMonitorState.getScreenMonitorStateUnlocked(getFQName()); if(null != sms) { final ArrayList<MonitorDevice> monitorDevices = sms.getMonitorDevices().getData(); for(int i=0; i<monitorDevices.size(); i++) { @@ -673,7 +674,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { System.err.println("Screen.shutdown(): Reset "+monitor); try { monitor.setCurrentMode(monitor.getOriginalMode()); - } catch (Throwable t) { + } catch (final Throwable t) { // be quiet .. shutdown } } diff --git a/src/newt/classes/jogamp/newt/ScreenMonitorState.java b/src/newt/classes/jogamp/newt/ScreenMonitorState.java index 01e6cfee9..ae982414b 100644 --- a/src/newt/classes/jogamp/newt/ScreenMonitorState.java +++ b/src/newt/classes/jogamp/newt/ScreenMonitorState.java @@ -46,15 +46,15 @@ public class ScreenMonitorState { private final RecursiveLock lock = LockFactory.createRecursiveLock(); private final ArrayHashSet<MonitorDevice> allMonitors; private final ArrayHashSet<MonitorMode> allMonitorModes; - private ArrayList<MonitorModeListener> listener = new ArrayList<MonitorModeListener>(); + private final ArrayList<MonitorModeListener> listener = new ArrayList<MonitorModeListener>(); private static HashMap<String, ScreenMonitorState> screenFQN2ScreenMonitorState = new HashMap<String, ScreenMonitorState>(); private static RecursiveLock screen2ScreenMonitorState = LockFactory.createRecursiveLock(); - protected static void mapScreenMonitorState(String screenFQN, ScreenMonitorState sms) { + protected static void mapScreenMonitorState(final String screenFQN, final ScreenMonitorState sms) { screen2ScreenMonitorState.lock(); try { - ScreenMonitorState _sms = screenFQN2ScreenMonitorState.get(screenFQN); + final ScreenMonitorState _sms = screenFQN2ScreenMonitorState.get(screenFQN); if( null != _sms ) { throw new RuntimeException("ScreenMonitorState "+_sms+" already mapped to "+screenFQN); } @@ -71,7 +71,7 @@ public class ScreenMonitorState { * @param screen the prev user * @return true if mapping is empty, ie no more usage of the mapped ScreenMonitorState */ - protected static void unmapScreenMonitorState(String screenFQN) { + protected static void unmapScreenMonitorState(final String screenFQN) { screen2ScreenMonitorState.lock(); try { unmapScreenMonitorStateUnlocked(screenFQN); @@ -79,14 +79,14 @@ public class ScreenMonitorState { screen2ScreenMonitorState.unlock(); } } - protected static void unmapScreenMonitorStateUnlocked(String screenFQN) { - ScreenMonitorState sms = screenFQN2ScreenMonitorState.remove(screenFQN); + protected static void unmapScreenMonitorStateUnlocked(final String screenFQN) { + final ScreenMonitorState sms = screenFQN2ScreenMonitorState.remove(screenFQN); if(DEBUG) { System.err.println("ScreenMonitorState.unmap "+screenFQN+" -> "+sms); } } - protected static ScreenMonitorState getScreenMonitorState(String screenFQN) { + protected static ScreenMonitorState getScreenMonitorState(final String screenFQN) { screen2ScreenMonitorState.lock(); try { return getScreenMonitorStateUnlocked(screenFQN); @@ -94,7 +94,7 @@ public class ScreenMonitorState { screen2ScreenMonitorState.unlock(); } } - protected static ScreenMonitorState getScreenMonitorStateUnlocked(String screenFQN) { + protected static ScreenMonitorState getScreenMonitorStateUnlocked(final String screenFQN) { return screenFQN2ScreenMonitorState.get(screenFQN); } @@ -106,8 +106,8 @@ public class ScreenMonitorState { screen2ScreenMonitorState.unlock(); } - public ScreenMonitorState(ArrayHashSet<MonitorDevice> allMonitors, - ArrayHashSet<MonitorMode> allMonitorModes) { + public ScreenMonitorState(final ArrayHashSet<MonitorDevice> allMonitors, + final ArrayHashSet<MonitorMode> allMonitorModes) { this.allMonitors = allMonitors; this.allMonitorModes = allMonitorModes; } @@ -120,7 +120,7 @@ public class ScreenMonitorState { return allMonitorModes; } - protected final int addListener(MonitorModeListener l) { + protected final int addListener(final MonitorModeListener l) { lock(); try { listener.add(l); @@ -133,7 +133,7 @@ public class ScreenMonitorState { } } - protected final int removeListener(MonitorModeListener l) { + protected final int removeListener(final MonitorModeListener l) { lock(); try { if(!listener.remove(l)) { @@ -148,18 +148,18 @@ public class ScreenMonitorState { } } - protected final MonitorDevice getMonitor(MonitorDevice monitor) { + protected final MonitorDevice getMonitor(final MonitorDevice monitor) { return allMonitors.get(monitor); } - protected final void validateMonitor(MonitorDevice monitor) { + protected final void validateMonitor(final MonitorDevice monitor) { final MonitorDevice md = allMonitors.get(monitor); if( null == md ) { throw new InternalError("Monitor unknown: "+monitor); } } - protected final void fireMonitorModeChangeNotify(MonitorDevice monitor, MonitorMode desiredMode) { + protected final void fireMonitorModeChangeNotify(final MonitorDevice monitor, final MonitorMode desiredMode) { lock(); try { validateMonitor(monitor); @@ -172,7 +172,7 @@ public class ScreenMonitorState { } } - protected void fireMonitorModeChanged(MonitorDevice monitor, MonitorMode currentMode, boolean success) { + protected void fireMonitorModeChanged(final MonitorDevice monitor, final MonitorMode currentMode, final boolean success) { lock(); try { validateMonitor(monitor); diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 61fa7af6b..29a0b1e21 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -65,6 +65,7 @@ import jogamp.nativewindow.SurfaceUpdatedHelper; import com.jogamp.common.util.ArrayHashSet; import com.jogamp.common.util.IntBitfield; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; import com.jogamp.common.util.locks.LockFactory; import com.jogamp.common.util.locks.RecursiveLock; @@ -96,7 +97,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer static { Debug.initSingleton(); - DEBUG_TEST_REPARENT_INCOMPATIBLE = Debug.isPropertyDefined("newt.test.Window.reparent.incompatible", true); + DEBUG_TEST_REPARENT_INCOMPATIBLE = PropertyAccess.isPropertyDefined("newt.test.Window.reparent.incompatible", true); ScreenImpl.initSingleton(); } @@ -120,7 +121,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } } - private static void addWindow2List(WindowImpl window) { + private static void addWindow2List(final WindowImpl window) { synchronized(windowList) { // GC before add int i=0, gced=0; @@ -242,7 +243,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer final Point[] movePositions = new Point[] { new Point(), new Point(), new Point(), new Point(), new Point(), new Point(), new Point(), new Point() }; - final Point getMovePosition(int id) { + final Point getMovePosition(final int id) { if( 0 <= id && id < movePositions.length ) { return movePositions[id]; } @@ -271,7 +272,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // Construction Methods // - private static Class<?> getWindowClass(String type) + private static Class<?> getWindowClass(final String type) throws ClassNotFoundException { final Class<?> windowClass = NewtFactory.getCustomClass(type, "WindowDriver"); @@ -281,7 +282,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return windowClass; } - public static WindowImpl create(NativeWindow parentWindow, long parentWindowHandle, Screen screen, CapabilitiesImmutable caps) { + public static WindowImpl create(final NativeWindow parentWindow, final long parentWindowHandle, final Screen screen, final CapabilitiesImmutable caps) { try { Class<?> windowClass; if(caps.isOnscreen()) { @@ -289,7 +290,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } else { windowClass = OffscreenWindow.class; } - WindowImpl window = (WindowImpl) windowClass.newInstance(); + final WindowImpl window = (WindowImpl) windowClass.newInstance(); window.parentWindow = parentWindow; window.parentWindowHandle = parentWindowHandle; window.screen = (ScreenImpl) screen; @@ -297,30 +298,30 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer window.instantiationFinished(); addWindow2List(window); return window; - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); throw new NativeWindowException(t); } } - public static WindowImpl create(Object[] cstrArguments, Screen screen, CapabilitiesImmutable caps) { + public static WindowImpl create(final Object[] cstrArguments, final Screen screen, final CapabilitiesImmutable caps) { try { - Class<?> windowClass = getWindowClass(screen.getDisplay().getType()); - Class<?>[] cstrArgumentTypes = getCustomConstructorArgumentTypes(windowClass); + final Class<?> windowClass = getWindowClass(screen.getDisplay().getType()); + final Class<?>[] cstrArgumentTypes = getCustomConstructorArgumentTypes(windowClass); if(null==cstrArgumentTypes) { throw new NativeWindowException("WindowClass "+windowClass+" doesn't support custom arguments in constructor"); } - int argsChecked = verifyConstructorArgumentTypes(cstrArgumentTypes, cstrArguments); + final int argsChecked = verifyConstructorArgumentTypes(cstrArgumentTypes, cstrArguments); if ( argsChecked < cstrArguments.length ) { throw new NativeWindowException("WindowClass "+windowClass+" constructor mismatch at argument #"+argsChecked+"; Constructor: "+getTypeStrList(cstrArgumentTypes)+", arguments: "+getArgsStrList(cstrArguments)); } - WindowImpl window = (WindowImpl) ReflectionUtil.createInstance( windowClass, cstrArgumentTypes, cstrArguments ) ; + final WindowImpl window = (WindowImpl) ReflectionUtil.createInstance( windowClass, cstrArgumentTypes, cstrArguments ) ; window.screen = (ScreenImpl) screen; window.capsRequested = (CapabilitiesImmutable) caps.cloneMutable(); window.instantiationFinished(); addWindow2List(window); return window; - } catch (Throwable t) { + } catch (final Throwable t) { throw new NativeWindowException(t); } } @@ -339,7 +340,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer parentWindowHandle = 0; } - protected final void setGraphicsConfiguration(AbstractGraphicsConfiguration cfg) { + protected final void setGraphicsConfiguration(final AbstractGraphicsConfiguration cfg) { config = cfg; } @@ -507,7 +508,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return true; } - private static long getNativeWindowHandle(NativeWindow nativeWindow) { + private static long getNativeWindowHandle(final NativeWindow nativeWindow) { long handle = 0; if(null!=nativeWindow) { boolean wasLocked = false; @@ -518,7 +519,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(0==handle) { throw new NativeWindowException("Parent native window handle is NULL, after succesful locking: "+nativeWindow); } - } catch (NativeWindowException nwe) { + } catch (final NativeWindowException nwe) { if(DEBUG_IMPLEMENTATION) { System.err.println("Window.getNativeWindowHandle: not successful yet: "+nwe); } @@ -556,9 +557,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public final WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) { + public final WindowClosingMode setDefaultCloseOperation(final WindowClosingMode op) { synchronized (closingListenerLock) { - WindowClosingMode _op = defaultCloseOperation; + final WindowClosingMode _op = defaultCloseOperation; defaultCloseOperation = op; return _op; } @@ -656,18 +657,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * Default is all but {@link #FLAG_IS_FULLSCREEN_SPAN} * </p> */ - protected boolean isReconfigureFlagSupported(int changeFlags) { + protected boolean isReconfigureFlagSupported(final int changeFlags) { return 0 == ( changeFlags & FLAG_IS_FULLSCREEN_SPAN ); } - protected int getReconfigureFlags(int changeFlags, boolean visible) { + protected int getReconfigureFlags(int changeFlags, final boolean visible) { return changeFlags |= ( ( 0 != getParentWindowHandle() ) ? FLAG_HAS_PARENT : 0 ) | ( isUndecorated() ? FLAG_IS_UNDECORATED : 0 ) | ( isFullscreen() ? FLAG_IS_FULLSCREEN : 0 ) | ( isAlwaysOnTop() ? FLAG_IS_ALWAYSONTOP : 0 ) | ( visible ? FLAG_IS_VISIBLE : 0 ) ; } - protected static String getReconfigureFlagsAsString(StringBuilder sb, int flags) { + protected static String getReconfigureFlagsAsString(StringBuilder sb, final int flags) { if(null == sb) { sb = new StringBuilder(); } sb.append("["); @@ -711,7 +712,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return sb.toString(); } - protected void setTitleImpl(String title) {} + protected void setTitleImpl(final String title) {} /** * Translates the given window client-area coordinates with top-left origin @@ -738,9 +739,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer */ protected abstract void updateInsetsImpl(Insets insets); - protected boolean setPointerVisibleImpl(boolean pointerVisible) { return false; } - protected boolean confinePointerImpl(boolean confine) { return false; } - protected void warpPointerImpl(int x, int y) { } + protected boolean setPointerVisibleImpl(final boolean pointerVisible) { return false; } + protected boolean confinePointerImpl(final boolean confine) { return false; } + protected void warpPointerImpl(final int x, final int y) { } protected void setPointerIconImpl(final PointerIconImpl pi) { } //---------------------------------------------------------------------- @@ -819,22 +820,22 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public final void addSurfaceUpdatedListener(SurfaceUpdatedListener l) { + public final void addSurfaceUpdatedListener(final SurfaceUpdatedListener l) { surfaceUpdatedHelper.addSurfaceUpdatedListener(l); } @Override - public final void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l) throws IndexOutOfBoundsException { + public final void addSurfaceUpdatedListener(final int index, final SurfaceUpdatedListener l) throws IndexOutOfBoundsException { surfaceUpdatedHelper.addSurfaceUpdatedListener(index, l); } @Override - public final void removeSurfaceUpdatedListener(SurfaceUpdatedListener l) { + public final void removeSurfaceUpdatedListener(final SurfaceUpdatedListener l) { surfaceUpdatedHelper.removeSurfaceUpdatedListener(l); } @Override - public final void surfaceUpdated(Object updater, NativeSurface ns, long when) { + public final void surfaceUpdated(final Object updater, final NativeSurface ns, final long when) { surfaceUpdatedHelper.surfaceUpdated(updater, ns, when); } @@ -919,7 +920,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return screen; } - protected void setScreen(ScreenImpl newScreen) { // never null ! + protected void setScreen(final ScreenImpl newScreen) { // never null ! removeScreenReference(); screen = newScreen; } @@ -936,10 +937,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * @param width client-area size in window units, or <=0 if unchanged * @param height client-area size in window units, or <=0 if unchanged */ - protected final void setVisibleImpl(boolean visible, int x, int y, int width, int height) { + protected final void setVisibleImpl(final boolean visible, final int x, final int y, final int width, final int height) { reconfigureWindowImpl(x, y, width, height, getReconfigureFlags(FLAG_CHANGE_VISIBILITY, visible)); } - final void setVisibleActionImpl(boolean visible) { + final void setVisibleActionImpl(final boolean visible) { boolean nativeWindowCreated = false; boolean madeVisible = false; @@ -949,7 +950,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(!visible && null!=childWindows && childWindows.size()>0) { synchronized(childWindowsLock) { for(int i = 0; i < childWindows.size(); i++ ) { - NativeWindow nw = childWindows.get(i); + final NativeWindow nw = childWindows.get(i); if(nw instanceof WindowImpl) { ((WindowImpl)nw).setVisible(false); } @@ -980,7 +981,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(isNativeValid() && visible && null!=childWindows && childWindows.size()>0) { synchronized(childWindowsLock) { for(int i = 0; i < childWindows.size(); i++ ) { - NativeWindow nw = childWindows.get(i); + final NativeWindow nw = childWindows.get(i); if(nw instanceof WindowImpl) { ((WindowImpl)nw).setVisible(true); } @@ -1003,7 +1004,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer private class VisibleAction implements Runnable { boolean visible; - private VisibleAction(boolean visible) { + private VisibleAction(final boolean visible) { this.visible = visible; } @@ -1014,7 +1015,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public final void setVisible(boolean wait, boolean visible) { + public final void setVisible(final boolean wait, final boolean visible) { if(DEBUG_IMPLEMENTATION) { System.err.println("Window setVisible: START ("+getThreadName()+") "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible: "+this.visible+" -> "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+(null!=parentWindow)); } @@ -1022,7 +1023,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public final void setVisible(boolean visible) { + public final void setVisible(final boolean visible) { setVisible(true, visible); } @@ -1030,7 +1031,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer int width, height; boolean force; - private SetSizeAction(int w, int h, boolean disregardFS) { + private SetSizeAction(final int w, final int h, final boolean disregardFS) { this.width = w; this.height = h; this.force = disregardFS; @@ -1118,9 +1119,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(childWindows.size()>0) { // avoid ConcurrentModificationException: parent -> child -> parent.removeChild(this) @SuppressWarnings("unchecked") + final ArrayList<NativeWindow> clonedChildWindows = (ArrayList<NativeWindow>) childWindows.clone(); while( clonedChildWindows.size() > 0 ) { - NativeWindow nw = clonedChildWindows.remove(0); + final NativeWindow nw = clonedChildWindows.remove(0); if(nw instanceof WindowImpl) { ((WindowImpl)nw).windowDestroyNotify(true); } else { @@ -1145,7 +1147,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer setGraphicsConfiguration(null); } removeScreenReference(); - Display dpy = screen.getDisplay(); + final Display dpy = screen.getDisplay(); if(null != dpy) { dpy.validateEDTStopped(); } @@ -1200,7 +1202,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer runOnEDTIfAvail(true, destroyAction); } - protected void destroy(boolean preserveResources) { + protected void destroy(final boolean preserveResources) { if( null != lifecycleHook ) { lifecycleHook.preserveGLStateAtDestroy( preserveResources ); } @@ -1212,7 +1214,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * @param pWin parent window, may be null * @return true if at least one of both window's configurations is offscreen */ - protected static boolean isOffscreenInstance(NativeWindow cWin, NativeWindow pWin) { + protected static boolean isOffscreenInstance(final NativeWindow cWin, final NativeWindow pWin) { boolean ofs = false; final AbstractGraphicsConfiguration cWinCfg = cWin.getGraphicsConfiguration(); if( null != cWinCfg ) { @@ -1233,7 +1235,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer final int hints; ReparentOperation operation; - private ReparentAction(NativeWindow newParentWindow, int topLevelX, int topLevelY, int hints) { + private ReparentAction(final NativeWindow newParentWindow, final int topLevelX, final int topLevelY, int hints) { this.newParentWindow = newParentWindow; this.topLevelX = topLevelX; this.topLevelY = topLevelY; @@ -1452,7 +1454,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer WindowImpl.this.waitForVisible(false, false); // FIXME: Some composite WM behave slacky .. give 'em chance to change state -> invisible, // even though we do exactly that (KDE+Composite) - try { Thread.sleep(100); } catch (InterruptedException e) { } + try { Thread.sleep(100); } catch (final InterruptedException e) { } display.dispatchMessagesNative(); // status up2date } @@ -1587,15 +1589,15 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } }; @Override - public final ReparentOperation reparentWindow(NativeWindow newParent, int x, int y, int hints) { + public final ReparentOperation reparentWindow(final NativeWindow newParent, final int x, final int y, final int hints) { final ReparentAction reparentAction = new ReparentAction(newParent, x, y, hints); runOnEDTIfAvail(true, reparentAction); return reparentAction.getOp(); } @Override - public final CapabilitiesChooser setCapabilitiesChooser(CapabilitiesChooser chooser) { - CapabilitiesChooser old = this.capabilitiesChooser; + public final CapabilitiesChooser setCapabilitiesChooser(final CapabilitiesChooser chooser) { + final CapabilitiesChooser old = this.capabilitiesChooser; this.capabilitiesChooser = chooser; return old; } @@ -1613,7 +1615,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer private class DecorationAction implements Runnable { boolean undecorated; - private DecorationAction(boolean undecorated) { + private DecorationAction(final boolean undecorated) { this.undecorated = undecorated; } @@ -1633,7 +1635,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer final int width = getWidth(); final int height = getHeight(); - DisplayImpl display = (DisplayImpl) screen.getDisplay(); + final DisplayImpl display = (DisplayImpl) screen.getDisplay(); display.dispatchMessagesNative(); // status up2date reconfigureWindowImpl(x, y, width, height, getReconfigureFlags(FLAG_CHANGE_DECORATION, isVisible())); display.dispatchMessagesNative(); // status up2date @@ -1647,7 +1649,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public final void setUndecorated(boolean value) { + public final void setUndecorated(final boolean value) { runOnEDTIfAvail(true, new DecorationAction(value)); } @@ -1659,7 +1661,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer private class AlwaysOnTopAction implements Runnable { boolean alwaysOnTop; - private AlwaysOnTopAction(boolean alwaysOnTop) { + private AlwaysOnTopAction(final boolean alwaysOnTop) { this.alwaysOnTop = alwaysOnTop; } @@ -1679,7 +1681,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer final int width = getWidth(); final int height = getHeight(); - DisplayImpl display = (DisplayImpl) screen.getDisplay(); + final DisplayImpl display = (DisplayImpl) screen.getDisplay(); display.dispatchMessagesNative(); // status up2date reconfigureWindowImpl(x, y, width, height, getReconfigureFlags(FLAG_CHANGE_ALWAYSONTOP, isVisible())); display.dispatchMessagesNative(); // status up2date @@ -1693,7 +1695,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public final void setAlwaysOnTop(boolean value) { + public final void setAlwaysOnTop(final boolean value) { if( isFullscreen() ) { nfs_alwaysOnTop = value; } else { @@ -1738,7 +1740,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } private boolean setPointerVisibleIntern(final boolean pointerVisible) { - boolean res = setOffscreenPointerVisible(pointerVisible, pointerIcon); + final boolean res = setOffscreenPointerVisible(pointerVisible, pointerIcon); return setPointerVisibleImpl(pointerVisible) || res; // accept onscreen or offscreen positive result! } /** @@ -1768,7 +1770,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer final OffscreenLayerSurface ols = (OffscreenLayerSurface) parent; try { return ols.hideCursor(); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } @@ -1824,7 +1826,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } else { return ols.setCursor(null, null); // default } - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } @@ -1836,7 +1838,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return pointerConfined; } @Override - public final void confinePointer(boolean confine) { + public final void confinePointer(final boolean confine) { if(this.pointerConfined != confine) { boolean setVal = 0 == getWindowHandle(); if(!setVal) { @@ -1850,7 +1852,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // this allows user listener to sync previous position value to the new centered position try { Thread.sleep(3 * screen.getDisplay().getEDTUtil().getPollPeriod()); - } catch (InterruptedException e) { } + } catch (final InterruptedException e) { } } } if(setVal) { @@ -1860,7 +1862,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public final void warpPointer(int x, int y) { + public final void warpPointer(final int x, final int y) { if(0 != getWindowHandle()) { warpPointerImpl(x, y); } @@ -1976,7 +1978,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer protected final boolean autoPosition() { return autoPosition; } /** Sets the position fields {@link #x} and {@link #y} in window units to the given values and {@link #autoPosition} to false. */ - protected final void definePosition(int x, int y) { + protected final void definePosition(final int x, final int y) { if(DEBUG_IMPLEMENTATION) { System.err.println("definePosition: "+this.x+"/"+this.y+" -> "+x+"/"+y); // Thread.dumpStack(); @@ -1989,7 +1991,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * Sets the size fields {@link #winWidth} and {@link #winHeight} in window units to the given values * and {@link #pixWidth} and {@link #pixHeight} in pixel units according to {@link #convertToPixelUnits(int[])}. */ - protected final void defineSize(int winWidth, int winHeight) { + protected final void defineSize(final int winWidth, final int winHeight) { final int pixWidth = winWidth * getPixelScaleX(); // FIXME HiDPI: Shortcut, may need to adjust if we change scaling methodology final int pixHeight = winHeight * getPixelScaleY(); if(DEBUG_IMPLEMENTATION) { @@ -2036,8 +2038,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return lifecycleHook; } - public final LifecycleHook setLifecycleHook(LifecycleHook hook) { - LifecycleHook old = lifecycleHook; + public final LifecycleHook setLifecycleHook(final LifecycleHook hook) { + final LifecycleHook old = lifecycleHook; lifecycleHook = hook; return old; } @@ -2051,7 +2053,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public final void setWindowDestroyNotifyAction(Runnable r) { + public final void setWindowDestroyNotifyAction(final Runnable r) { windowDestroyNotifyAction = r; } @@ -2061,7 +2063,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer @Override public final String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(getClass().getName()+"[Config "+config+ ",\n "+screen+ @@ -2100,12 +2102,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return sb.toString(); } - protected final void setWindowHandle(long handle) { + protected final void setWindowHandle(final long handle) { windowHandle = handle; } @Override - public final void runOnEDTIfAvail(boolean wait, final Runnable task) { + public final void runOnEDTIfAvail(final boolean wait, final Runnable task) { if( windowLock.isOwner( Thread.currentThread() ) ) { task.run(); } else { @@ -2143,11 +2145,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public final void requestFocus(boolean wait) { + public final void requestFocus(final boolean wait) { requestFocus(wait /* wait */, false /* skipFocusAction */, brokenFocusChange /* force */); } - private void requestFocus(boolean wait, boolean skipFocusAction, boolean force) { + private void requestFocus(final boolean wait, final boolean skipFocusAction, final boolean force) { if( isNativeValid() && ( force || !hasFocus() ) && ( skipFocusAction || !focusAction() ) ) { @@ -2156,7 +2158,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } /** Internally forcing request focus on current thread */ - private void requestFocusInt(boolean skipFocusAction) { + private void requestFocusInt(final boolean skipFocusAction) { if( skipFocusAction || !focusAction() ) { if(DEBUG_IMPLEMENTATION) { System.err.println("Window.RequestFocusInt: forcing - ("+getThreadName()+"): skipFocusAction "+skipFocusAction+", focus "+hasFocus+" -> true - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)); @@ -2166,7 +2168,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public final void setFocusAction(FocusRunnable focusAction) { + public final void setFocusAction(final FocusRunnable focusAction) { this.focusAction = focusAction; } @@ -2186,19 +2188,19 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return res; } - protected final void setBrokenFocusChange(boolean v) { + protected final void setBrokenFocusChange(final boolean v) { brokenFocusChange = v; } @Override - public final void setKeyboardFocusHandler(KeyListener l) { + public final void setKeyboardFocusHandler(final KeyListener l) { keyboardFocusHandler = l; } private class SetPositionAction implements Runnable { int x, y; - private SetPositionAction(int x, int y) { + private SetPositionAction(final int x, final int y) { this.x = x; this.y = y; } @@ -2231,20 +2233,20 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public void setPosition(int x, int y) { + public void setPosition(final int x, final int y) { autoPosition = false; runOnEDTIfAvail(true, new SetPositionAction(x, y)); } @Override - public final void setTopLevelPosition(int x, int y) { + public final void setTopLevelPosition(final int x, final int y) { setPosition(x + getInsets().getLeftWidth(), y + getInsets().getTopHeight()); } private class FullScreenAction implements Runnable { boolean _fullscreen; - private boolean init(boolean fullscreen) { + private boolean init(final boolean fullscreen) { if(isNativeValid()) { this._fullscreen = fullscreen; return isFullscreen() != fullscreen; @@ -2349,7 +2351,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if( tempInvisible ) { setVisibleImpl(false, oldX, oldY, oldWidth, oldHeight); WindowImpl.this.waitForVisible(false, false); - try { Thread.sleep(100); } catch (InterruptedException e) { } + try { Thread.sleep(100); } catch (final InterruptedException e) { } display.dispatchMessagesNative(); // status up2date } @@ -2387,7 +2389,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(wasVisible) { if( NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true) ) { // Give sluggy WM's (e.g. Unity) a chance to properly restore window .. - try { Thread.sleep(100); } catch (InterruptedException e) { } + try { Thread.sleep(100); } catch (final InterruptedException e) { } display.dispatchMessagesNative(); // status up2date } setVisibleImpl(true, x, y, w, h); @@ -2417,16 +2419,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer private final FullScreenAction fullScreenAction = new FullScreenAction(); @Override - public boolean setFullscreen(boolean fullscreen) { + public boolean setFullscreen(final boolean fullscreen) { return setFullscreenImpl(fullscreen, true, null); } @Override - public boolean setFullscreen(List<MonitorDevice> monitors) { + public boolean setFullscreen(final List<MonitorDevice> monitors) { return setFullscreenImpl(true, false, monitors); } - private boolean setFullscreenImpl(boolean fullscreen, boolean useMainMonitor, List<MonitorDevice> monitors) { + private boolean setFullscreenImpl(final boolean fullscreen, final boolean useMainMonitor, final List<MonitorDevice> monitors) { synchronized(fullScreenAction) { fullscreenMonitors = monitors; fullscreenUseMainMonitor = useMainMonitor; @@ -2454,7 +2456,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } /** Notify WindowDriver about the finished monitor mode change. */ - protected void monitorModeChanged(MonitorEvent me, boolean success) { + protected void monitorModeChanged(final MonitorEvent me, final boolean success) { } private class MonitorModeListenerImpl implements MonitorModeListener { @@ -2466,7 +2468,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer boolean _fullscreenUseMainMonitor = true; @Override - public void monitorModeChangeNotify(MonitorEvent me) { + public void monitorModeChangeNotify(final MonitorEvent me) { hadFocus = hasFocus(); final boolean isOSX = NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(true); final boolean quirkFSPause = fullscreen && isReconfigureFlagSupported(FLAG_IS_FULLSCREEN_SPAN); @@ -2496,7 +2498,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public void monitorModeChanged(MonitorEvent me, boolean success) { + public void monitorModeChanged(final MonitorEvent me, final boolean success) { if(!animatorPaused && success && null!=lifecycleHook) { // Didn't pass above notify method. probably detected screen change after it happened. animatorPaused = lifecycleHook.pauseRenderingAction(); @@ -2572,14 +2574,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // @Override - public final boolean removeChild(NativeWindow win) { + public final boolean removeChild(final NativeWindow win) { synchronized(childWindowsLock) { return childWindows.remove(win); } } @Override - public final boolean addChild(NativeWindow win) { + public final boolean addChild(final NativeWindow win) { if (win == null) { return false; } @@ -2591,7 +2593,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer //---------------------------------------------------------------------- // Generic Event Support // - private void doEvent(boolean enqueue, boolean wait, com.jogamp.newt.event.NEWTEvent event) { + private void doEvent(final boolean enqueue, boolean wait, final com.jogamp.newt.event.NEWTEvent event) { boolean done = false; if(!enqueue) { @@ -2605,14 +2607,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public final void enqueueEvent(boolean wait, com.jogamp.newt.event.NEWTEvent event) { + public final void enqueueEvent(final boolean wait, final com.jogamp.newt.event.NEWTEvent event) { if(isNativeValid()) { ((DisplayImpl)screen.getDisplay()).enqueueEvent(wait, event); } } @Override - public final boolean consumeEvent(NEWTEvent e) { + public final boolean consumeEvent(final NEWTEvent e) { switch(e.getEventType()) { // special repaint treatment case WindowEvent.EVENT_WINDOW_REPAINT: @@ -2744,7 +2746,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer final PointerType[] pTypes, final short eventType, final int modifiers, final int actionIdx, final boolean normalPNames, final int[] pNames, final int[] pX, final int[] pY, final float[] pPressure, - float maxPressure, final float[] rotationXYZ, final float rotationScale) { + final float maxPressure, final float[] rotationXYZ, final float rotationScale) { final int pCount = pNames.length; final short[] pIDs = new short[pCount]; for(int i=0; i<pCount; i++) { @@ -3044,7 +3046,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer doEvent(enqueue, wait, e); // actual mouse event } - private static int step(int lower, int edge, int value) { + private static int step(final int lower, final int edge, final int value) { return value < edge ? lower : value; } @@ -3274,16 +3276,17 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public final void addMouseListener(MouseListener l) { + public final void addMouseListener(final MouseListener l) { addMouseListener(-1, l); } @Override - public final void addMouseListener(int index, MouseListener l) { + public final void addMouseListener(int index, final MouseListener l) { if(l == null) { return; } @SuppressWarnings("unchecked") + final ArrayList<MouseListener> clonedListeners = (ArrayList<MouseListener>) mouseListeners.clone(); if(0>index) { index = clonedListeners.size(); @@ -3293,11 +3296,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public final void removeMouseListener(MouseListener l) { + public final void removeMouseListener(final MouseListener l) { if (l == null) { return; } @SuppressWarnings("unchecked") + final ArrayList<MouseListener> clonedListeners = (ArrayList<MouseListener>) mouseListeners.clone(); clonedListeners.remove(l); mouseListeners = clonedListeners; @@ -3306,6 +3310,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer @Override public final MouseListener getMouseListener(int index) { @SuppressWarnings("unchecked") + final ArrayList<MouseListener> clonedListeners = (ArrayList<MouseListener>) mouseListeners.clone(); if(0>index) { index = clonedListeners.size()-1; @@ -3319,7 +3324,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public final void setDefaultGesturesEnabled(boolean enable) { + public final void setDefaultGesturesEnabled(final boolean enable) { defaultGestureHandlerEnabled = enable; } @Override @@ -3328,15 +3333,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public final void addGestureHandler(GestureHandler gh) { + public final void addGestureHandler(final GestureHandler gh) { addGestureHandler(-1, gh); } @Override - public final void addGestureHandler(int index, GestureHandler gh) { + public final void addGestureHandler(int index, final GestureHandler gh) { if(gh == null) { return; } @SuppressWarnings("unchecked") + final ArrayList<GestureHandler> cloned = (ArrayList<GestureHandler>) pointerGestureHandler.clone(); if(0>index) { index = cloned.size(); @@ -3345,25 +3351,27 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer pointerGestureHandler = cloned; } @Override - public final void removeGestureHandler(GestureHandler gh) { + public final void removeGestureHandler(final GestureHandler gh) { if (gh == null) { return; } @SuppressWarnings("unchecked") + final ArrayList<GestureHandler> cloned = (ArrayList<GestureHandler>) pointerGestureHandler.clone(); cloned.remove(gh); pointerGestureHandler = cloned; } @Override - public final void addGestureListener(GestureHandler.GestureListener gl) { + public final void addGestureListener(final GestureHandler.GestureListener gl) { addGestureListener(-1, gl); } @Override - public final void addGestureListener(int index, GestureHandler.GestureListener gl) { + public final void addGestureListener(int index, final GestureHandler.GestureListener gl) { if(gl == null) { return; } @SuppressWarnings("unchecked") + final ArrayList<GestureHandler.GestureListener> cloned = (ArrayList<GestureHandler.GestureListener>) gestureListeners.clone(); if(0>index) { index = cloned.size(); @@ -3372,17 +3380,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer gestureListeners = cloned; } @Override - public final void removeGestureListener(GestureHandler.GestureListener gl) { + public final void removeGestureListener(final GestureHandler.GestureListener gl) { if (gl == null) { return; } @SuppressWarnings("unchecked") + final ArrayList<GestureHandler.GestureListener> cloned = (ArrayList<GestureHandler.GestureListener>) gestureListeners.clone(); cloned.remove(gl); gestureListeners= cloned; } - private final void dispatchMouseEvent(MouseEvent e) { + private final void dispatchMouseEvent(final MouseEvent e) { for(int i = 0; !e.isConsumed() && i < mouseListeners.size(); i++ ) { final MouseListener l = mouseListeners.get(i); switch(e.getEventType()) { @@ -3431,7 +3440,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * @param pressed true if pressed, otherwise false * @return the previus pressed value */ - protected final boolean setKeyPressed(short keyCode, boolean pressed) { + protected final boolean setKeyPressed(final short keyCode, final boolean pressed) { final int v = 0xFFFF & keyCode; if( v <= keyTrackingRange ) { return keyPressedState.put(v, pressed); @@ -3442,7 +3451,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * @param keyCode the keyCode to test pressed state * @return true if pressed, otherwise false */ - protected final boolean isKeyPressed(short keyCode) { + protected final boolean isKeyPressed(final short keyCode) { final int v = 0xFFFF & keyCode; if( v <= keyTrackingRange ) { return keyPressedState.get(v); @@ -3450,18 +3459,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return false; } - public void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) { + public void sendKeyEvent(final short eventType, final int modifiers, final short keyCode, final short keySym, final char keyChar) { // Always add currently pressed mouse buttons to modifier mask consumeKeyEvent( KeyEvent.create(eventType, this, System.currentTimeMillis(), modifiers | pState1.buttonPressedMask, keyCode, keySym, keyChar) ); } - public void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short keyCode, short keySym, char keyChar) { + public void enqueueKeyEvent(final boolean wait, final short eventType, final int modifiers, final short keyCode, final short keySym, final char keyChar) { // Always add currently pressed mouse buttons to modifier mask enqueueEvent(wait, KeyEvent.create(eventType, this, System.currentTimeMillis(), modifiers | pState1.buttonPressedMask, keyCode, keySym, keyChar) ); } @Override - public final void setKeyboardVisible(boolean visible) { + public final void setKeyboardVisible(final boolean visible) { if(isNativeValid()) { // We don't skip the impl. if it seems that there is no state change, // since we cannot assume the impl. reliably gives us it's current state. @@ -3485,11 +3494,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * hence even if an invisible operation failed, the keyboard is considered invisible! * </p> */ - protected boolean setKeyboardVisibleImpl(boolean visible) { + protected boolean setKeyboardVisibleImpl(final boolean visible) { return false; // nop } /** Triggered by implementation's WM events to update the virtual on-screen keyboard's visibility state. */ - protected void keyboardVisibilityChanged(boolean visible) { + protected void keyboardVisibilityChanged(final boolean visible) { if(keyboardVisible != visible) { if(DEBUG_IMPLEMENTATION || DEBUG_KEY_EVENT) { System.err.println("keyboardVisibilityChanged: "+keyboardVisible+" -> "+visible); @@ -3500,16 +3509,17 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer protected boolean keyboardVisible = false; @Override - public final void addKeyListener(KeyListener l) { + public final void addKeyListener(final KeyListener l) { addKeyListener(-1, l); } @Override - public final void addKeyListener(int index, KeyListener l) { + public final void addKeyListener(int index, final KeyListener l) { if(l == null) { return; } @SuppressWarnings("unchecked") + final ArrayList<KeyListener> clonedListeners = (ArrayList<KeyListener>) keyListeners.clone(); if(0>index) { index = clonedListeners.size(); @@ -3519,11 +3529,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public final void removeKeyListener(KeyListener l) { + public final void removeKeyListener(final KeyListener l) { if (l == null) { return; } @SuppressWarnings("unchecked") + final ArrayList<KeyListener> clonedListeners = (ArrayList<KeyListener>) keyListeners.clone(); clonedListeners.remove(l); keyListeners = clonedListeners; @@ -3532,6 +3543,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer @Override public final KeyListener getKeyListener(int index) { @SuppressWarnings("unchecked") + final ArrayList<KeyListener> clonedListeners = (ArrayList<KeyListener>) keyListeners.clone(); if(0>index) { index = clonedListeners.size()-1; @@ -3544,7 +3556,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return keyListeners.toArray(new KeyListener[keyListeners.size()]); } - private final boolean propagateKeyEvent(KeyEvent e, KeyListener l) { + private final boolean propagateKeyEvent(final KeyEvent e, final KeyListener l) { switch(e.getEventType()) { case KeyEvent.EVENT_KEY_PRESSED: l.keyPressed(e); @@ -3558,7 +3570,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return e.isConsumed(); } - protected void consumeKeyEvent(KeyEvent e) { + protected void consumeKeyEvent(final KeyEvent e) { boolean consumedE = false; if( null != keyboardFocusHandler && !e.isAutoRepeat() ) { consumedE = propagateKeyEvent(e, keyboardFocusHandler); @@ -3582,27 +3594,28 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // WindowListener/Event Support // @Override - public final void sendWindowEvent(int eventType) { + public final void sendWindowEvent(final int eventType) { consumeWindowEvent( new WindowEvent((short)eventType, this, System.currentTimeMillis()) ); } - public final void enqueueWindowEvent(boolean wait, int eventType) { + public final void enqueueWindowEvent(final boolean wait, final int eventType) { enqueueEvent( wait, new WindowEvent((short)eventType, this, System.currentTimeMillis()) ); } @Override - public final void addWindowListener(WindowListener l) { + public final void addWindowListener(final WindowListener l) { addWindowListener(-1, l); } @Override - public final void addWindowListener(int index, WindowListener l) + public final void addWindowListener(int index, final WindowListener l) throws IndexOutOfBoundsException { if(l == null) { return; } @SuppressWarnings("unchecked") + final ArrayList<WindowListener> clonedListeners = (ArrayList<WindowListener>) windowListeners.clone(); if(0>index) { index = clonedListeners.size(); @@ -3612,11 +3625,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public final void removeWindowListener(WindowListener l) { + public final void removeWindowListener(final WindowListener l) { if (l == null) { return; } @SuppressWarnings("unchecked") + final ArrayList<WindowListener> clonedListeners = (ArrayList<WindowListener>) windowListeners.clone(); clonedListeners.remove(l); windowListeners = clonedListeners; @@ -3625,6 +3639,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer @Override public final WindowListener getWindowListener(int index) { @SuppressWarnings("unchecked") + final ArrayList<WindowListener> clonedListeners = (ArrayList<WindowListener>) windowListeners.clone(); if(0>index) { index = clonedListeners.size()-1; @@ -3637,13 +3652,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return windowListeners.toArray(new WindowListener[windowListeners.size()]); } - protected void consumeWindowEvent(WindowEvent e) { + protected void consumeWindowEvent(final WindowEvent e) { if(DEBUG_IMPLEMENTATION) { System.err.println("consumeWindowEvent: "+e+", visible "+isVisible()+" "+getX()+"/"+getY()+", win["+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+ "], pixel["+getSurfaceWidth()+"x"+getSurfaceHeight()+"]"); } for(int i = 0; !e.isConsumed() && i < windowListeners.size(); i++ ) { - WindowListener l = windowListeners.get(i); + final WindowListener l = windowListeners.get(i); switch(e.getEventType()) { case WindowEvent.EVENT_WINDOW_RESIZED: l.windowResized(e); @@ -3675,7 +3690,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } /** Triggered by implementation's WM events to update the focus state. */ - protected void focusChanged(boolean defer, boolean focusGained) { + protected void focusChanged(final boolean defer, final boolean focusGained) { if(brokenFocusChange || hasFocus != focusGained) { if(DEBUG_IMPLEMENTATION) { System.err.println("Window.focusChanged: ("+getThreadName()+"): (defer: "+defer+") "+this.hasFocus+" -> "+focusGained+" - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)); @@ -3691,7 +3706,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } /** Triggered by implementation's WM events to update the visibility state. */ - protected final void visibleChanged(boolean defer, boolean visible) { + protected final void visibleChanged(final boolean defer, final boolean visible) { if(this.visible != visible) { if(DEBUG_IMPLEMENTATION) { System.err.println("Window.visibleChanged ("+getThreadName()+"): (defer: "+defer+") "+this.visible+" -> "+visible+" - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)); @@ -3701,17 +3716,17 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } /** Returns -1 if failed, otherwise remaining time until {@link #TIMEOUT_NATIVEWINDOW}, maybe zero. */ - private long waitForVisible(boolean visible, boolean failFast) { + private long waitForVisible(final boolean visible, final boolean failFast) { return waitForVisible(visible, failFast, TIMEOUT_NATIVEWINDOW); } /** Returns -1 if failed, otherwise remaining time until <code>timeOut</code>, maybe zero. */ - private long waitForVisible(boolean visible, boolean failFast, long timeOut) { + private long waitForVisible(final boolean visible, final boolean failFast, final long timeOut) { final DisplayImpl display = (DisplayImpl) screen.getDisplay(); display.dispatchMessagesNative(); // status up2date long remaining; for(remaining = timeOut; 0<remaining && this.visible != visible; remaining-=10 ) { - try { Thread.sleep(10); } catch (InterruptedException ie) {} + try { Thread.sleep(10); } catch (final InterruptedException ie) {} display.dispatchMessagesNative(); // status up2date } if(this.visible != visible) { @@ -3731,7 +3746,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } /** Triggered by implementation's WM events to update the client-area size in window units w/o insets/decorations. */ - protected void sizeChanged(boolean defer, int newWidth, int newHeight, boolean force) { + protected void sizeChanged(final boolean defer, final int newWidth, final int newHeight, final boolean force) { if(force || getWidth() != newWidth || getHeight() != newHeight) { if(DEBUG_IMPLEMENTATION) { System.err.println("Window.sizeChanged: ("+getThreadName()+"): (defer: "+defer+") force "+force+", "+ @@ -3752,12 +3767,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } - private boolean waitForSize(int w, int h, boolean failFast, long timeOut) { + private boolean waitForSize(final int w, final int h, final boolean failFast, final long timeOut) { final DisplayImpl display = (DisplayImpl) screen.getDisplay(); display.dispatchMessagesNative(); // status up2date long sleep; for(sleep = timeOut; 0<sleep && w!=getWidth() && h!=getHeight(); sleep-=10 ) { - try { Thread.sleep(10); } catch (InterruptedException ie) {} + try { Thread.sleep(10); } catch (final InterruptedException ie) {} display.dispatchMessagesNative(); // status up2date } if(0 >= sleep) { @@ -3775,7 +3790,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } /** Triggered by implementation's WM events to update the position. */ - protected final void positionChanged(boolean defer, int newX, int newY) { + protected final void positionChanged(final boolean defer, final int newX, final int newY) { if ( getX() != newX || getY() != newY ) { if(DEBUG_IMPLEMENTATION) { System.err.println("Window.positionChanged: ("+getThreadName()+"): (defer: "+defer+") "+getX()+"/"+getY()+" -> "+newX+"/"+newY+" - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)); @@ -3797,7 +3812,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * Since WM may not obey our positional request exactly, we allow a tolerance of 2 times insets[left/top], or 64 pixels, whatever is greater. * </p> */ - private boolean waitForPosition(boolean useCustomPosition, int x, int y, long timeOut) { + private boolean waitForPosition(final boolean useCustomPosition, final int x, final int y, final long timeOut) { final DisplayImpl display = (DisplayImpl) screen.getDisplay(); final int maxDX, maxDY; { @@ -3814,7 +3829,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer ok = !autoPosition; } if( !ok ) { - try { Thread.sleep(10); } catch (InterruptedException ie) {} + try { Thread.sleep(10); } catch (final InterruptedException ie) {} display.dispatchMessagesNative(); // status up2date remaining-=10; } @@ -3838,7 +3853,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * @see #getInsets() * @see #updateInsetsImpl(Insets) */ - protected void insetsChanged(boolean defer, int left, int right, int top, int bottom) { + protected void insetsChanged(final boolean defer, final int left, final int right, final int top, final int bottom) { if ( left >= 0 && right >= 0 && top >= 0 && bottom >= 0 ) { if( blockInsetsChange || isUndecorated() ) { if(DEBUG_IMPLEMENTATION) { @@ -3862,7 +3877,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * and hence force destruction. Otherwise is follows the user settings. * @return true if this window is no more valid and hence has been destroyed, otherwise false. */ - public final boolean windowDestroyNotify(boolean force) { + public final boolean windowDestroyNotify(final boolean force) { final WindowClosingMode defMode = getDefaultCloseOperation(); final WindowClosingMode mode = force ? WindowClosingMode.DISPOSE_ON_CLOSE : defMode; if(DEBUG_IMPLEMENTATION) { @@ -3906,7 +3921,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public final void windowRepaint(int x, int y, int width, int height) { + public final void windowRepaint(final int x, final int y, final int width, final int height) { windowRepaint(false, x, y, width, height); } @@ -3918,7 +3933,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * @param width dirty-region width in pixel units * @param height dirty-region height in pixel units */ - protected final void windowRepaint(boolean defer, int x, int y, int width, int height) { + protected final void windowRepaint(final boolean defer, final int x, final int y, int width, int height) { width = ( 0 >= width ) ? getSurfaceWidth() : width; height = ( 0 >= height ) ? getSurfaceHeight() : height; if(DEBUG_IMPLEMENTATION) { @@ -3926,7 +3941,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } if(isNativeValid()) { - NEWTEvent e = new WindowUpdateEvent(WindowEvent.EVENT_WINDOW_REPAINT, this, System.currentTimeMillis(), + final NEWTEvent e = new WindowUpdateEvent(WindowEvent.EVENT_WINDOW_REPAINT, this, System.currentTimeMillis(), new Rectangle(x, y, width, height)); doEvent(defer, false, e); } @@ -3936,16 +3951,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // Reflection helper .. // - private static Class<?>[] getCustomConstructorArgumentTypes(Class<?> windowClass) { + private static Class<?>[] getCustomConstructorArgumentTypes(final Class<?> windowClass) { Class<?>[] argTypes = null; try { - Method m = windowClass.getDeclaredMethod("getCustomConstructorArgumentTypes"); + final Method m = windowClass.getDeclaredMethod("getCustomConstructorArgumentTypes"); argTypes = (Class[]) m.invoke(null, (Object[])null); - } catch (Throwable t) {} + } catch (final Throwable t) {} return argTypes; } - private static int verifyConstructorArgumentTypes(Class<?>[] types, Object[] args) { + private static int verifyConstructorArgumentTypes(final Class<?>[] types, final Object[] args) { if(types.length != args.length) { return -1; } @@ -3957,8 +3972,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return args.length; } - private static String getArgsStrList(Object[] args) { - StringBuilder sb = new StringBuilder(); + private static String getArgsStrList(final Object[] args) { + final StringBuilder sb = new StringBuilder(); for(int i=0; i<args.length; i++) { sb.append(args[i].getClass()); if(i<args.length) { @@ -3968,8 +3983,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return sb.toString(); } - private static String getTypeStrList(Class<?>[] types) { - StringBuilder sb = new StringBuilder(); + private static String getTypeStrList(final Class<?>[] types) { + final StringBuilder sb = new StringBuilder(); for(int i=0; i<types.length; i++) { sb.append(types[i]); if(i<types.length) { @@ -3983,11 +3998,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return Display.getThreadName(); } - public static String toHexString(int hex) { + public static String toHexString(final int hex) { return Display.toHexString(hex); } - public static String toHexString(long hex) { + public static String toHexString(final long hex) { return Display.toHexString(hex); } } diff --git a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java index 2ba5b3460..682313ef4 100644 --- a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java +++ b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java @@ -55,7 +55,7 @@ public class NewtFactoryAWT extends NewtFactory { * * @param awtCompObject must be of type java.awt.Component */ - public static JAWTWindow getNativeWindow(Object awtCompObject, CapabilitiesImmutable capsRequested) { + public static JAWTWindow getNativeWindow(final Object awtCompObject, final CapabilitiesImmutable capsRequested) { if(null==awtCompObject) { throw new NativeWindowException("Null AWT Component"); } @@ -65,9 +65,9 @@ public class NewtFactoryAWT extends NewtFactory { return getNativeWindow( (java.awt.Component) awtCompObject, capsRequested ); } - public static JAWTWindow getNativeWindow(java.awt.Component awtComp, CapabilitiesImmutable capsRequested) { - AWTGraphicsConfiguration config = AWTGraphicsConfiguration.create(awtComp, null, capsRequested); - NativeWindow nw = NativeWindowFactory.getNativeWindow(awtComp, config); // a JAWTWindow + public static JAWTWindow getNativeWindow(final java.awt.Component awtComp, final CapabilitiesImmutable capsRequested) { + final AWTGraphicsConfiguration config = AWTGraphicsConfiguration.create(awtComp, null, capsRequested); + final NativeWindow nw = NativeWindowFactory.getNativeWindow(awtComp, config); // a JAWTWindow if(! ( nw instanceof JAWTWindow ) ) { throw new NativeWindowException("Not an AWT NativeWindow: "+nw); } @@ -77,7 +77,7 @@ public class NewtFactoryAWT extends NewtFactory { return (JAWTWindow)nw; } - public static void destroyNativeWindow(JAWTWindow jawtWindow) { + public static void destroyNativeWindow(final JAWTWindow jawtWindow) { final AbstractGraphicsConfiguration config = jawtWindow.getGraphicsConfiguration(); jawtWindow.destroy(); config.getScreen().getDevice().close(); diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java index b04fd98f4..31ee92ca4 100644 --- a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java +++ b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java @@ -101,7 +101,7 @@ public class AWTNewtEventFactory { } } - public static final short eventTypeAWT2NEWT(int awtType) { + public static final short eventTypeAWT2NEWT(final int awtType) { switch( awtType ) { // n/a case java.awt.event.WindowEvent.WINDOW_OPENED: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_OPENED; case java.awt.event.WindowEvent.WINDOW_CLOSING: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY; @@ -136,7 +136,7 @@ public class AWTNewtEventFactory { return (short)0; } - private static int getAWTButtonDownMaskImpl(int button) { + private static int getAWTButtonDownMaskImpl(final int button) { /** * java.awt.event.InputEvent.getMaskForButton(button); * @@ -173,7 +173,7 @@ public class AWTNewtEventFactory { * @param button * @return */ - public static int getAWTButtonDownMask(int button) { + public static int getAWTButtonDownMask(final int button) { if( 0 < button && button <= awtButtonDownMasks.length ) { return awtButtonDownMasks[button-1]; } else { @@ -181,7 +181,7 @@ public class AWTNewtEventFactory { } } - public static final short awtButton2Newt(int awtButton) { + public static final short awtButton2Newt(final int awtButton) { if( 0 < awtButton && awtButton <= com.jogamp.newt.event.MouseEvent.BUTTON_COUNT ) { return (short)awtButton; } else { diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java index 770502326..93cdd7e56 100644 --- a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java +++ b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java @@ -46,14 +46,14 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt { NativeWindow downstreamParent; - public AWTParentWindowAdapter(NativeWindow downstreamParent, com.jogamp.newt.Window downstream) { + public AWTParentWindowAdapter(final NativeWindow downstreamParent, final com.jogamp.newt.Window downstream) { super(downstream); this.downstreamParent = downstreamParent; } public AWTParentWindowAdapter() { super(); } - public AWTParentWindowAdapter setDownstream(NativeWindow downstreamParent, com.jogamp.newt.Window downstream) { + public AWTParentWindowAdapter setDownstream(final NativeWindow downstreamParent, final com.jogamp.newt.Window downstream) { setDownstream(downstream); this.downstreamParent = downstreamParent; return this; @@ -67,19 +67,19 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt } @Override - public synchronized AWTAdapter addTo(java.awt.Component awtComponent) { + public synchronized AWTAdapter addTo(final java.awt.Component awtComponent) { awtComponent.addHierarchyListener(this); return super.addTo(awtComponent); } @Override - public synchronized AWTAdapter removeFrom(java.awt.Component awtComponent) { + public synchronized AWTAdapter removeFrom(final java.awt.Component awtComponent) { awtComponent.removeHierarchyListener(this); return super.removeFrom(awtComponent); } @Override - public synchronized void focusGained(java.awt.event.FocusEvent e) { + public synchronized void focusGained(final java.awt.event.FocusEvent e) { if( !isSetup ) { return; } // forward focus to NEWT child final com.jogamp.newt.Window newtChild = getNewtWindow(); @@ -100,7 +100,7 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt } @Override - public synchronized void focusLost(java.awt.event.FocusEvent e) { + public synchronized void focusLost(final java.awt.event.FocusEvent e) { if( !isSetup ) { return; } if(DEBUG_IMPLEMENTATION) { System.err.println("AWT: focusLost: "+ e); @@ -108,7 +108,7 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt } @Override - public synchronized void componentResized(java.awt.event.ComponentEvent e) { + public synchronized void componentResized(final java.awt.event.ComponentEvent e) { if( !isSetup ) { return; } // Need to resize the NEWT child window // the resized event will be send via the native window feedback. @@ -139,7 +139,7 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt } @Override - public synchronized void componentMoved(java.awt.event.ComponentEvent e) { + public synchronized void componentMoved(final java.awt.event.ComponentEvent e) { if( !isSetup ) { return; } if(DEBUG_IMPLEMENTATION) { System.err.println("AWT: componentMoved: "+e); @@ -151,17 +151,17 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt } @Override - public synchronized void windowActivated(java.awt.event.WindowEvent e) { + public synchronized void windowActivated(final java.awt.event.WindowEvent e) { // no propagation to NEWT child window } @Override - public synchronized void windowDeactivated(java.awt.event.WindowEvent e) { + public synchronized void windowDeactivated(final java.awt.event.WindowEvent e) { // no propagation to NEWT child window } @Override - public synchronized void hierarchyChanged(java.awt.event.HierarchyEvent e) { + public synchronized void hierarchyChanged(final java.awt.event.HierarchyEvent e) { if( !isSetup ) { return; } final Window newtChild = getNewtWindow(); if( null != newtChild && null == getNewtEventListener() ) { diff --git a/src/newt/classes/jogamp/newt/driver/PNGIcon.java b/src/newt/classes/jogamp/newt/driver/PNGIcon.java index 967acd413..43cfa9b25 100644 --- a/src/newt/classes/jogamp/newt/driver/PNGIcon.java +++ b/src/newt/classes/jogamp/newt/driver/PNGIcon.java @@ -71,7 +71,7 @@ public class PNGIcon { * @throws IOException * @throws MalformedURLException */ - public static ByteBuffer arrayToX11BGRAImages(IOUtil.ClassResources resources, int[] data_size, int[] elem_bytesize) throws UnsupportedOperationException, InterruptedException, IOException, MalformedURLException { + public static ByteBuffer arrayToX11BGRAImages(final IOUtil.ClassResources resources, final int[] data_size, final int[] elem_bytesize) throws UnsupportedOperationException, InterruptedException, IOException, MalformedURLException { if( avail ) { return jogamp.newt.driver.opengl.JoglUtilPNGIcon.arrayToX11BGRAImages(resources, data_size, elem_bytesize); } diff --git a/src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java index 32bd970a1..a5f4fc769 100644 --- a/src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java @@ -56,7 +56,7 @@ public class DisplayDriver extends jogamp.newt.DisplayImpl { aDevice.open(); } - protected void closeNativeImpl(AbstractGraphicsDevice aDevice) { + protected void closeNativeImpl(final AbstractGraphicsDevice aDevice) { aDevice.close(); } diff --git a/src/newt/classes/jogamp/newt/driver/android/MD.java b/src/newt/classes/jogamp/newt/driver/android/MD.java index f2f30937b..e6316004b 100644 --- a/src/newt/classes/jogamp/newt/driver/android/MD.java +++ b/src/newt/classes/jogamp/newt/driver/android/MD.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,13 +20,15 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ package jogamp.newt.driver.android; +import jogamp.common.os.PlatformPropsImpl; + import com.jogamp.common.GlueGenVersion; import com.jogamp.common.os.Platform; import com.jogamp.common.util.VersionUtil; @@ -34,22 +36,22 @@ import com.jogamp.opengl.JoglVersion; public class MD { public static final String TAG = "JogAmp.NEWT"; - - public static String getInfo() { - StringBuilder sb = new StringBuilder(); - - sb.append(VersionUtil.getPlatformInfo()).append(Platform.NEWLINE) - .append(GlueGenVersion.getInstance()).append(Platform.NEWLINE) - .append(JoglVersion.getInstance()).append(Platform.NEWLINE) - .append(Platform.NEWLINE); - + + public static String getInfo() { + final StringBuilder sb = new StringBuilder(); + + sb.append(VersionUtil.getPlatformInfo()).append(PlatformPropsImpl.NEWLINE) + .append(GlueGenVersion.getInstance()).append(PlatformPropsImpl.NEWLINE) + .append(JoglVersion.getInstance()).append(PlatformPropsImpl.NEWLINE) + .append(PlatformPropsImpl.NEWLINE); + JoglVersion.getDefaultOpenGLInfo(null, sb, true); - return sb.toString(); + return sb.toString(); } - - public static void main(String args[]) { - + + public static void main(final String args[]) { + System.err.println(getInfo()); } } diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java index 27c570722..68d43ac75 100644 --- a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java +++ b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java @@ -57,7 +57,7 @@ public class NewtBaseActivity extends Activity { Activity rootActivity; boolean setThemeCalled = false; - protected void startAnimation(boolean start) { + protected void startAnimation(final boolean start) { if(null != animator) { final boolean res; if( start ) { @@ -95,7 +95,7 @@ public class NewtBaseActivity extends Activity { rootActivity = this; } - public void setRootActivity(Activity rootActivity) { + public void setRootActivity(final Activity rootActivity) { this.rootActivity = rootActivity; this.isDelegatedActivity = this != rootActivity; } @@ -194,11 +194,11 @@ public class NewtBaseActivity extends Activity { } private final GLStateKeeper.Listener glStateKeeperListener = new GLStateKeeper.Listener() { @Override - public void glStatePreserveNotify(GLStateKeeper glsk) { + public void glStatePreserveNotify(final GLStateKeeper glsk) { Log.d(MD.TAG, "GLStateKeeper Preserving: 0x"+Integer.toHexString(glsk.hashCode())); } @Override - public void glStateRestored(GLStateKeeper glsk) { + public void glStateRestored(final GLStateKeeper glsk) { Log.d(MD.TAG, "GLStateKeeper Restored: 0x"+Integer.toHexString(glsk.hashCode())); startAnimation(true); } @@ -212,7 +212,7 @@ public class NewtBaseActivity extends Activity { * @param androidWindow * @param newtWindow */ - public void layoutForNEWTWindow(android.view.Window androidWindow, Window newtWindow) { + public void layoutForNEWTWindow(final android.view.Window androidWindow, final Window newtWindow) { if(null == androidWindow || null == newtWindow) { throw new IllegalArgumentException("Android or NEWT Window null"); } @@ -241,7 +241,7 @@ public class NewtBaseActivity extends Activity { * @param androidWindow * @param newtWindow */ - public void setFullscreenFeature(android.view.Window androidWindow, boolean fullscreen) { + public void setFullscreenFeature(final android.view.Window androidWindow, final boolean fullscreen) { if(null == androidWindow) { throw new IllegalArgumentException("Android or Window null"); } @@ -262,7 +262,7 @@ public class NewtBaseActivity extends Activity { * Must be called before creating the view and adding any content, i.e. setContentView() ! * </p> */ - protected void adaptTheme4Transparency(CapabilitiesImmutable caps) { + protected void adaptTheme4Transparency(final CapabilitiesImmutable caps) { if(!caps.isBackgroundOpaque()) { setTransparencyTheme(); } @@ -308,7 +308,7 @@ public class NewtBaseActivity extends Activity { * @see #setContentView(android.view.Window, Window) * @see #addContentView(android.view.Window, Window, android.view.ViewGroup.LayoutParams) */ - public void setAnimator(GLAnimatorControl animator) { + public void setAnimator(final GLAnimatorControl animator) { this.animator = animator; if(!animator.isStarted()) { animator.start(); @@ -326,7 +326,7 @@ public class NewtBaseActivity extends Activity { } @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { Log.d(MD.TAG, "onCreate.0"); if(!isDelegatedActivity()) { super.onCreate(savedInstanceState); diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java index 09de62326..4dd96c9a0 100644 --- a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java +++ b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java @@ -33,6 +33,8 @@ import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLProfile; +import jogamp.common.os.PlatformPropsImpl; + import com.jogamp.common.GlueGenVersion; import com.jogamp.common.os.Platform; import com.jogamp.common.util.VersionUtil; @@ -49,7 +51,7 @@ import android.widget.TextView; public class NewtVersionActivity extends NewtBaseActivity { @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setFullscreenFeature(getWindow(), true); @@ -62,7 +64,7 @@ public class NewtVersionActivity extends NewtBaseActivity { scroller.addView(tv); viewGroup.addView(scroller, new android.widget.FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, Gravity.TOP|Gravity.LEFT)); - final String info1 = "JOGL Version Info"+Platform.NEWLINE+VersionUtil.getPlatformInfo()+Platform.NEWLINE+GlueGenVersion.getInstance()+Platform.NEWLINE+JoglVersion.getInstance()+Platform.NEWLINE; + final String info1 = "JOGL Version Info"+PlatformPropsImpl.NEWLINE+VersionUtil.getPlatformInfo()+PlatformPropsImpl.NEWLINE+GlueGenVersion.getInstance()+PlatformPropsImpl.NEWLINE+JoglVersion.getInstance()+PlatformPropsImpl.NEWLINE; Log.d(MD.TAG, info1); tv.setText(info1); @@ -77,8 +79,8 @@ public class NewtVersionActivity extends NewtBaseActivity { } if( null != glp ) { // create GLWindow (-> incl. underlying NEWT Display, Screen & Window) - GLCapabilities caps = new GLCapabilities(glp); - GLWindow glWindow = GLWindow.create(caps); + final GLCapabilities caps = new GLCapabilities(glp); + final GLWindow glWindow = GLWindow.create(caps); glWindow.setUndecorated(true); glWindow.setSize(32, 32); glWindow.setPosition(0, 0); @@ -87,14 +89,14 @@ public class NewtVersionActivity extends NewtBaseActivity { registerNEWTWindow(glWindow); glWindow.addGLEventListener(new GLEventListener() { - public void init(GLAutoDrawable drawable) { - GL gl = drawable.getGL(); + public void init(final GLAutoDrawable drawable) { + final GL gl = drawable.getGL(); final StringBuilder sb = new StringBuilder(); - sb.append(JoglVersion.getGLInfo(gl, null, true)).append(Platform.NEWLINE); - sb.append("Requested: ").append(Platform.NEWLINE); - sb.append(drawable.getNativeSurface().getGraphicsConfiguration().getRequestedCapabilities()).append(Platform.NEWLINE).append(Platform.NEWLINE); - sb.append("Chosen: ").append(Platform.NEWLINE); - sb.append(drawable.getChosenGLCapabilities()).append(Platform.NEWLINE).append(Platform.NEWLINE); + sb.append(JoglVersion.getGLInfo(gl, null, true)).append(PlatformPropsImpl.NEWLINE); + sb.append("Requested: ").append(PlatformPropsImpl.NEWLINE); + sb.append(drawable.getNativeSurface().getGraphicsConfiguration().getRequestedCapabilities()).append(PlatformPropsImpl.NEWLINE).append(PlatformPropsImpl.NEWLINE); + sb.append("Chosen: ").append(PlatformPropsImpl.NEWLINE); + sb.append(drawable.getChosenGLCapabilities()).append(PlatformPropsImpl.NEWLINE).append(PlatformPropsImpl.NEWLINE); final String info2 = sb.toString(); // Log.d(MD.TAG, info2); // too big! System.err.println(info2); @@ -105,13 +107,13 @@ public class NewtVersionActivity extends NewtBaseActivity { } } ); } - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { } - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { } }); glWindow.setVisible(true); diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java index 553900f6a..190f55e71 100644 --- a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java +++ b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java @@ -8,7 +8,7 @@ import android.util.Log; public class NewtVersionActivityLauncher extends Activity { @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Uri uri = Uri.parse("launch://jogamp.org/jogamp.newt.driver.android.NewtVersionActivity?sys=com.jogamp.common&sys=javax.media.opengl&pkg=com.jogamp.opengl.test&jogamp.debug=all&nativewindow.debug=all&jogl.debug=all&newt.debug=all"); diff --git a/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java index a4c70343d..b28cdcbed 100644 --- a/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java @@ -60,11 +60,11 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { protected void closeNativeImpl() { } @Override - protected int validateScreenIndex(int idx) { + protected int validateScreenIndex(final int idx) { return 0; // FIXME: only one screen available ? } - private final MonitorMode getModeImpl(final Cache cache, final android.view.Display aDisplay, DisplayMetrics outMetrics, int modeIdx, int screenSizeNRot, int nrot) { + private final MonitorMode getModeImpl(final Cache cache, final android.view.Display aDisplay, final DisplayMetrics outMetrics, final int modeIdx, final int screenSizeNRot, final int nrot) { final int[] props = new int[MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL]; int i = 0; props[i++] = MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL; @@ -78,7 +78,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { } @Override - protected void collectNativeMonitorModesAndDevicesImpl(Cache cache) { + protected void collectNativeMonitorModesAndDevicesImpl(final Cache cache) { // FIXME: Multi Monitor Implementation missing [for newer Android version ?] final Context ctx = jogamp.common.os.android.StaticContext.getContext(); @@ -94,7 +94,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { MonitorMode currentMode = null; for(int r=0; r<4; r++) { // for all rotations final int nrot_i = r*MonitorMode.ROTATE_90; - MonitorMode mode = getModeImpl(cache, aDisplay, outMetrics, modeIdx, 0, nrot_i); + final MonitorMode mode = getModeImpl(cache, aDisplay, outMetrics, modeIdx, 0, nrot_i); if( nrot == nrot_i ) { currentMode = mode; } @@ -117,7 +117,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { } @Override - protected MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor) { + protected MonitorMode queryCurrentMonitorModeImpl(final MonitorDevice monitor) { final Context ctx = jogamp.common.os.android.StaticContext.getContext(); final WindowManager wmgr = (WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE); final DisplayMetrics outMetrics = new DisplayMetrics(); @@ -129,14 +129,14 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { } @Override - protected boolean setCurrentMonitorModeImpl(MonitorDevice monitor, MonitorMode mode) { + protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) { return false; } //---------------------------------------------------------------------- // Internals only // - static int androidRotation2NewtRotation(int arot) { + static int androidRotation2NewtRotation(final int arot) { switch(arot) { case Surface.ROTATION_270: return MonitorMode.ROTATE_270; case Surface.ROTATION_180: return MonitorMode.ROTATE_180; @@ -145,7 +145,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { } return MonitorMode.ROTATE_0; } - static int getScreenSize(DisplayMetrics outMetrics, int nrot, int[] props, int offset) { + static int getScreenSize(final DisplayMetrics outMetrics, final int nrot, final int[] props, int offset) { // swap width and height, since Android reflects rotated dimension, we don't if (MonitorMode.ROTATE_90 == nrot || MonitorMode.ROTATE_270 == nrot) { props[offset++] = outMetrics.heightPixels; @@ -156,7 +156,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { } return offset; } - static int getBpp(android.view.Display aDisplay, int[] props, int offset) { + static int getBpp(final android.view.Display aDisplay, final int[] props, int offset) { int bpp; switch(aDisplay.getPixelFormat()) { case PixelFormat.RGBA_8888: bpp=32; break; @@ -171,7 +171,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { props[offset++] = bpp; return offset; } - static int getScreenSizeMM(DisplayMetrics outMetrics, int[] props, int offset) { + static int getScreenSizeMM(final DisplayMetrics outMetrics, final int[] props, int offset) { final float inW = outMetrics.widthPixels / outMetrics.xdpi; final float inH = outMetrics.heightPixels / outMetrics.ydpi; final float mmpi = 25.4f; diff --git a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java index db530cb7e..786ebb31c 100644 --- a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java @@ -50,6 +50,7 @@ import javax.media.opengl.GLException; import com.jogamp.common.os.AndroidVersion; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; import com.jogamp.newt.MonitorDevice; +import com.jogamp.newt.Window; import jogamp.opengl.egl.EGL; import jogamp.opengl.egl.EGLDisplayUtil; @@ -87,7 +88,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { * @param rCaps requested Capabilities * @return An Android PixelFormat number suitable for {@link SurfaceHolder#setFormat(int)}. */ - public static final int getSurfaceHolderFormat(CapabilitiesImmutable rCaps) { + public static final int getSurfaceHolderFormat(final CapabilitiesImmutable rCaps) { int fmt = PixelFormat.UNKNOWN; if( !rCaps.isBackgroundOpaque() ) { @@ -121,7 +122,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { * @param androidPixelFormat An Android PixelFormat delivered via {@link Callback2#surfaceChanged(SurfaceHolder, int, int, int)} params. * @return A native Android PixelFormat number suitable for {@link #setSurfaceVisualID0(long, int)}. */ - public static final int getANativeWindowFormat(int androidPixelFormat) { + public static final int getANativeWindowFormat(final int androidPixelFormat) { final int nativePixelFormat; switch(androidPixelFormat) { case PixelFormat.RGBA_8888: @@ -155,8 +156,8 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { * @param rCaps requested Capabilities * @return The fixed Capabilities */ - public static final CapabilitiesImmutable fixCaps(boolean matchFormatPrecise, int format, CapabilitiesImmutable rCaps) { - PixelFormat pf = new PixelFormat(); + public static final CapabilitiesImmutable fixCaps(final boolean matchFormatPrecise, final int format, final CapabilitiesImmutable rCaps) { + final PixelFormat pf = new PixelFormat(); PixelFormat.getPixelFormatInfo(format, pf); final CapabilitiesImmutable res; int r, g, b, a; @@ -178,7 +179,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { rCaps.getAlphaBits() > a ; if(change) { - Capabilities nCaps = (Capabilities) rCaps.cloneMutable(); + final Capabilities nCaps = (Capabilities) rCaps.cloneMutable(); nCaps.setRedBits(r); nCaps.setGreenBits(g); nCaps.setBlueBits(b); @@ -194,7 +195,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { return res; } - public static final boolean isAndroidFormatTransparent(int aFormat) { + public static final boolean isAndroidFormatTransparent(final int aFormat) { switch (aFormat) { case PixelFormat.TRANSLUCENT: case PixelFormat.TRANSPARENT: @@ -211,7 +212,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { reset(); } - public void registerActivity(Activity activity) { + public void registerActivity(final Activity activity) { this.activity = activity; } protected Activity activity = null; @@ -253,7 +254,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { } } - private final void setupAndroidView(Context ctx) { + private final void setupAndroidView(final Context ctx) { androidView = new MSurfaceView(ctx); final SurfaceHolder sh = androidView.getHolder(); @@ -280,7 +281,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { @Override protected final boolean canCreateNativeImpl() { Log.d(MD.TAG, "canCreateNativeImpl.0: surfaceHandle ready "+(0!=surfaceHandle)+" - on thread "+Thread.currentThread().getName()); - if(WindowImpl.DEBUG_IMPLEMENTATION) { + if(Window.DEBUG_IMPLEMENTATION) { Thread.dumpStack(); } @@ -308,7 +309,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { Log.d(MD.TAG, "canCreateNativeImpl: added to static ViewGroup - on thread "+Thread.currentThread().getName()); } }); for(long sleep = TIMEOUT_NATIVEWINDOW; 0<sleep && 0 == surfaceHandle; sleep-=10 ) { - try { Thread.sleep(10); } catch (InterruptedException ie) {} + try { Thread.sleep(10); } catch (final InterruptedException ie) {} } b = 0 != surfaceHandle; Log.d(MD.TAG, "canCreateNativeImpl: surfaceHandle ready(2) "+b+" - on thread "+Thread.currentThread().getName()); @@ -384,7 +385,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { ", format [a "+androidFormat+", n "+nativeFormat+"], win["+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+ "], pixel["+getSurfaceWidth()+"x"+getSurfaceHeight()+"],"+ " - on thread "+Thread.currentThread().getName()); - if(WindowImpl.DEBUG_IMPLEMENTATION) { + if(Window.DEBUG_IMPLEMENTATION) { Thread.dumpStack(); } @@ -395,7 +396,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { if (!EGL.eglDestroySurface(eglDevice.getHandle(), eglSurface)) { throw new GLException("Error destroying window surface (eglDestroySurface)"); } - } catch (Throwable t) { + } catch (final Throwable t) { Log.d(MD.TAG, "closeNativeImpl: Catch exception "+t.getMessage()); t.printStackTrace(); } finally { @@ -437,12 +438,12 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { * {@inheritDoc} */ @Override - public final void focusChanged(boolean defer, boolean focusGained) { + public final void focusChanged(final boolean defer, final boolean focusGained) { super.focusChanged(defer, focusGained); } @Override - protected final void requestFocusImpl(boolean reparented) { + protected final void requestFocusImpl(final boolean reparented) { if(null != androidView) { Log.d(MD.TAG, "requestFocusImpl: reparented "+reparented); androidView.post(new Runnable() { @@ -455,7 +456,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { } @Override - protected final boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) { + protected final boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, final int flags) { boolean res = true; if( 0 != ( FLAG_CHANGE_FULLSCREEN & flags) ) { @@ -485,12 +486,12 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { } @Override - protected final Point getLocationOnScreenImpl(int x, int y) { + protected final Point getLocationOnScreenImpl(final int x, final int y) { return new Point(x,y); } @Override - protected final void updateInsetsImpl(Insets insets) { + protected final void updateInsetsImpl(final Insets insets) { // nop .. } @@ -504,7 +505,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { } @Override - public void onReceiveResult(int r, Bundle data) { + public void onReceiveResult(final int r, final Bundle data) { boolean v = false; switch(r) { @@ -524,7 +525,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { private final KeyboardVisibleReceiver keyboardVisibleReceiver = new KeyboardVisibleReceiver(); @Override - protected final boolean setKeyboardVisibleImpl(boolean visible) { + protected final boolean setKeyboardVisibleImpl(final boolean visible) { if(null != androidView) { final InputMethodManager imm = (InputMethodManager) getAndroidView().getContext().getSystemService(Context.INPUT_METHOD_SERVICE); final IBinder winid = getAndroidView().getWindowToken(); @@ -547,15 +548,15 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { // @Override - public final void surfaceCreated(SurfaceHolder holder) { + public final void surfaceCreated(final SurfaceHolder holder) { Log.d(MD.TAG, "surfaceCreated: win["+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+ "], pixels["+" "+getSurfaceWidth()+"x"+getSurfaceHeight()+"] - on thread "+Thread.currentThread().getName()); } @Override - public final void surfaceChanged(SurfaceHolder aHolder, int aFormat, int aWidth, int aHeight) { + public final void surfaceChanged(final SurfaceHolder aHolder, final int aFormat, final int aWidth, final int aHeight) { Log.d(MD.TAG, "surfaceChanged: f "+nativeFormat+" -> "+aFormat+", "+aWidth+"x"+aHeight+", current surfaceHandle: 0x"+Long.toHexString(surfaceHandle)+" - on thread "+Thread.currentThread().getName()); - if(WindowImpl.DEBUG_IMPLEMENTATION) { + if(Window.DEBUG_IMPLEMENTATION) { Thread.dumpStack(); } if(0!=surfaceHandle && androidFormat != aFormat ) { @@ -607,19 +608,19 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { } @Override - public final void surfaceDestroyed(SurfaceHolder holder) { + public final void surfaceDestroyed(final SurfaceHolder holder) { Log.d(MD.TAG, "surfaceDestroyed - on thread "+Thread.currentThread().getName()); windowDestroyNotify(true); // actually too late .. however .. Thread.dumpStack(); } @Override - public final void surfaceRedrawNeeded(SurfaceHolder holder) { + public final void surfaceRedrawNeeded(final SurfaceHolder holder) { Log.d(MD.TAG, "surfaceRedrawNeeded - on thread "+Thread.currentThread().getName()); windowRepaint(0, 0, getSurfaceWidth(), getSurfaceHeight()); } - protected boolean handleKeyCodeBack(KeyEvent.DispatcherState state, android.view.KeyEvent event) { + protected boolean handleKeyCodeBack(final KeyEvent.DispatcherState state, final android.view.KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) { Log.d(MD.TAG, "handleKeyCodeBack.0 : "+event); state.startTracking(event, this); @@ -646,7 +647,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { } return false; // continue w/ further processing } - private void enqueueAKey2NKeyUpDown(android.view.KeyEvent aEvent, short newtKeyCode) { + private void enqueueAKey2NKeyUpDown(final android.view.KeyEvent aEvent, final short newtKeyCode) { final com.jogamp.newt.event.KeyEvent eDown = AndroidNewtEventFactory.createKeyEvent(aEvent, newtKeyCode, com.jogamp.newt.event.KeyEvent.EVENT_KEY_PRESSED, this); final com.jogamp.newt.event.KeyEvent eUp = AndroidNewtEventFactory.createKeyEvent(aEvent, newtKeyCode, com.jogamp.newt.event.KeyEvent.EVENT_KEY_RELEASED, this); enqueueEvent(false, eDown); @@ -654,7 +655,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { } @Override - protected void consumeKeyEvent(com.jogamp.newt.event.KeyEvent e) { + protected void consumeKeyEvent(final com.jogamp.newt.event.KeyEvent e) { super.consumeKeyEvent(e); // consume event, i.e. call all KeyListener if( com.jogamp.newt.event.KeyEvent.EVENT_KEY_RELEASED == e.getEventType() && !e.isConsumed() ) { if( com.jogamp.newt.event.KeyEvent.VK_ESCAPE == e.getKeyCode() ) { @@ -667,11 +668,11 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { } } private void triggerHome() { - Context ctx = StaticContext.getContext(); + final Context ctx = StaticContext.getContext(); if(null == ctx) { throw new NativeWindowException("No static [Application] Context has been set. Call StaticContext.setContext(Context) first."); } - Intent showOptions = new Intent(Intent.ACTION_MAIN); + final Intent showOptions = new Intent(Intent.ACTION_MAIN); showOptions.addCategory(Intent.CATEGORY_HOME); ctx.startActivity(showOptions); } @@ -686,14 +687,14 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { private long eglSurface; class MSurfaceView extends SurfaceView { - public MSurfaceView (Context ctx) { + public MSurfaceView (final Context ctx) { super(ctx); setBackgroundDrawable(null); // setBackgroundColor(Color.TRANSPARENT); } @Override - public boolean onKeyPreIme(int keyCode, KeyEvent event) { + public boolean onKeyPreIme(final int keyCode, final KeyEvent event) { Log.d(MD.TAG, "onKeyPreIme : "+event); if ( event.getKeyCode() == KeyEvent.KEYCODE_BACK ) { final KeyEvent.DispatcherState state = getKeyDispatcherState(); diff --git a/src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventFactory.java b/src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventFactory.java index aef822262..05191e200 100644 --- a/src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventFactory.java +++ b/src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventFactory.java @@ -43,7 +43,7 @@ public class AndroidNewtEventFactory { /** API Level 12: {@link android.view.MotionEvent#ACTION_SCROLL} = {@value} */ private static final int ACTION_SCROLL = 8; - private static final com.jogamp.newt.event.MouseEvent.PointerType aToolType2PointerType(int aToolType) { + private static final com.jogamp.newt.event.MouseEvent.PointerType aToolType2PointerType(final int aToolType) { switch( aToolType ) { case MotionEvent.TOOL_TYPE_FINGER: return com.jogamp.newt.event.MouseEvent.PointerType.TouchScreen; @@ -57,7 +57,7 @@ public class AndroidNewtEventFactory { } } - private static final short aMotionEventType2Newt(int aType) { + private static final short aMotionEventType2Newt(final int aType) { switch( aType ) { case android.view.MotionEvent.ACTION_DOWN: case android.view.MotionEvent.ACTION_POINTER_DOWN: @@ -79,7 +79,7 @@ public class AndroidNewtEventFactory { return (short)0; } - private static final short aAccessibilityEventType2Newt(int aType) { + private static final short aAccessibilityEventType2Newt(final int aType) { switch( aType ) { case android.view.accessibility.AccessibilityEvent.TYPE_VIEW_FOCUSED: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_GAINED_FOCUS; @@ -87,7 +87,7 @@ public class AndroidNewtEventFactory { return (short)0; } - private static final short aKeyEventType2NewtEventType(int androidKeyAction) { + private static final short aKeyEventType2NewtEventType(final int androidKeyAction) { switch(androidKeyAction) { case android.view.KeyEvent.ACTION_DOWN: case android.view.KeyEvent.ACTION_MULTIPLE: @@ -98,7 +98,7 @@ public class AndroidNewtEventFactory { return (short)0; } - private static final short aKeyCode2NewtKeyCode(int androidKeyCode, boolean inclSysKeys) { + private static final short aKeyCode2NewtKeyCode(final int androidKeyCode, final boolean inclSysKeys) { if(android.view.KeyEvent.KEYCODE_0 <= androidKeyCode && androidKeyCode <= android.view.KeyEvent.KEYCODE_9) { return (short) ( com.jogamp.newt.event.KeyEvent.VK_0 + ( androidKeyCode - android.view.KeyEvent.KEYCODE_0 ) ); } @@ -156,7 +156,7 @@ public class AndroidNewtEventFactory { return com.jogamp.newt.event.KeyEvent.VK_UNDEFINED; } - private static final int aKeyModifiers2Newt(int androidMods) { + private static final int aKeyModifiers2Newt(final int androidMods) { int newtMods = 0; if ((androidMods & android.view.KeyEvent.META_SYM_ON) != 0) newtMods |= com.jogamp.newt.event.InputEvent.META_MASK; if ((androidMods & android.view.KeyEvent.META_SHIFT_ON) != 0) newtMods |= com.jogamp.newt.event.InputEvent.SHIFT_MASK; @@ -165,7 +165,7 @@ public class AndroidNewtEventFactory { return newtMods; } - public static com.jogamp.newt.event.WindowEvent createWindowEvent(android.view.accessibility.AccessibilityEvent event, com.jogamp.newt.Window newtSource) { + public static com.jogamp.newt.event.WindowEvent createWindowEvent(final android.view.accessibility.AccessibilityEvent event, final com.jogamp.newt.Window newtSource) { final int aType = event.getEventType(); final short nType = aAccessibilityEventType2Newt(aType); @@ -176,7 +176,7 @@ public class AndroidNewtEventFactory { } - public static com.jogamp.newt.event.KeyEvent createKeyEvent(android.view.KeyEvent aEvent, com.jogamp.newt.Window newtSource, boolean inclSysKeys) { + public static com.jogamp.newt.event.KeyEvent createKeyEvent(final android.view.KeyEvent aEvent, final com.jogamp.newt.Window newtSource, final boolean inclSysKeys) { final com.jogamp.newt.event.KeyEvent res; final short newtType = aKeyEventType2NewtEventType(aEvent.getAction()); if( (short)0 != newtType) { @@ -191,7 +191,7 @@ public class AndroidNewtEventFactory { return res; } - public static com.jogamp.newt.event.KeyEvent createKeyEvent(android.view.KeyEvent aEvent, short newtType, com.jogamp.newt.Window newtSource, boolean inclSysKeys) { + public static com.jogamp.newt.event.KeyEvent createKeyEvent(final android.view.KeyEvent aEvent, final short newtType, final com.jogamp.newt.Window newtSource, final boolean inclSysKeys) { final short newtKeyCode = aKeyCode2NewtKeyCode(aEvent.getKeyCode(), inclSysKeys); final com.jogamp.newt.event.KeyEvent res = createKeyEventImpl(aEvent, newtType, newtKeyCode, newtSource); if(DEBUG_KEY_EVENT) { @@ -200,7 +200,7 @@ public class AndroidNewtEventFactory { return res; } - public static com.jogamp.newt.event.KeyEvent createKeyEvent(android.view.KeyEvent aEvent, short newtKeyCode, short newtType, com.jogamp.newt.Window newtSource) { + public static com.jogamp.newt.event.KeyEvent createKeyEvent(final android.view.KeyEvent aEvent, final short newtKeyCode, final short newtType, final com.jogamp.newt.Window newtSource) { final com.jogamp.newt.event.KeyEvent res = createKeyEventImpl(aEvent, newtType, newtKeyCode, newtSource); if(DEBUG_KEY_EVENT) { System.err.println("createKeyEvent2: newtType "+NEWTEvent.toHexString(newtType)+", "+aEvent+" -> "+res); @@ -208,7 +208,7 @@ public class AndroidNewtEventFactory { return res; } - private static com.jogamp.newt.event.KeyEvent createKeyEventImpl(android.view.KeyEvent aEvent, short newtType, short newtKeyCode, com.jogamp.newt.Window newtSource) { + private static com.jogamp.newt.event.KeyEvent createKeyEventImpl(final android.view.KeyEvent aEvent, final short newtType, final short newtKeyCode, final com.jogamp.newt.Window newtSource) { if( (short)0 != newtType && com.jogamp.newt.event.KeyEvent.VK_UNDEFINED != newtKeyCode ) { final Object src = null==newtSource ? null : newtSource; final long unixTime = System.currentTimeMillis() + ( aEvent.getEventTime() - android.os.SystemClock.uptimeMillis() ); @@ -243,7 +243,7 @@ public class AndroidNewtEventFactory { } private final int touchSlop; - public AndroidNewtEventFactory(android.content.Context context, android.os.Handler handler) { + public AndroidNewtEventFactory(final android.content.Context context, final android.os.Handler handler) { final android.view.ViewConfiguration configuration = android.view.ViewConfiguration.get(context); touchSlop = configuration.getScaledTouchSlop(); final int doubleTapSlop = configuration.getScaledDoubleTapSlop(); @@ -253,7 +253,7 @@ public class AndroidNewtEventFactory { } } - private static void collectPointerData(MotionEvent e, int count, final int[] x, final int[] y, final float[] pressure, + private static void collectPointerData(final MotionEvent e, final int count, final int[] x, final int[] y, final float[] pressure, final short[] pointerIds, final MouseEvent.PointerType[] pointerTypes) { for(int i=0; i < count; i++) { x[i] = (int)e.getX(i); @@ -270,8 +270,8 @@ public class AndroidNewtEventFactory { } } - public boolean sendPointerEvent(boolean enqueue, boolean wait, boolean setFocusOnDown, boolean isOnTouchEvent, - android.view.MotionEvent event, jogamp.newt.driver.android.WindowDriver newtSource) { + public boolean sendPointerEvent(final boolean enqueue, final boolean wait, final boolean setFocusOnDown, final boolean isOnTouchEvent, + final android.view.MotionEvent event, final jogamp.newt.driver.android.WindowDriver newtSource) { if(DEBUG_MOUSE_EVENT) { System.err.println("createMouseEvent: isOnTouchEvent "+isOnTouchEvent+", "+event); } diff --git a/src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventTranslator.java b/src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventTranslator.java index 5a4743f73..8d20ef448 100644 --- a/src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventTranslator.java +++ b/src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventTranslator.java @@ -6,35 +6,35 @@ import android.view.View; public class AndroidNewtEventTranslator implements View.OnKeyListener, View.OnTouchListener, View.OnFocusChangeListener, View.OnGenericMotionListener { private final WindowDriver newtWindow; private final AndroidNewtEventFactory factory; - - public AndroidNewtEventTranslator(WindowDriver newtWindow, android.content.Context context, android.os.Handler handler) { + + public AndroidNewtEventTranslator(final WindowDriver newtWindow, final android.content.Context context, final android.os.Handler handler) { this.newtWindow = newtWindow; - this.factory = new AndroidNewtEventFactory(context, handler); + this.factory = new AndroidNewtEventFactory(context, handler); } - - private final boolean processTouchMotionEvents(View v, android.view.MotionEvent event, boolean isOnTouchEvent) { - final boolean eventSent = factory.sendPointerEvent(true /*enqueue*/, false /*wait*/, true /*setFocusOnDown*/, + + private final boolean processTouchMotionEvents(final View v, final android.view.MotionEvent event, final boolean isOnTouchEvent) { + final boolean eventSent = factory.sendPointerEvent(true /*enqueue*/, false /*wait*/, true /*setFocusOnDown*/, isOnTouchEvent, event, newtWindow); if( eventSent ) { try { Thread.sleep((long) (100.0F/3.0F)); } // 33 ms - FIXME ?? - catch(InterruptedException e) { } + catch(final InterruptedException e) { } return true; // consumed/handled, further interest in events } - return false; // no mapping, no further interest in the event! + return false; // no mapping, no further interest in the event! } - + @Override - public boolean onTouch(View v, android.view.MotionEvent event) { + public boolean onTouch(final View v, final android.view.MotionEvent event) { return processTouchMotionEvents(v, event, true); } @Override - public boolean onGenericMotion(View v, android.view.MotionEvent event) { + public boolean onGenericMotion(final View v, final android.view.MotionEvent event) { return processTouchMotionEvents(v, event, false); } - + @Override - public boolean onKey(View v, int keyCode, android.view.KeyEvent event) { + public boolean onKey(final View v, final int keyCode, final android.view.KeyEvent event) { final com.jogamp.newt.event.KeyEvent newtEvent = AndroidNewtEventFactory.createKeyEvent(event, newtWindow, false /* no system keys */); if(null != newtEvent) { newtWindow.enqueueEvent(false, newtEvent); @@ -42,9 +42,9 @@ public class AndroidNewtEventTranslator implements View.OnKeyListener, View.OnTo } return false; } - + @Override - public void onFocusChange(View v, boolean hasFocus) { + public void onFocusChange(final View v, final boolean hasFocus) { newtWindow.focusChanged(false, hasFocus); } } diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java b/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java index 540d9b7e8..eccdd63cf 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java +++ b/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java @@ -75,7 +75,7 @@ public class AWTCanvas extends Canvas { private boolean displayConfigChanged=false; - public AWTCanvas(CapabilitiesImmutable capabilities, CapabilitiesChooser chooser, UpstreamScalable upstreamScale) { + public AWTCanvas(final CapabilitiesImmutable capabilities, final CapabilitiesChooser chooser, final UpstreamScalable upstreamScale) { super(); if(null==capabilities) { @@ -95,7 +95,7 @@ public class AWTCanvas extends Canvas { * canvas from interfering with the OpenGL rendering. */ @Override - public void update(Graphics g) { + public void update(final Graphics g) { // paint(g); } @@ -105,11 +105,11 @@ public class AWTCanvas extends Canvas { properly. */ @Override - public void paint(Graphics g) { + public void paint(final Graphics g) { } public boolean hasDeviceChanged() { - boolean res = displayConfigChanged; + final boolean res = displayConfigChanged; displayConfigChanged=false; return res; } @@ -152,7 +152,7 @@ public class AWTCanvas extends Canvas { jawtWindow.unlockSurface(); } - GraphicsConfiguration gc = super.getGraphicsConfiguration(); + final GraphicsConfiguration gc = super.getGraphicsConfiguration(); if(null!=gc) { device = gc.getDevice(); } @@ -188,12 +188,12 @@ public class AWTCanvas extends Canvas { jawtWindow=null; } if(null != awtConfig) { - AbstractGraphicsDevice adevice = awtConfig.getNativeGraphicsConfiguration().getScreen().getDevice(); + final AbstractGraphicsDevice adevice = awtConfig.getNativeGraphicsConfiguration().getScreen().getDevice(); String adeviceMsg=null; if(Window.DEBUG_IMPLEMENTATION) { adeviceMsg = adevice.toString(); } - boolean closed = adevice.close(); + final boolean closed = adevice.close(); if(Window.DEBUG_IMPLEMENTATION) { System.err.println(getThreadName()+": AWTCanvas.dispose(): closed GraphicsDevice: "+adeviceMsg+", result: "+closed); } @@ -255,11 +255,11 @@ public class AWTCanvas extends Canvas { * block, both devices should have the same visual list, and the * same configuration should be selected here. */ - AWTGraphicsConfiguration config = chooseGraphicsConfiguration( + final AWTGraphicsConfiguration config = chooseGraphicsConfiguration( awtConfig.getChosenCapabilities(), awtConfig.getRequestedCapabilities(), chooser, gc.getDevice()); final GraphicsConfiguration compatible = (null!=config)?config.getAWTGraphicsConfiguration():null; if(Window.DEBUG_IMPLEMENTATION) { - Exception e = new Exception("Info: Call Stack: "+Thread.currentThread().getName()); + final Exception e = new Exception("Info: Call Stack: "+Thread.currentThread().getName()); e.printStackTrace(); System.err.println("Created Config (n): HAVE GC "+chosen); System.err.println("Created Config (n): THIS GC "+gc); @@ -307,14 +307,14 @@ public class AWTCanvas extends Canvas { return gc; } - private static AWTGraphicsConfiguration chooseGraphicsConfiguration(CapabilitiesImmutable capsChosen, - CapabilitiesImmutable capsRequested, - CapabilitiesChooser chooser, - GraphicsDevice device) { + private static AWTGraphicsConfiguration chooseGraphicsConfiguration(final CapabilitiesImmutable capsChosen, + final CapabilitiesImmutable capsRequested, + final CapabilitiesChooser chooser, + final GraphicsDevice device) { final AbstractGraphicsScreen aScreen = null != device ? AWTGraphicsScreen.createScreenDevice(device, AbstractGraphicsDevice.DEFAULT_UNIT): AWTGraphicsScreen.createDefault(); - AWTGraphicsConfiguration config = (AWTGraphicsConfiguration) + final AWTGraphicsConfiguration config = (AWTGraphicsConfiguration) GraphicsConfigurationFactory.getFactory(AWTGraphicsDevice.class, capsChosen.getClass()).chooseGraphicsConfiguration(capsChosen, capsRequested, chooser, aScreen, VisualIDHolder.VID_UNDEFINED); @@ -346,16 +346,16 @@ public class AWTCanvas extends Canvas { clazz.getDeclaredMethod("disableBackgroundErase", new Class[] { Canvas.class }); disableBackgroundEraseMethod.setAccessible(true); - } catch (Exception e) { + } catch (final Exception e) { clazz = clazz.getSuperclass(); } } - } catch (Exception e) { + } catch (final Exception e) { } return null; } }); - } catch (Exception e) { + } catch (final Exception e) { } disableBackgroundEraseInitialized = true; if(Window.DEBUG_IMPLEMENTATION) { @@ -367,7 +367,7 @@ public class AWTCanvas extends Canvas { Throwable t=null; try { disableBackgroundEraseMethod.invoke(getToolkit(), new Object[] { this }); - } catch (Exception e) { + } catch (final Exception e) { // FIXME: workaround for 6504460 (incorrect backport of 6333613 in 5.0u10) // throw new GLException(e); t = e; diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java index 407d3abf9..c961669e8 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java +++ b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java @@ -49,7 +49,7 @@ public class AWTEDTUtil implements EDTUtil { private int start_iter=0; private static long pollPeriod = EDTUtil.defaultEDTPollPeriod; - public AWTEDTUtil(ThreadGroup tg, String name, Runnable dispatchMessages) { + public AWTEDTUtil(final ThreadGroup tg, final String name, final Runnable dispatchMessages) { this.threadGroup = tg; this.name=Thread.currentThread().getName()+"-"+name+"-EDT-"; this.dispatchMessages=dispatchMessages; @@ -63,7 +63,7 @@ public class AWTEDTUtil implements EDTUtil { } @Override - final public void setPollPeriod(long ms) { + final public void setPollPeriod(final long ms) { pollPeriod = ms; } @@ -121,16 +121,16 @@ public class AWTEDTUtil implements EDTUtil { } @Override - public final boolean invokeStop(boolean wait, Runnable task) { + public final boolean invokeStop(final boolean wait, final Runnable task) { return invokeImpl(wait, task, true); } @Override - public final boolean invoke(boolean wait, Runnable task) { + public final boolean invoke(final boolean wait, final Runnable task) { return invokeImpl(wait, task, false); } - private final boolean invokeImpl(boolean wait, Runnable task, boolean stop) { + private final boolean invokeImpl(boolean wait, final Runnable task, final boolean stop) { Throwable throwable = null; RunnableTask rTask = null; final Object rTaskLock = new Object(); @@ -187,7 +187,7 @@ public class AWTEDTUtil implements EDTUtil { if( wait ) { try { rTaskLock.wait(); // free lock, allow execution of rTask - } catch (InterruptedException ie) { + } catch (final InterruptedException ie) { throwable = ie; } if(null==throwable) { @@ -218,7 +218,7 @@ public class AWTEDTUtil implements EDTUtil { @Override public void run() { } }); - } catch (Exception e) { } + } catch (final Exception e) { } return true; } @@ -229,7 +229,7 @@ public class AWTEDTUtil implements EDTUtil { while( nedt.isRunning ) { try { edtLock.wait(); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } } @@ -245,7 +245,7 @@ public class AWTEDTUtil implements EDTUtil { volatile boolean isRunning = false; Object sync = new Object(); - public NEDT(ThreadGroup tg, String name) { + public NEDT(final ThreadGroup tg, final String name) { super(tg, name); } @@ -284,13 +284,13 @@ public class AWTEDTUtil implements EDTUtil { if(!shouldStop) { try { sync.wait(pollPeriod); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } } } } while(!shouldStop) ; - } catch (Throwable t) { + } catch (final Throwable t) { // handle errors .. shouldStop = true; if(t instanceof RuntimeException) { diff --git a/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java index d9a4a48e5..23da69dba 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java @@ -51,7 +51,7 @@ public class DisplayDriver extends DisplayImpl { aDevice = AWTGraphicsDevice.createDefault(); } - protected void setAWTGraphicsDevice(AWTGraphicsDevice d) { + protected void setAWTGraphicsDevice(final AWTGraphicsDevice d) { aDevice = d; } @@ -70,7 +70,7 @@ public class DisplayDriver extends DisplayImpl { } @Override - protected void closeNativeImpl(AbstractGraphicsDevice aDevice) { + protected void closeNativeImpl(final AbstractGraphicsDevice aDevice) { aDevice.close(); } diff --git a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java index 128c94e87..57948cfc3 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java @@ -54,7 +54,7 @@ public class ScreenDriver extends ScreenImpl { aScreen = new AWTGraphicsScreen((AWTGraphicsDevice)display.getGraphicsDevice()); } - protected void setAWTGraphicsScreen(AWTGraphicsScreen s) { + protected void setAWTGraphicsScreen(final AWTGraphicsScreen s) { aScreen = s; } @@ -70,11 +70,11 @@ public class ScreenDriver extends ScreenImpl { protected void closeNativeImpl() { } @Override - protected int validateScreenIndex(int idx) { + protected int validateScreenIndex(final int idx) { return idx; // pass through ... } - private static MonitorMode getModeProps(Cache cache, DisplayMode mode) { + private static MonitorMode getModeProps(final Cache cache, final DisplayMode mode) { int rate = mode.getRefreshRate(); if( DisplayMode.REFRESH_RATE_UNKNOWN == rate ) { rate = ScreenImpl.default_sm_rate; @@ -83,7 +83,7 @@ public class ScreenDriver extends ScreenImpl { if( DisplayMode.BIT_DEPTH_MULTI == bpp ) { bpp= ScreenImpl.default_sm_bpp; } - int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ]; + final int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ]; int i = 0; props[i++] = MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL; props[i++] = mode.getWidth(); @@ -97,7 +97,7 @@ public class ScreenDriver extends ScreenImpl { } @Override - protected void collectNativeMonitorModesAndDevicesImpl(Cache cache) { + protected void collectNativeMonitorModesAndDevicesImpl(final Cache cache) { final GraphicsDevice awtGD = ((AWTGraphicsDevice)getDisplay().getGraphicsDevice()).getGraphicsDevice(); final DisplayMode[] awtModes = awtGD.getDisplayModes(); for(int i=0; i<awtModes.length; i++) { @@ -123,12 +123,12 @@ public class ScreenDriver extends ScreenImpl { } @Override - protected MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor) { + protected MonitorMode queryCurrentMonitorModeImpl(final MonitorDevice monitor) { return null; } @Override - protected boolean setCurrentMonitorModeImpl(MonitorDevice monitor, MonitorMode mode) { + protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) { return false; } diff --git a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java index 4064fdb05..06dcb8ff5 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java @@ -72,7 +72,7 @@ public class WindowDriver extends WindowImpl { return new Class<?>[] { Container.class } ; } - public WindowDriver(Container container) { + public WindowDriver(final Container container) { super(); this.awtContainer = container; if(container instanceof Frame) { @@ -87,7 +87,7 @@ public class WindowDriver extends WindowImpl { private AWTCanvas awtCanvas; @Override - protected void requestFocusImpl(boolean reparented) { + protected void requestFocusImpl(final boolean reparented) { awtContainer.requestFocus(); } @@ -174,7 +174,7 @@ public class WindowDriver extends WindowImpl { @Override public boolean hasDeviceChanged() { - boolean res = awtCanvas.hasDeviceChanged(); + final boolean res = awtCanvas.hasDeviceChanged(); if(res) { final AWTGraphicsConfiguration cfg = awtCanvas.getAWTGraphicsConfiguration(); if (null == cfg) { @@ -192,12 +192,12 @@ public class WindowDriver extends WindowImpl { } @Override - protected void updateInsetsImpl(javax.media.nativewindow.util.Insets insets) { + protected void updateInsetsImpl(final javax.media.nativewindow.util.Insets insets) { final Insets contInsets = awtContainer.getInsets(); insets.set(contInsets.left, contInsets.right, contInsets.top, contInsets.bottom); } - private void setCanvasSizeImpl(int width, int height) { + private void setCanvasSizeImpl(final int width, final int height) { final Dimension szClient = new Dimension(width, height); final java.awt.Window awtWindow = AWTMisc.getWindow(awtCanvas); final Container c= null != awtWindow ? awtWindow : awtContainer; @@ -217,7 +217,7 @@ public class WindowDriver extends WindowImpl { awtContainer.validate(); } } - private void setFrameSizeImpl(int width, int height) { + private void setFrameSizeImpl(final int width, final int height) { final Insets insets = awtContainer.getInsets(); final Dimension szContainer = new Dimension(width + insets.left + insets.right, height + insets.top + insets.bottom); @@ -231,7 +231,7 @@ public class WindowDriver extends WindowImpl { } @Override - protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) { + protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, final int flags) { if(DEBUG_IMPLEMENTATION) { System.err.println("AWTWindow reconfig: "+x+"/"+y+" "+width+"x"+height+", "+ getReconfigureFlagsAsString(null, flags)); @@ -284,8 +284,8 @@ public class WindowDriver extends WindowImpl { } @Override - protected Point getLocationOnScreenImpl(int x, int y) { - java.awt.Point ap = awtCanvas.getLocationOnScreen(); + protected Point getLocationOnScreenImpl(final int x, final int y) { + final java.awt.Point ap = awtCanvas.getLocationOnScreen(); ap.translate(x, y); return new Point((int)(ap.getX()+0.5),(int)(ap.getY()+0.5)); } @@ -297,13 +297,13 @@ public class WindowDriver extends WindowImpl { class LocalWindowListener implements com.jogamp.newt.event.WindowListener { @Override - public void windowMoved(com.jogamp.newt.event.WindowEvent e) { + public void windowMoved(final com.jogamp.newt.event.WindowEvent e) { if(null!=awtContainer) { WindowDriver.this.positionChanged(false, awtContainer.getX(), awtContainer.getY()); } } @Override - public void windowResized(com.jogamp.newt.event.WindowEvent e) { + public void windowResized(final com.jogamp.newt.event.WindowEvent e) { if(null!=awtCanvas) { if(DEBUG_IMPLEMENTATION) { System.err.println("Window Resized: "+awtCanvas); @@ -313,23 +313,23 @@ public class WindowDriver extends WindowImpl { } } @Override - public void windowDestroyNotify(WindowEvent e) { + public void windowDestroyNotify(final WindowEvent e) { WindowDriver.this.windowDestroyNotify(false); } @Override - public void windowDestroyed(WindowEvent e) { + public void windowDestroyed(final WindowEvent e) { // Not fwd by AWTWindowAdapter, synthesized by NEWT } @Override - public void windowGainedFocus(WindowEvent e) { + public void windowGainedFocus(final WindowEvent e) { WindowDriver.this.focusChanged(false, true); } @Override - public void windowLostFocus(WindowEvent e) { + public void windowLostFocus(final WindowEvent e) { WindowDriver.this.focusChanged(false, false); } @Override - public void windowRepaint(WindowUpdateEvent e) { + public void windowRepaint(final WindowUpdateEvent e) { if(null!=awtCanvas) { if(DEBUG_IMPLEMENTATION) { System.err.println("Window Repaint: "+awtCanvas); diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java index d1b30f7cc..ceb337150 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java @@ -70,7 +70,7 @@ public class DisplayDriver extends jogamp.newt.DisplayImpl { } @Override - protected void closeNativeImpl(AbstractGraphicsDevice aDevice) { + protected void closeNativeImpl(final AbstractGraphicsDevice aDevice) { if (aDevice.getHandle() != EGL.EGL_NO_DISPLAY) { DestroyDisplay(aDevice.getHandle()); } diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java index efedf7c7a..fab3fe882 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java @@ -62,12 +62,12 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { protected void closeNativeImpl() { } @Override - protected int validateScreenIndex(int idx) { + protected int validateScreenIndex(final int idx) { return 0; // only one screen available } @Override - protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) { + protected final void collectNativeMonitorModesAndDevicesImpl(final MonitorModeProps.Cache cache) { int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ]; int i = 0; props[i++] = MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL; @@ -108,7 +108,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { } @Override - protected void calcVirtualScreenOriginAndSize(Rectangle viewport, Rectangle viewportInWindowUnits) { + protected void calcVirtualScreenOriginAndSize(final Rectangle viewport, final Rectangle viewportInWindowUnits) { viewport.set(0, 0, fixedWidth, fixedHeight); // FIXME } diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java index 64b856707..aec85f875 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java @@ -82,9 +82,9 @@ public class WindowDriver extends jogamp.newt.WindowImpl { } @Override - protected void requestFocusImpl(boolean reparented) { } + protected void requestFocusImpl(final boolean reparented) { } - protected void setSizeImpl(int width, int height) { + protected void setSizeImpl(final int width, final int height) { if(0!=getWindowHandle()) { // n/a in BroadcomEGL System.err.println("BCEGL Window.setSizeImpl n/a in BroadcomEGL with realized window"); @@ -94,7 +94,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl { } @Override - protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) { + protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, final int flags) { if(0!=getWindowHandle()) { if(0 != ( FLAG_CHANGE_FULLSCREEN & flags)) { if( 0 != ( FLAG_IS_FULLSCREEN & flags) ) { @@ -123,12 +123,12 @@ public class WindowDriver extends jogamp.newt.WindowImpl { } @Override - protected Point getLocationOnScreenImpl(int x, int y) { + protected Point getLocationOnScreenImpl(final int x, final int y) { return new Point(x,y); } @Override - protected void updateInsetsImpl(Insets insets) { + protected void updateInsetsImpl(final Insets insets) { // nop .. } @@ -148,11 +148,11 @@ public class WindowDriver extends jogamp.newt.WindowImpl { private native void SwapWindow(long eglDisplayHandle, long eglWindowHandle); - private long realizeWindow(boolean chromaKey, int width, int height) { + private long realizeWindow(final boolean chromaKey, final int width, final int height) { if(DEBUG_IMPLEMENTATION) { System.err.println("BCEGL Window.realizeWindow() with: chroma "+chromaKey+", "+width+"x"+height+", "+getGraphicsConfiguration()); } - long handle = CreateWindow(getDisplayHandle(), chromaKey, width, height); + final long handle = CreateWindow(getDisplayHandle(), chromaKey, width, height); if (0 == handle) { throw new NativeWindowException("Error native Window Handle is null"); } @@ -160,9 +160,9 @@ public class WindowDriver extends jogamp.newt.WindowImpl { return handle; } - private void windowCreated(int cfgID, int width, int height) { + private void windowCreated(final int cfgID, final int width, final int height) { defineSize(width, height); - GLCapabilitiesImmutable capsReq = (GLCapabilitiesImmutable) getGraphicsConfiguration().getRequestedCapabilities(); + final GLCapabilitiesImmutable capsReq = (GLCapabilitiesImmutable) getGraphicsConfiguration().getRequestedCapabilities(); final AbstractGraphicsConfiguration cfg = EGLGraphicsConfiguration.create(capsReq, getScreen().getGraphicsScreen(), cfgID); if (null == cfg) { throw new NativeWindowException("Error creating EGLGraphicsConfiguration from id: "+cfgID+", "+this); diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java index 178bb70f7..1b67fa755 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java @@ -69,7 +69,7 @@ public class DisplayDriver extends DisplayImpl { try { final URLConnection urlConn = res.resolve(0); image = PNGPixelRect.read(urlConn.getInputStream(), PixelFormat.BGRA8888, false /* directBuffer */, 0 /* destMinStrideInBytes */, false /* destIsGLOriented */); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } @@ -106,7 +106,7 @@ public class DisplayDriver extends DisplayImpl { private PointerIconImpl defaultPointerIcon = null; @Override - protected void closeNativeImpl(AbstractGraphicsDevice aDevice) { + protected void closeNativeImpl(final AbstractGraphicsDevice aDevice) { aDevice.close(); CloseBCMDisplay0(bcmHandle); bcmHandle = 0; @@ -123,12 +123,12 @@ public class DisplayDriver extends DisplayImpl { // public final PixelFormat getNativePointerIconPixelFormat() { return PixelFormat.BGRA8888; } @Override - protected final long createPointerIconImpl(PixelFormat pixelformat, int width, int height, final ByteBuffer pixels, final int hotX, final int hotY) { + protected final long createPointerIconImpl(final PixelFormat pixelformat, final int width, final int height, final ByteBuffer pixels, final int hotX, final int hotY) { return CreatePointerIcon(bcmHandle, pixels, width, height, hotX, hotY); } @Override - protected final void destroyPointerIconImpl(final long displayHandle, long piHandle) { + protected final void destroyPointerIconImpl(final long displayHandle, final long piHandle) { DestroyPointerIcon0(piHandle); } @@ -187,7 +187,7 @@ public class DisplayDriver extends DisplayImpl { private static native long OpenBCMDisplay0(); private static native void CloseBCMDisplay0(long handle); - private static long CreatePointerIcon(long bcmHandle, Buffer pixels, int width, int height, int hotX, int hotY) { + private static long CreatePointerIcon(final long bcmHandle, final Buffer pixels, final int width, final int height, final int hotX, final int hotY) { final boolean pixels_is_direct = Buffers.isDirect(pixels); return CreatePointerIcon0(pixels_is_direct ? pixels : Buffers.getArray(pixels), pixels_is_direct ? Buffers.getDirectBufferByteOffset(pixels) : Buffers.getIndirectBufferByteOffset(pixels), diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java index 404f03eed..5c1c08ca8 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java @@ -55,12 +55,12 @@ public class ScreenDriver extends ScreenImpl { protected void closeNativeImpl() { } @Override - protected int validateScreenIndex(int idx) { + protected int validateScreenIndex(final int idx) { return 0; // only one screen available } @Override - protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) { + protected final void collectNativeMonitorModesAndDevicesImpl(final MonitorModeProps.Cache cache) { int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ]; int i = 0; props[i++] = MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL; @@ -101,12 +101,12 @@ public class ScreenDriver extends ScreenImpl { } @Override - protected void calcVirtualScreenOriginAndSize(Rectangle viewport, Rectangle viewportInWindowUnits) { + protected void calcVirtualScreenOriginAndSize(final Rectangle viewport, final Rectangle viewportInWindowUnits) { viewport.set(0, 0, cachedWidth, cachedHeight); } /** Called from {@link #initNative()}. */ - protected void setScreenSize(int width, int height) { + protected void setScreenSize(final int width, final int height) { cachedWidth = width; cachedHeight = height; } diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java index b5e874f65..ad6d0b688 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java @@ -149,23 +149,23 @@ public class WindowDriver extends WindowImpl { } @Override - protected void requestFocusImpl(boolean reparented) { + protected void requestFocusImpl(final boolean reparented) { focusChanged(false, true); } @Override - protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) { + protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, final int flags) { reconfigure0(nativeWindowHandle, x, y, width, height, flags); return true; } @Override - protected Point getLocationOnScreenImpl(int x, int y) { + protected Point getLocationOnScreenImpl(final int x, final int y) { return new Point(x,y); } @Override - protected void updateInsetsImpl(Insets insets) { + protected void updateInsetsImpl(final Insets insets) { // nop .. } diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java index cc435540f..1d43017c3 100644 --- a/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java @@ -74,7 +74,7 @@ public class DisplayDriver extends jogamp.newt.DisplayImpl { } @Override - protected void closeNativeImpl(AbstractGraphicsDevice aDevice) { + protected void closeNativeImpl(final AbstractGraphicsDevice aDevice) { if(0==displayHandle) { throw new NativeWindowException("displayHandle null; initCnt "+initCounter); } @@ -96,7 +96,7 @@ public class DisplayDriver extends jogamp.newt.DisplayImpl { } } - protected void setFocus(WindowDriver focus) { + protected void setFocus(final WindowDriver focus) { focusedWindow = focus; } diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java index 89d7540da..b5400c386 100644 --- a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java @@ -55,7 +55,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { @Override protected void createNativeImpl() { - AbstractGraphicsDevice adevice = getDisplay().getGraphicsDevice(); + final AbstractGraphicsDevice adevice = getDisplay().getGraphicsDevice(); GetScreenInfo(adevice.getHandle(), screen_idx); aScreen = new DefaultGraphicsScreen(adevice, screen_idx); } @@ -64,12 +64,12 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { protected void closeNativeImpl() { } @Override - protected int validateScreenIndex(int idx) { + protected int validateScreenIndex(final int idx) { return 0; // only one screen available } @Override - protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) { + protected final void collectNativeMonitorModesAndDevicesImpl(final MonitorModeProps.Cache cache) { int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ]; int i = 0; props[i++] = MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL; @@ -110,7 +110,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { } @Override - protected void calcVirtualScreenOriginAndSize(Rectangle viewport, Rectangle viewportInWindowUnits) { + protected void calcVirtualScreenOriginAndSize(final Rectangle viewport, final Rectangle viewportInWindowUnits) { viewport.set(0, 0, cachedWidth, cachedHeight); } @@ -122,7 +122,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { private native void GetScreenInfo(long displayHandle, int screen_idx); // called by GetScreenInfo() .. - private void screenCreated(int width, int height) { + private void screenCreated(final int width, final int height) { cachedWidth = width; cachedHeight = height; } diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java index cf169f1c7..d7bd17e42 100644 --- a/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java @@ -86,8 +86,8 @@ public class WindowDriver extends jogamp.newt.WindowImpl { } @Override - protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) { - ScreenDriver screen = (ScreenDriver) getScreen(); + protected boolean reconfigureWindowImpl(int x, int y, int width, int height, final int flags) { + final ScreenDriver screen = (ScreenDriver) getScreen(); // Note for GDL: window units == pixel units if(width>screen.getWidth()) { @@ -118,7 +118,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl { } @Override - protected void requestFocusImpl(boolean reparented) { + protected void requestFocusImpl(final boolean reparented) { ((DisplayDriver)getScreen().getDisplay()).setFocus(this); } @@ -128,12 +128,12 @@ public class WindowDriver extends jogamp.newt.WindowImpl { } @Override - protected Point getLocationOnScreenImpl(int x, int y) { + protected Point getLocationOnScreenImpl(final int x, final int y) { return new Point(x,y); } @Override - protected void updateInsetsImpl(Insets insets) { + protected void updateInsetsImpl(final Insets insets) { // nop .. } @@ -146,7 +146,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl { private native void CloseSurface(long displayHandle, long surfaceHandle); private native void SetBounds0(long surfaceHandle, int scrn_width, int scrn_height, int x, int y, int width, int height); - private void updateBounds(int x, int y, int width, int height) { + private void updateBounds(final int x, final int y, final int width, final int height) { definePosition(x, y); defineSize(width, height); } diff --git a/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java index 6c706148a..e72ddbc11 100644 --- a/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java @@ -67,7 +67,7 @@ public class DisplayDriver extends DisplayImpl { } @Override - protected void closeNativeImpl(AbstractGraphicsDevice aDevice) { + protected void closeNativeImpl(final AbstractGraphicsDevice aDevice) { aDevice.close(); } diff --git a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java index 6245f3207..06485ccef 100644 --- a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java @@ -60,12 +60,12 @@ public class ScreenDriver extends ScreenImpl { protected void closeNativeImpl() { } @Override - protected int validateScreenIndex(int idx) { + protected int validateScreenIndex(final int idx) { return 0; // only one screen available } @Override - protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) { + protected final void collectNativeMonitorModesAndDevicesImpl(final MonitorModeProps.Cache cache) { int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ]; int i = 0; props[i++] = MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL; @@ -106,11 +106,11 @@ public class ScreenDriver extends ScreenImpl { } @Override - protected void calcVirtualScreenOriginAndSize(Rectangle viewport, Rectangle viewportInWindowUnits) { + protected void calcVirtualScreenOriginAndSize(final Rectangle viewport, final Rectangle viewportInWindowUnits) { viewport.set(0, 0, cachedWidth, cachedHeight); } - protected void sizeChanged(int w, int h) { + protected void sizeChanged(final int w, final int h) { cachedWidth = w; cachedHeight = h; } diff --git a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java index 158e6ab2f..d53ef00cd 100644 --- a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java @@ -68,9 +68,9 @@ public class WindowDriver extends WindowImpl { } setGraphicsConfiguration(cfg); - GLCapabilitiesImmutable eglCaps = (GLCapabilitiesImmutable) cfg.getChosenCapabilities(); - int eglConfigID = eglCaps.getVisualID(VIDType.EGL_CONFIG); - long eglConfig = EGLGraphicsConfiguration.EGLConfigId2EGLConfig(getDisplayHandle(), eglConfigID); + final GLCapabilitiesImmutable eglCaps = (GLCapabilitiesImmutable) cfg.getChosenCapabilities(); + final int eglConfigID = eglCaps.getVisualID(VIDType.EGL_CONFIG); + final long eglConfig = EGLGraphicsConfiguration.EGLConfigId2EGLConfig(getDisplayHandle(), eglConfigID); eglWindowHandle = CreateWindow(getDisplayHandle(), eglConfig); if (eglWindowHandle == 0) { @@ -93,10 +93,10 @@ public class WindowDriver extends WindowImpl { } @Override - protected void requestFocusImpl(boolean reparented) { } + protected void requestFocusImpl(final boolean reparented) { } @Override - protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) { + protected boolean reconfigureWindowImpl(final int x, final int y, int width, int height, final int flags) { if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) { setVisible0(eglWindowHandle, 0 != ( FLAG_IS_VISIBLE & flags)); visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags)); @@ -130,12 +130,12 @@ public class WindowDriver extends WindowImpl { } @Override - protected Point getLocationOnScreenImpl(int x, int y) { + protected Point getLocationOnScreenImpl(final int x, final int y) { return new Point(x,y); } @Override - protected void updateInsetsImpl(Insets insets) { + protected void updateInsetsImpl(final Insets insets) { // nop .. } @@ -151,12 +151,12 @@ public class WindowDriver extends WindowImpl { private native void setSize0(long eglWindowHandle, int width, int height); private native void setFullScreen0(long eglWindowHandle, boolean fullscreen); - private void windowCreated(long userData) { + private void windowCreated(final long userData) { windowUserData=userData; } @Override - protected void sizeChanged(boolean defer, int newWidth, int newHeight, boolean force) { + protected void sizeChanged(final boolean defer, final int newWidth, final int newHeight, final boolean force) { if(isFullscreen()) { ((ScreenDriver)getScreen()).sizeChanged(getWidth(), getHeight()); } diff --git a/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java b/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java index b7c86a26d..49a815cb6 100644 --- a/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java +++ b/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java @@ -72,7 +72,7 @@ public class LinuxEventDeviceTracker implements WindowListener { } private WindowImpl focusedWindow = null; - private EventDeviceManager eventDeviceManager = new EventDeviceManager(); + private final EventDeviceManager eventDeviceManager = new EventDeviceManager(); /* The devices are in /dev/input: @@ -85,56 +85,56 @@ public class LinuxEventDeviceTracker implements WindowListener { And so on up to event31. */ - private EventDevicePoller[] eventDevicePollers = new EventDevicePoller[32]; + private final EventDevicePoller[] eventDevicePollers = new EventDevicePoller[32]; @Override - public void windowResized(WindowEvent e) { } + public void windowResized(final WindowEvent e) { } @Override - public void windowMoved(WindowEvent e) { } + public void windowMoved(final WindowEvent e) { } @Override - public void windowDestroyNotify(WindowEvent e) { - Object s = e.getSource(); + public void windowDestroyNotify(final WindowEvent e) { + final Object s = e.getSource(); if(focusedWindow == s) { focusedWindow = null; } } @Override - public void windowDestroyed(WindowEvent e) { } + public void windowDestroyed(final WindowEvent e) { } @Override - public void windowGainedFocus(WindowEvent e) { - Object s = e.getSource(); + public void windowGainedFocus(final WindowEvent e) { + final Object s = e.getSource(); if(s instanceof WindowImpl) { focusedWindow = (WindowImpl) s; } } @Override - public void windowLostFocus(WindowEvent e) { - Object s = e.getSource(); + public void windowLostFocus(final WindowEvent e) { + final Object s = e.getSource(); if(focusedWindow == s) { focusedWindow = null; } } - public static void main(String[] args ){ + public static void main(final String[] args ){ System.setProperty("newt.debug.Window.KeyEvent", "true"); LinuxEventDeviceTracker.getSingleton(); try { while(true) { Thread.sleep(1000); } - } catch (InterruptedException e) { + } catch (final InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override - public void windowRepaint(WindowUpdateEvent e) { } + public void windowRepaint(final WindowUpdateEvent e) { } class EventDeviceManager implements Runnable { @@ -142,17 +142,17 @@ public class LinuxEventDeviceTracker implements WindowListener { @Override public void run() { - File f = new File("/dev/input/"); + final File f = new File("/dev/input/"); int number; while(!stop){ - for(String path:f.list()){ + for(final String path:f.list()){ if(path.startsWith("event")) { - String stringNumber = path.substring(5); + final String stringNumber = path.substring(5); number = Integer.parseInt(stringNumber); if(number<32&&number>=0) { if(eventDevicePollers[number]==null){ eventDevicePollers[number] = new EventDevicePoller(number); - Thread t = new Thread(eventDevicePollers[number], "NEWT-LinuxEventDeviceTracker-event"+number); + final Thread t = new Thread(eventDevicePollers[number], "NEWT-LinuxEventDeviceTracker-event"+number); t.setDaemon(true); t.start(); } else if(eventDevicePollers[number].stop) { @@ -163,7 +163,7 @@ public class LinuxEventDeviceTracker implements WindowListener { } try { Thread.sleep(2000); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } @@ -174,9 +174,9 @@ public class LinuxEventDeviceTracker implements WindowListener { class EventDevicePoller implements Runnable { private volatile boolean stop = false; - private String eventDeviceName; + private final String eventDeviceName; - public EventDevicePoller(int eventDeviceNumber){ + public EventDevicePoller(final int eventDeviceNumber){ this.eventDeviceName="/dev/input/event"+eventDeviceNumber; } @@ -194,14 +194,14 @@ public class LinuxEventDeviceTracker implements WindowListener { * unsigned int value; * }; */ - ByteBuffer bb = ByteBuffer.wrap(b); - StructAccessor s = new StructAccessor(bb); + final ByteBuffer bb = ByteBuffer.wrap(b); + final StructAccessor s = new StructAccessor(bb); final File f = new File(eventDeviceName); f.setReadOnly(); InputStream fis; try { fis = new FileInputStream(f); - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { stop=true; return; } @@ -224,7 +224,7 @@ public class LinuxEventDeviceTracker implements WindowListener { int read = 0; try { read = fis.read(b, 0, remaining); - } catch (IOException e) { + } catch (final IOException e) { stop = true; break loop; } @@ -369,13 +369,13 @@ public class LinuxEventDeviceTracker implements WindowListener { if(null != fis) { try { fis.close(); - } catch (IOException e) { + } catch (final IOException e) { } } stop=true; } - private char NewtVKey2Unicode(short VK, int modifiers) { + private char NewtVKey2Unicode(final short VK, final int modifiers) { if( KeyEvent.isPrintableKey(VK, true) ) { if((modifiers & InputEvent.SHIFT_MASK) == InputEvent.SHIFT_MASK) { return (char)VK; @@ -387,7 +387,7 @@ public class LinuxEventDeviceTracker implements WindowListener { } @SuppressWarnings("unused") - private char LinuxEVKey2Unicode(short EVKey) { + private char LinuxEVKey2Unicode(final short EVKey) { // This is the stuff normally mapped by a system keymap switch(EVKey) { @@ -443,7 +443,7 @@ public class LinuxEventDeviceTracker implements WindowListener { return 0; } - private short LinuxEVKey2NewtVKey(short EVKey) { + private short LinuxEVKey2NewtVKey(final short EVKey) { switch(EVKey) { case 1: // ESC diff --git a/src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.java b/src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.java index 3663ef0d4..1d9377563 100644 --- a/src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.java +++ b/src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.java @@ -79,40 +79,40 @@ public class LinuxMouseTracker implements WindowListener { public final int getLastY() { return lastFocusedY; } @Override - public void windowResized(WindowEvent e) { } + public void windowResized(final WindowEvent e) { } @Override - public void windowMoved(WindowEvent e) { } + public void windowMoved(final WindowEvent e) { } @Override - public void windowDestroyNotify(WindowEvent e) { - Object s = e.getSource(); + public void windowDestroyNotify(final WindowEvent e) { + final Object s = e.getSource(); if(focusedWindow == s) { focusedWindow = null; } } @Override - public void windowDestroyed(WindowEvent e) { } + public void windowDestroyed(final WindowEvent e) { } @Override - public void windowGainedFocus(WindowEvent e) { - Object s = e.getSource(); + public void windowGainedFocus(final WindowEvent e) { + final Object s = e.getSource(); if(s instanceof WindowImpl) { focusedWindow = (WindowImpl) s; } } @Override - public void windowLostFocus(WindowEvent e) { - Object s = e.getSource(); + public void windowLostFocus(final WindowEvent e) { + final Object s = e.getSource(); if(focusedWindow == s) { focusedWindow = null; } } @Override - public void windowRepaint(WindowUpdateEvent e) { } + public void windowRepaint(final WindowUpdateEvent e) { } class MouseDevicePoller implements Runnable { @Override @@ -123,7 +123,7 @@ public class LinuxMouseTracker implements WindowListener { InputStream fis; try { fis = new FileInputStream(f); - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); return; @@ -137,7 +137,7 @@ public class LinuxMouseTracker implements WindowListener { int read = 0; try { read = fis.read(b, 0, remaining); - } catch (IOException e) { + } catch (final IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } @@ -222,7 +222,7 @@ public class LinuxMouseTracker implements WindowListener { if(null != fis) { try { fis.close(); - } catch (IOException e) { + } catch (final IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } diff --git a/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java index d850a18af..4ecc2fdcf 100644 --- a/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java @@ -71,7 +71,7 @@ public class DisplayDriver extends DisplayImpl { final IOUtil.ClassResources iconRes = NewtFactory.getWindowIcons(); final URLConnection urlConn = iconRes.resolve(iconRes.resourceCount()-1); image = PNGPixelRect.read(urlConn.getInputStream(), PixelFormat.BGRA8888, true /* directBuffer */, 0 /* destMinStrideInBytes */, false /* destIsGLOriented */); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } @@ -107,7 +107,7 @@ public class DisplayDriver extends DisplayImpl { } @Override - protected void closeNativeImpl(AbstractGraphicsDevice aDevice) { + protected void closeNativeImpl(final AbstractGraphicsDevice aDevice) { aDevice.close(); } @@ -121,14 +121,14 @@ public class DisplayDriver extends DisplayImpl { public final boolean getNativePointerIconForceDirectNIO() { return true; } @Override - protected final long createPointerIconImpl(PixelFormat pixelformat, int width, int height, final ByteBuffer pixels, final int hotX, final int hotY) { + protected final long createPointerIconImpl(final PixelFormat pixelformat, final int width, final int height, final ByteBuffer pixels, final int hotX, final int hotY) { return createPointerIcon0( pixels, Buffers.getDirectBufferByteOffset(pixels), true /* pixels_is_direct */, width, height, hotX, hotY); } @Override - protected final void destroyPointerIconImpl(final long displayHandle, long piHandle) { + protected final void destroyPointerIconImpl(final long displayHandle, final long piHandle) { destroyPointerIcon0(piHandle); } diff --git a/src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.java b/src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.java index a89150d7c..d80d43e8f 100644 --- a/src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.java +++ b/src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.java @@ -231,7 +231,7 @@ public class MacKeyUtil { private static final char NSModeSwitchFunctionKey = 0xF747; */ - static short validateKeyCode(short keyCode, char keyChar) { + static short validateKeyCode(final short keyCode, final char keyChar) { // OS X Virtual Keycodes switch(keyCode) { // diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java index fe7411f29..c0f7d3859 100644 --- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java @@ -128,13 +128,13 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl } @Override - protected void setScreen(ScreenImpl newScreen) { // never null ! + protected void setScreen(final ScreenImpl newScreen) { // never null ! super.setScreen(newScreen); updatePixelScaleByScreenIdx(false /* sendEvent*/); // caller (reparent, ..) will send reshape event } @Override - protected void monitorModeChanged(MonitorEvent me, boolean success) { + protected void monitorModeChanged(final MonitorEvent me, final boolean success) { updatePixelScaleByWindowHandle(false /* sendEvent*/); // send reshape event itself } @@ -210,9 +210,9 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl close0( handle ); } }); } - } catch (Throwable t) { + } catch (final Throwable t) { if(DEBUG_IMPLEMENTATION) { - Exception e = new Exception("Warning: closeNative failed - "+Thread.currentThread().getName(), t); + final Exception e = new Exception("Warning: closeNative failed - "+Thread.currentThread().getName(), t); e.printStackTrace(); } } @@ -255,7 +255,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl } @Override - public void setSurfaceHandle(long surfaceHandle) { + public void setSurfaceHandle(final long surfaceHandle) { if(DEBUG_IMPLEMENTATION) { System.err.println("MacWindow.setSurfaceHandle(): 0x"+Long.toHexString(surfaceHandle)); } @@ -324,10 +324,10 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl } } - private boolean useParent(NativeWindow parent) { return null != parent && 0 != parent.getWindowHandle(); } + private boolean useParent(final NativeWindow parent) { return null != parent && 0 != parent.getWindowHandle(); } @Override - public void updatePosition(int x, int y) { + public void updatePosition(final int x, final int y) { final long handle = getWindowHandle(); if( 0 != handle && !isOffscreenInstance ) { final NativeWindow parent = getParent(); @@ -348,7 +348,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl } @Override - protected void sizeChanged(boolean defer, int newWidth, int newHeight, boolean force) { + protected void sizeChanged(final boolean defer, final int newWidth, final int newHeight, final boolean force) { final long handle = getWindowHandle(); if( 0 != handle && !isOffscreenInstance ) { final NativeWindow parent = getParent(); @@ -370,7 +370,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl } @Override - protected boolean reconfigureWindowImpl(int x, int y, final int width, final int height, int flags) { + protected boolean reconfigureWindowImpl(int x, int y, final int width, final int height, final int flags) { final boolean _isOffscreenInstance = isOffscreenInstance(this, this.getParent()); isOffscreenInstance = 0 != sscSurfaceHandle || _isOffscreenInstance; final PointImmutable pClientLevelOnSreen; @@ -471,7 +471,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl } @Override - protected Point getLocationOnScreenImpl(int x, int y) { + protected Point getLocationOnScreenImpl(final int x, final int y) { final NativeWindow parent = getParent(); final boolean useParent = useParent(parent); return getLocationOnScreenImpl(x, y, parent, useParent); @@ -490,12 +490,12 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl } @Override - protected void updateInsetsImpl(Insets insets) { + protected void updateInsetsImpl(final Insets insets) { // nop - using event driven insetsChange(..) } /** Callback for native screen position change event of the client area. */ - protected void screenPositionChanged(boolean defer, int newX, int newY) { + protected void screenPositionChanged(final boolean defer, final int newX, final int newY) { // passed coordinates are in screen position of the client area if(getWindowHandle()!=0) { final NativeWindow parent = getParent(); @@ -506,8 +506,8 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl positionChanged(defer, newX, newY); } else { // screen position -> rel child window position - Point absPos = new Point(newX, newY); - Point parentOnScreen = parent.getLocationOnScreen(null); + final Point absPos = new Point(newX, newY); + final Point parentOnScreen = parent.getLocationOnScreen(null); absPos.translate( parentOnScreen.scale(-1, -1) ); if(DEBUG_IMPLEMENTATION) { System.err.println("MacWindow.positionChanged.1 (Screen Pos - CHILD): ("+getThreadName()+"): (defer: "+defer+") "+getX()+"/"+getY()+" -> absPos "+newX+"/"+newY+", parentOnScreen "+parentOnScreen+" -> "+absPos); @@ -567,22 +567,22 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl } @Override - public final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) { + public final void sendKeyEvent(final short eventType, final int modifiers, final short keyCode, final short keySym, final char keyChar) { throw new InternalError("XXX: Adapt Java Code to Native Code Changes"); } @Override - public final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short _keyCode, short _keySym, char keyChar) { + public final void enqueueKeyEvent(final boolean wait, final short eventType, final int modifiers, final short _keyCode, final short _keySym, final char keyChar) { throw new InternalError("XXX: Adapt Java Code to Native Code Changes"); } - protected final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short _keyCode, char keyChar, char keySymChar) { + protected final void enqueueKeyEvent(final boolean wait, final short eventType, int modifiers, final short _keyCode, final char keyChar, final char keySymChar) { // Note that we send the key char for the key code on this // platform -- we do not get any useful key codes out of the system final short keyCode = MacKeyUtil.validateKeyCode(_keyCode, keyChar); final short keySym; { - short _keySym = KeyEvent.NULL_CHAR != keySymChar ? KeyEvent.utf16ToVKey(keySymChar) : KeyEvent.VK_UNDEFINED; + final short _keySym = KeyEvent.NULL_CHAR != keySymChar ? KeyEvent.utf16ToVKey(keySymChar) : KeyEvent.VK_UNDEFINED; keySym = KeyEvent.VK_UNDEFINED != _keySym ? _keySym : keyCode; } /** @@ -682,7 +682,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl setAlwaysOnTop0(getWindowHandle(), alwaysOnTop); } } }); - } catch (Exception ie) { + } catch (final Exception ie) { ie.printStackTrace(); } } diff --git a/src/newt/classes/jogamp/newt/driver/opengl/JoglUtilPNGIcon.java b/src/newt/classes/jogamp/newt/driver/opengl/JoglUtilPNGIcon.java index 551929b8d..5e703f690 100644 --- a/src/newt/classes/jogamp/newt/driver/opengl/JoglUtilPNGIcon.java +++ b/src/newt/classes/jogamp/newt/driver/opengl/JoglUtilPNGIcon.java @@ -41,7 +41,7 @@ import com.jogamp.opengl.util.PNGPixelRect; public class JoglUtilPNGIcon { - public static ByteBuffer arrayToX11BGRAImages(IOUtil.ClassResources resources, int[] data_size, int[] elem_bytesize) throws UnsupportedOperationException, InterruptedException, IOException, MalformedURLException { + public static ByteBuffer arrayToX11BGRAImages(final IOUtil.ClassResources resources, final int[] data_size, final int[] elem_bytesize) throws UnsupportedOperationException, InterruptedException, IOException, MalformedURLException { final PNGPixelRect[] images = new PNGPixelRect[resources.resourceCount()]; data_size[0] = 0; for(int i=0; i<resources.resourceCount(); i++) { diff --git a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java index a30431788..8973ae7ed 100644 --- a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java @@ -62,7 +62,7 @@ public class DisplayDriver extends DisplayImpl { static { NEWTJNILibLoader.loadNEWT(); { - long[] _defaultIconHandle = { 0, 0 }; + final long[] _defaultIconHandle = { 0, 0 }; if( DisplayImpl.isPNGUtilAvailable() ) { try { final IOUtil.ClassResources iconRes = NewtFactory.getWindowIcons(); @@ -76,7 +76,7 @@ public class DisplayDriver extends DisplayImpl { final PNGPixelRect image = PNGPixelRect.read(urlConn.getInputStream(), PixelFormat.BGRA8888, false /* directBuffer */, 0 /* destMinStrideInBytes */, false /* destIsGLOriented */); _defaultIconHandle[1] = DisplayDriver.createBGRA8888Icon0(image.getPixels(), image.getSize().getWidth(), image.getSize().getHeight(), false, 0, 0); } - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } @@ -110,7 +110,7 @@ public class DisplayDriver extends DisplayImpl { } @Override - protected void closeNativeImpl(AbstractGraphicsDevice aDevice) { + protected void closeNativeImpl(final AbstractGraphicsDevice aDevice) { sharedClassFactory.releaseSharedClass(); aDevice.close(); } @@ -125,12 +125,12 @@ public class DisplayDriver extends DisplayImpl { } @Override - protected final long createPointerIconImpl(PixelFormat pixelformat, int width, int height, final ByteBuffer pixels, final int hotX, final int hotY) { + protected final long createPointerIconImpl(final PixelFormat pixelformat, final int width, final int height, final ByteBuffer pixels, final int hotX, final int hotY) { return createBGRA8888Icon0(pixels, width, height, true, hotX, hotY); } @Override - protected final void destroyPointerIconImpl(final long displayHandle, long piHandle) { + protected final void destroyPointerIconImpl(final long displayHandle, final long piHandle) { destroyIcon0(piHandle); } @@ -139,7 +139,7 @@ public class DisplayDriver extends DisplayImpl { // private static native void DispatchMessages0(); - static long createBGRA8888Icon0(Buffer pixels, int width, int height, boolean isCursor, int hotX, int hotY) { + static long createBGRA8888Icon0(final Buffer pixels, final int width, final int height, final boolean isCursor, final int hotX, final int hotY) { if( null == pixels ) { throw new IllegalArgumentException("data buffer/size"); } diff --git a/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java index af265cfd3..1cba421bc 100644 --- a/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java @@ -156,7 +156,7 @@ public class ScreenDriver extends ScreenImpl { } @Override - protected void calcVirtualScreenOriginAndSize(final Rectangle viewport, Rectangle viewportInWindowUnits) { + protected void calcVirtualScreenOriginAndSize(final Rectangle viewport, final Rectangle viewportInWindowUnits) { viewport.set(getVirtualOriginX0(), getVirtualOriginY0(), getVirtualWidthImpl0(), getVirtualHeightImpl0()); } diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java index bda844bb5..1c5c34457 100644 --- a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java @@ -116,7 +116,7 @@ public class WindowDriver extends WindowImpl { @Override public boolean hasDeviceChanged() { if(0!=getWindowHandle()) { - long _hmon = MonitorFromWindow0(getWindowHandle()); + final long _hmon = MonitorFromWindow0(getWindowHandle()); if (hmon != _hmon) { if(DEBUG_IMPLEMENTATION) { System.err.println("Info: Window Device Changed "+Thread.currentThread().getName()+ @@ -154,7 +154,7 @@ public class WindowDriver extends WindowImpl { windowHandleClose = _windowHandle; if(DEBUG_IMPLEMENTATION) { - Exception e = new Exception("Info: Window new window handle "+Thread.currentThread().getName()+ + final Exception e = new Exception("Info: Window new window handle "+Thread.currentThread().getName()+ " (Parent HWND "+toHexString(getParentWindowHandle())+ ") : HWND "+toHexString(_windowHandle)+", "+Thread.currentThread()); e.printStackTrace(); @@ -167,18 +167,18 @@ public class WindowDriver extends WindowImpl { if ( 0 != hdc ) { try { GDI.ReleaseDC(windowHandleClose, hdc); - } catch (Throwable t) { + } catch (final Throwable t) { if(DEBUG_IMPLEMENTATION) { - Exception e = new Exception("Warning: closeNativeImpl failed - "+Thread.currentThread().getName(), t); + final Exception e = new Exception("Warning: closeNativeImpl failed - "+Thread.currentThread().getName(), t); e.printStackTrace(); } } } try { GDI.DestroyWindow(windowHandleClose); - } catch (Throwable t) { + } catch (final Throwable t) { if(DEBUG_IMPLEMENTATION) { - Exception e = new Exception("Warning: closeNativeImpl failed - "+Thread.currentThread().getName(), t); + final Exception e = new Exception("Warning: closeNativeImpl failed - "+Thread.currentThread().getName(), t); e.printStackTrace(); } } @@ -189,7 +189,7 @@ public class WindowDriver extends WindowImpl { } @Override - protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) { + protected boolean reconfigureWindowImpl(int x, int y, int width, int height, final int flags) { if(DEBUG_IMPLEMENTATION) { System.err.println("WindowsWindow reconfig: "+x+"/"+y+" "+width+"x"+height+", "+ getReconfigureFlagsAsString(null, flags)); @@ -217,7 +217,7 @@ public class WindowDriver extends WindowImpl { } @Override - protected void requestFocusImpl(boolean force) { + protected void requestFocusImpl(final boolean force) { requestFocus0(getWindowHandle(), force); } @@ -273,12 +273,12 @@ public class WindowDriver extends WindowImpl { } @Override - protected Point getLocationOnScreenImpl(int x, int y) { + protected Point getLocationOnScreenImpl(final int x, final int y) { return GDIUtil.GetRelativeLocation( getWindowHandle(), 0 /*root win*/, x, y); } @Override - protected void updateInsetsImpl(Insets insets) { + protected void updateInsetsImpl(final Insets insets) { // nop - using event driven insetsChange(..) } @@ -295,9 +295,9 @@ public class WindowDriver extends WindowImpl { * for details. * </p> */ - public final void sendTouchScreenEvent(short eventType, int modifiers, - int pActionIdx, int[] pNames, - int[] pX, int[] pY, float[] pPressure, float maxPressure) { + public final void sendTouchScreenEvent(final short eventType, final int modifiers, + final int pActionIdx, final int[] pNames, + final int[] pX, final int[] pY, final float[] pPressure, final float maxPressure) { final int pCount = pNames.length; final MouseEvent.PointerType[] pTypes = new MouseEvent.PointerType[pCount]; for(int i=pCount-1; i>=0; i--) { pTypes[i] = PointerType.TouchScreen; } @@ -311,7 +311,7 @@ public class WindowDriver extends WindowImpl { // private short repeatedKey = KeyEvent.VK_UNDEFINED; - private final boolean handlePressTypedAutoRepeat(boolean isModifierKey, int modifiers, short keyCode, short keySym, char keyChar) { + private final boolean handlePressTypedAutoRepeat(final boolean isModifierKey, int modifiers, final short keyCode, final short keySym, final char keyChar) { if( setKeyPressed(keyCode, true) ) { // AR: Key was already pressed: Either [enter | within] AR mode final boolean withinAR = repeatedKey == keyCode; @@ -331,7 +331,7 @@ public class WindowDriver extends WindowImpl { } @Override - public final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) { + public final void sendKeyEvent(final short eventType, final int modifiers, final short keyCode, final short keySym, final char keyChar) { final boolean isModifierKey = KeyEvent.isModifierKey(keySym); // System.err.println("*** sendKeyEvent: event "+KeyEvent.getEventTypeString(eventType)+", keyCode "+toHexString(keyCode)+", keyChar <"+keyChar+">, mods "+toHexString(modifiers)+ // ", isKeyCodeTracked "+isKeyCodeTracked(keyCode)+", was: pressed "+isKeyPressed(keyCode)+", printableKey "+KeyEvent.isPrintableKey(keyCode, false)+" [modifierKey "+isModifierKey+"] - "+System.currentTimeMillis()); @@ -359,7 +359,7 @@ public class WindowDriver extends WindowImpl { } @Override - public final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short keyCode, short keySym, char keyChar) { + public final void enqueueKeyEvent(final boolean wait, final short eventType, final int modifiers, final short keyCode, final short keySym, final char keyChar) { throw new InternalError("XXX: Adapt Java Code to Native Code Changes"); } diff --git a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java index 5c2820dab..759c27450 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java @@ -69,7 +69,7 @@ public class DisplayDriver extends DisplayImpl { } @Override - public String validateDisplayName(String name, long handle) { + public String validateDisplayName(final String name, final long handle) { return X11Util.validateDisplayName(name, handle); } @@ -81,21 +81,21 @@ public class DisplayDriver extends DisplayImpl { @Override protected void createNativeImpl() { X11Util.setX11ErrorHandler(true, DEBUG ? false : true); // make sure X11 error handler is set - long handle = X11Util.openDisplay(name); + final long handle = X11Util.openDisplay(name); if( 0 == handle ) { throw new RuntimeException("Error creating display(Win): "+name); } aDevice = new X11GraphicsDevice(handle, AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */); try { CompleteDisplay0(aDevice.getHandle()); - } catch(RuntimeException e) { + } catch(final RuntimeException e) { closeNativeImpl(aDevice); throw e; } } @Override - protected void closeNativeImpl(AbstractGraphicsDevice aDevice) { + protected void closeNativeImpl(final AbstractGraphicsDevice aDevice) { DisplayRelease0(aDevice.getHandle(), javaObjectAtom, windowDeleteAtom /*, kbdHandle */); // XKB disabled for now javaObjectAtom = 0; windowDeleteAtom = 0; @@ -128,12 +128,12 @@ public class DisplayDriver extends DisplayImpl { public final PixelFormat getNativePointerIconPixelFormat() { return PixelFormat.RGBA8888; } @Override - protected final long createPointerIconImpl(PixelFormat pixelformat, int width, int height, final ByteBuffer pixels, final int hotX, final int hotY) { + protected final long createPointerIconImpl(final PixelFormat pixelformat, final int width, final int height, final ByteBuffer pixels, final int hotX, final int hotY) { return createPointerIcon(getHandle(), pixels, width, height, hotX, hotY); } @Override - protected final void destroyPointerIconImpl(final long displayHandle, long piHandle) { + protected final void destroyPointerIconImpl(final long displayHandle, final long piHandle) { destroyPointerIcon0(displayHandle, piHandle); } @@ -145,7 +145,7 @@ public class DisplayDriver extends DisplayImpl { private native void CompleteDisplay0(long handle); - private void displayCompleted(long javaObjectAtom, long windowDeleteAtom /*, long kbdHandle */) { + private void displayCompleted(final long javaObjectAtom, final long windowDeleteAtom /*, long kbdHandle */) { this.javaObjectAtom=javaObjectAtom; this.windowDeleteAtom=windowDeleteAtom; // this.kbdHandle = kbdHandle; // XKB disabled for now @@ -154,7 +154,7 @@ public class DisplayDriver extends DisplayImpl { private native void DispatchMessages0(long display, long javaObjectAtom, long windowDeleteAtom /* , long kbdHandle */); // XKB disabled for now - private static long createPointerIcon(long display, Buffer pixels, int width, int height, int hotX, int hotY) { + private static long createPointerIcon(final long display, final Buffer pixels, final int width, final int height, final int hotX, final int hotY) { final boolean pixels_is_direct = Buffers.isDirect(pixels); return createPointerIcon0(display, pixels_is_direct ? pixels : Buffers.getArray(pixels), diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR11.java b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java index 23fd0f80f..4803852f9 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/RandR11.java +++ b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java @@ -35,6 +35,7 @@ import jogamp.newt.ScreenImpl; import com.jogamp.common.util.VersionNumber; import com.jogamp.newt.MonitorDevice; import com.jogamp.newt.MonitorMode; +import com.jogamp.newt.Screen; class RandR11 implements RandR { private static final boolean DEBUG = ScreenDriver.DEBUG; @@ -59,7 +60,7 @@ class RandR11 implements RandR { private int[] idx_rate = null, idx_res = null; @Override - public boolean beginInitialQuery(long dpy, ScreenDriver screen) { + public boolean beginInitialQuery(final long dpy, final ScreenDriver screen) { // initialize iterators and static data final int screen_idx = screen.getIndex(); resolutionCount = getNumScreenResolutions0(dpy, screen_idx); @@ -96,7 +97,7 @@ class RandR11 implements RandR { } @Override - public void endInitialQuery(long dpy, ScreenDriver screen) { + public void endInitialQuery(final long dpy, final ScreenDriver screen) { idx_rate=null; idx_res=null; nrates=null; @@ -153,7 +154,7 @@ class RandR11 implements RandR { } } - int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ]; + final int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ]; int i = 0; props[i++] = MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL; props[i++] = res[0]; // width @@ -210,14 +211,14 @@ class RandR11 implements RandR { return null; } final int screen_idx = screen.getIndex(); - long screenConfigHandle = getScreenConfiguration0(dpy, screen_idx); + final long screenConfigHandle = getScreenConfiguration0(dpy, screen_idx); if(0 == screenConfigHandle) { return null; } int[] res; final int nres_idx; try { - int resNumber = getNumScreenResolutions0(dpy, screen_idx); + final int resNumber = getNumScreenResolutions0(dpy, screen_idx); if(0==resNumber) { return null; } @@ -239,7 +240,7 @@ class RandR11 implements RandR { } finally { freeScreenConfiguration0(screenConfigHandle); } - int[] props = new int[4]; + final int[] props = new int[4]; int i = 0; props[i++] = 0; props[i++] = 0; @@ -255,7 +256,7 @@ class RandR11 implements RandR { return null; } final int screen_idx = screen.getIndex(); - long screenConfigHandle = getScreenConfiguration0(dpy, screen_idx); + final long screenConfigHandle = getScreenConfiguration0(dpy, screen_idx); if(0 == screenConfigHandle) { return null; } @@ -263,7 +264,7 @@ class RandR11 implements RandR { int rate, rot; final int nres_idx; try { - int resNumber = getNumScreenResolutions0(dpy, screen_idx); + final int resNumber = getNumScreenResolutions0(dpy, screen_idx); if(0==resNumber) { return null; } @@ -293,7 +294,7 @@ class RandR11 implements RandR { } finally { freeScreenConfiguration0(screenConfigHandle); } - int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ]; + final int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ]; int i = 0; props[i++] = MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL; props[i++] = res[0]; // width @@ -310,11 +311,11 @@ class RandR11 implements RandR { } @Override - public boolean setCurrentMonitorMode(final long dpy, final ScreenDriver screen, MonitorDevice monitor, final MonitorMode mode) { + public boolean setCurrentMonitorMode(final long dpy, final ScreenDriver screen, final MonitorDevice monitor, final MonitorMode mode) { final long t0 = System.currentTimeMillis(); boolean done = false; final int screen_idx = screen.getIndex(); - long screenConfigHandle = getScreenConfiguration0(dpy, screen_idx); + final long screenConfigHandle = getScreenConfiguration0(dpy, screen_idx); if(0 == screenConfigHandle) { return Boolean.valueOf(done); } @@ -327,10 +328,10 @@ class RandR11 implements RandR { final int r = mode.getRotation(); if( setCurrentScreenModeStart0(dpy, screen_idx, screenConfigHandle, resId, f, r) ) { - while(!done && System.currentTimeMillis()-t0 < ScreenImpl.SCREEN_MODE_CHANGE_TIMEOUT) { + while(!done && System.currentTimeMillis()-t0 < Screen.SCREEN_MODE_CHANGE_TIMEOUT) { done = setCurrentScreenModePollEnd0(dpy, screen_idx, resId, f, r); if(!done) { - try { Thread.sleep(10); } catch (InterruptedException e) { } + try { Thread.sleep(10); } catch (final InterruptedException e) { } } } } @@ -341,7 +342,7 @@ class RandR11 implements RandR { } @Override - public final void updateScreenViewport(final long dpy, final ScreenDriver screen, RectangleImmutable viewport) { + public final void updateScreenViewport(final long dpy, final ScreenDriver screen, final RectangleImmutable viewport) { // nop } diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java index a08741d9e..7a409bba1 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java +++ b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java @@ -58,7 +58,7 @@ class RandR13 implements RandR { @Override public void dumpInfo(final long dpy, final int screen_idx) { - long screenResources = getScreenResources0(dpy, screen_idx); + final long screenResources = getScreenResources0(dpy, screen_idx); if(0 == screenResources) { return; } @@ -73,7 +73,7 @@ class RandR13 implements RandR { IntLongHashMap crtInfoHandleMap = null; @Override - public boolean beginInitialQuery(long dpy, ScreenDriver screen) { + public boolean beginInitialQuery(final long dpy, final ScreenDriver screen) { final int screen_idx = screen.getIndex(); sessionScreenResources = getScreenResources0(dpy, screen_idx); if( 0 != sessionScreenResources ) { @@ -86,9 +86,9 @@ class RandR13 implements RandR { } @Override - public void endInitialQuery(long dpy, ScreenDriver screen) { + public void endInitialQuery(final long dpy, final ScreenDriver screen) { if( null != crtInfoHandleMap ) { - for(Iterator<IntLongHashMap.Entry> iter = crtInfoHandleMap.iterator(); iter.hasNext(); ) { + for(final Iterator<IntLongHashMap.Entry> iter = crtInfoHandleMap.iterator(); iter.hasNext(); ) { final IntLongHashMap.Entry entry = iter.next(); freeMonitorInfoHandle0(entry.value); } @@ -113,7 +113,7 @@ class RandR13 implements RandR { } } - private final long getMonitorInfoHandle(final long dpy, final int screen_idx, long screenResources, final int monitor_idx) { + private final long getMonitorInfoHandle(final long dpy, final int screen_idx, final long screenResources, final int monitor_idx) { if( null != crtInfoHandleMap ) { long h = crtInfoHandleMap.get(monitor_idx); if( 0 == h ) { @@ -174,7 +174,7 @@ class RandR13 implements RandR { } @Override - public int[] getMonitorDeviceProps(final long dpy, final ScreenDriver screen, MonitorModeProps.Cache cache, final int crt_idx) { + public int[] getMonitorDeviceProps(final long dpy, final ScreenDriver screen, final MonitorModeProps.Cache cache, final int crt_idx) { final int screen_idx = screen.getIndex(); final long screenResources = getScreenResourceHandle(dpy, screen_idx); try { @@ -222,7 +222,7 @@ class RandR13 implements RandR { } @Override - public boolean setCurrentMonitorMode(final long dpy, final ScreenDriver screen, MonitorDevice monitor, final MonitorMode mode) { + public boolean setCurrentMonitorMode(final long dpy, final ScreenDriver screen, final MonitorDevice monitor, final MonitorMode mode) { final int screen_idx = screen.getIndex(); final long screenResources = getScreenResourceHandle(dpy, screen_idx); final boolean res; diff --git a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java index 2d7c6509d..7ae68e510 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java @@ -48,6 +48,7 @@ import jogamp.newt.DisplayImpl.DisplayRunnable; import jogamp.newt.ScreenImpl; import com.jogamp.common.util.ArrayHashSet; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.VersionNumber; import com.jogamp.nativewindow.x11.X11GraphicsDevice; import com.jogamp.nativewindow.x11.X11GraphicsScreen; @@ -59,7 +60,7 @@ public class ScreenDriver extends ScreenImpl { static { Debug.initSingleton(); - DEBUG_TEST_RANDR13_DISABLED = Debug.isPropertyDefined("newt.test.Screen.disableRandR13", true); + DEBUG_TEST_RANDR13_DISABLED = PropertyAccess.isPropertyDefined("newt.test.Screen.disableRandR13", true); DisplayDriver.initSingleton(); } @@ -73,9 +74,9 @@ public class ScreenDriver extends ScreenImpl { @Override protected void createNativeImpl() { // validate screen index - Long handle = runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Long>() { + final Long handle = runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Long>() { @Override - public Long run(long dpy) { + public Long run(final long dpy) { return new Long(GetScreen0(dpy, screen_idx)); } } ); if (handle.longValue() == 0) { @@ -85,7 +86,7 @@ public class ScreenDriver extends ScreenImpl { final long dpy = x11dev.getHandle(); aScreen = new X11GraphicsScreen(x11dev, screen_idx); { - int v[] = getRandRVersion0(dpy); + final int v[] = getRandRVersion0(dpy); randrVersion = new VersionNumber(v[0], v[1], 0); } { @@ -169,7 +170,7 @@ public class ScreenDriver extends ScreenImpl { final AbstractGraphicsDevice device = getDisplay().getGraphicsDevice(); device.lock(); try { - int[] viewportProps = rAndR.getMonitorDeviceViewport(device.getHandle(), this, monitor.getId()); + final int[] viewportProps = rAndR.getMonitorDeviceViewport(device.getHandle(), this, monitor.getId()); viewportPU.set(viewportProps[0], viewportProps[1], viewportProps[2], viewportProps[3]); viewportWU.set(viewportProps[0], viewportProps[1], viewportProps[2], viewportProps[3]); // equal window-units and pixel-units return true; @@ -184,7 +185,7 @@ public class ScreenDriver extends ScreenImpl { return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<MonitorMode>() { @Override - public MonitorMode run(long dpy) { + public MonitorMode run(final long dpy) { final int[] currentModeProps = rAndR.getCurrentMonitorModeProps(dpy, ScreenDriver.this, monitor.getId()); return MonitorModeProps.streamInMonitorMode(null, null, currentModeProps, 0); } } ); @@ -195,9 +196,9 @@ public class ScreenDriver extends ScreenImpl { if( null == rAndR ) { return false; } final long t0 = System.currentTimeMillis(); - boolean done = runWithOptTempDisplayHandle( new DisplayImpl.DisplayRunnable<Boolean>() { + final boolean done = runWithOptTempDisplayHandle( new DisplayImpl.DisplayRunnable<Boolean>() { @Override - public Boolean run(long dpy) { + public Boolean run(final long dpy) { return Boolean.valueOf( rAndR.setCurrentMonitorMode(dpy, ScreenDriver.this, monitor, mode) ); } }).booleanValue(); @@ -211,7 +212,7 @@ public class ScreenDriver extends ScreenImpl { private final DisplayImpl.DisplayRunnable<Boolean> xineramaEnabledQueryWithTemp = new DisplayImpl.DisplayRunnable<Boolean>() { @Override - public Boolean run(long dpy) { + public Boolean run(final long dpy) { return new Boolean(X11Util.XineramaIsEnabled(dpy)); } }; @@ -227,7 +228,7 @@ public class ScreenDriver extends ScreenImpl { } @Override - protected void calcVirtualScreenOriginAndSize(final Rectangle viewport, Rectangle viewportInWindowUnits) { + protected void calcVirtualScreenOriginAndSize(final Rectangle viewport, final Rectangle viewportInWindowUnits) { final RectangleImmutable ov = DEBUG ? (RectangleImmutable) getViewport().cloneMutable() : null; /** if( null != rAndR && rAndR.getVersion().compareTo(RandR.version130) >= 0 && getMonitorDevices().size()>0 ) { @@ -243,7 +244,7 @@ public class ScreenDriver extends ScreenImpl { } else */ { runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() { @Override - public Object run(long dpy) { + public Object run(final long dpy) { viewport.set(0, 0, getWidth0(dpy, screen_idx), getHeight0(dpy, screen_idx)); return null; } } ); diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java index 0eda37eac..4a3b9442d 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java @@ -80,7 +80,7 @@ public class WindowDriver extends WindowImpl { _icon_data = PNGIcon.arrayToX11BGRAImages(NewtFactory.getWindowIcons(), data_size, elem_bytesize); _icon_data_size = data_size[0]; _icon_elem_bytesize = elem_bytesize[0]; - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } @@ -143,15 +143,15 @@ public class WindowDriver extends WindowImpl { @Override protected void closeNativeImpl() { if(0!=windowHandleClose && null!=getScreen() ) { - DisplayDriver display = (DisplayDriver) getScreen().getDisplay(); + final DisplayDriver display = (DisplayDriver) getScreen().getDisplay(); final AbstractGraphicsDevice edtDevice = display.getGraphicsDevice(); edtDevice.lock(); try { CloseWindow0(edtDevice.getHandle(), windowHandleClose, display.getJavaObjectAtom(), display.getWindowDeleteAtom() /* , display.getKbdHandle() */); // XKB disabled for now - } catch (Throwable t) { + } catch (final Throwable t) { if(DEBUG_IMPLEMENTATION) { - Exception e = new Exception("Warning: closeNativeImpl failed - "+Thread.currentThread().getName(), t); + final Exception e = new Exception("Warning: closeNativeImpl failed - "+Thread.currentThread().getName(), t); e.printStackTrace(); } } finally { @@ -172,7 +172,7 @@ public class WindowDriver extends WindowImpl { * {@inheritDoc} */ @Override - protected boolean isReconfigureFlagSupported(int changeFlags) { + protected boolean isReconfigureFlagSupported(final int changeFlags) { return true; // all flags! } @@ -208,7 +208,7 @@ public class WindowDriver extends WindowImpl { final DisplayDriver display = (DisplayDriver) getScreen().getDisplay(); runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() { @Override - public Object run(long dpy) { + public Object run(final long dpy) { reconfigureWindow0( dpy, getScreenIndex(), getParentWindowHandle(), getWindowHandle(), display.getWindowDeleteAtom(), _x, _y, width, height, fflags); @@ -226,7 +226,7 @@ public class WindowDriver extends WindowImpl { * {@inheritDoc} */ @Override - protected void focusChanged(boolean defer, boolean focusGained) { + protected void focusChanged(final boolean defer, final boolean focusGained) { if( isNativeValid() && isFullscreen() && tempFSAlwaysOnTop && hasFocus() != focusGained ) { final int flags = getReconfigureFlags(FLAG_CHANGE_ALWAYSONTOP, isVisible()) | ( focusGained ? FLAG_IS_ALWAYSONTOP : 0 ); if(DEBUG_IMPLEMENTATION) { @@ -235,7 +235,7 @@ public class WindowDriver extends WindowImpl { final DisplayDriver display = (DisplayDriver) getScreen().getDisplay(); runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() { @Override - public Object run(long dpy) { + public Object run(final long dpy) { reconfigureWindow0( dpy, getScreenIndex(), getParentWindowHandle(), getWindowHandle(), display.getWindowDeleteAtom(), getX(), getY(), getWidth(), getHeight(), flags); @@ -246,7 +246,7 @@ public class WindowDriver extends WindowImpl { super.focusChanged(defer, focusGained); } - protected void reparentNotify(long newParentWindowHandle) { + protected void reparentNotify(final long newParentWindowHandle) { if(DEBUG_IMPLEMENTATION) { final long p0 = getParentWindowHandle(); System.err.println("Window.reparentNotify ("+getThreadName()+"): "+toHexString(p0)+" -> "+toHexString(newParentWindowHandle)); @@ -257,7 +257,7 @@ public class WindowDriver extends WindowImpl { protected void requestFocusImpl(final boolean force) { runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() { @Override - public Object run(long dpy) { + public Object run(final long dpy) { requestFocus0(dpy, getWindowHandle(), force); return null; } @@ -268,7 +268,7 @@ public class WindowDriver extends WindowImpl { protected void setTitleImpl(final String title) { runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() { @Override - public Object run(long dpy) { + public Object run(final long dpy) { setTitle0(dpy, getWindowHandle(), title); return null; } @@ -279,10 +279,10 @@ public class WindowDriver extends WindowImpl { protected void setPointerIconImpl(final PointerIconImpl pi) { runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() { @Override - public Object run(long dpy) { + public Object run(final long dpy) { try { setPointerIcon0(dpy, getWindowHandle(), null != pi ? pi.validatedHandle() : 0); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } return null; @@ -294,7 +294,7 @@ public class WindowDriver extends WindowImpl { protected boolean setPointerVisibleImpl(final boolean pointerVisible) { return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Boolean>() { @Override - public Boolean run(long dpy) { + public Boolean run(final long dpy) { final PointerIconImpl pi = (PointerIconImpl)getPointerIcon(); final boolean res; if( pointerVisible && null != pi ) { @@ -312,7 +312,7 @@ public class WindowDriver extends WindowImpl { protected boolean confinePointerImpl(final boolean confine) { return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Boolean>() { @Override - public Boolean run(long dpy) { + public Boolean run(final long dpy) { return Boolean.valueOf(confinePointer0(dpy, getWindowHandle(), confine)); } }).booleanValue(); @@ -322,7 +322,7 @@ public class WindowDriver extends WindowImpl { protected void warpPointerImpl(final int x, final int y) { runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() { @Override - public Object run(long dpy) { + public Object run(final long dpy) { warpPointer0(dpy, getWindowHandle(), x, y); return null; } @@ -333,20 +333,20 @@ public class WindowDriver extends WindowImpl { protected Point getLocationOnScreenImpl(final int x, final int y) { return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Point>() { @Override - public Point run(long dpy) { + public Point run(final long dpy) { return X11Lib.GetRelativeLocation(dpy, getScreenIndex(), getWindowHandle(), 0 /*root win*/, x, y); } } ); } @Override - protected void updateInsetsImpl(Insets insets) { + protected void updateInsetsImpl(final Insets insets) { // nop - using event driven insetsChange(..) } @Override - protected final void doMouseEvent(boolean enqueue, boolean wait, short eventType, int modifiers, - int x, int y, short button, float[] rotationXYZ, float rotationScale) { + protected final void doMouseEvent(final boolean enqueue, final boolean wait, short eventType, int modifiers, + final int x, final int y, short button, final float[] rotationXYZ, final float rotationScale) { switch(eventType) { case MouseEvent.EVENT_MOUSE_PRESSED: switch(button) { @@ -390,10 +390,10 @@ public class WindowDriver extends WindowImpl { } /** Called by native TK */ - protected final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar0, String keyString) { + protected final void sendKeyEvent(final short eventType, final int modifiers, final short keyCode, final short keySym, final char keyChar0, final String keyString) { // handleKeyEvent(true, false, eventType, modifiers, keyCode, keyChar); final boolean isModifierKey = KeyEvent.isModifierKey(keyCode); - final boolean isAutoRepeat = 0 != ( KeyEvent.AUTOREPEAT_MASK & modifiers ); + final boolean isAutoRepeat = 0 != ( InputEvent.AUTOREPEAT_MASK & modifiers ); final char keyChar = ( null != keyString ) ? keyString.charAt(0) : keyChar0; // System.err.println("*** sendKeyEvent: event "+KeyEvent.getEventTypeString(eventType)+", keyCode "+toHexString(keyCode)+", keyChar <"+keyChar0+">/<"+keyChar+">, keyString "+keyString+", mods "+toHexString(modifiers)+ // ", isKeyCodeTracked "+isKeyCodeTracked(keyCode)+", was: pressed "+isKeyPressed(keyCode)+", repeat "+isAutoRepeat+", [modifierKey "+isModifierKey+"] - "+System.currentTimeMillis()); @@ -412,11 +412,11 @@ public class WindowDriver extends WindowImpl { } @Override - public final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) { + public final void sendKeyEvent(final short eventType, final int modifiers, final short keyCode, final short keySym, final char keyChar) { throw new InternalError("XXX: Adapt Java Code to Native Code Changes"); } @Override - public final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short keyCode, short keySym, char keyChar) { + public final void enqueueKeyEvent(final boolean wait, final short eventType, final int modifiers, final short keyCode, final short keySym, final char keyChar) { throw new InternalError("XXX: Adapt Java Code to Native Code Changes"); } @@ -426,16 +426,16 @@ public class WindowDriver extends WindowImpl { private static final String getCurrentThreadName() { return Thread.currentThread().getName(); } // Callback for JNI private static final void dumpStack() { Thread.dumpStack(); } // Callback for JNI - private final <T> T runWithLockedDisplayDevice(DisplayRunnable<T> action) { + private final <T> T runWithLockedDisplayDevice(final DisplayRunnable<T> action) { return ((DisplayDriver) getScreen().getDisplay()).runWithLockedDisplayDevice(action); } protected static native boolean initIDs0(); - private long CreateWindow(long parentWindowHandle, long display, int screen_index, - int visualID, long javaObjectAtom, long windowDeleteAtom, - int x, int y, int width, int height, boolean autoPosition, int flags, - int pixelDataSize, Buffer pixels) { + private long CreateWindow(final long parentWindowHandle, final long display, final int screen_index, + final int visualID, final long javaObjectAtom, final long windowDeleteAtom, + final int x, final int y, final int width, final int height, final boolean autoPosition, final int flags, + final int pixelDataSize, final Buffer pixels) { // NOTE: MUST BE DIRECT BUFFER, since _NET_WM_ICON Atom uses buffer directly! if( !Buffers.isDirect(pixels) ) { throw new IllegalArgumentException("data buffer is not direct "+pixels); diff --git a/src/newt/classes/jogamp/newt/event/NEWTEventTask.java b/src/newt/classes/jogamp/newt/event/NEWTEventTask.java index 38a434279..2bdab2796 100644 --- a/src/newt/classes/jogamp/newt/event/NEWTEventTask.java +++ b/src/newt/classes/jogamp/newt/event/NEWTEventTask.java @@ -35,18 +35,18 @@ import com.jogamp.newt.event.NEWTEvent; * which notifies after sending the event for the <code>invokeAndWait()</code> semantics. */ public class NEWTEventTask { - private NEWTEvent event; - private Object notifyObject; + private final NEWTEvent event; + private final Object notifyObject; private RuntimeException exception; - public NEWTEventTask(NEWTEvent event, Object notifyObject) { + public NEWTEventTask(final NEWTEvent event, final Object notifyObject) { this.event = event ; this.notifyObject = notifyObject ; this.exception = null; } public final NEWTEvent get() { return event; } - public final void setException(RuntimeException e) { exception = e; } + public final void setException(final RuntimeException e) { exception = e; } public final RuntimeException getException() { return exception; } public final boolean isCallerWaiting() { return null != notifyObject; } diff --git a/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java b/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java index 91c18f023..4d5d9724a 100644 --- a/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java +++ b/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java @@ -50,7 +50,7 @@ public class SWTEDTUtil implements EDTUtil { private int start_iter=0; private static long pollPeriod = EDTUtil.defaultEDTPollPeriod; - public SWTEDTUtil(final com.jogamp.newt.Display newtDisplay, org.eclipse.swt.widgets.Display swtDisplay) { + public SWTEDTUtil(final com.jogamp.newt.Display newtDisplay, final org.eclipse.swt.widgets.Display swtDisplay) { this.threadGroup = Thread.currentThread().getThreadGroup(); this.name=Thread.currentThread().getName()+"-SWTDisplay-"+newtDisplay.getFQName()+"-EDT-"; this.dispatchMessages = new Runnable() { @@ -73,7 +73,7 @@ public class SWTEDTUtil implements EDTUtil { } @Override - public void setPollPeriod(long ms) { + public void setPollPeriod(final long ms) { pollPeriod = ms; } @@ -142,16 +142,16 @@ public class SWTEDTUtil implements EDTUtil { } @Override - public final boolean invokeStop(boolean wait, Runnable task) { + public final boolean invokeStop(final boolean wait, final Runnable task) { return invokeImpl(wait, task, true); } @Override - public final boolean invoke(boolean wait, Runnable task) { + public final boolean invoke(final boolean wait, final Runnable task) { return invokeImpl(wait, task, false); } - private final boolean invokeImpl(boolean wait, Runnable task, boolean stop) { + private final boolean invokeImpl(boolean wait, final Runnable task, boolean stop) { Throwable throwable = null; RunnableTask rTask = null; final Object rTaskLock = new Object(); @@ -221,7 +221,7 @@ public class SWTEDTUtil implements EDTUtil { if( wait ) { try { rTaskLock.wait(); // free lock, allow execution of rTask - } catch (InterruptedException ie) { + } catch (final InterruptedException ie) { throwable = ie; } if(null==throwable) { @@ -253,7 +253,7 @@ public class SWTEDTUtil implements EDTUtil { @Override public void run() { } }); - } catch (Exception e) { } + } catch (final Exception e) { } return true; } @@ -267,7 +267,7 @@ public class SWTEDTUtil implements EDTUtil { while( nedt.isRunning ) { try { edtLock.wait(); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } } @@ -283,7 +283,7 @@ public class SWTEDTUtil implements EDTUtil { volatile boolean isRunning = false; Object sync = new Object(); - public NEDT(ThreadGroup tg, String name) { + public NEDT(final ThreadGroup tg, final String name) { super(tg, name); } @@ -326,13 +326,13 @@ public class SWTEDTUtil implements EDTUtil { if(!shouldStop) { try { sync.wait(pollPeriod); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } } } } while(!shouldStop) ; - } catch (Throwable t) { + } catch (final Throwable t) { // handle errors .. shouldStop = true; if(t instanceof RuntimeException) { diff --git a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java index 386149b22..a989345dd 100644 --- a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java +++ b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java @@ -46,7 +46,7 @@ import com.jogamp.newt.event.MouseEvent; */ public class SWTNewtEventFactory { - public static final short eventTypeSWT2NEWT(int swtType) { + public static final short eventTypeSWT2NEWT(final int swtType) { switch( swtType ) { // case SWT.MouseXXX: return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_CLICKED; case SWT.MouseDown: return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_PRESSED; @@ -63,7 +63,7 @@ public class SWTNewtEventFactory { return (short)0; } - public static final int swtModifiers2Newt(int awtMods, boolean mouseHint) { + public static final int swtModifiers2Newt(final int awtMods, final boolean mouseHint) { int newtMods = 0; if ((awtMods & SWT.SHIFT) != 0) newtMods |= com.jogamp.newt.event.InputEvent.SHIFT_MASK; if ((awtMods & SWT.CTRL) != 0) newtMods |= com.jogamp.newt.event.InputEvent.CTRL_MASK; @@ -202,7 +202,7 @@ public class SWTNewtEventFactory { } - public static final com.jogamp.newt.event.InputEvent createInputEvent(org.eclipse.swt.widgets.Event event, NativeSurfaceHolder sourceHolder) { + public static final com.jogamp.newt.event.InputEvent createInputEvent(final org.eclipse.swt.widgets.Event event, final NativeSurfaceHolder sourceHolder) { com.jogamp.newt.event.InputEvent res = createMouseEvent(event, sourceHolder); if(null == res) { res = createKeyEvent(event, sourceHolder); @@ -210,7 +210,7 @@ public class SWTNewtEventFactory { return res; } - public static final com.jogamp.newt.event.MouseEvent createMouseEvent(org.eclipse.swt.widgets.Event event, NativeSurfaceHolder sourceHolder) { + public static final com.jogamp.newt.event.MouseEvent createMouseEvent(final org.eclipse.swt.widgets.Event event, final NativeSurfaceHolder sourceHolder) { switch(event.type) { case SWT.MouseDown: case SWT.MouseUp: @@ -257,7 +257,7 @@ public class SWTNewtEventFactory { return null; // no mapping .. } - public static final com.jogamp.newt.event.KeyEvent createKeyEvent(org.eclipse.swt.widgets.Event event, NativeSurfaceHolder sourceHolder) { + public static final com.jogamp.newt.event.KeyEvent createKeyEvent(final org.eclipse.swt.widgets.Event event, final NativeSurfaceHolder sourceHolder) { switch(event.type) { case SWT.KeyDown: case SWT.KeyUp: @@ -290,8 +290,8 @@ public class SWTNewtEventFactory { dragButtonDown = 0; } - public final boolean dispatchMouseEvent(org.eclipse.swt.widgets.Event event, NativeSurfaceHolder sourceHolder, com.jogamp.newt.event.MouseListener l) { - com.jogamp.newt.event.MouseEvent res = createMouseEvent(event, sourceHolder); + public final boolean dispatchMouseEvent(final org.eclipse.swt.widgets.Event event, final NativeSurfaceHolder sourceHolder, final com.jogamp.newt.event.MouseListener l) { + final com.jogamp.newt.event.MouseEvent res = createMouseEvent(event, sourceHolder); if(null != res) { if(null != l) { switch(event.type) { @@ -341,8 +341,8 @@ public class SWTNewtEventFactory { return false; } - public final boolean dispatchKeyEvent(org.eclipse.swt.widgets.Event event, NativeSurfaceHolder sourceHolder, com.jogamp.newt.event.KeyListener l) { - com.jogamp.newt.event.KeyEvent res = createKeyEvent(event, sourceHolder); + public final boolean dispatchKeyEvent(final org.eclipse.swt.widgets.Event event, final NativeSurfaceHolder sourceHolder, final com.jogamp.newt.event.KeyListener l) { + final com.jogamp.newt.event.KeyEvent res = createKeyEvent(event, sourceHolder); if(null != res) { if(null != l) { switch(event.type) { @@ -372,7 +372,7 @@ public class SWTNewtEventFactory { if( null != ml ) { final Listener listener = new Listener () { @Override - public void handleEvent (Event event) { + public void handleEvent (final Event event) { dispatchMouseEvent( event, sourceHolder, ml ); } }; ctrl.addListener(SWT.MouseDown, listener); @@ -385,7 +385,7 @@ public class SWTNewtEventFactory { if( null != kl ) { final Listener listener = new Listener () { @Override - public void handleEvent (Event event) { + public void handleEvent (final Event event) { dispatchKeyEvent( event, sourceHolder, kl ); } }; ctrl.addListener(SWT.KeyDown, listener); |