reset window placement geometry if it happens to be (too much) offscreen
This commit is contained in:
parent
05e7f36148
commit
0fa05df6ab
|
|
@ -1714,7 +1714,7 @@ static void create_new_window(int *window_count, const char *win_path, const cha
|
|||
xctx->yorigin=CADINITIALY;
|
||||
load_schematic(1, fname, 1, confirm);
|
||||
if(has_x) {
|
||||
tclvareval("set_geom ", toppath, " [abs_sym_path {", fname ? fname : "untitled.sch", "}]", NULL);
|
||||
tclvareval("set_geom ", toppath, " [xschem get schname]", NULL);
|
||||
}
|
||||
tclvareval("set_replace_key_binding ", window_path[n], NULL);
|
||||
tclvareval("save_ctx ", window_path[n], NULL);
|
||||
|
|
|
|||
|
|
@ -8536,6 +8536,14 @@ proc set_geom {win {filename {}}} {
|
|||
set ret $geom_array($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"
|
||||
# off screen. do not use.
|
||||
if { $dx > $xmax - 100 || $dy > $ymax - 100} {
|
||||
set ret {}
|
||||
}
|
||||
if {$ret ne {}} {
|
||||
wm geometry $win $ret
|
||||
# puts "set to geometry: $ret"
|
||||
|
|
|
|||
Loading…
Reference in New Issue