From 25c53b2fb25d325a40cb12b2e38b2a895983f441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 12 Jul 2018 16:21:55 +0200 Subject: [PATCH] backend: Freeze frame clock when headless Don't schedule redraws when being headless; there is nothing to draw so don't attempt to draw. This also makes a flaky test become non-flaky, as it previously spuriously got warnings due to windows being "painted" when headless but lacking frame timings, as nothing was actually painted. https://gitlab.gnome.org/GNOME/mutter/merge_requests/170 --- src/backends/meta-backend.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c index 375e9d298..709d4194c 100644 --- a/src/backends/meta-backend.c +++ b/src/backends/meta-backend.c @@ -123,6 +123,8 @@ struct _MetaBackendPrivate guint sleep_signal_id; GCancellable *cancellable; GDBusConnection *system_bus; + + gboolean was_headless; }; typedef struct _MetaBackendPrivate MetaBackendPrivate; @@ -223,6 +225,19 @@ meta_backend_monitors_changed (MetaBackend *backend) } meta_cursor_renderer_force_update (priv->cursor_renderer); + + if (meta_monitor_manager_is_headless (priv->monitor_manager) && + !priv->was_headless) + { + clutter_stage_freeze_updates (CLUTTER_STAGE (priv->stage)); + priv->was_headless = TRUE; + } + else if (!meta_monitor_manager_is_headless (priv->monitor_manager) && + priv->was_headless) + { + clutter_stage_thaw_updates (CLUTTER_STAGE (priv->stage)); + priv->was_headless = FALSE; + } } void