Implemented stub for InitThreadInput.

Use GetThreadQueue/GetFastQueue instead of GetTaskQueue.
This commit is contained in:
Ulrich Weigand 1998-12-24 15:15:00 +00:00 committed by Alexandre Julliard
parent ff35e1fb13
commit 89b93bf26b
5 changed files with 68 additions and 23 deletions

View File

@ -375,7 +375,7 @@ file user.exe
407 pascal16 CreateIcon(word word word word word ptr ptr) CreateIcon16 407 pascal16 CreateIcon(word word word word word ptr ptr) CreateIcon16
408 pascal16 CreateCursorIconIndirect(word ptr ptr ptr) 408 pascal16 CreateCursorIconIndirect(word ptr ptr ptr)
CreateCursorIconIndirect CreateCursorIconIndirect
409 stub InitThreadInput 409 pascal16 InitThreadInput(word word) InitThreadInput
410 pascal16 InsertMenu(word word word word segptr) InsertMenu16 410 pascal16 InsertMenu(word word word word segptr) InsertMenu16
411 pascal16 AppendMenu(word word word segptr) AppendMenu16 411 pascal16 AppendMenu(word word word segptr) AppendMenu16
412 pascal16 RemoveMenu(word word word) RemoveMenu16 412 pascal16 RemoveMenu(word word word) RemoveMenu16

View File

@ -100,4 +100,6 @@ extern void QUEUE_FlushMessages(HQUEUE16);
extern void hardware_event( WORD message, WORD wParam, LONG lParam, extern void hardware_event( WORD message, WORD wParam, LONG lParam,
int xPos, int yPos, DWORD time, DWORD extraInfo ); int xPos, int yPos, DWORD time, DWORD extraInfo );
extern HQUEUE16 WINAPI InitThreadInput( WORD unknown, WORD flags );
#endif /* __WINE_QUEUE_H */ #endif /* __WINE_QUEUE_H */

View File

@ -155,4 +155,10 @@ extern HTASK16 TASK_GetNextTask( HTASK16 hTask );
extern BOOL32 TASK_Reschedule(void); extern BOOL32 TASK_Reschedule(void);
extern void TASK_InstallTHHook( THHOOK *pNewThook ); extern void TASK_InstallTHHook( THHOOK *pNewThook );
extern HQUEUE16 WINAPI SetThreadQueue( DWORD thread, HQUEUE16 hQueue );
extern HQUEUE16 WINAPI GetThreadQueue( DWORD thread );
extern VOID WINAPI SetFastQueue( DWORD thread, HANDLE32 hQueue );
extern HANDLE32 WINAPI GetFastQueue( void );
#endif /* __WINE_TASK_H */ #endif /* __WINE_TASK_H */

View File

@ -102,7 +102,7 @@ static DWORD MSG_TranslateMouseMsg( HWND16 hTopWnd, DWORD filter,
INT16 ht, hittest, sendSC = 0; INT16 ht, hittest, sendSC = 0;
UINT16 message = msg->message; UINT16 message = msg->message;
POINT16 screen_pt, pt; POINT16 screen_pt, pt;
HANDLE16 hQ = GetTaskQueue(0); HANDLE16 hQ = GetFastQueue();
MESSAGEQUEUE *queue = (MESSAGEQUEUE *)GlobalLock16(hQ); MESSAGEQUEUE *queue = (MESSAGEQUEUE *)GlobalLock16(hQ);
BOOL32 eatMsg = FALSE; BOOL32 eatMsg = FALSE;
BOOL32 mouseClick = ((message == WM_LBUTTONDOWN) || BOOL32 mouseClick = ((message == WM_LBUTTONDOWN) ||
@ -278,10 +278,10 @@ static DWORD MSG_TranslateKbdMsg( HWND16 hTopWnd, DWORD filter,
message += WM_SYSKEYDOWN - WM_KEYDOWN; message += WM_SYSKEYDOWN - WM_KEYDOWN;
} }
pWnd = WIN_FindWndPtr( hWnd ); pWnd = WIN_FindWndPtr( hWnd );
if (pWnd && (pWnd->hmemTaskQ != GetTaskQueue(0))) if (pWnd && (pWnd->hmemTaskQ != GetFastQueue()))
{ {
/* Not for the current task */ /* Not for the current task */
MESSAGEQUEUE *queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) ); MESSAGEQUEUE *queue = (MESSAGEQUEUE *)GlobalLock16( GetFastQueue() );
if (queue) QUEUE_ClearWakeBit( queue, QS_KEY ); if (queue) QUEUE_ClearWakeBit( queue, QS_KEY );
/* Wake up the other task */ /* Wake up the other task */
queue = (MESSAGEQUEUE *)GlobalLock16( pWnd->hmemTaskQ ); queue = (MESSAGEQUEUE *)GlobalLock16( pWnd->hmemTaskQ );
@ -596,7 +596,7 @@ static LRESULT MSG_SendMessage( HQUEUE16 hDestQueue, HWND16 hwnd, UINT16 msg,
QSMCTRL qCtrl = { 0, 1}; QSMCTRL qCtrl = { 0, 1};
MESSAGEQUEUE *queue, *destQ; MESSAGEQUEUE *queue, *destQ;
if (!(queue = (MESSAGEQUEUE*)GlobalLock16( GetTaskQueue(0) ))) return 0; if (!(queue = (MESSAGEQUEUE*)GlobalLock16( GetFastQueue() ))) return 0;
if (!(destQ = (MESSAGEQUEUE*)GlobalLock16( hDestQueue ))) return 0; if (!(destQ = (MESSAGEQUEUE*)GlobalLock16( hDestQueue ))) return 0;
if (IsTaskLocked() || !IsWindow32(hwnd)) return 0; if (IsTaskLocked() || !IsWindow32(hwnd)) return 0;
@ -619,7 +619,7 @@ static LRESULT MSG_SendMessage( HQUEUE16 hDestQueue, HWND16 hwnd, UINT16 msg,
queue->wParamHigh = HIWORD(wParam); queue->wParamHigh = HIWORD(wParam);
queue->lParam = lParam; queue->lParam = lParam;
queue->hPrevSendingTask = destQ->hSendingTask; queue->hPrevSendingTask = destQ->hSendingTask;
destQ->hSendingTask = GetTaskQueue(0); destQ->hSendingTask = GetFastQueue();
QUEUE_ClearWakeBit( queue, QS_SMPARAMSFREE ); QUEUE_ClearWakeBit( queue, QS_SMPARAMSFREE );
queue->flags = (queue->flags & ~(QUEUE_SM_WIN32|QUEUE_SM_UNICODE)) | flags; queue->flags = (queue->flags & ~(QUEUE_SM_WIN32|QUEUE_SM_UNICODE)) | flags;
@ -670,7 +670,7 @@ void WINAPI ReplyMessage16( LRESULT result )
MESSAGEQUEUE *senderQ; MESSAGEQUEUE *senderQ;
MESSAGEQUEUE *queue; MESSAGEQUEUE *queue;
if (!(queue = (MESSAGEQUEUE*)GlobalLock16( GetTaskQueue(0) ))) return; if (!(queue = (MESSAGEQUEUE*)GlobalLock16( GetFastQueue() ))) return;
TRACE(msg,"ReplyMessage, queue %04x\n", queue->self); TRACE(msg,"ReplyMessage, queue %04x\n", queue->self);
@ -736,7 +736,7 @@ static BOOL32 MSG_PeekMessage( LPMSG16 msg, HWND16 hwnd, WORD first, WORD last,
while(1) while(1)
{ {
hQueue = GetTaskQueue(0); hQueue = GetFastQueue();
msgQueue = (MESSAGEQUEUE *)GlobalLock16( hQueue ); msgQueue = (MESSAGEQUEUE *)GlobalLock16( hQueue );
if (!msgQueue) return FALSE; if (!msgQueue) return FALSE;
msgQueue->changeBits = 0; msgQueue->changeBits = 0;
@ -1222,7 +1222,7 @@ LRESULT WINAPI SendMessage16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam,
SPY_EnterMessage( SPY_SENDMESSAGE16, hwnd, msg, wParam, lParam ); SPY_EnterMessage( SPY_SENDMESSAGE16, hwnd, msg, wParam, lParam );
if (wndPtr->hmemTaskQ != GetTaskQueue(0)) if (wndPtr->hmemTaskQ != GetFastQueue())
ret = MSG_SendMessage( wndPtr->hmemTaskQ, hwnd, msg, ret = MSG_SendMessage( wndPtr->hmemTaskQ, hwnd, msg,
wParam, lParam, 0 ); wParam, lParam, 0 );
else else
@ -1329,7 +1329,7 @@ LRESULT WINAPI SendMessage32A( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
SPY_EnterMessage( SPY_SENDMESSAGE32, hwnd, msg, wParam, lParam ); SPY_EnterMessage( SPY_SENDMESSAGE32, hwnd, msg, wParam, lParam );
if (wndPtr->hmemTaskQ != GetTaskQueue(0)) if (wndPtr->hmemTaskQ != GetFastQueue())
ret = MSG_SendMessage( wndPtr->hmemTaskQ, hwnd, msg, wParam, lParam, ret = MSG_SendMessage( wndPtr->hmemTaskQ, hwnd, msg, wParam, lParam,
QUEUE_SM_WIN32 ); QUEUE_SM_WIN32 );
else else
@ -1400,7 +1400,7 @@ LRESULT WINAPI SendMessage32W(
SPY_EnterMessage( SPY_SENDMESSAGE32, hwnd, msg, wParam, lParam ); SPY_EnterMessage( SPY_SENDMESSAGE32, hwnd, msg, wParam, lParam );
if (wndPtr->hmemTaskQ != GetTaskQueue(0)) if (wndPtr->hmemTaskQ != GetFastQueue())
ret = MSG_SendMessage( wndPtr->hmemTaskQ, hwnd, msg, wParam, lParam, ret = MSG_SendMessage( wndPtr->hmemTaskQ, hwnd, msg, wParam, lParam,
QUEUE_SM_WIN32 | QUEUE_SM_UNICODE ); QUEUE_SM_WIN32 | QUEUE_SM_UNICODE );
else else
@ -1938,7 +1938,7 @@ BOOL32 WINAPI InSendMessage32(void)
{ {
MESSAGEQUEUE *queue; MESSAGEQUEUE *queue;
if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) ))) if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetFastQueue() )))
return 0; return 0;
return (BOOL32)queue->InSendMessageHandle; return (BOOL32)queue->InSendMessageHandle;
} }

View File

@ -312,11 +312,11 @@ void QUEUE_WaitBits( WORD bits )
{ {
MESSAGEQUEUE *queue; MESSAGEQUEUE *queue;
TRACE(msg,"q %04x waiting for %04x\n", GetTaskQueue(0), bits); TRACE(msg,"q %04x waiting for %04x\n", GetFastQueue(), bits);
for (;;) for (;;)
{ {
if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) ))) return; if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetFastQueue() ))) return;
if (queue->changeBits & bits) if (queue->changeBits & bits)
{ {
@ -752,7 +752,7 @@ void WINAPI PostQuitMessage32( INT32 exitCode )
{ {
MESSAGEQUEUE *queue; MESSAGEQUEUE *queue;
if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) ))) return; if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetFastQueue() ))) return;
queue->wPostQMsg = TRUE; queue->wPostQMsg = TRUE;
queue->wExitCode = (WORD)exitCode; queue->wExitCode = (WORD)exitCode;
} }
@ -819,7 +819,7 @@ BOOL32 WINAPI SetMessageQueue32( INT32 size )
SIGNAL_MaskAsyncEvents( TRUE ); SIGNAL_MaskAsyncEvents( TRUE );
/* Copy data and free the old message queue */ /* Copy data and free the old message queue */
if ((hQueue = GetTaskQueue(0)) != 0) if ((hQueue = GetThreadQueue(0)) != 0)
{ {
MESSAGEQUEUE *oldQ = (MESSAGEQUEUE *)GlobalLock16( hQueue ); MESSAGEQUEUE *oldQ = (MESSAGEQUEUE *)GlobalLock16( hQueue );
memcpy( &queuePtr->wParamHigh, &oldQ->wParamHigh, memcpy( &queuePtr->wParamHigh, &oldQ->wParamHigh,
@ -838,12 +838,25 @@ BOOL32 WINAPI SetMessageQueue32( INT32 size )
hFirstQueue = hNewQueue; hFirstQueue = hNewQueue;
if( !queuePtr->next ) pCursorQueue = queuePtr; if( !queuePtr->next ) pCursorQueue = queuePtr;
SetTaskQueue( 0, hNewQueue ); SetThreadQueue( 0, hNewQueue );
SIGNAL_MaskAsyncEvents( FALSE ); SIGNAL_MaskAsyncEvents( FALSE );
return TRUE; return TRUE;
} }
/***********************************************************************
* InitThreadInput (USER.409)
*/
HQUEUE16 WINAPI InitThreadInput( WORD unknown, WORD flags )
{
HQUEUE16 hQueue = GetTaskQueue( 0 );
FIXME( msg, "(%04X,%04X): should create thread-local message queue!\n",
unknown, flags );
SetFastQueue( 0, hQueue );
return hQueue;
}
/*********************************************************************** /***********************************************************************
* GetQueueStatus16 (USER.334) * GetQueueStatus16 (USER.334)
@ -853,7 +866,7 @@ DWORD WINAPI GetQueueStatus16( UINT16 flags )
MESSAGEQUEUE *queue; MESSAGEQUEUE *queue;
DWORD ret; DWORD ret;
if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) ))) return 0; if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetFastQueue() ))) return 0;
ret = MAKELONG( queue->changeBits, queue->wakeBits ); ret = MAKELONG( queue->changeBits, queue->wakeBits );
queue->changeBits = 0; queue->changeBits = 0;
return ret & MAKELONG( flags, flags ); return ret & MAKELONG( flags, flags );
@ -867,7 +880,7 @@ DWORD WINAPI GetQueueStatus32( UINT32 flags )
MESSAGEQUEUE *queue; MESSAGEQUEUE *queue;
DWORD ret; DWORD ret;
if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) ))) return 0; if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetFastQueue() ))) return 0;
ret = MAKELONG( queue->changeBits, queue->wakeBits ); ret = MAKELONG( queue->changeBits, queue->wakeBits );
queue->changeBits = 0; queue->changeBits = 0;
return ret & MAKELONG( flags, flags ); return ret & MAKELONG( flags, flags );
@ -900,11 +913,35 @@ BOOL32 WINAPI GetInputState32(void)
{ {
MESSAGEQUEUE *queue; MESSAGEQUEUE *queue;
if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) ))) if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetFastQueue() )))
return FALSE; return FALSE;
return queue->wakeBits & (QS_KEY | QS_MOUSEBUTTON); return queue->wakeBits & (QS_KEY | QS_MOUSEBUTTON);
} }
/***********************************************************************
* UserYield (USER.332)
*/
void WINAPI UserYield(void)
{
TDB *pCurTask = (TDB *)GlobalLock16( GetCurrentTask() );
MESSAGEQUEUE *queue = (MESSAGEQUEUE *)GlobalLock16( pCurTask->hQueue );
if ( !THREAD_IsWin16( THREAD_Current() ) )
{
FIXME(task, "called for Win32 thread (%04x)!\n", THREAD_Current()->teb_sel);
return;
}
/* Handle sent messages */
while (queue && (queue->wakeBits & QS_SENDMESSAGE))
QUEUE_ReceiveMessage( queue );
OldYield();
queue = (MESSAGEQUEUE *)GlobalLock16( pCurTask->hQueue );
while (queue && (queue->wakeBits & QS_SENDMESSAGE))
QUEUE_ReceiveMessage( queue );
}
/*********************************************************************** /***********************************************************************
* GetMessagePos (USER.119) (USER32.272) * GetMessagePos (USER.119) (USER32.272)
@ -931,7 +968,7 @@ DWORD WINAPI GetMessagePos(void)
{ {
MESSAGEQUEUE *queue; MESSAGEQUEUE *queue;
if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) ))) return 0; if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetFastQueue() ))) return 0;
return queue->GetMessagePosVal; return queue->GetMessagePosVal;
} }
@ -959,7 +996,7 @@ LONG WINAPI GetMessageTime(void)
{ {
MESSAGEQUEUE *queue; MESSAGEQUEUE *queue;
if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) ))) return 0; if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetFastQueue() ))) return 0;
return queue->GetMessageTimeVal; return queue->GetMessageTimeVal;
} }
@ -971,6 +1008,6 @@ LONG WINAPI GetMessageExtraInfo(void)
{ {
MESSAGEQUEUE *queue; MESSAGEQUEUE *queue;
if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) ))) return 0; if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetFastQueue() ))) return 0;
return queue->GetMessageExtraInfoVal; return queue->GetMessageExtraInfoVal;
} }