<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/D5704" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>So far KWin only updated the x11 timestamp if the new timestamp is larger<br />
than the existing one. While this is a useful thing it creates problems<br />
when the 32 bit msec based time stamp wraps around which happens after<br />
running an X server for 49 days. After the timestamp wrapped around KWin<br />
would not update the timestamp any more and thus some calls might fail.<br />
Most prominent victims are keyboard and pointer grab which fails as the<br />
timestamp is either larger than the server timestamp or smaller than the<br />
last grab timestamp.</p>

<p>Another problem related to timestamp handling is KWin getting broken by<br />
wrong timestamps sent by applications. A prominent example is clusterssh<br />
which used to send a timestamp as unix time which is larger than the<br />
x timestamp and thus our timestamp gets too large.</p>

<p>This change addresses these problems by allowing to reset the timestamp.<br />
This is only used from updateXTime (which is normally invoked before we<br />
do things like grabKeyboard). Thus we make QX11Info::getTimestamp the<br />
ultimate trusted source for timestamps.</p>

<p>BUG: 377901<br />
BUG: 348569<br />
FIXED-IN: 5.8.7</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>As I cannot wait 50 days: unit tests for the two conditions added.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R108 KWin</div></div></div><br /><div><strong>BRANCH</strong><div><div>x11-timestamp-handling-5.8</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D5704" rel="noreferrer">https://phabricator.kde.org/D5704</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>autotests/CMakeLists.txt<br />
autotests/test_x11_timestamp_update.cpp<br />
main.h<br />
utils.cpp<br />
utils.h</div></div></div><br /><div><strong>To: </strong>graesslin, KWin, Plasma<br /><strong>Cc: </strong>plasma-devel, kwin, spstarr, progwolff, Zren, lesliezhai, ali-mohamed, hardening, jensreuterberg, abetts, sebas, apol, lukas<br /></div>