- Timestamp:
- Aug 6, 2003, 1:00:45 PM (22 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/oslibmsg.cpp
r10205 r10212 1 /* $Id: oslibmsg.cpp,v 1.7 3 2003-08-04 17:06:50sandervl Exp $ */1 /* $Id: oslibmsg.cpp,v 1.74 2003-08-06 11:00:44 sandervl Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 46 46 #include <thread.h> 47 47 #include <wprocess.h> 48 #include <winnls.h> 48 49 #include "pmwindow.h" 49 50 #include "oslibwin.h" … … 231 232 } 232 233 //****************************************************************************** 234 // ReturnQueuedWMCHAR: 235 // 236 // Check for a queued WM_CHAR message (e.g. inserted by TranslateMessage) 237 //****************************************************************************** 238 BOOL ReturnQueuedWMCHAR(LPMSG pMsg, TEB *teb, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax, 239 BOOL isUnicode, BOOL fRemove) 240 { 241 if(teb->o.odin.fTranslated && (!hwnd || hwnd == teb->o.odin.msgWCHAR.hwnd)) 242 { 243 dprintf(("Return queued WM_CHAR message hwnd=%x msg=%d wParam=%x lParam=%x", teb->o.odin.msgWCHAR.hwnd, teb->o.odin.msgWCHAR.message, teb->o.odin.msgWCHAR.wParam, teb->o.odin.msgWCHAR.lParam)); 244 245 if(uMsgFilterMin) { 246 if(teb->o.odin.msgWCHAR.message < uMsgFilterMin) 247 return FALSE; 248 } 249 if(uMsgFilterMax) { 250 if(teb->o.odin.msgWCHAR.message > uMsgFilterMax) 251 return FALSE; 252 } 253 254 if(fRemove & PM_REMOVE_W) { 255 teb->o.odin.fTranslated = FALSE; 256 teb->o.odin.os2msg.msg = 0; 257 teb->o.odin.os2msg.hwnd = 0; 258 } 259 memcpy(pMsg, &teb->o.odin.msgWCHAR, sizeof(MSG)); 260 //After SetFocus(0), all keystrokes are converted in WM_SYS* 261 if(pMsg->message == WINWM_CHAR && fIgnoreKeystrokes) { 262 pMsg->message = WINWM_SYSCHAR; 263 } 264 265 if(!IsWindow(pMsg->hwnd)) { 266 //could be a queued char message for a window that was just destroyed 267 //when that's the case, we ignore it (MFC assertions are triggered by this) 268 teb->o.odin.fTranslated = FALSE; 269 teb->o.odin.os2msg.msg = 0; 270 teb->o.odin.os2msg.hwnd = 0; 271 return FALSE; 272 } 273 274 // @@@PH verify this 275 // if this is a keyup or keydown message, we've got to 276 // call the keyboard hook here 277 // send keyboard messages to the registered hooks 278 if(fRemove & PM_REMOVE_W) 279 { 280 switch (pMsg->message) 281 { 282 case WINWM_KEYDOWN: 283 case WINWM_KEYUP: 284 case WINWM_SYSKEYDOWN: 285 case WINWM_SYSKEYUP: 286 // only supposed to be called upon WM_KEYDOWN 287 // and WM_KEYUP according to docs. 288 if(ProcessKbdHook(pMsg, fRemove)) 289 return FALSE; 290 break; 291 } 292 } 293 294 //GetMessageW and PeekMessageW expect the character code in UTF-16 295 //(we save it in ascii format) 296 if(isUnicode && (pMsg->message == WINWM_CHAR || pMsg->message == WINWM_SYSCHAR)) 297 { 298 CHAR charA; 299 WCHAR charW; 300 301 charA = pMsg->wParam; 302 MultiByteToWideChar(CP_ACP, 0, &charA, 1, &charW, 1); 303 pMsg->wParam= charW; 304 dprintf(("ReturnQueuedWMCHAR: Convert to Unicode src=%x res=%x", charA, charW)); 305 } 306 return TRUE; 307 } 308 return FALSE; 309 } 310 //****************************************************************************** 233 311 //****************************************************************************** 234 312 BOOL OSLibWinGetMsg(LPMSG pMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax, … … 257 335 } 258 336 259 if(teb->o.odin.fTranslated && (!hwnd || hwnd == teb->o.odin.msgWCHAR.hwnd)) 260 { 261 dprintf(("Return queued WM_CHAR message hwnd=%x msg=%d wParam=%x lParam=%x", teb->o.odin.msgWCHAR.hwnd, teb->o.odin.msgWCHAR.message, teb->o.odin.msgWCHAR.wParam, teb->o.odin.msgWCHAR.lParam)); 262 if(uMsgFilterMin) { 263 if(teb->o.odin.msgWCHAR.message < uMsgFilterMin) 264 goto continuegetmsg; 265 } 266 if(uMsgFilterMax) { 267 if(teb->o.odin.msgWCHAR.message > uMsgFilterMax) 268 goto continuegetmsg; 269 } 270 teb->o.odin.fTranslated = FALSE; 271 memcpy(pMsg, &teb->o.odin.msgWCHAR, sizeof(MSG)); 272 273 //After SetFocus(0), all keystrokes are converted in WM_SYS* 274 if(pMsg->message == WINWM_CHAR && fIgnoreKeystrokes) { 275 pMsg->message = WINWM_SYSCHAR; 276 } 277 278 teb->o.odin.os2msg.msg = 0; 279 teb->o.odin.os2msg.hwnd = 0; 280 281 if(!IsWindow(pMsg->hwnd)) { 282 //could be a queued char message for a window that was just destroyed 283 //when that's the case, we ignore it (MFC assertions are triggered by this) 284 goto continuegetmsg; 285 } 286 287 // @@@PH verify this 288 // if this is a keyup or keydown message, we've got to 289 // call the keyboard hook here 290 // send keyboard messages to the registered hooks 291 switch (pMsg->message) 292 { 293 case WINWM_KEYDOWN: 294 case WINWM_KEYUP: 295 case WINWM_SYSKEYDOWN: 296 case WINWM_SYSKEYUP: 297 // only supposed to be called upon WM_KEYDOWN 298 // and WM_KEYUP according to docs. 299 if(ProcessKbdHook(pMsg, TRUE)) 300 goto continuegetmsg; 301 break; 302 } 303 337 //check for a queued WM_CHAR message (e.g. inserted by TranslateMessage) 338 if(ReturnQueuedWMCHAR(pMsg, teb, hwnd, uMsgFilterMin, uMsgFilterMax, isUnicode, PM_REMOVE_W) == TRUE) 339 { 304 340 return (pMsg->message != WINWM_QUIT); 305 341 } … … 401 437 } 402 438 if(hwnd && hwnd != -1) { 403 404 405 406 407 408 439 hwndOS2 = Win32ToOS2Handle(hwnd); 440 if(hwndOS2 == NULL) { 441 dprintf(("PeekMsg: window %x NOT FOUND!", hwnd)); 442 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 443 return FALSE; 444 } 409 445 } 410 446 … … 415 451 } 416 452 417 if(teb->o.odin.fTranslated && (!hwnd || hwnd == teb->o.odin.msgWCHAR.hwnd)) 418 { 419 dprintf(("Return queued WM_CHAR message hwnd=%x msg=%d wParam=%x lParam=%x", teb->o.odin.msgWCHAR.hwnd, teb->o.odin.msgWCHAR.message, teb->o.odin.msgWCHAR.wParam, teb->o.odin.msgWCHAR.lParam)); 420 if(uMsgFilterMin) { 421 if(teb->o.odin.msgWCHAR.message < uMsgFilterMin) 422 goto continuepeekmsg; 423 } 424 if(uMsgFilterMax) { 425 if(teb->o.odin.msgWCHAR.message > uMsgFilterMax) 426 goto continuepeekmsg; 427 } 428 429 if(fRemove & PM_REMOVE_W) { 430 teb->o.odin.fTranslated = FALSE; 431 teb->o.odin.os2msg.msg = 0; 432 teb->o.odin.os2msg.hwnd = 0; 433 } 434 memcpy(pMsg, &teb->o.odin.msgWCHAR, sizeof(MSG)); 435 //After SetFocus(0), all keystrokes are converted in WM_SYS* 436 if(pMsg->message == WINWM_CHAR && fIgnoreKeystrokes) { 437 pMsg->message = WINWM_SYSCHAR; 438 } 439 440 441 if(!IsWindow(pMsg->hwnd)) { 442 //could be a queued char message for a window that was just destroyed 443 //when that's the case, we ignore it (MFC assertions are triggered by this) 444 teb->o.odin.fTranslated = FALSE; 445 teb->o.odin.os2msg.msg = 0; 446 teb->o.odin.os2msg.hwnd = 0; 447 goto continuepeekmsg; 448 } 449 450 // @@@PH verify this 451 // if this is a keyup or keydown message, we've got to 452 // call the keyboard hook here 453 // send keyboard messages to the registered hooks 454 if(fRemove & PM_REMOVE_W) { 455 switch (pMsg->message) 456 { 457 case WINWM_KEYDOWN: 458 case WINWM_KEYUP: 459 case WINWM_SYSKEYDOWN: 460 case WINWM_SYSKEYUP: 461 // only supposed to be called upon WM_KEYDOWN 462 // and WM_KEYUP according to docs. 463 if(ProcessKbdHook(pMsg, fRemove)) 464 goto continuepeekmsg; 465 break; 466 } 467 } 468 453 //check for a queued WM_CHAR message (e.g. inserted by TranslateMessage) 454 if(ReturnQueuedWMCHAR(pMsg, teb, hwnd, uMsgFilterMin, uMsgFilterMax, isUnicode, fRemove) == TRUE) 455 { 469 456 return TRUE; 470 457 } -
trunk/src/user32/oslibmsgtranslate.cpp
r10190 r10212 1 /* $Id: oslibmsgtranslate.cpp,v 1.11 3 2003-07-31 15:56:44sandervl Exp $ */1 /* $Id: oslibmsgtranslate.cpp,v 1.114 2003-08-06 11:00:45 sandervl Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 62 62 // by GetMessage & PeekMessage 63 63 // 64 // NOTE: Automatically converts ascii character code to UTF-16 if the target 65 // window is unicode. 64 // NOTE: WM_CHAR message always in ascii format 66 65 // 67 66 //****************************************************************************** … … 72 71 // there's still an already translated message to be processed 73 72 return FALSE; 74 75 //Unicode windows expect the character code in UTF-1676 if(IsWindowUnicode(pExtraMsg->hwnd))77 {78 CHAR charA;79 WCHAR charW;80 81 charA = pExtraMsg->wParam;82 MultiByteToWideChar(CP_ACP, 0, &charA, 1, &charW, 1);83 pExtraMsg->wParam= charW;84 dprintf(("setThreadQueueExtraCharMessage: Convert to Unicode src=%x res=%x", charA, charW ));85 }86 73 87 74 teb->o.odin.fTranslated = TRUE;
Note:
See TracChangeset
for help on using the changeset viewer.