|
@ -1,7 +1,8 @@ |
|
|
# Obtained from: https://github.com/i3/i3/compare/4.13...mickael9:window-icons.diff |
|
|
# Rebased from: https://github.com/i3/i3/compare/4.13...mickael9:window-icons.diff |
|
|
|
|
|
# For i3-4.14 |
|
|
|
|
|
|
|
|
diff --git a/include/atoms_rest.xmacro b/include/atoms_rest.xmacro
|
|
|
diff --git a/include/atoms_rest.xmacro b/include/atoms_rest.xmacro
|
|
|
index d461dc0..f32a7e1 100644
|
|
|
index d461dc08..f32a7e1e 100644
|
|
|
--- a/include/atoms_rest.xmacro
|
|
|
--- a/include/atoms_rest.xmacro
|
|
|
+++ b/include/atoms_rest.xmacro
|
|
|
+++ b/include/atoms_rest.xmacro
|
|
|
@@ -1,6 +1,7 @@
|
|
|
@@ -1,6 +1,7 @@
|
|
@ -13,10 +14,10 @@ index d461dc0..f32a7e1 100644 |
|
|
xmacro(WM_DELETE_WINDOW) |
|
|
xmacro(WM_DELETE_WINDOW) |
|
|
xmacro(UTF8_STRING) |
|
|
xmacro(UTF8_STRING) |
|
|
diff --git a/include/data.h b/include/data.h
|
|
|
diff --git a/include/data.h b/include/data.h
|
|
|
index a729b21..faed55e 100644
|
|
|
index 69a79ade..4bd84a02 100644
|
|
|
--- a/include/data.h
|
|
|
--- a/include/data.h
|
|
|
+++ b/include/data.h
|
|
|
+++ b/include/data.h
|
|
|
@@ -440,6 +440,11 @@ struct Window {
|
|
|
@@ -460,6 +460,11 @@ struct Window {
|
|
|
|
|
|
|
|
|
/* aspect ratio from WM_NORMAL_HINTS (MPlayer uses this for example) */ |
|
|
/* aspect ratio from WM_NORMAL_HINTS (MPlayer uses this for example) */ |
|
|
double aspect_ratio; |
|
|
double aspect_ratio; |
|
@ -29,23 +30,23 @@ index a729b21..faed55e 100644 |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
diff --git a/include/libi3.h b/include/libi3.h
|
|
|
diff --git a/include/libi3.h b/include/libi3.h
|
|
|
index 11ca312..35174f2 100644
|
|
|
index dbb29e1f..bd898b06 100644
|
|
|
--- a/include/libi3.h
|
|
|
--- a/include/libi3.h
|
|
|
+++ b/include/libi3.h
|
|
|
+++ b/include/libi3.h
|
|
|
@@ -586,6 +586,11 @@ color_t draw_util_hex_to_color(const char *color);
|
|
|
@@ -601,6 +601,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); |
|
|
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.
|
|
|
+ * Draw the given image using libi3.
|
|
|
+ */
|
|
|
+ */
|
|
|
+void draw_util_image(unsigned char *src, int src_width, int src_height, surface_t *surface, int x, int y, int width, int height);
|
|
|
+void draw_util_image(unsigned char *src, int src_width, int src_height, surface_t *surface, int x, int y, int width, int height);
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
/** |
|
|
* Draws a filled rectangle. |
|
|
* Draws a filled rectangle. |
|
|
* This function is a convenience wrapper and takes care of flushing the |
|
|
* 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
|
|
|
diff --git a/include/window.h b/include/window.h
|
|
|
index 77e3f48..894ee9f 100644
|
|
|
index 77e3f48f..894ee9fd 100644
|
|
|
--- a/include/window.h
|
|
|
--- a/include/window.h
|
|
|
+++ b/include/window.h
|
|
|
+++ b/include/window.h
|
|
|
@@ -89,3 +89,9 @@ void window_update_hints(i3Window *win, xcb_get_property_reply_t *prop, bool *ur
|
|
|
@@ -89,3 +89,9 @@ void window_update_hints(i3Window *win, xcb_get_property_reply_t *prop, bool *ur
|
|
@ -59,10 +60,10 @@ index 77e3f48..894ee9f 100644 |
|
|
+ */
|
|
|
+ */
|
|
|
+void window_update_icon(i3Window *win, xcb_get_property_reply_t *prop);
|
|
|
+void window_update_icon(i3Window *win, xcb_get_property_reply_t *prop);
|
|
|
diff --git a/libi3/draw_util.c b/libi3/draw_util.c
|
|
|
diff --git a/libi3/draw_util.c b/libi3/draw_util.c
|
|
|
index e471405..329b685 100644
|
|
|
index 6a2e93dc..2147effc 100644
|
|
|
--- a/libi3/draw_util.c
|
|
|
--- a/libi3/draw_util.c
|
|
|
+++ b/libi3/draw_util.c
|
|
|
+++ b/libi3/draw_util.c
|
|
|
@@ -135,6 +135,42 @@ void draw_util_text(i3String *text, surface_t *surface, color_t fg_color, color_
|
|
|
@@ -140,6 +140,42 @@ void draw_util_text(i3String *text, surface_t *surface, color_t fg_color, color_
|
|
|
cairo_surface_mark_dirty(surface->surface); |
|
|
cairo_surface_mark_dirty(surface->surface); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -106,10 +107,10 @@ index e471405..329b685 100644 |
|
|
* Draws a filled rectangle. |
|
|
* Draws a filled rectangle. |
|
|
* This function is a convenience wrapper and takes care of flushing the |
|
|
* This function is a convenience wrapper and takes care of flushing the |
|
|
diff --git a/src/handlers.c b/src/handlers.c
|
|
|
diff --git a/src/handlers.c b/src/handlers.c
|
|
|
index 7dfacef..37bd70c 100644
|
|
|
index c273e116..0bea73bb 100644
|
|
|
--- a/src/handlers.c
|
|
|
--- a/src/handlers.c
|
|
|
+++ b/src/handlers.c
|
|
|
+++ b/src/handlers.c
|
|
|
@@ -1287,6 +1287,19 @@ static bool handle_strut_partial_change(void *data, xcb_connection_t *conn, uint
|
|
|
@@ -1400,6 +1400,19 @@ static bool handle_strut_partial_change(void *data, xcb_connection_t *conn, uint
|
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -129,7 +130,7 @@ index 7dfacef..37bd70c 100644 |
|
|
/* Returns false if the event could not be processed (e.g. the window could not |
|
|
/* Returns false if the event could not be processed (e.g. the window could not |
|
|
* be found), true otherwise */ |
|
|
* be found), true otherwise */ |
|
|
typedef bool (*cb_property_handler_t)(void *data, xcb_connection_t *c, uint8_t state, xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *property); |
|
|
typedef bool (*cb_property_handler_t)(void *data, xcb_connection_t *c, uint8_t state, xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *property); |
|
|
@@ -1308,7 +1321,8 @@ static struct property_handler_t property_handlers[] = {
|
|
|
@@ -1421,7 +1434,8 @@ static struct property_handler_t property_handlers[] = {
|
|
|
{0, 128, handle_class_change}, |
|
|
{0, 128, handle_class_change}, |
|
|
{0, UINT_MAX, handle_strut_partial_change}, |
|
|
{0, UINT_MAX, handle_strut_partial_change}, |
|
|
{0, UINT_MAX, handle_window_type}, |
|
|
{0, UINT_MAX, handle_window_type}, |
|
@ -139,7 +140,7 @@ index 7dfacef..37bd70c 100644 |
|
|
#define NUM_HANDLERS (sizeof(property_handlers) / sizeof(struct property_handler_t)) |
|
|
#define NUM_HANDLERS (sizeof(property_handlers) / sizeof(struct property_handler_t)) |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
@@ -1330,6 +1344,7 @@ void property_handlers_init(void) {
|
|
|
@@ -1443,6 +1457,7 @@ void property_handlers_init(void) {
|
|
|
property_handlers[8].atom = A__NET_WM_STRUT_PARTIAL; |
|
|
property_handlers[8].atom = A__NET_WM_STRUT_PARTIAL; |
|
|
property_handlers[9].atom = A__NET_WM_WINDOW_TYPE; |
|
|
property_handlers[9].atom = A__NET_WM_WINDOW_TYPE; |
|
|
property_handlers[10].atom = A__MOTIF_WM_HINTS; |
|
|
property_handlers[10].atom = A__MOTIF_WM_HINTS; |
|
@ -148,7 +149,7 @@ index 7dfacef..37bd70c 100644 |
|
|
|
|
|
|
|
|
static void property_notify(uint8_t state, xcb_window_t window, xcb_atom_t atom) { |
|
|
static void property_notify(uint8_t state, xcb_window_t window, xcb_atom_t atom) { |
|
|
diff --git a/src/manage.c b/src/manage.c
|
|
|
diff --git a/src/manage.c b/src/manage.c
|
|
|
index 81ee16f..233333b 100644
|
|
|
index 86a361c3..adbd3456 100644
|
|
|
--- a/src/manage.c
|
|
|
--- a/src/manage.c
|
|
|
+++ b/src/manage.c
|
|
|
+++ b/src/manage.c
|
|
|
@@ -91,6 +91,8 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
|
|
|
@@ -91,6 +91,8 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
|
|
@ -186,7 +187,7 @@ index 81ee16f..233333b 100644 |
|
|
if (!xcb_icccm_get_wm_size_hints_reply(conn, wm_normal_hints_cookie, &wm_size_hints, NULL)) |
|
|
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)); |
|
|
memset(&wm_size_hints, '\0', sizeof(xcb_size_hints_t)); |
|
|
diff --git a/src/render.c b/src/render.c
|
|
|
diff --git a/src/render.c b/src/render.c
|
|
|
index 85548f2..6380f51 100644
|
|
|
index 85548f26..6380f51a 100644
|
|
|
--- a/src/render.c
|
|
|
--- a/src/render.c
|
|
|
+++ b/src/render.c
|
|
|
+++ b/src/render.c
|
|
|
@@ -125,6 +125,10 @@ void render_con(Con *con, bool render_fullscreen) {
|
|
|
@@ -125,6 +125,10 @@ void render_con(Con *con, bool render_fullscreen) {
|
|
@ -201,7 +202,7 @@ index 85548f2..6380f51 100644 |
|
|
params.sizes = precalculate_sizes(con, ¶ms); |
|
|
params.sizes = precalculate_sizes(con, ¶ms); |
|
|
|
|
|
|
|
|
diff --git a/src/window.c b/src/window.c
|
|
|
diff --git a/src/window.c b/src/window.c
|
|
|
index db6215d..5b69459 100644
|
|
|
index db6215d0..5b694593 100644
|
|
|
--- a/src/window.c
|
|
|
--- a/src/window.c
|
|
|
+++ b/src/window.c
|
|
|
+++ b/src/window.c
|
|
|
@@ -17,6 +17,7 @@ void window_free(i3Window *win) {
|
|
|
@@ -17,6 +17,7 @@ void window_free(i3Window *win) {
|
|
@ -289,10 +290,10 @@ index db6215d..5b69459 100644 |
|
|
+ FREE(prop);
|
|
|
+ FREE(prop);
|
|
|
+}
|
|
|
+}
|
|
|
diff --git a/src/x.c b/src/x.c
|
|
|
diff --git a/src/x.c b/src/x.c
|
|
|
index 8d7d3dd..4dcd2c6 100644
|
|
|
index ee5ed2ce..00d86829 100644
|
|
|
--- a/src/x.c
|
|
|
--- a/src/x.c
|
|
|
+++ b/src/x.c
|
|
|
+++ b/src/x.c
|
|
|
@@ -538,6 +538,7 @@ void x_draw_decoration(Con *con) {
|
|
|
@@ -546,6 +546,7 @@ void x_draw_decoration(Con *con) {
|
|
|
|
|
|
|
|
|
/* 6: draw the title */ |
|
|
/* 6: draw the title */ |
|
|
int text_offset_y = (con->deco_rect.height - config.font.height) / 2; |
|
|
int text_offset_y = (con->deco_rect.height - config.font.height) / 2; |
|
@ -300,9 +301,9 @@ index 8d7d3dd..4dcd2c6 100644 |
|
|
|
|
|
|
|
|
struct Window *win = con->window; |
|
|
struct Window *win = con->window; |
|
|
if (win == NULL) { |
|
|
if (win == NULL) { |
|
|
@@ -567,6 +568,9 @@ void x_draw_decoration(Con *con) {
|
|
|
@@ -572,6 +573,9 @@ void x_draw_decoration(Con *con) {
|
|
|
if (win->name == NULL) |
|
|
goto after_title; |
|
|
goto copy_pixmaps; |
|
|
} |
|
|
|
|
|
|
|
|
+ if (win->icon)
|
|
|
+ if (win->icon)
|
|
|
+ text_offset_x = 18;
|
|
|
+ text_offset_x = 18;
|
|
@ -310,8 +311,8 @@ index 8d7d3dd..4dcd2c6 100644 |
|
|
int mark_width = 0; |
|
|
int mark_width = 0; |
|
|
if (config.show_marks && !TAILQ_EMPTY(&(con->marks_head))) { |
|
|
if (config.show_marks && !TAILQ_EMPTY(&(con->marks_head))) { |
|
|
char *formatted_mark = sstrdup(""); |
|
|
char *formatted_mark = sstrdup(""); |
|
|
@@ -602,12 +606,30 @@ void x_draw_decoration(Con *con) {
|
|
|
@@ -611,14 +615,32 @@ void x_draw_decoration(Con *con) {
|
|
|
i3String *title = con->title_format == NULL ? win->name : con_parse_title_format(con); |
|
|
|
|
|
draw_util_text(title, &(parent->frame_buffer), |
|
|
draw_util_text(title, &(parent->frame_buffer), |
|
|
p->color->text, p->color->background, |
|
|
p->color->text, p->color->background, |
|
|
- con->deco_rect.x + logical_px(2),
|
|
|
- con->deco_rect.x + logical_px(2),
|
|
@ -319,8 +320,10 @@ index 8d7d3dd..4dcd2c6 100644 |
|
|
con->deco_rect.y + text_offset_y, |
|
|
con->deco_rect.y + text_offset_y, |
|
|
- con->deco_rect.width - mark_width - 2 * logical_px(2));
|
|
|
- con->deco_rect.width - mark_width - 2 * logical_px(2));
|
|
|
+ con->deco_rect.width - text_offset_x - mark_width - 2 * logical_px(2));
|
|
|
+ con->deco_rect.width - text_offset_x - mark_width - 2 * logical_px(2));
|
|
|
if (con->title_format != NULL) |
|
|
|
|
|
|
|
|
if (con->title_format != NULL) { |
|
|
I3STRING_FREE(title); |
|
|
I3STRING_FREE(title); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
+ /* Draw the icon */
|
|
|
+ /* Draw the icon */
|
|
|
+ if (win->icon) {
|
|
|
+ if (win->icon) {
|