diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java index 4cf29174520..e30a81d68cb 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java @@ -14,6 +14,8 @@ *******************************************************************************/ package org.eclipse.swt.custom; +import java.util.*; + import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; @@ -93,8 +95,8 @@ public class CTabFolderRenderer { static final int BUTTON_FILL = SWT.COLOR_LIST_BACKGROUND; static final int BORDER1_COLOR = SWT.COLOR_WIDGET_NORMAL_SHADOW; - static final int ITEM_TOP_MARGIN = 2; - static final int ITEM_BOTTOM_MARGIN = 2; + static final int ITEM_TOP_MARGIN = 3; + static final int ITEM_BOTTOM_MARGIN = 3; static final int ITEM_LEFT_MARGIN = 4; static final int ITEM_RIGHT_MARGIN = 4; static final int INTERNAL_SPACING = 4; @@ -1380,10 +1382,23 @@ void drawSelected(int itemIndex, GC gc, Rectangle bounds, int state ) { // draw highlight marker of selected tab if (parent.selectionHighlightBarThickness > 0 && parent.simple) { - Color previousColor = gc.getBackground(); - gc.setBackground(item.getDisplay().getSystemColor(parent.shouldHighlight() ? SWT.COLOR_LIST_SELECTION : SWT.COLOR_WIDGET_DISABLED_FOREGROUND)); - gc.fillRectangle(x + 1 /* outline */, parent.onBottom ? y + height - 1 - parent.selectionHighlightBarThickness : y + 1, width - 2 /*outline*/, parent.selectionHighlightBarThickness); - gc.setBackground(previousColor); + int thickness = parent.selectionHighlightBarThickness; + boolean onBottom = parent.onBottom; + boolean highlight = parent.shouldHighlight(); + + Color oldBackground = gc.getBackground(); + Color highlightColor = item.getDisplay().getSystemColor( + highlight ? SWT.COLOR_LIST_SELECTION : SWT.COLOR_WIDGET_DISABLED_FOREGROUND); + gc.setBackground(highlightColor); + + int bottomY = y + height - 1; + int highlightY = onBottom ? bottomY - thickness : thickness + 1; + + int[] shape2 = Arrays.copyOf(shape, shape.length); + // Update Y coordinates in shape to apply highlight thickness + shape2[1] = shape2[3] = shape2[shape2.length - 1] = shape2[shape2.length - 3] = highlightY; + gc.fillPolygon(shape2); + gc.setBackground(oldBackground); } // draw outline