Changeset 4658 for trunk/src/user32/oslibmsg.cpp
- Timestamp:
- Nov 21, 2000, 12:36:09 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/oslibmsg.cpp
r3525 r4658 1 /* $Id: oslibmsg.cpp,v 1.3 3 2000-05-12 18:09:40sandervl Exp $ */1 /* $Id: oslibmsg.cpp,v 1.34 2000-11-21 11:36:08 sandervl Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 78 78 WM_CHAR, WINWM_KEYLAST, 79 79 80 WM_COMMAND, WINWM_COMMAND,81 WM_SYSCOMMAND, WINWM_SYSCOMMAND,82 80 // 83 81 WM_TIMER, WINWM_TIMER, 84 WM_INITMENU, WINWM_INITMENU, 82 85 83 // 86 84 WM_MOUSEMOVE, WINWM_MOUSEMOVE, … … 99 97 #define MAX_MSGTRANSTAB (sizeof(MsgTransTab)/sizeof(MsgTransTab[0])) 100 98 101 LRESULT WIN32API SendMessageA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);102 103 99 //****************************************************************************** 104 100 //****************************************************************************** … … 134 130 } 135 131 136 return 0; 132 //not found, probaby WIN32APP_POSTMSG 133 return WIN32APP_POSTMSG; 137 134 } 138 135 //****************************************************************************** … … 149 146 LONG OSLibWinDispatchMsg(MSG *msg, BOOL isUnicode) 150 147 { 151 T HDB *thdb;148 TEB *teb; 152 149 QMSG os2msg; 153 150 LONG rc; 154 151 155 t hdb = GetThreadTHDB();156 if(t hdb == NULL) {152 teb = GetThreadTEB(); 153 if(teb == NULL) { 157 154 DebugInt3(); 158 155 return FALSE; … … 162 159 // WinToOS2MsgTranslate(msg, &qmsg, isUnicode); 163 160 164 if(!memcmp(msg, &t hdb->winmsg, sizeof(MSG)) || msg->hwnd == 0) {165 memcpy(&os2msg, &t hdb->os2msg, sizeof(QMSG));166 t hdb->os2msg.time = -1;167 t hdb->winmsg.time = -1;161 if(!memcmp(msg, &teb->o.odin.winmsg, sizeof(MSG)) || msg->hwnd == 0) { 162 memcpy(&os2msg, &teb->o.odin.os2msg, sizeof(QMSG)); 163 teb->o.odin.os2msg.time = -1; 164 teb->o.odin.winmsg.time = -1; 168 165 if(msg->hwnd) { 169 t hdb->nrOfMsgs = 1;170 t hdb->msgstate++; //odd -> next call to our PM window handler should dispatch the translated msg171 memcpy(&t hdb->msg, msg, sizeof(MSG));166 teb->o.odin.nrOfMsgs = 1; 167 teb->o.odin.msgstate++; //odd -> next call to our PM window handler should dispatch the translated msg 168 memcpy(&teb->o.odin.msg, msg, sizeof(MSG)); 172 169 } 173 170 if(os2msg.hwnd || os2msg.msg == WM_QUIT) { 174 memset(&t hdb->os2msg, 0, sizeof(thdb->os2msg));175 memset(&t hdb->winmsg, 0, sizeof(thdb->winmsg));176 return (LONG)WinDispatchMsg(t hdb->hab, &os2msg);171 memset(&teb->o.odin.os2msg, 0, sizeof(teb->o.odin.os2msg)); 172 memset(&teb->o.odin.winmsg, 0, sizeof(teb->o.odin.winmsg)); 173 return (LONG)WinDispatchMsg(teb->o.odin.hab, &os2msg); 177 174 } 178 175 //SvL: Don't dispatch messages sent by PostThreadMessage (correct??) … … 192 189 { 193 190 BOOL rc, eaten; 194 T HDB *thdb;191 TEB *teb; 195 192 QMSG os2msg; 196 193 HWND hwndOS2 = 0; 194 ULONG filtermin, filtermax; 197 195 198 196 if(hwnd) { … … 206 204 } 207 205 208 t hdb = GetThreadTHDB();209 if(t hdb == NULL) {206 teb = GetThreadTEB(); 207 if(teb == NULL) { 210 208 DebugInt3(); 211 209 return TRUE; 212 210 } 213 211 214 if(t hdb->fTranslated && (!hwnd || hwnd == thdb->msgWCHAR.hwnd)) {212 if(teb->o.odin.fTranslated && (!hwnd || hwnd == teb->o.odin.msgWCHAR.hwnd)) { 215 213 if(uMsgFilterMin) { 216 if(t hdb->msgWCHAR.message < uMsgFilterMin)214 if(teb->o.odin.msgWCHAR.message < uMsgFilterMin) 217 215 goto continuegetmsg; 218 216 } 219 217 if(uMsgFilterMax) { 220 if(t hdb->msgWCHAR.message > uMsgFilterMax)218 if(teb->o.odin.msgWCHAR.message > uMsgFilterMax) 221 219 goto continuegetmsg; 222 220 } 223 t hdb->fTranslated = FALSE;224 memcpy(pMsg, &t hdb->msgWCHAR, sizeof(MSG));225 t hdb->os2msg.msg = 0;226 t hdb->os2msg.hwnd = 0;221 teb->o.odin.fTranslated = FALSE; 222 memcpy(pMsg, &teb->o.odin.msgWCHAR, sizeof(MSG)); 223 teb->o.odin.os2msg.msg = 0; 224 teb->o.odin.os2msg.hwnd = 0; 227 225 return (pMsg->message != WINWM_QUIT); 228 226 } … … 230 228 continuegetmsg: 231 229 if(hwnd) { 230 filtermin = TranslateWinMsg(uMsgFilterMin, TRUE); 231 filtermax = TranslateWinMsg(uMsgFilterMax, FALSE); 232 if(filtermin > filtermax) { 233 ULONG tmp = filtermin; 234 filtermin = filtermax; 235 filtermax = filtermin; 236 } 232 237 do { 233 WinWaitMsg(thdb->hab, TranslateWinMsg(uMsgFilterMin, TRUE), TranslateWinMsg(uMsgFilterMax, FALSE));234 rc = OSLibWinPeekMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax, PM_REMOVE_W, isUnicode);238 WinWaitMsg(teb->o.odin.hab, filtermin, filtermax); 239 rc = OSLibWinPeekMsg(pMsg, hwnd, uMsgFilterMin, uMsgFilterMax, PM_REMOVE_W, isUnicode); 235 240 } 236 241 while(rc == FALSE); … … 240 245 else 241 246 { 242 do { 243 eaten = FALSE; 244 rc = WinGetMsg(thdb->hab, &os2msg, TranslateWinMsg(uMsgFilterMin, TRUE), TranslateWinMsg(uMsgFilterMax, FALSE), 0); 245 if (os2msg.msg == WM_TIMER) 246 eaten = TIMER_HandleTimer(&os2msg); 247 } while (eaten); 248 } 249 250 OS2ToWinMsgTranslate((PVOID)thdb, &os2msg, pMsg, isUnicode, MSG_REMOVE); 251 memcpy(&thdb->os2msg, &os2msg, sizeof(QMSG)); 252 memcpy(&thdb->winmsg, pMsg, sizeof(MSG)); 247 filtermin = TranslateWinMsg(uMsgFilterMin, TRUE); 248 filtermax = TranslateWinMsg(uMsgFilterMax, FALSE); 249 if(filtermin > filtermax) { 250 ULONG tmp = filtermin; 251 filtermin = filtermax; 252 filtermax = filtermin; 253 } 254 do { 255 eaten = FALSE; 256 rc = WinGetMsg(teb->o.odin.hab, &os2msg, filtermin, filtermax, 0); 257 if (os2msg.msg == WM_TIMER) 258 eaten = TIMER_HandleTimer(&os2msg); 259 } while (eaten); 260 } 261 262 OS2ToWinMsgTranslate((PVOID)teb, &os2msg, pMsg, isUnicode, MSG_REMOVE); 263 memcpy(&teb->o.odin.os2msg, &os2msg, sizeof(QMSG)); 264 memcpy(&teb->o.odin.winmsg, pMsg, sizeof(MSG)); 253 265 254 266 if(pMsg->message <= WINWM_KEYLAST && pMsg->message >= WINWM_KEYDOWN) … … 275 287 { 276 288 BOOL rc, eaten; 277 T HDB *thdb;289 TEB *teb; 278 290 QMSG os2msg; 279 291 HWND hwndOS2 = 0; … … 288 300 } 289 301 290 t hdb = GetThreadTHDB();291 if(t hdb == NULL) {302 teb = GetThreadTEB(); 303 if(teb == NULL) { 292 304 DebugInt3(); 293 305 return FALSE; 294 306 } 295 307 296 if(t hdb->fTranslated && (!hwnd || hwnd == thdb->msgWCHAR.hwnd)) {308 if(teb->o.odin.fTranslated && (!hwnd || hwnd == teb->o.odin.msgWCHAR.hwnd)) { 297 309 if(uMsgFilterMin) { 298 if(t hdb->msgWCHAR.message < uMsgFilterMin)310 if(teb->o.odin.msgWCHAR.message < uMsgFilterMin) 299 311 goto continuepeekmsg; 300 312 } 301 313 if(uMsgFilterMax) { 302 if(t hdb->msgWCHAR.message > uMsgFilterMax)314 if(teb->o.odin.msgWCHAR.message > uMsgFilterMax) 303 315 goto continuepeekmsg; 304 316 } 305 317 306 318 if(fRemove & PM_REMOVE_W) { 307 t hdb->fTranslated = FALSE;308 t hdb->os2msg.msg = 0;309 t hdb->os2msg.hwnd = 0;310 } 311 memcpy(pMsg, &t hdb->msgWCHAR, sizeof(MSG));319 teb->o.odin.fTranslated = FALSE; 320 teb->o.odin.os2msg.msg = 0; 321 teb->o.odin.os2msg.hwnd = 0; 322 } 323 memcpy(pMsg, &teb->o.odin.msgWCHAR, sizeof(MSG)); 312 324 return TRUE; 313 325 } … … 316 328 do { 317 329 eaten = FALSE; 318 rc = WinPeekMsg(t hdb->hab, &os2msg, hwndOS2, TranslateWinMsg(uMsgFilterMin, TRUE),330 rc = WinPeekMsg(teb->o.odin.hab, &os2msg, hwndOS2, TranslateWinMsg(uMsgFilterMin, TRUE), 319 331 TranslateWinMsg(uMsgFilterMax, FALSE), (fRemove & PM_REMOVE_W) ? PM_REMOVE : PM_NOREMOVE); 320 332 … … 329 341 } 330 342 331 OS2ToWinMsgTranslate((PVOID)t hdb, &os2msg, pMsg, isUnicode, (fRemove & PM_REMOVE_W) ? MSG_REMOVE : MSG_NOREMOVE);343 OS2ToWinMsgTranslate((PVOID)teb, &os2msg, pMsg, isUnicode, (fRemove & PM_REMOVE_W) ? MSG_REMOVE : MSG_NOREMOVE); 332 344 //TODO: This is not safe! There's no guarantee this message will be dispatched and it might overwrite a previous message 333 345 if(fRemove & PM_REMOVE_W) { 334 memcpy(&t hdb->os2msg, &os2msg, sizeof(QMSG));335 memcpy(&t hdb->winmsg, pMsg, sizeof(MSG));346 memcpy(&teb->o.odin.os2msg, &os2msg, sizeof(QMSG)); 347 memcpy(&teb->o.odin.winmsg, pMsg, sizeof(MSG)); 336 348 } 337 349 … … 460 472 BOOL OSLibPostThreadMessage(ULONG threadid, UINT msg, WPARAM wParam, LPARAM lParam, BOOL fUnicode) 461 473 { 462 // T HDB *thdb = GetTHDBFromThreadId(threadid);474 // TEB *teb = GetTEBFromThreadId(threadid); 463 475 POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET)); 464 476 465 // if(t hdb == NULL) {477 // if(teb == NULL) { 466 478 // dprintf(("OSLibPostThreadMessage: thread %x not found!", threadid)); 467 479 // return FALSE;
Note:
See TracChangeset
for help on using the changeset viewer.