aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/newt/classes/com/jogamp/newt/Screen.java14
-rw-r--r--src/newt/classes/jogamp/newt/ScreenImpl.java51
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/AndroidScreen.java9
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/AWTScreen.java14
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/AWTWindow.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/broadcom/egl/Screen.java9
-rw-r--r--src/newt/classes/jogamp/newt/driver/intel/gdl/Screen.java13
-rw-r--r--src/newt/classes/jogamp/newt/driver/kd/KDScreen.java9
-rw-r--r--src/newt/classes/jogamp/newt/driver/macosx/MacScreen.java9
-rw-r--r--src/newt/classes/jogamp/newt/driver/windows/WindowsScreen.java12
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/X11Screen.java14
-rw-r--r--src/newt/native/WindowsWindow.c63
13 files changed, 147 insertions, 74 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java
index b6d863965..26f19ad6b 100644
--- a/src/newt/classes/com/jogamp/newt/Screen.java
+++ b/src/newt/classes/com/jogamp/newt/Screen.java
@@ -120,12 +120,22 @@ public abstract class Screen {
public abstract int getIndex();
/**
- * @return the current screen width, reflecting {@link ScreenMode} rotation
+ * @return the x position of the virtual top-left origin.
+ */
+ public abstract int getX();
+
+ /**
+ * @return the y position of the virtual top-left origin.
+ */
+ public abstract int getY();
+
+ /**
+ * @return the <b>rotated</b> virtual width.
*/
public abstract int getWidth();
/**
- * @return the current screen height, reflecting {@link ScreenMode} rotation
+ * @return the <b>rotated</b> virtual height.
*/
public abstract int getHeight();
diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java
index a8e6e68bd..98e851937 100644
--- a/src/newt/classes/jogamp/newt/ScreenImpl.java
+++ b/src/newt/classes/jogamp/newt/ScreenImpl.java
@@ -45,7 +45,9 @@ import com.jogamp.newt.util.MonitorMode;
import com.jogamp.newt.util.ScreenModeUtil;
import javax.media.nativewindow.*;
+import javax.media.nativewindow.util.Dimension;
import javax.media.nativewindow.util.DimensionImmutable;
+import javax.media.nativewindow.util.Point;
import javax.media.nativewindow.util.SurfaceSize;
import java.security.*;
@@ -61,8 +63,10 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener {
protected int hashCode;
protected AbstractGraphicsScreen aScreen;
protected int refCount; // number of Screen references by Window
- protected int width=-1, height=-1; // detected values: set using setScreenSize
- protected static int usrWidth=-1, usrHeight=-1; // property values: newt.ws.swidth and newt.ws.sheight
+ protected Point vOrigin = new Point(0, 0); // virtual top-left origin
+ protected Dimension vSize = new Dimension(0, 0); // virtual rotated screen size
+ protected static Dimension usrSize = null; // property values: newt.ws.swidth and newt.ws.sheight
+ protected static volatile boolean usrSizeQueried = false;
private static AccessControlContext localACC = AccessController.getContext();
private ArrayList<ScreenModeListener> referencedScreenModeListener = new ArrayList<ScreenModeListener>();
long t0; // creationTime
@@ -102,13 +106,15 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener {
public static Screen create(Display display, int idx) {
try {
- if(usrWidth<0 || usrHeight<0) {
+ if(!usrSizeQueried) {
synchronized (Screen.class) {
- if(usrWidth<0 || usrHeight<0) {
- usrWidth = Debug.getIntProperty("newt.ws.swidth", true, localACC);
- usrHeight = Debug.getIntProperty("newt.ws.sheight", true, localACC);
- if(usrWidth>0 || usrHeight>0) {
- System.err.println("User screen size "+usrWidth+"x"+usrHeight);
+ if(!usrSizeQueried) {
+ usrSizeQueried = true;
+ final int w = Debug.getIntProperty("newt.ws.swidth", true, localACC);
+ final int h = Debug.getIntProperty("newt.ws.sheight", true, localACC);
+ if(w>0 && h>0) {
+ usrSize = new Dimension(w, h);
+ System.err.println("User screen size "+usrSize);
}
}
}
@@ -178,7 +184,7 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener {
throw new NativeWindowException("Screen.createNative() failed to instanciate an AbstractGraphicsScreen");
}
initScreenModeStatus();
- updateScreenSize();
+ updateVirtualScreenOriginAndSize();
if(DEBUG) {
System.err.println("Screen.createNative() END ("+DisplayImpl.getThreadName()+", "+this+")");
}
@@ -252,13 +258,15 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener {
protected abstract int validateScreenIndex(int idx);
/**
- * Returns the <b>rotated</b> virtual ScreenSize.
+ * Stores the virtual origin and virtual <b>rotated</b> screen size.
* <p>
* This method is called after the ScreenMode has been set,
* hence you may utilize it.
* </p>
+ * @param virtualOrigin the store for the virtual origin
+ * @param virtualSize the store for the virtual rotated size
*/
- protected abstract DimensionImmutable getNativeScreenSizeImpl();
+ protected abstract void getVirtualScreenOriginAndSize(Point virtualOrigin, Dimension virtualSize);
public final String getFQName() {
return fqname;
@@ -267,10 +275,9 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener {
/**
* Updates the <b>rotated</b> virtual ScreenSize using the native impl.
*/
- protected void updateScreenSize() {
- final DimensionImmutable dim = getNativeScreenSizeImpl();
- width=dim.getWidth(); height=dim.getHeight();
- System.err.println("Detected screen size "+width+"x"+height);
+ protected void updateVirtualScreenOriginAndSize() {
+ getVirtualScreenOriginAndSize(vOrigin, vSize);
+ System.err.println("Detected screen origin "+vOrigin+", size "+vSize);
}
public final Display getDisplay() {
@@ -289,19 +296,15 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener {
return null != aScreen;
}
+ public int getX() { return vOrigin.getX(); }
+ public int getY() { return vOrigin.getY(); }
- /**
- * @return the <b>rotated</b> virtual width.
- */
public final int getWidth() {
- return (usrWidth>0) ? usrWidth : (width>0) ? width : 480;
+ return (null != usrSize) ? usrSize.getWidth() : vSize.getWidth();
}
- /**
- * @return the <b>rotated</b> virtual height.
- */
public final int getHeight() {
- return (usrHeight>0) ? usrHeight : (height>0) ? height : 480;
+ return (null != usrSize) ? usrSize.getHeight() : vSize.getHeight();
}
@Override
@@ -403,7 +406,7 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener {
public void screenModeChanged(ScreenMode sm, boolean success) {
if(success) {
- updateScreenSize();
+ updateVirtualScreenOriginAndSize();
}
for(int i=0; i<referencedScreenModeListener.size(); i++) {
((ScreenModeListener)referencedScreenModeListener.get(i)).screenModeChanged(sm, success);
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index 7c811c66a..f667d7540 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -1677,7 +1677,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
nfs_y = WindowImpl.this.y;
nfs_width = WindowImpl.this.width;
nfs_height = WindowImpl.this.height;
- x = 0; y = 0;
+ x = screen.getX(); y = screen.getY();
w = screen.getWidth();
h = screen.getHeight();
} else {
diff --git a/src/newt/classes/jogamp/newt/driver/android/AndroidScreen.java b/src/newt/classes/jogamp/newt/driver/android/AndroidScreen.java
index f403bc425..e108ed0bb 100644
--- a/src/newt/classes/jogamp/newt/driver/android/AndroidScreen.java
+++ b/src/newt/classes/jogamp/newt/driver/android/AndroidScreen.java
@@ -30,7 +30,7 @@ package jogamp.newt.driver.android;
import javax.media.nativewindow.*;
import javax.media.nativewindow.util.Dimension;
-import javax.media.nativewindow.util.DimensionImmutable;
+import javax.media.nativewindow.util.Point;
import com.jogamp.newt.ScreenMode;
import com.jogamp.newt.util.ScreenModeUtil;
@@ -80,9 +80,12 @@ public class AndroidScreen extends jogamp.newt.ScreenImpl {
return 0; // FIXME: only one screen available ?
}
- protected DimensionImmutable getNativeScreenSizeImpl() {
+ protected void getVirtualScreenOriginAndSize(Point virtualOrigin, Dimension virtualSize) {
+ virtualOrigin.setX(0);
+ virtualOrigin.setY(0);
final ScreenMode sm = getCurrentScreenMode();
- return new Dimension(sm.getRotatedWidth(), sm.getRotatedHeight());
+ virtualSize.setWidth(sm.getRotatedWidth());
+ virtualSize.setHeight(sm.getRotatedHeight());
}
//----------------------------------------------------------------------
diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTScreen.java b/src/newt/classes/jogamp/newt/driver/awt/AWTScreen.java
index e2e0105eb..9eed930b6 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/AWTScreen.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/AWTScreen.java
@@ -39,7 +39,7 @@ import jogamp.newt.ScreenImpl;
import javax.media.nativewindow.awt.AWTGraphicsDevice;
import javax.media.nativewindow.awt.AWTGraphicsScreen;
import javax.media.nativewindow.util.Dimension;
-import javax.media.nativewindow.util.DimensionImmutable;
+import javax.media.nativewindow.util.Point;
public class AWTScreen extends ScreenImpl {
public AWTScreen() {
@@ -57,8 +57,8 @@ public class AWTScreen extends ScreenImpl {
* Used by AWTWindow ..
*/
@Override
- protected void updateScreenSize() {
- super.updateScreenSize();
+ protected void updateVirtualScreenOriginAndSize() {
+ super.updateVirtualScreenOriginAndSize();
}
protected void closeNativeImpl() { }
@@ -67,12 +67,14 @@ public class AWTScreen extends ScreenImpl {
return idx; // pass through ...
}
- protected DimensionImmutable getNativeScreenSizeImpl() {
+ protected void getVirtualScreenOriginAndSize(Point virtualOrigin, Dimension virtualSize) {
final DisplayMode mode = ((AWTGraphicsDevice)getDisplay().getGraphicsDevice()).getGraphicsDevice().getDisplayMode();
if(null != mode) {
- return new Dimension(mode.getWidth(), mode.getHeight());
+ virtualOrigin.setX(0);
+ virtualOrigin.setY(0);
+ virtualSize.setWidth(mode.getWidth());
+ virtualSize.setHeight(mode.getHeight());
}
- return null;
}
}
diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTWindow.java b/src/newt/classes/jogamp/newt/driver/awt/AWTWindow.java
index 5b6fcedbe..e9e3ec0ba 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/AWTWindow.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/AWTWindow.java
@@ -156,7 +156,7 @@ public class AWTWindow extends WindowImpl {
((AWTScreen)getScreen()).setAWTGraphicsScreen((AWTGraphicsScreen)cfg.getScreen());
((AWTDisplay)getScreen().getDisplay()).setAWTGraphicsDevice((AWTGraphicsDevice)cfg.getScreen().getDevice());
- ((AWTScreen)getScreen()).updateScreenSize();
+ ((AWTScreen)getScreen()).updateVirtualScreenOriginAndSize();
}
return res;
}
diff --git a/src/newt/classes/jogamp/newt/driver/broadcom/egl/Screen.java b/src/newt/classes/jogamp/newt/driver/broadcom/egl/Screen.java
index 86a27a407..11b8dfcf9 100644
--- a/src/newt/classes/jogamp/newt/driver/broadcom/egl/Screen.java
+++ b/src/newt/classes/jogamp/newt/driver/broadcom/egl/Screen.java
@@ -35,7 +35,7 @@ package jogamp.newt.driver.broadcom.egl;
import javax.media.nativewindow.*;
import javax.media.nativewindow.util.Dimension;
-import javax.media.nativewindow.util.DimensionImmutable;
+import javax.media.nativewindow.util.Point;
public class Screen extends jogamp.newt.ScreenImpl {
@@ -57,8 +57,11 @@ public class Screen extends jogamp.newt.ScreenImpl {
return 0; // only one screen available
}
- protected DimensionImmutable getNativeScreenSizeImpl() {
- return new Dimension(fixedWidth, fixedHeight); // FIXME
+ protected void getVirtualScreenOriginAndSize(Point virtualOrigin, Dimension virtualSize) {
+ virtualOrigin.setX(0);
+ virtualOrigin.setY(0);
+ virtualSize.setWidth(fixedWidth); // FIXME
+ virtualSize.setHeight(fixedHeight); // FIXME
}
//----------------------------------------------------------------------
diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/Screen.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/Screen.java
index 6e156183f..66ad1c691 100644
--- a/src/newt/classes/jogamp/newt/driver/intel/gdl/Screen.java
+++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/Screen.java
@@ -33,10 +33,10 @@
package jogamp.newt.driver.intel.gdl;
-import jogamp.newt.*;
-import javax.media.nativewindow.*;
+import javax.media.nativewindow.AbstractGraphicsDevice;
+import javax.media.nativewindow.DefaultGraphicsScreen;
import javax.media.nativewindow.util.Dimension;
-import javax.media.nativewindow.util.DimensionImmutable;
+import javax.media.nativewindow.util.Point;
public class Screen extends jogamp.newt.ScreenImpl {
@@ -59,8 +59,11 @@ public class Screen extends jogamp.newt.ScreenImpl {
return 0; // only one screen available
}
- protected DimensionImmutable getNativeScreenSizeImpl() {
- return new Dimension(cachedWidth, cachedHeight);
+ protected void getVirtualScreenOriginAndSize(Point virtualOrigin, Dimension virtualSize) {
+ virtualOrigin.setX(0);
+ virtualOrigin.setY(0);
+ virtualSize.setWidth(cachedWidth);
+ virtualSize.setHeight(cachedHeight);
}
//----------------------------------------------------------------------
diff --git a/src/newt/classes/jogamp/newt/driver/kd/KDScreen.java b/src/newt/classes/jogamp/newt/driver/kd/KDScreen.java
index bbfef370c..6b6aecb20 100644
--- a/src/newt/classes/jogamp/newt/driver/kd/KDScreen.java
+++ b/src/newt/classes/jogamp/newt/driver/kd/KDScreen.java
@@ -36,7 +36,7 @@ package jogamp.newt.driver.kd;
import jogamp.newt.ScreenImpl;
import javax.media.nativewindow.*;
import javax.media.nativewindow.util.Dimension;
-import javax.media.nativewindow.util.DimensionImmutable;
+import javax.media.nativewindow.util.Point;
public class KDScreen extends ScreenImpl {
static {
@@ -56,8 +56,11 @@ public class KDScreen extends ScreenImpl {
return 0; // only one screen available
}
- protected DimensionImmutable getNativeScreenSizeImpl() {
- return new Dimension(cachedWidth, cachedHeight);
+ protected void getVirtualScreenOriginAndSize(Point virtualOrigin, Dimension virtualSize) {
+ virtualOrigin.setX(0);
+ virtualOrigin.setY(0);
+ virtualSize.setWidth(cachedWidth);
+ virtualSize.setHeight(cachedHeight);
}
protected void sizeChanged(int w, int h) {
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/MacScreen.java b/src/newt/classes/jogamp/newt/driver/macosx/MacScreen.java
index 4954b0569..3204982be 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/MacScreen.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/MacScreen.java
@@ -37,8 +37,8 @@ package jogamp.newt.driver.macosx;
import java.util.List;
import javax.media.nativewindow.DefaultGraphicsScreen;
-import javax.media.nativewindow.util.DimensionImmutable;
import javax.media.nativewindow.util.Dimension;
+import javax.media.nativewindow.util.Point;
import jogamp.newt.ScreenImpl;
@@ -111,8 +111,11 @@ public class MacScreen extends ScreenImpl {
return idx;
}
- protected DimensionImmutable getNativeScreenSizeImpl() {
- return new Dimension(getWidthImpl0(screen_idx), getHeightImpl0(screen_idx));
+ protected void getVirtualScreenOriginAndSize(Point virtualOrigin, Dimension virtualSize) {
+ virtualOrigin.setX(0);
+ virtualOrigin.setY(0);
+ virtualSize.setWidth(getWidthImpl0(screen_idx));
+ virtualSize.setHeight(getHeightImpl0(screen_idx));
}
private native int[] getScreenMode0(int screen_index, int mode_index);
diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowsScreen.java b/src/newt/classes/jogamp/newt/driver/windows/WindowsScreen.java
index 7e3e3626c..f8bce9da3 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/WindowsScreen.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/WindowsScreen.java
@@ -35,7 +35,7 @@ package jogamp.newt.driver.windows;
import javax.media.nativewindow.DefaultGraphicsScreen;
import javax.media.nativewindow.util.Dimension;
-import javax.media.nativewindow.util.DimensionImmutable;
+import javax.media.nativewindow.util.Point;
import jogamp.newt.ScreenImpl;
@@ -106,13 +106,17 @@ public class WindowsScreen extends ScreenImpl {
return 0; // big-desktop, only one screen available
}
- protected DimensionImmutable getNativeScreenSizeImpl() {
- return new Dimension(getWidthImpl0(screen_idx), getHeightImpl0(screen_idx));
+ protected void getVirtualScreenOriginAndSize(Point virtualOrigin, Dimension virtualSize) {
+ virtualOrigin.setX(getOriginX0(screen_idx));
+ virtualOrigin.setY(getOriginY0(screen_idx));
+ virtualSize.setWidth(getWidthImpl0(screen_idx));
+ virtualSize.setHeight(getHeightImpl0(screen_idx));
}
// Native calls
+ private native int getOriginX0(int screen_idx);
+ private native int getOriginY0(int screen_idx);
private native int getWidthImpl0(int scrn_idx);
-
private native int getHeightImpl0(int scrn_idx);
private native int[] getScreenMode0(int screen_index, int mode_index);
diff --git a/src/newt/classes/jogamp/newt/driver/x11/X11Screen.java b/src/newt/classes/jogamp/newt/driver/x11/X11Screen.java
index c52a21220..ed5ebc04e 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/X11Screen.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/X11Screen.java
@@ -44,7 +44,7 @@ import com.jogamp.newt.util.ScreenModeUtil;
import java.util.List;
import javax.media.nativewindow.util.Dimension;
-import javax.media.nativewindow.util.DimensionImmutable;
+import javax.media.nativewindow.util.Point;
import javax.media.nativewindow.x11.*;
public class X11Screen extends ScreenImpl {
@@ -268,10 +268,14 @@ public class X11Screen extends ScreenImpl {
}
}
- protected DimensionImmutable getNativeScreenSizeImpl() {
- return display.runWithLockedDisplayHandle( new DisplayImpl.DisplayRunnable<DimensionImmutable>() {
- public DimensionImmutable run(long dpy) {
- return new Dimension(getWidth0(dpy, screen_idx), getHeight0(dpy, screen_idx));
+ protected void getVirtualScreenOriginAndSize(final Point virtualOrigin, final Dimension virtualSize) {
+ display.runWithLockedDisplayHandle( new DisplayImpl.DisplayRunnable<Object>() {
+ public Object run(long dpy) {
+ virtualOrigin.setX(0);
+ virtualOrigin.setY(0);
+ virtualSize.setWidth(getWidth0(dpy, screen_idx));
+ virtualSize.setHeight(getHeight0(dpy, screen_idx));
+ return null;
} } );
}
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c
index b763d5cad..97fe6f28d 100644
--- a/src/newt/native/WindowsWindow.c
+++ b/src/newt/native/WindowsWindow.c
@@ -869,7 +869,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message,
(*env)->CallVoidMethod(env, window, sendMouseEventID,
(jint) EVENT_MOUSE_PRESSED,
GetModifiers(),
- (jint) LOWORD(lParam), (jint) HIWORD(lParam),
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
(jint) 1, (jint) 0);
useDefWindowProc = 1;
break;
@@ -878,7 +878,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message,
(*env)->CallVoidMethod(env, window, sendMouseEventID,
(jint) EVENT_MOUSE_RELEASED,
GetModifiers(),
- (jint) LOWORD(lParam), (jint) HIWORD(lParam),
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
(jint) 1, (jint) 0);
useDefWindowProc = 1;
break;
@@ -889,7 +889,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message,
(*env)->CallVoidMethod(env, window, sendMouseEventID,
(jint) EVENT_MOUSE_PRESSED,
GetModifiers(),
- (jint) LOWORD(lParam), (jint) HIWORD(lParam),
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
(jint) 2, (jint) 0);
useDefWindowProc = 1;
break;
@@ -898,7 +898,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message,
(*env)->CallVoidMethod(env, window, sendMouseEventID,
(jint) EVENT_MOUSE_RELEASED,
GetModifiers(),
- (jint) LOWORD(lParam), (jint) HIWORD(lParam),
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
(jint) 2, (jint) 0);
useDefWindowProc = 1;
break;
@@ -909,7 +909,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message,
(*env)->CallVoidMethod(env, window, sendMouseEventID,
(jint) EVENT_MOUSE_PRESSED,
GetModifiers(),
- (jint) LOWORD(lParam), (jint) HIWORD(lParam),
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
(jint) 3, (jint) 0);
useDefWindowProc = 1;
break;
@@ -918,7 +918,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message,
(*env)->CallVoidMethod(env, window, sendMouseEventID,
(jint) EVENT_MOUSE_RELEASED,
GetModifiers(),
- (jint) LOWORD(lParam), (jint) HIWORD(lParam),
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
(jint) 3, (jint) 0);
useDefWindowProc = 1;
break;
@@ -927,7 +927,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message,
(*env)->CallVoidMethod(env, window, sendMouseEventID,
(jint) EVENT_MOUSE_MOVED,
GetModifiers(),
- (jint) LOWORD(lParam), (jint) HIWORD(lParam),
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
(jint) 0, (jint) 0);
useDefWindowProc = 1;
break;
@@ -973,8 +973,8 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message,
break;
case WM_MOVE:
- DBG_PRINT("*** WindowsWindow: WM_MOVE window %p, %d/%d\n", wnd, (int)LOWORD(lParam), (int)HIWORD(lParam));
- (*env)->CallVoidMethod(env, window, positionChangedID, JNI_FALSE, (jint)LOWORD(lParam), (jint)HIWORD(lParam));
+ DBG_PRINT("*** WindowsWindow: WM_MOVE window %p, %d/%d\n", wnd, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
+ (*env)->CallVoidMethod(env, window, positionChangedID, JNI_FALSE, (jint)GET_X_LPARAM(lParam), (jint)GET_Y_LPARAM(lParam));
useDefWindowProc = 1;
break;
@@ -1041,13 +1041,47 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_windows_WindowsDisplay_DispatchMe
/*
* Class: jogamp_newt_driver_windows_WindowsScreen
+ * Method: getOriginX0
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_jogamp_newt_driver_windows_WindowsScreen_getOriginX0
+ (JNIEnv *env, jobject obj, jint scrn_idx)
+{
+ if( GetSystemMetrics( SM_CMONITORS) > 1) {
+ return (jint)GetSystemMetrics(SM_XVIRTUALSCREEN);
+ } else {
+ return 0;
+ }
+}
+
+/*
+ * Class: jogamp_newt_driver_windows_WindowsScreen
+ * Method: getOriginY0
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_jogamp_newt_driver_windows_WindowsScreen_getOriginY0
+ (JNIEnv *env, jobject obj, jint scrn_idx)
+{
+ if( GetSystemMetrics( SM_CMONITORS ) > 1) {
+ return (jint)GetSystemMetrics(SM_YVIRTUALSCREEN);
+ } else {
+ return 0;
+ }
+}
+
+/*
+ * Class: jogamp_newt_driver_windows_WindowsScreen
* Method: getWidthImpl
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_jogamp_newt_driver_windows_WindowsScreen_getWidthImpl0
(JNIEnv *env, jobject obj, jint scrn_idx)
{
- return (jint)GetSystemMetrics(SM_CXSCREEN);
+ if( GetSystemMetrics( SM_CMONITORS) > 1) {
+ return (jint)GetSystemMetrics(SM_CXVIRTUALSCREEN);
+ } else {
+ return (jint)GetSystemMetrics(SM_CXSCREEN);
+ }
}
/*
@@ -1058,7 +1092,11 @@ JNIEXPORT jint JNICALL Java_jogamp_newt_driver_windows_WindowsScreen_getWidthImp
JNIEXPORT jint JNICALL Java_jogamp_newt_driver_windows_WindowsScreen_getHeightImpl0
(JNIEnv *env, jobject obj, jint scrn_idx)
{
- return (jint)GetSystemMetrics(SM_CYSCREEN);
+ if( GetSystemMetrics( SM_CMONITORS ) > 1) {
+ return (jint)GetSystemMetrics(SM_CYVIRTUALSCREEN);
+ } else {
+ return (jint)GetSystemMetrics(SM_CYSCREEN);
+ }
}
static int NewtScreen_RotationNativeCCW2NewtCCW(JNIEnv *env, int native) {
@@ -1310,9 +1348,6 @@ static void NewtWindow_setVisiblePosSize(HWND hwnd, BOOL atop, BOOL visible,
} else {
flags = SWP_NOACTIVATE | SWP_NOZORDER;
}
- if(0>x || 0>y) {
- flags |= SWP_NOMOVE;
- }
if(0>=width || 0>=height ) {
flags |= SWP_NOSIZE;
}