ui: ditch window restore behavior since it was broken
parent
28e67b7066
commit
212d308de1
|
@ -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 ;
|
ui.tools.walker ui.commands ui.gestures ui ui.private ;
|
||||||
IN: ui.tools
|
IN: ui.tools
|
||||||
|
|
||||||
: main ( -- )
|
MAIN: listener-window
|
||||||
restore-windows? [ restore-windows ] [ listener-window ] if ;
|
|
||||||
|
|
||||||
MAIN: main
|
|
||||||
|
|
||||||
\ refresh-all H{ { +nullary+ t } { +listener+ t } } define-command
|
\ refresh-all H{ { +nullary+ t } { +listener+ t } } define-command
|
||||||
|
|
||||||
|
|
|
@ -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.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: arrays assocs io kernel math models namespaces make dlists
|
USING: arrays assocs boxes io kernel math models namespaces make
|
||||||
deques sequences threads words continuations init
|
dlists deques sequences threads words continuations init
|
||||||
combinators combinators.short-circuit hashtables concurrency.flags
|
combinators combinators.short-circuit hashtables
|
||||||
sets accessors calendar fry destructors ui.gadgets ui.gadgets.private
|
concurrency.flags sets accessors calendar fry destructors
|
||||||
ui.gadgets.worlds ui.gadgets.tracks ui.gestures ui.backend ui.render
|
ui.gadgets ui.gadgets.private ui.gadgets.worlds
|
||||||
strings classes.tuple classes.tuple.parser lexer vocabs.parser parser ;
|
ui.gadgets.tracks ui.gestures ui.backend ui.render strings
|
||||||
|
classes.tuple classes.tuple.parser lexer vocabs.parser parser ;
|
||||||
IN: ui
|
IN: ui
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
@ -82,12 +83,7 @@ M: world graft*
|
||||||
[ [ clean-up-broken-window ] [ ui-error ] bi* ] recover
|
[ [ clean-up-broken-window ] [ ui-error ] bi* ] recover
|
||||||
] bi ;
|
] bi ;
|
||||||
|
|
||||||
: reset-world ( world -- )
|
M: world ungraft*
|
||||||
#! 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 -- )
|
|
||||||
{
|
{
|
||||||
[ set-gl-context ]
|
[ set-gl-context ]
|
||||||
[ text-handle>> [ dispose ] when* ]
|
[ text-handle>> [ dispose ] when* ]
|
||||||
|
@ -96,38 +92,21 @@ M: world graft*
|
||||||
[ hand-gadget close-global ]
|
[ hand-gadget close-global ]
|
||||||
[ end-world ]
|
[ end-world ]
|
||||||
[ [ <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 ]
|
||||||
|
[ unfocus-world ]
|
||||||
} cleave ;
|
} cleave ;
|
||||||
|
|
||||||
M: world ungraft*
|
|
||||||
[ (ungraft-world) ]
|
|
||||||
[ handle>> (close-window) ]
|
|
||||||
[ reset-world ] tri ;
|
|
||||||
|
|
||||||
: init-ui ( -- )
|
: 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> \ graft-queue set-global
|
||||||
<dlist> \ layout-queue set-global
|
<dlist> \ layout-queue set-global
|
||||||
<dlist> \ gesture-queue set-global
|
<dlist> \ gesture-queue set-global
|
||||||
V{ } clone windows 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 -- )
|
: update-hand ( world -- )
|
||||||
dup hand-world get-global eq?
|
dup hand-world get-global eq?
|
||||||
[ hand-loc get-global swap move-hand ] [ drop ] if ;
|
[ hand-loc get-global swap move-hand ] [ drop ] if ;
|
||||||
|
@ -188,16 +167,6 @@ PRIVATE>
|
||||||
: start-ui ( quot -- )
|
: start-ui ( quot -- )
|
||||||
call( -- ) notify-ui-thread start-ui-thread ;
|
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 )
|
: ?attributes ( gadget title/attributes -- attributes )
|
||||||
dup string? [ world-attributes new swap >>title ] [ clone ] if
|
dup string? [ world-attributes new swap >>title ] [ clone ] if
|
||||||
swap [ [ [ 1array ] [ f ] if* ] curry unless* ] curry change-gadgets ;
|
swap [ [ [ 1array ] [ f ] if* ] curry unless* ] curry change-gadgets ;
|
||||||
|
|
Loading…
Reference in New Issue