From 4415b267e3f48a5e9bae1e0d72fe3c011ca9d9b6 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Mon, 21 Sep 2009 13:17:58 +0100 Subject: Moved window-related flags from QTLWExtra to QWExtra This is due to the fact that non-toplevel widgets may now be window-owning. Note that the RDrawableWindow* pointer has not been removed from QTLWExtra but has not been added to QWExtra. This is because it is not in fact needed - we can always retrieve the window from winid->DrawableWindow(). --- src/gui/kernel/qapplication_s60.cpp | 8 ++-- src/gui/kernel/qwidget_p.h | 5 +-- src/gui/kernel/qwidget_s60.cpp | 76 +++++++++++++++++-------------------- 3 files changed, 41 insertions(+), 48 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 4c96a2a..d163b37e 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -336,7 +336,7 @@ void QSymbianControl::ConstructL(bool topLevel, bool desktop) // Necessary in order to be able to track the activation status of // the control's window - qwidget->d_func()->createTLExtra(); + qwidget->d_func()->createExtra(); #ifdef DEBUG_QSYMBIANCONTROL qDebug() << "QSymbianControl::ConstructL [" << this @@ -971,14 +971,14 @@ QWidget * QApplication::topLevelAt(QPoint const& point) if (widget->geometry().adjusted(0,0,1,1).contains(point)) { // At this point we know there is a Qt widget under the point. // Now we need to make sure it is the top most in the z-order. - RDrawableWindow* rw = widget->d_func()->topData()->rwindow; - int z = rw->OrdinalPosition(); + RDrawableWindow *const window = widget->effectiveWinId()->DrawableWindow(); + int z = window->OrdinalPosition(); if (z < lowestZ) { lowestZ = z; found = widget; } } - } + } } return found; } diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 8e58498..f4b9a4c 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -171,9 +171,6 @@ struct QTLWExtra { #ifndef QT_NO_QWS_MANAGER QWSManager *qwsManager; #endif -#elif defined(Q_OS_SYMBIAN) // <--------------------------------------------------------- SYMBIAN - uint activated : 1; // RWindowBase::Activated has been called - RDrawableWindow *rwindow; #endif }; @@ -226,6 +223,8 @@ struct QWExtra { QImage maskBits; CGImageRef imageMask; #endif +#elif defined(Q_OS_SYMBIAN) // <----------------------------------------------------- Symbian + uint activated : 1; // RWindowBase::Activated has been called #endif }; diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 998606f..0f69354 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -577,19 +577,18 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de stackingFlags = ECoeStackFlagStandard; } QT_TRAP_THROWING(control->ControlEnv()->AppUi()->AddToStackL(control, ECoeStackPriorityDefault, stackingFlags)); - - QTLWExtra *topExtra = topData(); - topExtra->rwindow = control->DrawableWindow(); + + RDrawableWindow *const drawableWindow = control->DrawableWindow(); // Request mouse move events. - topExtra->rwindow->PointerFilter(EPointerFilterEnterExit + drawableWindow->PointerFilter(EPointerFilterEnterExit | EPointerFilterMove | EPointerFilterDrag, 0); - topExtra->rwindow->EnableVisibilityChangeEvents(); + drawableWindow->EnableVisibilityChangeEvents(); if (!isOpaque) { - RWindow *rwindow = static_cast(topExtra->rwindow); - TDisplayMode gotDM = (TDisplayMode)rwindow->SetRequiredDisplayMode(EColor16MA); - if (rwindow->SetTransparencyAlphaChannel() == KErrNone) - rwindow->SetBackgroundColor(TRgb(255, 255, 255, 0)); + RWindow *const window = static_cast(drawableWindow); + const TDisplayMode displayMode = static_cast(window->SetRequiredDisplayMode(EColor16MA)); + if (window->SetTransparencyAlphaChannel() == KErrNone) + window->SetBackgroundColor(TRgb(255, 255, 255, 0)); } } @@ -610,7 +609,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de stackingFlags = ECoeStackFlagStandard; } QT_TRAP_THROWING(control->ControlEnv()->AppUi()->AddToStackL(control, ECoeStackPriorityDefault, stackingFlags)); - + q->setAttribute(Qt::WA_WState_Created); int x, y, w, h; data.crect.getRect(&x, &y, &w, &h); @@ -648,7 +647,7 @@ void QWidgetPrivate::show_sys() if (q->internalWinId()) { WId id = q->internalWinId(); - if (!extra->topextra->activated) { + if (!extra->activated) { #ifdef DEBUG_QWIDGET qDebug() << "QWidgetPrivate::show_sys [" << this << "]" @@ -658,7 +657,7 @@ void QWidgetPrivate::show_sys() #endif QT_TRAP_THROWING(id->ActivateL()); - extra->topextra->activated = 1; + extra->activated = 1; } id->MakeVisible(true); @@ -761,10 +760,8 @@ void QWidgetPrivate::raise_sys() #endif Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); - QTLWExtra *tlwExtra = maybeTopData(); - if (q->internalWinId() && tlwExtra) { - tlwExtra->rwindow->SetOrdinalPosition(0); - } + if (q->internalWinId()) + q->internalWinId()->DrawableWindow()->SetOrdinalPosition(0); } void QWidgetPrivate::lower_sys() @@ -777,10 +774,9 @@ void QWidgetPrivate::lower_sys() #endif Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); - QTLWExtra *tlwExtra = maybeTopData(); - if (q->internalWinId() && tlwExtra) { - tlwExtra->rwindow->SetOrdinalPosition(-1); - } + if (q->internalWinId()) + q->internalWinId()->DrawableWindow()->SetOrdinalPosition(-1); + if(!q->isWindow()) invalidateBuffer(q->rect()); } @@ -794,10 +790,13 @@ void QWidgetPrivate::stackUnder_sys(QWidget* w) { Q_Q(QWidget); Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); - QTLWExtra *tlwExtra = maybeTopData(); - QTLWExtra *tlwExtraSibling = w->d_func()->maybeTopData(); - if (q->internalWinId() && tlwExtra && w->internalWinId() && tlwExtraSibling) - tlwExtra->rwindow->SetOrdinalPosition(tlwExtraSibling->rwindow->OrdinalPosition() + 1); + + if (q->internalWinId() && w->internalWinId()) { + RDrawableWindow *const thisWindow = q->internalWinId()->DrawableWindow(); + RDrawableWindow *const otherWindow = w->internalWinId()->DrawableWindow(); + thisWindow->SetOrdinalPosition(otherWindow->OrdinalPosition() + 1); + } + if(!q->isWindow() || !w->internalWinId()) invalidateBuffer(q->rect()); } @@ -923,17 +922,14 @@ void QWidgetPrivate::s60UpdateIsOpaque() if ((data.window_flags & Qt::FramelessWindowHint) == 0) return; + RWindow *const window = static_cast(q->effectiveWinId()->DrawableWindow()); + if (!isOpaque) { - QTLWExtra *topExtra = topData(); - RWindow *rwindow = static_cast(topExtra->rwindow); - TDisplayMode gotDM = (TDisplayMode)rwindow->SetRequiredDisplayMode(EColor16MA); - if (rwindow->SetTransparencyAlphaChannel() == KErrNone) - rwindow->SetBackgroundColor(TRgb(255, 255, 255, 0)); - } else { - QTLWExtra *topExtra = topData(); - RWindow *rwindow = static_cast(topExtra->rwindow); - rwindow->SetTransparentRegion(TRegionFix<1>()); - } + const TDisplayMode displayMode = static_cast(window->SetRequiredDisplayMode(EColor16MA)); + if (window->SetTransparencyAlphaChannel() == KErrNone) + window->SetBackgroundColor(TRgb(255, 255, 255, 0)); + } else + window->SetTransparentRegion(TRegionFix<1>()); } CFbsBitmap* qt_pixmapToNativeBitmap(QPixmap pixmap, bool invert) @@ -1107,8 +1103,8 @@ void QWidgetPrivate::scroll_sys(int dx, int dy) scrollRect(q->rect(), dx, dy); } else { Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); - RDrawableWindow* rw = topData()->rwindow; - rw->Scroll(TPoint(dx, dy)); + RDrawableWindow *const window = q->internalWinId()->DrawableWindow(); + window->Scroll(TPoint(dx, dy)); } } @@ -1120,8 +1116,8 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r) scrollRect(r, dx, dy); } else { Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); - RDrawableWindow* rw = topData()->rwindow; - rw->Scroll(TPoint(dx, dy), qt_QRect2TRect(r)); + RDrawableWindow *const window = q->internalWinId()->DrawableWindow(); + window->Scroll(TPoint(dx, dy), qt_QRect2TRect(r)); } } @@ -1153,8 +1149,6 @@ void QWidgetPrivate::registerDropSite(bool /* on */) void QWidgetPrivate::createTLSysExtra() { extra->topextra->backingStore = 0; - extra->topextra->activated = 0; - extra->topextra->rwindow = 0; } void QWidgetPrivate::deleteTLSysExtra() @@ -1165,7 +1159,7 @@ void QWidgetPrivate::deleteTLSysExtra() void QWidgetPrivate::createSysExtra() { - + extra->activated = 0; } void QWidgetPrivate::deleteSysExtra() -- cgit v0.12