wlr-foreign-toplevel: fix fullscreen failing and add output support (#6360)

* wlr-foreign-toplevel: fix fullscreen failing and add output support

* fix for core protocol rewrite
This commit is contained in:
outfoxxed 2024-06-10 03:16:38 -07:00 committed by GitHub
parent b16af45c4a
commit 89a3c90613
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,8 @@
#include "ForeignToplevelWlr.hpp" #include "ForeignToplevelWlr.hpp"
#include <algorithm> #include <algorithm>
#include "../Compositor.hpp" #include "../Compositor.hpp"
#include "protocols/core/Output.hpp"
#include "render/Renderer.hpp"
#define LOGM PROTO::foreignToplevelWlr->protoLog #define LOGM PROTO::foreignToplevelWlr->protoLog
@ -36,7 +38,21 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHand
return; return;
} }
g_pCompositor->setWindowFullscreen(PWINDOW, true); if (output) {
const auto wpMonitor = CWLOutputResource::fromResource(output)->monitor;
if (!wpMonitor.expired()) {
const auto monitor = wpMonitor.lock();
if (PWINDOW->m_pWorkspace != monitor->activeWorkspace) {
g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, monitor->activeWorkspace);
g_pCompositor->setActiveMonitor(monitor.get());
}
}
}
g_pCompositor->setWindowFullscreen(PWINDOW, true, FULLSCREEN_FULL);
g_pHyprRenderer->damageWindow(PWINDOW);
}); });
resource->setUnsetFullscreen([this](CZwlrForeignToplevelHandleV1* p) { resource->setUnsetFullscreen([this](CZwlrForeignToplevelHandleV1* p) {
@ -372,4 +388,4 @@ PHLWINDOW CForeignToplevelWlrProtocol::windowFromHandleResource(wl_resource* res
} }
return nullptr; return nullptr;
} }