mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2026-08-18 02:58:43 +00:00
borders/bars/focus: chase hyprland (#687)
* borders/bars/focus: chase hyprland * barDeco.cpp: clang-format
This commit is contained in:
@ -16,8 +16,8 @@ static size_t borderCount() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CBordersPlusPlus::CBordersPlusPlus(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow), m_pWindow(pWindow) {
|
CBordersPlusPlus::CBordersPlusPlus(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow), m_pWindow(pWindow) {
|
||||||
m_lastWindowPos = pWindow->m_realPosition->value();
|
m_lastWindowPos = pWindow->position(Desktop::View::IGeometric::GEOMETRIC_CURRENT);
|
||||||
m_lastWindowSize = pWindow->m_realSize->value();
|
m_lastWindowSize = pWindow->size(Desktop::View::IGeometric::GEOMETRIC_CURRENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
CBordersPlusPlus::~CBordersPlusPlus() {
|
CBordersPlusPlus::~CBordersPlusPlus() {
|
||||||
@ -156,8 +156,8 @@ eDecorationType CBordersPlusPlus::getDecorationType() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CBordersPlusPlus::updateWindow(PHLWINDOW pWindow) {
|
void CBordersPlusPlus::updateWindow(PHLWINDOW pWindow) {
|
||||||
m_lastWindowPos = pWindow->m_realPosition->value();
|
m_lastWindowPos = pWindow->position(Desktop::View::IGeometric::GEOMETRIC_CURRENT);
|
||||||
m_lastWindowSize = pWindow->m_realSize->value();
|
m_lastWindowSize = pWindow->size(Desktop::View::IGeometric::GEOMETRIC_CURRENT);
|
||||||
|
|
||||||
damageEntire();
|
damageEntire();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -508,9 +508,9 @@ void CHyprBar::renderPass(PHLMONITOR pMonitor, const float& a) {
|
|||||||
|
|
||||||
if (ROUNDING) {
|
if (ROUNDING) {
|
||||||
// the +1 is a shit garbage temp fix until renderRect supports an alpha matte
|
// the +1 is a shit garbage temp fix until renderRect supports an alpha matte
|
||||||
CBox windowBox = {PWINDOW->m_realPosition->value().x + PWINDOW->m_floatingOffset.x - pMonitor->m_position.x + 1,
|
CBox windowBox = {PWINDOW->position(Desktop::View::IGeometric::GEOMETRIC_CURRENT).x + PWINDOW->m_floatingOffset.x - pMonitor->m_position.x + 1,
|
||||||
PWINDOW->m_realPosition->value().y + PWINDOW->m_floatingOffset.y - pMonitor->m_position.y + 1, PWINDOW->m_realSize->value().x - 2,
|
PWINDOW->position(Desktop::View::IGeometric::GEOMETRIC_CURRENT).y + PWINDOW->m_floatingOffset.y - pMonitor->m_position.y + 1,
|
||||||
PWINDOW->m_realSize->value().y - 2};
|
PWINDOW->size(Desktop::View::IGeometric::GEOMETRIC_CURRENT).x - 2, PWINDOW->size(Desktop::View::IGeometric::GEOMETRIC_CURRENT).y - 2};
|
||||||
|
|
||||||
if (windowBox.w < 1 || windowBox.h < 1)
|
if (windowBox.w < 1 || windowBox.h < 1)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -96,48 +96,48 @@ static void onFocusChange(PHLWINDOW window, Desktop::eFocusReason reason) {
|
|||||||
w->alpha(Desktop::View::WINDOW_ALPHA_ACTIVE)->setCallbackOnEnd(nullptr);
|
w->alpha(Desktop::View::WINDOW_ALPHA_ACTIVE)->setCallbackOnEnd(nullptr);
|
||||||
});
|
});
|
||||||
} else if (mode == "shrink") {
|
} else if (mode == "shrink") {
|
||||||
const auto ORIGINAL = CBox{window->m_realPosition->goal(), window->m_realSize->goal()};
|
const auto ORIGINAL = CBox{window->positionAnimation()->goal(), window->sizeAnimation()->goal()};
|
||||||
|
|
||||||
window->m_realPosition->setConfig(PIN);
|
window->positionAnimation()->setConfig(PIN);
|
||||||
window->m_realSize->setConfig(PIN);
|
window->sizeAnimation()->setConfig(PIN);
|
||||||
|
|
||||||
auto box = ORIGINAL.copy().scaleFromCenter(configValues.shrinkPercentage->value());
|
auto box = ORIGINAL.copy().scaleFromCenter(configValues.shrinkPercentage->value());
|
||||||
|
|
||||||
*window->m_realPosition = box.pos();
|
*window->positionAnimation() = box.pos();
|
||||||
*window->m_realSize = box.size();
|
*window->sizeAnimation() = box.size();
|
||||||
|
|
||||||
window->m_realSize->setCallbackOnEnd([w = PHLWINDOWREF{window}, POUT, ORIGINAL](WP<CBaseAnimatedVariable> pav) {
|
window->sizeAnimation()->setCallbackOnEnd([w = PHLWINDOWREF{window}, POUT, ORIGINAL](WP<CBaseAnimatedVariable> pav) {
|
||||||
if (!w)
|
if (!w)
|
||||||
return;
|
return;
|
||||||
w->m_realSize->setConfig(POUT);
|
w->sizeAnimation()->setConfig(POUT);
|
||||||
w->m_realPosition->setConfig(POUT);
|
w->positionAnimation()->setConfig(POUT);
|
||||||
|
|
||||||
if (w->m_isFloating || Fullscreen::controller()->isFullscreen(w.lock())) {
|
if (w->m_isFloating || Fullscreen::controller()->isFullscreen(w.lock())) {
|
||||||
*w->m_realPosition = ORIGINAL.pos();
|
*w->positionAnimation() = ORIGINAL.pos();
|
||||||
*w->m_realSize = ORIGINAL.size();
|
*w->sizeAnimation() = ORIGINAL.size();
|
||||||
} else
|
} else
|
||||||
w->layoutTarget()->recalc();
|
w->layoutTarget()->recalc();
|
||||||
|
|
||||||
w->m_realSize->setCallbackOnEnd(nullptr);
|
w->sizeAnimation()->setCallbackOnEnd(nullptr);
|
||||||
});
|
});
|
||||||
} else if (mode == "slide") {
|
} else if (mode == "slide") {
|
||||||
const auto ORIGINAL = window->m_realPosition->goal();
|
const auto ORIGINAL = window->positionAnimation()->goal();
|
||||||
|
|
||||||
window->m_realPosition->setConfig(PIN);
|
window->positionAnimation()->setConfig(PIN);
|
||||||
|
|
||||||
*window->m_realPosition = ORIGINAL - Vector2D{0.F, configValues.slideHeight->value()};
|
*window->positionAnimation() = ORIGINAL - Vector2D{0.F, configValues.slideHeight->value()};
|
||||||
|
|
||||||
window->m_realPosition->setCallbackOnEnd([w = PHLWINDOWREF{window}, POUT, ORIGINAL](WP<CBaseAnimatedVariable> pav) {
|
window->positionAnimation()->setCallbackOnEnd([w = PHLWINDOWREF{window}, POUT, ORIGINAL](WP<CBaseAnimatedVariable> pav) {
|
||||||
if (!w)
|
if (!w)
|
||||||
return;
|
return;
|
||||||
w->m_realPosition->setConfig(POUT);
|
w->positionAnimation()->setConfig(POUT);
|
||||||
|
|
||||||
if (w->m_isFloating || Fullscreen::controller()->isFullscreen(w.lock()))
|
if (w->m_isFloating || Fullscreen::controller()->isFullscreen(w.lock()))
|
||||||
*w->m_realPosition = ORIGINAL;
|
*w->positionAnimation() = ORIGINAL;
|
||||||
else
|
else
|
||||||
w->layoutTarget()->recalc();
|
w->layoutTarget()->recalc();
|
||||||
|
|
||||||
w->m_realPosition->setCallbackOnEnd(nullptr);
|
w->positionAnimation()->setCallbackOnEnd(nullptr);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -188,8 +188,8 @@ APICALL EXPORT void PLUGIN_EXIT() {
|
|||||||
if (!Desktop::View::validMapped(w))
|
if (!Desktop::View::validMapped(w))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
w->m_realSize->setCallbackOnEnd(nullptr);
|
w->sizeAnimation()->setCallbackOnEnd(nullptr);
|
||||||
w->m_realPosition->setCallbackOnEnd(nullptr);
|
w->positionAnimation()->setCallbackOnEnd(nullptr);
|
||||||
w->alpha(Desktop::View::WINDOW_ALPHA_ACTIVE)->setCallbackOnEnd(nullptr);
|
w->alpha(Desktop::View::WINDOW_ALPHA_ACTIVE)->setCallbackOnEnd(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user