diff options
author | Vito Caputo <vcaputo@gnugeneration.com> | 2016-09-08 10:27:29 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@gnugeneration.com> | 2016-09-09 14:17:08 -0700 |
commit | 7a5e600e8f67f6fa170d3bd27de7e28150c2dca5 (patch) | |
tree | 733ece0d586adab2dc266d3d099261d79efadc8f /src/overlay.c | |
parent | 7f8473326aaff2381f9ed012f6fb54b2691526f1 (diff) |
overlay: introduce overlay.redraw_needed
Set on window resize, clear on draw_overlay() return.
Used in combination with sample_interval check to gate HZ redraw.
Will be used to gate redraw of process monitors heirarchy as well,
in a subsequent commit.
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; |