Commit ef29411f authored by David Edmundson's avatar David Edmundson
Browse files

Move installPointerConstraint calls into the constraint handlers


(cherry picked from commit dae7d738)
parent 569ab0df
Pipeline #249926 failed with stage
in 21 seconds
......@@ -62,9 +62,7 @@ void PointerConstraintsV1InterfacePrivate::zwp_pointer_constraints_v1_lock_point
return;
}
auto lockedPointer = new LockedPointerV1Interface(LockedPointerV1Interface::LifeTime(lifetime), regionFromResource(region_resource), lockedPointerResource);
SurfaceInterfacePrivate::get(surface)->installPointerConstraint(lockedPointer);
new LockedPointerV1Interface(surface, LockedPointerV1Interface::LifeTime(lifetime), regionFromResource(region_resource), lockedPointerResource);
}
void PointerConstraintsV1InterfacePrivate::zwp_pointer_constraints_v1_confine_pointer(Resource *resource,
......@@ -102,10 +100,7 @@ void PointerConstraintsV1InterfacePrivate::zwp_pointer_constraints_v1_confine_po
return;
}
auto confinedPointer =
new ConfinedPointerV1Interface(ConfinedPointerV1Interface::LifeTime(lifetime), regionFromResource(region_resource), confinedPointerResource);
SurfaceInterfacePrivate::get(surface)->installPointerConstraint(confinedPointer);
new ConfinedPointerV1Interface(surface, ConfinedPointerV1Interface::LifeTime(lifetime), regionFromResource(region_resource), confinedPointerResource);
}
void PointerConstraintsV1InterfacePrivate::zwp_pointer_constraints_v1_destroy(Resource *resource)
......@@ -129,11 +124,13 @@ LockedPointerV1InterfacePrivate *LockedPointerV1InterfacePrivate::get(LockedPoin
}
LockedPointerV1InterfacePrivate::LockedPointerV1InterfacePrivate(LockedPointerV1Interface *q,
SurfaceInterface *surface,
LockedPointerV1Interface::LifeTime lifeTime,
const QRegion &region,
::wl_resource *resource)
: QtWaylandServer::zwp_locked_pointer_v1(resource)
, q(q)
, surface(surface)
, lifeTime(lifeTime)
, region(region)
{
......@@ -179,9 +176,10 @@ void LockedPointerV1InterfacePrivate::zwp_locked_pointer_v1_set_region(Resource
hasPendingRegion = true;
}
LockedPointerV1Interface::LockedPointerV1Interface(LifeTime lifeTime, const QRegion &region, ::wl_resource *resource)
: d(new LockedPointerV1InterfacePrivate(this, lifeTime, region, resource))
LockedPointerV1Interface::LockedPointerV1Interface(SurfaceInterface *surface, LifeTime lifeTime, const QRegion &region, ::wl_resource *resource)
: d(new LockedPointerV1InterfacePrivate(this, surface, lifeTime, region, resource))
{
SurfaceInterfacePrivate::get(surface)->installPointerConstraint(this);
}
LockedPointerV1Interface::~LockedPointerV1Interface()
......@@ -231,11 +229,13 @@ ConfinedPointerV1InterfacePrivate *ConfinedPointerV1InterfacePrivate::get(Confin
}
ConfinedPointerV1InterfacePrivate::ConfinedPointerV1InterfacePrivate(ConfinedPointerV1Interface *q,
SurfaceInterface *surface,
ConfinedPointerV1Interface::LifeTime lifeTime,
const QRegion &region,
::wl_resource *resource)
: QtWaylandServer::zwp_confined_pointer_v1(resource)
, q(q)
, surface(surface)
, lifeTime(lifeTime)
, region(region)
{
......@@ -268,9 +268,10 @@ void ConfinedPointerV1InterfacePrivate::zwp_confined_pointer_v1_set_region(Resou
hasPendingRegion = true;
}
ConfinedPointerV1Interface::ConfinedPointerV1Interface(LifeTime lifeTime, const QRegion &region, ::wl_resource *resource)
: d(new ConfinedPointerV1InterfacePrivate(this, lifeTime, region, resource))
ConfinedPointerV1Interface::ConfinedPointerV1Interface(SurfaceInterface *surface, LifeTime lifeTime, const QRegion &region, ::wl_resource *resource)
: d(new ConfinedPointerV1InterfacePrivate(this, surface, lifeTime, region, resource))
{
SurfaceInterfacePrivate::get(surface)->installPointerConstraint(this);
}
ConfinedPointerV1Interface::~ConfinedPointerV1Interface()
......
......@@ -151,7 +151,7 @@ Q_SIGNALS:
void lockedChanged();
private:
LockedPointerV1Interface(LifeTime lifeTime, const QRegion &region, ::wl_resource *resource);
LockedPointerV1Interface(SurfaceInterface *surface, LifeTime lifeTime, const QRegion &region, ::wl_resource *resource);
std::unique_ptr<LockedPointerV1InterfacePrivate> d;
friend class LockedPointerV1InterfacePrivate;
friend class PointerConstraintsV1InterfacePrivate;
......@@ -236,7 +236,7 @@ Q_SIGNALS:
void confinedChanged();
private:
ConfinedPointerV1Interface(LifeTime lifeTime, const QRegion &region, ::wl_resource *resource);
ConfinedPointerV1Interface(SurfaceInterface *surface, LifeTime lifeTime, const QRegion &region, ::wl_resource *resource);
std::unique_ptr<ConfinedPointerV1InterfacePrivate> d;
friend class ConfinedPointerV1InterfacePrivate;
friend class PointerConstraintsV1InterfacePrivate;
......
......@@ -8,6 +8,7 @@
#pragma once
#include "pointerconstraints_v1_interface.h"
#include <QPointer>
#include "qwayland-server-pointer-constraints-unstable-v1.h"
......@@ -39,11 +40,12 @@ class LockedPointerV1InterfacePrivate : public QtWaylandServer::zwp_locked_point
public:
static LockedPointerV1InterfacePrivate *get(LockedPointerV1Interface *pointer);
LockedPointerV1InterfacePrivate(LockedPointerV1Interface *q, LockedPointerV1Interface::LifeTime lifeTime, const QRegion &region, ::wl_resource *resource);
LockedPointerV1InterfacePrivate(LockedPointerV1Interface *q, SurfaceInterface *surface, LockedPointerV1Interface::LifeTime lifeTime, const QRegion &region, ::wl_resource *resource);
void commit();
LockedPointerV1Interface *q;
QPointer<SurfaceInterface> surface;
LockedPointerV1Interface::LifeTime lifeTime;
QRegion region;
QRegion pendingRegion;
......@@ -65,7 +67,7 @@ class ConfinedPointerV1InterfacePrivate : public QtWaylandServer::zwp_confined_p
public:
static ConfinedPointerV1InterfacePrivate *get(ConfinedPointerV1Interface *pointer);
ConfinedPointerV1InterfacePrivate(ConfinedPointerV1Interface *q,
ConfinedPointerV1InterfacePrivate(ConfinedPointerV1Interface *q, SurfaceInterface *surface,
ConfinedPointerV1Interface::LifeTime lifeTime,
const QRegion &region,
::wl_resource *resource);
......@@ -73,6 +75,7 @@ public:
void commit();
ConfinedPointerV1Interface *q;
QPointer<SurfaceInterface> surface;
ConfinedPointerV1Interface::LifeTime lifeTime;
QRegion region;
QRegion pendingRegion;
......
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