mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-25 23:46:00 +01:00
fix xwaylabnd too, stuff
This commit is contained in:
parent
cf76b90606
commit
1a298257c9
7 changed files with 38 additions and 5 deletions
|
@ -224,6 +224,16 @@ CWindow* CCompositor::windowFromCursor() {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SMonitor* CCompositor::getMonitorFromOutput(wlr_output* out) {
|
||||||
|
for (auto& m : m_lMonitors) {
|
||||||
|
if (m.output == out) {
|
||||||
|
return &m;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void CCompositor::focusWindow(CWindow* pWindow) {
|
void CCompositor::focusWindow(CWindow* pWindow) {
|
||||||
|
|
||||||
if (!pWindow) {
|
if (!pWindow) {
|
||||||
|
|
|
@ -66,6 +66,7 @@ public:
|
||||||
CWindow* vectorToWindow(const Vector2D&);
|
CWindow* vectorToWindow(const Vector2D&);
|
||||||
CWindow* vectorToWindowIdeal(const Vector2D&);
|
CWindow* vectorToWindowIdeal(const Vector2D&);
|
||||||
CWindow* windowFromCursor();
|
CWindow* windowFromCursor();
|
||||||
|
SMonitor* getMonitorFromOutput(wlr_output*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initAllSignals();
|
void initAllSignals();
|
||||||
|
|
|
@ -120,6 +120,10 @@ void Events::listener_monitorDestroy(wl_listener* listener, void* data) {
|
||||||
void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
|
void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
|
||||||
const auto WLRLAYERSURFACE = (wlr_layer_surface_v1*)data;
|
const auto WLRLAYERSURFACE = (wlr_layer_surface_v1*)data;
|
||||||
|
|
||||||
|
if (!WLRLAYERSURFACE->output->data) {
|
||||||
|
Debug::log(LOG, "New LayerSurface has no preferred monitor.");
|
||||||
|
}
|
||||||
|
|
||||||
const auto PMONITOR = (SMonitor*)(WLRLAYERSURFACE->output->data ? WLRLAYERSURFACE->output->data : g_pCompositor->getMonitorFromCursor());
|
const auto PMONITOR = (SMonitor*)(WLRLAYERSURFACE->output->data ? WLRLAYERSURFACE->output->data : g_pCompositor->getMonitorFromCursor());
|
||||||
PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].push_back(new SLayerSurface());
|
PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].push_back(new SLayerSurface());
|
||||||
SLayerSurface* layerSurface = PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].back();
|
SLayerSurface* layerSurface = PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].back();
|
||||||
|
@ -138,7 +142,7 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
|
||||||
layerSurface->monitorID = PMONITOR->ID;
|
layerSurface->monitorID = PMONITOR->ID;
|
||||||
|
|
||||||
// todo: arrange
|
// todo: arrange
|
||||||
Debug::log(LOG, "LayerSurface %x created", layerSurface);
|
Debug::log(LOG, "LayerSurface %x created on monitor %s", layerSurface, PMONITOR->szName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_destroyLayerSurface(wl_listener* listener, void* data) {
|
void Events::listener_destroyLayerSurface(wl_listener* listener, void* data) {
|
||||||
|
@ -185,11 +189,20 @@ void Events::listener_unmapLayerSurface(wl_listener* listener, void* data) {
|
||||||
void Events::listener_commitLayerSurface(wl_listener* listener, void* data) {
|
void Events::listener_commitLayerSurface(wl_listener* listener, void* data) {
|
||||||
SLayerSurface* layersurface = wl_container_of(listener, layersurface, listen_commitLayerSurface);
|
SLayerSurface* layersurface = wl_container_of(listener, layersurface, listen_commitLayerSurface);
|
||||||
|
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(layersurface->monitorID);
|
|
||||||
|
|
||||||
if (!layersurface->layerSurface->output)
|
if (!layersurface->layerSurface->output)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(layersurface->layerSurface->output);
|
||||||
|
|
||||||
|
// fix if it changed its mon
|
||||||
|
if (layersurface->monitorID != PMONITOR->ID) {
|
||||||
|
const auto POLDMON = g_pCompositor->getMonitorFromID(layersurface->monitorID);
|
||||||
|
POLDMON->m_aLayerSurfaceLists[layersurface->layer].remove(layersurface);
|
||||||
|
PMONITOR->m_aLayerSurfaceLists[layersurface->layer].push_back(layersurface);
|
||||||
|
layersurface->monitorID = PMONITOR->ID;
|
||||||
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(POLDMON->ID);
|
||||||
|
}
|
||||||
|
|
||||||
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
|
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
|
||||||
|
|
||||||
if (layersurface->layer != layersurface->layerSurface->current.layer) {
|
if (layersurface->layer != layersurface->layerSurface->current.layer) {
|
||||||
|
@ -197,6 +210,8 @@ void Events::listener_commitLayerSurface(wl_listener* listener, void* data) {
|
||||||
PMONITOR->m_aLayerSurfaceLists[layersurface->layerSurface->current.layer].push_back(layersurface);
|
PMONITOR->m_aLayerSurfaceLists[layersurface->layerSurface->current.layer].push_back(layersurface);
|
||||||
layersurface->layer = layersurface->layerSurface->current.layer;
|
layersurface->layer = layersurface->layerSurface->current.layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PMONITOR->ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_mapWindow(wl_listener* listener, void* data) {
|
void Events::listener_mapWindow(wl_listener* listener, void* data) {
|
||||||
|
|
|
@ -247,3 +247,10 @@ void CHyprDwindleLayout::onWindowRemoved(CWindow* pWindow) {
|
||||||
m_lDwindleNodesData.remove(*PPARENT);
|
m_lDwindleNodesData.remove(*PPARENT);
|
||||||
m_lDwindleNodesData.remove(*PNODE);
|
m_lDwindleNodesData.remove(*PNODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CHyprDwindleLayout::recalculateMonitor(const int& monid) {
|
||||||
|
const auto TOPNODE = getMasterNodeOnMonitor(monid);
|
||||||
|
|
||||||
|
if (TOPNODE)
|
||||||
|
TOPNODE->recalcSizePosRecursive();
|
||||||
|
}
|
|
@ -31,6 +31,7 @@ class CHyprDwindleLayout : public IHyprLayout {
|
||||||
public:
|
public:
|
||||||
virtual void onWindowCreated(CWindow*);
|
virtual void onWindowCreated(CWindow*);
|
||||||
virtual void onWindowRemoved(CWindow*);
|
virtual void onWindowRemoved(CWindow*);
|
||||||
|
virtual void recalculateMonitor(const int&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -8,5 +8,6 @@ public:
|
||||||
|
|
||||||
virtual void onWindowCreated(CWindow*) = 0;
|
virtual void onWindowCreated(CWindow*) = 0;
|
||||||
virtual void onWindowRemoved(CWindow*) = 0;
|
virtual void onWindowRemoved(CWindow*) = 0;
|
||||||
|
virtual void recalculateMonitor(const int&) = 0;
|
||||||
|
|
||||||
};
|
};
|
|
@ -87,8 +87,6 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
|
||||||
// border
|
// border
|
||||||
drawBorderForWindow(&w, PMONITOR);
|
drawBorderForWindow(&w, PMONITOR);
|
||||||
|
|
||||||
wlr_output_layout_output_coords(g_pCompositor->m_sWLROutputLayout, PMONITOR->output, &w.m_vRealPosition.x, &w.m_vRealPosition.y);
|
|
||||||
|
|
||||||
SRenderData renderdata = {PMONITOR->output, time, w.m_vRealPosition.x, w.m_vRealPosition.y};
|
SRenderData renderdata = {PMONITOR->output, time, w.m_vRealPosition.x, w.m_vRealPosition.y};
|
||||||
|
|
||||||
if (w.m_uSurface.xwayland->surface)
|
if (w.m_uSurface.xwayland->surface)
|
||||||
|
|
Loading…
Reference in a new issue