From 2e4672ed6f7b49c9d1c44b6ca850cfe7024fc639 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sat, 12 Oct 2019 03:00:57 +0000 Subject: CTAN sync 201910120300 --- systems/texlive/tlnet/tlpkg/tltcl/tltcl.tcl | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'systems/texlive/tlnet/tlpkg/tltcl') 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 {.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 -- cgit v1.2.3