29package com.jogamp.newt;
31import java.io.IOException;
32import java.lang.ref.WeakReference;
33import java.util.ArrayList;
34import java.util.Collection;
35import java.util.Iterator;
37import com.jogamp.nativewindow.AbstractGraphicsDevice;
38import com.jogamp.nativewindow.NativeWindowException;
39import com.jogamp.nativewindow.util.PixelRectangle;
40import com.jogamp.nativewindow.util.PixelFormat;
41import com.jogamp.nativewindow.util.PointImmutable;
43import jogamp.newt.Debug;
45import com.jogamp.common.util.IOUtil;
46import com.jogamp.newt.util.EDTUtil;
49 public static final boolean DEBUG = Debug.debug(
"Display");
58 public boolean equals(
final Object obj) {
59 if (
this == obj) {
return true; }
202 throws IllegalArgumentException, IllegalStateException, IOException;
360 final Iterator<WeakReference<Display>> ri =
displayList.iterator();
361 for(
int j=0; ri.hasNext(); j++) {
362 final Display d = ri.next().get();
363 System.err.println(
" ["+j+
"] : "+d+
", GC'ed "+(
null==d));
377 return getDisplayOfImpl(type, name, fromIndex, 1, shared);
389 return getDisplayOfImpl(type, name, fromIndex, -1, shared);
392 private static Display getDisplayOfImpl(
final String type,
final String name,
final int fromIndex,
final int incr,
final boolean shared) {
394 int i = fromIndex >= 0 ? fromIndex :
displayList.size() - 1 ;
395 while( ( incr > 0 ) ? i <
displayList.size() : i >= 0 ) {
397 if(
null == display ) {
405 if( display.
getType().equals(type) &&
406 display.
getName().equals(name) &&
429 displayList.add(
new WeakReference<Display>(display));
435 ArrayList<Display> list;
437 list =
new ArrayList<Display>();
459 final Thread ct = Thread.currentThread();
460 return "Thread["+
toHexString(ct.hashCode()) +
", " + ct.getName()+
"]";
464 return "0x" + Integer.toHexString(hex);
468 return "0x" + Long.toHexString(hex);
472 return (
null != o ) ? o.hashCode() : 0;
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
static int hashCodeNullSafe(final Object o)
static Display getLastDisplayOf(final String type, final String name, final int fromIndex, final boolean shared)
static Display getFirstDisplayOf(final String type, final String name, final int fromIndex, final boolean shared)
abstract boolean getNativePointerIconForceDirectNIO()
Returns the native platform's direct NIO buffer requirement pointer-icon pixel data.
static final boolean DEBUG
static final ArrayList< WeakReference< Display > > displayList
static String toHexString(final long hex)
abstract void dispatchMessages()
abstract int hashCode()
return precomputed hashCode from FQN getFQName()
boolean equals(final Object obj)
return true if obj is of type Display and both FQN getFQName() equals
abstract int addReference()
The 1st call will initiate native creation, since we follow the lazy creation pattern.
abstract AbstractGraphicsDevice getGraphicsDevice()
Return the AbstractGraphicsDevice used for depending resources lifecycle, i.e.
abstract int getReferenceCount()
abstract String getName()
static int displaysActive
static int getActiveDisplayNumber()
abstract int removeReference()
The last call may destroy this instance, if getDestroyWhenUnused() returns true.
abstract PixelFormat getNativePointerIconPixelFormat()
Returns the native platform's PixelFormat for pointer-icon pixel data.
abstract boolean validateEDTStopped()
Validate EDT running state.
abstract EDTUtil getEDTUtil()
static String getThreadName()
abstract String getType()
abstract String getFQName()
static String toHexString(final int hex)
static Collection< Display > getAllDisplays()
Returns the global display collection.
abstract void destroy()
Manually trigger the destruction, incl.
abstract boolean isExclusive()
Return true if this instance is exclusive, i.e.
abstract boolean isEDTRunning()
abstract void createNative()
Manual trigger the native creation, if it is not done yet.
static final boolean DEBUG_POINTER_ICON
abstract boolean isNativeValid()
abstract PointerIcon createPointerIcon(final IOUtil.ClassResources pngResource, final int hotX, final int hotY)
Returns the newly created PointerIcon or null if not implemented on platform.
static void addDisplay2List(final Display display)
abstract EDTUtil setEDTUtil(EDTUtil usrEDTUtil)
Sets a new EDTUtil and returns the previous one.
static void dumpDisplayList(final String prefix)
abstract long getHandle()
Return the handle of the AbstractGraphicsDevice as returned by getGraphicsDevice().
abstract PointerIcon createPointerIcon(final PixelRectangle pixelrect, final int hotX, final int hotY)
Returns the newly created PointerIcon or null if not implemented on platform.
A interface describing a graphics device in a toolkit-independent manner.
Pixel Rectangle identified by it's hashCode().
Immutable Point interface.
Native PointerIcon handle.
PointImmutable getHotspot()
Returns the hotspot.
boolean isValid()
Returns true if valid, otherwise false.
boolean isGLOriented()
Always false, i.e.
int hashCode()
Computes a hash code over:
void destroy()
Destroys this instance.
int getStride()
Always neatly packed, i.e.
EDT stands for Event Dispatch Thread.