Accept WM_SYSCHAR message for processsing in TranslateAcceleratorW

Rein Klazes rklazes at xs4all.nl
Thu Sep 23 11:57:18 CDT 2004


On Thu, 23 Sep 2004 23:38:16 +0900, you wrote:

> "Rein Klazes" <rklazes at xs4all.nl> wrote:
> 
> > After finding an accelerator for WM_CHAR (in this case SYSCHAR) the code
> > in translate_accelerator() jumps straight to the handling of this. 
> > Again I'm not familiar with these parts, do you think key state checks
> > should be added here?
> 
> Since now I have a test case for accelerators I'll try to fix it
> to pass under Wine, right now it fails miserably.

Great. Attached patch is what I think Windows is doing. It fixes the
problem with Agent, and hopefully also fixes your problem about no
window with keyboard focus.

Rein.
-- 
Rein Klazes
rklazes at xs4all.nl
-------------- next part --------------
--- wine/dlls/user/menu.c	2004-09-21 10:53:51.000000000 +0200
+++ mywine/dlls/user/menu.c	2004-09-23 18:35:42.000000000 +0200
@@ -4523,7 +4523,7 @@
 
     if (wParam != key) return FALSE;
 
-    if (message == WM_CHAR || message == WM_SYSCHAR)
+    if (message == WM_CHAR)
     {
         if ( !(fVirt & FALT) && !(fVirt & FVIRTKEY) )
         {
@@ -4682,6 +4682,7 @@
     /* YES, Accel16! */
     LPACCEL16 lpAccelTbl;
     int i;
+    UINT kbdmessage;
 
     if (msg == NULL)
     {
@@ -4704,10 +4705,16 @@
                   "msg->hwnd=%p, msg->message=%04x, wParam=%08x, lParam=%lx\n",
                   hAccel,hWnd,msg->hwnd,msg->message,msg->wParam,msg->lParam);
 
+    kbdmessage = msg->message;
+    if( kbdmessage >= WM_SYSKEYDOWN && 
+            !(msg->lParam & 0x20000000)) /* 0 if sent to the active window */
+                                        /* because there is no keyboard focus */
+        kbdmessage -= (WM_SYSKEYDOWN - WM_KEYDOWN);
+                                           
     i = 0;
     do
     {
-        if (translate_accelerator( hWnd, msg->message, msg->wParam, msg->lParam,
+        if (translate_accelerator( hWnd, kbdmessage, msg->wParam, msg->lParam,
                                    lpAccelTbl[i].fVirt, lpAccelTbl[i].key, lpAccelTbl[i].cmd))
             return 1;
     } while ((lpAccelTbl[i++].fVirt & 0x80) == 0);


More information about the wine-devel mailing list