At 03:16 PM 8/13/00 +0200, you wrote:
<snip>
>A "guess-work" fix is to insert the following line in
>MSG_TranslateKbdMsg(): 
>
>Index: wine/windows/message.c
>===================================================================
>RCS file: /home/wine/wine/windows/message.c,v
>retrieving revision 1.71
>diff -u -r1.71 message.c
>--- wine/windows/message.c     2000/07/28 20:17:54     1.71
>+++ wine/windows/message.c     2000/08/13 12:56:47
>@@ -382,7 +382,9 @@
>       if( message < WM_SYSKEYDOWN )
>           message += WM_SYSKEYDOWN - WM_KEYDOWN;
>     }
>+    if ( !hWnd ) return SYSQ_MSG_ABANDON;
<snip>

Consider this marvelous piece of junk^H^H^H^Hcode :

DWORD WINAPI MyThread( LPVOID lpv )
{
int i;
MSG   msg;
HWND hBid;
 
hBid = CreateWindow(
                  "WREPAINT2", "AA",
                  WS_CAPTION | WS_VISIBLE,
                  1, 1, 50, 50, NULL,NULL,hInst,NULL
                  );
ShowWindow(hWndMain, SW_HIDE);
SetActiveWindow(0);
SetFocus(0);
OutputDebugString("XXXX");
for (i = 0; i < 20; i++)
        {
        Sleep(200);
        UpdateWindow(hBid);
        if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
        {
                char buf[100];
                wsprintf(buf, "message %x", msg.message);
                OutputDebugString(buf);
        }
        else
                OutputDebugString("no message");
        }
DestroyWindow(hBid);
ShowWindow(hWndMain, SW_SHOW);
ExitThread(0);   
}

Under windows, this program always output 'no message' if I
don't click in the thread window.
Under Wine, it generates messages 104 and 105 (syskeys)  without your
patch, 'no message' with your patch.
If I click in the thread window (activate it), I get 100 and 101 messages
(wm_keydown, wm_keyup) under Wine and Windows, with or
without your patch.

Eric's patch is good too, but IMO you should send your patch
since it makes Wine behaviour marginally better.

About the test code, please note that :
SetFocus(0) seems only necessary under Wine, not under Windows.
SetActiveWindow(0) does not work under current Wine; I have
done a little hack to SetActiveWindow to make Wine behaviour
compatible with the Windows one (call WINPOS_SetActiveWindow(0,0,0)
if hwnd = 0)

Gerard

Reply via email to