[PATCH 09/15] window: Add window_get_output_scale()
alexl at redhat.com
alexl at redhat.com
Wed May 22 05:41:33 PDT 2013
From: Alexander Larsson <alexl at redhat.com>
This lets you find the maximal scale for all the outputs a window
is on, which is useful for picking a buffer_scale.
---
clients/window.c | 18 ++++++++++++++++++
clients/window.h | 3 +++
2 files changed, 21 insertions(+)
diff --git a/clients/window.c b/clients/window.c
index 6dd6533..09573f6 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -1454,6 +1454,22 @@ window_get_buffer_scale(struct window *window)
return window->main_surface->buffer_scale;
}
+uint32_t
+window_get_output_scale(struct window *window)
+{
+ struct window_output *window_output;
+ struct window_output *window_output_tmp;
+ int scale = 1;
+
+ wl_list_for_each_safe(window_output, window_output_tmp,
+ &window->window_output_list, link) {
+ if (window_output->output->scale > scale)
+ scale = window_output->output->scale;
+ }
+
+ return scale;
+}
+
static void frame_destroy(struct frame *frame);
static void
@@ -4370,6 +4386,8 @@ window_show_menu(struct display *display,
menu->window = window;
menu->widget = window_add_widget(menu->window, menu);
+ window_set_buffer_scale (menu->window, window_get_buffer_scale (parent));
+ window_set_buffer_transform (menu->window, window_get_buffer_transform (parent));
menu->entries = entries;
menu->count = count;
menu->release_count = 0;
diff --git a/clients/window.h b/clients/window.h
index fec601f..f7b3f28 100644
--- a/clients/window.h
+++ b/clients/window.h
@@ -260,6 +260,9 @@ void
window_set_buffer_scale(struct window *window,
uint32_t scale);
+uint32_t
+window_get_output_scale(struct window *window);
+
void
window_destroy(struct window *window);
--
1.8.1.4
More information about the wayland-devel
mailing list