diff options
-rw-r--r-- | make/scripts/tests.sh | 8 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java | 39 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/impl/WindowImpl.java | 28 |
3 files changed, 44 insertions, 31 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 83c852584..3df37e330 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -27,8 +27,8 @@ function jrun() { #D_ARGS="-Dnewt.debug.EDT -Djogamp.common.utils.locks.Lock.timeout=600000 -Djogl.debug.Animator -Dnewt.debug.Display -Dnewt.debug.Screen" #D_ARGS="-Dnewt.debug.EDT -Dnewt.debug.Display -Dnativewindow.debug.X11Util -Djogl.debug.GLDrawable -Djogl.debug.GLCanvas" #D_ARGS="-Dnewt.debug.EDT -Djogl.debug.GLContext" - D_ARGS="-Dnewt.debug.Screen -Dnewt.debug.EDT -Djogamp.debug.Lock" - #D_ARGS="-Dnewt.debug.EDT" + #D_ARGS="-Dnewt.debug.Screen -Dnewt.debug.EDT -Djogamp.debug.Lock" + D_ARGS="-Dnewt.debug.EDT" #D_ARGS="-Dnewt.debug.EDT -Djogl.debug=all -Dnativewindow.debug=all" # D_ARGS="-Djogl.debug=all" X_ARGS="-Dsun.java2d.noddraw=true -Dsun.java2d.opengl=false" @@ -53,9 +53,9 @@ function testawt() { #testawt com.jogamp.test.junit.newt.parenting.TestParenting01NEWT #testawt com.jogamp.test.junit.newt.parenting.TestParenting02NEWT #testawt com.jogamp.test.junit.newt.TestScreenMode00NEWT -testnoawt com.jogamp.test.junit.newt.TestScreenMode01NEWT +#testnoawt com.jogamp.test.junit.newt.TestScreenMode01NEWT #testnoawt com.jogamp.test.junit.newt.TestScreenMode02NEWT -#testawt com.jogamp.test.junit.newt.TestGLWindows01NEWT +testawt com.jogamp.test.junit.newt.TestGLWindows01NEWT -time 1000000 #testawt -Djava.awt.headless=true com.jogamp.test.junit.newt.TestGLWindows01NEWT #testawt com.jogamp.test.junit.newt.TestGLWindows02NEWTAnimated diff --git a/src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java b/src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java index d4f391e6c..d22e9c7c4 100644 --- a/src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java +++ b/src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java @@ -34,13 +34,16 @@ package com.jogamp.newt.impl; -import com.jogamp.newt.*; -import javax.media.nativewindow.*; -import com.jogamp.newt.event.*; -import com.jogamp.newt.impl.event.*; +import com.jogamp.newt.Display; +import com.jogamp.newt.NewtFactory; +import com.jogamp.newt.event.NEWTEvent; +import com.jogamp.newt.event.NEWTEventConsumer; +import com.jogamp.newt.impl.event.NEWTEventTask; import com.jogamp.newt.util.EDTUtil; import com.jogamp.newt.util.MainThread; -import java.util.*; +import java.util.ArrayList; +import javax.media.nativewindow.AbstractGraphicsDevice; +import javax.media.nativewindow.NativeWindowFactory; public abstract class DisplayImpl extends Display { public static final boolean DEBUG_TEST_EDT_MAINTHREAD = Debug.isPropertyDefined("newt.test.EDTMainThread", true); // JAU EDT Test .. @@ -306,7 +309,7 @@ public abstract class DisplayImpl extends Display { protected abstract void dispatchMessagesNative(); private Object eventsLock = new Object(); - private LinkedList/*<NEWTEvent>*/ events = new LinkedList(); + private ArrayList/*<NEWTEvent>*/ events = new ArrayList(); class DispatchMessagesRunnable implements Runnable { public void run() { @@ -320,20 +323,20 @@ public abstract class DisplayImpl extends Display { if(0==refCount) return; // no screens if(null==getGraphicsDevice()) return; // no native device - LinkedList/*<NEWTEvent>*/ _events = null; + ArrayList/*<NEWTEvent>*/ _events = null; - if(!events.isEmpty()) { + if(events.size()>0) { // swap events list to free ASAP synchronized(eventsLock) { - if(!events.isEmpty()) { + if(events.size()>0) { _events = events; - events = new LinkedList(); + events = new ArrayList(); } eventsLock.notifyAll(); } if( null != _events ) { - for (Iterator iter = _events.iterator(); iter.hasNext(); ) { - NEWTEventTask eventTask = (NEWTEventTask) iter.next(); + for (int i=0; i < _events.size(); i++) { + NEWTEventTask eventTask = (NEWTEventTask) _events.get(i); NEWTEvent event = eventTask.get(); Object source = event.getSource(); if(source instanceof NEWTEventConsumer) { @@ -349,14 +352,8 @@ public abstract class DisplayImpl extends Display { } } - // lock(); - try { - // System.err.println("Display.dispatchMessages() NATIVE "+this+" "+getThreadName()); - dispatchMessagesNative(); - } finally { - // unlock(); - // System.err.println("Display.dispatchMessages() X "+this+" "+getThreadName()); - } + // System.err.println("Display.dispatchMessages() NATIVE "+this+" "+getThreadName()); + dispatchMessagesNative(); } public void enqueueEvent(boolean wait, NEWTEvent e) { @@ -372,7 +369,7 @@ public abstract class DisplayImpl extends Display { NEWTEventTask eTask = new NEWTEventTask(e, wait?lock:null); synchronized(lock) { synchronized(eventsLock) { - events.addLast(eTask); + events.add(eTask); eventsLock.notifyAll(); } if( wait ) { diff --git a/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java b/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java index dfa768147..d7504cfdf 100644 --- a/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java +++ b/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java @@ -34,19 +34,34 @@ package com.jogamp.newt.impl; +import com.jogamp.common.util.ReflectionUtil; import com.jogamp.newt.NewtFactory; import com.jogamp.newt.Display; import com.jogamp.newt.Screen; import com.jogamp.newt.Window; -import com.jogamp.newt.event.*; - -import com.jogamp.common.util.*; -import javax.media.nativewindow.*; import com.jogamp.common.util.locks.RecursiveLock; import com.jogamp.newt.ScreenMode; +import com.jogamp.newt.event.KeyEvent; +import com.jogamp.newt.event.KeyListener; +import com.jogamp.newt.event.MouseEvent; +import com.jogamp.newt.event.MouseListener; +import com.jogamp.newt.event.NEWTEvent; +import com.jogamp.newt.event.NEWTEventConsumer; +import com.jogamp.newt.event.ScreenModeListener; +import com.jogamp.newt.event.WindowEvent; +import com.jogamp.newt.event.WindowListener; +import com.jogamp.newt.event.WindowUpdateEvent; import java.util.ArrayList; import java.lang.reflect.Method; +import javax.media.nativewindow.AbstractGraphicsConfiguration; +import javax.media.nativewindow.AbstractGraphicsDevice; +import javax.media.nativewindow.Capabilities; +import javax.media.nativewindow.NativeSurface; +import javax.media.nativewindow.NativeWindow; +import javax.media.nativewindow.NativeWindowException; +import javax.media.nativewindow.NativeWindowFactory; +import javax.media.nativewindow.SurfaceUpdatedListener; import javax.media.nativewindow.util.DimensionReadOnly; import javax.media.nativewindow.util.Insets; import javax.media.nativewindow.util.Point; @@ -362,12 +377,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer, ScreenMod windowLock.lock(); - screen.getDisplay().getGraphicsDevice().lock(); + AbstractGraphicsDevice adevice = screen.getDisplay().getGraphicsDevice(); + adevice.lock(); try { res = lockSurfaceImpl(); } finally { if(!isNativeValid()) { - screen.getDisplay().getGraphicsDevice().unlock(); + adevice.unlock(); windowLock.unlock(); res = LOCK_SURFACE_NOT_READY; } |