Skip to content

Commit

Permalink
Merge pull request #10 from psychon/remove-xfixes
Browse files Browse the repository at this point in the history
Some more trivial Xlib -> XCB conversions
  • Loading branch information
yshui authored Oct 2, 2018
2 parents d917ec2 + 385ba2c commit e58de49
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 30 deletions.
10 changes: 5 additions & 5 deletions src/c2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 0 additions & 9 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
14 changes: 7 additions & 7 deletions src/compton.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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.");
}
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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];
Expand Down
10 changes: 5 additions & 5 deletions src/win.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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) {
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/x.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand Down

0 comments on commit e58de49

Please sign in to comment.