JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.nativewindow.NativeWindowFactory Class Referenceabstract

Provides a pluggable mechanism for arbitrary window toolkits to adapt their components to the NativeWindow interface, which provides a platform-independent mechanism of accessing the information required to perform operations like hardware-accelerated rendering using the OpenGL API. More...

Collaboration diagram for com.jogamp.nativewindow.NativeWindowFactory:

Static Public Member Functions

static final boolean isJVMShuttingDown ()
 Returns true if the JVM is shutting down, otherwise false. More...
 
static void addCustomShutdownHook (final boolean head, final Runnable runnable)
 Add a custom shutdown hook to be performed at JVM shutdown before shutting down NativeWindowFactory instance. More...
 
static synchronized void shutdown (final boolean _isJVMShuttingDown)
 Cleanup resources at JVM shutdown. More...
 
static synchronized boolean isInitialized ()
 Returns true if initSingleton() has been called w/o subsequent shutdown(boolean). More...
 
static synchronized void initSingleton ()
 Static one time initialization of this factory. More...
 
static boolean requiresToolkitLock ()
 
static boolean isAWTAvailable ()
 
static String getNativeWindowType (final boolean useCustom)
 
static void setDefaultFactory (final NativeWindowFactory factory)
 Don't know if we shall add this factory here . More...
 
static NativeWindowFactory getDefaultFactory ()
 Gets the default NativeWindowFactory. More...
 
static ToolkitLock getAWTToolkitLock ()
 Returns the AWT ToolkitLock (JAWT based) if isAWTAvailable, otherwise null. More...
 
static ToolkitLock getNullToolkitLock ()
 
static ToolkitLock getDefaultToolkitLock ()
 Provides the system default ToolkitLock for the default system windowing type. More...
 
static ToolkitLock getDefaultToolkitLock (final String type)
 Provides the default ToolkitLock for type. More...
 
static AbstractGraphicsScreen createScreen (final AbstractGraphicsDevice device, int screen)
 
static NativeWindowFactory getFactory (final Class<?> windowClass) throws IllegalArgumentException
 Returns the appropriate NativeWindowFactory to handle window objects of the given type. More...
 
static NativeWindow getNativeWindow (final Object winObj, final AbstractGraphicsConfiguration config) throws IllegalArgumentException, NativeWindowException
 Converts the given window object and it's AbstractGraphicsConfiguration into a NativeWindow which can be operated upon by a custom toolkit, e.g. More...
 
static OffscreenLayerSurface getOffscreenLayerSurface (final NativeSurface surface, final boolean ifEnabled)
 Returns the OffscreenLayerSurface instance of this NativeSurface. More...
 
static boolean isNativeVisualIDValidForProcessing (final int visualID)
 Returns true if the given visualID is valid for further processing, i.e. More...
 
static String getDefaultDisplayConnection ()
 
static String getDefaultDisplayConnection (final String nwt)
 
static AbstractGraphicsDevice createDevice (final String displayConnection, final boolean own)
 Creates a native device type, following getNativeWindowType(true). More...
 
static AbstractGraphicsDevice createDevice (final String nwt, final String displayConnection, final boolean own)
 Creates a native device type, following the given native-window-type. More...
 
static AbstractGraphicsDevice createDevice (final String nwt, final String displayConnection, final int unitID, final boolean own)
 Creates a native device type, following the given native-window-type. More...
 
static NativeWindow createWrappedWindow (final AbstractGraphicsScreen aScreen, final long surfaceHandle, final long windowHandle, final UpstreamWindowHookMutableSizePos hook)
 Creates a wrapped NativeWindow with given native handles and AbstractGraphicsScreen. More...
 
static Point getLocationOnScreen (final NativeWindow nw)
 

Static Public Attributes

static final String TYPE_WAYLAND = ".wayland"
 Wayland/EGL type, as retrieved with getNativeWindowType(boolean). More...
 
static final String TYPE_DRM_GBM = ".egl.gbm"
 DRM/GBM type, as retrieved with getNativeWindowType(boolean). More...
 
static final String TYPE_EGL = ".egl"
 OpenKODE/EGL type, as retrieved with getNativeWindowType(boolean). More...
 
static final String TYPE_WINDOWS = ".windows"
 Microsoft Windows type, as retrieved with getNativeWindowType(boolean). More...
 
static final String TYPE_X11 = ".x11"
 X11 type, as retrieved with getNativeWindowType(boolean). More...
 
static final String TYPE_BCM_VC_IV = ".bcm.vc.iv"
 Broadcom VC IV/EGL type, as retrieved with getNativeWindowType(boolean). More...
 
static final String TYPE_ANDROID = ".android"
 Android/EGL type, as retrieved with getNativeWindowType(boolean). More...
 
static final String TYPE_MACOSX = ".macosx"
 Mac OS X type, as retrieved with getNativeWindowType(boolean). More...
 
static final String TYPE_IOS = ".ios"
 iOS type, as retrieved with getNativeWindowType(boolean). More...
 
static final String TYPE_AWT = ".awt"
 Generic AWT type, as retrieved with getNativeWindowType(boolean). More...
 
static final String TYPE_DEFAULT = ".default"
 Generic DEFAULT type, where platform implementation don't care, as retrieved with getNativeWindowType(boolean). More...
 

Protected Member Functions

 NativeWindowFactory ()
 Creates a new NativeWindowFactory instance. More...
 
abstract NativeWindow getNativeWindowImpl (Object winObj, AbstractGraphicsConfiguration config) throws IllegalArgumentException
 Performs the conversion from a toolkit's window object to a NativeWindow. More...
 

Static Protected Member Functions

static void registerFactory (final Class<?> windowClass, final NativeWindowFactory factory)
 Registers a NativeWindowFactory handling window objects of the given class. More...
 

Static Protected Attributes

static final boolean DEBUG
 

Detailed Description

Provides a pluggable mechanism for arbitrary window toolkits to adapt their components to the NativeWindow interface, which provides a platform-independent mechanism of accessing the information required to perform operations like hardware-accelerated rendering using the OpenGL API.

FIXME: Bug 973 Needs service provider interface (SPI) for TK dependent implementation

Definition at line 70 of file NativeWindowFactory.java.

Constructor & Destructor Documentation

◆ NativeWindowFactory()

com.jogamp.nativewindow.NativeWindowFactory.NativeWindowFactory ( )
protected

Creates a new NativeWindowFactory instance.

End users do not need to call this method.

Definition at line 138 of file NativeWindowFactory.java.

Member Function Documentation

◆ addCustomShutdownHook()

static void com.jogamp.nativewindow.NativeWindowFactory.addCustomShutdownHook ( final boolean  head,
final Runnable  runnable 
)
static

Add a custom shutdown hook to be performed at JVM shutdown before shutting down NativeWindowFactory instance.

Parameters
headif true add runnable at the start, otherwise at the end
runnablerunnable to be added.

Definition at line 302 of file NativeWindowFactory.java.

◆ createDevice() [1/3]

static AbstractGraphicsDevice com.jogamp.nativewindow.NativeWindowFactory.createDevice ( final String  displayConnection,
final boolean  own 
)
static

Creates a native device type, following getNativeWindowType(true).

The device will be opened if own is true, otherwise no native handle will ever be acquired.

Definition at line 700 of file NativeWindowFactory.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createDevice() [2/3]

static AbstractGraphicsDevice com.jogamp.nativewindow.NativeWindowFactory.createDevice ( final String  nwt,
final String  displayConnection,
final boolean  own 
)
static

Creates a native device type, following the given native-window-type.

The device will be opened if own is true, otherwise no native handle will ever be acquired.

FIXME: Bug 973 Needs service provider interface (SPI) for TK dependent implementation

Definition at line 713 of file NativeWindowFactory.java.

Here is the call graph for this function:

◆ createDevice() [3/3]

static AbstractGraphicsDevice com.jogamp.nativewindow.NativeWindowFactory.createDevice ( final String  nwt,
final String  displayConnection,
final int  unitID,
final boolean  own 
)
static

Creates a native device type, following the given native-window-type.

The device will be opened if own is true, otherwise no native handle will ever be acquired.

FIXME: Bug 973 Needs service provider interface (SPI) for TK dependent implementation

Definition at line 726 of file NativeWindowFactory.java.

Here is the call graph for this function:

◆ createScreen()

static AbstractGraphicsScreen com.jogamp.nativewindow.NativeWindowFactory.createScreen ( final AbstractGraphicsDevice  device,
int  screen 
)
static
Parameters
device
screen-1 is default screen of the given device, e.g. maybe 0 or determined by native API. >= 0 is specific screen
Returns
newly created AbstractGraphicsScreen matching device's native type

Definition at line 549 of file NativeWindowFactory.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createWrappedWindow()

static NativeWindow com.jogamp.nativewindow.NativeWindowFactory.createWrappedWindow ( final AbstractGraphicsScreen  aScreen,
final long  surfaceHandle,
final long  windowHandle,
final UpstreamWindowHookMutableSizePos  hook 
)
static

