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 @@ -620,18 +621,33 @@ void drawSelectedTab(int itemIndex, GC gc, Rectangle bounds) {
gc.drawLine(startX, 0, endX, 0);
}

if (TAB_OUTLINE_WIDTH > 0) {
gc.drawPolyline(tabOutlinePoints);
}

if (selectedTabHighlightColor != null) {
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);
final int highlightHeight = 2;
if (cornerSize == SQUARE_CORNER || highlightOnTop == onBottom) {
Copy link
Contributor

@arunjose696 arunjose696 Dec 30, 2025

Choose a reason for hiding this comment

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

@ShahzaibIbrahim I’m just slightly confused about the second part of the if condition (highlightOnTop == onBottom). I’m curious if there’s a scenario you’ve encountered where both highlightOnTop and onBottom are true. It would be interesting to test if this is something commonly reproducible in the IDE. I could see this complete flow is not triggered when running CustomControlExample so could not use it for reproduction

Apart from that, I’ve tested the changes at 100%, 150%, 200%, and 350% zoom levels, and the updates look good for both square and rounded tabs. The appearance is noticeably improved compared to the current master.

int verticalOffset = highlightOnTop ? 0 : outlineBoundsForOutline.height - (highlightHeight - 1);
gc.fillRectangle(outlineBoundsForOutline.x,
outlineBoundsForOutline.y + verticalOffset, outlineBoundsForOutline.width, highlightHeight);
} else {
boolean gcAdvanced = gc.getAdvanced();
gc.setAdvanced(false);
int[] highlightShape = Arrays.copyOfRange(tabOutlinePoints, 12, tabOutlinePoints.length - 12);
int highlightY = highlightOnTop ? highlightHeight
: outlineBoundsForOutline.height - highlightHeight;
highlightShape[1] = highlightShape[3] = highlightShape[highlightShape.length
- 1] = highlightShape[highlightShape.length - 3] = highlightY;
gc.fillPolygon(highlightShape);
gc.setForeground(tabOutlineColor);
gc.setAdvanced(gcAdvanced);
}
}

if (backgroundPattern != null) {
Expand All @@ -640,11 +656,6 @@ void drawSelectedTab(int itemIndex, GC gc, Rectangle bounds) {
if (foregroundPattern != null) {
foregroundPattern.dispose();
}

gc.setForeground(tabOutlineColor);
if (TAB_OUTLINE_WIDTH > 0) {
gc.drawPolyline(tabOutlinePoints);
}
}

void drawUnselectedTab(int itemIndex, GC gc, Rectangle bounds, int state) {
Expand Down
Loading