Jogamp
Bug 1188: Fix API doc of getSupportedStateMask(); Misc Changes (see below)
authorSven Gothel <sgothel@jausoft.com>
Tue, 25 Aug 2015 21:07:34 +0000 (23:07 +0200)
committerSven Gothel <sgothel@jausoft.com>
Tue, 25 Aug 2015 21:07:34 +0000 (23:07 +0200)
- Fix STATE_MASK_CREATENATIVE
- Simplify resetStateMask()
- Windows WindowDriver: Remove STATE_MASK_STICKY from supported states

- TestGearsNEWT: Use NEWTDemoListener

src/newt/classes/com/jogamp/newt/Window.java
src/newt/classes/jogamp/newt/WindowImpl.java
src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNEWT.java

index 5139560..cacac9f 100644 (file)
@@ -369,20 +369,20 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
      * <p>
      * Semantic of the supported state-mask bits:
      * <ul>
-     * <li>{@link #STATE_BIT_VISIBLE}: {@link #setVisible(boolean) Visibility} can be toggled after creation. <b>Minimum requirement</b>.</li>
-     * <li>{@link #STATE_BIT_AUTOPOSITION}: {@code WindowManager autoposition} is supported.</li>
-     * <li>{@link #STATE_BIT_CHILDWIN}: {@link #reparentWindow(NativeWindow, int, int, int) Native window parenting} is supported.</li>
-     * <li>{@link #STATE_BIT_FOCUSED}: Window {@link #requestFocus() focus management} is supported.  <b>Minimum requirement</b>.</li>
-     * <li>{@link #STATE_BIT_UNDECORATED}: {@link #setUndecorated(boolean) Window decoration} can be toggled after creation.</li>
-     * <li>{@link #STATE_BIT_ALWAYSONTOP}: Window can be set {@link #setAlwaysOnTop(boolean) always-on-top}. </li>
-     * <li>{@link #STATE_BIT_ALWAYSONBOTTOM}: Window can be set {@link #setAlwaysOnBottom(boolean) always-on-bottom}. </li>
-     * <li>{@link #STATE_BIT_STICKY}: Window can be set {@link #setSticky(boolean) sticky}.</li>
-     * <li>{@link #STATE_BIT_RESIZABLE}: Window {@link #setResizable(boolean) resizability} can be disabled and toggled.</li>
-     * <li>{@link #STATE_BIT_MAXIMIZED_VERT}: Window can be {@link #setMaximized(boolean, boolean) maximized-vertically}. </li>
-     * <li>{@link #STATE_BIT_MAXIMIZED_HORZ}: Window can be {@link #setMaximized(boolean, boolean) maximized-horizontally}. </li>
-     * <li>{@link #STATE_BIT_FULLSCREEN}: Window {@link #setFullscreen(boolean) fullscreen} can be toggled after creation. </li>
-     * <li>{@link #STATE_BIT_POINTERVISIBLE}: Window {@link #setPointerVisible(boolean) pointer visibility} can be toggled. </li>
-     * <li>{@link #STATE_BIT_POINTERCONFINED}: Window {@link #confinePointer(boolean) pointer can be confined}. </li>
+     * <li>{@link #STATE_MASK_VISIBLE}: {@link #setVisible(boolean) Visibility} can be toggled after creation. <b>Minimum requirement</b>.</li>
+     * <li>{@link #STATE_MASK_AUTOPOSITION}: {@code WindowManager autoposition} is supported.</li>
+     * <li>{@link #STATE_MASK_CHILDWIN}: {@link #reparentWindow(NativeWindow, int, int, int) Native window parenting} is supported.</li>
+     * <li>{@link #STATE_MASK_FOCUSED}: Window {@link #requestFocus() focus management} is supported.  <b>Minimum requirement</b>.</li>
+     * <li>{@link #STATE_MASK_UNDECORATED}: {@link #setUndecorated(boolean) Window decoration} can be toggled after creation.</li>
+     * <li>{@link #STATE_MASK_ALWAYSONTOP}: Window can be set {@link #setAlwaysOnTop(boolean) always-on-top}. </li>
+     * <li>{@link #STATE_MASK_ALWAYSONBOTTOM}: Window can be set {@link #setAlwaysOnBottom(boolean) always-on-bottom}. </li>
+     * <li>{@link #STATE_MASK_STICKY}: Window can be set {@link #setSticky(boolean) sticky}.</li>
+     * <li>{@link #STATE_MASK_RESIZABLE}: Window {@link #setResizable(boolean) resizability} can be disabled and toggled.</li>
+     * <li>{@link #STATE_MASK_MAXIMIZED_VERT}: Window can be {@link #setMaximized(boolean, boolean) maximized-vertically}. </li>
+     * <li>{@link #STATE_MASK_MAXIMIZED_HORZ}: Window can be {@link #setMaximized(boolean, boolean) maximized-horizontally}. </li>
+     * <li>{@link #STATE_MASK_FULLSCREEN}: Window {@link #setFullscreen(boolean) fullscreen} can be toggled after creation. </li>
+     * <li>{@link #STATE_MASK_POINTERVISIBLE}: Window {@link #setPointerVisible(boolean) pointer visibility} can be toggled. </li>
+     * <li>{@link #STATE_MASK_POINTERCONFINED}: Window {@link #confinePointer(boolean) pointer can be confined}. </li>
      * </ul>
      * </p>
      * @see #getStateMask()
index b6e2a1d..1f91a75 100644 (file)
@@ -223,7 +223,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
     /**
      * Reconfig mask for createNativeImpl(..) taking out from {@link #getStateMask()}:
      * <ul>
-     *   <li>{@link #STATE_MASK_VISIBLE}</li>
      *   <li>{@link #STATE_MASK_FULLSCREEN}</li>
      *   <li>{@link #STATE_MASK_POINTERVISIBLE}</li>
      *   <li>{@link #STATE_MASK_POINTERCONFINED}</li>
@@ -231,13 +230,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
      * Above taken out states are achieved from caller createNative() 'manually'.
      * @since 2.3.2
      */
-    protected final int STATE_MASK_CREATENATIVE = STATE_MASK_UNDECORATED |
-                                                  STATE_MASK_ALWAYSONTOP |
-                                                  STATE_MASK_ALWAYSONBOTTOM |
-                                                  STATE_MASK_STICKY |
-                                                  STATE_MASK_RESIZABLE |
-                                                  STATE_MASK_MAXIMIZED_VERT |
-                                                  STATE_MASK_MAXIMIZED_HORZ;
+    protected final int STATE_MASK_CREATENATIVE = STATE_MASK_ALL_PUBLIC &
+                                                  ~( STATE_MASK_FULLSCREEN |
+                                                     STATE_MASK_POINTERVISIBLE |
+                                                     STATE_MASK_POINTERCONFINED
+                                                   );
     //
     // Additional private state-mask mask values for reconfiguration only
     // (keep in sync w/ src/newt/native/Window.h)
@@ -262,12 +259,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
 
     /* pp */ final void resetStateMask() {
         stateMask.clearField(false);
-        stateMask.set(STATE_BIT_AUTOPOSITION);
-        stateMask.put(STATE_BIT_CHILDWIN, null != parentWindow);
-        stateMask.set(STATE_BIT_RESIZABLE);
-        stateMask.set(STATE_BIT_POINTERVISIBLE);
-        stateMask.set(PSTATE_BIT_FULLSCREEN_NFS_RESIZABLE);
-        stateMask.set(PSTATE_BIT_FULLSCREEN_MAINMONITOR);
+        stateMask.put32(0, 32,
+                STATE_MASK_AUTOPOSITION |
+                ( null != parentWindow ? STATE_MASK_CHILDWIN : 0 ) |
+                STATE_MASK_RESIZABLE |
+                STATE_MASK_POINTERVISIBLE |
+                PSTATE_MASK_FULLSCREEN_NFS_RESIZABLE |
+                PSTATE_MASK_FULLSCREEN_MAINMONITOR);
         normPosSizeStored[0] = false;
         normPosSizeStored[1] = false;
         supportedReconfigStateMask = STATE_MASK_ALL_RECONFIG;
@@ -2917,7 +2915,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
                 final int changeMask;
                 try {
                     {
-                        // Enter fullscreen - Disable alwaysOnTop/alwaysOnBottom/resizableChange
+                        // Enter fullscreen - Disable alwaysOnTop/resizableChange
                         int cm = 0;
                         if( alwaysOnTopChange ) {
                             cm = CHANGE_MASK_ALWAYSONTOP;
@@ -2928,7 +2926,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
                         changeMask = cm;
                     }
                     if( _fullscreen && 0 != changeMask ) {
-                        // Enter fullscreen - Disable alwaysOnTop/alwaysOnBottom/resizableChange
+                        // Enter fullscreen - Disable alwaysOnTop/resizableChange
                         reconfigureWindowImpl(oldX, oldY, oldWidth, oldHeight, getReconfigureMask(changeMask, isVisible()));
                     }
 
index f29ee4b..70a8ec5 100644 (file)
@@ -207,7 +207,7 @@ public class WindowDriver extends WindowImpl {
                STATE_MASK_UNDECORATED |
                STATE_MASK_ALWAYSONTOP |
                STATE_MASK_ALWAYSONBOTTOM |
-               STATE_MASK_STICKY |
+               // STATE_MASK_STICKY |
                STATE_MASK_RESIZABLE |
                STATE_MASK_MAXIMIZED_VERT |
                STATE_MASK_MAXIMIZED_HORZ |
index 0f3011c..17e50ad 100644 (file)
 
 package com.jogamp.opengl.test.junit.jogl.demos.gl2.newt;
 
-import com.jogamp.newt.event.KeyAdapter;
-import com.jogamp.newt.event.KeyEvent;
 import com.jogamp.newt.opengl.GLWindow;
 import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.test.junit.util.NEWTDemoListener;
 import com.jogamp.opengl.test.junit.util.QuitAdapter;
 
 import com.jogamp.opengl.util.Animator;
@@ -84,25 +83,9 @@ public class TestGearsNEWT extends UITestCase {
         glWindow.addKeyListener(quitAdapter);
         glWindow.addWindowListener(quitAdapter);
 
-        final GLWindow f_glWindow = glWindow;
-        glWindow.addKeyListener(new KeyAdapter() {
-            public void keyReleased(final KeyEvent e) {
-                if( !e.isPrintableKey() || e.isAutoRepeat() ) {
-                    return;
-                }
-                if(e.getKeyChar()=='f') {
-                    new Thread() {
-                        public void run() {
-                            f_glWindow.setFullscreen(!f_glWindow.isFullscreen());
-                    } }.start();
-                } else if(e.getKeyChar()=='d') {
-                    new Thread() {
-                        public void run() {
-                            f_glWindow.setUndecorated(!f_glWindow.isUndecorated());
-                    } }.start();
-                }
-            }
-        });
+        final NEWTDemoListener newtDemoListener = new NEWTDemoListener(glWindow);
+        glWindow.addKeyListener(newtDemoListener);
+        glWindow.addMouseListener(newtDemoListener);
 
         glWindow.setSize(width, height);
         glWindow.setVisible(true);
http://JogAmp.org git info: FAQ, tutorial and man pages.