Posted to tcl by kbk at Fri Aug 15 20:19:15 GMT 2008view raw
- # If we're using KHIM, make all entries and texts use it.
- if {[package provide khim] ne {}} {
- foreach command {::entry ::tk::entry ::text ::tk::text ::ttk::entry} {
- if {[interp alias {} $command] ne {}} {
- continue
- }
- if {[namespace which $command] eq {}} {
- continue
- }
- set ns [namespace qualifiers $command]
- set t [namespace tail $command]
- if {[namespace which ${ns}::khimWrapped${t}] ne {}} {
- continue
- }
- rename ${ns}::${t} ${ns}::khimWrapped${t}
- proc ${ns}::${t} {w args} [string map [list @ns $ns @t $t] {
- eval [linsert $args 0 @ns::khimWrapped@t $w]
- bindtags $w [linsert [bindtags $w] 1 KHIM]
- return $w
- }]
- }
- }