summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/panels/glance.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/panels/glance.c b/src/gui/panels/glance.c
index fb1723a..abbe6a1 100644
--- a/src/gui/panels/glance.c
+++ b/src/gui/panels/glance.c
@@ -626,6 +626,7 @@ static gboolean on_mouse_motion_over_glance(GtkWidget *widget, GdkEventMotion *e
gdouble diff_y; /* Evolution sur les ordonnées */
GtkAdjustment *hadj; /* Gestionnaire du défilement */
GtkAdjustment *vadj; /* Gestionnaire du défilement */
+ gdouble value; /* Nouvelle valeur bornée */
if (panel->view != NULL && event->state & GDK_BUTTON1_MASK && panel->valid)
{
@@ -635,8 +636,11 @@ static gboolean on_mouse_motion_over_glance(GtkWidget *widget, GdkEventMotion *e
hadj = gtk_scrolled_window_get_hadjustment(panel->support);
vadj = gtk_scrolled_window_get_vadjustment(panel->support);
- gtk_adjustment_set_value(hadj, panel->ref_h + diff_x);
- gtk_adjustment_set_value(vadj, panel->ref_v + diff_y);
+ value = CLAMP(panel->ref_h + diff_x, hadj->lower, hadj->upper - hadj->page_size);
+ gtk_adjustment_set_value(hadj, value);
+
+ value = CLAMP(panel->ref_v + diff_y, vadj->lower, vadj->upper - vadj->page_size);
+ gtk_adjustment_set_value(vadj, value);
}