The TCanvas::SetCanvasSize method works in interactive and batch modes while the TCanvas::SetWindowSize works in interactive mode only.
So, I would like to propose that the TCanvas::SetWindowSize is modified into (it will then work in both modes, too):
void SetWindowSize(UInt_t ww, UInt_t wh) { if (fBatch) SetCanvasSize((ww + fCw) / 2, (wh + fCh) / 2); else if (fCanvasImp) fCanvasImp->SetWindowSize(ww, wh); }
BTW. Wonder why “SetCanvasSize((ww + fCw) / 2, (wh + fCh) / 2)”? Well, that’s because the TCanvas shows the typical usage “c->SetWindowSize(w + (w - c->GetWw()), h + (h - c->GetWh()));”, so we need to “recalculate” parameters’ values (in order to get the original “w” and “h”).