summaryrefslogtreecommitdiff
path: root/src/x.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/x.hh')
-rw-r--r--src/x.hh29
1 files changed, 26 insertions, 3 deletions
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<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) {
}
};