Posted to tcl by kbk at Fri Aug 15 20:19:15 GMT 2008view raw

  1. # If we're using KHIM, make all entries and texts use it.
  2.  
  3. if {[package provide khim] ne {}} {
  4. foreach command {::entry ::tk::entry ::text ::tk::text ::ttk::entry} {
  5. if {[interp alias {} $command] ne {}} {
  6. continue
  7. }
  8. if {[namespace which $command] eq {}} {
  9. continue
  10. }
  11. set ns [namespace qualifiers $command]
  12. set t [namespace tail $command]
  13. if {[namespace which ${ns}::khimWrapped${t}] ne {}} {
  14. continue
  15. }
  16. rename ${ns}::${t} ${ns}::khimWrapped${t}
  17. proc ${ns}::${t} {w args} [string map [list @ns $ns @t $t] {
  18. eval [linsert $args 0 @ns::khimWrapped@t $w]
  19. bindtags $w [linsert [bindtags $w] 1 KHIM]
  20. return $w
  21. }]
  22. }
  23. }