diff --git a/basis/ui/gadgets/worlds/worlds.factor b/basis/ui/gadgets/worlds/worlds.factor index 837cf822dc..31b5a137a3 100755 --- a/basis/ui/gadgets/worlds/worlds.factor +++ b/basis/ui/gadgets/worlds/worlds.factor @@ -24,6 +24,7 @@ TUPLE: world-attributes status gadgets { pixel-format-attributes initial: $ default-world-pixel-format-attributes } ; + C: 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 -- ) diff --git a/basis/ui/ui.factor b/basis/ui/ui.factor index 0d15d7d57a..d07403836a 100644 --- a/basis/ui/ui.factor +++ b/basis/ui/ui.factor @@ -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 ]