Commit b3a99de5 authored by Stephane Lussier's avatar Stephane Lussier Committed by Alexandre Julliard

-Fixed MESSAGE functions that were thunking down to 16 bits implementation.

So PeekMessage32, GetMessage32, PostMessage32, PostThreadMessage are fixed with this patch. Unicode version of those functions is currently only calling the ASCII version. -Fixed queue signaling using a new EVENT object in the queue for 32 bits thread. MsgWaitForMultipleObject has been fixed and is now blocking on the right EVENT.
parent 7bb6fd1d
...@@ -2344,7 +2344,7 @@ static void MENU_KeyRight( MTRACKER* pmt ) ...@@ -2344,7 +2344,7 @@ static void MENU_KeyRight( MTRACKER* pmt )
static BOOL32 MENU_TrackMenu( HMENU32 hmenu, UINT32 wFlags, INT32 x, INT32 y, static BOOL32 MENU_TrackMenu( HMENU32 hmenu, UINT32 wFlags, INT32 x, INT32 y,
HWND32 hwnd, const RECT32 *lprect ) HWND32 hwnd, const RECT32 *lprect )
{ {
MSG16 msg; MSG32 msg;
POPUPMENU *menu; POPUPMENU *menu;
BOOL32 fRemove; BOOL32 fRemove;
MTRACKER mt = { 0, hmenu, hmenu, hwnd, {x, y} }; /* control struct */ MTRACKER mt = { 0, hmenu, hmenu, hwnd, {x, y} }; /* control struct */
...@@ -2367,15 +2367,16 @@ static BOOL32 MENU_TrackMenu( HMENU32 hmenu, UINT32 wFlags, INT32 x, INT32 y, ...@@ -2367,15 +2367,16 @@ static BOOL32 MENU_TrackMenu( HMENU32 hmenu, UINT32 wFlags, INT32 x, INT32 y,
if (!MSG_InternalGetMessage( &msg, msg.hwnd, mt.hOwnerWnd, if (!MSG_InternalGetMessage( &msg, msg.hwnd, mt.hOwnerWnd,
MSGF_MENU, PM_NOREMOVE, TRUE )) break; MSGF_MENU, PM_NOREMOVE, TRUE )) break;
TranslateMessage16( &msg ); TranslateMessage32( &msg );
CONV_POINT16TO32( &msg.pt, &mt.pt ); mt.pt = msg.pt;
fRemove = FALSE; fRemove = FALSE;
if ((msg.message >= WM_MOUSEFIRST) && (msg.message <= WM_MOUSELAST)) if ((msg.message >= WM_MOUSEFIRST) && (msg.message <= WM_MOUSELAST))
{ {
/* Find a menu for this mouse event */ /* Find a menu for this mouse event */
POINT16 pt16;
hmenu = MENU_PtMenu( mt.hTopMenu, msg.pt ); CONV_POINT32TO16( &msg.pt, &pt16 );
hmenu = MENU_PtMenu( mt.hTopMenu, pt16 );
switch(msg.message) switch(msg.message)
{ {
...@@ -2483,7 +2484,7 @@ static BOOL32 MENU_TrackMenu( HMENU32 hmenu, UINT32 wFlags, INT32 x, INT32 y, ...@@ -2483,7 +2484,7 @@ static BOOL32 MENU_TrackMenu( HMENU32 hmenu, UINT32 wFlags, INT32 x, INT32 y,
if ((msg.wParam <= 32) || (msg.wParam >= 127)) break; if ((msg.wParam <= 32) || (msg.wParam >= 127)) break;
pos = MENU_FindItemByKey( mt.hOwnerWnd, mt.hCurrentMenu, pos = MENU_FindItemByKey( mt.hOwnerWnd, mt.hCurrentMenu,
msg.wParam, FALSE ); LOWORD(msg.wParam), FALSE );
if (pos == (UINT32)-2) fEndMenu = TRUE; if (pos == (UINT32)-2) fEndMenu = TRUE;
else if (pos == (UINT32)-1) MessageBeep32(0); else if (pos == (UINT32)-1) MessageBeep32(0);
else else
...@@ -2497,7 +2498,7 @@ static BOOL32 MENU_TrackMenu( HMENU32 hmenu, UINT32 wFlags, INT32 x, INT32 y, ...@@ -2497,7 +2498,7 @@ static BOOL32 MENU_TrackMenu( HMENU32 hmenu, UINT32 wFlags, INT32 x, INT32 y,
} }
else else
{ {
DispatchMessage16( &msg ); DispatchMessage32A( &msg );
} }
if (!fEndMenu) fRemove = TRUE; if (!fEndMenu) fRemove = TRUE;
...@@ -2505,7 +2506,7 @@ static BOOL32 MENU_TrackMenu( HMENU32 hmenu, UINT32 wFlags, INT32 x, INT32 y, ...@@ -2505,7 +2506,7 @@ static BOOL32 MENU_TrackMenu( HMENU32 hmenu, UINT32 wFlags, INT32 x, INT32 y,
/* finally remove message from the queue */ /* finally remove message from the queue */
if (fRemove && !(mt.trackFlags & TF_SKIPREMOVE) ) if (fRemove && !(mt.trackFlags & TF_SKIPREMOVE) )
PeekMessage16( &msg, 0, msg.message, msg.message, PM_REMOVE ); PeekMessage32A( &msg, 0, msg.message, msg.message, PM_REMOVE );
else mt.trackFlags &= ~TF_SKIPREMOVE; else mt.trackFlags &= ~TF_SKIPREMOVE;
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
extern DWORD MSG_WineStartTicks; /* Ticks at Wine startup */ extern DWORD MSG_WineStartTicks; /* Ticks at Wine startup */
/* message.c */ /* message.c */
extern BOOL32 MSG_InternalGetMessage( MSG16 *msg, HWND32 hwnd, extern BOOL32 MSG_InternalGetMessage( MSG32 *msg, HWND32 hwnd,
HWND32 hwndOwner, WPARAM32 code, HWND32 hwndOwner, WPARAM32 code,
WORD flags, BOOL32 sendIdle ); WORD flags, BOOL32 sendIdle );
...@@ -24,7 +24,7 @@ extern void TIMER_RemoveQueueTimers( HQUEUE16 hqueue ); ...@@ -24,7 +24,7 @@ extern void TIMER_RemoveQueueTimers( HQUEUE16 hqueue );
extern void TIMER_SwitchQueue( HQUEUE16 hOldQueue, HQUEUE16 hNewQueue ); extern void TIMER_SwitchQueue( HQUEUE16 hOldQueue, HQUEUE16 hNewQueue );
extern LONG TIMER_GetNextExpiration(void); extern LONG TIMER_GetNextExpiration(void);
extern void TIMER_ExpireTimers(void); extern void TIMER_ExpireTimers(void);
extern BOOL32 TIMER_GetTimerMsg( MSG16 *msg, HWND32 hwnd, extern BOOL32 TIMER_GetTimerMsg( MSG32 *msg, HWND32 hwnd,
HQUEUE16 hQueue, BOOL32 remove ); HQUEUE16 hQueue, BOOL32 remove );
#define EVENT_IO_READ 0 #define EVENT_IO_READ 0
......
...@@ -129,7 +129,6 @@ extern void QUEUE_WalkQueues(void); ...@@ -129,7 +129,6 @@ extern void QUEUE_WalkQueues(void);
extern BOOL32 QUEUE_IsExitingQueue( HQUEUE16 hQueue ); extern BOOL32 QUEUE_IsExitingQueue( HQUEUE16 hQueue );
extern void QUEUE_SetExitingQueue( HQUEUE16 hQueue ); extern void QUEUE_SetExitingQueue( HQUEUE16 hQueue );
extern MESSAGEQUEUE *QUEUE_GetSysQueue(void); extern MESSAGEQUEUE *QUEUE_GetSysQueue(void);
extern void QUEUE_Signal( THDB *thdb );
extern void QUEUE_SetWakeBit( MESSAGEQUEUE *queue, WORD bit ); extern void QUEUE_SetWakeBit( MESSAGEQUEUE *queue, WORD bit );
extern void QUEUE_ClearWakeBit( MESSAGEQUEUE *queue, WORD bit ); extern void QUEUE_ClearWakeBit( MESSAGEQUEUE *queue, WORD bit );
extern void QUEUE_ReceiveMessage( MESSAGEQUEUE *queue ); extern void QUEUE_ReceiveMessage( MESSAGEQUEUE *queue );
...@@ -138,7 +137,7 @@ extern void QUEUE_IncPaintCount( HQUEUE16 hQueue ); ...@@ -138,7 +137,7 @@ extern void QUEUE_IncPaintCount( HQUEUE16 hQueue );
extern void QUEUE_DecPaintCount( HQUEUE16 hQueue ); extern void QUEUE_DecPaintCount( HQUEUE16 hQueue );
extern void QUEUE_IncTimerCount( HQUEUE16 hQueue ); extern void QUEUE_IncTimerCount( HQUEUE16 hQueue );
extern void QUEUE_DecTimerCount( HQUEUE16 hQueue ); extern void QUEUE_DecTimerCount( HQUEUE16 hQueue );
extern BOOL32 QUEUE_CreateSysMsgQueue( ); extern BOOL32 QUEUE_CreateSysMsgQueue( int size );
extern BOOL32 QUEUE_DeleteMsgQueue( HQUEUE16 hQueue ); extern BOOL32 QUEUE_DeleteMsgQueue( HQUEUE16 hQueue );
extern HTASK16 QUEUE_GetQueueTask( HQUEUE16 hQueue ); extern HTASK16 QUEUE_GetQueueTask( HQUEUE16 hQueue );
extern BOOL32 QUEUE_AddMsg( HQUEUE16 hQueue, MSG32 * msg, DWORD extraInfo ); extern BOOL32 QUEUE_AddMsg( HQUEUE16 hQueue, MSG32 * msg, DWORD extraInfo );
......
...@@ -847,7 +847,7 @@ INT32 DIALOG_DoDialogBox( HWND32 hwnd, HWND32 owner ) ...@@ -847,7 +847,7 @@ INT32 DIALOG_DoDialogBox( HWND32 hwnd, HWND32 owner )
{ {
WND * wndPtr; WND * wndPtr;
DIALOGINFO * dlgInfo; DIALOGINFO * dlgInfo;
MSG16 msg; MSG32 msg;
INT32 retval; INT32 retval;
/* Owner must be a top-level window */ /* Owner must be a top-level window */
...@@ -860,10 +860,10 @@ INT32 DIALOG_DoDialogBox( HWND32 hwnd, HWND32 owner ) ...@@ -860,10 +860,10 @@ INT32 DIALOG_DoDialogBox( HWND32 hwnd, HWND32 owner )
while (MSG_InternalGetMessage(&msg, hwnd, owner, MSGF_DIALOGBOX, PM_REMOVE, while (MSG_InternalGetMessage(&msg, hwnd, owner, MSGF_DIALOGBOX, PM_REMOVE,
!(wndPtr->dwStyle & DS_NOIDLEMSG) )) !(wndPtr->dwStyle & DS_NOIDLEMSG) ))
{ {
if (!IsDialogMessage16( hwnd, &msg)) if (!IsDialogMessage32A( hwnd, &msg))
{ {
TranslateMessage16( &msg ); TranslateMessage32( &msg );
DispatchMessage16( &msg ); DispatchMessage32A( &msg );
} }
if (dlgInfo->flags & DF_END) break; if (dlgInfo->flags & DF_END) break;
} }
......
...@@ -1881,7 +1881,7 @@ static LONG NC_StartSizeMove( WND* wndPtr, WPARAM16 wParam, ...@@ -1881,7 +1881,7 @@ static LONG NC_StartSizeMove( WND* wndPtr, WPARAM16 wParam,
{ {
LONG hittest = 0; LONG hittest = 0;
POINT16 pt; POINT16 pt;
MSG16 msg; MSG32 msg;
if ((wParam & 0xfff0) == SC_MOVE) if ((wParam & 0xfff0) == SC_MOVE)
{ {
...@@ -1910,8 +1910,8 @@ static LONG NC_StartSizeMove( WND* wndPtr, WPARAM16 wParam, ...@@ -1910,8 +1910,8 @@ static LONG NC_StartSizeMove( WND* wndPtr, WPARAM16 wParam,
switch(msg.message) switch(msg.message)
{ {
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
hittest = NC_HandleNCHitTest( wndPtr->hwndSelf, msg.pt ); CONV_POINT32TO16(&msg.pt, &pt);
pt = msg.pt; hittest = NC_HandleNCHitTest( wndPtr->hwndSelf, pt );
if ((hittest < HTLEFT) || (hittest > HTBOTTOMRIGHT)) if ((hittest < HTLEFT) || (hittest > HTBOTTOMRIGHT))
hittest = 0; hittest = 0;
break; break;
...@@ -1959,11 +1959,11 @@ static LONG NC_StartSizeMove( WND* wndPtr, WPARAM16 wParam, ...@@ -1959,11 +1959,11 @@ static LONG NC_StartSizeMove( WND* wndPtr, WPARAM16 wParam,
/*********************************************************************** /***********************************************************************
* NC_DoSizeMove * NC_DoSizeMove
* *
* Perform SC_MOVE and SC_SIZE commands. * Perform SC_MOVE and SC_SIZE commands. `
*/ */
static void NC_DoSizeMove( HWND32 hwnd, WORD wParam ) static void NC_DoSizeMove( HWND32 hwnd, WORD wParam )
{ {
MSG16 msg; MSG32 msg;
RECT32 sizingRect, mouseRect; RECT32 sizingRect, mouseRect;
HDC32 hdc; HDC32 hdc;
LONG hittest = (LONG)(wParam & 0x0f); LONG hittest = (LONG)(wParam & 0x0f);
...@@ -2201,7 +2201,8 @@ static void NC_DoSizeMove( HWND32 hwnd, WORD wParam ) ...@@ -2201,7 +2201,8 @@ static void NC_DoSizeMove( HWND32 hwnd, WORD wParam )
*/ */
static void NC_TrackMinMaxBox( HWND32 hwnd, WORD wParam ) static void NC_TrackMinMaxBox( HWND32 hwnd, WORD wParam )
{ {
MSG16 msg; MSG32 msg;
POINT16 pt16;
HDC32 hdc = GetWindowDC32( hwnd ); HDC32 hdc = GetWindowDC32( hwnd );
BOOL32 pressed = TRUE; BOOL32 pressed = TRUE;
void (*paintButton)(HWND32, HDC16, BOOL32); void (*paintButton)(HWND32, HDC16, BOOL32);
...@@ -2220,8 +2221,9 @@ static void NC_TrackMinMaxBox( HWND32 hwnd, WORD wParam ) ...@@ -2220,8 +2221,9 @@ static void NC_TrackMinMaxBox( HWND32 hwnd, WORD wParam )
{ {
BOOL32 oldstate = pressed; BOOL32 oldstate = pressed;
MSG_InternalGetMessage( &msg, 0, 0, 0, PM_REMOVE, FALSE ); MSG_InternalGetMessage( &msg, 0, 0, 0, PM_REMOVE, FALSE );
CONV_POINT32TO16( &msg.pt, &pt16 );
pressed = (NC_HandleNCHitTest( hwnd, msg.pt ) == wParam); pressed = (NC_HandleNCHitTest( hwnd, pt16 ) == wParam);
if (pressed != oldstate) if (pressed != oldstate)
(*paintButton)( hwnd, hdc, pressed ); (*paintButton)( hwnd, hdc, pressed );
} while (msg.message != WM_LBUTTONUP); } while (msg.message != WM_LBUTTONUP);
...@@ -2233,10 +2235,10 @@ static void NC_TrackMinMaxBox( HWND32 hwnd, WORD wParam ) ...@@ -2233,10 +2235,10 @@ static void NC_TrackMinMaxBox( HWND32 hwnd, WORD wParam )
if (!pressed) return; if (!pressed) return;
if (wParam == HTMINBUTTON) if (wParam == HTMINBUTTON)
SendMessage16( hwnd, WM_SYSCOMMAND, SC_MINIMIZE, *(LONG*)&msg.pt ); SendMessage16( hwnd, WM_SYSCOMMAND, SC_MINIMIZE, *(LONG*)&pt16 );
else else
SendMessage16( hwnd, WM_SYSCOMMAND, SendMessage16( hwnd, WM_SYSCOMMAND,
IsZoomed32(hwnd) ? SC_RESTORE:SC_MAXIMIZE, *(LONG*)&msg.pt ); IsZoomed32(hwnd) ? SC_RESTORE:SC_MAXIMIZE, *(LONG*)&pt16 );
} }
...@@ -2248,7 +2250,8 @@ static void NC_TrackMinMaxBox( HWND32 hwnd, WORD wParam ) ...@@ -2248,7 +2250,8 @@ static void NC_TrackMinMaxBox( HWND32 hwnd, WORD wParam )
static void static void
NC_TrackCloseButton95 (HWND32 hwnd, WORD wParam) NC_TrackCloseButton95 (HWND32 hwnd, WORD wParam)
{ {
MSG16 msg; MSG32 msg;
POINT16 pt16;
HDC32 hdc = GetWindowDC32( hwnd ); HDC32 hdc = GetWindowDC32( hwnd );
BOOL32 pressed = TRUE; BOOL32 pressed = TRUE;
...@@ -2260,8 +2263,9 @@ NC_TrackCloseButton95 (HWND32 hwnd, WORD wParam) ...@@ -2260,8 +2263,9 @@ NC_TrackCloseButton95 (HWND32 hwnd, WORD wParam)
{ {
BOOL32 oldstate = pressed; BOOL32 oldstate = pressed;
MSG_InternalGetMessage( &msg, 0, 0, 0, PM_REMOVE, FALSE ); MSG_InternalGetMessage( &msg, 0, 0, 0, PM_REMOVE, FALSE );
CONV_POINT32TO16( &msg.pt, &pt16 );
pressed = (NC_HandleNCHitTest( hwnd, msg.pt ) == wParam); pressed = (NC_HandleNCHitTest( hwnd, pt16 ) == wParam);
if (pressed != oldstate) if (pressed != oldstate)
NC_DrawCloseButton95 (hwnd, hdc, pressed); NC_DrawCloseButton95 (hwnd, hdc, pressed);
} while (msg.message != WM_LBUTTONUP); } while (msg.message != WM_LBUTTONUP);
...@@ -2272,7 +2276,7 @@ NC_TrackCloseButton95 (HWND32 hwnd, WORD wParam) ...@@ -2272,7 +2276,7 @@ NC_TrackCloseButton95 (HWND32 hwnd, WORD wParam)
ReleaseDC32( hwnd, hdc ); ReleaseDC32( hwnd, hdc );
if (!pressed) return; if (!pressed) return;
SendMessage16( hwnd, WM_SYSCOMMAND, SC_CLOSE, *(LONG*)&msg.pt ); SendMessage16( hwnd, WM_SYSCOMMAND, SC_CLOSE, *(LONG*)&pt16 );
} }
......
...@@ -332,6 +332,8 @@ void QUEUE_Unlock( MESSAGEQUEUE *queue ) ...@@ -332,6 +332,8 @@ void QUEUE_Unlock( MESSAGEQUEUE *queue )
if ( --queue->lockCount == 0 ) if ( --queue->lockCount == 0 )
{ {
DeleteCriticalSection ( &queue->cSection ); DeleteCriticalSection ( &queue->cSection );
if (queue->hEvent)
CloseHandle( queue->hEvent );
GlobalFree16( queue->self ); GlobalFree16( queue->self );
} }
...@@ -449,6 +451,23 @@ static HQUEUE16 QUEUE_CreateMsgQueue( BOOL16 bCreatePerQData ) ...@@ -449,6 +451,23 @@ static HQUEUE16 QUEUE_CreateMsgQueue( BOOL16 bCreatePerQData )
msgQueue->wWinVersion = pTask ? pTask->version : 0; msgQueue->wWinVersion = pTask ? pTask->version : 0;
InitializeCriticalSection( &msgQueue->cSection ); InitializeCriticalSection( &msgQueue->cSection );
/* Create an Event object for waiting on message, used by win32 thread
only */
if ( !THREAD_IsWin16( THREAD_Current() ) )
{
msgQueue->hEvent = CreateEvent32A( NULL, FALSE, FALSE, NULL);
if (msgQueue->hEvent == 0)
{
WARN(msg, "CreateEvent32A is not able to create an event object");
return 0;
}
msgQueue->hEvent = ConvertToGlobalHandle( msgQueue->hEvent );
}
else
msgQueue->hEvent = 0;
msgQueue->lockCount = 1; msgQueue->lockCount = 1;
msgQueue->magic = QUEUE_MAGIC; msgQueue->magic = QUEUE_MAGIC;
...@@ -561,16 +580,6 @@ MESSAGEQUEUE *QUEUE_GetSysQueue(void) ...@@ -561,16 +580,6 @@ MESSAGEQUEUE *QUEUE_GetSysQueue(void)
return sysMsgQueue; return sysMsgQueue;
} }
/***********************************************************************
* QUEUE_Signal
*/
void QUEUE_Signal( THDB *thdb )
{
/* Wake up thread waiting for message */
SetEvent( thdb->event );
PostEvent( thdb->process->task );
}
/*********************************************************************** /***********************************************************************
* QUEUE_Wait * QUEUE_Wait
...@@ -604,7 +613,14 @@ void QUEUE_SetWakeBit( MESSAGEQUEUE *queue, WORD bit ) ...@@ -604,7 +613,14 @@ void QUEUE_SetWakeBit( MESSAGEQUEUE *queue, WORD bit )
if (queue->wakeMask & bit) if (queue->wakeMask & bit)
{ {
queue->wakeMask = 0; queue->wakeMask = 0;
QUEUE_Signal( queue->thdb );
/* Wake up thread waiting for message */
if ( THREAD_IsWin16( queue->thdb ) )
PostEvent( queue->thdb->process->task );
else
{
SetEvent( queue->hEvent );
}
} }
} }
......
...@@ -187,7 +187,7 @@ void TIMER_ExpireTimers(void) ...@@ -187,7 +187,7 @@ void TIMER_ExpireTimers(void)
* *
* Build a message for an expired timer. * Build a message for an expired timer.
*/ */
BOOL32 TIMER_GetTimerMsg( MSG16 *msg, HWND32 hwnd, BOOL32 TIMER_GetTimerMsg( MSG32 *msg, HWND32 hwnd,
HQUEUE16 hQueue, BOOL32 remove ) HQUEUE16 hQueue, BOOL32 remove )
{ {
TIMER *pTimer = pNextTimer; TIMER *pTimer = pNextTimer;
...@@ -205,9 +205,9 @@ BOOL32 TIMER_GetTimerMsg( MSG16 *msg, HWND32 hwnd, ...@@ -205,9 +205,9 @@ BOOL32 TIMER_GetTimerMsg( MSG16 *msg, HWND32 hwnd,
pTimer->hwnd, pTimer->msg, pTimer->id, (DWORD)pTimer->proc); pTimer->hwnd, pTimer->msg, pTimer->id, (DWORD)pTimer->proc);
/* Build the message */ /* Build the message */
msg->hwnd = (HWND16)pTimer->hwnd; msg->hwnd = pTimer->hwnd;
msg->message = pTimer->msg; msg->message = pTimer->msg;
msg->wParam = (UINT16)pTimer->id; msg->wParam = pTimer->id;
msg->lParam = (LONG)pTimer->proc; msg->lParam = (LONG)pTimer->proc;
msg->time = curTime; msg->time = curTime;
return TRUE; return TRUE;
......
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