Merge pull request #10 from psychon/remove-xfixes

Some more trivial Xlib -> XCB conversions
This commit is contained in:
yshui 2018-10-02 21:38:28 +01:00 committed by GitHub
commit e58de49d7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 30 deletions

View File

@ -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;

View File

@ -80,9 +80,6 @@
#include <X11/Xlib-xcb.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/extensions/Xfixes.h>
#include <X11/extensions/Xdbe.h>
#ifdef CONFIG_XSYNC
#include <X11/extensions/sync.h>
@ -99,12 +96,6 @@
#endif
#include <pixman.h>
// 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 <dbus/dbus.h>

View File

@ -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;
@ -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;
}
@ -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");
@ -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];

View File

@ -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;

View File

@ -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) {
@ -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,
@ -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;

View File

@ -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 *);