Commit 1a9238f2 authored by David Edmundson's avatar David Edmundson
Browse files

Handle scale override in locked and confined pointers

BUG: 460532


(cherry picked from commit 1df10c35)
parent ef29411f
Pipeline #249927 canceled with stage
in 34 seconds
......@@ -16,6 +16,15 @@ namespace KWaylandServer
{
static const int s_version = 1;
static QRegion mapScaleOverride(const QRegion &region, qreal scaleOverride)
{
QRegion out;
for (const QRect &rect : region) {
out += QRect(rect.topLeft() / scaleOverride, rect.size() / scaleOverride);
}
return out;
}
PointerConstraintsV1InterfacePrivate::PointerConstraintsV1InterfacePrivate(Display *display)
: QtWaylandServer::zwp_pointer_constraints_v1(*display, s_version)
{
......@@ -138,13 +147,14 @@ LockedPointerV1InterfacePrivate::LockedPointerV1InterfacePrivate(LockedPointerV1
void LockedPointerV1InterfacePrivate::commit()
{
qreal scaleOverride = surface->scaleOverride();
if (hasPendingRegion) {
region = pendingRegion;
region = mapScaleOverride(pendingRegion, scaleOverride);
hasPendingRegion = false;
Q_EMIT q->regionChanged();
}
if (hasPendingHint) {
hint = pendingHint;
hint = pendingHint / scaleOverride;
hasPendingHint = false;
Q_EMIT q->cursorPositionHintChanged();
}
......@@ -243,8 +253,9 @@ ConfinedPointerV1InterfacePrivate::ConfinedPointerV1InterfacePrivate(ConfinedPoi
void ConfinedPointerV1InterfacePrivate::commit()
{
qreal scaleOverride = surface->scaleOverride();
if (hasPendingRegion) {
region = pendingRegion;
region = mapScaleOverride(pendingRegion, scaleOverride);
hasPendingRegion = false;
Q_EMIT q->regionChanged();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment