|
@ -1,14 +1,10 @@ |
|
|
# Rebased from: https://github.com/i3/i3/compare/4.13...mickael9:window-icons.diff |
|
|
# From: https://github.com/i3/i3/compare/4.14...mickael9:window-icons.diff |
|
|
# For i3-4.14 |
|
|
|
|
|
|
|
|
|
|
|
# Add support for window icons in the i3 title bar. |
|
|
# Add support for window icons in the i3 title bar. |
|
|
# This makes it easier to distinguish windows without reading their names, |
|
|
# This makes it easier to distinguish windows without reading their names, |
|
|
# and makes it possible to use browsers like qutebrowser in tabbed mode. |
|
|
# and makes it possible to use browsers like qutebrowser in tabbed mode. |
|
|
|
|
|
|
|
|
diff --git a/include/atoms_rest.xmacro b/include/atoms_rest.xmacro
|
|
|
+++ include/atoms_rest.xmacro
|
|
|
index d461dc08..f32a7e1e 100644
|
|
|
|
|
|
--- a/include/atoms_rest.xmacro
|
|
|
|
|
|
+++ b/include/atoms_rest.xmacro
|
|
|
|
|
|
@@ -1,6 +1,7 @@
|
|
|
@@ -1,6 +1,7 @@
|
|
|
xmacro(_NET_WM_USER_TIME) |
|
|
xmacro(_NET_WM_USER_TIME) |
|
|
xmacro(_NET_STARTUP_ID) |
|
|
xmacro(_NET_STARTUP_ID) |
|
@ -17,11 +13,8 @@ index d461dc08..f32a7e1e 100644 |
|
|
xmacro(WM_PROTOCOLS) |
|
|
xmacro(WM_PROTOCOLS) |
|
|
xmacro(WM_DELETE_WINDOW) |
|
|
xmacro(WM_DELETE_WINDOW) |
|
|
xmacro(UTF8_STRING) |
|
|
xmacro(UTF8_STRING) |
|
|
diff --git a/include/data.h b/include/data.h
|
|
|
+++ include/data.h
|
|
|
index 69a79ade..4bd84a02 100644
|
|
|
@@ -470,6 +470,11 @@
|
|
|
--- a/include/data.h
|
|
|
|
|
|
+++ b/include/data.h
|
|
|
|
|
|
@@ -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; |
|
@ -33,27 +26,21 @@ index 69a79ade..4bd84a02 100644 |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
diff --git a/include/libi3.h b/include/libi3.h
|
|
|
+++ include/libi3.h
|
|
|
index dbb29e1f..bd898b06 100644
|
|
|
@@ -602,6 +602,11 @@
|
|
|
--- a/include/libi3.h
|
|
|
|
|
|
+++ b/include/libi3.h
|
|
|
|
|
|
@@ -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 |
|
|
diff --git a/include/window.h b/include/window.h
|
|
|
* surface as well as restoring the cairo state. |
|
|
index 77e3f48f..894ee9fd 100644
|
|
|
+++ include/window.h
|
|
|
--- a/include/window.h
|
|
|
@@ -89,3 +89,9 @@
|
|
|
+++ b/include/window.h
|
|
|
|
|
|
@@ -89,3 +89,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); |
|
|
void window_update_motif_hints(i3Window *win, xcb_get_property_reply_t *prop, border_style_t *motif_border_style); |
|
@ -63,11 +50,8 @@ index 77e3f48f..894ee9fd 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
|
|
|
+++ libi3/draw_util.c
|
|
|
index 6a2e93dc..2147effc 100644
|
|
|
@@ -140,6 +140,42 @@
|
|
|
--- a/libi3/draw_util.c
|
|
|
|
|
|
+++ b/libi3/draw_util.c
|
|
|
|
|
|
@@ -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); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -110,11 +94,8 @@ index 6a2e93dc..2147effc 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
|
|
|
+++ src/handlers.c
|
|
|
index c273e116..0bea73bb 100644
|
|
|
@@ -1402,6 +1402,19 @@
|
|
|
--- a/src/handlers.c
|
|
|
|
|
|
+++ b/src/handlers.c
|
|
|
|
|
|
@@ -1400,6 +1400,19 @@ static bool handle_strut_partial_change(void *data, xcb_connection_t *conn, uint
|
|
|
|
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -134,7 +115,7 @@ index c273e116..0bea73bb 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); |
|
|
@@ -1421,7 +1434,8 @@ static struct property_handler_t property_handlers[] = {
|
|
|
@@ -1423,7 +1436,8 @@
|
|
|
{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}, |
|
@ -144,7 +125,7 @@ index c273e116..0bea73bb 100644 |
|
|
#define NUM_HANDLERS (sizeof(property_handlers) / sizeof(struct property_handler_t)) |
|
|
#define NUM_HANDLERS (sizeof(property_handlers) / sizeof(struct property_handler_t)) |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
@@ -1443,6 +1457,7 @@ void property_handlers_init(void) {
|
|
|
@@ -1445,6 +1459,7 @@
|
|
|
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; |
|
@ -152,11 +133,8 @@ index c273e116..0bea73bb 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
|
|
|
+++ src/manage.c
|
|
|
index 86a361c3..adbd3456 100644
|
|
|
@@ -91,6 +91,8 @@
|
|
|
--- a/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
|
|
|
|
|
|
role_cookie, startup_id_cookie, wm_hints_cookie, |
|
|
role_cookie, startup_id_cookie, wm_hints_cookie, |
|
|
wm_normal_hints_cookie, motif_wm_hints_cookie, wm_user_time_cookie, wm_desktop_cookie; |
|
|
wm_normal_hints_cookie, motif_wm_hints_cookie, wm_user_time_cookie, wm_desktop_cookie; |
|
|
|
|
|
|
|
@ -165,7 +143,7 @@ index 86a361c3..adbd3456 100644 |
|
|
geomc = xcb_get_geometry(conn, d); |
|
|
geomc = xcb_get_geometry(conn, d); |
|
|
|
|
|
|
|
|
/* Check if the window is mapped (it could be not mapped when intializing and |
|
|
/* Check if the window is mapped (it could be not mapped when intializing and |
|
|
@@ -162,6 +164,7 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
|
|
|
@@ -162,6 +164,7 @@
|
|
|
motif_wm_hints_cookie = GET_PROPERTY(A__MOTIF_WM_HINTS, 5 * sizeof(uint64_t)); |
|
|
motif_wm_hints_cookie = GET_PROPERTY(A__MOTIF_WM_HINTS, 5 * sizeof(uint64_t)); |
|
|
wm_user_time_cookie = GET_PROPERTY(A__NET_WM_USER_TIME, UINT32_MAX); |
|
|
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_desktop_cookie = GET_PROPERTY(A__NET_WM_DESKTOP, UINT32_MAX); |
|
@ -173,7 +151,7 @@ index 86a361c3..adbd3456 100644 |
|
|
|
|
|
|
|
|
DLOG("Managing window 0x%08x\n", window); |
|
|
DLOG("Managing window 0x%08x\n", window); |
|
|
|
|
|
|
|
|
@@ -177,6 +180,7 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
|
|
|
@@ -177,6 +180,7 @@
|
|
|
window_update_class(cwindow, xcb_get_property_reply(conn, class_cookie, NULL), true); |
|
|
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_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_name(cwindow, xcb_get_property_reply(conn, utf8_title_cookie, NULL), true); |
|
@ -181,7 +159,7 @@ index 86a361c3..adbd3456 100644 |
|
|
window_update_leader(cwindow, xcb_get_property_reply(conn, leader_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_transient_for(cwindow, xcb_get_property_reply(conn, transient_cookie, NULL)); |
|
|
window_update_strut_partial(cwindow, xcb_get_property_reply(conn, strut_cookie, NULL)); |
|
|
window_update_strut_partial(cwindow, xcb_get_property_reply(conn, strut_cookie, NULL)); |
|
|
@@ -185,6 +189,8 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
|
|
|
@@ -185,6 +189,8 @@
|
|
|
window_update_hints(cwindow, xcb_get_property_reply(conn, wm_hints_cookie, NULL), &urgency_hint); |
|
|
window_update_hints(cwindow, xcb_get_property_reply(conn, wm_hints_cookie, NULL), &urgency_hint); |
|
|
border_style_t motif_border_style = BS_NORMAL; |
|
|
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); |
|
|
window_update_motif_hints(cwindow, xcb_get_property_reply(conn, motif_wm_hints_cookie, NULL), &motif_border_style); |
|
@ -190,11 +168,8 @@ index 86a361c3..adbd3456 100644 |
|
|
xcb_size_hints_t wm_size_hints; |
|
|
xcb_size_hints_t wm_size_hints; |
|
|
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
|
|
|
+++ src/render.c
|
|
|
index 85548f26..6380f51a 100644
|
|
|
@@ -125,6 +125,10 @@
|
|
|
--- a/src/render.c
|
|
|
|
|
|
+++ b/src/render.c
|
|
|
|
|
|
@@ -125,6 +125,10 @@ void render_con(Con *con, bool render_fullscreen) {
|
|
|
|
|
|
/* find the height for the decorations */ |
|
|
/* find the height for the decorations */ |
|
|
params.deco_height = render_deco_height(); |
|
|
params.deco_height = render_deco_height(); |
|
|
|
|
|
|
|
@ -205,11 +180,8 @@ index 85548f26..6380f51a 100644 |
|
|
/* precalculate the sizes to be able to correct rounding errors */ |
|
|
/* precalculate the sizes to be able to correct rounding errors */ |
|
|
params.sizes = precalculate_sizes(con, ¶ms); |
|
|
params.sizes = precalculate_sizes(con, ¶ms); |
|
|
|
|
|
|
|
|
diff --git a/src/window.c b/src/window.c
|
|
|
+++ src/window.c
|
|
|
index db6215d0..5b694593 100644
|
|
|
@@ -17,6 +17,7 @@
|
|
|
--- a/src/window.c
|
|
|
|
|
|
+++ b/src/window.c
|
|
|
|
|
|
@@ -17,6 +17,7 @@ void window_free(i3Window *win) {
|
|
|
|
|
|
FREE(win->class_class); |
|
|
FREE(win->class_class); |
|
|
FREE(win->class_instance); |
|
|
FREE(win->class_instance); |
|
|
i3string_free(win->name); |
|
|
i3string_free(win->name); |
|
@ -217,7 +189,7 @@ index db6215d0..5b694593 100644 |
|
|
FREE(win->ran_assignments); |
|
|
FREE(win->ran_assignments); |
|
|
FREE(win); |
|
|
FREE(win); |
|
|
} |
|
|
} |
|
|
@@ -365,3 +366,75 @@ void window_update_motif_hints(i3Window *win, xcb_get_property_reply_t *prop, bo
|
|
|
@@ -365,3 +366,75 @@
|
|
|
#undef MWM_DECOR_BORDER |
|
|
#undef MWM_DECOR_BORDER |
|
|
#undef MWM_DECOR_TITLE |
|
|
#undef MWM_DECOR_TITLE |
|
|
} |
|
|
} |
|
@ -293,11 +265,8 @@ index db6215d0..5b694593 100644 |
|
|
+
|
|
|
+
|
|
|
+ FREE(prop);
|
|
|
+ FREE(prop);
|
|
|
+}
|
|
|
+}
|
|
|
diff --git a/src/x.c b/src/x.c
|
|
|
+++ src/x.c
|
|
|
index ee5ed2ce..00d86829 100644
|
|
|
@@ -546,6 +546,7 @@
|
|
|
--- a/src/x.c
|
|
|
|
|
|
+++ b/src/x.c
|
|
|
|
|
|
@@ -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; |
|
@ -305,7 +274,7 @@ index ee5ed2ce..00d86829 100644 |
|
|
|
|
|
|
|
|
struct Window *win = con->window; |
|
|
struct Window *win = con->window; |
|
|
if (win == NULL) { |
|
|
if (win == NULL) { |
|
|
@@ -572,6 +573,9 @@ void x_draw_decoration(Con *con) {
|
|
|
@@ -572,6 +573,9 @@
|
|
|
goto after_title; |
|
|
goto after_title; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -315,7 +284,7 @@ index ee5ed2ce..00d86829 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(""); |
|
|
@@ -611,14 +615,32 @@ void x_draw_decoration(Con *con) {
|
|
|
@@ -611,14 +615,32 @@
|
|
|
|
|
|
|
|
|
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, |