From 17edc5e63ac51e4b46bf57c41b2dfdbb30a5410d Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Tue, 31 Jul 2012 20:26:51 -0700 Subject: [PATCH] ui: short-circuit layout-queued if deque is empty. --- basis/ui/ui.factor | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/basis/ui/ui.factor b/basis/ui/ui.factor index 766d128c1f..789ca71761 100644 --- a/basis/ui/ui.factor +++ b/basis/ui/ui.factor @@ -114,13 +114,17 @@ M: world ungraft* dup hand-world get-global eq? [ hand-loc get-global swap move-hand ] [ drop ] if ; -: layout-queued ( -- seq ) +: (layout-queued) ( deque -- seq ) [ in-layout? on - layout-queue [ + [ dup layout find-world [ , ] when* ] slurp-deque - ] { } make members ; + ] { } make members ; inline + +: layout-queued ( -- seq ) + layout-queue dup deque-empty? + [ drop { } ] [ (layout-queued) ] if ; : redraw-worlds ( seq -- ) [ dup update-hand draw-world ] each ;