diff --git a/data/darktableconfig.xml.in b/data/darktableconfig.xml.in
index 7b9b2781bd08..b9550724991e 100644
--- a/data/darktableconfig.xml.in
+++ b/data/darktableconfig.xml.in
@@ -1327,6 +1327,13 @@
enable disk backend for full preview cache
if enabled, write full preview to disk (.cache/darktable/) when evicted from the memory cache.\nnote that this can take a lot of memory (several gigabytes for 20k images) and will never delete cached full previews again.\nit's safe though to delete these manually, if you want.\nlight table performance will be increased greatly when zooming image in full preview mode.
+
+ thumbtable_fractional_scrolling
+ bool
+ false
+ enable smooth scrolling for lighttable thumbnails
+ if enabled, scrolling the lighttable scrolls by some number of pixels, as expected with a touch pad.\ndisabled, the lighttable scrolls full rows of thumbnails, as befits a scroll wheel.
+
backthumbs_mipsize
diff --git a/src/dtgtk/thumbtable.c b/src/dtgtk/thumbtable.c
index 577db43bef84..7f40a2e43635 100644
--- a/src/dtgtk/thumbtable.c
+++ b/src/dtgtk/thumbtable.c
@@ -1061,8 +1061,18 @@ static gboolean _event_scroll_compressed(gpointer user_data)
// half shown if scrollbar used)
int move = table->thumb_size * delta;
- // clicky scroll wheels generate integer clicks, scroll by one thumb size:
- if (fabsf(delta) == 1.f) {
+ // for fractional scrolling, scroll by a number of pixels proportionate to
+ // the delta (which is a float value for most touch pads and some mice)
+ if (dt_conf_get_bool("thumbtable_fractional_scrolling"))
+ {
+ // scale scroll increment for an appropriate scroll speed
+ delta *= 50;
+ _move(table, 0, -delta, TRUE);
+ }
+ // for clicky scrolling, scroll one row of thumbnails per scroll delta
+ // (which is collected into an integer value in this case)
+ else
+ {
// if the top thumb row is only partially visible, then realign first
const int partial_height = table->thumbs_area.y % table->thumb_size;
if(partial_height)
@@ -1078,12 +1088,6 @@ static gboolean _event_scroll_compressed(gpointer user_data)
}
_move(table, 0, -move, TRUE);
}
- // precision touch pads generate float increments, scroll by pixel delta:
- else {
- // scale scroll increment for an appropriate scroll speed
- delta *= 50;
- _move(table, 0, -delta, TRUE);
- }
// ensure the hovered image is the right one
dt_thumbnail_t *th = _thumb_get_under_mouse(table);
@@ -1105,12 +1109,20 @@ static gboolean _event_scroll(GtkWidget *widget,
dt_thumbtable_t *table = (dt_thumbtable_t *)user_data;
int delta_x, delta_y;
- // file manager should scroll smoothly for precision touch pads, but
- // in one-thumbnail increments for clicky scroll wheels, so use
- // get_scroll_deltas instead of get_scroll_unit_deltas:
+ // file manager can either scroll fractionally and smoothly for precision
+ // touch pads, or in one-thumbnail increments for clicky scroll wheels
if(table->mode == DT_THUMBTABLE_MODE_FILEMANAGER) {
gdouble deltaf_x, deltaf_y;
- if(dt_gui_get_scroll_deltas(e, &deltaf_x, &deltaf_y))
+ gboolean did_scroll;
+ if(dt_conf_get_bool("thumbtable_fractional_scrolling")) {
+ did_scroll = dt_gui_get_scroll_deltas(e, &deltaf_x, &deltaf_y);
+ }
+ else
+ {
+ did_scroll = dt_gui_get_scroll_unit_deltas(e, &delta_x, &delta_y);
+ deltaf_y = (float)delta_y;
+ }
+ if(did_scroll)
{
// in order to process "big" scroll in one time, we use a
// timeout to postpone a little scrolling
@@ -1120,6 +1132,7 @@ static gboolean _event_scroll(GtkWidget *widget,
}
table->scroll_value += deltaf_y;
}
+ // we stop here to avoid scrolledwindow to move
return TRUE;
}