Changeset 76 for trunk/src/corelib/kernel
- Timestamp:
- Jul 9, 2009, 8:45:34 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/corelib/kernel/qcoreapplication_pm.cpp
r68 r76 131 131 #endif 132 132 133 // @todo later134 #if 0 && !defined(QT_NO_DEBUG_STREAM)135 /*****************************************************************************136 Convenience functions for convert WM_* messages into human readable strings,137 including a nifty QDebug operator<< for simpel QDebug() << msg output.138 *****************************************************************************/139 QT_BEGIN_INCLUDE_NAMESPACE140 #include "qdebug.h"141 QT_END_INCLUDE_NAMESPACE142 143 #if !defined(GET_X_LPARAM)144 # define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))145 # define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))146 #endif147 #ifdef _WIN32_WCE148 # ifndef WM_NCACTIVATE149 # define WM_NCACTIVATE 0x86150 # endif151 #endif152 153 // The values below should never change. Note that none of the usual154 // WM_...FIRST & WM_...LAST values are in the list, as they normally have other155 // WM_... representations156 struct {157 uint WM;158 const char* str;159 } knownWM[] =160 {{ 0x0000, "WM_NULL" },161 { 0x0001, "WM_CREATE" },162 { 0x0002, "WM_DESTROY" },163 { 0x0003, "WM_MOVE" },164 { 0x0005, "WM_SIZE" },165 { 0x0006, "WM_ACTIVATE" },166 { 0x0007, "WM_SETFOCUS" },167 { 0x0008, "WM_KILLFOCUS" },168 { 0x000A, "WM_ENABLE" },169 { 0x000B, "WM_SETREDRAW" },170 { 0x000C, "WM_SETTEXT" },171 { 0x000D, "WM_GETTEXT" },172 { 0x000E, "WM_GETTEXTLENGTH" },173 { 0x000F, "WM_PAINT" },174 { 0x0010, "WM_CLOSE" },175 { 0x0011, "WM_QUERYENDSESSION" },176 { 0x0013, "WM_QUERYOPEN" },177 { 0x0016, "WM_ENDSESSION" },178 { 0x0012, "WM_QUIT" },179 { 0x0014, "WM_ERASEBKGND" },180 { 0x0015, "WM_SYSCOLORCHANGE" },181 { 0x0018, "WM_SHOWWINDOW" },182 { 0x001A, "WM_WININICHANGE" },183 { 0x001B, "WM_DEVMODECHANGE" },184 { 0x001C, "WM_ACTIVATEAPP" },185 { 0x001D, "WM_FONTCHANGE" },186 { 0x001E, "WM_TIMECHANGE" },187 { 0x001F, "WM_CANCELMODE" },188 { 0x0020, "WM_SETCURSOR" },189 { 0x0021, "WM_MOUSEACTIVATE" },190 { 0x0022, "WM_CHILDACTIVATE" },191 { 0x0023, "WM_QUEUESYNC" },192 { 0x0024, "WM_GETMINMAXINFO" },193 { 0x0026, "WM_PAINTICON" },194 { 0x0027, "WM_ICONERASEBKGND" },195 { 0x0028, "WM_NEXTDLGCTL" },196 { 0x002A, "WM_SPOOLERSTATUS" },197 { 0x002B, "WM_DRAWITEM" },198 { 0x002C, "WM_MEASUREITEM" },199 { 0x002D, "WM_DELETEITEM" },200 { 0x002E, "WM_VKEYTOITEM" },201 { 0x002F, "WM_CHARTOITEM" },202 { 0x0030, "WM_SETFONT" },203 { 0x0031, "WM_GETFONT" },204 { 0x0032, "WM_SETHOTKEY" },205 { 0x0033, "WM_GETHOTKEY" },206 { 0x0037, "WM_QUERYDRAGICON" },207 { 0x0039, "WM_COMPAREITEM" },208 { 0x003D, "WM_GETOBJECT" },209 { 0x0041, "WM_COMPACTING" },210 { 0x0044, "WM_COMMNOTIFY" },211 { 0x0046, "WM_WINDOWPOSCHANGING" },212 { 0x0047, "WM_WINDOWPOSCHANGED" },213 { 0x0048, "WM_POWER" },214 { 0x004A, "WM_COPYDATA" },215 { 0x004B, "WM_CANCELJOURNAL" },216 { 0x004E, "WM_NOTIFY" },217 { 0x0050, "WM_INPUTLANGCHANGEREQUEST" },218 { 0x0051, "WM_INPUTLANGCHANGE" },219 { 0x0052, "WM_TCARD" },220 { 0x0053, "WM_HELP" },221 { 0x0054, "WM_USERCHANGED" },222 { 0x0055, "WM_NOTIFYFORMAT" },223 { 0x007B, "WM_CONTEXTMENU" },224 { 0x007C, "WM_STYLECHANGING" },225 { 0x007D, "WM_STYLECHANGED" },226 { 0x007E, "WM_DISPLAYCHANGE" },227 { 0x007F, "WM_GETICON" },228 { 0x0080, "WM_SETICON" },229 { 0x0081, "WM_NCCREATE" },230 { 0x0082, "WM_NCDESTROY" },231 { 0x0083, "WM_NCCALCSIZE" },232 { 0x0084, "WM_NCHITTEST" },233 { 0x0085, "WM_NCPAINT" },234 { 0x0086, "WM_NCACTIVATE" },235 { 0x0087, "WM_GETDLGCODE" },236 { 0x0088, "WM_SYNCPAINT" },237 { 0x00A0, "WM_NCMOUSEMOVE" },238 { 0x00A1, "WM_NCLBUTTONDOWN" },239 { 0x00A2, "WM_NCLBUTTONUP" },240 { 0x00A3, "WM_NCLBUTTONDBLCLK" },241 { 0x00A4, "WM_NCRBUTTONDOWN" },242 { 0x00A5, "WM_NCRBUTTONUP" },243 { 0x00A6, "WM_NCRBUTTONDBLCLK" },244 { 0x00A7, "WM_NCMBUTTONDOWN" },245 { 0x00A8, "WM_NCMBUTTONUP" },246 { 0x00A9, "WM_NCMBUTTONDBLCLK" },247 { 0x00AB, "WM_NCXBUTTONDOWN" },248 { 0x00AC, "WM_NCXBUTTONUP" },249 { 0x00AD, "WM_NCXBUTTONDBLCLK" },250 { 0x00FF, "WM_INPUT" },251 { 0x0100, "WM_KEYDOWN" },252 { 0x0101, "WM_KEYUP" },253 { 0x0102, "WM_CHAR" },254 { 0x0103, "WM_DEADCHAR" },255 { 0x0104, "WM_SYSKEYDOWN" },256 { 0x0105, "WM_SYSKEYUP" },257 { 0x0106, "WM_SYSCHAR" },258 { 0x0107, "WM_SYSDEADCHAR" },259 { 0x0109, "WM_UNICHAR" },260 { 0x010D, "WM_IME_STARTCOMPOSITION" },261 { 0x010E, "WM_IME_ENDCOMPOSITION" },262 { 0x010F, "WM_IME_COMPOSITION" },263 { 0x0110, "WM_INITDIALOG" },264 { 0x0111, "WM_COMMAND" },265 { 0x0112, "WM_SYSCOMMAND" },266 { 0x0113, "WM_TIMER" },267 { 0x0114, "WM_HSCROLL" },268 { 0x0115, "WM_VSCROLL" },269 { 0x0116, "WM_INITMENU" },270 { 0x0117, "WM_INITMENUPOPUP" },271 { 0x011F, "WM_MENUSELECT" },272 { 0x0120, "WM_MENUCHAR" },273 { 0x0121, "WM_ENTERIDLE" },274 { 0x0122, "WM_MENURBUTTONUP" },275 { 0x0123, "WM_MENUDRAG" },276 { 0x0124, "WM_MENUGETOBJECT" },277 { 0x0125, "WM_UNINITMENUPOPUP" },278 { 0x0126, "WM_MENUCOMMAND" },279 { 0x0127, "WM_CHANGEUISTATE" },280 { 0x0128, "WM_UPDATEUISTATE" },281 { 0x0129, "WM_QUERYUISTATE" },282 { 0x0132, "WM_CTLCOLORMSGBOX" },283 { 0x0133, "WM_CTLCOLOREDIT" },284 { 0x0134, "WM_CTLCOLORLISTBOX" },285 { 0x0135, "WM_CTLCOLORBTN" },286 { 0x0136, "WM_CTLCOLORDLG" },287 { 0x0137, "WM_CTLCOLORSCROLLBAR" },288 { 0x0138, "WM_CTLCOLORSTATIC" },289 { 0x0200, "WM_MOUSEMOVE" },290 { 0x0201, "WM_LBUTTONDOWN" },291 { 0x0202, "WM_LBUTTONUP" },292 { 0x0203, "WM_LBUTTONDBLCLK" },293 { 0x0204, "WM_RBUTTONDOWN" },294 { 0x0205, "WM_RBUTTONUP" },295 { 0x0206, "WM_RBUTTONDBLCLK" },296 { 0x0207, "WM_MBUTTONDOWN" },297 { 0x0208, "WM_MBUTTONUP" },298 { 0x0209, "WM_MBUTTONDBLCLK" },299 { 0x020A, "WM_MOUSEWHEEL" },300 { 0x020B, "WM_XBUTTONDOWN" },301 { 0x020C, "WM_XBUTTONUP" },302 { 0x020D, "WM_XBUTTONDBLCLK" },303 { 0x0210, "WM_PARENTNOTIFY" },304 { 0x0211, "WM_ENTERMENULOOP" },305 { 0x0212, "WM_EXITMENULOOP" },306 { 0x0213, "WM_NEXTMENU" },307 { 0x0214, "WM_SIZING" },308 { 0x0215, "WM_CAPTURECHANGED" },309 { 0x0216, "WM_MOVING" },310 { 0x0218, "WM_POWERBROADCAST" },311 { 0x0219, "WM_DEVICECHANGE" },312 { 0x0220, "WM_MDICREATE" },313 { 0x0221, "WM_MDIDESTROY" },314 { 0x0222, "WM_MDIACTIVATE" },315 { 0x0223, "WM_MDIRESTORE" },316 { 0x0224, "WM_MDINEXT" },317 { 0x0225, "WM_MDIMAXIMIZE" },318 { 0x0226, "WM_MDITILE" },319 { 0x0227, "WM_MDICASCADE" },320 { 0x0228, "WM_MDIICONARRANGE" },321 { 0x0229, "WM_MDIGETACTIVE" },322 { 0x0230, "WM_MDISETMENU" },323 { 0x0231, "WM_ENTERSIZEMOVE" },324 { 0x0232, "WM_EXITSIZEMOVE" },325 { 0x0233, "WM_DROPFILES" },326 { 0x0234, "WM_MDIREFRESHMENU" },327 { 0x0281, "WM_IME_SETCONTEXT" },328 { 0x0282, "WM_IME_NOTIFY" },329 { 0x0283, "WM_IME_CONTROL" },330 { 0x0284, "WM_IME_COMPOSITIONFULL" },331 { 0x0285, "WM_IME_SELECT" },332 { 0x0286, "WM_IME_CHAR" },333 { 0x0288, "WM_IME_REQUEST" },334 { 0x0290, "WM_IME_KEYDOWN" },335 { 0x0291, "WM_IME_KEYUP" },336 { 0x02A0, "WM_NCMOUSEHOVER" },337 { 0x02A1, "WM_MOUSEHOVER" },338 { 0x02A2, "WM_NCMOUSELEAVE" },339 { 0x02A3, "WM_MOUSELEAVE" },340 { 0x02B1, "WM_WTSSESSION_CHANGE" },341 { 0x02C0, "WM_TABLET_FIRST" },342 { 0x02C1, "WM_TABLET_FIRST + 1" },343 { 0x02C2, "WM_TABLET_FIRST + 2" },344 { 0x02C3, "WM_TABLET_FIRST + 3" },345 { 0x02C4, "WM_TABLET_FIRST + 4" },346 { 0x02C5, "WM_TABLET_FIRST + 5" },347 { 0x02C6, "WM_TABLET_FIRST + 6" },348 { 0x02C7, "WM_TABLET_FIRST + 7" },349 { 0x02C8, "WM_TABLET_FIRST + 8" },350 { 0x02C9, "WM_TABLET_FIRST + 9" },351 { 0x02CA, "WM_TABLET_FIRST + 10" },352 { 0x02CB, "WM_TABLET_FIRST + 11" },353 { 0x02CC, "WM_TABLET_FIRST + 12" },354 { 0x02CD, "WM_TABLET_FIRST + 13" },355 { 0x02CE, "WM_TABLET_FIRST + 14" },356 { 0x02CF, "WM_TABLET_FIRST + 15" },357 { 0x02D0, "WM_TABLET_FIRST + 16" },358 { 0x02D1, "WM_TABLET_FIRST + 17" },359 { 0x02D2, "WM_TABLET_FIRST + 18" },360 { 0x02D3, "WM_TABLET_FIRST + 19" },361 { 0x02D4, "WM_TABLET_FIRST + 20" },362 { 0x02D5, "WM_TABLET_FIRST + 21" },363 { 0x02D6, "WM_TABLET_FIRST + 22" },364 { 0x02D7, "WM_TABLET_FIRST + 23" },365 { 0x02D8, "WM_TABLET_FIRST + 24" },366 { 0x02D9, "WM_TABLET_FIRST + 25" },367 { 0x02DA, "WM_TABLET_FIRST + 26" },368 { 0x02DB, "WM_TABLET_FIRST + 27" },369 { 0x02DC, "WM_TABLET_FIRST + 28" },370 { 0x02DD, "WM_TABLET_FIRST + 29" },371 { 0x02DE, "WM_TABLET_FIRST + 30" },372 { 0x02DF, "WM_TABLET_LAST" },373 { 0x0300, "WM_CUT" },374 { 0x0301, "WM_COPY" },375 { 0x0302, "WM_PASTE" },376 { 0x0303, "WM_CLEAR" },377 { 0x0304, "WM_UNDO" },378 { 0x0305, "WM_RENDERFORMAT" },379 { 0x0306, "WM_RENDERALLFORMATS" },380 { 0x0307, "WM_DESTROYCLIPBOARD" },381 { 0x0308, "WM_DRAWCLIPBOARD" },382 { 0x0309, "WM_PAINTCLIPBOARD" },383 { 0x030A, "WM_VSCROLLCLIPBOARD" },384 { 0x030B, "WM_SIZECLIPBOARD" },385 { 0x030C, "WM_ASKCBFORMATNAME" },386 { 0x030D, "WM_CHANGECBCHAIN" },387 { 0x030E, "WM_HSCROLLCLIPBOARD" },388 { 0x030F, "WM_QUERYNEWPALETTE" },389 { 0x0310, "WM_PALETTEISCHANGING" },390 { 0x0311, "WM_PALETTECHANGED" },391 { 0x0312, "WM_HOTKEY" },392 { 0x0317, "WM_PRINT" },393 { 0x0318, "WM_PRINTCLIENT" },394 { 0x0319, "WM_APPCOMMAND" },395 { 0x031A, "WM_THEMECHANGED" },396 { 0x0358, "WM_HANDHELDFIRST" },397 { 0x0359, "WM_HANDHELDFIRST + 1" },398 { 0x035A, "WM_HANDHELDFIRST + 2" },399 { 0x035B, "WM_HANDHELDFIRST + 3" },400 { 0x035C, "WM_HANDHELDFIRST + 4" },401 { 0x035D, "WM_HANDHELDFIRST + 5" },402 { 0x035E, "WM_HANDHELDFIRST + 6" },403 { 0x035F, "WM_HANDHELDLAST" },404 { 0x0360, "WM_AFXFIRST" },405 { 0x0361, "WM_AFXFIRST + 1" },406 { 0x0362, "WM_AFXFIRST + 2" },407 { 0x0363, "WM_AFXFIRST + 3" },408 { 0x0364, "WM_AFXFIRST + 4" },409 { 0x0365, "WM_AFXFIRST + 5" },410 { 0x0366, "WM_AFXFIRST + 6" },411 { 0x0367, "WM_AFXFIRST + 7" },412 { 0x0368, "WM_AFXFIRST + 8" },413 { 0x0369, "WM_AFXFIRST + 9" },414 { 0x036A, "WM_AFXFIRST + 10" },415 { 0x036B, "WM_AFXFIRST + 11" },416 { 0x036C, "WM_AFXFIRST + 12" },417 { 0x036D, "WM_AFXFIRST + 13" },418 { 0x036E, "WM_AFXFIRST + 14" },419 { 0x036F, "WM_AFXFIRST + 15" },420 { 0x0370, "WM_AFXFIRST + 16" },421 { 0x0371, "WM_AFXFIRST + 17" },422 { 0x0372, "WM_AFXFIRST + 18" },423 { 0x0373, "WM_AFXFIRST + 19" },424 { 0x0374, "WM_AFXFIRST + 20" },425 { 0x0375, "WM_AFXFIRST + 21" },426 { 0x0376, "WM_AFXFIRST + 22" },427 { 0x0377, "WM_AFXFIRST + 23" },428 { 0x0378, "WM_AFXFIRST + 24" },429 { 0x0379, "WM_AFXFIRST + 25" },430 { 0x037A, "WM_AFXFIRST + 26" },431 { 0x037B, "WM_AFXFIRST + 27" },432 { 0x037C, "WM_AFXFIRST + 28" },433 { 0x037D, "WM_AFXFIRST + 29" },434 { 0x037E, "WM_AFXFIRST + 30" },435 { 0x037F, "WM_AFXLAST" },436 { 0x0380, "WM_PENWINFIRST" },437 { 0x0381, "WM_PENWINFIRST + 1" },438 { 0x0382, "WM_PENWINFIRST + 2" },439 { 0x0383, "WM_PENWINFIRST + 3" },440 { 0x0384, "WM_PENWINFIRST + 4" },441 { 0x0385, "WM_PENWINFIRST + 5" },442 { 0x0386, "WM_PENWINFIRST + 6" },443 { 0x0387, "WM_PENWINFIRST + 7" },444 { 0x0388, "WM_PENWINFIRST + 8" },445 { 0x0389, "WM_PENWINFIRST + 9" },446 { 0x038A, "WM_PENWINFIRST + 10" },447 { 0x038B, "WM_PENWINFIRST + 11" },448 { 0x038C, "WM_PENWINFIRST + 12" },449 { 0x038D, "WM_PENWINFIRST + 13" },450 { 0x038E, "WM_PENWINFIRST + 14" },451 { 0x038F, "WM_PENWINLAST" },452 { 0x0400, "WM_USER" },453 { 0x8000, "WM_APP" },454 { 0,0 }}; // End of known messages455 456 // Looks up the WM_ message in the table above457 const char* findWMstr(uint msg)458 {459 uint i = 0;460 const char* result = 0;461 // Known WM_'s462 while (knownWM[i].str && (knownWM[i].WM != msg))463 ++i;464 result = knownWM[i].str;465 return result;466 };467 468 // Convenience function for converting flags and values into readable strings469 struct FLAG_STRING_STRUCT470 {471 uint value;472 const char* str;473 };474 475 FLAG_STRING_STRUCT FLAG_STRING(int value = 0, const char *c = 0)476 {477 FLAG_STRING_STRUCT s = {value, c};478 return s;479 }480 481 #define FLGSTR(x) FLAG_STRING(x, #x)482 483 // Returns an ORed (" | ") together string for the flags active in the actual484 // value. (...) must consist of FLAG_STRING, with a FLAG_STRING() as the last485 // value in the list passed to the function486 QString flagCheck(uint actual, ...)487 {488 va_list ap;489 va_start(ap, actual);490 491 QString result;492 int count = 0;493 FLAG_STRING_STRUCT v;494 while((v=va_arg(ap,FLAG_STRING_STRUCT)).str) {495 if ((actual & v.value) == v.value) {496 if (count++)497 result += QLatin1String(" | ");498 result += QString::fromLatin1(v.str);499 }500 }501 va_end(ap);502 return result;503 };504 505 // Returns the string representation of the value in 'actual'. (...) must506 // consist of FLAG_STRING, with a FLAG_STRING() as the last value in the list507 // passed to the function508 QString valueCheck(uint actual, ...)509 {510 va_list ap;511 va_start(ap, actual);512 513 QString result;514 FLAG_STRING_STRUCT v;515 while((v=va_arg(ap,FLAG_STRING_STRUCT)).str && (actual != v.value))516 ;517 result = QString::fromLatin1(v.str);518 519 va_end(ap);520 return result;521 };522 523 #ifdef Q_CC_BOR524 525 Q_CORE_EXPORT QString decodeMSG(const MSG& msg)526 {527 return QString::fromLatin1("THis is not supported on Borland");528 }529 530 #else531 532 // Returns a "human readable" string representation of the MSG and the533 // information it points to534 QString decodeMSG(const MSG& msg)535 {536 const WPARAM wParam = msg.wParam;537 const LPARAM lParam = msg.lParam;538 QString wmmsg = QString::fromLatin1(findWMstr(msg.message));539 // Unknown WM_, so use number540 if (wmmsg.isEmpty())541 wmmsg = QString::fromLatin1("WM_(%1)").arg(msg.message);542 543 QString rawParameters;544 rawParameters.sprintf("hwnd(0x%p) ", (void *)msg.hwnd);545 546 // Custom WM_'s547 if (msg.message > WM_APP)548 wmmsg = QString::fromLatin1("WM_APP + %1").arg(msg.message - WM_APP);549 else if (msg.message > WM_USER)550 wmmsg = QString::fromLatin1("WM_USER + %1").arg(msg.message - WM_USER);551 552 QString parameters;553 switch (msg.message) {554 #ifdef WM_ACTIVATE555 case WM_ACTIVATE:556 {557 QString activation = valueCheck(wParam,558 FLAG_STRING(WA_ACTIVE, "Activate"),559 FLAG_STRING(WA_INACTIVE, "Deactivate"),560 FLAG_STRING(WA_CLICKACTIVE, "Activate by mouseclick"),561 FLAG_STRING());562 parameters.sprintf("%s Hwnd (0x%p)", activation.toLatin1().data(), (void *)msg.hwnd);563 }564 break;565 #endif566 #ifdef WM_CAPTURECHANGED567 case WM_CAPTURECHANGED:568 parameters.sprintf("Hwnd gaining capture (0x%p)", (void *)lParam);569 break;570 #endif571 #ifdef WM_CREATE572 case WM_CREATE:573 {574 LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;575 QString styles = flagCheck(lpcs->style,576 FLGSTR(WS_BORDER),577 FLGSTR(WS_CAPTION),578 FLGSTR(WS_CHILD),579 FLGSTR(WS_CLIPCHILDREN),580 FLGSTR(WS_CLIPSIBLINGS),581 FLGSTR(WS_DISABLED),582 FLGSTR(WS_DLGFRAME),583 FLGSTR(WS_GROUP),584 FLGSTR(WS_HSCROLL),585 FLGSTR(WS_OVERLAPPED),586 #if defined(WS_OVERLAPPEDWINDOW) && (WS_OVERLAPPEDWINDOW != 0)587 FLGSTR(WS_OVERLAPPEDWINDOW),588 #endif589 #ifdef WS_ICONIC590 FLGSTR(WS_ICONIC),591 #endif592 FLGSTR(WS_MAXIMIZE),593 FLGSTR(WS_MAXIMIZEBOX),594 FLGSTR(WS_MINIMIZE),595 FLGSTR(WS_MINIMIZEBOX),596 FLGSTR(WS_OVERLAPPEDWINDOW),597 FLGSTR(WS_POPUP),598 #ifdef WS_POPUPWINDOW599 FLGSTR(WS_POPUPWINDOW),600 #endif601 FLGSTR(WS_SIZEBOX),602 FLGSTR(WS_SYSMENU),603 FLGSTR(WS_TABSTOP),604 FLGSTR(WS_THICKFRAME),605 #ifdef WS_TILED606 FLGSTR(WS_TILED),607 #endif608 #ifdef WS_TILEDWINDOW609 FLGSTR(WS_TILEDWINDOW),610 #endif611 FLGSTR(WS_VISIBLE),612 FLGSTR(WS_VSCROLL),613 FLAG_STRING());614 615 QString exStyles = flagCheck(lpcs->dwExStyle,616 #ifdef WS_EX_ACCEPTFILES617 FLGSTR(WS_EX_ACCEPTFILES),618 #endif619 #ifdef WS_EX_APPWINDOW620 FLGSTR(WS_EX_APPWINDOW),621 #endif622 FLGSTR(WS_EX_CLIENTEDGE),623 FLGSTR(WS_EX_DLGMODALFRAME),624 #ifdef WS_EX_LEFT625 FLGSTR(WS_EX_LEFT),626 #endif627 FLGSTR(WS_EX_LEFTSCROLLBAR),628 #ifdef WS_EX_LTRREADING629 FLGSTR(WS_EX_LTRREADING),630 #endif631 #ifdef WS_EX_MDICHILD632 FLGSTR(WS_EX_MDICHILD),633 #endif634 #ifdef WS_EX_NOACTIVATE635 FLGSTR(WS_EX_NOACTIVATE),636 #endif637 #ifdef WS_EX_NOANIMATION638 FLGSTR(WS_EX_NOANIMATION),639 #endif640 FLGSTR(WS_EX_NOPARENTNOTIFY),641 FLGSTR(WS_EX_OVERLAPPEDWINDOW),642 #ifdef WS_EX_PALETTEWINDOW643 FLGSTR(WS_EX_PALETTEWINDOW),644 #endif645 #ifdef WS_EX_RIGHT646 FLGSTR(WS_EX_RIGHT),647 #endif648 #ifdef WS_EX_RIGHTSCROLLBAR649 FLGSTR(WS_EX_RIGHTSCROLLBAR),650 #endif651 #ifdef WS_EX_RTLREADING652 FLGSTR(WS_EX_RTLREADING),653 #endif654 FLGSTR(WS_EX_STATICEDGE),655 FLGSTR(WS_EX_TOOLWINDOW),656 FLGSTR(WS_EX_TOPMOST),657 #ifdef WS_EX_TRANSPARENT658 FLGSTR(WS_EX_TRANSPARENT),659 #endif660 FLGSTR(WS_EX_WINDOWEDGE),661 #ifdef WS_EX_CAPTIONOKBTN662 FLGSTR(WS_EX_CAPTIONOKBTN),663 #endif664 FLAG_STRING());665 666 QString className;667 if (lpcs->lpszClass != 0) {668 if (HIWORD(lpcs->lpszClass) == 0) // Atom669 className = QString::number(LOWORD(lpcs->lpszClass), 16);670 else // String671 className = QString((QChar*)lpcs->lpszClass,672 (int)wcslen(reinterpret_cast<const wchar_t *>(lpcs->lpszClass)));673 }674 675 QString windowName;676 if (lpcs->lpszName != 0)677 windowName = QString((QChar*)lpcs->lpszName,678 (int)wcslen(reinterpret_cast<const wchar_t *>(lpcs->lpszName)));679 680 parameters.sprintf("x,y(%4d,%4d) w,h(%4d,%4d) className(%s) windowName(%s) parent(0x%p) style(%s) exStyle(%s)",681 lpcs->x, lpcs->y, lpcs->cx, lpcs->cy, className.toLatin1().data(),682 windowName.toLatin1().data(), (void *)lpcs->hwndParent,683 styles.toLatin1().data(), exStyles.toLatin1().data());684 }685 break;686 #endif687 #ifdef WM_DESTROY688 case WM_DESTROY:689 parameters.sprintf("Destroy hwnd (0x%p)", (void *)msg.hwnd);690 break;691 #endif692 #ifdef WM_IME_NOTIFY693 case WM_IME_NOTIFY:694 {695 QString imnCommand = valueCheck(wParam,696 FLGSTR(IMN_CHANGECANDIDATE),697 FLGSTR(IMN_CLOSECANDIDATE),698 FLGSTR(IMN_CLOSESTATUSWINDOW),699 FLGSTR(IMN_GUIDELINE),700 FLGSTR(IMN_OPENCANDIDATE),701 FLGSTR(IMN_OPENSTATUSWINDOW),702 FLGSTR(IMN_SETCANDIDATEPOS),703 FLGSTR(IMN_SETCOMPOSITIONFONT),704 FLGSTR(IMN_SETCOMPOSITIONWINDOW),705 FLGSTR(IMN_SETCONVERSIONMODE),706 FLGSTR(IMN_SETOPENSTATUS),707 FLGSTR(IMN_SETSENTENCEMODE),708 FLGSTR(IMN_SETSTATUSWINDOWPOS),709 FLAG_STRING());710 parameters.sprintf("Command(%s : 0x%p)", imnCommand.toLatin1().data(), (void *)lParam);711 }712 break;713 #endif714 #ifdef WM_IME_SETCONTEXT715 case WM_IME_SETCONTEXT:716 {717 bool fSet = (BOOL)wParam;718 DWORD fShow = (DWORD)lParam;719 QString showFlgs = flagCheck(fShow,720 #ifdef ISC_SHOWUICOMPOSITIONWINDOW721 FLGSTR(ISC_SHOWUICOMPOSITIONWINDOW),722 #endif723 #ifdef ISC_SHOWUIGUIDWINDOW724 FLGSTR(ISC_SHOWUIGUIDWINDOW),725 #endif726 #ifdef ISC_SHOWUISOFTKBD727 FLGSTR(ISC_SHOWUISOFTKBD),728 #endif729 FLGSTR(ISC_SHOWUICANDIDATEWINDOW),730 FLGSTR(ISC_SHOWUICANDIDATEWINDOW << 1),731 FLGSTR(ISC_SHOWUICANDIDATEWINDOW << 2),732 FLGSTR(ISC_SHOWUICANDIDATEWINDOW << 3),733 FLAG_STRING());734 parameters.sprintf("Input context(%s) Show flags(%s)", (fSet?"Active":"Inactive"), showFlgs.toLatin1().data());735 }736 break;737 #endif738 #ifdef WM_KILLFOCUS739 case WM_KILLFOCUS:740 parameters.sprintf("Hwnd gaining keyboard focus (0x%p)", (void *)wParam);741 break;742 #endif743 #ifdef WM_CHAR744 case WM_CHAR:745 #endif746 #ifdef WM_IME_CHAR747 case WM_IME_CHAR:748 #endif749 #ifdef WM_KEYDOWN750 case WM_KEYDOWN:751 #endif752 #ifdef WM_KEYUP753 case WM_KEYUP:754 {755 int nVirtKey = (int)wParam;756 long lKeyData = (long)lParam;757 int repCount = (lKeyData & 0xffff); // Bit 0-15758 int scanCode = (lKeyData & 0xf0000) >> 16; // Bit 16-23759 bool contextCode = (lKeyData && 0x20000000); // Bit 29760 bool prevState = (lKeyData && 0x40000000); // Bit 30761 bool transState = (lKeyData && 0x80000000); // Bit 31762 parameters.sprintf("Virual-key(0x%x) Scancode(%d) Rep(%d) Contextcode(%d), Prev state(%d), Trans state(%d)",763 nVirtKey, scanCode, repCount, contextCode, prevState, transState);764 }765 break;766 #endif767 #ifdef WM_NCACTIVATE768 case WM_NCACTIVATE:769 {770 parameters = (msg.wParam? QLatin1String("Active Titlebar") : QLatin1String("Inactive Titlebar"));771 }772 break;773 #endif774 #ifdef WM_MOUSEACTIVATE775 case WM_MOUSEACTIVATE:776 {777 QString mouseMsg = QString::fromLatin1(findWMstr(HIWORD(lParam)));778 parameters.sprintf("TLW(0x%p) HittestCode(0x%x) MouseMsg(%s)", (void *)wParam, LOWORD(lParam), mouseMsg.toLatin1().data());779 }780 break;781 #endif782 #ifdef WM_MOUSELEAVE783 case WM_MOUSELEAVE:784 break; // wParam & lParam not used785 #endif786 #ifdef WM_MOUSEHOVER787 case WM_MOUSEHOVER:788 #endif789 #ifdef WM_MOUSEWHEEL790 case WM_MOUSEWHEEL:791 #endif792 #ifdef WM_LBUTTONDBLCLK793 case WM_LBUTTONDBLCLK:794 #endif795 #ifdef WM_LBUTTONDOWN796 case WM_LBUTTONDOWN:797 #endif798 #ifdef WM_LBUTTONUP799 case WM_LBUTTONUP:800 #endif801 #ifdef WM_MBUTTONDBLCLK802 case WM_MBUTTONDBLCLK:803 #endif804 #ifdef WM_MBUTTONDOWN805 case WM_MBUTTONDOWN:806 #endif807 #ifdef WM_MBUTTONUP808 case WM_MBUTTONUP:809 #endif810 #ifdef WM_RBUTTONDBLCLK811 case WM_RBUTTONDBLCLK:812 #endif813 #ifdef WM_RBUTTONDOWN814 case WM_RBUTTONDOWN:815 #endif816 #ifdef WM_RBUTTONUP817 case WM_RBUTTONUP:818 #endif819 #ifdef WM_MOUSEMOVE820 case WM_MOUSEMOVE:821 {822 QString vrtKeys = flagCheck(wParam,823 FLGSTR(MK_CONTROL),824 FLGSTR(MK_LBUTTON),825 FLGSTR(MK_MBUTTON),826 FLGSTR(MK_RBUTTON),827 FLGSTR(MK_SHIFT),828 #ifdef MK_XBUTTON1829 FLGSTR(MK_XBUTTON1),830 #endif831 #ifdef MK_XBUTTON2832 FLGSTR(MK_XBUTTON2),833 #endif834 FLAG_STRING());835 parameters.sprintf("x,y(%4d,%4d) Virtual Keys(%s)", GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), vrtKeys.toLatin1().data());836 }837 break;838 #endif839 #ifdef WM_MOVE840 case WM_MOVE:841 parameters.sprintf("x,y(%4d,%4d)", LOWORD(lParam), HIWORD(lParam));842 break;843 #endif844 #if defined(WM_PAINT) && defined(WM_ERASEBKGND)845 case WM_ERASEBKGND:846 case WM_PAINT:847 parameters.sprintf("hdc(0x%p)", (void *)wParam);848 break;849 #endif850 #ifdef WM_QUERYNEWPALETTE851 case WM_QUERYNEWPALETTE:852 break; // lParam & wParam are unused853 #endif854 #ifdef WM_SETCURSOR855 case WM_SETCURSOR:856 {857 QString mouseMsg = QString::fromLatin1(findWMstr(HIWORD(lParam)));858 parameters.sprintf("HitTestCode(0x%x) MouseMsg(%s)", LOWORD(lParam), mouseMsg.toLatin1().data());859 }860 break;861 #endif862 #ifdef WM_SETFOCUS863 case WM_SETFOCUS:864 parameters.sprintf("Lost Focus (0x%p)", (void *)wParam);865 break;866 #endif867 #ifdef WM_SETTEXT868 case WM_SETTEXT:869 parameters.sprintf("Set Text (%s)", QString((QChar*)lParam, (int)wcslen(reinterpret_cast<const wchar_t *>(lParam))).toLatin1().data()); //Unicode string870 break;871 #endif872 #ifdef WM_SIZE873 case WM_SIZE:874 {875 QString showMode = valueCheck(wParam,876 FLGSTR(SIZE_MAXHIDE),877 FLGSTR(SIZE_MAXIMIZED),878 FLGSTR(SIZE_MAXSHOW),879 FLGSTR(SIZE_MINIMIZED),880 FLGSTR(SIZE_RESTORED),881 FLAG_STRING());882 883 parameters.sprintf("w,h(%4d,%4d) showmode(%s)", LOWORD(lParam), HIWORD(lParam), showMode.toLatin1().data());884 }885 break;886 #endif887 #ifdef WM_WINDOWPOSCHANGED888 case WM_WINDOWPOSCHANGED:889 {890 LPWINDOWPOS winPos = (LPWINDOWPOS)lParam;891 if (!winPos)892 break;893 QString hwndAfter = valueCheck((uint)winPos->hwndInsertAfter,894 FLAG_STRING((uint)HWND_BOTTOM, "HWND_BOTTOM"),895 FLAG_STRING((int)HWND_NOTOPMOST, "HWND_NOTOPMOST"),896 FLAG_STRING((uint)HWND_TOP, "HWND_TOP"),897 FLAG_STRING((int)HWND_TOPMOST, "HWND_TOPMOST"),898 FLAG_STRING());899 if (hwndAfter.size() == 0)900 hwndAfter = QString::number((uint)winPos->hwndInsertAfter, 16);901 QString flags = flagCheck(winPos->flags,902 FLGSTR(SWP_DRAWFRAME),903 FLGSTR(SWP_FRAMECHANGED),904 FLGSTR(SWP_HIDEWINDOW),905 FLGSTR(SWP_NOACTIVATE),906 #ifdef SWP_NOCOPYBITS907 FLGSTR(SWP_NOCOPYBITS),908 #endif909 FLGSTR(SWP_NOMOVE),910 FLGSTR(SWP_NOOWNERZORDER),911 FLGSTR(SWP_NOREDRAW),912 FLGSTR(SWP_NOREPOSITION),913 #ifdef SWP_NOSENDCHANGING914 FLGSTR(SWP_NOSENDCHANGING),915 #endif916 FLGSTR(SWP_NOSIZE),917 FLGSTR(SWP_NOZORDER),918 FLGSTR(SWP_SHOWWINDOW),919 FLAG_STRING());920 parameters.sprintf("x,y(%4d,%4d) w,h(%4d,%4d) flags(%s) hwndAfter(%s)", winPos->x, winPos->y, winPos->cx, winPos->cy, flags.toLatin1().data(), hwndAfter.toLatin1().data());921 }922 break;923 #endif924 default:925 parameters.sprintf("wParam(0x%p) lParam(0x%p)", (void *)wParam, (void *)lParam);926 break;927 }928 // Yes, we want to give the WM_ names 20 chars of space before showing the929 // decoded message, since some of the common messages are quite long, and930 // we don't want the decoded information to vary in output position931 QString message = QString::fromLatin1("%1: ").arg(wmmsg, 20);932 message += rawParameters;933 message += parameters;934 return message;935 }936 937 #endif938 939 QDebug operator<<(QDebug dbg, const MSG &msg)940 {941 dbg << decodeMSG(msg);942 return dbg.nospace();943 }944 #endif945 946 133 QT_END_NAMESPACE
Note:
See TracChangeset
for help on using the changeset viewer.