From 12b30ca25f8575abf7c3f67c84e6a56ef7330661 Mon Sep 17 00:00:00 2001 From: Patrick Hilhorst Date: Mon, 17 Jun 2019 20:41:18 +0200 Subject: [PATCH] AModule::getScrollDir: convert reset if-else into switch --- src/AModule.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/AModule.cpp b/src/AModule.cpp index 394f354..38e9785 100644 --- a/src/AModule.cpp +++ b/src/AModule.cpp @@ -79,11 +79,19 @@ AModule::SCROLL_DIR AModule::getScrollDir(GdkEventScroll* e) { dir = SCROLL_DIR::LEFT; } - if (dir == SCROLL_DIR::UP || dir == SCROLL_DIR::DOWN) { - distance_scrolled_y_ = 0; - } else if (dir == SCROLL_DIR::LEFT || dir == SCROLL_DIR::RIGHT) { - distance_scrolled_x_ = 0; + switch (dir) { + case SCROLL_DIR::UP: + case SCROLL_DIR::DOWN: + distance_scrolled_y_ = 0; + break; + case SCROLL_DIR::LEFT: + case SCROLL_DIR::RIGHT: + distance_scrolled_x_ = 0; + break; + case SCROLL_DIR::NONE: + break; } + return dir; } // Silence -Wreturn-type: