From f090255f242f46e1bad5ef21afea730d93cdcb9e Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Fri, 14 Jan 2022 18:36:14 +0200 Upstream-status: Submitted Subject: [PATCH] clients/window: Add set_app_id function + change Wayland Terminal Without this we can not switch to weston-terminal. Signed-off-by: Marius Vlad --- clients/terminal.c | 3 ++- clients/window.c | 12 ++++++++++++ clients/window.h | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/clients/terminal.c b/clients/terminal.c index 66e2bf5..49c88ab 100644 --- a/clients/terminal.c +++ b/clients/terminal.c @@ -2947,8 +2947,9 @@ terminal_create(struct display *display) terminal->margin_bottom = -1; terminal->window = window_create(display); terminal->widget = window_frame_create(terminal->window, terminal); - terminal->title = xstrdup("Wayland Terminal"); + terminal->title = xstrdup("weston-terminal"); window_set_title(terminal->window, terminal->title); + window_set_app_id(terminal->window, terminal->title); widget_set_transparent(terminal->widget, 0); init_state_machine(&terminal->state_machine); diff --git a/clients/window.c b/clients/window.c index 2bd303e..bfa1756 100644 --- a/clients/window.c +++ b/clients/window.c @@ -230,6 +230,7 @@ struct window { struct display *display; struct wl_list window_output_list; char *title; + char *app_id; struct rectangle saved_allocation; struct rectangle min_allocation; struct rectangle pending_allocation; @@ -1609,6 +1610,7 @@ window_destroy(struct window *window) wl_list_remove(&window->link); free(window->title); + free(window->app_id); free(window); } @@ -4812,6 +4814,16 @@ window_set_title(struct window *window, const char *title) xdg_toplevel_set_title(window->xdg_toplevel, title); } +void +window_set_app_id(struct window *window, const char *app_id) +{ + free(window->app_id); + window->app_id = strdup(app_id); + + if (window->xdg_toplevel) + xdg_toplevel_set_app_id(window->xdg_toplevel, window->app_id); +} + const char * window_get_title(struct window *window) { diff --git a/clients/window.h b/clients/window.h index c66dd06..7a1a076 100644 --- a/clients/window.h +++ b/clients/window.h @@ -500,6 +500,9 @@ window_set_locked_pointer_motion_handler( void window_set_title(struct window *window, const char *title); +void +window_set_app_id(struct window *window, const char *app_id); + const char * window_get_title(struct window *window); -- 2.33.0