aboutsummaryrefslogtreecommitdiffstats
path: root/src/nativewindow
diff options
context:
space:
mode:
Diffstat (limited to 'src/nativewindow')
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java43
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java1
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java4
3 files changed, 43 insertions, 5 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java
index 4ee336176..d161f2f34 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java
@@ -36,25 +36,60 @@ import javax.media.nativewindow.*;
/** Encapsulates a graphics device on EGL platforms.
*/
-
public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneable {
- boolean closeDisplay = false;
+ final long nativeDisplayID;
+ final EGLTerminateCallback eglTerminateCallback;
/**
+ * Hack to allow inject a EGL termination call.
+ * <p>
+ * FIXME: This shall be removed when relocated EGL to the nativewindow package,
+ * since then it can be utilized directly.
+ * </p>
+ */
+ public interface EGLTerminateCallback {
+ /**
+ * Implementation should issue an <code>EGL.eglTerminate(eglDisplayHandle)</code> call.
+ * @param eglDisplayHandle
+ */
+ void eglTerminate(long eglDisplayHandle);
+ }
+
+ /**
* Note that this is not an open connection, ie no native display handle exist.
* This constructor exist to setup a default device connection/unit.<br>
*/
public EGLGraphicsDevice(String connection, int unitID) {
super(NativeWindowFactory.TYPE_EGL, connection, unitID);
+ this.nativeDisplayID = 0;
+ this.eglTerminateCallback = null;
}
- /** Constructs a new EGLGraphicsDevice corresponding to the given EGL display handle. */
- public EGLGraphicsDevice(long eglDisplay, String connection, int unitID) {
+ public EGLGraphicsDevice(long nativeDisplayID, long eglDisplay, String connection, int unitID, EGLTerminateCallback eglTerminateCallback) {
super(NativeWindowFactory.TYPE_EGL, connection, unitID, eglDisplay);
+ this.nativeDisplayID = nativeDisplayID;
+ this.eglTerminateCallback = eglTerminateCallback;
}
+ public long getNativeDisplayID() { return nativeDisplayID; }
+
public Object clone() {
return super.clone();
}
+
+ public boolean close() {
+ if(null != eglTerminateCallback) {
+ if(DEBUG) {
+ System.err.println(Thread.currentThread().getName() + " - eglTerminate: "+this);
+ }
+ eglTerminateCallback.eglTerminate(handle);
+ }
+ return super.close();
+ }
+
+ @Override
+ public String toString() {
+ return "EGLGraphicsDevice[type EGL, connection "+getConnection()+", unitID "+getUnitID()+", handle 0x"+Long.toHexString(getHandle())+", nativeDisplayID 0x"+Long.toHexString(nativeDisplayID)+"]";
+ }
}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java
index 308756b54..a02332413 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java
@@ -46,7 +46,6 @@ import javax.media.nativewindow.ToolkitLock;
*/
public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneable {
- public static final boolean DEBUG = Debug.debug("GraphicsDevice");
final boolean closeDisplay;
/** Constructs a new X11GraphicsDevice corresponding to the given connection and default
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
index 1dd01a274..4979f1949 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
@@ -40,11 +40,15 @@
package javax.media.nativewindow;
+import jogamp.nativewindow.Debug;
+
/** A interface describing a graphics device in a
toolkit-independent manner.
*/
public interface AbstractGraphicsDevice extends Cloneable {
+ public static final boolean DEBUG = Debug.debug("GraphicsDevice");
+
/** Dummy connection value for a default connection where no native support for multiple devices is available */
public static String DEFAULT_CONNECTION = "decon";