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 GLAnimatorControlAbstractGraphicsDevicefor 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 GLAnimatorControlfinal booleanfinal GLCapabilitiesImmutablefinal GLContextfinal AbstractGraphicsDevicefinal GLEventListener[]final boolean[]final booleanfinal AbstractGraphicsDevice -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Last resort to destroy and loose ownershipReturns aRunnableunlockingan eventually lockedNativeSurface, seemoveFrom(GLAutoDrawable, boolean)andmoveTo(GLAutoDrawable, Runnable).final booleanisOwner()Returnstrue, if this instance is the current owner of the components, otherwisefalse.final intstatic GLEventListenerStatemoveFrom(GLAutoDrawable src) Moves all GLEventListenerState components from the givenGLAutoDrawableto a newly created instance.static GLEventListenerStatemoveFrom(GLAutoDrawable src, boolean keepLocked) Moves all GLEventListenerState components from the givenGLAutoDrawableto a newly created instance.final voidmoveTo(GLAutoDrawable dest) Moves all GLEventListenerState components to the givenGLAutoDrawablefrom this instance, while loosingownership.final voidmoveTo(GLAutoDrawable dest, Runnable destUnlockOperation) Moves all GLEventListenerState components to the givenGLAutoDrawablefrom 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 aRunnableunlockingan 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 givenGLAutoDrawableto a newly created instance.Note that all components are removed from the
GLAutoDrawable, i.e. theGLContext, allGLEventListener.If the
GLAutoDrawablewas added to aGLAnimatorControl, it is removed and theGLAnimatorControladded to the GLEventListenerState.The returned GLEventListenerState instance is the
owner of the components.Locking is performed on the
auto-drawable'supstream-lockandsurface. See GLAutoDrawable Locking.- Parameters:
src-GLAutoDrawablesource to move components from- Returns:
- new GLEventListenerState instance
owningmoved components. - See Also:
-
moveFrom
Moves all GLEventListenerState components from the givenGLAutoDrawableto a newly created instance.Note that all components are removed from the
GLAutoDrawable, i.e. theGLContext, allGLEventListener.If the
GLAutoDrawablewas added to aGLAnimatorControl, it is removed and theGLAnimatorControladded to the GLEventListenerState.The returned GLEventListenerState instance is the
owner of the components.Locking is performed on the
auto-drawable'supstream-lockandsurface, which is not released ifkeepLockedistrue. See GLAutoDrawable Locking.keepLockedmay 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-GLAutoDrawablesource to move components fromkeepLocked- keepupstream-lockandsurfacelocked, see above- Returns:
- new GLEventListenerState instance
owningmoved components. - See Also:
-
moveTo
Moves all GLEventListenerState components to the givenGLAutoDrawablefrom this instance, while loosingownership.If the previous
GLAutoDrawablewas removed from aGLAnimatorControlby previousmoveFrom(GLAutoDrawable), the givenGLAutoDrawableis added to the cachedGLAnimatorControl. This operation is skipped, if the givenGLAutoDrawableis already added to aGLAnimatorControlinstance.Locking is performed on the
auto-drawable'supstream-lockandsurface. See GLAutoDrawable Locking.Note: After this operation, the GLEventListenerState reference should be released.
- Parameters:
dest-GLAutoDrawabledestination to move GLEventListenerState components to- Throws:
GLException- if a realized surface could not be locked.GLException- if this preservedAbstractGraphicsDeviceis incompatible w/ the given destination one.- See Also:
-
moveTo
Moves all GLEventListenerState components to the givenGLAutoDrawablefrom this instance, while loosingownership.If the previous
GLAutoDrawablewas removed from aGLAnimatorControlby previousmoveFrom(GLAutoDrawable, boolean), the givenGLAutoDrawableis added to the cachedGLAnimatorControl. This operation is skipped, if the givenGLAutoDrawableis already added to aGLAnimatorControlinstance.Locking is performed on the
auto-drawable'supstream-lockandsurface. See GLAutoDrawable Locking.If the
GLAutoDrawabledesthas been kept locked bymoveFrom(GLAutoDrawable, boolean), it'sgetUnlockSurfaceOp()shall be passed here todestUnlockOperationto be unlocked.Note: After this operation, the GLEventListenerState reference should be released.
- Parameters:
dest-GLAutoDrawabledestination 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 preservedAbstractGraphicsDeviceis incompatible w/ the given destination one.- See Also:
-