diff options
author | Sven Gothel <[email protected]> | 2014-01-31 10:55:19 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-01-31 10:55:19 +0100 |
commit | 6280428d85cdcbbc8b83b73111ccf20fe786564f (patch) | |
tree | d97ef9af79fdb76a7693e6232b6aae644f9eaed2 /src/nativewindow | |
parent | 7a1537c091b6205a3a25c4d6e8f09f32279160c8 (diff) |
Add NativeWindowFactory.getLocationOnScreen(NativeWindow nw) to retrieve the NativeWindow location on screen
Diffstat (limited to 'src/nativewindow')
-rw-r--r-- | src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java index 1dce05192..7c491a9ee 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java @@ -43,11 +43,17 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.media.nativewindow.util.Point; +import javax.media.nativewindow.util.PointImmutable; + import jogamp.nativewindow.Debug; import jogamp.nativewindow.NativeWindowFactoryImpl; import jogamp.nativewindow.ToolkitProperties; import jogamp.nativewindow.ResourceToolkitLock; import jogamp.nativewindow.WrappedWindow; +import jogamp.nativewindow.macosx.OSXUtil; +import jogamp.nativewindow.windows.GDIUtil; +import jogamp.nativewindow.x11.X11Lib; import com.jogamp.common.os.Platform; import com.jogamp.common.util.ReflectionUtil; @@ -673,4 +679,17 @@ public abstract class NativeWindowFactory { return new WrappedWindow(config, surfaceHandle, hook, true, windowHandle); } + public static PointImmutable getLocationOnScreen(NativeWindow nw) { + final String nwt = NativeWindowFactory.getNativeWindowType(true); + if( NativeWindowFactory.TYPE_X11 == nwt ) { + return X11Lib.GetRelativeLocation(nw.getDisplayHandle(), nw.getScreenIndex(), nw.getWindowHandle(), 0, 0, 0); + } else if( NativeWindowFactory.TYPE_WINDOWS == nwt ) { + return GDIUtil.GetRelativeLocation(nw.getWindowHandle(), 0, 0, 0); + } else if( NativeWindowFactory.TYPE_MACOSX == nwt ) { + return OSXUtil.GetLocationOnScreen(nw.getWindowHandle(), null == nw.getParent(), 0, 0); + } + throw new UnsupportedOperationException("n/a for this windowing system: "+nwt); + } + + } |