Do not create container pixmap when not needed
Patch status: merged
Patch by Tony Crisci
Long description:
The pixmap of a borderless container will not be used (except for the titlebar in a stack or tabs). Make sure these containers do not have a pixmap because it can only get in the way. fixes #1013
To apply this patch, use:
curl http://cr.i3wm.org/patch/383/raw.patch | git am
b/src/x.c
18 |
@@ -667,9 +667,24 @@ void x_push_node(Con *con) { |
19 |
/* As the pixmap only depends on the size and not on the position, it |
20 |
* is enough to check if width/height have changed. Also, we don’t |
21 |
* create a pixmap at all when the window is actually not visible |
22 |
- * (height == 0). */ |
23 |
- if ((state->rect.width != rect.width || |
24 |
- state->rect.height != rect.height)) { |
25 |
+ * (height == 0) or when it is not needed. */ |
26 |
+ bool has_rect_changed = (state->rect.width != rect.width || state->rect.height != rect.height); |
27 |
+ |
28 |
+ /* The pixmap of a borderless container will not be used (except for |
29 |
+ * the titlebar in a stack or tabs). It can only get in the way. (bug |
30 |
+ * #1013). */ |
31 |
+ bool is_pixmap_needed = (con->border_style != BS_NONE || |
32 |
+ con->parent->layout == L_STACKED || |
33 |
+ con->parent->layout == L_TABBED); |
34 |
+ |
35 |
+ /* Check if the container has an unneeded pixmap left over from |
36 |
+ * previously having a border or titlebar. */ |
37 |
+ if (!is_pixmap_needed && con->pixmap != XCB_NONE) { |
38 |
+ xcb_free_pixmap(conn, con->pixmap); |
39 |
+ con->pixmap = XCB_NONE; |
40 |
+ } |
41 |
+ |
42 |
+ if (has_rect_changed && is_pixmap_needed) { |
43 |
if (con->pixmap == 0) { |
44 |
con->pixmap = xcb_generate_id(conn); |
45 |
con->pm_gc = xcb_generate_id(conn); |