Commit 2e951f57 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Don't queue a draw if the layout has not changed. (#313991, Benjamin Berg)

2005-08-20  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkrange.c (gtk_range_adjustment_changed)
	(gtk_range_adjustment_value_changed):  Don't queue a draw
	if the layout has not changed.  (#313991, Benjamin Berg)
parent 4e5fe40c
2005-08-20 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkrange.c (gtk_range_adjustment_changed)
(gtk_range_adjustment_value_changed): Don't queue a draw
if the layout has not changed. (#313991, Benjamin Berg)
2005-08-19 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktreeitem.c: Remove duplicate lines. (#313344,
......
2005-08-20 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkrange.c (gtk_range_adjustment_changed)
(gtk_range_adjustment_value_changed): Don't queue a draw
if the layout has not changed. (#313991, Benjamin Berg)
2005-08-19 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktreeitem.c: Remove duplicate lines. (#313344,
......
2005-08-20 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkrange.c (gtk_range_adjustment_changed)
(gtk_range_adjustment_value_changed): Don't queue a draw
if the layout has not changed. (#313991, Benjamin Berg)
2005-08-19 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktreeitem.c: Remove duplicate lines. (#313344,
......
......@@ -1564,14 +1564,42 @@ gtk_range_state_changed (GtkWidget *widget,
stop_scrolling (GTK_RANGE (widget));
}
#define check_rectangle(rectangle1, rectangle2) \
{ \
if (rectangle1.x != rectangle2.x) return TRUE; \
if (rectangle1.y != rectangle2.y) return TRUE; \
if (rectangle1.width != rectangle2.width) return TRUE; \
if (rectangle1.height != rectangle2.height) return TRUE; \
}
static gboolean
layout_changed (GtkRangeLayout *layout1,
GtkRangeLayout *layout2)
{
check_rectangle (layout1->slider, layout2->slider);
check_rectangle (layout1->trough, layout2->trough);
check_rectangle (range->layout1->stepper_a, layout2->stepper_a);
check_rectangle (range->layout1->stepper_d, layout2->stepper_d);
check_rectangle (range->layout1->stepper_b, layout2->stepper_b);
check_rectangle (range->layout1->stepper_c, layout2->stepper_c);
return FALSE;
}
static void
gtk_range_adjustment_changed (GtkAdjustment *adjustment,
gpointer data)
{
GtkRange *range = GTK_RANGE (data);
/* create a copy of the layout */
GtkRangeLayout layout = *range->layout;
range->need_recalc = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (range));
gtk_range_calc_layout (range, range->adjustment->value);
/* now check whether the layout changed */
if (layout_changed (range->layout, &layout))
gtk_widget_queue_draw (GTK_WIDGET (range));
/* Note that we don't round off to range->round_digits here.
* that's because it's really broken to change a value
......@@ -1587,13 +1615,21 @@ gtk_range_adjustment_value_changed (GtkAdjustment *adjustment,
gpointer data)
{
GtkRange *range = GTK_RANGE (data);
/* create a copy of the layout */
GtkRangeLayout layout = *range->layout;
range->need_recalc = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (range));
/* This is so we don't lag the widget being scrolled. */
if (GTK_WIDGET_REALIZED (range))
gdk_window_process_updates (GTK_WIDGET (range)->window, FALSE);
gtk_range_calc_layout (range, range->adjustment->value);
/* now check whether the layout changed */
if (layout_changed (range->layout, &layout))
{
gtk_widget_queue_draw (GTK_WIDGET (range));
/* This is so we don't lag the widget being scrolled. */
if (GTK_WIDGET_REALIZED (range))
gdk_window_process_updates (GTK_WIDGET (range)->window, FALSE);
}
/* Note that we don't round off to range->round_digits here.
* that's because it's really broken to change a value
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment