diff options
author | Sven Gothel <[email protected]> | 2012-06-27 05:05:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-06-27 05:05:36 +0200 |
commit | a06e40cce89615eb8c4b080842997c9c3ad1130b (patch) | |
tree | 0bac563f3604662f8583b4f0da21b68ac53abd28 /src/newt | |
parent | 4a0a5d69ffcb7592b092991ddb3761653c389ce6 (diff) |
NativeSurface Cleanup (API Change) - Adapt to GlueGen Lock cleanup commit: 834b9e530e652b7ff7c5e222720bce3ad2b11c5f
- adapt to GlueGen Lock cleanup
- remove isSurfaceLocked(), use 'null != getSurfaceLockOwner()' instead
Misc:
- remove unused priv./impl. methods
- add @Override
Diffstat (limited to 'src/newt')
-rw-r--r-- | src/newt/classes/com/jogamp/newt/opengl/GLWindow.java | 8 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/WindowImpl.java | 34 |
2 files changed, 19 insertions, 23 deletions
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index a3adf5090..1832d4e99 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -842,22 +842,22 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC // NativeWindow completion // + @Override public final int lockSurface() { return window.lockSurface(); } + @Override public final void unlockSurface() throws NativeWindowException { window.unlockSurface(); } + @Override public final boolean isSurfaceLockedByOtherThread() { return window.isSurfaceLockedByOtherThread(); } - public final boolean isSurfaceLocked() { - return window.isSurfaceLocked(); - } - + @Override public final Thread getSurfaceLockOwner() { return window.getSurfaceLockOwner(); diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 73bd9ed1c..baad77ffb 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -562,6 +562,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // NativeSurface // + @Override public final int lockSurface() { windowLock.lock(); surfaceLock.lock(); @@ -590,6 +591,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return res; } + @Override public final void unlockSurface() { surfaceLock.validateLocked(); windowLock.validateLocked(); @@ -606,30 +608,24 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer windowLock.unlock(); } - public final boolean isWindowLockedByOtherThread() { - return windowLock.isLockedByOtherThread(); - } - - public final boolean isWindowLocked() { - return windowLock.isLocked(); - } - - public final Thread getWindowLockOwner() { - return windowLock.getOwner(); - } - + @Override public final boolean isSurfaceLockedByOtherThread() { return surfaceLock.isLockedByOtherThread(); } - public final boolean isSurfaceLocked() { - return surfaceLock.isLocked(); - } - + @Override public final Thread getSurfaceLockOwner() { return surfaceLock.getOwner(); } + public final boolean isWindowLockedByOtherThread() { + return windowLock.isLockedByOtherThread(); + } + + public final Thread getWindowLockOwner() { + return windowLock.getOwner(); + } + public long getSurfaceHandle() { return windowHandle; // default: return window handle } @@ -1574,7 +1570,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } public void runOnEDTIfAvail(boolean wait, final Runnable task) { - if(windowLock.isOwner()) { + if(windowLock.isOwner(Thread.currentThread())) { task.run(); } else { Screen scrn = getScreen(); @@ -1913,7 +1909,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // special repaint treatment case WindowEvent.EVENT_WINDOW_REPAINT: // queue repaint event in case window is locked, ie in operation - if( isWindowLocked() ) { + if( null != getWindowLockOwner() ) { // make sure only one repaint event is queued if(!repaintQueued) { repaintQueued=true; @@ -1932,7 +1928,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // common treatment case WindowEvent.EVENT_WINDOW_RESIZED: // queue event in case window is locked, ie in operation - if( isWindowLocked() ) { + if( null != getWindowLockOwner() ) { final boolean discardTO = QUEUED_EVENT_TO <= System.currentTimeMillis()-e.getWhen(); if(DEBUG_IMPLEMENTATION) { System.err.println("Window.consumeEvent: "+Thread.currentThread().getName()+" - queued "+e+", discard-to "+discardTO); |