aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/native/WindowsWindow.c
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-11-19 19:21:50 +0100
committerSven Gothel <[email protected]>2011-11-19 19:21:50 +0100
commit2641d1cffebff214c4b37d7291627f76cc3bbe3f (patch)
tree5c2c9f38c2b60ce2f8ca2f53a9eb5c83e1f23ac1 /src/newt/native/WindowsWindow.c
parentd7ee8ff7c919b71107539e9c012a9170e60ceaa9 (diff)
NEWT: Move 'focusAction()' invokation from native code to Java, avoiding deadlocks and simplify call-tree
Diffstat (limited to 'src/newt/native/WindowsWindow.c')
-rw-r--r--src/newt/native/WindowsWindow.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c
index a62343d0e..b654fbe85 100644
--- a/src/newt/native/WindowsWindow.c
+++ b/src/newt/native/WindowsWindow.c
@@ -115,7 +115,6 @@ static jmethodID enqueueMouseEventID = NULL;
static jmethodID sendMouseEventID = NULL;
static jmethodID enqueueKeyEventID = NULL;
static jmethodID sendKeyEventID = NULL;
-static jmethodID focusActionID = NULL;
static jmethodID requestFocusID = NULL;
static RECT* UpdateInsets(JNIEnv *env, jobject window, HWND hwnd);
@@ -602,18 +601,14 @@ static void NewtWindows_requestFocus (JNIEnv *env, jobject window, HWND hwnd, jb
(void*) pHwnd, (void*)hwnd, current==hwnd);
if( JNI_TRUE==force || current!=hwnd) {
- if( JNI_TRUE==force || JNI_FALSE == (*env)->CallBooleanMethod(env, window, focusActionID) ) {
- UINT flags = SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE;
- SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, flags);
- SetForegroundWindow(hwnd); // Slightly Higher Priority
- SetFocus(hwnd);// Sets Keyboard Focus To Window
- if(NULL!=pHwnd) {
- SetActiveWindow(hwnd);
- }
- DBG_PRINT("*** WindowsWindow: requestFocus.X1\n");
- } else {
- DBG_PRINT("*** WindowsWindow: requestFocus.X0\n");
+ UINT flags = SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE;
+ SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, flags);
+ SetForegroundWindow(hwnd); // Slightly Higher Priority
+ SetFocus(hwnd);// Sets Keyboard Focus To Window
+ if(NULL!=pHwnd) {
+ SetActiveWindow(hwnd);
}
+ DBG_PRINT("*** WindowsWindow: requestFocus.X1\n");
}
DBG_PRINT("*** WindowsWindow: requestFocus.XX\n");
}
@@ -1271,7 +1266,6 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_windows_WindowsWindow_initIDs
enqueueKeyEventID = (*env)->GetMethodID(env, clazz, "enqueueKeyEvent", "(ZIIIC)V");
sendKeyEventID = (*env)->GetMethodID(env, clazz, "sendKeyEvent", "(IIIC)V");
requestFocusID = (*env)->GetMethodID(env, clazz, "requestFocus", "(Z)V");
- focusActionID = (*env)->GetMethodID(env, clazz, "focusAction", "()Z");
if (insetsChangedID == NULL ||
sizeChangedID == NULL ||
@@ -1284,7 +1278,6 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_windows_WindowsWindow_initIDs
sendMouseEventID == NULL ||
enqueueKeyEventID == NULL ||
sendKeyEventID == NULL ||
- focusActionID == NULL ||
requestFocusID == NULL) {
return JNI_FALSE;
}