wayland: Validate serial of wl_pointer.set_cursor

This commit is contained in:
Vlad Zahorodnii 2023-05-07 16:24:05 +03:00
parent 8f928e6ac9
commit 805c899589
2 changed files with 5 additions and 0 deletions

View file

@ -62,6 +62,9 @@ void PointerInterfacePrivate::pointer_set_cursor(Resource *resource, uint32_t se
qCDebug(KWIN_CORE, "Denied set_cursor request from unfocused client");
return;
}
if (focusedSerial != serial) {
return;
}
if (surface_resource) {
surface = SurfaceInterface::get(surface_resource);
@ -159,6 +162,7 @@ void PointerInterface::sendEnter(SurfaceInterface *surface, const QPointF &posit
}
d->focusedSurface = surface;
d->focusedSerial = serial;
d->destroyConnection = connect(d->focusedSurface, &SurfaceInterface::aboutToBeDestroyed, this, [this]() {
d->sendLeave(d->seat->display()->nextSerial());
d->sendFrame();

View file

@ -36,6 +36,7 @@ public:
PointerInterface *q;
SeatInterface *seat;
SurfaceInterface *focusedSurface = nullptr;
quint32 focusedSerial = 0;
QMetaObject::Connection destroyConnection;
std::unique_ptr<Cursor> cursor;
std::unique_ptr<RelativePointerV1Interface> relativePointersV1;