From 2e7cd2b2ef809222ed5a45aa8c8affc5d672de20 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Wed, 9 Aug 2017 00:19:03 -0400 Subject: [PATCH] tasklist: Add a sync way to force an update It simplifies the tests --- lib/awful/widget/tasklist.lua | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/awful/widget/tasklist.lua b/lib/awful/widget/tasklist.lua index 6e164500..700c8724 100644 --- a/lib/awful/widget/tasklist.lua +++ b/lib/awful/widget/tasklist.lua @@ -460,15 +460,19 @@ function tasklist.new(args, filter, buttons, style, update_function, base_widget end local queued_update = false + + -- For the tests + function w._do_tasklist_update_now() + queued_update = false + if screen.valid then + tasklist_update(screen, w, args.buttons, args.filter, data, args.style, uf) + end + end + function w._do_tasklist_update() -- Add a delayed callback for the first update. if not queued_update then - timer.delayed_call(function() - queued_update = false - if screen.valid then - tasklist_update(screen, w, args.buttons, args.filter, data, args.style, uf) - end - end) + timer.delayed_call(w._do_tasklist_update_now) queued_update = true end end