<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/D5182" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>Consider the following situation: we have three InputEventFilter linked<br />
in the sequence A - B - C.</p>

<p>The input filters are processing pointer motion events. The expected<br />
behavior is that the new motion is processed in the sequence</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">A -> B -> C</pre></div>

<p>So far this did not work correctly if the pointer gets warped during the<br />
processing. If e.g. filter B warps the pointer we get a motion sequence:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">A (1) -> B (1) -> A (2) -> B (2) -> C (2) -> C (1)</pre></div>

<p>The filters following the one warping the pointer get first the newer<br />
than the older position. This is obviously wrong. Unfortunately it is not<br />
just a theoretical condition, but a condition happening when interacting<br />
with the screenedges, which warp the pointer.</p>

<p>This change introduces a PositionUpdateBlocker in<br />
PointerInputRedirection::processMotion to ensure that a processMotion<br />
call finishes prior to the next update. If the PositionUpdateBlocker is<br />
blocked the new position gets scheduled and processed once the<br />
PositionUpdateBlocker gets destroyed.</p>

<p>With this we get the expected sequence for B warping pointer:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">A (1) -> B (1) -> C (1) -> A (2) -> B (2) -> C (2)</pre></div>

<p>This should hopefully improve the interaction with screen edges on<br />
Wayland.</p>

<p>CCBUG: 374867</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Added an auto test demonstrating the issue of incorrect<br />
ordering caused by screenedges. Prior to the change the test is failing.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R108 KWin</div></div></div><br /><div><strong>BRANCH</strong><div><div>position-update-blocker</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D5182" rel="noreferrer">https://phabricator.kde.org/D5182</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>autotests/integration/pointer_input.cpp<br />
pointer_input.cpp</div></div></div><br /><div><strong>To: </strong>graesslin, KWin, Plasma<br /><strong>Cc: </strong>plasma-devel, kwin, progwolff, lesliezhai, ali-mohamed, hardening, jensreuterberg, abetts, sebas, apol<br /></div>