From 93d95ffbc486c161c7844a04693e556cd8b7a9e6 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 25 May 2021 09:32:55 +0300 Subject: [PATCH] Replace AbstractClient::doPerformInteractiveMoveResize() with a simpler solution AbstractClient::doPerformInteractiveMoveResize() is only used by the X11Client to reset a boolean flag when the client doesn't support sync counters. X11Client can call performInteractiveMoveResize() only in two cases: the sync request timer expires or the client increments the sync counter. This change removes the AbstractClient::doPerformInteractiveMoveResize() function and adds a function to handle the case where the sync timer expires explicitly. This removes a virtual function in the AbstractClient and makes code more readable. --- src/abstract_client.cpp | 5 ----- src/abstract_client.h | 7 ------- src/x11client.cpp | 5 +++-- src/x11client.h | 2 +- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/abstract_client.cpp b/src/abstract_client.cpp index 5ae514b390..d0e011db9b 100644 --- a/src/abstract_client.cpp +++ b/src/abstract_client.cpp @@ -1431,7 +1431,6 @@ void AbstractClient::performInteractiveMoveResize() } else if (isInteractiveResize() && !haveResizeEffect()) { resize(moveResizeGeom.size()); } - doPerformInteractiveMoveResize(); positionGeometryTip(); emit clientStepUserMovedResized(this, moveResizeGeom); } @@ -2139,10 +2138,6 @@ void AbstractClient::positionGeometryTip() { } -void AbstractClient::doPerformInteractiveMoveResize() -{ -} - bool AbstractClient::isWaitingForInteractiveMoveResizeSync() const { return false; diff --git a/src/abstract_client.h b/src/abstract_client.h index 5bb1647d68..2622b61b60 100644 --- a/src/abstract_client.h +++ b/src/abstract_client.h @@ -1159,13 +1159,6 @@ protected: virtual void leaveInteractiveMoveResize(); virtual void positionGeometryTip(); void performInteractiveMoveResize(); - /** - * Called from performMoveResize() after actually performing the change of geometry. - * Implementing subclasses can perform windowing system specific handling here. - * - * Default implementation does nothing. - */ - virtual void doPerformInteractiveMoveResize(); /* * Checks if the mouse cursor is near the edge of the screen and if so * activates quick tiling or maximization diff --git a/src/x11client.cpp b/src/x11client.cpp index 05a903b9a4..9339c9ecbb 100644 --- a/src/x11client.cpp +++ b/src/x11client.cpp @@ -4514,7 +4514,7 @@ void X11Client::doInteractiveResizeSync() { if (!m_syncRequest.timeout) { m_syncRequest.timeout = new QTimer(this); - connect(m_syncRequest.timeout, &QTimer::timeout, this, &X11Client::performInteractiveMoveResize); + connect(m_syncRequest.timeout, &QTimer::timeout, this, &X11Client::handleSyncTimeout); m_syncRequest.timeout->setSingleShot(true); } if (m_syncRequest.counter != XCB_NONE) { @@ -4536,11 +4536,12 @@ void X11Client::doInteractiveResizeSync() m_client.setGeometry(QRect(QPoint(0, 0), moveResizeClientGeometry.size())); } -void X11Client::doPerformInteractiveMoveResize() +void X11Client::handleSyncTimeout() { if (m_syncRequest.counter == XCB_NONE) { // client w/o XSYNC support. allow the next resize event m_syncRequest.isPending = false; // NEVER do this for clients with a valid counter } // (leads to sync request races in some clients) + performInteractiveMoveResize(); } NETExtendedStrut X11Client::strut() const diff --git a/src/x11client.h b/src/x11client.h index 749ad9d315..68e17005d4 100644 --- a/src/x11client.h +++ b/src/x11client.h @@ -280,6 +280,7 @@ public: } virtual bool wantsSyncCounter() const; void handleSync(); + void handleSyncTimeout(); static void cleanupX11(); @@ -319,7 +320,6 @@ protected: void doSetDemandsAttention() override; bool belongsToDesktop() const override; bool doStartInteractiveMoveResize() override; - void doPerformInteractiveMoveResize() override; bool isWaitingForInteractiveMoveResizeSync() const override; void doInteractiveResizeSync() override; QSize resizeIncrements() const override;