mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
monitor-manager: Expose output_is_laptop() method
We currently duplicate the heuristics of whether an output is considered a laptop or not. Avoid this by sharing a small helper method. https://bugzilla.gnome.org/show_bug.cgi?id=765267
This commit is contained in:
parent
ff312b6958
commit
ab6c008e3e
@ -916,20 +916,6 @@ key_is_laptop (MetaOutputKey *key)
|
||||
g_str_has_prefix (key->connector, "eDP");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
output_is_laptop (MetaOutput *output)
|
||||
{
|
||||
/* FIXME: extend with better heuristics */
|
||||
switch (output->connector_type)
|
||||
{
|
||||
case META_CONNECTOR_TYPE_eDP:
|
||||
case META_CONNECTOR_TYPE_LVDS:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
laptop_display_is_on (MetaConfiguration *config)
|
||||
{
|
||||
@ -1092,7 +1078,7 @@ find_primary_output (MetaOutput *outputs,
|
||||
|
||||
for (i = 0; i < n_outputs; i++)
|
||||
{
|
||||
if (output_is_laptop (&outputs[i]))
|
||||
if (meta_output_is_laptop (&outputs[i]))
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -398,6 +398,7 @@ void meta_monitor_manager_confirm_configuration (MetaMonitorManag
|
||||
|
||||
void meta_output_parse_edid (MetaOutput *output,
|
||||
GBytes *edid);
|
||||
gboolean meta_output_is_laptop (MetaOutput *output);
|
||||
|
||||
void meta_crtc_info_free (MetaCRTCInfo *info);
|
||||
void meta_output_info_free (MetaOutputInfo *info);
|
||||
|
@ -511,14 +511,8 @@ make_display_name (MetaMonitorManager *manager,
|
||||
g_autofree char *inches = NULL;
|
||||
g_autofree char *vendor_name = NULL;
|
||||
|
||||
switch (output->connector_type)
|
||||
{
|
||||
case META_CONNECTOR_TYPE_LVDS:
|
||||
case META_CONNECTOR_TYPE_eDP:
|
||||
if (meta_output_is_laptop (output))
|
||||
return g_strdup (_("Built-in display"));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (output->width_mm > 0 && output->height_mm > 0)
|
||||
{
|
||||
@ -1464,6 +1458,20 @@ meta_output_parse_edid (MetaOutput *meta_output,
|
||||
meta_output->serial = g_strdup ("unknown");
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_output_is_laptop (MetaOutput *output)
|
||||
{
|
||||
/* FIXME: extend with better heuristics */
|
||||
switch (output->connector_type)
|
||||
{
|
||||
case META_CONNECTOR_TYPE_eDP:
|
||||
case META_CONNECTOR_TYPE_LVDS:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
meta_monitor_manager_on_hotplug (MetaMonitorManager *manager)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user