Skip to content

CTabRendering produces diagonal line for inactive square tabs #912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
apeteri opened this issue Jul 5, 2023 · 2 comments · Fixed by #1333
Closed

CTabRendering produces diagonal line for inactive square tabs #912

apeteri opened this issue Jul 5, 2023 · 2 comments · Fixed by #1333
Assignees
Milestone

Comments

@apeteri
Copy link
Contributor

apeteri commented Jul 5, 2023

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;

@jukzi
Copy link
Contributor

jukzi commented Aug 31, 2023

@apeteri can you provide a Fix as Pull Request, please?

@apeteri
Copy link
Contributor Author

apeteri commented Nov 27, 2023

Added as #1333.

@jukzi jukzi linked a pull request Nov 27, 2023 that will close this issue
BeckerWdf pushed a commit that referenced this issue Dec 1, 2023
The last points in the polyline were visiting the lower right and lower
left corners of the CTabFolder's client area before heading back to the
starting point. These are now removed.

This makes "computeSquareTabOutline" behave the same way as
"computeRoundTabOutline" does, which did not attempt to draw lines
outside of the tab itself (also a horizontal leading/trailing line when
in active mode).
@BeckerWdf BeckerWdf added this to the 4.31 M1 milestone Dec 1, 2023
amartya4256 pushed a commit to amartya4256/eclipse.platform.ui that referenced this issue Dec 4, 2023
The last points in the polyline were visiting the lower right and lower
left corners of the CTabFolder's client area before heading back to the
starting point. These are now removed.

This makes "computeSquareTabOutline" behave the same way as
"computeRoundTabOutline" does, which did not attempt to draw lines
outside of the tab itself (also a horizontal leading/trailing line when
in active mode).
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 a pull request may close this issue.

3 participants