diff options
author | Vito Caputo <vcaputo@gnugeneration.com> | 2017-03-10 14:26:56 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@gnugeneration.com> | 2017-03-14 19:41:48 -0700 |
commit | 413ca350cf9ed8d0b7678e2e43fde7e937916e64 (patch) | |
tree | aaaf04ff36366916e74dbc4d8de6bce883b20955 /src | |
parent | 448423ee1e933d926e6089a56d39026054f41a59 (diff) |
xwindow: add vwm_xwin_get_pid() helper
Diffstat (limited to 'src')
-rw-r--r-- | src/xwindow.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/xwindow.c b/src/xwindow.c index f19180e..e22ca49 100644 --- a/src/xwindow.c +++ b/src/xwindow.c @@ -95,6 +95,26 @@ int vwm_xwin_is_mapped(vwm_t *vwm, vwm_xwindow_t *xwin) } +/* helper to get the client pid for a window */ +static int vwm_xwin_get_pid(vwm_t *vwm, vwm_xwindow_t *xwin) +{ + Atom type; + int fmt; + unsigned long nitems; + unsigned long nbytes; + long *foo = NULL; + int pid; + + if (XGetWindowProperty(VWM_XDISPLAY(vwm), xwin->id, vwm->wm_pid_atom, 0, 1, False, XA_CARDINAL, + &type, &fmt, &nitems, &nbytes, (unsigned char **)&foo) != Success || !foo) return -1; + + pid = *foo; + XFree(foo); + + return pid; +} + + /* 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) |