libwm

library for X windows manipulations
git clone git://z3bra.org/libwm
Log | Files | Refs | LICENSE

commit d9726345df54827e0e23029f47aefff3daec100b
parent e72afad71ff21c17964634f381b1290acb6ff522
Author: dcat <dcat@iotek.org>
Date:   Sun Nov 22 02:53:00 2015

wm_get_focus

Diffstat:
 libwm.c | 18 ++++++++++++++++++
 wm.h    |  6 ++++++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/libwm.c b/libwm.c @@ -109,6 +109,24 @@ wm_get_windows(xcb_window_t w, xcb_window_t **l) return childnum; } +xcb_window_t +wm_get_focus(void) +{ + xcb_window_t w = 0; + xcb_get_input_focus_cookie_t c; + xcb_get_input_focus_reply_t *r; + + c = xcb_get_input_focus(conn); + r = xcb_get_input_focus_reply(conn, c, NULL); + if (r == NULL) + return -1; + + w = r->focus; + free(r); + return w; +} + + int wm_get_attribute(xcb_window_t w, int attr) { diff --git a/wm.h b/wm.h @@ -104,6 +104,12 @@ int wm_get_screen(); int wm_get_windows(xcb_window_t wid, xcb_window_t **list); /* + * Get focused window identifier + * returns -1 on error + */ +xcb_window_t wm_get_focus(void); + +/* * Retrive the value of an attribute for a specific windows. * The possible values for the attributes are: * ATTR_W - width