Replace Xlib atom constants with XCB ones

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2018-10-02 19:53:28 +02:00
parent b2d947a19a
commit bc7767e086
5 changed files with 16 additions and 17 deletions

View File

@ -1340,15 +1340,15 @@ static Atom
c2_get_atom_type(const c2_l_t *pleaf) { c2_get_atom_type(const c2_l_t *pleaf) {
switch (pleaf->type) { switch (pleaf->type) {
case C2_L_TCARDINAL: case C2_L_TCARDINAL:
return XA_CARDINAL; return XCB_ATOM_CARDINAL;
case C2_L_TWINDOW: case C2_L_TWINDOW:
return XA_WINDOW; return XCB_ATOM_WINDOW;
case C2_L_TSTRING: case C2_L_TSTRING:
return XA_STRING; return XCB_ATOM_STRING;
case C2_L_TATOM: case C2_L_TATOM:
return XA_ATOM; return XCB_ATOM_ATOM;
case C2_L_TDRAWABLE: case C2_L_TDRAWABLE:
return XA_DRAWABLE; return XCB_ATOM_DRAWABLE;
default: default:
assert(0); assert(0);
break; break;

View File

@ -81,7 +81,6 @@
#include <X11/Xlib-xcb.h> #include <X11/Xlib-xcb.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/extensions/Xdbe.h> #include <X11/extensions/Xdbe.h>
#ifdef CONFIG_XSYNC #ifdef CONFIG_XSYNC
#include <X11/extensions/sync.h> #include <X11/extensions/sync.h>

View File

@ -923,7 +923,7 @@ get_root_tile(session_t *ps) {
for (int p = 0; background_props_str[p]; p++) { for (int p = 0; background_props_str[p]; p++) {
winprop_t prop = wid_get_prop(ps, ps->root, winprop_t prop = wid_get_prop(ps, ps->root,
get_atom(ps, background_props_str[p]), get_atom(ps, background_props_str[p]),
1L, XA_PIXMAP, 32); 1L, XCB_ATOM_PIXMAP, 32);
if (prop.nitems) { if (prop.nitems) {
pixmap = *prop.data.p32; pixmap = *prop.data.p32;
fill = false; fill = false;
@ -3541,7 +3541,7 @@ register_cm(session_t *ps) {
{ {
long pid = getpid(); long pid = getpid();
if (!XChangeProperty(ps->dpy, ps->reg_win, 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)) { (unsigned char *) &pid, 1)) {
printf_errf("(): Failed to set _NET_WM_PID."); 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_opacity = get_atom(ps, "_NET_WM_WINDOW_OPACITY");
ps->atom_frame_extents = get_atom(ps, "_NET_FRAME_EXTENTS"); ps->atom_frame_extents = get_atom(ps, "_NET_FRAME_EXTENTS");
ps->atom_client = get_atom(ps, "WM_STATE"); 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_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_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_client_leader = get_atom(ps, "WM_CLIENT_LEADER");
ps->atom_ewmh_active_win = get_atom(ps, "_NET_ACTIVE_WINDOW"); ps->atom_ewmh_active_win = get_atom(ps, "_NET_ACTIVE_WINDOW");
ps->atom_compton_shadow = get_atom(ps, "_COMPTON_SHADOW"); ps->atom_compton_shadow = get_atom(ps, "_COMPTON_SHADOW");

View File

@ -24,7 +24,7 @@ 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 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); 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) { wintype_t wid_get_prop_wintype(session_t *ps, Window wid) {
set_ignore_next(ps); 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 (unsigned i = 0; i < prop.nitems; ++i) {
for (wintype_t j = 1; j < NUM_WINTYPES; ++j) { 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; bool ret = false;
*out = def; *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) { if (prop.nitems) {
*out = *prop.data.p32; *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) { void win_update_prop_shadow_raw(session_t *ps, win *w) {
winprop_t prop = 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) { if (!prop.nitems) {
w->prop_shadow = -1; w->prop_shadow = -1;
@ -1220,7 +1220,7 @@ void win_update_opacity_prop(session_t *ps, win *w) {
void void
win_update_frame_extents(session_t *ps, win *w, Window client) { win_update_frame_extents(session_t *ps, win *w, Window client) {
winprop_t prop = wid_get_prop(ps, client, ps->atom_frame_extents, 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) { if (prop.nitems == 4) {
const long * const extents = prop.data.p32; const long * const extents = prop.data.p32;

View File

@ -63,7 +63,7 @@ Window
wid_get_prop_window(session_t *ps, Window wid, Atom aprop) { wid_get_prop_window(session_t *ps, Window wid, Atom aprop) {
// Get the attribute // Get the attribute
Window p = None; 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 // Return it
if (prop.nitems) { if (prop.nitems) {