|
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,26 @@ 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; |
630 | | - int verticalOffset = highlightOnTop ? 0 : bounds.height - (highlightHeight - 1); |
631 | | - int horizontalOffset = itemIndex == 0 || cornerSize == SQUARE_CORNER ? 0 : 1; |
632 | | - int widthAdjustment = cornerSize == SQUARE_CORNER ? 0 : 1; |
633 | | - gc.fillRectangle(bounds.x + horizontalOffset, bounds.y + verticalOffset, bounds.width - widthAdjustment, |
634 | | - highlightHeight); |
| 631 | + final int highlightHeight = 2 + (superimposeKeylineOutline && highlightOnTop ? OUTER_KEYLINE_WIDTH : 0); |
| 632 | + |
| 633 | + if (cornerSize == SQUARE_CORNER || highlightOnTop == onBottom) { |
| 634 | + int verticalOffset = highlightOnTop ? 0 : outlineBoundsForOutline.height - (highlightHeight - 1); |
| 635 | + gc.fillRectangle(outlineBoundsForOutline.x, outlineBoundsForOutline.y + verticalOffset, |
| 636 | + outlineBoundsForOutline.width, highlightHeight); |
| 637 | + } else { |
| 638 | + int[] highlightShape = Arrays.copyOfRange(tabOutlinePoints, 8, tabOutlinePoints.length - 8); |
| 639 | + int highlightY = highlightOnTop ? highlightHeight : outlineBoundsForOutline.height - highlightHeight; |
| 640 | + highlightShape[1] = highlightShape[3] = highlightShape[highlightShape.length |
| 641 | + - 1] = highlightShape[highlightShape.length - 3] = highlightY; |
| 642 | + gc.fillPolygon(highlightShape); |
| 643 | + } |
| 644 | + gc.setBackground(oldBackground); |
635 | 645 | } |
636 | 646 |
|
637 | 647 | if (backgroundPattern != null) { |
|
0 commit comments