Convert property management to XCB

I removed the error checking in compton.c because it was dead code.
XChangeProperty() always returns 1.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2018-10-03 14:13:59 +02:00 committed by Yuxuan Shui
parent a192bfb130
commit 8db6473d32
2 changed files with 9 additions and 10 deletions

View File

@ -3532,12 +3532,9 @@ register_cm(session_t *ps) {
// Set _NET_WM_PID // Set _NET_WM_PID
{ {
long pid = getpid(); uint32_t pid = getpid();
if (!XChangeProperty(ps->dpy, ps->reg_win, xcb_change_property(c, XCB_PROP_MODE_REPLACE, ps->reg_win,
get_atom(ps, "_NET_WM_PID"), XCB_ATOM_CARDINAL, 32, PropModeReplace, get_atom(ps, "_NET_WM_PID"), XCB_ATOM_CARDINAL, 32, 1, &pid);
(unsigned char *) &pid, 1)) {
printf_errf("(): Failed to set _NET_WM_PID.");
}
} }
// Set COMPTON_VERSION // Set COMPTON_VERSION

View File

@ -27,14 +27,16 @@ clear_cache_win_leaders(session_t *ps) {
static inline void static inline void
wid_set_opacity_prop(session_t *ps, Window wid, opacity_t val) { wid_set_opacity_prop(session_t *ps, Window wid, opacity_t val) {
const unsigned long v = val; const uint32_t v = val;
XChangeProperty(ps->dpy, wid, ps->atom_opacity, XCB_ATOM_CARDINAL, 32, xcb_connection_t *c = XGetXCBConnection(ps->dpy);
PropModeReplace, (unsigned char *) &v, 1); xcb_change_property(c, XCB_PROP_MODE_REPLACE, wid, ps->atom_opacity,
XCB_ATOM_CARDINAL, 32, 1, &v);
} }
static inline void static inline void
wid_rm_opacity_prop(session_t *ps, Window wid) { wid_rm_opacity_prop(session_t *ps, Window wid) {
XDeleteProperty(ps->dpy, wid, ps->atom_opacity); xcb_connection_t *c = XGetXCBConnection(ps->dpy);
xcb_delete_property(c, wid, ps->atom_opacity);
} }
/** /**