aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java18
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java9
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java10
3 files changed, 15 insertions, 22 deletions
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 96d0f6e3b..7fccb6622 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -458,24 +458,22 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
} else {
t0 = 0;
}
-
- /* if (nativeWindowCreated && null != context) {
- throw new GLException("InternalError: Native Windows has been just created, but context wasn't destroyed (is not null)");
- } */
- if (null == context && visible && 0 != window.getWindowHandle() && 0<getWidth()*getHeight()) {
- NativeWindow nw;
+
+ if (null == drawable && visible && 0 != window.getWindowHandle() && 0<getWidth()*getHeight()) {
+ if( ( null != context ) ) {
+ throw new InternalError("GLWindow.LifecycleHook.setVisiblePost: "+WindowImpl.getThreadName()+" - Null drawable, but valid context - "+GLWindow.this);
+ }
+ final NativeWindow nw;
if (window.getWrappedWindow() != null) {
nw = NativeWindowFactory.getNativeWindow(window.getWrappedWindow(), window.getPrivateGraphicsConfiguration());
} else {
nw = window;
}
- GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) nw.getGraphicsConfiguration().getChosenCapabilities();
+ final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) nw.getGraphicsConfiguration().getChosenCapabilities();
if(null==factory) {
factory = GLDrawableFactory.getFactory(glCaps.getGLProfile());
}
- if(null==drawable) {
- drawable = (GLDrawableImpl) factory.createGLDrawable(nw);
- }
+ drawable = (GLDrawableImpl) factory.createGLDrawable(nw);
drawable.setRealized(true);
context = (GLContextImpl) drawable.createContext(sharedContext);
context.setContextCreationFlags(additionalCtxCreationFlags);
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index 88fbfc951..d033a8794 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -629,10 +629,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@Override
- public long getDisplayHandle() {
- // Actually: return getGraphicsConfiguration().getScreen().getDevice().getHandle();
- return screen.getDisplay().getHandle(); // shortcut
- }
+ public final long getDisplayHandle() {
+ return config.getNativeGraphicsConfiguration().getScreen().getDevice().getHandle();
+ }
@Override
public final int getScreenIndex() {
@@ -880,6 +879,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if( isNativeValid() ) {
screen.removeScreenModeListener(screenModeListenerImpl);
closeNativeImpl();
+ config.getScreen().getDevice().close();
+ setGraphicsConfiguration(null);
removeScreenReference();
}
Display dpy = screen.getDisplay();
diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
index 8cea76ca5..c55fddd07 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
@@ -72,7 +72,7 @@ public class WindowDriver extends WindowImpl {
// Decoupled X11 Device/Screen allowing X11 display lock-free off-thread rendering
final long renderDeviceHandle = X11Util.openDisplay(edtDevice.getConnection());
if( 0 == renderDeviceHandle ) {
- throw new RuntimeException("Error creating display(EDT): "+edtDevice.getConnection());
+ throw new RuntimeException("Error creating display(GfxCfg/Render): "+edtDevice.getConnection());
}
renderDevice = new X11GraphicsDevice(renderDeviceHandle, AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */);
final AbstractGraphicsScreen renderScreen = new X11GraphicsScreen(renderDevice, screen.getIndex());
@@ -132,12 +132,6 @@ public class WindowDriver extends WindowImpl {
}
}
- @Override
- public long getDisplayHandle() {
- // Actually: return getGraphicsConfiguration().getScreen().getDevice().getHandle();
- return renderDevice.getHandle(); // shortcut
- }
-
protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, final int flags) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("X11Window reconfig: "+x+"/"+y+" "+width+"x"+height+", "+
@@ -304,5 +298,5 @@ public class WindowDriver extends WindowImpl {
private static native void warpPointer0(long display, long windowHandle, int x, int y);
private long windowHandleClose;
- private X11GraphicsDevice renderDevice;
+ private X11GraphicsDevice renderDevice;
}