From 81b05bd87ee6ab4ec91f2a13b16d3bbe399dc954 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 26 Jan 2023 11:54:40 +0200 Subject: [PATCH] Avoid mistriggering quick tiling when using custom tiling If user has chosen custom tiling, ensure that quick tiling state is reset. BUG: 464810 --- src/window.cpp | 27 +++++++++++++++++++++------ src/window.h | 1 + 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/window.cpp b/src/window.cpp index 63e34fec71..b8ed9997f6 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1799,11 +1799,10 @@ void Window::handleInteractiveMoveResize(const QPointF &local, const QPointF &gl setMoveResizeGeometry(geom_restore); } handleInteractiveMoveResize(local.x(), local.y(), global.x(), global.y()); // fix position - } else if (quickTileMode() == QuickTileMode(QuickTileFlag::None) && isResizable()) { - checkQuickTilingMaximizationZones(global.x(), global.y()); } if (input()->modifiersRelevantForGlobalShortcuts() & Qt::ShiftModifier) { + resetQuickTilingMaximizationZones(); const auto &r = quickTileGeometry(QuickTileFlag::Custom, global); if (r.isEmpty()) { workspace()->outline()->hide(); @@ -1812,10 +1811,15 @@ void Window::handleInteractiveMoveResize(const QPointF &local, const QPointF &gl workspace()->outline()->show(r.toRect(), moveResizeGeometry().toRect()); } } - } else if (!m_electricMaximizing) { - // Only if we are in an electric maximizing gesture we should keep the outline, - // otherwise we must make sure it's hidden - workspace()->outline()->hide(); + } else { + if (quickTileMode() == QuickTileMode(QuickTileFlag::None) && isResizable()) { + checkQuickTilingMaximizationZones(global.x(), global.y()); + } + if (!m_electricMaximizing) { + // Only if we are in an electric maximizing gesture we should keep the outline, + // otherwise we must make sure it's hidden + workspace()->outline()->hide(); + } } } } @@ -2905,6 +2909,17 @@ void Window::checkQuickTilingMaximizationZones(int xroot, int yroot) } } +void Window::resetQuickTilingMaximizationZones() +{ + if (electricBorderMode() != QuickTileMode(QuickTileFlag::None)) { + if (m_electricMaximizingDelay) { + m_electricMaximizingDelay->stop(); + } + setElectricBorderMaximizing(false); + setElectricBorderMode(QuickTileFlag::None); + } +} + void Window::keyPressEvent(uint key_code) { if (!isInteractiveMove() && !isInteractiveResize()) { diff --git a/src/window.h b/src/window.h index 68fc2a2f0c..b9126830de 100644 --- a/src/window.h +++ b/src/window.h @@ -1841,6 +1841,7 @@ protected: * activates quick tiling or maximization */ void checkQuickTilingMaximizationZones(int xroot, int yroot); + void resetQuickTilingMaximizationZones(); /** * Whether a sync request is still pending. * Default implementation returns @c false.