mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-25 13:45:58 +01:00
store window internal and external reserved area
modified: src/Window.cpp modified: src/Window.hpp modified: src/config/ConfigManager.cpp modified: src/render/Renderer.cpp modified: subprojects/wlroots Signed-off-by: MightyPlaza <123664421+MightyPlaza@users.noreply.github.com>
This commit is contained in:
parent
bc62facc80
commit
5c2f22eb75
4 changed files with 37 additions and 16 deletions
|
@ -204,6 +204,27 @@ void CWindow::updateWindowDecos() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reset extents
|
||||||
|
m_seReservedInternal.topLeft = Vector2D();
|
||||||
|
m_seReservedInternal.bottomRight = Vector2D();
|
||||||
|
m_seReservedExternal.topLeft = Vector2D();
|
||||||
|
m_seReservedExternal.bottomRight = Vector2D();
|
||||||
|
|
||||||
|
for (auto& wd : m_dWindowDecorations) {
|
||||||
|
const auto RESERVED = wd->getWindowDecorationReservedArea();
|
||||||
|
if (RESERVED.isInternalDecoration) {
|
||||||
|
m_seReservedInternal.topLeft.x = std::max(m_seReservedInternal.topLeft.x, RESERVED.topLeft.x);
|
||||||
|
m_seReservedInternal.topLeft.y = std::max(m_seReservedInternal.topLeft.y, RESERVED.topLeft.y);
|
||||||
|
m_seReservedInternal.bottomRight.x = std::max(m_seReservedInternal.bottomRight.x, RESERVED.bottomRight.x);
|
||||||
|
m_seReservedInternal.bottomRight.y = std::max(m_seReservedInternal.bottomRight.y, RESERVED.bottomRight.y);
|
||||||
|
} else {
|
||||||
|
m_seReservedExternal.topLeft.x = std::max(m_seReservedExternal.topLeft.x, RESERVED.topLeft.x);
|
||||||
|
m_seReservedExternal.topLeft.y = std::max(m_seReservedExternal.topLeft.y, RESERVED.topLeft.y);
|
||||||
|
m_seReservedExternal.bottomRight.x = std::max(m_seReservedExternal.bottomRight.x, RESERVED.bottomRight.x);
|
||||||
|
m_seReservedExternal.bottomRight.y = std::max(m_seReservedExternal.bottomRight.y, RESERVED.bottomRight.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (recalc)
|
if (recalc)
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateWindow(this);
|
g_pLayoutManager->getCurrentLayout()->recalculateWindow(this);
|
||||||
|
|
||||||
|
|
|
@ -285,6 +285,10 @@ class CWindow {
|
||||||
std::deque<std::unique_ptr<IHyprWindowDecoration>> m_dWindowDecorations;
|
std::deque<std::unique_ptr<IHyprWindowDecoration>> m_dWindowDecorations;
|
||||||
std::vector<IHyprWindowDecoration*> m_vDecosToRemove;
|
std::vector<IHyprWindowDecoration*> m_vDecosToRemove;
|
||||||
|
|
||||||
|
// Window decorations internal and external reserved area
|
||||||
|
SWindowDecorationExtents m_seReservedInternal;
|
||||||
|
SWindowDecorationExtents m_seReservedExternal;
|
||||||
|
|
||||||
// Special render data, rules, etc
|
// Special render data, rules, etc
|
||||||
SWindowSpecialRenderData m_sSpecialRenderData;
|
SWindowSpecialRenderData m_sSpecialRenderData;
|
||||||
SWindowAdditionalConfigData m_sAdditionalConfigData;
|
SWindowAdditionalConfigData m_sAdditionalConfigData;
|
||||||
|
|
|
@ -1650,14 +1650,12 @@ void CConfigManager::loadConfigLoadVars() {
|
||||||
|
|
||||||
w->updateDynamicRules();
|
w->updateDynamicRules();
|
||||||
w->updateSpecialRenderData();
|
w->updateSpecialRenderData();
|
||||||
|
|
||||||
for (auto& wd : w->m_dWindowDecorations)
|
for (auto& wd : w->m_dWindowDecorations)
|
||||||
wd->forceReload(w.get());
|
wd->forceReload(w.get());
|
||||||
|
g_pLayoutManager->getCurrentLayout()->recalculateWindow(w.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: hack needed for decorations, fix later
|
|
||||||
for (auto& m : g_pCompositor->m_vMonitors)
|
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
|
|
||||||
|
|
||||||
// Update window border colors
|
// Update window border colors
|
||||||
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
|
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
|
||||||
|
|
||||||
|
|
|
@ -384,20 +384,11 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
|
||||||
renderdata.y += offset.y;
|
renderdata.y += offset.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWindowDecorationExtents borderExtents;
|
|
||||||
// render window decorations first, if not fullscreen full
|
// render window decorations first, if not fullscreen full
|
||||||
if (mode == RENDER_PASS_ALL || mode == RENDER_PASS_MAIN) {
|
if (mode == RENDER_PASS_ALL || mode == RENDER_PASS_MAIN) {
|
||||||
if (!pWindow->m_bIsFullscreen || PWORKSPACE->m_efFullscreenMode != FULLSCREEN_FULL)
|
if (!pWindow->m_bIsFullscreen || PWORKSPACE->m_efFullscreenMode != FULLSCREEN_FULL)
|
||||||
for (auto& wd : pWindow->m_dWindowDecorations) {
|
for (auto& wd : pWindow->m_dWindowDecorations)
|
||||||
wd->draw(pMonitor, renderdata.alpha * renderdata.fadeAlpha, offset);
|
wd->draw(pMonitor, renderdata.alpha * renderdata.fadeAlpha, offset);
|
||||||
const auto EXTENTS = wd->getWindowDecorationExtents();
|
|
||||||
if (EXTENTS.isInternalDecoration) {
|
|
||||||
borderExtents.topLeft.x += EXTENTS.topLeft.x;
|
|
||||||
borderExtents.topLeft.y += EXTENTS.topLeft.y;
|
|
||||||
borderExtents.bottomRight.x += EXTENTS.bottomRight.x;
|
|
||||||
borderExtents.bottomRight.y += EXTENTS.bottomRight.y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static auto* const PXWLUSENN = &g_pConfigManager->getConfigValuePtr("xwayland:use_nearest_neighbor")->intValue;
|
static auto* const PXWLUSENN = &g_pConfigManager->getConfigValuePtr("xwayland:use_nearest_neighbor")->intValue;
|
||||||
if (pWindow->m_bIsX11 && *PXWLUSENN)
|
if (pWindow->m_bIsX11 && *PXWLUSENN)
|
||||||
|
@ -418,8 +409,15 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_box windowBox = {renderdata.x - pMonitor->vecPosition.x, renderdata.y - pMonitor->vecPosition.y, renderdata.w, renderdata.h};
|
wlr_box windowBox = {renderdata.x - pMonitor->vecPosition.x, renderdata.y - pMonitor->vecPosition.y, renderdata.w, renderdata.h};
|
||||||
wlr_box borderBox = {renderdata.x - pMonitor->vecPosition.x - borderExtents.topLeft.x, renderdata.y - pMonitor->vecPosition.y - borderExtents.topLeft.y,
|
wlr_box borderBox;
|
||||||
renderdata.w + borderExtents.topLeft.x + borderExtents.bottomRight.x, renderdata.h + borderExtents.topLeft.y + borderExtents.bottomRight.y};
|
|
||||||
|
if (!pWindow->m_bIsFullscreen || PWORKSPACE->m_efFullscreenMode != FULLSCREEN_FULL)
|
||||||
|
borderBox = {renderdata.x - pMonitor->vecPosition.x - pWindow->m_seReservedInternal.topLeft.x,
|
||||||
|
renderdata.y - pMonitor->vecPosition.y - pWindow->m_seReservedInternal.topLeft.y,
|
||||||
|
renderdata.w + pWindow->m_seReservedInternal.topLeft.x + pWindow->m_seReservedInternal.bottomRight.x,
|
||||||
|
renderdata.h + pWindow->m_seReservedInternal.topLeft.y + pWindow->m_seReservedInternal.bottomRight.y};
|
||||||
|
else
|
||||||
|
borderBox = windowBox;
|
||||||
|
|
||||||
scaleBox(&windowBox, pMonitor->scale);
|
scaleBox(&windowBox, pMonitor->scale);
|
||||||
scaleBox(&borderBox, pMonitor->scale);
|
scaleBox(&borderBox, pMonitor->scale);
|
||||||
|
|
Loading…
Reference in a new issue