[PATCH 03/15] window: Track output scales

alexl at redhat.com alexl at redhat.com
Wed May 22 05:41:27 PDT 2013


From: Alexander Larsson <alexl at redhat.com>

---
 clients/window.c | 30 ++++++++++++++++++++++++++++--
 clients/window.h |  3 +++
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index 48b784d..36fda25 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -322,6 +322,7 @@ struct output {
 	struct rectangle allocation;
 	struct wl_list link;
 	int transform;
+	int scale;
 
 	display_output_handler_t destroy_handler;
 	void *user_data;
@@ -4382,6 +4383,22 @@ display_handle_geometry(void *data,
 }
 
 static void
+display_handle_done(void *data,
+		     struct wl_output *wl_output)
+{
+}
+
+static void
+display_handle_scale(void *data,
+		     struct wl_output *wl_output,
+		     uint32_t scale)
+{
+	struct output *output = data;
+
+	output->scale = scale;
+}
+
+static void
 display_handle_mode(void *data,
 		    struct wl_output *wl_output,
 		    uint32_t flags,
@@ -4403,7 +4420,9 @@ display_handle_mode(void *data,
 
 static const struct wl_output_listener output_listener = {
 	display_handle_geometry,
-	display_handle_mode
+	display_handle_mode,
+	display_handle_done,
+	display_handle_scale
 };
 
 static void
@@ -4417,8 +4436,9 @@ display_add_output(struct display *d, uint32_t id)
 
 	memset(output, 0, sizeof *output);
 	output->display = d;
+	output->scale = 1;
 	output->output =
-		wl_registry_bind(d->registry, id, &wl_output_interface, 1);
+		wl_registry_bind(d->registry, id, &wl_output_interface, 2);
 	wl_list_insert(d->output_list.prev, &output->link);
 
 	wl_output_add_listener(output->output, &output_listener, output);
@@ -4522,6 +4542,12 @@ output_get_transform(struct output *output)
 	return output->transform;
 }
 
+uint32_t
+output_get_scale(struct output *output)
+{
+	return output->scale;
+}
+
 static void
 fini_xkb(struct input *input)
 {
diff --git a/clients/window.h b/clients/window.h
index 7db9c63..c0a7cb6 100644
--- a/clients/window.h
+++ b/clients/window.h
@@ -504,6 +504,9 @@ output_get_wl_output(struct output *output);
 enum wl_output_transform
 output_get_transform(struct output *output);
 
+uint32_t
+output_get_scale(struct output *output);
+
 void
 keysym_modifiers_add(struct wl_array *modifiers_map,
 		     const char *name);
-- 
1.8.1.4



More information about the wayland-devel mailing list