From 7eb9879f13f13d9722a13a6614bf18065138f1f0 Mon Sep 17 00:00:00 2001
From: Olivier Couet <Olivier.Couet@cern.ch>
Date: Mon, 11 Oct 2010 08:26:49 +0000
Subject: [PATCH] - A Square TCanvas saved in batch mode in a root file   and
 then displayed again in interactive mode was not   square anymore.

git-svn-id: http://root.cern.ch/svn/root/trunk@36278 27541ba8-7e3a-0410-8455-c3a389f83636
---
 graf2d/gpad/src/TCanvas.cxx | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/graf2d/gpad/src/TCanvas.cxx b/graf2d/gpad/src/TCanvas.cxx
index 19ec9d8f909..bf00447280a 100644
--- a/graf2d/gpad/src/TCanvas.cxx
+++ b/graf2d/gpad/src/TCanvas.cxx
@@ -790,8 +790,14 @@ void TCanvas::Draw(Option_t *)
    }
    if (old) { gROOT->GetListOfCanvases()->Remove(old); delete old;}
 
-   if (fWindowWidth  == 0) fWindowWidth  = 800;
-   if (fWindowHeight == 0) fWindowHeight = 600;
+   if (fWindowWidth  == 0) {
+      if (fCw !=0) fWindowWidth = fCw+4; 
+      else         fWindowWidth = 800;
+   }
+   if (fWindowHeight == 0) {
+      if (fCh !=0) fWindowHeight = fCh+28;
+      else         fWindowHeight = 600;
+   }
    fCanvasImp = gGuiFactory->CreateCanvasImp(this, GetName(), fWindowTopX, fWindowTopY,
                                              fWindowWidth, fWindowHeight);
    fCanvasImp->ShowMenuBar(TestBit(kMenuBar));
-- 
GitLab