Top Inners Fields Constructors Methods
jogamp.newt

public abstract Class DisplayImpl

extends Display
Class Inheritance
Known Direct Subclasses
jogamp.newt.driver.awt.DisplayDriver, jogamp.newt.driver.bcm.egl.DisplayDriver, jogamp.newt.driver.bcm.vc.iv.DisplayDriver, jogamp.newt.driver.intel.gdl.DisplayDriver, jogamp.newt.driver.kd.DisplayDriver, jogamp.newt.driver.macosx.DisplayDriver, jogamp.newt.driver.windows.DisplayDriver, jogamp.newt.driver.x11.DisplayDriver
Imports
com.jogamp.common.ExceptionUtils, com.jogamp.common.nio.Buffers, com.jogamp.common.util.IOUtil, .InterruptedRuntimeException, .ReflectionUtil, com.jogamp.newt.Display, .NewtFactory, com.jogamp.newt.event.NEWTEvent, .NEWTEventConsumer, jogamp.newt.event.NEWTEventTask, com.jogamp.newt.util.EDTUtil, com.jogamp.opengl.util.PNGPixelRect, java.io.IOException, java.net.URLConnection, java.nio.ByteBuffer, java.util.ArrayList, com.jogamp.nativewindow.AbstractGraphicsDevice, .NativeWindowException, .NativeWindowFactory, com.jogamp.nativewindow.util.PixelFormatUtil, .PixelRectangle, .PixelFormat, .Point, .PointImmutable

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface

Field Summary

Modifier and TypeField and Description
protected AbstractGraphicsDevice
protected final Runnable
protected volatile EDTUtil
private ArrayList<NEWTEventTask>
private final Object
protected boolean
protected String
protected int
private volatile boolean
protected int
protected String
public static final String
private static final boolean
pack-priv final ArrayList<PointerIconImpl>
protected int
private static int
protected String
Inherited from com.jogamp.newt.Display:
DEBUGDEBUG_POINTER_ICONdisplayListdisplaysActive

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final synchronized int
addReference()

Implements abstract com.jogamp.newt.Display.addReference.

The 1st call will initiate native creation, since we follow the lazy creation pattern.
protected abstract void
public static Display
create(final String type, String name, final long handle, final boolean reuse)

Make sure to reuse a Display with the same name

protected EDTUtil
public final synchronized void
createNative()

Implements abstract com.jogamp.newt.Display.createNative.

Manual trigger the native creation, if it is not done yet.
protected abstract void
public final Display.PointerIcon
createPointerIcon(final IOUtil.ClassResources
single PNG resource for the PointerIcon. Only the first entry of IOUtil.ClassResources#resourcePaths is used.
pngResource
,
final int
pointer hotspot x-coord, origin is upper-left corner
hotX
,
final int
pointer hotspot y-coord, origin is upper-left corner
hotY
)

Implements abstract com.jogamp.newt.Display.createPointerIcon.

Returns the newly created PointerIcon or null if not implemented on platform.
public final Display.PointerIcon
createPointerIcon(final PixelRectangle pixelrect, final int
pointer hotspot x-coord, origin is upper-left corner
hotX
,
final int
pointer hotspot y-coord, origin is upper-left corner
hotY
)

Implements abstract com.jogamp.newt.Display.createPointerIcon.

Returns the newly created PointerIcon or null if not implemented on platform.
protected long

Returns:

if successful a valid handle (not null), otherwise null.
createPointerIconImpl
(final PixelFormat
the pixels's format
pixelformat
,
final int
the pixels's width
width
,
final int
the pixels's height
height
,
final ByteBuffer
the pixels
pixels
,
final int
the PointerIcon's hot-spot x-coord
hotX
,
final int
the PointerIcon's hot-spot x-coord
hotY
)

Executed from EDT!

protected final long

Returns:

if successful a valid handle (not null), otherwise null.
createPointerIconImplChecked
(final PixelFormat
the pixels's format
pixelformat
,
final int
the pixels's width
width
,
final int
the pixels's height
height
,
final ByteBuffer
the pixels
pixels
,
final int
the PointerIcon's hot-spot x-coord
hotX
,
final int
the PointerIcon's hot-spot x-coord
hotY
)

Executed from EDT!

public final synchronized void
destroy()

