summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorcornholio2016-04-29 21:37:01 -0400
committercornholio2016-04-29 21:37:01 -0400
commitdf5ce8271b714937088bc797b5724c1f2c591c74 (patch)
treea677d720bfc1e366a8b8d8514f7abbd28f96577f
parentf2aa9ff549ac1b780d788f86cb551b2995b2fb16 (diff)
downloadaur-df5ce8271b714937088bc797b5724c1f2c591c74.tar.gz
Updated to 4.12, thanks to mickael9
-rw-r--r--.SRCINFO10
-rw-r--r--PKGBUILD7
-rw-r--r--iconsupport.patch437
3 files changed, 206 insertions, 248 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 60cda25756b9..a312f3427a9c 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = i3-wm-iconpatch
pkgdesc = An improved dynamic tiling window manager (with titlebar icon patch)
- pkgver = 4.11
+ pkgver = 4.12
pkgrel = 1
url = http://i3wm.org/
arch = i686
@@ -25,12 +25,12 @@ pkgbase = i3-wm-iconpatch
conflicts = i3-wm
options = docs
options = !strip
- source = http://i3wm.org/downloads/i3-4.11.tar.bz2
- source = http://i3wm.org/downloads/i3-4.11.tar.bz2.asc
+ source = http://i3wm.org/downloads/i3-4.12.tar.bz2
+ source = http://i3wm.org/downloads/i3-4.12.tar.bz2.asc
source = iconsupport.patch
- sha1sums = 85d04492214bd26c2804dfa83c979fda54b51c08
+ sha1sums = 264e682c7404ee8d5da76e3d652c546db1662a2b
sha1sums = SKIP
- sha1sums = 54d9b36aeb5ee725f4a6a14f90a169f01352f552
+ sha1sums = e279bed82dc0a5cbd9f1f17370f47decba5c6970
pkgname = i3-wm-iconpatch
diff --git a/PKGBUILD b/PKGBUILD
index f5a565e53dfc..1acf507b4bad 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,10 +1,11 @@
# Upstream Maintainer (i3-wm): Thorsten Töpper <atsutane-tu@freethoughts.de>
# Patch Contributor: Marius Muja <mariusm@cs.ubc.ca>
+# Patch Contributor: mickael9 <mickael9@gmail.com>
# Package Maintainer: cornholio <vigo.the.unholy.carpathian@gmail.com>
pkgname=i3-wm-iconpatch
_pkgsourcename=i3
-pkgver=4.11
+pkgver=4.12
pkgrel=1
pkgdesc='An improved dynamic tiling window manager (with titlebar icon patch)'
arch=('i686' 'x86_64')
@@ -23,9 +24,9 @@ options=('docs' '!strip')
source=("http://i3wm.org/downloads/${_pkgsourcename}-${pkgver}.tar.bz2"
"http://i3wm.org/downloads/${_pkgsourcename}-${pkgver}.tar.bz2.asc"
"iconsupport.patch")
-sha1sums=('85d04492214bd26c2804dfa83c979fda54b51c08'
+sha1sums=('264e682c7404ee8d5da76e3d652c546db1662a2b'
'SKIP'
- '54d9b36aeb5ee725f4a6a14f90a169f01352f552')
+ 'e279bed82dc0a5cbd9f1f17370f47decba5c6970')
build() {
cd "$srcdir/$_pkgsourcename-$pkgver"
diff --git a/iconsupport.patch b/iconsupport.patch
index ac726ce1db4d..2f1f708b9003 100644
--- a/iconsupport.patch
+++ b/iconsupport.patch
@@ -1,181 +1,208 @@
-diff -rupN i3-4.11-original/common.mk i3-4.11-patched/common.mk
---- i3-4.11-original/common.mk 2015-09-30 02:55:10.000000000 -0400
-+++ i3-4.11-patched/common.mk 2015-10-25 23:59:59.028232946 -0400
+diff --git a/include/atoms_rest.xmacro b/include/atoms_rest.xmacro
+index d461dc0..f32a7e1 100644
+--- a/include/atoms_rest.xmacro
++++ b/include/atoms_rest.xmacro
@@ -1,6 +1,7 @@
- UNAME=$(shell uname)
- DEBUG=1
- INSTALL=install
-+USE_ICONS=1
- LN=ln
- PKG_CONFIG=pkg-config
- ifndef PREFIX
-@@ -59,6 +60,9 @@ I3_CPPFLAGS += -DMINOR_VERSION=${MINOR_V
- I3_CPPFLAGS += -DPATCH_VERSION=${PATCH_VERSION}
- I3_CPPFLAGS += -DSYSCONFDIR=\"${SYSCONFDIR}\"
- I3_CPPFLAGS += -DI3__FILE__=__FILE__
-+ifeq ($(USE_ICONS),1)
-+I3_CPPFLAGS += -DUSE_ICONS
-+endif
-
-
- ## Libraries flags
-@@ -108,6 +112,10 @@ XCB_WM_CFLAGS += $(call cflags_for_lib,
- XCB_WM_LIBS := $(call ldflags_for_lib, xcb-icccm,xcb-icccm)
- XCB_WM_LIBS += $(call ldflags_for_lib, xcb-xinerama,xcb-xinerama)
- XCB_WM_LIBS += $(call ldflags_for_lib, xcb-randr,xcb-randr)
-+ifeq ($(USE_ICONS),1)
-+XCB_WM_LIBS += $(call ldflags_for_lib, xcb-image,xcb-image)
-+endif
-+
-
- XKB_COMMON_CFLAGS := $(call cflags_for_lib, xkbcommon,xkbcommon)
- XKB_COMMON_LIBS := $(call ldflags_for_lib, xkbcommon,xkbcommon)
-diff -rupN i3-4.11-original/include/atoms.xmacro i3-4.11-patched/include/atoms.xmacro
---- i3-4.11-original/include/atoms.xmacro 2015-09-30 02:55:10.000000000 -0400
-+++ i3-4.11-patched/include/atoms.xmacro 2015-10-26 00:01:01.186402376 -0400
-@@ -32,6 +32,7 @@ xmacro(_NET_ACTIVE_WINDOW)
- xmacro(_NET_CLOSE_WINDOW)
+ xmacro(_NET_WM_USER_TIME)
xmacro(_NET_STARTUP_ID)
xmacro(_NET_WORKAREA)
+xmacro(_NET_WM_ICON)
xmacro(WM_PROTOCOLS)
xmacro(WM_DELETE_WINDOW)
xmacro(UTF8_STRING)
-diff -rupN i3-4.11-original/include/data.h i3-4.11-patched/include/data.h
---- i3-4.11-original/include/data.h 2015-09-30 02:55:10.000000000 -0400
-+++ i3-4.11-patched/include/data.h 2015-10-26 00:02:36.543594088 -0400
-@@ -421,6 +421,12 @@ struct Window {
+diff --git a/include/data.h b/include/data.h
+index 3a059e7..d1f09ec 100644
+--- a/include/data.h
++++ b/include/data.h
+@@ -426,6 +426,9 @@ struct Window {
/* aspect ratio from WM_NORMAL_HINTS (MPlayer uses this for example) */
double aspect_ratio;
+
-+#ifdef USE_ICONS
-+ /* Window icon, array of size 16x16 containing the ARGB pixels */
++ /** Window icon, array of size 16x16 containing the ARGB pixels */
+ uint32_t* icon;
-+#endif
-+
};
/**
-diff -rupN i3-4.11-original/include/window.h i3-4.11-patched/include/window.h
---- i3-4.11-original/include/window.h 2015-09-30 02:55:10.000000000 -0400
-+++ i3-4.11-patched/include/window.h 2015-10-26 00:04:24.660410026 -0400
-@@ -69,6 +69,12 @@ void window_update_type(i3Window *window
- void window_update_hints(i3Window *win, xcb_get_property_reply_t *prop, bool *urgency_hint);
+diff --git a/include/libi3.h b/include/libi3.h
+index 4c72267..1d40cea 100644
+--- a/include/libi3.h
++++ b/include/libi3.h
+@@ -587,6 +587,11 @@ color_t draw_util_hex_to_color(const char *color);
+ void draw_util_text(i3String *text, surface_t *surface, color_t fg_color, color_t bg_color, int x, int y, int max_width);
/**
++ * Draw the given image using libi3.
++ */
++void draw_util_image(unsigned char *pixels, surface_t *surface, int x, int y, int width, int height);
++
++/**
+ * Draws a filled rectangle.
+ * This function is a convenience wrapper and takes care of flushing the
+ * surface as well as restoring the cairo state.
+diff --git a/include/window.h b/include/window.h
+index d0b97f1..0b2997d 100644
+--- a/include/window.h
++++ b/include/window.h
+@@ -87,3 +87,9 @@ void window_update_hints(i3Window *win, xcb_get_property_reply_t *prop, bool *ur
+ *
+ */
+ void window_update_motif_hints(i3Window *win, xcb_get_property_reply_t *prop, border_style_t *motif_border_style);
++
++/**
+ * Updates the _NET_WM_ICON
+ *
+ */
+void window_update_icon(i3Window *win, xcb_get_property_reply_t *prop);
+diff --git a/libi3/draw_util.c b/libi3/draw_util.c
+index dcd881c..3bc7ff9 100644
+--- a/libi3/draw_util.c
++++ b/libi3/draw_util.c
+@@ -153,6 +153,39 @@ void draw_util_text(i3String *text, surface_t *surface, color_t fg_color, color_
+ #endif
+ }
+
+
+/**
- * Updates the MOTIF_WM_HINTS. The container's border style should be set to
- * `motif_border_style' if border style is not BS_NORMAL.
- *
-diff -rupN i3-4.11-original/src/manage.c i3-4.11-patched/src/manage.c
---- i3-4.11-original/src/manage.c 2015-09-30 02:55:10.000000000 -0400
-+++ i3-4.11-patched/src/manage.c 2015-10-26 00:07:52.240963404 -0400
-@@ -92,6 +92,10 @@ void manage_window(xcb_window_t window,
++ * Draw the given image using libi3.
++ * This function is a convenience wrapper and takes care of flushing the
++ * surface as well as restoring the cairo state.
++ *
++ */
++void draw_util_image(unsigned char *pixels, surface_t *surface, int x, int y, int width, int height) {
++ RETURN_UNLESS_SURFACE_INITIALIZED(surface);
++
++#if CAIRO_SUPPORT
++ cairo_save(surface->cr);
++
++ cairo_surface_t *image;
++
++ image = cairo_image_surface_create_for_data(
++ pixels,
++ CAIRO_FORMAT_ARGB32,
++ width,
++ height,
++ width * 4);
++
++ cairo_set_operator(surface->cr, CAIRO_OPERATOR_OVER);
++ cairo_set_source_surface(surface->cr, image, x, y);
++ cairo_rectangle(surface->cr, x, y, width, height);
++ cairo_fill(surface->cr);
++
++ cairo_surface_destroy(image);
++
++ cairo_restore(surface->cr);
++#endif
++}
++
+ /**
+ * Draws a filled rectangle.
+ * This function is a convenience wrapper and takes care of flushing the
+diff --git a/src/manage.c b/src/manage.c
+index 93272f1..ee87850 100644
+--- a/src/manage.c
++++ b/src/manage.c
+@@ -92,6 +92,8 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
role_cookie, startup_id_cookie, wm_hints_cookie,
- wm_normal_hints_cookie, motif_wm_hints_cookie;
+ wm_normal_hints_cookie, motif_wm_hints_cookie, wm_user_time_cookie, wm_desktop_cookie;
-+ #ifdef USE_ICONS
+ xcb_get_property_cookie_t wm_icon_cookie;
-+ #endif
+
geomc = xcb_get_geometry(conn, d);
/* Check if the window is mapped (it could be not mapped when intializing and
-@@ -161,6 +165,9 @@ void manage_window(xcb_window_t window,
- wm_hints_cookie = xcb_icccm_get_wm_hints(conn, window);
- wm_normal_hints_cookie = xcb_icccm_get_wm_normal_hints(conn, window);
+@@ -163,6 +165,7 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
motif_wm_hints_cookie = GET_PROPERTY(A__MOTIF_WM_HINTS, 5 * sizeof(uint64_t));
-+ #ifdef USE_ICONS
-+ wm_icon_cookie = xcb_get_property_unchecked(conn, false, window, A__NET_WM_ICON, XCB_ATOM_CARDINAL, 0, UINT32_MAX);
-+ #endif
+ wm_user_time_cookie = GET_PROPERTY(A__NET_WM_USER_TIME, UINT32_MAX);
+ wm_desktop_cookie = GET_PROPERTY(A__NET_WM_DESKTOP, UINT32_MAX);
++ wm_icon_cookie = GET_PROPERTY(A__NET_WM_ICON, UINT32_MAX);
DLOG("Managing window 0x%08x\n", window);
-@@ -187,6 +194,9 @@ void manage_window(xcb_window_t window,
+@@ -176,6 +179,7 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
+ window_update_class(cwindow, xcb_get_property_reply(conn, class_cookie, NULL), true);
+ window_update_name_legacy(cwindow, xcb_get_property_reply(conn, title_cookie, NULL), true);
+ window_update_name(cwindow, xcb_get_property_reply(conn, utf8_title_cookie, NULL), true);
++ window_update_icon(cwindow, xcb_get_property_reply(conn, wm_icon_cookie, NULL));
+ window_update_leader(cwindow, xcb_get_property_reply(conn, leader_cookie, NULL));
+ window_update_transient_for(cwindow, xcb_get_property_reply(conn, transient_cookie, NULL));
+ window_update_strut_partial(cwindow, xcb_get_property_reply(conn, strut_cookie, NULL));
+@@ -184,6 +188,8 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
window_update_hints(cwindow, xcb_get_property_reply(conn, wm_hints_cookie, NULL), &urgency_hint);
border_style_t motif_border_style = BS_NORMAL;
window_update_motif_hints(cwindow, xcb_get_property_reply(conn, motif_wm_hints_cookie, NULL), &motif_border_style);
-+ #ifdef USE_ICONS
-+ window_update_icon(cwindow, xcb_get_property_reply(conn, wm_icon_cookie, NULL));
-+ #endif
++
++
xcb_size_hints_t wm_size_hints;
if (!xcb_icccm_get_wm_size_hints_reply(conn, wm_normal_hints_cookie, &wm_size_hints, NULL))
memset(&wm_size_hints, '\0', sizeof(xcb_size_hints_t));
-diff -rupN i3-4.11-original/src/render.c i3-4.11-patched/src/render.c
---- i3-4.11-original/src/render.c 2015-09-30 02:55:10.000000000 -0400
-+++ i3-4.11-patched/src/render.c 2015-10-26 00:09:08.002065558 -0400
-@@ -223,6 +223,11 @@ void render_con(Con *con, bool render_fu
-
+diff --git a/src/render.c b/src/render.c
+index 9fa40f0..26d12a3 100644
+--- a/src/render.c
++++ b/src/render.c
+@@ -127,6 +127,10 @@ void render_con(Con *con, bool render_fullscreen) {
/* find the height for the decorations */
- int deco_height = render_deco_height();
-+ #ifdef USE_ICONS
+ params.deco_height = render_deco_height();
+
+ /* minimum decoration height to allow icon to fit
+ * not actuuly required, icon would be cropped otherwise */
-+ deco_height = deco_height<16 ? 16 : deco_height;
-+ #endif
-
++ params.deco_height = (params.deco_height < 16) ? 16 : params.deco_height;
++
/* precalculate the sizes to be able to correct rounding errors */
- int sizes[children];
-diff -rupN i3-4.11-original/src/tree.c i3-4.11-patched/src/tree.c
---- i3-4.11-original/src/tree.c 2015-09-30 02:55:10.000000000 -0400
-+++ i3-4.11-patched/src/tree.c 2015-10-26 00:10:18.246663507 -0400
-@@ -268,6 +268,9 @@ bool tree_close(Con *con, kill_window_t
- FREE(con->window->class_class);
- FREE(con->window->class_instance);
- i3string_free(con->window->name);
-+ #ifdef USE_ICONS
-+ FREE(con->window->icon);
-+ #endif
- FREE(con->window->ran_assignments);
- FREE(con->window);
- }
-diff -rupN i3-4.11-original/src/window.c i3-4.11-patched/src/window.c
---- i3-4.11-original/src/window.c 2015-09-30 02:55:10.000000000 -0400
-+++ i3-4.11-patched/src/window.c 2015-10-26 00:12:58.141954559 -0400
-@@ -334,6 +334,85 @@ void window_update_motif_hints(i3Window
+ params.sizes = precalculate_sizes(con, &params);
+
+diff --git a/src/window.c b/src/window.c
+index d10811f..b18927d 100644
+--- a/src/window.c
++++ b/src/window.c
+@@ -19,6 +19,7 @@ void window_free(i3Window *win) {
+ FREE(win->class_class);
+ FREE(win->class_instance);
+ i3string_free(win->name);
++ FREE(win->icon);
+ FREE(win->ran_assignments);
+ FREE(win);
+ }
+@@ -367,3 +368,87 @@ void window_update_motif_hints(i3Window *win, xcb_get_property_reply_t *prop, bo
+ #undef MWM_DECOR_BORDER
#undef MWM_DECOR_TITLE
}
-
-+#ifdef USE_ICONS
++
+/*
+ * Copy and resize icon if needed
+ */
+void copy_icon_with_resize(uint32_t *dst, int width, int height, uint32_t* src, int s_width, int s_height)
+{
+ int i, j;
-+ if (width==s_width && height==s_height) {
-+ /* easy case, same dimensions, just copy data */
++
++ if (width == s_width && height == s_height) {
++ /* easy case, same dimensions, just copy data */
+ memcpy(dst, src, width*height*sizeof(uint32_t));
++ return;
+ }
-+ else {
-+ uint32_t* row = src;
-+ int xstep = s_width/width;
-+ int ystep = s_height/height*s_width;
-+
-+ for(i=0; i < height; ++i) {
-+ uint32_t* ptr = row;
-+ for(j=0; j < width; ++j) {
-+ *dst++ = *ptr;
-+ ptr+=xstep;
-+ }
-+ row += ystep;
++
++ uint32_t* row = src;
++ int xstep = s_width / width;
++ int ystep = s_height / height * s_width;
++
++ for (i=0; i < height; ++i) {
++ uint32_t* ptr = row;
++ for(j=0; j < width; ++j) {
++ *dst++ = *ptr;
++ ptr+=xstep;
+ }
++ row += ystep;
+ }
+}
+
++
+void window_update_icon(i3Window *win, xcb_get_property_reply_t *prop)
+{
+ uint32_t *data = NULL;
+ uint64_t len = 0;
+
+ if(!prop || prop->type != XCB_ATOM_CARDINAL || prop->format != 32) {
-+ DLOG("_NET_WM_ICON is not set\n");
++ DLOG("_NET_WM_ICON is not set\n");
+ FREE(prop);
+ return;
+ }
@@ -184,151 +211,81 @@ diff -rupN i3-4.11-original/src/window.c i3-4.11-patched/src/window.c
+ uint32_t *prop_value = (uint32_t *) xcb_get_property_value(prop);
+
+ /* Find the number of icons in the reply. */
-+ while(prop_value_len > (sizeof(uint32_t) * 2) && prop_value && prop_value[0] && prop_value[1])
++ while (prop_value_len > (sizeof(uint32_t) * 2) && prop_value &&
++ prop_value[0] && prop_value[1])
+ {
-+ /* Check that the property is as long as it should be (in bytes),
-+ handling integer overflow. "+2" to handle the width and height
-+ fields. */
-+ const uint64_t crt_len = prop_value[0] * (uint64_t) prop_value[1];
-+ const uint64_t expected_len = (crt_len + 2) * 4;
-+ if(expected_len > prop_value_len)
-+ break;
-+
-+ if (len==0 || (crt_len>=16*16 && crt_len<len)) {
-+ len = crt_len;
-+ data = prop_value;
-+ }
-+ if (len==16*16) break; // found 16 pixels icon
-+
-+ /* Find pointer to next icon in the reply. */
-+ prop_value_len -= expected_len;
-+ prop_value = (uint32_t *) (((uint8_t *) prop_value) + expected_len);
++ /* Check that the property is as long as it should be (in bytes),
++ handling integer overflow. "+2" to handle the width and height
++ fields. */
++ const uint64_t crt_len = prop_value[0] * (uint64_t) prop_value[1];
++ const uint64_t expected_len = (crt_len + 2) * 4;
++
++ if (expected_len > prop_value_len) {
++ break;
++ }
++
++ if (len == 0 || (crt_len >= 16*16 && crt_len < len)) {
++ len = crt_len;
++ data = prop_value;
++ }
++ if (len == 16*16) {
++ break; // found 16 pixels icon
++ }
++
++ /* Find pointer to next icon in the reply. */
++ prop_value_len -= expected_len;
++ prop_value = (uint32_t *) (((uint8_t *) prop_value) + expected_len);
+ }
+
-+ if (!data ) {
-+ DLOG("Could not get _NET_WM_ICON\n");
-+ free(prop);
-+ return;
++ if (!data) {
++ DLOG("Could not get _NET_WM_ICON\n");
++ FREE(prop);
++ return;
+ }
+
+ LOG("Got _NET_WM_ICON of size: (%d,%d)\n", data[0], data[1]);
+
+ FREE(win->icon);
-+ win->icon = malloc(16*16*sizeof(uint32_t));
-+ copy_icon_with_resize(win->icon, 16, 16, data+2, data[0], data[1]);
-+
-+ free(prop);
-+}
-+#endif /* USE_ICONS */
-+
- /*
- * Returns the window title considering the current title format.
- * If no format is set, this will simply return the window's name.
-diff -rupN i3-4.11-original/src/x.c i3-4.11-patched/src/x.c
---- i3-4.11-original/src/x.c 2015-09-30 02:55:10.000000000 -0400
-+++ i3-4.11-patched/src/x.c 2015-10-26 00:18:12.942683615 -0400
-@@ -11,6 +11,9 @@
- *
- */
- #include "all.h"
-+#ifdef USE_ICONS
-+#include <xcb/xcb_image.h>
-+#endif
-
- xcb_window_t ewmh_window;
-
-@@ -312,6 +315,43 @@ void x_window_kill(xcb_window_t window,
- free(event);
- }
-
-+#ifdef USE_ICONS
-+static inline uint32_t pixel_blend(uint32_t d, uint32_t s)
-+{
-+ const uint32_t a = (s >> 24) + 1;
-+
-+ const uint32_t dstrb = d & 0xFF00FF;
-+ const uint32_t dstg = d & 0xFF00;
-+
-+ const uint32_t srcrb = s & 0xFF00FF;
-+ const uint32_t srcg = s & 0xFF00;
-+
-+ uint32_t drb = srcrb - dstrb;
-+ uint32_t dg = srcg - dstg;
-+
-+ drb *= a;
-+ dg *= a;
-+ drb >>= 8;
-+ dg >>= 8;
-+
-+ uint32_t rb = (drb + dstrb) & 0xFF00FF;
-+ uint32_t g = (dg + dstg) & 0xFF00;
++ win->icon = malloc(16 * 16 * sizeof(uint32_t));
++ copy_icon_with_resize(win->icon, 16, 16, data + 2, data[0], data[1]);
+
-+ return rb | g;
++ FREE(prop);
+}
-+
-+/*
-+ * Copy icon pixels, blend with background
-+ */
-+void copy_with_pixel_blend(uint32_t *dst, uint32_t* src, uint32_t background)
-+{
-+ int i;
-+ for(i=0; i < 16*16; ++i) {
-+ *dst++ = pixel_blend(background,*src++);
-+ }
-+}
-+#endif
-+
- /*
- * Draws the decoration of the given container onto its parent.
- *
-@@ -543,6 +583,9 @@ void x_draw_decoration(Con *con) {
- }
+diff --git a/src/x.c b/src/x.c
+index f44bc37..bfc5eba 100644
+--- a/src/x.c
++++ b/src/x.c
+@@ -571,6 +571,10 @@ void x_draw_decoration(Con *con) {
//DLOG("indent_level = %d, indent_mult = %d\n", indent_level, indent_mult);
int indent_px = (indent_level * 5) * indent_mult;
-+ #ifdef USE_ICONS
-+ if (win->icon) indent_px += 18;
-+ #endif
++ if (win->icon) {
++ indent_px += 18;
++ }
++
int mark_width = 0;
- if (config.show_marks && con->mark != NULL && (con->mark)[0] != '_') {
-@@ -564,6 +607,40 @@ void x_draw_decoration(Con *con) {
- parent->pixmap, parent->pm_gc,
- con->deco_rect.x + logical_px(2) + indent_px, con->deco_rect.y + text_offset_y,
- con->deco_rect.width - logical_px(2) - indent_px - mark_width - logical_px(2));
-+ #ifdef USE_ICONS
+ if (config.show_marks && !TAILQ_EMPTY(&(con->marks_head))) {
+ char *formatted_mark = sstrdup("");
+@@ -611,6 +615,22 @@ void x_draw_decoration(Con *con) {
+ if (con->title_format != NULL)
+ I3STRING_FREE(title);
+
+ /* Draw the icon */
+ if (win->icon) {
-+ xcb_image_t* icon;
-+
+ uint16_t width = 16;
+ uint16_t height = 16;
-+ uint32_t icon_pixels[width*height];
-+
-+ copy_with_pixel_blend(icon_pixels, win->icon, p->color->background);
-+
-+ icon = xcb_image_create_native( conn,
-+ width, height,
-+ XCB_IMAGE_FORMAT_Z_PIXMAP,
-+ root_depth,
-+ NULL,
-+ width*height*4,
-+ (uint8_t*)icon_pixels
-+ );
+
-+ if (icon) {
-+ int icon_offset_y = (con->deco_rect.height - 16) / 2;
++ int icon_offset_y = (con->deco_rect.height - height) / 2;
+
-+ xcb_image_put(conn, parent->pixmap, parent->pm_gc,
-+ icon, con->deco_rect.x + indent_px - 16 , con->deco_rect.y + icon_offset_y, 0);
-+
-+ xcb_image_destroy(icon);
-+ }
-+ else {
-+ ELOG("Error creating XCB image\n");
-+ }
++ draw_util_image(
++ (unsigned char *)win->icon,
++ &(parent->frame_buffer),
++ con->deco_rect.x + indent_px - width,
++ con->deco_rect.y + icon_offset_y,
++ width,
++ height);
+ }
-+ #endif
+
- if (win->title_format != NULL)
- I3STRING_FREE(title);
-
+ after_title:
+ x_draw_decoration_after_title(con, p);
+ copy_pixmaps: