-
Notifications
You must be signed in to change notification settings - Fork 228
Adjust selection bounds for CTabRenderring #3533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
|
|
@@ -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; | ||
| 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; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 Screenshots are taken at 175%. |
||
| int highlightY = onBottom ? bottomY - thickness : thickness + 1; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This introduces a regression, as it uses |
||
| highlightShape[1] = highlightShape[3] = highlightShape[highlightShape.length - 1] = highlightShape[highlightShape.length - 3] = highlightY; | ||
| gc.fillPolygon(highlightShape); | ||
| } | ||
| gc.setBackground(oldBackground); | ||
| } | ||
|
|
||
| if (backgroundPattern != null) { | ||
|
|
||




There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since
cornerSize == SQUARE_CORNERin this branch, these variable can be completely removed, can't they?