summaryrefslogtreecommitdiff
path: root/systems/texlive/tlnet/tlpkg/tltcl/tltcl.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'systems/texlive/tlnet/tlpkg/tltcl/tltcl.tcl')
-rw-r--r--systems/texlive/tlnet/tlpkg/tltcl/tltcl.tcl16
1 files changed, 15 insertions, 1 deletions
diff --git a/systems/texlive/tlnet/tlpkg/tltcl/tltcl.tcl b/systems/texlive/tlnet/tlpkg/tltcl/tltcl.tcl
index edb20eb5f0..b0b8d1c19d 100644
--- a/systems/texlive/tlnet/tlpkg/tltcl/tltcl.tcl
+++ b/systems/texlive/tlnet/tlpkg/tltcl/tltcl.tcl
@@ -451,6 +451,10 @@ set ::env(NOPERLDOC) 1
# for example code, look at dialog.tcl, part of Tk itself
+# In most cases, it is not necessary to explicitly define a handler for
+# the WM_DELETE_WINDOW protocol. But if the cancel- or abort button would do
+# anything special, then the close icon should not bypass this.
+
# widget classes which can be enabled and disabled.
# The text widget class is not included here.
@@ -468,7 +472,6 @@ proc create_dlg {wnd {p .}} {
wm withdraw $wnd
if [winfo viewable $p] {wm transient $wnd $p}
if $::plain_unix {wm attributes $wnd -type dialog}
- wm protocol $wnd WM_DELETE_WINDOW {destroy $wnd}
}
# Place a dialog centered wrt its parent.
@@ -515,6 +518,15 @@ proc end_dlg {ans wnd} {
destroy $wnd
} ; # end_dlg
+# a possibly useful callback for WM_DELETE_WINDOW
+proc cancel_or_destroy {ctrl topl} {
+ if [winfo exists $ctrl] {
+ $ctrl invoke
+ } elseif [winfo exists $topl] {
+ destroy $topl
+ }
+}
+
##### directories #####
# slash flipping
@@ -576,6 +588,8 @@ if {$::tcl_platform(platform) eq "unix"} {
ppack [ttk::button .browser.cancel -text [__ "Cancel"]] \
-in .browser.fr1 -side right
bind .browser <Escape> {.browser.cancel invoke}
+ wm protocol .browser WM_DELETE_WINDOW \
+ {cancel_or_destroy .browser.cancel .browser}
.browser.ok configure -command {
set ::dialog_ans [.browser.tree focus]
destroy .browser