mirror of
https://github.com/hyprwm/Hyprland.git
synced 2024-09-11 21:27:20 +03:00
arrange properly layers with no anchors
This commit is contained in:
parent
e7abda1b2b
commit
45addfb31d
@ -204,6 +204,20 @@ void Events::listener_mapLayerSurface(wl_listener* listener, void* data) {
|
||||
|
||||
wlr_surface_send_enter(layersurface->layerSurface->surface, layersurface->layerSurface->output);
|
||||
|
||||
// fix if it changed its mon
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(layersurface->layerSurface->output);
|
||||
|
||||
if ((uint64_t)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(POLDMON->ID);
|
||||
}
|
||||
|
||||
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
|
||||
|
||||
if (layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_TOP || layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY)
|
||||
g_pCompositor->focusSurface(layersurface->layerSurface->surface);
|
||||
|
||||
@ -240,6 +254,7 @@ void Events::listener_commitLayerSurface(wl_listener* listener, void* data) {
|
||||
PMONITOR->m_aLayerSurfaceLists[layersurface->layer].push_back(layersurface);
|
||||
layersurface->monitorID = PMONITOR->ID;
|
||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(POLDMON->ID);
|
||||
g_pHyprRenderer->arrangeLayersForMonitor(POLDMON->ID);
|
||||
}
|
||||
|
||||
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
|
||||
|
@ -189,6 +189,14 @@ void CHyprRenderer::arrangeLayerArray(SMonitor* pMonitor, const std::list<SLayer
|
||||
layerBox.height -= STATE->margin.top + STATE->margin.bottom;
|
||||
}
|
||||
|
||||
if (!(STATE->anchor & (ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT | ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM))) {
|
||||
// no anchors. center
|
||||
layerBox.x = pMonitor->vecPosition.x + (pMonitor->vecSize.x - layerBox.width) / 2.f;
|
||||
layerBox.y = pMonitor->vecPosition.y + (pMonitor->vecSize.y - layerBox.height) / 2.f;
|
||||
|
||||
// TODO: maybe allow the app to choose for itself its x and y?
|
||||
}
|
||||
|
||||
ls->geometry = layerBox;
|
||||
|
||||
wlr_layer_surface_v1_configure(ls->layerSurface, layerBox.width, layerBox.height);
|
||||
|
Loading…
Reference in New Issue
Block a user