46e305d1218512dc797abb8a1876b79eddb957bb
[AGL/meta-agl.git] / meta-agl-core / recipes-graphics / wayland / weston / 0001-libweston-Send-name-description-update-wl_output-to-.patch
1 From 5361d157ff6b11d5cb7a9f989abe5f376c9e2efa Mon Sep 17 00:00:00 2001
2 From: Marius Vlad <marius.vlad@collabora.com>
3 Date: Wed, 24 Aug 2022 11:43:06 +0300
4 Subject: [PATCH] libweston: Send name,description, update wl_output to ver 4
5
6 These have been in wayland a while back with version 1.20.0.
7
8 We also need to update the test client helper with this bump, as
9 those bind to version 4.
10
11 Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
12 ---
13  libweston/compositor.c            | 14 +++++++++++++-
14  tests/weston-test-client-helper.c | 18 ++++++++++++++++++
15  tests/weston-test-client-helper.h |  2 ++
16  3 files changed, 33 insertions(+), 1 deletion(-)
17
18 diff --git a/libweston/compositor.c b/libweston/compositor.c
19 index 1670c50..af7c71e 100644
20 --- a/libweston/compositor.c
21 +++ b/libweston/compositor.c
22 @@ -184,6 +184,12 @@ weston_mode_switch_send_events(struct weston_head *head,
23                 if (version >= WL_OUTPUT_SCALE_SINCE_VERSION && scale_changed)
24                         wl_output_send_scale(resource, output->current_scale);
25  
26 +               if (version >= WL_OUTPUT_NAME_SINCE_VERSION)
27 +                       wl_output_send_name(resource, head->name);
28 +
29 +               if (version >= WL_OUTPUT_DESCRIPTION_SINCE_VERSION)
30 +                       wl_output_send_description(resource, head->model);
31 +
32                 if (version >= WL_OUTPUT_DONE_SINCE_VERSION)
33                         wl_output_send_done(resource);
34         }
35 @@ -5198,6 +5204,12 @@ bind_output(struct wl_client *client,
36                                     mode->refresh);
37         }
38  
39 +       if (version >= WL_OUTPUT_NAME_SINCE_VERSION)
40 +               wl_output_send_name(resource, head->name);
41 +
42 +       if (version >= WL_OUTPUT_DESCRIPTION_SINCE_VERSION)
43 +               wl_output_send_description(resource, head->model);
44 +
45         if (version >= WL_OUTPUT_DONE_SINCE_VERSION)
46                 wl_output_send_done(resource);
47  }
48 @@ -5206,7 +5218,7 @@ static void
49  weston_head_add_global(struct weston_head *head)
50  {
51         head->global = wl_global_create(head->compositor->wl_display,
52 -                                       &wl_output_interface, 3,
53 +                                       &wl_output_interface, 4,
54                                         head, bind_output);
55  }
56  
57 diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c
58 index 01c4b80..8369c40 100644
59 --- a/tests/weston-test-client-helper.c
60 +++ b/tests/weston-test-client-helper.c
61 @@ -715,6 +715,20 @@ output_handle_scale(void *data,
62         output->scale = scale;
63  }
64  
65 +static void
66 +output_handle_name(void *data, struct wl_output *wl_output, const char *name)
67 +{
68 +       struct output *output = data;
69 +       output->name = strdup(name);
70 +}
71 +
72 +static void
73 +output_handle_description(void *data, struct wl_output *wl_output, const char *desc)
74 +{
75 +       struct output *output = data;
76 +       output->name = strdup(desc);
77 +}
78 +
79  static void
80  output_handle_done(void *data,
81                    struct wl_output *wl_output)
82 @@ -729,6 +743,8 @@ static const struct wl_output_listener output_listener = {
83         output_handle_mode,
84         output_handle_done,
85         output_handle_scale,
86 +       output_handle_name,
87 +       output_handle_description,
88  };
89  
90  static void
91 @@ -737,6 +753,8 @@ output_destroy(struct output *output)
92         assert(wl_proxy_get_version((struct wl_proxy *)output->wl_output) >= 3);
93         wl_output_release(output->wl_output);
94         wl_list_remove(&output->link);
95 +       free(output->name);
96 +       free(output->desc);
97         free(output);
98  }
99  
100 diff --git a/tests/weston-test-client-helper.h b/tests/weston-test-client-helper.h
101 index 8e1505d..9e05009 100644
102 --- a/tests/weston-test-client-helper.h
103 +++ b/tests/weston-test-client-helper.h
104 @@ -163,6 +163,8 @@ struct output {
105         int height;
106         int scale;
107         int initialized;
108 +       char *name;
109 +       char *desc;
110  };
111  
112  struct buffer {
113 -- 
114 2.35.1
115