From ecd88826ac1f0bf3513c23a5ee90ae360422f618 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Tue, 14 Mar 2017 19:16:58 -0700 Subject: overlay: fix heirarchy tee/cap drawing bug If walking ancestors never entered the loop, bar_y isn't set. Set the bar_y once per row, and independent of ancestors. This is obviously more correct and fixes a situation where the siblings have children but there are no ancestors (siblings under the root). Surprisingly this isn't generally observed in vwm, but was noticed in vmon development. --- src/overlay.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/overlay.c') diff --git a/src/overlay.c b/src/overlay.c index 1ff8443..2dc572e 100644 --- a/src/overlay.c +++ b/src/overlay.c @@ -347,7 +347,7 @@ static void draw_heirarchy_row(vwm_t *vwm, vwm_xwindow_t *xwin, vmon_proc_t *pro vmon_proc_t *ancestor, *sibling, *last_sibling = NULL; struct list_head *rem; int needs_tee = 0; - int bar_x = 0, bar_y = 0; + int bar_x = 0, bar_y = (row + 1) * OVERLAY_ROW_HEIGHT; int sub; /* XXX: everything done in this code block only dirties _this_ process' row in the rendered overlay output */ @@ -357,7 +357,6 @@ static void draw_heirarchy_row(vwm_t *vwm, vwm_xwindow_t *xwin, vmon_proc_t *pro for (sub = 1, ancestor = proc->parent; ancestor && ancestor != xwin->monitor; ancestor = ancestor->parent) { sub++; bar_x = (depth - sub) * (OVERLAY_ROW_HEIGHT / 2) + 4; - bar_y = (row + 1) * OVERLAY_ROW_HEIGHT; /* determine if the ancestor has remaining siblings which are not stale, if so, draw a connecting bar at its depth */ for (rem = ancestor->siblings.next; rem != &ancestor->parent->children; rem = rem->next) { -- cgit v1.2.3