Commit d6b063e3 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

Handle control characters in VkKeyScanEx similar to what Windows

does.
parent 607bb11a
...@@ -1866,6 +1866,9 @@ SHORT X11DRV_VkKeyScanEx(WCHAR wChar, HKL hkl) ...@@ -1866,6 +1866,9 @@ SHORT X11DRV_VkKeyScanEx(WCHAR wChar, HKL hkl)
CHAR cChar; CHAR cChar;
SHORT ret; SHORT ret;
/* FIXME: what happens if wChar is not a Latin1 character and CP_UNIXCP
* is UTF-8 (multibyte encoding)?
*/
if (!WideCharToMultiByte(CP_UNIXCP, 0, &wChar, 1, &cChar, 1, NULL, NULL)) if (!WideCharToMultiByte(CP_UNIXCP, 0, &wChar, 1, &cChar, 1, NULL, NULL))
{ {
WARN("no translation from unicode to CP_UNIXCP for 0x%02x\n", wChar); WARN("no translation from unicode to CP_UNIXCP for 0x%02x\n", wChar);
...@@ -1881,7 +1884,15 @@ SHORT X11DRV_VkKeyScanEx(WCHAR wChar, HKL hkl) ...@@ -1881,7 +1884,15 @@ SHORT X11DRV_VkKeyScanEx(WCHAR wChar, HKL hkl)
wine_tsx11_lock(); wine_tsx11_lock();
keycode = XKeysymToKeycode(display, keysym); /* keysym -> keycode */ keycode = XKeysymToKeycode(display, keysym); /* keysym -> keycode */
if (!keycode) if (!keycode)
{ /* It didn't work ... let's try with deadchar code. */ {
if (keysym >= 0xFF00) /* Windows returns 0x0240 + cChar in this case */
{
ret = 0x0240 + cChar; /* 0x0200 indicates a control character */
TRACE(" ... returning ctrl char %#.2x\n", ret);
wine_tsx11_unlock();
return ret;
}
/* It didn't work ... let's try with deadchar code. */
TRACE("retrying with | 0xFE00\n"); TRACE("retrying with | 0xFE00\n");
keycode = XKeysymToKeycode(display, keysym | 0xFE00); keycode = XKeysymToKeycode(display, keysym | 0xFE00);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment