bug in gtk_adjustment_clamp_page()?
- From: jcupitt gmail com
- To: gtk-devel-list <gtk-devel-list gnome org>
- Subject: bug in gtk_adjustment_clamp_page()?
- Date: Thu, 26 Nov 2015 15:24:57 +0000
Hi all, I've found some puzzling code in gtk_adjustment_clamp_page().
Maybe it's a bug? I'm unsure.
These lines:
https://git.gnome.org/browse/gtk+/tree/gtk/gtkadjustment.c#n932
Clamp the value of an adjustment so it lies between lower and upper.
But aren't the < and > reversed? Those lines should surely be:
if (priv->value + priv->page_size > upper)
{
priv->value = upper - priv->page_size;
need_emission = TRUE;
}
ie. if bigger than upper, limit to upper.
Or maybe I've misunderstood what clamp_page is for. Is this a bug?
The context here is tabbing focus into a scrolled window triggers
gtk_adjustment_clamp_page(), which always scrolls back to the left/top
because of these swapped tests. I'm working on an image viewer and I
obviously don't want to move the image around when I tab into that
window.
If I swap the < and >, everything seems to work for me at least.
John
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]