summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--dillorc6
-rw-r--r--doc/user_help.in.html9
-rw-r--r--dw/fltkviewport.cc19
-rw-r--r--dw/fltkviewport.hh22
-rw-r--r--src/prefs.c1
-rw-r--r--src/prefs.h1
-rw-r--r--src/prefsparser.cc1
-rw-r--r--src/uicmd.cc1
9 files changed, 60 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index b6f9be06..9af82cf8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,7 @@ dillo-3.2.0 [Not released yet]
- Perform an emergency stop of the layout engine loop after 1000 iterations to
prevent a hang.
- Fix use-after-free on errors in TLS connection.
+ - Add scrollbar_page_mode option to easily scroll full pages with the mouse.
Patches: Rodrigo Arias Mallo
+- Add primitive support for SVG using the nanosvg.h library.
- Add support for ch, rem, vw, vh, vmin and vmax CSS units.
diff --git a/dillorc b/dillorc
index 99aa1e65..bcd556d3 100644
--- a/dillorc
+++ b/dillorc
@@ -49,6 +49,12 @@
# Place the vertical scrollbar on the left side (default right).
#scrollbar_on_left=NO
+# Enable the page mode for the vertical scrollbar. When this mode is enabled,
+# clicking anywhere on the vertical scrollbar with the left button scrolls one
+# page down. With the right button, one page up. Click with the middle button to
+# jump to a given position.
+#scrollbar_page_mode=NO
+
#-------------------------------------------------------------------------
# RENDERING SECTION
#-------------------------------------------------------------------------
diff --git a/doc/user_help.in.html b/doc/user_help.in.html
index a35bb63b..25129668 100644
--- a/doc/user_help.in.html
+++ b/doc/user_help.in.html
@@ -213,6 +213,15 @@ scrollbar can be positioned on the left side setting the
<code>scrollbar_on_left</code> option to <code>YES</code>, by default it is on
the right side.</p>
+The vertical scrollbar has another mode of operation to navigate full
+<em>pages</em> that can be enabled by setting the
+<code>scrollbar_page_mode</code> option to <code>YES</code> or temporarily by
+holding the Shift key. When this mode is active, left-clicking anywhere on the
+scrollbar will scroll down one page and right-clicking will scroll up one page.
+Middle clicking on the scrollbar will move the thumb to that position, which can
+also be dragged. The Shift key can also be used to temporarily disable this
+mode if it was enabled in the configuration.
+
<h3 id="find-text">Find text</h3>
<p>
To find text in a document right-click to open the <em>Page menu</em> and select
diff --git a/dw/fltkviewport.cc b/dw/fltkviewport.cc
index 28c4101c..f0b69cb8 100644
--- a/dw/fltkviewport.cc
+++ b/dw/fltkviewport.cc
@@ -2,6 +2,7 @@
* Dillo Widget
*
* Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org>
+ * Copyright 2024 Rodrigo Arias Mallo <rodarima@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -71,6 +72,7 @@ FltkViewport::FltkViewport (int X, int Y, int W, int H, const char *label):
hasDragScroll = 1;
scrollX = scrollY = scrollDX = scrollDY = 0;
horScrolling = verScrolling = dragScrolling = 0;
+ scrollbarPageMode = false;
gadgetOrientation[0] = GADGET_HORIZONTAL;
gadgetOrientation[1] = GADGET_HORIZONTAL;
@@ -292,8 +294,18 @@ int FltkViewport::handle (int event)
case FL_PUSH:
if (vscrollbar->visible() && Fl::event_inside(vscrollbar)) {
- if (vscrollbar->handle(event))
+ if (scrollbarPageMode ^ (bool) Fl::event_shift()) {
+ if (Fl::event_button() == FL_LEFT_MOUSE) {
+ scroll(core::SCREEN_DOWN_CMD);
+ return 1;
+ } else if (Fl::event_button() == FL_RIGHT_MOUSE) {
+ scroll(core::SCREEN_UP_CMD);
+ return 1;
+ }
+ }
+ if (vscrollbar->handle(event)) {
verScrolling = 1;
+ }
} else if (hscrollbar->visible() && Fl::event_inside(hscrollbar)) {
if (hscrollbar->handle(event))
horScrolling = 1;
@@ -412,6 +424,11 @@ void FltkViewport::setScrollStep(int step)
hscrollbar->linesize(step);
}
+void FltkViewport::setScrollbarPageMode(bool enable)
+{
+ scrollbarPageMode = enable;
+}
+
bool FltkViewport::usesViewport ()
{
return true;
diff --git a/dw/fltkviewport.hh b/dw/fltkviewport.hh
index fdcbb3be..62d4fa21 100644
--- a/dw/fltkviewport.hh
+++ b/dw/fltkviewport.hh
@@ -1,3 +1,23 @@
+/*
+ * Dillo Widget
+ *
+ * Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org>
+ * Copyright 2024 Rodrigo Arias Mallo <rodarima@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#ifndef __DW_FLTKVIEWPORT_HH__
#define __DW_FLTKVIEWPORT_HH__
@@ -24,6 +44,7 @@ private:
int scrollbarOnLeft;
int hasDragScroll, dragScrolling, dragX, dragY;
int horScrolling, verScrolling;
+ bool scrollbarPageMode;
Fl_Scrollbar *vscrollbar, *hscrollbar;
@@ -78,6 +99,7 @@ public:
void setDragScroll (bool enable) { hasDragScroll = enable ? 1 : 0; }
void addGadget (Fl_Widget *gadget);
void setScrollbarOnLeft (bool enable);
+ void setScrollbarPageMode(bool enable);
};
} // namespace fltk
diff --git a/src/prefs.c b/src/prefs.c
index 29b4f349..36415647 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -92,6 +92,7 @@ void a_Prefs_init(void)
dList_append(prefs.search_urls, dStrdup(PREFS_SEARCH_URL));
prefs.search_url_idx = 0;
prefs.scrollbar_on_left = FALSE;
+ prefs.scrollbar_page_mode = FALSE;
prefs.show_back = TRUE;
prefs.show_bookmarks = TRUE;
prefs.show_clear_url = TRUE;
diff --git a/src/prefs.h b/src/prefs.h
index f51d0a4c..6f8f4fdb 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -78,6 +78,7 @@ typedef struct {
int32_t font_min_size;
int32_t scroll_step;
bool_t scrollbar_on_left;
+ bool_t scrollbar_page_mode;
bool_t show_back;
bool_t show_forw;
bool_t show_home;
diff --git a/src/prefsparser.cc b/src/prefsparser.cc
index 3669b8d4..864a6736 100644
--- a/src/prefsparser.cc
+++ b/src/prefsparser.cc
@@ -201,6 +201,7 @@ void PrefsParser::parse(FILE *fp)
{ "save_dir", &prefs.save_dir, PREFS_STRING, 0 },
{ "scroll_step", &prefs.scroll_step, PREFS_INT32, 0 },
{ "scrollbar_on_left", &prefs.scrollbar_on_left, PREFS_BOOL, 0 },
+ { "scrollbar_page_mode", &prefs.scrollbar_page_mode, PREFS_BOOL, 0 },
{ "search_url", &prefs.search_urls, PREFS_STRINGS, 0 },
{ "show_back", &prefs.show_back, PREFS_BOOL, 0 },
{ "show_bookmarks", &prefs.show_bookmarks, PREFS_BOOL, 0 },
diff --git a/src/uicmd.cc b/src/uicmd.cc
index 07593892..ad6e67c1 100644
--- a/src/uicmd.cc
+++ b/src/uicmd.cc
@@ -629,6 +629,7 @@ static BrowserWindow *UIcmd_tab_new(CustTabs *tabs, UI *old_ui, int focus)
viewport->setBufferedDrawing (prefs.buffered_drawing ? true : false);
viewport->setDragScroll (prefs.middle_click_drags_page ? true : false);
viewport->setScrollbarOnLeft (prefs.scrollbar_on_left ? true : false);
+ viewport->setScrollbarPageMode (prefs.scrollbar_page_mode ? true : false);
layout->attachView (viewport);
new_ui->set_render_layout(viewport);
viewport->setScrollStep(prefs.scroll_step);