mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-17 04:53:48 -07:00
renderer: improve zoom in anims (#11453)
Removes `animations:first_launch_animation` as it's useless now
This commit is contained in:
@@ -380,12 +380,6 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
||||
.type = CONFIG_OPTION_BOOL,
|
||||
.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",
|
||||
|
@@ -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");
|
||||
|
@@ -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();
|
||||
});
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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 {
|
||||
|
Reference in New Issue
Block a user