Keep timestamp of last syncRequest and update with xTime on each sync
The sync protocol with e.g. Qt 4 windows is broken if our app time is older than the one of the last sync alarm event. Thus we keep a timestamp in the syncRequest struct of the last sent sync request. If the timestamp is newer than our xTime when sending the next request, we update the xTime to ensure that we have a new timestamp again. BUG: 333512 REVIEW: 117734icc-effect-5.14.5
parent
f44575ddbf
commit
7d302b9039
|
@ -236,6 +236,7 @@ Client::Client()
|
|||
// TODO: Do all as initialization
|
||||
syncRequest.counter = syncRequest.alarm = XCB_NONE;
|
||||
syncRequest.timeout = syncRequest.failsafeTimeout = NULL;
|
||||
syncRequest.lastTimestamp = xTime();
|
||||
syncRequest.isPending = false;
|
||||
|
||||
// Set the initial mapping state
|
||||
|
@ -2220,6 +2221,7 @@ void Client::sendSyncRequest()
|
|||
syncRequest.counter = syncRequest.alarm = XCB_NONE;
|
||||
delete syncRequest.timeout; delete syncRequest.failsafeTimeout;
|
||||
syncRequest.timeout = syncRequest.failsafeTimeout = nullptr;
|
||||
syncRequest.lastTimestamp = XCB_CURRENT_TIME;
|
||||
}
|
||||
);
|
||||
syncRequest.failsafeTimeout->setSingleShot(true);
|
||||
|
@ -2236,6 +2238,9 @@ void Client::sendSyncRequest()
|
|||
if (oldLo > syncRequest.value.lo) {
|
||||
syncRequest.value.hi++;
|
||||
}
|
||||
if (syncRequest.lastTimestamp >= xTime()) {
|
||||
updateXTime();
|
||||
}
|
||||
|
||||
// Send the message to client
|
||||
XEvent ev;
|
||||
|
@ -2249,6 +2254,7 @@ void Client::sendSyncRequest()
|
|||
ev.xclient.data.l[3] = syncRequest.value.hi;
|
||||
ev.xclient.data.l[4] = 0;
|
||||
syncRequest.isPending = true;
|
||||
syncRequest.lastTimestamp = xTime();
|
||||
XSendEvent(display(), window(), False, NoEventMask, &ev);
|
||||
Xcb::sync();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue