aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-10-20 09:46:06 +0200
committerPřemysl Eric Janouch <p@janouch.name>2021-10-20 09:46:06 +0200
commitdd7b25869824f7e9d443c98f82f594bca7b61af3 (patch)
tree1dc38a83bb767ee39d4518f78a3727ad8ccf43d6 /src
parentaa3ad12d44274cf665b53be11f3de2c9fc393664 (diff)
downloadtdv-dd7b25869824f7e9d443c98f82f594bca7b61af3.tar.gz
tdv-dd7b25869824f7e9d443c98f82f594bca7b61af3.tar.xz
tdv-dd7b25869824f7e9d443c98f82f594bca7b61af3.zip
sdgui: make an attempt at smooth scrolling
Diffstat (limited to 'src')
-rw-r--r--src/stardict-view.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/stardict-view.c b/src/stardict-view.c
index 8eefa1a..f80a6e2 100644
--- a/src/stardict-view.c
+++ b/src/stardict-view.c
@@ -395,8 +395,9 @@ stardict_view_realize (GtkWidget *widget)
// Input-only would presumably also work (as in GtkPathBar, e.g.),
// but it merely seems to involve more work.
.wclass = GDK_INPUT_OUTPUT,
-
.visual = gtk_widget_get_visual (widget),
+
+ // GDK_SMOOTH_SCROLL_MASK is useless, will stop sending UP/DOWN
.event_mask = gtk_widget_get_events (widget) | GDK_SCROLL_MASK,
};
@@ -481,15 +482,16 @@ stardict_view_scroll_event (GtkWidget *widget, GdkEventScroll *event)
switch (event->direction)
{
case GDK_SCROLL_UP:
- self->top_offset -= 3 * natural_row_size (widget);
- adjust_for_offset (self);
+ stardict_view_scroll (self, GTK_SCROLL_STEPS, -3);
return TRUE;
case GDK_SCROLL_DOWN:
- self->top_offset += 3 * natural_row_size (widget);
+ stardict_view_scroll (self, GTK_SCROLL_STEPS, +3);
+ return TRUE;
+ case GDK_SCROLL_SMOOTH:
+ self->top_offset += event->delta_y;
adjust_for_offset (self);
return TRUE;
default:
- // GDK_SCROLL_SMOOTH doesn't fit the intended way of usage
return FALSE;
}
}