Implements abstract com.jogamp.newt.Display.destroy.

Manually trigger the destruction, incl.
private void
destroyAllPointerIconFromList(final long dpy)

Executed from EDT!

protected void
destroyPointerIconImpl(final long displayHandle, final long piHandle)

Executed from EDT!

pack-priv final void
pack-priv final void
dispatchMessage(final NEWTEventTask eventTask)

public void
protected abstract void
dispatchMessagesNative()

Dispatch native Toolkit messageges

public void
enqueueEvent(final boolean wait, final NEWTEvent e)

public boolean
equals(final Object
the reference object with which to compare.
obj
)

Overrides com.jogamp.newt.Display.equals.

return true if obj is of type Display and both FQN getFQName() equals
private static Class<?>
getDisplayClass(final String type)

public final EDTUtil
public final String
private static String
getFQName(String type, String name, final int id)

public final AbstractGraphicsDevice
getGraphicsDevice()

Implements abstract com.jogamp.newt.Display.getGraphicsDevice.

Return the AbstractGraphicsDevice used for depending resources lifecycle, i.e. Screen and Window, as well as the event dispatching (EDT).
public final long
getHandle()

Implements abstract com.jogamp.newt.Display.getHandle.

Return the handle of the AbstractGraphicsDevice as returned by getGraphicsDevice().
public final int
getId()

Implements abstract com.jogamp.newt.Display.getId.

public final String
public boolean
getNativePointerIconForceDirectNIO()

Implements abstract com.jogamp.newt.Display.getNativePointerIconForceDirectNIO.

Returns the native platform's direct NIO buffer requirement pointer-icon pixel data.
public PixelFormat
getNativePointerIconPixelFormat()

Implements abstract com.jogamp.newt.Display.getNativePointerIconPixelFormat.

Returns the native platform's PixelFormat for pointer-icon pixel data.
public final synchronized int
public final String
public int
hashCode()

Implements abstract com.jogamp.newt.Display.hashCode.

return precomputed hashCode from FQN getFQName()
pack-priv static void
initSingleton()

Ensure static init has been run.

public boolean
public final boolean
isExclusive()

Implements abstract com.jogamp.newt.Display.isExclusive.

Return true if this instance is exclusive, i.e. will not be shared.
public final synchronized boolean
protected final boolean
public static final boolean
public final synchronized int
removeReference()

Implements abstract com.jogamp.newt.Display.removeReference.

The last call may destroy this instance, if getDestroyWhenUnused() returns true.
public void
runOnEDTIfAvail(final boolean wait, final Runnable task)

public static final <T> T
public final <T> T
public synchronized EDTUtil
setEDTUtil(final EDTUtil usrEDTUtil)

Implements abstract com.jogamp.newt.Display.setEDTUtil.

Sets a new EDTUtil and returns the previous one.
pack-priv static final void
shutdownAll()

May be utilized at a shutdown hook, impl.

private static void
stopEDT(final EDTUtil edtUtil, final Runnable task)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public String
validateDisplayName(String name, final long handle)

public boolean
validateEDTStopped()

Implements abstract com.jogamp.newt.Display.validateEDTStopped.

Validate EDT running state.
Inherited from com.jogamp.newt.Display:
addDisplay2ListdumpDisplayListgetActiveDisplayNumbergetAllDisplaysgetFirstDisplayOfgetLastDisplayOfgetThreadNamehashCodeNullSafetoHexStringtoHexString

Field Detail

aDeviceback to summary
protected AbstractGraphicsDevice aDevice
dispatchMessagesRunnableback to summary
protected final Runnable dispatchMessagesRunnable
edtUtilback to summary
protected volatile EDTUtil edtUtil
eventsback to summary
private ArrayList<NEWTEventTask> events
eventsLockback to summary
private final Object eventsLock
exclusiveback to summary
protected boolean exclusive
fqnameback to summary
protected String fqname
hashCodeback to summary
protected int hashCode
haveEventsback to summary
private volatile boolean haveEvents
idback to summary
protected int id
nameback to summary
protected String name
nilStringback to summary
public static final String nilString
pngUtilAvailback to summary
private static final boolean pngUtilAvail
pointerIconListback to summary
pack-priv final ArrayList<PointerIconImpl> pointerIconList
refCountback to summary
protected int refCount
serialnoback to summary
private static int serialno
typeback to summary
protected String type

Constructor Detail

DisplayImplback to summary
public DisplayImpl()

Method Detail

addReferenceback to summary
public final synchronized int addReference()

Implements abstract com.jogamp.newt.Display.addReference.

Doc from com.jogamp.newt.Display.addReference.

The 1st call will initiate native creation, since we follow the lazy creation pattern.

Returns:int

number of references post operation

Annotations
@Override
closeNativeImplback to summary
protected abstract void closeNativeImpl(AbstractGraphicsDevice aDevice)
createback to summary
public static Display create(final String type, String name, final long handle, final boolean reuse)

Make sure to reuse a Display with the same name

createEDTUtilback to summary
protected EDTUtil createEDTUtil()
createNativeback to summary
public final synchronized void createNative() throws NativeWindowException

Implements abstract com.jogamp.newt.Display.createNative.

Doc from com.jogamp.newt.Display.createNative.

Manual trigger the native creation, if it is not done yet.
This is useful to be able to request the com.jogamp.nativewindow.AbstractGraphicsDevice, via getGraphicsDevice().
Otherwise the abstract device won't be available before the dependent components (Screen and Window) are realized.

This method is usually invoke by addReference()

Annotations
@Override
Exceptions
NativeWindowException:
if the native creation failed.
createNativeImplback to summary
protected abstract void createNativeImpl()
createPointerIconback to summary
public final Display.PointerIcon createPointerIcon(final IOUtil.ClassResources pngResource, final int hotX, final int hotY) throws IllegalArgumentException, IllegalStateException, IOException

Implements abstract com.jogamp.newt.Display.createPointerIcon.

Doc from com.jogamp.newt.Display.createPointerIcon.

Returns the newly created PointerIcon or null if not implemented on platform.

See PointerIcon for lifecycle semantics.

Parameters
pngResource:IOUtil.ClassResources

single PNG resource for the PointerIcon. Only the first entry of IOUtil.ClassResources#resourcePaths is used.

hotX:int

pointer hotspot x-coord, origin is upper-left corner

hotY:int

pointer hotspot y-coord, origin is upper-left corner

Annotations
@Override
Exceptions
IllegalArgumentException:
if pngResource is null or invalid
IllegalStateException:
if this Display instance is not valid yet.
IOException:
if the pngResource could not be resolved or via the PNG parser processing the input stream.
createPointerIconback to summary
public final Display.PointerIcon createPointerIcon(final PixelRectangle pixelrect, final int hotX, final int hotY) throws IllegalArgumentException, IllegalStateException

Implements abstract com.jogamp.newt.Display.createPointerIcon.

Doc from com.jogamp.newt.Display.createPointerIcon.

Returns the newly created PointerIcon or null if not implemented on platform.

See PointerIcon for lifecycle semantics.

In case getNativePointerIconPixelFormat() or getNativePointerIconForceDirectNIO() is not matched by the given pixelrect, the pixelrect is converted into the required PixelFormat and NIO type.

Parameters
pixelrect:PixelRectangle

PixelRectangle source for the PointerIcon

hotX:int

pointer hotspot x-coord, origin is upper-left corner

hotY:int

pointer hotspot y-coord, origin is upper-left corner

Annotations
@Override
Exceptions
IllegalArgumentException:
if pixelrect is null.
IllegalStateException:
if this Display instance is not valid yet.
createPointerIconImplback to summary
protected long createPointerIconImpl(final PixelFormat pixelformat, final int width, final int height, final ByteBuffer pixels, final int hotX, final int hotY)

Executed from EDT!

Parameters
pixelformat:PixelFormat

the pixels's format

width:int

the pixels's width

height:int

the pixels's height

pixels:ByteBuffer

the pixels

hotX:int

the PointerIcon's hot-spot x-coord

hotY:int

the PointerIcon's hot-spot x-coord

Returns:long

if successful a valid handle (not null), otherwise null.

createPointerIconImplCheckedback to summary
protected final long createPointerIconImplChecked(final PixelFormat pixelformat, final int width, final int height, final ByteBuffer pixels, final int hotX, final int hotY)

Executed from EDT!

Parameters
pixelformat:PixelFormat

the pixels's format

width:int

the pixels's width

height:int

the pixels's height

pixels:ByteBuffer

