[Bug 10907] getch() function does not get arrows, home, end, ins etc.

wine-bugs at winehq.org wine-bugs at winehq.org
Wed Feb 13 07:49:19 CST 2008


http://bugs.winehq.org/show_bug.cgi?id=10907


Evgeniy Dushistov <dushistov at mail.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dushistov at mail.ru




--- Comment #7 from Evgeniy Dushistov <dushistov at mail.ru>  2008-02-13 07:49:19 ---
Patch below demonstrate the problem,
which according to my opinion in testing:
ir.Event.KeyEvent.uChar.AsciiChar != 0
_getch return value only if ir.Event.KeyEvent.uChar.AsciiChar not
zero, which is wrong in case of "F1-F12", arrow keys and so on.

In "Window" looks like the retvalue in case of not character is
wVirtualScanCode.

The only thing, not clear to me, is how to return the first of all "0"
and only after that wVirtualScanCode.

PS
kbhit looks like has the similar problem.

Index: wine-0.9.55/dlls/msvcrt/console.c
===================================================================
--- wine-0.9.55.orig/dlls/msvcrt/console.c
+++ wine-0.9.55/dlls/msvcrt/console.c
@@ -105,12 +105,18 @@ int CDECL _getch(void)
       {
         /* Only interested in ASCII chars */
         if (ir.EventType == KEY_EVENT &&
-            ir.Event.KeyEvent.bKeyDown &&
-            ir.Event.KeyEvent.uChar.AsciiChar)
-        {
-          retval = ir.Event.KeyEvent.uChar.AsciiChar;
-          break;
-        }
+            ir.Event.KeyEvent.bKeyDown) {
+               if (ir.Event.KeyEvent.uChar.AsciiChar) {
+                       retval = ir.Event.KeyEvent.uChar.AsciiChar;
+                       break;
+               } else {
+                       retval = ir.Event.KeyEvent.wVirtualScanCode;
+                       printf("KeyCode: %llu, ScanCode %llu\n",
+                              (unsigned long
long)ir.Event.KeyEvent.wVirtualKeyCode,
+                              (unsigned long
long)ir.Event.KeyEvent.wVirtualScanCode);
+                       break;
+               }
+       }
       }
       else
         break;


-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list