diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-13 10:41:27 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-13 10:41:27 -0400 |
| commit | b01c65394202a5377313afe08cd5fb56f0903831 (patch) | |
| tree | 7616ad8b85e79847c89663ee4f72acfe2d6df47b /redo/uitask_windows.c | |
| parent | 59f2eeca22dd15daf9d7765c1709bf926d158faf (diff) | |
Made Areas on Windows tab stops and implemented AreaHandler.Defocuses() on Windows.
Diffstat (limited to 'redo/uitask_windows.c')
| -rw-r--r-- | redo/uitask_windows.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/redo/uitask_windows.c b/redo/uitask_windows.c index 5d5f503..5a64096 100644 --- a/redo/uitask_windows.c +++ b/redo/uitask_windows.c @@ -3,11 +3,16 @@ #include "winapi_windows.h" #include "_cgo_export.h" +/* note that this includes the terminating '\0' */ +#define NAREACLASS (sizeof areaWindowClass / sizeof areaWindowClass[0]) + void uimsgloop(void) { MSG msg; int res; HWND active; + WCHAR classchk[NAREACLASS]; + BOOL dodlgmessage; for (;;) { SetLastError(0); @@ -17,9 +22,24 @@ void uimsgloop(void) if (res == 0) /* WM_QUIT */ break; active = GetActiveWindow(); - // TODO this interferes with Area - if (active != NULL && IsDialogMessageW(active, &msg) != 0) - continue; + if (active != NULL) { + HWND focus; + + dodlgmessage = TRUE; + focus = GetFocus(); + if (focus != NULL) { + // theoretically we could use the class atom to avoid a wcscmp() + // however, raymond chen advises against this - TODO_get_URL + // while I have no idea what could deregister *my* window class from under *me*, better safe than sorry + // we could also theoretically just send msgAreaDefocuses directly, but what DefWindowProc() does to a WM_APP message is undocumented + if (GetClassNameW(focus, classchk, NAREACLASS) == 0) + xpanic("error getting name of focused window class for Area check", GetLastError()); + if (wcscmp(classchk, areaWindowClass) == 0) + dodlgmessage = (BOOL) SendMessageW(focus, msgAreaDefocuses, 0, 0); + } + if (dodlgmessage && IsDialogMessageW(active, &msg) != 0) + continue; + } TranslateMessage(&msg); DispatchMessageW(&msg); } |
