|
18 | 18 | package org.eclipse.e4.ui.workbench.renderers.swt; |
19 | 19 |
|
20 | 20 | import java.lang.reflect.Field; |
| 21 | +import java.util.Arrays; |
21 | 22 | import java.util.Objects; |
22 | 23 | import org.eclipse.core.runtime.Platform; |
23 | 24 | import org.eclipse.core.runtime.preferences.IEclipsePreferences; |
@@ -621,17 +622,29 @@ void drawSelectedTab(int itemIndex, GC gc, Rectangle bounds) { |
621 | 622 | } |
622 | 623 |
|
623 | 624 | if (selectedTabHighlightColor != null) { |
| 625 | + Color oldBackground = gc.getBackground(); |
624 | 626 | gc.setBackground(selectedTabHighlightColor); |
625 | 627 | boolean highlightOnTop = drawTabHighlightOnTop; |
626 | 628 | if (onBottom) { |
627 | 629 | highlightOnTop = !highlightOnTop; |
628 | 630 | } |
629 | | - int highlightHeight = 2 + (superimposeKeylineOutline && highlightOnTop ? OUTER_KEYLINE_WIDTH : 0); |
630 | | - int verticalOffset = highlightOnTop ? 0 : outlineBoundsForOutline.height - (highlightHeight - 1); |
631 | | - int horizontalOffset = itemIndex == 0 || cornerSize == SQUARE_CORNER ? 0 : 1; |
632 | | - int widthAdjustment = cornerSize == SQUARE_CORNER ? 0 : 1; |
633 | | - gc.fillRectangle(outlineBoundsForOutline.x + horizontalOffset, outlineBoundsForOutline.y + verticalOffset, outlineBoundsForOutline.width - widthAdjustment, |
634 | | - highlightHeight); |
| 631 | + if (cornerSize == SQUARE_CORNER) { |
| 632 | + int highlightHeight = 2 + (superimposeKeylineOutline && highlightOnTop ? OUTER_KEYLINE_WIDTH : 0); |
| 633 | + int verticalOffset = highlightOnTop ? 0 : outlineBoundsForOutline.height - (highlightHeight - 1); |
| 634 | + int horizontalOffset = itemIndex == 0 || cornerSize == SQUARE_CORNER ? 0 : 1; |
| 635 | + int widthAdjustment = cornerSize == SQUARE_CORNER ? 0 : 1; |
| 636 | + gc.fillRectangle(outlineBoundsForOutline.x + horizontalOffset, |
| 637 | + outlineBoundsForOutline.y + verticalOffset, outlineBoundsForOutline.width - widthAdjustment, |
| 638 | + highlightHeight); |
| 639 | + } else { |
| 640 | + int[] highlightShape = Arrays.copyOf(tabOutlinePoints, tabOutlinePoints.length); |
| 641 | + // Update Y coordinates in shape to apply highlight thickness |
| 642 | + int thickness = 2; |
| 643 | + int highlightY = onBottom ? bottomY - thickness : thickness + 1; |
| 644 | + highlightShape[1] = highlightShape[3] = highlightShape[highlightShape.length - 1] = highlightShape[highlightShape.length - 3] = highlightY; |
| 645 | + gc.fillPolygon(highlightShape); |
| 646 | + } |
| 647 | + gc.setBackground(oldBackground); |
635 | 648 | } |
636 | 649 |
|
637 | 650 | if (backgroundPattern != null) { |
|
0 commit comments