protocols: implement pointer-warp-v1 (#11469)
This commit is contained in:
parent
05a1c0aa73
commit
ea42041f93
17 changed files with 699 additions and 5 deletions
|
|
@ -109,6 +109,8 @@ CWLPointerResource::CWLPointerResource(SP<CWlPointer> resource_, SP<CWLSeatResou
|
|||
if UNLIKELY (!good())
|
||||
return;
|
||||
|
||||
m_resource->setData(this);
|
||||
|
||||
m_resource->setRelease([this](CWlPointer* r) { PROTO::seat->destroyResource(this); });
|
||||
m_resource->setOnDestroy([this](CWlPointer* r) { PROTO::seat->destroyResource(this); });
|
||||
|
||||
|
|
@ -145,6 +147,11 @@ bool CWLPointerResource::good() {
|
|||
return m_resource->resource();
|
||||
}
|
||||
|
||||
SP<CWLPointerResource> CWLPointerResource::fromResource(wl_resource* res) {
|
||||
auto data = sc<CWLPointerResource*>(sc<CWlPointer*>(wl_resource_get_user_data(res))->data());
|
||||
return data ? data->m_self.lock() : nullptr;
|
||||
}
|
||||
|
||||
void CWLPointerResource::sendEnter(SP<CWLSurfaceResource> surface, const Vector2D& local) {
|
||||
if (!m_owner || m_currentSurface == surface || !surface->getResource()->resource())
|
||||
return;
|
||||
|
|
@ -439,6 +446,8 @@ CWLSeatResource::CWLSeatResource(SP<CWlSeat> resource_) : m_resource(resource_)
|
|||
return;
|
||||
}
|
||||
|
||||
RESOURCE->m_self = RESOURCE;
|
||||
|
||||
m_pointers.emplace_back(RESOURCE);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -88,15 +88,21 @@ class CWLPointerResource {
|
|||
|
||||
WP<CWLSeatResource> m_owner;
|
||||
|
||||
//
|
||||
static SP<CWLPointerResource> fromResource(wl_resource* res);
|
||||
|
||||
private:
|
||||
SP<CWlPointer> m_resource;
|
||||
WP<CWLSurfaceResource> m_currentSurface;
|
||||
WP<CWLPointerResource> m_self;
|
||||
|
||||
std::vector<uint32_t> m_pressedButtons;
|
||||
|
||||
struct {
|
||||
CHyprSignalListener destroySurface;
|
||||
} m_listeners;
|
||||
|
||||
friend class CWLSeatResource;
|
||||
};
|
||||
|
||||
class CWLKeyboardResource {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue