Hello,
there is an interesting problem with the pacman trial version, which
is part of win95 (pacdemo.exe) When the game runs, about every second
keyboard message is not delivered to the game, but to the multimedia
thread.
I don't understand most parts of the message and queue stuff, but to
me, the scenario looks as follows:
After a key has been pressed, a message is generated inside the
hardware_event() function in windows/queue.c. The function then calls
QUEUE_WakeSomeone(). QUEUE_WakeSomeone() determines (correctly?) the right
thread and calls QUEUE_SetWakeBit to let the thread
continue. QUEUE_SetWakeBit, however, will only wake the thread, if the
wakeMask of its message queue is not zero. The wakeMask, on the other
side, is set to zero in this function. So if the thread has been woken
up before, perhaps because of an other key press, it will not become
resumed again. Maybe this is not necessary, because it is allready
running?
The multimedia thread, on the other side is in a PeekMessage() loop
(in dlls/winmm/wineoss/audio.c, function wodPlayer()). This
PeekMessage() call goes down to MSG_PeekHardwareMsg() in
windows/message.c, from where MSG_TranslateKbdMsg is called. In
this function, a destination window for the keyboard message is not
found (both GetFocus() and GetActiveWindow() return zero), if the
function is called from the multimedia thread. The result is, that
MSG_TranslateKbdMsg() returns SYSQ_MSG_ACCEPT, in that case and the
multimedia thread will receive the keyboard message. That thread of
course does not understand keyboard messages, so we'll get a lot of
"unknown message" fixmes.
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;
pWnd = WIN_FindWndPtr( hWnd );
+
if (pWnd && (pWnd->hmemTaskQ != GetFastQueue16()))
{
/* Not for the current task */
This cures the problem, but it would be nice, if anybody with more
message and queue knowledge could comment on this.
Greetings,
Peter
--
Peter Ganten
[EMAIL PROTECTED]