<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 1/26/2012 14:52, Guillermo Polito wrote:
<blockquote
cite="mid:CAOBmb52ZNqyA6GYPbBvBohNH24aC41My5BZnAG8NBK+TLYxRag@mail.gmail.com"
type="cite">
<pre wrap=""> </pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
Hi!
<div><br>
</div>
<div>I was playing to add Function Ket support in the windows vm
(yep, always the same :P), and looking at the code, I saw this
in the recordKeyboardEvent:</div>
<div><br>
</div>
<div>
<div>evt = (sqKeyboardEvent*) sqNextEventPut();</div>
<div> evt->type = EventTypeKeyboard;</div>
<div> evt->timeStamp = msg->time;</div>
<div><b> evt->charCode = keymap[keyCode & 0xff];</b></div>
</div>
<div><b><br>
</b></div>
<div>the problem with that line is that KeyDown and KeyUp events
send VirtualKeycodes as keycodes and the Char event sends a
unicode char value. And, it makes collisions, since for example</div>
<div><br>
</div>
<div>$p char value is 112</div>
<div>and F1 virtual code value is 112 too :P</div>
<div><br>
</div>
<div><a moz-do-not-send="true"
href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms646276%28v=vs.85%29.aspx">http://msdn.microsoft.com/en-us/library/windows/desktop/ms646276(v=vs.85).aspx</a>
</div>
<div><a moz-do-not-send="true"
href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms646281%28v=vs.85%29.aspx">http://msdn.microsoft.com/en-us/library/windows/desktop/ms646281(v=vs.85).aspx</a>
</div>
<div><a moz-do-not-send="true"
href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx">http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx</a>
</div>
<div><br>
</div>
<div>And so with other keys, having the same keycode in the image
side with different keys...</div>
<div><br>
</div>
<div>I'm trying a solution like this, providing in a Char event
the keycode without mapping to the image:</div>
<div><br>
</div>
<div>...</div>
<div>
<div> case WM_CHAR:</div>
<div> case WM_SYSCHAR:</div>
<div> /* Note: VK_RETURN is recorded as virtual key ONLY */</div>
<div> if(keyCode == 13) return 1;</div>
<div> <b> charCode = keyCode;</b></div>
<div> pressCode = EventKeyChar;</div>
</div>
<div> break</div>
<div>...</div>
<div> evt->timeStamp = msg->time;</div>
<div>
<div><b> evt->charCode = charCode? charCode : keymap[keyCode
& 0xff];</b></div>
<div>
evt->pressCode = pressCode;</div>
</div>
<div>...</div>
<div><br>
</div>
<div>changing only the bold lines, and It seems to work.</div>
<div><br>
</div>
<div>What do you think?</div>
</blockquote>
<br>
The change makes no sense (it will break most non-ascii input like
accents, umlauts, etc). You really shouldn't be using character
events for handling function keys. There is no 'F11 Character' in
any character encoding world-wide so trying to represent F11 as a
character is completely futile. You need to use keyDown and keyUp
events, since F11 & friends are KEYs not CHARACTERs.<br>
<br>
Cheers,<br>
- Andreas<br>
<br>
<br>
<blockquote
cite="mid:CAOBmb52ZNqyA6GYPbBvBohNH24aC41My5BZnAG8NBK+TLYxRag@mail.gmail.com"
type="cite">
<div>Guille</div>
</blockquote>
</body>
</html>