mirror of
https://github.com/labwc/labwc.git
synced 2025-10-31 22:25:34 -04:00
ssd-titlebar: show fallback icon when no app_id is set
Before this commit, nothing was rendered in window icon button if the
application doesn't set its app_id (e.g. nested kwin_wayland). This was my
oversight in dc474521.
This commit makes sure fallback icon (set via <theme><fallbackAppIcon>)
by removing ssd->state.app_id and the early-return in
ssd_update_window_icon(). This doesn't affect performance because
scaled_icon_buffer caches app_id and scaled_icon_buffer_set_app_id() does
nothing when a duplicated app_id is passed.
This commit is contained in:
parent
c1a27b139c
commit
392db7c04d
2 changed files with 5 additions and 14 deletions
|
|
@ -83,8 +83,6 @@ struct ssd {
|
||||||
struct ssd_state_title_width active;
|
struct ssd_state_title_width active;
|
||||||
struct ssd_state_title_width inactive;
|
struct ssd_state_title_width inactive;
|
||||||
} title;
|
} title;
|
||||||
|
|
||||||
char *app_id;
|
|
||||||
} state;
|
} state;
|
||||||
|
|
||||||
/* An invisible area around the view which allows resizing */
|
/* An invisible area around the view which allows resizing */
|
||||||
|
|
|
||||||
|
|
@ -343,9 +343,6 @@ ssd_titlebar_destroy(struct ssd *ssd)
|
||||||
if (ssd->state.title.text) {
|
if (ssd->state.title.text) {
|
||||||
zfree(ssd->state.title.text);
|
zfree(ssd->state.title.text);
|
||||||
}
|
}
|
||||||
if (ssd->state.app_id) {
|
|
||||||
zfree(ssd->state.app_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
wlr_scene_node_destroy(&ssd->titlebar.tree->node);
|
wlr_scene_node_destroy(&ssd->titlebar.tree->node);
|
||||||
ssd->titlebar.tree = NULL;
|
ssd->titlebar.tree = NULL;
|
||||||
|
|
@ -575,16 +572,12 @@ ssd_update_window_icon(struct ssd *ssd)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When app id is not set, an empty string is stored here and the
|
||||||
|
* fallback icon is always rendered.
|
||||||
|
*/
|
||||||
const char *app_id = view_get_string_prop(ssd->view, "app_id");
|
const char *app_id = view_get_string_prop(ssd->view, "app_id");
|
||||||
if (string_null_or_empty(app_id)) {
|
assert(app_id);
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (ssd->state.app_id && !strcmp(ssd->state.app_id, app_id)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
free(ssd->state.app_id);
|
|
||||||
ssd->state.app_id = xstrdup(app_id);
|
|
||||||
|
|
||||||
struct ssd_sub_tree *subtree;
|
struct ssd_sub_tree *subtree;
|
||||||
FOR_EACH_STATE(ssd, subtree) {
|
FOR_EACH_STATE(ssd, subtree) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue