diff --git a/src/c2.c b/src/c2.c
index 425dc9f..1516058 100644
--- a/src/c2.c
+++ b/src/c2.c
@@ -1362,7 +1362,7 @@ c2_match_once_leaf(session_t *ps, win *w, const c2_l_t *pleaf,
bool *pres, bool *perr) {
assert(pleaf);
- const Window wid = (pleaf->tgt_onframe ? w->client_win: w->id);
+ const xcb_window_t wid = (pleaf->tgt_onframe ? w->client_win: w->id);
// Return if wid is missing
if (!pleaf->predef && !wid)
diff --git a/src/common.h b/src/common.h
index 6454f15..b344c72 100644
--- a/src/common.h
+++ b/src/common.h
@@ -335,11 +335,11 @@ typedef struct glx_prog_main {
struct glx_prog_main { };
#endif
-#define PAINT_INIT { .pixmap = None, .pict = None }
+#define PAINT_INIT { .pixmap = XCB_NONE, .pict = XCB_NONE }
/// Linked list type of atoms.
typedef struct _latom {
- Atom atom;
+ xcb_atom_t atom;
struct _latom *next;
} latom_t;
@@ -439,7 +439,7 @@ typedef struct session {
/// Default depth.
int depth;
/// Root window.
- Window root;
+ xcb_window_t root;
/// Height of root window.
int root_height;
/// Width of root window.
@@ -447,7 +447,7 @@ typedef struct session {
// Damage of root window.
// Damage root_damage;
/// X Composite overlay window. Used if --paint-on-overlay.
- Window overlay;
+ xcb_window_t overlay;
/// Whether the root tile is filled by compton.
bool root_tile_fill;
/// Picture of the root window background.
@@ -463,7 +463,7 @@ typedef struct session {
paint_t tgt_buffer;
XSyncFence tgt_buffer_fence;
/// Window ID of the window we register as a symbol.
- Window reg_win;
+ xcb_window_t reg_win;
#ifdef CONFIG_OPENGL
/// Pointer to GLX data.
glx_session_t *psglx;
@@ -526,7 +526,7 @@ typedef struct session {
win *active_win;
/// Window ID of leader window of currently active window. Used for
/// subsidiary window detection.
- Window active_leader;
+ xcb_window_t active_leader;
// === Shadow/dimming related ===
/// 1x1 black Picture.
@@ -626,32 +626,32 @@ typedef struct session {
// === Atoms ===
/// Atom of property _NET_WM_OPACITY.
- Atom atom_opacity;
+ xcb_atom_t atom_opacity;
/// Atom of _NET_FRAME_EXTENTS.
- Atom atom_frame_extents;
+ xcb_atom_t atom_frame_extents;
/// Property atom to identify top-level frame window. Currently
/// WM_STATE.
- Atom atom_client;
+ xcb_atom_t atom_client;
/// Atom of property WM_NAME.
- Atom atom_name;
+ xcb_atom_t atom_name;
/// Atom of property _NET_WM_NAME.
- Atom atom_name_ewmh;
+ xcb_atom_t atom_name_ewmh;
/// Atom of property WM_CLASS.
- Atom atom_class;
+ xcb_atom_t atom_class;
/// Atom of property WM_WINDOW_ROLE.
- Atom atom_role;
+ xcb_atom_t atom_role;
/// Atom of property WM_TRANSIENT_FOR.
- Atom atom_transient;
+ xcb_atom_t atom_transient;
/// Atom of property WM_CLIENT_LEADER.
- Atom atom_client_leader;
+ xcb_atom_t atom_client_leader;
/// Atom of property _NET_ACTIVE_WINDOW.
- Atom atom_ewmh_active_win;
+ xcb_atom_t atom_ewmh_active_win;
/// Atom of property _COMPTON_SHADOW.
- Atom atom_compton_shadow;
+ xcb_atom_t atom_compton_shadow;
/// Atom of property _NET_WM_WINDOW_TYPE.
- Atom atom_win_type;
+ xcb_atom_t atom_win_type;
/// Array of atoms of all possible window types.
- Atom atoms_wintypes[NUM_WINTYPES];
+ xcb_atom_t atoms_wintypes[NUM_WINTYPES];
/// Linked list of additional atoms to track.
latom_t *track_atom_lst;
@@ -888,7 +888,7 @@ get_atom(session_t *ps, const char *atom_name) {
/**
* Return the painting target window.
*/
-static inline Window
+static inline xcb_window_t
get_tgt_window(session_t *ps) {
return ps->overlay != XCB_NONE ? ps->overlay: ps->root;
}
@@ -897,7 +897,7 @@ get_tgt_window(session_t *ps) {
* Find a window from window id in window linked list of the session.
*/
static inline win *
-find_win(session_t *ps, Window id) {
+find_win(session_t *ps, xcb_window_t id) {
if (!id)
return NULL;
@@ -918,7 +918,7 @@ find_win(session_t *ps, Window id) {
* @return struct win object of the found window, NULL if not found
*/
static inline win *
-find_toplevel(session_t *ps, Window id) {
+find_toplevel(session_t *ps, xcb_window_t id) {
if (!id)
return NULL;
@@ -977,7 +977,7 @@ static inline void
free_fence(session_t *ps, XSyncFence *pfence) {
if (*pfence)
XSyncDestroyFence(ps->dpy, *pfence);
- *pfence = None;
+ *pfence = XCB_NONE;
}
/**
@@ -1045,21 +1045,25 @@ win_is_solid(session_t *ps, const win *w) {
* @param ps current session
* @param w window to check
* @param atom atom of property to check
- * @return 1 if it has the attribute, 0 otherwise
+ * @return true if it has the attribute, false otherwise
*/
static inline bool
-wid_has_prop(const session_t *ps, Window w, Atom atom) {
- Atom type = None;
- int format;
- unsigned long nitems, after;
- unsigned char *data;
-
- if (Success == XGetWindowProperty(ps->dpy, w, atom, 0, 0, False,
- AnyPropertyType, &type, &format, &nitems, &after, &data)) {
- cxfree(data);
- if (type) return true;
+wid_has_prop(const session_t *ps, xcb_window_t w, xcb_atom_t atom) {
+ auto r =
+ xcb_get_property_reply(ps->c,
+ xcb_get_property(ps->c, 0, w, atom,
+ XCB_GET_PROPERTY_TYPE_ANY, 0, 0),
+ NULL);
+ if (!r) {
+ return false;
}
+ auto rtype = r->type;
+ free(r);
+
+ if (rtype != XCB_NONE) {
+ return true;
+ }
return false;
}
@@ -1084,10 +1088,6 @@ winprop_get_int(winprop_t prop) {
return tgt;
}
-bool
-wid_get_text_prop(session_t *ps, Window wid, Atom prop,
- char ***pstrlst, int *pnstr);
-
void
force_repaint(session_t *ps);
diff --git a/src/compton.c b/src/compton.c
index 071d1ad..40b75ff 100644
--- a/src/compton.c
+++ b/src/compton.c
@@ -85,7 +85,7 @@ static double
get_opacity_percent(win *w);
static void
-restack_win(session_t *ps, win *w, Window new_above);
+restack_win(session_t *ps, win *w, xcb_window_t new_above);
static void
update_ewmh_active_win(session_t *ps);
@@ -300,7 +300,7 @@ cxinerama_upd_scrs(session_t *ps) {
* XXX move to win.c
*/
static inline win *
-find_win_all(session_t *ps, const Window wid) {
+find_win_all(session_t *ps, const xcb_window_t wid) {
if (!wid || PointerRoot == wid || wid == ps->root || wid == ps->overlay)
return NULL;
@@ -422,7 +422,7 @@ should_ignore(session_t *ps, unsigned long sequence) {
/**
* Determine the event mask for a window.
*/
-long determine_evmask(session_t *ps, Window wid, win_evmode_t mode) {
+long determine_evmask(session_t *ps, xcb_window_t wid, win_evmode_t mode) {
long evmask = 0;
win *w = NULL;
@@ -452,7 +452,7 @@ long determine_evmask(session_t *ps, Window wid, win_evmode_t mode) {
* @param wid window ID
* @return struct _win object of the found window, NULL if not found
*/
-win *find_toplevel2(session_t *ps, Window wid) {
+win *find_toplevel2(session_t *ps, xcb_window_t wid) {
// TODO this should probably be an "update tree", then find_toplevel.
// current approach is a bit more "racy"
win *w = NULL;
@@ -506,7 +506,7 @@ recheck_focus(session_t *ps) {
win *w = find_win_all(ps, wid);
log_trace("%#010" PRIx32 " (%#010lx \"%s\") focused.", wid,
- (w ? w->id: None), (w ? w->name: NULL));
+ (w ? w->id: XCB_NONE), (w ? w->name: NULL));
// And we set the focus state here
if (w) {
@@ -833,7 +833,7 @@ finish_map_win(session_t *ps, win **_w) {
}
void
-map_win(session_t *ps, Window id) {
+map_win(session_t *ps, xcb_window_t id) {
// Unmap overlay window if it got mapped but we are currently not
// in redirected state.
if (ps->overlay && id == ps->overlay && !ps->redirected) {
@@ -843,7 +843,7 @@ map_win(session_t *ps, Window id) {
win *w = find_win(ps, id);
- log_trace("(%#010lx \"%s\"): %p", id, (w ? w->name: NULL), w);
+ log_trace("(%#010x \"%s\"): %p", id, (w ? w->name: NULL), w);
// Don't care about window mapping if it's an InputOnly window
// Try avoiding mapping a window twice
@@ -885,7 +885,7 @@ map_win(session_t *ps, Window id) {
assert(w->client_win);
- log_trace("(%#010lx): type %s", w->id, WINTYPES[w->window_type]);
+ log_trace("(%#010x): type %s", w->id, WINTYPES[w->window_type]);
// FocusIn/Out may be ignored when the window is unmapped, so we must
// recheck focus here
@@ -988,13 +988,13 @@ unmap_win(session_t *ps, win **_w) {
}
static void
-restack_win(session_t *ps, win *w, Window new_above) {
- Window old_above;
+restack_win(session_t *ps, win *w, xcb_window_t new_above) {
+ xcb_window_t old_above;
if (w->next) {
old_above = w->next->id;
} else {
- old_above = None;
+ old_above = XCB_NONE;
}
if (old_above != new_above) {
@@ -1025,7 +1025,7 @@ restack_win(session_t *ps, win *w, Window new_above) {
}
if (new_above && !found) {
- log_error("(%#010lx, %#010lx): Failed to found new above window.", w->id, new_above);
+ log_error("(%#010x, %#010x): Failed to found new above window.", w->id, new_above);
return;
}
@@ -1174,14 +1174,14 @@ configure_win(session_t *ps, xcb_configure_notify_event_t *ce) {
static void
circulate_win(session_t *ps, xcb_circulate_notify_event_t *ce) {
win *w = find_win(ps, ce->window);
- Window new_above;
+ xcb_window_t new_above;
if (!w) return;
if (ce->place == PlaceOnTop) {
new_above = ps->list->id;
} else {
- new_above = None;
+ new_above = XCB_NONE;
}
restack_win(ps, w, new_above);
@@ -1193,11 +1193,11 @@ finish_destroy_win(session_t *ps, win **_w) {
assert(w->destroyed);
win **prev = NULL, *i = NULL;
- log_trace("(%#010lx): Starting...", w->id);
+ log_trace("(%#010x): Starting...", w->id);
for (prev = &ps->list; (i = *prev); prev = &i->next) {
if (w == i) {
- log_trace("(%#010lx \"%s\"): %p", w->id, w->name, w);
+ log_trace("(%#010x \"%s\"): %p", w->id, w->name, w);
finish_unmap_win(ps, _w);
*prev = w->next;
@@ -1222,10 +1222,10 @@ finish_destroy_win(session_t *ps, win **_w) {
}
static void
-destroy_win(session_t *ps, Window id) {
+destroy_win(session_t *ps, xcb_window_t id) {
win *w = find_win(ps, id);
- log_trace("(%#010lx \"%s\"): %p", id, (w ? w->name: NULL), w);
+ log_trace("(%#010x \"%s\"): %p", id, (w ? w->name: NULL), w);
if (w) {
unmap_win(ps, &w);
@@ -1428,7 +1428,7 @@ ev_name(session_t *ps, xcb_generic_event_t *ev) {
return buf;
}
-static inline Window attr_unused
+static inline xcb_window_t attr_unused
ev_window(session_t *ps, xcb_generic_event_t *ev) {
switch (ev->response_type) {
case FocusIn:
@@ -1643,7 +1643,7 @@ ev_expose(session_t *ps, xcb_expose_event_t *ev) {
static void
update_ewmh_active_win(session_t *ps) {
// Search for the window
- Window wid = wid_get_prop_window(ps, ps->root, ps->atom_ewmh_active_win);
+ xcb_window_t wid = wid_get_prop_window(ps, ps->root, ps->atom_ewmh_active_win);
win *w = find_win_all(ps, wid);
// Mark the window focused. No need to unfocus the previous one.
@@ -1860,7 +1860,7 @@ ev_selection_clear(session_t *ps,
* Get a window's name from window ID.
*/
static inline void attr_unused
-ev_window_name(session_t *ps, Window wid, char **name) {
+ev_window_name(session_t *ps, xcb_window_t wid, char **name) {
*name = "";
if (wid) {
*name = "(Failed to get title)";
@@ -1891,7 +1891,7 @@ ev_handle(session_t *ps, xcb_generic_event_t *ev) {
#ifdef DEBUG_EVENTS
if (ev->response_type != ps->damage_event + XCB_DAMAGE_NOTIFY) {
- Window wid = ev_window(ps, ev);
+ xcb_window_t wid = ev_window(ps, ev);
char *window_name = NULL;
ev_window_name(ps, wid, &window_name);
@@ -1994,7 +1994,7 @@ register_cm(session_t *ps) {
assert(!ps->reg_win);
ps->reg_win = XCreateSimpleWindow(ps->dpy, ps->root, 0, 0, 1, 1, 0,
- None, None);
+ XCB_NONE, XCB_NONE);
if (!ps->reg_win) {
log_fatal("Failed to create window.");
@@ -2072,7 +2072,7 @@ fork_after(session_t *ps) {
#ifdef CONFIG_OPENGL
// GLX context must be released and reattached on fork
- if (glx_has_context(ps) && !glXMakeCurrent(ps->dpy, None, NULL)) {
+ if (glx_has_context(ps) && !glXMakeCurrent(ps->dpy, XCB_NONE, NULL)) {
log_fatal("Failed to detach GLX context.");
return false;
}
@@ -2293,7 +2293,7 @@ init_overlay(session_t *ps) {
log_error("Cannot get X Composite overlay window. Falling "
"back to painting on root window.");
}
- log_debug("overlay = %#010lx", ps->overlay);
+ log_debug("overlay = %#010x", ps->overlay);
return ps->overlay;
}
@@ -2542,16 +2542,16 @@ session_init(session_t *ps_old, int argc, char **argv) {
.c = NULL,
.vis = 0,
.depth = 0,
- .root = None,
+ .root = XCB_NONE,
.root_height = 0,
.root_width = 0,
- // .root_damage = None,
- .overlay = None,
+ // .root_damage = XCB_NONE,
+ .overlay = XCB_NONE,
.root_tile_fill = false,
.root_tile_paint = PAINT_INIT,
- .tgt_picture = None,
+ .tgt_picture = XCB_NONE,
.tgt_buffer = PAINT_INIT,
- .reg_win = None,
+ .reg_win = XCB_NONE,
#ifdef CONFIG_OPENGL
.glx_prog_win = GLX_PROG_MAIN_INIT,
#endif
@@ -2571,7 +2571,7 @@ session_init(session_t *ps_old, int argc, char **argv) {
.stoppaint_force = UNSET,
.dbus = false,
.benchmark = 0,
- .benchmark_wid = None,
+ .benchmark_wid = XCB_NONE,
.logpath = NULL,
.refresh_rate = 0,
@@ -2639,11 +2639,11 @@ session_init(session_t *ps_old, int argc, char **argv) {
.list = NULL,
.active_win = NULL,
- .active_leader = None,
+ .active_leader = XCB_NONE,
- .black_picture = None,
- .cshadow_picture = None,
- .white_picture = None,
+ .black_picture = XCB_NONE,
+ .cshadow_picture = XCB_NONE,
+ .white_picture = XCB_NONE,
.gaussian_map = NULL,
.cgsize = 0,
.shadow_corner = NULL,
@@ -2680,17 +2680,17 @@ session_init(session_t *ps_old, int argc, char **argv) {
#endif
.xrfilter_convolution_exists = false,
- .atom_opacity = None,
- .atom_frame_extents = None,
- .atom_client = None,
- .atom_name = None,
- .atom_name_ewmh = None,
- .atom_class = None,
- .atom_role = None,
- .atom_transient = None,
- .atom_ewmh_active_win = None,
- .atom_compton_shadow = None,
- .atom_win_type = None,
+ .atom_opacity = XCB_NONE,
+ .atom_frame_extents = XCB_NONE,
+ .atom_client = XCB_NONE,
+ .atom_name = XCB_NONE,
+ .atom_name_ewmh = XCB_NONE,
+ .atom_class = XCB_NONE,
+ .atom_role = XCB_NONE,
+ .atom_transient = XCB_NONE,
+ .atom_ewmh_active_win = XCB_NONE,
+ .atom_compton_shadow = XCB_NONE,
+ .atom_win_type = XCB_NONE,
.atoms_wintypes = { 0 },
.track_atom_lst = NULL,
@@ -3145,10 +3145,10 @@ session_destroy(session_t *ps) {
// Free tgt_{buffer,picture} and root_picture
if (ps->tgt_buffer.pict == ps->tgt_picture)
- ps->tgt_buffer.pict = None;
+ ps->tgt_buffer.pict = XCB_NONE;
if (ps->tgt_picture == ps->root_picture)
- ps->tgt_picture = None;
+ ps->tgt_picture = XCB_NONE;
else
free_picture(ps->c, &ps->tgt_picture);
free_fence(ps, &ps->tgt_buffer_fence);
@@ -3186,13 +3186,13 @@ session_destroy(session_t *ps) {
// Release overlay window
if (ps->overlay) {
xcb_composite_release_overlay_window(ps->c, ps->overlay);
- ps->overlay = None;
+ ps->overlay = XCB_NONE;
}
// Free reg_win
if (ps->reg_win) {
xcb_destroy_window(ps->c, ps->reg_win);
- ps->reg_win = None;
+ ps->reg_win = XCB_NONE;
}
// Flush all events
diff --git a/src/compton.h b/src/compton.h
index c4d814e..f11c7a0 100644
--- a/src/compton.h
+++ b/src/compton.h
@@ -45,14 +45,14 @@
void add_damage(session_t *ps, const region_t *damage);
-long determine_evmask(session_t *ps, Window wid, win_evmode_t mode);
+long determine_evmask(session_t *ps, xcb_window_t wid, win_evmode_t mode);
xcb_window_t
find_client_win(session_t *ps, xcb_window_t w);
-win *find_toplevel2(session_t *ps, Window wid);
+win *find_toplevel2(session_t *ps, xcb_window_t wid);
-void map_win(session_t *ps, Window id);
+void map_win(session_t *ps, xcb_window_t id);
/**
* Subtract two unsigned long values.
@@ -84,7 +84,7 @@ wintype_arr_enable_unset(switch_t arr[]) {
* @param wid window ID to search for
*/
static inline bool
-array_wid_exists(const Window *arr, int count, Window wid) {
+array_wid_exists(const xcb_window_t *arr, int count, xcb_window_t wid) {
while (count--) {
if (arr[count] == wid) {
return true;
@@ -131,7 +131,7 @@ make_text_prop(session_t *ps, char *str) {
* Set a single-string text property on a window.
*/
static inline bool
-wid_set_text_prop(session_t *ps, Window wid, Atom prop_atom, char *str) {
+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);
@@ -149,18 +149,15 @@ wid_set_text_prop(session_t *ps, Window wid, Atom prop_atom, char *str) {
* Dump an drawable's info.
*/
static inline void
-dump_drawable(session_t *ps, Drawable drawable) {
- Window rroot = None;
- int x = 0, y = 0;
- unsigned width = 0, height = 0, border = 0, depth = 0;
- if (XGetGeometry(ps->dpy, drawable, &rroot, &x, &y, &width, &height,
- &border, &depth)) {
- log_trace("Drawable %#010lx: x = %u, y = %u, wid = %u, hei = %d, b = %u, d = %u",
- drawable, x, y, width, height, border, depth);
- }
- else {
- log_trace("Drawable %#010lx: Failed", drawable);
+dump_drawable(session_t *ps, xcb_drawable_t drawable) {
+ auto r = xcb_get_geometry_reply(ps->c, xcb_get_geometry(ps->c, drawable), NULL);
+ if (!r) {
+ log_trace("Drawable %#010x: Failed", drawable);
+ return;
}
+ log_trace("Drawable %#010x: x = %u, y = %u, wid = %u, hei = %d, b = %u, d = %u",
+ drawable, r->x, r->y, r->width, r->height, r->border_width, r->depth);
+ free(r);
}
/**
diff --git a/src/config.h b/src/config.h
index d7f4467..a20cd76 100644
--- a/src/config.h
+++ b/src/config.h
@@ -119,7 +119,7 @@ typedef struct options_t {
/// Number of cycles to paint in benchmark mode. 0 for disabled.
int benchmark;
/// Window to constantly repaint in benchmark mode. 0 for full-screen.
- Window benchmark_wid;
+ xcb_window_t benchmark_wid;
/// A list of conditions of windows not to paint.
c2_lptr_t *paint_blacklist;
/// Whether to show all X errors.
diff --git a/src/dbus.c b/src/dbus.c
index 03da24c..96bfefd 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -432,7 +432,7 @@ cdbus_apdarg_double(session_t *ps, DBusMessage *msg, const void *data) {
static bool
cdbus_apdarg_wid(session_t *ps, DBusMessage *msg, const void *data) {
assert(data);
- cdbus_window_t val = *(const Window *)data;
+ cdbus_window_t val = *(const xcb_window_t *)data;
if (!dbus_message_append_args(msg, CDBUS_TYPE_WINDOW, &val,
DBUS_TYPE_INVALID)) {
@@ -565,7 +565,7 @@ cdbus_signal(session_t *ps, const char *name,
* Send a signal with a Window ID as argument.
*/
static inline bool
-cdbus_signal_wid(session_t *ps, const char *name, Window wid) {
+cdbus_signal_wid(session_t *ps, const char *name, xcb_window_t wid) {
return cdbus_signal(ps, name, cdbus_apdarg_wid, &wid);
}
@@ -648,7 +648,7 @@ cdbus_reply_double(session_t *ps, DBusMessage *srcmsg, double val) {
* Send a reply with a wid argument.
*/
static inline bool
-cdbus_reply_wid(session_t *ps, DBusMessage *srcmsg, Window wid) {
+cdbus_reply_wid(session_t *ps, DBusMessage *srcmsg, xcb_window_t wid) {
return cdbus_reply(ps, srcmsg, cdbus_apdarg_wid, &wid);
}
@@ -754,7 +754,7 @@ cdbus_process_list_win(session_t *ps, DBusMessage *msg) {
*/
static bool
cdbus_process_win_get(session_t *ps, DBusMessage *msg) {
- cdbus_window_t wid = None;
+ cdbus_window_t wid = XCB_NONE;
const char *target = NULL;
DBusError err = { };
@@ -858,7 +858,7 @@ cdbus_process_win_get(session_t *ps, DBusMessage *msg) {
*/
static bool
cdbus_process_win_set(session_t *ps, DBusMessage *msg) {
- cdbus_window_t wid = None;
+ cdbus_window_t wid = XCB_NONE;
const char *target = NULL;
DBusError err = { };
@@ -942,11 +942,11 @@ cdbus_process_find_win(session_t *ps, DBusMessage *msg) {
if (!cdbus_msg_get_arg(msg, 0, DBUS_TYPE_STRING, &target))
return false;
- Window wid = None;
+ xcb_window_t wid = XCB_NONE;
// Find window by client window
if (!strcmp("client", target)) {
- cdbus_window_t client = None;
+ cdbus_window_t client = XCB_NONE;
if (!cdbus_msg_get_arg(msg, 1, CDBUS_TYPE_WINDOW, &client))
return false;
win *w = find_toplevel(ps, client);
diff --git a/src/render.c b/src/render.c
index ac3320e..5d3b355 100644
--- a/src/render.c
+++ b/src/render.c
@@ -71,7 +71,7 @@ static inline void attr_nonnull(1, 2) set_tgt_clip(session_t *ps, region_t *reg)
void free_picture(xcb_connection_t *c, xcb_render_picture_t *p) {
if (*p) {
xcb_render_free_picture(c, *p);
- *p = None;
+ *p = XCB_NONE;
}
}
@@ -147,7 +147,7 @@ static inline bool paint_isvalid(session_t *ps, const paint_t *ppaint) {
return false;
#ifdef CONFIG_OPENGL
- if (BKEND_GLX == ps->o.backend && !glx_tex_binded(ppaint->ptex, None))
+ if (BKEND_GLX == ps->o.backend && !glx_tex_binded(ppaint->ptex, XCB_NONE))
return false;
#endif
@@ -192,12 +192,12 @@ void paint_one(session_t *ps, win *w, const region_t *reg_paint) {
// causing the jittering issue M4he reported in #7.
if (!paint_bind_tex(ps, &w->paint, 0, 0, 0,
(!ps->o.glx_no_rebind_pixmap && w->pixmap_damaged))) {
- log_error("Failed to bind texture for window %#010lx.", w->id);
+ log_error("Failed to bind texture for window %#010x.", w->id);
}
w->pixmap_damaged = false;
if (!paint_isvalid(ps, &w->paint)) {
- log_error("Window %#010lx is missing painting data.", w->id);
+ log_error("Window %#010x is missing painting data.", w->id);
return;
}
@@ -223,16 +223,16 @@ void paint_one(session_t *ps, win *w, const region_t *reg_paint) {
pixman_region32_fini(®);
}
- xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_SRC, pict, None,
+ xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_SRC, pict, XCB_NONE,
newpict, 0, 0, 0, 0, 0, 0, wid, hei);
xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_DIFFERENCE,
- ps->white_picture, None, newpict, 0, 0, 0, 0,
+ ps->white_picture, XCB_NONE, newpict, 0, 0, 0, 0,
0, 0, wid, hei);
// We use an extra PictOpInReverse operation to get correct
// pixel alpha. There could be a better solution.
if (win_has_alpha(w))
xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_IN_REVERSE,
- pict, None, newpict, 0, 0, 0, 0, 0,
+ pict, XCB_NONE, newpict, 0, 0, 0, 0, 0,
0, wid, hei);
pict = newpict;
}
@@ -367,7 +367,7 @@ static bool get_root_tile(session_t *ps) {
ps->root_tile_fill = false;
bool fill = false;
- xcb_pixmap_t pixmap = None;
+ xcb_pixmap_t pixmap = XCB_NONE;
// Get the values of background attributes
for (int p = 0; background_props_str[p]; p++) {
@@ -566,14 +566,14 @@ static bool win_build_shadow(session_t *ps, win *w, double opacity) {
// log_trace("(): building shadow for %s %d %d", w->name, width, height);
xcb_image_t *shadow_image = NULL;
- xcb_pixmap_t shadow_pixmap = None, shadow_pixmap_argb = None;
- xcb_render_picture_t shadow_picture = None, shadow_picture_argb = None;
- xcb_gcontext_t gc = None;
+ xcb_pixmap_t shadow_pixmap = XCB_NONE, shadow_pixmap_argb = XCB_NONE;
+ xcb_render_picture_t shadow_picture = XCB_NONE, shadow_picture_argb = XCB_NONE;
+ xcb_gcontext_t gc = XCB_NONE;
shadow_image = make_shadow(ps, opacity, width, height);
if (!shadow_image) {
log_error("failed to make shadow");
- return None;
+ return XCB_NONE;
}
shadow_pixmap =
@@ -641,7 +641,7 @@ static inline void win_paint_shadow(session_t *ps, win *w, region_t *reg_paint)
paint_bind_tex(ps, &w->shadow_paint, 0, 0, 32, false);
if (!paint_isvalid(ps, &w->shadow_paint)) {
- log_error("Window %#010lx is missing shadow data.", w->id);
+ log_error("Window %#010x is missing shadow data.", w->id);
return;
}
@@ -709,7 +709,7 @@ xr_blur_dst(session_t *ps, xcb_render_picture_t tgt_buffer, int x, int y, int wi
xcb_render_set_picture_filter(
ps->c, src_pict, strlen(XRFILTER_CONVOLUTION), XRFILTER_CONVOLUTION,
kwid * khei + 2, convolution_blur);
- xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_SRC, src_pict, None,
+ xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_SRC, src_pict, XCB_NONE,
dst_pict, (rd_from_tgt ? x : 0),
(rd_from_tgt ? y : 0), 0, 0, (rd_from_tgt ? 0 : x),
(rd_from_tgt ? 0 : y), wid, hei);
@@ -723,7 +723,7 @@ xr_blur_dst(session_t *ps, xcb_render_picture_t tgt_buffer, int x, int y, int wi
}
if (src_pict != tgt_buffer)
- xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_SRC, src_pict, None,
+ xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_SRC, src_pict, XCB_NONE,
tgt_buffer, 0, 0, 0, 0, x, y, wid, hei);
free_picture(ps->c, &tmp_picture);
@@ -995,7 +995,7 @@ void paint_all(session_t *ps, region_t *region, const region_t *region_real, win
xcb_render_picture_t new_pict = x_create_picture_with_pictfmt(
ps, ps->root_width, ps->root_height, pictfmt, 0, NULL);
xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_SRC,
- ps->tgt_buffer.pict, None, new_pict, 0, 0, 0,
+ ps->tgt_buffer.pict, XCB_NONE, new_pict, 0, 0, 0,
0, 0, 0, ps->root_width, ps->root_height);
// Next, we set the region of paint and highlight it
@@ -1008,12 +1008,12 @@ void paint_all(session_t *ps, region_t *region, const region_t *region_real, win
// Finally, clear clip region and put the whole thing on screen
x_set_picture_clip_region(ps, new_pict, 0, 0, &ps->screen_reg);
xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_SRC, new_pict,
- None, ps->tgt_picture, 0, 0, 0, 0, 0, 0,
+ XCB_NONE, ps->tgt_picture, 0, 0, 0, 0, 0, 0,
ps->root_width, ps->root_height);
xcb_render_free_picture(ps->c, new_pict);
} else
xcb_render_composite(ps->c, XCB_RENDER_PICT_OP_SRC,
- ps->tgt_buffer.pict, None, ps->tgt_picture,
+ ps->tgt_buffer.pict, XCB_NONE, ps->tgt_picture,
0, 0, 0, 0, 0, 0, ps->root_width,
ps->root_height);
break;
@@ -1299,7 +1299,7 @@ void free_root_tile(session_t *ps) {
xcb_free_pixmap(ps->c, ps->root_tile_paint.pixmap);
ps->root_tile_paint.pixmap = XCB_NONE;
}
- ps->root_tile_paint.pixmap = None;
+ ps->root_tile_paint.pixmap = XCB_NONE;
ps->root_tile_fill = false;
}
diff --git a/src/win.c b/src/win.c
index 4e24196..6d399a0 100644
--- a/src/win.c
+++ b/src/win.c
@@ -39,18 +39,18 @@
static inline void
clear_cache_win_leaders(session_t *ps) {
for (win *w = ps->list; w; w = w->next)
- w->cache_leader = None;
+ w->cache_leader = XCB_NONE;
}
static inline void
-wid_set_opacity_prop(session_t *ps, Window wid, opacity_t val) {
+wid_set_opacity_prop(session_t *ps, xcb_window_t wid, opacity_t val) {
const uint32_t v = val;
xcb_change_property(ps->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) {
+wid_rm_opacity_prop(session_t *ps, xcb_window_t wid) {
xcb_delete_property(ps->c, wid, ps->atom_opacity);
}
@@ -60,7 +60,7 @@ wid_rm_opacity_prop(session_t *ps, Window wid) {
* @param leader leader window ID
*/
static inline void
-group_update_focused(session_t *ps, Window leader) {
+group_update_focused(session_t *ps, xcb_window_t leader) {
if (!leader)
return;
@@ -79,7 +79,7 @@ group_update_focused(session_t *ps, Window leader) {
* @return true if the window group is focused, false otherwise
*/
static inline bool
-group_is_focused(session_t *ps, Window leader) {
+group_is_focused(session_t *ps, xcb_window_t leader) {
if (!leader)
return false;
@@ -145,7 +145,7 @@ void win_rounded_corners(session_t *ps, win *w) {
if (!w->bounding_shaped)
return;
- // Quit if border_size() returns None
+ // Quit if border_size() returns XCB_NONE
if (!pixman_region32_not_empty(&w->bounding_shape))
return;
@@ -170,7 +170,7 @@ void win_rounded_corners(session_t *ps, win *w) {
}
int win_get_name(session_t *ps, win *w) {
- XTextProperty text_prop = { NULL, None, 0, 0 };
+ XTextProperty text_prop = { NULL, XCB_NONE, 0, 0 };
char **strlst = NULL;
int nstr = 0;
@@ -178,7 +178,7 @@ int win_get_name(session_t *ps, win *w) {
return 0;
if (!(wid_get_text_prop(ps, w->client_win, ps->atom_name_ewmh, &strlst, &nstr))) {
- log_trace("(%#010lx): _NET_WM_NAME unset, falling back to WM_NAME.", w->client_win);
+ log_trace("(%#010x): _NET_WM_NAME unset, falling back to WM_NAME.", w->client_win);
if (!(XGetWMName(ps->dpy, w->client_win, &text_prop) && text_prop.value)) {
return -1;
@@ -203,7 +203,7 @@ int win_get_name(session_t *ps, win *w) {
XFreeStringList(strlst);
- log_trace("(%#010lx): client = %#010lx, name = \"%s\", "
+ log_trace("(%#010x): client = %#010x, name = \"%s\", "
"ret = %d", w->id, w->client_win, w->name, ret);
return ret;
}
@@ -224,7 +224,7 @@ int win_get_role(session_t *ps, win *w) {
XFreeStringList(strlst);
- log_trace("(%#010lx): client = %#010lx, role = \"%s\", "
+ log_trace("(%#010x): client = %#010x, role = \"%s\", "
"ret = %d", w->id, w->client_win, w->role, ret);
return ret;
}
@@ -232,7 +232,7 @@ int win_get_role(session_t *ps, win *w) {
/**
* Check if a window is bounding-shaped.
*/
-static inline bool win_bounding_shaped(const session_t *ps, Window wid) {
+static inline bool win_bounding_shaped(const session_t *ps, xcb_window_t wid) {
if (ps->shape_exists) {
xcb_shape_query_extents_reply_t *reply;
Bool bounding_shaped;
@@ -248,7 +248,7 @@ static inline bool win_bounding_shaped(const session_t *ps, Window wid) {
return false;
}
-wintype_t wid_get_prop_wintype(session_t *ps, Window wid) {
+wintype_t wid_get_prop_wintype(session_t *ps, xcb_window_t wid) {
set_ignore_next(ps);
winprop_t prop = wid_get_prop(ps, wid, ps->atom_win_type, 32L, XCB_ATOM_ATOM, 32);
@@ -266,7 +266,7 @@ wintype_t wid_get_prop_wintype(session_t *ps, Window wid) {
return WINTYPE_UNKNOWN;
}
-bool wid_get_opacity_prop(session_t *ps, Window wid, opacity_t def,
+bool wid_get_opacity_prop(session_t *ps, xcb_window_t wid, opacity_t def,
opacity_t *out) {
bool ret = false;
*out = def;
@@ -634,7 +634,7 @@ void win_upd_wintype(session_t *ps, win *w) {
* @param w struct _win of the parent window
* @param client window ID of the client window
*/
-void win_mark_client(session_t *ps, win *w, Window client) {
+void win_mark_client(session_t *ps, win *w, xcb_window_t client) {
w->client_win = client;
// If the window isn't mapped yet, stop here, as the function will be
@@ -679,9 +679,9 @@ void win_mark_client(session_t *ps, win *w, Window client) {
* @param w struct _win of the parent window
*/
void win_unmark_client(session_t *ps, win *w) {
- Window client = w->client_win;
+ xcb_window_t client = w->client_win;
- w->client_win = None;
+ w->client_win = XCB_NONE;
// Recheck event mask
xcb_change_window_attributes(ps->c, client, XCB_CW_EVENT_MASK,
@@ -702,15 +702,15 @@ void win_recheck_client(session_t *ps, win *w) {
// Always recursively look for a window with WM_STATE, as Fluxbox
// sets override-redirect flags on all frame windows.
- Window cw = find_client_win(ps, w->id);
+ xcb_window_t cw = find_client_win(ps, w->id);
if (cw)
- log_trace("(%#010lx): client %#010lx", w->id, cw);
+ log_trace("(%#010x): client %#010x", w->id, cw);
// Set a window's client window to itself if we couldn't find a
// client window
if (!cw) {
cw = w->id;
w->wmwin = !w->a.override_redirect;
- log_trace("(%#010lx): client self (%s)", w->id,
+ log_trace("(%#010x): client self (%s)", w->id,
(w->wmwin ? "wmwin" : "override-redirected"));
}
@@ -723,13 +723,13 @@ void win_recheck_client(session_t *ps, win *w) {
}
// TODO: probably split into win_new (in win.c) and add_win (in compton.c)
-bool add_win(session_t *ps, Window id, Window prev) {
+bool add_win(session_t *ps, xcb_window_t id, xcb_window_t prev) {
static const win win_def = {
.win_data = NULL,
.next = NULL,
.prev_trans = NULL,
- .id = None,
+ .id = XCB_NONE,
.a = {},
#ifdef CONFIG_XINERAMA
.xinerama_scr = -1,
@@ -737,7 +737,7 @@ bool add_win(session_t *ps, Window id, Window prev) {
.pictfmt = NULL,
.mode = WMODE_TRANS,
.ever_damaged = false,
- .damage = None,
+ .damage = XCB_NONE,
.pixmap_damaged = false,
.paint = PAINT_INIT,
.flags = 0,
@@ -754,11 +754,11 @@ bool add_win(session_t *ps, Window id, Window prev) {
.to_paint = false,
.in_openclose = false,
- .client_win = None,
+ .client_win = XCB_NONE,
.window_type = WINTYPE_UNKNOWN,
.wmwin = false,
- .leader = None,
- .cache_leader = None,
+ .leader = XCB_NONE,
+ .cache_leader = XCB_NONE,
.focused = false,
.focused_force = UNSET,
@@ -814,7 +814,7 @@ bool add_win(session_t *ps, Window id, Window prev) {
// Allocate and initialize the new win structure
auto new = cmalloc(win);
- log_trace("(%#010lx): %p", id, new);
+ log_trace("(%#010x): %p", id, new);
*new = win_def;
pixman_region32_init(&new->bounding_shape);
@@ -933,10 +933,10 @@ void win_update_focused(session_t *ps, win *w) {
/**
* Set leader of a window.
*/
-static inline void win_set_leader(session_t *ps, win *w, Window nleader) {
+static inline void win_set_leader(session_t *ps, win *w, xcb_window_t nleader) {
// If the leader changes
if (w->leader != nleader) {
- Window cache_leader_old = win_get_leader(ps, w);
+ xcb_window_t cache_leader_old = win_get_leader(ps, w);
w->leader = nleader;
@@ -946,7 +946,7 @@ static inline void win_set_leader(session_t *ps, win *w, Window nleader) {
// Update the old and new window group and active_leader if the window
// could affect their state.
- Window cache_leader = win_get_leader(ps, w);
+ xcb_window_t cache_leader = win_get_leader(ps, w);
if (win_is_focused_real(ps, w) && cache_leader_old != cache_leader) {
ps->active_leader = cache_leader;
@@ -967,7 +967,7 @@ static inline void win_set_leader(session_t *ps, win *w, Window nleader) {
* Update leader of a window.
*/
void win_update_leader(session_t *ps, win *w) {
- Window leader = None;
+ xcb_window_t leader = XCB_NONE;
// Read the leader properties
if (ps->o.detect_transient && !leader)
@@ -978,14 +978,14 @@ void win_update_leader(session_t *ps, win *w) {
win_set_leader(ps, w, leader);
- log_trace("(%#010lx): client %#010lx, leader %#010lx, cache %#010lx",
+ log_trace("(%#010x): client %#010x, leader %#010x, cache %#010x",
w->id, w->client_win, w->leader, win_get_leader(ps, w));
}
/**
* Internal function of win_get_leader().
*/
-Window win_get_leader_raw(session_t *ps, win *w, int recursions) {
+xcb_window_t win_get_leader_raw(session_t *ps, win *w, int recursions) {
// Rebuild the cache if needed
if (!w->cache_leader && (w->client_win || w->leader)) {
// Leader defaults to client window
@@ -998,7 +998,7 @@ Window win_get_leader_raw(session_t *ps, win *w, int recursions) {
if (wp) {
// Dead loop?
if (recursions > WIN_GET_LEADER_MAX_RECURSION)
- return None;
+ return XCB_NONE;
w->cache_leader = win_get_leader_raw(ps, wp, recursions + 1);
}
@@ -1038,7 +1038,7 @@ bool win_get_class(session_t *ps, win *w) {
XFreeStringList(strlst);
- log_trace("(%#010lx): client = %#010lx, "
+ log_trace("(%#010x): client = %#010x, "
"instance = \"%s\", general = \"%s\"",
w->id, w->client_win, w->class_instance, w->class_general);
@@ -1054,11 +1054,11 @@ static void
win_on_focus_change(session_t *ps, win *w) {
// If window grouping detection is enabled
if (ps->o.track_leader) {
- Window leader = win_get_leader(ps, w);
+ xcb_window_t leader = win_get_leader(ps, w);
// If the window gets focused, replace the old active_leader
if (win_is_focused_real(ps, w) && leader != ps->active_leader) {
- Window active_leader_old = ps->active_leader;
+ xcb_window_t active_leader_old = ps->active_leader;
ps->active_leader = leader;
@@ -1068,7 +1068,7 @@ win_on_focus_change(session_t *ps, win *w) {
// If the group get unfocused, remove it from active_leader
else if (!win_is_focused_real(ps, w) && leader && leader == ps->active_leader
&& !group_is_focused(ps, leader)) {
- ps->active_leader = None;
+ ps->active_leader = XCB_NONE;
group_update_focused(ps, leader);
}
@@ -1220,7 +1220,7 @@ void win_update_opacity_prop(session_t *ps, win *w) {
* Retrieve frame extents from a window.
*/
void
-win_update_frame_extents(session_t *ps, win *w, Window client) {
+win_update_frame_extents(session_t *ps, win *w, xcb_window_t client) {
winprop_t prop = wid_get_prop(ps, client, ps->atom_frame_extents,
4L, XCB_ATOM_CARDINAL, 32);
@@ -1241,7 +1241,7 @@ win_update_frame_extents(session_t *ps, win *w, Window client) {
w->reg_ignore_valid = false;
}
- log_trace("(%#010lx): %d, %d, %d, %d", w->id,
+ log_trace("(%#010x): %d, %d, %d, %d", w->id,
w->frame_extents.left, w->frame_extents.right,
w->frame_extents.top, w->frame_extents.bottom);
diff --git a/src/win.h b/src/win.h
index c008ade..488ef0d 100644
--- a/src/win.h
+++ b/src/win.h
@@ -84,7 +84,7 @@ struct win {
// Core members
/// ID of the top-level frame window.
- Window id;
+ xcb_window_t id;
/// Window attributes.
xcb_get_window_attributes_reply_t a;
xcb_get_geometry_reply_t g;
@@ -146,7 +146,7 @@ struct win {
// Client window related members
/// ID of the top-level client window of the window.
- Window client_win;
+ xcb_window_t client_win;
/// Type of the window.
wintype_t window_type;
/// Whether it looks like a WM window. We consider a window WM window if
@@ -154,9 +154,9 @@ struct win {
/// redirected itself.
bool wmwin;
/// Leader window ID of the window.
- Window leader;
+ xcb_window_t leader;
/// Cached topmost window ID of the window.
- Window cache_leader;
+ xcb_window_t cache_leader;
// Focus-related members
/// Whether the window is to be considered focused.
@@ -281,10 +281,10 @@ void win_on_factor_change(session_t *ps, win *w);
void calc_win_size(session_t *ps, win *w);
void calc_shadow_geometry(session_t *ps, win *w);
void win_upd_wintype(session_t *ps, win *w);
-void win_mark_client(session_t *ps, win *w, Window client);
+void win_mark_client(session_t *ps, win *w, xcb_window_t client);
void win_unmark_client(session_t *ps, win *w);
void win_recheck_client(session_t *ps, win *w);
-Window win_get_leader_raw(session_t *ps, win *w, int recursions);
+xcb_window_t win_get_leader_raw(session_t *ps, win *w, int recursions);
bool win_get_class(session_t *ps, win *w);
void win_calc_opacity(session_t *ps, win *w);
void win_calc_dim(session_t *ps, win *w);
@@ -332,8 +332,8 @@ region_t win_get_region_noframe_local_by_val(win *w);
* Retrieve frame extents from a window.
*/
void
-win_update_frame_extents(session_t *ps, win *w, Window client);
-bool add_win(session_t *ps, Window id, Window prev);
+win_update_frame_extents(session_t *ps, win *w, xcb_window_t client);
+bool add_win(session_t *ps, xcb_window_t id, xcb_window_t prev);
/**
* Set fade callback of a window, and possibly execute the previous
@@ -361,7 +361,7 @@ void win_ev_stop(session_t *ps, win *w);
*
* This function updates w->cache_leader if necessary.
*/
-static inline Window
+static inline xcb_window_t
win_get_leader(session_t *ps, win *w) {
return win_get_leader_raw(ps, w, 0);
}
diff --git a/src/x.c b/src/x.c
index c2be811..16f84a6 100644
--- a/src/x.c
+++ b/src/x.c
@@ -35,7 +35,7 @@ wid_get_prop_adv(const session_t *ps, xcb_window_t w, xcb_atom_t atom, long offs
xcb_get_property(ps->c, 0, w, atom, rtype, offset, length), NULL);
if (r && xcb_get_property_value_length(r) &&
- (rtype == XCB_ATOM_ANY || r->type == rtype) &&
+ (rtype == XCB_GET_PROPERTY_TYPE_ANY || r->type == rtype) &&
(!rformat || r->format == rformat) &&
(r->format == 8 || r->format == 16 || r->format == 32))
{
@@ -53,20 +53,20 @@ wid_get_prop_adv(const session_t *ps, xcb_window_t w, xcb_atom_t atom, long offs
return (winprop_t) {
.ptr = NULL,
.nitems = 0,
- .type = AnyPropertyType,
+ .type = XCB_GET_PROPERTY_TYPE_ANY,
.format = 0
};
}
/**
- * Get the value of a type-Window property of a window.
+ * Get the value of a type-xcb_window_t property of a window.
*
* @return the value if successful, 0 otherwise
*/
-Window
-wid_get_prop_window(session_t *ps, Window wid, Atom aprop) {
+xcb_window_t
+wid_get_prop_window(session_t *ps, xcb_window_t wid, xcb_atom_t aprop) {
// Get the attribute
- Window p = None;
+ xcb_window_t p = XCB_NONE;
winprop_t prop = wid_get_prop(ps, wid, aprop, 1L, XCB_ATOM_WINDOW, 32);
// Return it
@@ -82,9 +82,9 @@ wid_get_prop_window(session_t *ps, Window wid, Atom aprop) {
/**
* Get the value of a text property of a window.
*/
-bool wid_get_text_prop(session_t *ps, Window wid, Atom prop,
+bool wid_get_text_prop(session_t *ps, xcb_window_t wid, xcb_atom_t prop,
char ***pstrlst, int *pnstr) {
- XTextProperty text_prop = { NULL, None, 0, 0 };
+ XTextProperty text_prop = { NULL, XCB_NONE, 0, 0 };
if (!(XGetTextProperty(ps->dpy, wid, &text_prop, prop) && text_prop.value))
return false;
@@ -204,7 +204,7 @@ x_create_picture_with_pictfmt(session_t *ps, int wid, int hei,
xcb_pixmap_t tmp_pixmap = x_create_pixmap(ps, depth, ps->root, wid, hei);
if (!tmp_pixmap)
- return None;
+ return XCB_NONE;
xcb_render_picture_t picture =
x_create_picture_with_pictfmt_and_pixmap(ps, pictfmt, tmp_pixmap, valuemask, attr);
@@ -274,7 +274,7 @@ void x_set_picture_clip_region(session_t *ps, xcb_render_picture_t pict,
void x_clear_picture_clip_region(session_t *ps, xcb_render_picture_t pict) {
xcb_render_change_picture_value_list_t v = {
- .clipmask = None
+ .clipmask = XCB_NONE
};
xcb_generic_error_t *e =
xcb_request_check(ps->c, xcb_render_change_picture(ps->c, pict,
@@ -403,14 +403,19 @@ x_create_pixmap(session_t *ps, uint8_t depth, xcb_drawable_t drawable, uint16_t
* are better ways.
*/
bool
-x_validate_pixmap(session_t *ps, xcb_pixmap_t pxmap) {
- if (!pxmap) return false;
+x_validate_pixmap(session_t *ps, xcb_pixmap_t pixmap) {
+ if (pixmap == XCB_NONE) {
+ return false;
+ }
- Window rroot = None;
- int rx = 0, ry = 0;
- unsigned rwid = 0, rhei = 0, rborder = 0, rdepth = 0;
- return XGetGeometry(ps->dpy, pxmap, &rroot, &rx, &ry,
- &rwid, &rhei, &rborder, &rdepth) && rwid && rhei;
+ auto r = xcb_get_geometry_reply(ps->c, xcb_get_geometry(ps->c, pixmap), NULL);
+ if (!r) {
+ return false;
+ }
+
+ bool ret = r->width && r->height;
+ free(r);
+ return ret;
}
/// Names of root window properties that could point to a pixmap of
/// background.
diff --git a/src/x.h b/src/x.h
index b16a821..978a1de 100644
--- a/src/x.h
+++ b/src/x.h
@@ -79,17 +79,17 @@ wid_get_prop(const session_t *ps, xcb_window_t wid, xcb_atom_t atom, long length
}
/**
- * Get the value of a type-Window property of a window.
+ * Get the value of a type-xcb_window_t property of a window.
*
* @return the value if successful, 0 otherwise
*/
-Window
-wid_get_prop_window(session_t *ps, Window wid, Atom aprop);
+xcb_window_t
+wid_get_prop_window(session_t *ps, xcb_window_t wid, xcb_atom_t aprop);
/**
* Get the value of a text property of a window.
*/
-bool wid_get_text_prop(session_t *ps, Window wid, Atom prop,
+bool wid_get_text_prop(session_t *ps, xcb_window_t wid, xcb_atom_t prop,
char ***pstrlst, int *pnstr);
xcb_render_pictforminfo_t *x_get_pictform_for_visual(session_t *, xcb_visualid_t);