From 7c174cc3b1bc7f7c4a3d53564d7103ee8aab39bd Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 2 Oct 2018 19:50:27 +0200 Subject: [PATCH 1/6] Replace XserverRegion with xcb_xfixes_region_t Signed-off-by: Uli Schlachter --- src/compton.c | 4 ++-- src/x.c | 2 +- src/x.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compton.c b/src/compton.c index 0cd8cf4..38ee2f0 100644 --- a/src/compton.c +++ b/src/compton.c @@ -1313,7 +1313,7 @@ xr_blur_dst(session_t *ps, xcb_render_picture_t tgt_buffer, xrfilter_reset(ps, src_pict); { - XserverRegion tmp = src_pict; + xcb_xfixes_region_t tmp = src_pict; src_pict = dst_pict; dst_pict = tmp; } @@ -4957,7 +4957,7 @@ cxinerama_upd_scrs(session_t *ps) { xcb_xinerama_screen_info_t *scrs = xcb_xinerama_query_screens_screen_info(ps->xinerama_scrs); ps->xinerama_nscrs = xcb_xinerama_query_screens_screen_info_length(ps->xinerama_scrs); - ps->xinerama_scr_regs = allocchk(malloc(sizeof(XserverRegion *) + ps->xinerama_scr_regs = allocchk(malloc(sizeof(xcb_xfixes_region_t *) * ps->xinerama_nscrs)); for (int i = 0; i < ps->xinerama_nscrs; ++i) { const xcb_xinerama_screen_info_t * const s = &scrs[i]; diff --git a/src/x.c b/src/x.c index b8188c7..d3e3b57 100644 --- a/src/x.c +++ b/src/x.c @@ -213,7 +213,7 @@ x_create_picture(session_t *ps, int wid, int hei, return picture; } -bool x_fetch_region(session_t *ps, XserverRegion r, pixman_region32_t *res) { +bool x_fetch_region(session_t *ps, xcb_xfixes_region_t r, pixman_region32_t *res) { xcb_generic_error_t *e = NULL; xcb_connection_t *c = XGetXCBConnection(ps->dpy); xcb_xfixes_fetch_region_reply_t *xr = xcb_xfixes_fetch_region_reply(c, diff --git a/src/x.h b/src/x.h index f5508c0..587da9c 100644 --- a/src/x.h +++ b/src/x.h @@ -84,7 +84,7 @@ x_create_picture(session_t *ps, int wid, int hei, const xcb_render_create_picture_value_list_t *attr); /// Fetch a X region and store it in a pixman region -bool x_fetch_region(session_t *ps, XserverRegion r, region_t *res); +bool x_fetch_region(session_t *ps, xcb_xfixes_region_t r, region_t *res); void x_set_picture_clip_region(session_t *ps, xcb_render_picture_t, int clip_x_origin, int clip_y_origin, const region_t *); From 91468c3622591b40a9195b4dcb0b0f0e38c3ecd6 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 2 Oct 2018 19:51:30 +0200 Subject: [PATCH 2/6] Replace BadRegion with XCB_XFIXES_BAD_REGION Signed-off-by: Uli Schlachter --- src/x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/x.c b/src/x.c index d3e3b57..b89257a 100644 --- a/src/x.c +++ b/src/x.c @@ -287,7 +287,7 @@ x_print_error(unsigned long serial, uint8_t major, uint8_t minor, uint8_t error_ o = error_code - ps->xfixes_error; switch (o) { - CASESTRRET2(BadRegion); + CASESTRRET2(XCB_XFIXES_BAD_REGION); } o = error_code - ps->damage_error; From b2d947a19ac237494b9ef113bcc65a45c5138e96 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 2 Oct 2018 19:51:37 +0200 Subject: [PATCH 3/6] Remove include of Xfixes.h Signed-off-by: Uli Schlachter --- src/common.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/common.h b/src/common.h index 78b2280..4a5dc4e 100644 --- a/src/common.h +++ b/src/common.h @@ -82,7 +82,6 @@ #include #include #include -#include #include #ifdef CONFIG_XSYNC #include From bc7767e086d36cb718012fd1061f37bc4f433fc4 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 2 Oct 2018 19:53:28 +0200 Subject: [PATCH 4/6] Replace Xlib atom constants with XCB ones Signed-off-by: Uli Schlachter --- src/c2.c | 10 +++++----- src/common.h | 1 - src/compton.c | 10 +++++----- src/win.c | 10 +++++----- src/x.c | 2 +- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/c2.c b/src/c2.c index 0fe1c6e..4e1a587 100644 --- a/src/c2.c +++ b/src/c2.c @@ -1340,15 +1340,15 @@ static Atom c2_get_atom_type(const c2_l_t *pleaf) { switch (pleaf->type) { case C2_L_TCARDINAL: - return XA_CARDINAL; + return XCB_ATOM_CARDINAL; case C2_L_TWINDOW: - return XA_WINDOW; + return XCB_ATOM_WINDOW; case C2_L_TSTRING: - return XA_STRING; + return XCB_ATOM_STRING; case C2_L_TATOM: - return XA_ATOM; + return XCB_ATOM_ATOM; case C2_L_TDRAWABLE: - return XA_DRAWABLE; + return XCB_ATOM_DRAWABLE; default: assert(0); break; diff --git a/src/common.h b/src/common.h index 4a5dc4e..a37fc92 100644 --- a/src/common.h +++ b/src/common.h @@ -81,7 +81,6 @@ #include #include #include -#include #include #ifdef CONFIG_XSYNC #include diff --git a/src/compton.c b/src/compton.c index 38ee2f0..0b0e0a0 100644 --- a/src/compton.c +++ b/src/compton.c @@ -923,7 +923,7 @@ get_root_tile(session_t *ps) { for (int p = 0; background_props_str[p]; p++) { winprop_t prop = wid_get_prop(ps, ps->root, get_atom(ps, background_props_str[p]), - 1L, XA_PIXMAP, 32); + 1L, XCB_ATOM_PIXMAP, 32); if (prop.nitems) { pixmap = *prop.data.p32; fill = false; @@ -3541,7 +3541,7 @@ register_cm(session_t *ps) { { long pid = getpid(); if (!XChangeProperty(ps->dpy, ps->reg_win, - get_atom(ps, "_NET_WM_PID"), XA_CARDINAL, 32, PropModeReplace, + get_atom(ps, "_NET_WM_PID"), XCB_ATOM_CARDINAL, 32, PropModeReplace, (unsigned char *) &pid, 1)) { printf_errf("(): Failed to set _NET_WM_PID."); } @@ -4122,11 +4122,11 @@ init_atoms(session_t *ps) { ps->atom_opacity = get_atom(ps, "_NET_WM_WINDOW_OPACITY"); ps->atom_frame_extents = get_atom(ps, "_NET_FRAME_EXTENTS"); ps->atom_client = get_atom(ps, "WM_STATE"); - ps->atom_name = XA_WM_NAME; + ps->atom_name = XCB_ATOM_WM_NAME; ps->atom_name_ewmh = get_atom(ps, "_NET_WM_NAME"); - ps->atom_class = XA_WM_CLASS; + ps->atom_class = XCB_ATOM_WM_CLASS; ps->atom_role = get_atom(ps, "WM_WINDOW_ROLE"); - ps->atom_transient = XA_WM_TRANSIENT_FOR; + ps->atom_transient = XCB_ATOM_WM_TRANSIENT_FOR; ps->atom_client_leader = get_atom(ps, "WM_CLIENT_LEADER"); ps->atom_ewmh_active_win = get_atom(ps, "_NET_ACTIVE_WINDOW"); ps->atom_compton_shadow = get_atom(ps, "_COMPTON_SHADOW"); diff --git a/src/win.c b/src/win.c index 4131994..8f392cb 100644 --- a/src/win.c +++ b/src/win.c @@ -24,7 +24,7 @@ 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, XA_CARDINAL, 32, + XChangeProperty(ps->dpy, wid, ps->atom_opacity, XCB_ATOM_CARDINAL, 32, PropModeReplace, (unsigned char *) &v, 1); } @@ -241,7 +241,7 @@ static inline bool win_bounding_shaped(const session_t *ps, Window wid) { wintype_t wid_get_prop_wintype(session_t *ps, Window wid) { set_ignore_next(ps); - winprop_t prop = wid_get_prop(ps, wid, ps->atom_win_type, 32L, XA_ATOM, 32); + winprop_t prop = wid_get_prop(ps, wid, ps->atom_win_type, 32L, XCB_ATOM_ATOM, 32); for (unsigned i = 0; i < prop.nitems; ++i) { for (wintype_t j = 1; j < NUM_WINTYPES; ++j) { @@ -262,7 +262,7 @@ bool wid_get_opacity_prop(session_t *ps, Window wid, opacity_t def, bool ret = false; *out = def; - winprop_t prop = wid_get_prop(ps, wid, ps->atom_opacity, 1L, XA_CARDINAL, 32); + winprop_t prop = wid_get_prop(ps, wid, ps->atom_opacity, 1L, XCB_ATOM_CARDINAL, 32); if (prop.nitems) { *out = *prop.data.p32; @@ -389,7 +389,7 @@ void win_determine_fade(session_t *ps, win *w) { */ void win_update_prop_shadow_raw(session_t *ps, win *w) { winprop_t prop = - wid_get_prop(ps, w->id, ps->atom_compton_shadow, 1, XA_CARDINAL, 32); + wid_get_prop(ps, w->id, ps->atom_compton_shadow, 1, XCB_ATOM_CARDINAL, 32); if (!prop.nitems) { w->prop_shadow = -1; @@ -1220,7 +1220,7 @@ void win_update_opacity_prop(session_t *ps, win *w) { void win_update_frame_extents(session_t *ps, win *w, Window client) { winprop_t prop = wid_get_prop(ps, client, ps->atom_frame_extents, - 4L, XA_CARDINAL, 32); + 4L, XCB_ATOM_CARDINAL, 32); if (prop.nitems == 4) { const long * const extents = prop.data.p32; diff --git a/src/x.c b/src/x.c index b89257a..fe07e96 100644 --- a/src/x.c +++ b/src/x.c @@ -63,7 +63,7 @@ Window wid_get_prop_window(session_t *ps, Window wid, Atom aprop) { // Get the attribute Window p = None; - winprop_t prop = wid_get_prop(ps, wid, aprop, 1L, XA_WINDOW, 32); + winprop_t prop = wid_get_prop(ps, wid, aprop, 1L, XCB_ATOM_WINDOW, 32); // Return it if (prop.nitems) { From cad786c0256dd4140a221461a8241a573ee4f0ef Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 2 Oct 2018 19:54:20 +0200 Subject: [PATCH 5/6] Remove include of X11/Xutil.h It doesn't seem to cause any problems. Perhaps its uses were already converted to XCB? Signed-off-by: Uli Schlachter --- src/common.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/common.h b/src/common.h index a37fc92..ae18cf2 100644 --- a/src/common.h +++ b/src/common.h @@ -80,7 +80,6 @@ #include #include -#include #include #ifdef CONFIG_XSYNC #include From 385ba2cdf6f940c1bb1280f4141b249e985a7247 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 2 Oct 2018 19:56:06 +0200 Subject: [PATCH 6/6] Remove unused definition Signed-off-by: Uli Schlachter --- src/common.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/common.h b/src/common.h index ae18cf2..f19cea1 100644 --- a/src/common.h +++ b/src/common.h @@ -96,12 +96,6 @@ #endif #include -// Workarounds for missing definitions in very old versions of X headers, -// thanks to consolers for reporting -#ifndef PictOpDifference -#define PictOpDifference 0x39 -#endif - // libdbus #ifdef CONFIG_DBUS #include