diff options
author | Xerxes Rånby <[email protected]> | 2015-08-25 00:40:44 +0200 |
---|---|---|
committer | Xerxes Rånby <[email protected]> | 2015-08-25 00:45:41 +0200 |
commit | 5db1ba769b6a4b8f8e7148728bb1a82149c822ee (patch) | |
tree | 1cca9a338c06dc38b381da1ea3aaa7c8dae6daee | |
parent | a836175ecf20aaf71cd53f1cb79c6f68a2f87e2a (diff) |
Bug 1178: Fix cc3: Set position using LocationOnScreen coordinates.
Signed-off-by: Xerxes Rånby <[email protected]>
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/x11/X11UnderlayTracker.java | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/x11/X11UnderlayTracker.java b/src/newt/classes/jogamp/newt/driver/x11/X11UnderlayTracker.java index 6e64e7025..0b19dd726 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/X11UnderlayTracker.java +++ b/src/newt/classes/jogamp/newt/driver/x11/X11UnderlayTracker.java @@ -38,6 +38,7 @@ import com.jogamp.common.util.ReflectionUtil; import com.jogamp.nativewindow.Capabilities; import com.jogamp.nativewindow.GraphicsConfigurationFactory; import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.nativewindow.util.Point; import com.jogamp.newt.Display; import com.jogamp.newt.NewtFactory; import com.jogamp.newt.Screen; @@ -135,19 +136,52 @@ public class X11UnderlayTracker implements WindowListener, KeyListener, MouseLis if (underlayWindowMap.containsKey(s)) { WindowImpl underlayWindow = (WindowImpl)s; WindowImpl overlayWindow = underlayWindowMap.get(s); - if(overlayWindow.getX()!=underlayWindow.getX() || - overlayWindow.getY()!=underlayWindow.getY()) { - overlayWindow.setPosition(underlayWindow.getX(), underlayWindow.getY()); + Point overlayOnScreen = new Point(); + Point underlayOnScreen = new Point(); + overlayWindow.getLocationOnScreen(overlayOnScreen); + underlayWindow.getLocationOnScreen(underlayOnScreen); + if(overlayOnScreen.getX()!=underlayOnScreen.getX() || + overlayOnScreen.getY()!=underlayOnScreen.getY()) { + overlayWindow.setPosition(underlayOnScreen.getX(), underlayOnScreen.getY()); } } else if (overlayWindowMap.containsKey(s)) { WindowImpl overlayWindow = (WindowImpl)s; WindowImpl underlayWindow = overlayWindowMap.get(s); - if(overlayWindow.getX()!=underlayWindow.getX() || - overlayWindow.getY()!=underlayWindow.getY()) { - //FIXME: Pressing Maximize on the underlay X11 - //with this line enabled locks-up the NEWT EDT while using the BCM.VC.IV - //underlayWindow.setPosition(overlayWindow.getX(), overlayWindow.getY()); + // FIXME: Pressing Maximize on the underlay X11 + // with these lines enabled locks-up the NEWT EDT + /* + Point overlayOnScreen = new Point(); + Point underlayOnScreen = new Point(); + overlayWindow.getLocationOnScreen(overlayOnScreen); + underlayWindow.getLocationOnScreen(underlayOnScreen); + if(overlayOnScreen.getX()!=underlayOnScreen.getX() || + overlayOnScreen.getY()!=underlayOnScreen.getY()) { + underlayWindow.setPosition(overlayOnScreen.getX(), overlayOnScreen.getY()); } + */ + /* it locks up like this + Caused by: java.lang.RuntimeException: Waited 5000ms for: <5ccc078, 45700941>[count 1, qsz 0, owner <main-Display-.x11_:0-1-EDT-1>] - <main-Display-.x11_:0-2-EDT-1> + at jogamp.common.util.locks.RecursiveLockImpl01Unfairish.lock(RecursiveLockImpl01Unfairish.java:198) + at jogamp.nativewindow.ResourceToolkitLock.lock(ResourceToolkitLock.java:56) + at com.jogamp.nativewindow.DefaultGraphicsDevice.lock(DefaultGraphicsDevice.java:126) + at jogamp.newt.DisplayImpl.runWithLockedDevice(DisplayImpl.java:780) + at jogamp.newt.DisplayImpl.runWithLockedDisplayDevice(DisplayImpl.java:793) + at jogamp.newt.driver.x11.WindowDriver.runWithLockedDisplayDevice(WindowDriver.java:425) + at jogamp.newt.driver.x11.WindowDriver.getLocationOnScreenImpl(WindowDriver.java:334) + at jogamp.newt.WindowImpl.getLocationOnScreen(WindowImpl.java:1113) + at jogamp.newt.driver.x11.X11UnderlayTracker.windowMoved(X11UnderlayTracker.java:153) + at jogamp.newt.WindowImpl.consumeWindowEvent(WindowImpl.java:4243) + at jogamp.newt.WindowImpl.sendWindowEvent(WindowImpl.java:4174) + at jogamp.newt.WindowImpl.positionChanged(WindowImpl.java:4403) + at jogamp.newt.WindowImpl.sizePosMaxInsetsChanged(WindowImpl.java:4567) + at jogamp.newt.driver.x11.DisplayDriver.DispatchMessages0(Native Method) + at jogamp.newt.driver.x11.DisplayDriver.dispatchMessagesNative(DisplayDriver.java:112) + at jogamp.newt.WindowImpl.waitForPosition(WindowImpl.java:4438) + at jogamp.newt.WindowImpl.access$2200(WindowImpl.java:96) + at jogamp.newt.WindowImpl$SetPositionAction.run(WindowImpl.java:2765) + at com.jogamp.common.util.RunnableTask.run(RunnableTask.java:150) + at jogamp.newt.DefaultEDTUtil$NEDT.run(DefaultEDTUtil.java:372) + */ } } |