diff options
author | Sven Gothel <[email protected]> | 2012-10-30 17:43:34 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-10-30 17:43:34 +0100 |
commit | 60bf26c5c889cc78a3f9714e7283950088823a90 (patch) | |
tree | 7a1b6150a76dd3862d22d71d46434e032a4270b6 | |
parent | 2db90cf4ffc2e821da8f13fd3057a63b59dc2fc7 (diff) |
NEWT Windows: Add more verbose DEBUG information for FOCUS handling
-rw-r--r-- | src/newt/native/WindowsWindow.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c index 40252f59b..bb90a2dce 100644 --- a/src/newt/native/WindowsWindow.c +++ b/src/newt/native/WindowsWindow.c @@ -595,20 +595,25 @@ static int WmKeyUp(JNIEnv *env, jobject window, UINT wkey, UINT repCnt, static void NewtWindows_requestFocus (JNIEnv *env, jobject window, HWND hwnd, jboolean force) { HWND pHwnd, current; + BOOL isEnabled = IsWindowEnabled(hwnd); pHwnd = GetParent(hwnd); current = GetFocus(); - DBG_PRINT("*** WindowsWindow: requestFocus.S parent %p, window %p, isCurrent %d\n", - (void*) pHwnd, (void*)hwnd, current==hwnd); + DBG_PRINT("*** WindowsWindow: requestFocus.S force %d, parent %p, window %p, isEnabled %d, isCurrent %d\n", + (int)force, (void*)pHwnd, (void*)hwnd, isEnabled, current==hwnd); - if( JNI_TRUE==force || current!=hwnd) { + if( JNI_TRUE==force || current!=hwnd || !isEnabled ) { UINT flags = SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE; + if(!isEnabled) { + EnableWindow(hwnd, TRUE); + } SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, flags); SetForegroundWindow(hwnd); // Slightly Higher Priority - SetFocus(hwnd);// Sets Keyboard Focus To Window + SetFocus(hwnd);// Sets Keyboard Focus To Window (activates parent window if exist, or this window) if(NULL!=pHwnd) { SetActiveWindow(hwnd); } - DBG_PRINT("*** WindowsWindow: requestFocus.X1\n"); + current = GetFocus(); + DBG_PRINT("*** WindowsWindow: requestFocus.X1 isCurrent %d\n", current==hwnd); } DBG_PRINT("*** WindowsWindow: requestFocus.XX\n"); } @@ -959,11 +964,13 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, } case WM_SETFOCUS: + DBG_PRINT("*** WindowsWindow: WM_SETFOCUS window %p, lost %p\n", wnd, (HWND)wParam); (*env)->CallVoidMethod(env, window, focusChangedID, JNI_FALSE, JNI_TRUE); useDefWindowProc = 1; break; case WM_KILLFOCUS: + DBG_PRINT("*** WindowsWindow: WM_KILLFOCUS window %p, received %p\n", wnd, (HWND)wParam); (*env)->CallVoidMethod(env, window, focusChangedID, JNI_FALSE, JNI_FALSE); useDefWindowProc = 1; break; |