From cd368384f4028a1c5cd9664ae72cf767fd06b10c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sun, 28 Oct 2012 13:53:08 +0100 Subject: [PATCH] Clock unsynced resizes For clients w/o XSYNC support, limit resizes to 30Hz to take pointless load from client and X11 REVIEW: 107087 --- geometry.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/geometry.cpp b/geometry.cpp index e3260eb714..89a9186f50 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -2679,6 +2679,8 @@ void Client::leaveMoveResize() workspace()->setClientIsMoving(0); moveResizeMode = false; #ifdef HAVE_XSYNC + if (syncRequest.counter == None) // don't forget to sanitize since the timeout will no more fire + syncRequest.isPending = false; delete syncRequest.timeout; syncRequest.timeout = NULL; #endif @@ -3032,14 +3034,19 @@ void Client::handleMoveResize(int x, int y, int x_root, int y_root) return; #ifdef HAVE_XSYNC - if (isResize() && syncRequest.counter != None && !s_haveResizeEffect) { + if (isResize() && !s_haveResizeEffect) { if (!syncRequest.timeout) { syncRequest.timeout = new QTimer(this); connect(syncRequest.timeout, SIGNAL(timeout()), SLOT(performMoveResize())); syncRequest.timeout->setSingleShot(true); } - syncRequest.timeout->start(250); - sendSyncRequest(); + if (syncRequest.counter != None) { + syncRequest.timeout->start(250); + sendSyncRequest(); + } else { // for clients not supporting the XSYNC protocol, we + syncRequest.isPending = true; // limit the resizes to 30Hz to take pointless load from X11 + syncRequest.timeout->start(33); // and the client, the mouse is still moved a full speed + } // and no human can control faster resizes anyway XMoveResizeWindow(display(), window(), 0, 0, moveResizeGeom.width() - (border_left + border_right), moveResizeGeom.height() - (border_top + border_bottom)); } else #endif @@ -3058,7 +3065,10 @@ void Client::performMoveResize() setGeometry(moveResizeGeom); } #ifdef HAVE_XSYNC - if (isResize() && syncRequest.counter != None) + if (syncRequest.counter == None) // client w/o XSYNC support. allow the next resize event + syncRequest.isPending = false; // NEVER do this for clients with a valid counter + // (leads to sync request races in some clients) + if (isResize()) addRepaintFull(); #endif positionGeometryTip();