-
Notifications
You must be signed in to change notification settings - Fork 231
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
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.
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. |
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
|
b088af9 to
dfe590e
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 current proposal seems to work decently fine when tab headers are placed at the top. The only limitation we see is that the highlights that are draw at the bottom end of a tab header (at the side of the tab contents) are a bit off on some zoom.
Unfortunately, the current implementation is fully incompatible with CTabFolders that have their tab headers placed at the bottom. I simply tested by adapting the CTabFolder constructor to always use onBottom = true and get this:
![]()
![]()
Even though the current state is not that great either (in terms of the highlights not having consistent heights), this PR would currently break the highlighting for such tab folders completely (top/bottom is swapped, placement is wrong and sometimes even the whole header is highlighted).
|
@ShahzaibIbrahim I have created #3656 to overcome the current limitations (in particular with headers placed at the bottom) of this proposal without messing up this PR. Can you please validate the PR in itself and against this one? |
dfe590e to
d7a1fd5
Compare
I have overcome the current problems with onBottom = true, and adapted few changes from your PR. Here are the results.
|
d02437c to
821d87a
Compare
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.
5e92c7d to
d55095d
Compare
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've tested this again and so far found two issues:
First, in case the highlight is not on top of a header, the highlight looks slightly cut off at the left end on zoom higher than 100%:
![]()
This is caused by the highlight starting at the same x pixel coordinate than the outline, but since the highlight is drawn one pixel too low, the outline does not cover the highlight at than one pixel below the outline.
Since we found that we cannot easily fix this issue of being one pixel too low, we may just also start a bit more to the right (like done now) via something like:
// When the rectangle is drawn at the bottom, the outline may not fully cover
// the left pixel such that we should start one point to the right (even though
// we produce a slight gap then)
int xOffset = highlightOnTop ? 0 : 1;
gc.fillRectangle(outlineBoundsForOutline.x + xOffset, highlightY,
outlineBoundsForOutline.width - xOffset, highlightHeight);One more severe observation is that when using onBottom the highlight on top "flickers" (i.e., the line become one pixel smaller/larger) on 125% when changing the position of the header by dragging the according part larger and smaller:

Edit: the latter one is also present in the current master state, so even though we do not improve that, I would not make anything worse. So we can probably ignore that for now.
I don't see severe blockers for this PR anymore. The one issue mentioned in my last review should be resolved before merging.
d55095d to
5e5a656
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)
5e5a656 to
e8ba2fa
Compare
|
@HeikoKlare the mentioned issue with xOffset has been resolved. This PR is now ready for merging. |
akoch-yatta
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 tested it on Windows with and without rounded corner as well as with onBottom=true and false on the standard zooms in windows. Except the mentioned (pre-existing) issue, the behavior looks consistent over all zooms for me.






















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: