Changeset 605


Ignore:
Timestamp:
Feb 26, 2010, 12:33:58 AM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: Cleaned up debug printing: get rid of qStr*() functions and use cross-platform qDebugFmt*() instead.

Location:
trunk/src/gui
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/kernel/qapplication_pm.cpp

    r603 r605  
    451451}
    452452
     453
     454
     455
     456
     457
     458
     459
     460
     461
     462
     463
     464
     465
     466
     467
     468
    453469// application no-grab option
    454470bool qt_nograb()
     
    700716        return 0;
    701717
    702     QWidget *w = qWidgetFromHWND(hwnd);
     718    QWidget *w = q(hwnd);
    703719    return w ? w->window() : 0;
    704720}
     
    796812
    797813#if defined(QT_DEBUGMSGFLOW)
    798         {
    799             QDbgStr str = qStrQMSG(qmsg);
    800             if (!str.isEmpty())
    801                 qDebug() << "*** [W]" << str;
    802         }
     814        if (qmsg.msg != WM_QUERYICON)
     815            qDebug() << "*** [W]" << qmsg;
    803816#endif
    804817
     
    12691282
    12701283#if defined(QT_DEBUGMSGFLOW)
    1271         {
    1272             QDbgStr str = qStrQMSG(qmsg);
    1273             if (!str.isEmpty())
    1274                 qDebug() << "*** [F]" << str;
    1275         }
     1284        if (qmsg.msg != WM_QUERYICON)
     1285            qDebug() << "*** [F]" << qmsg;
    12761286#endif
    12771287
     
    13681378
    13691379#if defined(QT_DEBUGMSGFLOW)
    1370         {
    1371             QDbgStr str = qStrQMSG(qmsg);
    1372             if (!str.isEmpty())
    1373                 qDebug() << "*** [FC]" << str;
    1374         }
     1380        if (qmsg.msg != WM_QUERYICON)
     1381            qDebug() << "*** [FC]" << qmsg;
    13751382#endif
    13761383
     
    15381545            setAutoCapture(popup->d_func()->frameWinId()); // grab mouse/keyboard
    15391546        }
    1540         if (!qWidgetFromHWND(WinQueryActiveWindow(HWND_DESKTOP))) {
     1547        if (!q(WinQueryActiveWindow(HWND_DESKTOP))) {
    15411548            // the popup is opened while another application is active. Steal
    15421549            // the focus (to receive keyboard input and to make sure we get
     
    22672274
    22682275#if defined(QT_DEBUGMSGFLOW)
    2269     qDebug() << " PAINT BEGIN:" << rcl << "hps:" << qStrHPS(d_func()->hd);
     2276    qDebug() << "(d_func()->hd);
    22702277#endif
    22712278
     
    22872294    updRect.translate(data->wrect.topLeft());
    22882295#if defined(QT_DEBUGMSGFLOW)
    2289     qDebug() << " PAINT updRect:" << updRect;
     2296    qDebug() << "PAINT updRect:" << updRect;
    22902297#endif
    22912298
     
    22972304
    22982305#if defined(QT_DEBUGMSGFLOW)
    2299     qDebug() << " PAINT END";
     2306    qDebug() << "PAINT END";
    23002307#endif
    23012308
     
    25522559 *****************************************************************************/
    25532560
    2554 /*!
    2555     Returns a QWidget pointer or 0 if there is no widget corresponding to the
    2556     given HWND. As opposed to QWidget::find(), correctly handles WC_FRAME
    2557     windows created for top level widgets. Used for debugging.
    2558  */
    2559 QWidget *qWidgetFromHWND(HWND hwnd)
    2560 {
    2561     char buf[10];
    2562     if (WinQueryClassName(hwnd, sizeof(buf), buf)) {
    2563         if (!strcmp(buf, "#1")) // WC_FRAME
    2564             hwnd = WinWindowFromID(hwnd, FID_CLIENT);
    2565         return QWidget::find(hwnd);
    2566     }
    2567     return 0;
    2568 }
    2569 
    2570 /*!
    2571     \internal
    2572 
    2573     Returns a human readable widget name in the form "class/name". Used for
    2574     debugging.
    2575  */
    2576 QDbgStr qWidgetName(QWidget *w)
    2577 {
    2578     if (w)
    2579         return QString()
    2580             .sprintf("%s.%s", w->metaObject()->className(),
    2581                      w->objectName().isEmpty() ? "<noname>" :
    2582                      w->objectName().toUtf8().constData());
    2583     return QString(QLatin1String("<no-widget>"));
    2584 }
    2585 
    2586 typedef QLatin1String QCStr;
     2561QDebug operator<<(QDebug debug, const QDebugHWND &d)
     2562{
     2563    debug << qDebugFmtHex(d.hwnd) << qt_widget_from_hwnd(d.hwnd);
     2564    return debug;
     2565}
     2566
     2567QDebug operator<<(QDebug debug, const RECTL &rcl)
     2568{
     2569    debug.nospace() << "RECTL(" << rcl.xLeft << "," << rcl.yBottom
     2570                    << " " << rcl.xRight << "," << rcl.yTop << ")";
     2571    return debug.space();
     2572}
    25872573
    25882574#define myDefFlagEx(var,fl,varstr,flstr) if (var & fl) { \
    2589     if (!varstr.isEmpty()) varstr += QCStr("|"); varstr += QCStr(flstr); \
     2575    if (!varstr.isEmpty()) varstr += ; \
    25902576} else do {} while(0)
    25912577
     
    25932579#define myDefFlagCut(var,fl,varstr,pos) myDefFlagEx(var,fl,varstr,#fl + pos)
    25942580
    2595 QDbgStr qStrHWND(HWND hwnd)
    2596 {
    2597     return QString().sprintf("%08lX/", hwnd) +
    2598            qWidgetName(qWidgetFromHWND(hwnd));
    2599 }
    2600 
    2601 QDbgStr qStrHPS(HPS hps)
    2602 {
    2603     return QString().sprintf("%08lX", hps);
    2604 }
    2605 
    2606 QDbgStr qStrHPOINTER(HPOINTER hptr)
    2607 {
    2608     return QString().sprintf("%08lX", hptr);
    2609 }
    2610 
    2611 QDbgStr qStrHRGN(HRGN hrgn)
    2612 {
    2613     return QString().sprintf("%08lX", hrgn);
    2614 }
    2615 
    2616 QDbgStr qStrQMSG(const QMSG &qmsg)
    2617 {
    2618     QString str;
    2619 
    2620     #define myCaseBegin(a) case a: { \
    2621         str = QString().sprintf(#a ": hwnd %08lX.", qmsg.hwnd); \
    2622         str += qWidgetName(qWidgetFromHWND(qmsg.hwnd));
    2623     #define myCaseEnd() }
    2624 
    2625     switch (qmsg.msg) {
    2626 
    2627     myCaseBegin(WM_CHAR)
    2628         USHORT fl = SHORT1FROMMP(qmsg.mp1);
    2629         UCHAR repeat = CHAR3FROMMP(qmsg.mp1);
    2630         UCHAR scan = CHAR4FROMMP(qmsg.mp1);
    2631         USHORT ch = SHORT1FROMMP(qmsg.mp2);
    2632         USHORT vk = SHORT2FROMMP(qmsg.mp2);
    2633         str += QString().
    2634             sprintf(" rep %02d scan %02X ch %04X (%s) vk %04X",
    2635                     repeat, scan, ch, (ch > 32 && ch < 254) ?
    2636                     qPrintable(QString::fromLocal8Bit((char *)&ch, 1)) :
    2637                     qPrintable(QString(QChar(QLatin1Char(' ')))), vk);
    2638         QString flstr;
    2639         myDefFlagEx(fl, KC_CHAR, flstr, "CHAR");
    2640         myDefFlagEx(fl, KC_VIRTUALKEY, flstr, "VIRT");
    2641         myDefFlagEx(fl, KC_SCANCODE, flstr, "SCAN");
    2642         myDefFlagEx(fl, KC_SHIFT, flstr, "SHIFT");
    2643         myDefFlagEx(fl, KC_CTRL, flstr, "CTRL");
    2644         myDefFlagEx(fl, KC_ALT, flstr, "ALT");
    2645         myDefFlagEx(fl, KC_KEYUP, flstr, "UP");
    2646         myDefFlagEx(fl, KC_PREVDOWN, flstr, "PREVDWN");
    2647         myDefFlagEx(fl, KC_LONEKEY, flstr, "LONE");
    2648         myDefFlagEx(fl, KC_DEADKEY, flstr, "DEAD");
    2649         myDefFlagEx(fl, KC_COMPOSITE, flstr, "COMP");
    2650         myDefFlagEx(fl, KC_INVALIDCOMP, flstr, "INVCMP");
    2651         myDefFlagEx(fl, KC_TOGGLE, flstr, "TGGL");
    2652         myDefFlagEx(fl, KC_INVALIDCHAR, flstr, "INVCHR");
    2653         str += QString().sprintf(" KC(%04X,", fl) + flstr + QCStr(")");
    2654         break;
    2655     myCaseEnd()
    2656 
    2657     myCaseBegin(WM_KBDLAYERCHANGED)
    2658         str += QString().sprintf(" mp1 %p mp2 %p", qmsg.mp1, qmsg.mp2);
    2659         break;
    2660     myCaseEnd()
    2661 
    2662     myCaseBegin(WM_PAINT)
    2663         break;
    2664     myCaseEnd()
    2665 
    2666     myCaseBegin(WM_SIZE)
    2667         str += QString().
    2668             sprintf(" old (%hd,%hd) new (%hd,%hd)",
    2669                     SHORT1FROMMP(qmsg.mp1), SHORT2FROMMP(qmsg.mp1),
    2670                     SHORT1FROMMP(qmsg.mp2), SHORT2FROMMP(qmsg.mp2));
    2671         SWP swp;
    2672         WinQueryWindowPos(qmsg.hwnd, &swp);
    2673         str += QCStr(" ") + qStrSWP(swp);
    2674         HWND p = WinQueryWindow(qmsg.hwnd, QW_PARENT);
    2675         if (p != NULLHANDLE && p != WinQueryDesktopWindow(0, 0)) {
    2676             WinQueryWindowPos(p, &swp);
    2677             str += QCStr(" p ") + qStrSWP(swp);
    2678         }
    2679         break;
    2680     myCaseEnd()
    2681 
    2682     myCaseBegin(WM_MOVE)
    2683         SWP swp;
    2684         WinQueryWindowPos(qmsg.hwnd, &swp);
    2685         str += QCStr(" ") + qStrSWP(swp);
    2686         HWND p = WinQueryWindow(qmsg.hwnd, QW_PARENT);
    2687         if (p != NULLHANDLE && p != WinQueryDesktopWindow(0, 0)) {
    2688             WinQueryWindowPos(p, &swp);
    2689             str += QCStr(" p ") + qStrSWP(swp);
    2690         }
    2691         break;
    2692     myCaseEnd()
    2693 
    2694     myCaseBegin(WM_WINDOWPOSCHANGED)
    2695         str += QCStr(" ") + qStrSWP(*((PSWP) qmsg.mp1));
    2696         ULONG awp = LONGFROMMP(qmsg.mp2);
    2697         QString awpstr;
    2698         myDefFlagEx(awp, AWP_MINIMIZED, awpstr, "MIN");
    2699         myDefFlagEx(awp, AWP_MAXIMIZED, awpstr, "MAX");
    2700         myDefFlagEx(awp, AWP_RESTORED, awpstr, "REST");
    2701         myDefFlagEx(awp, AWP_ACTIVATE, awpstr, "ACT");
    2702         myDefFlagEx(awp, AWP_DEACTIVATE, awpstr, "DEACT");
    2703         str += QCStr(" AWP(") + awpstr + QCStr(")");
    2704         break;
    2705     myCaseEnd()
    2706 
    2707     myCaseBegin(WM_MINMAXFRAME)
    2708         str += QCStr(" ") + qStrSWP(*((PSWP) qmsg.mp1));
    2709         break;
    2710     myCaseEnd()
    2711 
    2712     myCaseBegin(WM_ACTIVATE)
    2713         bool active = SHORT1FROMMP(qmsg.mp1);
    2714         HWND hwnd = (HWND)qmsg.mp2;
    2715         str += QCStr(" Active(") + QCStr(active ? "TRUE) " : "FALSE)");
    2716         str += QString().sprintf(" hwndActive %08lX.", hwnd);
    2717         str += qWidgetName(qWidgetFromHWND(hwnd));
    2718         break;
    2719     myCaseEnd()
    2720 
    2721     myCaseBegin(WM_SETFOCUS)
    2722         HWND hwnd = (HWND)qmsg.mp1;
    2723         bool focus = SHORT1FROMMP(qmsg.mp2);
    2724         str += QCStr(" Focus(") + QCStr(focus ? "TRUE) " : "FALSE)");
    2725         str += QString().sprintf(" hwndFocus %08lX.", hwnd);
    2726         str += qWidgetName(qWidgetFromHWND(hwnd));
    2727         break;
    2728     myCaseEnd()
    2729 
    2730     myCaseBegin(WM_FOCUSCHANGE)
    2731         HWND hwnd = (HWND)qmsg.mp1;
    2732         bool focus = SHORT1FROMMP(qmsg.mp2);
    2733         bool fl = SHORT2FROMMP(qmsg.mp2);
    2734         QString flstr;
    2735         myDefFlagEx(fl, FC_NOSETFOCUS, flstr, "NOSETFCS");
    2736         myDefFlagEx(fl, FC_NOLOSEFOCUS, flstr, "NOLOSEFCS");
    2737         myDefFlagEx(fl, FC_NOSETACTIVE, flstr, "NOSETACT");
    2738         myDefFlagEx(fl, FC_NOLOSEACTIVE, flstr, "NOLOSEACT");
    2739         myDefFlagEx(fl, FC_NOSETSELECTION, flstr, "NOSETSEL");
    2740         myDefFlagEx(fl, FC_NOLOSESELECTION, flstr, "NOSETSEL");
    2741         str += QCStr(" Focus(") + QCStr(focus ? "TRUE) " : "FALSE)");
    2742         str += QString().sprintf(" hwndFocus %08lX.", hwnd);
    2743         str += qWidgetName(qWidgetFromHWND(hwnd));
    2744         str += QCStr(" FC(") + flstr + QCStr(")");
    2745         break;
    2746     myCaseEnd()
    2747 
    2748     default:
    2749 #if 0
    2750         if (qmsg.msg == WM_QUERYICON)
    2751             break;
    2752         str = QString().sprintf("WM_%04lX: hwnd %08lX.", qmsg.msg, qmsg.hwnd);
    2753         str += qWidgetName(qWidgetFromHWND(qmsg.hwnd));
    2754 #endif
    2755         break;
    2756     }
    2757 
    2758     return str;
    2759 
    2760     #undef myCaseEnd
    2761     #undef myCaseBegin
    2762 }
    2763 
    2764 QDbgStr qStrRECTL(const RECTL &rcl)
    2765 {
    2766     return QString().sprintf("RECTL(%ld,%ld %ld,%ld)",
    2767                              rcl.xLeft, rcl.yBottom, rcl.xRight, rcl.yTop);
    2768 }
    2769 
    2770 QDbgStr qStrSWP(const SWP &swp)
    2771 {
    2772     QString fl;
     2581QDebug operator<<(QDebug debug, const SWP &swp)
     2582{
     2583    QByteArray fl;
    27732584    myDefFlagEx(swp.fl, SWP_SIZE, fl, "SIZE");
    27742585    myDefFlagEx(swp.fl, SWP_MOVE, fl, "MOVE");
     
    27882599    myDefFlagEx(swp.fl, SWP_NOAUTOCLOSE, fl, "NOACLOSE");
    27892600
    2790     return QString().sprintf("SWP(%ld,%ld %ldx%ld %08lX ",
    2791                              swp.x, swp.y, swp.cx, swp.cy, swp.hwndInsertBehind) +
    2792         fl + QLatin1String(")");
     2601    debug.nospace() << "SWP(" << swp.x << "," << swp.y
     2602                    << " " << swp.cx << "x" << swp.cy << " "
     2603                    << qDebugFmtHex(swp.hwndInsertBehind)
     2604                    << fl.constData() << ")";
     2605    return debug.space();
     2606}
     2607
     2608QDebug operator<<(QDebug debug, const QMSG &qmsg)
     2609{
     2610    #define myCaseBegin(a) case a: { \
     2611        debug << #a": hwnd" << qDebugHWND(qmsg.hwnd);
     2612    #define myCaseEnd() }
     2613
     2614    switch (qmsg.msg) {
     2615
     2616    myCaseBegin(WM_CHAR)
     2617        USHORT fl = SHORT1FROMMP(qmsg.mp1);
     2618        UCHAR repeat = CHAR3FROMMP(qmsg.mp1);
     2619        UCHAR scan = CHAR4FROMMP(qmsg.mp1);
     2620        USHORT ch = SHORT1FROMMP(qmsg.mp2);
     2621        USHORT vk = SHORT2FROMMP(qmsg.mp2);
     2622        QByteArray flstr;
     2623        myDefFlagEx(fl, KC_CHAR, flstr, "CHAR");
     2624        myDefFlagEx(fl, KC_VIRTUALKEY, flstr, "VIRT");
     2625        myDefFlagEx(fl, KC_SCANCODE, flstr, "SCAN");
     2626        myDefFlagEx(fl, KC_SHIFT, flstr, "SHIFT");
     2627        myDefFlagEx(fl, KC_CTRL, flstr, "CTRL");
     2628        myDefFlagEx(fl, KC_ALT, flstr, "ALT");
     2629        myDefFlagEx(fl, KC_KEYUP, flstr, "UP");
     2630        myDefFlagEx(fl, KC_PREVDOWN, flstr, "PREVDWN");
     2631        myDefFlagEx(fl, KC_LONEKEY, flstr, "LONE");
     2632        myDefFlagEx(fl, KC_DEADKEY, flstr, "DEAD");
     2633        myDefFlagEx(fl, KC_COMPOSITE, flstr, "COMP");
     2634        myDefFlagEx(fl, KC_INVALIDCOMP, flstr, "INVCMP");
     2635        myDefFlagEx(fl, KC_TOGGLE, flstr, "TGGL");
     2636        myDefFlagEx(fl, KC_INVALIDCHAR, flstr, "INVCHR");
     2637
     2638        debug << "rep" << qDebugFmt("%02d", repeat)
     2639              << "scan" << qDebugFmtHex(scan) << "ch" << qDebugFmtHex(ch)
     2640              << ((ch > 32 && ch < 254) ? QString::fromLocal8Bit((char *)&ch, 1) :
     2641                                          QString(QLatin1String(" ")))
     2642              << "vk" << qDebugFmtHex(vk);
     2643        debug.nospace() << "KC(" << qDebugFmtHex(fl) << ","
     2644                        << flstr.constData() << ")";
     2645        debug.space();
     2646        break;
     2647    myCaseEnd()
     2648
     2649    myCaseBegin(WM_KBDLAYERCHANGED)
     2650        debug << "mp1" << qmsg.mp1 << "mp2" << qmsg.mp2;
     2651        break;
     2652    myCaseEnd()
     2653
     2654    myCaseBegin(WM_PAINT)
     2655        debug << "mp1" << qmsg.mp1 << "mp2" << qmsg.mp2;
     2656        break;
     2657    myCaseEnd()
     2658
     2659    myCaseBegin(WM_SIZE)
     2660        SWP swp;
     2661        WinQueryWindowPos(qmsg.hwnd, &swp);
     2662        debug << "old " << SHORT1FROMMP(qmsg.mp1) << SHORT2FROMMP(qmsg.mp1)
     2663              << "new " << SHORT1FROMMP(qmsg.mp2) << SHORT2FROMMP(qmsg.mp2)
     2664              << swp;
     2665        HWND p = WinQueryWindow(qmsg.hwnd, QW_PARENT);
     2666        if (p != NULLHANDLE && p != WinQueryDesktopWindow(0, 0)) {
     2667            WinQueryWindowPos(p, &swp);
     2668            debug << "parent" << swp;
     2669        }
     2670        break;
     2671    myCaseEnd()
     2672
     2673    myCaseBegin(WM_MOVE)
     2674        SWP swp;
     2675        WinQueryWindowPos(qmsg.hwnd, &swp);
     2676        debug << swp;
     2677        HWND p = WinQueryWindow(qmsg.hwnd, QW_PARENT);
     2678        if (p != NULLHANDLE && p != WinQueryDesktopWindow(0, 0)) {
     2679            WinQueryWindowPos(p, &swp);
     2680            debug << "parent" << swp;
     2681        }
     2682        break;
     2683    myCaseEnd()
     2684
     2685    myCaseBegin(WM_WINDOWPOSCHANGED)
     2686        debug << *((PSWP) qmsg.mp1);
     2687        ULONG awp = LONGFROMMP(qmsg.mp2);
     2688        QByteArray awpstr;
     2689        myDefFlagEx(awp, AWP_MINIMIZED, awpstr, "MIN");
     2690        myDefFlagEx(awp, AWP_MAXIMIZED, awpstr, "MAX");
     2691        myDefFlagEx(awp, AWP_RESTORED, awpstr, "REST");
     2692        myDefFlagEx(awp, AWP_ACTIVATE, awpstr, "ACT");
     2693        myDefFlagEx(awp, AWP_DEACTIVATE, awpstr, "DEACT");
     2694        debug.nospace() << "AWP(" << awpstr.constData() << ")";
     2695        debug.space();
     2696        break;
     2697    myCaseEnd()
     2698
     2699    myCaseBegin(WM_MINMAXFRAME)
     2700        debug << *((PSWP) qmsg.mp1);
     2701        break;
     2702    myCaseEnd()
     2703
     2704    myCaseBegin(WM_ACTIVATE)
     2705        bool active = SHORT1FROMMP(qmsg.mp1);
     2706        HWND hwnd = (HWND)qmsg.mp2;
     2707        debug.nospace() << "Active(" << (active ? "TRUE)" : "FALSE)");
     2708        debug.space() << "hwndActive" << qDebugHWND(hwnd);
     2709        break;
     2710    myCaseEnd()
     2711
     2712    myCaseBegin(WM_SETFOCUS)
     2713        HWND hwnd = (HWND)qmsg.mp1;
     2714        bool focus = SHORT1FROMMP(qmsg.mp2);
     2715        debug.nospace() << "Focus(" << (focus ? "TRUE) " : "FALSE)");
     2716        debug.space() << "hwndFocus" << qDebugHWND(hwnd);
     2717        break;
     2718    myCaseEnd()
     2719
     2720    myCaseBegin(WM_FOCUSCHANGE)
     2721        HWND hwnd = (HWND)qmsg.mp1;
     2722        bool focus = SHORT1FROMMP(qmsg.mp2);
     2723        bool fl = SHORT2FROMMP(qmsg.mp2);
     2724        QByteArray flstr;
     2725        myDefFlagEx(fl, FC_NOSETFOCUS, flstr, "NOSETFCS");
     2726        myDefFlagEx(fl, FC_NOLOSEFOCUS, flstr, "NOLOSEFCS");
     2727        myDefFlagEx(fl, FC_NOSETACTIVE, flstr, "NOSETACT");
     2728        myDefFlagEx(fl, FC_NOLOSEACTIVE, flstr, "NOLOSEACT");
     2729        myDefFlagEx(fl, FC_NOSETSELECTION, flstr, "NOSETSEL");
     2730        myDefFlagEx(fl, FC_NOLOSESELECTION, flstr, "NOSETSEL");
     2731        debug.nospace() << "Focus(" << (focus ? "TRUE) " : "FALSE)");
     2732        debug.space() << "hwndFocus" << qDebugHWND(hwnd);
     2733        debug.nospace() << "FC(" << flstr.constData() << ")";
     2734        debug.space();
     2735        break;
     2736    myCaseEnd()
     2737
     2738    default:
     2739        debug.nospace() << "WM_" << qDebugFmtHex(qmsg.msg) << ":";
     2740        debug.space() << qDebugHWND(qmsg.hwnd);
     2741        debug << "mp1" << qmsg.mp1 << "mp2" << qmsg.mp2;
     2742        break;
     2743    }
     2744
     2745    return debug;
     2746
     2747    #undef myCaseEnd
     2748    #undef myCaseBegin
    27932749}
    27942750
  • trunk/src/gui/kernel/qwidget_pm.cpp

    r603 r605  
    150150{
    151151#if defined(QT_DEBUGWIDGETMASK)
    152     qDebug("qt_WinInvalidateRegionEx: hwnd=%s hwndFrom=%08lX hwndTo=%08lX",
    153            qStrHWND(hwnd).toUtf8().constData(), hwndFrom, hwndTo);
     152    qDebug() << "qt_WinInvalidateRegionEx: hwnd" << qDebugHWND(hwnd)
     153             << "hwndFrom" << qDebugFmtHex(hwndFrom)
     154             << "hwndTo" << qDebugFmtHex(hwndTo);
    154155#endif
    155156
     
    179180        WinQueryWindowPos(child, &swp);
    180181#if defined(QT_DEBUGWIDGETMASK)
    181         qDebug(" child=%s [fl=%08lX]", qStrHWND(child).toUtf8().constData(),
    182                swp.fl);
     182        qDebug() << " child" << qDebugHWND(child) << "fl" << qDebugFmtHex(swp.fl);
    183183#endif
    184184        // proceed only if not hidden
     
    264264
    265265#if defined(QT_DEBUGWIDGETMASK)
    266     qDebug("qt_WinProcessWindowObstacles: hwnd=%s, prcl=%p "
    267            "hrgn=%08lX, op=%ld flags=%08lX",
    268            qStrHWND(hwnd).toUtf8().constData(), prcl, hrgn, op, flags);
     266    qDebug(
     267           
     268           flags);
    269269#endif
    270270
     
    316316                WinQueryWindowPos(relative, &swp);
    317317#if defined(QT_DEBUGWIDGETMASK)
    318                 qDebug(" child=%s [fl=%08lX]",
    319                        qStrHWND(relative).toUtf8().constData(), swp.fl);
     318                qDebug(
     319                       swp.fl);
    320320#endif
    321321                // skip if hidden
     
    356356            WinQueryWindowPos(relative, &swp);
    357357#if defined(QT_DEBUGWIDGETMASK)
    358             qDebug(" sibling=%s [fl=%08lX]",
    359                    qStrHWND(relative).toUtf8().constData(), swp.fl);
     358            qDebug(
     359                   swp.fl);
    360360#endif
    361361            // skip if hidden
     
    406406            WinQueryWindowPos(parent, &swp);
    407407#if defined(QT_DEBUGWIDGETMASK)
    408             qDebug(" parent=%s [fl=%08lX]",
    409                    qStrHWND(parent).toUtf8().constData(), swp.fl);
     408            qDebug(
     409                   swp.fl);
    410410#endif
    411411            delta.x += swp.x;
     
    415415                WinQueryWindowPos(relative, &swp);
    416416#if defined(QT_DEBUGWIDGETMASK)
    417                 qDebug(" ancestor=%s [fl=%08lX]",
    418                        qStrHWND(relative).toUtf8().constData(), swp.fl);
     417                qDebug(
     418                       swp.fl);
    419419#endif
    420420                // skip if hidden
     
    468468{
    469469#if defined(QT_DEBUGWIDGETMASK)
    470     qDebug("qt_WinSetWindowPos: hwnd=%s fl=%08lX",
    471            qStrHWND(hwnd).toUtf8().constData(), fl);
     470    qDebug(
     471           fl);
    472472#endif
    473473
     
    561561            }
    562562#if defined(QT_DEBUGWIDGETMASK)
    563             qDebug(" moving up? %ld", up);
    564             qDebug(" hwndFrom=%s", qStrHWND(hwndFrom).toUtf8().constData());
    565             qDebug(" hwndTo=%s", qStrHWND(hwndTo).toUtf8().constData());
     563            qDebug(;
     564            qDebug();
     565            qDebug();
    566566#endif
    567567
     
    576576                    WinQueryWindowPos(sibling, &swp);
    577577#if defined(QT_DEBUGWIDGETMASK)
    578                     qDebug(" sibling=%s [fl=%08lX]",
    579                            qStrHWND(sibling).toUtf8().constData(), swp.fl);
     578                    qDebug(
     579                           swp.fl);
    580580#endif
    581581                    // proceed only if not hidden
     
    607607                    WinQueryWindowPos(sibling, &swp);
    608608#if defined(QT_DEBUGWIDGETMASK)
    609                     qDebug(" sibling=%s [fl=%08lX]",
    610                            qStrHWND(sibling).toUtf8().constData(), swp.fl);
     609                    qDebug(
     610                           swp.fl);
    611611#endif
    612612                    // proceed only if not hidden
     
    11381138            }
    11391139#if defined(QT_DEBUGWINCREATEDESTROY)
    1140             qDebug("|Creating top level window (frame) [%s]:\n"
    1141                    "|  owner = %08lX\n"
    1142                    "|  title = '%s'\n"
    1143                    "|  style = %08lX\n"
    1144                    "|  fcFlags = %08lX",
    1145                    qWidgetName(q).toUtf8().constData(), ownerw,
    1146                    title.constData(), fStyle, fcFlags);
     1140            qDebug() <<   "|Creating top level window (frame)" << q
     1141                     << "\n|  owner" << qDebugFmtHex(ownerw)
     1142                     << "\n|  title" << title
     1143                     << "\n|  style" << qDebugFmtHex(fStyle)
     1144                     << "\n|  fcFlags" << qDebugFmtHex(fcFlags);
    11471145#endif
    11481146            fId = WinCreateWindow(HWND_DESKTOP, WC_FRAME, title, fStyle,
     
    11501148                                  &fcData, NULL);
    11511149#if defined(QT_DEBUGWINCREATEDESTROY)
    1152             qDebug("|  hwnd = %08lX", fId);
     1150            qDebug(fId);
    11531151#endif
    11541152            if (fId == NULLHANDLE)
     
    11891187            // create client window
    11901188#if defined(QT_DEBUGWINCREATEDESTROY)
    1191             qDebug("|Creating top level window (client) [%s]:\n"
    1192                    "|  owner & parent = %08lX\n"
    1193                    "|  class = '%s'\n"
    1194                    "|  title = '%s'\n"
    1195                    "|  style = %08lX",
    1196                    qWidgetName(q).toUtf8().constData(), fId, className.constData(),
    1197                    title.constData(), style);
     1189            qDebug() <<   "|Creating top level window (client)" << q
     1190                     << "\n|  owner & parent" << qDebugFmtHex(fId)
     1191                     << "\n|  class" << className
     1192                     << "\n|  title" << title
     1193                     << "\n|  style" << qDebugFmtHex(style);
    11981194#endif
    11991195            // note that we place the client on top (HWND_TOP) to exclude other
     
    12031199        } else {
    12041200#if defined(QT_DEBUGWINCREATEDESTROY)
    1205             qDebug("|Creating top level window (popup) [%s]:\n"
    1206                    "|  class = '%s'\n"
    1207                    "|  title = '%s'\n"
    1208                    "|  style = %08lX",
    1209                    qWidgetName(q).toUtf8().constData(), className.constData(),
    1210                    title.constData(), style);
     1201            qDebug() <<   "|Creating top level window (popup)" << q
     1202                     << "\n|  class" << className
     1203                     << "\n|  title" << title
     1204                     << "\n|  style" << qDebugFmtHex(style);
    12111205#endif
    12121206            id = WinCreateWindow(HWND_DESKTOP, className, title, style,
     
    12141208        }
    12151209#if defined(QT_DEBUGWINCREATEDESTROY)
    1216         qDebug("|  hwnd = %08lX", id);
     1210        qDebug(id);
    12171211#endif
    12181212        if (id == NULLHANDLE)
     
    13271321
    13281322#if defined(QT_DEBUGWINCREATEDESTROY)
    1329         qDebug("|Creating child window [%s]:\n"
    1330                "|  owner & parent = %08lX\n"
    1331                "|  class = '%s'\n"
    1332                "|  title = '%s'\n"
    1333                "|  style = %08lX",
    1334                qWidgetName(q).toUtf8().constData(), parentw, className.constData(),
    1335                title.constData(), style);
     1323        qDebug() <<   "|Creating child window" << q
     1324                 << "/n|  owner & parent" << qDebugFmtHex(parentw)
     1325                 << "/n|  class" << className
     1326                 << "/n|  title" << title
     1327                 << "/n|  style" << qDebugFmtHex(style);
    13361328#endif
    13371329        id = WinCreateWindow(parentw, className, title, style,
     
    13421334                             parentw, HWND_TOP, 0, NULL, NULL);
    13431335#if defined(QT_DEBUGWINCREATEDESTROY)
    1344         qDebug("|  hwnd = %08lX", id);
     1336        qDebug(id);
    13451337#endif
    13461338        if (id == NULLHANDLE)
     
    14051397            }
    14061398#if defined(QT_DEBUGWINCREATEDESTROY)
    1407             qDebug("|Destroying window [%s]:\n"
    1408                    "|  hwnd = %08lX", qWidgetName(this).toUtf8().constData(), id);
    1409 #endif
    1410 
     1399            qDebug() << "|Destroying window" << this
     1400                     << "\n|  hwnd"  << qDebugFmtHex(id);
     1401#endif
    14111402            qt_WinDestroyWindow(id);
    14121403        }
  • trunk/src/gui/kernel/qwindowdefs_pm.h

    r603 r605  
    8686Q_GUI_EXPORT int qt_display_height();
    8787
    88 Q_GUI_EXPORT QWidget *qWidgetFromHWND(HWND hwnd);
     88Q_GUI_EXPORT QWidget *q(HWND hwnd);
    8989
    90 // For printing non-quoted QString's with QDebug
    91 struct Q_CORE_EXPORT QDbgStr: public QString
    92 {
    93     inline QDbgStr(const QString &str) : QString(str) {}
    94 };
     90// QDebug helpers for debugging various API types
    9591
    96 Q_GUI_EXPORT QDbgStr qWidgetName(QWidget *w);
    97 inline QDbgStr qWidgetName(HWND hwnd)
    98 { return qWidgetName(qWidgetFromHWND(hwnd)); }
     92// don't drag qdebug.h but require it to be included first
     93#if defined(QDEBUG_H) && !defined(QT_NO_DEBUG_STREAM)
    9994
    100 Q_CORE_EXPORT QDbgStr qStrHWND(HWND hwnd);
    101 Q_CORE_EXPORT QDbgStr qStrHPS(HPS hps);
    102 Q_CORE_EXPORT QDbgStr qStrHPOINTER(HPOINTER hptr);
    103 Q_CORE_EXPORT QDbgStr qStrHRGN(HRGN hrgn);
    104 
    105 Q_CORE_EXPORT QDbgStr qStrQMSG(const QMSG &qmsg);
     95struct QDebugHWND { HWND hwnd; };
     96inline QDebugHWND qDebugHWND(HWND hwnd) { QDebugHWND d = { hwnd }; return d; }
     97QDebug operator<<(QDebug debug, const QDebugHWND &d);
    10698
    10799// the following declarations require OS/2 types not defined here,
    108 // we don't drag them in but require qt_os2.h to be included before
     100//
    109101#if defined(QT_OS2_H)
    110102
    111 Q_CORE_EXPORT QDbgStr qStrRECTL(const RECTL &rcl);
    112 Q_CORE_EXPORT QDbgStr qStrSWP(const SWP &swp);
    113 
    114 #endif // defined(QT_OS2_H)
    115 
    116 // don't drag qdebug.h as well but require it to be included before
    117 #if defined(QDEBUG_H) && !defined(QT_NO_DEBUG_STREAM)
    118 
    119 // Prints a non-quoted QString
    120 inline QDebug operator<<(QDebug dbg, const QDbgStr &str)
    121 { dbg << str.toUtf8().constData(); return dbg; }
    122 
    123 #if defined(QT_OS2_H)
    124 
    125 inline QDebug operator<<(QDebug dbg, const RECTL &rcl)
    126 { dbg << qStrRECTL(rcl); return dbg; }
    127 
    128 inline QDebug operator<<(QDebug dbg, const SWP &swp)
    129 { dbg << qStrSWP(swp); return dbg; }
     103QDebug operator<<(QDebug debug, const RECTL &rcl);
     104QDebug operator<<(QDebug debug, const SWP &swp);
     105QDebug operator<<(QDebug debug, const QMSG &qmsg);
    130106
    131107#endif // defined(QT_OS2_H)
  • trunk/src/gui/painting/qwindowsurface_raster.cpp

    r561 r605  
    212212
    213213#if 0
    214     qDebug("QRasterWindowSurface::flush: [%s] wps %x br %d,%d/%d,%d",
    215            qWidgetName(widget).toUtf8().constData(), (unsigned int)wps,
    216            br.x(), br.y(), br.width(), br.height());
     214    qDebug() << "QRasterWindowSurface::flush:" << widget << "wps" << wps
     215             << "br" << br;
    217216#endif
    218217
     
    248247                      { br.right() + 1, ih - br.top() } };
    249248#if 0
    250     qDebug("QRasterWindowSurface::flush: [%s] ptls %ld,%ld-%ld,%ld %ld,%ld-%ld,%ld",
    251            qWidgetName(widget).toUtf8().constData(),
    252            ptls[0].x, ptls[0].y, ptls[1].x, ptls[1].y,
    253            ptls[2].x, ptls[2].y, ptls[3].x, ptls[3].y);
     249    qDebug() << "QRasterWindowSurface::flush:" << widget << "ptls"
     250             << ptls[0].x << ptls[0].y << ptls[1].x << ptls[1].y
     251             << ptls[2].x << ptls[2].y << ptls[3].x << ptls[3].y;
    254252#endif
    255253    GpiDrawBits(wps, (PVOID) img.bits(), (PBITMAPINFO2) &bmh, 4, ptls,
     
    277275                      { br.right() + 1, br.bottom() + 1 } };
    278276#if 0
    279     qDebug("QRasterWindowSurface::flush: [%s] ptls %ld,%ld-%ld,%ld %ld,%ld-%ld,%ld",
    280            qWidgetName(widget).toUtf8().constData(),
    281            ptls[0].x, ptls[0].y, ptls[1].x, ptls[1].y,
    282            ptls[2].x, ptls[2].y, ptls[3].x, ptls[3].y);
     277    qDebug() << "QRasterWindowSurface::flush:" << widget << "ptls"
     278             << ptls[0].x << ptls[0].y << ptls[1].x << ptls[1].y
     279             << ptls[2].x << ptls[2].y << ptls[3].x << ptls[3].y;
    283280#endif
    284281
Note: See TracChangeset for help on using the changeset viewer.