Update to explain the situation.

2008-09-23  Matthias Clasen  <mclasen@redhat.com>

        * README.in: Update to explain the situation.

        * gtk/gtkadjustment.c: Revert to the old behaviour of allowing
        values in the range [lower, upper]. Relying on the possibility
        to set values in the [upper - page_size, upper] subrange is
        considered deprecated, though, and will trigger a warning.

        * gtk/gtkcombobox.c:
        * gtk/gtkiconview.c:
        * gtk/gtkrange.c:
        * gtk/gtkscrolledwindow.c:
        * gtk/gtktreeview.c: Add the CLAMPing back that was removed after
        the GtkAdjustment behaviour change.

svn path=/branches/gtk-2-14/; revision=21499

Conflicts:

	ChangeLog.pre-2-14
This commit is contained in:
Matthias Clasen 2009-05-03 12:45:54 -04:00
parent 49e1700bb2
commit 5325959fe2
7 changed files with 75 additions and 41 deletions

View File

@ -69,11 +69,15 @@ Release notes for 2.14
to GTK_SENSITIVITY_ON, so that the button is always sensitive or
GTK_SENSITIVITY_OFF to make it insensitive respectively.
* GtkAdjustment now enforces that values are restricted to the
range [lower, upper - page_size]. This has always been the documented
behaviour, and the recommended practice is to set page_size to 0
when using adjustments for simple scalar values, like in a slider
or spin button.
* In the early 2.14.x releases, GtkAdjustment was changed to enforce
that values are restricted to the range [lower, upper - page_size].
This has always been the documented behaviour, and the recommended
practice is to set page_size to 0 when using adjustments for simple
scalar values, like in a slider or spin button.
Due to the large number of applications that are affected by this
change, the behaviour has been reverted to the old behaviour in
2.14.3, with an explicit warning that this change will be
reintroduced in 2.90.
* gdk-pixbuf will use GIO for mime type detection if possible. For
this to work, shared-mime-info needs to be installed and XDG_DATA_DIRS

View File

@ -359,11 +359,7 @@ gtk_adjustment_set_value (GtkAdjustment *adjustment,
{
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
/* don't use CLAMP() so we don't end up below lower if upper - page_size
* is smaller than lower
*/
value = MIN (value, adjustment->upper - adjustment->page_size);
value = MAX (value, adjustment->lower);
value = CLAMP (value, adjustment->lower, adjustment->upper);
if (value != adjustment->value)
{

View File

@ -4018,13 +4018,13 @@ gtk_combo_box_list_auto_scroll (GtkComboBox *combo_box,
adj->lower < adj->value)
{
value = adj->value - (tree_view->allocation.x - x + 1);
gtk_adjustment_set_value (adj, value);
gtk_adjustment_set_value (adj, CLAMP (value, adj->lower, adj->upper - adj->page_size));
}
else if (x >= tree_view->allocation.x + tree_view->allocation.width &&
adj->upper - adj->page_size > adj->value)
{
value = adj->value + (x - tree_view->allocation.x - tree_view->allocation.width + 1);
gtk_adjustment_set_value (adj, MAX (value, 0.0));
gtk_adjustment_set_value (adj, CLAMP (value, 0.0, adj->upper - adj->page_size));
}
}
@ -4035,13 +4035,13 @@ gtk_combo_box_list_auto_scroll (GtkComboBox *combo_box,
adj->lower < adj->value)
{
value = adj->value - (tree_view->allocation.y - y + 1);
gtk_adjustment_set_value (adj, value);
gtk_adjustment_set_value (adj, CLAMP (value, adj->lower, adj->upper - adj->page_size));
}
else if (y >= tree_view->allocation.height &&
adj->upper - adj->page_size > adj->value)
{
value = adj->value + (y - tree_view->allocation.height + 1);
gtk_adjustment_set_value (adj, MAX (value, 0.0));
gtk_adjustment_set_value (adj, CLAMP (value, 0.0, adj->upper - adj->page_size));
}
}
}

View File

