aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2024-10-13 20:03:10 +0200
committerRodrigo Arias Mallo <rodarima@gmail.com>2024-10-13 20:03:10 +0200
commite4041a2f0fa8052028ac3bfa5b9b600a0f7fe7c4 (patch)
treeadef4a615102a2a9ef48fd1f10ecee539fd6c90b
parent9315c26bb248157d0b37ef933e3d16779aed7dd9 (diff)
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.
-rw-r--r--dw/fltkviewport.cc15
1 files changed, 15 insertions, 0 deletions
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)