Commit 380b91e4 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

tablet: small cleanups

Add missing &
Remove unnecessary namespace
Consistant m_ prefix
parent f67daa07
Pipeline #44253 passed with stage
in 6 minutes and 5 seconds
...@@ -20,7 +20,7 @@ static int s_version = 1; ...@@ -20,7 +20,7 @@ static int s_version = 1;
class TabletV2InterfacePrivate : public QtWaylandServer::zwp_tablet_v2 class TabletV2InterfacePrivate : public QtWaylandServer::zwp_tablet_v2
{ {
public: public:
TabletV2InterfacePrivate(TabletV2Interface *q, uint32_t vendorId, uint32_t productId, const QString name, const QStringList &paths) TabletV2InterfacePrivate(TabletV2Interface *q, uint32_t vendorId, uint32_t productId, const QString &name, const QStringList &paths)
: zwp_tablet_v2() : zwp_tablet_v2()
, q(q) , q(q)
, m_vendorId(vendorId) , m_vendorId(vendorId)
...@@ -33,14 +33,14 @@ public: ...@@ -33,14 +33,14 @@ public:
wl_resource *resourceForSurface(SurfaceInterface *surface) const wl_resource *resourceForSurface(SurfaceInterface *surface) const
{ {
ClientConnection *client = surface->client(); ClientConnection *client = surface->client();
QtWaylandServer::zwp_tablet_v2::Resource *r = resourceMap().value(*client); Resource *r = resourceMap().value(*client);
return r ? r->handle : nullptr; return r ? r->handle : nullptr;
} }
void zwp_tablet_v2_destroy_resource(QtWaylandServer::zwp_tablet_v2::Resource * resource) override void zwp_tablet_v2_destroy_resource(QtWaylandServer::zwp_tablet_v2::Resource * resource) override
{ {
Q_UNUSED(resource); Q_UNUSED(resource);
if (removed && resourceMap().isEmpty()) { if (m_removed && resourceMap().isEmpty()) {
delete q; delete q;
} }
} }
...@@ -50,7 +50,7 @@ public: ...@@ -50,7 +50,7 @@ public:
const uint32_t m_productId; const uint32_t m_productId;
const QString m_name; const QString m_name;
const QStringList m_paths; const QStringList m_paths;
bool removed = false; bool m_removed = false;
}; };
TabletV2Interface::TabletV2Interface(uint32_t vendorId, uint32_t productId, TabletV2Interface::TabletV2Interface(uint32_t vendorId, uint32_t productId,
...@@ -70,7 +70,7 @@ bool TabletV2Interface::isSurfaceSupported(SurfaceInterface *surface) const ...@@ -70,7 +70,7 @@ bool TabletV2Interface::isSurfaceSupported(SurfaceInterface *surface) const
void TabletV2Interface::sendRemoved() void TabletV2Interface::sendRemoved()
{ {
d->removed = true; d->m_removed = true;
for (QtWaylandServer::zwp_tablet_v2::Resource *resource : d->resourceMap()) { for (QtWaylandServer::zwp_tablet_v2::Resource *resource : d->resourceMap()) {
d->send_removed(resource->handle); d->send_removed(resource->handle);
} }
...@@ -83,13 +83,15 @@ public: ...@@ -83,13 +83,15 @@ public:
void update(quint32 serial, SurfaceInterface *surface, const QPoint &hotspot) void update(quint32 serial, SurfaceInterface *surface, const QPoint &hotspot)
{ {
const bool diff = m_serial != serial && m_surface != surface && m_hotspot != hotspot; const bool diff = m_serial != serial || m_surface != surface || m_hotspot != hotspot;
if (diff) {
m_serial = serial; m_serial = serial;
m_surface = surface; m_surface = surface;
m_hotspot = hotspot; m_hotspot = hotspot;
if (diff)
Q_EMIT q->changed(); Q_EMIT q->changed();
} }
}
TabletCursorV2 *const q; TabletCursorV2 *const q;
......
Markdown is supported
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