mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-21 23:13:49 -07:00
core: move parts of the animation system to hyprutils (#8868)
* core: change animation manager to use Hyprutils::Animation * config: move animation config to hyprutils animation tree * use g_pAnimationManager->createAnimation and the new PHLANIMVAR template * core: use CGenericAnimatedVariabled::{enabled,setConfig,getStyle} and adapt callbacks * core: adapt animated variable usage (dereference the shared pointer) * misc: bump CMakeLists to hyprutils 0.3.3
This commit is contained in:
committed by
GitHub
parent
c7086f936a
commit
5642ed331d
@@ -3,6 +3,7 @@
|
||||
#include "../render/Renderer.hpp"
|
||||
#include "core/Output.hpp"
|
||||
#include "../config/ConfigValue.hpp"
|
||||
#include "managers/AnimationManager.hpp"
|
||||
|
||||
CHyprlandCTMControlResource::CHyprlandCTMControlResource(SP<CHyprlandCtmControlManagerV1> resource_) : resource(resource_) {
|
||||
if (!good())
|
||||
@@ -92,8 +93,7 @@ bool CHyprlandCTMControlProtocol::isCTMAnimationEnabled() {
|
||||
}
|
||||
|
||||
CHyprlandCTMControlProtocol::SCTMData::SCTMData() {
|
||||
progress.create(g_pConfigManager->getAnimationPropertyConfig("__internal_fadeCTM"), AVARDAMAGE_NONE);
|
||||
progress.setValueAndWarp(0.F);
|
||||
g_pAnimationManager->createAnimation(0.f, progress, g_pConfigManager->getAnimationPropertyConfig("__internal_fadeCTM"), AVARDAMAGE_NONE);
|
||||
}
|
||||
|
||||
void CHyprlandCTMControlProtocol::setCTM(PHLMONITOR monitor, const Mat3x3& ctm) {
|
||||
@@ -112,18 +112,18 @@ void CHyprlandCTMControlProtocol::setCTM(PHLMONITOR monitor, const Mat3x3& ctm)
|
||||
data->ctmFrom = data->ctmTo;
|
||||
data->ctmTo = ctm;
|
||||
|
||||
data->progress.setValueAndWarp(0.F);
|
||||
data->progress = 1.F;
|
||||
data->progress->setValueAndWarp(0.F);
|
||||
*data->progress = 1.F;
|
||||
|
||||
monitor->setCTM(data->ctmFrom);
|
||||
|
||||
data->progress.setUpdateCallback([monitor = PHLMONITORREF{monitor}, this](void* self) {
|
||||
data->progress->setUpdateCallback([monitor = PHLMONITORREF{monitor}, this](auto) {
|
||||
if (!monitor || !m_mCTMDatas.contains(monitor))
|
||||
return;
|
||||
auto& data = m_mCTMDatas.at(monitor);
|
||||
const auto from = data->ctmFrom.getMatrix();
|
||||
const auto to = data->ctmTo.getMatrix();
|
||||
const auto PROGRESS = data->progress.getPercent();
|
||||
const auto PROGRESS = data->progress->getPercent();
|
||||
|
||||
static const auto lerp = [](const float one, const float two, const float progress) -> float { return one + (two - one) * progress; };
|
||||
|
||||
@@ -135,7 +135,7 @@ void CHyprlandCTMControlProtocol::setCTM(PHLMONITOR monitor, const Mat3x3& ctm)
|
||||
monitor->setCTM(mtx);
|
||||
});
|
||||
|
||||
data->progress.setCallbackOnEnd([monitor = PHLMONITORREF{monitor}, this](void* self) {
|
||||
data->progress->setCallbackOnEnd([monitor = PHLMONITORREF{monitor}, this](auto) {
|
||||
if (!monitor || !m_mCTMDatas.contains(monitor)) {
|
||||
monitor->setCTM(Mat3x3::identity());
|
||||
return;
|
||||
|
@@ -42,8 +42,8 @@ class CHyprlandCTMControlProtocol : public IWaylandProtocol {
|
||||
//
|
||||
struct SCTMData {
|
||||
SCTMData();
|
||||
Mat3x3 ctmFrom = Mat3x3::identity(), ctmTo = Mat3x3::identity();
|
||||
CAnimatedVariable<float> progress;
|
||||
Mat3x3 ctmFrom = Mat3x3::identity(), ctmTo = Mat3x3::identity();
|
||||
PHLANIMVAR<float> progress;
|
||||
};
|
||||
std::map<PHLMONITORREF, std::unique_ptr<SCTMData>> m_mCTMDatas;
|
||||
|
||||
|
@@ -119,7 +119,7 @@ CToplevelExportFrame::CToplevelExportFrame(SP<CHyprlandToplevelExportFrameV1> re
|
||||
|
||||
dmabufFormat = PMONITOR->output->state->state().drmFormat;
|
||||
|
||||
box = {0, 0, (int)(pWindow->m_vRealSize.value().x * PMONITOR->scale), (int)(pWindow->m_vRealSize.value().y * PMONITOR->scale)};
|
||||
box = {0, 0, (int)(pWindow->m_vRealSize->value().x * PMONITOR->scale), (int)(pWindow->m_vRealSize->value().y * PMONITOR->scale)};
|
||||
|
||||
box.transform(wlTransformToHyprutils(PMONITOR->transform), PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y).round();
|
||||
|
||||
@@ -263,7 +263,7 @@ bool CToplevelExportFrame::copyShm(timespec* now) {
|
||||
g_pHyprRenderer->m_bBlockSurfaceFeedback = false;
|
||||
|
||||
if (overlayCursor)
|
||||
g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - pWindow->m_vRealPosition.value());
|
||||
g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - pWindow->m_vRealPosition->value());
|
||||
|
||||
const auto PFORMAT = NFormatUtils::getPixelFormatFromDRM(shm.format);
|
||||
if (!PFORMAT) {
|
||||
@@ -315,7 +315,7 @@ bool CToplevelExportFrame::copyDmabuf(timespec* now) {
|
||||
g_pHyprRenderer->m_bBlockSurfaceFeedback = false;
|
||||
|
||||
if (overlayCursor)
|
||||
g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - pWindow->m_vRealPosition.value());
|
||||
g_pPointerManager->renderSoftwareCursorsFor(PMONITOR->self.lock(), now, fakeDamage, g_pInputManager->getMouseCoordsInternal() - pWindow->m_vRealPosition->value());
|
||||
|
||||
g_pHyprOpenGL->m_RenderData.blockScreenShader = true;
|
||||
g_pHyprRenderer->endRender();
|
||||
@@ -386,7 +386,7 @@ void CToplevelExportProtocol::onOutputCommit(PHLMONITOR pMonitor) {
|
||||
if (pMonitor != PWINDOW->m_pMonitor.lock())
|
||||
continue;
|
||||
|
||||
CBox geometry = {PWINDOW->m_vRealPosition.value().x, PWINDOW->m_vRealPosition.value().y, PWINDOW->m_vRealSize.value().x, PWINDOW->m_vRealSize.value().y};
|
||||
CBox geometry = {PWINDOW->m_vRealPosition->value().x, PWINDOW->m_vRealPosition->value().y, PWINDOW->m_vRealSize->value().x, PWINDOW->m_vRealSize->value().y};
|
||||
|
||||
if (geometry.intersection({pMonitor->vecPosition, pMonitor->vecSize}).empty())
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user