diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index bbb1fca..29941b3 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -96,6 +96,10 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c #include #include "qevent_p.h" + +#include +#include +#include //#define ALIEN_DEBUG #ifndef QT_NO_THREAD @@ -1450,6 +1454,53 @@ void QApplication::winFocus(QWidget *widget, bool gotFocus) } +void dumpWindow(HWND h, bool parents, std::wostream &str) +{ + wchar_t buf[256]; + str << h << ' '; + + if (GetWindowText(h, buf, sizeof(buf))) + str << buf; + if (GetClassName(h, buf, sizeof(buf))) + str << '(' << buf << ')'; + RECT rect; + GetWindowRect(h, &rect); + const int width = rect.right - rect.left + 1; + const int height = rect.bottom - rect.top + 1; + str << L", " << width << L'x' << height << std::showpos << rect.left << rect.top << std::noshowpos; + if (parents) { + if (HWND parent = GetAncestor(h, GA_PARENT)) { + str << ", parent: "; + dumpWindow(parent, false, str); + } + if (HWND parent = GetAncestor(h, GA_ROOTOWNER)) { + str << ", root-owner: "; + dumpWindow(parent, false, str); + } + if (HWND parent = GetAncestor(h, GA_ROOT)) { + str << ", root: "; + dumpWindow(parent, false, str); + } + } +} + +BOOL CALLBACK windowEnumProc(HWND h, LPARAM p) +{ + std::wostream *str = reinterpret_cast(p); + dumpWindow(h, true, *str); + *str << '\n'; + return TRUE; +} + +void dumpWindows(HWND parent) +{ + std::wostream *str = &std::wcerr; + *str << L"Children of "; + dumpWindow(parent, true, *str); + *str << '\n'; + EnumChildWindows(parent, windowEnumProc, reinterpret_cast(str)); +} + // // QtWndProc() receives all messages from the main event loop // @@ -2200,10 +2251,13 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa } break; case WM_CLOSE: // close window + qDebug() << "WM_CLOSE" <translateCloseEvent(msg); RETURN(0); // always handled case WM_DESTROY: // destroy window + qDebug() << "WM_DESTROY" <curs; #endif @@ -2542,9 +2544,9 @@ void QWidgetPrivate::createWinId(WId winid) { Q_Q(QWidget); -#ifdef ALIEN_DEBUG + qDebug() << "QWidgetPrivate::createWinId for" << q << winid; -#endif + const bool forceNativeWindow = q->testAttribute(Qt::WA_NativeWindow); if (!q->testAttribute(Qt::WA_WState_Created) || (forceNativeWindow && !q->internalWinId())) { #ifndef Q_WS_QPA diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index 04fe4f9..f96ae08 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -79,6 +79,7 @@ void q_createNativeChildrenAndSetParent(QPlatformWindow *parentWindow, const QWi void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyOldWindow) { Q_Q(QWidget); + qDebug() << __FUNCTION__ <aboutToDestroy(); if (!isWindow() && parentWidget()) @@ -170,6 +172,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) { Q_Q(QWidget); + qDebug() << __FUNCTION__ <isWindow()) + qDebug() << __FUNCTION__ << q; q->setAttribute(Qt::WA_Mapped); if (q->testAttribute(Qt::WA_DontShowOnScreen)) { invalidateBuffer(q->rect()); @@ -420,6 +425,8 @@ void QWidgetPrivate::show_sys() void QWidgetPrivate::hide_sys() { Q_Q(QWidget); + if (q->isWindow()) + qDebug() << __FUNCTION__ << q; q->setAttribute(Qt::WA_Mapped, false); deactivateWidgetCleanup(); if (!q->isWindow()) { diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index 1e8b030..d8cb310 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -259,10 +259,52 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND, UINT, WPARAM, LPARAM); QWidget member functions *****************************************************************************/ +static QByteArray debugWinStyle(DWORD style) +{ + QByteArray rc = "0x"; + rc += QByteArray::number(qulonglong(style), 16); + if (style & WS_POPUP) + rc += " WS_POPUP"; + if (style & WS_CHILD) + rc += " WS_CHILD"; + if (style & WS_OVERLAPPED) + rc += " WS_OVERLAPPED"; + if (style & WS_CLIPSIBLINGS) + rc += " WS_CLIPSIBLINGS"; + if (style & WS_CLIPCHILDREN) + rc += " WS_CLIPCHILDREN"; + if (style & WS_THICKFRAME) + rc += " WS_THICKFRAME"; + if (style & WS_DLGFRAME) + rc += " WS_DLGFRAME"; + if (style & WS_SYSMENU) + rc += " WS_SYSMENU"; + if (style & WS_MINIMIZEBOX) + rc += " WS_MINIMIZEBOX"; + if (style & WS_MAXIMIZEBOX) + rc += " WS_MAXIMIZEBOX"; + return rc; +} + +static QByteArray debugWinExStyle(DWORD exStyle) +{ + QByteArray rc = "0x"; + rc += QByteArray::number(qulonglong(exStyle), 16); + if (exStyle & WS_EX_TOOLWINDOW) + rc += " WS_EX_TOOLWINDOW"; + if (exStyle & WS_EX_CONTEXTHELP) + rc += " WS_EX_CONTEXTHELP"; + if (exStyle & WS_EX_LAYERED) + rc += " WS_EX_LAYERED"; + return rc; +} + + #ifndef Q_WS_WINCE void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyOldWindow) { Q_Q(QWidget); + qDebug() << __FUNCTION__ << q << initializeWindow << destroyOldWindow; static int sw = -1, sh = -1; Qt::WindowType type = q->windowType(); @@ -432,7 +474,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO y = qMax(sh/2 - h/2, 0); } } - +qDebug() << "Creating window: " << q << debugWinStyle(style) << debugWinExStyle(exsty); id = CreateWindowEx(exsty, reinterpret_cast(windowClassName.utf16()), reinterpret_cast(title.utf16()), style, x, y, w, h, @@ -448,6 +490,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO SetWindowPos(id, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); winUpdateIsOpaque(); } else if (q->testAttribute(Qt::WA_NativeWindow) || paintOnScreen()) { // create child widget + qDebug() << "Creating window: " << q << debugWinStyle(style) << debugWinExStyle(exsty); id = CreateWindowEx(exsty, reinterpret_cast(windowClassName.utf16()), reinterpret_cast(title.utf16()), style, data.crect.left(), data.crect.top(), data.crect.width(), data.crect.height(), @@ -519,6 +562,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO #endif if (destroyw) { + qDebug() << __FUNCTION__ << q << "DestroyWindow"; DestroyWindow(destroyw); } @@ -549,6 +593,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO void QWidget::destroy(bool destroyWindow, bool destroySubWindows) { Q_D(QWidget); + qDebug() << __FUNCTION__ << this << destroyWindow << destroySubWindows; d->aboutToDestroy(); if (!isWindow() && parentWidget()) parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry())); @@ -570,6 +615,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) else if ((windowType() == Qt::Popup)) qApp->d_func()->closePopup(this); if (destroyWindow && !(windowType() == Qt::Desktop) && internalWinId()) { + qDebug() << __FUNCTION__ << this << "DestroyWindow"; DestroyWindow(internalWinId()); } #ifdef Q_WS_WINCE @@ -589,14 +635,18 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) void QWidgetPrivate::reparentChildren() { Q_Q(QWidget); + qDebug() << __FUNCTION__ <children(); for(int i = 0; i < chlist.size(); ++i) { // reparent children QObject *obj = chlist.at(i); if (obj->isWidgetType()) { + qDebug() << __FUNCTION__ <windowType() == Qt::Popup)) { + qDebug() << __FUNCTION__ <isWindow()) { + qDebug() << __FUNCTION__ <isVisible(); QPoint old_pos = w->pos(); w->setParent(q, w->windowFlags()); @@ -604,6 +654,7 @@ void QWidgetPrivate::reparentChildren() if (showIt) w->show(); } else { + qDebug() << __FUNCTION__ <d_func()->invalidateBuffer(w->rect()); SetParent(w->effectiveWinId(), q->effectiveWinId()); w->d_func()->reparentChildren(); @@ -615,6 +666,7 @@ void QWidgetPrivate::reparentChildren() void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) { Q_Q(QWidget); + qDebug() << __FUNCTION__ << q << ">"<< parent << f; bool wasCreated = q->testAttribute(Qt::WA_WState_Created); if (q->isVisible() && q->parentWidget() && parent != q->parentWidget()) q->parentWidget()->d_func()->invalidateBuffer(effectiveRectFor(q->geometry())); @@ -654,6 +706,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden); if (wasCreated) { + qDebug() << __FUNCTION__ << "Calling reparentChildren "; reparentChildren(); } @@ -666,8 +719,11 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) setWindowIcon_sys(true); setWindowTitle_helper(extra->topextra->caption); } - if (old_winid) - DestroyWindow(old_winid); + if (old_winid) { + qDebug() << __FUNCTION__ << "DestroyWindow" << q << old_winid; + if (!DestroyWindow(old_winid)) + qErrnoWarning("DestroyWindow"); + } if (q->testAttribute(Qt::WA_AcceptDrops) || dropSiteWasRegistered || (!q->isWindow() && q->parentWidget() && q->parentWidget()->testAttribute(Qt::WA_DropSiteRegistered))) @@ -681,6 +737,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) } #endif invalidateBuffer(q->rect()); + qDebug() << __FUNCTION__ << q << "<"; } diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index cd13ff7..c52cf8c 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -409,6 +409,7 @@ void QComboBoxPrivateContainer::leaveEvent(QEvent *) QComboBoxPrivateContainer::QComboBoxPrivateContainer(QAbstractItemView *itemView, QComboBox *parent) : QFrame(parent, Qt::Popup), combo(parent), view(0), top(0), bottom(0) { + setObjectName("QComboBoxPrivateContainer"); // we need the combobox and itemview Q_ASSERT(parent); Q_ASSERT(itemView); @@ -432,7 +433,9 @@ QComboBoxPrivateContainer::QComboBoxPrivateContainer(QAbstractItemView *itemView const bool usePopup = combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo); if (usePopup) { top = new QComboBoxPrivateScroller(QAbstractSlider::SliderSingleStepSub, this); + top->setObjectName("QComboBoxPrivateScrollerT"); bottom = new QComboBoxPrivateScroller(QAbstractSlider::SliderSingleStepAdd, this); + bottom->setObjectName("QComboBoxPrivateScrollerB"); top->hide(); bottom->hide(); } else { diff --git a/src/gui/widgets/qeffects.cpp b/src/gui/widgets/qeffects.cpp index ed80291..226734a 100644 --- a/src/gui/widgets/qeffects.cpp +++ b/src/gui/widgets/qeffects.cpp @@ -382,6 +382,7 @@ static QRollEffect* q_roll = 0; QRollEffect::QRollEffect(QWidget* w, Qt::WindowFlags f, DirFlags orient) : QWidget(0, f), orientation(orient) { + setObjectName("QRollEffect on " + w->objectName()); #ifndef Q_WS_WIN setEnabled(false); #endif