/* * Updates the name by using WM_NAME (encoded in COMPOUND_TEXT). We do not * touch what the client sends us but pass it to xcb_image_text_8. To get * proper unicode rendering, the application has to use _NET_WM_NAME (see * window_update_name()). * */ void window_update_name_legacy(i3Window *win, xcb_get_property_reply_t *prop, bool before_mgmt) { if (prop == NULL || xcb_get_property_value_length(prop) == 0) { DLOG("WM_NAME not set (_NET_WM_NAME is what you want anyways).\n"); FREE(prop); return; } /* ignore update when the window is known to already have a UTF-8 name */ if (win->uses_net_wm_name) { free(prop); return; } i3string_free(win->name); win->name = i3string_from_utf8_with_length(xcb_get_property_value(prop), xcb_get_property_value_length(prop)); LOG("WM_NAME changed to \"%s\"\n", i3string_as_utf8(win->name)); LOG("Using legacy window title. Note that in order to get Unicode window " "titles in i3, the application has to set _NET_WM_NAME (UTF-8)\n"); win->name_x_changed = true; if (before_mgmt) { free(prop); return; } run_assignments(win); free(prop); }
/* * Build an i3String from an UTF-8 encoded string in Pango markup with fixed * length. * */ i3String *i3string_from_markup_with_length(const char *from_markup, size_t num_bytes) { i3String *str = i3string_from_utf8_with_length(from_markup, num_bytes); /* set the markup flag */ str->is_markup = true; return str; }
/* * Updates the name by using _NET_WM_NAME (encoded in UTF-8) for the given * window. Further updates using window_update_name_legacy will be ignored. * */ void window_update_name(i3Window *win, xcb_get_property_reply_t *prop, bool before_mgmt) { if (prop == NULL || xcb_get_property_value_length(prop) == 0) { DLOG("_NET_WM_NAME not specified, not changing\n"); FREE(prop); return; } i3string_free(win->name); win->name = i3string_from_utf8_with_length(xcb_get_property_value(prop), xcb_get_property_value_length(prop)); win->name_x_changed = true; LOG("_NET_WM_NAME changed to \"%s\"\n", i3string_as_utf8(win->name)); win->uses_net_wm_name = true; if (before_mgmt) { free(prop); return; } run_assignments(win); free(prop); }