summaryrefslogtreecommitdiff
path: root/clients
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2013-05-22 14:41:33 +0200
committerKristian Høgsberg <krh@bitplanet.net>2013-05-22 16:18:52 -0400
commitd68f523f308f0966a9ccf0adeba1bd6f78ace3cd (patch)
treec0924a0c3d46aaf717ca6a516c8fbafc6366e991 /clients
parentc584fa60d45b333ab7f2c1d34e75994d58d1f7f8 (diff)
window: Add window_get_output_scale()
This lets you find the maximal scale for all the outputs a window is on, which is useful for picking a buffer_scale.
Diffstat (limited to 'clients')
-rw-r--r--clients/window.c18
-rw-r--r--clients/window.h3
2 files changed, 21 insertions, 0 deletions
diff --git a/clients/window.c b/clients/window.c
index 6f1b4067..135ae5ab 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -1468,6 +1468,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
@@ -4384,6 +4400,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 fec601f7..f7b3f286 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);