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 | |
parent | 2c7e2045cc69f3e8a43e73164839710827c04553 (diff) |
Better handling of titlebar Close button
git-svn-id: svn://tug.org/texlive/trunk@52337 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Master/texmf-dist/scripts/tlshell/tlshell.tcl | 11 | ||||
-rwxr-xr-x | Master/tlpkg/installer/install-tl-gui.tcl | 29 | ||||
-rw-r--r-- | Master/tlpkg/tltcl/tltcl.tcl | 16 |
3 files changed, 41 insertions, 15 deletions
diff --git a/Master/texmf-dist/scripts/tlshell/tlshell.tcl b/Master/texmf-dist/scripts/tlshell/tlshell.tcl index e9bedea6890..c34147b4d8e 100755 --- a/Master/texmf-dist/scripts/tlshell/tlshell.tcl +++ b/Master/texmf-dist/scripts/tlshell/tlshell.tcl @@ -167,8 +167,10 @@ proc long_message {str type {p "."}} { } if [winfo exists .tlmg.cancel] { bind .tlmg <Escape> {.tlmg.cancel invoke} + wm protocol WM_DELETE_WINDOW {cancel_or_destroy .tlmg.cancel .tlmg} } elseif {$type eq "ok"} { bind .tlmg <Escape> {.tlmg.ok invoke} + wm protocol WM_DELETE_WINDOW {cancel_or_destroy .tlmg.ok .tlmg} } ppack [ttk::frame .tlmg.tx] -in .tlmg.bg -side top -fill both -expand 1 @@ -796,6 +798,7 @@ If this takes too long, press Abort and choose another repository." \ } ttk::button .loading.abo -text [__ "Abort"] -command abort_load ppack .loading.abo -in .loading.buttons -side right + wm protocol .loading {cancel_or_destroy .loading.abo .loading} wm resizable .loading 0 0 place_dlg .loading . } ; # splash_loading @@ -918,7 +921,8 @@ proc show_logs {} { ppack [ttk::label .tllg.status -textvariable ::busy -anchor w] \ -in .tllg.bottom -side left bind .tllg <Escape> {.tllg.close invoke} - wm protocol .tllg WM_DELETE_WINDOW {.tllg.close invoke} + wm protocol .tllg WM_DELETE_WINDOW \ + {cancel_or_destroy .tllg.close .tllg} # notebook pages and scrollbars ttk::frame .tllg.log @@ -1271,7 +1275,8 @@ proc repository_dialog {} { ppack .tlr.cancel -in .tlr.closebuttons -side right bind .tlr <Escape> {.tlr.cancel invoke} - wm protocol .tlr WM_DELETE_WINDOW {.tlr.cancel invoke} + wm protocol .tlr WM_DELETE_WINDOW \ + {cancel_or_destroy .tlr.cancel .tlr} wm resizable .tlr 1 0 place_dlg .tlr . } ; # repository_dialog @@ -2314,7 +2319,7 @@ proc populate_main {} { bind .pkg_popup <Leave> {.pkg_popup unpost} } - wm protocol . WM_DELETE_WINDOW {.q invoke} + wm protocol . WM_DELETE_WINDOW {cancel_or_destroy .q .} wm resizable . 1 1 wm state . normal } 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 |