diff options
author | Sven Gothel <[email protected]> | 2011-12-24 03:24:29 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-12-24 03:24:29 +0100 |
commit | 976e47291d052caab4b101d900270a073a3bbb55 (patch) | |
tree | fd9694fbbf652475b9ffeec87e325d36c3099d6d /src/newt/native/WindowsWindow.c | |
parent | 3f5d71f14506da21db29d050e685a482df47b5cc (diff) |
NEWT Screen: Add virtual top-left origin getX()/getY() ; WindowsWindow.c: allow negative coordinates
- ScreenImpl:
- Use Point & Dimension for holding virtual origin and size
- updateScreenSize() -> updateVirtualScreenOriginAndSize()
- DimensionImmutable getNativeScreenSizeImpl()
-> void getVirtualScreenOriginAndSize(Point virtualOrigin, Dimension virtualSize)
- WindowImpl setFullscreen(true): Use Screen virtual origin
- WindowsWindow.c
- For x/y coords use GET_X_LPARAM/GET_Y_LPARAM which casts '(int)(short)'
to preserve negative coordinates.
- NewtWindow_setVisiblePosSize() allow negative coordinates
Diffstat (limited to 'src/newt/native/WindowsWindow.c')
-rw-r--r-- | src/newt/native/WindowsWindow.c | 63 |
1 files changed, 49 insertions, 14 deletions
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; } |