diff options
author | Sven Gothel <[email protected]> | 2010-05-04 06:35:37 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-05-04 06:35:37 +0200 |
commit | 9e792dcef900de7039cd277459c0629abfab9f21 (patch) | |
tree | 81adfd1e07e2118675d62836e1289225f408bb00 /src/newt/native/WindowsWindow.c | |
parent | a677e9db03ea44ea353fb9de61e2a86a6e063d0f (diff) |
NEWT Fixes:
- Common native in NewtCommon.c/.h
- Add simple NEWTEventFiFo, providing a pattern
to spool events by an EventListener and to process them
where it impacts (GLEventListener ..)
- Window [X11|Windows]: setSize/setPosition:
- always store the values,
- only act if valid and !fullscreen
- Window [X11]:
- Add requestFocus
- Add setTitle
- Fix parent/child window creation
- Fix parent/child window fullscreen (reparenting)
- JUnit Test: ParentTest:
- Shows parent and client window animation
- Client window shall be able to go into fullscreen,
ie disconnect/reconnect from its parent.
Test: Focus-client + type-'f'
- Both windows receive/dispatch events properly
Diffstat (limited to 'src/newt/native/WindowsWindow.c')
-rwxr-xr-x | src/newt/native/WindowsWindow.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c index 82eb81d99..69b87d39d 100755 --- a/src/newt/native/WindowsWindow.c +++ b/src/newt/native/WindowsWindow.c @@ -96,6 +96,8 @@ #include "InputEvent.h" #include "KeyEvent.h" +#include "NewtCommon.h" + // #define VERBOSE_ON 1 #ifdef VERBOSE_ON @@ -460,17 +462,6 @@ static void BuildDynamicKeyMapTable() } // for each VK_OEM_* } -// Really need to factor this out in to a separate run-time file -static jchar* GetNullTerminatedStringChars(JNIEnv* env, jstring str) -{ - jchar* strChars = NULL; - strChars = calloc((*env)->GetStringLength(env, str) + 1, sizeof(jchar)); - if (strChars != NULL) { - (*env)->GetStringRegion(env, str, 0, (*env)->GetStringLength(env, str), strChars); - } - return strChars; -} - static jint GetModifiers() { jint modifiers = 0; // have to do &0xFFFF to avoid runtime assert caused by compiling with @@ -932,7 +923,7 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsDisplay_Dispatch JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_windows_WindowsDisplay_LoadLibraryW (JNIEnv *env, jclass clazz, jstring dllName) { - jchar* _dllName = GetNullTerminatedStringChars(env, dllName); + jchar* _dllName = NewtCommon_GetNullTerminatedStringChars(env, dllName); HMODULE lib = LoadLibraryW(_dllName); free(_dllName); return (jlong) (intptr_t) lib; @@ -965,7 +956,7 @@ JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_windows_WindowsDisplay_Register wc.hbrBackground = GetStockObject(BLACK_BRUSH); wc.lpszMenuName = NULL; #ifdef UNICODE - wc.lpszClassName = GetNullTerminatedStringChars(env, wndClassName); + wc.lpszClassName = NewtCommon_GetNullTerminatedStringChars(env, wndClassName); #else _wndClassName = (*env)->GetStringUTFChars(env, wndClassName, NULL); wc.lpszClassName = strdup(_wndClassName); @@ -1062,7 +1053,7 @@ JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_CreateWi HWND window = NULL; #ifdef UNICODE - wndName = GetNullTerminatedStringChars(env, jWndName); + wndName = NewtCommon_GetNullTerminatedStringChars(env, jWndName); #else wndName = (*env)->GetStringUTFChars(env, jWndName, NULL); #endif @@ -1281,7 +1272,7 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_setTitle { HWND hwnd = (HWND) (intptr_t) window; if (title != NULL) { - jchar *titleString = GetNullTerminatedStringChars(env, title); + jchar *titleString = NewtCommon_GetNullTerminatedStringChars(env, title); if (titleString != NULL) { SetWindowTextW(hwnd, titleString); free(titleString); |