     \ invalidate* over set-gadget-layout-state
     dup forget-pref-dim
     dup gadget-root?
-    [ layout-later ] [ gadget-parent [ relayout ] when* ] if ;
+    [ layout-later ] [ parent>> [ relayout ] when* ] if ;
 
 : relayout ( gadget -- )
     dup gadget-layout-state \ invalidate* eq?

: unparent ( gadget -- )
    not-in-layout
    [
        dup gadget-parent dup [
            over (unparent)
            [ unfocus-gadget ] 2keep
            [ gadget-children delete ] keep

    swap [ over (add-gadget) ] each relayout ;

: parents ( gadget -- seq )
    [ parent>> ] follow ;

: each-parent ( gadget quot -- ? )
    >r parents r> all? ; inline
