From 8db6473d32d7d6ed03c812c6071407b2b2aeaedf Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 3 Oct 2018 14:13:59 +0200 Subject: [PATCH] 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 --- src/compton.c | 9 +++------ src/win.c | 10 ++++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/compton.c b/src/compton.c index ca1c8e3..2ca970c 100644 --- a/src/compton.c +++ b/src/compton.c @@ -3532,12 +3532,9 @@ register_cm(session_t *ps) { // Set _NET_WM_PID { - long pid = getpid(); - if (!XChangeProperty(ps->dpy, ps->reg_win, - get_atom(ps, "_NET_WM_PID"), XCB_ATOM_CARDINAL, 32, PropModeReplace, - (unsigned char *) &pid, 1)) { - printf_errf("(): Failed to set _NET_WM_PID."); - } + uint32_t pid = getpid(); + xcb_change_property(c, XCB_PROP_MODE_REPLACE, ps->reg_win, + get_atom(ps, "_NET_WM_PID"), XCB_ATOM_CARDINAL, 32, 1, &pid); } // Set COMPTON_VERSION diff --git a/src/win.c b/src/win.c index 38e35a5..91bd4b1 100644 --- a/src/win.c +++ b/src/win.c @@ -27,14 +27,16 @@ clear_cache_win_leaders(session_t *ps) { static inline void wid_set_opacity_prop(session_t *ps, Window wid, opacity_t val) { - const unsigned long v = val; - XChangeProperty(ps->dpy, wid, ps->atom_opacity, XCB_ATOM_CARDINAL, 32, - PropModeReplace, (unsigned char *) &v, 1); + const uint32_t v = val; + xcb_connection_t *c = XGetXCBConnection(ps->dpy); + xcb_change_property(c, XCB_PROP_MODE_REPLACE, wid, ps->atom_opacity, + XCB_ATOM_CARDINAL, 32, 1, &v); } static inline void 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); } /**