mir: correctly get screen mm sizes

This commit is contained in:
Marco Trevisan (Treviño) 2014-11-13 01:47:56 +01:00
parent c6de20496c
commit 98a8c66970

View File

@ -94,6 +94,29 @@ get_screen_size (MirDisplayConfiguration *config, gint *width, gint *height)
}
}
static void
get_screen_size_mm (MirDisplayConfiguration *config, gint *width, gint *height)
{
uint32_t i;
*width = 0;
*height = 0;
if (!config)
return;
for (i = 0; i < config->num_outputs; i++)
{
MirDisplayOutput *o = &config->outputs[i];
if (!o->used)
continue;
*width += o->physical_width_mm;
*height += o->physical_height_mm;
}
}
static void
update_display_config (GdkMirScreen *screen)
{
@ -194,16 +217,18 @@ static gint
gdk_mir_screen_get_width_mm (GdkScreen *screen)
{
g_printerr ("gdk_mir_screen_get_width_mm\n");
// FIXME: A combination of all screens?
return get_output (screen, 0)->physical_width_mm;
gint width, height;
get_screen_size_mm (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
return width;
}
static gint
gdk_mir_screen_get_height_mm (GdkScreen *screen)
{
g_printerr ("gdk_mir_screen_get_height_mm\n");
// FIXME: A combination of all screens?
return get_output (screen, 0)->physical_height_mm;
gint width, height;
get_screen_size_mm (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
return height;
}
static gint