Skip to content

Send CTabFolder Resize when the client area changes without a resize - #3906

Merged
HeikoKlare merged 1 commit into
eclipse-platform:masterfrom
HeikoKlare:ctabfolder-client-area-resize
Dec 3, 2026
Merged

HeikoKlare merged 1 commit into
eclipse-platform:masterfrom
HeikoKlare:ctabfolder-client-area-resize

Conversation

@HeikoKlare

@HeikoKlare HeikoKlare commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

What & Why

When the tab position, the border or the renderer of a CTabFolder changes, or its tab height with a renderer whose body trim depends on it (such as the e4 CTabRendering), the client area changes while the folder keeps its size. The selected tab's control then keeps its old bounds until the folder is resized, e.g. it overlaps the tabs after moving them to the bottom, and Resize listeners on the folder are not told about the new client area. This was raised in eclipse-platform/eclipse.platform.ui#4556 (comment), where content placed in the client area did not follow a tab height or renderer change.

CTabFolder already sends SWT.Resize when its client area changes without the folder being resized, as there is no dedicated event for that. With this change, each of the cases above notifies the folder's Resize listeners once and lays out the selected control in the new client area, while a real resize is still reported once. The deferred update used to compare the client area at its start and its end, but the setters had already changed the state both readings depend on. The folder now remembers the client area of its last Resize event and compares against that.

A renderer that changes its trim on its own and only redraws (such as CTabRendering.setPadding() for a CSS padding), minimizing the folder and a wrapped top-right control that changes its height still schedule no update; they are left for a follow-up.

How to test

The test shows that the selected tab's content follows client area changes without a resize of the folder.

  1. Run a snippet with a CTabFolder in a shell, one item whose control is a colored Composite, and a renderer subclass whose computeTrim(PART_BODY, ...) adds getTabHeight() to the top.
  2. Without resizing the shell, call in turn: setTabHeight(50), setRenderer(null) and setTabPosition(SWT.BOTTOM).
  3. Without the change, the colored content keeps its old bounds after each call (it overlaps the tabs or leaves a gap) until the shell is resized. With the change, it follows the new client area right away.

Steps 1 to 3 were performed on Windows for setTabHeight and setRenderer with the earlier version of this PR; with the current version, setTabPosition, GTK and macOS are unverified.

🤖 Generated with Claude Code

@HeikoKlare
HeikoKlare force-pushed the ctabfolder-client-area-resize branch from 725052d to 84e4dd3 Compare November 29, 2026 21:29
@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

 1 124 files  + 8   1 124 suites  +8   1h 45m 16s ⏱️ + 12m 24s
 5 398 tests + 9   5 370 ✅ +12     28 💤 ±0  0 ❌  - 3 
31 730 runs  +88  28 198 ✅ +91  3 532 💤 ±0  0 ❌  - 3 

Results for commit 3ad6f04. ± Comparison against base commit 605fe31.

♻️ This comment has been updated with latest results.

@HeikoKlare
HeikoKlare force-pushed the ctabfolder-client-area-resize branch from 84e4dd3 to 4d38320 Compare November 30, 2026 07:48
@HeikoKlare
HeikoKlare marked this pull request as ready for review November 30, 2026 07:52
@HeikoKlare
HeikoKlare requested a balanced review from Copilot November 30, 2026 11:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The resize handler caches header-control events and premature wrapping state, which can leave content bounds stale or trigger duplicate folder notifications.

1 open issue
What changed in this PR

This PR updates SWT’s CTabFolder to report client-area changes without requiring a widget resize, addressing stale content bounds such as the workbench onboarding layout issue.

Changes:

  • Tracks the client area recorded during Resize events for comparison in deferred updates.
  • Adds regression tests for tab height, renderer, tab position, border visibility, and duplicate notifications.
File Description
tests/​org.eclipse.swt.tests/​JUnit Tests/​org/​eclipse/​swt/​tests/​junit/​Test_org_eclipse_swt_custom_CTabFolder.java Tests resize notifications and selected-control bounds after client-area changes.
bundles/​org.eclipse.swt/​Eclipse SWT Custom Widgets/​common/​org/​eclipse/​swt/​custom/​CTabFolder.java Adds saved client-area tracking to detect changes during deferred updates.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Before the first Resize event, the null client-area baseline can suppress notification of a trim-induced change, requiring initialization before trim setters run and regression coverage for that case.

1 open issue
1 resolved since last review

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The review reports no active issues with the CTabFolder resize-notification changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@HeikoKlare
HeikoKlare force-pushed the ctabfolder-client-area-resize branch 2 times, most recently from 9b7adfb to b3dfd35 Compare December 2, 2026 13:17
@HeikoKlare
HeikoKlare requested a balanced review from Copilot December 2, 2026 13:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Tooltip refresh can reenter updates and emit duplicate Resize events, while pending updates can still flush during painting and trigger Resize events and layout.

2 open issues

Review effort: Balanced

@HeikoKlare
HeikoKlare force-pushed the ctabfolder-client-area-resize branch 2 times, most recently from 0222074 to a3a0505 Compare December 3, 2026 09:17
@HeikoKlare
HeikoKlare requested a balanced review from Copilot December 3, 2026 09:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Trim-change updates can still trigger synchronous Resize events and layout during painting when bounds getters flush pending flags; the deferral logic and regression coverage need correction.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@HeikoKlare
HeikoKlare force-pushed the ctabfolder-client-area-resize branch from a3a0505 to f4a7787 Compare December 3, 2026 16:25
@HeikoKlare
HeikoKlare requested a balanced review from Copilot December 3, 2026 17:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the CTabFolder client-area notification and layout changes.

No open issues 🎉

Review effort: Balanced

When the tab position, the border or the renderer of a CTabFolder
changes, or its tab height with a renderer whose body trim depends on
it, the client area changes while the folder keeps its size. The
selected tab's control keeps its old bounds until the folder is resized,
for example it overlaps the tabs after moving them to the bottom, and
Resize listeners on the folder are not told about the new client area.

Now each of these changes notifies the folder's Resize listeners once
and lays out the selected control in the new client area, while a real
resize is still reported once. The deferred update used to compare the
client area at its start and its end, but the setters had already
changed the state both readings depend on, so it saw no difference. The
folder now remembers the client area of its last Resize and compares
against that.

A renderer that changes its trim on its own and only redraws (such as
CTabRendering for a CSS padding), minimizing the folder and a wrapped
top right control that changes its height still schedule no update,
and a resize that changes the client area while an update is pending
and a folder tooltip is set can still send a second Resize.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
@HeikoKlare
HeikoKlare force-pushed the ctabfolder-client-area-resize branch from f4a7787 to 3ad6f04 Compare December 3, 2026 18:31
@HeikoKlare
HeikoKlare merged commit ceee3cd into eclipse-platform:master Dec 3, 2026
28 of 29 checks passed
@HeikoKlare
HeikoKlare deleted the ctabfolder-client-area-resize branch December 3, 2026 19:16
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.

2 participants