diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2025-08-16 20:02:15 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-16 20:02:15 +0100 |
| commit | 3d4dc19412921864c25cd25e0cbffd6e1693c43c (patch) | |
| tree | 0a0e54a2336fb408bbd7d3767682f33391c3fee3 /src | |
| parent | 78c9e2080c800e9da0792b73ca436ef49384bfb7 (diff) | |
renderer: improve zoom in anims (#11453)
Removes `animations:first_launch_animation` as it's useless now
Diffstat (limited to 'src')
| -rw-r--r-- | src/config/ConfigDescriptions.hpp | 6 | ||||
| -rw-r--r-- | src/config/ConfigManager.cpp | 2 | ||||
| -rw-r--r-- | src/helpers/Monitor.cpp | 7 | ||||
| -rw-r--r-- | src/helpers/Monitor.hpp | 3 | ||||
| -rw-r--r-- | src/render/Renderer.cpp | 29 | ||||
| -rw-r--r-- | src/render/Renderer.hpp | 2 |
6 files changed, 13 insertions, 36 deletions
diff --git a/src/config/ConfigDescriptions.hpp b/src/config/ConfigDescriptions.hpp index 2d9582f6..23252c91 100644 --- a/src/config/ConfigDescriptions.hpp +++ b/src/config/ConfigDescriptions.hpp @@ -381,12 +381,6 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = { .data = SConfigOptionDescription::SBoolData{true}, }, SConfigOptionDescription{ - .value = "animations:first_launch_animation", - .description = "enable first launch animation", - .type = CONFIG_OPTION_BOOL, - .data = SConfigOptionDescription::SBoolData{true}, - }, - SConfigOptionDescription{ .value = "animations:workspace_wraparound", .description = "changes the direction of slide animations between the first and last workspaces", .type = CONFIG_OPTION_BOOL, diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 4427906f..2d817534 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -619,7 +619,6 @@ CConfigManager::CConfigManager() { registerConfigVar("master:always_keep_position", Hyprlang::INT{0}); registerConfigVar("animations:enabled", Hyprlang::INT{1}); - registerConfigVar("animations:first_launch_animation", Hyprlang::INT{1}); registerConfigVar("animations:workspace_wraparound", Hyprlang::INT{0}); registerConfigVar("input:follow_mouse", Hyprlang::INT{1}); @@ -985,6 +984,7 @@ void CConfigManager::setDefaultAnimationVars() { m_animationTree.createNode("borderangle", "global"); m_animationTree.createNode("workspaces", "global"); m_animationTree.createNode("zoomFactor", "global"); + m_animationTree.createNode("monitorAdded", "global"); // layer m_animationTree.createNode("layersIn", "layers"); diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index fa0965b8..93a798a0 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -49,6 +49,8 @@ CMonitor::CMonitor(SP<Aquamarine::IOutput> output_) : m_state(this), m_output(ou static auto PZOOMFACTOR = CConfigValue<Hyprlang::FLOAT>("cursor:zoom_factor"); g_pAnimationManager->createAnimation(*PZOOMFACTOR, m_cursorZoom, g_pConfigManager->getAnimationPropertyConfig("zoomFactor"), AVARDAMAGE_NONE); m_cursorZoom->setUpdateCallback([this](auto) { g_pHyprRenderer->damageMonitor(m_self.lock()); }); + g_pAnimationManager->createAnimation(0.F, m_zoomAnimProgress, g_pConfigManager->getAnimationPropertyConfig("monitorAdded"), AVARDAMAGE_NONE); + m_zoomAnimProgress->setUpdateCallback([this](auto) { g_pHyprRenderer->damageMonitor(m_self.lock()); }); } CMonitor::~CMonitor() { @@ -61,6 +63,8 @@ void CMonitor::onConnect(bool noRule) { EMIT_HOOK_EVENT("preMonitorAdded", m_self.lock()); CScopeGuard x = {[]() { g_pCompositor->arrangeMonitors(); }}; + m_zoomAnimProgress->setValueAndWarp(0.F); + g_pEventLoopManager->doLater([] { g_pConfigManager->ensurePersistentWorkspacesPresent(); }); m_listeners.frame = m_output->events.frame.listen([this] { @@ -89,6 +93,9 @@ void CMonitor::onConnect(bool noRule) { else PROTO::presentation->onPresented(m_self.lock(), Time::fromTimespec(event.when), event.refresh, event.seq, event.flags); + if (m_zoomAnimProgress->goal() == 0.F) + *m_zoomAnimProgress = 1.F; + m_frameScheduler->onPresented(); }); diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp index f2b7e1ed..a857cd49 100644 --- a/src/helpers/Monitor.hpp +++ b/src/helpers/Monitor.hpp @@ -183,6 +183,9 @@ class CMonitor { PHLANIMVAR<float> m_cursorZoom; + // for initial zoom anim + PHLANIMVAR<float> m_zoomAnimProgress; + struct { bool canTear = false; bool nextRenderTorn = false; diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index dfafbead..326f71bb 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -1186,8 +1186,6 @@ void CHyprRenderer::renderMonitor(PHLMONITOR pMonitor, bool commit) { static auto PDAMAGEBLINK = CConfigValue<Hyprlang::INT>("debug:damage_blink"); static auto PDIRECTSCANOUT = CConfigValue<Hyprlang::INT>("render:direct_scanout"); static auto PVFR = CConfigValue<Hyprlang::INT>("misc:vfr"); - static auto PANIMENABLED = CConfigValue<Hyprlang::INT>("animations:enabled"); - static auto PFIRSTLAUNCHANIM = CConfigValue<Hyprlang::INT>("animations:first_launch_animation"); static auto PTEARINGENABLED = CConfigValue<Hyprlang::INT>("general:allow_tearing"); static int damageBlinkCleanup = 0; // because double-buffered @@ -1202,28 +1200,6 @@ void CHyprRenderer::renderMonitor(PHLMONITOR pMonitor, bool commit) { if (!*PDAMAGEBLINK) damageBlinkCleanup = 0; - static bool firstLaunch = true; - static bool firstLaunchAnimActive = *PFIRSTLAUNCHANIM; - - float zoomInFactorFirstLaunch = 1.f; - - if (firstLaunch) { - firstLaunch = false; - m_renderTimer.reset(); - } - - if (m_renderTimer.getSeconds() < 1.5f && firstLaunchAnimActive) { // TODO: make the animation system more damage-flexible so that this can be migrated to there - if (!*PANIMENABLED) { - zoomInFactorFirstLaunch = 1.f; - firstLaunchAnimActive = false; - } else { - zoomInFactorFirstLaunch = 2.f - g_pAnimationManager->getBezier("default")->getYForPoint(m_renderTimer.getSeconds() / 1.5); - damageMonitor(pMonitor); - } - } else { - firstLaunchAnimActive = false; - } - if (*PDEBUGOVERLAY == 1) { renderStart = std::chrono::high_resolution_clock::now(); g_pDebugOverlay->frameData(pMonitor); @@ -1334,11 +1310,10 @@ void CHyprRenderer::renderMonitor(PHLMONITOR pMonitor, bool commit) { else g_pHyprOpenGL->m_renderData.mouseZoomFactor = 1.f; - if (zoomInFactorFirstLaunch > 1.f) { - g_pHyprOpenGL->m_renderData.mouseZoomFactor = zoomInFactorFirstLaunch; + if (pMonitor->m_zoomAnimProgress->isBeingAnimated()) { + g_pHyprOpenGL->m_renderData.mouseZoomFactor = 2.0 - pMonitor->m_zoomAnimProgress->value(); // 2x zoom -> 1x zoom g_pHyprOpenGL->m_renderData.mouseZoomUseMouse = false; g_pHyprOpenGL->m_renderData.useNearestNeighbor = false; - pMonitor->m_forceFullFrames = 10; } CRegion damage, finalDamage; diff --git a/src/render/Renderer.hpp b/src/render/Renderer.hpp index 4018fe40..b898e37c 100644 --- a/src/render/Renderer.hpp +++ b/src/render/Renderer.hpp @@ -104,8 +104,6 @@ class CHyprRenderer { wl_event_source* m_crashingLoop = nullptr; wl_event_source* m_cursorTicker = nullptr; - CTimer m_renderTimer; - std::vector<CHLBufferReference> m_usedAsyncBuffers; struct { |
