add a resize-world generic to handle window resizes

db4
Joe Groff 2009-05-03 22:01:35 -05:00
parent 045635cdf2
commit 4504907736
2 changed files with 23 additions and 7 deletions

View File

@ -24,6 +24,7 @@ TUPLE: world-attributes
status status
gadgets gadgets
{ pixel-format-attributes initial: $ default-world-pixel-format-attributes } ; { pixel-format-attributes initial: $ default-world-pixel-format-attributes } ;
C: <world-attributes> world-attributes C: <world-attributes> world-attributes
: find-world ( gadget -- world/f ) [ world? ] find-parent ; : find-world ( gadget -- world/f ) [ world? ] find-parent ;
@ -97,10 +98,22 @@ flush-layout-cache-hook [ [ ] ] initialize
GENERIC: begin-world ( world -- ) GENERIC: begin-world ( world -- )
GENERIC: end-world ( world -- ) GENERIC: end-world ( world -- )
GENERIC: resize-world ( world -- )
M: world begin-world M: world begin-world
drop ; drop ;
M: world end-world M: world end-world
drop ; drop ;
M: world resize-world
drop ;
M: world (>>dim)
[ call-next-method ]
[
dup handle>>
[ select-gl-context resize-world ]
[ drop ] if*
] bi ;
GENERIC: draw-world* ( world -- ) GENERIC: draw-world* ( world -- )

View File

@ -51,13 +51,16 @@ SYMBOL: windows
focus-path f swap focus-gestures ; focus-path f swap focus-gestures ;
: try-to-open-window ( world -- ) : try-to-open-window ( world -- )
{
[ (open-window) ] [ (open-window) ]
[ handle>> select-gl-context ] [ handle>> select-gl-context ]
[ [
[ begin-world ] [ begin-world ]
[ [ handle>> (close-window) ] [ ui-error ] bi* ] [ [ handle>> (close-window) ] [ ui-error ] bi* ]
recover recover
] tri ; ]
[ resize-world ]
} cleave ;
M: world graft* M: world graft*
[ try-to-open-window ] [ try-to-open-window ]