summaryrefslogtreecommitdiff
path: root/src/x.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/x.cc')
-rw-r--r--src/x.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/x.cc b/src/x.cc
index 53b09d4..3749f81 100644
--- a/src/x.cc
+++ b/src/x.cc
@@ -177,6 +177,7 @@ Format get_best_format(xcb_connection_t* conn, xcb_screen_t const* screen,
xcb_render_pictforminfo_t* render = nullptr;
xcb_render_pictforminfo_t* render_alpha = nullptr;
xcb_render_query_pict_formats_reply_t* render_formats = nullptr;
+ uint8_t flags = 0;
PixelFormat format;
auto render_reply = xcb_get_extension_data(conn, &xcb_render_id);
@@ -265,6 +266,15 @@ Format get_best_format(xcb_connection_t* conn, xcb_screen_t const* screen,
free(render_formats);
return Format();
}
+
+ if (depth != screen->root_depth) {
+ flags |= Format::FLAG_NEED_BORDER;
+ }
+ if (visual->visual_id != screen->root_visual
+ || screen->default_colormap == XCB_NONE) {
+ flags |= Format::FLAG_NEED_COLORMAP;
+ }
+
if (render && render_formats) {
auto info = xcb_render_query_pict_formats_formats(render_formats);
auto count = xcb_render_query_pict_formats_formats_length(render_formats);
@@ -313,7 +323,10 @@ Format get_best_format(xcb_connection_t* conn, xcb_screen_t const* screen,
// as xcb_render_pictforminfo_t pointers
// free(render_formats);
- return Format(depth, visual, render, render_alpha);
+ return Format(depth, visual, render, render_alpha, flags);
}
+const uint8_t Format::FLAG_NEED_BORDER = 1 << 0;
+const uint8_t Format::FLAG_NEED_COLORMAP = 1 << 1;
+
} // namespace x