[PATCH weston] weston-info: display output scale
Jonny Lamb
jonny.lamb at collabora.co.uk
Wed Dec 16 11:19:55 PST 2015
Fall back to not showing anything as before if we don't have a
compositor with wl_output new enough (version 2 or newer).
Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
---
clients/weston-info.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/clients/weston-info.c b/clients/weston-info.c
index f22781c..0b70701 100644
--- a/clients/weston-info.c
+++ b/clients/weston-info.c
@@ -65,6 +65,7 @@ struct output_info {
struct {
int32_t x, y;
+ int32_t scale;
int32_t physical_width, physical_height;
enum wl_output_subpixel subpixel;
enum wl_output_transform output_transform;
@@ -233,8 +234,12 @@ print_output_info(void *data)
break;
}
- printf("\tx: %d, y: %d,\n",
+ printf("\tx: %d, y: %d,",
output->geometry.x, output->geometry.y);
+ if (output->geometry.scale)
+ printf(" scale: %d,", output->geometry.scale);
+ printf("\n");
+
printf("\tphysical_width: %d mm, physical_height: %d mm,\n",
output->geometry.physical_width,
output->geometry.physical_height);
@@ -519,9 +524,25 @@ output_handle_mode(void *data, struct wl_output *wl_output,
wl_list_insert(output->modes.prev, &mode->link);
}
+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 scale)
+{
+ struct output_info *output = data;
+
+ output->geometry.scale = scale;
+}
+
static const struct wl_output_listener output_listener = {
output_handle_geometry,
output_handle_mode,
+ output_handle_done,
+ output_handle_scale,
};
static void
@@ -555,7 +576,7 @@ add_output_info(struct weston_info *info, uint32_t id, uint32_t version)
wl_list_init(&output->modes);
output->output = wl_registry_bind(info->registry, id,
- &wl_output_interface, 1);
+ &wl_output_interface, MIN(version, 2));
wl_output_add_listener(output->output, &output_listener,
output);
--
2.6.4
More information about the wayland-devel
mailing list