Avoid mistriggering quick tiling when using custom tiling

If user has chosen custom tiling, ensure that quick tiling state is
reset.

BUG: 464810
This commit is contained in:
Vlad Zahorodnii 2023-01-26 11:54:40 +02:00
parent 3e369c46fd
commit 81b05bd87e
2 changed files with 22 additions and 6 deletions

View file

@ -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()) {

View file

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