File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -3030,8 +3030,23 @@ unset doc_path doc_url
3030
3030
wm protocol . WM_DELETE_WINDOW do_quit
3031
3031
bind all <$M1B -Key-q> do_quit
3032
3032
bind all <$M1B -Key-Q> do_quit
3033
- bind all <$M1B -Key-w> {destroy [ winfo toplevel %W] }
3034
- bind all <$M1B -Key-W> {destroy [ winfo toplevel %W] }
3033
+
3034
+ set m1b_w_script {
3035
+ set toplvl_win [ winfo toplevel %W]
3036
+
3037
+ # If we are destroying the main window, we should call do_quit to take
3038
+ # care of cleanup before exiting the program.
3039
+ if {$toplvl_win eq " ." } {
3040
+ do_quit
3041
+ } else {
3042
+ destroy $toplvl_win
3043
+ }
3044
+ }
3045
+
3046
+ bind all <$M1B -Key-w> $m1b_w_script
3047
+ bind all <$M1B -Key-W> $m1b_w_script
3048
+
3049
+ unset m1b_w_script
3035
3050
3036
3051
set subcommand_args {}
3037
3052
proc usage {} {
You can’t perform that action at this time.
0 commit comments