Port more stuff away from Cursor::pos() to interactiveMoveResizeAnchor()

The main benefit from doing this is that kwin is going to handle
maximizing the window by dragging it on touchscreen correctly if the
pointer focus point and touch focus point are on different screens.
This commit is contained in:
Vlad Zahorodnii 2024-03-15 23:38:49 +02:00
parent e8ae03d799
commit 8cae7f7186
3 changed files with 4 additions and 4 deletions

View file

@ -2529,7 +2529,7 @@ void Window::keyPressEvent(uint key_code)
key_code = key_code & ~Qt::KeyboardModifierMask;
int delta = is_control ? 1 : is_alt ? 32
: 8;
QPointF pos = Cursors::self()->mouse()->pos();
QPointF pos = interactiveMoveResizeAnchor();
switch (key_code) {
case Qt::Key_Left:
pos.rx() -= delta;
@ -3368,7 +3368,7 @@ void Window::setElectricBorderMaximizing(bool maximizing)
{
m_electricMaximizing = maximizing;
if (maximizing) {
workspace()->outline()->show(quickTileGeometry(electricBorderMode(), Cursors::self()->mouse()->pos()).toRect(), moveResizeGeometry().toRect());
workspace()->outline()->show(quickTileGeometry(electricBorderMode(), interactiveMoveResizeAnchor()).toRect(), moveResizeGeometry().toRect());
} else {
workspace()->outline()->hide();
}

View file

@ -4432,7 +4432,7 @@ void X11Window::maximize(MaximizeMode mode)
QRectF clientArea;
if (isElectricBorderMaximizing()) {
clientArea = workspace()->clientArea(MaximizeArea, this, Cursors::self()->mouse()->pos());
clientArea = workspace()->clientArea(MaximizeArea, this, interactiveMoveResizeAnchor());
} else {
clientArea = workspace()->clientArea(MaximizeArea, this, moveResizeOutput());
}

View file

@ -1484,7 +1484,7 @@ void XdgToplevelWindow::maximize(MaximizeMode mode)
return;
}
const QRectF clientArea = isElectricBorderMaximizing() ? workspace()->clientArea(MaximizeArea, this, Cursors::self()->mouse()->pos()) : workspace()->clientArea(MaximizeArea, this, moveResizeOutput());
const QRectF clientArea = isElectricBorderMaximizing() ? workspace()->clientArea(MaximizeArea, this, interactiveMoveResizeAnchor()) : workspace()->clientArea(MaximizeArea, this, moveResizeOutput());
const MaximizeMode oldMode = m_requestedMaximizeMode;
const QRectF oldGeometry = moveResizeGeometry();