Diffusion KWin 0bec9ad73375

Improve the x11 timestamp handling

Authored by graesslin on May 3 2017, 7:17 PM.


Improve the x11 timestamp handling

So far KWin only updated the x11 timestamp if the new timestamp is larger
than the existing one. While this is a useful thing it creates problems
when the 32 bit msec based time stamp wraps around which happens after
running an X server for 49 days. After the timestamp wrapped around KWin
would not update the timestamp any more and thus some calls might fail.
Most prominent victims are keyboard and pointer grab which fails as the
timestamp is either larger than the server timestamp or smaller than the
last grab timestamp.

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

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

BUG: 377901
BUG: 348569
FIXED-IN: 5.8.7

Test Plan: As I cannot wait 50 days: unit tests for the two conditions added.

Reviewers: KWin, Plasma

Subscribers: plasma-devel, kwin

Tags: KWin

Differential Revision: https://phabricator.kde.org/D5704


graesslinMay 3 2017, 7:36 PM
Differential Revision
D5704: Improve the x11 timestamp handling
R108:f5a43877a9ea: Sort the themes in decoration KCM