diff options
Diffstat (limited to 'src')
3 files changed, 28 insertions, 6 deletions
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index fb11f8bba..ca5cd424b 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -237,7 +237,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { // NativeWindowFactory.getNullToolkitLock(), true); // own non-shared display connection, w/o locking sharedDevice.lock(); try { - final X11GraphicsScreen sharedScreen = new X11GraphicsScreen(sharedDevice, 0); + final X11GraphicsScreen sharedScreen = new X11GraphicsScreen(sharedDevice, sharedDevice.getDefaultScreen()); if(!GLXUtil.isGLXAvailableOnServer(sharedDevice)) { throw new GLException("GLX not available on device/server: "+sharedDevice); @@ -514,7 +514,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } else { device = (X11GraphicsDevice)deviceReq; } - final X11GraphicsScreen screen = new X11GraphicsScreen(device, 0); + final X11GraphicsScreen screen = new X11GraphicsScreen(device, device.getDefaultScreen()); final X11GLXGraphicsConfiguration config = X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen, VisualIDHolder.VID_UNDEFINED); if(null == config) { throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen); diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java index 5e4d6f41a..152384980 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java @@ -84,11 +84,34 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl handleOwner = owner; } + private static int getDefaultScreenImpl(long dpy) { + return X11Lib.DefaultScreen(dpy); + } + + /** + * Returns the default screen number as referenced by the display connection, i.e. 'somewhere:0.1' -> 1 + * <p> + * Implementation uses the XLib macro <code>DefaultScreen(display)</code>. + * </p> + */ + public int getDefaultScreen() { + final long display = getHandle(); + if(0==display) { + throw new NativeWindowException("null display"); + } + final int ds = getDefaultScreenImpl(display); + if(DEBUG) { + System.err.println(Thread.currentThread().getName() + " - X11GraphicsDevice.getDefaultDisplay() of "+this+": "+ds+", count "+X11Lib.ScreenCount(display)); + } + return ds; + } + public int getDefaultVisualID() { - // It still could be an AWT hold handle .. final long display = getHandle(); - final int scrnIdx = X11Lib.DefaultScreen(display); - return X11Lib.DefaultVisualID(display, scrnIdx); + if(0==display) { + throw new NativeWindowException("null display"); + } + return X11Lib.DefaultVisualID(display, getDefaultScreenImpl(display)); } @Override diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java index 35e24403f..ef830b660 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java @@ -30,7 +30,6 @@ package com.jogamp.opengl.test.junit.newt; import org.junit.Assert; import org.junit.Assume; -import org.junit.BeforeClass; import org.junit.Test; import javax.media.opengl.*; |