Client: Replace a bunch of frameMargins with clientSideMargins

Use it wherever window coordinates should be translated to surface
coordinates

This also fixes the usage of QWindow::mapFromGlobal which is in wrong
coordinate space while handling CSD dragging from pending touch points

Change-Id: I66b114610f0e44fea10535594adb5d1284196662
Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
Ilya Fedin 2024-01-06 23:18:51 +04:00
parent de0be2b5dc
commit 2ab62833e2
2 changed files with 3 additions and 3 deletions

View File

@ -1560,9 +1560,9 @@ void QWaylandInputDevice::Touch::touch_frame()
const QWindowSystemInterface::TouchPoint &tp = mPendingTouchPoints.constLast();
// When the touch event is received, the global pos is calculated with the margins
// in mind. Now we need to adjust again to get the correct local pos back.
QMargins margins = window->frameMargins();
QMargins margins = mFocus->clientSideMargins();
QPoint p = tp.area.center().toPoint();
QPointF localPos(window->mapFromGlobal(QPoint(p.x() + margins.left(), p.y() + margins.top())));
QPointF localPos(mFocus->mapFromGlobal(p) + QPoint(margins.left(), margins.top()));
if (mFocus->touchDragDecoration(mParent, localPos, tp.area.center(), tp.state, mParent->modifiers()))
return;
}

View File

@ -1376,7 +1376,7 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe
return;
}
QMargins marg = frameMargins();
QMargins marg = clientSideMargins();
QRect windowRect(0 + marg.left(),
0 + marg.top(),
geometry().size().width(),