summaryrefslogtreecommitdiff
path: root/src/xwindow.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@gnugeneration.com>2017-03-11 02:29:37 -0800
committerVito Caputo <vcaputo@gnugeneration.com>2017-03-14 19:41:48 -0700
commit2373a54d2d52961a841dace71b505d2c20f5c040 (patch)
treede534cf0e4f7f1e917faf2b8fc07eb80a1749f96 /src/xwindow.c
parentb99f0728ec7229423cfc65d25711208f6cac1c0e (diff)
overlays: extricate overlays from vwm internals
- Move vmon_proc_t under vwm_overlay_t. - Privatize vwm_overlay_t. - Update xwindow.c to dynamically create and destroy overlays. - Cease supplying vwm_t to vwm_overlays_create(), now just pass in the bare vwm_xserver_t. - Update all vwm_overlay_* functions to operate on vwm_overlays_t and vwm_overlay_t. Only vwm_overlays_create() receives the xserver, which it then embeds within the returned vwm_overlay_t. - Eliminate _xwin_ flavors of overlay functions, largely mechanical rename eliminating the _xwin_ from the names during the previous pass of switching from vwm_t & vwm_xwindow_t to vwm_overlays_t & vwm_overlay_t parameters. - Change vwm_overlay_compose() to store damage in supplied pointer, the caller is expected to make use of the damage information now because the overlay code doesn't know about the window its coordinate space.
Diffstat (limited to 'src/xwindow.c')
-rw-r--r--src/xwindow.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/xwindow.c b/src/xwindow.c
index a01b212..8dd2937 100644
--- a/src/xwindow.c
+++ b/src/xwindow.c
@@ -115,6 +115,20 @@ 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)
+{
+ /* XXX FIXME: handle getting called multiple times on the same xwin */
+
+ /* for regular windows create a monitoring overlay */
+ 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);
+ }
+}
+
+
/* 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. */
vwm_xwindow_t * vwm_xwin_create(vwm_t *vwm, Window win, vwm_grab_mode_t grabbed)
@@ -145,8 +159,6 @@ vwm_xwindow_t * vwm_xwin_create(vwm_t *vwm, Window win, vwm_grab_mode_t grabbed)
xwin->attrs = attrs;
XFetchName(VWM_XDISPLAY(vwm), win, &xwin->name);
- xwin->overlay.gen_last_composed = -1;
-
/* This is so we get the PropertyNotify event and can get the pid when it's set post-create,
* with my _NET_WM_PID patch the property is immediately available */
XSelectInput(VWM_XDISPLAY(vwm), win, PropertyChangeMask);
@@ -156,7 +168,7 @@ vwm_xwindow_t * vwm_xwin_create(vwm_t *vwm, Window win, vwm_grab_mode_t grabbed)
* otherwise we could just use !xwin.managed to indicate unmapped, which is more vwm2-like, but insufficient when compositing. */
xwin->mapped = (attrs.map_state != IsUnmapped);
- vwm_overlay_xwin_create(vwm, xwin);
+ vwm_xwin_setup_overlay(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 */
@@ -186,7 +198,8 @@ void vwm_xwin_destroy(vwm_t *vwm, vwm_xwindow_t *xwin)
if (xwin->name) XFree(xwin->name);
- vwm_overlay_xwin_destroy(vwm, xwin);
+ if (xwin->overlay) vwm_overlay_destroy(vwm->overlays, xwin->overlay);
+
vwm_composite_xwin_destroy(vwm, xwin);
free(xwin);
© All Rights Reserved