From e4041a2f0fa8052028ac3bfa5b9b600a0f7fe7c4 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Sun, 13 Oct 2024 20:03:10 +0200 Subject: Jump to top and bottom in scroll page mode When scroll page mode is active, clicking on the up and down scrollbar buttons make the page jump to the top and bottom repectively. --- dw/fltkviewport.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'dw') diff --git a/dw/fltkviewport.cc b/dw/fltkviewport.cc index fc9a0bed..86071128 100644 --- a/dw/fltkviewport.cc +++ b/dw/fltkviewport.cc @@ -300,6 +300,21 @@ int FltkViewport::handle (int event) case FL_PUSH: if (vscrollbar->visible() && Fl::event_inside(vscrollbar)) { if (scrollbarPageMode ^ (bool) Fl::event_shift()) { + /* Check top and bottom actions first */ + int yclick = Fl::event_y(); + int ytop = y() + SCROLLBAR_THICKNESS; + int ybottom = y() + h() - SCROLLBAR_THICKNESS; + if (hscrollbar->visible()) + ybottom -= SCROLLBAR_THICKNESS; + + if (yclick <= ytop) { + scroll(core::TOP_CMD); + return 1; + } else if (yclick >= ybottom) { + scroll(core::BOTTOM_CMD); + return 1; + } + if (Fl::event_button() == FL_LEFT_MOUSE) pageScrolling = core::SCREEN_DOWN_CMD; else if (Fl::event_button() == FL_RIGHT_MOUSE) -- cgit v1.2.3