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 defaultToolkitLock
viaNativeWindowFactory.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 defaultToolkitLock
viaNativeWindowFactory.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 void
clearHandleOwner()
Object
clone()
boolean
close()
Optionally closing the device if handle is notnull
.int
getDefaultScreen()
Returns the default screen number as referenced by the display connection, i.e.int
getDefaultVisualID()
boolean
isHandleOwner()
boolean
isXineramaEnabled()
boolean
open()
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 defaultToolkitLock
viaNativeWindowFactory.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 defaultToolkitLock
viaNativeWindowFactory.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:
clone
in interfaceAbstractGraphicsDevice
- Overrides:
clone
in classDefaultGraphicsDevice
-
open
public boolean open()
Description copied from interface:AbstractGraphicsDevice
Optionally [re]opening the device if handle isnull
.The default implementation is a
NOP
.Example implementations like
X11GraphicsDevice
orEGLGraphicsDevice
issue the native open operation in case handle isnull
.- Specified by:
open
in interfaceAbstractGraphicsDevice
- Overrides:
open
in classDefaultGraphicsDevice
- Returns:
- true if the handle was
null
and opening was successful, otherwise false.
-
close
public boolean close()
Description copied from interface:AbstractGraphicsDevice
Optionally closing the device if handle is notnull
.The default implementation
dispose
it'sToolkitLock
and sets the handle tonull
.Example implementations like
X11GraphicsDevice
orEGLGraphicsDevice
issue the native close operation or skip it depending on thehandles's ownership
.- Specified by:
close
in interfaceAbstractGraphicsDevice
- Overrides:
close
in classDefaultGraphicsDevice
- Returns:
- true if the handle was not
null
and closing was successful, otherwise false.
-
isHandleOwner
public boolean isHandleOwner()
- Specified by:
isHandleOwner
in interfaceAbstractGraphicsDevice
- Overrides:
isHandleOwner
in classDefaultGraphicsDevice
- Returns:
true
if instance owns the handle to issueAbstractGraphicsDevice.close()
, otherwisefalse
.
-
clearHandleOwner
public void clearHandleOwner()
- Specified by:
clearHandleOwner
in interfaceAbstractGraphicsDevice
- Overrides:
clearHandleOwner
in classDefaultGraphicsDevice
-
-