-
Notifications
You must be signed in to change notification settings - Fork 230
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?
Conversation
HeikoKlare
left a comment
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.
....ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/CTabRendering.java
Outdated
Show resolved
Hide resolved
b510ca2 to
8be0403
Compare
|
@HeikoKlare I found the problem. Here were drawing the tab from (0,0) pixel but still using initial item location (1,1) and hence the gap was visible. I also updated the height to 3 when we draw from (0,0) so we have enough height for the selection marker. The code that caused the gap: |
8be0403 to
c878f05
Compare
HeikoKlare
left a comment
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.
The appearance is in my opinion much better than before. I have some questions/remarks on the current propose.
And the appearance with round tabs now became worse (than it already was before):

We may probably do something similar than in SWT to draw a proper shape. The current adjustments by 1 point based on cornerSize do not look sufficient.
....ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/CTabRendering.java
Outdated
Show resolved
Hide resolved
....ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/CTabRendering.java
Outdated
Show resolved
Hide resolved
88fc99e to
a4713f9
Compare
No, it should be fully aligned at the top, left and right without any gaps at every zoom. |
|
@amartya4256 can you please retest this? Unfortunately, I have currently monitor available that I can set to 250%. Everything up to 225% looks fine to me. |
@ShahzaibIbrahim But maybe that would require another readaptation of the calculations. Shouldn't we just fix it right away? Then it would also make more sense to take into account the |
I have added a commit to put highlight on rounded tabs. Although it looks big jagged as original one (non-selected rounded tabs) also bit jagged. I have reused the shape. Here's the comparison of the selected and unselected tabs:
|
|
This pull request changes some projects for the first time in this development cycle. Warning 🚧 This PR cannot be modified by maintainers because edits are disabled or it is created from an organization repository. To obtain the required changes apply the git patch manually as an additional commit. Git patchFurther information are available in Common Build Issues - Missing version increments. |
691b22d to
fe5e96b
Compare
....ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/CTabRendering.java
Outdated
Show resolved
Hide resolved
....ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/CTabRendering.java
Outdated
Show resolved
Hide resolved
....ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/CTabRendering.java
Outdated
Show resolved
Hide resolved
ed8d36f to
d79a1fe
Compare
|
After latest adaptation, there is no more "Bleeding" on the very left and right. The selection highlight looks fine to me in different zoom levels. Also addressed the comments from you @HeikoKlare. Let me know if I miss something.
|
HeikoKlare
left a comment
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.
We seem to be coming closer. The code became much simpler and many scenarios now look good.
But with rounded corner, the highlight is still far too large. At 150%, it looks like this (compare to the "correct" hight for the non-focused "problem" view below):

When reducing the hight by 1, I see the rendering artifacts mentioned before again.
The screenshots in the previous post seem to be taken with some custom auto-scaling settings. The tab icons are not scaled according to the text, so probably monitor-specific scaling is disabled or some custom auto-scale configuration is active.
d79a1fe to
fbbfba3
Compare
HeikoKlare
left a comment
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.
I looks almost fine now. But the lines still do not have the same height, such that the highlight bar with rounded corners appear a bit too thick and prominent. These are the heights I get:
- 100%: round corners 3px, square corners 2px
- 175%: round corners 5px, square corners 4px
Here is the comparison of the highlight at 100% with round corners before (top) and after (bottom) this change:

The overall appearance is definitely much better, but the line is thicker now.
046398a to
c819bc8
Compare
|
Just measured it in my Runtime, the lower one is 3px, the upper one is 4px Doesn't that make sense as |
I can confirm this observation. |
91660bb to
0263dbe
Compare
....ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/CTabRendering.java
Show resolved
Hide resolved
....ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/CTabRendering.java
Outdated
Show resolved
Hide resolved
0263dbe to
9a76154
Compare
It's resolved now. |
....ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/CTabRendering.java
Outdated
Show resolved
Hide resolved
arunjose696
left a comment
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.
Approving this as the changes look fine on all tested zooms
HeikoKlare
left a comment
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.
| if (TAB_OUTLINE_WIDTH > 0) { | ||
| gc.drawPolyline(tabOutlinePoints); | ||
| } |
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.
I was wondering why the outline is now drawn first instead of after painting the highlight.
When taking a look at how it looks, it turns out that this PR now changes the placement of the highlight, such that it overwrites the outline:

While you do not notice that much with the default gray outline, this would look really odd if you have a colored outline. Since the gc.setForeground(tabOutlineColor) call has been accidentally removed, you will not notice as the color is simply missing.
Please move this call back or ensure by any other means that the outline remains properly drawn.
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.
I have reverted the outline to its original position. However as discussed to accommodate outline we had to increase the highlight height for squared tabs. Here is how it compares to rounded and bottom tabs.
This is the expected highlight size chart for different zooms
| Highlight Tab | Formula | In Points | 100 | 150 | 175 |
|---|---|---|---|---|---|
| Square Top | Round(pts * (zoom / 100) - 1(outline)) | 3pt | 3 | 4 | 4 |
| Bottom | Round(pts * (zoom / 100)) | 2pt | 2 | 3 | 4 |
| Rounded | Round(pts * (zoom / 100)) | 2pt | 2 | 3 | 4 |
4c8c3d9 to
a155737
Compare
HeikoKlare
left a comment
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.
4a6dcee to
58a5709
Compare
HeikoKlare
left a comment
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.
Now with the latest changes it is too small again when placed at the bottom. In this screenshot, the left is the state now and the right is the state with this PR (at 150% zoom):

This is also somehow expected as the offset calculation used bounds.height - (highlightHeight - 1) before andnow uses bounds.height - (highlightHeight).
May I also ask to test every combination (rounded/square, bottom/top, different zooms) for the next review iteration yourself first?
If you look the screenshot, the current state highlight is below the outline And the after change, the size is as per the chart that I mentioned here in the comment (i.e. 3px at 150%): #3533 (comment) |
|
Okay, I see the misplacement in the existing behavior. But it's misplaced with this PR as well, just in the opposite direction (it is placed too high instead too low). Note that the zoom I posted (150%) seems to actually have been incorrect for the screenshot. It must have been taken at 125%.
So why do we do it like that? While the highlight at the bottom was just misplaced before (at 125%), it is now misplaced and inconsistent to other highlights being show at the top (if not using round tabs, which is rather uncommon). Couldn't we draw an additional line (in addition to filling the rect) to compensate for the rounding error here? Since the outline is drawn at the y coordinate where the highlight is missing at 125%, it might be possible to compensate with that. |
58a5709 to
cea16ab
Compare
Selected tabs highlight look slightly off and more noticeable when zoom is not 100%. These adjusted value shows no gaps from top and better aligned highlights for tabs (Theme is enabled)
cea16ab to
b088af9
Compare
I have now drawn a line on very bottom (the filler space), although It will make it look slightly darker (I have updated the values in the chart, see description). Also I have tested on every zoom which to me looks good now. The highlight is right on the line. The latest push doesn't affect top highlights (square or rounded). Attaching the screenshot for bottom highlight for all the zoom:
Bottom Highlight with rounded tabs on top
|
























Selected tabs highlight look slightly off and more noticeable when zoom is not 100%. These adjusted value shows no gaps from top and better aligned highlights for tabs (Theme is enabled)
Results:
This is the expected highlight size chart for different zooms