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

View file

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