diff options
author | Siep Kroonenberg <siepo@cybercomm.nl> | 2019-10-11 11:45:12 +0000 |
---|---|---|
committer | Siep Kroonenberg <siepo@cybercomm.nl> | 2019-10-11 11:45:12 +0000 |
commit | 1e7c9553a21edc3e757745f1d5c4e887bbcde1df (patch) | |
tree | d34ceeacc2039728853f89bc30077d23177e3af8 /Master/tlpkg/tltcl | |
parent | 2c7e2045cc69f3e8a43e73164839710827c04553 (diff) |
Better handling of titlebar Close button
git-svn-id: svn://tug.org/texlive/trunk@52337 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tltcl')
-rw-r--r-- | Master/tlpkg/tltcl/tltcl.tcl | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Master/tlpkg/tltcl/tltcl.tcl b/Master/tlpkg/tltcl/tltcl.tcl index edb20eb5f02..b0b8d1c19d5 100644 --- a/Master/tlpkg/tltcl/tltcl.tcl +++ b/Master/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 |