cleanup FocusIn / window switching

This commit is contained in:
stefan schippers 2025-03-28 13:12:52 +01:00
parent 33050d406a
commit 1d2bff5f9b
2 changed files with 20 additions and 16 deletions

View File

@ -1299,7 +1299,8 @@ int preview_window(const char *what, const char *win_path, const char *fname)
}
}
}
tclvareval("restore_ctx ", xctx->current_win_path, NULL);
if(xctx->current_win_path)
tclvareval("restore_ctx ", xctx->current_win_path, NULL);
semaphore--;
return result;
}
@ -1843,10 +1844,11 @@ static void destroy_window(int *window_count, const char *win_path)
}
/* following 3 lines must be done also if window not closed */
xctx = savectx; /* restore previous schematic or main window if previous destroyed */
tclvareval("restore_ctx ", xctx->current_win_path, " ; housekeeping_ctx", NULL);
if(xctx->current_win_path)
tclvareval("restore_ctx ", xctx->current_win_path, " ; housekeeping_ctx", NULL);
set_modify(-1); /* sets window title */
} else {
dbg(0, "new_schematic() destroy_window: there are no additional tabs\n");
dbg(0, "new_schematic() destroy_window: there are no additional windows\n");
}
}
@ -1901,7 +1903,8 @@ static void destroy_tab(int *window_count, const char *win_path)
/* seems unnecessary; previous tab save_pixmap was not deleted */
/* resetwin(1, 0, 0, 0, 0); */ /* create pixmap. resetwin(create_pixmap, clear_pixmap, force, w, h) */
tclvareval("restore_ctx ", xctx->current_win_path, " ; housekeeping_ctx", NULL);
if(xctx->current_win_path)
tclvareval("restore_ctx ", xctx->current_win_path, " ; housekeeping_ctx", NULL);
resetwin(1, 1, 1, 0, 0);
set_modify(-1); /* sets window title */
draw();
@ -1965,7 +1968,8 @@ static void destroy_all_windows(int *window_count, int force)
}
/* following 3 lines must be done also if windows not closed */
xctx = savectx; /* restore previous schematic or main if old is destroyed */
tclvareval("restore_ctx ", xctx->current_win_path, " ; housekeeping_ctx", NULL);
if(xctx->current_win_path)
tclvareval("restore_ctx ", xctx->current_win_path, " ; housekeeping_ctx", NULL);
set_modify(-1); /* sets window title */
}
}
@ -2007,7 +2011,8 @@ static void destroy_all_tabs(int *window_count, int force)
}
/* following 3 lines must be done also if windows not closed */
xctx = savectx; /* restore previous schematic or main if old is destroyed */
tclvareval("restore_ctx ", xctx->current_win_path, " ; housekeeping_ctx", NULL);
if(xctx->current_win_path)
tclvareval("restore_ctx ", xctx->current_win_path, " ; housekeeping_ctx", NULL);
set_modify(-1); /* sets window title */
draw();
}

View File

@ -1988,13 +1988,11 @@ proc cellview { {derived_symbols {}} {upd 0}} {
set font fixed
}
set netlist_type $save_netlist_type
xschem set netlist_type $netlist_type
xschem reload_symbols ;# purge unused symbols
xschem netlist -keep_symbols -noalert;# traverse the hierarchy and retain all encountered symbols
if {!$upd} {
set netlist_type $save_netlist_type
xschem set netlist_type $netlist_type
xschem reload_symbols ;# purge unused symbols
xschem netlist -keep_symbols -noalert;# traverse the hierarchy and retain all encountered symbols
puts "get netlist"
catch {destroy .cv}
toplevel .cv
wm geometry .cv 800x200
@ -8544,14 +8542,15 @@ global env has_x OS autofocus_mainwindow
bind $parent <Expose> [list raise_dialog $parent $topwin]
bind $parent <Visibility> [list raise_dialog $parent $topwin]
# This event will cause a window context switch
bind $parent <Enter> "switch_window $parent $topwin %T %W"
# This event will cause a window context switch
# Context switch
bind $parent <FocusIn> "switch_window $parent $topwin %T %W"
bind $topwin <Leave> "
xschem callback %W %T %x %y 0 0 0 %s
graph_show_measure stop
"
bind $topwin <Expose> "xschem callback %W %T %x %y 0 %w %h %s"
# transform mousewheel events into button4/5 events
@ -8604,7 +8603,7 @@ global env has_x OS autofocus_mainwindow
bind $topwin <Control-Alt-KeyPress> {xschem callback %W %T %x %y %N 0 0 [expr {$ControlMask + $Mod1Mask}]}
bind $topwin <Shift-Alt-KeyPress> {xschem callback %W %T %x %y %N 0 0 [expr {$ShiftMask + $Mod1Mask}]}
bind $topwin <Shift-Insert> {xschem callback %W %T %x %y %N 0 0 [expr {$ShiftMask}]}
bind $topwin <MouseWheel> {
bind $topwin <MouseWheel> { ;# transform MouseWheel into button 4/5 presses.
if {%D<0} {
xschem callback %W 4 %x %y 0 5 0 %s
} else {