foreign-toplevel: fixup output resource finding

fixes #6457
This commit is contained in:
Vaxry 2024-06-12 23:28:52 +02:00
parent 18ee9ece9c
commit 0e18da8467

View file

@ -122,25 +122,19 @@ void CForeignToplevelHandleWlr::sendMonitor(CMonitor* pMonitor) {
if (lastMonitorID == (int64_t)pMonitor->ID) if (lastMonitorID == (int64_t)pMonitor->ID)
return; return;
const auto CLIENT = resource->client(); const auto CLIENT = resource->client();
struct wl_resource* outputResource;
if (const auto PLASTMONITOR = g_pCompositor->getMonitorFromID(lastMonitorID); PLASTMONITOR) { if (const auto PLASTMONITOR = g_pCompositor->getMonitorFromID(lastMonitorID); PLASTMONITOR) {
wl_resource_for_each(outputResource, &PLASTMONITOR->output->resources) { const auto OLDRESOURCE = PROTO::outputs.at(PLASTMONITOR->szName)->outputResourceFrom(CLIENT);
if (wl_resource_get_client(outputResource) != CLIENT)
continue;
resource->sendOutputLeave(outputResource); if (OLDRESOURCE)
} resource->sendOutputLeave(OLDRESOURCE->getResource()->resource());
} }
wl_resource_for_each(outputResource, &pMonitor->output->resources) { const auto NEWRESOURCE = PROTO::outputs.at(pMonitor->szName)->outputResourceFrom(CLIENT);
if (wl_resource_get_client(outputResource) != CLIENT)
continue;
resource->sendOutputEnter(outputResource); if (NEWRESOURCE)
} resource->sendOutputEnter(NEWRESOURCE->getResource()->resource());
lastMonitorID = pMonitor->ID; lastMonitorID = pMonitor->ID;
} }