From 0be40737081110238f326e3644287b3dca18a824 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Fri, 6 Jul 2012 04:14:37 +0530 Subject: linuxfb: remove mScreens from QFbWindow A QWindow can only be in one QScreen, so it makes no sense to track a list of screens. Change-Id: I341a67afa90c7fbbbd95786b43d0a322fc1ddba2 Reviewed-by: Gunnar Sletta Reviewed-by: Thomas Senyk Reviewed-by: Girish Ramakrishnan --- src/platformsupport/fbconvenience/qfbwindow.cpp | 93 +++++++++---------------- 1 file changed, 31 insertions(+), 62 deletions(-) (limited to 'src/platformsupport/fbconvenience/qfbwindow.cpp') diff --git a/src/platformsupport/fbconvenience/qfbwindow.cpp b/src/platformsupport/fbconvenience/qfbwindow.cpp index f83f084363..da7c881d94 100644 --- a/src/platformsupport/fbconvenience/qfbwindow.cpp +++ b/src/platformsupport/fbconvenience/qfbwindow.cpp @@ -42,21 +42,34 @@ #include "qfbwindow_p.h" #include "qfbscreen_p.h" +#include + QT_BEGIN_NAMESPACE +QFbWindow::QFbWindow(QWindow *window) + : QPlatformWindow(window), mBackingStore(0), visibleFlag(false) +{ + static QAtomicInt winIdGenerator(1); + windowId = winIdGenerator.fetchAndAddRelaxed(1); +} + +QFbWindow::~QFbWindow() +{ + platformScreen()->removeWindow(this); +} + +QFbScreen *QFbWindow::platformScreen() const +{ + return static_cast(window()->screen()->handle()); +} + void QFbWindow::setGeometry(const QRect &rect) { -// store previous geometry for screen update + // store previous geometry for screen update oldGeometry = geometry(); - - QList::const_iterator i = mScreens.constBegin(); - QList::const_iterator end = mScreens.constEnd(); - while (i != end) { - (*i)->invalidateRectCache(); - ++i; - } -//### QWindowSystemInterface::handleGeometryChange(window(), rect); + platformScreen()->invalidateRectCache(); + //### QWindowSystemInterface::handleGeometryChange(window(), rect); QPlatformWindow::setGeometry(rect); } @@ -64,24 +77,14 @@ void QFbWindow::setGeometry(const QRect &rect) void QFbWindow::setVisible(bool visible) { visibleFlag = visible; - QList::const_iterator i = mScreens.constBegin(); - QList::const_iterator end = mScreens.constEnd(); - while (i != end) { - (*i)->invalidateRectCache(); - (*i)->setDirty(geometry()); - ++i; - } + platformScreen()->invalidateRectCache(); + platformScreen()->setDirty(geometry()); } Qt::WindowFlags QFbWindow::setWindowFlags(Qt::WindowFlags type) { flags = type; - QList::const_iterator i = mScreens.constBegin(); - QList::const_iterator end = mScreens.constEnd(); - while (i != end) { - (*i)->invalidateRectCache(); - ++i; - } + platformScreen()->invalidateRectCache(); return flags; } @@ -90,41 +93,14 @@ Qt::WindowFlags QFbWindow::windowFlags() const return flags; } -QFbWindow::QFbWindow(QWindow *window) - : QPlatformWindow(window), mBackingStore(0), visibleFlag(false) -{ - static QAtomicInt winIdGenerator(1); - windowId = winIdGenerator.fetchAndAddRelaxed(1); -} - -QFbWindow::~QFbWindow() -{ - QList::const_iterator i = mScreens.constBegin(); - QList::const_iterator end = mScreens.constEnd(); - while (i != end) { - (*i)->removeWindow(this); - ++i; - } -} - void QFbWindow::raise() { - QList::const_iterator i = mScreens.constBegin(); - QList::const_iterator end = mScreens.constEnd(); - while (i != end) { - (*i)->raise(this); - ++i; - } + platformScreen()->raise(this); } void QFbWindow::lower() { - QList::const_iterator i = mScreens.constBegin(); - QList::const_iterator end = mScreens.constEnd(); - while (i != end) { - (*i)->lower(this); - ++i; - } + platformScreen()->lower(this); } void QFbWindow::repaint(const QRegion ®ion) @@ -136,20 +112,13 @@ void QFbWindow::repaint(const QRegion ®ion) currentGeometry.top() + dirtyClient.top(), dirtyClient.width(), dirtyClient.height()); - QList::const_iterator i = mScreens.constBegin(); - QList::const_iterator end = mScreens.constEnd(); QRect oldGeometryLocal = oldGeometry; oldGeometry = currentGeometry; - while (i != end) { - // If this is a move, redraw the previous location - if (oldGeometryLocal != currentGeometry) { - (*i)->setDirty(oldGeometryLocal); - } - (*i)->setDirty(dirtyRegion); - ++i; - } + // If this is a move, redraw the previous location + if (oldGeometryLocal != currentGeometry) + platformScreen()->setDirty(oldGeometryLocal); + platformScreen()->setDirty(dirtyRegion); } - QT_END_NAMESPACE -- cgit v1.2.3