aboutsummaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-07-25 04:23:35 +0200
committerSven Gothel <[email protected]>2012-07-25 04:23:35 +0200
commit7bb5885fc3a904f49e22f0c8cbf747d9b189a7ba (patch)
treee5617fa74ff4a401fa60a080c5b3e8cf4ee21233 /src/nativewindow/classes/jogamp
parent00bef95008b02cc71e166da122884402e9381f44 (diff)
SWT Update: SWT GLCanvas creates lazy when resource is ready; Create new NewtCanvasSWT allowing to parent NEWT windows natively.
SWT GLCanvas creates lazy when resource is ready - Ensures drawable and context are created when size > zero and native visualID is valid. The latter is platform dependent. - Note that you cannot utilize custom GLCapabilities w/ this one, since the configurations is already realized - use NewtCanvasSWT. Create new NewtCanvasSWT allowing to parent NEWT windows natively: - Similar to NewtCanvasAWT - Allows attaching / detaching NEWT windows NewtCanvasAWT: Public setNEWTChild(..) fixed Added test cases for the above - tested on Linux, OSX and Windows w/ SWT Note: As usual for OSX, add -XstartOnFirstThread Details: - NEWT Display has new method: 'EDTUtil setEDTUtil(EDTUtil)' allowing to set a custom event dispatch utility. We use this to set our SWTEDTUtil for using NEWT w/ SWT complying w/ SWT threading constraints.
Diffstat (limited to 'src/nativewindow/classes/jogamp')
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
index 4767dff18..894084fce 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
@@ -28,6 +28,7 @@
package jogamp.nativewindow.macosx;
import javax.media.nativewindow.NativeWindowException;
+import javax.media.nativewindow.util.Insets;
import javax.media.nativewindow.util.Point;
import jogamp.nativewindow.Debug;
@@ -63,8 +64,37 @@ public class OSXUtil {
return isNSView0(object);
}
- public static Point GetLocationOnScreen(long windowOrView, int src_x, int src_y) {
- return (Point) GetLocationOnScreen0(windowOrView, src_x, src_y);
+ /**
+ * In case the <code>windowOrView</code> is top-level,
+ * you shall set <code>topLevel</code> to true where
+ * insets gets into account to compute the client position as follows:
+ * <pre>
+ if(topLevel) {
+ // top-level position -> client window position
+ final Insets insets = GetInsets(windowOrView);
+ los.setX(los.getX() + insets.getLeftWidth());
+ los.setY(los.getY() + insets.getTopHeight());
+ }
+ * </pre>
+ * @param windowOrView
+ * @param topLevel
+ * @param src_x
+ * @param src_y
+ * @return the client position
+ */
+ public static Point GetLocationOnScreen(long windowOrView, boolean topLevel, int src_x, int src_y) {
+ final Point los = (Point) GetLocationOnScreen0(windowOrView, src_x, src_y);
+ if(topLevel) {
+ // top-level position -> client window position
+ final Insets insets = GetInsets(windowOrView);
+ los.setX(los.getX() + insets.getLeftWidth());
+ los.setY(los.getY() + insets.getTopHeight());
+ }
+ return los;
+ }
+
+ public static Insets GetInsets(long windowOrView) {
+ return (Insets) GetInsets0(windowOrView);
}
public static long CreateNSWindow(int x, int y, int width, int height) {
@@ -135,6 +165,7 @@ public class OSXUtil {
private static native boolean initIDs0();
private static native boolean isNSView0(long object);
private static native Object GetLocationOnScreen0(long windowOrView, int src_x, int src_y);
+ private static native Object GetInsets0(long windowOrView);
private static native long CreateNSWindow0(int x, int y, int width, int height);
private static native void DestroyNSWindow0(long nsWindow);
private static native long GetNSView0(long nsWindow);