From 1167b97f2e4dc8b6595a7351557c09bf524e1f86 Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Sat, 15 Jan 2022 03:09:18 +0100 Subject: [PATCH] fix regression in tabbed window WM_DELETE_WINDOW protocol handler --- src/xschem.tcl | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/xschem.tcl b/src/xschem.tcl index 53342258..c594cba7 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -3739,6 +3739,30 @@ proc setup_tabbed_interface {} { .menubar.file.menu entryconfigure 6 -state normal .menubar.file.menu entryconfigure 7 -state normal } + # update tabbed window close (X) function + if {$tabbed_interface} { + wm protocol . WM_DELETE_WINDOW { + if { [xschem get current_win_path] eq {.drw} } { + xschem exit + } else { + xschem new_schematic destroy [xschem get current_win_path] {} + } + } + # restore non tabbed window close function for main window + } else { + wm protocol . WM_DELETE_WINDOW { + set old [xschem get current_win_path] + save_ctx $old + restore_ctx .drw + housekeeping_ctx + xschem new_schematic switch_win .drw + xschem exit + # did not exit (user cancel) ... switch back + restore_ctx $old + housekeeping_ctx + xschem new_schematic switch_win $old + } + } } proc delete_tab {path} { @@ -4605,7 +4629,15 @@ proc build_widgets { {topwin {} } } { $rootwin configure -background {} wm geometry $rootwin $initial_geometry #wm maxsize . 1600 1200 - if { $rootwin == {.}} { + if {$tabbed_interface && $rootwin eq {.}} { + wm protocol $rootwin WM_DELETE_WINDOW { + if { [xschem get current_win_path] eq {.drw} } { + xschem exit + } else { + xschem new_schematic destroy [xschem get current_win_path] {} + } + } + } elseif { $rootwin == {.}} { wm protocol $rootwin WM_DELETE_WINDOW { set old [xschem get current_win_path] save_ctx $old