uint32_t mask = 0;
uint32_t values[5];
- xcb_visualid_t visual = XCB_COPY_FROM_PARENT;
- xcb_colormap_t win_colormap = XCB_NONE;
- if (depth != root_depth && depth != XCB_COPY_FROM_PARENT) {
- /* For custom visuals, we need to create a colormap before creating
- * this window. It will be freed directly after creating the window. */
- visual = get_visualid_by_depth(depth);
- win_colormap = xcb_generate_id(conn);
- xcb_create_colormap_checked(conn, XCB_COLORMAP_ALLOC_NONE, win_colormap, root, visual);
-
- /* We explicitly set a background color and border color (even though we
- * don’t even have a border) because the X11 server requires us to when
- * using 32 bit color depths, see
- * http://stackoverflow.com/questions/3645632 */
- mask |= XCB_CW_BACK_PIXEL;
- values[0] = root_screen->black_pixel;
-
- mask |= XCB_CW_BORDER_PIXEL;
- values[1] = root_screen->black_pixel;
-
- /* our own frames should not be managed */
- mask |= XCB_CW_OVERRIDE_REDIRECT;
- values[2] = 1;
-
- /* see include/xcb.h for the FRAME_EVENT_MASK */
- mask |= XCB_CW_EVENT_MASK;
- values[3] = FRAME_EVENT_MASK & ~XCB_EVENT_MASK_ENTER_WINDOW;
-
- mask |= XCB_CW_COLORMAP;
- values[4] = win_colormap;
- } else {
- /* our own frames should not be managed */
- mask = XCB_CW_OVERRIDE_REDIRECT;
- values[0] = 1;
+ /* For custom visuals, we need to create a colormap before creating
+ * this window. It will be freed directly after creating the window. */
+ xcb_visualid_t visual = get_visualid_by_depth(depth);
+ xcb_colormap_t win_colormap = xcb_generate_id(conn);
+ xcb_create_colormap_checked(conn, XCB_COLORMAP_ALLOC_NONE, win_colormap, root, visual);
- /* see include/xcb.h for the FRAME_EVENT_MASK */
- mask |= XCB_CW_EVENT_MASK;
- values[1] = FRAME_EVENT_MASK & ~XCB_EVENT_MASK_ENTER_WINDOW;
+ /* We explicitly set a background color and border color (even though we
+ * don’t even have a border) because the X11 server requires us to when
+ * using 32 bit color depths, see
+ * http://stackoverflow.com/questions/3645632 */
+ mask |= XCB_CW_BACK_PIXEL;
+ values[0] = root_screen->black_pixel;
- mask |= XCB_CW_COLORMAP;
- values[2] = colormap;
- }
+ mask |= XCB_CW_BORDER_PIXEL;
+ values[1] = root_screen->black_pixel;
+
+ /* our own frames should not be managed */
+ mask |= XCB_CW_OVERRIDE_REDIRECT;
+ values[2] = 1;
+
+ /* see include/xcb.h for the FRAME_EVENT_MASK */
+ mask |= XCB_CW_EVENT_MASK;
+ values[3] = FRAME_EVENT_MASK & ~XCB_EVENT_MASK_ENTER_WINDOW;
+
+ mask |= XCB_CW_COLORMAP;
+ values[4] = win_colormap;
Rect dims = {-15, -15, 10, 10};
xcb_window_t frame_id = create_window(conn, dims, depth, visual, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCURSOR_CURSOR_POINTER, false, mask, values);
if (parent->frame_buffer.id == XCB_NONE)
goto copy_pixmaps;
+ /* For the first child, we clear the parent pixmap to ensure there's no
+ * garbage left on there. This is important to avoid tearing when using
+ * transparency. */
+ if (con == TAILQ_FIRST(&(con->parent->nodes_head))) {
+ draw_util_clear_surface(conn, &(con->parent->frame_buffer), COLOR_TRANSPARENT);
+ FREE(con->parent->deco_render_params);
+ }
+
/* 4: paint the bar */
draw_util_rectangle(conn, &(parent->frame_buffer), p->color->background,
con->deco_rect.x, con->deco_rect.y, con->deco_rect.width, con->deco_rect.height);
/* Ensure we have valid dimensions for our surface. */
// TODO This is probably a bug in the condition above as we should never enter this path
// for height == 0. Also, we should probably handle width == 0 the same way.
- int width = MAX(rect.width, 1);
- int height = MAX(rect.height, 1);
+ int width = MAX((int32_t)rect.width, 1);
+ int height = MAX((int32_t)rect.height, 1);
xcb_create_pixmap_checked(conn, win_depth, con->frame_buffer.id, con->frame.id, width, height);
draw_util_surface_init(conn, &(con->frame_buffer), con->frame_buffer.id,
DLOG("-- PUSHING WINDOW STACK --\n");
//DLOG("Disabling EnterNotify\n");
- uint32_t values[1] = {XCB_NONE};
+ /* We need to keep SubstructureRedirect around, otherwise clients can send
+ * ConfigureWindow requests and get them applied directly instead of having
+ * them become ConfigureRequests that i3 handles. */
+ uint32_t values[1] = {XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT};
CIRCLEQ_FOREACH_REVERSE(state, &state_head, state) {
if (state->mapped)
xcb_change_window_attributes(conn, state->id, XCB_CW_EVENT_MASK, values);