mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 04:22:05 +00:00
backends: Add logical monitor -> monitor -> output -> crtc ref chain
Make it so that each logical monitor has a reference to all the monitors that are assigned to it. All monitors has a reference to each output that belongs to it. Each output has a reference to any CRTC it has been assigned. https://bugzilla.gnome.org/show_bug.cgi?id=786929
This commit is contained in:
parent
1200182d70
commit
768ec15ea0
@ -146,7 +146,7 @@ meta_logical_monitor_add_monitor (MetaLogicalMonitor *logical_monitor,
|
|||||||
|
|
||||||
is_presentation = logical_monitor->is_presentation;
|
is_presentation = logical_monitor->is_presentation;
|
||||||
logical_monitor->monitors = g_list_append (logical_monitor->monitors,
|
logical_monitor->monitors = g_list_append (logical_monitor->monitors,
|
||||||
monitor);
|
g_object_ref (monitor));
|
||||||
|
|
||||||
for (l = logical_monitor->monitors; l; l = l->next)
|
for (l = logical_monitor->monitors; l; l = l->next)
|
||||||
{
|
{
|
||||||
@ -257,13 +257,17 @@ meta_logical_monitor_init (MetaLogicalMonitor *logical_monitor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_logical_monitor_finalize (GObject *object)
|
meta_logical_monitor_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
MetaLogicalMonitor *logical_monitor = META_LOGICAL_MONITOR (object);
|
MetaLogicalMonitor *logical_monitor = META_LOGICAL_MONITOR (object);
|
||||||
|
|
||||||
g_list_free (logical_monitor->monitors);
|
if (logical_monitor->monitors)
|
||||||
|
{
|
||||||
|
g_list_free_full (logical_monitor->monitors, g_object_unref);
|
||||||
|
logical_monitor->monitors = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
G_OBJECT_CLASS (meta_logical_monitor_parent_class)->finalize (object);
|
G_OBJECT_CLASS (meta_logical_monitor_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -271,7 +275,7 @@ meta_logical_monitor_class_init (MetaLogicalMonitorClass *klass)
|
|||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
object_class->finalize = meta_logical_monitor_finalize;
|
object_class->dispose = meta_logical_monitor_dispose;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
@ -387,6 +387,21 @@ meta_monitor_crtc_to_logical_transform (MetaMonitor *monitor,
|
|||||||
return new_transform;
|
return new_transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_monitor_dispose (GObject *object)
|
||||||
|
{
|
||||||
|
MetaMonitor *monitor = META_MONITOR (object);
|
||||||
|
MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor);
|
||||||
|
|
||||||
|
if (priv->outputs)
|
||||||
|
{
|
||||||
|
g_list_free_full (priv->outputs, g_object_unref);
|
||||||
|
priv->outputs = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (meta_monitor_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_monitor_finalize (GObject *object)
|
meta_monitor_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
@ -395,7 +410,6 @@ meta_monitor_finalize (GObject *object)
|
|||||||
|
|
||||||
g_hash_table_destroy (priv->mode_ids);
|
g_hash_table_destroy (priv->mode_ids);
|
||||||
g_list_free_full (priv->modes, (GDestroyNotify) meta_monitor_mode_free);
|
g_list_free_full (priv->modes, (GDestroyNotify) meta_monitor_mode_free);
|
||||||
g_clear_pointer (&priv->outputs, g_list_free);
|
|
||||||
meta_monitor_spec_free (priv->spec);
|
meta_monitor_spec_free (priv->spec);
|
||||||
|
|
||||||
G_OBJECT_CLASS (meta_monitor_parent_class)->finalize (object);
|
G_OBJECT_CLASS (meta_monitor_parent_class)->finalize (object);
|
||||||
@ -414,6 +428,7 @@ meta_monitor_class_init (MetaMonitorClass *klass)
|
|||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
|
object_class->dispose = meta_monitor_dispose;
|
||||||
object_class->finalize = meta_monitor_finalize;
|
object_class->finalize = meta_monitor_finalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,7 +565,7 @@ meta_monitor_normal_new (MetaGpu *gpu,
|
|||||||
|
|
||||||
monitor_priv->gpu = gpu;
|
monitor_priv->gpu = gpu;
|
||||||
|
|
||||||
monitor_priv->outputs = g_list_append (NULL, output);
|
monitor_priv->outputs = g_list_append (NULL, g_object_ref (output));
|
||||||
monitor_priv->winsys_id = output->winsys_id;
|
monitor_priv->winsys_id = output->winsys_id;
|
||||||
meta_monitor_generate_spec (monitor);
|
meta_monitor_generate_spec (monitor);
|
||||||
|
|
||||||
@ -665,7 +680,8 @@ add_tiled_monitor_outputs (MetaGpu *gpu,
|
|||||||
g_warn_if_fail (output->subpixel_order ==
|
g_warn_if_fail (output->subpixel_order ==
|
||||||
monitor_tiled->origin_output->subpixel_order);
|
monitor_tiled->origin_output->subpixel_order);
|
||||||
|
|
||||||
monitor_priv->outputs = g_list_append (monitor_priv->outputs, output);
|
monitor_priv->outputs = g_list_append (monitor_priv->outputs,
|
||||||
|
g_object_ref (output));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ meta_output_assign_crtc (MetaOutput *output,
|
|||||||
|
|
||||||
g_assert (crtc);
|
g_assert (crtc);
|
||||||
|
|
||||||
priv->crtc = crtc;
|
g_set_object (&priv->crtc, crtc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -51,7 +51,7 @@ meta_output_unassign_crtc (MetaOutput *output)
|
|||||||
{
|
{
|
||||||
MetaOutputPrivate *priv = meta_output_get_instance_private (output);
|
MetaOutputPrivate *priv = meta_output_get_instance_private (output);
|
||||||
|
|
||||||
priv->crtc = NULL;
|
g_clear_object (&priv->crtc);
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaCrtc *
|
MetaCrtc *
|
||||||
@ -62,6 +62,17 @@ meta_output_get_assigned_crtc (MetaOutput *output)
|
|||||||
return priv->crtc;
|
return priv->crtc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_output_dispose (GObject *object)
|
||||||
|
{
|
||||||
|
MetaOutput *output = META_OUTPUT (object);
|
||||||
|
MetaOutputPrivate *priv = meta_output_get_instance_private (output);
|
||||||
|
|
||||||
|
g_clear_object (&priv->crtc);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (meta_output_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_output_finalize (GObject *object)
|
meta_output_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
@ -91,5 +102,6 @@ meta_output_class_init (MetaOutputClass *klass)
|
|||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
|
object_class->dispose = meta_output_dispose;
|
||||||
object_class->finalize = meta_output_finalize;
|
object_class->finalize = meta_output_finalize;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user