Skip to content

CTabRendering produces diagonal line for inactive square tabs #912

Closed
@apeteri

Description

@apeteri

I'm seeing this artifact in an RCP application that uses org.eclipse.e4.ui.workbench.renderers.swt_0.15.200.v20210816-1658, running on Windows 10 and 11, but the relevant code snippet seems to be present on master as well. I didn't encounter it in any version of the IDE however.

A small example that reproduces the issue:

Shell shell = new Shell(SWT.DIALOG_TRIM | SWT.PRIMARY_MODAL);
shell.setText("CTabRendering example");
shell.setLayout(new GridLayout(1, false));

CTabFolder folder = new CTabFolder(shell, SWT.NONE);
folder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

CTabRendering renderer = new CTabRendering(folder);
renderer.setShadowVisible(false);
renderer.setCornerRadius(0); // change to a value greater than 6 to enable rounded tabs
folder.setRenderer(renderer);

CTabItem tab1 = new CTabItem(folder, SWT.NONE);
tab1.setText("Folder tab 1");

shell.setSize(600, 500);
shell.open();

final Display display = shell.getDisplay();
while (!shell.isDisposed()) {
	if (!display.readAndDispatch()) { display.sleep(); }
}

The rendered result with square tabs:

image

With rounded tabs:

image

When the tab is rendered in inactive mode, the polyline skips visiting the upper right part and heads straight to the lower right corner:

points[index++] = endX;
points[index++] = bottomY;
if (active) {
points[index++] = parentSize.x - 1 - margin;
points[index++] = bottomY;
}
points[index++] = parentSize.x - 1 - margin;
points[index++] = parentSize.y - 1;

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions