From 4c716528693e03574151fd61e7fb8d085e5b69ca Mon Sep 17 00:00:00 2001 From: Daniel Miranda Date: Sun, 13 Sep 2015 08:19:48 -0300 Subject: [PATCH] Replace window checking idle loop with a timeout Also, make sure the onWindowAdded callback is only called once when the window is already properly added to the compositor. Keep the timeout running otherwise, instead of setting a new one up every time. --- maximus-two@wilfinitlike.gmail.com/decoration.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/maximus-two@wilfinitlike.gmail.com/decoration.js b/maximus-two@wilfinitlike.gmail.com/decoration.js index 7e44dcb..4137501 100644 --- a/maximus-two@wilfinitlike.gmail.com/decoration.js +++ b/maximus-two@wilfinitlike.gmail.com/decoration.js @@ -204,15 +204,18 @@ function onWindowAdded(ws, win) { * (see workspace.js _doAddWindow) */ if (!win.get_compositor_private()) { - Mainloop.idle_add(function () { - onWindowAdded(ws, win); - return false; + Mainloop.timeout_add(20, function () { + if(win.get_compositor_private()) { + onWindowAdded(ws, win); + return false; + } + return true; }); return false; } let retry = 3; - Mainloop.idle_add(function () { + Mainloop.timeout_add(20, function () { let id = guessWindowXID(win); if (!id) { if (--retry) {