]> gitweb.factorcode.org Git - factor.git/commitdiff
ui.gadgets: simplify unparent
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 1 Aug 2022 02:58:48 +0000 (19:58 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 1 Aug 2022 02:58:48 +0000 (19:58 -0700)
basis/ui/gadgets/gadgets.factor

index a6c9888b31259ad51ca4aa1328bde57209019afd..265fc1f3b294815aeb9f00a16888937a255545d5 100644 (file)
@@ -308,16 +308,15 @@ M: gadget remove-gadget 2drop ;
 : unparent ( gadget -- )
     not-in-layout
     [
-        dup parent>> dup
-        [
-            [ remove-gadget ] [
-                over (unparent)
+        dup parent>> [
+            {
+                [ remove-gadget ]
+                [ drop (unparent) ]
                 [ unfocus-gadget ]
                 [ children>> remove! drop ]
                 [ nip relayout ]
-                2tri
-            ] 2bi
-        ] [ 2drop ] if
+            } 2cleave
+        ] [ drop ] if*
     ] when* ;
 
 : clear-gadget ( gadget -- )