summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrans Englich <frans.englich@nokia.com>2009-09-28 08:43:58 (GMT)
committerFrans Englich <frans.englich@nokia.com>2009-09-28 08:43:58 (GMT)
commit420672ce2d86f9be2b11a6bceba71f41aadfcedf (patch)
treee7f31d7bdc0846433a8154815d71a26c5452a534
parent76f550e266062ef72ce826676c80cc2b441a93f5 (diff)
downloadQt-420672ce2d86f9be2b11a6bceba71f41aadfcedf.zip
Qt-420672ce2d86f9be2b11a6bceba71f41aadfcedf.tar.gz
Qt-420672ce2d86f9be2b11a6bceba71f41aadfcedf.tar.bz2
Revert "Revert all GUI changes from the MMF work."
This reverts commit 9345d47c3945b61a27724508e8b3d0aaf7b57bcf.
-rw-r--r--src/gui/gui.pro2
-rw-r--r--src/gui/kernel/qapplication_s60.cpp101
-rw-r--r--src/gui/kernel/qt_s60_p.h2
-rw-r--r--src/gui/kernel/qwidget_p.h13
-rw-r--r--src/gui/kernel/qwidget_s60.cpp426
5 files changed, 476 insertions, 68 deletions
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 83ac5fe..7c24002 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -54,4 +54,4 @@ DEFINES += Q_INTERNAL_QAPP_SRC
symbian:TARGET.UID3=0x2001B2DD
# ro-section in gui can exceed default allocated space, so more rw-section little further
-symbian-sbsv2: MMP_RULES += "LINKEROPTION armcc --rw-base 0x800000" \ No newline at end of file
+symbian-sbsv2: MMP_RULES += "LINKEROPTION armcc --rw-base 0x800000"
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 27e8602..7ef335b 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -77,6 +77,10 @@
#include <hal.h>
#include <hal_data.h>
+#ifdef DEBUG_QSYMBIANCONTROL
+#include <QDebug>
+#endif
+
QT_BEGIN_NAMESPACE
#if defined(QT_DEBUG)
@@ -320,13 +324,36 @@ QSymbianControl::QSymbianControl(QWidget *w)
{
}
-void QSymbianControl::ConstructL(bool topLevel, bool desktop)
+void QSymbianControl::ConstructL(bool isWindowOwning, bool desktop)
{
if (!desktop)
{
- if (topLevel) {
+ if (isWindowOwning or !qwidget->parentWidget())
CreateWindowL(S60->windowGroup());
- }
+ else
+ /**
+ * TODO: in order to avoid creating windows for all ancestors of
+ * this widget up to the root window, the parameter passed to
+ * CreateWindowL should be
+ * qwidget->parentWidget()->effectiveWinId(). However, if we do
+ * this, then we need to take care of re-parenting when a window
+ * is created for a widget between this one and the root window.
+ */
+ CreateWindowL(qwidget->parentWidget()->winId());
+
+ // Necessary in order to be able to track the activation status of
+ // the control's window
+ qwidget->d_func()->createExtra();
+
+#ifdef DEBUG_QSYMBIANCONTROL
+ qDebug() << "QSymbianControl::ConstructL [" << this
+ << "] widget" << qwidget
+ << "isWindowOwning" << isWindowOwning
+ << "parentWidget" << qwidget->parentWidget()
+ << "OwnsWindow" << OwnsWindow()
+ << "Window.ClientHandle" << reinterpret_cast<const void*>(DrawableWindow()->ClientHandle())
+ << "WindowGroupId" << DrawableWindow()->WindowGroupId();
+#endif
SetFocusing(true);
m_longTapDetector = QLongTapTimer::NewL(this);
@@ -767,19 +794,57 @@ TCoeInputCapabilities QSymbianControl::InputCapabilities() const
void QSymbianControl::Draw(const TRect& r) const
{
QWindowSurface *surface = qwidget->windowSurface();
- if (!surface)
- return;
+ QPaintEngine *engine = surface ? surface->paintDevice()->paintEngine() : NULL;
+
+#ifdef DEBUG_QSYMBIANCONTROL
+ qDebug() << "QSymbianControl::Draw [" << this << "]"
+ << "rect " << r.iTl.iX << ',' << r.iTl.iY
+ << '-' << r.iBr.iX << ',' << r.iBr.iY
+ << "surface" << surface
+ << "engine" << engine
+ << "raster" << (engine ? engine->type() == QPaintEngine::Raster : false)
+ << "opaque" << (qwidget->d_func()->isOpaque)
+ << "disableBlit" << (qwidget->d_func()->extraData()->disableBlit);
+#endif
- QPaintEngine *engine = surface->paintDevice()->paintEngine();
if (!engine)
return;
+
if (engine->type() == QPaintEngine::Raster) {
QS60WindowSurface *s60Surface = static_cast<QS60WindowSurface *>(qwidget->windowSurface());
CFbsBitmap *bitmap = s60Surface->symbianBitmap();
CWindowGc &gc = SystemGc();
- if (qwidget->d_func()->isOpaque)
- gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
- gc.BitBlt(r.iTl, bitmap, r);
+
+ if(qwidget->d_func()->extraData()->disableBlit) {
+#ifdef DEBUG_QSYMBIANCONTROL
+ const TDisplayMode displayMode = bitmap->DisplayMode();
+ qDebug() << "QSymbianControl::Draw [" << this << "]"
+ << "mode " << displayMode;
+
+ const TUint32 *address = bitmap->DataAddress();
+ const int bitmapWidth = bitmap->SizeInPixels().iWidth;
+ const int bitmapHeight = bitmap->SizeInPixels().iHeight;
+
+ for(int i=0; i<10 and i*10<bitmapWidth and i*10<bitmapHeight; ++i) {
+ const int coord = i*10;
+ const TUint32 *ptr = address + (coord * bitmapWidth) + coord;
+ const TUint32 pixel = *ptr;
+ qDebug() << " " << i*10 << " : " << ptr << pixel;
+ }
+
+ for(int i=0; i<10 and i*10<bitmapWidth and i*10<bitmapHeight; ++i) {
+ TRgb color;
+ bitmap->GetPixel(color, TPoint(i*10, i*10));
+ qDebug() << " " << i*10 << " : " << color.Red() << color.Green() << color.Blue() << color.Alpha();
+ }
+#endif
+
+ if (qwidget->d_func()->isOpaque)
+ gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
+ }
+ else
+ gc.BitBlt(r.iTl, bitmap, r);
+
} else {
surface->flush(qwidget, QRegion(qt_TRect2QRect(r)), QPoint());
}
@@ -792,6 +857,12 @@ void QSymbianControl::SizeChanged()
QSize oldSize = qwidget->size();
QSize newSize(Size().iWidth, Size().iHeight);
+#ifdef DEBUG_QSYMBIANCONTROL
+ qDebug() << "QSymbianControl::SizeChanged [" << this << "]"
+ << oldSize.width() << 'x' << oldSize.height()
+ << "-" << newSize.width() << 'x' << newSize.height();
+#endif
+
if (oldSize != newSize) {
QRect cr = qwidget->geometry();
cr.setSize(newSize);
@@ -818,6 +889,12 @@ void QSymbianControl::PositionChanged()
QPoint oldPos = qwidget->geometry().topLeft();
QPoint newPos(Position().iX, Position().iY);
+#ifdef DEBUG_QSYMBIANCONTROL
+ qDebug() << "QSymbianControl::SizeChanged [" << this << "]"
+ << oldPos.x() << ',' << oldPos.y()
+ << "-" << newPos.x() << ',' << newPos.y();
+#endif
+
if (oldPos != newPos) {
QRect cr = qwidget->geometry();
cr.moveTopLeft(newPos);
@@ -1236,14 +1313,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/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index 0d48634..d1ec74d 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -141,7 +141,7 @@ public:
public:
QSymbianControl(QWidget *w);
- void ConstructL(bool topLevel = false, bool desktop = false);
+ void ConstructL(bool isWindowOwning = false, bool desktop = false);
~QSymbianControl();
void HandleResourceChange(int resourceType);
void HandlePointerEventL(const TPointerEvent& aPointerEvent);
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 296c5b1..2a81689 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -169,9 +169,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
};
@@ -224,6 +221,15 @@ struct QWExtra {
QImage maskBits;
CGImageRef imageMask;
#endif
+#elif defined(Q_OS_SYMBIAN) // <----------------------------------------------------- Symbian
+ uint activated : 1; // RWindowBase::Activated has been called
+
+ // If set, QSymbianControl::Draw does not blit this widget
+ // This is to allow, for use cases such as video, widgets which, from the Qt point
+ // of view, are just placeholders in the scene. For these widgets, any necessary
+ // drawing to the UI framebuffer is done by the relevant Symbian subsystem. For
+ // video rendering, this would be an MMF controller, or MDF post-processor.
+ uint disableBlit : 1;
#endif
};
@@ -288,6 +294,7 @@ public:
void setMask_sys(const QRegion &);
#ifdef Q_OS_SYMBIAN
void handleSymbianDeferredFocusChanged();
+ void setSoftKeys_sys(const QList<QAction*> &softkeys);
#endif
void raise_sys();
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 6b5e9b7..8667325 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -56,6 +56,10 @@
#include <aknappui.h>
#endif
+#ifdef DEBUG_QWIDGET
+#include <QDebug>
+#endif
+
QT_BEGIN_NAMESPACE
extern bool qt_nograb();
@@ -78,14 +82,225 @@ static bool isEqual(const QList<QAction*>& a, const QList<QAction*>& b)
return true;
}
-void QWidgetPrivate::setWSGeometry(bool /* dontShow */, const QRect & /* rect */)
+void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &)
{
+ // Note: based on x11 implementation
+
+ static const int XCOORD_MAX = 16383;
+ static const int WRECT_MAX = 16383;
+
+ Q_Q(QWidget);
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::setWSGeometry [" << this << "]"
+ << "q" << q;
+#endif
+
+ Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
+
+ /*
+ There are up to four different coordinate systems here:
+ Qt coordinate system for this widget.
+ Symbian coordinate system for this widget (relative to wrect).
+ Qt coordinate system for parent
+ Symbian coordinate system for parent (relative to parent's wrect).
+ */
+
+ QRect validRange(-XCOORD_MAX,-XCOORD_MAX, 2*XCOORD_MAX, 2*XCOORD_MAX);
+ QRect wrectRange(-WRECT_MAX,-WRECT_MAX, 2*WRECT_MAX, 2*WRECT_MAX);
+ QRect wrect;
+ //xrect is the Symbian geometry of my widget. (starts out in parent's Qt coord sys, and ends up in parent's Symbian coord sys)
+ QRect xrect = data.crect;
+
+ const QWidget *const parent = q->parentWidget();
+ QRect parentWRect = parent->data->wrect;
+
+ if (parentWRect.isValid()) {
+ // parent is clipped, and we have to clip to the same limit as parent
+ if (!parentWRect.contains(xrect)) {
+ xrect &= parentWRect;
+ wrect = xrect;
+ //translate from parent's to my Qt coord sys
+ wrect.translate(-data.crect.topLeft());
+ }
+ //translate from parent's Qt coords to parent's X coords
+ xrect.translate(-parentWRect.topLeft());
+
+ } else {
+ // parent is not clipped, we may or may not have to clip
+
+ if (data.wrect.isValid() && QRect(QPoint(),data.crect.size()).contains(data.wrect)) {
+ // This is where the main optimization is: we are already
+ // clipped, and if our clip is still valid, we can just
+ // move our window, and do not need to move or clip
+ // children
+
+ QRect vrect = xrect & parent->rect();
+ vrect.translate(-data.crect.topLeft()); //the part of me that's visible through parent, in my Qt coords
+ if (data.wrect.contains(vrect)) {
+ xrect = data.wrect;
+ xrect.translate(data.crect.topLeft());
+ if (data.winid) {
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::setWSGeometry [" << this << "] (1)"
+ << "control" << data.winid
+ << "SetExtent" << xrect.x() << ',' << xrect.y()
+ << xrect.width() << 'x' << xrect.height();
+#endif
+
+ data.winid->SetExtent(TPoint(xrect.x(), xrect.y()), TSize(xrect.width(), xrect.height()));
+ data.winid->DrawNow();
+ }
+ return;
+ }
+ }
+
+ if (!validRange.contains(xrect)) {
+ // we are too big, and must clip
+ xrect &=wrectRange;
+ wrect = xrect;
+ wrect.translate(-data.crect.topLeft());
+ //parent's X coord system is equal to parent's Qt coord
+ //sys, so we don't need to map xrect.
+ }
+
+ }
+
+ // unmap if we are outside the valid window system coord system
+ bool outsideRange = !xrect.isValid();
+ bool mapWindow = false;
+ if (q->testAttribute(Qt::WA_OutsideWSRange) != outsideRange) {
+ q->setAttribute(Qt::WA_OutsideWSRange, outsideRange);
+ if (outsideRange) {
+ if (data.winid) {
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::setWSGeometry [" << this << "] (2)"
+ << "control" << data.winid
+ << "SetVisible(EFalse)";
+#endif
+
+ data.winid->DrawableWindow()->SetVisible(EFalse);
+ }
+ q->setAttribute(Qt::WA_Mapped, false);
+ } else if (!q->isHidden()) {
+ mapWindow = true;
+ }
+ }
+
+ if (outsideRange)
+ return;
+
+ bool jump = (data.wrect != wrect);
+ data.wrect = wrect;
+
+
+ // and now recursively for all children...
+ // ### can be optimized
+ for (int i = 0; i < children.size(); ++i) {
+ QObject *object = children.at(i);
+ if (object->isWidgetType()) {
+ QWidget *w = static_cast<QWidget *>(object);
+ if (!w->isWindow() && w->testAttribute(Qt::WA_WState_Created)) {
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::setWSGeometry [" << this << "] (3)"
+ << "control" << data.winid
+ << "child" << w->d_func();
+#endif
+
+ w->d_func()->setWSGeometry(jump);
+ }
+ }
+ }
+
+ if (data.winid) {
+ // move ourselves to the new position and map (if necessary) after
+ // the movement. Rationale: moving unmapped windows is much faster
+ // than moving mapped windows
+ if (!parent->internalWinId())
+ xrect.translate(parent->mapTo(q->nativeParentWidget(), QPoint(0, 0)));
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::setWSGeometry [" << this << "] (4)"
+ << "control" << data.winid
+ << "SetExtent" << xrect.x() << ',' << xrect.y()
+ << xrect.width() << 'x' << xrect.height();
+#endif
+
+ data.winid->SetExtent(TPoint(xrect.x(), xrect.y()), TSize(xrect.width(), xrect.height()));
+ if(!jump) {
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::setWSGeometry [" << this << "] (5)"
+ << "control" << data.winid
+ << "DrawNow";
+#endif
+
+ data.winid->DrawNow();
+ }
+ }
+
+ //to avoid flicker, we have to show children after the helper widget has moved
+ if (jump) {
+ for (int i = 0; i < children.size(); ++i) {
+ QObject *object = children.at(i);
+ if (object->isWidgetType()) {
+ QWidget *w = static_cast<QWidget *>(object);
+ if (!w->testAttribute(Qt::WA_OutsideWSRange) && !w->testAttribute(Qt::WA_Mapped) && !w->isHidden()) {
+ w->setAttribute(Qt::WA_Mapped);
+ if (w->internalWinId()) {
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::setWSGeometry [" << this << "] (6)"
+ << "control" << data.winid
+ << "SetVisible(ETrue)";
+#endif
+
+ w->data->winid->DrawableWindow()->SetVisible(ETrue);
+ }
+ }
+ }
+ }
+ }
+
+ if (jump && data.winid) {
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::setWSGeometry [" << this << "] (7)"
+ << "control" << data.winid
+ << "DrawNow" << wrect.width() << 'x' << wrect.height();
+#endif
+
+ data.winid->DrawNow(TRect(0, 0, wrect.width(), wrect.height()));
+ }
+
+ if (mapWindow and !dontShow) {
+ q->setAttribute(Qt::WA_Mapped);
+ if (q->internalWinId()) {
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::setWSGeometry [" << this << "] (8)"
+ << "control" << data.winid
+ << "SetVisible(ETrue)";
+#endif
+
+ q->internalWinId()->DrawableWindow()->SetVisible(ETrue);
+ }
+ }
}
void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
{
Q_Q(QWidget);
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::setGeometry_sys [" << this << "]"
+ << "q" << q
+ << x << ',' << y << w << 'x' << h << isMove;
+#endif
+
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
if ((q->windowType() == Qt::Desktop))
@@ -119,13 +334,25 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
if (q->isWindow()) {
if (w == 0 || h == 0) {
q->setAttribute(Qt::WA_OutsideWSRange, true);
- if (q->isVisible() && q->testAttribute(Qt::WA_Mapped))
+ if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) {
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::setGeometry_sys [" << this << "] (1)"
+ << "hide";
+#endif
+
hide_sys();
+ }
data.crect = QRect(x, y, w, h);
data.window_state &= ~Qt::WindowFullScreen;
} else if (q->isVisible() && q->testAttribute(Qt::WA_OutsideWSRange)) {
q->setAttribute(Qt::WA_OutsideWSRange, false);
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::setGeometry_sys [" << this << "] (2)"
+ << "SetRect, show";
+#endif
+
// put the window in its place and show it
q->internalWinId()->SetRect(TRect(TPoint(x, y), TSize(w, h)));
data.crect.setRect(x, y, w, h);
@@ -134,6 +361,12 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
} else {
QRect r = QRect(x, y, w, h);
data.crect = r;
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::setGeometry_sys [" << this << "] (3)"
+ << "SetRect";
+#endif
+
q->internalWinId()->SetRect(TRect(TPoint(x, y), TSize(w, h)));
topData()->normalGeometry = data.crect;
}
@@ -156,8 +389,15 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
if (inTopLevelResize)
tlwExtra->inTopLevelResize = true;
}
- if (q->testAttribute(Qt::WA_WState_Created))
+ if (q->testAttribute(Qt::WA_WState_Created)) {
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::setGeometry_sys [" << this << "] (4)"
+ << "setWSGeometry";
+#endif
+
setWSGeometry();
+ }
}
if (q->isVisible()) {
@@ -202,6 +442,19 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de
bool desktop = (type == Qt::Desktop);
//bool tool = (type == Qt::Tool || type == Qt::Drawer);
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::create_sys [" << this << "] "
+ << "q" << q;
+ qDebug() << "QWidgetPrivate::create_sys [" << this << "] "
+ << "type" << type
+ << "flags" << flags
+ << "parent" << parentWidget
+ << "topLevel" << topLevel
+ << "popup" << popup
+ << "dialog" << dialog
+ << "desktop" << desktop;
+#endif
+
WId id = 0;
if (popup)
@@ -253,18 +506,17 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de
}
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<RWindow*>(topExtra->rwindow);
- TDisplayMode gotDM = (TDisplayMode)rwindow->SetRequiredDisplayMode(EColor16MA);
- if (rwindow->SetTransparencyAlphaChannel() == KErrNone)
- rwindow->SetBackgroundColor(TRgb(255, 255, 255, 0));
+ RWindow *const window = static_cast<RWindow *>(drawableWindow);
+ const TDisplayMode displayMode = static_cast<TDisplayMode>(window->SetRequiredDisplayMode(EColor16MA));
+ if (window->SetTransparencyAlphaChannel() == KErrNone)
+ window->SetBackgroundColor(TRgb(255, 255, 255, 0));
}
}
@@ -286,9 +538,6 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de
}
QT_TRAP_THROWING(control->ControlEnv()->AppUi()->AddToStackL(control, ECoeStackPriorityDefault, stackingFlags));
- WId parentw = parentWidget->effectiveWinId();
- QT_TRAP_THROWING(control->SetContainerWindowL(*parentw));
-
q->setAttribute(Qt::WA_WState_Created);
int x, y, w, h;
data.crect.getRect(&x, &y, &w, &h);
@@ -308,6 +557,11 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de
void QWidgetPrivate::show_sys()
{
Q_Q(QWidget);
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::show_sys [" << this << "] "
+ << "q" << q;
+#endif
if (q->testAttribute(Qt::WA_OutsideWSRange))
return;
@@ -321,20 +575,31 @@ void QWidgetPrivate::show_sys()
return;
}
- if (q->isWindow() && q->internalWinId()) {
-
+ if (q->internalWinId()) {
+
WId id = q->internalWinId();
- if (!extra->topextra->activated) {
+ if (!extra->activated) {
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::show_sys [" << this << "]"
+ << "id" << id
+ << "isWindow" << q->isWindow()
+ << "ActivateL";
+#endif
+
QT_TRAP_THROWING(id->ActivateL());
- extra->topextra->activated = 1;
+ extra->activated = 1;
}
id->MakeVisible(true);
- id->SetFocus(true);
+
+ if(q->isWindow())
+ id->SetFocus(true);
// Force setting of the icon after window is made visible,
// this is needed even WA_SetWindowIcon is not set, as in that case we need
// to reset to the application level window icon
- setWindowIcon_sys(true);
+ if(q->isWindow())
+ setWindowIcon_sys(true);
}
invalidateBuffer(q->rect());
@@ -343,11 +608,25 @@ void QWidgetPrivate::show_sys()
void QWidgetPrivate::hide_sys()
{
Q_Q(QWidget);
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::hide_sys [" << this << "]"
+ << "q" << q;
+#endif
+
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
deactivateWidgetCleanup();
WId id = q->internalWinId();
- if (q->isWindow() && id) {
- if (id->IsFocused()) // Avoid unnecessary calls to FocusChanged()
+
+ if (id) {
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::show_sys [" << this << "]"
+ << "id" << id
+ << "MakeVisible(false)";
+#endif
+
+ if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged()
id->SetFocus(false);
id->MakeVisible(false);
if (QWidgetBackingStore *bs = maybeBackingStore())
@@ -371,6 +650,13 @@ void QWidgetPrivate::handleSymbianDeferredFocusChanged()
{
Q_Q(QWidget);
WId control = q->internalWinId();
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::handleSymbianDeferredFocusChanged [" << this << "]"
+ << "q" << q
+ << "control" << control;
+#endif
+
if (!control) {
// This could happen if the widget was reparented, while the focuschange
// was in the event queue.
@@ -398,21 +684,30 @@ void QWidgetPrivate::handleSymbianDeferredFocusChanged()
void QWidgetPrivate::raise_sys()
{
Q_Q(QWidget);
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::raise_sys [" << this << "]"
+ << "q" << q;
+#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()
{
Q_Q(QWidget);
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::lower_sys [" << this << "]"
+ << "q" << q;
+#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());
}
@@ -426,10 +721,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());
}
@@ -437,6 +735,12 @@ void QWidgetPrivate::stackUnder_sys(QWidget* w)
void QWidgetPrivate::reparentChildren()
{
Q_Q(QWidget);
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::reparentChildren [" << this << "]"
+ << "q" << q;
+#endif
+
QObjectList chlist = q->children();
for (int i = 0; i < chlist.size(); ++i) { // reparent children
QObject *obj = chlist.at(i);
@@ -467,6 +771,14 @@ void QWidgetPrivate::reparentChildren()
void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
{
Q_Q(QWidget);
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::setParent_sys [" << this << "]"
+ << "q" << q
+ << "parent" << parent
+ << "f" << f;
+#endif
+
bool wasCreated = q->testAttribute(Qt::WA_WState_Created);
if (q->isVisible() && q->parentWidget() && parent != q->parentWidget())
@@ -530,23 +842,25 @@ void QWidgetPrivate::s60UpdateIsOpaque()
{
Q_Q(QWidget);
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidgetPrivate::s60UpdateIsOpaque [" << this << "]"
+ << "q" << q;
+#endif
+
if (!q->testAttribute(Qt::WA_WState_Created) || !q->testAttribute(Qt::WA_TranslucentBackground))
return;
if ((data.window_flags & Qt::FramelessWindowHint) == 0)
return;
+ RWindow *const window = static_cast<RWindow *>(q->effectiveWinId()->DrawableWindow());
+
if (!isOpaque) {
- QTLWExtra *topExtra = topData();
- RWindow *rwindow = static_cast<RWindow*>(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<RWindow*>(topExtra->rwindow);
- rwindow->SetTransparentRegion(TRegionFix<1>());
- }
+ const TDisplayMode displayMode = static_cast<TDisplayMode>(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)
@@ -722,8 +1036,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));
}
}
@@ -735,8 +1049,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));
}
}
@@ -768,8 +1082,6 @@ void QWidgetPrivate::registerDropSite(bool /* on */)
void QWidgetPrivate::createTLSysExtra()
{
extra->topextra->backingStore = 0;
- extra->topextra->activated = 0;
- extra->topextra->rwindow = 0;
}
void QWidgetPrivate::deleteTLSysExtra()
@@ -780,7 +1092,8 @@ void QWidgetPrivate::deleteTLSysExtra()
void QWidgetPrivate::createSysExtra()
{
-
+ extra->activated = 0;
+ extra->disableBlit = 0;
}
void QWidgetPrivate::deleteSysExtra()
@@ -926,6 +1239,12 @@ QPoint QWidget::mapFromGlobal(const QPoint &pos) const
void QWidget::setWindowState(Qt::WindowStates newstate)
{
Q_D(QWidget);
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidget::setWindowState [" << this << "]"
+ << "newstate" << newstate;
+#endif
+
Qt::WindowStates oldstate = windowState();
if (oldstate == newstate)
return;
@@ -1173,6 +1492,11 @@ void QWidget::releaseMouse()
void QWidget::activateWindow()
{
Q_D(QWidget);
+
+#ifdef DEBUG_QWIDGET
+ qDebug() << "QWidget::activateWindow [" << this << "]";
+#endif
+
QWidget *tlw = window();
if (tlw->isVisible()) {
window()->createWinId();