Prevent a possible warning

When doing updates, gtk_progress_bar_real_update can calculate
compute a negative value for activity_pos.

If the allocation width is smaller than (xthickness + size),
pbar->activity_pos will be set to a negative value and this will
cause the drawing code to emit a warning about coordinates being
out of bounds.

Prevent this by keeping the value at least 0.

https://bugzilla.gnome.org/show_bug.cgi?id=701751
This commit is contained in:
Matthias Clasen 2013-11-09 23:51:50 -05:00
parent 280fc402be
commit e09719b12d

View File

@ -463,8 +463,8 @@ gtk_progress_bar_real_update (GtkProgress *progress)
widget->allocation.width -
widget->style->xthickness)
{
pbar->activity_pos = widget->allocation.width -
widget->style->xthickness - size;
pbar->activity_pos = MAX (0, widget->allocation.width -
widget->style->xthickness - size);
pbar->activity_dir = 1;
}
}
@ -493,8 +493,8 @@ gtk_progress_bar_real_update (GtkProgress *progress)
widget->allocation.height -
widget->style->ythickness)
{
pbar->activity_pos = widget->allocation.height -
widget->style->ythickness - size;
pbar->activity_pos = MAX (0, widget->allocation.height -
widget->style->ythickness - size);
pbar->activity_dir = 1;
}
}