Creates a wrapped NativeWindow with given native handles and AbstractGraphicsScreen.

The given UpstreamWindowHookMutableSizePos maybe used to reflect resizes and repositioning of the native window.

The AbstractGraphicsScreen may be created via createScreen(AbstractGraphicsDevice, int).

The AbstractGraphicsScreen may have an underlying open AbstractGraphicsDevice or a simple dummy instance, see createDevice(String, boolean).

Definition at line 782 of file NativeWindowFactory.java.

Here is the caller graph for this function:

◆ getAWTToolkitLock()

static ToolkitLock com.jogamp.nativewindow.NativeWindowFactory.getAWTToolkitLock ( )
static

Returns the AWT ToolkitLock (JAWT based) if isAWTAvailable, otherwise null.

The JAWT based ToolkitLock also locks the global lock, which matters if the latter is required.

Definition at line 509 of file NativeWindowFactory.java.

Here is the caller graph for this function:

◆ getDefaultDisplayConnection() [1/2]

static String com.jogamp.nativewindow.NativeWindowFactory.getDefaultDisplayConnection ( )
static

Definition at line 683 of file NativeWindowFactory.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDefaultDisplayConnection() [2/2]

static String com.jogamp.nativewindow.NativeWindowFactory.getDefaultDisplayConnection ( final String  nwt)
static

Definition at line 686 of file NativeWindowFactory.java.

◆ getDefaultFactory()

static NativeWindowFactory com.jogamp.nativewindow.NativeWindowFactory.getDefaultFactory ( )
static

Gets the default NativeWindowFactory.

Definition at line 498 of file NativeWindowFactory.java.

◆ getDefaultToolkitLock() [1/2]

static ToolkitLock com.jogamp.nativewindow.NativeWindowFactory.getDefaultToolkitLock ( )
static

Provides the system default ToolkitLock for the default system windowing type.

See also
getNativeWindowType(boolean)
getDefaultToolkitLock(java.lang.String)

Definition at line 522 of file NativeWindowFactory.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDefaultToolkitLock() [2/2]

static ToolkitLock com.jogamp.nativewindow.NativeWindowFactory.getDefaultToolkitLock ( final String  type)
static

Provides the default ToolkitLock for type.

Definition at line 534 of file NativeWindowFactory.java.

Here is the call graph for this function:

◆ getFactory()

static NativeWindowFactory com.jogamp.nativewindow.NativeWindowFactory.getFactory ( final Class<?>  windowClass) throws IllegalArgumentException
static

Returns the appropriate NativeWindowFactory to handle window objects of the given type.

The windowClass might be NativeWindow, in which case the client has already assumed the responsibility of creating a compatible NativeWindow implementation, or it might be that of a toolkit class like Component.

Definition at line 574 of file NativeWindowFactory.java.

Here is the caller graph for this function:

◆ getLocationOnScreen()

static Point com.jogamp.nativewindow.NativeWindowFactory.getLocationOnScreen ( final NativeWindow  nw)
static
Parameters
nw
Returns
top-left client-area position in window units

FIXME: Bug 973 Needs service provider interface (SPI) for TK dependent implementation

Definition at line 796 of file NativeWindowFactory.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNativeWindow()

static NativeWindow com.jogamp.nativewindow.NativeWindowFactory.getNativeWindow ( final Object  winObj,
final AbstractGraphicsConfiguration  config 
) throws IllegalArgumentException, NativeWindowException
static

Converts the given window object and it's AbstractGraphicsConfiguration into a NativeWindow which can be operated upon by a custom toolkit, e.g.

com.jogamp.opengl.GLDrawableFactory.
The object may be a component for a particular window toolkit, such as an AWT Canvas. It may also be a NativeWindow object itself.
You shall utilize GraphicsConfigurationFactory to construct a proper AbstractGraphicsConfiguration.
The particular implementation of the NativeWindowFactory is responsible for handling objects from a particular window toolkit. The built-in NativeWindowFactory handles NativeWindow instances as well as AWT Components.

Exceptions
IllegalArgumentExceptionif the given window object could not be handled by any of the registered NativeWindowFactory instances
See also
com.jogamp.nativewindow.GraphicsConfigurationFactory::chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen)

Definition at line 618 of file NativeWindowFactory.java.

Here is the call graph for this function:

◆ getNativeWindowImpl()

abstract NativeWindow com.jogamp.nativewindow.NativeWindowFactory.getNativeWindowImpl ( Object  winObj,
AbstractGraphicsConfiguration  config 
) throws IllegalArgumentException
abstractprotected

Performs the conversion from a toolkit's window object to a NativeWindow.

Implementors of concrete NativeWindowFactory subclasses should override this method.

Here is the caller graph for this function:

◆ getNativeWindowType()

static String com.jogamp.nativewindow.NativeWindowFactory.getNativeWindowType ( final boolean  useCustom)
static
Parameters
useCustomif false return the native value, if true return a custom value if set, otherwise fallback to the native value.
Returns
the native window type, e.g. TYPE_X11, which is canonical via String#intern(). Hence String#equals(Object) and == produce the same result.

Definition at line 473 of file NativeWindowFactory.java.

Here is the caller graph for this function:

◆ getNullToolkitLock()

static ToolkitLock com.jogamp.nativewindow.NativeWindowFactory.getNullToolkitLock ( )
static

Definition at line 513 of file NativeWindowFactory.java.

◆ getOffscreenLayerSurface()

static OffscreenLayerSurface com.jogamp.nativewindow.NativeWindowFactory.getOffscreenLayerSurface ( final NativeSurface  surface,
final boolean  ifEnabled 
)
static

Returns the OffscreenLayerSurface instance of this NativeSurface.

In case this surface is a NativeWindow, we traverse from the given surface up to root until an implementation of OffscreenLayerSurface is found. In case ifEnabled is true, the surface must also implement OffscreenLayerOption where OffscreenLayerOption#isOffscreenLayerSurfaceEnabled() is true.

Parameters
surfaceThe surface to query.
ifEnabledIf true, only return the enabled OffscreenLayerSurface, see OffscreenLayerOption#isOffscreenLayerSurfaceEnabled().
Returns

Definition at line 644 of file NativeWindowFactory.java.

Here is the call graph for this function:

◆ initSingleton()

static synchronized void com.jogamp.nativewindow.NativeWindowFactory.initSingleton ( )
static

Static one time initialization of this factory.


This initialization method must be called once by the program or utilizing modules!

Definition at line 373 of file NativeWindowFactory.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isAWTAvailable()

static boolean com.jogamp.nativewindow.NativeWindowFactory.isAWTAvailable ( )
static
Returns
true if not headless, AWT Component and NativeWindow's AWT part available

Definition at line 466 of file NativeWindowFactory.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isInitialized()

static synchronized boolean com.jogamp.nativewindow.NativeWindowFactory.isInitialized ( )
static

Returns true if initSingleton() has been called w/o subsequent shutdown(boolean).

Definition at line 367 of file NativeWindowFactory.java.

Here is the caller graph for this function:

◆ isJVMShuttingDown()

static final boolean com.jogamp.nativewindow.NativeWindowFactory.isJVMShuttingDown ( )
static

Returns true if the JVM is shutting down, otherwise false.

Definition at line 294 of file NativeWindowFactory.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isNativeVisualIDValidForProcessing()

static boolean com.jogamp.nativewindow.NativeWindowFactory.isNativeVisualIDValidForProcessing ( final int  visualID)
static

Returns true if the given visualID is valid for further processing, i.e.

OpenGL usage, otherwise return false.

On certain platforms, i.e. X11, a valid visualID is required at window creation. Other platforms may determine it later on, e.g. OSX and Windows.

If the visualID is VisualIDHolder#VID_UNDEFINED and the platform requires it at creation time (see above), it is not valid for further processing.

FIXME: Bug 973 Needs service provider interface (SPI) for TK dependent implementation

Definition at line 678 of file NativeWindowFactory.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ registerFactory()

static void com.jogamp.nativewindow.NativeWindowFactory.registerFactory ( final Class<?>  windowClass,
final NativeWindowFactory  factory 
)
staticprotected

Registers a NativeWindowFactory handling window objects of the given class.

This does not need to be called by end users, only implementors of new NativeWindowFactory subclasses.

Definition at line 592 of file NativeWindowFactory.java.

Here is the caller graph for this function:

◆ requiresToolkitLock()

static boolean com.jogamp.nativewindow.NativeWindowFactory.requiresToolkitLock ( )
static
Returns
true if the underlying toolkit requires locking, otherwise false.

Definition at line 461 of file NativeWindowFactory.java.

◆ setDefaultFactory()

static void com.jogamp.nativewindow.NativeWindowFactory.setDefaultFactory ( final NativeWindowFactory  factory)
static

Don't know if we shall add this factory here .

FIXME: Bug 973 Needs service provider interface (SPI) for TK dependent implementation

public static AbstractGraphicsDevice createGraphicsDevice(String type, String connection, int unitID, long handle, ToolkitLock locker) { if(TYPE_EGL == type) { return new } else if(TYPE_X11 == type) { } else if(TYPE_WINDOWS == type) { } else if(TYPE_MACOSX == type)) { } else if(TYPE_AWT == type) { } else if(TYPE_DEFAULT == type) { } } Sets the default NativeWindowFactory.

Definition at line 493 of file NativeWindowFactory.java.

◆ shutdown()

static synchronized void com.jogamp.nativewindow.NativeWindowFactory.shutdown ( final boolean  _isJVMShuttingDown)
static

Cleanup resources at JVM shutdown.

Definition at line 317 of file NativeWindowFactory.java.

Here is the call graph for this function:

Member Data Documentation

◆ DEBUG

final boolean com.jogamp.nativewindow.NativeWindowFactory.DEBUG
staticprotected

Definition at line 71 of file NativeWindowFactory.java.

◆ TYPE_ANDROID

final String com.jogamp.nativewindow.NativeWindowFactory.TYPE_ANDROID = ".android"
static

Android/EGL type, as retrieved with getNativeWindowType(boolean).

String is canonical via String#intern().

Definition at line 92 of file NativeWindowFactory.java.

◆ TYPE_AWT

final String com.jogamp.nativewindow.NativeWindowFactory.TYPE_AWT = ".awt"
static

Generic AWT type, as retrieved with getNativeWindowType(boolean).

String is canonical via String#intern().

Definition at line 101 of file NativeWindowFactory.java.

◆ TYPE_BCM_VC_IV

final String com.jogamp.nativewindow.NativeWindowFactory.TYPE_BCM_VC_IV = ".bcm.vc.iv"
static

Broadcom VC IV/EGL type, as retrieved with getNativeWindowType(boolean).

String is canonical via String#intern().

Definition at line 89 of file NativeWindowFactory.java.

◆ TYPE_DEFAULT

final String com.jogamp.nativewindow.NativeWindowFactory.TYPE_DEFAULT = ".default"
static

Generic DEFAULT type, where platform implementation don't care, as retrieved with getNativeWindowType(boolean).

String is canonical via String#intern().

Definition at line 104 of file NativeWindowFactory.java.

◆ TYPE_DRM_GBM

final String com.jogamp.nativewindow.NativeWindowFactory.TYPE_DRM_GBM = ".egl.gbm"
static

DRM/GBM type, as retrieved with getNativeWindowType(boolean).

String is canonical via String#intern().

Definition at line 77 of file NativeWindowFactory.java.

◆ TYPE_EGL

final String com.jogamp.nativewindow.NativeWindowFactory.TYPE_EGL = ".egl"
static

OpenKODE/EGL type, as retrieved with getNativeWindowType(boolean).

String is canonical via String#intern().

Definition at line 80 of file NativeWindowFactory.java.

◆ TYPE_IOS

final String com.jogamp.nativewindow.NativeWindowFactory.TYPE_IOS = ".ios"
static

iOS type, as retrieved with getNativeWindowType(boolean).

String is canonical via String#intern().

Definition at line 98 of file NativeWindowFactory.java.

◆ TYPE_MACOSX

final String com.jogamp.nativewindow.NativeWindowFactory.TYPE_MACOSX = ".macosx"
static

Mac OS X type, as retrieved with getNativeWindowType(boolean).

String is canonical via String#intern().

Definition at line 95 of file NativeWindowFactory.java.

◆ TYPE_WAYLAND

final String com.jogamp.nativewindow.NativeWindowFactory.TYPE_WAYLAND = ".wayland"
static

Wayland/EGL type, as retrieved with getNativeWindowType(boolean).

String is canonical via String#intern().

Definition at line 74 of file NativeWindowFactory.java.

◆ TYPE_WINDOWS

final String com.jogamp.nativewindow.NativeWindowFactory.TYPE_WINDOWS = ".windows"
static

Microsoft Windows type, as retrieved with getNativeWindowType(boolean).

String is canonical via String#intern().

Definition at line 83 of file NativeWindowFactory.java.

◆ TYPE_X11

final String com.jogamp.nativewindow.NativeWindowFactory.TYPE_X11 = ".x11"
static

X11 type, as retrieved with getNativeWindowType(boolean).

String is canonical via String#intern().

Definition at line 86 of file NativeWindowFactory.java.


The documentation for this class was generated from the following file: