From 670c71f11eb7bb9ae62719c236e4b0415fdb1400 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sun, 10 Mar 2024 14:11:36 +0200 Subject: [PATCH] Don't block interactive moves by sync requests The compositor doesn't need to synchronize with the client when moving windows, except cases like unmaximizing the window. It's needed only when resizing to avoid overwhelming the client with configure notify events. --- src/window.cpp | 22 ++++++++++------------ src/window.h | 2 +- src/x11window.cpp | 2 +- src/x11window.h | 2 +- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/window.cpp b/src/window.cpp index 7353fee097..56162fa3d9 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1378,10 +1378,6 @@ void Window::updateInteractiveMoveResize(const QPointF ¤tGlobalCursor) void Window::handleInteractiveMoveResize(const QPointF &local, const QPointF &global) { - if (isWaitingForInteractiveMoveResizeSync()) { - return; // we're still waiting for the client or the timeout - } - const Gravity gravity = interactiveMoveResizeGravity(); if ((gravity == Gravity::None && !isMovableAcrossScreens()) || (gravity != Gravity::None && (isShade() || !isResizable()))) { @@ -1407,17 +1403,19 @@ void Window::handleInteractiveMoveResize(const QPointF &local, const QPointF &gl setShade(ShadeNone); } - if (isInteractiveResize()) { - if (m_tile && m_tile->supportsResizeGravity(gravity)) { - m_tile->resizeFromGravity(gravity, global.x(), global.y()); - return; - } - } - const QRectF currentMoveResizeGeom = moveResizeGeometry(); QRectF nextMoveResizeGeom = currentMoveResizeGeom; if (isInteractiveResize()) { + if (isWaitingForInteractiveResizeSync()) { + return; // we're still waiting for the client or the timeout + } + + if (m_tile && m_tile->supportsResizeGravity(gravity)) { + m_tile->resizeFromGravity(gravity, global.x(), global.y()); + return; + } + nextMoveResizeGeom = nextInteractiveResizeGeometry(global); if (nextMoveResizeGeom != currentMoveResizeGeom) { doInteractiveResizeSync(nextMoveResizeGeom); @@ -2470,7 +2468,7 @@ void Window::doFinishInteractiveMoveResize() { } -bool Window::isWaitingForInteractiveMoveResizeSync() const +bool Window::isWaitingForInteractiveResizeSync() const { return false; } diff --git a/src/window.h b/src/window.h index 6b4216d7ae..8f8c07cad5 100644 --- a/src/window.h +++ b/src/window.h @@ -1667,7 +1667,7 @@ protected: * Whether a sync request is still pending. * Default implementation returns @c false. */ - virtual bool isWaitingForInteractiveMoveResizeSync() const; + virtual bool isWaitingForInteractiveResizeSync() const; /** * Called during handling a resize. Implementing subclasses can use this * method to perform windowing system specific syncing. diff --git a/src/x11window.cpp b/src/x11window.cpp index 5b28d989a0..62a7b6bf85 100644 --- a/src/x11window.cpp +++ b/src/x11window.cpp @@ -4753,7 +4753,7 @@ void X11Window::leaveInteractiveMoveResize() Window::leaveInteractiveMoveResize(); } -bool X11Window::isWaitingForInteractiveMoveResizeSync() const +bool X11Window::isWaitingForInteractiveResizeSync() const { return m_syncRequest.isPending && m_syncRequest.interactiveResize; } diff --git a/src/x11window.h b/src/x11window.h index a4a33f0d7e..ec7102459c 100644 --- a/src/x11window.h +++ b/src/x11window.h @@ -344,7 +344,7 @@ protected: void doSetHiddenByShowDesktop() override; bool belongsToDesktop() const override; bool doStartInteractiveMoveResize() override; - bool isWaitingForInteractiveMoveResizeSync() const override; + bool isWaitingForInteractiveResizeSync() const override; void doInteractiveResizeSync(const QRectF &rect) override; QSizeF resizeIncrements() const override; bool acceptsFocus() const override;