Skip to content

Conversation

@rlalik
Copy link
Contributor

@rlalik rlalik commented Feb 3, 2026

The current implementation doesn't make sense at all? Was it some accidentally committed code?

@linev It was your commit? Was it mistake?

771c44692bcb graf2d/gpad/src/TCanvas.cxx (Sergey Linev      2023-07-06 16:42:42 +0200 2151)    if (fBatch && !IsWeb())
d023aecbdda4 graf2d/gpad/src/TCanvas.cxx (Sergey Linev      2020-05-04 19:06:00 +0200 2152)       SetCanvasSize((ww + fCw) / 2, (wh + fCh) / 2);
d023aecbdda4 graf2d/gpad/src/TCanvas.cxx (Sergey Linev      2020-05-04 19:06:00 +0200 2153)    else if (fCanvasImp)
d023aecbdda4 graf2d/gpad/src/TCanvas.cxx (Sergey Linev      2020-05-04 19:06:00 +0200 2154)       fCanvasImp->SetWindowSize(ww, wh);
  • tested changes locally
  • updated the docs (if necessary)

The current implementation doesn't make sense at all? Was it some accidentally commited code?
@rlalik rlalik requested a review from couet as a code owner February 3, 2026 17:00
@linev
Copy link
Member

linev commented Feb 3, 2026

@rlalik

No, this kind of calculation was there since a while. See:

https://github.com/root-project/root/blob/v6-24-00-patches/graf2d/gpad/src/TCanvas.cxx#L2201

I only add special handling for web case

@linev
Copy link
Member

linev commented Feb 3, 2026

I have no idea why code looks like this but I prefer not to touch it.
SetWindowSize has no real meaning for the batch - one should use SetCanvasSize instead.

@rlalik
Copy link
Contributor Author

rlalik commented Feb 3, 2026

Well, in the batch mode there is indeed no window but this code changes the canvas size. And I would say, for compatibility reasons, should work properly. Otherwise macro run in batch mode will produce wrongly sized canvases.

@ferdymercury
Copy link
Collaborator

related: #11004 and c3de92f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants