Implement showing window icons in titlebar (#4439)

This feature defaults to off, and can be turned on for individual windows,
or (with for_window) for all new windows. See the userguide change.

This commit is partially based on work by:

• Marius Muja
• mickael9
• Esteve Varela Colominas
• Bernardo Menicagli
This commit is contained in:
Michael Stapelberg
2021-06-13 08:35:52 +02:00
committed by GitHub
parent eaa5e636f9
commit abbf6a85d7
23 changed files with 392 additions and 27 deletions

View File

@ -1185,6 +1185,14 @@ static bool handle_i3_floating(Con *con, xcb_get_property_reply_t *prop) {
return true;
}
static bool handle_windowicon_change(Con *con, xcb_get_property_reply_t *prop) {
window_update_icon(con->window, prop);
x_push_changes(croot);
return true;
}
/* Returns false if the event could not be processed (e.g. the window could not
* be found), true otherwise */
typedef bool (*cb_property_handler_t)(Con *con, xcb_get_property_reply_t *property);
@ -1208,7 +1216,8 @@ static struct property_handler_t property_handlers[] = {
{0, UINT_MAX, handle_window_type},
{0, UINT_MAX, handle_i3_floating},
{0, 128, handle_machine_change},
{0, 5 * sizeof(uint64_t), handle_motif_hints_change}};
{0, 5 * sizeof(uint64_t), handle_motif_hints_change},
{0, UINT_MAX, handle_windowicon_change}};
#define NUM_HANDLERS (sizeof(property_handlers) / sizeof(struct property_handler_t))
/*
@ -1232,6 +1241,7 @@ void property_handlers_init(void) {
property_handlers[10].atom = A_I3_FLOATING_WINDOW;
property_handlers[11].atom = XCB_ATOM_WM_CLIENT_MACHINE;
property_handlers[12].atom = A__MOTIF_WM_HINTS;
property_handlers[13].atom = A__NET_WM_ICON;
}
static void property_notify(uint8_t state, xcb_window_t window, xcb_atom_t atom) {