From 3e92d34de3672d7f5e401ed6181bb55a58bdf4b6 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 9 Dec 2019 02:24:44 +0100 Subject: Bug 1156: NEWT Window: Better handling of fixed console case: Not resizable and not repositionable. Our two fixed size and position console cases 'bcm.egl' and 'egl.gbm' (drm.gbm) only operate in a console like fullscreen mode. We should earmark and expose this behavior, as well as handle it by not waiting for a position / size and not attempting to change position and size. Reducing WindowImpl.minimumReconfigStateMask to bare minimum values: STATE_MASK_VISIBLE | STATE_MASK_FOCUSED; New WindowImpl.mutableSizePosReconfigStateMask extends WindowImpl.minimumReconfigStateMask, representing previous values: STATE_MASK_VISIBLE | STATE_MASK_FOCUSED | STATE_MASK_FULLSCREEN | STATE_MASK_RESIZABLE | STATE_MASK_REPOSITIONABLE; All WindowDriver implementations previously using WindowImpl.minimumReconfigStateMask are now using WindowImpl.mutableSizePosReconfigStateMask but the explicit console driver named above. I would have liked to add the STATE_BIT_FULLSCREEN to the current stateMask to notify this semantics, however this would have lead to more code changes as our fullscreen mode assumes to be 'on top' of the normal mode. Here the normal mode is essentially fullscreen and no back/forth fullscreen setting is useful or allowed. Therefore, both fixed size & position console driver won't expose themselves as being in fullscreen mode. --- src/newt/classes/com/jogamp/newt/Window.java | 73 ++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 3 deletions(-) (limited to 'src/newt/classes/com/jogamp') diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java index 30b02cb61..99089d3d7 100644 --- a/src/newt/classes/com/jogamp/newt/Window.java +++ b/src/newt/classes/com/jogamp/newt/Window.java @@ -130,6 +130,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur *

Changing this state is lifecycle heavy.

*

Bit number {@value}.

*

Defaults to {@code false}.

+ * @see #getSupportedStateMask() * @see #getStateMask() * @since 2.3.2 */ @@ -140,6 +141,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur * otherwise the custom position is being enforced.

*

Bit number {@value}.

*

Defaults to {@code true}.

+ * @see #getSupportedStateMask() * @see #getStateMask() * @since 2.3.2 */ @@ -152,6 +154,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur *

Changing this state is lifecycle heavy.

*

Bit number {@value}.

*

Defaults to {@code false}.

+ * @see #getSupportedStateMask() * @see #getStateMask() * @since 2.3.2 */ @@ -160,6 +163,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur * Set if window has the input focus, otherwise cleared. *

Bit number {@value}.

*

Defaults to {@code false}.

+ * @see #getSupportedStateMask() * @see #getStateMask() * @since 2.3.2 */ @@ -168,6 +172,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur * Set if window has window decorations, otherwise cleared. *

Bit number {@value}.

*

Defaults to {@code false}.

+ * @see #getSupportedStateMask() * @see #getStateMask() * @since 2.3.2 */ @@ -176,6 +181,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur * Set if window is always on top, otherwise cleared. *

Bit number {@value}.

*

Defaults to {@code false}.

+ * @see #getSupportedStateMask() * @see #getStateMask() * @since 2.3.2 */ @@ -184,6 +190,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur * Set if window is always on bottom, otherwise cleared. *

Bit number {@value}.

*

Defaults to {@code false}.

+ * @see #getSupportedStateMask() * @see #getStateMask() * @since 2.3.2 */ @@ -192,12 +199,13 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur * Set if window is sticky, i.e. visible on all virtual desktop, otherwise cleared. *

Bit number {@value}.

*

Defaults to {@code false}.

+ * @see #getSupportedStateMask() * @see #getStateMask() * @since 2.3.2 */ public static final int STATE_BIT_STICKY = 7; // reconfig-flag /** - * Set if window is resizable, otherwise cleared. + * Set if window is resizable after creation, otherwise cleared. *

Bit number {@value}.

*

Defaults to {@code true}.

* @see #getStateMask() @@ -208,6 +216,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur * Set if window is maximized vertically, otherwise cleared. *

Bit number {@value}.

*

Defaults to {@code false}.

+ * @see #getSupportedStateMask() * @see #getStateMask() * @since 2.3.2 */ @@ -216,6 +225,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur * Set if window is maximized horizontally, otherwise cleared. *

Bit number {@value}.

*

Defaults to {@code false}.

+ * @see #getSupportedStateMask() * @see #getStateMask() * @since 2.3.2 */ @@ -228,6 +238,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur *

