aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2023-08-25 18:22:25 +0200
committervaxerski <[email protected]>2023-08-25 18:22:25 +0200
commit116b9a80566e7956233b39697ac78c112d514c3c (patch)
tree79c628c5f0ea8ab4a56c6a21be3a66f67f9f7017
parent9dae8ece712ab710a6ff36284b4be408c11526b4 (diff)
downloadHyprland-116b9a80566e7956233b39697ac78c112d514c3c.tar.gz
Hyprland-116b9a80566e7956233b39697ac78c112d514c3c.zip
xdgoutput: mark resources defunct when monitor is unplugged
-rw-r--r--src/protocols/XDGOutput.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/protocols/XDGOutput.cpp b/src/protocols/XDGOutput.cpp
index 8d9bbd84..c1049bb5 100644
--- a/src/protocols/XDGOutput.cpp
+++ b/src/protocols/XDGOutput.cpp
@@ -62,7 +62,12 @@ CXDGOutputProtocol::CXDGOutputProtocol(const wl_interface* iface, const int& ver
g_pHookSystem->hookDynamic("configReloaded", [&](void* self, std::any param) { this->updateAllOutputs(); });
g_pHookSystem->hookDynamic("monitorRemoved", [&](void* self, std::any param) {
const auto PMONITOR = std::any_cast<CMonitor*>(param);
- std::erase_if(m_vXDGOutputs, [&](const auto& other) { return other->monitor == PMONITOR; });
+ std::erase_if(m_vXDGOutputs, [&](const auto& other) {
+ const bool R = other->monitor == PMONITOR;
+ if (R)
+ other->resource->markDefunct();
+ return R;
+ });
});
}
@@ -110,11 +115,11 @@ void CXDGOutputProtocol::onManagerGetXDGOutput(wl_client* client, wl_resource* r
void CXDGOutputProtocol::updateOutputDetails(SXDGOutput* pOutput) {
static auto* const PXWLFORCESCALEZERO = &g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling")->intValue;
-
+
if (!pOutput->resource->good())
return;
- const auto POS = pOutput->isXWayland ? pOutput->monitor->vecXWaylandPosition : pOutput->monitor->vecPosition;
+ const auto POS = pOutput->isXWayland ? pOutput->monitor->vecXWaylandPosition : pOutput->monitor->vecPosition;
zxdg_output_v1_send_logical_position(pOutput->resource->resource(), POS.x, POS.y);
if (*PXWLFORCESCALEZERO && pOutput->isXWayland)