Handle scale override in locked and confined pointers
BUG: 460532
This commit is contained in:
parent
dae7d738a3
commit
1df10c3518
1 changed files with 14 additions and 3 deletions
|
@ -16,6 +16,15 @@ namespace KWaylandServer
|
||||||
{
|
{
|
||||||
static const int s_version = 1;
|
static const int s_version = 1;
|
||||||
|
|
||||||
|
static QRegion mapScaleOverride(const QRegion ®ion, qreal scaleOverride)
|
||||||
|
{
|
||||||
|
QRegion out;
|
||||||
|
for (const QRect &rect : region) {
|
||||||
|
out += QRect(rect.topLeft() / scaleOverride, rect.size() / scaleOverride);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
PointerConstraintsV1InterfacePrivate::PointerConstraintsV1InterfacePrivate(Display *display)
|
PointerConstraintsV1InterfacePrivate::PointerConstraintsV1InterfacePrivate(Display *display)
|
||||||
: QtWaylandServer::zwp_pointer_constraints_v1(*display, s_version)
|
: QtWaylandServer::zwp_pointer_constraints_v1(*display, s_version)
|
||||||
{
|
{
|
||||||
|
@ -138,13 +147,14 @@ LockedPointerV1InterfacePrivate::LockedPointerV1InterfacePrivate(LockedPointerV1
|
||||||
|
|
||||||
void LockedPointerV1InterfacePrivate::commit()
|
void LockedPointerV1InterfacePrivate::commit()
|
||||||
{
|
{
|
||||||
|
qreal scaleOverride = surface->scaleOverride();
|
||||||
if (hasPendingRegion) {
|
if (hasPendingRegion) {
|
||||||
region = pendingRegion;
|
region = mapScaleOverride(pendingRegion, scaleOverride);
|
||||||
hasPendingRegion = false;
|
hasPendingRegion = false;
|
||||||
Q_EMIT q->regionChanged();
|
Q_EMIT q->regionChanged();
|
||||||
}
|
}
|
||||||
if (hasPendingHint) {
|
if (hasPendingHint) {
|
||||||
hint = pendingHint;
|
hint = pendingHint / scaleOverride;
|
||||||
hasPendingHint = false;
|
hasPendingHint = false;
|
||||||
Q_EMIT q->cursorPositionHintChanged();
|
Q_EMIT q->cursorPositionHintChanged();
|
||||||
}
|
}
|
||||||
|
@ -243,8 +253,9 @@ ConfinedPointerV1InterfacePrivate::ConfinedPointerV1InterfacePrivate(ConfinedPoi
|
||||||
|
|
||||||
void ConfinedPointerV1InterfacePrivate::commit()
|
void ConfinedPointerV1InterfacePrivate::commit()
|
||||||
{
|
{
|
||||||
|
qreal scaleOverride = surface->scaleOverride();
|
||||||
if (hasPendingRegion) {
|
if (hasPendingRegion) {
|
||||||
region = pendingRegion;
|
region = mapScaleOverride(pendingRegion, scaleOverride);
|
||||||
hasPendingRegion = false;
|
hasPendingRegion = false;
|
||||||
Q_EMIT q->regionChanged();
|
Q_EMIT q->regionChanged();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue