Package com.jogamp.nativewindow.x11
Class X11GraphicsDevice
- java.lang.Object
-
- com.jogamp.nativewindow.DefaultGraphicsDevice
-
- com.jogamp.nativewindow.x11.X11GraphicsDevice
-
- All Implemented Interfaces:
AbstractGraphicsDevice,Cloneable
public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneable
Encapsulates a graphics device on X11 platforms.
-
-
Field Summary
-
Fields inherited from interface com.jogamp.nativewindow.AbstractGraphicsDevice
DEBUG, DEFAULT_CONNECTION, DEFAULT_UNIT, EXTERNAL_CONNECTION
-
-
Constructor Summary
Constructors Constructor Description X11GraphicsDevice(long display, int unitID, boolean owner)Constructs a new X11GraphicsDevice corresponding to the given native display handle and defaultToolkitLockviaNativeWindowFactory.getDefaultToolkitLock(String).X11GraphicsDevice(long display, int unitID, ToolkitLock locker, boolean owner)X11GraphicsDevice(String connection, int unitID)Constructs a new X11GraphicsDevice corresponding to the given connection and defaultToolkitLockviaNativeWindowFactory.getDefaultToolkitLock(String).
Note that this is not an open connection, ie no native display handle exist.X11GraphicsDevice(String displayConnection, int unitID, ToolkitLock locker)Constructs a new X11GraphicsDevice corresponding to the given display connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearHandleOwner()Objectclone()booleanclose()Optionally closing the device if handle is notnull.intgetDefaultScreen()Returns the default screen number as referenced by the display connection, i.e.intgetDefaultVisualID()booleanisHandleOwner()booleanisXineramaEnabled()booleanopen()Optionally [re]opening the device if handle isnull.-
Methods inherited from class com.jogamp.nativewindow.DefaultGraphicsDevice
getConnection, getDefaultDisplayConnection, getDefaultDisplayConnection, getHandle, getToolkitLock, getType, getUniqueID, getUnitID, lock, swapDeviceHandleAndOwnership, toString, unlock, validateLocked
-
-
-
-
Constructor Detail
-
X11GraphicsDevice
public X11GraphicsDevice(String connection, int unitID)
Constructs a new X11GraphicsDevice corresponding to the given connection and defaultToolkitLockviaNativeWindowFactory.getDefaultToolkitLock(String).
Note that this is not an open connection, ie no native display handle exist. This constructor exist to setup a default device connection.
-
X11GraphicsDevice
public X11GraphicsDevice(long display, int unitID, boolean owner)Constructs a new X11GraphicsDevice corresponding to the given native display handle and defaultToolkitLockviaNativeWindowFactory.getDefaultToolkitLock(String).
-
X11GraphicsDevice
public X11GraphicsDevice(long display, int unitID, ToolkitLock locker, boolean owner)- Parameters:
display- the Display connectionlocker- customToolkitLock, eg to force null locking w/ private connection- See Also:
DefaultGraphicsDevice(String, String, int, long, ToolkitLock)
-
X11GraphicsDevice
public X11GraphicsDevice(String displayConnection, int unitID, ToolkitLock locker)
Constructs a new X11GraphicsDevice corresponding to the given display connection.The constructor opens the native connection and takes ownership.
- Parameters:
displayConnection- the semantic display connection namelocker- customToolkitLock, eg to force null locking w/ private connection- See Also:
DefaultGraphicsDevice(String, String, int, long, ToolkitLock)
-
-
Method Detail
-
getDefaultScreen
public int getDefaultScreen()
Returns the default screen number as referenced by the display connection, i.e. 'somewhere:0.1' -> 1Implementation uses the XLib macro
DefaultScreen(display).
-
getDefaultVisualID
public int getDefaultVisualID()
-
isXineramaEnabled
public final boolean isXineramaEnabled()
-
clone
public Object clone()
- Specified by:
clonein interfaceAbstractGraphicsDevice- Overrides:
clonein classDefaultGraphicsDevice
-
open
public boolean open()
Description copied from interface:AbstractGraphicsDeviceOptionally [re]opening the device if handle isnull.The default implementation is a
NOP.Example implementations like
X11GraphicsDeviceorEGLGraphicsDeviceissue the native open operation in case handle isnull.- Specified by:
openin interfaceAbstractGraphicsDevice- Overrides:
openin classDefaultGraphicsDevice- Returns:
- true if the handle was
nulland opening was successful, otherwise false.
-
close
public boolean close()
Description copied from interface:AbstractGraphicsDeviceOptionally closing the device if handle is notnull.The default implementation
disposeit'sToolkitLockand sets the handle tonull.Example implementations like
X11GraphicsDeviceorEGLGraphicsDeviceissue the native close operation or skip it depending on thehandles's ownership.- Specified by:
closein interfaceAbstractGraphicsDevice- Overrides:
closein classDefaultGraphicsDevice- Returns:
- true if the handle was not
nulland closing was successful, otherwise false.
-
isHandleOwner
public boolean isHandleOwner()
- Specified by:
isHandleOwnerin interfaceAbstractGraphicsDevice- Overrides:
isHandleOwnerin classDefaultGraphicsDevice- Returns:
trueif instance owns the handle to issueAbstractGraphicsDevice.close(), otherwisefalse.
-
clearHandleOwner
public void clearHandleOwner()
- Specified by:
clearHandleOwnerin interfaceAbstractGraphicsDevice- Overrides:
clearHandleOwnerin classDefaultGraphicsDevice
-
-