Port more stuff to xcb

To avoid interoperability issues between xcb and xlib.
This commit is contained in:
Yuxuan Shui
2018-09-23 19:10:46 +01:00
parent 7af815a0aa
commit 209b751b25
10 changed files with 380 additions and 398 deletions

View File

@ -96,6 +96,8 @@
#include <X11/extensions/Xinerama.h>
#endif
#include <xcb/render.h>
// Workarounds for missing definitions in very old versions of X headers,
// thanks to consolers for reporting
#ifndef PictOpDifference
@ -787,7 +789,9 @@ typedef struct session {
/// Default screen.
int scr;
/// Default visual.
Visual *vis;
xcb_visualid_t vis;
/// Pict formats info
xcb_render_query_pict_formats_reply_t *pictfmts;
/// Default depth.
int depth;
/// Root window.
@ -1041,13 +1045,14 @@ struct win {
/// ID of the top-level frame window.
Window id;
/// Window attributes.
XWindowAttributes a;
xcb_get_window_attributes_reply_t a;
xcb_get_geometry_reply_t g;
#ifdef CONFIG_XINERAMA
/// Xinerama screen this window is on.
int xinerama_scr;
#endif
/// Window visual pict format;
XRenderPictFormat *pictfmt;
xcb_render_pictforminfo_t *pictfmt;
/// Window painting mode.
winmode_t mode;
/// Whether the window has been damaged at least once.
@ -1852,16 +1857,6 @@ find_toplevel(session_t *ps, Window id) {
return NULL;
}
/**
* Check if current backend uses XRender for rendering.
*/
static inline bool
bkend_use_xrender(session_t *ps) {
return BKEND_XRENDER == ps->o.backend
|| BKEND_XR_GLX_HYBRID == ps->o.backend;
}
/**
* Check if current backend uses GLX.
*/
@ -2007,7 +2002,7 @@ set_ignore_next(session_t *ps) {
*/
static inline bool
win_is_fullscreen(session_t *ps, const win *w) {
return rect_is_fullscreen(ps, w->a.x, w->a.y, w->widthb, w->heightb)
return rect_is_fullscreen(ps, w->g.x, w->g.y, w->widthb, w->heightb)
&& (!w->bounding_shaped || w->rounded_corners);
}
@ -2515,3 +2510,14 @@ wintype_arr_enable(bool arr[]) {
arr[i] = true;
}
}
/**
* Destroy a <code>Pixmap</code>.
*/
static inline void
free_pixmap(session_t *ps, Pixmap *p) {
if (*p) {
XFreePixmap(ps->dpy, *p);
*p = None;
}
}