Make xstacking order dirty handling work without X11

Summary:
The xStackingOrder unlike indicated by it's name is relevant for both
X11 and Wayland and contains the stacking order of the windows used for
compositing.

So far it was determined whether it needs to be recreated based on
whether an xcb query is pending. This change introduces a boolean
variable to check whether the stacking order is dirty and guards the X11
specific code to only be run if we have an X11 connection.

This is to my current knowledge the last remaining issue where X11 was
used during the normal Wayland operation mode. Now it should be possible
to re-order the Workspace startup [1] and try to run kwin_wayland without
Wayland support.

[1] Workspace::Workspace and Workspace::init is still highly X11
specific and needs to be split into X11 only and general parts.

Test Plan: Compiles

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7856
This commit is contained in:
Martin Flöser 2017-09-17 09:26:24 +02:00
parent f7d6e4affd
commit ec7fe44190
3 changed files with 8 additions and 3 deletions

View file

@ -693,7 +693,7 @@ bool Workspace::keepTransientAbove(const AbstractClient* mainwindow, const Abstr
// Returns all windows in their stacking order on the root window.
ToplevelList Workspace::xStackingOrder() const
{
if (m_xStackingQueryTree) {
if (m_xStackingDirty) {
const_cast<Workspace*>(this)->updateXStackingOrder();
}
return x_stacking;
@ -707,7 +707,7 @@ void Workspace::updateXStackingOrder()
foreach (Toplevel * c, stacking_order)
x_stacking.append(c);
if (!tree->isNull()) {
if (tree && !tree->isNull()) {
xcb_window_t *windows = tree->children();
const auto count = tree->data()->children_len;
int foundUnmanagedCount = unmanaged.count();
@ -735,6 +735,7 @@ void Workspace::updateXStackingOrder()
}
}
}
m_xStackingDirty = false;
}
//*******************************

View file

@ -1696,7 +1696,10 @@ Toplevel *Workspace::findInternal(QWindow *w) const
void Workspace::markXStackingOrderAsDirty()
{
m_xStackingQueryTree.reset(new Xcb::Tree(rootWindow()));
m_xStackingDirty = true;
if (kwinApp()->x11Connection()) {
m_xStackingQueryTree.reset(new Xcb::Tree(kwinApp()->x11RootWindow()));
}
}
void Workspace::setWasUserInteraction()

View file

@ -565,6 +565,7 @@ private:
bool force_restacking;
ToplevelList x_stacking; // From XQueryTree()
std::unique_ptr<Xcb::Tree> m_xStackingQueryTree;
bool m_xStackingDirty = false;
QList<AbstractClient*> should_get_focus; // Last is most recent
QList<AbstractClient*> attention_chain;