Code

screen_search: check for SEARCH_URI in search_simple_query()
[ncmpc.git] / src / progress_bar.c
index 8fe278468000e799b8e7972b87a64d31efa1b4b4..37a397715847f1c2105728cd8bc0d3d64434bfdd 100644 (file)
@@ -40,13 +40,11 @@ progress_bar_paint(const struct progress_bar *p)
        wnoutrefresh(p->window.w);
 }
 
-bool
-progress_bar_resize(struct progress_bar *p)
+static bool
+progress_bar_calc(struct progress_bar *p)
 {
        unsigned old_width;
 
-       assert(p != NULL);
-
        if (p->max == 0)
                return false;
 
@@ -57,6 +55,18 @@ progress_bar_resize(struct progress_bar *p)
        return p->width != old_width;
 }
 
+void
+progress_bar_resize(struct progress_bar *p, unsigned width, int y, int x)
+{
+       assert(p != NULL);
+
+       p->window.cols = width;
+       wresize(p->window.w, 1, width);
+       mvwin(p->window.w, y, x);
+
+       progress_bar_calc(p);
+}
+
 bool
 progress_bar_set(struct progress_bar *p, unsigned current, unsigned max)
 {
@@ -72,5 +82,5 @@ progress_bar_set(struct progress_bar *p, unsigned current, unsigned max)
        p->max = max;
        p->current = current;
 
-       return progress_bar_resize(p) || modified;
+       return progress_bar_calc(p) || modified;
 }