mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-25 11:46:01 +01:00
replace rounding() with getRealRounding()
modified: src/Window.cpp modified: src/Window.hpp modified: src/render/Renderer.cpp modified: src/render/decorations/CHyprGroupBarDecoration.cpp Signed-off-by: MightyPlaza <123664421+MightyPlaza@users.noreply.github.com>
This commit is contained in:
parent
5c2f22eb75
commit
80d5becba2
4 changed files with 19 additions and 16 deletions
|
@ -622,7 +622,7 @@ void CWindow::updateDynamicRules() {
|
|||
// it is assumed that the point is within the real window box (m_vRealPosition, m_vRealSize)
|
||||
// otherwise behaviour is undefined
|
||||
bool CWindow::isInCurvedCorner(double x, double y) {
|
||||
const int ROUNDING = rounding();
|
||||
const int ROUNDING = getRealRounding();
|
||||
if (getRealBorderSize() >= ROUNDING)
|
||||
return false;
|
||||
|
||||
|
@ -919,14 +919,6 @@ bool CWindow::opaque() {
|
|||
return false;
|
||||
}
|
||||
|
||||
float CWindow::rounding() {
|
||||
static auto* const PROUNDING = &g_pConfigManager->getConfigValuePtr("decoration:rounding")->intValue;
|
||||
|
||||
float rounding = m_sAdditionalConfigData.rounding.toUnderlying() == -1 ? *PROUNDING : m_sAdditionalConfigData.rounding.toUnderlying();
|
||||
|
||||
return rounding;
|
||||
}
|
||||
|
||||
void CWindow::updateSpecialRenderData() {
|
||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID);
|
||||
const auto WORKSPACERULE = PWORKSPACE ? g_pConfigManager->getWorkspaceRuleFor(PWORKSPACE) : SWorkspaceRule{};
|
||||
|
@ -942,6 +934,17 @@ void CWindow::updateSpecialRenderData() {
|
|||
m_sSpecialRenderData.shadow = WORKSPACERULE.shadow.value_or(true);
|
||||
}
|
||||
|
||||
int CWindow::getRealRounding() {
|
||||
|
||||
if (!m_sSpecialRenderData.rounding)
|
||||
return 0;
|
||||
|
||||
if (m_sAdditionalConfigData.rounding.toUnderlying() != -1)
|
||||
return m_sAdditionalConfigData.rounding.toUnderlying();
|
||||
|
||||
return g_pConfigManager->getConfigValuePtr("decoration:rounding")->intValue;
|
||||
}
|
||||
|
||||
int CWindow::getRealBorderSize() {
|
||||
if (!m_sSpecialRenderData.border || m_sAdditionalConfigData.forceNoBorder)
|
||||
return 0;
|
||||
|
|
|
@ -356,10 +356,10 @@ class CWindow {
|
|||
SWindowDecorationExtents getFullWindowReservedArea();
|
||||
Vector2D middle();
|
||||
bool opaque();
|
||||
float rounding();
|
||||
bool canBeTorn();
|
||||
|
||||
int getRealBorderSize();
|
||||
int getRealRounding();
|
||||
void updateSpecialRenderData();
|
||||
|
||||
void onBorderAngleAnimEnd(void* ptr);
|
||||
|
@ -424,4 +424,4 @@ struct std::formatter<CWindow*, CharT> : std::formatter<CharT> {
|
|||
std::format_to(out, ", class: {}", g_pXWaylandManager->getAppIDClass(w));
|
||||
return std::format_to(out, "]");
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -329,11 +329,11 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
|
|||
renderdata.surface = pWindow->m_pWLSurface.wlr();
|
||||
renderdata.w = std::max(pWindow->m_vRealSize.vec().x, 5.0); // clamp the size to min 5,
|
||||
renderdata.h = std::max(pWindow->m_vRealSize.vec().y, 5.0); // otherwise we'll have issues later with invalid boxes
|
||||
renderdata.dontRound = (pWindow->m_bIsFullscreen && PWORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL) || (!pWindow->m_sSpecialRenderData.rounding);
|
||||
renderdata.dontRound = (pWindow->m_bIsFullscreen && PWORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL);
|
||||
renderdata.fadeAlpha = pWindow->m_fAlpha.fl() * (pWindow->m_bPinned ? 1.f : PWORKSPACE->m_fAlpha.fl());
|
||||
renderdata.alpha = pWindow->m_fActiveInactiveAlpha.fl();
|
||||
renderdata.decorate = decorate && !pWindow->m_bX11DoesntWantBorders && (!pWindow->m_bIsFullscreen || PWORKSPACE->m_efFullscreenMode != FULLSCREEN_FULL);
|
||||
renderdata.rounding = ignoreAllGeometry || renderdata.dontRound ? 0 : pWindow->rounding() * pMonitor->scale;
|
||||
renderdata.rounding = ignoreAllGeometry || renderdata.dontRound ? 0 : pWindow->getRealRounding() * pMonitor->scale;
|
||||
renderdata.blur = !ignoreAllGeometry; // if it shouldn't, it will be ignored later
|
||||
renderdata.pWindow = pWindow;
|
||||
|
||||
|
@ -1991,7 +1991,7 @@ void CHyprRenderer::setOccludedForBackLayers(CRegion& region, CWorkspace* pWorks
|
|||
if (!w->opaque())
|
||||
continue;
|
||||
|
||||
const auto ROUNDING = w->rounding() * PMONITOR->scale;
|
||||
const auto ROUNDING = w->getRealRounding() * PMONITOR->scale;
|
||||
const Vector2D POS = w->m_vRealPosition.vec() + Vector2D{ROUNDING, ROUNDING} - PMONITOR->vecPosition + (w->m_bPinned ? Vector2D{} : pWorkspace->m_vRenderOffset.vec());
|
||||
const Vector2D SIZE = w->m_vRealSize.vec() - Vector2D{ROUNDING * 2, ROUNDING * 2};
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D&
|
|||
|
||||
// TODO: fix mouse event with rounding
|
||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_pWindow->m_iWorkspaceID);
|
||||
const int ROUNDING = !m_pWindow->m_sSpecialRenderData.rounding ? 0 : m_pWindow->rounding();
|
||||
const int ROUNDING = m_pWindow->getRealRounding();
|
||||
const int BORDERSIZE = m_pWindow->getRealBorderSize();
|
||||
|
||||
const int BARW = (m_vLastWindowSize.x - 2 * ROUNDING - BAR_HORIZONTAL_PADDING * (barsToDraw - 1)) / barsToDraw;
|
||||
|
@ -364,7 +364,7 @@ void CHyprGroupBarDecoration::forceReload(CWindow* pWindow) {
|
|||
}
|
||||
|
||||
CRegion CHyprGroupBarDecoration::getWindowDecorationRegion() {
|
||||
const int ROUNDING = !m_pWindow->m_sSpecialRenderData.rounding ? 0 : m_pWindow->rounding();
|
||||
const int ROUNDING = m_pWindow->getRealRounding();
|
||||
const int BORDERSIZE = m_pWindow->getRealBorderSize();
|
||||
return CRegion(m_vLastWindowPos.x + ROUNDING,
|
||||
m_vLastWindowPos.y +
|
||||
|
|
Loading…
Reference in a new issue