diff options
author | Sven Gothel <[email protected]> | 2014-07-08 22:10:03 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-08 22:10:03 +0200 |
commit | de53d193c86a02a3cdc46c5c8758192d957d1c67 (patch) | |
tree | 8be8e36381d6f25850b887c9ff0df7e9c2279487 /src/newt | |
parent | be2b608e22d9a2a3a80eb547bee6180c2ca22678 (diff) |
Findbugs: Misc minor issues (see below)
- remove duplicate code in branch
- Use Type.valueOf(primitive)
- Don't use array.toString() directly
- remove dead code
Diffstat (limited to 'src/newt')
-rw-r--r-- | src/newt/classes/jogamp/newt/MonitorModeProps.java | 5 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/WindowImpl.java | 23 |
2 files changed, 13 insertions, 15 deletions
diff --git a/src/newt/classes/jogamp/newt/MonitorModeProps.java b/src/newt/classes/jogamp/newt/MonitorModeProps.java index 0fc0da9bc..6e376ce48 100644 --- a/src/newt/classes/jogamp/newt/MonitorModeProps.java +++ b/src/newt/classes/jogamp/newt/MonitorModeProps.java @@ -163,9 +163,8 @@ public class MonitorModeProps { } /** WARNING: must be synchronized with ScreenMode.h, native implementation */ - private static SurfaceSize streamInSurfaceSize(final DimensionImmutable resolution, final int[] sizeProperties, int offset) { - final SurfaceSize surfaceSize = new SurfaceSize(resolution, sizeProperties[offset++]); - return surfaceSize; + private static SurfaceSize streamInSurfaceSize(final DimensionImmutable resolution, final int[] sizeProperties, final int offset) { + return new SurfaceSize(resolution, sizeProperties[offset]); } /** WARNING: must be synchronized with ScreenMode.h, native implementation */ diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index c9a5d9277..68d3e93d6 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -3069,11 +3069,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * </p> */ protected void consumePointerEvent(MouseEvent pe) { - int x = pe.getX(); - int y = pe.getY(); - if(DEBUG_MOUSE_EVENT) { - System.err.println("consumePointerEvent.in: "+pe+", "+pState0+", pos "+x+"/"+y+", win["+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+ + System.err.println("consumePointerEvent.in: "+pe+", "+pState0+", pos "+pe.getX()+"/"+pe.getY()+", win["+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+ "], pixel["+getSurfaceWidth()+"x"+getSurfaceHeight()+"]"); } @@ -3098,8 +3095,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // Fall through intended ! case MouseEvent.EVENT_MOUSE_ENTERED: // clip coordinates to window dimension - x = Math.min(Math.max(x, 0), getSurfaceWidth()-1); - y = Math.min(Math.max(y, 0), getSurfaceHeight()-1); + // final int pe_x = Math.min(Math.max(pe.getX(), 0), getSurfaceWidth()-1); + // final int pe_y = Math.min(Math.max(pe.getY(), 0), getSurfaceHeight()-1); pState0.clearButton(); if( eventType == MouseEvent.EVENT_MOUSE_ENTERED ) { insideSurface = true; @@ -3122,20 +3119,22 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // Fall through intended ! default: - insideSurface = x >= 0 && y >= 0 && x < getSurfaceWidth() && y < getSurfaceHeight(); + final int pe_x = pe.getX(); + final int pe_y = pe.getY(); + insideSurface = pe_x >= 0 && pe_y >= 0 && pe_x < getSurfaceWidth() && pe_y < getSurfaceHeight(); if( pe.getPointerType(0) == PointerType.Mouse ) { if( !pState0.insideSurface && insideSurface ) { // ENTER .. use clipped coordinates eEntered = new MouseEvent(MouseEvent.EVENT_MOUSE_ENTERED, pe.getSource(), pe.getWhen(), pe.getModifiers(), - Math.min(Math.max(x, 0), getSurfaceWidth()-1), - Math.min(Math.max(y, 0), getSurfaceHeight()-1), - (short)0, (short)0, pe.getRotation(), pe.getRotationScale()); + Math.min(Math.max(pe_x, 0), getSurfaceWidth()-1), + Math.min(Math.max(pe_y, 0), getSurfaceHeight()-1), + (short)0, (short)0, pe.getRotation(), pe.getRotationScale()); pState0.exitSent = false; } else if( !insideSurface && eExitAllowed ) { // EXIT .. use clipped coordinates eExited = new MouseEvent(MouseEvent.EVENT_MOUSE_EXITED, pe.getSource(), pe.getWhen(), pe.getModifiers(), - Math.min(Math.max(x, 0), getSurfaceWidth()-1), - Math.min(Math.max(y, 0), getSurfaceHeight()-1), + Math.min(Math.max(pe_x, 0), getSurfaceWidth()-1), + Math.min(Math.max(pe_y, 0), getSurfaceHeight()-1), (short)0, (short)0, pe.getRotation(), pe.getRotationScale()); pState0.exitSent = true; } |