Skip to content
Browse files

fix transcript scrolling (via wheels/buttons) at the end of the trans…

…cript
  • Loading branch information...
1 parent 9c8e7a1 commit 80089ebd8b1d276b48950b34957ee9e7e3eee2a8 @rhaberkorn committed Jun 4, 2012
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/gtk-experiment-widgets/gtk-experiment-transcript.c
View
12 lib/gtk-experiment-widgets/gtk-experiment-transcript.c
@@ -422,15 +422,17 @@ static gboolean
scrolled(GtkWidget *widget, GdkEventScroll *event)
{
GtkExperimentTranscript *trans = GTK_EXPERIMENT_TRANSCRIPT(widget);
- GtkAdjustment *adj;
- gdouble value;
+ GtkAdjustment *adj;
+ gdouble value, real_upper;
if (trans->priv->time_adjustment == NULL)
return FALSE;
- adj = GTK_ADJUSTMENT(trans->priv->time_adjustment);
+ adj = GTK_ADJUSTMENT(trans->priv->time_adjustment);
value = gtk_adjustment_get_value(adj);
+ real_upper = gtk_adjustment_get_upper(adj) -
+ gtk_adjustment_get_page_size(adj);
switch (event->direction) {
case GDK_SCROLL_UP:
@@ -442,9 +444,7 @@ scrolled(GtkWidget *widget, GdkEventScroll *event)
break;
}
- if (value <= gtk_adjustment_get_upper(adj) -
- gtk_adjustment_get_page_size(adj))
- gtk_adjustment_set_value(adj, value);
+ gtk_adjustment_set_value(adj, value > real_upper ? real_upper : value);
return TRUE;
}

0 comments on commit 80089eb

Please sign in to comment.
Something went wrong with that request. Please try again.