diff options
Diffstat (limited to 'src/overlay.c')
-rw-r--r-- | src/overlay.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/overlay.c b/src/overlay.c index e223d08..d53a864 100644 --- a/src/overlay.c +++ b/src/overlay.c @@ -542,13 +542,9 @@ static void draw_overlay(vwm_t *vwm, vwm_xwindow_t *xwin, vmon_proc_t *proc, int /* IOWait and Idle % @ row 0 */ draw_bars(vwm, xwin, *row, iowait_delta, total_delta, idle_delta, total_delta); - /* here's where the Idle/IOWait row drawing concludes */ - if (1 /* FIXME TODO compositing_mode*/) { + /* only draw the \/\/\ and HZ if necessary */ + if (xwin->overlay.redraw_needed || prev_sampling_interval != sampling_interval) { snprintf(str, sizeof(str), "\\/\\/\\ %2iHz %n", (int)(sampling_interval < 0 ? 0 : 1 / sampling_intervals[sampling_interval]), &str_len); - /* TODO: I clear and redraw this row every time, which is unnecessary, small optimization would be to only do so when: - * - overlay resized, and then constrain the clear to the affected width - * - Hz changed - */ XRenderFillRectangle(vwm->display, PictOpSrc, xwin->overlay.text_picture, &overlay_trans_color, 0, 0, /* dst x, y */ xwin->attrs.width, OVERLAY_ROW_HEIGHT); /* dst w, h */ @@ -562,6 +558,8 @@ static void draw_overlay(vwm_t *vwm, vwm_xwindow_t *xwin, vmon_proc_t *proc, int draw_overlay_rest(vwm, xwin, proc, depth, row); + xwin->overlay.redraw_needed = 0; + return; } @@ -585,6 +583,8 @@ static void maintain_overlay(vwm_t *vwm, vwm_xwindow_t *xwin) * For now, the monitors will just be a little latent in window resizes which is pretty harmless artifact. */ + if (xwin->attrs.width != xwin->overlay.width || xwin->attrs.height != xwin->overlay.height) xwin->overlay.redraw_needed = 1; + /* if the window is larger than the overlays currently are, enlarge them */ if (xwin->attrs.width > xwin->overlay.width || xwin->attrs.height > xwin->overlay.height) { vwm_overlay_t existing; |