diff --git a/src/backends/meta-crtc.h b/src/backends/meta-crtc.h index af75eb9b2..0d12c5161 100644 --- a/src/backends/meta-crtc.h +++ b/src/backends/meta-crtc.h @@ -65,7 +65,6 @@ struct _MetaCrtc glong crtc_id; unsigned int all_transforms; - MetaLogicalMonitor *logical_monitor; MetaCrtcConfig *config; /* Used when changing configuration */ diff --git a/src/backends/meta-logical-monitor.c b/src/backends/meta-logical-monitor.c index 8e0f24827..15a918103 100644 --- a/src/backends/meta-logical-monitor.c +++ b/src/backends/meta-logical-monitor.c @@ -177,16 +177,14 @@ meta_logical_monitor_add_monitor (MetaLogicalMonitor *logical_monitor, for (l_output = outputs; l_output; l_output = l_output->next) { MetaOutput *output = l_output->data; - MetaCrtc *crtc; is_presentation = is_presentation && output->is_presentation; - crtc = meta_output_get_assigned_crtc (output); - if (crtc) - crtc->logical_monitor = logical_monitor; } } logical_monitor->is_presentation = is_presentation; + + meta_monitor_set_logical_monitor (monitor, logical_monitor); } gboolean diff --git a/src/backends/meta-monitor-manager-dummy.c b/src/backends/meta-monitor-manager-dummy.c index 2d02327d7..470c327e5 100644 --- a/src/backends/meta-monitor-manager-dummy.c +++ b/src/backends/meta-monitor-manager-dummy.c @@ -548,8 +548,6 @@ apply_crtc_assignments (MetaMonitorManager *manager, { MetaCrtc *crtc = l->data; - crtc->logical_monitor = NULL; - if (crtc->is_dirty) { crtc->is_dirty = FALSE; diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c index 9b60441eb..908675c44 100644 --- a/src/backends/meta-monitor.c +++ b/src/backends/meta-monitor.c @@ -66,6 +66,8 @@ typedef struct _MetaMonitorPrivate MetaMonitorSpec *spec; + MetaLogicalMonitor *logical_monitor; + /* * The primary or first output for this monitor, 0 if we can't figure out. * It can be matched to a winsys_id of a MetaOutput. @@ -1448,16 +1450,9 @@ meta_monitor_get_spec (MetaMonitor *monitor) MetaLogicalMonitor * meta_monitor_get_logical_monitor (MetaMonitor *monitor) { - MetaOutput *output; - MetaCrtc *crtc; + MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor); - output = meta_monitor_get_main_output (monitor); - crtc = meta_output_get_assigned_crtc (output); - - if (crtc) - return crtc->logical_monitor; - else - return NULL; + return priv->logical_monitor; } MetaMonitorMode * @@ -1895,3 +1890,12 @@ meta_monitor_get_display_name (MetaMonitor *monitor) return monitor_priv->display_name; } + +void +meta_monitor_set_logical_monitor (MetaMonitor *monitor, + MetaLogicalMonitor *logical_monitor) +{ + MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor); + + priv->logical_monitor = logical_monitor; +} diff --git a/src/backends/meta-monitor.h b/src/backends/meta-monitor.h index 58d2950c9..eb6b99fea 100644 --- a/src/backends/meta-monitor.h +++ b/src/backends/meta-monitor.h @@ -283,4 +283,7 @@ void meta_monitor_spec_free (MetaMonitorSpec *monitor_id); const char * meta_monitor_get_display_name (MetaMonitor *monitor); +void meta_monitor_set_logical_monitor (MetaMonitor *monitor, + MetaLogicalMonitor *logical_monitor); + #endif /* META_MONITOR_H */ diff --git a/src/backends/native/meta-monitor-manager-kms.c b/src/backends/native/meta-monitor-manager-kms.c index d381a75f4..b7da048e2 100644 --- a/src/backends/native/meta-monitor-manager-kms.c +++ b/src/backends/native/meta-monitor-manager-kms.c @@ -221,8 +221,6 @@ apply_crtc_assignments (MetaMonitorManager *manager, { MetaCrtc *crtc = k->data; - crtc->logical_monitor = NULL; - if (crtc->is_dirty) { crtc->is_dirty = FALSE; diff --git a/src/tests/meta-monitor-manager-test.c b/src/tests/meta-monitor-manager-test.c index 89c373c93..49ef6494d 100644 --- a/src/tests/meta-monitor-manager-test.c +++ b/src/tests/meta-monitor-manager-test.c @@ -177,8 +177,6 @@ apply_crtc_assignments (MetaMonitorManager *manager, { MetaCrtc *crtc = l->data; - crtc->logical_monitor = NULL; - if (crtc->is_dirty) { crtc->is_dirty = FALSE; diff --git a/src/tests/monitor-unit-tests.c b/src/tests/monitor-unit-tests.c index 5540f4b5f..2340438d0 100644 --- a/src/tests/monitor-unit-tests.c +++ b/src/tests/monitor-unit-tests.c @@ -520,7 +520,7 @@ check_current_monitor_mode (MetaMonitor *monitor, g_assert (monitor_crtc_mode->crtc_mode == crtc_config->mode); - logical_monitor = crtc->logical_monitor; + logical_monitor = meta_monitor_get_logical_monitor (monitor); g_assert_nonnull (logical_monitor); } @@ -618,7 +618,8 @@ check_logical_monitor (MonitorTestCase *test_case, } crtc = meta_output_get_assigned_crtc (output); - g_assert (!crtc || crtc->logical_monitor == logical_monitor); + g_assert (!crtc || + meta_monitor_get_logical_monitor (monitor) == logical_monitor); g_assert_cmpint (logical_monitor->is_presentation, ==, output->is_presentation); @@ -831,7 +832,6 @@ check_monitor_configuration (MonitorTestCase *test_case) } else { - MetaLogicalMonitor *logical_monitor = crtc->logical_monitor; MetaCrtcMode *expected_current_mode; g_assert_nonnull (crtc_config); @@ -845,9 +845,6 @@ check_monitor_configuration (MonitorTestCase *test_case) ==, test_case->expect.crtcs[i].transform); - logical_monitor = crtc->logical_monitor; - g_assert_nonnull (logical_monitor); - g_assert_cmpfloat_with_epsilon (crtc_config->layout.origin.x, test_case->expect.crtcs[i].x, FLT_EPSILON);