Commit ec7fe441 authored by Martin Flöser's avatar Martin Flöser

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
parent f7d6e4af
......@@ -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;
}
//*******************************
......
......@@ -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()
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment