Repository navigation
Send CTabFolder Resize when the client area changes without a resize - #3906
Conversation
725052d to
84e4dd3
Compare
84e4dd3 to
4d38320
Compare
There was a problem hiding this comment.
🟡 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
4d38320 to
de98c68
Compare
There was a problem hiding this comment.
🟡 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
9b7adfb to
b3dfd35
Compare
0222074 to
a3a0505
Compare
There was a problem hiding this comment.
🔵 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
a3a0505 to
f4a7787
Compare
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>
f4a7787 to
3ad6f04
Compare


What & Why
When the tab position, the border or the renderer of a
CTabFolderchanges, or its tab height with a renderer whose body trim depends on it (such as the e4CTabRendering), 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.CTabFolderalready sendsSWT.Resizewhen 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 CSSpadding), 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.
CTabFolderin a shell, one item whose control is a coloredComposite, and a renderer subclass whosecomputeTrim(PART_BODY, ...)addsgetTabHeight()to the top.setTabHeight(50),setRenderer(null)andsetTabPosition(SWT.BOTTOM).Steps 1 to 3 were performed on Windows for
setTabHeightandsetRendererwith the earlier version of this PR; with the current version,setTabPosition, GTK and macOS are unverified.🤖 Generated with Claude Code