diff options
author | Vito Caputo <vcaputo@gnugeneration.com> | 2016-08-28 00:36:53 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@gnugeneration.com> | 2016-09-09 14:14:31 -0700 |
commit | 4642216f70dd98134a79f9299b7ca4bc876649c7 (patch) | |
tree | bdf9fd892bc54a2f2a678a9828c6af9d9fc8bed2 /src/xwindow.h | |
parent | e99f5ac1293a0ae1f498bc4c73c4c04e4edb8665 (diff) |
*: 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.
Diffstat (limited to 'src/xwindow.h')
-rw-r--r-- | src/xwindow.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/xwindow.h b/src/xwindow.h new file mode 100644 index 0000000..f3be681 --- /dev/null +++ b/src/xwindow.h @@ -0,0 +1,52 @@ +#ifndef _XWIN_H +#define _XWIN_H + +#include <X11/extensions/Xdamage.h> +#include <X11/extensions/Xrender.h> +#include <X11/Xlib.h> + +#include "libvmon/vmon.h" +#include "list.h" +#include "overlay.h" + +typedef struct _vwm_t vwm_t; +typedef struct _vwm_window_t vwm_window_t; + +/* every window gets this, even non-managed ones. For compositing vwm must track everything visible, even popup menus. */ +typedef struct _vwm_xwindow_t { + list_head_t xwindows; /* global list of all windows kept in X stacking order */ + + Window id; /* X Window backing this instance */ + XWindowAttributes attrs; /* X window's current attributes, kept up-to-date in handling of ConfigureNotify events */ + Damage damage; /* X damage object associated with the window (for compositing) */ + Picture picture; /* X picture object representing the window (for compositing) */ + Pixmap pixmap; /* X pixmap object representing the window (for compositing) */ + + vmon_proc_t *monitor; /* vmon process monitor handle, may be NULL if for example the X client doesn't supply a PID */ + vwm_overlay_t overlay; /* monitoring overlay state */ + + char *name; /* client name */ + unsigned int mapped:1; /* is the window currently mapped (by client) */ + unsigned int occluded:1; /* is the window occluded entirely by another window? (used and valid only during paint_all()) */ + /* if only Xorg could send VisibilityNotify events when requested for redirected windows :( */ + vwm_window_t *managed; /* is the window "managed"? NULL or this points to the managed context of the window */ +} vwm_xwindow_t; + +/* creates and potentially manages a new window (called in response to CreateNotify events, and during startup for all existing windows) */ +/* if the window is already mapped and not an override_redirect window, it becomes managed here. */ +typedef enum _vwm_grab_mode_t { + VWM_NOT_GRABBED = 0, + VWM_GRABBED +} vwm_grab_mode_t; + +void vwm_xwin_message(vwm_t *vwm, vwm_xwindow_t *xwin, Atom type, long foo); +vwm_xwindow_t * vwm_xwin_lookup(vwm_t *vwm, Window win); +int vwm_xwin_is_mapped(vwm_t *vwm, vwm_xwindow_t *xwin); +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); +int vwm_xwin_create_existing(vwm_t *vwm); + + +#endif |