aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/native/WindowsWindow.c
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-10-22 15:54:58 +0200
committerSven Gothel <[email protected]>2011-10-22 15:54:58 +0200
commitcba9a070f9649bec42627631d393963d548e320c (patch)
treecda7fb5c364afd86779a756132ddec023131bb3a /src/newt/native/WindowsWindow.c
parenta9494e62a039d2b4bb0c8f7492e273aad44531c5 (diff)
NEWT/Native RequestFocus: Even if owning focus, run the focusAction() call incl. native focus request (X11, Windows, OSX)
Diffstat (limited to 'src/newt/native/WindowsWindow.c')
-rw-r--r--src/newt/native/WindowsWindow.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c
index 0d969e670..df4141169 100644
--- a/src/newt/native/WindowsWindow.c
+++ b/src/newt/native/WindowsWindow.c
@@ -600,19 +600,20 @@ static void NewtWindows_requestFocus (JNIEnv *env, jobject window, HWND hwnd, jb
current = GetFocus();
DBG_PRINT("*** WindowsWindow: requestFocus.S parent %p, window %p, isCurrent %d\n",
(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");
+
+ // 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);
}
+ DBG_PRINT("*** WindowsWindow: requestFocus.X1\n");
+ } else {
+ DBG_PRINT("*** WindowsWindow: requestFocus.X0\n");
}
DBG_PRINT("*** WindowsWindow: requestFocus.XX\n");
}