mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 20:45: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};
|
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() {
|
void CWindow::updateWindowDecos() {
|
||||||
for (auto& wd : m_dWindowDecorations)
|
for (auto& wd : m_dWindowDecorations)
|
||||||
wd->updateWindow(this);
|
wd->updateWindow(this);
|
||||||
|
|
|
@ -287,34 +287,35 @@ class CWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
wlr_box getFullWindowBoundingBox();
|
wlr_box getFullWindowBoundingBox();
|
||||||
wlr_box getWindowIdealBoundingBoxIgnoreReserved();
|
wlr_box getWindowIdealBoundingBoxIgnoreReserved();
|
||||||
void updateWindowDecos();
|
void updateWindowDecos();
|
||||||
pid_t getPID();
|
pid_t getPID();
|
||||||
IHyprWindowDecoration* getDecorationByType(eDecorationType);
|
IHyprWindowDecoration* getDecorationByType(eDecorationType);
|
||||||
void removeDecorationByType(eDecorationType);
|
void removeDecorationByType(eDecorationType);
|
||||||
void createToplevelHandle();
|
void createToplevelHandle();
|
||||||
void destroyToplevelHandle();
|
void destroyToplevelHandle();
|
||||||
void updateToplevel();
|
void updateToplevel();
|
||||||
void updateSurfaceOutputs();
|
void updateSurfaceOutputs();
|
||||||
void moveToWorkspace(int);
|
void moveToWorkspace(int);
|
||||||
CWindow* X11TransientFor();
|
CWindow* X11TransientFor();
|
||||||
void onUnmap();
|
void onUnmap();
|
||||||
void onMap();
|
void onMap();
|
||||||
void setHidden(bool hidden);
|
void setHidden(bool hidden);
|
||||||
bool isHidden();
|
bool isHidden();
|
||||||
void applyDynamicRule(const SWindowRule& r);
|
void applyDynamicRule(const SWindowRule& r);
|
||||||
void updateDynamicRules();
|
void updateDynamicRules();
|
||||||
|
SWindowDecorationExtents getFullWindowReservedArea();
|
||||||
|
|
||||||
void onBorderAngleAnimEnd(void* ptr);
|
void onBorderAngleAnimEnd(void* ptr);
|
||||||
bool isInCurvedCorner(double x, double y);
|
bool isInCurvedCorner(double x, double y);
|
||||||
bool hasPopupAt(const Vector2D& pos);
|
bool hasPopupAt(const Vector2D& pos);
|
||||||
|
|
||||||
CWindow* getGroupHead();
|
CWindow* getGroupHead();
|
||||||
CWindow* getGroupTail();
|
CWindow* getGroupTail();
|
||||||
CWindow* getGroupCurrent();
|
CWindow* getGroupCurrent();
|
||||||
void setGroupCurrent(CWindow* pWindow);
|
void setGroupCurrent(CWindow* pWindow);
|
||||||
void insertWindowToGroup(CWindow* pWindow);
|
void insertWindowToGroup(CWindow* pWindow);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// For hidden windows and stuff
|
// For hidden windows and stuff
|
||||||
|
|
|
@ -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 &&
|
if (!force &&
|
||||||
((pWindow->m_vReportedSize == size && pWindow->m_vRealPosition.vec() == pWindow->m_vReportedPosition) || (pWindow->m_vReportedSize == size && !pWindow->m_bIsX11)))
|
((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 getTitle(CWindow*);
|
||||||
std::string getAppIDClass(CWindow*);
|
std::string getAppIDClass(CWindow*);
|
||||||
void sendCloseWindow(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 setWindowStyleTiled(CWindow*, uint32_t);
|
||||||
void setWindowFullscreen(CWindow*, bool);
|
void setWindowFullscreen(CWindow*, bool);
|
||||||
wlr_surface* surfaceAt(CWindow*, const Vector2D&, Vector2D&);
|
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 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 PNOFLOATINGBORDERS = &g_pConfigManager->getConfigValuePtr("general:no_border_on_floating")->intValue;
|
||||||
static auto* const PDIMAROUND = &g_pConfigManager->getConfigValuePtr("decoration:dim_around")->floatValue;
|
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;
|
decorate = false;
|
||||||
|
|
||||||
renderdata.surface = g_pXWaylandManager->getWindowSurface(pWindow);
|
renderdata.surface = g_pXWaylandManager->getWindowSurface(pWindow);
|
||||||
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 - RESERVED.topLeft.x - RESERVED.bottomRight.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 - 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.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.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();
|
||||||
|
|
|
@ -3,3 +3,7 @@
|
||||||
#include "../../Window.hpp"
|
#include "../../Window.hpp"
|
||||||
|
|
||||||
IHyprWindowDecoration::~IHyprWindowDecoration() {}
|
IHyprWindowDecoration::~IHyprWindowDecoration() {}
|
||||||
|
|
||||||
|
SWindowDecorationExtents IHyprWindowDecoration::getWindowDecorationReservedArea() {
|
||||||
|
return SWindowDecorationExtents{};
|
||||||
|
}
|
||||||
|
|
|
@ -31,4 +31,6 @@ interface IHyprWindowDecoration {
|
||||||
virtual void updateWindow(CWindow*) = 0;
|
virtual void updateWindow(CWindow*) = 0;
|
||||||
|
|
||||||
virtual void damageEntire() = 0;
|
virtual void damageEntire() = 0;
|
||||||
|
|
||||||
|
virtual SWindowDecorationExtents getWindowDecorationReservedArea();
|
||||||
};
|
};
|
Loading…
Reference in a new issue