Skip to content

[CTabFolder] Ask the renderer for the background of tab controls - #3548

Open
vogella wants to merge 2 commits into
eclipse-platform:masterfrom
vogella:ctabfolder-bkimage-tests
Open

vogella wants to merge 2 commits into
eclipse-platform:masterfrom
vogella:ctabfolder-bkimage-tests

Conversation

@vogella

@vogella vogella commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

A control placed in a CTabFolder with setTopRight was given the flat getBackground() whenever no gradient was set, and always when it had wrapped below the tab row. That assumes the folder background is a flat color at that position, which only holds for the built-in renderer. A renderer painting its own PART_BACKGROUND, as the IDE's CTabRendering does, uses different colors for the tab row and the body, so a view tool bar that wrapped showed a block of the tab row color sitting on the body strip.

With a custom renderer, the folder now renders PART_BACKGROUND for the control's position into a temporary image, takes the color at the middle of the control and sets it as a flat background. The control gets no background image, so no platform specific image inheritance is involved. The built-in renderer keeps its flat color, or its gradient image when a gradient is set. The temporary image is prefilled with getBackground(), because a renderer may leave pixels untouched where on screen the widget background shows through. setRenderer now refreshes the control backgrounds too.

Snippet394 reproduces it with a two tone renderer. Tests cover the wrapped case, the non-wrapped case with and without a gradient, a renderer that keeps the default background, a renderer set after layout, and the built-in renderer with a gradient.

Verified on GTK in a running IDE. On Windows (Dark and Dracula themes) there is no visible change: the wrapped band is painted with the folder background there, and the theme CSS sets the ToolbarComposite background explicitly. Themes which set swt-draw-custom-tab-content-background: false are not affected either.

@github-actions

github-actions Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

  212 files  ± 0    212 suites  ±0   30m 12s ⏱️ + 1m 32s
4 975 tests + 8  4 947 ✅ + 7   28 💤 +1  0 ❌ ±0 
7 252 runs  +42  7 058 ✅ +39  194 💤 +3  0 ❌ ±0 

Results for commit 32970b6. ± Comparison against base commit 36ea085.

♻️ This comment has been updated with latest results.

@vogella
vogella force-pushed the ctabfolder-bkimage-tests branch from 763c523 to 0826dd3 Compare September 14, 2026 15:13
@vogella
vogella marked this pull request as ready for review September 14, 2026 15:14
@vogella
vogella force-pushed the ctabfolder-bkimage-tests branch 2 times, most recently from abf78f8 to 9058a2c Compare September 22, 2026 11:19
updateBkImages() handed a control the flat getBackground() when it was
wrapped below the tab row, or when no gradient was set. That only holds for
the built-in renderer. One painting its own PART_BACKGROUND, like the IDE's
CTabRendering, uses different colors for tab row and body, so a wrapped view
tool bar showed a block of the tab row color on the body strip.

A custom renderer is now asked for the background. The image is prefilled
with getBackground() first, since a renderer may leave pixels untouched that
on screen show the widget background. setRenderer() refreshes the
backgrounds, since the renderer now decides between color and image.

Adds Snippet394.

Assisted-by: multiple AI agents and layers of automated tooling 🤖
@vogella
vogella force-pushed the ctabfolder-bkimage-tests branch from 9058a2c to 13a224d Compare September 22, 2026 11:23
…rers

A background image per top right control takes a different code path on
each platform. For a custom renderer, sample the color at the middle of
the control from the rendered background and set it as a flat color.
The built-in renderer keeps its gradient image.

Assisted-by: multiple AI agents and layers of automated tooling 🤖
@vogella

vogella commented Sep 28, 2026

Copy link
Copy Markdown
Contributor Author

On Windows no difference:

Before:

dark-overview

After:

dark-after

Will also re-test on Linux / GTK

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.

1 participant