<p>Note about Ctrl+A/Z: AFAIU, it's what the console app were expected in the ages, so our OS still carry this tribute to legacy...</p>
<p>See how we have to workaround on linux:<br>
<a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/abf05549bd377106f27600a293d79f75a59e705e/platforms/unix/vm-display-X11/sqUnixX11.c#L2065">https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/abf05549bd377106f27600a293d79f75a59e705e/platforms/unix/vm-display-X11/sqUnixX11.c#L2065</a></p>
<p>Who is turning the keysym into 1 to: 26 charCode?<br>
<a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/abf05549bd377106f27600a293d79f75a59e705e/platforms/unix/vm-display-X11/sqUnixX11.c#L2049">https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/abf05549bd377106f27600a293d79f75a59e705e/platforms/unix/vm-display-X11/sqUnixX11.c#L2049</a><br>
See <a href="https://linux.die.net/man/3/xlookupstring" rel="nofollow">https://linux.die.net/man/3/xlookupstring</a></p>
<p>I also mentionned this in issue <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="448912894" data-permission-text="Issue title is private" data-url="https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/396" data-hovercard-type="issue" data-hovercard-url="/OpenSmalltalk/opensmalltalk-vm/issues/396/hovercard" href="https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/396">#396</a></p>
<p>So we might want to do something similar on Windows? (and Mac OS?)<br>
For Win32, see <a href="https://docs.microsoft.com/en-us/windows/win32/learnwin32/keyboard-input" rel="nofollow">https://docs.microsoft.com/en-us/windows/win32/learnwin32/keyboard-input</a></p>
<p>MSDN page above explicitely explains that CTRL+A/Z are translated to ASCII control character in the <code>VM_CHAR</code> event (as I suggested in preliminary comment, for legacy console app).<br>
It also does not recommend handling CTRL+... or ALT+... thru <code>WM_CHAR</code> event, this is not the idiomatic handling on this platform.<br>
And the doc is right - see why below.</p>
<p>The equivalent of linux keysym is the virtual key code (<code>VK_*</code>) passed thru wParam in <code>WM_KEYDOWN</code> event.<br>
<a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/d58235ca011b9a8f8344814b66d9f9d6428c963f/platforms/win32/vm/sqWin32Window.c#L1262">https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/d58235ca011b9a8f8344814b66d9f9d6428c963f/platforms/win32/vm/sqWin32Window.c#L1262</a></p>
<p>The problem is that we effectively get the keycode in case of <code>WM_KEYDOWN</code> event, but not in case of <code>VM_CHAR</code> event: <code>msg->wParam</code> holds an UTF-16 Unicode character the doc says...</p>
<p>So, IMO, we should better generate an extra OpenSmalltalk <code>EventKeyChar</code> event in response to <code>WM_KEYDOWN</code> event when we detect a CTRL down status, and filter out the event in case of <code>VM_CHAR</code> with CRTL down...</p>
<p>Note that Pharo VM uses <code>MapVirtualKey</code> with <code>MAPVK_VSC_TO_VK</code> to handle ctrl+char<br>
<a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/d58235ca011b9a8f8344814b66d9f9d6428c963f/platforms/win32/vm/sqWin32Window.c#L1319">https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/d58235ca011b9a8f8344814b66d9f9d6428c963f/platforms/win32/vm/sqWin32Window.c#L1319</a><br>
<a href="https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-mapvirtualkeya" rel="nofollow">https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-mapvirtualkeya</a><br>
Though it's not clear where the usage of <code>msg->lParam</code> comes from (<code>MapVirtualKey</code> expects a scan code, which is low level keyboard code and will return a VK code that fortunately matches ASCII for A to Z keys...), I've not seen it documented in official MSDN, it would be good to have a link documenting it.<br>
It's not the way that MSDN (and I) recommended above, but might eventually work (I'm not in a position to understand if there are other side effects...)</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/42?email_source=notifications&email_token=AIJPEW5YFD4NYNFYWELN4UTQYQIZDA5CNFSM4CNBGDSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG3QVBA#issuecomment-565643908">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AIJPEWZT65RPG6XZOPSAZYTQYQIZDANCNFSM4CNBGDSA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AIJPEWZ6JNXQM4RFKNHEHILQYQIZDA5CNFSM4CNBGDSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG3QVBA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/42?email_source=notifications\u0026email_token=AIJPEW5YFD4NYNFYWELN4UTQYQIZDA5CNFSM4CNBGDSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG3QVBA#issuecomment-565643908",
"url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/42?email_source=notifications\u0026email_token=AIJPEW5YFD4NYNFYWELN4UTQYQIZDA5CNFSM4CNBGDSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG3QVBA#issuecomment-565643908",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>