more layout fixing. make the grills smaller. don't add arbirary padding on the left...
authorDana Jansens <danakj@orodu.net>
Mon, 11 Jun 2007 04:11:11 +0000 (04:11 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 11 Jun 2007 04:11:11 +0000 (04:11 +0000)
use any extra pixels up in the last task (with size limiting)

dims.h
gui.c

diff --git a/dims.h b/dims.h
index e043b1e..4210cc1 100644 (file)
--- a/dims.h
+++ b/dims.h
@@ -3,6 +3,6 @@
 
 /* don't edit these */
 #define TEXTPAD 6
-#define GRILL_WIDTH 10
+#define GRILL_WIDTH 4
 
 #endif
diff --git a/gui.c b/gui.c
index bb0e513..a1655e6 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -290,7 +290,7 @@ void gui_draw_taskbar(screen *sc, taskbar *tb)
 #ifdef PAGER
     pager_draw();
 #else
-    pager_size = TEXTPAD;
+    pager_size = GRILL_WIDTH;
 #endif
 
     ow = tb->draww;
@@ -302,7 +302,7 @@ void gui_draw_taskbar(screen *sc, taskbar *tb)
                       (tb->at_top ? -sc->theme->obwidth : 0),
                       tb->draww, tb->drawh);
 
-    x = pager_size + 2;
+    x = pager_size;
     width = tb->draww - (pager_size + GRILL_WIDTH);
 
     /* only re-render if the size has changed */
@@ -326,17 +326,19 @@ void gui_draw_taskbar(screen *sc, taskbar *tb)
         goto clear;
 
     taskw = width / num_tasks;
-    if (taskw > MAX_TASK_WIDTH)
-        taskw = MAX_TASK_WIDTH;
 
     for (tk = tb->task_list; tk; tk = tk->next) {
         if (!task_shown(tk))
             continue;
         tk->pos_x = x;
-        tk->width = taskw;
+        /* use up extra pixels in the last task */
+        if (!tk->next)
+            tk->width = MIN(width - x, MAX_TASK_WIDTH);
+        else
+            tk->width = MIN(taskw, MAX_TASK_WIDTH);
         gui_draw_task(sc, tb, tk, FALSE);
         set_icon_geometry(sc, tb, tk);
-        x += taskw;
+        x += tk->width;
     }
 
 clear: