tearing-control: hyprland impl (#5655)

* tearing: hl impl

* format
This commit is contained in:
Vaxry 2024-04-19 22:16:35 +01:00 committed by GitHub
parent 1016faea53
commit b52a49b4c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 207 additions and 74 deletions

View file

@ -31,7 +31,14 @@ void CWaylandResource::markDefunct() {
Debug::log(TRACE, "[wl res {:x}] now defunct", (uintptr_t)m_pWLResource);
m_bDefunct = true;
wl_resource_set_user_data(m_pWLResource, nullptr);
// we call it here because we need defunct to be set to true.
// if this function destroys us, we can't call wl_resource_set_user_data or
// destroy the resource.
if (m_fOnDestroyHandler)
m_fOnDestroyHandler(this);
}
CWaylandResource::~CWaylandResource() {
@ -80,6 +87,10 @@ void* CWaylandResource::data() {
return m_pData;
}
void CWaylandResource::setOnDestroyHandler(std::function<void(CWaylandResource* res)> fn) {
m_fOnDestroyHandler = fn;
}
static void bindManagerInternal(wl_client* client, void* data, uint32_t ver, uint32_t id) {
((IWaylandProtocol*)data)->bindManager(client, data, ver, id);
}