@ -1471,7 +1471,7 @@ gtk_icon_view_size_allocate (GtkWidget *widget,
hadjustment->upper = MAX (allocation->width, icon_view->priv->width);
if (hadjustment->value > hadjustment->upper - hadjustment->page_size)
gtk_adjustment_set_value (hadjustment, hadjustment->upper - hadjustment->page_size);
gtk_adjustment_set_value (hadjustment, MAX (0, hadjustment->upper - hadjustment->page_size));
vadjustment->page_size = allocation->height;
vadjustment->page_increment = allocation->height * 0.9;
@ -1480,7 +1480,7 @@ gtk_icon_view_size_allocate (GtkWidget *widget,
vadjustment->upper = MAX (allocation->height, icon_view->priv->height);
if (vadjustment->value > vadjustment->upper - vadjustment->page_size)
gtk_adjustment_set_value (vadjustment, vadjustment->upper - vadjustment->page_size);
gtk_adjustment_set_value (vadjustment, MAX (0, vadjustment->upper - vadjustment->page_size));
if (GTK_WIDGET_REALIZED (widget) &&
icon_view->priv->scroll_to_path)
@ -1638,11 +1638,17 @@ gtk_icon_view_expose (GtkWidget *widget,
static gboolean
rubberband_scroll_timeout (gpointer data)
{
GtkIconView *icon_view = data;
GtkIconView *icon_view;
gdouble value;
gtk_adjustment_set_value (icon_view->priv->vadjustment,
icon_view->priv->vadjustment->value +
icon_view->priv->scroll_value_diff);
icon_view = data;
value = MIN (icon_view->priv->vadjustment->value +
icon_view->priv->scroll_value_diff,
icon_view->priv->vadjustment->upper -
icon_view->priv->vadjustment->page_size);
gtk_adjustment_set_value (icon_view->priv->vadjustment, value);
gtk_icon_view_update_rubberband (icon_view);
@ -4349,7 +4355,7 @@ gtk_icon_view_scroll_to_path (GtkIconView *icon_view,
{
gint x, y;
gint focus_width;
gfloat offset;
gfloat offset, value;
gtk_widget_style_get (GTK_WIDGET (icon_view),
"focus-line-width", &focus_width,
@ -4359,15 +4365,17 @@ gtk_icon_view_scroll_to_path (GtkIconView *icon_view,
offset = y + item->y - focus_width -
row_align * (GTK_WIDGET (icon_view)->allocation.height - item->height);
gtk_adjustment_set_value (icon_view->priv->vadjustment,
icon_view->priv->vadjustment->value + offset);
value = CLAMP (icon_view->priv->vadjustment->value + offset,
icon_view->priv->vadjustment->lower,
icon_view->priv->vadjustment->upper - icon_view->priv->vadjustment->page_size);
gtk_adjustment_set_value (icon_view->priv->vadjustment, value);
offset = x + item->x - focus_width -
col_align * (GTK_WIDGET (icon_view)->allocation.width - item->width);
gtk_adjustment_set_value (icon_view->priv->hadjustment,
icon_view->priv->hadjustment->value + offset);
value = CLAMP (icon_view->priv->hadjustment->value + offset,
icon_view->priv->hadjustment->lower,
icon_view->priv->hadjustment->upper - icon_view->priv->hadjustment->page_size);
gtk_adjustment_set_value (icon_view->priv->hadjustment, value);
gtk_adjustment_changed (icon_view->priv->hadjustment);
gtk_adjustment_changed (icon_view->priv->vadjustment);
@ -6407,6 +6415,7 @@ gtk_icon_view_autoscroll (GtkIconView *icon_view)
{
gint px, py, x, y, width, height;
gint hoffset, voffset;
gfloat value;
gdk_window_get_pointer (GTK_WIDGET (icon_view)->window, &px, &py, NULL);
gdk_window_get_geometry (GTK_WIDGET (icon_view)->window, &x, &y, &width, &height, NULL);
@ -6421,12 +6430,19 @@ gtk_icon_view_autoscroll (GtkIconView *icon_view)
hoffset = MAX (px - (x + width - 2 * SCROLL_EDGE_SIZE), 0);
if (voffset != 0)
gtk_adjustment_set_value (icon_view->priv->vadjustment,
icon_view->priv->vadjustment->value + voffset);
{
value = CLAMP (icon_view->priv->vadjustment->value + voffset,
icon_view->priv->vadjustment->lower,
icon_view->priv->vadjustment->upper - icon_view->priv->vadjustment->page_size);
gtk_adjustment_set_value (icon_view->priv->vadjustment, value);
}
if (hoffset != 0)
gtk_adjustment_set_value (icon_view->priv->hadjustment,
icon_view->priv->hadjustment->value + hoffset);
{
value = CLAMP (icon_view->priv->hadjustment->value + hoffset,
icon_view->priv->hadjustment->lower,
icon_view->priv->hadjustment->upper - icon_view->priv->hadjustment->page_size);
gtk_adjustment_set_value (icon_view->priv->hadjustment, value);
}
}

View File

@ -990,6 +990,9 @@ gtk_range_set_range (GtkRange *range,
value = MIN (value, MAX (range->adjustment->lower,
range->layout->fill_level));
value = CLAMP (value, range->adjustment->lower,
(range->adjustment->upper - range->adjustment->page_size));
gtk_adjustment_set_value (range->adjustment, value);
gtk_adjustment_changed (range->adjustment);
}
@ -1014,6 +1017,9 @@ gtk_range_set_value (GtkRange *range,
value = MIN (value, MAX (range->adjustment->lower,
range->layout->fill_level));
value = CLAMP (value, range->adjustment->lower,
(range->adjustment->upper - range->adjustment->page_size));
gtk_adjustment_set_value (range->adjustment, value);
}

View File

@ -1190,6 +1190,8 @@ gtk_scrolled_window_scroll_child (GtkScrolledWindow *scrolled_window,
break;
}
value = CLAMP (value, adjustment->lower, adjustment->upper - adjustment->page_size);
gtk_adjustment_set_value (adjustment, value);
return TRUE;
@ -1573,11 +1575,13 @@ gtk_scrolled_window_scroll_event (GtkWidget *widget,
if (range && GTK_WIDGET_VISIBLE (range))
{
GtkAdjustment *adj = GTK_RANGE (range)->adjustment;
gdouble delta;
gdouble delta, new_value;
delta = _gtk_range_get_wheel_delta (GTK_RANGE (range), event->direction);
gtk_adjustment_set_value (adj, adj->value + delta);
new_value = CLAMP (adj->value + delta, adj->lower, adj->upper - adj->page_size);
gtk_adjustment_set_value (adj, new_value);
return TRUE;
}

View File

@ -3620,6 +3620,7 @@ gtk_tree_view_vertical_autoscroll (GtkTreeView *tree_view)
GdkRectangle visible_rect;
gint y;
gint offset;
gfloat value;
gdk_window_get_pointer (tree_view->priv->bin_window, NULL, &y, NULL);
y += tree_view->priv->dy;
@ -3635,8 +3636,9 @@ gtk_tree_view_vertical_autoscroll (GtkTreeView *tree_view)
return;
}
gtk_adjustment_set_value (tree_view->priv->vadjustment,
MAX (tree_view->priv->vadjustment->value + offset, 0.0));
value = CLAMP (tree_view->priv->vadjustment->value + offset, 0.0,
tree_view->priv->vadjustment->upper - tree_view->priv->vadjustment->page_size);
gtk_adjustment_set_value (tree_view->priv->vadjustment, value);
}
static gboolean
@ -3645,6 +3647,7 @@ gtk_tree_view_horizontal_autoscroll (GtkTreeView *tree_view)
GdkRectangle visible_rect;
gint x;
gint offset;
gfloat value;
gdk_window_get_pointer (tree_view->priv->bin_window, &x, NULL, NULL);
@ -3660,8 +3663,9 @@ gtk_tree_view_horizontal_autoscroll (GtkTreeView *tree_view)
}
offset = offset/3;
gtk_adjustment_set_value (tree_view->priv->hadjustment,
MAX (tree_view->priv->hadjustment->value + offset, 0.0));
value = CLAMP (tree_view->priv->hadjustment->value + offset,
0.0, tree_view->priv->hadjustment->upper - tree_view->priv->hadjustment->page_size);
gtk_adjustment_set_value (tree_view->priv->hadjustment, value);
return TRUE;
@ -8964,7 +8968,11 @@ gtk_tree_view_clamp_column_visible (GtkTreeView *tree_view,
}
}
gtk_adjustment_set_value (tree_view->priv->hadjustment, x);
gtk_adjustment_set_value (tree_view->priv->hadjustment,
CLAMP (x,
tree_view->priv->hadjustment->lower,
tree_view->priv->hadjustment->upper
- tree_view->priv->hadjustment->page_size));
}
else
{
@ -11613,9 +11621,9 @@ gtk_tree_view_scroll_to_point (GtkTreeView *tree_view,
vadj = tree_view->priv->vadjustment;
if (tree_x != -1)
gtk_adjustment_set_value (hadj, tree_x);
gtk_adjustment_set_value (hadj, CLAMP (tree_x, hadj->lower, hadj->upper - hadj->page_size));
if (tree_y != -1)
gtk_adjustment_set_value (vadj, tree_y);
gtk_adjustment_set_value (vadj, CLAMP (tree_y, vadj->lower, vadj->upper - vadj->page_size));
}
/**