add a resize-world generic to handle window resizes
							parent
							
								
									045635cdf2
								
							
						
					
					
						commit
						4504907736
					
				| 
						 | 
				
			
			@ -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 -- )
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 ;
 | 
			
		||||
        ]
 | 
			
		||||
        [ resize-world ]
 | 
			
		||||
    } cleave ;
 | 
			
		||||
 | 
			
		||||
M: world graft*
 | 
			
		||||
    [ try-to-open-window ]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue