[patch] Scrollbar thickness from dillorc
podarcis <[email protected]>
| Newsgroups | gmane.comp.web.dillo.devel |
|---|---|
| Message-ID | <1358694071.9117.14.camel@ubuntu> |
Scrollbars currently have the hardcoded thickness 15. This can be too small to operate dillo on large screens or with fingers on a touch screen. The supplied patch does the following: - Adds the prefence "scrollbar_tickness" to dillorc. - Reads the value into the prefences (Note: added a type UINT32 to prefsparse.cc) - Sets this value to the FltkViewport with the new method FltkViewport::setScrollbarThickness(). Note: I deliberately did no check for value 0, which can therefore be used to make the scrollbars invisible. Scrolling can then still be achieved with the cursor keys. This could be called a feature. Cheers, podarcis _______________________________________________ Dillo-dev mailing list [email protected] http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
dillo_scrollbar_thickness.diff
(text/x-patch, 4.1 KB)
diff -r 2147f3881a10 dillorc
--- a/dillorc Fri Jan 18 19:14:23 2013 +0100
+++ b/dillorc Sun Jan 20 15:22:19 2013 +0100
@@ -299,6 +299,9 @@
# Ask before quitting Dillo with more than one window or tab open.
#show_quit_dialog=YES
+# Width of scrollbars in pixels.
+#scrollbar_thickness = 15
+
#-------------------------------------------------------------------------
# DEBUG MESSAGES SECTION
#-------------------------------------------------------------------------
diff -r 2147f3881a10 dw/fltkviewport.cc
--- a/dw/fltkviewport.cc Fri Jan 18 19:14:23 2013 +0100
+++ b/dw/fltkviewport.cc Sun Jan 20 15:22:19 2013 +0100
@@ -35,6 +35,9 @@
namespace dw {
namespace fltk {
+/*static*/
+size_t FltkViewport::SCROLLBAR_THICKNESS = 15;
+
/*
* Lets SHIFT+{Left,Right} go to the parent
*/
@@ -348,10 +351,17 @@
(core::ButtonState)0);
}
+
/*
* For scrollbars, this currently sets the same step to both vertical and
* horizontal. It may be differentiated if necessary.
*/
+
+void FltkViewport::setScrollbarThickness(size_t scrollbar_thickness)
+{
+ SCROLLBAR_THICKNESS = scrollbar_thickness;
+}
+
void FltkViewport::setScrollStep(int step)
{
vscrollbar->linesize(step);
diff -r 2147f3881a10 dw/fltkviewport.hh
--- a/dw/fltkviewport.hh Fri Jan 18 19:14:23 2013 +0100
+++ b/dw/fltkviewport.hh Sun Jan 20 15:22:19 2013 +0100
@@ -15,10 +15,9 @@
{
public:
enum GadgetOrientation { GADGET_VERTICAL, GADGET_HORIZONTAL };
+ static size_t SCROLLBAR_THICKNESS;
private:
- enum { SCROLLBAR_THICKNESS = 15 };
-
int scrollX, scrollY;
int scrollDX, scrollDY;
int hasDragScroll, dragScrolling, dragX, dragY;
@@ -69,6 +68,7 @@
void scrollTo (int x, int y);
void setViewportSize (int width, int height,
int hScrollbarThickness, int vScrollbarThickness);
+ void setScrollbarThickness(size_t scrollbar_thickness);
void setScrollStep(int step);
void setGadgetOrientation (bool hscrollbarVisible, bool vscrollbarVisible,
diff -r 2147f3881a10 src/prefs.c
--- a/src/prefs.c Fri Jan 18 19:14:23 2013 +0100
+++ b/src/prefs.c Sun Jan 20 15:22:19 2013 +0100
@@ -115,6 +115,8 @@
prefs.penalty_em_dash_left = 800;
prefs.penalty_em_dash_right = 100;
prefs.penalty_em_dash_right_2 = 800;
+
+ prefs.scrollbar_thickness = 15;
}
/*
diff -r 2147f3881a10 src/prefs.h
--- a/src/prefs.h Fri Jan 18 19:14:23 2013 +0100
+++ b/src/prefs.h Sun Jan 20 15:22:19 2013 +0100
@@ -97,6 +97,7 @@
bool_t middle_click_drags_page;
int penalty_hyphen, penalty_hyphen_2;
int penalty_em_dash_left, penalty_em_dash_right, penalty_em_dash_right_2;
+ uint32_t scrollbar_thickness;
} DilloPrefs;
/* Global Data */
diff -r 2147f3881a10 src/prefsparser.cc
--- a/src/prefsparser.cc Fri Jan 18 19:14:23 2013 +0100
+++ b/src/prefsparser.cc Sun Jan 20 15:22:19 2013 +0100
@@ -29,6 +29,7 @@
PREFS_STRINGS,
PREFS_URL,
PREFS_INT32,
+ PREFS_UINT32,
PREFS_DOUBLE,
PREFS_FRACTION_100,
PREFS_GEOMETRY,
@@ -127,7 +128,8 @@
{ "penalty_em_dash_right", &prefs.penalty_em_dash_right,
PREFS_FRACTION_100 },
{ "penalty_em_dash_right_2", &prefs.penalty_em_dash_right_2,
- PREFS_FRACTION_100 }
+ PREFS_FRACTION_100 },
+ { "scrollbar_thickness", &prefs.scrollbar_thickness, PREFS_UINT32 },
};
node = NULL;
@@ -177,6 +179,9 @@
case PREFS_INT32:
*(int32_t *)node->pref = strtol(value, NULL, 10);
break;
+ case PREFS_UINT32:
+ *(uint32_t *)node->pref = strtoul(value, NULL, 10);
+ break;
case PREFS_DOUBLE:
*(double *)node->pref = strtod(value, NULL);
break;
diff -r 2147f3881a10 src/uicmd.cc
--- a/src/uicmd.cc Fri Jan 18 19:14:23 2013 +0100
+++ b/src/uicmd.cc Sun Jan 20 15:22:19 2013 +0100
@@ -594,6 +594,7 @@
viewport->setDragScroll (prefs.middle_click_drags_page ? true : false);
layout->attachView (viewport);
new_ui->set_render_layout(viewport);
+ viewport->setScrollbarThickness(prefs.scrollbar_thickness);
viewport->setScrollStep((int) rint(28.0 * prefs.font_factor));
// Now, create a new browser window structure