From 831560cd9784e31999ad5c0e01a132f643014624 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Sun, 28 Mar 1999 13:10:54 +0000 Subject: [PATCH] Call EVENT_Pending() to flush X11 output queue before blocking in MsgWaitForMultipleObjects(). Don't call EVENT_WaitNetEvent in MSG_PeekHardwareMsg. Protect system queue access in hardware_event(). --- windows/message.c | 4 ++++ windows/queue.c | 14 +++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/windows/message.c b/windows/message.c index f4e92e8f9a..acb89ffc6c 100644 --- a/windows/message.c +++ b/windows/message.c @@ -502,10 +502,12 @@ static BOOL MSG_PeekHardwareMsg( MSG *msg, HWND hwnd, DWORD first, DWORD last, qmsg = sysMsgQueue->firstMsg; +#if 0 /* If the queue is empty, attempt to fill it */ if (!sysMsgQueue->msgCount && THREAD_IsWin16( THREAD_Current() ) && EVENT_Pending()) EVENT_WaitNetEvent( FALSE, FALSE ); +#endif for ( kbd_msg = 0; qmsg; qmsg = nextqmsg) { @@ -1820,6 +1822,8 @@ DWORD WINAPI MsgWaitForMultipleObjects( DWORD nCount, HANDLE *pHandles, handles[i] = pHandles[i]; handles[nCount] = msgQueue->hEvent; + EVENT_Pending(); + ret = WaitForMultipleObjects( nCount+1, handles, fWaitAll, dwMilliseconds ); } diff --git a/windows/queue.c b/windows/queue.c index 125b18bbdb..5ead0ce12c 100644 --- a/windows/queue.c +++ b/windows/queue.c @@ -1146,12 +1146,15 @@ void hardware_event( WORD message, WORD wParam, LONG lParam, int xPos, int yPos, DWORD time, DWORD extraInfo ) { MSG *msg; - QMSG *qmsg = sysMsgQueue->lastMsg; + QMSG *qmsg; int mergeMsg = 0; if (!sysMsgQueue) return; - /* Merge with previous event if possible */ + EnterCriticalSection( &sysMsgQueue->cSection ); + + /* Merge with previous event if possible */ + qmsg = sysMsgQueue->lastMsg; if ((message == WM_MOUSEMOVE) && sysMsgQueue->lastMsg) { @@ -1173,7 +1176,10 @@ void hardware_event( WORD message, WORD wParam, LONG lParam, /* Don't merge allocate a new msg in the global heap */ if (!(qmsg = (QMSG *) HeapAlloc( SystemHeap, 0, sizeof(QMSG) ) )) - return; + { + LeaveCriticalSection( &sysMsgQueue->cSection ); + return; + } /* put message at the end of the linked list */ qmsg->nextMsg = 0; @@ -1201,6 +1207,8 @@ void hardware_event( WORD message, WORD wParam, LONG lParam, msg->pt.y = yPos; qmsg->extraInfo = extraInfo; + LeaveCriticalSection( &sysMsgQueue->cSection ); + QUEUE_WakeSomeone( message ); }