From 8db1996ccc29ea7fc89624fcbcfcae6ff8eeea12 Mon Sep 17 00:00:00 2001 From: encbar5 <8845322+encbar5@users.noreply.github.com> Date: Sun, 27 Nov 2022 21:24:56 -0600 Subject: [PATCH] Allow calendar_shift_init_ to be negative --- src/modules/clock.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/clock.cpp b/src/modules/clock.cpp index 71b24c19..e0d63e28 100644 --- a/src/modules/clock.cpp +++ b/src/modules/clock.cpp @@ -136,7 +136,7 @@ bool waybar::modules::Clock::handleScroll(GdkEventScroll* e) { auto dir = AModule::getScrollDir(e); // Shift calendar date - if (calendar_shift_init_.count() > 0) { + if (calendar_shift_init_.count() != 0) { if (dir == SCROLL_DIR::UP) calendar_shift_ += calendar_shift_init_; else @@ -170,7 +170,7 @@ auto waybar::modules::Clock::calendar_text(const waybar_time& wtime) -> std::str if (calendar_cached_ymd_ == ymd) return calendar_cached_text_; - const auto curr_day{(calendar_shift_init_.count() > 0 && calendar_shift_.count() != 0) + const auto curr_day{(calendar_shift_init_.count() != 0 && calendar_shift_.count() != 0) ? date::day{0} : ymd.day()}; const date::year_month ym{ymd.year(), ymd.month()};