Implemented stub for InitThreadInput.
Use GetThreadQueue/GetFastQueue instead of GetTaskQueue.
diff --git a/windows/message.c b/windows/message.c
index edaca9c..5da24fd 100644
--- a/windows/message.c
+++ b/windows/message.c
@@ -102,7 +102,7 @@
INT16 ht, hittest, sendSC = 0;
UINT16 message = msg->message;
POINT16 screen_pt, pt;
- HANDLE16 hQ = GetTaskQueue(0);
+ HANDLE16 hQ = GetFastQueue();
MESSAGEQUEUE *queue = (MESSAGEQUEUE *)GlobalLock16(hQ);
BOOL32 eatMsg = FALSE;
BOOL32 mouseClick = ((message == WM_LBUTTONDOWN) ||
@@ -278,10 +278,10 @@
message += WM_SYSKEYDOWN - WM_KEYDOWN;
}
pWnd = WIN_FindWndPtr( hWnd );
- if (pWnd && (pWnd->hmemTaskQ != GetTaskQueue(0)))
+ if (pWnd && (pWnd->hmemTaskQ != GetFastQueue()))
{
/* Not for the current task */
- MESSAGEQUEUE *queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) );
+ MESSAGEQUEUE *queue = (MESSAGEQUEUE *)GlobalLock16( GetFastQueue() );
if (queue) QUEUE_ClearWakeBit( queue, QS_KEY );
/* Wake up the other task */
queue = (MESSAGEQUEUE *)GlobalLock16( pWnd->hmemTaskQ );
@@ -596,7 +596,7 @@
QSMCTRL qCtrl = { 0, 1};
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 (IsTaskLocked() || !IsWindow32(hwnd)) return 0;
@@ -619,7 +619,7 @@
queue->wParamHigh = HIWORD(wParam);
queue->lParam = lParam;
queue->hPrevSendingTask = destQ->hSendingTask;
- destQ->hSendingTask = GetTaskQueue(0);
+ destQ->hSendingTask = GetFastQueue();
QUEUE_ClearWakeBit( queue, QS_SMPARAMSFREE );
queue->flags = (queue->flags & ~(QUEUE_SM_WIN32|QUEUE_SM_UNICODE)) | flags;
@@ -670,7 +670,7 @@
MESSAGEQUEUE *senderQ;
MESSAGEQUEUE *queue;
- if (!(queue = (MESSAGEQUEUE*)GlobalLock16( GetTaskQueue(0) ))) return;
+ if (!(queue = (MESSAGEQUEUE*)GlobalLock16( GetFastQueue() ))) return;
TRACE(msg,"ReplyMessage, queue %04x\n", queue->self);
@@ -736,7 +736,7 @@
while(1)
{
- hQueue = GetTaskQueue(0);
+ hQueue = GetFastQueue();
msgQueue = (MESSAGEQUEUE *)GlobalLock16( hQueue );
if (!msgQueue) return FALSE;
msgQueue->changeBits = 0;
@@ -1222,7 +1222,7 @@
SPY_EnterMessage( SPY_SENDMESSAGE16, hwnd, msg, wParam, lParam );
- if (wndPtr->hmemTaskQ != GetTaskQueue(0))
+ if (wndPtr->hmemTaskQ != GetFastQueue())
ret = MSG_SendMessage( wndPtr->hmemTaskQ, hwnd, msg,
wParam, lParam, 0 );
else
@@ -1329,7 +1329,7 @@
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,
QUEUE_SM_WIN32 );
else
@@ -1400,7 +1400,7 @@
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,
QUEUE_SM_WIN32 | QUEUE_SM_UNICODE );
else
@@ -1938,7 +1938,7 @@
{
MESSAGEQUEUE *queue;
- if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) )))
+ if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetFastQueue() )))
return 0;
return (BOOL32)queue->InSendMessageHandle;
}
diff --git a/windows/queue.c b/windows/queue.c
index cb562d2..eee5c8a 100644
--- a/windows/queue.c
+++ b/windows/queue.c
@@ -312,11 +312,11 @@
{
MESSAGEQUEUE *queue;
- TRACE(msg,"q %04x waiting for %04x\n", GetTaskQueue(0), bits);
+ TRACE(msg,"q %04x waiting for %04x\n", GetFastQueue(), bits);
for (;;)
{
- if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) ))) return;
+ if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetFastQueue() ))) return;
if (queue->changeBits & bits)
{
@@ -752,7 +752,7 @@
{
MESSAGEQUEUE *queue;
- if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) ))) return;
+ if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetFastQueue() ))) return;
queue->wPostQMsg = TRUE;
queue->wExitCode = (WORD)exitCode;
}
@@ -819,7 +819,7 @@
SIGNAL_MaskAsyncEvents( TRUE );
/* Copy data and free the old message queue */
- if ((hQueue = GetTaskQueue(0)) != 0)
+ if ((hQueue = GetThreadQueue(0)) != 0)
{
MESSAGEQUEUE *oldQ = (MESSAGEQUEUE *)GlobalLock16( hQueue );
memcpy( &queuePtr->wParamHigh, &oldQ->wParamHigh,
@@ -838,12 +838,25 @@
hFirstQueue = hNewQueue;
if( !queuePtr->next ) pCursorQueue = queuePtr;
- SetTaskQueue( 0, hNewQueue );
+ SetThreadQueue( 0, hNewQueue );
SIGNAL_MaskAsyncEvents( FALSE );
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)
@@ -853,7 +866,7 @@
MESSAGEQUEUE *queue;
DWORD ret;
- if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) ))) return 0;
+ if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetFastQueue() ))) return 0;
ret = MAKELONG( queue->changeBits, queue->wakeBits );
queue->changeBits = 0;
return ret & MAKELONG( flags, flags );
@@ -867,7 +880,7 @@
MESSAGEQUEUE *queue;
DWORD ret;
- if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) ))) return 0;
+ if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetFastQueue() ))) return 0;
ret = MAKELONG( queue->changeBits, queue->wakeBits );
queue->changeBits = 0;
return ret & MAKELONG( flags, flags );
@@ -900,11 +913,35 @@
{
MESSAGEQUEUE *queue;
- if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) )))
+ if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetFastQueue() )))
return FALSE;
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)
@@ -931,7 +968,7 @@
{
MESSAGEQUEUE *queue;
- if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) ))) return 0;
+ if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetFastQueue() ))) return 0;
return queue->GetMessagePosVal;
}
@@ -959,7 +996,7 @@
{
MESSAGEQUEUE *queue;
- if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) ))) return 0;
+ if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetFastQueue() ))) return 0;
return queue->GetMessageTimeVal;
}
@@ -971,6 +1008,6 @@
{
MESSAGEQUEUE *queue;
- if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) ))) return 0;
+ if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetFastQueue() ))) return 0;
return queue->GetMessageExtraInfoVal;
}