com.jogamp.nativewindow.x11

## Class X11GraphicsDevice

- java.lang.Object
- - javax.media.nativewindow.DefaultGraphicsDevice
  - - com.jogamp.nativewindow.x11.X11GraphicsDevice

- All Implemented Interfaces:
    Cloneable, AbstractGraphicsDevice

      public class X11GraphicsDevice
      extends DefaultGraphicsDevice
      implements Cloneable

  Encapsulates a graphics device on X11 platforms.

- - ### Field Summary

    - ### Fields inherited from interface javax.media.nativewindow.AbstractGraphicsDevice

      `DEBUG, DEFAULT_CONNECTION, DEFAULT_UNIT, EXTERNAL_CONNECTION`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `X11GraphicsDevice(long display, int unitID, boolean owner)` Constructs a new X11GraphicsDevice corresponding to the given native display handle and default `ToolkitLock` via `NativeWindowFactory.getDefaultToolkitLock(String, long)`.
    `X11GraphicsDevice(long display, int unitID, ToolkitLock locker, boolean owner)`
    `X11GraphicsDevice(String connection, int unitID)` Constructs a new X11GraphicsDevice corresponding to the given connection and default `ToolkitLock` via `NativeWindowFactory.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

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clearHandleOwner()`
    `Object` | `clone()`
    `boolean` | `close()` Optionally closing the device if handle is not `null`.
    `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 is `null`.

    - ### Methods inherited from class javax.media.nativewindow.DefaultGraphicsDevice

      `getConnection, getHandle, getToolkitLock, getType, getUniqueID, getUnitID, lock, swapDeviceHandleAndOwnership, toString, unlock, validateLocked`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### X11GraphicsDevice

          public X11GraphicsDevice(String connection,
                           int unitID)

      Constructs a new X11GraphicsDevice corresponding to the given connection and default `ToolkitLock` via `NativeWindowFactory.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.
      See Also:
        `DefaultGraphicsDevice.DefaultGraphicsDevice(String, String, int)`

    - #### X11GraphicsDevice

          public X11GraphicsDevice(long display,
                           int unitID,
                           boolean owner)

      Constructs a new X11GraphicsDevice corresponding to the given native display handle and default `ToolkitLock` via `NativeWindowFactory.getDefaultToolkitLock(String, long)`.
      See Also:
        `DefaultGraphicsDevice.DefaultGraphicsDevice(String, String, int, long)`

    - #### X11GraphicsDevice

          public X11GraphicsDevice(long display,
                           int unitID,
                           ToolkitLock locker,
                           boolean owner)

      Parameters:
        `display` - the Display connection
        `locker` - custom `ToolkitLock`, eg to force null locking w/ private connection
      See Also:
        `DefaultGraphicsDevice.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 name
        `locker` - custom `ToolkitLock`, eg to force null locking w/ private connection
      See Also:
        `DefaultGraphicsDevice.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' -> 1

      Implementation uses the XLib macro `DefaultScreen(display)`.

    - #### getDefaultVisualID

          public int getDefaultVisualID()

    - #### isXineramaEnabled

          public final boolean isXineramaEnabled()

    - #### clone

          public Object clone()

      Specified by:
        `clone` in interface `AbstractGraphicsDevice`
      Overrides:
        `clone` in class `DefaultGraphicsDevice`

    - #### open

          public boolean open()

      Description copied from interface: `AbstractGraphicsDevice`
      Optionally [re]opening the device if handle is `null`.

      The default implementation is a `NOP`.

      Example implementations like `X11GraphicsDevice` or `EGLGraphicsDevice` issue the native open operation in case handle is `null`.

      Specified by:
        `open` in interface `AbstractGraphicsDevice`
      Overrides:
        `open` in class `DefaultGraphicsDevice`
      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 not `null`.

      The default implementation `dispose` it's `ToolkitLock` and sets the handle to `null`.

      Example implementations like `X11GraphicsDevice` or `EGLGraphicsDevice` issue the native close operation or skip it depending on the `handles's ownership`.

      Specified by:
        `close` in interface `AbstractGraphicsDevice`
      Overrides:
        `close` in class `DefaultGraphicsDevice`
      Returns:
        true if the handle was not `null` and closing was successful, otherwise false.

    - #### isHandleOwner

          public boolean isHandleOwner()

      Specified by:
        `isHandleOwner` in interface `AbstractGraphicsDevice`
      Overrides:
        `isHandleOwner` in class `DefaultGraphicsDevice`
      Returns:
        `true` if instance owns the handle to issue `AbstractGraphicsDevice.close()`, otherwise `false`.

    - #### clearHandleOwner

          public void clearHandleOwner()

      Specified by:
        `clearHandleOwner` in interface `AbstractGraphicsDevice`
      Overrides:
        `clearHandleOwner` in class `DefaultGraphicsDevice`

Copyright 2010 JogAmp Community.