summaryrefslogtreecommitdiff
path: root/src/x.cc
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@yahoo.com>2017-09-27 19:38:44 +0200
committerJoel Klinghed <the_jk@yahoo.com>2017-09-27 19:38:44 +0200
commit36ab6defac59d289a513e74c28e21f437adead98 (patch)
treea578cf109f7a5da6973937c68fc00f9846032494 /src/x.cc
parent62546e2a0fbd6d0e4730873480466dd1fef07d96 (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.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