Keyboard patch 2 (ReWind port)

Lionel Ulmer lionel.ulmer at free.fr
Mon Jun 10 15:17:33 CDT 2002


Well, there was a second patch on the same file... So use this combined one
instead of the one I just sent before.

New Changelog:

  David Hammerton <david at transgaming.com>
  Peter Hunnisett <peter at transgaming.com>
  - fix TranslateMessage return code.
  - Make GetKeyState work properly for apps that test 0x80 instead of 0x8000.

                 Lionel

-- 
		 Lionel Ulmer - http://www.bbrox.org/
-------------- next part --------------
Index: windows/message.c
===================================================================
RCS file: /home/wine/wine/windows/message.c,v
retrieving revision 1.134
diff -u -r1.134 message.c
--- windows/message.c	31 May 2002 23:06:54 -0000	1.134
+++ windows/message.c	10 Jun 2002 20:13:49 -0000
@@ -633,8 +633,10 @@
     INT retval;
 
     if (vkey >= 'a' && vkey <= 'z') vkey += 'A' - 'a';
-    retval = ((WORD)(QueueKeyStateTable[vkey] & 0x80) << 8 ) | (QueueKeyStateTable[vkey] & 0x01);
-    /* TRACE(key, "(0x%x) -> %x\n", vkey, retval); */
+    retval = ((WORD)(QueueKeyStateTable[vkey] & 0x80) << 8 ) |
+              (QueueKeyStateTable[vkey] & 0x80) |
+              (QueueKeyStateTable[vkey] & 0x01);
+    TRACE("key (0x%x) -> %x\n", vkey, retval);
     return retval;
 }
 
@@ -938,18 +940,28 @@
  * ditto replacing WM_* with WM_SYS*
  * This produces WM_CHAR messages only for keys mapped to ASCII characters
  * by the keyboard driver.
+ *
+ * If the message is WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, or WM_SYSKEYUP, the
+ * return value is nonzero, regardless of the translation.
+ *
  */
 BOOL WINAPI TranslateMessage( const MSG *msg )
 {
     static int dead_char;
     UINT message;
     WCHAR wp[2];
+    BOOL rc = FALSE;
 
     if (msg->message >= WM_KEYFIRST && msg->message <= WM_KEYLAST)
+    {
         TRACE_(key)("(%s, %04X, %08lX)\n",
                     SPY_GetMsgName(msg->message, msg->hwnd), msg->wParam, msg->lParam );
 
-    if ((msg->message != WM_KEYDOWN) && (msg->message != WM_SYSKEYDOWN)) return FALSE;
+        /* Return code must be TRUE no matter what! */
+        rc = TRUE;
+    }
+
+    if ((msg->message != WM_KEYDOWN) && (msg->message != WM_SYSKEYDOWN)) return rc;
 
     TRACE_(key)("Translating key %s (%04x), scancode %02x\n",
                  SPY_GetVKeyName(msg->wParam), msg->wParam, LOBYTE(HIWORD(msg->lParam)));
@@ -983,7 +995,7 @@
         }
         TRACE_(key)("1 -> PostMessage(%s)\n", SPY_GetMsgName(message, msg->hwnd));
         PostMessageW( msg->hwnd, message, wp[0], msg->lParam );
-        return TRUE;
+        break;
 
     case -1:
         message = (msg->message == WM_KEYDOWN) ? WM_DEADCHAR : WM_SYSDEADCHAR;
@@ -992,7 +1004,7 @@
         PostMessageW( msg->hwnd, message, wp[0], msg->lParam );
         return TRUE;
     }
-    return FALSE;
+    return rc;
 }
 
 


More information about the wine-patches mailing list