Commit 3f03975f authored by Alexandre Julliard's avatar Alexandre Julliard

Added first/last message filters to MSG_InternalGetMessage to avoid

busy waits.
parent 85d30863
......@@ -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 */
......
......@@ -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 */
......
......@@ -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)))
......
......@@ -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;
}
}
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment