Skip to content

Fix CTabFolder Trim Calculation logic #382

@amartya4256

Description

@amartya4256

Description
The CTabFolder trim is calculated using some magic numbers represented in points which can have adverse effect when scaled to pixels. Hence, it should be calculated in pixels and then converted into points using OfFloat variants to preserve inversibility.

Currently if we resize a CtabFolder (e.g. the project explorer tab), here's how the flow works:

  1. CTabFolder receives WM_SIZE callback and calls updateLayout.
  2. This calls CTabFolderLayout.layout.
  3. CTabFolderLayout.layout -> CTabFolder.getClientArea.

Inside getClientArea, there's a call to find the trim using renderer.computeTrim with zero width and height to find the padding. It uses CTabRendering as a renderer. Hence, the call: renderer.computeTrim(CTabFolderRenderer.PART_BODY, SWT.FILL, 0, 0, 0, 0); is just a hack to obtain the padding. We need a better way to find the padding instead.

Update: Inside the computeTrim method, the paddings are added as magic numbers and they didnot scale properly on fractional scaling factors in the past but, since now we have better scaling, could it be possible that we have circumvented this problem since now these values scale properly with the new implementation in DPIUtils.

Metadata

Metadata

Assignees

Labels

EnhancementA Request for an Enhancement of an Existing FeatureHiDPIA HiDPI-Related Issue or FeatureSWTIssue for SWT

Type

No type

Projects

Status

✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions