From 93d64e5c85045ebbcd4efc34d13bfce0549eb26b Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Thu, 11 Jan 2024 22:41:27 +0100 Subject: Switch tabs using the mouse wheel Allows switching tabs using the mouse wheel, which is useful to quickly scan pages by looking at the page content instead of the tab title. --- src/uicmd.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/uicmd.cc b/src/uicmd.cc index 7f2226dd..b4835b8a 100644 --- a/src/uicmd.cc +++ b/src/uicmd.cc @@ -246,6 +246,18 @@ int CustTabs::handle(int e) a_Timeout_add(0.0, a_UIcmd_close_all_bw, NULL); ret = 1; } + } else if (e == FL_MOUSEWHEEL) { + /* Move to the next or previous tab using the mouse wheel */ + int dx = Fl::event_dx(); + int dy = Fl::event_dy(); + int dir = dy ? dy : dx; + + if (dir > 0) + next_tab(); + else if (dir < 0) + prev_tab(); + + ret = 1; } return (ret) ? ret : Fl_Group::handle(e); -- cgit v1.2.3