From c0cc74a7d525aaa7eb89f60c836589678053d5fb Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 17 Sep 2012 03:30:36 +0200 Subject: Fixes Bug 615 - X11: Use proper screen index/name for shared resources and device denominated 'mutable' surfaces (dummy, offscreen, ..) Fix follows findings of Rob Hatcherson, but instead of parsing the display connection ourself we use the X11 macro 'DefaultScreen(display)' See "The screen number specified in the display_name argument is returned by the DefaultScreen() macro (or the XDefaultScreen() function)." Since I currently have no two-head X11 setup here, only xinerama via virtualbox, pls test / validate. Note: One Display connection may span multiple screens, i.e.: display 'lala:0.1' may span from screen 1 - 3 (non xinerama mode) Discussion: [1] How to validate whether a screen number belongs to one display connection ? We can query ScreenCount(display), however it is not clear what the range would be. [2] With 1 display connection spanning multiple screens, what is/are the proper connection string[s] ? [3] After all, it seems this ancient configuration really cannot beat a modern setup w/ XRandR having Xinerama enabled. The latter is the default anyways. --- src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/jogl') 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); -- cgit v1.2.3