diff options
Diffstat (limited to 'src/newt')
-rw-r--r-- | src/newt/classes/jogamp/newt/WindowImpl.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index caa91fd7c..f0c351048 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -1358,12 +1358,21 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(this.pointerConfined != confine) { boolean setVal = 0 == getWindowHandle(); if(!setVal) { - requestFocus(); - warpPointer(width/2, height/2); + if(confine) { + requestFocus(); + warpPointer(width/2, height/2); + } setVal = confinePointerImpl(confine); + if(confine) { + // give time to deliver mouse movements w/o confinement, + // this allows user listener to sync previous position value to the new centered position + try { + Thread.sleep(3 * screen.getDisplay().getEDTUtil().getPollPeriod()); + } catch (InterruptedException e) { } + } } if(setVal) { - this.pointerConfined = confine; + this.pointerConfined = confine; } } } |