+ wParam key-sym [
+ t hWnd send-key-down/up execute( sym action? hWnd -- )
+ ] [
+ 256 <byte-array> :> keyboard-state
+ 4 <byte-array> :> chars
+ lParam -16 shift 0xff bitand :> scan-code
+ keyboard-state GetKeyboardState win32-error<>0
+ VK_CONTROL VK_CAPITAL [ 0 swap keyboard-state set-nth ] bi@
+ wParam scan-code keyboard-state chars 2 0 ToUnicode dup win32-error=0/f
+ 1 <= [
+ 1 chars nth 8 shift 0 chars nth bitor
+ ] [
+ 3 chars nth 8 shift 2 chars nth bitor ! dead-key
+ ] if
+ 1string f hWnd send-key-down/up execute( sym action? hWnd -- )
+ ] if*
+ ] unless ; inline
+
+: handle-wm-keydown ( hWnd uMsg wParam lParam -- )
+ \ send-key-down (handle-wm-keydown/up) ;