From 36ab6defac59d289a513e74c28e21f437adead98 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Wed, 27 Sep 2017 19:38:44 +0200 Subject: Add some rather quirky X fixes So, from the xserver code, if you don't specify a border pixel you must match the parent window depth. Also, if you don't specify a colormap you need to match the parent visual --- src/x.hh | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'src/x.hh') diff --git a/src/x.hh b/src/x.hh index ce4f812..00751c2 100644 --- a/src/x.hh +++ b/src/x.hh @@ -41,6 +41,12 @@ struct XcbRenderPictureDelete { } }; +struct XcbColormapDelete { + void operator()(xcb_connection_t* conn, xcb_colormap_t id) const { + xcb_free_colormap(conn, id); + } +}; + } // priv class shared_connection { @@ -194,24 +200,41 @@ typedef unique_resource unique_gcontext; typedef unique_resource unique_picture; +typedef unique_resource unique_colormap; struct Format { + static uint8_t const FLAG_NEED_BORDER; + static uint8_t const FLAG_NEED_COLORMAP; + uint8_t depth; xcb_visualtype_t* visual; xcb_render_pictforminfo_t* render; xcb_render_pictforminfo_t* render_alpha; + uint8_t flags; bool good() const { return depth > 0 && visual; } + bool need_border() const { + return flags & FLAG_NEED_BORDER; + } + + bool need_colormap() const { + return flags & FLAG_NEED_COLORMAP; + } + Format(uint8_t depth, xcb_visualtype_t* visual, xcb_render_pictforminfo_t* render, - xcb_render_pictforminfo_t* render_alpha) - : depth(depth), visual(visual), render(render), render_alpha(render_alpha) { + xcb_render_pictforminfo_t* render_alpha, + uint8_t flags) + : depth(depth), visual(visual), render(render), render_alpha(render_alpha), + flags(flags) { } Format() - : depth(0), visual(nullptr), render(nullptr), render_alpha(nullptr) { + : depth(0), visual(nullptr), render(nullptr), render_alpha(nullptr), + flags(0) { } }; -- cgit v1.3