Commit 3ee09c62 authored by Jasper St. Pierre's avatar Jasper St. Pierre

meta-monitor-xrandr: Assign a name to the mode

Based on a downstream Endless patch. They use this to show a proper mode
name to the users.
parent bb54f91d
......@@ -330,6 +330,21 @@ output_get_hotplug_mode_update (MetaMonitorManagerXrandr *manager_xrandr,
return output_get_boolean_property (manager_xrandr, output, "hotplug_mode_update");
}
static char *
get_xmode_name (XRRModeInfo *xmode)
{
int width = xmode->width;
int height = xmode->height;
if (xmode->hSkew != 0)
{
width += 2 * (xmode->hSkew >> 8);
height += 2 * (xmode->hSkew & 0xff);
}
return g_strdup_printf ("%dx%d", width, height);
}
static void
meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
{
......@@ -415,6 +430,7 @@ meta_monitor_manager_xrandr_read_current (MetaMonitorManager *manager)
mode->height = xmode->height;
mode->refresh_rate = (xmode->dotClock /
((float)xmode->hTotal * xmode->vTotal));
mode->name = get_xmode_name (xmode);
}
for (i = 0; i < (unsigned)resources->ncrtc; i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment