mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-25 13:25:57 +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)
|
// it is assumed that the point is within the real window box (m_vRealPosition, m_vRealSize)
|
||||||
// otherwise behaviour is undefined
|
// otherwise behaviour is undefined
|
||||||
bool CWindow::isInCurvedCorner(double x, double y) {
|
bool CWindow::isInCurvedCorner(double x, double y) {
|
||||||
const int ROUNDING = rounding();
|
const int ROUNDING = getRealRounding();
|
||||||
if (getRealBorderSize() >= ROUNDING)
|
if (getRealBorderSize() >= ROUNDING)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -919,14 +919,6 @@ bool CWindow::opaque() {
|
||||||
return false;
|
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() {
|
void CWindow::updateSpecialRenderData() {
|
||||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID);
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID);
|
||||||
const auto WORKSPACERULE = PWORKSPACE ? g_pConfigManager->getWorkspaceRuleFor(PWORKSPACE) : SWorkspaceRule{};
|
const auto WORKSPACERULE = PWORKSPACE ? g_pConfigManager->getWorkspaceRuleFor(PWORKSPACE) : SWorkspaceRule{};
|
||||||
|
@ -942,6 +934,17 @@ void CWindow::updateSpecialRenderData() {
|
||||||
m_sSpecialRenderData.shadow = WORKSPACERULE.shadow.value_or(true);
|
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() {
|
int CWindow::getRealBorderSize() {
|
||||||
if (!m_sSpecialRenderData.border || m_sAdditionalConfigData.forceNoBorder)
|
if (!m_sSpecialRenderData.border || m_sAdditionalConfigData.forceNoBorder)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -356,10 +356,10 @@ class CWindow {
|
||||||
SWindowDecorationExtents getFullWindowReservedArea();
|
SWindowDecorationExtents getFullWindowReservedArea();
|
||||||
Vector2D middle();
|
Vector2D middle();
|
||||||
bool opaque();
|
bool opaque();
|
||||||
float rounding();
|
|
||||||
bool canBeTorn();
|
bool canBeTorn();
|
||||||
|
|
||||||
int getRealBorderSize();
|
int getRealBorderSize();
|
||||||
|
int getRealRounding();
|
||||||
void updateSpecialRenderData();
|
void updateSpecialRenderData();
|
||||||
|
|
||||||
void onBorderAngleAnimEnd(void* ptr);
|
void onBorderAngleAnimEnd(void* ptr);
|
||||||
|
|
|
@ -329,11 +329,11 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
|
||||||
renderdata.surface = pWindow->m_pWLSurface.wlr();
|
renderdata.surface = pWindow->m_pWLSurface.wlr();
|
||||||
renderdata.w = std::max(pWindow->m_vRealSize.vec().x, 5.0); // clamp the size to min 5,
|
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.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.fadeAlpha = pWindow->m_fAlpha.fl() * (pWindow->m_bPinned ? 1.f : PWORKSPACE->m_fAlpha.fl());
|
||||||
renderdata.alpha = pWindow->m_fActiveInactiveAlpha.fl();
|
renderdata.alpha = pWindow->m_fActiveInactiveAlpha.fl();
|
||||||
renderdata.decorate = decorate && !pWindow->m_bX11DoesntWantBorders && (!pWindow->m_bIsFullscreen || PWORKSPACE->m_efFullscreenMode != FULLSCREEN_FULL);
|
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.blur = !ignoreAllGeometry; // if it shouldn't, it will be ignored later
|
||||||
renderdata.pWindow = pWindow;
|
renderdata.pWindow = pWindow;
|
||||||
|
|
||||||
|
@ -1991,7 +1991,7 @@ void CHyprRenderer::setOccludedForBackLayers(CRegion& region, CWorkspace* pWorks
|
||||||
if (!w->opaque())
|
if (!w->opaque())
|
||||||
continue;
|
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 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};
|
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
|
// TODO: fix mouse event with rounding
|
||||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_pWindow->m_iWorkspaceID);
|
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 BORDERSIZE = m_pWindow->getRealBorderSize();
|
||||||
|
|
||||||
const int BARW = (m_vLastWindowSize.x - 2 * ROUNDING - BAR_HORIZONTAL_PADDING * (barsToDraw - 1)) / barsToDraw;
|
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() {
|
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();
|
const int BORDERSIZE = m_pWindow->getRealBorderSize();
|
||||||
return CRegion(m_vLastWindowPos.x + ROUNDING,
|
return CRegion(m_vLastWindowPos.x + ROUNDING,
|
||||||
m_vLastWindowPos.y +
|
m_vLastWindowPos.y +
|
||||||
|
|
Loading…
Reference in a new issue