Added first/last message filters to MSG_InternalGetMessage to avoid

busy waits.
This commit is contained in:
Alexandre Julliard 2001-04-12 21:09:03 +00:00
parent 85d308631c
commit 3f03975f48
5 changed files with 18 additions and 14 deletions

View file

@ -2768,7 +2768,7 @@ static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
/* we have to keep the message in the queue until it's
* clear that menu loop is not over yet. */
if (!MSG_InternalGetMessage( QMSG_WIN32A, &msg, msg.hwnd, mt.hOwnerWnd,
if (!MSG_InternalGetMessage( &msg, msg.hwnd, mt.hOwnerWnd, 0, 0,
MSGF_MENU, PM_NOREMOVE, !enterIdleSent, &enterIdleSent )) break;
/* check if EndMenu() tried to cancel us, by posting this message */

View file

@ -14,8 +14,8 @@
struct tagMSG;
/* message.c */
extern BOOL MSG_InternalGetMessage( int type, struct tagMSG *msg, HWND hwnd,
HWND hwndOwner, WPARAM code,
extern BOOL MSG_InternalGetMessage( struct tagMSG *msg, HWND hwnd, HWND hwndOwner,
UINT first, UINT last, WPARAM code,
WORD flags, BOOL sendIdle, BOOL* idleSent );
/* timer.c */

View file

@ -1048,7 +1048,7 @@ static INT DIALOG_DoDialogBox( HWND hwnd, HWND owner )
if (!(dlgInfo->flags & DF_END)) /* was EndDialog called in WM_INITDIALOG ? */
{
ShowWindow( hwnd, SW_SHOW );
while (MSG_InternalGetMessage(QMSG_WIN32A, &msg, hwnd, ownerMsg, MSGF_DIALOGBOX,
while (MSG_InternalGetMessage(&msg, hwnd, ownerMsg, 0, 0, MSGF_DIALOGBOX,
PM_REMOVE, !(wndPtr->dwStyle & DS_NOIDLEMSG), NULL ))
{
if (!(dlgInfo->flags & DF_END) && (!IsDialogMessageA( hwnd, &msg)))

View file

@ -1316,14 +1316,14 @@ static BOOL MSG_PeekMessage( int type, LPMSG msg_out, HWND hwnd,
* 'hwnd' must be the handle of the dialog or menu window.
* 'code' is the message filter value (MSGF_??? codes).
*/
BOOL MSG_InternalGetMessage( int type, MSG *msg, HWND hwnd, HWND hwndOwner,
BOOL MSG_InternalGetMessage( MSG *msg, HWND hwnd, HWND hwndOwner, UINT first, UINT last,
WPARAM code, WORD flags, BOOL sendIdle, BOOL* idleSent )
{
for (;;)
{
if (sendIdle)
{
if (!MSG_PeekMessage( type, msg, 0, 0, 0, flags, TRUE ))
if (!MSG_PeekMessage( QMSG_WIN32A, msg, 0, first, last, flags, TRUE ))
{
/* No message present -> send ENTERIDLE and wait */
if (IsWindow(hwndOwner))
@ -1334,11 +1334,11 @@ BOOL MSG_InternalGetMessage( int type, MSG *msg, HWND hwnd, HWND hwndOwner,
if (idleSent!=NULL)
*idleSent=TRUE;
}
MSG_PeekMessage( type, msg, 0, 0, 0, flags, FALSE );
MSG_PeekMessage( QMSG_WIN32A, msg, 0, first, last, flags, FALSE );
}
}
else /* Always wait for a message */
MSG_PeekMessage( type, msg, 0, 0, 0, flags, FALSE );
MSG_PeekMessage( QMSG_WIN32A, msg, 0, first, last, flags, FALSE );
/* Call message filters */
@ -1360,7 +1360,7 @@ BOOL MSG_InternalGetMessage( int type, MSG *msg, HWND hwnd, HWND hwndOwner,
/* Message filtered -> remove it from the queue */
/* if it's still there. */
if (!(flags & PM_REMOVE))
MSG_PeekMessage( type, msg, 0, 0, 0, PM_REMOVE, TRUE );
MSG_PeekMessage( QMSG_WIN32A, msg, 0, first, last, PM_REMOVE, TRUE );
continue;
}
}

View file

@ -1961,7 +1961,8 @@ static LONG NC_StartSizeMove( WND* wndPtr, WPARAM16 wParam,
{
while(!hittest)
{
MSG_InternalGetMessage( QMSG_WIN32A, &msg, 0, 0, MSGF_SIZE, PM_REMOVE, FALSE, NULL );
MSG_InternalGetMessage( &msg, 0, 0, WM_KEYFIRST, WM_MOUSELAST,
MSGF_SIZE, PM_REMOVE, FALSE, NULL );
switch(msg.message)
{
case WM_MOUSEMOVE:
@ -2128,7 +2129,7 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam )
{
int dx = 0, dy = 0;
MSG_InternalGetMessage( QMSG_WIN32A, &msg, 0, 0, MSGF_SIZE, PM_REMOVE, FALSE, NULL );
MSG_InternalGetMessage( &msg, 0, 0, 0, 0, MSGF_SIZE, PM_REMOVE, FALSE, NULL );
/* Exit on button-up, Return, or Esc */
if ((msg.message == WM_LBUTTONUP) ||
@ -2359,7 +2360,8 @@ static void NC_TrackMinMaxBox95( HWND hwnd, WORD wParam )
while(1)
{
BOOL oldstate = pressed;
MSG_InternalGetMessage( QMSG_WIN32A, &msg, 0, 0, 0, PM_REMOVE, FALSE, NULL );
MSG_InternalGetMessage( &msg, 0, 0, WM_MOUSEFIRST, WM_MOUSELAST,
0, PM_REMOVE, FALSE, NULL );
if(msg.message == WM_LBUTTONUP)
break;
@ -2414,7 +2416,8 @@ static void NC_TrackMinMaxBox( HWND hwnd, WORD wParam )
while(1)
{
BOOL oldstate = pressed;
MSG_InternalGetMessage( QMSG_WIN32A, &msg, 0, 0, 0, PM_REMOVE, FALSE, NULL );
MSG_InternalGetMessage( &msg, 0, 0, WM_MOUSEFIRST, WM_MOUSELAST,
0, PM_REMOVE, FALSE, NULL );
if(msg.message == WM_LBUTTONUP)
break;
@ -2475,7 +2478,8 @@ NC_TrackCloseButton95 (HWND hwnd, WORD wParam)
while(1)
{
BOOL oldstate = pressed;
MSG_InternalGetMessage( QMSG_WIN32A, &msg, 0, 0, 0, PM_REMOVE, FALSE, NULL );
MSG_InternalGetMessage( &msg, 0, 0, WM_MOUSEFIRST, WM_MOUSELAST,
0, PM_REMOVE, FALSE, NULL );
if(msg.message == WM_LBUTTONUP)
break;