summaryrefslogtreecommitdiff
path: root/src/xwindow.c
diff options
context:
space:
mode:
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