<table><tr><td style="">graesslin created this revision.<br />Restricted Application added a project: KWin.<br />Restricted Application added subscribers: kwin, plasma-devel.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D6323" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>This method replaces the calls x_stacking_dirty = true in the code base<br />
allowing for further refactoring of that functionality.</p>

<p>Remove roundtrip to XServer from Workspace::xStackingOrder</p>

<p>The method xStackingOrder is only used during a Compositor paint pass.<br />
If the stacking order had changed, the method updated the stacking order<br />
from X by performing a sync XQueryTree. With other words we had a round<br />
trip to the X server directly in the paint pass.</p>

<p>This change rearchitectures this area by making better use of xcb. When<br />
we notice that the stacking order changed and an XQueryTree is needed,<br />
we directly send out the request. When xStackingOrder is finally called,<br />
which normally happens a few milliseconds later, the reply is retreived.<br />
In the worst case it still blocks, but in most cases the roundtrip is<br />
gone.</p>

<p>If the stacking order changed again before accessing xStackingOrder the<br />
running request is cancelled and a new request is issued. So whenever we<br />
get into xStackingOrder it will have the current state.</p>

<p>The updating of the xStackingOrder is moved into a dedicated method and<br />
xStackingOrder invokes it through a const_cast instead of operating on<br />
mutable variables.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Normal system usage, no issues</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R108 KWin</div></div></div><br /><div><strong>BRANCH</strong><div><div>xstacking-no-roundtrip</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D6323" rel="noreferrer">https://phabricator.kde.org/D6323</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>composite.cpp<br />
events.cpp<br />
layers.cpp<br />
workspace.cpp<br />
workspace.h</div></div></div><br /><div><strong>To: </strong>graesslin, KWin, Plasma<br /><strong>Cc: </strong>plasma-devel, kwin, ZrenBot, spstarr, progwolff, lesliezhai, ali-mohamed, hardening, jensreuterberg, abetts, sebas, apol, mart, lukas<br /></div>