diff options
Diffstat (limited to 'src/nativewindow/classes/com')
5 files changed, 37 insertions, 6 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/DefaultGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/DefaultGraphicsDevice.java index 070b6bb28..56c196132 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/DefaultGraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/DefaultGraphicsDevice.java @@ -45,6 +45,23 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice protected ToolkitLock toolkitLock; /** + * Return the default display connection for the given windowing toolkit type + * gathered via {@link NativeWindowFactory#getDefaultDisplayConnection()}. + * @param type + */ + public static String getDefaultDisplayConnection() { + return NativeWindowFactory.getDefaultDisplayConnection(); + } + /** + * Return the default display connection for the given windowing toolkit type + * gathered via {@link NativeWindowFactory#getDefaultDisplayConnection(String)}. + * @param type + */ + public static String getDefaultDisplayConnection(final String type) { + return NativeWindowFactory.getDefaultDisplayConnection(type); + } + + /** * Create an instance with the system default {@link ToolkitLock}, * gathered via {@link NativeWindowFactory#getDefaultToolkitLock(String)}. * @param type diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/DefaultGraphicsScreen.java b/src/nativewindow/classes/com/jogamp/nativewindow/DefaultGraphicsScreen.java index 63c79af55..cbf3e22da 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/DefaultGraphicsScreen.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/DefaultGraphicsScreen.java @@ -42,7 +42,7 @@ public class DefaultGraphicsScreen implements Cloneable, AbstractGraphicsScreen } public static AbstractGraphicsScreen createDefault(final String type) { - return new DefaultGraphicsScreen(new DefaultGraphicsDevice(type, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT), 0); + return new DefaultGraphicsScreen(new DefaultGraphicsDevice(type, DefaultGraphicsDevice.getDefaultDisplayConnection(type), AbstractGraphicsDevice.DEFAULT_UNIT), 0); } @Override diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java index d01e3a203..811e3767b 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java @@ -54,6 +54,7 @@ import jogamp.nativewindow.WrappedWindow; import jogamp.nativewindow.macosx.OSXUtil; import jogamp.nativewindow.windows.GDIUtil; import jogamp.nativewindow.x11.X11Lib; +import jogamp.nativewindow.x11.X11Util; import com.jogamp.common.os.Platform; import com.jogamp.common.util.PropertyAccess; @@ -647,6 +648,17 @@ public abstract class NativeWindowFactory { VisualIDHolder.VID_UNDEFINED != visualID ; } + public static String getDefaultDisplayConnection() { + return getDefaultDisplayConnection(NativeWindowFactory.getNativeWindowType(true)); + } + public static String getDefaultDisplayConnection(final String nwt) { + if(NativeWindowFactory.TYPE_X11 == nwt) { + return X11Util.getNullDisplayName(); + } else { + return AbstractGraphicsDevice.DEFAULT_CONNECTION; + } + } + /** * Creates a native device type, following {@link #getNativeWindowType(boolean) getNativeWindowType(true)}. * <p> @@ -673,7 +685,7 @@ public abstract class NativeWindowFactory { return new X11GraphicsDevice(displayConnection, AbstractGraphicsDevice.DEFAULT_UNIT); } } else if( NativeWindowFactory.TYPE_WINDOWS == nwt ) { - return new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT); + return new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); } else if( NativeWindowFactory.TYPE_MACOSX == nwt ) { return new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); } else if( NativeWindowFactory.TYPE_EGL == nwt ) { diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java index 04d304cd5..dca05dd18 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java @@ -32,9 +32,11 @@ package com.jogamp.nativewindow.egl; -import com.jogamp.nativewindow.*; - import com.jogamp.common.util.VersionNumber; +import com.jogamp.nativewindow.AbstractGraphicsDevice; +import com.jogamp.nativewindow.DefaultGraphicsDevice; +import com.jogamp.nativewindow.NativeWindowException; +import com.jogamp.nativewindow.NativeWindowFactory; /** Encapsulates a graphics device on EGL platforms. */ @@ -73,7 +75,7 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl * This constructor exist to setup a default device connection/unit.<br> */ public EGLGraphicsDevice() { - super(NativeWindowFactory.TYPE_EGL, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT); + super(NativeWindowFactory.TYPE_EGL, DefaultGraphicsDevice.getDefaultDisplayConnection(), AbstractGraphicsDevice.DEFAULT_UNIT); this.nativeDisplayID[0] = 0 ; // EGL.EGL_DEFAULT_DISPLAY this.eglLifecycleCallback = null; } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java index c750f7651..c79ed2f67 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java @@ -386,7 +386,7 @@ public class SWTAccessor { return new X11GraphicsDevice(xdisplay0, AbstractGraphicsDevice.DEFAULT_UNIT, false /* owner */); } if( isWindows ) { - return new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT); + return new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); } if( isOSX ) { return new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); |