mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-11-22 21:35:58 +01:00
border animation optimization
This commit is contained in:
parent
3216afbf12
commit
158260c0ec
3 changed files with 10 additions and 5 deletions
|
@ -50,6 +50,7 @@ Animations {
|
||||||
enabled=1
|
enabled=1
|
||||||
speed=5
|
speed=5
|
||||||
cheap=1 # highly recommended
|
cheap=1 # highly recommended
|
||||||
|
borders=0
|
||||||
}
|
}
|
||||||
|
|
||||||
# keybinds
|
# keybinds
|
||||||
|
|
|
@ -83,3 +83,5 @@
|
||||||
|
|
||||||
#define RETURNIFBAR if (g_pWindowManager->statusBar) return;
|
#define RETURNIFBAR if (g_pWindowManager->statusBar) return;
|
||||||
#define RETURNIFMAIN if (!g_pWindowManager->statusBar) return;
|
#define RETURNIFMAIN if (!g_pWindowManager->statusBar) return;
|
||||||
|
|
||||||
|
#define COLORDELTAOVERX(c, c1, d) (abs(RED(c) - RED(c1)) > d / 255.f || abs(GREEN(c) - GREEN(c1)) > d / 255.f || abs(BLUE(c) - BLUE(c1)) > d / 255.f || abs(ALPHA(c) - ALPHA(c1)) > d / 255.f)
|
|
@ -19,17 +19,19 @@ void AnimationUtil::move() {
|
||||||
// Border animations
|
// Border animations
|
||||||
if (window.getDrawable() > 0) {
|
if (window.getDrawable() > 0) {
|
||||||
if (window.getEffectiveBorderColor().getAsUint32() != window.getRealBorderColor().getAsUint32() /* As uint32 to round and not spam */) {
|
if (window.getEffectiveBorderColor().getAsUint32() != window.getRealBorderColor().getAsUint32() /* As uint32 to round and not spam */) {
|
||||||
|
|
||||||
// interp border color if enabled
|
// interp border color if enabled
|
||||||
|
const auto PREVCOLOR = window.getRealBorderColor().getAsUint32();
|
||||||
|
|
||||||
if (ConfigManager::getInt("anim:borders") == 1) {
|
if (ConfigManager::getInt("anim:borders") == 1) {
|
||||||
window.setRealBorderColor(parabolicColor(window.getRealBorderColor(), window.getEffectiveBorderColor(), ANIMATIONSPEED));
|
window.setRealBorderColor(parabolicColor(window.getRealBorderColor(), window.getEffectiveBorderColor(), ANIMATIONSPEED));
|
||||||
} else {
|
} else {
|
||||||
window.setRealBorderColor(window.getEffectiveBorderColor());
|
window.setRealBorderColor(window.getEffectiveBorderColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (COLORDELTAOVERX(PREVCOLOR, window.getRealBorderColor().getAsUint32(), 2)) {
|
||||||
updateRequired = true;
|
updateRequired = true;
|
||||||
window.setDirty(true);
|
window.setDirty(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue