diff options
author | Sven Gothel <[email protected]> | 2019-12-04 19:44:00 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2019-12-04 19:44:00 +0100 |
commit | 43dd50a8545f8fde8198091b136aece6f062cb38 (patch) | |
tree | 9eef13188a5af8856c9d7aa501841b142118cff6 | |
parent | c81252bd25e29f05ba41f8350dc098c9ca4f821d (diff) |
Bug 1406: demos.Launcher0: More code path reduction: useMultiplePointerIcon must be enabled via -pointerIcon
3 files changed, 21 insertions, 11 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/Launcher0.java b/src/demos/com/jogamp/opengl/demos/Launcher0.java index 2898af1ab..cbd49fac8 100644 --- a/src/demos/com/jogamp/opengl/demos/Launcher0.java +++ b/src/demos/com/jogamp/opengl/demos/Launcher0.java @@ -31,6 +31,7 @@ package com.jogamp.opengl.demos; import java.io.IOException; import com.jogamp.newt.Display; +import com.jogamp.newt.Display.PointerIcon; import com.jogamp.newt.NewtFactory; import com.jogamp.newt.Screen; import com.jogamp.newt.Window; @@ -87,7 +88,7 @@ public class Launcher0 { static boolean waitForKey = false; static boolean mouseVisible = true; static boolean mouseConfined = false; - static boolean setPointerIcon = false; + static boolean useMultiplePointerIcon = false; static boolean showFPS = true; static boolean forceES2 = false; static boolean forceES3 = false; @@ -214,7 +215,11 @@ public class Launcher0 { } }); - final NEWTDemoListener newtDemoListener = new NEWTDemoListener(glWindow); + final NEWTDemoListener newtDemoListener; + { + final PointerIcon[] pointerIcon = useMultiplePointerIcon ? NEWTDemoListener.createPointerIcons(glWindow.getScreen().getDisplay()) : null; + newtDemoListener = new NEWTDemoListener(glWindow, pointerIcon); + } newtDemoListener.quitAdapterEnable(true); glWindow.addKeyListener(newtDemoListener); if( traceMouse ) { @@ -330,7 +335,7 @@ public class Launcher0 { } else if(args[i].equals("-mouseConfine")) { mouseConfined = true; } else if(args[i].equals("-pointerIcon")) { - setPointerIcon = true; + useMultiplePointerIcon = true; } else if(args[i].equals("-showFPS")) { showFPS = true; } else if(args[i].equals("-width")) { @@ -389,7 +394,7 @@ public class Launcher0 { System.err.println("fullscreen "+fullscreen); System.err.println("mouseVisible "+mouseVisible); System.err.println("mouseConfined "+mouseConfined); - System.err.println("pointerIcon "+setPointerIcon); + System.err.println("pointerIcon "+useMultiplePointerIcon); System.err.println("forceES2 "+forceES2); System.err.println("forceES3 "+forceES3); System.err.println("forceGL3 "+forceGL3); diff --git a/src/newt/classes/com/jogamp/newt/opengl/util/NEWTDemoListener.java b/src/newt/classes/com/jogamp/newt/opengl/util/NEWTDemoListener.java index 568b5d0bb..6c07b3626 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/util/NEWTDemoListener.java +++ b/src/newt/classes/com/jogamp/newt/opengl/util/NEWTDemoListener.java @@ -88,16 +88,21 @@ public class NEWTDemoListener extends WindowAdapter implements KeyListener, Mous float contrast = 1f; boolean confinedFixedCenter = false; + /** + * Creates a new instance with given pointer icons, which are not used if {@code null}. + * @param glWin the GLWindow instance to use + * @param pointerIcons if {@code null} don't use multiple pointer icons + */ public NEWTDemoListener(final GLWindow glWin, final PointerIcon[] pointerIcons) { this.glWindow = glWin; - if( null != pointerIcons ) { - this.pointerIcons = pointerIcons; - } else { - this.pointerIcons = createPointerIcons(glWindow.getScreen().getDisplay()); - } + this.pointerIcons = pointerIcons; } + /** + * Creates a new instance with {@link #createPointerIcons(Display)} default pointer icons. + * @param glWin the GLWindow instance to use + */ public NEWTDemoListener(final GLWindow glWin) { - this(glWin, null); + this(glWin, createPointerIcons(glWin.getScreen().getDisplay())); } protected void printlnState(final String prelude) { diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtReparentingKeyAdapter.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtReparentingKeyAdapter.java index 339230d48..cd4edddb1 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtReparentingKeyAdapter.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtReparentingKeyAdapter.java @@ -47,7 +47,7 @@ public class NewtReparentingKeyAdapter extends NEWTDemoListener { final NativeWindowHolder winHolder; public NewtReparentingKeyAdapter(final NativeWindowHolder winHolder, final GLWindow glWindow) { - super(glWindow, null); + super(glWindow); this.winHolder = winHolder; } |