mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 20:25:59 +01:00
Added decoration reserved area
This commit is contained in:
parent
7beb9fd606
commit
4b20d4f1ad
7 changed files with 59 additions and 31 deletions
|
@ -88,6 +88,22 @@ wlr_box CWindow::getWindowIdealBoundingBoxIgnoreReserved() {
|
|||
return wlr_box{(int)POS.x, (int)POS.y, (int)SIZE.x, (int)SIZE.y};
|
||||
}
|
||||
|
||||
SWindowDecorationExtents CWindow::getFullWindowReservedArea() {
|
||||
SWindowDecorationExtents extents;
|
||||
|
||||
for (auto& wd : m_dWindowDecorations) {
|
||||
const auto RESERVED = wd->getWindowDecorationReservedArea();
|
||||
|
||||
if (RESERVED.bottomRight == Vector2D{} && RESERVED.topLeft == Vector2D{})
|
||||
continue;
|
||||
|
||||
extents.topLeft = extents.topLeft + RESERVED.topLeft;
|
||||
extents.bottomRight = extents.bottomRight + RESERVED.bottomRight;
|
||||
}
|
||||
|
||||
return extents;
|
||||
}
|
||||
|
||||
void CWindow::updateWindowDecos() {
|
||||
for (auto& wd : m_dWindowDecorations)
|
||||
wd->updateWindow(this);
|
||||
|
|
|
@ -305,6 +305,7 @@ class CWindow {
|
|||
bool isHidden();
|
||||
void applyDynamicRule(const SWindowRule& r);
|
||||
void updateDynamicRules();
|
||||
SWindowDecorationExtents getFullWindowReservedArea();
|
||||
|
||||
void onBorderAngleAnimEnd(void* ptr);
|
||||
bool isInCurvedCorner(double x, double y);
|
||||
|
|
|
@ -136,7 +136,11 @@ void CHyprXWaylandManager::sendCloseWindow(CWindow* pWindow) {
|
|||
}
|
||||
}
|
||||
|
||||
void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, const Vector2D& size, bool force) {
|
||||
void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, Vector2D size, bool force) {
|
||||
|
||||
const auto RESERVED = pWindow->getFullWindowReservedArea();
|
||||
|
||||
size = size - RESERVED.topLeft - RESERVED.bottomRight;
|
||||
|
||||
if (!force &&
|
||||
((pWindow->m_vReportedSize == size && pWindow->m_vRealPosition.vec() == pWindow->m_vReportedPosition) || (pWindow->m_vReportedSize == size && !pWindow->m_bIsX11)))
|
||||
|
|
|
@ -17,7 +17,7 @@ class CHyprXWaylandManager {
|
|||
std::string getTitle(CWindow*);
|
||||
std::string getAppIDClass(CWindow*);
|
||||
void sendCloseWindow(CWindow*);
|
||||
void setWindowSize(CWindow*, const Vector2D&, bool force = false);
|
||||
void setWindowSize(CWindow*, Vector2D, bool force = false);
|
||||
void setWindowStyleTiled(CWindow*, uint32_t);
|
||||
void setWindowFullscreen(CWindow*, bool);
|
||||
wlr_surface* surfaceAt(CWindow*, const Vector2D&, Vector2D&);
|
||||
|
|
|
@ -237,7 +237,8 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
|
|||
}
|
||||
|
||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
|
||||
const auto REALPOS = pWindow->m_vRealPosition.vec() + (pWindow->m_bPinned ? Vector2D{} : PWORKSPACE->m_vRenderOffset.vec());
|
||||
const auto RESERVED = pWindow->getFullWindowReservedArea();
|
||||
const auto REALPOS = pWindow->m_vRealPosition.vec() + (pWindow->m_bPinned ? Vector2D{} : PWORKSPACE->m_vRenderOffset.vec()) + RESERVED.topLeft;
|
||||
static auto* const PNOFLOATINGBORDERS = &g_pConfigManager->getConfigValuePtr("general:no_border_on_floating")->intValue;
|
||||
static auto* const PDIMAROUND = &g_pConfigManager->getConfigValuePtr("decoration:dim_around")->floatValue;
|
||||
|
||||
|
@ -251,8 +252,8 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
|
|||
decorate = false;
|
||||
|
||||
renderdata.surface = g_pXWaylandManager->getWindowSurface(pWindow);
|
||||
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.w = std::max(pWindow->m_vRealSize.vec().x - RESERVED.topLeft.x - RESERVED.bottomRight.x, 5.0); // clamp the size to min 5,
|
||||
renderdata.h = std::max(pWindow->m_vRealSize.vec().y - RESERVED.topLeft.y - RESERVED.bottomRight.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.fadeAlpha = pWindow->m_fAlpha.fl() * (pWindow->m_bPinned ? 1.f : PWORKSPACE->m_fAlpha.fl());
|
||||
renderdata.alpha = pWindow->m_fActiveInactiveAlpha.fl();
|
||||
|
|
|
@ -3,3 +3,7 @@
|
|||
#include "../../Window.hpp"
|
||||
|
||||
IHyprWindowDecoration::~IHyprWindowDecoration() {}
|
||||
|
||||
SWindowDecorationExtents IHyprWindowDecoration::getWindowDecorationReservedArea() {
|
||||
return SWindowDecorationExtents{};
|
||||
}
|
||||
|
|
|
@ -31,4 +31,6 @@ interface IHyprWindowDecoration {
|
|||
virtual void updateWindow(CWindow*) = 0;
|
||||
|
||||
virtual void damageEntire() = 0;
|
||||
|
||||
virtual SWindowDecorationExtents getWindowDecorationReservedArea();
|
||||
};
|
Loading…
Reference in a new issue