summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ã…dahl <jadahl@gmail.com>2020-10-01 15:05:17 +0200
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2020-10-06 15:52:54 +0000
commitb1ffd14d623c70057abf99aeff4e6a4ccfd6b90b (patch)
tree3d6fbbfed131334c71a4583d578596e22941a8bf
parent24c374ffb233b0db52ab879a0da8fb356ef3d65e (diff)
downloadmutter-b1ffd14d623c70057abf99aeff4e6a4ccfd6b90b.tar.gz
main: Parse MUTTER_DEBUG as debug string
This makes it possible to run e.g. env MUTTER_DEBUG=input:geometry gnome-shell which will enable the 'META_DEBUG_INPUT' and 'META_DEBUG_GEOMETRY' topics. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1465
-rw-r--r--src/core/main.c37
-rw-r--r--src/core/util.c6
2 files changed, 38 insertions, 5 deletions
diff --git a/src/core/main.c b/src/core/main.c
index 06605c5e2..5a20cd6a7 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -98,6 +98,29 @@
#include "backends/native/meta-backend-native.h"
#endif
+static const GDebugKey meta_debug_keys[] = {
+ { "focus", META_DEBUG_FOCUS },
+ { "workarea", META_DEBUG_WORKAREA },
+ { "stack", META_DEBUG_STACK },
+ { "sm", META_DEBUG_SM },
+ { "events", META_DEBUG_EVENTS },
+ { "window-state", META_DEBUG_WINDOW_STATE },
+ { "window-ops", META_DEBUG_WINDOW_OPS },
+ { "geometry", META_DEBUG_GEOMETRY },
+ { "placement", META_DEBUG_PLACEMENT },
+ { "ping", META_DEBUG_PING },
+ { "keybindings", META_DEBUG_KEYBINDINGS },
+ { "sync", META_DEBUG_SYNC },
+ { "startup", META_DEBUG_STARTUP },
+ { "prefs", META_DEBUG_PREFS },
+ { "groups", META_DEBUG_GROUPS },
+ { "resizing", META_DEBUG_RESIZING },
+ { "shapes", META_DEBUG_SHAPES },
+ { "edge-resistance", META_DEBUG_EDGE_RESISTANCE },
+ { "dbus", META_DEBUG_DBUS },
+ { "input", META_DEBUG_INPUT },
+};
+
/*
* The exit code we'll return to our parent process when we eventually die.
*/
@@ -535,6 +558,7 @@ meta_init (void)
{
struct sigaction act;
sigset_t empty_mask;
+ const char *debug_env;
MetaCompositorType compositor_type;
GType backend_gtype;
@@ -559,8 +583,17 @@ meta_init (void)
if (g_getenv ("MUTTER_VERBOSE"))
meta_set_verbose (TRUE);
- if (g_getenv ("MUTTER_DEBUG"))
- meta_set_debugging (TRUE);
+
+ debug_env = g_getenv ("MUTTER_DEBUG");
+ if (debug_env)
+ {
+ MetaDebugTopic topics;
+
+ topics = g_parse_debug_string (debug_env,
+ meta_debug_keys,
+ G_N_ELEMENTS (meta_debug_keys));
+ meta_add_verbose_topic (topics);
+ }
if (_compositor_configuration_overridden)
{
diff --git a/src/core/util.c b/src/core/util.c
index 2b3dc286c..4d9d8acb3 100644
--- a/src/core/util.c
+++ b/src/core/util.c
@@ -116,9 +116,6 @@ meta_set_verbose (gboolean setting)
#ifndef WITH_VERBOSE_MODE
if (setting)
meta_fatal (_("Mutter was compiled without support for verbose mode\n"));
-#else
- if (setting)
- ensure_logfile ();
#endif
if (setting)
@@ -139,6 +136,9 @@ meta_add_verbose_topic (MetaDebugTopic topic)
{
if (verbose_topics == META_DEBUG_VERBOSE)
return;
+
+ ensure_logfile ();
+
if (topic == META_DEBUG_VERBOSE)
verbose_topics = META_DEBUG_VERBOSE;
else