Skip to content

[graf2d] Change TCanvas arguments to canvas size#21156

Draft
rlalik wants to merge 1 commit intoroot-project:masterfrom
rlalik:fix_canvas_size
Draft

[graf2d] Change TCanvas arguments to canvas size#21156
rlalik wants to merge 1 commit intoroot-project:masterfrom
rlalik:fix_canvas_size

Conversation

@rlalik
Copy link
Contributor

@rlalik rlalik commented Feb 4, 2026

In the current ROOT, TCanvas constructor arguments were the window size. It caused some issues when the canvas created in batch and interactive mode as a result had different sizes, and some manual workarounds were required. It then also causes issue with saving resized canvas to macro as in the batch mode the size change was not preserved. Some of the discussions are https://root-forum.cern.ch/t/title-and-label-size-scaling-inconsistent-behaviour/64168 and https://root-forum.cern.ch/t/set-tcanvas-size-in-batch-mode/6626 and also #11004. Since the window decorations sizes are known and hardcoded one can reverse the old logic of determining the canvas size from window, to determine window size from canvas.

This Pull request:

  • changes meaning of arguments for TCanvas constructors
  • provides consistent canvas size between interactive and batch mode

Changes or fixes:

  • TCanvas constructor arguments ww and wh renamed to cw and ch - now, their meaning is the canvas size, not the window size
  • loginc inside TCanvas class to handle the new login

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

This PR fixes #11004

In the previous version, constructor arguments were the window size. It caused some issues when the canvas created in batch and interactive mode as a result had different sizes, and some manual workarounds were required. It then also causes issue with saving resized canvas to macro as in the batch mode the size change was not preserved. Some of the discussions are https://root-forum.cern.ch/t/title-and-label-size-scaling-inconsistent-behaviour/64168 and https://root-forum.cern.ch/t/set-tcanvas-size-in-batch-mode/6626.
Since the window decorations sizes are known and hardcoded one can reverse the old logic of determining the canvas size from window, to determine window size from canvas.
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.

TCanvas size is inconsistent in batch vs non-batch mode

2 participants