Implement support for chosing a 32 bit visual (necessary for pseudo-transparency) (Thanks darkraven)

You need to specify the --enable-32bit-visual flag when starting i3. This is
done because everything feels sluggish on my system when using a 32 bit visual
instead of a 24 bit visual. Fast > fancy.
This commit is contained in:
Michael Stapelberg
2012-01-28 16:09:02 +00:00
parent 19f3f84d29
commit 58ecd14900
5 changed files with 103 additions and 8 deletions

View File

@ -20,8 +20,17 @@ xcb_window_t create_window(xcb_connection_t *conn, Rect dims, uint16_t window_cl
enum xcursor_cursor_t cursor, bool map, uint32_t mask, uint32_t *values) {
xcb_window_t result = xcb_generate_id(conn);
/* If the window class is XCB_WINDOW_CLASS_INPUT_ONLY, depth has to be 0 */
uint16_t depth = (window_class == XCB_WINDOW_CLASS_INPUT_ONLY ? 0 : XCB_COPY_FROM_PARENT);
/* By default, the color depth determined in src/main.c is used (32 bit if
* available, otherwise the X11 root windows default depth). */
uint16_t depth = root_depth;
xcb_visualid_t visual = visual_id;
/* If the window class is XCB_WINDOW_CLASS_INPUT_ONLY, we copy depth and
* visual id from the parent window. */
if (window_class == XCB_WINDOW_CLASS_INPUT_ONLY) {
depth = XCB_COPY_FROM_PARENT;
visual = XCB_COPY_FROM_PARENT;
}
xcb_create_window(conn,
depth,
@ -30,7 +39,7 @@ xcb_window_t create_window(xcb_connection_t *conn, Rect dims, uint16_t window_cl
dims.x, dims.y, dims.width, dims.height, /* dimensions */
0, /* border = 0, we draw our own */
window_class,
XCB_WINDOW_CLASS_COPY_FROM_PARENT, /* copy visual from parent */
visual,
mask,
values);