mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 02:45:58 +01:00
parent
9afdd61ade
commit
91cbe93cf8
5 changed files with 32 additions and 15 deletions
|
@ -26,6 +26,10 @@ void CHyprDropShadowDecoration::onPositioningReply(const SDecorationPositioningR
|
||||||
updateWindow(m_pWindow);
|
updateWindow(m_pWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t CHyprDropShadowDecoration::getDecorationFlags() {
|
||||||
|
return DECORATION_NON_SOLID;
|
||||||
|
}
|
||||||
|
|
||||||
void CHyprDropShadowDecoration::damageEntire() {
|
void CHyprDropShadowDecoration::damageEntire() {
|
||||||
static auto* const PSHADOWS = &g_pConfigManager->getConfigValuePtr("decoration:drop_shadow")->intValue;
|
static auto* const PSHADOWS = &g_pConfigManager->getConfigValuePtr("decoration:drop_shadow")->intValue;
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@ class CHyprDropShadowDecoration : public IHyprWindowDecoration {
|
||||||
|
|
||||||
virtual eDecorationLayer getDecorationLayer();
|
virtual eDecorationLayer getDecorationLayer();
|
||||||
|
|
||||||
|
virtual uint64_t getDecorationFlags();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SWindowDecorationExtents m_seExtents;
|
SWindowDecorationExtents m_seExtents;
|
||||||
SWindowDecorationExtents m_seReportedExtents;
|
SWindowDecorationExtents m_seReportedExtents;
|
||||||
|
|
|
@ -168,8 +168,11 @@ void CDecorationPositioner::onWindowUpdate(CWindow* pWindow) {
|
||||||
const bool LEFT = wd->positioningInfo.edges & DECORATION_EDGE_LEFT;
|
const bool LEFT = wd->positioningInfo.edges & DECORATION_EDGE_LEFT;
|
||||||
const bool RIGHT = wd->positioningInfo.edges & DECORATION_EDGE_RIGHT;
|
const bool RIGHT = wd->positioningInfo.edges & DECORATION_EDGE_RIGHT;
|
||||||
const int EDGESNO = TOP + BOTTOM + LEFT + RIGHT;
|
const int EDGESNO = TOP + BOTTOM + LEFT + RIGHT;
|
||||||
|
const bool SOLID = !(wd->pDecoration->getDecorationFlags() & DECORATION_NON_SOLID);
|
||||||
|
|
||||||
if (wd->positioningInfo.policy == DECORATION_POSITION_ABSOLUTE) {
|
if (wd->positioningInfo.policy == DECORATION_POSITION_ABSOLUTE) {
|
||||||
|
|
||||||
|
if (SOLID) {
|
||||||
if (LEFT)
|
if (LEFT)
|
||||||
stickyOffsetXL += wd->positioningInfo.desiredExtents.topLeft.x;
|
stickyOffsetXL += wd->positioningInfo.desiredExtents.topLeft.x;
|
||||||
if (RIGHT)
|
if (RIGHT)
|
||||||
|
@ -178,6 +181,7 @@ void CDecorationPositioner::onWindowUpdate(CWindow* pWindow) {
|
||||||
stickyOffsetYT += wd->positioningInfo.desiredExtents.topLeft.y;
|
stickyOffsetYT += wd->positioningInfo.desiredExtents.topLeft.y;
|
||||||
if (BOTTOM)
|
if (BOTTOM)
|
||||||
stickyOffsetYB += wd->positioningInfo.desiredExtents.bottomRight.y;
|
stickyOffsetYB += wd->positioningInfo.desiredExtents.bottomRight.y;
|
||||||
|
}
|
||||||
|
|
||||||
wd->lastReply = {};
|
wd->lastReply = {};
|
||||||
wd->pDecoration->onPositioningReply({});
|
wd->pDecoration->onPositioningReply({});
|
||||||
|
@ -210,22 +214,26 @@ void CDecorationPositioner::onWindowUpdate(CWindow* pWindow) {
|
||||||
pos.x -= desiredSize;
|
pos.x -= desiredSize;
|
||||||
size = {desiredSize, wb.size().y};
|
size = {desiredSize, wb.size().y};
|
||||||
|
|
||||||
|
if (SOLID)
|
||||||
stickyOffsetXL += desiredSize;
|
stickyOffsetXL += desiredSize;
|
||||||
} else if (RIGHT) {
|
} else if (RIGHT) {
|
||||||
pos = wb.pos() + Vector2D{wb.size().x, 0} - EDGEPOINT + Vector2D{stickyOffsetXR, 0};
|
pos = wb.pos() + Vector2D{wb.size().x, 0} - EDGEPOINT + Vector2D{stickyOffsetXR, 0};
|
||||||
size = {desiredSize, wb.size().y};
|
size = {desiredSize, wb.size().y};
|
||||||
|
|
||||||
|
if (SOLID)
|
||||||
stickyOffsetXR += desiredSize;
|
stickyOffsetXR += desiredSize;
|
||||||
} else if (TOP) {
|
} else if (TOP) {
|
||||||
pos = wb.pos() - EDGEPOINT - Vector2D{0, stickyOffsetYT};
|
pos = wb.pos() - EDGEPOINT - Vector2D{0, stickyOffsetYT};
|
||||||
pos.y -= desiredSize;
|
pos.y -= desiredSize;
|
||||||
size = {wb.size().x, desiredSize};
|
size = {wb.size().x, desiredSize};
|
||||||
|
|
||||||
|
if (SOLID)
|
||||||
stickyOffsetYT += desiredSize;
|
stickyOffsetYT += desiredSize;
|
||||||
} else {
|
} else {
|
||||||
pos = wb.pos() + Vector2D{0, wb.size().y} - EDGEPOINT - Vector2D{0, stickyOffsetYB};
|
pos = wb.pos() + Vector2D{0, wb.size().y} - EDGEPOINT - Vector2D{0, stickyOffsetYB};
|
||||||
size = {wb.size().x, desiredSize};
|
size = {wb.size().x, desiredSize};
|
||||||
|
|
||||||
|
if (SOLID)
|
||||||
stickyOffsetYB += desiredSize;
|
stickyOffsetYB += desiredSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,14 @@
|
||||||
class CWindow;
|
class CWindow;
|
||||||
class IHyprWindowDecoration;
|
class IHyprWindowDecoration;
|
||||||
|
|
||||||
enum eDecorationPositioningPolicy {
|
enum eDecorationPositioningPolicy
|
||||||
DECORATION_POSITION_ABSOLUTE = 0, /* Decoration does not interfere with anything else */
|
{
|
||||||
|
DECORATION_POSITION_ABSOLUTE = 0, /* Decoration wants absolute positioning */
|
||||||
DECORATION_POSITION_STICKY, /* Decoration is stuck to some edge of a window */
|
DECORATION_POSITION_STICKY, /* Decoration is stuck to some edge of a window */
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eDecorationEdges {
|
enum eDecorationEdges
|
||||||
|
{
|
||||||
DECORATION_EDGE_TOP = 1 << 0,
|
DECORATION_EDGE_TOP = 1 << 0,
|
||||||
DECORATION_EDGE_BOTTOM = 1 << 1,
|
DECORATION_EDGE_BOTTOM = 1 << 1,
|
||||||
DECORATION_EDGE_LEFT = 1 << 2,
|
DECORATION_EDGE_LEFT = 1 << 2,
|
||||||
|
|
|
@ -24,6 +24,7 @@ enum eDecorationFlags
|
||||||
{
|
{
|
||||||
DECORATION_ALLOWS_MOUSE_INPUT = 1 << 0, /* this decoration accepts mouse input */
|
DECORATION_ALLOWS_MOUSE_INPUT = 1 << 0, /* this decoration accepts mouse input */
|
||||||
DECORATION_PART_OF_MAIN_WINDOW = 1 << 1, /* this decoration is a *seamless* part of the main window, so stuff like shadows will include it */
|
DECORATION_PART_OF_MAIN_WINDOW = 1 << 1, /* this decoration is a *seamless* part of the main window, so stuff like shadows will include it */
|
||||||
|
DECORATION_NON_SOLID = 1 << 2, /* this decoration is not solid. Other decorations should draw on top of it. Example: shadow */
|
||||||
};
|
};
|
||||||
|
|
||||||
class CWindow;
|
class CWindow;
|
||||||
|
|
Loading…
Reference in a new issue