Add a promise to world objects that gets fulfilled when the world is ungrafted

db4
Doug Coleman 2010-06-16 15:32:50 -05:00
parent d41feef57c
commit 6a501d4aa3
2 changed files with 17 additions and 13 deletions

View 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?

View 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 ( -- )