From 45e58f4884108a300f08fd9af6aee82121376974 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Sat, 29 Aug 2015 16:23:49 +0200
Subject: Bug 1203: EGLGraphicsDevice.nativeDisplayID: Differentiate upstream
 device's native handle via own ctor, reducing redundancy

---
 .../com/jogamp/nativewindow/egl/EGLGraphicsDevice.java       | 12 ++++++++++++
 1 file changed, 12 insertions(+)

(limited to 'src/nativewindow')

diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java
index dca05dd18..320c0ec75 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java
@@ -80,6 +80,18 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
         this.eglLifecycleCallback = null;
     }
 
+    public EGLGraphicsDevice(final AbstractGraphicsDevice aDevice, final long eglDisplay, final EGLDisplayLifecycleCallback eglLifecycleCallback) {
+        super(NativeWindowFactory.TYPE_EGL, aDevice.getConnection(), aDevice.getUnitID(), eglDisplay);
+        final long nativeDisplayID;
+        if( aDevice instanceof EGLGraphicsDevice ) {
+            nativeDisplayID = ((EGLGraphicsDevice)aDevice).getNativeDisplayID();
+        } else {
+            nativeDisplayID = aDevice.getHandle();
+        }
+        this.nativeDisplayID[0] = nativeDisplayID;
+        this.eglLifecycleCallback = eglLifecycleCallback;
+    }
+
     public EGLGraphicsDevice(final long nativeDisplayID, final long eglDisplay, final String connection, final int unitID, final EGLDisplayLifecycleCallback eglLifecycleCallback) {
         super(NativeWindowFactory.TYPE_EGL, connection, unitID, eglDisplay);
         this.nativeDisplayID[0] = nativeDisplayID;
-- 
cgit v1.2.3