From 6a501d4aa3e9cc3308d065adfa2b7a9c1b54de57 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 16 Jun 2010 15:32:50 -0500 Subject: [PATCH] Add a promise to world objects that gets fulfilled when the world is ungrafted --- basis/ui/gadgets/worlds/worlds.factor | 15 +++++++++------ basis/ui/ui.factor | 15 ++++++++------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/basis/ui/gadgets/worlds/worlds.factor b/basis/ui/gadgets/worlds/worlds.factor index a63d64312b..e713b0f999 100644 --- a/basis/ui/gadgets/worlds/worlds.factor +++ b/basis/ui/gadgets/worlds/worlds.factor @@ -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 ; : initial-background-color ( attributes -- color ) window-controls>> textured-background swap member-eq? diff --git a/basis/ui/ui.factor b/basis/ui/ui.factor index 1e5af88ac8..eaeeb01f03 100644 --- a/basis/ui/ui.factor +++ b/basis/ui/ui.factor @@ -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 [ [ dispose ] when* ] each V{ } clone ] change-window-resources drop ] [ [ (close-window) f ] change-handle drop ] [ unfocus-world ] + [ promise>> t swap fulfill ] } cleave ; : init-ui ( -- )