better avoidance of race conditions between wm and Xevents when placing multiple windows (potential uncaught events)

This commit is contained in:
stefan schippers 2025-09-26 18:39:06 +02:00
parent 0fa05df6ab
commit ed9f069752
2 changed files with 9 additions and 7 deletions

View File

@ -1713,6 +1713,8 @@ static void create_new_window(int *window_count, const char *win_path, const cha
xctx->xorigin=CADINITIALX;
xctx->yorigin=CADINITIALY;
load_schematic(1, fname, 1, confirm);
if(dr) xctx->pending_fullzoom=1;
tclvareval("set_bindings ", window_path[n], NULL);
if(has_x) {
tclvareval("set_geom ", toppath, " [xschem get schname]", NULL);
}
@ -1726,10 +1728,7 @@ static void create_new_window(int *window_count, const char *win_path, const cha
* new_schematic("switch", prev_window, "", 1);
*/
tclvareval("housekeeping_ctx", NULL);
tclvareval("set_bindings ", window_path[n], NULL);
if(has_x) windowid(toppath);
if(dr) xctx->pending_fullzoom=1;
if(has_x) tclvareval("tkwait visibility ", toppath, ".drw", NULL);
}
/* non NULL and not empty noconfirm is used to avoid warning for duplicated filenames */
@ -3146,10 +3145,11 @@ int Tcl_AppInit(Tcl_Interp *inter)
if(!file_loaded) tcleval("exit 1");
if(cli_opt_do_netlist) set_modify(-1); /* set tab/window title */
}
if(has_x) tclvareval("set_geom . [xschem get schname]", NULL);
tcleval("set_bindings .drw");
/* Necessary to tell xschem the initial area to display */
xctx->pending_fullzoom=1;
tcleval("set_bindings .drw");
if(has_x) tclvareval("set_geom . [xschem get schname]", NULL);
/* Necessary to tell xschem the initial area to display */
if(cli_opt_do_netlist) {
if(!cli_opt_filename[0]) {
fprintf(errfp, "xschem: cant do a netlist without a filename\n");

View File

@ -8539,7 +8539,7 @@ proc set_geom {win {filename {}}} {
set xmax [winfo screenwidth .]
set ymax [winfo screenheight .]
scan $ret {%dx%d+%d+%d} x y dx dy
puts "xmax=$xmax, ymax=$ymax, x=$x, y=$y dx=$dx dy=$dy"
# puts "xmax=$xmax, ymax=$ymax, x=$x, y=$y dx=$dx dy=$dy"
# off screen. do not use.
if { $dx > $xmax - 100 || $dy > $ymax - 100} {
set ret {}
@ -8551,6 +8551,8 @@ proc set_geom {win {filename {}}} {
wm geometry $win $initial_geometry
# puts "set to geometry: $initial_geometry"
}
# tkwait visibility $win
update
}
proc get_geom {win {filename {}}} {