View Raw SPL
autosync(win, syncmode)
{
if (argc < 2)
{
/* sync X & Y */
syncmode = 3;
if (argc < 1)
{
win = refwindow(w0);
}
}
/* defer plotting */
plotmode(win, 0);
/* original focus */
f = getfocus(win);
focus(win, 1);
/* default scaling */
autoscale(win);
/* get root focus autoscaling and set to focus */
xl = getxl(win);
xr = getxr(win);
yb = getyb(win);
yt = getyt(win);
/* set autoscaling for secondary focus */
focus(win, 2);
setxauto(win, xl, xr);
setyauto(win, yb, yt);
/* set current window scaling */
setx(win, xl, xr);
sety(win, yb, yt);
/* set sync */
focus(win, 1);
sync(win, syncmode);
/* natural scaling */
autoscale(win);
/* reset focus */
focus(win, f);
/* show it */
plotmode(win, 1);
}