mirror of
https://github.com/brl/mutter.git
synced 2024-11-28 11:00:54 -05:00
Monitor: restore correct display name handling
Now that we have the right values from the EDID, we can load the PNP database and find the proper vendor name, to show in the control center UI. https://bugzilla.gnome.org/show_bug.cgi?id=705670
This commit is contained in:
parent
69467842ab
commit
3bb5086173
@ -76,6 +76,7 @@ MUTTER_PC_MODULES="
|
|||||||
$CLUTTER_PACKAGE >= 1.14.3
|
$CLUTTER_PACKAGE >= 1.14.3
|
||||||
cogl-1.0 >= 1.13.3
|
cogl-1.0 >= 1.13.3
|
||||||
upower-glib > 0.9.11
|
upower-glib > 0.9.11
|
||||||
|
gnome-desktop-3.0
|
||||||
"
|
"
|
||||||
|
|
||||||
GLIB_GSETTINGS
|
GLIB_GSETTINGS
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#define META_MONITOR_PRIVATE_H
|
#define META_MONITOR_PRIVATE_H
|
||||||
|
|
||||||
#include <cogl/cogl.h>
|
#include <cogl/cogl.h>
|
||||||
|
#include <libgnome-desktop/gnome-pnp-ids.h>
|
||||||
|
|
||||||
#include "display-private.h"
|
#include "display-private.h"
|
||||||
#include <meta/screen.h>
|
#include <meta/screen.h>
|
||||||
@ -250,6 +251,8 @@ struct _MetaMonitorManager
|
|||||||
|
|
||||||
int persistent_timeout_id;
|
int persistent_timeout_id;
|
||||||
MetaMonitorConfig *config;
|
MetaMonitorConfig *config;
|
||||||
|
|
||||||
|
GnomePnpIds *pnp_ids;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MetaMonitorManagerClass
|
struct _MetaMonitorManagerClass
|
||||||
|
@ -703,16 +703,41 @@ diagonal_to_str (double d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
make_display_name (MetaOutput *output)
|
make_display_name (MetaMonitorManager *manager,
|
||||||
|
MetaOutput *output)
|
||||||
{
|
{
|
||||||
|
if (g_str_has_prefix (output->name, "LVDS") ||
|
||||||
|
g_str_has_prefix (output->name, "eDP"))
|
||||||
|
return g_strdup (_("Built-in display"));
|
||||||
|
|
||||||
if (output->width_mm != -1 && output->height_mm != -1)
|
if (output->width_mm != -1 && output->height_mm != -1)
|
||||||
{
|
{
|
||||||
double d = sqrt (output->width_mm * output->width_mm +
|
double d = sqrt (output->width_mm * output->width_mm +
|
||||||
output->height_mm * output->height_mm);
|
output->height_mm * output->height_mm);
|
||||||
char *inches = diagonal_to_str (d / 25.4);
|
char *inches = diagonal_to_str (d / 25.4);
|
||||||
|
char *vendor_name;
|
||||||
char *ret;
|
char *ret;
|
||||||
|
|
||||||
ret = g_strdup_printf ("%s %s", output->vendor, inches);
|
if (g_strcmp0 (output->vendor, "unknown") != 0)
|
||||||
|
{
|
||||||
|
if (!manager->pnp_ids)
|
||||||
|
manager->pnp_ids = gnome_pnp_ids_new ();
|
||||||
|
|
||||||
|
vendor_name = gnome_pnp_ids_get_pnp_id (manager->pnp_ids,
|
||||||
|
output->vendor);
|
||||||
|
|
||||||
|
ret = g_strdup_printf ("%s %s", vendor_name, inches);
|
||||||
|
|
||||||
|
g_free (vendor_name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* TRANSLATORS: this is a monitor name (in case we don't know
|
||||||
|
the vendor), it's Unknown followed by a size in inches,
|
||||||
|
like 'Unknown 15"'
|
||||||
|
*/
|
||||||
|
ret = g_strdup_printf (_("Unknown %s"), inches);
|
||||||
|
}
|
||||||
|
|
||||||
g_free (inches);
|
g_free (inches);
|
||||||
return ret;
|
return ret;
|
||||||
@ -789,7 +814,7 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
|
|||||||
g_variant_builder_add (&properties, "{sv}", "serial",
|
g_variant_builder_add (&properties, "{sv}", "serial",
|
||||||
g_variant_new_string (output->serial));
|
g_variant_new_string (output->serial));
|
||||||
g_variant_builder_add (&properties, "{sv}", "display-name",
|
g_variant_builder_add (&properties, "{sv}", "display-name",
|
||||||
g_variant_new_take_string (make_display_name (output)));
|
g_variant_new_take_string (make_display_name (manager, output)));
|
||||||
g_variant_builder_add (&properties, "{sv}", "backlight",
|
g_variant_builder_add (&properties, "{sv}", "backlight",
|
||||||
g_variant_new_int32 (output->backlight));
|
g_variant_new_int32 (output->backlight));
|
||||||
g_variant_builder_add (&properties, "{sv}", "primary",
|
g_variant_builder_add (&properties, "{sv}", "primary",
|
||||||
|
Loading…
Reference in New Issue
Block a user