[Dillo-dev] [PATCH] Add show_scrollbar preference

13 views
Skip to first unread message

Alyssa Rosenzweig

unread,
Jun 10, 2018, 2:36:42 PM6/10/18
to dill...@dillo.org
While it certainly serves a purpose for length and progress indication,
the scrollbar is of minimal use in some workflows, particularly if other
means are used to scroll (the keyboard, middle-click, touchscreen).

This patch adds a simple `show_scrollbar` preference, defaulting to
true, which enables users to disable the scrollbar in their dillorc like
other UI components.

Precedent includes e.g mate-terminal, which exposes a "Disable
scrollbar" option in its profile preferences.

---

diff -r 9a2de2c22f04 dillorc
--- a/dillorc Sun Jun 10 18:19:35 2018 +0000
+++ b/dillorc Sun Jun 10 18:30:36 2018 +0000
@@ -345,6 +345,7 @@
#show_home=YES
#show_reload=YES
#show_save=YES
+#show_scrollbar=YES
#show_stop=YES
#show_bookmarks=YES
#show_tools=YES
diff -r 9a2de2c22f04 dw/fltkviewport.cc
--- a/dw/fltkviewport.cc Sun Jun 10 18:19:35 2018 +0000
+++ b/dw/fltkviewport.cc Sun Jun 10 18:30:36 2018 +0000
@@ -488,8 +488,11 @@
hScrollbarThickness,hscrollbar->visible(),
vScrollbarThickness,vscrollbar->visible(), adjustReq);

- (hScrollbarThickness > 0) ? hscrollbar->show () : hscrollbar->hide ();
- (vScrollbarThickness > 0) ? vscrollbar->show () : vscrollbar->hide ();
+ (showScrollbar && hScrollbarThickness > 0) ?
+ hscrollbar->show () : hscrollbar->hide ();
+
+ (showScrollbar && vScrollbarThickness > 0) ?
+ vscrollbar->show () : vscrollbar->hide ();

/* If no scrollbar, go to the beginning */
scroll(hScrollbarThickness ? 0 : -scrollX,
diff -r 9a2de2c22f04 dw/fltkviewport.hh
--- a/dw/fltkviewport.hh Sun Jun 10 18:19:35 2018 +0000
+++ b/dw/fltkviewport.hh Sun Jun 10 18:30:36 2018 +0000
@@ -25,6 +25,7 @@
int horScrolling, verScrolling;

Fl_Scrollbar *vscrollbar, *hscrollbar;
+ bool showScrollbar;

GadgetOrientation gadgetOrientation[4];
lout::container::typed::List <lout::object::TypedPointer < Fl_Widget> >
@@ -73,6 +74,7 @@

void setGadgetOrientation (bool hscrollbarVisible, bool vscrollbarVisible,
GadgetOrientation gadgetOrientation);
+ void setShowScrollbar (bool enable) { showScrollbar = enable; }
void setDragScroll (bool enable) { hasDragScroll = enable ? 1 : 0; }
void setTouchScroll (bool enable) { hasTouchScroll = enable ? 1 : 0; }
void addGadget (Fl_Widget *gadget);
diff -r 9a2de2c22f04 src/prefs.c
--- a/src/prefs.c Sun Jun 10 18:19:35 2018 +0000
+++ b/src/prefs.c Sun Jun 10 18:30:36 2018 +0000
@@ -98,6 +98,7 @@
prefs.show_quit_dialog = TRUE;
prefs.show_reload = TRUE;
prefs.show_save = TRUE;
+ prefs.show_scrollbar = TRUE;
prefs.show_url = TRUE;
prefs.show_search = TRUE;
prefs.show_stop = TRUE;
diff -r 9a2de2c22f04 src/prefs.h
--- a/src/prefs.h Sun Jun 10 18:19:35 2018 +0000
+++ b/src/prefs.h Sun Jun 10 18:30:36 2018 +0000
@@ -84,6 +84,7 @@
bool_t show_clear_url;
bool_t show_url;
bool_t show_search;
+ bool_t show_scrollbar;
bool_t show_help;
bool_t show_progress_box;
bool_t show_quit_dialog;
diff -r 9a2de2c22f04 src/prefsparser.cc
--- a/src/prefsparser.cc Sun Jun 10 18:19:35 2018 +0000
+++ b/src/prefsparser.cc Sun Jun 10 18:30:36 2018 +0000
@@ -206,6 +206,7 @@
{ "show_reload", &prefs.show_reload, PREFS_BOOL, 0 },
{ "show_save", &prefs.show_save, PREFS_BOOL, 0 },
{ "show_url", &prefs.show_url, PREFS_BOOL, 0 },
+ { "show_scrollbar", &prefs.show_scrollbar, PREFS_BOOL, 0 },
{ "show_search", &prefs.show_search, PREFS_BOOL, 0 },
{ "show_stop", &prefs.show_stop, PREFS_BOOL, 0 },
{ "show_tools", &prefs.show_tools, PREFS_BOOL, 0 },
diff -r 9a2de2c22f04 src/uicmd.cc
--- a/src/uicmd.cc Sun Jun 10 18:19:35 2018 +0000
+++ b/src/uicmd.cc Sun Jun 10 18:30:36 2018 +0000
@@ -604,6 +604,7 @@
FltkViewport *viewport = new FltkViewport (0, 0, 0, 1);
viewport->box(FL_NO_BOX);
viewport->setBufferedDrawing (prefs.buffered_drawing ? true : false);
+ viewport->setShowScrollbar (prefs.show_scrollbar);
viewport->setDragScroll (prefs.middle_click_drags_page);
viewport->setTouchScroll (prefs.touchscreen_drags_page);
layout->setTouchScroll (prefs.touchscreen_drags_page);

_______________________________________________
Dillo-dev mailing list
Dill...@dillo.org
http://lists.dillo.org/cgi-bin/mailman/listinfo/dillo-dev

Reply all
Reply to author
Forward
0 new messages