mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-15 09:46:00 +01:00
parent
0baf166d39
commit
781828a56e
3 changed files with 29 additions and 0 deletions
|
@ -589,3 +589,9 @@ void CWLCompositorProtocol::destroyResource(CWLSurfaceResource* resource) {
|
||||||
void CWLCompositorProtocol::destroyResource(CWLRegionResource* resource) {
|
void CWLCompositorProtocol::destroyResource(CWLRegionResource* resource) {
|
||||||
std::erase_if(m_vRegions, [&](const auto& other) { return other.get() == resource; });
|
std::erase_if(m_vRegions, [&](const auto& other) { return other.get() == resource; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CWLCompositorProtocol::forEachSurface(std::function<void(SP<CWLSurfaceResource>)> fn) {
|
||||||
|
for (auto& surf : m_vSurfaces) {
|
||||||
|
fn(surf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -169,6 +169,8 @@ class CWLCompositorProtocol : public IWaylandProtocol {
|
||||||
|
|
||||||
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
||||||
|
|
||||||
|
void forEachSurface(std::function<void(SP<CWLSurfaceResource>)> fn);
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
CSignal newSurface; // SP<CWLSurfaceResource>
|
CSignal newSurface; // SP<CWLSurfaceResource>
|
||||||
} events;
|
} events;
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#include "Output.hpp"
|
#include "Output.hpp"
|
||||||
|
#include "Compositor.hpp"
|
||||||
|
#include "../../Compositor.hpp"
|
||||||
#include "../../helpers/Monitor.hpp"
|
#include "../../helpers/Monitor.hpp"
|
||||||
|
|
||||||
CWLOutputResource::CWLOutputResource(SP<CWlOutput> resource_, SP<CMonitor> pMonitor) : monitor(pMonitor), resource(resource_) {
|
CWLOutputResource::CWLOutputResource(SP<CWlOutput> resource_, SP<CMonitor> pMonitor) : monitor(pMonitor), resource(resource_) {
|
||||||
|
@ -27,6 +29,25 @@ CWLOutputResource::CWLOutputResource(SP<CWlOutput> resource_, SP<CMonitor> pMoni
|
||||||
}
|
}
|
||||||
|
|
||||||
updateState();
|
updateState();
|
||||||
|
|
||||||
|
PROTO::compositor->forEachSurface([](SP<CWLSurfaceResource> surf) {
|
||||||
|
auto HLSurf = CWLSurface::fromResource(surf);
|
||||||
|
|
||||||
|
if (!HLSurf)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const auto GEOMETRY = HLSurf->getSurfaceBoxGlobal();
|
||||||
|
|
||||||
|
if (!GEOMETRY.has_value())
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
|
if (!m->logicalBox().overlaps(*GEOMETRY))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
surf->enter(m);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
SP<CWLOutputResource> CWLOutputResource::fromResource(wl_resource* res) {
|
SP<CWLOutputResource> CWLOutputResource::fromResource(wl_resource* res) {
|
||||||
|
|
Loading…
Reference in a new issue