summaryrefslogtreecommitdiff
path: root/Master/tlpkg
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2019-10-11 11:45:12 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2019-10-11 11:45:12 +0000
commit1e7c9553a21edc3e757745f1d5c4e887bbcde1df (patch)
treed34ceeacc2039728853f89bc30077d23177e3af8 /Master/tlpkg
parent2c7e2045cc69f3e8a43e73164839710827c04553 (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')
-rwxr-xr-xMaster/tlpkg/installer/install-tl-gui.tcl29
-rw-r--r--Master/tlpkg/tltcl/tltcl.tcl16
2 files changed, 33 insertions, 12 deletions
diff --git a/Master/tlpkg/installer/install-tl-gui.tcl b/Master/tlpkg/installer/install-tl-gui.tcl
index 69a653fc87a..4234f183125 100755
--- a/Master/tlpkg/installer/install-tl-gui.tcl
+++ b/Master/tlpkg/installer/install-tl-gui.tcl
@@ -539,11 +539,12 @@ proc edit_name {} {
}
}
ppack .tled.ok_b -in .tled.buttons -side right -padx 5 -pady 5
- ttk::button .tled.q_b -text [__ "Cancel"] -command {end_dlg "" .tled}
- ppack .tled.q_b -in .tled.buttons -side right -padx 5 -pady 5
- bind .tled <Escape> {.tled.q_b invoke}
+ ttk::button .tled.cancel_b -text [__ "Cancel"] -command {end_dlg "" .tled}
+ ppack .tled.cancel_b -in .tled.buttons -side right -padx 5 -pady 5
+ bind .tled <Escape> {.tled.cancel_b invoke}
- wm protocol .tled WM_DELETE_WINDOW {.tled.q_b invoke}
+ wm protocol .tled WM_DELETE_WINDOW \
+ {cancel_or_destroy .tled.cancel_b .tled}
wm resizable .tled 0 0
place_dlg .tled .tltd
} ; # edit_name
@@ -703,7 +704,8 @@ proc texdir_setup {} {
bind .tltd <Return> commit_root
bind .tltd <Escape> {destroy .tltd}
- wm protocol .tltd WM_DELETE_WINDOW {.tltd.cancel_b invoke}
+ wm protocol .tltd WM_DELETE_WINDOW \
+ {cancel_or_destroy .tltd.cancel_b .tltd}
wm resizable .tltd 1 0
place_dlg .tltd
} ; # texdir_setup
@@ -744,11 +746,12 @@ proc edit_dir {d} {
ppack .td.cancel -in .td.f -side right
bind .td <Escape> {.td.cancel invoke}
- wm protocol .td WM_DELETE_WINDOW {.td.cancel invoke}
+ wm protocol .td WM_DELETE_WINDOW \
+ {cancel_or_destroy .td.cancel .td}
wm resizable .td 1 0
place_dlg .td .
tkwait window .td
- if {$::dialog_ans ne ""} {
+ if {[info exists ::dialog_ans] && $::dialog_ans ne ""} {
set ::vars($d) [forward_slashify $::dialog_ans]
if $::vars(instopt_portable) {
if {$d eq "TEXMFLOCAL"} {set ::vars(TEXMFHOME) $::vars($d)}
@@ -961,7 +964,8 @@ proc select_binaries {} {
bind .tlbin.lst <ButtonRelease-1> \
{toggle_bin [.tlbin.lst identify item %x %y]}
- wm protocol .tlbin WM_DELETE_WINDOW {.tlbin.cancel invoke}
+ wm protocol .tlbin WM_DELETE_WINDOW \
+ {cancel_or_destroy .tlbin.cancel .tlbin}
wm resizable .tlbin 1 1
place_dlg .tlbin .
}; # select_binaries
@@ -1017,7 +1021,8 @@ proc select_scheme {} {
# we already made sure that $::vars(selected_scheme) has a valid value
.tlschm.lst selection set [list $::vars(selected_scheme)]
- wm protocol .tlschm WM_DELETE_WINDOW {tlschm.cancel invoke}
+ wm protocol .tlschm WM_DELETE_WINDOW \
+ {cancel_or_destroy tlschm.cancel .tlschm}
wm resizable .tlschm 1 0
place_dlg .tlschm .
}; # select_scheme
@@ -1138,7 +1143,8 @@ proc select_collections {} {
[list [mark_sym $::vars($c)] [__ $::coll_descs($c)]]
}
- wm protocol .tlcoll WM_DELETE_WINDOW {.tlcoll.cancel invoke}
+ wm protocol .tlcoll WM_DELETE_WINDOW \
+ {cancel_or_destroy .tlcoll.cancel .tlcoll}
wm resizable .tlcoll 1 1
place_dlg .tlcoll .
}; # select_collections
@@ -1299,7 +1305,8 @@ if {$::tcl_platform(platform) ne "windows"} {
check_sym_entries
- wm protocol .edsyms WM_DELETE_WINDOW {.edsyms.cancel invoke}
+ wm protocol .edsyms WM_DELETE_WINDOW \
+ {cancel_or_destroy .edsyms.cancel .edsyms}
wm resizable .edsyms 1 0
place_dlg .edsyms .
} ; # edit_symlinks
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