From 8404acb36f9c6fba9e402893bf75e2ed729cd155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 18 Mar 2014 12:15:42 -0700 Subject: [PATCH] compsitor-x11: Report more accurate dimension of outputs We use the X screen DPI to compute the X11 compositor output size, which gives us a more accurate and useful value in the wl_output geometry event. --- src/compositor-x11.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/compositor-x11.c b/src/compositor-x11.c index ce1c0711..56b32287 100644 --- a/src/compositor-x11.c +++ b/src/compositor-x11.c @@ -761,7 +761,7 @@ x11_compositor_create_output(struct x11_compositor *c, int x, int y, xcb_screen_iterator_t iter; struct wm_normal_hints normal_hints; struct wl_event_loop *loop; - int output_width, output_height; + int output_width, output_height, width_mm, height_mm; int ret; uint32_t mask = XCB_CW_EVENT_MASK | XCB_CW_CURSOR; xcb_atom_t atom_list[1]; @@ -876,8 +876,12 @@ x11_compositor_create_output(struct x11_compositor *c, int x, int y, if (configured_name) output->base.name = strdup(configured_name); + width_mm = width * c->screen->width_in_millimeters / + c->screen->width_in_pixels; + height_mm = height * c->screen->height_in_millimeters / + c->screen->height_in_pixels; weston_output_init(&output->base, &c->base, - x, y, width, height, transform, scale); + x, y, width_mm, height_mm, transform, scale); if (c->use_pixman) { if (x11_output_init_shm(c, output,