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. ! Copyright (C) 2005, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs continuations kernel math models USING: accessors arrays assocs cache colors combinators
namespaces opengl opengl.textures sequences io colors combinators combinators.short-circuit concurrency.promises continuations
combinators.short-circuit fry math.vectors math.rectangles cache destructors fry io kernel literals math math.rectangles
ui.gadgets ui.gestures ui.render ui.backend ui.gadgets.tracks math.vectors models namespaces opengl opengl.textures sequences
ui.pixel-formats destructors literals strings ; strings ui.backend ui.gadgets ui.gadgets.tracks ui.gestures
ui.pixel-formats ui.render ;
IN: ui.gadgets.worlds IN: ui.gadgets.worlds
SYMBOLS: SYMBOLS:
@ -40,6 +41,7 @@ TUPLE: world < track
window-loc window-loc
pixel-format-attributes pixel-format-attributes
background-color background-color
promise
window-controls window-controls
window-resources ; window-resources ;
@ -118,7 +120,8 @@ M: world request-focus-on ( child gadget -- )
f >>active? f >>active?
{ 0 0 } >>window-loc { 0 0 } >>window-loc
f >>grab-input? f >>grab-input?
V{ } clone >>window-resources ; V{ } clone >>window-resources
<promise> >>promise ;
: initial-background-color ( attributes -- color ) : initial-background-color ( attributes -- color )
window-controls>> textured-background swap member-eq? window-controls>> textured-background swap member-eq?

View File

@ -1,12 +1,12 @@
! Copyright (C) 2006, 2010 Slava Pestov. ! Copyright (C) 2006, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: arrays assocs boxes io kernel math models namespaces make USING: accessors arrays assocs boxes classes.tuple
dlists deques sequences threads words continuations init classes.tuple.parser combinators combinators.short-circuit
combinators combinators.short-circuit hashtables concurrency.flags concurrency.promises continuations deques
concurrency.flags sets accessors calendar fry destructors destructors dlists fry init kernel lexer make math namespaces
ui.gadgets ui.gadgets.private ui.gadgets.worlds parser sequences sets strings threads ui.backend ui.gadgets
ui.gadgets.tracks ui.gestures ui.backend ui.render strings ui.gadgets.private ui.gadgets.worlds ui.gestures vocabs.parser
classes.tuple classes.tuple.parser lexer vocabs.parser parser ; words ;
IN: ui IN: ui
<PRIVATE <PRIVATE
@ -94,6 +94,7 @@ M: world ungraft*
[ [ <reversed> [ [ dispose ] when* ] each V{ } clone ] change-window-resources drop ] [ [ <reversed> [ [ dispose ] when* ] each V{ } clone ] change-window-resources drop ]
[ [ (close-window) f ] change-handle drop ] [ [ (close-window) f ] change-handle drop ]
[ unfocus-world ] [ unfocus-world ]
[ promise>> t swap fulfill ]
} cleave ; } cleave ;
: init-ui ( -- ) : init-ui ( -- )