mirror of
https://github.com/labwc/labwc.git
synced 2025-11-11 13:30:04 -05:00
Support xdg-toplevel-icon protocol
This patch also changes the semantics of scaled_icon_buffer: rather than calling scaled_icon_buffer_set_app_id() every time an app_id is set, we can now call scaled_icon_buffer_set_view() just once so that multiple scaled_icon_buffers bound to a window are automatically updated when an app_id is set or new icon is set via xdg-toplevel-icon-v1.
This commit is contained in:
parent
649773b4f8
commit
fb077c0095
12 changed files with 247 additions and 57 deletions
|
|
@ -113,6 +113,7 @@ add_scene_button(struct wl_list *part_list, enum ssd_part_type type,
|
|||
struct scaled_icon_buffer *icon_buffer =
|
||||
scaled_icon_buffer_create(parent, view->server,
|
||||
button_width - 2 * icon_padding, button_height);
|
||||
scaled_icon_buffer_set_view(icon_buffer, view);
|
||||
assert(icon_buffer);
|
||||
icon_part->node = &icon_buffer->scene_buffer->node;
|
||||
wlr_scene_node_set_position(icon_part->node, icon_padding, 0);
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@ ssd_titlebar_create(struct ssd *ssd)
|
|||
update_visible_buttons(ssd);
|
||||
|
||||
ssd_update_title(ssd);
|
||||
ssd_update_window_icon(ssd);
|
||||
|
||||
bool maximized = view->maximized == VIEW_AXIS_BOTH;
|
||||
bool squared = ssd_should_be_squared(ssd);
|
||||
|
|
@ -324,7 +323,6 @@ ssd_titlebar_update(struct ssd *ssd)
|
|||
} FOR_EACH_END
|
||||
|
||||
ssd_update_title(ssd);
|
||||
ssd_update_window_icon(ssd);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -565,34 +563,4 @@ ssd_should_be_squared(struct ssd *ssd)
|
|||
&& view->maximized != VIEW_AXIS_BOTH;
|
||||
}
|
||||
|
||||
void
|
||||
ssd_update_window_icon(struct ssd *ssd)
|
||||
{
|
||||
#if HAVE_LIBSFDO
|
||||
if (!ssd) {
|
||||
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");
|
||||
assert(app_id);
|
||||
|
||||
struct ssd_sub_tree *subtree;
|
||||
FOR_EACH_STATE(ssd, subtree) {
|
||||
struct ssd_part *part = ssd_get_part(
|
||||
&subtree->parts, LAB_SSD_BUTTON_WINDOW_ICON);
|
||||
if (!part) {
|
||||
break;
|
||||
}
|
||||
|
||||
struct ssd_button *button = node_ssd_button_from_node(part->node);
|
||||
assert(button->window_icon);
|
||||
scaled_icon_buffer_set_app_id(button->window_icon, app_id);
|
||||
} FOR_EACH_END
|
||||
#endif
|
||||
}
|
||||
|
||||
#undef FOR_EACH_STATE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue