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:
tokyo4j 2025-05-30 20:58:48 +09:00 committed by Hiroaki Yamamoto
parent 649773b4f8
commit fb077c0095
12 changed files with 247 additions and 57 deletions

View file

@ -281,6 +281,12 @@ struct view {
struct foreign_toplevel *foreign_toplevel;
/* used by scaled_icon_buffer */
struct {
char *name;
struct wl_array buffers; /* struct lab_data_buffer * */
} icon;
struct {
struct wl_signal new_app_id;
struct wl_signal new_title;
@ -289,6 +295,11 @@ struct view {
struct wl_signal minimized;
struct wl_signal fullscreened;
struct wl_signal activated; /* bool *activated */
/*
* This is emitted when app_id, or icon set via xdg_toplevel_icon
* is updated. This is listened by scaled_icon_buffer.
*/
struct wl_signal set_icon;
struct wl_signal destroy;
} events;
};
@ -614,6 +625,10 @@ int view_get_min_width(void);
void view_set_shade(struct view *view, bool shaded);
/* Icon buffers set with this function are dropped later */
void view_set_icon(struct view *view, const char *icon_name,
struct wl_array *buffers);
struct view_size_hints view_get_size_hints(struct view *view);
void view_adjust_size(struct view *view, int *w, int *h);