mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
AModule::getScrollDir: convert if-else chain into switch statement
This commit is contained in:
parent
7c85aec8e0
commit
86d6668ed4
@ -53,15 +53,12 @@ bool AModule::handleToggle(GdkEventButton* const& e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AModule::SCROLL_DIR AModule::getScrollDir(GdkEventScroll* e) {
|
AModule::SCROLL_DIR AModule::getScrollDir(GdkEventScroll* e) {
|
||||||
if (e->direction == GDK_SCROLL_UP) {
|
switch (e -> direction) {
|
||||||
return SCROLL_DIR::UP;
|
case GDK_SCROLL_UP: return SCROLL_DIR::UP;
|
||||||
} else if (e->direction == GDK_SCROLL_DOWN) {
|
case GDK_SCROLL_DOWN: return SCROLL_DIR::DOWN;
|
||||||
return SCROLL_DIR::DOWN;
|
case GDK_SCROLL_LEFT: return SCROLL_DIR::LEFT;
|
||||||
} else if (e->direction == GDK_SCROLL_LEFT) {
|
case GDK_SCROLL_RIGHT: return SCROLL_DIR::RIGHT;
|
||||||
return SCROLL_DIR::LEFT;
|
case GDK_SCROLL_SMOOTH: {
|
||||||
} else if (e->direction == GDK_SCROLL_RIGHT) {
|
|
||||||
return SCROLL_DIR::RIGHT;
|
|
||||||
} else if (e->direction == GDK_SCROLL_SMOOTH) {
|
|
||||||
SCROLL_DIR dir{SCROLL_DIR::NONE};
|
SCROLL_DIR dir{SCROLL_DIR::NONE};
|
||||||
|
|
||||||
distance_scrolled_y_ += e->delta_y;
|
distance_scrolled_y_ += e->delta_y;
|
||||||
@ -89,6 +86,9 @@ AModule::SCROLL_DIR AModule::getScrollDir(GdkEventScroll* e) {
|
|||||||
}
|
}
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
// Silence -Wreturn-type:
|
||||||
|
default: return SCROLL_DIR::NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AModule::handleScroll(GdkEventScroll* e) {
|
bool AModule::handleScroll(GdkEventScroll* e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user