aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
authorPetros Koutsolampros <[email protected]>2013-11-24 22:46:58 +0000
committerPetros Koutsolampros <[email protected]>2013-11-24 22:46:58 +0000
commit5db2c65cd030311b5cfcb8174ada6e870db10258 (patch)
tree24c3f036e35225de6fc07dc9f7b5a7c234aca05d /src/newt
parent0c3709ba4ba2dd4ba7bb2e7f0783fba346e090e1 (diff)
Bug 672 (NewtCanvasSWT ignore windowing offset on OSX').
The NewtCanvasSWT is now brought into place by the parent SWT Composite and the super SWT Canvas it extends. Also added two test cases. One with a simple SashForm and the NewtCanvasSWT in the second cell, and another with the NewtCanvasSWT in a Composite, that Composite now in the second cell of the SashForm. The second test is necessary because the NewtCanvasSWT does not receive SWT.Resize events in this configuration, but only SWT.Paint ones (a behaviour inherited from the super SWT Canvas)
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
index e63a53524..029cee3da 100644
--- a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
+++ b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
@@ -145,6 +145,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
newtChild.setSize(clientArea.width, clientArea.height);
postSetSize = false;
}
+ if( isOSX ) newtChild.setPosition(parent.getLocation().x,parent.getLocation().y);
newtChild.windowRepaint(0, 0, clientArea.width, clientArea.height);
}
}
@@ -252,6 +253,9 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
super.dispose();
}
+ private Rectangle getSWTCanvasPosition() {
+ return super.getBounds();
+ }
/** @return this SWT Canvas NativeWindow representation, may be null in case it has not been realized. */
public NativeWindow getNativeWindow() { return nativeWindow; }
@@ -500,7 +504,8 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
if( isOSX ) {
final Point los = OSXUtil.GetLocationOnScreen(nativeWindowHandle, false, 0, 0);
// top-level position -> client window position
- los.set(los.getX() + insets.getLeftWidth(), los.getY() + insets.getTopHeight());
+ final Rectangle swtCanvasPosition = getSWTCanvasPosition();
+ los.set(swtCanvasPosition.x + los.getX() + insets.getLeftWidth(), swtCanvasPosition.y + los.getY() + insets.getTopHeight());
if(null!=point) {
return point.translate(los);
} else {