diff options
author | andreask <andreask> | 2013-01-22 19:30:43 (GMT) |
---|---|---|
committer | andreask <andreask> | 2013-01-22 19:30:43 (GMT) |
commit | 48c9fcb7281cc6aa076113db874c7ae0e105795d (patch) | |
tree | 7187940ff056462bfa41705a2ce04d0ed07d424e /library/focus.tcl | |
parent | 41f5d19540b0b3f053da352e1569c9a4ed019dd5 (diff) | |
download | tk-48c9fcb7281cc6aa076113db874c7ae0e105795d.zip tk-48c9fcb7281cc6aa076113db874c7ae0e105795d.tar.gz tk-48c9fcb7281cc6aa076113db874c7ae0e105795d.tar.bz2 |
Contribution by Patrick Fradin <patrick.fradin@planar.com>contrib_patrick_fradin_code_cleanup
Quoting his mail:
<pre>
==========================================================
Hi Jeff,
I spent some of my time to contribute to the TclTk community ! I'm in
late for Christmas gift but like we said in French : "Mieux vaut tard
que jamais". ;-)
I've use TclDevKit 5.3.0 tclchecker to analyse TclTk code in Tcl and
Tk library directories (library, tools and tests) to correct a lot of
warnings and few errors. (encapsulate some expr, use 'chan xxx'
instead of fconfigure, fileevent...)
I've made some improvements too :
Examples :
- Use 'lassign' instead of many 'lindex' of 'foreach/break' loop.
- Use 'in' or 'ni' operators instead of 'lsearch -exact' or to
factorise some eq/ne && / || tests.
- Use 'eq' or 'ne' to tests strings instead of '==' or '!='.
- Use 'unset -nocomplain' to avoid 'catch {unset...}'.
- Remove some useless catch around 'destroy' calls.
- Use expand {*} instead of 'eval'. Don't touch a lot of code because
I don't know all structs and lists. I think it could be a greater
improvement to reduce 'eval' calls.
Due to previous experience, I dot not change any indentation ! ;-)
==========================================================
</pre>
Diffstat (limited to 'library/focus.tcl')
-rw-r--r-- | library/focus.tcl | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/library/focus.tcl b/library/focus.tcl index 640406e..36d0855 100644 --- a/library/focus.tcl +++ b/library/focus.tcl @@ -20,7 +20,7 @@ # Arguments: # w - Name of a window. -proc ::tk_focusNext w { +proc ::tk_focusNext {w} { set cur $w while {1} { @@ -55,7 +55,7 @@ proc ::tk_focusNext w { set children [winfo children $parent] set i [lsearch -exact $children $cur] } - if {$w eq $cur || [tk::FocusOK $cur]} { + if {($w eq $cur) || [tk::FocusOK $cur]} { return $cur } } @@ -72,7 +72,7 @@ proc ::tk_focusNext w { # Arguments: # w - Name of a window. -proc ::tk_focusPrev w { +proc ::tk_focusPrev {w} { set cur $w while {1} { @@ -106,7 +106,7 @@ proc ::tk_focusPrev w { set i [llength $children] } set cur $parent - if {$w eq $cur || [tk::FocusOK $cur]} { + if {($w eq $cur) || [tk::FocusOK $cur]} { return $cur } } @@ -126,7 +126,7 @@ proc ::tk_focusPrev w { # Arguments: # w - Name of a window. -proc ::tk::FocusOK w { +proc ::tk::FocusOK {w} { set code [catch {$w cget -takefocus} value] if {($code == 0) && ($value ne "")} { if {$value == 0} { @@ -144,7 +144,7 @@ proc ::tk::FocusOK w { return 0 } set code [catch {$w cget -state} value] - if {($code == 0) && $value eq "disabled"} { + if {($code == 0) && ($value eq "disabled")} { return 0 } regexp Key|Focus "[bind $w] [bind [winfo class $w]]" |