mirror of
https://github.com/yshui/picom.git
synced 2024-11-18 13:55:36 -05:00
core: remove a bit more of Xlib dependencies
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
00ee5cb4b1
commit
ff70f6056e
2 changed files with 8 additions and 36 deletions
11
src/picom.c
11
src/picom.c
|
@ -955,9 +955,14 @@ static int register_cm(session_t *ps) {
|
|||
}
|
||||
|
||||
// Set COMPTON_VERSION
|
||||
if (!wid_set_text_prop(ps, ps->reg_win, get_atom(ps->atoms, "COMPTON_VERSION"),
|
||||
COMPTON_VERSION)) {
|
||||
log_error("Failed to set COMPTON_VERSION.");
|
||||
e = xcb_request_check(
|
||||
ps->c, xcb_change_property_checked(
|
||||
ps->c, XCB_PROP_MODE_REPLACE, ps->reg_win,
|
||||
get_atom(ps->atoms, "COMPTON_VERSION"), XCB_ATOM_STRING, 8,
|
||||
(uint32_t)strlen(COMPTON_VERSION), COMPTON_VERSION));
|
||||
if (e) {
|
||||
log_error_x_error(e, "Failed to set COMPTON_VERSION.");
|
||||
free(e);
|
||||
}
|
||||
|
||||
// Acquire X Selection _NET_WM_CM_S?
|
||||
|
|
33
src/picom.h
33
src/picom.h
|
@ -102,39 +102,6 @@ free_win_res_glx(session_t *ps attr_unused, struct managed_win *w attr_unused) {
|
|||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create a XTextProperty of a single string.
|
||||
*/
|
||||
static inline XTextProperty *make_text_prop(session_t *ps, char *str) {
|
||||
XTextProperty *pprop = ccalloc(1, XTextProperty);
|
||||
|
||||
if (XmbTextListToTextProperty(ps->dpy, &str, 1, XStringStyle, pprop)) {
|
||||
XFree(pprop->value);
|
||||
free(pprop);
|
||||
pprop = NULL;
|
||||
}
|
||||
|
||||
return pprop;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a single-string text property on a window.
|
||||
*/
|
||||
static inline bool
|
||||
wid_set_text_prop(session_t *ps, xcb_window_t wid, xcb_atom_t prop_atom, char *str) {
|
||||
XTextProperty *pprop = make_text_prop(ps, str);
|
||||
if (!pprop) {
|
||||
log_error("Failed to make text property: %s.", str);
|
||||
return false;
|
||||
}
|
||||
|
||||
XSetTextProperty(ps->dpy, wid, pprop, prop_atom);
|
||||
XFree(pprop->value);
|
||||
XFree(pprop);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dump an drawable's info.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue