diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-21 05:37:24 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-21 05:37:24 -0400 |
| commit | e5c74b832be68fdbefb9c7527c2367dba1cec7a8 (patch) | |
| tree | bff78082b8666a04ce42b815b11a65ddee77821d /redo/uitask_windows.c | |
| parent | f3ca234dda0c34c2bd11acee414111d1c745422d (diff) | |
Changed AreaHandler.Key() to return a boolean value indicating if the event was handled; implemented this on Windows. It does sledgehammer some edge cases I wanted to avoid, but it also avoids fussing about scrolling and focus and what not.
Diffstat (limited to 'redo/uitask_windows.c')
| -rw-r--r-- | redo/uitask_windows.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/redo/uitask_windows.c b/redo/uitask_windows.c index 5dad117..25f7da9 100644 --- a/redo/uitask_windows.c +++ b/redo/uitask_windows.c @@ -8,9 +8,31 @@ // this also assumes WC_TABCONTROL is longer than areaWindowClass #define NCLASSNAME (sizeof WC_TABCONTROL / sizeof WC_TABCONTROL[0]) -void uimsgloop_area(MSG *msg) +void uimsgloop_area(HWND active, HWND focus, MSG *msg) { + MSG copy; + + copy = *msg; + switch (copy.message) { + case WM_KEYDOWN: + case WM_SYSKEYDOWN: // Alt+[anything] and F10 send these instead + copy.message = msgAreaKeyDown; + break; + case WM_KEYUP: + case WM_SYSKEYUP: + copy.message = msgAreaKeyUp; + break; + default: + goto notkey; + } + // if we handled the key, don't do the default behavior // don't call TranslateMessage(); we do our own keyboard handling + if (DispatchMessage(©) != FALSE) + return; + // TODO move this under notkey? + if (IsDialogMessage(active, msg) != 0) + return; +notkey: DispatchMessage(msg); } @@ -70,7 +92,7 @@ void uimsgloop(void) if (GetClassNameW(focus, classchk, NCLASSNAME) == 0) xpanic("error getting name of focused window class for Area check", GetLastError()); if (wcscmp(classchk, areaWindowClass) == 0) { - uimsgloop_area(&msg); + uimsgloop_area(active, focus, &msg); continue; } else if (wcscmp(classchk, WC_TABCONTROL) == 0) { uimsgloop_tab(active, focus, &msg); |
