[mutter/gnome-3-24] monitor: Don't get the monitor manager from the backend
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gnome-3-24] monitor: Don't get the monitor manager from the backend
- Date: Fri, 12 May 2017 03:57:50 +0000 (UTC)
commit dfdc15c72ca84ee129515d228bafef7dab6a656a
Author: Jonas Ådahl <jadahl gmail com>
Date: Thu May 11 17:24:53 2017 +0800
monitor: Don't get the monitor manager from the backend
We will both create and destroy monitors during initialization (when
using the X11 backend), so don't try to access the monitor manager from
the backend, but store a pointer to it instead.
It's stored in MetaMonitor even though only MetaMonitorTiled uses it,
mostly because it makes more sense to store such a pointer there.
https://bugzilla.gnome.org/show_bug.cgi?id=781723
src/backends/meta-monitor-manager.c | 2 +-
src/backends/meta-monitor.c | 20 +++++++++++++-------
src/backends/meta-monitor.h | 3 ++-
3 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index dc1d960..0d1bb05 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -1667,7 +1667,7 @@ rebuild_monitors (MetaMonitorManager *manager)
{
MetaMonitorNormal *monitor_normal;
- monitor_normal = meta_monitor_normal_new (output);
+ monitor_normal = meta_monitor_normal_new (manager, output);
manager->monitors = g_list_append (manager->monitors,
monitor_normal);
}
diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c
index 7d67989..30c2197 100644
--- a/src/backends/meta-monitor.c
+++ b/src/backends/meta-monitor.c
@@ -34,6 +34,8 @@ typedef struct _MetaMonitorMode
typedef struct _MetaMonitorPrivate
{
+ MetaMonitorManager *monitor_manager;
+
GList *outputs;
GList *modes;
@@ -348,7 +350,8 @@ meta_monitor_normal_generate_modes (MetaMonitorNormal *monitor_normal)
}
MetaMonitorNormal *
-meta_monitor_normal_new (MetaOutput *output)
+meta_monitor_normal_new (MetaMonitorManager *monitor_manager,
+ MetaOutput *output)
{
MetaMonitorNormal *monitor_normal;
MetaMonitor *monitor;
@@ -358,6 +361,8 @@ meta_monitor_normal_new (MetaOutput *output)
monitor = META_MONITOR (monitor_normal);
monitor_priv = meta_monitor_get_instance_private (monitor);
+ monitor_priv->monitor_manager = monitor_manager;
+
monitor_priv->outputs = g_list_append (NULL, output);
monitor_priv->winsys_id = output->winsys_id;
meta_monitor_generate_spec (monitor);
@@ -924,6 +929,8 @@ meta_monitor_tiled_new (MetaMonitorManager *monitor_manager,
monitor = META_MONITOR (monitor_tiled);
monitor_priv = meta_monitor_get_instance_private (monitor);
+ monitor_priv->monitor_manager = monitor_manager;
+
monitor_tiled->tile_group_id = output->tile_info.group_id;
monitor_priv->winsys_id = output->winsys_id;
@@ -992,13 +999,12 @@ meta_monitor_tiled_get_suggested_position (MetaMonitor *monitor,
static void
meta_monitor_tiled_finalize (GObject *object)
{
- MetaMonitorTiled *monitor_tiled = META_MONITOR_TILED (object);
- MetaBackend *backend = meta_get_backend ();
- MetaMonitorManager *monitor_manager =
- meta_backend_get_monitor_manager (backend);
+ MetaMonitor *monitor = META_MONITOR (object);
+ MetaMonitorPrivate *monitor_priv =
+ meta_monitor_get_instance_private (monitor);
- meta_monitor_manager_tiled_monitor_removed (monitor_manager,
- META_MONITOR (monitor_tiled));
+ meta_monitor_manager_tiled_monitor_removed (monitor_priv->monitor_manager,
+ monitor);
}
static void
diff --git a/src/backends/meta-monitor.h b/src/backends/meta-monitor.h
index ec2b4cd..aa03889 100644
--- a/src/backends/meta-monitor.h
+++ b/src/backends/meta-monitor.h
@@ -86,7 +86,8 @@ G_DECLARE_FINAL_TYPE (MetaMonitorTiled, meta_monitor_tiled,
MetaMonitorTiled * meta_monitor_tiled_new (MetaMonitorManager *monitor_manager,
MetaOutput *main_output);
-MetaMonitorNormal * meta_monitor_normal_new (MetaOutput *output);
+MetaMonitorNormal * meta_monitor_normal_new (MetaMonitorManager *monitor_manager,
+ MetaOutput *output);
MetaMonitorSpec * meta_monitor_get_spec (MetaMonitor *monitor);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]