From 4642216f70dd98134a79f9299b7ca4bc876649c7 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sun, 28 Aug 2016 00:36:53 -0700 Subject: *: refactor all the things Long overdue house cleaning. The addition of compositing/monitoring overlays in vwm3 pushed vwm well past what is a reasonable size for a simple thousand line file. This is a first step towards restoring sanity in the code, but no behavioral differences are intended, this is mostly just shuffling around and organizing code. I expect some performance regressions initially, follow-on commits will make more improvements to that end as the dust settles. --- src/overlay.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/overlay.h (limited to 'src/overlay.h') diff --git a/src/overlay.h b/src/overlay.h new file mode 100644 index 0000000..94e2dca --- /dev/null +++ b/src/overlay.h @@ -0,0 +1,36 @@ +#ifndef _OVERLAY_H +#define _OVERLAY_H + +#include +#include + +typedef struct _vwm_t vwm_t; +typedef struct _vwm_xwindow_t vwm_xwindow_t; + +/* everything needed by the per-window overlay's context */ +typedef struct _vwm_overlay_t { + Pixmap text_pixmap; /* pixmap for overlayed 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 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 */ +} vwm_overlay_t; + +int vwm_overlay_xwin_composed_height(vwm_t *vwm, vwm_xwindow_t *xwin); +void vwm_overlay_xwin_reset_snowflakes(vwm_t *vwm, vwm_xwindow_t *xwin); +void vwm_overlay_xwin_create(vwm_t *vwm, vwm_xwindow_t *xwin); +void vwm_overlay_xwin_destroy(vwm_t *vwm, vwm_xwindow_t *xwin); +void vwm_overlay_xwin_compose(vwm_t *vwm, vwm_xwindow_t *xwin); +void vwm_overlay_rate_increase(vwm_t *vwm); +void vwm_overlay_rate_decrease(vwm_t *vwm); +void vwm_overlay_update(vwm_t *vwm, int *desired_delay); + +#endif -- cgit v1.2.3 From 7a5e600e8f67f6fa170d3bd27de7e28150c2dca5 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Thu, 8 Sep 2016 10:27:29 -0700 Subject: 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. --- src/overlay.h | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'src/overlay.h') diff --git a/src/overlay.h b/src/overlay.h index 94e2dca..dd60319 100644 --- a/src/overlay.h +++ b/src/overlay.h @@ -9,19 +9,20 @@ typedef struct _vwm_xwindow_t vwm_xwindow_t; /* everything needed by the per-window overlay's context */ typedef struct _vwm_overlay_t { - Pixmap text_pixmap; /* pixmap for overlayed 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 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 */ + Pixmap text_pixmap; /* pixmap for overlayed 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 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; int vwm_overlay_xwin_composed_height(vwm_t *vwm, vwm_xwindow_t *xwin); -- cgit v1.2.3