diff options
author | Sven Gothel <[email protected]> | 2011-10-23 21:31:09 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-10-23 21:31:09 +0200 |
commit | b772c8416eada24696eaad638568ac8c24df60bc (patch) | |
tree | c01d6e3e1812e3b7fc2e23e69a1b0079fe0ea918 /src/newt/native/WindowsWindow.c | |
parent | 2a00f1008e2be44e02e7b96f3b1cb6af210597f2 (diff) |
Partially revert cba9a070f9649bec42627631d393963d548e320c: Skip focusAction() and native focus request on X11/Windows. On both platforms it's not required (proper focus traversion) and AWT would deadlock on Windows
Diffstat (limited to 'src/newt/native/WindowsWindow.c')
-rw-r--r-- | src/newt/native/WindowsWindow.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c index df4141169..d60c40496 100644 --- a/src/newt/native/WindowsWindow.c +++ b/src/newt/native/WindowsWindow.c @@ -601,19 +601,19 @@ static void NewtWindows_requestFocus (JNIEnv *env, jobject window, HWND hwnd, jb DBG_PRINT("*** WindowsWindow: requestFocus.S parent %p, window %p, isCurrent %d\n", (void*) pHwnd, (void*)hwnd, current==hwnd); - // even if we already own the focus, we need the 'focusAction()' call - // and the other probably redundant GDI calls don't harm. - 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); + 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"); } - DBG_PRINT("*** WindowsWindow: requestFocus.X1\n"); - } else { - DBG_PRINT("*** WindowsWindow: requestFocus.X0\n"); } DBG_PRINT("*** WindowsWindow: requestFocus.XX\n"); } |