diff options
author | jenglish <jenglish@flightlab.com> | 2009-11-12 18:17:14 (GMT) |
---|---|---|
committer | jenglish <jenglish@flightlab.com> | 2009-11-12 18:17:14 (GMT) |
commit | 09aec6f1d87b130dbe9c4392768cf9c16365a698 (patch) | |
tree | 6a689306857a9896ab922345a0b5dea64df3e3ee | |
parent | da2611425bfd7e8e60f4c170fed650cdd316b3b7 (diff) | |
download | tk-09aec6f1d87b130dbe9c4392768cf9c16365a698.zip tk-09aec6f1d87b130dbe9c4392768cf9c16365a698.tar.gz tk-09aec6f1d87b130dbe9c4392768cf9c16365a698.tar.bz2 |
[update] hygiene.
+ Where possible, replace [a; update; b] with [a ; after 0 b].
+ Where not possible, use [update idletasks] instead of full [update].
+ Use [after 0] in favor of [after idle] for delayed work,
to reduce likelihood of reentrancy issues in [update idletasks].
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | library/ttk/button.tcl | 4 | ||||
-rw-r--r-- | library/ttk/combobox.tcl | 10 | ||||
-rw-r--r-- | library/ttk/notebook.tcl | 4 | ||||
-rw-r--r-- | library/ttk/treeview.tcl | 4 |
5 files changed, 22 insertions, 11 deletions
@@ -1,3 +1,14 @@ +2009-11-12 Joe English <jenglish@users.sourceforge.net> + + * library/ttk/button.tcl, library/ttk/combobox.tcl, + library/ttk/notebook.tcl, library/ttk/treeview.tcl: + [update] hygiene. + + + Where possible, replace [a; update; b] with [a ; after 0 b]. + + Where not possible, use [update idletasks] instead of full [update]. + + Use [after 0] in favor of [after idle] for delayed work, + to reduce likelihood of reentrancy issues in [update idletasks]. + 2009-11-11 Don Porter <dgp@users.sourceforge.net> * generic/tkPlatDecls.h: Restore C++ friendliness to the diff --git a/library/ttk/button.tcl b/library/ttk/button.tcl index 494a674..3baefe2 100644 --- a/library/ttk/button.tcl +++ b/library/ttk/button.tcl @@ -1,5 +1,5 @@ # -# $Id: button.tcl,v 1.2 2006/11/27 06:53:55 jenglish Exp $ +# $Id: button.tcl,v 1.3 2009/11/12 18:17:14 jenglish Exp $ # # Bindings for Buttons, Checkbuttons, and Radiobuttons. # @@ -54,7 +54,7 @@ bind TRadiobutton <KeyPress-Down> { ttk::button::RadioTraverse %W +1 } proc ttk::button::activate {w} { $w instate disabled { return } set oldState [$w state pressed] - update idletasks; after 100 + update idletasks; after 100 ;# block event loop to avoid reentrancy $w state $oldState $w invoke } diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl index bec6faa..ff41366 100644 --- a/library/ttk/combobox.tcl +++ b/library/ttk/combobox.tcl @@ -1,5 +1,5 @@ # -# $Id: combobox.tcl,v 1.18 2008/12/07 21:24:12 jenglish Exp $ +# $Id: combobox.tcl,v 1.19 2009/11/12 18:17:14 jenglish Exp $ # # Combobox bindings. # @@ -221,9 +221,9 @@ proc ttk::combobox::LBTab {lb dir} { LBSelect $lb Unpost $cb # The [grab release] call in [Unpost] queues events that later - # re-set the focus. [update] to make sure these get processed first: - update - ttk::traverseTo $newFocus + # re-set the focus (@@@ NOTE: this might not be true anymore). + # Set new focus later: + after 0 [list ttk::traverseTo $newFocus] } } @@ -397,7 +397,7 @@ proc ttk::combobox::Post {cb} { set popdown [PopdownWindow $cb] ConfigureListbox $cb - update idletasks + update idletasks ;# needed for geometry propagation. PlacePopdown $cb $popdown # See <<NOTE-WM-TRANSIENT>> switch -- [tk windowingsystem] { diff --git a/library/ttk/notebook.tcl b/library/ttk/notebook.tcl index 4fe58cc..325d75d 100644 --- a/library/ttk/notebook.tcl +++ b/library/ttk/notebook.tcl @@ -1,5 +1,5 @@ # -# $Id: notebook.tcl,v 1.4 2007/02/24 09:15:07 das Exp $ +# $Id: notebook.tcl,v 1.5 2009/11/12 18:17:14 jenglish Exp $ # # Bindings for TNotebook widget # @@ -32,7 +32,7 @@ proc ttk::notebook::ActivateTab {w tab} { focus $w } else { $w select $tab - update ;# needed so focus logic sees correct mapped/unmapped states + update idletasks ;# needed so focus logic sees correct mapped states if {[set f [ttk::focusFirst [$w select]]] ne ""} { tk::TabToWindow $f } diff --git a/library/ttk/treeview.tcl b/library/ttk/treeview.tcl index 575769a..6dc34ca 100644 --- a/library/ttk/treeview.tcl +++ b/library/ttk/treeview.tcl @@ -1,4 +1,4 @@ -# $Id: treeview.tcl,v 1.7 2008/10/28 20:02:03 jenglish Exp $ +# $Id: treeview.tcl,v 1.8 2009/11/12 18:17:14 jenglish Exp $ # # ttk::treeview widget bindings and utilities. # @@ -234,7 +234,7 @@ proc ttk::treeview::heading.drag {w x y} { proc ttk::treeview::heading.release {w} { variable State if {[lsearch -exact [$w heading $State(heading) state] pressed] >= 0} { - after idle [$w heading $State(heading) -command] + after 0 [$w heading $State(heading) -command] } $w heading $State(heading) state !pressed } |