mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-07 17:46:00 +01:00
Animation config rework
This commit is contained in:
parent
9dd17a4be6
commit
920fdd6bff
11 changed files with 193 additions and 48 deletions
|
@ -3,12 +3,12 @@
|
|||
#include "render/decorations/CHyprDropShadowDecoration.hpp"
|
||||
|
||||
CWindow::CWindow() {
|
||||
m_vRealPosition.create(AVARTYPE_VECTOR, &g_pConfigManager->getConfigValuePtr("animations:windows_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:windows")->intValue, &g_pConfigManager->getConfigValuePtr("animations:windows_curve")->strValue, (void*) this, AVARDAMAGE_ENTIRE);
|
||||
m_vRealSize.create(AVARTYPE_VECTOR, &g_pConfigManager->getConfigValuePtr("animations:windows_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:windows")->intValue, &g_pConfigManager->getConfigValuePtr("animations:windows_curve")->strValue, (void*)this, AVARDAMAGE_ENTIRE);
|
||||
m_cRealBorderColor.create(AVARTYPE_COLOR, &g_pConfigManager->getConfigValuePtr("animations:borders_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:borders")->intValue, &g_pConfigManager->getConfigValuePtr("animations:borders_curve")->strValue, (void*)this, AVARDAMAGE_BORDER);
|
||||
m_fAlpha.create(AVARTYPE_FLOAT, &g_pConfigManager->getConfigValuePtr("animations:fadein_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:fadein")->intValue, &g_pConfigManager->getConfigValuePtr("animations:fadein_curve")->strValue, (void*)this, AVARDAMAGE_ENTIRE);
|
||||
m_fActiveInactiveAlpha.create(AVARTYPE_FLOAT, &g_pConfigManager->getConfigValuePtr("animations:fadein_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:fadein")->intValue, &g_pConfigManager->getConfigValuePtr("animations:fadein_curve")->strValue, (void*)this, AVARDAMAGE_ENTIRE);
|
||||
m_cRealShadowColor.create(AVARTYPE_COLOR, &g_pConfigManager->getConfigValuePtr("animations:borders_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:borders")->intValue, &g_pConfigManager->getConfigValuePtr("animations:borders_curve")->strValue, (void*)this, AVARDAMAGE_SHADOW);
|
||||
m_vRealPosition.create(AVARTYPE_VECTOR, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), (void*) this, AVARDAMAGE_ENTIRE);
|
||||
m_vRealSize.create(AVARTYPE_VECTOR, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), (void*)this, AVARDAMAGE_ENTIRE);
|
||||
m_cRealBorderColor.create(AVARTYPE_COLOR, g_pConfigManager->getAnimationPropertyConfig("border"), (void*)this, AVARDAMAGE_BORDER);
|
||||
m_fAlpha.create(AVARTYPE_FLOAT, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), (void*)this, AVARDAMAGE_ENTIRE);
|
||||
m_fActiveInactiveAlpha.create(AVARTYPE_FLOAT, g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"), (void*)this, AVARDAMAGE_ENTIRE);
|
||||
m_cRealShadowColor.create(AVARTYPE_COLOR, g_pConfigManager->getAnimationPropertyConfig("fadeShadow"), (void*)this, AVARDAMAGE_SHADOW);
|
||||
|
||||
m_dWindowDecorations.emplace_back(std::make_unique<CHyprDropShadowDecoration>(this)); // put the shadow so it's the first deco (has to be rendered first)
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
CConfigManager::CConfigManager() {
|
||||
setDefaultVars();
|
||||
setDefaultAnimationVars();
|
||||
|
||||
std::string CONFIGPATH;
|
||||
if (g_pCompositor->explicitConfigPath == "") {
|
||||
|
@ -161,6 +162,56 @@ void CConfigManager::setDeviceDefaultVars(const std::string& dev) {
|
|||
cfgValues["drag_lock"].intValue = 0;
|
||||
}
|
||||
|
||||
void CConfigManager::setDefaultAnimationVars() {
|
||||
if (isFirstLaunch) {
|
||||
INITANIMCFG("global");
|
||||
INITANIMCFG("windows");
|
||||
INITANIMCFG("fade");
|
||||
INITANIMCFG("border");
|
||||
INITANIMCFG("workspaces");
|
||||
|
||||
// windows
|
||||
INITANIMCFG("windowsIn");
|
||||
INITANIMCFG("windowsOut");
|
||||
INITANIMCFG("windowsMove");
|
||||
|
||||
// fade
|
||||
INITANIMCFG("fadeIn");
|
||||
INITANIMCFG("fadeOut");
|
||||
INITANIMCFG("fadeSwitch");
|
||||
INITANIMCFG("fadeShadow");
|
||||
|
||||
// border
|
||||
|
||||
// workspaces
|
||||
}
|
||||
|
||||
// init the values
|
||||
animationConfig["global"] = {
|
||||
false,
|
||||
"default",
|
||||
"",
|
||||
8.f,
|
||||
1,
|
||||
&animationConfig["general"],
|
||||
nullptr
|
||||
};
|
||||
|
||||
CREATEANIMCFG("windows", "global");
|
||||
CREATEANIMCFG("fade", "global");
|
||||
CREATEANIMCFG("border", "global");
|
||||
CREATEANIMCFG("workspaces", "global");
|
||||
|
||||
CREATEANIMCFG("windowsIn", "windows");
|
||||
CREATEANIMCFG("windowsOut", "windows");
|
||||
CREATEANIMCFG("windowsMove", "windows");
|
||||
|
||||
CREATEANIMCFG("fadeIn", "fade");
|
||||
CREATEANIMCFG("fadeOut", "fade");
|
||||
CREATEANIMCFG("fadeSwitch", "fade");
|
||||
CREATEANIMCFG("fadeShadow", "fade");
|
||||
}
|
||||
|
||||
void CConfigManager::init() {
|
||||
|
||||
loadConfigLoadVars();
|
||||
|
@ -457,6 +508,17 @@ void CConfigManager::handleBezier(const std::string& command, const std::string&
|
|||
g_pAnimationManager->addBezierWithName(bezierName, Vector2D(p1x, p1y), Vector2D(p2x, p2y));
|
||||
}
|
||||
|
||||
void CConfigManager::setAnimForChildren(SAnimationPropertyConfig *const ANIM) {
|
||||
for (auto& [name, anim] : animationConfig) {
|
||||
if (anim.pParentAnimation == ANIM && !anim.overriden) {
|
||||
// if a child isnt overriden, set the values of the parent
|
||||
anim.pValues = ANIM->pValues;
|
||||
|
||||
setAnimForChildren(&anim);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void CConfigManager::handleAnimation(const std::string& command, const std::string& args) {
|
||||
std::string curitem = "";
|
||||
|
||||
|
@ -480,33 +542,44 @@ void CConfigManager::handleAnimation(const std::string& command, const std::stri
|
|||
|
||||
// anim name
|
||||
const auto ANIMNAME = curitem;
|
||||
const auto ANIMMASTERSETTING = configValues.find("animations:" + ANIMNAME);
|
||||
|
||||
if (ANIMMASTERSETTING == configValues.end()) {
|
||||
Debug::log(ERR, "Anim %s doesnt exist", ANIMNAME.c_str());
|
||||
parseError = "Animation " + ANIMNAME + " does not exist";
|
||||
const auto PANIM = animationConfig.find(ANIMNAME);
|
||||
|
||||
if (PANIM == animationConfig.end()) {
|
||||
parseError = "no such animation";
|
||||
return;
|
||||
}
|
||||
|
||||
PANIM->second.overriden = true;
|
||||
PANIM->second.pValues = &PANIM->second;
|
||||
|
||||
nextItem();
|
||||
|
||||
// on/off
|
||||
configSetValueSafe("animations:" + ANIMNAME, curitem);
|
||||
PANIM->second.internalEnabled = curitem == "1";
|
||||
|
||||
nextItem();
|
||||
|
||||
// Speed
|
||||
configSetValueSafe("animations:" + ANIMNAME + "_speed", curitem);
|
||||
// speed
|
||||
if (isNumber(curitem, true)) {
|
||||
PANIM->second.internalSpeed = std::stof(curitem);
|
||||
} else {
|
||||
PANIM->second.internalSpeed = 10.f;
|
||||
parseError = "Invalid speed";
|
||||
}
|
||||
|
||||
nextItem();
|
||||
|
||||
// curve
|
||||
configSetValueSafe("animations:" + ANIMNAME + "_curve", curitem);
|
||||
PANIM->second.internalBezier = curitem;
|
||||
|
||||
nextItem();
|
||||
|
||||
// style
|
||||
configSetValueSafe("animations:" + ANIMNAME + "_style", curitem);
|
||||
PANIM->second.internalStyle = curitem;
|
||||
|
||||
// now, check for children, recursively
|
||||
setAnimForChildren(&PANIM->second);
|
||||
}
|
||||
|
||||
void CConfigManager::handleBind(const std::string& command, const std::string& value) {
|
||||
|
@ -849,6 +922,7 @@ void CConfigManager::loadConfigLoadVars() {
|
|||
configDynamicVars.clear();
|
||||
deviceConfigs.clear();
|
||||
m_dBlurLSNamespaces.clear();
|
||||
setDefaultAnimationVars(); // reset anims
|
||||
|
||||
// paths
|
||||
configPaths.clear();
|
||||
|
@ -1226,3 +1300,7 @@ void CConfigManager::ensureDPMS() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
SAnimationPropertyConfig* CConfigManager::getAnimationPropertyConfig(const std::string& name) {
|
||||
return &animationConfig[name];
|
||||
}
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
|
||||
#define STRVAL_EMPTY "[[EMPTY]]"
|
||||
|
||||
#define INITANIMCFG(name) animationConfig[name] = {}
|
||||
#define CREATEANIMCFG(name, parent) animationConfig[name] = {true, "", "", 0.f, -1, &animationConfig["global"], &animationConfig[parent]}
|
||||
|
||||
struct SConfigValue {
|
||||
int64_t intValue = -1;
|
||||
float floatValue = -1;
|
||||
|
@ -47,6 +50,18 @@ struct SWindowRule {
|
|||
std::string szValue;
|
||||
};
|
||||
|
||||
struct SAnimationPropertyConfig {
|
||||
bool overriden = true;
|
||||
|
||||
std::string internalBezier = "";
|
||||
std::string internalStyle = "";
|
||||
float internalSpeed = 0.f;
|
||||
int internalEnabled = -1;
|
||||
|
||||
SAnimationPropertyConfig* pValues = nullptr;
|
||||
SAnimationPropertyConfig* pParentAnimation = nullptr;
|
||||
};
|
||||
|
||||
class CConfigManager {
|
||||
public:
|
||||
CConfigManager();
|
||||
|
@ -84,6 +99,8 @@ public:
|
|||
|
||||
std::string parseKeyword(const std::string&, const std::string&, bool dynamic = false);
|
||||
|
||||
SAnimationPropertyConfig* getAnimationPropertyConfig(const std::string&);
|
||||
|
||||
private:
|
||||
std::deque<std::string> configPaths; // stores all the config paths
|
||||
std::unordered_map<std::string, time_t> configModifyTimes; // stores modify times
|
||||
|
@ -91,6 +108,8 @@ private:
|
|||
std::unordered_map<std::string, SConfigValue> configValues;
|
||||
std::unordered_map<std::string, std::unordered_map<std::string, SConfigValue>> deviceConfigs; // stores device configs
|
||||
|
||||
std::unordered_map<std::string, SAnimationPropertyConfig> animationConfig; // stores all the animations with their set values
|
||||
|
||||
std::string configCurrentPath;
|
||||
|
||||
std::string currentCategory = ""; // For storing the category of the current item
|
||||
|
@ -110,9 +129,12 @@ private:
|
|||
|
||||
// internal methods
|
||||
void setDefaultVars();
|
||||
void setDefaultAnimationVars();
|
||||
void setDeviceDefaultVars(const std::string&);
|
||||
void ensureDPMS();
|
||||
|
||||
void setAnimForChildren(SAnimationPropertyConfig *const);
|
||||
|
||||
void applyUserDefinedVars(std::string&, const size_t);
|
||||
void loadConfigLoadVars();
|
||||
SConfigValue getConfigValueSafe(const std::string&);
|
||||
|
|
|
@ -108,6 +108,9 @@ void Events::listener_mapLayerSurface(void* owner, void* data) {
|
|||
layersurface->layerSurface->mapped = true;
|
||||
layersurface->mapped = true;
|
||||
|
||||
// anim
|
||||
layersurface->alpha.setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeIn"));
|
||||
|
||||
// fix if it changed its mon
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(layersurface->layerSurface->output);
|
||||
|
||||
|
@ -168,6 +171,9 @@ void Events::listener_unmapLayerSurface(void* owner, void* data) {
|
|||
return;
|
||||
}
|
||||
|
||||
// anim
|
||||
layersurface->alpha.setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeOut"));
|
||||
|
||||
// make a snapshot and start fade
|
||||
g_pHyprOpenGL->makeLayerSnapshot(layersurface);
|
||||
layersurface->alpha = 0.f;
|
||||
|
|
|
@ -29,6 +29,20 @@ void addViewCoords(void* pWindow, int* x, int* y) {
|
|||
}
|
||||
}
|
||||
|
||||
int setAnimToMove(void* data) {
|
||||
const auto PWINDOW = (CWindow*)data;
|
||||
|
||||
auto *const PANIMCFG = g_pConfigManager->getAnimationPropertyConfig("windowsMove");
|
||||
|
||||
if (!g_pCompositor->windowValidMapped(PWINDOW))
|
||||
return 0;
|
||||
|
||||
PWINDOW->m_vRealPosition.setConfig(PANIMCFG);
|
||||
PWINDOW->m_vRealSize.setConfig(PANIMCFG);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Events::listener_mapWindow(void* owner, void* data) {
|
||||
CWindow* PWINDOW = (CWindow*)owner;
|
||||
|
||||
|
@ -44,7 +58,6 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
PWINDOW->m_bReadyToDelete = false;
|
||||
PWINDOW->m_bFadingOut = false;
|
||||
PWINDOW->m_szTitle = g_pXWaylandManager->getTitle(PWINDOW);
|
||||
PWINDOW->m_fAlpha = 255.f;
|
||||
|
||||
if (PWINDOW->m_iX11Type == 2)
|
||||
g_pCompositor->moveUnmanagedX11ToWindows(PWINDOW);
|
||||
|
@ -271,6 +284,11 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
|
||||
// do the animation thing
|
||||
g_pAnimationManager->onWindowPostCreateClose(PWINDOW, false);
|
||||
PWINDOW->m_fAlpha.setValueAndWarp(0.f);
|
||||
PWINDOW->m_fAlpha = 255.f;
|
||||
|
||||
const auto TIMER = wl_event_loop_add_timer(g_pCompositor->m_sWLEventLoop, setAnimToMove, PWINDOW);
|
||||
wl_event_source_timer_update(TIMER, PWINDOW->m_vRealPosition.getDurationLeftMs() + 5);
|
||||
|
||||
if (workspaceSilent) {
|
||||
// move the window
|
||||
|
@ -343,8 +361,6 @@ void Events::listener_unmapWindow(void* owner, void* data) {
|
|||
g_pCompositor->m_pLastFocus = nullptr;
|
||||
}
|
||||
|
||||
PWINDOW->m_fAlpha = 0.f;
|
||||
|
||||
PWINDOW->m_bMappedX11 = false;
|
||||
|
||||
// remove the fullscreen window status from workspace if we closed it
|
||||
|
@ -380,7 +396,10 @@ void Events::listener_unmapWindow(void* owner, void* data) {
|
|||
|
||||
if (!PWINDOW->m_bX11DoesntWantBorders) // don't animate out if they weren't animated in.
|
||||
PWINDOW->m_vRealPosition = PWINDOW->m_vRealPosition.vec() + Vector2D(0.01f, 0.01f); // it has to be animated, otherwise onWindowPostCreateClose will ignore it
|
||||
|
||||
// anims
|
||||
g_pAnimationManager->onWindowPostCreateClose(PWINDOW, true);
|
||||
PWINDOW->m_fAlpha = 0.f;
|
||||
|
||||
// Destroy Foreign Toplevel
|
||||
wlr_foreign_toplevel_handle_v1_destroy(PWINDOW->m_phForeignToplevel);
|
||||
|
|
|
@ -1,25 +1,24 @@
|
|||
#include "AnimatedVariable.hpp"
|
||||
#include "../managers/AnimationManager.hpp"
|
||||
#include "../config/ConfigManager.hpp"
|
||||
|
||||
CAnimatedVariable::CAnimatedVariable() {
|
||||
; // dummy var
|
||||
}
|
||||
|
||||
void CAnimatedVariable::create(ANIMATEDVARTYPE type, float* speed, int64_t* enabled, std::string* pBezier, void* pWindow, AVARDAMAGEPOLICY policy) {
|
||||
void CAnimatedVariable::create(ANIMATEDVARTYPE type, SAnimationPropertyConfig* pAnimConfig, void* pWindow, AVARDAMAGEPOLICY policy) {
|
||||
m_eVarType = type;
|
||||
m_eDamagePolicy = policy;
|
||||
m_pSpeed = speed;
|
||||
m_pEnabled = enabled;
|
||||
m_pConfig = pAnimConfig;
|
||||
m_pWindow = pWindow;
|
||||
m_pBezier = pBezier;
|
||||
|
||||
g_pAnimationManager->m_lAnimatedVariables.push_back(this);
|
||||
|
||||
m_bDummy = false;
|
||||
}
|
||||
|
||||
void CAnimatedVariable::create(ANIMATEDVARTYPE type, std::any val, float* speed, int64_t* enabled, std::string* pBezier, void* pWindow, AVARDAMAGEPOLICY policy) {
|
||||
create(type, speed, enabled, pBezier, pWindow, policy);
|
||||
void CAnimatedVariable::create(ANIMATEDVARTYPE type, std::any val, SAnimationPropertyConfig* pAnimConfig, void* pWindow, AVARDAMAGEPOLICY policy) {
|
||||
create(type, pAnimConfig, pWindow, policy);
|
||||
|
||||
try {
|
||||
switch (type) {
|
||||
|
@ -58,3 +57,7 @@ CAnimatedVariable::~CAnimatedVariable() {
|
|||
void CAnimatedVariable::unregister() {
|
||||
g_pAnimationManager->m_lAnimatedVariables.remove(this);
|
||||
}
|
||||
|
||||
int CAnimatedVariable::getDurationLeftMs() {
|
||||
return std::clamp((int)(m_pConfig->pValues->internalSpeed * 100) - (int)std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - animationBegin).count(), 0, INT_MAX);
|
||||
}
|
||||
|
|
|
@ -20,13 +20,14 @@ enum AVARDAMAGEPOLICY {
|
|||
class CAnimationManager;
|
||||
class CWorkspace;
|
||||
struct SLayerSurface;
|
||||
struct SAnimationPropertyConfig;
|
||||
|
||||
class CAnimatedVariable {
|
||||
public:
|
||||
CAnimatedVariable(); // dummy var
|
||||
|
||||
void create(ANIMATEDVARTYPE, float* speed, int64_t* enabled, std::string* pBezier, void* pWindow, AVARDAMAGEPOLICY);
|
||||
void create(ANIMATEDVARTYPE, std::any val, float* speed, int64_t* enabled, std::string* pBezier, void* pWindow, AVARDAMAGEPOLICY);
|
||||
void create(ANIMATEDVARTYPE, SAnimationPropertyConfig*, void* pWindow, AVARDAMAGEPOLICY);
|
||||
void create(ANIMATEDVARTYPE, std::any val, SAnimationPropertyConfig*, void* pWindow, AVARDAMAGEPOLICY);
|
||||
|
||||
~CAnimatedVariable();
|
||||
|
||||
|
@ -156,6 +157,16 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void setConfig(SAnimationPropertyConfig* pConfig) {
|
||||
m_pConfig = pConfig;
|
||||
}
|
||||
|
||||
SAnimationPropertyConfig* getConfig() {
|
||||
return m_pConfig;
|
||||
}
|
||||
|
||||
int getDurationLeftMs();
|
||||
|
||||
private:
|
||||
|
||||
Vector2D m_vValue = Vector2D(0,0);
|
||||
|
@ -170,15 +181,12 @@ private:
|
|||
float m_fBegun = 0;
|
||||
CColor m_cBegun;
|
||||
|
||||
float* m_pSpeed = nullptr;
|
||||
int64_t* m_pEnabled = nullptr;
|
||||
|
||||
// owners
|
||||
void* m_pWindow = nullptr;
|
||||
void* m_pWorkspace = nullptr;
|
||||
void* m_pLayer = nullptr;
|
||||
|
||||
std::string* m_pBezier = nullptr;
|
||||
SAnimationPropertyConfig* m_pConfig = nullptr;
|
||||
|
||||
bool m_bDummy = true;
|
||||
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
#include "../config/ConfigManager.hpp"
|
||||
|
||||
SLayerSurface::SLayerSurface() {
|
||||
alpha.create(AVARTYPE_FLOAT, &g_pConfigManager->getConfigValuePtr("animations:fadein_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:fadein")->intValue, &g_pConfigManager->getConfigValuePtr("animations:fadein_curve")->strValue, nullptr, AVARDAMAGE_ENTIRE);
|
||||
alpha.create(AVARTYPE_FLOAT, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), nullptr, AVARDAMAGE_ENTIRE);
|
||||
alpha.m_pLayer = this;
|
||||
}
|
|
@ -26,9 +26,9 @@ CWorkspace::CWorkspace(int monitorID, std::string name, bool special) {
|
|||
}
|
||||
|
||||
m_vRenderOffset.m_pWorkspace = this;
|
||||
m_vRenderOffset.create(AVARTYPE_VECTOR, &g_pConfigManager->getConfigValuePtr("animations:workspaces_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces")->intValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces_curve")->strValue, nullptr, AVARDAMAGE_ENTIRE);
|
||||
m_vRenderOffset.create(AVARTYPE_VECTOR, g_pConfigManager->getAnimationPropertyConfig("workspaces"), nullptr, AVARDAMAGE_ENTIRE);
|
||||
m_fAlpha.m_pWorkspace = this;
|
||||
m_fAlpha.create(AVARTYPE_FLOAT, &g_pConfigManager->getConfigValuePtr("animations:workspaces_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces")->intValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces_curve")->strValue, nullptr, AVARDAMAGE_ENTIRE);
|
||||
m_fAlpha.create(AVARTYPE_FLOAT, g_pConfigManager->getAnimationPropertyConfig("workspaces"), nullptr, AVARDAMAGE_ENTIRE);
|
||||
m_fAlpha.setValueAndWarp(255.f);
|
||||
|
||||
g_pEventManager->postEvent({"createworkspace", m_szName}, true);
|
||||
|
@ -49,7 +49,7 @@ CWorkspace::~CWorkspace() {
|
|||
}
|
||||
|
||||
void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
||||
const auto ANIMSTYLE = g_pConfigManager->getString("animations:workspaces_style");
|
||||
const auto ANIMSTYLE = m_fAlpha.m_pConfig->pValues->internalStyle;
|
||||
|
||||
if (ANIMSTYLE == "fade") {
|
||||
m_vRenderOffset.setValueAndWarp(Vector2D(0, 0)); // fix a bug, if switching from slide -> fade.
|
||||
|
|
|
@ -101,6 +101,9 @@ void IHyprLayout::onBeginDragWindow() {
|
|||
return;
|
||||
}
|
||||
|
||||
DRAGGINGWINDOW->m_vRealPosition.setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsMove"));
|
||||
DRAGGINGWINDOW->m_vRealSize.setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsMove"));
|
||||
|
||||
DRAGGINGWINDOW->m_bDraggingTiled = false;
|
||||
|
||||
if (!DRAGGINGWINDOW->m_bIsFloating) {
|
||||
|
|
|
@ -28,14 +28,10 @@ void CAnimationManager::tick() {
|
|||
if (!*PANIMENABLED)
|
||||
animationsDisabled = true;
|
||||
|
||||
static auto *const PANIMSPEED = &g_pConfigManager->getConfigValuePtr("animations:speed")->floatValue;
|
||||
static auto *const PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue;
|
||||
static auto *const BEZIERSTR = &g_pConfigManager->getConfigValuePtr("animations:curve")->strValue;
|
||||
static auto *const PSHADOWSENABLED = &g_pConfigManager->getConfigValuePtr("decoration:drop_shadow")->intValue;
|
||||
|
||||
auto DEFAULTBEZIER = m_mBezierCurves.find(*BEZIERSTR);
|
||||
if (DEFAULTBEZIER == m_mBezierCurves.end())
|
||||
DEFAULTBEZIER = m_mBezierCurves.find("default");
|
||||
const auto DEFAULTBEZIER = m_mBezierCurves.find("default");
|
||||
|
||||
for (auto& av : m_lAnimatedVariables) {
|
||||
|
||||
|
@ -49,7 +45,7 @@ void CAnimationManager::tick() {
|
|||
}
|
||||
|
||||
// get speed
|
||||
const auto SPEED = *av->m_pSpeed == 0 ? *PANIMSPEED : *av->m_pSpeed;
|
||||
const auto SPEED = av->m_pConfig->pValues->internalSpeed;
|
||||
|
||||
// get the spent % (0 - 1)
|
||||
const auto DURATIONPASSED = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - av->animationBegin).count();
|
||||
|
@ -79,7 +75,7 @@ void CAnimationManager::tick() {
|
|||
switch (av->m_eVarType) {
|
||||
case AVARTYPE_FLOAT: {
|
||||
// for disabled anims just warp
|
||||
if (*av->m_pEnabled == 0 || animationsDisabled) {
|
||||
if (av->m_pConfig->pValues->internalEnabled == 0 || animationsDisabled) {
|
||||
av->warp();
|
||||
break;
|
||||
}
|
||||
|
@ -90,7 +86,7 @@ void CAnimationManager::tick() {
|
|||
}
|
||||
|
||||
const auto DELTA = av->m_fGoal - av->m_fBegun;
|
||||
const auto BEZIER = m_mBezierCurves.find(*av->m_pBezier);
|
||||
const auto BEZIER = m_mBezierCurves.find(av->m_pConfig->pValues->internalBezier);
|
||||
|
||||
if (BEZIER != m_mBezierCurves.end())
|
||||
av->m_fValue = av->m_fBegun + BEZIER->second.getYForPoint(SPENT) * DELTA;
|
||||
|
@ -100,7 +96,7 @@ void CAnimationManager::tick() {
|
|||
}
|
||||
case AVARTYPE_VECTOR: {
|
||||
// for disabled anims just warp
|
||||
if (*av->m_pEnabled == 0 || animationsDisabled) {
|
||||
if (av->m_pConfig->pValues->internalEnabled == 0 || animationsDisabled) {
|
||||
av->warp();
|
||||
break;
|
||||
}
|
||||
|
@ -111,7 +107,7 @@ void CAnimationManager::tick() {
|
|||
}
|
||||
|
||||
const auto DELTA = av->m_vGoal - av->m_vBegun;
|
||||
const auto BEZIER = m_mBezierCurves.find(*av->m_pBezier);
|
||||
const auto BEZIER = m_mBezierCurves.find(av->m_pConfig->pValues->internalBezier);
|
||||
|
||||
if (BEZIER != m_mBezierCurves.end())
|
||||
av->m_vValue = av->m_vBegun + DELTA * BEZIER->second.getYForPoint(SPENT);
|
||||
|
@ -121,7 +117,7 @@ void CAnimationManager::tick() {
|
|||
}
|
||||
case AVARTYPE_COLOR: {
|
||||
// for disabled anims just warp
|
||||
if (*av->m_pEnabled == 0 || animationsDisabled) {
|
||||
if (av->m_pConfig->pValues->internalEnabled == 0 || animationsDisabled) {
|
||||
av->warp();
|
||||
break;
|
||||
}
|
||||
|
@ -132,7 +128,7 @@ void CAnimationManager::tick() {
|
|||
}
|
||||
|
||||
const auto DELTA = av->m_cGoal - av->m_cBegun;
|
||||
const auto BEZIER = m_mBezierCurves.find(*av->m_pBezier);
|
||||
const auto BEZIER = m_mBezierCurves.find(av->m_pConfig->pValues->internalBezier);
|
||||
|
||||
if (BEZIER != m_mBezierCurves.end())
|
||||
av->m_cValue = av->m_cBegun + DELTA * BEZIER->second.getYForPoint(SPENT);
|
||||
|
@ -334,7 +330,17 @@ void CAnimationManager::animationSlide(CWindow* pWindow, std::string force, bool
|
|||
}
|
||||
|
||||
void CAnimationManager::onWindowPostCreateClose(CWindow* pWindow, bool close) {
|
||||
auto ANIMSTYLE = g_pConfigManager->getString("animations:windows_style");
|
||||
if (!close) {
|
||||
pWindow->m_vRealPosition.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("windowsIn");
|
||||
pWindow->m_vRealSize.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("windowsIn");
|
||||
pWindow->m_fAlpha.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("fadeIn");
|
||||
} else {
|
||||
pWindow->m_vRealPosition.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("windowsOut");
|
||||
pWindow->m_vRealSize.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("windowsOut");
|
||||
pWindow->m_fAlpha.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("fadeOut");
|
||||
}
|
||||
|
||||
auto ANIMSTYLE = pWindow->m_vRealPosition.m_pConfig->pValues->internalStyle;
|
||||
transform(ANIMSTYLE.begin(), ANIMSTYLE.end(), ANIMSTYLE.begin(), ::tolower);
|
||||
|
||||
// if the window is not being animated, that means the layout set a fixed size for it, don't animate.
|
||||
|
|
Loading…
Reference in a new issue