aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/com/jogamp/newt/NewtFactory.java5
-rw-r--r--src/newt/classes/com/jogamp/newt/event/NEWTEvent.java6
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java10
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/WindowImpl.java104
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/awt/AWTCanvas.java4
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/awt/AWTWindow.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/macosx/MacWindow.java9
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/windows/WindowsWindow.java10
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/x11/X11Display.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java4
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java38
11 files changed, 105 insertions, 89 deletions
diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java
index 5f969777a..e01e04304 100644
--- a/src/newt/classes/com/jogamp/newt/NewtFactory.java
+++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java
@@ -34,12 +34,8 @@
package com.jogamp.newt;
-import com.jogamp.common.util.ReflectionUtil;
import javax.media.nativewindow.*;
-import java.util.ArrayList;
-import java.util.Iterator;
import com.jogamp.common.jvm.JVMUtil;
-import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.impl.DisplayImpl;
import com.jogamp.newt.impl.ScreenImpl;
@@ -53,6 +49,7 @@ public class NewtFactory {
// between native Newt and (apparently) Fmod
static {
JVMUtil.initSingleton();
+ NativeWindowFactory.initSingleton(false); // last resort ..
WindowImpl.init(NativeWindowFactory.getNativeWindowType(true));
}
diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java
index bbe648c42..61858b083 100644
--- a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java
@@ -73,6 +73,7 @@ public class NEWTEvent extends java.util.EventObject {
static final String WindowClazzName = "com.jogamp.newt.Window" ;
static final String AWTNewtEventFactoryClazzName = "com.jogamp.newt.event.awt.AWTNewtEventFactory" ;
+ /**
static final boolean evaluateIsSystemEvent(NEWTEvent event, Throwable t) {
StackTraceElement[] stack = t.getStackTrace();
if(stack.length==0 || null==stack[0]) {
@@ -104,11 +105,12 @@ public class NEWTEvent extends java.util.EventObject {
System.err.println("system: "+res);
}
return res;
- }
+ } */
protected NEWTEvent(int eventType, Object source, long when) {
super(source);
- this.isSystemEvent = evaluateIsSystemEvent(this, new Throwable());
+ // this.isSystemEvent = evaluateIsSystemEvent(this, new Throwable());
+ this.isSystemEvent = false; // FIXME: Need a more efficient way to determine system events
this.eventType = eventType;
this.when = when;
this.attachment=null;
diff --git a/src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java b/src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java
index 0d9e295bd..840411984 100644
--- a/src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java
+++ b/src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java
@@ -349,7 +349,7 @@ public abstract class DisplayImpl extends Display {
if(!isEDTRunning()) {
// oops .. we are already dead
if(DEBUG) {
- Throwable t = new Throwable("EDT already stopped: wait:="+wait+", "+e);
+ Throwable t = new Throwable("Warning: EDT already stopped: wait:="+wait+", "+e);
t.printStackTrace();
}
return;
@@ -371,14 +371,6 @@ public abstract class DisplayImpl extends Display {
}
}
- public void lock() {
- aDevice.lock();
- }
-
- public void unlock() {
- aDevice.unlock();
- }
-
protected EDTUtil edtUtil = null;
protected int id;
protected String name;
diff --git a/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java b/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java
index ae2b7c6e1..a0879a634 100644
--- a/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java
+++ b/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java
@@ -42,10 +42,9 @@ import com.jogamp.newt.event.*;
import com.jogamp.common.util.*;
import javax.media.nativewindow.*;
-import com.jogamp.common.util.RecursiveToolkitLock;
+import com.jogamp.common.util.locks.RecursiveLock;
import java.util.ArrayList;
-import java.util.Iterator;
import java.lang.reflect.Method;
import javax.media.nativewindow.util.Insets;
import javax.media.nativewindow.util.Point;
@@ -161,7 +160,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
private LifecycleHook lifecycleHook = null;
- private RecursiveToolkitLock windowLock = new RecursiveToolkitLock();
+ private RecursiveLock windowLock = new RecursiveLock();
private long windowHandle;
private ScreenImpl screen;
private boolean screenReferenced = false;
@@ -293,17 +292,21 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
//
public final int lockSurface() {
- // We leave the ToolkitLock lock to the specializtion's discretion,
- // ie the implicit JAWTWindow in case of AWTWindow
+ int res = LOCK_SURFACE_NOT_READY;
- // may throw RuntimeException if timed out while waiting for lock
windowLock.lock();
- int res = lockSurfaceImpl();
- if(!isNativeValid()) {
- windowLock.unlock();
- res = LOCK_SURFACE_NOT_READY;
+ screen.getDisplay().getGraphicsDevice().lock();
+ try {
+ res = lockSurfaceImpl();
+ } finally {
+ if(!isNativeValid()) {
+ screen.getDisplay().getGraphicsDevice().unlock();
+ windowLock.unlock();
+ res = LOCK_SURFACE_NOT_READY;
+ }
}
+
return res;
}
@@ -311,11 +314,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// may throw RuntimeException if not locked
windowLock.validateLocked();
- unlockSurfaceImpl();
-
+ try {
+ unlockSurfaceImpl();
+ } finally {
+ screen.getDisplay().getGraphicsDevice().unlock();
+ }
windowLock.unlock();
- // We leave the ToolkitLock unlock to the specializtion's discretion,
- // ie the implicit JAWTWindow in case of AWTWindow
}
public final boolean isSurfaceLockedByOtherThread() {
@@ -330,10 +334,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
return windowLock.getOwner();
}
- public final Exception getSurfaceLockStack() {
- return windowLock.getLockedStack();
- }
-
public long getSurfaceHandle() {
return windowHandle; // default: return window handle
}
@@ -437,8 +437,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
if(!visible && childWindows.size()>0) {
synchronized(childWindowsLock) {
- for(Iterator i = childWindows.iterator(); i.hasNext(); ) {
- NativeWindow nw = (NativeWindow) i.next();
+ for(int i = 0; i < childWindows.size(); i++ ) {
+ NativeWindow nw = (NativeWindow) childWindows.get(i);
if(nw instanceof WindowImpl) {
((WindowImpl)nw).setVisible(false);
}
@@ -464,8 +464,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(0!=windowHandle && visible && childWindows.size()>0) {
synchronized(childWindowsLock) {
- for(Iterator i = childWindows.iterator(); i.hasNext(); ) {
- NativeWindow nw = (NativeWindow) i.next();
+ for(int i = 0; i < childWindows.size(); i++ ) {
+ NativeWindow nw = (NativeWindow) childWindows.get(i);
if(nw instanceof WindowImpl) {
((WindowImpl)nw).setVisible(true);
}
@@ -478,7 +478,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
} finally {
windowLock.unlock();
}
- getScreen().getDisplay().dispatchMessages(); // status up2date
}
}
@@ -885,7 +884,24 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
ReparentActionImpl reparentAction = new ReparentActionImpl(newParent, forceDestroyCreate);
runOnEDTIfAvail(true, reparentAction);
reparentActionStrategy = reparentAction.getStrategy();
- if( isVisible() ) {
+ boolean sizeSignaled=false;
+ if(null!=newParent) {
+ // refit if size is bigger than parent
+ int w = getWidth();
+ int h = getHeight();
+ if(w>newParent.getWidth()) {
+ w=newParent.getWidth();
+ sizeSignaled=true;
+ }
+ if(h>newParent.getHeight()) {
+ h=newParent.getHeight();
+ sizeSignaled=true;
+ }
+ if(sizeSignaled) {
+ setSize(w, h);
+ }
+ }
+ if( !sizeSignaled && isVisible() ) {
sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout and repaint to listener
}
} finally {
@@ -920,7 +936,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
public void setUndecorated(boolean value) {
- if(this.undecorated != value) {
+ if(!fullscreen && this.undecorated != value) {
undecorated = value;
if( 0 != windowHandle ) {
reconfigureWindowImpl(x, y, width, height);
@@ -929,10 +945,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
- public boolean isUndecorated(boolean fullscreen) {
- return 0 != getParentWindowHandle() || undecorated || fullscreen ;
- }
-
public boolean isUndecorated() {
return 0 != parentWindowHandle || undecorated || fullscreen ;
}
@@ -1037,20 +1049,20 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
"\n, ChildWindows "+childWindows.size());
sb.append(", SurfaceUpdatedListeners num "+surfaceUpdatedListeners.size()+" [");
- for (Iterator iter = surfaceUpdatedListeners.iterator(); iter.hasNext(); ) {
- sb.append(iter.next()+", ");
+ for (int i = 0; i < surfaceUpdatedListeners.size(); i++ ) {
+ sb.append(surfaceUpdatedListeners.get(i)+", ");
}
sb.append("], WindowListeners num "+windowListeners.size()+" [");
- for (Iterator iter = windowListeners.iterator(); iter.hasNext(); ) {
- sb.append(iter.next()+", ");
+ for (int i = 0; i < windowListeners.size(); i++ ) {
+ sb.append(windowListeners.get(i)+", ");
}
sb.append("], MouseListeners num "+mouseListeners.size()+" [");
- for (Iterator iter = mouseListeners.iterator(); iter.hasNext(); ) {
- sb.append(iter.next()+", ");
+ for (int i = 0; i < mouseListeners.size(); i++ ) {
+ sb.append(mouseListeners.get(i)+", ");
}
sb.append("], KeyListeners num "+keyListeners.size()+" [");
- for (Iterator iter = keyListeners.iterator(); iter.hasNext(); ) {
- sb.append(iter.next()+", ");
+ for (int i = 0; i < keyListeners.size(); i++ ) {
+ sb.append(keyListeners.get(i)+", ");
}
sb.append("] ]");
return sb.toString();
@@ -1321,8 +1333,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public void surfaceUpdated(Object updater, NativeSurface ns, long when) {
synchronized(surfaceUpdatedListenersLock) {
- for(Iterator i = surfaceUpdatedListeners.iterator(); i.hasNext(); ) {
- SurfaceUpdatedListener l = (SurfaceUpdatedListener) i.next();
+ for(int i = 0; i < surfaceUpdatedListeners.size(); i++ ) {
+ SurfaceUpdatedListener l = (SurfaceUpdatedListener) surfaceUpdatedListeners.get(i);
l.surfaceUpdated(updater, ns, when);
}
}
@@ -1446,8 +1458,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
System.err.println("consumeMouseEvent: event: "+e);
}
- for(Iterator i = mouseListeners.iterator(); i.hasNext(); ) {
- MouseListener l = (MouseListener) i.next();
+ for(int i = 0; i < mouseListeners.size(); i++ ) {
+ MouseListener l = (MouseListener) mouseListeners.get(i);
switch(e.getEventType()) {
case MouseEvent.EVENT_MOUSE_CLICKED:
l.mouseClicked(e);
@@ -1534,8 +1546,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_KEY_EVENT) {
System.err.println("consumeKeyEvent: "+e);
}
- for(Iterator i = keyListeners.iterator(); i.hasNext(); ) {
- KeyListener l = (KeyListener) i.next();
+ for(int i = 0; i < keyListeners.size(); i++ ) {
+ KeyListener l = (KeyListener) keyListeners.get(i);
switch(e.getEventType()) {
case KeyEvent.EVENT_KEY_PRESSED:
l.keyPressed(e);
@@ -1606,10 +1618,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
protected void consumeWindowEvent(WindowEvent e) {
if(DEBUG_WINDOW_EVENT) {
- System.err.println("consumeWindowEvent: "+e);
+ System.err.println("consumeWindowEvent: "+e+", visible "+isVisible()+" "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight());
}
- for(Iterator i = windowListeners.iterator(); i.hasNext(); ) {
- WindowListener l = (WindowListener) i.next();
+ for(int i = 0; i < windowListeners.size(); i++ ) {
+ WindowListener l = (WindowListener) windowListeners.get(i);
switch(e.getEventType()) {
case WindowEvent.EVENT_WINDOW_RESIZED:
l.windowResized(e);
diff --git a/src/newt/classes/com/jogamp/newt/impl/awt/AWTCanvas.java b/src/newt/classes/com/jogamp/newt/impl/awt/AWTCanvas.java
index 8750a8bc1..bbf75798e 100644
--- a/src/newt/classes/com/jogamp/newt/impl/awt/AWTCanvas.java
+++ b/src/newt/classes/com/jogamp/newt/impl/awt/AWTCanvas.java
@@ -90,7 +90,7 @@ public class AWTCanvas extends Canvas {
*/
awtConfig = chooseGraphicsConfiguration(capabilities, device);
if(Window.DEBUG_IMPLEMENTATION) {
- Exception e = new Exception("Created Config: "+awtConfig);
+ Exception e = new Exception("Info: Created Config: "+awtConfig);
e.printStackTrace();
}
if(null!=awtConfig) {
@@ -157,7 +157,7 @@ public class AWTCanvas extends Canvas {
AWTGraphicsConfiguration config = chooseGraphicsConfiguration((Capabilities)awtConfig.getRequestedCapabilities(), gc.getDevice());
final GraphicsConfiguration compatible = (null!=config)?config.getGraphicsConfiguration():null;
if(Window.DEBUG_IMPLEMENTATION) {
- Exception e = new Exception("Call Stack: "+Thread.currentThread().getName());
+ Exception e = new Exception("Info: Call Stack: "+Thread.currentThread().getName());
e.printStackTrace();
System.err.println("!!! Created Config (n): HAVE GC "+chosen);
System.err.println("!!! Created Config (n): THIS GC "+gc);
diff --git a/src/newt/classes/com/jogamp/newt/impl/awt/AWTWindow.java b/src/newt/classes/com/jogamp/newt/impl/awt/AWTWindow.java
index 1f481e28b..5abff047f 100644
--- a/src/newt/classes/com/jogamp/newt/impl/awt/AWTWindow.java
+++ b/src/newt/classes/com/jogamp/newt/impl/awt/AWTWindow.java
@@ -246,7 +246,7 @@ public class AWTWindow extends WindowImpl {
public void run() {
if(null!=frame) {
if(!container.isDisplayable()) {
- frame.setUndecorated(isUndecorated(fullscreen));
+ frame.setUndecorated(isUndecorated());
} else {
if(DEBUG_IMPLEMENTATION || DEBUG_WINDOW_EVENT) {
System.err.println("AWTWindow can't undecorate already created frame");
diff --git a/src/newt/classes/com/jogamp/newt/impl/macosx/MacWindow.java b/src/newt/classes/com/jogamp/newt/impl/macosx/MacWindow.java
index a2b7cd335..15cadb05f 100644
--- a/src/newt/classes/com/jogamp/newt/impl/macosx/MacWindow.java
+++ b/src/newt/classes/com/jogamp/newt/impl/macosx/MacWindow.java
@@ -35,7 +35,7 @@
package com.jogamp.newt.impl.macosx;
import javax.media.nativewindow.*;
-import com.jogamp.common.util.RecursiveToolkitLock;
+import com.jogamp.common.util.locks.RecursiveLock;
import com.jogamp.newt.event.*;
import com.jogamp.newt.impl.*;
@@ -132,7 +132,6 @@ public class MacWindow extends WindowImpl {
private volatile long surfaceHandle;
// non fullscreen dimensions ..
- private int nfs_width, nfs_height, nfs_x, nfs_y;
private final Insets insets = new Insets(0,0,0,0);
static {
@@ -158,7 +157,7 @@ public class MacWindow extends WindowImpl {
}
} catch (Throwable t) {
if(DEBUG_IMPLEMENTATION) {
- Exception e = new Exception("closeNative failed - "+Thread.currentThread().getName(), t);
+ Exception e = new Exception("Warning: closeNative failed - "+Thread.currentThread().getName(), t);
e.printStackTrace();
}
} finally {
@@ -184,7 +183,7 @@ public class MacWindow extends WindowImpl {
}
}
- private RecursiveToolkitLock nsViewLock = new RecursiveToolkitLock();
+ private RecursiveLock nsViewLock = new RecursiveLock();
protected int lockSurfaceImpl() {
nsViewLock.lock();
@@ -394,7 +393,7 @@ public class MacWindow extends WindowImpl {
}
setWindowHandle(createWindow0(getParentWindowHandle(),
x, y, width, height, fullscreen,
- (isUndecorated(fullscreen) ?
+ (isUndecorated() ?
NSBorderlessWindowMask :
NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask),
NSBackingStoreBuffered,
diff --git a/src/newt/classes/com/jogamp/newt/impl/windows/WindowsWindow.java b/src/newt/classes/com/jogamp/newt/impl/windows/WindowsWindow.java
index 3c922b9e7..3ade599da 100644
--- a/src/newt/classes/com/jogamp/newt/impl/windows/WindowsWindow.java
+++ b/src/newt/classes/com/jogamp/newt/impl/windows/WindowsWindow.java
@@ -76,7 +76,7 @@ public class WindowsWindow extends WindowImpl {
long _hmon = MonitorFromWindow0(getWindowHandle());
if (hmon != _hmon) {
if(DEBUG_IMPLEMENTATION || DEBUG_WINDOW_EVENT) {
- Exception e = new Exception("!!! Window Device Changed "+Thread.currentThread().getName()+
+ Exception e = new Exception("Info: Window Device Changed "+Thread.currentThread().getName()+
", HMON "+toHexString(hmon)+" -> "+toHexString(_hmon));
e.printStackTrace();
}
@@ -102,7 +102,7 @@ public class WindowsWindow extends WindowImpl {
}
windowHandleClose = getWindowHandle();
if(DEBUG_IMPLEMENTATION || DEBUG_WINDOW_EVENT) {
- Exception e = new Exception("!!! Window new window handle "+Thread.currentThread().getName()+
+ Exception e = new Exception("Info: Window new window handle "+Thread.currentThread().getName()+
" (Parent HWND "+toHexString(getParentWindowHandle())+
") : HWND "+toHexString(getWindowHandle())+", "+Thread.currentThread());
e.printStackTrace();
@@ -116,7 +116,7 @@ public class WindowsWindow extends WindowImpl {
ReleaseDC0(windowHandleClose, hdc);
} catch (Throwable t) {
if(DEBUG_IMPLEMENTATION) {
- Exception e = new Exception("closeNativeImpl failed - "+Thread.currentThread().getName(), t);
+ Exception e = new Exception("Warning: closeNativeImpl failed - "+Thread.currentThread().getName(), t);
e.printStackTrace();
}
}
@@ -128,7 +128,7 @@ public class WindowsWindow extends WindowImpl {
DestroyWindow0(windowHandleClose);
} catch (Throwable t) {
if(DEBUG_IMPLEMENTATION) {
- Exception e = new Exception("closeNativeImpl failed - "+Thread.currentThread().getName(), t);
+ Exception e = new Exception("Warning: closeNativeImpl failed - "+Thread.currentThread().getName(), t);
e.printStackTrace();
}
} finally {
@@ -157,7 +157,7 @@ public class WindowsWindow extends WindowImpl {
}
protected void reconfigureWindowImpl(int x, int y, int width, int height) {
- reconfigureWindow0(fullscreen?0:getParentWindowHandle(), getWindowHandle(), x, y, width, height, isUndecorated(fullscreen));
+ reconfigureWindow0(fullscreen?0:getParentWindowHandle(), getWindowHandle(), x, y, width, height, isUndecorated());
}
protected boolean reparentWindowImpl() {
diff --git a/src/newt/classes/com/jogamp/newt/impl/x11/X11Display.java b/src/newt/classes/com/jogamp/newt/impl/x11/X11Display.java
index f96625d8e..7f315d785 100644
--- a/src/newt/classes/com/jogamp/newt/impl/x11/X11Display.java
+++ b/src/newt/classes/com/jogamp/newt/impl/x11/X11Display.java
@@ -76,7 +76,7 @@ public class X11Display extends DisplayImpl {
X11Util.closeDisplay(handle);
throw e;
}
- aDevice = new X11GraphicsDevice(handle);
+ aDevice = new X11GraphicsDevice(handle, NativeWindowFactory.getNullToolkitLock());
}
protected void closeNativeImpl() {
diff --git a/src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java b/src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java
index f9fce6fc1..80e5068b4 100644
--- a/src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java
+++ b/src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java
@@ -76,7 +76,7 @@ public class X11Window extends WindowImpl {
display.getJavaObjectAtom(), display.getWindowDeleteAtom());
} catch (Throwable t) {
if(DEBUG_IMPLEMENTATION) {
- Exception e = new Exception("closeNativeImpl failed - "+Thread.currentThread().getName(), t);
+ Exception e = new Exception("Warning: closeNativeImpl failed - "+Thread.currentThread().getName(), t);
e.printStackTrace();
}
} finally {
@@ -105,7 +105,7 @@ public class X11Window extends WindowImpl {
protected void reconfigureWindowImpl(int x, int y, int width, int height) {
reconfigureWindow0(fullscreen?0:getParentWindowHandle(), getDisplayHandle(), getScreenIndex(), getWindowHandle(),
- x, y, width, height, isUndecorated(fullscreen), isVisible());
+ x, y, width, height, isUndecorated(), isVisible());
}
protected boolean reparentWindowImpl() {
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 97afab903..50fe3f63a 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -405,23 +405,34 @@ public class GLWindow implements GLAutoDrawable, Window {
}
public void addGLEventListener(GLEventListener listener) {
- helper.addGLEventListener(listener);
+ if(null!=helper) {
+ helper.addGLEventListener(listener);
+ }
}
public void addGLEventListener(int index, GLEventListener listener) {
- helper.addGLEventListener(index, listener);
+ if(null!=helper) {
+ helper.addGLEventListener(index, listener);
+ }
}
public void removeGLEventListener(GLEventListener listener) {
- helper.removeGLEventListener(listener);
+ if(null!=helper) {
+ helper.removeGLEventListener(listener);
+ }
}
public void setAnimator(GLAnimatorControl animatorControl) {
- helper.setAnimator(animatorControl);
+ if(null!=helper) {
+ helper.setAnimator(animatorControl);
+ }
}
public GLAnimatorControl getAnimator() {
- return helper.getAnimator();
+ if(null!=helper) {
+ return helper.getAnimator();
+ }
+ return null;
}
public boolean getPerfLogEnabled() { return perfLog; }
@@ -431,7 +442,9 @@ public class GLWindow implements GLAutoDrawable, Window {
}
public void invoke(boolean wait, GLRunnable glRunnable) {
- helper.invoke(this, wait, glRunnable);
+ if(null!=helper) {
+ helper.invoke(this, wait, glRunnable);
+ }
}
public void display() {
@@ -468,12 +481,17 @@ public class GLWindow implements GLAutoDrawable, Window {
/** This implementation uses a static value */
public void setAutoSwapBufferMode(boolean onOrOff) {
- helper.setAutoSwapBufferMode(onOrOff);
+ if(null!=helper) {
+ helper.setAutoSwapBufferMode(onOrOff);
+ }
}
/** This implementation uses a static value */
public boolean getAutoSwapBufferMode() {
- return helper.getAutoSwapBufferMode();
+ if(null!=helper) {
+ return helper.getAutoSwapBufferMode();
+ }
+ return false;
}
public void swapBuffers() {
@@ -766,10 +784,6 @@ public class GLWindow implements GLAutoDrawable, Window {
}
- public final Exception getSurfaceLockStack() {
- return window.getSurfaceLockStack();
- }
-
public final boolean surfaceSwap() {
return window.surfaceSwap();
}