summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@gnugeneration.com>2017-03-22 18:36:54 -0700
committerVito Caputo <vcaputo@gnugeneration.com>2017-03-25 16:51:17 -0700
commit36daa7b60f0545a79482d174c778293ec831e03e (patch)
treee5d6b8d93d5ed66db08141c7d24372e808d17d3a /src
parent3657ce966227e9be0334540178ca578bc8d5ad0d (diff)
overlays: rename overlays->charts
vmon introduces a non-overlay usage, monitors is correct but ambiguous, graphs is also amiguous, charts is short and distinctive. renaming of the files comes in a separate, future commit.
Diffstat (limited to 'src')
-rw-r--r--src/composite.c40
-rw-r--r--src/key.c10
-rw-r--r--src/overlays.c798
-rw-r--r--src/overlays.h32
-rw-r--r--src/vmon.c48
-rw-r--r--src/vwm.c18
-rw-r--r--src/vwm.h2
-rw-r--r--src/xevent.c6
-rw-r--r--src/xserver.h2
-rw-r--r--src/xwindow.c14
-rw-r--r--src/xwindow.h4
11 files changed, 487 insertions, 487 deletions
diff --git a/src/composite.c b/src/composite.c
index ad04480..bf9489b 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -32,7 +32,7 @@
/* compositing manager stuff */
typedef enum _vwm_compositing_mode_t {
VWM_COMPOSITING_OFF = 0, /* non-composited, no redirected windows, most efficient */
- VWM_COMPOSITING_MONITORS = 1 /* composited process monitoring overlays, slower but really useful. */
+ VWM_COMPOSITING_MONITORS = 1 /* composited process monitoring charts, slower but really useful. */
} vwm_compositing_mode_t;
static vwm_compositing_mode_t compositing_mode = VWM_COMPOSITING_OFF; /* current compositing mode */
@@ -192,7 +192,7 @@ void vwm_composite_paint_all(vwm_t *vwm)
Region occluded;
static XserverRegion undamage_region = None;
- /* if there's no damage to repaint, short-circuit, this happens when compositing for overlays is disabled. */
+ /* if there's no damage to repaint, short-circuit, this happens when compositing for charts is disabled. */
if (!compositing_mode || (combined_damage == None && !repaint_needed))
return;
@@ -215,7 +215,7 @@ void vwm_composite_paint_all(vwm_t *vwm)
}
occluded = XCreateRegion();
- /* compose overlays for all visible windows up front in a separate pass (kind of lame, but it's simpler since compose_overlay() adds to combined_damage) */
+ /* compose charts for all visible windows up front in a separate pass (kind of lame, but it's simpler since compose_chart() adds to combined_damage) */
list_for_each_entry_prev(xwin, &vwm->xwindows, xwindows) {
XRectangle r;
@@ -226,15 +226,15 @@ void vwm_composite_paint_all(vwm_t *vwm)
* Since the composite extension stops delivery of VisibilityNotify events for redirected windows,
* (it assumes redirected windows should be treated as part of a potentially transparent composite, and provides no api to alter this assumption)
* we can't simply select the VisibilityNotify events on all windows and cache their visibility state in vwm_xwindow_t then skip
- * xwin->state==VisibilityFullyObscured windows here to avoid the cost of pointlessly composing overlays and rendering fully obscured windows :(.
+ * xwin->state==VisibilityFullyObscured windows here to avoid the cost of pointlessly composing charts and rendering fully obscured windows :(.
*
* Instead we accumulate an occluded region (starting empty) of painted windows from the top-down on every paint_all().
- * Before we compose_overlay() a window, we check if the window's rectangle fits entirely within the occluded region.
- * If it does, no compose_overlay() is performed.
- * If it doesn't, compose_overlay() is called, and the window's rect is added to the occluded region.
+ * Before we compose_chart() a window, we check if the window's rectangle fits entirely within the occluded region.
+ * If it does, no compose_chart() is performed.
+ * If it doesn't, compose_chart() is called, and the window's rect is added to the occluded region.
* The occluded knowledge is also cached for the XRenderComposite() loop immediately following, where we skip the rendering of
* occluded windows as well.
- * This does technically break SHAPE windows (xeyes, xmms), but only when monitoring is enabled which covers them with rectangular overlays anyways.
+ * This does technically break SHAPE windows (xeyes, xmms), but only when monitoring is enabled which covers them with rectangular charts anyways.
*/
r.x = xwin->attrs.x;
r.y = xwin->attrs.y;
@@ -242,23 +242,23 @@ void vwm_composite_paint_all(vwm_t *vwm)
r.height = xwin->attrs.height + xwin->attrs.border_width * 2;
if (XRectInRegion(occluded, r.x, r.y, r.width, r.height) != RectangleIn) {
/* the window isn't fully occluded, compose it and add it to occluded */
- if (xwin->overlay) {
- XserverRegion overlay_damage = None;
+ if (xwin->chart) {
+ XserverRegion chart_damage = None;
- vwm_overlay_compose(vwm->overlays, xwin->overlay, &overlay_damage);
- if (overlay_damage != None) {
- /* the damage region is in overlay coordinate space, translation necessary. */
- XFixesTranslateRegion(VWM_XDISPLAY(vwm), overlay_damage,
+ vwm_chart_compose(vwm->charts, xwin->chart, &chart_damage);
+ if (chart_damage != None) {
+ /* the damage region is in chart coordinate space, translation necessary. */
+ XFixesTranslateRegion(VWM_XDISPLAY(vwm), chart_damage,
xwin->attrs.x + xwin->attrs.border_width,
xwin->attrs.y + xwin->attrs.border_width);
- vwm_composite_damage_add(vwm, overlay_damage);
+ vwm_composite_damage_add(vwm, chart_damage);
}
}
XUnionRectWithRegion(&r, occluded, occluded);
xwin->occluded = 0;
} else {
xwin->occluded = 1;
- VWM_TRACE("window %#x occluded, skipping compose_overlay()", (int)xwin->id);
+ VWM_TRACE("window %#x occluded, skipping compose_chart()", (int)xwin->id);
}
}
XDestroyRegion(occluded);
@@ -286,9 +286,9 @@ void vwm_composite_paint_all(vwm_t *vwm)
r.x, r.y, /* dst x, y */
r.width, r.height);
- if (xwin->overlay) {
- /* draw the monitoring overlay atop the window, note we stay within the window borders here. */
- vwm_overlay_render(vwm->overlays, xwin->overlay, PictOpOver, root_buffer,
+ if (xwin->chart) {
+ /* draw the monitoring chart atop the window, note we stay within the window borders here. */
+ vwm_chart_render(vwm->charts, xwin->chart, PictOpOver, root_buffer,
xwin->attrs.x + xwin->attrs.border_width,
xwin->attrs.y + xwin->attrs.border_width,
xwin->attrs.width,
@@ -315,7 +315,7 @@ void vwm_composite_paint_all(vwm_t *vwm)
}
-/* toggle compositing/monitoring overlays on/off */
+/* toggle compositing/monitoring charts on/off */
void vwm_composite_toggle(vwm_t *vwm)
{
vwm_xwindow_t *xwin;
diff --git a/src/key.c b/src/key.c
index ae72882..e795a93 100644
--- a/src/key.c
+++ b/src/key.c
@@ -343,23 +343,23 @@ void vwm_key_pressed(vwm_t *vwm, Window win, XKeyPressedEvent *keypress)
}
break;
- case XK_semicolon: /* toggle composited overlays */
+ case XK_semicolon: /* toggle composited charts */
vwm_composite_toggle(vwm);
break;
case XK_apostrophe: /* reset snowflakes of the focused window */
- if (vwin && vwin->xwindow->overlay) {
- vwm_overlay_reset_snowflakes(vwm->overlays, vwin->xwindow->overlay);
+ if (vwin && vwin->xwindow->chart) {
+ vwm_chart_reset_snowflakes(vwm->charts, vwin->xwindow->chart);
vwm_composite_damage_win(vwm, vwin->xwindow);
}
break;
case XK_Right: /* increase sampling frequency */
- vwm_overlays_rate_increase(vwm->overlays);
+ vwm_charts_rate_increase(vwm->charts);
break;
case XK_Left: /* decrease sampling frequency */
- vwm_overlays_rate_decrease(vwm->overlays);
+ vwm_charts_rate_decrease(vwm->charts);
break;
default:
diff --git a/src/overlays.c b/src/overlays.c
index 3edda0b..01d9fe1 100644
--- a/src/overlays.c
+++ b/src/overlays.c
@@ -34,20 +34,20 @@
#include "vwm.h"
#include "xwindow.h"
-#define OVERLAY_MASK_DEPTH 8 /* XXX: 1 would save memory, but Xorg isn't good at it */
-#define OVERLAY_FIXED_FONT "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1"
-#define OVERLAY_ROW_HEIGHT 15 /* this should always be larger than the font height */
-#define OVERLAY_GRAPH_MIN_WIDTH 200 /* always create graphs at least this large */
-#define OVERLAY_GRAPH_MIN_HEIGHT (4 * OVERLAY_ROW_HEIGHT)
-#define OVERLAY_ISTHREAD_ARGV "~" /* use this string to mark threads in the argv field */
-#define OVERLAY_NOCOMM_ARGV "#missed it!" /* use this string to substitute the command when missing in argv field */
-#define OVERLAY_MAX_ARGC 512 /* this is a huge amount */
-#define OVERLAY_VMON_PROC_WANTS (VMON_WANT_PROC_STAT | VMON_WANT_PROC_FOLLOW_CHILDREN | VMON_WANT_PROC_FOLLOW_THREADS)
-#define OVERLAY_VMON_SYS_WANTS (VMON_WANT_SYS_STAT)
-
-/* the global overlays state, supplied to vwm_overlay_create() which keeps a reference for future use. */
-typedef struct _vwm_overlays_t {
- vwm_xserver_t *xserver; /* xserver supplied to vwm_overlays_init() */
+#define CHART_MASK_DEPTH 8 /* XXX: 1 would save memory, but Xorg isn't good at it */
+#define CHART_FIXED_FONT "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1"
+#define CHART_ROW_HEIGHT 15 /* this should always be larger than the font height */
+#define CHART_GRAPH_MIN_WIDTH 200 /* always create graphs at least this large */
+#define CHART_GRAPH_MIN_HEIGHT (4 * CHART_ROW_HEIGHT)
+#define CHART_ISTHREAD_ARGV "~" /* use this string to mark threads in the argv field */
+#define CHART_NOCOMM_ARGV "#missed it!" /* use this string to substitute the command when missing in argv field */
+#define CHART_MAX_ARGC 512 /* this is a huge amount */
+#define CHART_VMON_PROC_WANTS (VMON_WANT_PROC_STAT | VMON_WANT_PROC_FOLLOW_CHILDREN | VMON_WANT_PROC_FOLLOW_THREADS)
+#define CHART_VMON_SYS_WANTS (VMON_WANT_SYS_STAT)
+
+/* the global charts state, supplied to vwm_chart_create() which keeps a reference for future use. */
+typedef struct _vwm_charts_t {
+ vwm_xserver_t *xserver; /* xserver supplied to vwm_charts_init() */
/* libvmon */
struct timeval maybe_sample, last_sample, this_sample;
@@ -60,7 +60,7 @@ typedef struct _vwm_overlays_t {
int sampling_paused, contiguous_drops;
/* X */
- XFontStruct *overlay_font;
+ XFontStruct *chart_font;
GC text_gc;
Picture shadow_fill,
text_fill,
@@ -69,28 +69,28 @@ typedef struct _vwm_overlays_t {
grapha_fill,
graphb_fill,
finish_fill;
-} vwm_overlays_t;
+} vwm_charts_t;
-/* everything needed by the per-window overlay's context */
-typedef struct _vwm_overlay_t {
+/* everything needed by the per-window chart's context */
+typedef struct _vwm_chart_t {
vmon_proc_t *monitor; /* vmon process monitor handle */
- Pixmap text_pixmap; /* pixmap for overlayed text (kept around for XDrawText usage) */
+ Pixmap text_pixmap; /* pixmap for charted text (kept around for XDrawText usage) */
Picture text_picture; /* picture representation of text_pixmap */
Picture shadow_picture; /* text shadow layer */
Picture grapha_picture; /* graph A layer */
Picture graphb_picture; /* graph B layer */
Picture tmp_picture; /* 1 row worth of temporary picture space */
- Picture picture; /* overlay picture derived from the pixmap, for render compositing */
- int width; /* current width of the overlay */
- int height; /* current height of the overlay */
- int visible_width; /* currently visible width of the overlay */
- int visible_height; /* currently visible height of the overlay */
+ Picture picture; /* chart picture derived from the pixmap, for render compositing */
+ int width; /* current width of the chart */
+ int height; /* current height of the chart */
+ int visible_width; /* currently visible width of the chart */
+ int visible_height; /* currently visible height of the chart */
int phase; /* current position within the (horizontally scrolling) graphs */
int heirarchy_end; /* row where the process heirarchy currently ends */
int snowflakes_cnt; /* count of snowflaked rows (reset to zero to truncate snowflakes display) */
int gen_last_composed; /* the last composed vmon generation */
int redraw_needed; /* if a redraw is required (like when the window is resized...) */
-} vwm_overlay_t;
+} vwm_chart_t;
/* space we need for every process being monitored */
typedef struct _vwm_perproc_ctxt_t {
@@ -110,14 +110,14 @@ static float sampling_intervals[] = {
.025, /* ~40Hz */
.01666}; /* ~60Hz */
-static XRenderColor overlay_visible_color = { 0xffff, 0xffff, 0xffff, 0xffff },
- overlay_shadow_color = { 0x0000, 0x0000, 0x0000, 0x8800},
- overlay_bg_color = { 0x0, 0x1000, 0x0, 0x9000},
- overlay_div_color = { 0x2000, 0x3000, 0x2000, 0x9000},
- overlay_snowflakes_visible_color = { 0xd000, 0xd000, 0xd000, 0x8000 },
- overlay_trans_color = {0x00, 0x00, 0x00, 0x00},
- overlay_grapha_color = { 0xff00, 0x0000, 0x0000, 0x3000 }, /* ~red */
- overlay_graphb_color = { 0x0000, 0xffff, 0xffff, 0x3000 }; /* ~cyan */
+static XRenderColor chart_visible_color = { 0xffff, 0xffff, 0xffff, 0xffff },
+ chart_shadow_color = { 0x0000, 0x0000, 0x0000, 0x8800},
+ chart_bg_color = { 0x0, 0x1000, 0x0, 0x9000},
+ chart_div_color = { 0x2000, 0x3000, 0x2000, 0x9000},
+ chart_snowflakes_visible_color = { 0xd000, 0xd000, 0xd000, 0x8000 },
+ chart_trans_color = {0x00, 0x00, 0x00, 0x00},
+ chart_grapha_color = { 0xff00, 0x0000, 0x0000, 0x3000 }, /* ~red */
+ chart_graphb_color = { 0x0000, 0xffff, 0xffff, 0x3000 }; /* ~cyan */
static XRenderPictureAttributes pa_repeat = { .repeat = 1 };
static XRenderPictureAttributes pa_no_repeat = { .repeat = 0 };
@@ -125,16 +125,16 @@ static XRenderPictureAttributes pa_no_repeat = { .repeat = 0 };
/* this callback gets invoked at sample time once "per sys" */
static void sample_callback(vmon_t *vmon, void *arg)
{
- vwm_overlays_t *overlays = arg;
+ vwm_charts_t *charts = arg;
vmon_sys_stat_t *sys_stat = vmon->stores[VMON_STORE_SYS_STAT];
- overlays->this_total = sys_stat->user + sys_stat->nice + sys_stat->system +
+ charts->this_total = sys_stat->user + sys_stat->nice + sys_stat->system +
sys_stat->idle + sys_stat->iowait + sys_stat->irq +
sys_stat->softirq + sys_stat->steal + sys_stat->guest;
- overlays->total_delta = overlays->this_total - overlays->last_total;
- overlays->idle_delta = sys_stat->idle - overlays->last_idle;
- overlays->iowait_delta = sys_stat->iowait - overlays->last_iowait;
+ charts->total_delta = charts->this_total - charts->last_total;
+ charts->idle_delta = sys_stat->idle - charts->last_idle;
+ charts->iowait_delta = sys_stat->iowait - charts->last_iowait;
}
@@ -157,18 +157,18 @@ static void vmon_dtor_cb(vmon_t *vmon, vmon_proc_t *proc)
/* convenience helper for creating a pixmap */
-static Pixmap create_pixmap(vwm_overlays_t *overlays, unsigned width, unsigned height, unsigned depth)
+static Pixmap create_pixmap(vwm_charts_t *charts, unsigned width, unsigned height, unsigned depth)
{
- vwm_xserver_t *xserver = overlays->xserver;
+ vwm_xserver_t *xserver = charts->xserver;
return XCreatePixmap(xserver->display, XSERVER_XROOT(xserver), width, height, depth);
}
/* convenience helper for creating a picture, supply res_pixmap to keep a reference to the pixmap drawable. */
-static Picture create_picture(vwm_overlays_t *overlays, unsigned width, unsigned height, unsigned depth, unsigned long attr_mask, XRenderPictureAttributes *attr, Pixmap *res_pixmap)
+static Picture create_picture(vwm_charts_t *charts, unsigned width, unsigned height, unsigned depth, unsigned long attr_mask, XRenderPictureAttributes *attr, Pixmap *res_pixmap)
{
- vwm_xserver_t *xserver = overlays->xserver;
+ vwm_xserver_t *xserver = charts->xserver;
Pixmap pixmap;
Picture picture;
int format;
@@ -185,7 +185,7 @@ static Picture create_picture(vwm_overlays_t *overlays, unsigned width, unsigned
assert(0);
}
- pixmap = create_pixmap(overlays, width, height, depth);
+ pixmap = create_pixmap(charts, width, height, depth);
picture = XRenderCreatePicture(xserver->display, pixmap, XRenderFindStandardFormat(xserver->display, format), attr_mask, attr);
if (res_pixmap) {
@@ -199,143 +199,143 @@ static Picture create_picture(vwm_overlays_t *overlays, unsigned width, unsigned
/* convenience helper for creating a filled picture, supply res_pixmap to keep a reference to the pixmap drawable. */
-static Picture create_picture_fill(vwm_overlays_t *overlays, unsigned width, unsigned height, unsigned depth, unsigned long attrs_mask, XRenderPictureAttributes *attrs, XRenderColor *color, Pixmap *res_pixmap)
+static Picture create_picture_fill(vwm_charts_t *charts, unsigned width, unsigned height, unsigned depth, unsigned long attrs_mask, XRenderPictureAttributes *attrs, XRenderColor *color, Pixmap *res_pixmap)
{
- vwm_xserver_t *xserver = overlays->xserver;
+ vwm_xserver_t *xserver = charts->xserver;
Picture picture;
- picture = create_picture(overlays, width, height, depth, attrs_mask, attrs, res_pixmap);
+ picture = create_picture(charts, width, height, depth, attrs_mask, attrs, res_pixmap);
XRenderFillRectangle(xserver->display, PictOpSrc, picture, color, 0, 0, width, height);
return picture;
}
-/* initialize overlays system */
-vwm_overlays_t * vwm_overlays_create(vwm_xserver_t *xserver)
+/* initialize charts system */
+vwm_charts_t * vwm_charts_create(vwm_xserver_t *xserver)
{
- vwm_overlays_t *overlays;
+ vwm_charts_t *charts;
Pixmap bitmask;
- overlays = calloc(1, sizeof(vwm_overlays_t));
- if (!overlays) {
- VWM_PERROR("unable to allocate vwm_overlays_t");
+ charts = calloc(1, sizeof(vwm_charts_t));
+ if (!charts) {
+ VWM_PERROR("unable to allocate vwm_charts_t");
goto _err;
}
- overlays->xserver = xserver;
- overlays->prev_sampling_interval = overlays->sampling_interval = 0.1f; /* default to 10Hz */
+ charts->xserver = xserver;
+ charts->prev_sampling_interval = charts->sampling_interval = 0.1f; /* default to 10Hz */
- if (!vmon_init(&overlays->vmon, VMON_FLAG_2PASS, OVERLAY_VMON_SYS_WANTS, OVERLAY_VMON_PROC_WANTS)) {
+ if (!vmon_init(&charts->vmon, VMON_FLAG_2PASS, CHART_VMON_SYS_WANTS, CHART_VMON_PROC_WANTS)) {
VWM_ERROR("unable to initialize libvmon");
- goto _err_overlays;
+ goto _err_charts;
}
- overlays->vmon.proc_ctor_cb = vmon_ctor_cb;
- overlays->vmon.proc_dtor_cb = vmon_dtor_cb;
- overlays->vmon.sample_cb = sample_callback;
- overlays->vmon.sample_cb_arg = overlays;
- gettimeofday(&overlays->this_sample, NULL);
+ charts->vmon.proc_ctor_cb = vmon_ctor_cb;
+ charts->vmon.proc_dtor_cb = vmon_dtor_cb;
+ charts->vmon.sample_cb = sample_callback;
+ charts->vmon.sample_cb_arg = charts;
+ gettimeofday(&charts->this_sample, NULL);
- /* get all the text and graphics stuff setup for overlays */
- overlays->overlay_font = XLoadQueryFont(xserver->display, OVERLAY_FIXED_FONT);
- if (!overlays->overlay_font) {
- VWM_ERROR("unable to load overlay font \"%s\"", OVERLAY_FIXED_FONT);
+ /* get all the text and graphics stuff setup for charts */
+ charts->chart_font = XLoadQueryFont(xserver->display, CHART_FIXED_FONT);
+ if (!charts->chart_font) {
+ VWM_ERROR("unable to load chart font \"%s\"", CHART_FIXED_FONT);
goto _err_vmon;
}
- /* create a GC for rendering the text using Xlib into the text overlay stencils */
- bitmask = create_pixmap(overlays, 1, 1, OVERLAY_MASK_DEPTH);
- overlays->text_gc = XCreateGC(xserver->display, bitmask, 0, NULL);
- XSetForeground(xserver->display, overlays->text_gc, WhitePixel(xserver->display, xserver->screen_num));
+ /* create a GC for rendering the text using Xlib into the text chart stencils */
+ bitmask = create_pixmap(charts, 1, 1, CHART_MASK_DEPTH);
+ charts->text_gc = XCreateGC(xserver->display, bitmask, 0, NULL);
+ XSetForeground(xserver->display, charts->text_gc, WhitePixel(xserver->display, xserver->screen_num));
XFreePixmap(xserver->display, bitmask);
/* create some repeating source fill pictures for drawing through the text and graph stencils */
- overlays->text_fill = create_picture_fill(overlays, 1, 1, 32, CPRepeat, &pa_repeat, &overlay_visible_color, NULL);
- overlays->shadow_fill = create_picture_fill(overlays, 1, 1, 32, CPRepeat, &pa_repeat, &overlay_shadow_color, NULL);
+ charts->text_fill = create_picture_fill(charts, 1, 1, 32, CPRepeat, &pa_repeat, &chart_visible_color, NULL);
+ charts->shadow_fill = create_picture_fill(charts, 1, 1, 32, CPRepeat, &pa_repeat, &chart_shadow_color, NULL);
- overlays->bg_fill = create_picture(overlays, 1, OVERLAY_ROW_HEIGHT, 32, CPRepeat, &pa_repeat, NULL);
- XRenderFillRectangle(xserver->display, PictOpSrc, overlays->bg_fill, &overlay_bg_color, 0, 0, 1, OVERLAY_ROW_HEIGHT);
- XRenderFillRectangle(xserver->display, PictOpSrc, overlays->bg_fill, &overlay_div_color, 0, OVERLAY_ROW_HEIGHT - 1, 1, 1);
+ charts->bg_fill = create_picture(charts, 1, CHART_ROW_HEIGHT, 32, CPRepeat, &pa_repeat, NULL);
+ XRenderFillRectangle(xserver->display, PictOpSrc, charts->bg_fill, &chart_bg_color, 0, 0, 1, CHART_ROW_HEIGHT);
+ XRenderFillRectangle(xserver->display, PictOpSrc, charts->bg_fill, &chart_div_color, 0, CHART_ROW_HEIGHT - 1, 1, 1);
- overlays->snowflakes_text_fill = create_picture_fill(overlays, 1, 1, 32, CPRepeat, &pa_repeat, &overlay_snowflakes_visible_color, NULL);
- overlays->grapha_fill = create_picture_fill(overlays, 1, 1, 32, CPRepeat, &pa_repeat, &overlay_grapha_color, NULL);
- overlays->graphb_fill = create_picture_fill(overlays, 1, 1, 32, CPRepeat, &pa_repeat, &overlay_graphb_color, NULL);
+ charts->snowflakes_text_fill = create_picture_fill(charts, 1, 1, 32, CPRepeat, &pa_repeat, &chart_snowflakes_visible_color, NULL);
+ charts->grapha_fill = create_picture_fill(charts, 1, 1, 32, CPRepeat, &pa_repeat, &chart_grapha_color, NULL);
+ charts->graphb_fill = create_picture_fill(charts, 1, 1, 32, CPRepeat, &pa_repeat, &chart_graphb_color, NULL);
- overlays->finish_fill = create_picture(overlays, 1, 2, 32, CPRepeat, &pa_repeat, NULL);
- XRenderFillRectangle(xserver->display, PictOpSrc, overlays->finish_fill, &overlay_visible_color, 0, 0, 1, 1);
- XRenderFillRectangle(xserver->display, PictOpSrc, overlays->finish_fill, &overlay_trans_color, 0, 1, 1, 1);
+ charts->finish_fill = create_picture(charts, 1, 2, 32, CPRepeat, &pa_repeat, NULL);
+ XRenderFillRectangle(xserver->display, PictOpSrc, charts->finish_fill, &chart_visible_color, 0, 0, 1, 1);
+ XRenderFillRectangle(xserver->display, PictOpSrc, charts->finish_fill, &chart_trans_color, 0, 1, 1, 1);
- return overlays;
+ return charts;
_err_vmon:
- vmon_destroy(&overlays->vmon);
+ vmon_destroy(&charts->vmon);
-_err_overlays:
- free(overlays);
+_err_charts:
+ free(charts);
_err:
return NULL;
}
-/* teardown overlays system */
-void vwm_overlays_destroy(vwm_overlays_t *overlays)
+/* teardown charts system */
+void vwm_charts_destroy(vwm_charts_t *charts)
{
/* TODO: free rest of stuff.. */
- free(overlays);
+ free(charts);
}
/* copies a row from src to dest */
-static void copy_row(vwm_overlays_t *overlays, vwm_overlay_t *overlay, int src_row, Picture src, int dest_row, Picture dest)
+static void copy_row(vwm_charts_t *charts, vwm_chart_t *chart, int src_row, Picture src, int dest_row, Picture dest)
{
- XRenderComposite(overlays->xserver->display, PictOpSrc, src, None, dest,
- 0, src_row * OVERLAY_ROW_HEIGHT, /* src */
+ XRenderComposite(charts->xserver->display, PictOpSrc, src, None, dest,
+ 0, src_row * CHART_ROW_HEIGHT, /* src */
0, 0, /* mask */
- 0, dest_row * OVERLAY_ROW_HEIGHT, /* dest */
- overlay->width, OVERLAY_ROW_HEIGHT); /* dimensions */
+ 0, dest_row * CHART_ROW_HEIGHT, /* dest */
+ chart->width, CHART_ROW_HEIGHT); /* dimensions */
}
/* fills a row with the specified color */
-static void fill_row(vwm_overlays_t *overlays, vwm_overlay_t *overlay, int row, Picture pic, XRenderColor *color)
+static void fill_row(vwm_charts_t *charts, vwm_chart_t *chart, int row, Picture pic, XRenderColor *color)
{
- XRenderFillRectangle(overlays->xserver->display, PictOpSrc, pic, color,
- 0, row * OVERLAY_ROW_HEIGHT, /* dest */
- overlay->width, OVERLAY_ROW_HEIGHT); /* dimensions */
+ XRenderFillRectangle(charts->xserver->display, PictOpSrc, pic, color,
+ 0, row * CHART_ROW_HEIGHT, /* dest */
+ chart->width, CHART_ROW_HEIGHT); /* dimensions */
}
/* copy what's below a given row up the specified amount within the same picture */
-static void shift_below_row_up(vwm_overlays_t *overlays, vwm_overlay_t *overlay, int row, Picture pic, int rows)
+static void shift_below_row_up(vwm_charts_t *charts, vwm_chart_t *chart, int row, Picture pic, int rows)
{
- vwm_xserver_t *xserver = overlays->xserver;
+ vwm_xserver_t *xserver = charts->xserver;
XRenderChangePicture(xserver->display, pic, CPRepeat, &pa_no_repeat);
XRenderComposite(xserver->display, PictOpSrc, pic, None, pic,
- 0, (rows + row) * OVERLAY_ROW_HEIGHT, /* src */
- 0, 0, /* mask */
- 0, row * OVERLAY_ROW_HEIGHT, /* dest */
- overlay->width, (rows + overlay->heirarchy_end) * OVERLAY_ROW_HEIGHT - (rows + row) * OVERLAY_ROW_HEIGHT); /* dimensions */
+ 0, (rows + row) * CHART_ROW_HEIGHT, /* src */
+ 0, 0, /* mask */
+ 0, row * CHART_ROW_HEIGHT, /* dest */
+ chart->width, (rows + chart->heirarchy_end) * CHART_ROW_HEIGHT - (rows + row) * CHART_ROW_HEIGHT); /* dimensions */
XRenderChangePicture(xserver->display, pic, CPRepeat, &pa_repeat);
}
/* moves what's below a given row up above it if specified, the row becoming discarded */
-static void snowflake_row(vwm_overlays_t *overlays, vwm_overlay_t *overlay, Picture pic, int copy, int row)
+static void snowflake_row(vwm_charts_t *charts, vwm_chart_t *chart, Picture pic, int copy, int row)
{
- VWM_TRACE("pid=%i overlay=%p row=%i copy=%i heirarhcy_end=%i", overlay->monitor->pid, overlay, row, copy, overlay->heirarchy_end);
+ VWM_TRACE("pid=%i chart=%p row=%i copy=%i heirarhcy_end=%i", chart->monitor->pid, chart, row, copy, chart->heirarchy_end);
if (copy)
- copy_row(overlays, overlay, row, pic, 0, overlay->tmp_picture);
+ copy_row(charts, chart, row, pic, 0, chart->tmp_picture);
- shift_below_row_up(overlays, overlay, row, pic, 1);
+ shift_below_row_up(charts, chart, row, pic, 1);
if (copy) {
- copy_row(overlays, overlay, 0, overlay->tmp_picture, overlay->heirarchy_end, pic);
+ copy_row(charts, chart, 0, chart->tmp_picture, chart->heirarchy_end, pic);
} else {
- fill_row(overlays, overlay, overlay->heirarchy_end, pic, &overlay_trans_color);
+ fill_row(charts, chart, chart->heirarchy_end, pic, &chart_trans_color);
}
}
@@ -344,55 +344,55 @@ static void snowflake_row(vwm_overlays_t *overlays, vwm_overlay_t *overlay, Pict
*/
-static void shift_below_row_down(vwm_overlays_t *overlays, vwm_overlay_t *overlay, int row, Picture pic, int rows)
+static void shift_below_row_down(vwm_charts_t *charts, vwm_chart_t *chart, int row, Picture pic, int rows)
{
- XRenderComposite(overlays->xserver->display, PictOpSrc, pic, None, pic,
- 0, row * OVERLAY_ROW_HEIGHT, /* src */
- 0, 0, /* mask */
- 0, (row + rows) * OVERLAY_ROW_HEIGHT, /* dest */
- overlay->width, overlay->height - (rows + row) * OVERLAY_ROW_HEIGHT); /* dimensions */
+ XRenderComposite(charts->xserver->display, PictOpSrc, pic, None, pic,
+ 0, row * CHART_ROW_HEIGHT, /* src */
+ 0, 0, /* mask */
+ 0, (row + rows) * CHART_ROW_HEIGHT, /* dest */
+ chart->width, chart->height - (rows + row) * CHART_ROW_HEIGHT); /* dimensions */
}
/* shifts what's below a given row down a row, and clears the row, preparing it for populating */
-static void allocate_row(vwm_overlays_t *overlays, vwm_overlay_t *overlay, Picture pic, int row)
+static void allocate_row(vwm_charts_t *charts, vwm_chart_t *chart, Picture pic, int row)
{
- VWM_TRACE("pid=%i overlay=%p row=%i", overlay->monitor->pid, overlay, row);
+ VWM_TRACE("pid=%i chart=%p row=%i", chart->monitor->pid, chart, row);
- shift_below_row_down(overlays, overlay, row, pic, 1);
- fill_row(overlays, overlay, row, pic, &overlay_trans_color);
+ shift_below_row_down(charts, chart, row, pic, 1);
+ fill_row(charts, chart, row, pic, &chart_trans_color);
}
/* shadow a row from the text layer in the shadow layer */
-static void shadow_row(vwm_overlays_t *overlays, vwm_overlay_t *overlay, int row)
+static void shadow_row(vwm_charts_t *charts, vwm_chart_t *chart, int row)
{
- vwm_xserver_t *xserver = overlays->xserver;
+ vwm_xserver_t *xserver = charts->xserver;
/* the current technique for creating the shadow is to simply render the text at +1/-1 pixel offsets on both axis in translucent black */
- XRenderComposite(xserver->display, PictOpSrc, overlays->shadow_fill, overlay->text_picture, overlay->shadow_picture,
+ XRenderComposite(xserver->display, PictOpSrc, charts->shadow_fill, chart->text_picture, chart->shadow_picture,
0, 0,
- -1, row * OVERLAY_ROW_HEIGHT,
- 0, row * OVERLAY_ROW_HEIGHT,
- overlay->visible_width, OVERLAY_ROW_HEIGHT);
+ -1, row * CHART_ROW_HEIGHT,
+ 0, row * CHART_ROW_HEIGHT,
+ chart->visible_width, CHART_ROW_HEIGHT);
- XRenderComposite(xserver->display, PictOpOver, overlays->shadow_fill, overlay->text_picture, overlay->shadow_picture,
+ XRenderComposite(xserver->display, PictOpOver, charts->shadow_fill, chart->text_picture, chart->shadow_picture,
0, 0,
- 0, -1 + row * OVERLAY_ROW_HEIGHT,
- 0, row * OVERLAY_ROW_HEIGHT,
- overlay->visible_width, OVERLAY_ROW_HEIGHT);
+ 0, -1 + row * CHART_ROW_HEIGHT,
+ 0, row * CHART_ROW_HEIGHT,
+ chart->visible_width, CHART_ROW_HEIGHT);
- XRenderComposite(xserver->display, PictOpOver, overlays->shadow_fill, overlay->text_picture, overlay->shadow_picture,
+ XRenderComposite(xserver->display, PictOpOver, charts->shadow_fill, chart->text_picture, chart->shadow_picture,
0, 0,
- 1, row * OVERLAY_ROW_HEIGHT,
- 0, row * OVERLAY_ROW_HEIGHT,
- overlay->visible_width, OVERLAY_ROW_HEIGHT);
+ 1, row * CHART_ROW_HEIGHT,
+ 0, row * CHART_ROW_HEIGHT,
+ chart->visible_width, CHART_ROW_HEIGHT);
- XRenderComposite(xserver->display, PictOpOver, overlays->shadow_fill, overlay->text_picture, overlay->shadow_picture,
+ XRenderComposite(xserver->display, PictOpOver, charts->shadow_fill, chart->text_picture, chart->shadow_picture,
0, 0,
- 0, 1 + row * OVERLAY_ROW_HEIGHT,
- 0, row * OVERLAY_ROW_HEIGHT,
- overlay->visible_width, OVERLAY_ROW_HEIGHT);
+ 0, 1 + row * CHART_ROW_HEIGHT,
+ 0, row * CHART_ROW_HEIGHT,
+ chart->visible_width, CHART_ROW_HEIGHT);
}
@@ -403,8 +403,8 @@ static void argv2xtext(vmon_proc_t *proc, XTextItem *items, int max_items, int *
int nr = 0;
if (proc->is_thread) { /* stick the thread marker at the start of threads */
- items[0].nchars = sizeof(OVERLAY_ISTHREAD_ARGV) - 1;
- items[0].chars = OVERLAY_ISTHREAD_ARGV;
+ items[0].nchars = sizeof(CHART_ISTHREAD_ARGV) - 1;
+ items[0].chars = CHART_ISTHREAD_ARGV;
items[0].delta = 4;
items[0].font = None;
nr++;
@@ -415,8 +415,8 @@ static void argv2xtext(vmon_proc_t *proc, XTextItem *items, int max_items, int *
items[nr].chars = ((vmon_proc_stat_t *)proc->stores[VMON_STORE_PROC_STAT])->comm.array;
} else {
/* sometimes a process is so ephemeral we don't manage to sample its comm, XXX TODO: we always have a pid, stringify it? */
- items[nr].nchars = sizeof(OVERLAY_NOCOMM_ARGV) - 1;
- items[nr].chars = OVERLAY_NOCOMM_ARGV;
+ items[nr].nchars = sizeof(CHART_NOCOMM_ARGV) - 1;
+ items[nr].chars = CHART_NOCOMM_ARGV;
}
items[nr].delta = 4;
items[nr].font = None;
@@ -476,14 +476,14 @@ static int proc_heirarchy_changed(vmon_proc_t *proc)
/* helper for drawing the vertical bars in the graph layers */
-static void draw_bars(vwm_overlays_t *overlays, vwm_overlay_t *overlay, int row, double a_fraction, double a_total, double b_fraction, double b_total)
+static void draw_bars(vwm_charts_t *charts, vwm_chart_t *chart, int row, double a_fraction, double a_total, double b_fraction, double b_total)
{
- vwm_xserver_t *xserver = overlays->xserver;
+ vwm_xserver_t *xserver = charts->xserver;
int a_height, b_height;
/* compute the bar heights for this sample */
- a_height = (a_fraction / a_total * (double)(OVERLAY_ROW_HEIGHT - 1)); /* give up 1 pixel for the div */
- b_height = (b_fraction / b_total * (double)(OVERLAY_ROW_HEIGHT - 1));
+ a_height = (a_fraction / a_total * (double)(CHART_ROW_HEIGHT - 1)); /* give up 1 pixel for the div */
+ b_height = (b_fraction / b_total * (double)(CHART_ROW_HEIGHT - 1));
/* round up to 1 pixel when the scaled result is a fraction less than 1,
* I want to at least see 1 pixel blips for the slightest cpu utilization */
@@ -494,51 +494,51 @@ static void draw_bars(vwm_overlays_t *overlays, vwm_overlay_t *overlay, int row,
b_height = 1;
/* draw the two bars for this sample at the current phase in the graphs, note the first is ceiling-based, second floor-based */
- XRenderFillRectangle(xserver->display, PictOpSrc, overlay->grapha_picture, &overlay_visible_color,
- overlay->phase, row * OVERLAY_ROW_HEIGHT, /* dst x, y */
- 1, a_height); /* dst w, h */
- XRenderFillRectangle(xserver->display, PictOpSrc, overlay->graphb_picture, &overlay_visible_color,
- overlay->phase, row * OVERLAY_ROW_HEIGHT + (OVERLAY_ROW_HEIGHT - b_height) - 1, /* dst x, y */
+ XRenderFillRectangle(xserver->display, PictOpSrc, chart->grapha_picture, &chart_visible_color,
+ chart->phase, row * CHART_ROW_HEIGHT, /* dst x, y */
+ 1, a_height); /* dst w, h */
+ XRenderFillRectangle(xserver->display, PictOpSrc, chart->graphb_picture, &chart_visible_color,
+ chart->phase, row * CHART_ROW_HEIGHT + (CHART_ROW_HEIGHT - b_height) - 1, /* dst x, y */
1, b_height); /* dst w, h */
}
/* helper for marking a finish line at the current phase for the specified row */
-static void mark_finish(vwm_overlays_t *overlays, vwm_overlay_t *overlay, int row)
+static void mark_finish(vwm_charts_t *charts, vwm_chart_t *chart, int row)
{
- vwm_xserver_t *xserver = overlays->xserver;
-
- XRenderComposite(xserver->display, PictOpSrc, overlays->finish_fill, None, overlay->grapha_picture,
- 0, 0, /* src x, y */
- 0, 0, /* mask x, y */
- overlay->phase, row * OVERLAY_ROW_HEIGHT, /* dst x, y */
- 1, OVERLAY_ROW_HEIGHT - 1);
- XRenderComposite(xserver->display, PictOpSrc, overlays->finish_fill, None, overlay->graphb_picture,
- 0, 0, /* src x, y */
- 0, 0, /* mask x, y */
- overlay->phase, row * OVERLAY_ROW_HEIGHT, /* dst x, y */
- 1, OVERLAY_ROW_HEIGHT - 1);
+ vwm_xserver_t *xserver = charts->xserver;
+
+ XRenderComposite(xserver->display, PictOpSrc, charts->finish_fill, None, chart->grapha_picture,
+ 0, 0, /* src x, y */
+ 0, 0, /* mask x, y */
+ chart->phase, row * CHART_ROW_HEIGHT, /* dst x, y */
+ 1, CHART_ROW_HEIGHT - 1);
+ XRenderComposite(xserver->display, PictOpSrc, charts->finish_fill, None, chart->graphb_picture,
+ 0, 0, /* src x, y */
+ 0, 0, /* mask x, y */
+ chart->phase, row * CHART_ROW_HEIGHT, /* dst x, y */
+ 1, CHART_ROW_HEIGHT - 1);
}
-/* helper for drawing a proc's argv @ specified x offset and row on the overlay */
-static void print_argv(vwm_overlays_t *overlays, vwm_overlay_t *overlay, int x, int row, vmon_proc_t *proc)
+/* helper for drawing a proc's argv @ specified x offset and row on the chart */
+static void print_argv(vwm_charts_t *charts, vwm_chart_t *chart, int x, int row, vmon_proc_t *proc)
{
- vwm_xserver_t *xserver = overlays->xserver;
- XTextItem items[OVERLAY_MAX_ARGC];
+ vwm_xserver_t *xserver = charts->xserver;
+ XTextItem items[CHART_MAX_ARGC];
int nr_items;
argv2xtext(proc, items, NELEMS(items), &nr_items);
- XDrawText(xserver->display, overlay->text_pixmap, overlays->text_gc,
- x, (row + 1) * OVERLAY_ROW_HEIGHT - 3, /* dst x, y */
+ XDrawText(xserver->display, chart->text_pixmap, charts->text_gc,
+ x, (row + 1) * CHART_ROW_HEIGHT - 3, /* dst x, y */
items, nr_items);
}
/* draws proc in a row of the process heirarchy */
-static void draw_heirarchy_row(vwm_overlays_t *overlays, vwm_overlay_t *overlay, vmon_proc_t *proc, int depth, int row, int heirarchy_changed)
+static void draw_heirarchy_row(vwm_charts_t *charts, vwm_chart_t *chart, vmon_proc_t *proc, int depth, int row, int heirarchy_changed)
{
- vwm_xserver_t *xserver = overlays->xserver;
+ vwm_xserver_t *xserver = charts->xserver;
vmon_proc_stat_t *proc_stat = proc->stores[VMON_STORE_PROC_STAT];
vmon_proc_t *child;
char str[256];
@@ -547,7 +547,7 @@ static void draw_heirarchy_row(vwm_overlays_t *overlays, vwm_overlay_t *overlay,
/* process heirarchy text and accompanying per-process details like wchan/pid/state... */
/* skip if obviously unnecessary (this can be further improved, but this makes a big difference as-is) */
- if (!overlay->redraw_needed &&
+ if (!chart->redraw_needed &&
!heirarchy_changed &&
!BITTEST(proc_stat->changed, VMON_PROC_STAT_WCHAN) &&
!BITTEST(proc_stat->changed, VMON_PROC_STAT_PID) &&
@@ -558,9 +558,9 @@ static void draw_heirarchy_row(vwm_overlays_t *overlays, vwm_overlay_t *overlay,
/* TODO: make the columns interactively configurable @ runtime */
if (!proc->is_new)
/* XXX for now always clear the row, this should be capable of being optimized in the future (if the datums driving the text haven't changed...) */
- XRenderFillRectangle(xserver->display, PictOpSrc, overlay->text_picture, &overlay_trans_color,
- 0, row * OVERLAY_ROW_HEIGHT, /* dst x, y */
- overlay->width, OVERLAY_ROW_HEIGHT); /* dst w, h */
+ XRenderFillRectangle(xserver->display, PictOpSrc, chart->text_picture, &chart_trans_color,
+ 0, row * CHART_ROW_HEIGHT, /* dst x, y */
+ chart->width, CHART_ROW_HEIGHT); /* dst w, h */
/* put the process' wchan, state, and PID columns @ the far right */
if (proc->is_thread || list_empty(&proc->threads)) { /* only threads or non-threaded processes include the wchan and state */
@@ -573,42 +573,42 @@ static void draw_heirarchy_row(vwm_overlays_t *overlays, vwm_overlay_t *overlay,
} else { /* we're a process having threads, suppress the wchan and state, as they will be displayed for the thread of same pid */
snprintf(str, sizeof(str), " %5i %n", proc->pid, &str_len);
}
- str_width = XTextWidth(overlays->overlay_font, str, str_len);
+ str_width = XTextWidth(charts->chart_font, str, str_len);
/* the process' comm label indented according to depth, followed with their respective argv's */
- print_argv(overlays, overlay, depth * (OVERLAY_ROW_HEIGHT / 2), row, proc);
+ print_argv(charts, chart, depth * (CHART_ROW_HEIGHT / 2), row, proc);
/* ensure the area for the rest of the stuff is cleared, we don't put much text into thread rows so skip it for those. */
if (!proc->is_thread)
- XRenderFillRectangle(xserver->display, PictOpSrc, overlay->text_picture, &overlay_trans_color,
- overlay->visible_width - str_width, row * OVERLAY_ROW_HEIGHT, /* dst x,y */
- overlay->width - (overlay->visible_width - str_width), OVERLAY_ROW_HEIGHT); /* dst w,h */
+ XRenderFillRectangle(xserver->display, PictOpSrc, chart->text_picture, &chart_trans_color,
+ chart->visible_width - str_width, row * CHART_ROW_HEIGHT, /* dst x,y */
+ chart->width - (chart->visible_width - str_width), CHART_ROW_HEIGHT); /* dst w,h */
- XDrawString(xserver->display, overlay->text_pixmap, overlays->text_gc,
- overlay->visible_width - str_width, (row + 1) * OVERLAY_ROW_HEIGHT - 3, /* dst x, y */
+ XDrawString(xserver->display, chart->text_pixmap, charts->text_gc,
+ chart->visible_width - str_width, (row + 1) * CHART_ROW_HEIGHT - 3, /* dst x, y */
str, str_len);
/* only if this process isn't the root process @ the window shall we consider all relational drawing conditions */
- if (proc != overlay->monitor) {
+ if (proc != chart->monitor) {
vmon_proc_t *ancestor, *sibling, *last_sibling = NULL;
struct list_head *rem;
int needs_tee = 0;
- int bar_x = 0, bar_y = (row + 1) * OVERLAY_ROW_HEIGHT;
+ int bar_x = 0, bar_y = (row + 1) * CHART_ROW_HEIGHT;
int sub;
- /* XXX: everything done in this code block only dirties _this_ process' row in the rendered overlay output */
+ /* XXX: everything done in this code block only dirties _this_ process' row in the rendered chart output */
- /* walk up the ancestors until reaching overlay->monitor, any ancestors we encounter which have more siblings we draw a vertical bar for */
+ /* walk up the ancestors until reaching chart->monitor, any ancestors we encounter which have more siblings we draw a vertical bar for */
/* this draws the |'s in something like: | | | | comm */
- for (sub = 1, ancestor = proc->parent; ancestor && ancestor != overlay->monitor; ancestor = ancestor->parent) {
+ for (sub = 1, ancestor = proc->parent; ancestor && ancestor != chart->monitor; ancestor = ancestor->parent) {
sub++;
- bar_x = (depth - sub) * (OVERLAY_ROW_HEIGHT / 2) + 4;
+ bar_x = (depth - sub) * (CHART_ROW_HEIGHT / 2) + 4;
/* 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) {
if (!(list_entry(rem, vmon_proc_t, siblings)->is_stale)) {
- XDrawLine(xserver->display, overlay->text_pixmap, overlays->text_gc,
- bar_x, bar_y - OVERLAY_ROW_HEIGHT, /* dst x1, y1 */
+ XDrawLine(xserver->display, chart->text_pixmap, charts->text_gc,
+ bar_x, bar_y - CHART_ROW_HEIGHT, /* dst x1, y1 */
bar_x, bar_y); /* dst x2, y2 (vertical line) */
break; /* stop looking for more siblings at this ancestor when we find one that isn't stale */
}
@@ -654,20 +654,20 @@ static void draw_heirarchy_row(vwm_overlays_t *overlays, vwm_overlay_t *overlay,
/* found a tee is necessary, all that's left is to determine if the tee is a corner and draw it accordingly, stopping the search. */
if (needs_tee) {
- bar_x = (depth - 1) * (OVERLAY_ROW_HEIGHT / 2) + 4;
+ bar_x = (depth - 1) * (CHART_ROW_HEIGHT / 2) + 4;
/* if we're the last sibling, corner the tee by shortening the vbar */
if (proc == last_sibling) {
- XDrawLine(xserver->display, overlay->text_pixmap, overlays->text_gc,
- bar_x, bar_y - OVERLAY_ROW_HEIGHT, /* dst x1, y1 */
+ XDrawLine(xserver->display, chart->text_pixmap, charts->text_gc,
+ bar_x, bar_y - CHART_ROW_HEIGHT, /* dst x1, y1 */
bar_x, bar_y - 4); /* dst x2, y2 (vertical bar) */
} else {
- XDrawLine(xserver->display, overlay->text_pixmap, overlays->text_gc,
- bar_x, bar_y - OVERLAY_ROW_HEIGHT, /* dst x1, y1 */
+ XDrawLine(xserver->display, chart->text_pixmap, charts->text_gc,
+ bar_x, bar_y - CHART_ROW_HEIGHT, /* dst x1, y1 */
bar_x, bar_y); /* dst x2, y2 (vertical bar) */
}
- XDrawLine(xserver->display, overlay->text_pixmap, overlays->text_gc,
+ XDrawLine(xserver->display, chart->text_pixmap, charts->text_gc,
bar_x, bar_y - 4, /* dst x1, y1 */
bar_x + 2, bar_y - 4); /* dst x2, y2 (horizontal bar) */
@@ -677,12 +677,12 @@ static void draw_heirarchy_row(vwm_overlays_t *overlays, vwm_overlay_t *overlay,
}
}
- shadow_row(overlays, overlay, row);
+ shadow_row(charts, chart, row);
}
-/* recursive draw function for "rest" of overlay: the per-process rows (heirarchy, argv, state, wchan, pid...) */
-static void draw_overlay_rest(vwm_overlays_t *overlays, vwm_overlay_t *overlay, vmon_proc_t *proc, int *depth, int *row, int heirarchy_changed)
+/* recursive draw function for "rest" of chart: the per-process rows (heirarchy, argv, state, wchan, pid...) */
+static void draw_chart_rest(vwm_charts_t *charts, vwm_chart_t *chart, vmon_proc_t *proc, int *depth, int *row, int heirarchy_changed)
{
vmon_proc_stat_t *proc_stat = proc->stores[VMON_STORE_PROC_STAT];
vwm_perproc_ctxt_t *proc_ctxt = proc->foo;
@@ -691,7 +691,7 @@ static void draw_overlay_rest(vwm_overlays_t *overlays, vwm_overlay_t *overlay,
/* Some parts of this we must do on every sample to maintain coherence in the graphs, since they're incrementally kept
* in sync with the process heirarchy, allocating and shifting the rows as processes are created and destroyed. Everything
- * else we should be able to skip doing unless overlay.redraw_needed or their contents changed.
+ * else we should be able to skip doing unless chart.redraw_needed or their contents changed.
*/
if (proc->is_stale) {
@@ -704,20 +704,20 @@ static void draw_overlay_rest(vwm_overlays_t *overlays, vwm_overlay_t *overlay,
/* This does require that I do a separate forward recursion to determine the number of rows
* so I can correctly snowflake in reverse */
if (!in_stale) {
- VWM_TRACE("entered stale at overlay=%p depth=%i row=%i", overlay, *depth, *row);
+ VWM_TRACE("entered stale at chart=%p depth=%i row=%i", chart, *depth, *row);
in_stale_entrypoint = in_stale = 1;
(*row) += count_rows(proc) - 1;
}
(*depth)++;
list_for_each_entry_prev(child, &proc->children, siblings) {
- draw_overlay_rest(overlays, overlay, child, depth, row, heirarchy_changed);
+ draw_chart_rest(charts, chart, child, depth, row, heirarchy_changed);
(*row)--;
}
if (!proc->is_thread) {
list_for_each_entry_prev(child, &proc->threads, threads) {
- draw_overlay_rest(overlays, overlay, child, depth, row, heirarchy_changed);
+ draw_chart_rest(charts, chart, child, depth, row, heirarchy_changed);
(*row)--;
}
}
@@ -728,23 +728,23 @@ static void draw_overlay_rest(vwm_overlays_t *overlays, vwm_overlay_t *overlay,
((vmon_proc_stat_t *)proc->stores[VMON_STORE_PROC_STAT])->comm.array,
(*depth), (*row), proc->is_thread);
- mark_finish(overlays, overlay, (*row));
+ mark_finish(charts, chart, (*row));
/* extract the row from the various layers */
- snowflake_row(overlays, overlay, overlay->grapha_picture, 1, (*row));
- snowflake_row(overlays, overlay, overlay->graphb_picture, 1, (*row));
- snowflake_row(overlays, overlay, overlay->text_picture, 0, (*row));
- snowflake_row(overlays, overlay, overlay->shadow_picture, 0, (*row));
- overlay->snowflakes_cnt++;
+ snowflake_row(charts, chart, chart->grapha_picture, 1, (*row));
+ snowflake_row(charts, chart, chart->graphb_picture, 1, (*row));
+ snowflake_row(charts, chart, chart->text_picture, 0, (*row));
+ snowflake_row(charts, chart, chart->shadow_picture, 0, (*row));
+ chart->snowflakes_cnt++;
- /* stamp the name (and whatever else we include) into overlay.text_picture */
- print_argv(overlays, overlay, 5, overlay->heirarchy_end, proc);
- shadow_row(overlays, overlay, overlay->heirarchy_end);
+ /* stamp the name (and whatever else we include) into chart.text_picture */
+ print_argv(charts, chart, 5, chart->heirarchy_end, proc);
+ shadow_row(charts, chart, chart->heirarchy_end);
- overlay->heirarchy_end--;
+ chart->heirarchy_end--;
if (in_stale_entrypoint) {
- VWM_TRACE("exited stale at overlay=%p depth=%i row=%i", overlay, *depth, *row);
+ VWM_TRACE("exited stale at chart=%p depth=%i row=%i", chart, *depth, *row);
in_stale = 0;
}
@@ -753,37 +753,37 @@ static void draw_overlay_rest(vwm_overlays_t *overlays, vwm_overlay_t *overlay,
/* what to do when a process has been introduced */
VWM_TRACE("%i is new", proc->pid);
- allocate_row(overlays, overlay, overlay->grapha_picture, (*row));
- allocate_row(overlays, overlay, overlay->graphb_picture, (*row));
- allocate_row(overlays, overlay, overlay->text_picture, (*row));
- allocate_row(overlays, overlay, overlay->shadow_picture, (*row));
+ allocate_row(charts, chart, chart->grapha_picture, (*row));
+ allocate_row(charts, chart, chart->graphb_picture, (*row));
+ allocate_row(charts, chart, chart->text_picture, (*row));
+ allocate_row(charts, chart, chart->shadow_picture, (*row));
- overlay->heirarchy_end++;
+ chart->heirarchy_end++;
}
/* CPU utilization graphs */
/* use the generation number to avoid recomputing this stuff for callbacks recurring on the same process in the same sample */
- if (proc_ctxt->generation != overlays->vmon.generation) {
+ if (proc_ctxt->generation != charts->vmon.generation) {
proc_ctxt->stime_delta = proc_stat->stime - proc_ctxt->last_stime;
proc_ctxt->utime_delta = proc_stat->utime - proc_ctxt->last_utime;
proc_ctxt->last_utime = proc_stat->utime;
proc_ctxt->last_stime = proc_stat->stime;
- proc_ctxt->generation = overlays->vmon.generation;
+ proc_ctxt->generation = charts->vmon.generation;
}
if (proc->is_new) {
/* we need a minimum of two samples before we can compute a delta to plot,
* so we suppress that and instead mark the start of monitoring with an impossible 100% of both graph contexts, a starting line. */
- stime_delta = utime_delta = overlays->total_delta;
+ stime_delta = utime_delta = charts->total_delta;
} else {
stime_delta = proc_ctxt->stime_delta;
utime_delta = proc_ctxt->utime_delta;
}
- draw_bars(overlays, overlay, *row, stime_delta, overlays->total_delta, utime_delta, overlays->total_delta);
+ draw_bars(charts, chart, *row, stime_delta, charts->total_delta, utime_delta, charts->total_delta);
- draw_heirarchy_row(overlays, overlay, proc, *depth, *row, heirarchy_changed);
+ draw_heirarchy_row(charts, chart, proc, *depth, *row, heirarchy_changed);
(*row)++;
@@ -791,83 +791,83 @@ static void draw_overlay_rest(vwm_overlays_t *overlays, vwm_overlay_t *overlay,
(*depth)++;
if (!proc->is_thread) { /* XXX: the threads member serves as the list head only when not a thread */
list_for_each_entry(child, &proc->threads, threads) {
- draw_overlay_rest(overlays, overlay, child, depth, row, heirarchy_changed);
+ draw_chart_rest(charts, chart, child, depth, row, heirarchy_changed);
}
}
list_for_each_entry(child, &proc->children, siblings) {
- draw_overlay_rest(overlays, overlay, child, depth, row, heirarchy_changed);
+ draw_chart_rest(charts, chart, child, depth, row, heirarchy_changed);
}
(*depth)--;
}
-/* recursive draw function entrypoint, draws the IOWait/Idle/HZ row, then enters draw_overlay_rest() */
-static void draw_overlay(vwm_overlays_t *overlays, vwm_overlay_t *overlay, vmon_proc_t *proc, int *depth, int *row)
+/* recursive draw function entrypoint, draws the IOWait/Idle/HZ row, then enters draw_chart_rest() */
+static void draw_chart(vwm_charts_t *charts, vwm_chart_t *chart, vmon_proc_t *proc, int *depth, int *row)
{
- vwm_xserver_t *xserver = overlays->xserver;
+ vwm_xserver_t *xserver = charts->xserver;
int heirarchy_changed = 0;
int str_len, str_width;
char str[256];
/* CPU utilization graphs */
/* IOWait and Idle % @ row 0 */
- draw_bars(overlays, overlay, *row, overlays->iowait_delta, overlays->total_delta, overlays->idle_delta, overlays->total_delta);
+ draw_bars(charts, chart, *row, charts->iowait_delta, charts->total_delta, charts->idle_delta, charts->total_delta);
/* only draw the \/\/\ and HZ if necessary */
- if (overlay->redraw_needed || overlays->prev_sampling_interval != overlays->sampling_interval) {
- snprintf(str, sizeof(str), "\\/\\/\\ %2iHz %n", (int)(overlays->sampling_interval == INFINITY ? 0 : 1 / overlays->sampling_interval), &str_len);
- XRenderFillRectangle(xserver->display, PictOpSrc, overlay->text_picture, &overlay_trans_color,
+ if (chart->redraw_needed || charts->prev_sampling_interval != charts->sampling_interval) {
+ snprintf(str, sizeof(str), "\\/\\/\\ %2iHz %n", (int)(charts->sampling_interval == INFINITY ? 0 : 1 / charts->sampling_interval), &str_len);
+ XRenderFillRectangle(xserver->display, PictOpSrc, chart->text_picture, &chart_trans_color,
0, 0, /* dst x, y */
- overlay->visible_width, OVERLAY_ROW_HEIGHT); /* dst w, h */
- str_width = XTextWidth(overlays->overlay_font, str, str_len);
- XDrawString(xserver->display, overlay->text_pixmap, overlays->text_gc,
- overlay->visible_width - str_width, OVERLAY_ROW_HEIGHT - 3, /* dst x, y */
+ chart->visible_width, CHART_ROW_HEIGHT); /* dst w, h */
+ str_width = XTextWidth(charts->chart_font, str, str_len);
+ XDrawString(xserver->display, chart->text_pixmap, charts->text_gc,
+ chart->visible_width - str_width, CHART_ROW_HEIGHT - 3, /* dst x, y */
str, str_len);
- shadow_row(overlays, overlay, 0);
+ shadow_row(charts, chart, 0);
}
(*row)++;
- if (!overlay->redraw_needed)
+ if (!chart->redraw_needed)
heirarchy_changed = proc_heirarchy_changed(proc);
- draw_overlay_rest(overlays, overlay, proc, depth, row, heirarchy_changed);
+ draw_chart_rest(charts, chart, proc, depth, row, heirarchy_changed);
- overlay->redraw_needed = 0;
+ chart->redraw_needed = 0;
return;
}
-/* consolidated version of overlay text and graph rendering, makes snowflakes integration cleaner, this always gets called regardless of the overlays mode */
-static void maintain_overlay(vwm_overlays_t *overlays, vwm_overlay_t *overlay)
+/* consolidated version of chart text and graph rendering, makes snowflakes integration cleaner, this always gets called regardless of the charts mode */
+static void maintain_chart(vwm_charts_t *charts, vwm_chart_t *chart)
{
- vwm_xserver_t *xserver = overlays->xserver;
+ vwm_xserver_t *xserver = charts->xserver;
int row = 0, depth = 0;
- if (!overlay->monitor || !overlay->monitor->stores[VMON_STORE_PROC_STAT])
+ if (!chart->monitor || !chart->monitor->stores[VMON_STORE_PROC_STAT])
return;
/* TODO:
* A side effect of responding to window resizes in this function is there's a latency proportional to the current sample_interval.
- * Something to fix is to resize the overlays when the window resizes.
- * However, simply resizing the overlays is insufficient. Their contents need to be redrawn in the new dimensions, this is where it
- * gets annoying. The current maintain/draw_overlay makes assumptions about being run from the periodic vmon per-process callback.
- * There needs to be a redraw mode added where draw_overlay is just reconstructing the current state, which requires that we suppress
- * the phase advance and in maintain_overlay() and just enter draw_overlay() to redraw everything for the same generation.
- * So this probably requires some tweaking of draw_overlay() as well as maintain_overlay(). I want to be able tocall mainta_overlays()
+ * Something to fix is to resize the charts when the window resizes.
+ * However, simply resizing the charts is insufficient. Their contents need to be redrawn in the new dimensions, this is where it
+ * gets annoying. The current maintain/draw_chart makes assumptions about being run from the periodic vmon per-process callback.
+ * There needs to be a redraw mode added where draw_chart is just reconstructing the current state, which requires that we suppress
+ * the phase advance and in maintain_chart() and just enter draw_chart() to redraw everything for the same generation.
+ * So this probably requires some tweaking of draw_chart() as well as maintain_chart(). I want to be able tocall mainta_charts()
* from anywhere, and have it detect if it's being called on the same generation or if the generation has advanced.
* For now, the monitors will just be a little latent in window resizes which is pretty harmless artifact.
*/
- overlay->phase += (overlay->width - 1); /* simply change this to .phase++ to scroll the other direction */
- overlay->phase %= overlay->width;
- XRenderFillRectangle(xserver->display, PictOpSrc, overlay->grapha_picture, &overlay_trans_color, overlay->phase, 0, 1, overlay->height);
- XRenderFillRectangle(xserver->display, PictOpSrc, overlay->graphb_picture, &overlay_trans_color, overlay->phase, 0, 1, overlay->height);
+ chart->phase += (chart->width - 1); /* simply change this to .phase++ to scroll the other direction */
+ chart->phase %= chart->width;
+ XRenderFillRectangle(xserver->display, PictOpSrc, chart->grapha_picture, &chart_trans_color, chart->phase, 0, 1, chart->height);
+ XRenderFillRectangle(xserver->display, PictOpSrc, chart->graphb_picture, &chart_trans_color, chart->phase, 0, 1, chart->height);
- /* recursively draw the monitored processes to the overlay */
- draw_overlay(overlays, overlay, overlay->monitor, &depth, &row);
+ /* recursively draw the monitored processes to the chart */
+ draw_chart(charts, chart, chart->monitor, &depth, &row);
}
@@ -876,60 +876,60 @@ static void maintain_overlay(vwm_overlays_t *overlays, vwm_overlay_t *overlay)
* It's also where we compose the graphs and text for visible windows into a picture ready for compositing with the window contents */
static void proc_sample_callback(vmon_t *vmon, void *sys_cb_arg, vmon_proc_t *proc, void *proc_cb_arg)
{
- vwm_overlays_t *overlays = sys_cb_arg;
- vwm_overlay_t *overlay = proc_cb_arg;
+ vwm_charts_t *charts = sys_cb_arg;
+ vwm_chart_t *chart = proc_cb_arg;
- VWM_TRACE("proc=%p overlay=%p", proc, overlay);
+ VWM_TRACE("proc=%p chart=%p", proc, chart);
- /* render the various always-updated overlays, this is the component we do regardless of the overlays mode and window visibility,
+ /* render the various always-updated charts, this is the component we do regardless of the charts mode and window visibility,
* essentially the incrementally rendered/historic components */
- maintain_overlay(overlays, overlay);
+ maintain_chart(charts, chart);
- /* XXX TODO: we used to mark repaint as being needed if this overlay's window was mapped, but
- * since extricating overlays from windows that's no longer convenient, and repaint is
+ /* XXX TODO: we used to mark repaint as being needed if this chart's window was mapped, but
+ * since extricating charts from windows that's no longer convenient, and repaint is
* always performed after a sample. Make sure the repainting isn't costly when nothing
- * overlayed is mapped (the case that code optimized)
+ * charted is mapped (the case that code optimized)
*/
}
-/* return the composed height of the overlay */
-static int vwm_overlay_composed_height(vwm_overlays_t *overlays, vwm_overlay_t *overlay)
+/* return the composed height of the chart */
+static int vwm_chart_composed_height(vwm_charts_t *charts, vwm_chart_t *chart)
{
- int snowflakes = overlay->snowflakes_cnt ? 1 + overlay->snowflakes_cnt : 0; /* don't include the separator row if there are no snowflakes */
+ int snowflakes = chart->snowflakes_cnt ? 1 + chart->snowflakes_cnt : 0; /* don't include the separator row if there are no snowflakes */
- return MIN((overlay->heirarchy_end + snowflakes) * OVERLAY_ROW_HEIGHT, overlay->visible_height);
+ return MIN((chart->heirarchy_end + snowflakes) * CHART_ROW_HEIGHT, chart->visible_height);
}
-/* reset snowflakes on the specified overlay */
-void vwm_overlay_reset_snowflakes(vwm_overlays_t *overlays, vwm_overlay_t *overlay)
+/* reset snowflakes on the specified chart */
+void vwm_chart_reset_snowflakes(vwm_charts_t *charts, vwm_chart_t *chart)
{
- if (overlay->snowflakes_cnt) {
- overlay->snowflakes_cnt = 0;
- overlay->redraw_needed = 1;
+ if (chart->snowflakes_cnt) {
+ chart->snowflakes_cnt = 0;
+ chart->redraw_needed = 1;
}
}
-static void free_overlay_pictures(vwm_overlays_t *overlays, vwm_overlay_t *overlay)
+static void free_chart_pictures(vwm_charts_t *charts, vwm_chart_t *chart)
{
- vwm_xserver_t *xserver = overlays->xserver;
+ vwm_xserver_t *xserver = charts->xserver;
- XRenderFreePicture(xserver->display, overlay->grapha_picture);
- XRenderFreePicture(xserver->display, overlay->graphb_picture);
- XRenderFreePicture(xserver->display, overlay->tmp_picture);
- XRenderFreePicture(xserver->display, overlay->text_picture);
- XFreePixmap(xserver->display, overlay->text_pixmap);
- XRenderFreePicture(xserver->display, overlay->shadow_picture);
- XRenderFreePicture(xserver->display, overlay->picture);
+ XRenderFreePicture(xserver->display, chart->grapha_picture);
+ XRenderFreePicture(xserver->display, chart->graphb_picture);
+ XRenderFreePicture(xserver->display, chart->tmp_picture);
+ XRenderFreePicture(xserver->display, chart->text_picture);
+ XFreePixmap(xserver->display, chart->text_pixmap);
+ XRenderFreePicture(xserver->display, chart->shadow_picture);
+ XRenderFreePicture(xserver->display, chart->picture);
}
-static void copy_overlay_pictures(vwm_overlays_t *overlays, vwm_overlay_t *src, vwm_overlay_t *dest)
+static void copy_chart_pictures(vwm_charts_t *charts, vwm_chart_t *src, vwm_chart_t *dest)
{
- vwm_xserver_t *xserver = overlays->xserver;
+ vwm_xserver_t *xserver = charts->xserver;
if (!src->width)
return;
@@ -963,190 +963,190 @@ static void copy_overlay_pictures(vwm_overlays_t *overlays, vwm_overlay_t *src,
}
-/* (re)size the specified overlay's visible dimensions */
-int vwm_overlay_set_visible_size(vwm_overlays_t *overlays, vwm_overlay_t *overlay, int width, int height)
+/* (re)size the specified chart's visible dimensions */
+int vwm_chart_set_visible_size(vwm_charts_t *charts, vwm_chart_t *chart, int width, int height)
{
- if (width != overlay->visible_width || height != overlay->visible_height)
- overlay->redraw_needed = 1;
+ if (width != chart->visible_width || height != chart->visible_height)
+ chart->redraw_needed = 1;
- /* TODO error handling: if a create failed but we had an overlay, free whatever we created and leave it be, succeed.
+ /* TODO error handling: if a create failed but we had an chart, free whatever we created and leave it be, succeed.
* if none existed it's a hard error and we must propagate it. */
- /* if larger than the overlays currently are, enlarge them */
- if (width > overlay->width || height > overlay->height) {
- vwm_overlay_t existing = *overlay;
+ /* if larger than the charts currently are, enlarge them */
+ if (width > chart->width || height > chart->height) {
+ vwm_chart_t existing = *chart;
- overlay->width = MAX(overlay->width, MAX(width, OVERLAY_GRAPH_MIN_WIDTH));
- overlay->height = MAX(overlay->height, MAX(height, OVERLAY_GRAPH_MIN_HEIGHT));
+ chart->width = MAX(chart->width, MAX(width, CHART_GRAPH_MIN_WIDTH));
+ chart->height = MAX(chart->height, MAX(height, CHART_GRAPH_MIN_HEIGHT));
- overlay->grapha_picture = create_picture_fill(overlays, overlay->width, overlay->height, OVERLAY_MASK_DEPTH, CPRepeat, &pa_repeat, &overlay_trans_color, NULL);
- overlay->graphb_picture = create_picture_fill(overlays, overlay->width, overlay->height, OVERLAY_MASK_DEPTH, CPRepeat, &pa_repeat, &overlay_trans_color, NULL);
- overlay->tmp_picture = create_picture(overlays, overlay->width, OVERLAY_ROW_HEIGHT, OVERLAY_MASK_DEPTH, 0, NULL, NULL);
+ chart->grapha_picture = create_picture_fill(charts, chart->width, chart->height, CHART_MASK_DEPTH, CPRepeat, &pa_repeat, &chart_trans_color, NULL);
+ chart->graphb_picture = create_picture_fill(charts, chart->width, chart->height, CHART_MASK_DEPTH, CPRepeat, &pa_repeat, &chart_trans_color, NULL);
+ chart->tmp_picture = create_picture(charts, chart->width, CHART_ROW_HEIGHT, CHART_MASK_DEPTH, 0, NULL, NULL);
/* keep the text_pixmap reference around for XDrawText usage */
- overlay->text_picture = create_picture_fill(overlays, overlay->width, overlay->height, OVERLAY_MASK_DEPTH, 0, NULL, &overlay_trans_color, &overlay->text_pixmap);
+ chart->text_picture = create_picture_fill(charts, chart->width, chart->height, CHART_MASK_DEPTH, 0, NULL, &chart_trans_color, &chart->text_pixmap);
- overlay->shadow_picture = create_picture_fill(overlays, overlay->width, overlay->height, OVERLAY_MASK_DEPTH, 0, NULL, &overlay_trans_color, NULL);
- overlay->picture = create_picture(overlays, overlay->width, overlay->height, 32, 0, NULL, NULL);
+ chart->shadow_picture = create_picture_fill(charts, chart->width, chart->height, CHART_MASK_DEPTH, 0, NULL, &chart_trans_color, NULL);
+ chart->picture = create_picture(charts, chart->width, chart->height, 32, 0, NULL, NULL);
- copy_overlay_pictures(overlays, &existing, overlay);
- free_overlay_pictures(overlays, &existing);
+ copy_chart_pictures(charts, &existing, chart);
+ free_chart_pictures(charts, &existing);
}
- overlay->visible_width = width;
- overlay->visible_height = height;
+ chart->visible_width = width;
+ chart->visible_height = height;
return 1;
}
-/* create an overlay and start monitoring for the supplied pid */
-vwm_overlay_t * vwm_overlay_create(vwm_overlays_t *overlays, int pid, int width, int height)
+/* create an chart and start monitoring for the supplied pid */
+vwm_chart_t * vwm_chart_create(vwm_charts_t *charts, int pid, int width, int height)
{
- vwm_overlay_t *overlay;
+ vwm_chart_t *chart;
- overlay = calloc(1, sizeof(vwm_overlay_t));
- if (!overlay) {
- VWM_PERROR("Unable to allocate vwm_overlay_t");
+ chart = calloc(1, sizeof(vwm_chart_t));
+ if (!chart) {
+ VWM_PERROR("Unable to allocate vwm_chart_t");
goto _err;
}
/* add the client process to the monitoring heirarchy */
/* XXX note libvmon here maintains a unique callback for each unique callback+xwin pair, so multi-window processes work */
- overlay->monitor = vmon_proc_monitor(&overlays->vmon, NULL, pid, VMON_WANT_PROC_INHERIT, (void (*)(vmon_t *, void *, vmon_proc_t *, void *))proc_sample_callback, overlay);
- if (!overlay->monitor) {
+ chart->monitor = vmon_proc_monitor(&charts->vmon, NULL, pid, VMON_WANT_PROC_INHERIT, (void (*)(vmon_t *, void *, vmon_proc_t *, void *))proc_sample_callback, chart);
+ if (!chart->monitor) {
VWM_ERROR("Unable to establish proc monitor");
goto _err_free;
}
/* FIXME: count_rows() isn't returning the right count sometimes (off by ~1), it seems to be related to racing with the automatic child monitoring */
/* the result is an extra row sometimes appearing below the process heirarchy */
- overlay->heirarchy_end = 1 + count_rows(overlay->monitor);
- overlay->gen_last_composed = -1;
+ chart->heirarchy_end = 1 + count_rows(chart->monitor);
+ chart->gen_last_composed = -1;
- if (!vwm_overlay_set_visible_size(overlays, overlay, width, height)) {
- VWM_ERROR("Unable to set initial overlay size");
+ if (!vwm_chart_set_visible_size(charts, chart, width, height)) {
+ VWM_ERROR("Unable to set initial chart size");
goto _err_unmonitor;
}
- return overlay;
+ return chart;
_err_unmonitor:
- vmon_proc_unmonitor(&overlays->vmon, overlay->monitor, (void (*)(vmon_t *, void *, vmon_proc_t *, void *))proc_sample_callback, overlay);
+ vmon_proc_unmonitor(&charts->vmon, chart->monitor, (void (*)(vmon_t *, void *, vmon_proc_t *, void *))proc_sample_callback, chart);
_err_free:
- free(overlay);
+ free(chart);
_err:
return NULL;
}
-/* stop monitoring and destroy the supplied overlay */
-void vwm_overlay_destroy(vwm_overlays_t *overlays, vwm_overlay_t *overlay)
+/* stop monitoring and destroy the supplied chart */
+void vwm_chart_destroy(vwm_charts_t *charts, vwm_chart_t *chart)
{
- vmon_proc_unmonitor(&overlays->vmon, overlay->monitor, (void (*)(vmon_t *, void *, vmon_proc_t *, void *))proc_sample_callback, overlay);
- free_overlay_pictures(overlays, overlay);
- free(overlay);
+ vmon_proc_unmonitor(&charts->vmon, chart->monitor, (void (*)(vmon_t *, void *, vmon_proc_t *, void *))proc_sample_callback, chart);
+ free_chart_pictures(charts, chart);
+ free(chart);
}
-/* this composes the maintained overlay into the base overlay picture, this gets called from paint_all() on every repaint of xwin */
+/* this composes the maintained chart into the base chart picture, this gets called from paint_all() on every repaint of xwin */
/* we noop the call if the gen_last_composed and monitor->proc.generation numbers match, indicating there's nothing new to compose. */
-void vwm_overlay_compose(vwm_overlays_t *overlays, vwm_overlay_t *overlay, XserverRegion *res_damaged_region)
+void vwm_chart_compose(vwm_charts_t *charts, vwm_chart_t *chart, XserverRegion *res_damaged_region)
{
- vwm_xserver_t *xserver = overlays->xserver;
+ vwm_xserver_t *xserver = charts->xserver;
int height;
- if (!overlay->width || !overlay->height)
+ if (!chart->width || !chart->height)
return;
- if (overlay->gen_last_composed == overlay->monitor->generation)
+ if (chart->gen_last_composed == chart->monitor->generation)
return; /* noop if no sampling occurred since last compose */
- overlay->gen_last_composed = overlay->monitor->generation; /* remember this generation */
+ chart->gen_last_composed = chart->monitor->generation; /* remember this generation */
- //VWM_TRACE("composing %p", overlay);
+ //VWM_TRACE("composing %p", chart);
- height = vwm_overlay_composed_height(overlays, overlay);
+ height = vwm_chart_composed_height(charts, chart);
- /* fill the overlay picture with the background */
- XRenderComposite(xserver->display, PictOpSrc, overlays->bg_fill, None, overlay->picture,
+ /* fill the chart picture with the background */
+ XRenderComposite(xserver->display, PictOpSrc, charts->bg_fill, None, chart->picture,
0, 0,
0, 0,
0, 0,
- overlay->visible_width, height);
+ chart->visible_width, height);
- /* draw the graphs into the overlay through the stencils being maintained by the sample callbacks */
- XRenderComposite(xserver->display, PictOpOver, overlays->grapha_fill, overlay->grapha_picture, overlay->picture,
+ /* draw the graphs into the chart through the stencils being maintained by the sample callbacks */
+ XRenderComposite(xserver->display, PictOpOver, charts->grapha_fill, chart->grapha_picture, chart->picture,
0, 0,
- overlay->phase, 0,
+ chart->phase, 0,
0, 0,
- overlay->visible_width, height);
- XRenderComposite(xserver->display, PictOpOver, overlays->graphb_fill, overlay->graphb_picture, overlay->picture,
+ chart->visible_width, height);
+ XRenderComposite(xserver->display, PictOpOver, charts->graphb_fill, chart->graphb_picture, chart->picture,
0, 0,
- overlay->phase, 0,
+ chart->phase, 0,
0, 0,
- overlay->visible_width, height);
+ chart->visible_width, height);
- /* draw the shadow into the overlay picture using a translucent black source drawn through the shadow mask */
- XRenderComposite(xserver->display, PictOpOver, overlays->shadow_fill, overlay->shadow_picture, overlay->picture,
+ /* draw the shadow into the chart picture using a translucent black source drawn through the shadow mask */
+ XRenderComposite(xserver->display, PictOpOver, charts->shadow_fill, chart->shadow_picture, chart->picture,
0, 0,
0, 0,
0, 0,
- overlay->visible_width, height);
+ chart->visible_width, height);
- /* render overlay text into the overlay picture using a white source drawn through the overlay text as a mask, on top of everything */
- XRenderComposite(xserver->display, PictOpOver, overlays->text_fill, overlay->text_picture, overlay->picture,
+ /* render chart text into the chart picture using a white source drawn through the chart text as a mask, on top of everything */
+ XRenderComposite(xserver->display, PictOpOver, charts->text_fill, chart->text_picture, chart->picture,
0, 0,
0, 0,
0, 0,
- overlay->visible_width, (overlay->heirarchy_end * OVERLAY_ROW_HEIGHT));
+ chart->visible_width, (chart->heirarchy_end * CHART_ROW_HEIGHT));
- XRenderComposite(xserver->display, PictOpOver, overlays->snowflakes_text_fill, overlay->text_picture, overlay->picture,
+ XRenderComposite(xserver->display, PictOpOver, charts->snowflakes_text_fill, chart->text_picture, chart->picture,
0, 0,
- 0, overlay->heirarchy_end * OVERLAY_ROW_HEIGHT,
- 0, overlay->heirarchy_end * OVERLAY_ROW_HEIGHT,
- overlay->visible_width, height - (overlay->heirarchy_end * OVERLAY_ROW_HEIGHT));
+ 0, chart->heirarchy_end * CHART_ROW_HEIGHT,
+ 0, chart->heirarchy_end * CHART_ROW_HEIGHT,
+ chart->visible_width, height - (chart->heirarchy_end * CHART_ROW_HEIGHT));
- /* damage the window to ensure the updated overlay is drawn (TODO: this can be done more selectively/efficiently) */
+ /* damage the window to ensure the updated chart is drawn (TODO: this can be done more selectively/efficiently) */
if (res_damaged_region) {
XRectangle damage = {};
- damage.width = overlay->visible_width;
- damage.height = overlay->visible_height;
+ damage.width = chart->visible_width;
+ damage.height = chart->visible_height;
*res_damaged_region = XFixesCreateRegion(xserver->display, &damage, 1);
}
}
-/* render the overlay into a picture at the specified coordinates and dimensions */
-void vwm_overlay_render(vwm_overlays_t *overlays, vwm_overlay_t *overlay, int op, Picture dest, int x, int y, int width, int height)
+/* render the chart into a picture at the specified coordinates and dimensions */
+void vwm_chart_render(vwm_charts_t *charts, vwm_chart_t *chart, int op, Picture dest, int x, int y, int width, int height)
{
- vwm_xserver_t *xserver = overlays->xserver;
+ vwm_xserver_t *xserver = charts->xserver;
- if (!overlay->width || !overlay->height)
+ if (!chart->width || !chart->height)
return;
- /* draw the monitoring overlay atop dest, note we stay within the window borders here. */
- XRenderComposite(xserver->display, op, overlay->picture, None, dest,
- 0, 0, 0, 0, /* src x,y, maxk x, y */
- x, /* dst x */
- y, /* dst y */
- width, MIN(vwm_overlay_composed_height(overlays, overlay), height) /* FIXME */); /* w, h */
+ /* draw the monitoring chart atop dest, note we stay within the window borders here. */
+ XRenderComposite(xserver->display, op, chart->picture, None, dest,
+ 0, 0, 0, 0, /* src x,y, maxk x, y */
+ x, /* dst x */
+ y, /* dst y */
+ width, MIN(vwm_chart_composed_height(charts, chart), height) /* FIXME */); /* w, h */
}
/* increase the sample rate relative to current using the table of intervals */
-void vwm_overlays_rate_increase(vwm_overlays_t *overlays)
+void vwm_charts_rate_increase(vwm_charts_t *charts)
{
int i;
- assert(overlays);
+ assert(charts);
for (i = 0; i < NELEMS(sampling_intervals); i++) {
- if (sampling_intervals[i] < overlays->sampling_interval) {
- overlays->sampling_interval = sampling_intervals[i];
+ if (sampling_intervals[i] < charts->sampling_interval) {
+ charts->sampling_interval = sampling_intervals[i];
break;
}
}
@@ -1154,15 +1154,15 @@ void vwm_overlays_rate_increase(vwm_overlays_t *overlays)
/* decrease the sample rate relative to current using the table of intervals */
-void vwm_overlays_rate_decrease(vwm_overlays_t *overlays)
+void vwm_charts_rate_decrease(vwm_charts_t *charts)
{
int i;
- assert(overlays);
+ assert(charts);
for (i = NELEMS(sampling_intervals) - 1; i >= 0; i--) {
- if (sampling_intervals[i] > overlays->sampling_interval) {
- overlays->sampling_interval = sampling_intervals[i];
+ if (sampling_intervals[i] > charts->sampling_interval) {
+ charts->sampling_interval = sampling_intervals[i];
break;
}
}
@@ -1170,12 +1170,12 @@ void vwm_overlays_rate_decrease(vwm_overlays_t *overlays)
/* set an arbitrary sample rate rather than using one of the presets, 0 to pause */
-void vwm_overlays_rate_set(vwm_overlays_t *overlays, unsigned hertz)
+void vwm_charts_rate_set(vwm_charts_t *charts, unsigned hertz)
{
- assert(overlays);
+ assert(charts);
/* XXX: note floating point divide by 0 simply results in infinity */
- overlays->sampling_interval = 1.0f / (float)hertz;
+ charts->sampling_interval = 1.0f / (float)hertz;
}
@@ -1195,36 +1195,36 @@ static float delta(struct timeval *cur, struct timeval *prev)
}
-/* update the overlays if necessary, return if updating occurred, and duration before another update needed in *desired_delay */
-int vwm_overlays_update(vwm_overlays_t *overlays, int *desired_delay)
+/* update the charts if necessary, return if updating occurred, and duration before another update needed in *desired_delay */
+int vwm_charts_update(vwm_charts_t *charts, int *desired_delay)
{
float this_delta = 0.0f;
int ret = 0;
- gettimeofday(&overlays->maybe_sample, NULL);
- if ((overlays->sampling_interval == INFINITY && !overlays->sampling_paused) || /* XXX this is kind of a kludge to get the 0 Hz indicator drawn before pausing */
- (overlays->sampling_interval != INFINITY && ((this_delta = delta(&overlays->maybe_sample, &overlays->this_sample)) >= overlays->sampling_interval))) {
+ gettimeofday(&charts->maybe_sample, NULL);
+ if ((charts->sampling_interval == INFINITY && !charts->sampling_paused) || /* XXX this is kind of a kludge to get the 0 Hz indicator drawn before pausing */
+ (charts->sampling_interval != INFINITY && ((this_delta = delta(&charts->maybe_sample, &charts->this_sample)) >= charts->sampling_interval))) {
vmon_sys_stat_t *sys_stat;
/* automatically lower the sample rate if we can't keep up with the current sample rate */
- if (overlays->sampling_interval < INFINITY &&
- overlays->sampling_interval <= overlays->prev_sampling_interval &&
- this_delta >= (overlays->sampling_interval * 1.5)) {
+ if (charts->sampling_interval < INFINITY &&
+ charts->sampling_interval <= charts->prev_sampling_interval &&
+ this_delta >= (charts->sampling_interval * 1.5)) {
/* require > 1 contiguous drops before lowering the rate, tolerates spurious one-off stalls */
- if (++overlays->contiguous_drops > 2)
- vwm_overlays_rate_decrease(overlays);
+ if (++charts->contiguous_drops > 2)
+ vwm_charts_rate_decrease(charts);
} else {
- overlays->contiguous_drops = 0;
+ charts->contiguous_drops = 0;
}
/* age the sys-wide sample data into "last" variables, before the new sample overwrites them. */
- overlays->last_sample = overlays->this_sample;
- overlays->this_sample = overlays->maybe_sample;
- if ((sys_stat = overlays->vmon.stores[VMON_STORE_SYS_STAT])) {
- overlays->last_user_cpu = sys_stat->user;
- overlays->last_system_cpu = sys_stat->system;
- overlays->last_total = sys_stat->user +
+ charts->last_sample = charts->this_sample;
+ charts->this_sample = charts->maybe_sample;
+ if ((sys_stat = charts->vmon.stores[VMON_STORE_SYS_STAT])) {
+ charts->last_user_cpu = sys_stat->user;
+ charts->last_system_cpu = sys_stat->system;
+ charts->last_total = sys_stat->user +
sys_stat->nice +
sys_stat->system +
sys_stat->idle +
@@ -1234,19 +1234,19 @@ int vwm_overlays_update(vwm_overlays_t *overlays, int *desired_delay)
sys_stat->steal +
sys_stat->guest;
- overlays->last_idle = sys_stat->idle;
- overlays->last_iowait = sys_stat->iowait;
+ charts->last_idle = sys_stat->idle;
+ charts->last_iowait = sys_stat->iowait;
}
- ret = vmon_sample(&overlays->vmon); /* XXX: calls proc_sample_callback() for explicitly monitored processes after sampling their descendants */
+ ret = vmon_sample(&charts->vmon); /* XXX: calls proc_sample_callback() for explicitly monitored processes after sampling their descendants */
/* XXX: also calls sample_callback() per invocation after sampling the sys wants */
- overlays->sampling_paused = (overlays->sampling_interval == INFINITY);
- overlays->prev_sampling_interval = overlays->sampling_interval;
+ charts->sampling_paused = (charts->sampling_interval == INFINITY);
+ charts->prev_sampling_interval = charts->sampling_interval;
}
/* TODO: make some effort to compute how long to sleep, but this is perfectly fine for now. */
- *desired_delay = overlays->sampling_interval == INFINITY ? -1 : overlays->sampling_interval * 300.0;
+ *desired_delay = charts->sampling_interval == INFINITY ? -1 : charts->sampling_interval * 300.0;
return ret;
}
diff --git a/src/overlays.h b/src/overlays.h
index ee965ff..222b968 100644
--- a/src/overlays.h
+++ b/src/overlays.h
@@ -1,26 +1,26 @@
-#ifndef _OVERLAYS_H
-#define _OVERLAYS_H
+#ifndef _CHARTS_H
+#define _CHARTS_H
#include <X11/extensions/Xfixes.h>
#include <X11/extensions/Xrender.h>
#include "xserver.h"
-typedef struct _vwm_overlays_t vwm_overlays_t;
-typedef struct _vwm_overlay_t vwm_overlay_t;
+typedef struct _vwm_charts_t vwm_charts_t;
+typedef struct _vwm_chart_t vwm_chart_t;
-vwm_overlays_t * vwm_overlays_create(vwm_xserver_t *xserver);
-void vwm_overlays_destroy(vwm_overlays_t *overlays);
-void vwm_overlays_rate_increase(vwm_overlays_t *overlays);
-void vwm_overlays_rate_decrease(vwm_overlays_t *overlays);
-void vwm_overlays_rate_set(vwm_overlays_t *overlays, unsigned hertz);
-int vwm_overlays_update(vwm_overlays_t *overlays, int *desired_delay);
+vwm_charts_t * vwm_charts_create(vwm_xserver_t *xserver);
+void vwm_charts_destroy(vwm_charts_t *charts);
+void vwm_charts_rate_increase(vwm_charts_t *charts);
+void vwm_charts_rate_decrease(vwm_charts_t *charts);
+void vwm_charts_rate_set(vwm_charts_t *charts, unsigned hertz);
+int vwm_charts_update(vwm_charts_t *charts, int *desired_delay);
-vwm_overlay_t * vwm_overlay_create(vwm_overlays_t *overlays, int pid, int width, int height);
-void vwm_overlay_destroy(vwm_overlays_t *overlays, vwm_overlay_t *overlay);
-void vwm_overlay_reset_snowflakes(vwm_overlays_t *overlays, vwm_overlay_t *overlay);
-int vwm_overlay_set_visible_size(vwm_overlays_t *overlays, vwm_overlay_t *overlay, int width, int height);
-void vwm_overlay_compose(vwm_overlays_t *overlays, vwm_overlay_t *overlay, XserverRegion *res_damaged_region);
-void vwm_overlay_render(vwm_overlays_t *overlays, vwm_overlay_t *overlay, int op, Picture dest, int x, int y, int width, int height);
+vwm_chart_t * vwm_chart_create(vwm_charts_t *charts, int pid, int width, int height);
+void vwm_chart_destroy(vwm_charts_t *charts, vwm_chart_t *chart);
+void vwm_chart_reset_snowflakes(vwm_charts_t *charts, vwm_chart_t *chart);
+int vwm_chart_set_visible_size(vwm_charts_t *charts, vwm_chart_t *chart, int width, int height);
+void vwm_chart_compose(vwm_charts_t *charts, vwm_chart_t *chart, XserverRegion *res_damaged_region);
+void vwm_chart_render(vwm_charts_t *charts, vwm_chart_t *chart, int op, Picture dest, int x, int y, int width, int height);
#endif
diff --git a/src/vmon.c b/src/vmon.c
index d31af2d..da3a900 100644
--- a/src/vmon.c
+++ b/src/vmon.c
@@ -31,12 +31,12 @@
#include "util.h"
#include "xserver.h"
-/* vmon exposes the monitoring overlays to the shell in an strace-like cli */
+/* vmon exposes the monitoring charts to the shell in an strace-like cli */
typedef struct vmon_t {
vwm_xserver_t *xserver;
- vwm_overlays_t *overlays;
- vwm_overlay_t *overlay;
+ vwm_charts_t *charts;
+ vwm_chart_t *chart;
Window window;
int width, height;
Picture picture;
@@ -225,7 +225,7 @@ static int vmon_handle_argv(vmon_t *vmon, int argc, char * const argv[])
if (!parse_flag_int(argv, end, argv + 1, 1, 1000, &hertz))
return 0;
- vwm_overlays_rate_set(vmon->overlays, hertz);
+ vwm_charts_rate_set(vmon->charts, hertz);
last = ++argv;
} else if (is_flag(*argv, "-h", "--help")) {
@@ -310,21 +310,21 @@ static vmon_t * vmon_startup(int argc, char * const argv[])
goto _err_free;
}
- vmon->overlays = vwm_overlays_create(vmon->xserver);
- if (!vmon->overlays) {
- VWM_ERROR("unable to create overlays instance");
+ vmon->charts = vwm_charts_create(vmon->xserver);
+ if (!vmon->charts) {
+ VWM_ERROR("unable to create charts instance");
goto _err_xserver;
}
if (!vmon_handle_argv(vmon, argc, argv)) {
VWM_ERROR("unable to handle arguments");
- goto _err_overlays;
+ goto _err_charts;
}
- vmon->overlay = vwm_overlay_create(vmon->overlays, vmon->pid, vmon->width, vmon->height);
- if (!vmon->overlay) {
- VWM_ERROR("unable to create overlay");
- goto _err_overlays;
+ vmon->chart = vwm_chart_create(vmon->charts, vmon->pid, vmon->width, vmon->height);
+ if (!vmon->chart) {
+ VWM_ERROR("unable to create chart");
+ goto _err_charts;
}
vmon->window = XCreateSimpleWindow(vmon->xserver->display, XSERVER_XROOT(vmon->xserver), 0, 0, vmon->width, vmon->height, 1, 0, 0);
@@ -337,8 +337,8 @@ static vmon_t * vmon_startup(int argc, char * const argv[])
return vmon;
-_err_overlays:
- vwm_overlays_destroy(vmon->overlays);
+_err_charts:
+ vwm_charts_destroy(vmon->charts);
_err_xserver:
vwm_xserver_close(vmon->xserver);
_err_free:
@@ -355,21 +355,21 @@ static void vmon_shutdown(vmon_t *vmon)
assert(vmon->xserver);
XDestroyWindow(vmon->xserver->display, vmon->window);
- vwm_overlay_destroy(vmon->overlays, vmon->overlay);
- vwm_overlays_destroy(vmon->overlays);
+ vwm_chart_destroy(vmon->charts, vmon->chart);
+ vwm_charts_destroy(vmon->charts);
vwm_xserver_close(vmon->xserver);
free(vmon);
}
-/* resize the overlay (in response to configure events) */
+/* resize the chart (in response to configure events) */
static void vmon_resize(vmon_t *vmon, int width, int height)
{
assert(vmon);
vmon->width = width;
vmon->height = height;
- vwm_overlay_set_visible_size(vmon->overlays, vmon->overlay, width, height);
+ vwm_chart_set_visible_size(vmon->charts, vmon->chart, width, height);
}
@@ -385,11 +385,11 @@ static void vmon_process_event(vmon_t *vmon)
switch (ev.type) {
case ConfigureNotify:
vmon_resize(vmon, ev.xconfigure.width, ev.xconfigure.height);
- vwm_overlay_compose(vmon->overlays, vmon->overlay, NULL);
- vwm_overlay_render(vmon->overlays, vmon->overlay, PictOpSrc, vmon->picture, 0, 0, vmon->width, vmon->height);
+ vwm_chart_compose(vmon->charts, vmon->chart, NULL);
+ vwm_chart_render(vmon->charts, vmon->chart, PictOpSrc, vmon->picture, 0, 0, vmon->width, vmon->height);
break;
case Expose:
- vwm_overlay_render(vmon->overlays, vmon->overlay, PictOpSrc, vmon->picture, 0, 0, vmon->width, vmon->height);
+ vwm_chart_render(vmon->charts, vmon->chart, PictOpSrc, vmon->picture, 0, 0, vmon->width, vmon->height);
break;
default:
VWM_TRACE("unhandled event: %x\n", ev.type);
@@ -414,9 +414,9 @@ int main(int argc, char * const argv[])
while (!vmon->done) {
int delay;
- if (vwm_overlays_update(vmon->overlays, &delay)) {
- vwm_overlay_compose(vmon->overlays, vmon->overlay, NULL);
- vwm_overlay_render(vmon->overlays, vmon->overlay, PictOpSrc, vmon->picture, 0, 0, vmon->width, vmon->height);
+ if (vwm_charts_update(vmon->charts, &delay)) {
+ vwm_chart_compose(vmon->charts, vmon->chart, NULL);
+ vwm_chart_render(vmon->charts, vmon->chart, PictOpSrc, vmon->picture, 0, 0, vmon->width, vmon->height);
}
if (XPending(vmon->xserver->display) || poll(&pfd, 1, delay) > 0)
diff --git a/src/vwm.c b/src/vwm.c
index 0e92bdb..7ce6259 100644
--- a/src/vwm.c
+++ b/src/vwm.c
@@ -79,20 +79,20 @@ static vwm_t * vwm_startup(void)
goto _err_free;
}
- if (!(vwm->overlays = vwm_overlays_create(vwm->xserver))) {
- VWM_ERROR("Failed to create overlays");
+ if (!(vwm->charts = vwm_charts_create(vwm->xserver))) {
+ VWM_ERROR("Failed to create charts");
goto _err_xclose;
}
/* query the needed X extensions */
if (!XQueryExtension(VWM_XDISPLAY(vwm), COMPOSITE_NAME, &composite_opcode, &composite_event, &composite_error)) {
VWM_ERROR("No composite extension available");
- goto _err_overlays;
+ goto _err_charts;
}
if (!XDamageQueryExtension(VWM_XDISPLAY(vwm), &vwm->damage_event, &vwm->damage_error)) {
VWM_ERROR("No damage extension available");
- goto _err_overlays;
+ goto _err_charts;
}
if (XSyncQueryExtension(VWM_XDISPLAY(vwm), &sync_event, &sync_error)) {
@@ -111,7 +111,7 @@ static vwm_t * vwm_startup(void)
/* get our scheduling priority, clients are launched with a priority LAUNCHED_RELATIVE_PRIORITY nicer than this */
if ((vwm->priority = getpriority(PRIO_PROCESS, getpid())) == -1) {
VWM_ERROR("Cannot get scheduling priority");
- goto _err_overlays;
+ goto _err_charts;
}
vwm->wm_delete_atom = XInternAtom(VWM_XDISPLAY(vwm), "WM_DELETE_WINDOW", False);
@@ -161,8 +161,8 @@ static vwm_t * vwm_startup(void)
return vwm;
-_err_overlays:
- vwm_overlays_destroy(vwm->overlays);
+_err_charts:
+ vwm_charts_destroy(vwm->charts);
_err_xclose:
vwm_xserver_close(vwm->xserver);
@@ -180,7 +180,7 @@ void vwm_shutdown(vwm_t *vwm)
char *quit_console_args[] = {"/bin/sh", "-c", "screen -dr " CONSOLE_SESSION_STRING " -X quit", NULL};
vwm_launch(vwm, quit_console_args, VWM_LAUNCH_MODE_FG);
- vwm_overlays_destroy(vwm->overlays);
+ vwm_charts_destroy(vwm->charts);
vwm_xserver_close(vwm->xserver);
/* TODO there's more shit to cleanup here, but we're exiting anyways. */
free(vwm);
@@ -312,7 +312,7 @@ int main(int argc, char *argv[])
do {
int delay;
- if (vwm_overlays_update(vwm->overlays, &delay))
+ if (vwm_charts_update(vwm->charts, &delay))
vwm_composite_repaint_needed(vwm);
XFlush(VWM_XDISPLAY(vwm));
diff --git a/src/vwm.h b/src/vwm.h
index 3db7e7b..e483478 100644
--- a/src/vwm.h
+++ b/src/vwm.h
@@ -34,7 +34,7 @@ typedef struct _vwm_desktop_t vwm_desktop_t;
typedef struct _vwm_t {
vwm_xserver_t *xserver; /* global xserver instance */
- vwm_overlays_t *overlays; /* golbal overlays instance */
+ vwm_charts_t *charts; /* golbal charts instance */
/* extra X stuff needed by vwm */
Atom wm_delete_atom;
diff --git a/src/xevent.c b/src/xevent.c
index cc946bd..ad8c27d 100644
--- a/src/xevent.c
+++ b/src/xevent.c
@@ -108,8 +108,8 @@ void vwm_xevent_handle_configure_notify(vwm_t *vwm, XConfigureEvent *ev)
vwm_xwin_restack(vwm, xwin, ev->above);
XGetWindowAttributes(VWM_XDISPLAY(vwm), ev->window, &attrs);
vwm_composite_handle_configure(vwm, xwin, &attrs);
- if (xwin->overlay)
- vwm_overlay_set_visible_size(vwm->overlays, xwin->overlay, attrs.width, attrs.height);
+ if (xwin->chart)
+ vwm_chart_set_visible_size(vwm->charts, xwin->chart, attrs.width, attrs.height);
VWM_TRACE("pre x=%i y=%i w=%i h=%i\n", xwin->attrs.x, xwin->attrs.y, xwin->attrs.width, xwin->attrs.height);
xwin->attrs = attrs;
@@ -222,7 +222,7 @@ void vwm_xevent_handle_property_notify(vwm_t *vwm, XPropertyEvent *ev)
if ((xwin = vwm_xwin_lookup(vwm, ev->window)) &&
ev->atom == vwm->wm_pid_atom &&
ev->state == PropertyNewValue)
- vwm_xwin_setup_overlay(vwm, xwin);
+ vwm_xwin_setup_chart(vwm, xwin);
}
diff --git a/src/xserver.h b/src/xserver.h
index 694513a..1f33775 100644
--- a/src/xserver.h
+++ b/src/xserver.h
@@ -7,7 +7,7 @@
#define XSERVER_XVISUAL(_xserver) DefaultVisual((_xserver)->display, (_xserver)->screen_num)
#define XSERVER_XDEPTH(_xserver) DefaultDepth((_xserver)->display, (_xserver)->screen_num)
-/* bare xserver context, split out for vmon's shared monitoring overlay use sake */
+/* bare xserver context, split out for vmon's shared monitoring chart use sake */
typedef struct vwm_xserver_t {
Display *display;
Colormap cmap;
diff --git a/src/xwindow.c b/src/xwindow.c
index 3812ff2..7590139 100644
--- a/src/xwindow.c
+++ b/src/xwindow.c
@@ -111,17 +111,17 @@ static int vwm_xwin_get_pid(vwm_t *vwm, vwm_xwindow_t *xwin)
}
-/* establishes an overlay on xwin if appropriate and the pid is available */
-void vwm_xwin_setup_overlay(vwm_t *vwm, vwm_xwindow_t *xwin)
+/* establishes an chart on xwin if appropriate and the pid is available */
+void vwm_xwin_setup_chart(vwm_t *vwm, vwm_xwindow_t *xwin)
{
/* XXX FIXME: handle getting called multiple times on the same xwin */
- /* for regular windows create a monitoring overlay */
+ /* for regular windows create a monitoring chart */
if (!xwin->attrs.override_redirect) {
int pid = vwm_xwin_get_pid(vwm, xwin);
if (pid != -1)
- xwin->overlay = vwm_overlay_create(vwm->overlays, pid, xwin->attrs.width, xwin->attrs.height);
+ xwin->chart = vwm_chart_create(vwm->charts, pid, xwin->attrs.width, xwin->attrs.height);
}
}
@@ -168,7 +168,7 @@ vwm_xwindow_t * vwm_xwin_create(vwm_t *vwm, Window win, vwm_grab_mode_t grabbed)
*/
xwin->client_mapped = (attrs.map_state != IsUnmapped);
- vwm_xwin_setup_overlay(vwm, xwin);
+ vwm_xwin_setup_chart(vwm, xwin);
vwm_composite_xwin_create(vwm, xwin);
list_add_tail(&xwin->xwindows, &vwm->xwindows); /* created windows are always placed on the top of the stacking order */
@@ -199,8 +199,8 @@ void vwm_xwin_destroy(vwm_t *vwm, vwm_xwindow_t *xwin)
if (xwin->name)
XFree(xwin->name);
- if (xwin->overlay)
- vwm_overlay_destroy(vwm->overlays, xwin->overlay);
+ if (xwin->chart)
+ vwm_chart_destroy(vwm->charts, xwin->chart);
vwm_composite_xwin_destroy(vwm, xwin);
diff --git a/src/xwindow.h b/src/xwindow.h
index 0d2b322..e17b4db 100644
--- a/src/xwindow.h
+++ b/src/xwindow.h
@@ -21,7 +21,7 @@ typedef struct _vwm_xwindow_t {
Picture picture; /* X picture object representing the window (for compositing) */
Pixmap pixmap; /* X pixmap object representing the window (for compositing) */
- vwm_overlay_t *overlay; /* monitoring overlay state */
+ vwm_chart_t *chart; /* monitoring chart state */
char *name; /* client name */
unsigned int client_mapped:1; /* is the window currently mapped (by client) */
@@ -44,7 +44,7 @@ void vwm_xwin_monitor(vwm_t *vwm, vwm_xwindow_t *xwin);
vwm_xwindow_t * vwm_xwin_create(vwm_t *vwm, Window win, vwm_grab_mode_t grabbed);
void vwm_xwin_destroy(vwm_t *vwm, vwm_xwindow_t *xwin);
void vwm_xwin_restack(vwm_t *vwm, vwm_xwindow_t *xwin, Window new_above);
-void vwm_xwin_setup_overlay(vwm_t *vwm, vwm_xwindow_t *xwin);
+void vwm_xwin_setup_chart(vwm_t *vwm, vwm_xwindow_t *xwin);
int vwm_xwin_create_existing(vwm_t *vwm);
© All Rights Reserved