mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
gtk/gtkcombobox.c gtk/gtkiconview.c gtk/gtkrange.c gtk/gtkscrolledwindow.c
2008-08-06 Michael Natterer <mitch@imendio.com> * gtk/gtkcombobox.c * gtk/gtkiconview.c * gtk/gtkrange.c * gtk/gtkscrolledwindow.c * gtk/gtktreeview.c: remove CLAMPing from values passed to gtk_adjustment_set_value() since it does it right now. svn path=/trunk/; revision=21021
This commit is contained in:
parent
5d95525f30
commit
3d75f27801
@ -1,3 +1,12 @@
|
||||
2008-08-06 Michael Natterer <mitch@imendio.com>
|
||||
|
||||
* gtk/gtkcombobox.c
|
||||
* gtk/gtkiconview.c
|
||||
* gtk/gtkrange.c
|
||||
* gtk/gtkscrolledwindow.c
|
||||
* gtk/gtktreeview.c: remove CLAMPing from values passed to
|
||||
gtk_adjustment_set_value() since it does it right now.
|
||||
|
||||
2008-08-05 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* configure.in: Bump version
|
||||
|
@ -3989,13 +3989,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, CLAMP (value, adj->lower, adj->upper - adj->page_size));
|
||||
gtk_adjustment_set_value (adj, value);
|
||||
}
|
||||
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, CLAMP (value, 0.0, adj->upper - adj->page_size));
|
||||
gtk_adjustment_set_value (adj, MAX (value, 0.0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -4006,13 +4006,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, CLAMP (value, adj->lower, adj->upper - adj->page_size));
|
||||
gtk_adjustment_set_value (adj, value);
|
||||
}
|
||||
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, CLAMP (value, 0.0, adj->upper - adj->page_size));
|
||||
gtk_adjustment_set_value (adj, MAX (value, 0.0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1356,7 +1356,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, MAX (0, hadjustment->upper - hadjustment->page_size));
|
||||
gtk_adjustment_set_value (hadjustment, hadjustment->upper - hadjustment->page_size);
|
||||
|
||||
vadjustment->page_size = allocation->height;
|
||||
vadjustment->page_increment = allocation->height * 0.9;
|
||||
@ -1365,7 +1365,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, MAX (0, vadjustment->upper - vadjustment->page_size));
|
||||
gtk_adjustment_set_value (vadjustment, vadjustment->upper - vadjustment->page_size);
|
||||
|
||||
if (GTK_WIDGET_REALIZED (widget) &&
|
||||
icon_view->priv->scroll_to_path)
|
||||
@ -1522,17 +1522,11 @@ gtk_icon_view_expose (GtkWidget *widget,
|
||||
static gboolean
|
||||
rubberband_scroll_timeout (gpointer data)
|
||||
{
|
||||
GtkIconView *icon_view;
|
||||
gdouble value;
|
||||
GtkIconView *icon_view = data;
|
||||
|
||||
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_adjustment_set_value (icon_view->priv->vadjustment,
|
||||
icon_view->priv->vadjustment->value +
|
||||
icon_view->priv->scroll_value_diff);
|
||||
|
||||
gtk_icon_view_update_rubberband (icon_view);
|
||||
|
||||
@ -4210,7 +4204,7 @@ gtk_icon_view_scroll_to_path (GtkIconView *icon_view,
|
||||
{
|
||||
gint x, y;
|
||||
gint focus_width;
|
||||
gfloat offset, value;
|
||||
gfloat offset;
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (icon_view),
|
||||
"focus-line-width", &focus_width,
|
||||
@ -4220,17 +4214,15 @@ 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);
|
||||
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);
|
||||
|
||||
gtk_adjustment_set_value (icon_view->priv->vadjustment,
|
||||
icon_view->priv->vadjustment->value + offset);
|
||||
|
||||
offset = x + item->x - focus_width -
|
||||
col_align * (GTK_WIDGET (icon_view)->allocation.width - item->width);
|
||||
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_set_value (icon_view->priv->hadjustment,
|
||||
icon_view->priv->hadjustment->value + offset);
|
||||
|
||||
gtk_adjustment_changed (icon_view->priv->hadjustment);
|
||||
gtk_adjustment_changed (icon_view->priv->vadjustment);
|
||||
@ -6289,7 +6281,6 @@ 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);
|
||||
@ -6304,19 +6295,12 @@ gtk_icon_view_autoscroll (GtkIconView *icon_view)
|
||||
hoffset = MAX (px - (x + width - 2 * SCROLL_EDGE_SIZE), 0);
|
||||
|
||||
if (voffset != 0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
gtk_adjustment_set_value (icon_view->priv->vadjustment,
|
||||
icon_view->priv->vadjustment->value + voffset);
|
||||
|
||||
if (hoffset != 0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
gtk_adjustment_set_value (icon_view->priv->hadjustment,
|
||||
icon_view->priv->hadjustment->value + hoffset);
|
||||
}
|
||||
|
||||
|
||||
|
@ -961,9 +961,6 @@ 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);
|
||||
}
|
||||
@ -988,9 +985,6 @@ 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);
|
||||
}
|
||||
|
||||
|
@ -1127,8 +1127,6 @@ 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;
|
||||
@ -1512,13 +1510,11 @@ gtk_scrolled_window_scroll_event (GtkWidget *widget,
|
||||
if (range && GTK_WIDGET_VISIBLE (range))
|
||||
{
|
||||
GtkAdjustment *adj = GTK_RANGE (range)->adjustment;
|
||||
gdouble delta, new_value;
|
||||
gdouble delta;
|
||||
|
||||
delta = _gtk_range_get_wheel_delta (GTK_RANGE (range), event->direction);
|
||||
|
||||
new_value = CLAMP (adj->value + delta, adj->lower, adj->upper - adj->page_size);
|
||||
|
||||
gtk_adjustment_set_value (adj, new_value);
|
||||
gtk_adjustment_set_value (adj, adj->value + delta);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -3614,7 +3614,6 @@ 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;
|
||||
@ -3630,9 +3629,8 @@ gtk_tree_view_vertical_autoscroll (GtkTreeView *tree_view)
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
gtk_adjustment_set_value (tree_view->priv->vadjustment,
|
||||
MAX (tree_view->priv->vadjustment->value + offset, 0.0));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -3641,7 +3639,6 @@ 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);
|
||||
|
||||
@ -3657,9 +3654,8 @@ gtk_tree_view_horizontal_autoscroll (GtkTreeView *tree_view)
|
||||
}
|
||||
offset = offset/3;
|
||||
|
||||
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);
|
||||
gtk_adjustment_set_value (tree_view->priv->hadjustment,
|
||||
MAX (tree_view->priv->hadjustment->value + offset, 0.0));
|
||||
|
||||
return TRUE;
|
||||
|
||||
@ -8952,11 +8948,7 @@ gtk_tree_view_clamp_column_visible (GtkTreeView *tree_view,
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
gtk_adjustment_set_value (tree_view->priv->hadjustment, x);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -11601,9 +11593,9 @@ gtk_tree_view_scroll_to_point (GtkTreeView *tree_view,
|
||||
vadj = tree_view->priv->vadjustment;
|
||||
|
||||
if (tree_x != -1)
|
||||
gtk_adjustment_set_value (hadj, CLAMP (tree_x, hadj->lower, hadj->upper - hadj->page_size));
|
||||
gtk_adjustment_set_value (hadj, tree_x);
|
||||
if (tree_y != -1)
|
||||
gtk_adjustment_set_value (vadj, CLAMP (tree_y, vadj->lower, vadj->upper - vadj->page_size));
|
||||
gtk_adjustment_set_value (vadj, tree_y);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user