tests: Cleanup cursor role objects
They should have the same lifetime as the underlying surface Change-Id: I35ad0377a506a4e18e7d4f37691189f636ae54bf Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
573486001f
commit
5921924fba
@ -338,7 +338,7 @@ uint Pointer::sendEnter(Surface *surface, const QPointF &position)
|
|||||||
|
|
||||||
uint serial = m_seat->m_compositor->nextSerial();
|
uint serial = m_seat->m_compositor->nextSerial();
|
||||||
m_enterSerials << serial;
|
m_enterSerials << serial;
|
||||||
m_cursorRole = nullptr; // According to the protocol, the pointer image is undefined after enter
|
m_cursorRole.clear(); // According to the protocol, the pointer image is undefined after enter
|
||||||
|
|
||||||
wl_client *client = surface->resource()->client();
|
wl_client *client = surface->resource()->client();
|
||||||
const auto pointerResources = resourceMap().values(client);
|
const auto pointerResources = resourceMap().values(client);
|
||||||
|
@ -337,7 +337,7 @@ class Pointer : public QObject, public QtWaylandServer::wl_pointer
|
|||||||
public:
|
public:
|
||||||
explicit Pointer(Seat *seat) : m_seat(seat) {}
|
explicit Pointer(Seat *seat) : m_seat(seat) {}
|
||||||
Surface *cursorSurface();
|
Surface *cursorSurface();
|
||||||
CursorRole* m_cursorRole = nullptr; //TODO: cleanup
|
QPointer<CursorRole> m_cursorRole;
|
||||||
void send_enter() = delete;
|
void send_enter() = delete;
|
||||||
uint sendEnter(Surface *surface, const QPointF &position);
|
uint sendEnter(Surface *surface, const QPointF &position);
|
||||||
void send_leave() = delete;
|
void send_leave() = delete;
|
||||||
@ -369,6 +369,7 @@ public:
|
|||||||
explicit CursorRole(Surface *surface) // TODO: needs some more args
|
explicit CursorRole(Surface *surface) // TODO: needs some more args
|
||||||
: m_surface(surface)
|
: m_surface(surface)
|
||||||
{
|
{
|
||||||
|
connect(m_surface, &QObject::destroyed, this, &QObject::deleteLater);
|
||||||
}
|
}
|
||||||
static CursorRole *fromSurface(Surface *surface) { return qobject_cast<CursorRole *>(surface->m_role); }
|
static CursorRole *fromSurface(Surface *surface) { return qobject_cast<CursorRole *>(surface->m_role); }
|
||||||
Surface *m_surface = nullptr;
|
Surface *m_surface = nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user