]> gitweb.factorcode.org Git - factor.git/commitdiff
Add a promise to world objects that gets fulfilled when the world is ungrafted
authorDoug Coleman <doug.coleman@gmail.com>
Wed, 16 Jun 2010 20:32:50 +0000 (15:32 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Wed, 16 Jun 2010 21:23:30 +0000 (16:23 -0500)
basis/ui/gadgets/worlds/worlds.factor
basis/ui/ui.factor

index a63d64312be1663e3db01017319b50ae7e4115dc..e713b0f99959b0c0abf00dc86af12565ecea2dbe 100644 (file)
@@ -1,10 +1,11 @@
 ! Copyright (C) 2005, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays assocs continuations kernel math models
-namespaces opengl opengl.textures sequences io colors combinators
-combinators.short-circuit fry math.vectors math.rectangles cache
-ui.gadgets ui.gestures ui.render ui.backend ui.gadgets.tracks
-ui.pixel-formats destructors literals strings ;
+USING: accessors arrays assocs cache colors combinators
+combinators.short-circuit concurrency.promises continuations
+destructors fry io kernel literals math math.rectangles
+math.vectors models namespaces opengl opengl.textures sequences
+strings ui.backend ui.gadgets ui.gadgets.tracks ui.gestures
+ui.pixel-formats ui.render ;
 IN: ui.gadgets.worlds
 
 SYMBOLS:
@@ -40,6 +41,7 @@ TUPLE: world < track
     window-loc
     pixel-format-attributes
     background-color
+    promise
     window-controls
     window-resources ;
 
@@ -118,7 +120,8 @@ M: world request-focus-on ( child gadget -- )
         f >>active?
         { 0 0 } >>window-loc
         f >>grab-input?
-        V{ } clone >>window-resources ;
+        V{ } clone >>window-resources
+        <promise> >>promise ;
 
 : initial-background-color ( attributes -- color )
     window-controls>> textured-background swap member-eq?
index 1e5af88ac85fae96a994a4ba0adbfc52523c04ee..eaeeb01f03a51d1dac17ce6d91c0edeb76e42fcd 100644 (file)
@@ -1,12 +1,12 @@
 ! Copyright (C) 2006, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays assocs boxes io kernel math models namespaces make
-dlists deques sequences threads words continuations init
-combinators combinators.short-circuit hashtables
-concurrency.flags sets accessors calendar fry destructors
-ui.gadgets ui.gadgets.private ui.gadgets.worlds
-ui.gadgets.tracks ui.gestures ui.backend ui.render strings
-classes.tuple classes.tuple.parser lexer vocabs.parser parser ;
+USING: accessors arrays assocs boxes classes.tuple
+classes.tuple.parser combinators combinators.short-circuit
+concurrency.flags concurrency.promises continuations deques
+destructors dlists fry init kernel lexer make math namespaces
+parser sequences sets strings threads ui.backend ui.gadgets
+ui.gadgets.private ui.gadgets.worlds ui.gestures vocabs.parser
+words ;
 IN: ui
 
 <PRIVATE
@@ -94,6 +94,7 @@ M: world ungraft*
         [ [ <reversed> [ [ dispose ] when* ] each V{ } clone ] change-window-resources drop ]
         [ [ (close-window) f ] change-handle drop ]
         [ unfocus-world ]
+        [ promise>> t swap fulfill ]
     } cleave ;
 
 : init-ui ( -- )