utils:trace: don't require a metawindow

This commit is contained in:
Ole Jørgen Brønner
2020-01-29 23:00:34 +01:00
committed by Tor Hedin Brønner
parent d4e24b1ee9
commit 950efe04e0

View File

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