the pixels

hotX:int

the PointerIcon's hot-spot x-coord

hotY:int

the PointerIcon's hot-spot x-coord

Returns:long

if successful a valid handle (not null), otherwise null.

destroyback to summary
public final synchronized void destroy()

Implements abstract com.jogamp.newt.Display.destroy.

Doc from com.jogamp.newt.Display.destroy.

Manually trigger the destruction, incl. native destruction.

This method is usually invoke by removeReference()

Annotations
@Override
destroyAllPointerIconFromListback to summary
private void destroyAllPointerIconFromList(final long dpy)

Executed from EDT!

destroyPointerIconImplback to summary
protected void destroyPointerIconImpl(final long displayHandle, final long piHandle)

Executed from EDT!

dispatchMessageback to summary
pack-priv final void dispatchMessage(final NEWTEvent event)
dispatchMessageback to summary
pack-priv final void dispatchMessage(final NEWTEventTask eventTask)
dispatchMessagesback to summary
public void dispatchMessages()

Implements abstract com.jogamp.newt.Display.dispatchMessages.

Annotations
@Override
dispatchMessagesNativeback to summary
protected abstract void dispatchMessagesNative()

Dispatch native Toolkit messageges

enqueueEventback to summary
public void enqueueEvent(final boolean wait, final NEWTEvent e)
equalsback to summary
public boolean equals(final Object obj)

Overrides com.jogamp.newt.Display.equals.

Doc from com.jogamp.newt.Display.equals.

return true if obj is of type Display and both FQN getFQName() equals

Parameters
obj:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getDisplayClassback to summary
private static Class<?> getDisplayClass(final String type) throws ClassNotFoundException
getEDTUtilback to summary
public final EDTUtil getEDTUtil()

Implements abstract com.jogamp.newt.Display.getEDTUtil.

Annotations
@Override
getFQNameback to summary
public final String getFQName()

Implements abstract com.jogamp.newt.Display.getFQName.

Returns:String

Doc from com.jogamp.newt.Display.getFQName.

The fully qualified Display name, which is a key of getType() + getName() + getId().

Annotations
@Override
getFQNameback to summary
private static String getFQName(String type, String name, final int id)
getGraphicsDeviceback to summary
public final AbstractGraphicsDevice getGraphicsDevice()

Implements abstract com.jogamp.newt.Display.getGraphicsDevice.

Doc from com.jogamp.newt.Display.getGraphicsDevice.

Return the AbstractGraphicsDevice used for depending resources lifecycle, i.e. Screen and Window, as well as the event dispatching (EDT).

Annotations
@Override
getHandleback to summary
public final long getHandle()

Implements abstract com.jogamp.newt.Display.getHandle.

Doc from com.jogamp.newt.Display.getHandle.

Return the handle of the AbstractGraphicsDevice as returned by getGraphicsDevice().

Annotations
@Override
getIdback to summary
public final int getId()

Implements abstract com.jogamp.newt.Display.getId.

Returns:int

Doc from com.jogamp.newt.Display.getId.

this display internal serial id

Annotations
@Override
getNameback to summary
public final String getName()

Implements abstract com.jogamp.newt.Display.getName.

Returns:String

Doc from com.jogamp.newt.Display.getName.

This display connection name as defined at creation time. The display connection name is a technical platform specific detail, see AbstractGraphicsDevice#getConnection().

Annotations
@Override
getNativePointerIconForceDirectNIOback to summary
public boolean getNativePointerIconForceDirectNIO()

Implements abstract com.jogamp.newt.Display.getNativePointerIconForceDirectNIO.

Doc from com.jogamp.newt.Display.getNativePointerIconForceDirectNIO.

Returns the native platform's direct NIO buffer requirement pointer-icon pixel data.

Using this value will avoid conversion within createPointerIcon(PixelRectangle, int, int).

Annotations
@Override
getNativePointerIconPixelFormatback to summary
public PixelFormat getNativePointerIconPixelFormat()

Implements abstract com.jogamp.newt.Display.getNativePointerIconPixelFormat.

Doc from com.jogamp.newt.Display.getNativePointerIconPixelFormat.

Returns the native platform's PixelFormat for pointer-icon pixel data.

Using this value will avoid conversion within createPointerIcon(PixelRectangle, int, int).

