If the compositor supports version 3 of the wl_output interface and
sends a name event then this will now be displayed in the info.
---
 clients/weston-info.c | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/clients/weston-info.c b/clients/weston-info.c
index df869e3..05edd21 100644
--- a/clients/weston-info.c
+++ b/clients/weston-info.c
@@ -59,6 +59,8 @@ struct output_info {
 
        struct wl_output *output;
 
+       char *name;
+
        struct {
                int32_t x, y;
                int32_t physical_width, physical_height;
@@ -160,6 +162,9 @@ print_output_info(void *data)
 
        print_global_info(data);
 
+       if (output->name)
+               printf("\tname: %s\n", output->name);
+
        switch (output->geometry.subpixel) {
        case WL_OUTPUT_SUBPIXEL_UNKNOWN:
                subpixel_orientation = "unknown";
@@ -423,9 +428,35 @@ output_handle_mode(void *data, struct wl_output *wl_output,
        wl_list_insert(output->modes.prev, &mode->link);
 }
 
+static void
+output_handle_name(void *data,
+                struct wl_output *wl_output,
+                const char *name)
+{
+       struct output_info *output = data;
+
+       output->name = xstrdup(name);
+}
+
+static void
+output_handle_done(void *data,
+                  struct wl_output *wl_output)
+{
+}
+
+static void
+output_handle_scale(void *data,
+                   struct wl_output *wl_output,
+                   int32_t factor)
+{
+}
+
 static const struct wl_output_listener output_listener = {
        output_handle_geometry,
        output_handle_mode,
+       output_handle_done,
+       output_handle_scale,
+       output_handle_name,
 };
 
 static void
@@ -440,6 +471,8 @@ destroy_output_info(void *data)
                free(output->geometry.make);
        if (output->geometry.model != NULL)
                free(output->geometry.model);
+       if (output->name != NULL)
+               free(output->name);
 
        wl_list_for_each_safe(mode, tmp, &output->modes, link) {
                wl_list_remove(&mode->link);
@@ -458,8 +491,12 @@ add_output_info(struct weston_info *info, uint32_t id, 
uint32_t version)
 
        wl_list_init(&output->modes);
 
+       if (version > 3)
+               version = 3;
+
        output->output = wl_registry_bind(info->registry, id,
-                                         &wl_output_interface, 1);
+                                         &wl_output_interface,
+                                         version);
        wl_output_add_listener(output->output, &output_listener,
                               output);
 
-- 
1.9.0

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to