diff options
| author | Joel Klinghed <the_jk@yahoo.com> | 2017-09-27 19:38:44 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@yahoo.com> | 2017-09-27 19:38:44 +0200 |
| commit | 36ab6defac59d289a513e74c28e21f437adead98 (patch) | |
| tree | a578cf109f7a5da6973937c68fc00f9846032494 /src/x.hh | |
| parent | 62546e2a0fbd6d0e4730873480466dd1fef07d96 (diff) | |
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
Diffstat (limited to 'src/x.hh')
| -rw-r--r-- | src/x.hh | 29 |
1 files changed, 26 insertions, 3 deletions
@@ -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<xcb_gcontext_t, priv::XcbGContextDelete> unique_gcontext; typedef unique_resource<xcb_render_picture_t, priv::XcbRenderPictureDelete> unique_picture; +typedef unique_resource<xcb_colormap_t, + priv::XcbColormapDelete> 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) { } }; |