*

Bit number {@value}.

*

Defaults to {@code false}.

+ * @see #getSupportedStateMask() * @see #getStateMask() * @since 2.3.2 */ @@ -237,6 +248,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur * Set if the pointer is visible when inside the window, otherwise cleared. *

Bit number {@value}.

*

Defaults to {@code true}.

+ * @see #getSupportedStateMask() * @see #getStateMask() * @since 2.3.2 */ @@ -245,84 +257,131 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur * Set if the pointer is confined to the window, otherwise cleared. *

Bit number {@value}.

*

Defaults to {@code false}.

+ * @see #getSupportedStateMask() * @see #getStateMask() * @since 2.3.2 */ public static final int STATE_BIT_POINTERCONFINED = 13; + /** + * Set if window is repositionable after creation, otherwise cleared. + *

Bit number {@value}.

+ *

Defaults to {@code true}.

+ * @see #getSupportedStateMask() + * @see #getStateMask() + * @since 2.4.0 + */ + public static final int STATE_BIT_REPOSITIONABLE = 14; // reconfig-flag + /** * Bitmask for {@link #STATE_BIT_VISIBLE}, {@value}. + * @see #getSupportedStateMask() + * @see #getStateMask() * @since 2.3.2 */ public static final int STATE_MASK_VISIBLE = 1 << STATE_BIT_VISIBLE; /** * Bitmask for {@link #STATE_BIT_AUTOPOSITION}, {@value}. + * @see #getSupportedStateMask() + * @see #getStateMask() * @since 2.3.2 */ public static final int STATE_MASK_AUTOPOSITION = 1 << STATE_BIT_AUTOPOSITION; /** * Bitmask for {@link #STATE_BIT_CHILDWIN}, {@value}. + * @see #getSupportedStateMask() + * @see #getStateMask() * @since 2.3.2 */ public static final int STATE_MASK_CHILDWIN = 1 << STATE_BIT_CHILDWIN; /** * Bitmask for {@link #STATE_BIT_FOCUSED}, {@value}. + * @see #getSupportedStateMask() + * @see #getStateMask() * @since 2.3.2 */ public static final int STATE_MASK_FOCUSED = 1 << STATE_BIT_FOCUSED; /** * Bitmask for {@link #STATE_BIT_UNDECORATED}, {@value}. + * @see #getSupportedStateMask() + * @see #getStateMask() * @since 2.3.2 */ public static final int STATE_MASK_UNDECORATED = 1 << STATE_BIT_UNDECORATED; /** * Bitmask for {@link #STATE_BIT_ALWAYSONTOP}, {@value}. + * @see #getSupportedStateMask() + * @see #getStateMask() * @since 2.3.2 */ public static final int STATE_MASK_ALWAYSONTOP = 1 << STATE_BIT_ALWAYSONTOP; /** * Bitmask for {@link #STATE_BIT_ALWAYSONBOTTOM}, {@value}. + * @see #getSupportedStateMask() + * @see #getStateMask() * @since 2.3.2 */ public static final int STATE_MASK_ALWAYSONBOTTOM = 1 << STATE_BIT_ALWAYSONBOTTOM; /** * Bitmask for {@link #STATE_BIT_STICKY}, {@value}. + * @see #getSupportedStateMask() + * @see #getStateMask() * @since 2.3.2 */ public static final int STATE_MASK_STICKY = 1 << STATE_BIT_STICKY; /** * Bitmask for {@link #STATE_BIT_RESIZABLE}, {@value}. + * @see #getSupportedStateMask() + * @see #getStateMask() * @since 2.3.2 */ public static final int STATE_MASK_RESIZABLE = 1 << STATE_BIT_RESIZABLE; /** * Bitmask for {@link #STATE_BIT_MAXIMIZED_VERT}, {@value}. + * @see #getSupportedStateMask() + * @see #getStateMask() * @since 2.3.2 */ public static final int STATE_MASK_MAXIMIZED_VERT = 1 << STATE_BIT_MAXIMIZED_VERT; /** * Bitmask for {@link #STATE_BIT_MAXIMIZED_HORZ}, {@value}. + * @see #getSupportedStateMask() + * @see #getStateMask() * @since 2.3.2 */ public static final int STATE_MASK_MAXIMIZED_HORZ = 1 << STATE_BIT_MAXIMIZED_HORZ; /** * Bitmask for {@link #STATE_BIT_FULLSCREEN}, {@value}. + * @see #getSupportedStateMask() + * @see #getStateMask() * @since 2.3.2 */ public static final int STATE_MASK_FULLSCREEN = 1 << STATE_BIT_FULLSCREEN; /** * Bitmask for {@link #STATE_BIT_POINTERVISIBLE}, {@value}. + * @see #getSupportedStateMask() + * @see #getStateMask() * @since 2.3.2 */ public static final int STATE_MASK_POINTERVISIBLE = 1 << STATE_BIT_POINTERVISIBLE; /** * Bitmask for {@link #STATE_BIT_POINTERCONFINED}, {@value}. + * @see #getSupportedStateMask() + * @see #getStateMask() * @since 2.3.2 */ public static final int STATE_MASK_POINTERCONFINED = 1 << STATE_BIT_POINTERCONFINED; + /** + * Bitmask for {@link #STATE_BIT_REPOSITIONABLE}, {@value}. + * @see #getSupportedStateMask() + * @see #getStateMask() + * @since 2.4.0 + */ + public static final int STATE_MASK_REPOSITIONABLE = 1 << STATE_BIT_REPOSITIONABLE; /** * Number of all public state bits. + * @see #getSupportedStateMask() * @see #getStateMask() * @since 2.3.2 */ @@ -330,6 +389,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur /** * Bitmask covering all public state bits. + * @see #getSupportedStateMask() * @see #getStateMask() * @since 2.3.2 */ @@ -352,6 +412,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur * @see #STATE_MASK_FULLSCREEN * @see #STATE_MASK_POINTERVISIBLE * @see #STATE_MASK_POINTERCONFINED + * @see #STATE_MASK_REPOSITIONABLE * @since 2.3.2 */ int getStateMask(); @@ -372,10 +433,13 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur * Please note that a window's size shall also be allowed to change, i.e. {@link #setSize(int, int)}. *

*

- * Default value is {@link #STATE_MASK_VISIBLE} | {@link #STATE_MASK_FOCUSED} | {@link #STATE_MASK_FULLSCREEN}, + * Default minimum value is {@link #STATE_MASK_VISIBLE} | {@link #STATE_MASK_FOCUSED}, * i.e. the minimum requirement for all implementations. *

*

+ * Usual desktop minimum value is {@link #STATE_MASK_VISIBLE} | {@link #STATE_MASK_FOCUSED} | {@link STATE_MASK_FULLSCREEN} | {@link STATE_MASK_RESIZABLE} | {@link STATE_MASK_REPOSITIONABLE}. + *

+ *

* Before native window creation {@link #getStatePublicBitmask()} is returned, * i.e. it is assumed all features are supported. *

@@ -389,12 +453,13 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur *
  • {@link #STATE_MASK_ALWAYSONTOP}: Window can be set {@link #setAlwaysOnTop(boolean) always-on-top}.
  • *
  • {@link #STATE_MASK_ALWAYSONBOTTOM}: Window can be set {@link #setAlwaysOnBottom(boolean) always-on-bottom}.
  • *
  • {@link #STATE_MASK_STICKY}: Window can be set {@link #setSticky(boolean) sticky}.
  • - *
  • {@link #STATE_MASK_RESIZABLE}: Window {@link #setResizable(boolean) resizability} can be toggled.
  • + *
  • {@link #STATE_MASK_RESIZABLE}: Window {@link #setResizable(boolean) resizability} can be toggled and it's {@link #setSize(int, int) size} can be changed.
  • *
  • {@link #STATE_MASK_MAXIMIZED_VERT}: Window can be {@link #setMaximized(boolean, boolean) maximized-vertically}.
  • *
  • {@link #STATE_MASK_MAXIMIZED_HORZ}: Window can be {@link #setMaximized(boolean, boolean) maximized-horizontally}.
  • *
  • {@link #STATE_MASK_FULLSCREEN}: Window {@link #setFullscreen(boolean) fullscreen} can be toggled.
  • *
  • {@link #STATE_MASK_POINTERVISIBLE}: Window {@link #setPointerVisible(boolean) pointer visibility} can be toggled.
  • *
  • {@link #STATE_MASK_POINTERCONFINED}: Window {@link #confinePointer(boolean) pointer can be confined}.
  • + *
  • {@link #STATE_MASK_REPOSITIONABLE}: Window {@link #setPosition(int, int) position} can be changed.
  • * *

    * @see #getStateMask() @@ -605,6 +670,8 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur * @param width of the window's client area in window units * @param height of the window's client area in window units * + * @see {@link #STATE_BIT_RESIZABLE} + * @see {@link #STATE_MASK_RESIZABLE} * @see #setSurfaceSize(int, int) * @see #setTopLevelSize(int, int) * @see #getInsets() -- cgit v1.2.3