Fixed some resource leaks in the UI
parent
b87d1b1973
commit
c94ba8665b
|
@ -134,10 +134,10 @@ H{ } clone views set-global
|
|||
[ 2drop 1 ]
|
||||
}
|
||||
|
||||
{ "init" "id" { "id" "SEL" }
|
||||
{ "initWithFrame:pixelFormat:" "id" { "id" "SEL" "NSRect" "id" }
|
||||
[
|
||||
drop
|
||||
SUPER-> [init]
|
||||
rot drop
|
||||
SUPER-> [initWithFrame:pixelFormat:]
|
||||
dup "updateFactorGadgetSize:" add-resize-observer
|
||||
]
|
||||
}
|
||||
|
@ -165,7 +165,8 @@ H{ } clone views set-global
|
|||
|
||||
IN: gadgets
|
||||
|
||||
: repaint-handle ( handle -- ) 1 [setNeedsDisplay:] ;
|
||||
: repaint-handle ( handle -- )
|
||||
1 [setNeedsDisplay:] ;
|
||||
|
||||
: in-window ( gadget status dim title -- )
|
||||
>r <world> r> <FactorWindow> drop ;
|
||||
|
|
|
@ -69,12 +69,14 @@ V{ } clone hand-buttons set-global
|
|||
[ lose-focus ] swap each-gesture
|
||||
[ gain-focus ] swap each-gesture ;
|
||||
|
||||
: request-focus ( gadget -- )
|
||||
dup focusable-child swap find-world
|
||||
: request-focus* ( gadget world -- )
|
||||
dup focused-ancestors >r
|
||||
[ set-world-focus ] keep
|
||||
focused-ancestors r> focus-gestures ;
|
||||
|
||||
: request-focus ( gadget -- )
|
||||
dup focusable-child swap find-world request-focus* ;
|
||||
|
||||
: drag-loc ( -- loc )
|
||||
hand-loc get-global hand-click-loc get-global v- ;
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ SYMBOL: stack-bar
|
|||
<input-pane> dup pane set-global <scroller> ;
|
||||
|
||||
: <listener> ( -- gadget status )
|
||||
<frame> dup solid-interior
|
||||
<frame>
|
||||
<input-pane> dup pane set-global <scroller>
|
||||
over @center frame-add
|
||||
<bottom-bar> >r over @bottom frame-add r> ;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2005, 2006 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
IN: gadgets
|
||||
USING: freetype gadgets-layouts generic hashtables kernel
|
||||
USING: errors freetype gadgets-layouts generic hashtables kernel
|
||||
namespaces opengl sequences ;
|
||||
|
||||
! The world gadget is the top level gadget that all (visible)
|
||||
|
@ -19,7 +19,10 @@ TUPLE: world glass status focus fonts handle ;
|
|||
world-fonts [ drop V{ } clone ] cache ;
|
||||
|
||||
: close-world ( world -- )
|
||||
dup remove-notify dup free-fonts f swap set-world-handle ;
|
||||
f over request-focus*
|
||||
dup remove-notify
|
||||
dup free-fonts
|
||||
f swap set-world-handle ;
|
||||
|
||||
C: world ( gadget status dim -- world )
|
||||
<stack> over set-delegate
|
||||
|
@ -49,7 +52,7 @@ M: gadget find-world gadget-parent find-world ;
|
|||
M: world find-world ;
|
||||
|
||||
: repaint ( gadget -- )
|
||||
find-world [ world-handle repaint-handle ] when* ;
|
||||
find-world [ world-handle [ repaint-handle ] when* ] when* ;
|
||||
|
||||
: focused-ancestors ( world -- seq )
|
||||
world-focus parents reverse-slice ;
|
||||
|
|
Loading…
Reference in New Issue