diff options
author | Richard Grenville <[email protected]> | 2013-11-10 10:13:18 +0800 |
---|---|---|
committer | Richard Grenville <[email protected]> | 2013-11-10 10:13:18 +0800 |
commit | 640ef0437814dbc4df57a275cbadecb368ad0950 (patch) | |
tree | bb4b5ac09bd8e7acb5319a4b2211bfd859d1515f /compton.h | |
parent | ed99f1b2c9fe5c2ff5efe0af204b381aa9fdcc3e (diff) | |
download | tdebase-640ef0437814dbc4df57a275cbadecb368ad0950.tar.gz tdebase-640ef0437814dbc4df57a275cbadecb368ad0950.zip |
Misc: Add properties to the registration window
Add WM_CLASS, COMPTON_VERSION, and _NET_WM_PID properties to the
registration window, to ease the development of pcman's compton-conf.
Diffstat (limited to 'compton.h')
-rw-r--r-- | compton.h | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -337,9 +337,7 @@ isdamagenotify(session_t *ps, const XEvent *ev) { */ static inline XTextProperty * make_text_prop(session_t *ps, char *str) { - XTextProperty *pprop = malloc(sizeof(XTextProperty)); - if (!pprop) - printf_errfq(1, "(): Failed to allocate memory."); + XTextProperty *pprop = cmalloc(1, XTextProperty); if (XmbTextListToTextProperty(ps->dpy, &str, 1, XStringStyle, pprop)) { cxfree(pprop->value); @@ -350,6 +348,25 @@ make_text_prop(session_t *ps, char *str) { return pprop; } + +/** + * Set a single-string text property on a window. + */ +static inline bool +wid_set_text_prop(session_t *ps, Window wid, Atom prop_atom, char *str) { + XTextProperty *pprop = make_text_prop(ps, str); + if (!pprop) { + printf_errf("(\"%s\"): Failed to make text property.", str); + return false; + } + + XSetTextProperty(ps->dpy, wid, pprop, prop_atom); + cxfree(pprop->value); + cxfree(pprop); + + return true; +} + static void run_fade(session_t *ps, win *w, unsigned steps); |