Known native pixel formats are:

Annotations
@Override
getReferenceCountback to summary
public final synchronized int getReferenceCount()

Implements abstract com.jogamp.newt.Display.getReferenceCount.

Returns:int

Doc from com.jogamp.newt.Display.getReferenceCount.

number of references

Annotations
@Override
getTypeback to summary
public final String getType()

Implements abstract com.jogamp.newt.Display.getType.

Returns:String

Doc from com.jogamp.newt.Display.getType.

the native display type, ie com.jogamp.nativewindow.NativeWindowFactory#getNativeWindowType(boolean)

Annotations
@Override
hashCodeback to summary
public int hashCode()

Implements abstract com.jogamp.newt.Display.hashCode.

Doc from com.jogamp.newt.Display.hashCode.

return precomputed hashCode from FQN getFQName()

Returns:int

Doc from java.lang.Object.hashCode.

a hash code value for this object

Annotations
@Override
initSingletonback to summary
pack-priv static void initSingleton()

Ensure static init has been run.

isEDTRunningback to summary
public boolean isEDTRunning()

Implements abstract com.jogamp.newt.Display.isEDTRunning.

Returns:boolean

Doc from com.jogamp.newt.Display.isEDTRunning.

true if EDT is running and not subject to be stopped, otherwise false.

Annotations
@Override
isExclusiveback to summary
public final boolean isExclusive()

Implements abstract com.jogamp.newt.Display.isExclusive.

Doc from com.jogamp.newt.Display.isExclusive.

Return true if this instance is exclusive, i.e. will not be shared.

Annotations
@Override
isNativeValidback to summary
public final synchronized boolean isNativeValid()

Implements abstract com.jogamp.newt.Display.isNativeValid.

Returns:boolean

Doc from com.jogamp.newt.Display.isNativeValid.

true if the native display handle is valid and ready to operate, otherwise false.

Annotations
@Override
isNativeValidAsyncback to summary
protected final boolean isNativeValidAsync()
isPNGUtilAvailableback to summary
public static final boolean isPNGUtilAvailable()
removeReferenceback to summary
public final synchronized int removeReference()

Implements abstract com.jogamp.newt.Display.removeReference.

Doc from com.jogamp.newt.Display.removeReference.

The last call may destroy this instance, if getDestroyWhenUnused() returns true.

Returns:int

number of references post operation

Annotations
@Override
runOnEDTIfAvailback to summary
public void runOnEDTIfAvail(final boolean wait, final Runnable task)
runWithLockedDeviceback to summary
public static final <T> T runWithLockedDevice(final AbstractGraphicsDevice device, final DisplayImpl.DisplayRunnable<T> action)
runWithLockedDisplayDeviceback to summary
public final <T> T runWithLockedDisplayDevice(final DisplayImpl.DisplayRunnable<T> action)
setEDTUtilback to summary
public synchronized EDTUtil setEDTUtil(final EDTUtil usrEDTUtil)

Implements abstract com.jogamp.newt.Display.setEDTUtil.

Doc from com.jogamp.newt.Display.setEDTUtil.

Sets a new EDTUtil and returns the previous one.

If usrEDTUtil is null, the device's default EDTUtil is created and used.

If a previous one exists and it differs from usrEDTUtil, it's being stopped, wait-until-idle.

If usrEDTUtil is not null and equals the previous one, no change is being made.

Annotations
@Override
shutdownAllback to summary
pack-priv static final void shutdownAll()

May be utilized at a shutdown hook, impl. does not block.

stopEDTback to summary
private static void stopEDT(final EDTUtil edtUtil, final Runnable task)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
validateDisplayNameback to summary
public String validateDisplayName(String name, final long handle)
validateEDTStoppedback to summary
public boolean validateEDTStopped()

Implements abstract com.jogamp.newt.Display.validateEDTStopped.

Doc from com.jogamp.newt.Display.validateEDTStopped.

Validate EDT running state.
Stop the running EDT in case this display is destroyed already.

Returns:boolean

true if EDT has been stopped (destroyed but running), otherwise false.

Annotations
@Override
jogamp.newt back to summary

public Interface DisplayImpl.DisplayRunnable<T>


Method Summary

Modifier and TypeMethod and Description
public T
run(long dpy)

Method Detail

runback to summary
public T run(long dpy)