Fix clock on-scroll value not being used for calendar, which was broken by 86a3898
parent
cc084f5f86
commit
abd7ca2a1e
|
@ -41,6 +41,7 @@ class Clock final : public ALabel {
|
||||||
const int cldMonColLen_{20}; // calendar month column length
|
const int cldMonColLen_{20}; // calendar month column length
|
||||||
WS cldWPos_{WS::HIDDEN}; // calendar week side to print
|
WS cldWPos_{WS::HIDDEN}; // calendar week side to print
|
||||||
months cldCurrShift_{0}; // calendar months shift
|
months cldCurrShift_{0}; // calendar months shift
|
||||||
|
int cldShift_{1}; // calendar months shift factor
|
||||||
year_month_day cldYearShift_; // calendar Year mode. Cached ymd
|
year_month_day cldYearShift_; // calendar Year mode. Cached ymd
|
||||||
std::string cldYearCached_; // calendar Year mode. Cached calendar
|
std::string cldYearCached_; // calendar Year mode. Cached calendar
|
||||||
year_month cldMonShift_; // calendar Month mode. Cached ym
|
year_month cldMonShift_; // calendar Month mode. Cached ym
|
||||||
|
|
|
@ -115,6 +115,7 @@ waybar::modules::Clock::Clock(const std::string& id, const Json::Value& config)
|
||||||
} else
|
} else
|
||||||
cldMonCols_ = 1;
|
cldMonCols_ = 1;
|
||||||
if (config_[kCldPlaceholder]["on-scroll"].isInt()) {
|
if (config_[kCldPlaceholder]["on-scroll"].isInt()) {
|
||||||
|
cldShift_ = config_[kCldPlaceholder]["on-scroll"].asInt();
|
||||||
event_box_.add_events(Gdk::LEAVE_NOTIFY_MASK);
|
event_box_.add_events(Gdk::LEAVE_NOTIFY_MASK);
|
||||||
event_box_.signal_leave_notify_event().connect([this](GdkEventCrossing*) {
|
event_box_.signal_leave_notify_event().connect([this](GdkEventCrossing*) {
|
||||||
cldCurrShift_ = months{0};
|
cldCurrShift_ = months{0};
|
||||||
|
@ -405,10 +406,10 @@ void waybar::modules::Clock::cldModeSwitch() {
|
||||||
cldMode_ = (cldMode_ == CldMode::YEAR) ? CldMode::MONTH : CldMode::YEAR;
|
cldMode_ = (cldMode_ == CldMode::YEAR) ? CldMode::MONTH : CldMode::YEAR;
|
||||||
}
|
}
|
||||||
void waybar::modules::Clock::cldShift_up() {
|
void waybar::modules::Clock::cldShift_up() {
|
||||||
cldCurrShift_ += (months)((cldMode_ == CldMode::YEAR) ? 12 : 1);
|
cldCurrShift_ += (months)((cldMode_ == CldMode::YEAR) ? 12 : 1) * cldShift_;
|
||||||
}
|
}
|
||||||
void waybar::modules::Clock::cldShift_down() {
|
void waybar::modules::Clock::cldShift_down() {
|
||||||
cldCurrShift_ -= (months)((cldMode_ == CldMode::YEAR) ? 12 : 1);
|
cldCurrShift_ -= (months)((cldMode_ == CldMode::YEAR) ? 12 : 1) * cldShift_;
|
||||||
}
|
}
|
||||||
void waybar::modules::Clock::tz_up() {
|
void waybar::modules::Clock::tz_up() {
|
||||||
const auto tzSize{tzList_.size()};
|
const auto tzSize{tzList_.size()};
|
||||||
|
|
Loading…
Reference in New Issue