Properly initialize distance_scrolled members.

When they were uninitialized it caused getScrollDir() to incorrectly return SCROLL_DIR::NONE in some circumstances
This commit is contained in:
Evyatar Stalinsky 2022-02-01 22:42:03 +02:00
parent 96caa9f094
commit 895bc878f8

View File

@ -6,7 +6,9 @@ namespace waybar {
AModule::AModule(const Json::Value& config, const std::string& name, const std::string& id,
bool enable_click, bool enable_scroll)
: name_(std::move(name)), config_(std::move(config)) {
: name_(std::move(name)), config_(std::move(config))
, distance_scrolled_y_(0.0)
, distance_scrolled_x_(0.0) {
// configure events' user commands
if (config_["on-click"].isString() || config_["on-click-middle"].isString() ||
config_["on-click-backward"].isString() || config_["on-click-forward"].isString() ||