Class GLEventListenerState
GLAutoDrawable
components crucial
to relocating all its GLEventListener
w/ their operating GLContext
, etc.
The components are:
GLContext
- All
GLEventListener
, incl. their init state GLAnimatorControl
AbstractGraphicsDevice
for compatibility check and preserving the native device handle incl. ownership
A GLEventListenerState instance can be created while components are moved from
a GLAutoDrawable
to the new instance, which gains ownership
of the moved components.
A GLEventListenerState instance's components can be moved to
a GLAutoDrawable
,
while loosing ownership
of the moved components.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal GLAnimatorControl
final boolean
final GLCapabilitiesImmutable
final GLContext
final AbstractGraphicsDevice
final GLEventListener[]
final boolean[]
final boolean
final AbstractGraphicsDevice
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Last resort to destroy and loose ownershipReturns aRunnable
unlocking
an eventually lockedNativeSurface
, seemoveFrom(GLAutoDrawable, boolean)
andmoveTo(GLAutoDrawable, Runnable)
.final boolean
isOwner()
Returnstrue
, if this instance is the current owner of the components, otherwisefalse
.final int
static GLEventListenerState
moveFrom
(GLAutoDrawable src) Moves all GLEventListenerState components from the givenGLAutoDrawable
to a newly created instance.static GLEventListenerState
moveFrom
(GLAutoDrawable src, boolean keepLocked) Moves all GLEventListenerState components from the givenGLAutoDrawable
to a newly created instance.final void
moveTo
(GLAutoDrawable dest) Moves all GLEventListenerState components to the givenGLAutoDrawable
from this instance, while loosingownership
.final void
moveTo
(GLAutoDrawable dest, Runnable destUnlockOperation) Moves all GLEventListenerState components to the givenGLAutoDrawable
from this instance, while loosingownership
.
-
Field Details
-
upstreamDevice
-
proxyOwnsUpstreamDevice
public final boolean proxyOwnsUpstreamDevice -
device
-
caps
-
context
-
listeners
-
listenersInit
public final boolean[] listenersInit -
anim
-
animStarted
public final boolean animStarted
-
-
Method Details
-
isOwner
public final boolean isOwner()Returnstrue
, if this instance is the current owner of the components, otherwisefalse
.Ownership is lost if
moveTo(GLAutoDrawable)
is being called successfully and all components are transferred to the newGLAutoDrawable
. -
listenerCount
public final int listenerCount() -
getUnlockSurfaceOp
Returns aRunnable
unlocking
an eventually lockedNativeSurface
, seemoveFrom(GLAutoDrawable, boolean)
andmoveTo(GLAutoDrawable, Runnable)
. -
destroy
public void destroy()Last resort to destroy and loose ownership -
moveFrom
Moves all GLEventListenerState components from the givenGLAutoDrawable
to a newly created instance.Note that all components are removed from the
GLAutoDrawable
, i.e. theGLContext
, allGLEventListener
.If the
GLAutoDrawable
was added to aGLAnimatorControl
, it is removed and theGLAnimatorControl
added to the GLEventListenerState.The returned GLEventListenerState instance is the
owner of the components
.Locking is performed on the
auto-drawable's
upstream-lock
andsurface
. See GLAutoDrawable Locking.- Parameters:
src
-GLAutoDrawable
source to move components from- Returns:
- new GLEventListenerState instance
owning
moved components. - See Also:
-
moveFrom
Moves all GLEventListenerState components from the givenGLAutoDrawable
to a newly created instance.Note that all components are removed from the
GLAutoDrawable
, i.e. theGLContext
, allGLEventListener
.If the
GLAutoDrawable
was added to aGLAnimatorControl
, it is removed and theGLAnimatorControl
added to the GLEventListenerState.The returned GLEventListenerState instance is the
owner of the components
.Locking is performed on the
auto-drawable's
upstream-lock
andsurface
, which is not released ifkeepLocked
istrue
. See GLAutoDrawable Locking.keepLocked
may be utilized if swapping a context between drawables and to ensure atomicity of operation. Here, thegetUnlockSurfaceOp()
shall be passed tomoveTo(GLAutoDrawable, Runnable)
. SeeGLDrawableUtil.swapGLContextAndAllGLEventListener(GLAutoDrawable, GLAutoDrawable)
.- Parameters:
src
-GLAutoDrawable
source to move components fromkeepLocked
- keepupstream-lock
andsurface
locked, see above- Returns:
- new GLEventListenerState instance
owning
moved components. - See Also:
-
moveTo
Moves all GLEventListenerState components to the givenGLAutoDrawable
from this instance, while loosingownership
.If the previous
GLAutoDrawable
was removed from aGLAnimatorControl
by previousmoveFrom(GLAutoDrawable)
, the givenGLAutoDrawable
is added to the cachedGLAnimatorControl
. This operation is skipped, if the givenGLAutoDrawable
is already added to aGLAnimatorControl
instance.Locking is performed on the
auto-drawable's
upstream-lock
andsurface
. See GLAutoDrawable Locking.Note: After this operation, the GLEventListenerState reference should be released.
- Parameters:
dest
-GLAutoDrawable
destination to move GLEventListenerState components to- Throws:
GLException
- if a realized surface could not be locked.GLException
- if this preservedAbstractGraphicsDevice
is incompatible w/ the given destination one.- See Also:
-
moveTo
Moves all GLEventListenerState components to the givenGLAutoDrawable
from this instance, while loosingownership
.If the previous
GLAutoDrawable
was removed from aGLAnimatorControl
by previousmoveFrom(GLAutoDrawable, boolean)
, the givenGLAutoDrawable
is added to the cachedGLAnimatorControl
. This operation is skipped, if the givenGLAutoDrawable
is already added to aGLAnimatorControl
instance.Locking is performed on the
auto-drawable's
upstream-lock
andsurface
. See GLAutoDrawable Locking.If the
GLAutoDrawable
dest
has been kept locked bymoveFrom(GLAutoDrawable, boolean)
, it'sgetUnlockSurfaceOp()
shall be passed here todestUnlockOperation
to be unlocked.Note: After this operation, the GLEventListenerState reference should be released.
- Parameters:
dest
-GLAutoDrawable
destination to move GLEventListenerState components todestUnlockOperation
- optional unlock operation fordest
, seemoveFrom(GLAutoDrawable, boolean)
.- Throws:
GLException
- if a realized surface could not be locked.GLException
- if this preservedAbstractGraphicsDevice
is incompatible w/ the given destination one.- See Also:
-