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
gadgets
{ pixel-format-attributes initial: $ default-world-pixel-format-attributes } ;
C: <world-attributes> world-attributes
: find-world ( gadget -- world/f ) [ world? ] find-parent ;
@ -97,10 +98,22 @@ flush-layout-cache-hook [ [ ] ] initialize
GENERIC: begin-world ( world -- )
GENERIC: end-world ( world -- )
GENERIC: resize-world ( world -- )
M: world begin-world
drop ;
M: world end-world
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 -- )

View File

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