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.
This commit is contained in:
Vlad Zahorodnii 2021-05-25 09:32:55 +03:00
parent c929d977a7
commit 93d95ffbc4
4 changed files with 4 additions and 15 deletions

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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;