mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 11:32:04 +00:00
output: Tie the output to the monitor it's part of
Outputs correspond to active connectors, that we translate into monitors. Make this association more real by adding a pointer back to the monitor from the output. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
This commit is contained in:
parent
5edc118d62
commit
7215b0d88c
@ -675,6 +675,8 @@ meta_monitor_normal_new (MetaGpu *gpu,
|
||||
monitor_priv->gpu = gpu;
|
||||
|
||||
monitor_priv->outputs = g_list_append (NULL, g_object_ref (output));
|
||||
meta_output_set_monitor (output, monitor);
|
||||
|
||||
monitor_priv->winsys_id = meta_output_get_id (output);
|
||||
meta_monitor_generate_spec (monitor);
|
||||
|
||||
@ -802,6 +804,8 @@ add_tiled_monitor_outputs (MetaGpu *gpu,
|
||||
|
||||
monitor_priv->outputs = g_list_append (monitor_priv->outputs,
|
||||
g_object_ref (output));
|
||||
|
||||
meta_output_set_monitor (output, META_MONITOR (monitor_tiled));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,8 @@ typedef struct _MetaOutputPrivate
|
||||
|
||||
MetaOutputInfo *info;
|
||||
|
||||
MetaMonitor *monitor;
|
||||
|
||||
/* The CRTC driving this output, NULL if the output is not enabled */
|
||||
MetaCrtc *crtc;
|
||||
|
||||
@ -112,6 +114,27 @@ meta_output_get_gpu (MetaOutput *output)
|
||||
return priv->gpu;
|
||||
}
|
||||
|
||||
MetaMonitor *
|
||||
meta_output_get_monitor (MetaOutput *output)
|
||||
{
|
||||
MetaOutputPrivate *priv = meta_output_get_instance_private (output);
|
||||
|
||||
g_warn_if_fail (priv->monitor);
|
||||
|
||||
return priv->monitor;
|
||||
}
|
||||
|
||||
void
|
||||
meta_output_set_monitor (MetaOutput *output,
|
||||
MetaMonitor *monitor)
|
||||
{
|
||||
MetaOutputPrivate *priv = meta_output_get_instance_private (output);
|
||||
|
||||
g_warn_if_fail (!priv->monitor);
|
||||
|
||||
priv->monitor = monitor;
|
||||
}
|
||||
|
||||
const char *
|
||||
meta_output_get_name (MetaOutput *output)
|
||||
{
|
||||
|
@ -139,6 +139,12 @@ uint64_t meta_output_get_id (MetaOutput *output);
|
||||
META_EXPORT_TEST
|
||||
MetaGpu * meta_output_get_gpu (MetaOutput *output);
|
||||
|
||||
META_EXPORT_TEST
|
||||
MetaMonitor * meta_output_get_monitor (MetaOutput *output);
|
||||
|
||||
void meta_output_set_monitor (MetaOutput *output,
|
||||
MetaMonitor *monitor);
|
||||
|
||||
const char * meta_output_get_name (MetaOutput *output);
|
||||
|
||||
META_EXPORT_TEST
|
||||
|
@ -289,6 +289,8 @@ check_logical_monitor (MetaMonitorManager *monitor_manager,
|
||||
MetaOutput *output = l_output->data;
|
||||
MetaCrtc *crtc;
|
||||
|
||||
g_assert (meta_output_get_monitor (output) == monitor);
|
||||
|
||||
if (meta_output_is_primary (output))
|
||||
{
|
||||
g_assert_null (primary_output);
|
||||
|
Loading…
Reference in New Issue
Block a user