From 950efe04e00f94bf4c8c85b1709f03dbad793333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20J=C3=B8rgen=20Br=C3=B8nner?= Date: Wed, 29 Jan 2020 23:00:34 +0100 Subject: [PATCH] utils:trace: don't require a metawindow --- utils.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/utils.js b/utils.js index a9ce90a..83d1f71 100644 --- a/utils.js +++ b/utils.js @@ -347,9 +347,22 @@ var tweener = { } }; +function isMetaWindow(obj) { + return obj && obj.window_type && obj.get_compositor_private; +} function trace(topic, ...args) { - windowTrace(topic, ...args); + if (!topic.match(/.*/)) { + return; + } + + if (isMetaWindow(args[0])) { + windowTrace(topic, ...args); + } else { + let trace = shortTrace(1).join(" < "); + let extraInfo = args.length > 0 ? "\n\t" + args.map(x => x.toString()).join("\n\t") : "" + log(topic, trace, extraInfo); + } } let existingWindows = new Set(); @@ -359,10 +372,6 @@ function windowTrace(topic, metaWindow, ...rest) { return; } - if (!topic.match(/.*/)) { - return; - } - log(topic, infoMetaWindow(metaWindow).join("\n"), ...rest.join("\n")); }