Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.eclipse.e4.ui.workbench.renderers.swt;

import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.Objects;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
Expand Down Expand Up @@ -621,17 +622,29 @@ void drawSelectedTab(int itemIndex, GC gc, Rectangle bounds) {
}

if (selectedTabHighlightColor != null) {
Color oldBackground = gc.getBackground();
gc.setBackground(selectedTabHighlightColor);
boolean highlightOnTop = drawTabHighlightOnTop;
if (onBottom) {
highlightOnTop = !highlightOnTop;
}
int highlightHeight = 2;
int verticalOffset = highlightOnTop ? 0 : bounds.height - (highlightHeight - 1);
int horizontalOffset = itemIndex == 0 || cornerSize == SQUARE_CORNER ? 0 : 1;
int widthAdjustment = cornerSize == SQUARE_CORNER ? 0 : 1;
gc.fillRectangle(bounds.x + horizontalOffset, bounds.y + verticalOffset, bounds.width - widthAdjustment,
highlightHeight);
if (cornerSize == SQUARE_CORNER) {
int highlightHeight = 2 + (superimposeKeylineOutline && highlightOnTop ? OUTER_KEYLINE_WIDTH : 0);
int verticalOffset = highlightOnTop ? 0 : outlineBoundsForOutline.height - (highlightHeight - 1);
int horizontalOffset = itemIndex == 0 || cornerSize == SQUARE_CORNER ? 0 : 1;
int widthAdjustment = cornerSize == SQUARE_CORNER ? 0 : 1;
Comment on lines +634 to +635
Copy link
Contributor

Choose a reason for hiding this comment

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

Since cornerSize == SQUARE_CORNER in this branch, these variable can be completely removed, can't they?

gc.fillRectangle(outlineBoundsForOutline.x + horizontalOffset,
outlineBoundsForOutline.y + verticalOffset, outlineBoundsForOutline.width - widthAdjustment,
highlightHeight);
} else {
int[] highlightShape = Arrays.copyOf(tabOutlinePoints, tabOutlinePoints.length);
// Update Y coordinates in shape to apply highlight thickness
int thickness = 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't we need to apply the more complex calculation logic used for the SQUARE_CORNER case here? This seems to lead to hightlights that are far too thick:
image
image
Also note that there are blue-colored fragments remaining to the left and right. Seems like some more tweaking of the shape points is necessary.

Screenshots are taken at 175%.

int highlightY = onBottom ? bottomY - thickness : thickness + 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

This introduces a regression, as it uses onBottom instead of the highlightOnTop. I think there is even a mistake in the general distinction just based on cornerSize == SQUARE_CORNER. You will also need to draw a rectangle in case of round corners but when the highlight is not at the end with the rounding, i.e., if highlightOnTop != onBottom. So the condition for drawing a rectangle probably needs to be cornerSize == SQUARE_CORNER || highlightOnTop == onBottom.
image
image

highlightShape[1] = highlightShape[3] = highlightShape[highlightShape.length - 1] = highlightShape[highlightShape.length - 3] = highlightY;
gc.fillPolygon(highlightShape);
}
gc.setBackground(oldBackground);
}

if (backgroundPattern != null) {
Expand Down
Loading