tablet: Fix disconnecting the tablet while the pen is still in proximity
libinput will send release and proximity out events after the device is disconnected. This just takes into account that tablet might be nullptr. BUG: 442573
This commit is contained in:
parent
7ffa7c48e5
commit
8825c01b15
1 changed files with 3 additions and 1 deletions
|
@ -1774,6 +1774,8 @@ public:
|
||||||
tool = createTool(event->tabletId());
|
tool = createTool(event->tabletId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: tablet will be nullptr as the device is removed (see ::removeDevice) but events from the tool
|
||||||
|
// may still happen (e.g. Release or ProximityOut events)
|
||||||
auto tablet = static_cast<KWaylandServer::TabletV2Interface *>(event->tabletId().m_deviceGroupData);
|
auto tablet = static_cast<KWaylandServer::TabletV2Interface *>(event->tabletId().m_deviceGroupData);
|
||||||
|
|
||||||
Toplevel *toplevel = input()->findToplevel(event->globalPos());
|
Toplevel *toplevel = input()->findToplevel(event->globalPos());
|
||||||
|
@ -1784,7 +1786,7 @@ public:
|
||||||
KWaylandServer::SurfaceInterface *surface = toplevel->surface();
|
KWaylandServer::SurfaceInterface *surface = toplevel->surface();
|
||||||
tool->setCurrentSurface(surface);
|
tool->setCurrentSurface(surface);
|
||||||
|
|
||||||
if (!tool->isClientSupported() || !tablet->isSurfaceSupported(surface)) {
|
if (!tool->isClientSupported() || (tablet && !tablet->isSurfaceSupported(surface))) {
|
||||||
return emulateTabletEvent(event);
|
return emulateTabletEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue