Class GLWindow
- All Implemented Interfaces:
NativeSurface
,NativeSurfaceHolder
,NativeWindow
,ScalableSurface
,SurfaceUpdatedListener
,WindowClosingProtocol
,NEWTEventConsumer
,Window
,FPSCounter
,GLAutoDrawable
,GLDrawable
,GLSharedContextSetter
,GLStateKeeper
GLAutoDrawable
and Window
interface,
using a delegated Window
instance, which may be an aggregation (lifecycle: created and destroyed).
This implementation supports GL state preservation
,
hence isGLStatePreservationSupported()
returns true
.
This implementation does not make the OpenGL context current
before calling the various input EventListener callbacks, ie MouseListener
etc.
This design decision is made in favor of a more performant and simplified
implementation. Also the event dispatcher shall be implemented OpenGL agnostic.
To be able to use OpenGL commands from within such input NEWTEventListener
,
you can inject GLRunnable
objects
via GLAutoDrawableBase.invoke(boolean, GLRunnable)
to the OpenGL command stream.
OpenGL Context Sharing
To share a GLContext
see the following note in the documentation overview:
context sharing
as well as GLSharedContextSetter
.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.jogamp.opengl.GLStateKeeper
GLStateKeeper.Listener
Nested classes/interfaces inherited from interface com.jogamp.newt.Window
Window.FocusRunnable, Window.ReparentOperation
Nested classes/interfaces inherited from interface com.jogamp.nativewindow.WindowClosingProtocol
WindowClosingProtocol.WindowClosingMode
-
Field Summary
Fields inherited from class jogamp.opengl.GLAutoDrawableBase
DEBUG
Fields inherited from interface com.jogamp.opengl.FPSCounter
DEFAULT_FRAMES_PER_INTERVAL
Fields inherited from interface com.jogamp.opengl.GLAutoDrawable
SCREEN_CHANGE_ACTION_ENABLED
Fields inherited from interface com.jogamp.nativewindow.NativeSurface
LOCK_SUCCESS, LOCK_SURFACE_CHANGED, LOCK_SURFACE_NOT_READY, LOCK_SURFACE_UNLOCKED
Fields inherited from interface com.jogamp.nativewindow.ScalableSurface
AUTOMAX_PIXELSCALE, IDENTITY_PIXELSCALE
Fields inherited from interface com.jogamp.newt.Window
DEBUG_IMPLEMENTATION, DEBUG_KEY_EVENT, DEBUG_MOUSE_EVENT, REPARENT_HINT_BECOMES_VISIBLE, REPARENT_HINT_FORCE_RECREATION, STATE_BIT_ALWAYSONBOTTOM, STATE_BIT_ALWAYSONTOP, STATE_BIT_AUTOPOSITION, STATE_BIT_CHILDWIN, STATE_BIT_FOCUSED, STATE_BIT_FULLSCREEN, STATE_BIT_MAXIMIZED_HORZ, STATE_BIT_MAXIMIZED_VERT, STATE_BIT_POINTERCONFINED, STATE_BIT_POINTERVISIBLE, STATE_BIT_RESIZABLE, STATE_BIT_STICKY, STATE_BIT_UNDECORATED, STATE_BIT_VISIBLE, STATE_MASK_ALWAYSONBOTTOM, STATE_MASK_ALWAYSONTOP, STATE_MASK_AUTOPOSITION, STATE_MASK_CHILDWIN, STATE_MASK_FOCUSED, STATE_MASK_FULLSCREEN, STATE_MASK_MAXIMIZED_HORZ, STATE_MASK_MAXIMIZED_VERT, STATE_MASK_POINTERCONFINED, STATE_MASK_POINTERVISIBLE, STATE_MASK_RESIZABLE, STATE_MASK_STICKY, STATE_MASK_UNDECORATED, STATE_MASK_VISIBLE, TIMEOUT_NATIVEWINDOW
-
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
addChild
(NativeWindow win) final void
addGestureHandler
(int index, GestureHandler gh) Inserts the givenGestureHandler
at the specified position in the list.final void
Appends the givenGestureHandler
to the end of the list.final void
addGestureListener
(int index, GestureHandler.GestureListener gl) Inserts the givenGestureHandler.GestureListener
at the specified position in the list.final void
Appends the givenGestureHandler.GestureListener
to the end of the list.final void
addKeyListener
(int index, KeyListener l) Inserts the givenKeyListener
at the specified position in the list.final void
Appends the givenKeyListener
to the end of the list.final void
addMouseListener
(int index, MouseListener l) Inserts the givenMouseListener
at the specified position in the list.final void
Appends the givenMouseListener
to the end of the list.final void
addSurfaceUpdatedListener
(int index, SurfaceUpdatedListener l) Inserts the givenSurfaceUpdatedListener
at the specified position in the list.final void
Appends the givenSurfaceUpdatedListener
to the end of the list.final void
addWindowListener
(int index, WindowListener l) Inserts the givenWindowListener
at the specified position in the list.final void
Appends the givenWindowListener
to the end of the list.boolean
Return true if defaultGestureHandler
are enabled.final void
confinePointer
(boolean grab) Confine the pointer to this window, ie.boolean
consumeEvent
(NEWTEvent event) Consume the eventfinal int[]
convertToPixelUnits
(int[] windowUnitsAndResult) Converts the given window units into pixel units in place.final int[]
convertToWindowUnits
(int[] pixelUnitsAndResult) Converts the given pixel units into window units in place.static GLWindow
create
(NativeWindow parentNativeWindow, GLCapabilitiesImmutable caps) Creates a new GLWindow attaching a new child Window of the givenparentNativeWindow
with the given GLCapabilities.static GLWindow
create
(Screen screen, GLCapabilitiesImmutable caps) Creates a new GLWindow attaching a new Window referencing the given Screen with the given GLCapabilities.static GLWindow
Creates a new GLWindow attaching the given window.static GLWindow
Creates a new GLWindow attaching a new Window referencing a new default Screen and default Display with the given GLCapabilities.final void
destroy()
Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext.void
display()
Causes OpenGL rendering to be performed for this GLAutoDrawable in the following order: Callingdisplay(..)
for all registeredGLEventListener
s.final void
enqueueEvent
(boolean wait, NEWTEvent event) Enqueues aNEWT event
.final Rectangle
Returns a newly createdRectangle
containing window origin,NativeWindow.getX()
&NativeWindow.getY()
, and size,NativeWindow.getWidth()
&NativeWindow.getHeight()
, in window units.final CapabilitiesImmutable
Gets an immutable set of chosen capabilities.final float[]
getCurrentSurfaceScale
(float[] result) Returns the current pixel scale of the associatedNativeSurface
.final Window
If the implementation uses delegation, return the delegatedWindow
instance, otherwise returnthis
instance.final long
Convenience: Get display handle from AbstractGraphicsConfiguration .final GLDrawableFactory
Return theGLDrawableFactory
being used to create this instance.Returns the graphics configuration corresponding to this window.final int
Returns the height of the client area excluding insets (window decorations) in window units.final InsetsImmutable
Returns the insets defined as the width and height of the window decoration on the left, right, top and bottom in window units.final KeyListener
getKeyListener
(int index) final KeyListener[]
getLocationOnScreen
(Point storage) Returns the window's top-left client-area position in the screen.final MonitorDevice
final float[]
getMaximumSurfaceScale
(float[] result) Returns the maximum pixel scale of the associatedNativeSurface
.final float[]
getMinimumSurfaceScale
(float[] result) Returns the minimum pixel scale of the associatedNativeSurface
.final MouseListener
getMouseListener
(int index) Returns theMouseListener
from the list at the given index.final MouseListener[]
Returns allMouseListener
final NativeWindow
final float[]
getPixelsPerMM
(float[] ppmmStore) Returns the pixels per millimeter of this window'sNativeSurface
according to themain monitor
's currentmode
'ssurface resolution
.final Display.PointerIcon
Returns the currentDisplay.PointerIcon
, which maybenull
for the default.final CapabilitiesImmutable
Gets an immutable set of requested capabilities.final float[]
getRequestedSurfaceScale
(float[] result) Returns therequested
pixel scale of the associatedNativeSurface
.final Screen
final int
Convenience: Get display handle from AbstractGraphicsConfiguration .final int
Returns the current status mask of this instance.final String
Returns a string representation of thecurrent state mask
.final int
Number of all public state bits.final int
Bitmask covering all public state bits.final int
Returns the supportedstate mask
of the implementation.final String
Returns a string representation of thesupported state mask
.final long
Returns the handle to the surface for this NativeSurface.final int
Returns the height of thisGLDrawable
'ssurface
client area in pixel units.final Thread
Return the locking owner's Thread, or null if not locked.final int
Returns the width of thisGLDrawable
'ssurface
client area in pixel units.final String
getTitle()
final com.jogamp.common.util.locks.RecursiveLock
Returns the recursive lock object of theupstream widget
to synchronize multithreaded access on top ofNativeSurface.lockSurface()
.final Object
Method may return the upstream UI toolkit object holding thisGLAutoDrawable
instance, if exist.final int
getWidth()
Returns the width of the client area excluding insets (window decorations) in window units.final long
Returns the window handle for this NativeWindow.final WindowListener
getWindowListener
(int index) final WindowListener[]
final int
getX()
Returns the x position of the top-left corner of the client area relative to it's parent in window units.final int
getY()
Returns the current y position of the top-left corner of the client area relative to it's parent in window units.boolean
hasFocus()
Returns true if this native window owns the focus, otherwise false.final boolean
final boolean
final boolean
Returnstrue
if this window is a child window, i.e.final boolean
final boolean
final boolean
Returntrue
if the virtual on-screen keyboard is visible, otherwisefalse
.final boolean
final boolean
final boolean
final boolean
final boolean
final boolean
final boolean
isSticky()
final boolean
Query if surface is locked by another thread, i.e.final boolean
final boolean
final int
Lock the surface of this native window.static void
A most simple JOGL AWT test entryfinal boolean
removeChild
(NativeWindow win) final void
Removes the givenGestureHandler
from the list.final void
Removes the givenGestureHandler.GestureListener
from the list.final void
final void
Removes the givenMouseListener
from the list.final void
Remove the specifiedSurfaceUpdatedListener
from the list.final void
final Window.ReparentOperation
reparentWindow
(NativeWindow newParent, int x, int y, int hints) Change this window's parent window.final void
Request focus for this native windowfinal void
requestFocus
(boolean wait) Request focus for this native windowfinal void
runOnEDTIfAvail
(boolean wait, Runnable task) void
sendWindowEvent
(int eventType) Send aWindowEvent
to allWindowListener
.final void
setAlwaysOnBottom
(boolean value) Operation is ignored if this instanceis a child window
.final void
setAlwaysOnTop
(boolean value) Operation is ignored if this instanceis a child window
.Set the CapabilitiesChooser to help determine the native visual type.void
setDefaultGesturesEnabled
(boolean enable) Enable or disable defaultGestureHandler
.final void
setFocusAction
(Window.FocusRunnable focusAction) Sets aWindow.FocusRunnable
, whichWindow.FocusRunnable.run()
method is executed before the native focus is requested.final boolean
setFullscreen
(boolean fullscreen) Enable or disable fullscreen mode for this window.boolean
setFullscreen
(List<MonitorDevice> monitors) Enable fullscreen mode for this window spanning across the givenMonitorDevice
s or across allMonitorDevice
s.void
Sets aKeyListener
allowing focus traversal with a covered window toolkit like AWT.final void
setKeyboardVisible
(boolean visible) In case the platform supports or even requires a virtual on-screen keyboard, this method shows or hide it depending on whethervisible
istrue
orfalse
.final void
setMaximized
(boolean horz, boolean vert) Operation is ignored if this instanceis a child window
.final void
final void
setPointerVisible
(boolean mouseVisible) Makes the pointer visible or invisible.final void
setPosition
(int x, int y) Sets the location of the window's client area excluding insets (window decorations) in window units.
This call is ignored if in fullscreen mode.final void
setResizable
(boolean value) Operation is ignored if this instanceis a child window
.final void
setSize
(int width, int height) Sets the size of the window's client area in window units, excluding decorations.final void
setSticky
(boolean value) Operation is ignored if this instanceis a child window
.final boolean
setSurfaceScale
(float[] pixelScale) Request a pixel scale in x- and y-direction for the associatedNativeSurface
, wheresize_in_pixel_units = pixel_scale * size_in_window_units
.final void
setSurfaceSize
(int pixelWidth, int pixelHeight) Sets the size of the window's surface in pixel units which claims the window's client area excluding decorations.final void
void
setTopLevelPosition
(int x, int y) Sets the location of the top-level window inclusive insets (window decorations) in window units.void
setTopLevelSize
(int width, int height) Sets the size of the top-level window including insets (window decorations) in window units.final void
setUndecorated
(boolean value) final void
setVisible
(boolean visible) CallssetVisible(true, visible)
, i.e.void
setVisible
(boolean wait, boolean visible) setVisible(..)
makes the window and children visible ifvisible
is true, otherwise the window and children becomes invisible.void
Set a custom action handling destruction issued by atoolkit triggered window destroy
replacing the defaultWindow.destroy()
action.final boolean
Provide a mechanism to utilize custom (pre-) swap surface code.final void
surfaceUpdated
(Object updater, NativeSurface ns, long when) Notification of a surface update event, eg.final void
Swaps the front and back buffers of this drawable.final String
toString()
final void
Unlock the surface of this native window Shall not modify the surface handle, seeNativeSurface.lockSurface()
final void
warpPointer
(int x, int y) Moves the pointer to x/y relative to this window's origin in pixel units.final void
windowRepaint
(int x, int y, int width, int height) Trigger window repaint while passing the dirty region in pixel units.Methods inherited from class jogamp.opengl.GLAutoDrawableBase
addGLEventListener, addGLEventListener, areAllGLEventListenerInitialized, clearPreservedGLState, createContext, defaultSwapBuffers, disposeGLEventListener, flushGLRunnables, getAnimator, getAutoSwapBufferMode, getChosenGLCapabilities, getContext, getContextCreationFlags, getDelegatedDrawable, getExclusiveContextThread, getFPSStartTime, getGL, getGLEventListener, getGLEventListenerCount, getGLEventListenerInitState, getGLProfile, getHandle, getLastFPS, getLastFPSPeriod, getLastFPSUpdateTime, getNativeSurface, getPreservedGLState, getRequestedGLCapabilities, getTotalFPS, getTotalFPSDuration, getTotalFPSFrames, getUpdateFPSFrames, invoke, invoke, invokeOnCurrentThread, invokeOnNewThread, isGLOriented, isRealized, isThreadGLCapable, preserveGLStateAtDestroy, removeGLEventListener, resetFPSCounter, setAnimator, setAutoSwapBufferMode, setContext, setContextCreationFlags, setExclusiveContextThread, setGL, setGLEventListenerInitState, setGLStateKeeperListener, setRealized, setSharedAutoDrawable, setSharedContext, setUpdateFPSFrames
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.jogamp.opengl.FPSCounter
getFPSStartTime, getLastFPS, getLastFPSPeriod, getLastFPSUpdateTime, getTotalFPS, getTotalFPSDuration, getTotalFPSFrames, getUpdateFPSFrames, resetFPSCounter, setUpdateFPSFrames
Methods inherited from interface com.jogamp.opengl.GLAutoDrawable
addGLEventListener, addGLEventListener, areAllGLEventListenerInitialized, createContext, disposeGLEventListener, flushGLRunnables, getAnimator, getAutoSwapBufferMode, getContext, getContextCreationFlags, getDelegatedDrawable, getExclusiveContextThread, getGL, getGLEventListener, getGLEventListenerCount, getGLEventListenerInitState, invoke, invoke, isThreadGLCapable, removeGLEventListener, setAnimator, setAutoSwapBufferMode, setContext, setContextCreationFlags, setExclusiveContextThread, setGL, setGLEventListenerInitState
Methods inherited from interface com.jogamp.opengl.GLDrawable
getChosenGLCapabilities, getGLProfile, getHandle, getNativeSurface, getRequestedGLCapabilities, isGLOriented, isRealized, setRealized
Methods inherited from interface com.jogamp.nativewindow.NativeWindow
getNativeSurface
-
Method Details
-
getUpstreamWidget
Description copied from interface:GLAutoDrawable
Method may return the upstream UI toolkit object holding thisGLAutoDrawable
instance, if exist.Currently known Java UI toolkits and it's known return types are:
Toolkit GLAutoDrawable Implementation ~ Return Type of getUpstreamWidget()</td NEWT GLWindow
has a Window
</tdSWT GLCanvas
is a Canvas
</tdAWT GLCanvas
is a Canvas
</tdAWT GLJPanel
is a JPanel
</tdThis method may also return
null
if no UI toolkit is being used, as common for offscreen rendering.- Specified by:
getUpstreamWidget
in interfaceGLAutoDrawable
-
getUpstreamLock
public final com.jogamp.common.util.locks.RecursiveLock getUpstreamLock()Description copied from interface:GLAutoDrawable
Returns the recursive lock object of theupstream widget
to synchronize multithreaded access on top ofNativeSurface.lockSurface()
.- Specified by:
getUpstreamLock
in interfaceGLAutoDrawable
-
create
Creates a new GLWindow attaching a new Window referencing a new default Screen and default Display with the given GLCapabilities.The lifecycle of this Window's Screen and Display is handled via
The default Display will be reused if already instantiated.Screen.addReference()
andScreen.removeReference()
. -
create
Creates a new GLWindow attaching a new Window referencing the given Screen with the given GLCapabilities.The lifecycle of this Window's Screen and Display is handled via
Screen.addReference()
andScreen.removeReference()
. -
create
Creates a new GLWindow attaching the given window.The lifecycle of this Window's Screen and Display is handled via
Screen.addReference()
andScreen.removeReference()
. -
create
Creates a new GLWindow attaching a new child Window of the givenparentNativeWindow
with the given GLCapabilities.The Display/Screen will be compatible with the
parentNativeWindow
, or even identical in case it's a Newt Window. An already instantiated compatible Display will be reused.The lifecycle of this Window's Screen and Display is handled via
Screen.addReference()
andScreen.removeReference()
. -
getDefaultCloseOperation
- Specified by:
getDefaultCloseOperation
in interfaceWindowClosingProtocol
- Returns:
- the current close operation value
- See Also:
-
setDefaultCloseOperation
public WindowClosingProtocol.WindowClosingMode setDefaultCloseOperation(WindowClosingProtocol.WindowClosingMode op) - Specified by:
setDefaultCloseOperation
in interfaceWindowClosingProtocol
- Parameters:
op
- the new close operation value- Returns:
- the previous close operation value
- See Also:
-
getStatePublicBitCount
public final int getStatePublicBitCount()Description copied from interface:Window
Number of all public state bits.- Specified by:
getStatePublicBitCount
in interfaceWindow
- See Also:
-
getStatePublicBitmask
public final int getStatePublicBitmask()Description copied from interface:Window
Bitmask covering all public state bits.- Specified by:
getStatePublicBitmask
in interfaceWindow
- See Also:
-
getStateMask
public final int getStateMask()Description copied from interface:Window
Returns the current status mask of this instance.- Specified by:
getStateMask
in interfaceWindow
- See Also:
-
Window.getSupportedStateMask()
Window.STATE_MASK_VISIBLE
Window.STATE_MASK_AUTOPOSITION
Window.STATE_MASK_CHILDWIN
Window.STATE_MASK_FOCUSED
Window.STATE_MASK_UNDECORATED
Window.STATE_MASK_ALWAYSONTOP
Window.STATE_MASK_ALWAYSONBOTTOM
Window.STATE_MASK_STICKY
Window.STATE_MASK_RESIZABLE
Window.STATE_MASK_MAXIMIZED_VERT
Window.STATE_MASK_MAXIMIZED_HORZ
Window.STATE_MASK_FULLSCREEN
Window.STATE_MASK_POINTERVISIBLE
Window.STATE_MASK_POINTERCONFINED
-
getStateMaskString
Description copied from interface:Window
Returns a string representation of thecurrent state mask
.- Specified by:
getStateMaskString
in interfaceWindow
-
getSupportedStateMask
public final int getSupportedStateMask()Description copied from interface:Window
Returns the supportedstate mask
of the implementation.Implementation provides supported
state mask
values at runtime after native window creation, i.e. first visibility.Please note that a window's size shall also be allowed to change, i.e.
Window.setSize(int, int)
.Default value is
Window.STATE_MASK_VISIBLE
|Window.STATE_MASK_FOCUSED
|Window.STATE_MASK_FULLSCREEN
, i.e. the minimum requirement for all implementations.Before native window creation
Window.getStatePublicBitmask()
is returned, i.e. it is assumed all features are supported.Semantic of the supported state-mask bits (after native creation, i.e. 1st visibility):
Window.STATE_MASK_VISIBLE
:Visibility
can be toggled. Minimum requirement.Window.STATE_MASK_CHILDWIN
:Native window parenting
is supported.Window.STATE_MASK_FOCUSED
: Windowfocus management
is supported. Minimum requirement.Window.STATE_MASK_UNDECORATED
:Window decoration
can be toggled.Window.STATE_MASK_ALWAYSONTOP
: Window can be setalways-on-top
.Window.STATE_MASK_ALWAYSONBOTTOM
: Window can be setalways-on-bottom
.Window.STATE_MASK_STICKY
: Window can be setsticky
.Window.STATE_MASK_RESIZABLE
: Windowresizability
can be toggled.Window.STATE_MASK_MAXIMIZED_VERT
: Window can bemaximized-vertically
.Window.STATE_MASK_MAXIMIZED_HORZ
: Window can bemaximized-horizontally
.Window.STATE_MASK_FULLSCREEN
: Windowfullscreen
can be toggled.Window.STATE_MASK_POINTERVISIBLE
: Windowpointer visibility
can be toggled.Window.STATE_MASK_POINTERCONFINED
: Windowpointer can be confined
.
- Specified by:
getSupportedStateMask
in interfaceWindow
- See Also:
-
getSupportedStateMaskString
Description copied from interface:Window
Returns a string representation of thesupported state mask
.- Specified by:
getSupportedStateMaskString
in interfaceWindow
-
setCapabilitiesChooser
Description copied from interface:Window
Set the CapabilitiesChooser to help determine the native visual type.- Specified by:
setCapabilitiesChooser
in interfaceWindow
- Parameters:
chooser
- the new CapabilitiesChooser- Returns:
- the previous CapabilitiesChooser
-
getChosenCapabilities
Description copied from interface:Window
Gets an immutable set of chosen capabilities.- Specified by:
getChosenCapabilities
in interfaceWindow
- Returns:
- the chosen capabilities
-
getRequestedCapabilities
Description copied from interface:Window
Gets an immutable set of requested capabilities.- Specified by:
getRequestedCapabilities
in interfaceWindow
- Returns:
- the requested capabilities
-
getDelegatedWindow
Description copied from interface:Window
If the implementation uses delegation, return the delegatedWindow
instance, otherwise returnthis
instance.- Specified by:
getDelegatedWindow
in interfaceWindow
-
getParent
- Specified by:
getParent
in interfaceNativeWindow
- Returns:
- The parent NativeWindow, or null if this NativeWindow is top level.
-
getScreen
-
getMainMonitor
Description copied from interface:Window
Returns theMonitorDevice
with the highestviewport
coverage
of this window.If no coverage is detected the first
MonitorDevice
is returned.- Specified by:
getMainMonitor
in interfaceWindow
-
setTitle
-
getTitle
-
isPointerVisible
public final boolean isPointerVisible()- Specified by:
isPointerVisible
in interfaceWindow
- See Also:
-
setPointerVisible
public final void setPointerVisible(boolean mouseVisible) Description copied from interface:Window
Makes the pointer visible or invisible.- Specified by:
setPointerVisible
in interfaceWindow
- Parameters:
mouseVisible
- defaults totrue
for platforms w/ visible pointer, otherwise defaults totrue
, eg. Android.- See Also:
-
getPointerIcon
Description copied from interface:Window
Returns the currentDisplay.PointerIcon
, which maybenull
for the default.- Specified by:
getPointerIcon
in interfaceWindow
- See Also:
-
setPointerIcon
- Specified by:
setPointerIcon
in interfaceWindow
- Parameters:
pi
- ValidDisplay.PointerIcon
reference ornull
to reset the pointer icon to default.- See Also:
-
isPointerConfined
public final boolean isPointerConfined()- Specified by:
isPointerConfined
in interfaceWindow
- See Also:
-
confinePointer
public final void confinePointer(boolean grab) Description copied from interface:Window
Confine the pointer to this window, ie. pointer jail.Before jailing the mouse pointer, the window request the focus and the pointer is centered in the window.
In combination w/
Window.warpPointer(int, int)
and maybeWindow.setPointerVisible(boolean)
a simple mouse navigation can be realized.- Specified by:
confinePointer
in interfaceWindow
- Parameters:
grab
- defaults tofalse
.
-
setUndecorated
public final void setUndecorated(boolean value) - Specified by:
setUndecorated
in interfaceWindow
-
warpPointer
public final void warpPointer(int x, int y) Description copied from interface:Window
Moves the pointer to x/y relative to this window's origin in pixel units.- Specified by:
warpPointer
in interfaceWindow
- Parameters:
x
- relative pointer x position within this window in pixel unitsy
- relative pointer y position within this window in pixel units- See Also:
-
isUndecorated
public final boolean isUndecorated()- Specified by:
isUndecorated
in interfaceWindow
-
setAlwaysOnTop
public final void setAlwaysOnTop(boolean value) Description copied from interface:Window
Operation is ignored if this instance
is a child window
.- Specified by:
setAlwaysOnTop
in interfaceWindow
-
isAlwaysOnTop
public final boolean isAlwaysOnTop()- Specified by:
isAlwaysOnTop
in interfaceWindow
-
setAlwaysOnBottom
public final void setAlwaysOnBottom(boolean value) Description copied from interface:Window
Operation is ignored if this instance
is a child window
.- Specified by:
setAlwaysOnBottom
in interfaceWindow
-
isAlwaysOnBottom
public final boolean isAlwaysOnBottom()- Specified by:
isAlwaysOnBottom
in interfaceWindow
-
setResizable
public final void setResizable(boolean value) Description copied from interface:Window
Operation is ignored if this instance
is a child window
.- Specified by:
setResizable
in interfaceWindow
-
isResizable
public final boolean isResizable()- Specified by:
isResizable
in interfaceWindow
-
setSticky
public final void setSticky(boolean value) Description copied from interface:Window
Operation is ignored if this instance
is a child window
. -
isSticky
public final boolean isSticky() -
setMaximized
public final void setMaximized(boolean horz, boolean vert) Description copied from interface:Window
Operation is ignored if this instance
is a child window
.- Specified by:
setMaximized
in interfaceWindow
-
isMaximizedVert
public final boolean isMaximizedVert()- Specified by:
isMaximizedVert
in interfaceWindow
-
isMaximizedHorz
public final boolean isMaximizedHorz()- Specified by:
isMaximizedHorz
in interfaceWindow
-
setFocusAction
Description copied from interface:Window
Sets aWindow.FocusRunnable
, whichWindow.FocusRunnable.run()
method is executed before the native focus is requested.This allows notifying a covered window toolkit like AWT that the focus is requested, hence focus traversal can be made transparent.
- Specified by:
setFocusAction
in interfaceWindow
-
setKeyboardFocusHandler
Description copied from interface:Window
Sets aKeyListener
allowing focus traversal with a covered window toolkit like AWT.The
KeyListener
methods are invoked prior to all otherKeyListener
's allowing to suppress theKeyEvent
via theNEWTEvent.consumedTag
and to perform focus traversal with a 3rd party toolkit.The
KeyListener
methods are not invoked forauto-repeat
events.- Specified by:
setKeyboardFocusHandler
in interfaceWindow
-
requestFocus
public final void requestFocus()Description copied from interface:Window
Request focus for this native windowThe request is handled on this Window EDT and blocked until finished.
- Specified by:
requestFocus
in interfaceWindow
- See Also:
-
requestFocus
public final void requestFocus(boolean wait) Description copied from interface:Window
Request focus for this native windowThe request is handled on this Window EDT.
- Specified by:
requestFocus
in interfaceWindow
- Parameters:
wait
- true if waiting until the request is executed, otherwise false- See Also:
-
hasFocus
public boolean hasFocus()Description copied from interface:NativeWindow
Returns true if this native window owns the focus, otherwise false.- Specified by:
hasFocus
in interfaceNativeWindow
-
getInsets
Description copied from interface:NativeWindow
Returns the insets defined as the width and height of the window decoration on the left, right, top and bottom in window units.Insets are zero if the window is undecorated, including child windows.
Insets are available only after the native window has been created, ie. the native window has been made visible.
The top-level window area's top-left corner is located atNativeWindow.getX()
- getInsets().getLeftWidth()
NativeWindow.getY()
- getInsets().getTopHeight()
NativeWindow.getWidth()
+ getInsets().getTotalWidth()
NativeWindow.getHeight()
+ getInsets().getTotalHeight()
- Specified by:
getInsets
in interfaceNativeWindow
- Returns:
- insets
-
getX
public final int getX()Description copied from interface:NativeWindow
Returns the x position of the top-left corner of the client area relative to it's parent in window units.If no parent exist (top-level window), this coordinate equals the screen coordinate.
Since the position reflects the client area, it does not include the insets.
See Coordinate System.
- Specified by:
getX
in interfaceNativeWindow
- See Also:
-
getY
public final int getY()Description copied from interface:NativeWindow
Returns the current y position of the top-left corner of the client area relative to it's parent in window units.If no parent exist (top-level window), this coordinate equals the screen coordinate.
Since the position reflects the client area, it does not include the insets.
See Coordinate System.
- Specified by:
getY
in interfaceNativeWindow
- See Also:
-
getWidth
public final int getWidth()Description copied from interface:NativeWindow
Returns the width of the client area excluding insets (window decorations) in window units.- Specified by:
getWidth
in interfaceNativeWindow
- Returns:
- width of the client area in window units
- See Also:
-
getHeight
public final int getHeight()Description copied from interface:NativeWindow
Returns the height of the client area excluding insets (window decorations) in window units.- Specified by:
getHeight
in interfaceNativeWindow
- Returns:
- height of the client area in window units
- See Also:
-
getBounds
Description copied from interface:Window
Returns a newly createdRectangle
containing window origin,NativeWindow.getX()
&NativeWindow.getY()
, and size,NativeWindow.getWidth()
&NativeWindow.getHeight()
, in window units. -
getSurfaceWidth
public final int getSurfaceWidth()Description copied from interface:GLDrawable
Returns the width of thisGLDrawable
'ssurface
client area in pixel units.- Specified by:
getSurfaceWidth
in interfaceGLDrawable
- Specified by:
getSurfaceWidth
in interfaceNativeSurface
- Overrides:
getSurfaceWidth
in classjogamp.opengl.GLAutoDrawableBase
- Returns:
- width of the client area in pixel units
- See Also:
-
getSurfaceHeight
public final int getSurfaceHeight()Description copied from interface:GLDrawable
Returns the height of thisGLDrawable
'ssurface
client area in pixel units.- Specified by:
getSurfaceHeight
in interfaceGLDrawable
- Specified by:
getSurfaceHeight
in interfaceNativeSurface
- Overrides:
getSurfaceHeight
in classjogamp.opengl.GLAutoDrawableBase
- Returns:
- height of the client area in pixel units
- See Also:
-
convertToWindowUnits
public final int[] convertToWindowUnits(int[] pixelUnitsAndResult) Description copied from interface:NativeSurface
Converts the given pixel units into window units in place.- Specified by:
convertToWindowUnits
in interfaceNativeSurface
- Parameters:
pixelUnitsAndResult
- int[2] storage holding the pixel units for the x- and y-coord to convert and the resulting values.- Returns:
- result int[2] storage pixelUnitsAndResult for chaining holding the converted values
- See Also:
-
convertToPixelUnits
public final int[] convertToPixelUnits(int[] windowUnitsAndResult) Description copied from interface:NativeSurface
Converts the given window units into pixel units in place.- Specified by:
convertToPixelUnits
in interfaceNativeSurface
- Parameters:
windowUnitsAndResult
- int[2] storage holding the window units for the x- and y-coord to convert and the resulting values.- Returns:
- result int[2] storage windowUnitsAndResult for chaining holding the converted values
- See Also:
-
setSurfaceScale
public final boolean setSurfaceScale(float[] pixelScale) Description copied from interface:ScalableSurface
Request a pixel scale in x- and y-direction for the associatedNativeSurface
, wheresize_in_pixel_units = pixel_scale * size_in_window_units
.Default pixel scale request for both directions is
ScalableSurface.AUTOMAX_PIXELSCALE
.In case platform only supports uniform pixel scale, i.e. one scale for both directions, either
ScalableSurface.AUTOMAX_PIXELSCALE
or the maximum requested pixel scale component is used.The requested pixel scale will be validated against platform limits before native scale-setup, i.e. clipped to
ScalableSurface.IDENTITY_PIXELSCALE
if not supported or clipped to the platform maximum. It can be queried viaScalableSurface.getRequestedSurfaceScale(float[])
.The actual realized pixel scale values of the
NativeSurface
can be queried viaScalableSurface.getCurrentSurfaceScale(float[])
or computed viasurface.
convertToPixelUnits
(new int[] { 1, 1 })- Specified by:
setSurfaceScale
in interfaceScalableSurface
- Parameters:
pixelScale
- requested surface pixel scale float[2] values for x- and y-direction.- Returns:
true
if thecurrent pixel scale
has changed, otherwisefalse
.- See Also:
-
getRequestedSurfaceScale
public final float[] getRequestedSurfaceScale(float[] result) Description copied from interface:ScalableSurface
Returns therequested
pixel scale of the associatedNativeSurface
.- Specified by:
getRequestedSurfaceScale
in interfaceScalableSurface
- Parameters:
result
- float[2] storage for the result- Returns:
- the passed storage containing the current pixelScale for chaining
- See Also:
-
getCurrentSurfaceScale
public final float[] getCurrentSurfaceScale(float[] result) Description copied from interface:ScalableSurface
Returns the current pixel scale of the associatedNativeSurface
.- Specified by:
getCurrentSurfaceScale
in interfaceScalableSurface
- Parameters:
result
- float[2] storage for the result- Returns:
- the passed storage containing the current pixelScale for chaining
-
getMinimumSurfaceScale
public final float[] getMinimumSurfaceScale(float[] result) Description copied from interface:ScalableSurface
Returns the minimum pixel scale of the associatedNativeSurface
.- Specified by:
getMinimumSurfaceScale
in interfaceScalableSurface
- Parameters:
result
- float[2] storage for the result- Returns:
- the passed storage containing the minimum pixelScale for chaining
-
getMaximumSurfaceScale
public final float[] getMaximumSurfaceScale(float[] result) Description copied from interface:ScalableSurface
Returns the maximum pixel scale of the associatedNativeSurface
.The maximum pixel scale maybe used to determine the proper dpi value of the monitor displaying this
NativeSurface
.surfacePpMM = monitorPpMM * currentSurfaceScale / nativeSurfaceScale, with PpMM == pixel per millimeter
- Specified by:
getMaximumSurfaceScale
in interfaceScalableSurface
- Parameters:
result
- float[2] storage for the result- Returns:
- the passed storage containing the maximum pixelScale for chaining
-
getPixelsPerMM
public final float[] getPixelsPerMM(float[] ppmmStore) Description copied from interface:Window
Returns the pixels per millimeter of this window'sNativeSurface
according to themain monitor
's currentmode
'ssurface resolution
.Method takes the
current surface-scale
andnative surface-scale
into account, i.e.:surfacePpMM = monitorPpMM * currentSurfaceScale / nativeSurfaceScale, with PpMM == pixel per millimeter
To convert the result to dpi, i.e. dots-per-inch, multiply both components with
25.4f
.- Specified by:
getPixelsPerMM
in interfaceWindow
- Parameters:
ppmmStore
- float[2] storage for the ppmm result- Returns:
- the passed storage containing the ppmm for chaining
-
setPosition
public final void setPosition(int x, int y) Description copied from interface:Window
Sets the location of the window's client area excluding insets (window decorations) in window units.
This call is ignored if in fullscreen mode.- Specified by:
setPosition
in interfaceWindow
- Parameters:
x
- coord of the client-area's top left corner in window unitsy
- coord of the client-area's top left corner in window units- See Also:
-
setTopLevelPosition
public void setTopLevelPosition(int x, int y) Description copied from interface:Window
Sets the location of the top-level window inclusive insets (window decorations) in window units.
Note: Insets (if supported) are available only after the window is set visible and hence has been created.
This call is ignored if in fullscreen mode.- Specified by:
setTopLevelPosition
in interfaceWindow
- Parameters:
x
- coord of the top-level left corner in window unitsy
- coord of the top-level left corner in window units- See Also:
-
setFullscreen
public final boolean setFullscreen(boolean fullscreen) Description copied from interface:Window
Enable or disable fullscreen mode for this window.Fullscreen mode is established on the
main monitor
.This method is lifecycle heavy.
- Specified by:
setFullscreen
in interfaceWindow
- Parameters:
fullscreen
- enable or disable fullscreen mode- Returns:
- success
- See Also:
-
setFullscreen
Description copied from interface:Window
Enable fullscreen mode for this window spanning across the givenMonitorDevice
s or across allMonitorDevice
s.Disable fullscreen via
Window.setFullscreen(boolean)
.This method is lifecycle heavy.
- Specified by:
setFullscreen
in interfaceWindow
- Parameters:
monitors
- ifnull
fullscreen will be spanned across allMonitorDevice
s, otherwise across the given list ofMonitorDevice
.- Returns:
- success
- See Also:
-
isFullscreen
public final boolean isFullscreen()- Specified by:
isFullscreen
in interfaceWindow
-
isVisible
public final boolean isVisible() -
toString
- Specified by:
toString
in interfaceGLDrawable
- Overrides:
toString
in classjogamp.opengl.GLAutoDrawableBase
-
reparentWindow
public final Window.ReparentOperation reparentWindow(NativeWindow newParent, int x, int y, int hints) Description copied from interface:Window
Change this window's parent window.
In case the old parent is not null and a Window, this window is removed from it's list of children.
In case the new parent is not null and a Window, this window is added to it's list of children.This method is lifecycle heavy.
- Specified by:
reparentWindow
in interfaceWindow
- Parameters:
newParent
- The new parent NativeWindow. If null, this Window becomes a top level window.x
- new top-level position in window units, use -1 for default position.y
- new top-level position in window units, use -1 for default position.hints
- May contain hints (bitfield values) likeWindow.REPARENT_HINT_FORCE_RECREATION
orWindow.REPARENT_HINT_BECOMES_VISIBLE
.- Returns:
- The issued reparent action type (strategy) as defined in Window.ReparentAction
-
isChildWindow
public final boolean isChildWindow()Description copied from interface:Window
Returnstrue
if this window is a child window, i.e. has beenreparented
.Otherwise return
false
, i.e. this window is a top-level window.- Specified by:
isChildWindow
in interfaceWindow
-
removeChild
- Specified by:
removeChild
in interfaceWindow
-
addChild
-
destroy
public final void destroy()Description copied from interface:GLAutoDrawable
Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext. If a window is attached to it's implementation, it shall be closed. Causes disposing of all OpenGL resources by callingdispose(..)
for all registeredGLEventListener
s. Called automatically by the window system toolkit upon receiving a destroy notification. This routine may be called manually.- Specified by:
destroy
in interfaceGLAutoDrawable
- Specified by:
destroy
in interfaceNativeWindow
- Specified by:
destroy
in interfaceWindow
- See Also:
-
setWindowDestroyNotifyAction
Description copied from interface:Window
Set a custom action handling destruction issued by atoolkit triggered window destroy
replacing the defaultWindow.destroy()
action.The custom action shall call
Window.destroy()
but may perform further tasks before and after.- Specified by:
setWindowDestroyNotifyAction
in interfaceWindow
-
setVisible
public final void setVisible(boolean visible) Description copied from interface:Window
CallssetVisible(true, visible)
, i.e. blocks until the window becomes visible.This method is lifecycle heavy.
- Specified by:
setVisible
in interfaceWindow
- See Also:
-
setVisible
public void setVisible(boolean wait, boolean visible) Description copied from interface:Window
setVisible(..)
makes the window and children visible ifvisible
is true, otherwise the window and children becomes invisible.Native instance gets created at first visibility, following NEWT's lazy creation pattern.
If
wait
is true, method blocks until window isvisible
andvalid
, otherwise method returns immediately.Zero size semantics are respected, see
Window.setSize(int,int)
:
if ( 0 == windowHandle && visible ) { this.visible = visible; if( 0 < width && 0 < height ) { createNative(); } } else if ( this.visible != visible ) { this.visible = visible; setNativeSizeImpl(); }
In case this window is
a child window
and has aNativeWindow
parent,
setVisible(wait, true)
has no effect as long the parent's is not valid yet, i.e.NativeWindow.getWindowHandle()
returnsnull
.
setVisible(wait, true)
shall be repeated when the parent becomes valid.This method is lifecycle heavy.
- Specified by:
setVisible
in interfaceWindow
- See Also:
-
setSize
public final void setSize(int width, int height) Description copied from interface:Window
Sets the size of the window's client area in window units, excluding decorations.Zero size semantics are respected, see
Window.setVisible(boolean)
:
if ( visible && 0 != windowHandle && ( 0 ≥ width || 0 ≥ height ) ) { setVisible(false); } else if ( visible && 0 == windowHandle && 0 < width && 0 < height ) { setVisible(true); } else { // as expected .. }
This call is ignored if in fullscreen mode.
-
setSurfaceSize
public final void setSurfaceSize(int pixelWidth, int pixelHeight) Description copied from interface:Window
Sets the size of the window's surface in pixel units which claims the window's client area excluding decorations.In multiple monitor mode, setting the window's surface size in pixel units might not be possible due to unknown scale values of the target display. Hence re-setting the pixel unit size after window creation is recommended.
Zero size semantics are respected, see
Window.setVisible(boolean)
:
if ( visible && 0 != windowHandle && ( 0 ≥ width || 0 ≥ height ) ) { setVisible(false); } else if ( visible && 0 == windowHandle && 0 < width && 0 < height ) { setVisible(true); } else { // as expected .. }
This call is ignored if in fullscreen mode.
- Specified by:
setSurfaceSize
in interfaceWindow
- Parameters:
pixelWidth
- of the window's client area in pixel unitspixelHeight
- of the window's client area in pixel units- See Also:
-
setTopLevelSize
public void setTopLevelSize(int width, int height) Description copied from interface:Window
Sets the size of the top-level window including insets (window decorations) in window units.Note: Insets (if supported) are available only after the window is set visible and hence has been created.
- Specified by:
setTopLevelSize
in interfaceWindow
- Parameters:
width
- of the top-level window area in window unitsheight
- of the top-level window area in window units- See Also:
-
isNativeValid
public final boolean isNativeValid()- Specified by:
isNativeValid
in interfaceWindow
- Returns:
- true if the native window handle is valid and ready to operate, ie
if the native window has been created via
setVisible(true)
, otherwise false. - See Also:
-
Window.setVisible(boolean)
#destroy(boolean)
-
getLocationOnScreen
Description copied from interface:NativeWindow
Returns the window's top-left client-area position in the screen.If
Point
is notnull
, it is translated about the resulting screen position and returned.See Coordinate System.
Since the position reflects the client area, it does not include the insets.
- Specified by:
getLocationOnScreen
in interfaceNativeWindow
- Parameters:
storage
- OptionalPoint
storage. If not null,null
, it is translated about the resulting screen position and returned.- See Also:
-
display
public void display()Description copied from interface:GLAutoDrawable
Causes OpenGL rendering to be performed for this GLAutoDrawable in the following order:
- Calling
display(..)
for all registeredGLEventListener
s. - Executes all one-shot
GLRunnable
, enqueued viaGLAutoDrawable.invoke(boolean, GLRunnable)
.
May be called periodically by a running
GLAnimatorControl
implementation,
which must register itself withGLAutoDrawable.setAnimator(com.jogamp.opengl.GLAnimatorControl)
.Called automatically by the window system toolkit upon receiving a repaint() request,
except anGLAnimatorControl
implementationGLAnimatorControl.isAnimating()
.This routine may also be called manually for better control over the rendering process. It is legal to call another GLAutoDrawable's display method from within the
display(..)
callback.In case of a new generated OpenGL context, the implementation shall call
init(..)
for all registeredGLEventListener
s before making the actualdisplay(..)
calls, in case this has not been done yet.- Specified by:
display
in interfaceGLAutoDrawable
- See Also:
- Calling
-
isGLStatePreservationSupported
public final boolean isGLStatePreservationSupported()GLWindow supports GL state preservation, hence returns
true
.- Specified by:
isGLStatePreservationSupported
in interfaceGLStateKeeper
- Overrides:
isGLStatePreservationSupported
in classjogamp.opengl.GLAutoDrawableBase
- Returns:
true
if GL state preservation is supported in implementation and on current platform,false
otherwise.- See Also:
-
getFactory
Description copied from interface:GLDrawable
Return theGLDrawableFactory
being used to create this instance.- Specified by:
getFactory
in interfaceGLDrawable
-
swapBuffers
Description copied from interface:GLDrawable
Swaps the front and back buffers of this drawable. ForGLAutoDrawable
implementations, when automatic buffer swapping is enabled (as is the default), this method is called automatically and should not be called by the end user.- Specified by:
swapBuffers
in interfaceGLDrawable
- Throws:
GLException
-
consumeEvent
Description copied from interface:NEWTEventConsumer
Consume the event- Specified by:
consumeEvent
in interfaceNEWTEventConsumer
- Returns:
- true if the event has been consumed, otherwise it returns false for later propagation.
-
windowRepaint
public final void windowRepaint(int x, int y, int width, int height) Description copied from interface:Window
Trigger window repaint while passing the dirty region in pixel units.- Specified by:
windowRepaint
in interfaceWindow
- Parameters:
x
- dirty-region y-pos in pixel unitsy
- dirty-region x-pos in pixel unitswidth
- dirty-region width in pixel unitsheight
- dirty-region height in pixel units
-
enqueueEvent
Description copied from interface:Window
Enqueues aNEWT event
.- Specified by:
enqueueEvent
in interfaceWindow
- Parameters:
wait
- Passingtrue
will block until the event has been processed, otherwise method returns immediately.event
- Theevent
to enqueue.
-
runOnEDTIfAvail
- Specified by:
runOnEDTIfAvail
in interfaceWindow
-
sendWindowEvent
public void sendWindowEvent(int eventType) Description copied from interface:Window
Send aWindowEvent
to allWindowListener
.- Specified by:
sendWindowEvent
in interfaceWindow
- Parameters:
eventType
- aWindowEvent
type, e.g.WindowEvent.EVENT_WINDOW_REPAINT
.
-
getWindowListener
- Specified by:
getWindowListener
in interfaceWindow
-
getWindowListeners
- Specified by:
getWindowListeners
in interfaceWindow
-
removeWindowListener
- Specified by:
removeWindowListener
in interfaceWindow
-
addWindowListener
Description copied from interface:Window
Appends the givenWindowListener
to the end of the list.- Specified by:
addWindowListener
in interfaceWindow
-
addWindowListener
Description copied from interface:Window
Inserts the givenWindowListener
at the specified position in the list.- Specified by:
addWindowListener
in interfaceWindow
- Parameters:
index
- Position where the listener will be inserted. Should be within (0 <= index && index <= size()). An index value of -1 is interpreted as the end of the list, size().l
- The listener object to be inserted- Throws:
IndexOutOfBoundsException
- If the index is not within (0 <= index && index <= size()), or -1
-
setKeyboardVisible
public final void setKeyboardVisible(boolean visible) Description copied from interface:Window
In case the platform supports or even requires a virtual on-screen keyboard, this method shows or hide it depending on whethervisible
istrue
orfalse
.One known platform where NEWT supports this feature is
Android
.- Specified by:
setKeyboardVisible
in interfaceWindow
-
isKeyboardVisible
public final boolean isKeyboardVisible()Description copied from interface:Window
Returntrue
if the virtual on-screen keyboard is visible, otherwisefalse
.Currently on
Android
, the only supported platform right now, there is no way to reliably be notified of the current keyboard state.
It would be best, if your code does not rely on this information.- Specified by:
isKeyboardVisible
in interfaceWindow
- See Also:
-
addKeyListener
Description copied from interface:Window
Appends the givenKeyListener
to the end of the list.- Specified by:
addKeyListener
in interfaceWindow
-
addKeyListener
Description copied from interface:Window
Inserts the givenKeyListener
at the specified position in the list.- Specified by:
addKeyListener
in interfaceWindow
- Parameters:
index
- Position where the listener will be inserted. Should be within (0 <= index && index <= size()). An index value of -1 is interpreted as the end of the list, size().l
- The listener object to be inserted
-
removeKeyListener
- Specified by:
removeKeyListener
in interfaceWindow
-
getKeyListener
- Specified by:
getKeyListener
in interfaceWindow
-
getKeyListeners
- Specified by:
getKeyListeners
in interfaceWindow
-
addMouseListener
Description copied from interface:Window
Appends the givenMouseListener
to the end of the list.- Specified by:
addMouseListener
in interfaceWindow
-
addMouseListener
Description copied from interface:Window
Inserts the givenMouseListener
at the specified position in the list.- Specified by:
addMouseListener
in interfaceWindow
- Parameters:
index
- Position where the listener will be inserted. Should be within (0 <= index && index <= size()). An index value of -1 is interpreted as the end of the list, size().l
- The listener object to be inserted
-
removeMouseListener
Description copied from interface:Window
Removes the givenMouseListener
from the list.- Specified by:
removeMouseListener
in interfaceWindow
-
getMouseListener
Description copied from interface:Window
Returns theMouseListener
from the list at the given index.- Specified by:
getMouseListener
in interfaceWindow
-
getMouseListeners
Description copied from interface:Window
Returns allMouseListener
- Specified by:
getMouseListeners
in interfaceWindow
-
setDefaultGesturesEnabled
public void setDefaultGesturesEnabled(boolean enable) Description copied from interface:Window
Enable or disable defaultGestureHandler
. Default is enabled.- Specified by:
setDefaultGesturesEnabled
in interfaceWindow
-
areDefaultGesturesEnabled
public boolean areDefaultGesturesEnabled()Description copied from interface:Window
Return true if defaultGestureHandler
are enabled.- Specified by:
areDefaultGesturesEnabled
in interfaceWindow
-
addGestureHandler
Description copied from interface:Window
Appends the givenGestureHandler
to the end of the list.- Specified by:
addGestureHandler
in interfaceWindow
-
addGestureHandler
Description copied from interface:Window
Inserts the givenGestureHandler
at the specified position in the list.- Specified by:
addGestureHandler
in interfaceWindow
- Parameters:
index
- Position where the listener will be inserted. Should be within (0 <= index && index <= size()). An index value of -1 is interpreted as the end of the list, size().
-
removeGestureHandler
Description copied from interface:Window
Removes the givenGestureHandler
from the list.- Specified by:
removeGestureHandler
in interfaceWindow
-
addGestureListener
Description copied from interface:Window
Appends the givenGestureHandler.GestureListener
to the end of the list.- Specified by:
addGestureListener
in interfaceWindow
-
addGestureListener
Description copied from interface:Window
Inserts the givenGestureHandler.GestureListener
at the specified position in the list.- Specified by:
addGestureListener
in interfaceWindow
- Parameters:
index
- Position where the listener will be inserted. Should be within (0 <= index && index <= size()). An index value of -1 is interpreted as the end of the list, size().
-
removeGestureListener
Description copied from interface:Window
Removes the givenGestureHandler.GestureListener
from the list.- Specified by:
removeGestureListener
in interfaceWindow
-
lockSurface
Description copied from interface:NativeSurface
Lock the surface of this native window.The surface handle shall be valid after a successfull call, ie return a value other than
NativeSurface.LOCK_SURFACE_UNLOCKED
andNativeSurface.LOCK_SURFACE_NOT_READY
, which isboolean ok = LOCK_SURFACE_NOT_READY < lockSurface();
The caller may need to take care of the result
NativeSurface.LOCK_SURFACE_CHANGED
, where the surface handle is valid but has changed.This call is blocking until the surface has been locked or a timeout is reached. The latter will throw a runtime exception.
This call allows recursion from the same thread.
The implementation may want to aquire the application level
RecursiveLock
first before proceeding with a native surface lock.The implementation shall also invoke
AbstractGraphicsDevice.lock()
for the initial lock (recursive count zero).- Specified by:
lockSurface
in interfaceNativeSurface
- Returns:
NativeSurface.LOCK_SUCCESS
,NativeSurface.LOCK_SURFACE_CHANGED
orNativeSurface.LOCK_SURFACE_NOT_READY
.- Throws:
NativeWindowException
- if native locking failed, maybe platform relatedRuntimeException
- after timeout when waiting for the surface lock- See Also:
-
RecursiveLock
-
unlockSurface
public final void unlockSurface()Description copied from interface:NativeSurface
Unlock the surface of this native window Shall not modify the surface handle, seeNativeSurface.lockSurface()
The implementation shall also invoke
AbstractGraphicsDevice.unlock()
for the final unlock (recursive count zero).The implementation shall be fail safe, i.e. tolerant in case the native resources are already released / unlocked. In this case the implementation shall simply ignore the call.
- Specified by:
unlockSurface
in interfaceNativeSurface
- See Also:
-
NativeSurface.lockSurface()
RecursiveLock
-
isSurfaceLockedByOtherThread
public final boolean isSurfaceLockedByOtherThread()Description copied from interface:NativeSurface
Query if surface is locked by another thread, i.e. not the current one.
Convenient shortcut for:final Thread o = getSurfaceLockOwner(); if( null != o && Thread.currentThread() != o ) { .. }
- Specified by:
isSurfaceLockedByOtherThread
in interfaceNativeSurface
-
getSurfaceLockOwner
Description copied from interface:NativeSurface
Return the locking owner's Thread, or null if not locked.- Specified by:
getSurfaceLockOwner
in interfaceNativeSurface
-
surfaceSwap
public final boolean surfaceSwap()Description copied from interface:NativeSurface
Provide a mechanism to utilize custom (pre-) swap surface code. This method is called before the render toolkit (e.g. JOGL) swaps the buffer/surface if double buffering is enabled.The implementation may itself apply the swapping, in which case true shall be returned.
- Specified by:
surfaceSwap
in interfaceNativeSurface
- Returns:
- true if this method completed swapping the surface, otherwise false, in which case eg the GLDrawable implementation has to swap the code.
-
removeSurfaceUpdatedListener
Description copied from interface:NativeSurface
Remove the specifiedSurfaceUpdatedListener
from the list.- Specified by:
removeSurfaceUpdatedListener
in interfaceNativeSurface
-
addSurfaceUpdatedListener
Description copied from interface:NativeSurface
Appends the givenSurfaceUpdatedListener
to the end of the list.- Specified by:
addSurfaceUpdatedListener
in interfaceNativeSurface
-
addSurfaceUpdatedListener
public final void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l) throws IndexOutOfBoundsException Description copied from interface:NativeSurface
Inserts the givenSurfaceUpdatedListener
at the specified position in the list.- Specified by:
addSurfaceUpdatedListener
in interfaceNativeSurface
- Parameters:
index
- Position where the listener will be inserted. Should be within (0 <= index && index <= size()). An index value of -1 is interpreted as the end of the list, size().l
- The listener object to be inserted- Throws:
IndexOutOfBoundsException
- If the index is not within (0 <= index && index <= size()), or -1
-
surfaceUpdated
Description copied from interface:SurfaceUpdatedListener
Notification of a surface update event, eg. after a swap buffer operation.- Specified by:
surfaceUpdated
in interfaceSurfaceUpdatedListener
- Parameters:
updater
- is the caller object who updated the surface, e.g. a JOGL GLDrawable.ns
- the updated NativeSurfacewhen
- the time in ms, when the surface was updated
-
getWindowHandle
public final long getWindowHandle()Description copied from interface:NativeWindow
Returns the window handle for this NativeWindow.The window handle shall reflect the platform one for all window related operations, e.g. open, close, resize.
On X11 this returns an entity of type Window.
On Microsoft Windows this returns an entity of type HWND.- Specified by:
getWindowHandle
in interfaceNativeWindow
-
getSurfaceHandle
public final long getSurfaceHandle()Description copied from interface:NativeSurface
Returns the handle to the surface for this NativeSurface.The surface handle should be set/update by
NativeSurface.lockSurface()
, whereNativeSurface.unlockSurface()
is not allowed to modify it. AfterNativeSurface.unlockSurface()
it is no more guaranteed that the surface handle is still valid. The surface handle shall reflect the platform one for all drawable surface operations, e.g. opengl, swap-buffer.On X11 this returns an entity of type Window, since there is no differentiation of surface and window there.
On Microsoft Windows this returns an entity of type HDC.- Specified by:
getSurfaceHandle
in interfaceNativeSurface
-
getGraphicsConfiguration
Description copied from interface:NativeSurface
Returns the graphics configuration corresponding to this window.In case the implementation utilizes a delegation pattern to wrap abstract toolkits, this method shall return the native
AbstractGraphicsConfiguration
viaAbstractGraphicsConfiguration.getNativeGraphicsConfiguration()
.- Specified by:
getGraphicsConfiguration
in interfaceNativeSurface
- See Also:
-
AbstractGraphicsConfiguration.getNativeGraphicsConfiguration()
com.jogamp.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen)
-
getDisplayHandle
public final long getDisplayHandle()Description copied from interface:NativeSurface
Convenience: Get display handle from AbstractGraphicsConfiguration . AbstractGraphicsScreen . AbstractGraphicsDevice- Specified by:
getDisplayHandle
in interfaceNativeSurface
-
getScreenIndex
public final int getScreenIndex()Description copied from interface:NativeSurface
Convenience: Get display handle from AbstractGraphicsConfiguration . AbstractGraphicsScreen- Specified by:
getScreenIndex
in interfaceNativeSurface
-
main
A most simple JOGL AWT test entry
-