protocols: implement pointer-warp-v1 (#11469)

This commit is contained in:
Ikalco 2025-08-29 15:16:40 -05:00 committed by GitHub
parent 05a1c0aa73
commit ea42041f93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 699 additions and 5 deletions

View file

@ -64,6 +64,7 @@
#include "../protocols/XDGBell.hpp"
#include "../protocols/ExtWorkspace.hpp"
#include "../protocols/ExtDataDevice.hpp"
#include "../protocols/PointerWarp.hpp"
#include "../helpers/Monitor.hpp"
#include "../render/Renderer.hpp"
@ -192,6 +193,7 @@ CProtocolManager::CProtocolManager() {
PROTO::xdgBell = makeUnique<CXDGSystemBellProtocol>(&xdg_system_bell_v1_interface, 1, "XDGBell");
PROTO::extWorkspace = makeUnique<CExtWorkspaceProtocol>(&ext_workspace_manager_v1_interface, 1, "ExtWorkspace");
PROTO::extDataDevice = makeUnique<CExtDataDeviceProtocol>(&ext_data_control_manager_v1_interface, 1, "ExtDataDevice");
PROTO::pointerWarp = makeUnique<CPointerWarpProtocol>(&wp_pointer_warp_v1_interface, 1, "PointerWarp");
if (*PENABLECM)
PROTO::colorManagement = makeUnique<CColorManagementProtocol>(&wp_color_manager_v1_interface, 1, "ColorManagement", *PDEBUGCM);
@ -295,6 +297,7 @@ CProtocolManager::~CProtocolManager() {
PROTO::xdgBell.reset();
PROTO::extWorkspace.reset();
PROTO::extDataDevice.reset();
PROTO::pointerWarp.reset();
for (auto& [_, lease] : PROTO::lease) {
lease.reset();

View file

@ -58,7 +58,7 @@ uint32_t CSeatManager::nextSerial(SP<CWLSeatResource> seatResource) {
return serial;
}
bool CSeatManager::serialValid(SP<CWLSeatResource> seatResource, uint32_t serial) {
bool CSeatManager::serialValid(SP<CWLSeatResource> seatResource, uint32_t serial, bool erase) {
if (!seatResource)
return false;
@ -68,7 +68,8 @@ bool CSeatManager::serialValid(SP<CWLSeatResource> seatResource, uint32_t serial
for (auto it = container->serials.begin(); it != container->serials.end(); ++it) {
if (*it == serial) {
container->serials.erase(it);
if (erase)
container->serials.erase(it);
return true;
}
}

View file

@ -76,7 +76,7 @@ class CSeatManager {
uint32_t nextSerial(SP<CWLSeatResource> seatResource);
// pops the serial if it was valid, meaning it is consumed.
bool serialValid(SP<CWLSeatResource> seatResource, uint32_t serial);
bool serialValid(SP<CWLSeatResource> seatResource, uint32_t serial, bool erase = true);
void onSetCursor(SP<CWLSeatResource> seatResource, uint32_t serial, SP<CWLSurfaceResource> surf, const Vector2D& hotspot);