Merge pull request #2232 from robertgzr/reverse-scroll
Lift reverse-scrolling option into AModulepull/2234/head
commit
dff0583c12
|
@ -91,6 +91,10 @@ Additionally you can control the volume by scrolling *up* or *down* while the cu
|
||||||
typeof: double ++
|
typeof: double ++
|
||||||
Threshold to be used when scrolling.
|
Threshold to be used when scrolling.
|
||||||
|
|
||||||
|
*reverse-scrolling*: ++
|
||||||
|
typeof: bool ++
|
||||||
|
Option to reverse the scroll direction.
|
||||||
|
|
||||||
*tooltip*: ++
|
*tooltip*: ++
|
||||||
typeof: bool ++
|
typeof: bool ++
|
||||||
default: true ++
|
default: true ++
|
||||||
|
|
|
@ -97,11 +97,14 @@ bool AModule::handleToggle(GdkEventButton* const& e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
AModule::SCROLL_DIR AModule::getScrollDir(GdkEventScroll* e) {
|
AModule::SCROLL_DIR AModule::getScrollDir(GdkEventScroll* e) {
|
||||||
|
// only affects up/down
|
||||||
|
bool reverse = config_["reverse-scrolling"].asBool();
|
||||||
|
|
||||||
switch (e->direction) {
|
switch (e->direction) {
|
||||||
case GDK_SCROLL_UP:
|
case GDK_SCROLL_UP:
|
||||||
return SCROLL_DIR::UP;
|
return reverse ? SCROLL_DIR::DOWN : SCROLL_DIR::UP;
|
||||||
case GDK_SCROLL_DOWN:
|
case GDK_SCROLL_DOWN:
|
||||||
return SCROLL_DIR::DOWN;
|
return reverse ? SCROLL_DIR::UP : SCROLL_DIR::DOWN;
|
||||||
case GDK_SCROLL_LEFT:
|
case GDK_SCROLL_LEFT:
|
||||||
return SCROLL_DIR::LEFT;
|
return SCROLL_DIR::LEFT;
|
||||||
case GDK_SCROLL_RIGHT:
|
case GDK_SCROLL_RIGHT:
|
||||||
|
|
|
@ -305,14 +305,6 @@ bool waybar::modules::Backlight::handleScroll(GdkEventScroll *e) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config_["reverse-scrolling"].asBool()) {
|
|
||||||
if (dir == SCROLL_DIR::UP) {
|
|
||||||
dir = SCROLL_DIR::DOWN;
|
|
||||||
} else if (dir == SCROLL_DIR::DOWN) {
|
|
||||||
dir = SCROLL_DIR::UP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get scroll step
|
// Get scroll step
|
||||||
double step = 1;
|
double step = 1;
|
||||||
|
|
||||||
|
|
|
@ -81,13 +81,6 @@ bool waybar::modules::Pulseaudio::handleScroll(GdkEventScroll *e) {
|
||||||
if (dir == SCROLL_DIR::NONE) {
|
if (dir == SCROLL_DIR::NONE) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (config_["reverse-scrolling"].asInt() == 1) {
|
|
||||||
if (dir == SCROLL_DIR::UP) {
|
|
||||||
dir = SCROLL_DIR::DOWN;
|
|
||||||
} else if (dir == SCROLL_DIR::DOWN) {
|
|
||||||
dir = SCROLL_DIR::UP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
double volume_tick = static_cast<double>(PA_VOLUME_NORM) / 100;
|
double volume_tick = static_cast<double>(PA_VOLUME_NORM) / 100;
|
||||||
pa_volume_t change = volume_tick;
|
pa_volume_t change = volume_tick;
|
||||||
pa_cvolume pa_volume = pa_volume_;
|
pa_cvolume pa_volume = pa_volume_;
|
||||||
|
|
Loading…
Reference in New Issue