[gtk+/gtk-2-24] Prevent a possible warning



commit e09719b12d034568bbb50b7e6aaff78138d6b58c
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Nov 9 23:51:50 2013 -0500

    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

 gtk/gtkprogressbar.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c
index a21e762..bd8933d 100644
--- a/gtk/gtkprogressbar.c
+++ b/gtk/gtkprogressbar.c
@@ -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;
                    }
                }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]