internal: Unsafe state reworks (#3114)

This commit is contained in:
Vaxry
2023-09-01 22:03:56 +02:00
committed by GitHub
parent 774a5bedf8
commit d9292800a2
6 changed files with 52 additions and 59 deletions

View File

@@ -58,16 +58,11 @@ void CXDGOutputProtocol::bindManager(wl_client* client, void* data, uint32_t ver
}
CXDGOutputProtocol::CXDGOutputProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
g_pHookSystem->hookDynamic("monitorLayoutChanged", [&](void* self, std::any param) { this->updateAllOutputs(); });
g_pHookSystem->hookDynamic("configReloaded", [&](void* self, std::any param) { this->updateAllOutputs(); });
g_pHookSystem->hookDynamic("monitorRemoved", [&](void* self, std::any param) {
g_pHookSystem->hookDynamic("monitorLayoutChanged", [this](void* self, std::any param) { this->updateAllOutputs(); });
g_pHookSystem->hookDynamic("configReloaded", [this](void* self, std::any param) { this->updateAllOutputs(); });
g_pHookSystem->hookDynamic("monitorRemoved", [this](void* self, std::any param) {
const auto PMONITOR = std::any_cast<CMonitor*>(param);
std::erase_if(m_vXDGOutputs, [&](const auto& other) {
const bool R = other->monitor == PMONITOR;
if (R)
other->resource->markDefunct();
return R;
});
std::erase_if(m_vXDGOutputs, [&](const auto& other) { return other->monitor == PMONITOR; });
});
}