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.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/x.cc') 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 -- cgit v1.3