summaryrefslogtreecommitdiffstats
path: root/src/nativewindow
diff options
context:
space:
mode:
Diffstat (limited to 'src/nativewindow')
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java59
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java2
2 files changed, 33 insertions, 28 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java
index 67f6fe4b8..f03aa06d9 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java
@@ -226,34 +226,39 @@ public abstract class JAWTWindow implements NativeWindow {
}
public Point getLocationOnScreen(Point storage) {
- if( 0 != getWindowHandle() ) {
- Point d;
- // windowLock.lock();
- try {
- d = getLocationOnScreenImpl(0, 0);
- } finally {
- // windowLock.unlock();
- }
- if(null!=d) {
- if(null!=storage) {
- storage.translate(d.getX(),d.getY());
- return storage;
- }
- return d;
+ int lockRes = lockSurface();
+ if(LOCK_SURFACE_NOT_READY == lockRes) {
+ // FIXME: Shall we deal with already locked or unrealized surfaces ?
+ System.err.println("Warning: JAWT Lock couldn't be acquired!");
+ Thread.dumpStack();
+ return null;
+ }
+ try {
+ Point d = getLocationOnScreenImpl(0, 0);
+ if(null!=d) {
+ if(null!=storage) {
+ storage.translate(d.getX(),d.getY());
+ return storage;
}
- // fall through intended ..
- }
-
- if(!Thread.holdsLock(component.getTreeLock())) {
- return null; // avoid deadlock ..
- }
- java.awt.Point awtLOS = component.getLocationOnScreen();
- int dx = (int) ( awtLOS.getX() + .5 ) ;
- int dy = (int) ( awtLOS.getY() + .5 ) ;
- if(null!=storage) {
- return storage.translate(dx, dy);
- }
- return new Point(dx, dy);
+ return d;
+ }
+ // fall through intended ..
+ if(!Thread.holdsLock(component.getTreeLock())) {
+ // FIXME: Verify if this check is still required!
+ System.err.println("Warning: JAWT Lock hold, but not the AWT tree lock!");
+ Thread.dumpStack();
+ return null; // avoid deadlock ..
+ }
+ java.awt.Point awtLOS = component.getLocationOnScreen();
+ int dx = (int) ( awtLOS.getX() + .5 ) ;
+ int dy = (int) ( awtLOS.getY() + .5 ) ;
+ if(null!=storage) {
+ return storage.translate(dx, dy);
+ }
+ return new Point(dx, dy);
+ } finally {
+ unlockSurface();
+ }
}
protected abstract Point getLocationOnScreenImpl(int x, int y);
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
index 37056d44d..28d75ea06 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
@@ -78,7 +78,7 @@ public class X11Util {
requiresX11Lock = !firstX11ActionOnProcess ;
if(DEBUG) {
- System.out.println("X11Util firstX11ActionOnProcess: "+firstX11ActionOnProcess+
+ System.err.println("X11Util firstX11ActionOnProcess: "+firstX11ActionOnProcess+
", XINITTHREADS_ALWAYS_ENABLED "+XINITTHREADS_ALWAYS_ENABLED+
", requiresX11Lock "+requiresX11Lock);
}