Introduce a method Workspace::markXStackingOrderAsDirty

This method replaces the calls x_stacking_dirty = true in the code base
allowing for further refactoring of that functionality.
This commit is contained in:
Martin Flöser 2017-06-21 06:56:53 +02:00
parent be89c16b38
commit 0d8f11405e
4 changed files with 19 additions and 12 deletions

View file

@ -330,7 +330,7 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
break;
case XCB_CONFIGURE_NOTIFY:
if (reinterpret_cast<xcb_configure_notify_event_t*>(e)->event == rootWindow())
x_stacking_dirty = true;
markXStackingOrderAsDirty();
break;
};

View file

@ -226,7 +226,7 @@ void Workspace::propagateClients(bool propagate_new_clients)
// Make the cached stacking order invalid here, in case we need the new stacking order before we get
// the matching event, due to X being asynchronous.
x_stacking_dirty = true;
markXStackingOrderAsDirty();
}
/*!

View file

@ -392,7 +392,7 @@ void Workspace::init()
if (!stacking_order.contains(c)) // It'll be updated later, and updateToolWindows() requires
stacking_order.append(c); // c to be in stacking_order
}
x_stacking_dirty = true;
markXStackingOrderAsDirty();
updateStackingOrder(true);
updateClientArea();
if (c->wantsInput()) {
@ -406,7 +406,7 @@ void Workspace::init()
QRect area = clientArea(PlacementArea, Screens::self()->current(), c->desktop());
c->placeIn(area);
}
x_stacking_dirty = true;
markXStackingOrderAsDirty();
updateStackingOrder(true);
updateClientArea();
if (c->wantsInput()) {
@ -416,7 +416,7 @@ void Workspace::init()
);
connect(c, &ShellClient::windowHidden, this,
[this] {
x_stacking_dirty = true;
markXStackingOrderAsDirty();
updateStackingOrder(true);
updateClientArea();
}
@ -431,7 +431,7 @@ void Workspace::init()
}
clientHidden(c);
emit clientRemoved(c);
x_stacking_dirty = true;
markXStackingOrderAsDirty();
updateStackingOrder(true);
updateClientArea();
}
@ -562,7 +562,7 @@ void Workspace::addClient(Client* c)
unconstrained_stacking_order.append(c); // Raise if it hasn't got any stacking position yet
if (!stacking_order.contains(c)) // It'll be updated later, and updateToolWindows() requires
stacking_order.append(c); // c to be in stacking_order
x_stacking_dirty = true;
markXStackingOrderAsDirty();
updateClientArea(); // This cannot be in manage(), because the client got added only now
updateClientLayer(c);
if (c->isDesktop()) {
@ -586,7 +586,7 @@ void Workspace::addClient(Client* c)
void Workspace::addUnmanaged(Unmanaged* c)
{
unmanaged.append(c);
x_stacking_dirty = true;
markXStackingOrderAsDirty();
}
/**
@ -622,7 +622,7 @@ void Workspace::removeClient(Client* c)
clients.removeAll(c);
m_allClients.removeAll(c);
desktops.removeAll(c);
x_stacking_dirty = true;
markXStackingOrderAsDirty();
attention_chain.removeAll(c);
Group* group = findGroup(c->window());
if (group != NULL)
@ -652,7 +652,7 @@ void Workspace::removeUnmanaged(Unmanaged* c)
assert(unmanaged.contains(c));
unmanaged.removeAll(c);
emit unmanagedRemoved(c);
x_stacking_dirty = true;
markXStackingOrderAsDirty();
}
void Workspace::addDeleted(Deleted* c, Toplevel *orig)
@ -671,7 +671,7 @@ void Workspace::addDeleted(Deleted* c, Toplevel *orig)
} else {
stacking_order.append(c);
}
x_stacking_dirty = true;
markXStackingOrderAsDirty();
connect(c, SIGNAL(needsRepaint()), m_compositor, SLOT(scheduleRepaint()));
}
@ -682,7 +682,7 @@ void Workspace::removeDeleted(Deleted* c)
deleted.removeAll(c);
unconstrained_stacking_order.removeAll(c);
stacking_order.removeAll(c);
x_stacking_dirty = true;
markXStackingOrderAsDirty();
if (c->wasClient() && m_compositor) {
m_compositor->updateCompositeBlocking();
}
@ -1766,5 +1766,10 @@ Toplevel *Workspace::findInternal(QWindow *w) const
}
}
void Workspace::markXStackingOrderAsDirty()
{
x_stacking_dirty = true;
}
} // namespace

View file

@ -546,6 +546,8 @@ private:
static NET::WindowType txtToWindowType(const char* txt);
static bool sessionInfoWindowTypeMatch(Client* c, SessionInfo* info);
void markXStackingOrderAsDirty();
AbstractClient* active_client;
AbstractClient* last_active_client;
AbstractClient* most_recently_raised; // Used ONLY by raiseOrLowerClient()