summaryrefslogtreecommitdiff
path: root/src/desktop/view/Window.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2026-04-29 17:25:21 +0100
committerVaxry <43317083+vaxerski@users.noreply.github.com>2026-04-29 22:05:32 +0100
commit55a1611fd8150d7bb8d1b6e2b8cc95ffccf31ea2 (patch)
tree88ae2d9bcee6d327c6af97e2afb920020f16432b /src/desktop/view/Window.cpp
parenta92dae5af7bad3af53f6d6b689d71ee900077569 (diff)
desktop/window: expand hidden into proper states
Diffstat (limited to 'src/desktop/view/Window.cpp')
-rw-r--r--src/desktop/view/Window.cpp45
1 files changed, 40 insertions, 5 deletions
diff --git a/src/desktop/view/Window.cpp b/src/desktop/view/Window.cpp
index ef854bd1..73c4378d 100644
--- a/src/desktop/view/Window.cpp
+++ b/src/desktop/view/Window.cpp
@@ -87,7 +87,7 @@ PHLWINDOW CWindow::create(SP<CXWaylandSurface> surface) {
g_pAnimationManager->createAnimation(1.f, pWindow->alpha(WINDOW_ALPHA_FADE), Config::animationTree()->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE);
g_pAnimationManager->createAnimation(1.f, pWindow->alpha(WINDOW_ALPHA_ACTIVE), Config::animationTree()->getAnimationPropertyConfig("fadeSwitch"), pWindow, AVARDAMAGE_ENTIRE);
g_pAnimationManager->createAnimation(1.f, pWindow->alpha(WINDOW_ALPHA_FULLSCREEN), Config::animationTree()->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE);
- g_pAnimationManager->createAnimation(1.f, pWindow->alpha(WINDOW_ALPHA_LAYOUT), Config::animationTree()->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE);
+ g_pAnimationManager->createAnimation(1.f, pWindow->alpha(WINDOW_ALPHA_LAYOUT), Config::animationTree()->getAnimationPropertyConfig("fadeSwitch"), pWindow, AVARDAMAGE_ENTIRE);
g_pAnimationManager->createAnimation(CHyprColor(), pWindow->m_realShadowColor, Config::animationTree()->getAnimationPropertyConfig("fadeShadow"), pWindow, AVARDAMAGE_SHADOW);
g_pAnimationManager->createAnimation(CHyprColor(), pWindow->m_realGlowColor, Config::animationTree()->getAnimationPropertyConfig("fadeGlow"), pWindow, AVARDAMAGE_ENTIRE);
g_pAnimationManager->createAnimation(0.f, pWindow->m_dimPercent, Config::animationTree()->getAnimationPropertyConfig("fadeDim"), pWindow, AVARDAMAGE_ENTIRE);
@@ -121,7 +121,7 @@ PHLWINDOW CWindow::create(SP<CXDGSurfaceResource> resource) {
g_pAnimationManager->createAnimation(1.f, pWindow->alpha(WINDOW_ALPHA_FADE), Config::animationTree()->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE);
g_pAnimationManager->createAnimation(1.f, pWindow->alpha(WINDOW_ALPHA_ACTIVE), Config::animationTree()->getAnimationPropertyConfig("fadeSwitch"), pWindow, AVARDAMAGE_ENTIRE);
g_pAnimationManager->createAnimation(1.f, pWindow->alpha(WINDOW_ALPHA_FULLSCREEN), Config::animationTree()->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE);
- g_pAnimationManager->createAnimation(1.f, pWindow->alpha(WINDOW_ALPHA_LAYOUT), Config::animationTree()->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE);
+ g_pAnimationManager->createAnimation(1.f, pWindow->alpha(WINDOW_ALPHA_LAYOUT), Config::animationTree()->getAnimationPropertyConfig("fadeSwitch"), pWindow, AVARDAMAGE_ENTIRE);
g_pAnimationManager->createAnimation(CHyprColor(), pWindow->m_realShadowColor, Config::animationTree()->getAnimationPropertyConfig("fadeShadow"), pWindow, AVARDAMAGE_SHADOW);
g_pAnimationManager->createAnimation(CHyprColor(), pWindow->m_realGlowColor, Config::animationTree()->getAnimationPropertyConfig("fadeGlow"), pWindow, AVARDAMAGE_ENTIRE);
g_pAnimationManager->createAnimation(0.f, pWindow->m_dimPercent, Config::animationTree()->getAnimationPropertyConfig("fadeDim"), pWindow, AVARDAMAGE_ENTIRE);
@@ -187,7 +187,7 @@ eViewType CWindow::type() const {
}
bool CWindow::visible() const {
- return !m_hidden && ((m_isMapped && m_wlSurface && m_wlSurface->resource()) || (m_fadingOut && alphaValue(WINDOW_ALPHA_FADE) != 0.F));
+ return !m_hidden && ((m_isMapped && m_wlSurface && m_wlSurface->resource()) || m_fadingOut) && visibleByAlpha();
}
std::optional<CBox> CWindow::logicalBox() const {
@@ -723,10 +723,37 @@ void CWindow::setHidden(bool hidden) {
setSuspended(hidden);
}
-bool CWindow::isHidden() {
+bool CWindow::isHidden() const {
return m_hidden;
}
+void CWindow::setInputBlocked(eWindowInputBlockReason reason, bool blocked) {
+ if (reason == INPUT_BLOCK_NONE)
+ return;
+
+ const auto MASK = sc<uint32_t>(reason);
+
+ if (blocked)
+ m_inputBlockReasons |= MASK;
+ else
+ m_inputBlockReasons &= ~MASK;
+
+ if (blocked && Desktop::focusState()->window() == m_self)
+ Desktop::focusState()->window().reset();
+}
+
+bool CWindow::isInputBlocked() const {
+ return m_inputBlockReasons != INPUT_BLOCK_NONE;
+}
+
+bool CWindow::isInputBlocked(eWindowInputBlockReason reason) const {
+ return (m_inputBlockReasons & sc<uint32_t>(reason)) != 0;
+}
+
+bool CWindow::acceptsInput() const {
+ return !isHidden() && !isInputBlocked();
+}
+
PHLANIMVAR<float>& CWindow::alpha(eWindowAlpha type) {
return m_alpha.get(type);
}
@@ -751,6 +778,14 @@ float CWindow::alphaTotalWithout(eWindowAlpha type) const {
return m_alpha.getTotalWithout(type);
}
+float CWindow::effectiveAlpha() const {
+ return alphaTotal();
+}
+
+bool CWindow::visibleByAlpha() const {
+ return effectiveAlpha() != 0.F;
+}
+
// check if the point is "hidden" under a rounded corner of the window
// it is assumed that the point is within the real window box (m_vRealPosition, m_vRealSize)
// otherwise behaviour is undefined
@@ -1341,7 +1376,7 @@ PHLWINDOW CWindow::getSwallower() {
break;
for (auto const& w : g_pCompositor->m_windows) {
- if (!w->m_isMapped || w->isHidden())
+ if (!w->m_isMapped || !w->acceptsInput())
continue;
if (w->getPID() == currentPid)