[graf2d] Fix Setting window size in batch mode#21136
Conversation
The current implementation doesn't make sense at all? Was it some accidentally commited code?
|
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 |
|
I have no idea why code looks like this but I prefer not to touch it. |
|
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. |
It was this commit by @couet suggested by Wile in 2017 281c670 According to Wile, it's because: 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 requested original “w” and “h”). |
|
I do not understand the logic behind it. In the batch mode Did Wile test his suggestion? Is there any trace in the issue or in the forum about that? Perhaps there was miscommunication and Wile's suggestion as implemented incorrectly? |
|
Ok, now I indeed understand, because But you see that this function will work properly only in this specific case, someone need to call it in this particular way, otherwise it will give wrong result. This is so wrong in my opinion. The logic is flaved here and should be handled different way. |
Yes, I agree all this is really messy. |
The current implementation doesn't make sense at all? Was it some accidentally committed code?
@linev It was your commit? Was it mistake?