weston_8.0_aglcore.inc: Set-up app_id for toytoolkit apps
[AGL/meta-agl.git] / meta-agl-core / recipes-graphics / wayland / weston / 0001-clients-window-Add-set_app_id-function-change-Waylan.patch
1 From f090255f242f46e1bad5ef21afea730d93cdcb9e Mon Sep 17 00:00:00 2001
2 From: Marius Vlad <marius.vlad@collabora.com>
3 Date: Fri, 14 Jan 2022 18:36:14 +0200
4 Upstream-status: Submitted
5 Subject: [PATCH] clients/window: Add set_app_id function + change Wayland
6  Terminal
7
8 Without this we can not switch to weston-terminal.
9
10 Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
11 ---
12  clients/terminal.c |  3 ++-
13  clients/window.c   | 12 ++++++++++++
14  clients/window.h   |  3 +++
15  3 files changed, 17 insertions(+), 1 deletion(-)
16
17 diff --git a/clients/terminal.c b/clients/terminal.c
18 index 66e2bf5..49c88ab 100644
19 --- a/clients/terminal.c
20 +++ b/clients/terminal.c
21 @@ -2947,8 +2947,9 @@ terminal_create(struct display *display)
22         terminal->margin_bottom = -1;
23         terminal->window = window_create(display);
24         terminal->widget = window_frame_create(terminal->window, terminal);
25 -       terminal->title = xstrdup("Wayland Terminal");
26 +       terminal->title = xstrdup("weston-terminal");
27         window_set_title(terminal->window, terminal->title);
28 +       window_set_app_id(terminal->window, terminal->title);
29         widget_set_transparent(terminal->widget, 0);
30  
31         init_state_machine(&terminal->state_machine);
32 diff --git a/clients/window.c b/clients/window.c
33 index 2bd303e..bfa1756 100644
34 --- a/clients/window.c
35 +++ b/clients/window.c
36 @@ -230,6 +230,7 @@ struct window {
37         struct display *display;
38         struct wl_list window_output_list;
39         char *title;
40 +       char *app_id;
41         struct rectangle saved_allocation;
42         struct rectangle min_allocation;
43         struct rectangle pending_allocation;
44 @@ -1609,6 +1610,7 @@ window_destroy(struct window *window)
45         wl_list_remove(&window->link);
46  
47         free(window->title);
48 +       free(window->app_id);
49         free(window);
50  }
51  
52 @@ -4812,6 +4814,16 @@ window_set_title(struct window *window, const char *title)
53                 xdg_toplevel_set_title(window->xdg_toplevel, title);
54  }
55  
56 +void
57 +window_set_app_id(struct window *window, const char *app_id)
58 +{
59 +       free(window->app_id);
60 +       window->app_id = strdup(app_id);
61 +
62 +       if (window->xdg_toplevel)
63 +               xdg_toplevel_set_app_id(window->xdg_toplevel, window->app_id);
64 +}
65 +
66  const char *
67  window_get_title(struct window *window)
68  {
69 diff --git a/clients/window.h b/clients/window.h
70 index c66dd06..7a1a076 100644
71 --- a/clients/window.h
72 +++ b/clients/window.h
73 @@ -500,6 +500,9 @@ window_set_locked_pointer_motion_handler(
74  void
75  window_set_title(struct window *window, const char *title);
76  
77 +void
78 +window_set_app_id(struct window *window, const char *app_id);
79 +
80  const char *
81  window_get_title(struct window *window);
82  
83 -- 
84 2.33.0
85