From cc43928a970c2ceb5143e3616f67c888f82849aa Mon Sep 17 00:00:00 2001 From: Arthur Arlt Date: Tue, 28 Jun 2011 13:50:24 +0200 Subject: [PATCH] Use QVector for screen edge windows instead of Window array The code was updated to use a QVector for the screen edge windows instead of an ordinary Window array. The getter method windows() was updated to return now this QVector. In the method propagateClients() in layers.cpp the newWindowStack QVector is filled by iteration through the screen edge windows and only adding Windows that are not None. --- layers.cpp | 7 ++++++- screenedge.cpp | 12 +++--------- screenedge.h | 4 ++-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/layers.cpp b/layers.cpp index 1273ec073c..ce579e751e 100644 --- a/layers.cpp +++ b/layers.cpp @@ -155,7 +155,12 @@ void Workspace::propagateClients(bool propagate_new_clients) // it ensures that no client will be ever shown above override-redirect // windows (e.g. popups). newWindowStack << (Window*)supportWindow->winId(); - newWindowStack << m_screenEdge.windows(); + QVectorIterator it(m_screenEdge.windows()); + while (it.hasNext()) { + if ((Window)it.next() != None) { + newWindowStack << (Window*)⁢ + } + } for (int i = stacking_order.size() - 1; i >= 0; i--) { if (stacking_order.at(i)->hiddenPreview()) { continue; diff --git a/screenedge.cpp b/screenedge.cpp index fe51bae221..e612461559 100644 --- a/screenedge.cpp +++ b/screenedge.cpp @@ -48,10 +48,10 @@ namespace KWin { ScreenEdge::ScreenEdge() : QObject(NULL) + , m_screenEdgeWindows(ELECTRIC_COUNT, None) { for (int i = 0; i < ELECTRIC_COUNT; ++i) { m_screenEdgeReserved[i] = 0; - m_screenEdgeWindows[i] = None; } } @@ -377,15 +377,9 @@ void ScreenEdge::raiseWindows() delete [] windows; } -const QVector< Window* >& ScreenEdge::windows() +const QVector< Window >& ScreenEdge::windows() { - QVector< Window* >* screenEdgeWindows = new QVector< Window* >(); - for (int i = 0; i <= ELECTRIC_COUNT; ++i) { - if (m_screenEdgeWindows[i] != None) { - screenEdgeWindows->append((Window*)m_screenEdgeWindows[i]); - } - } - return *screenEdgeWindows; + return m_screenEdgeWindows; } } //namespace diff --git a/screenedge.h b/screenedge.h index 205552977f..006866d65c 100644 --- a/screenedge.h +++ b/screenedge.h @@ -104,7 +104,7 @@ public: * Returns a QVector of all existing screen edge windows * @return all existing screen edge windows in a QVector */ - const QVector< Window* >& windows(); + const QVector< Window >& windows(); public Q_SLOTS: /** * Update the screen edge windows. Add new ones if the user specified @@ -119,8 +119,8 @@ private: */ void switchDesktop(ElectricBorder border, const QPoint& pos); + QVector< Window > m_screenEdgeWindows; ElectricBorder m_currentScreenEdge; - Window m_screenEdgeWindows[ELECTRIC_COUNT]; int m_screenEdgeLeft; int m_screenEdgeRight; int m_screenEdgeTop;