Changeset 10430 for trunk/src/user32/windowmsg.cpp
- Timestamp:
- Jan 30, 2004, 11:10:07 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/windowmsg.cpp
r10216 r10430 1 /* $Id: windowmsg.cpp,v 1.4 7 2003-08-08 13:30:22 sandervlExp $ */1 /* $Id: windowmsg.cpp,v 1.48 2004-01-30 22:10:07 bird Exp $ */ 2 2 /* 3 3 * Win32 window message APIs for OS/2 … … 40 40 ODINDEBUGCHANNEL(USER32-WINDOWMSG) 41 41 42 43 42 //****************************************************************************** 44 43 //****************************************************************************** … … 121 120 { 122 121 BOOL ret; 122 TEB *pTeb = GetThreadTEB(); 123 123 124 124 dprintf2(("GetMessageA %x %x-%x", hwnd, uMsgFilterMin, uMsgFilterMax)); 125 ret = OSLibWinGetMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax); 126 if(ret) dprintf2(("GetMessageA %x %x %x %x", hwnd, pMsg->message, pMsg->wParam, pMsg->lParam)); 125 do 126 { 127 ret = OSLibWinGetMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax); 128 if(ret) dprintf2(("GetMessageA %x %x %x %x", hwnd, pMsg->message, pMsg->wParam, pMsg->lParam)); 129 } while ( pTeb->o.odin.tidAttachedInputThread 130 && OSLibForwardMessageToAttachedThread(pTeb, pMsg, NULL)); 127 131 HOOK_CallHooksA(WH_GETMESSAGE, HC_ACTION, PM_REMOVE, (LPARAM)pMsg); 128 132 return ret; … … 133 137 { 134 138 BOOL ret; 139 TEB *pTeb = GetThreadTEB(); 135 140 136 141 dprintf2(("GetMessageW %x %x-%x", hwnd, uMsgFilterMin, uMsgFilterMax)); 137 ret = OSLibWinGetMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax, TRUE); 142 do 143 { 144 ret = OSLibWinGetMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax, TRUE); 145 } while ( pTeb->o.odin.tidAttachedInputThread 146 && OSLibForwardMessageToAttachedThread(pTeb, pMsg, NULL)); 138 147 HOOK_CallHooksW(WH_GETMESSAGE, HC_ACTION, PM_REMOVE, (LPARAM)pMsg); 139 148 return ret; … … 145 154 { 146 155 BOOL fFoundMsg; 156 TEB *pTeb = GetThreadTEB(); 147 157 148 158 dprintf2(("PeekMessageA %x %d-%d %d", hwndOwner, uMsgFilterMin, uMsgFilterMax, fuRemoveMsg)); 149 fFoundMsg = OSLibWinPeekMsg(msg, hwndOwner, uMsgFilterMin, uMsgFilterMax, 150 fuRemoveMsg, FALSE); 151 if(fFoundMsg) { 159 do 160 { 161 fFoundMsg = OSLibWinPeekMsg(msg, hwndOwner, uMsgFilterMin, uMsgFilterMax, fuRemoveMsg, FALSE); 162 if ( fFoundMsg 163 && pTeb->o.odin.tidAttachedInputThread 164 && OSLibForwardMessageToAttachedThread(pTeb, msg, NULL)); 165 { 166 if (!fuRemoveMsg) 167 OSLibWinPeekMsg(msg, hwndOwner, uMsgFilterMin, uMsgFilterMax, TRUE, FALSE); 168 continue; 169 } 170 } while (0); 171 172 if (fFoundMsg) { 152 173 dprintf2(("PeekMessageA %x %d-%d %d found message %x %d %x %x", hwndOwner, uMsgFilterMin, uMsgFilterMax, fuRemoveMsg, msg->hwnd, msg->message, msg->wParam, msg->lParam)); 153 174 HOOK_CallHooksA(WH_GETMESSAGE, HC_ACTION, fuRemoveMsg & PM_REMOVE, (LPARAM)msg ); … … 164 185 { 165 186 BOOL fFoundMsg; 187 TEB *pTeb = GetThreadTEB(); 166 188 167 189 dprintf2(("PeekMessageW %x %d-%d %d", hwndOwner, uMsgFilterMin, uMsgFilterMax, fuRemoveMsg)); 168 fFoundMsg = OSLibWinPeekMsg(msg, hwndOwner, uMsgFilterMin, uMsgFilterMax, 169 fuRemoveMsg, TRUE); 190 do 191 { 192 fFoundMsg = OSLibWinPeekMsg(msg, hwndOwner, uMsgFilterMin, uMsgFilterMax, fuRemoveMsg, TRUE); 193 if ( fFoundMsg 194 && pTeb->o.odin.tidAttachedInputThread 195 && OSLibForwardMessageToAttachedThread(pTeb, msg, NULL)); 196 { 197 if (!fuRemoveMsg) 198 OSLibWinPeekMsg(msg, hwndOwner, uMsgFilterMin, uMsgFilterMax, TRUE, TRUE); 199 continue; 200 } 201 } while (0); 202 170 203 if(fFoundMsg) { 171 204 dprintf2(("PeekMessageW %x %d-%d %d found message %x %d %x %x", hwndOwner, uMsgFilterMin, uMsgFilterMax, fuRemoveMsg, msg->hwnd, msg->message, msg->wParam, msg->lParam)); … … 277 310 } 278 311 //****************************************************************************** 312 313 /** 314 * Attach one threads input queue to another thread. 315 * 316 * @returns Success indicator. 317 * @param idAttach Thread ID of the thread to attach/detach the input 318 * of idAttachTo to. 319 * @param idAttachTo The Thread ID of the thread which input is to be taken 320 * over or reattached. 321 * @param fAttach If set attach the input queue of thread idAttachTo 322 * to idAttach. 323 * If clear detach the input queue of thread idAttach 324 * reattaching it to idAttachTo. 325 * @status partially implemented. 326 * @author knut st. osmundsen <bird-srcspam@anduin.net> 327 * @remark One cannot attach a threads input queue to it self. 328 * @todo Not sure if all this is 100% ok according to the windows reality. 329 * I'm sure some error cases aren't caught. 330 */ 331 BOOL WIN32API AttachThreadInput(DWORD idAttach, DWORD idAttachTo, BOOL fAttach) 332 { 333 dprintf(("USER32: AttachThreadInput\n")); 334 if (idAttach != idAttachTo) 335 { 336 /* pray noone frees the TEB while we're working on it... */ 337 TEB *pTeb = GetTEBFromThreadId(idAttach); 338 if (pTeb) 339 { 340 TEB *pTebTo = GetTEBFromThreadId(idAttachTo); 341 if (pTebTo) 342 { 343 if (fAttach) 344 { /* attach. */ 345 if (pTebTo->o.odin.tidAttachedInputThread) 346 { 347 dprintf(("USER32: AttachThreadInput: WARNING! %#x is already attached to %#x\n", idAttachTo, pTebTo->o.odin.tidAttachedInputThread)); 348 DebugInt3(); 349 } 350 pTebTo->o.odin.tidAttachedInputThread = idAttach; 351 dprintf(("USER32: AttachThreadInput: Attached input from %#x to %#x\n", idAttachTo, idAttach)); 352 } 353 else 354 { /* deattach - i.e. undo previous AttachThreadInput(,,TRUE). */ 355 if (pTebTo->o.odin.tidAttachedInputThread != idAttach) 356 { 357 dprintf(("USER32: AttachThreadInput: WARNING! %#x is not attached to %#x\n", idAttachTo, pTebTo->o.odin.tidAttachedInputThread)); 358 DebugInt3(); 359 } 360 pTebTo->o.odin.tidAttachedInputThread = 0; 361 dprintf(("USER32: AttachThreadInput: Detached input from %#x to %#x\n", idAttach, idAttachTo)); 362 } 363 return TRUE; 364 } 365 else 366 { 367 dprintf(("USER32: AttachThreadInput: Invalid tid=%#x\n", idAttachTo)); 368 SetLastError(ERROR_INVALID_PARAMETER); 369 } 370 } 371 else 372 { 373 dprintf(("USER32: AttachThreadInput: Invalid tid=%#x\n", idAttach)); 374 SetLastError(ERROR_INVALID_PARAMETER); 375 } 376 } 377 else 378 { 379 dprintf(("USER32: AttachThreadInput idAttach == idAttachTo (== %#x)\n", idAttach)); 380 SetLastError(ERROR_ACCESS_DENIED); 381 } 382 return FALSE; 383 } 384 279 385 //****************************************************************************** 280 386 /**********************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.