Add debug controller

The debug controller can optionally, when passing --debug-control,
enable manipulating debug state, so far enabling/disabling HDR, via
D-Bus.

It's always created, in order to have a place to store debug state and
emit signals etc when it changes, but so far, it doesn't have its own
state it tracks, it just mirrors that of the monitor manager.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3432>
This commit is contained in:
Jonas Ådahl
2023-10-31 22:30:17 +08:00
committed by Marge Bot
parent d5253b1385
commit adc5489ba7
8 changed files with 383 additions and 1 deletions

View File

@ -103,6 +103,8 @@ typedef struct _MetaContextPrivate
#ifdef HAVE_WAYLAND
MetaServiceChannel *service_channel;
#endif
MetaDebugControl *debug_control;
} MetaContextPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (MetaContext, meta_context, G_TYPE_OBJECT)
@ -329,7 +331,13 @@ meta_context_real_configure (MetaContext *context,
}
option_context = g_steal_pointer (&priv->option_context);
return g_option_context_parse (option_context, argc, argv, error);
if (!g_option_context_parse (option_context, argc, argv, error))
return FALSE;
priv->debug_control = g_object_new (META_TYPE_DEBUG_CONTROL,
"context", context,
NULL);
return TRUE;
}
/**
@ -747,6 +755,8 @@ meta_context_dispose (GObject *object)
g_clear_pointer (&priv->backend, meta_backend_destroy);
g_clear_object (&priv->debug_control);
g_clear_pointer (&priv->option_context, g_option_context_free);
g_clear_pointer (&priv->main_loop, g_main_loop_unref);
@ -839,3 +849,11 @@ meta_context_init (MetaContext *context)
g_warning ("Failed to save the nofile limit: %s", error->message);
}
}
MetaDebugControl *
meta_context_get_debug_control (MetaContext *context)
{
MetaContextPrivate *priv = meta_context_get_instance_private (context);
return priv->debug_control;
}