]> gitweb.factorcode.org Git - factor.git/commitdiff
ui: ditch window restore behavior since it was broken
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 24 May 2010 20:50:09 +0000 (16:50 -0400)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 24 May 2010 20:50:09 +0000 (16:50 -0400)
basis/ui/tools/tools.factor
basis/ui/ui.factor

index 42bc0ef1f22d7b58a023badf037ce67418b7f96c..1b5fcb50c43a9f86ac3f1f0526d7d911ffcddea7 100644 (file)
@@ -5,10 +5,7 @@ ui.tools.listener ui.tools.browser ui.tools.common ui.tools.error-list
 ui.tools.walker ui.commands ui.gestures ui ui.private ;
 IN: ui.tools
 
-: main ( -- )
-    restore-windows? [ restore-windows ] [ listener-window ] if ;
-
-MAIN: main
+MAIN: listener-window
 
 \ refresh-all H{ { +nullary+ t } { +listener+ t } } define-command
 
index bf186ee9a81b19f0a2e7d5046879cbadbf96e997..d55d1af0968ca0792c3e9daf8ff00876a5526743 100644 (file)
@@ -1,11 +1,12 @@
-! Copyright (C) 2006, 2009 Slava Pestov.
+! Copyright (C) 2006, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays assocs 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: 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 ;
 IN: ui
 
 <PRIVATE
@@ -82,12 +83,7 @@ M: world graft*
         [ [ clean-up-broken-window ] [ ui-error ] bi* ] recover
     ] bi ;
 
-: reset-world ( world -- )
-    #! This is used when a window is being closed, but also
-    #! when restoring saved worlds on image startup.
-    f >>handle unfocus-world ;
-
-: (ungraft-world) ( world -- )
+M: world ungraft*
     {
         [ set-gl-context ]
         [ text-handle>> [ dispose ] when* ]
@@ -96,38 +92,21 @@ M: world graft*
         [ hand-gadget close-global ]
         [ end-world ]
         [ [ <reversed> [ [ dispose ] when* ] each V{ } clone ] change-window-resources drop ]
+        [ [ (close-window) f ] change-handle drop ]
+        [ unfocus-world ]
     } cleave ;
 
-M: world ungraft*
-    [ (ungraft-world) ]
-    [ handle>> (close-window) ]
-    [ reset-world ] tri ;
-
 : init-ui ( -- )
+    <box> drag-timer set-global
+    f hand-gadget set-global
+    f hand-clicked set-global
+    f hand-world set-global
+    f world set-global
     <dlist> \ graft-queue set-global
     <dlist> \ layout-queue set-global
     <dlist> \ gesture-queue set-global
     V{ } clone windows set-global ;
 
-: restore-gadget-later ( gadget -- )
-    dup graft-state>> {
-        { { f f } [ ] }
-        { { f t } [ ] }
-        { { t t } [ { f f } >>graft-state ] }
-        { { t f } [ dup unqueue-graft { f f } >>graft-state ] }
-    } case graft-later ;
-
-: restore-gadget ( gadget -- )
-    dup restore-gadget-later
-    children>> [ restore-gadget ] each ;
-
-: restore-world ( world -- )
-    {
-        [ reset-world ]
-        [ f >>text-handle f >>images drop ]
-        [ restore-gadget ]
-    } cleave ;
-
 : update-hand ( world -- )
     dup hand-world get-global eq?
     [ hand-loc get-global swap move-hand ] [ drop ] if ;
@@ -188,16 +167,6 @@ PRIVATE>
 : start-ui ( quot -- )
     call( -- ) notify-ui-thread start-ui-thread ;
 
-: restore-windows ( -- )
-    [
-        windows get [ values ] [ delete-all ] bi
-        [ restore-world ] each
-        forget-rollover
-    ] (with-ui) ;
-
-: restore-windows? ( -- ? )
-    windows get empty? not ;
-
 : ?attributes ( gadget title/attributes -- attributes )
     dup string? [ world-attributes new swap >>title ] [ clone ] if
     swap [ [ [ 1array ] [ f ] if* ] curry unless* ] curry change-gadgets ;