From 0138a072ca856060423dd2f789c47233de2fe5de Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Tue, 8 Mar 2022 15:42:36 +0100 Subject: [PATCH] fix one pixel being off and annoying me --- src/defines.hpp | 3 ++- src/utilities/AnimationUtil.cpp | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/defines.hpp b/src/defines.hpp index ab6a3f6..e3997ff 100644 --- a/src/defines.hpp +++ b/src/defines.hpp @@ -73,7 +73,8 @@ free(error##name); -#define VECTORDELTANONZERO(veca, vecb) ((int)abs(veca.x - vecb.x) > 0 || (int)abs(veca.y - vecb.y) > 0) +#define VECTORDELTANONZERO(veca, vecb) (abs(veca.x - vecb.x) > 0.4f || abs(veca.y - vecb.y) > 0.4f) +#define VECTORDELTAMORETHAN(veca, vecb, delta) (abs(veca.x - vecb.x) > (delta) || abs(veca.y - vecb.y) > (delta)) #define PROP(cookie, name, len) const auto cookie = xcb_get_property(DisplayConnection, false, window, name, XCB_GET_PROPERTY_TYPE_ANY, 0, len); \ const auto cookie##reply = xcb_get_property_reply(DisplayConnection, cookie, NULL) diff --git a/src/utilities/AnimationUtil.cpp b/src/utilities/AnimationUtil.cpp index 609cfd2..e3eb668 100644 --- a/src/utilities/AnimationUtil.cpp +++ b/src/utilities/AnimationUtil.cpp @@ -84,6 +84,9 @@ void AnimationUtil::move() { if (!VECTORDELTANONZERO(window.getRealPosition(), window.getEffectivePosition()) && !VECTORDELTANONZERO(window.getRealSize(), window.getEffectiveSize())) { window.setIsAnimated(false); + + window.setRealSize(window.getEffectiveSize()); + window.setRealPosition(window.getEffectivePosition()); } }