Use QVector<Window> 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.
This commit is contained in:
Arthur Arlt 2011-06-28 13:50:24 +02:00
parent f73fb783ca
commit cc43928a97
3 changed files with 11 additions and 12 deletions

View file

@ -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<Window> it(m_screenEdge.windows());
while (it.hasNext()) {
if ((Window)it.next() != None) {
newWindowStack << (Window*)&it;
}
}
for (int i = stacking_order.size() - 1; i >= 0; i--) {
if (stacking_order.at(i)->hiddenPreview()) {
continue;

View file

@ -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

View file

@ -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;