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
This commit is contained in:
Jonas Ådahl 2018-07-12 16:21:55 +02:00
parent 213ed80284
commit 25c53b2fb2

View File

@ -123,6 +123,8 @@ struct _MetaBackendPrivate
guint sleep_signal_id; guint sleep_signal_id;
GCancellable *cancellable; GCancellable *cancellable;
GDBusConnection *system_bus; GDBusConnection *system_bus;
gboolean was_headless;
}; };
typedef struct _MetaBackendPrivate MetaBackendPrivate; typedef struct _MetaBackendPrivate MetaBackendPrivate;
@ -223,6 +225,19 @@ meta_backend_monitors_changed (MetaBackend *backend)
} }
meta_cursor_renderer_force_update (priv->cursor_renderer); 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 void