From 633da750d19c3ca726c912aa5e45fd6b01327bd3 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 8 Apr 2024 21:15:43 +0200 Subject: Control the direction of tab scrolling Adds the scroll_switches_tabs_reverse option in dillorc to allows reversing the direction of tab switching based on the movement of the mouse wheel. See: https://lists.mailman3.com/hyperkitty/list/dillo-dev@mailman3.com/thread/F2EF4NHF3CBMJ3XZII2TFIE6MSXEE5AD/ Fixes: https://github.com/dillo-browser/dillo/issues/122 Reviewed-by: Rodrigo Arias Mallo --- dillorc | 3 +++ src/prefs.c | 1 + src/prefs.h | 1 + src/prefsparser.cc | 1 + src/uicmd.cc | 3 +++ 5 files changed, 9 insertions(+) diff --git a/dillorc b/dillorc index 60fe2f4b..8295e05b 100644 --- a/dillorc +++ b/dillorc @@ -384,6 +384,9 @@ ui_tab_bg_color=#b7beb7 # If set to NO, the page will be scrolled instead. #scroll_switches_tabs=YES +# Reverse the direction of tab scrolling with mouse wheel. +#scroll_switches_tabs_reverse=NO + # Mouse middle click by default drives drag-scrolling. # To paste an URL into the window instead of scrolling, set it to NO. # Note: You could always paste the URL onto the URL box clear button. diff --git a/src/prefs.c b/src/prefs.c index 26c86a4d..8cac23a9 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -79,6 +79,7 @@ void a_Prefs_init(void) prefs.middle_click_opens_new_tab = TRUE; prefs.right_click_closes_tab = TRUE; prefs.scroll_switches_tabs = TRUE; + prefs.scroll_switches_tabs_reverse = FALSE; prefs.no_proxy = dStrdup(PREFS_NO_PROXY); prefs.panel_size = P_medium; prefs.parse_embedded_css=TRUE; diff --git a/src/prefs.h b/src/prefs.h index 4eddeb5f..0073d52a 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -107,6 +107,7 @@ typedef struct { bool_t middle_click_opens_new_tab; bool_t right_click_closes_tab; bool_t scroll_switches_tabs; + bool_t scroll_switches_tabs_reverse; bool_t search_url_idx; Dlist *search_urls; char *save_dir; diff --git a/src/prefsparser.cc b/src/prefsparser.cc index 83131d58..dbb82cb8 100644 --- a/src/prefsparser.cc +++ b/src/prefsparser.cc @@ -192,6 +192,7 @@ void PrefsParser::parse(FILE *fp) PREFS_BOOL, 0 }, { "right_click_closes_tab", &prefs.right_click_closes_tab, PREFS_BOOL, 0 }, { "scroll_switches_tabs", &prefs.scroll_switches_tabs, PREFS_BOOL, 0 }, + { "scroll_switches_tabs_reverse", &prefs.scroll_switches_tabs_reverse, PREFS_BOOL, 0 }, { "no_proxy", &prefs.no_proxy, PREFS_STRING, 0 }, { "panel_size", &prefs.panel_size, PREFS_PANEL_SIZE, 0 }, { "parse_embedded_css", &prefs.parse_embedded_css, PREFS_BOOL, 0 }, diff --git a/src/uicmd.cc b/src/uicmd.cc index 02d2a141..88bc9b7d 100644 --- a/src/uicmd.cc +++ b/src/uicmd.cc @@ -254,6 +254,9 @@ int CustTabs::handle(int e) int dy = Fl::event_dy(); int dir = dy ? dy : dx; + if (prefs.scroll_switches_tabs_reverse) + dir = -dir; + if (dir > 0) next_tab(); else if (dir < 0) -- cgit v1.2.3