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")); }