foreign-toplevel: update monitor properly on changed

fixes #11197
This commit is contained in:
Vaxry 2025-07-29 21:59:26 +02:00
parent f51be7f201
commit 43966cc787
No known key found for this signature in database
GPG key ID: 665806380871D640
2 changed files with 11 additions and 11 deletions

View file

@ -288,20 +288,15 @@ void CForeignToplevelWlrManager::onUnmap(PHLWINDOW pWindow) {
H->m_closed = true; H->m_closed = true;
} }
void CForeignToplevelWlrManager::onMoveMonitor(PHLWINDOW pWindow) { void CForeignToplevelWlrManager::onMoveMonitor(PHLWINDOW pWindow, PHLMONITOR pMonitor) {
if UNLIKELY (m_finished) if UNLIKELY (m_finished)
return; return;
const auto H = handleForWindow(pWindow); const auto H = handleForWindow(pWindow);
if UNLIKELY (!H || H->m_closed) if UNLIKELY (!H || H->m_closed || !pMonitor)
return; return;
const auto PMONITOR = pWindow->m_monitor.lock(); H->sendMonitor(pMonitor);
if UNLIKELY (!PMONITOR)
return;
H->sendMonitor(PMONITOR);
H->m_resource->sendDone(); H->m_resource->sendDone();
} }
@ -386,9 +381,14 @@ CForeignToplevelWlrProtocol::CForeignToplevelWlrProtocol(const wl_interface* ifa
}); });
static auto P4 = g_pHookSystem->hookDynamic("moveWindow", [this](void* self, SCallbackInfo& info, std::any data) { static auto P4 = g_pHookSystem->hookDynamic("moveWindow", [this](void* self, SCallbackInfo& info, std::any data) {
const auto PWINDOW = std::any_cast<PHLWINDOW>(std::any_cast<std::vector<std::any>>(data).at(0)); const auto PWINDOW = std::any_cast<PHLWINDOW>(std::any_cast<std::vector<std::any>>(data).at(0));
const auto PWORKSPACE = std::any_cast<PHLWORKSPACE>(std::any_cast<std::vector<std::any>>(data).at(1));
if (!PWORKSPACE)
return;
for (auto const& m : m_managers) { for (auto const& m : m_managers) {
m->onMoveMonitor(PWINDOW); m->onMoveMonitor(PWINDOW, PWORKSPACE->m_monitor.lock());
} }
}); });

View file

@ -34,7 +34,7 @@ class CForeignToplevelWlrManager {
void onMap(PHLWINDOW pWindow); void onMap(PHLWINDOW pWindow);
void onTitle(PHLWINDOW pWindow); void onTitle(PHLWINDOW pWindow);
void onClass(PHLWINDOW pWindow); void onClass(PHLWINDOW pWindow);
void onMoveMonitor(PHLWINDOW pWindow); void onMoveMonitor(PHLWINDOW pWindow, PHLMONITOR pMonitor);
void onFullscreen(PHLWINDOW pWindow); void onFullscreen(PHLWINDOW pWindow);
void onNewFocus(PHLWINDOW pWindow); void onNewFocus(PHLWINDOW pWindow);
void onUnmap(PHLWINDOW pWindow); void onUnmap(PHLWINDOW pWindow);