Bug 501491 - [Graphics] Replace custom drawing on close button
Summary: [Graphics] Replace custom drawing on close button
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.5   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.21 M3   Edit
Assignee: Lars Vogel CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy, usability
: 538710 560134 (view as bug list)
Depends on: 466511
Blocks: 575395 430166 574014 575398 575563
  Show dependency tree
 
Reported: 2016-09-15 08:17 EDT by Lars Vogel CLA
Modified: 2021-10-25 14:28 EDT (History)
18 users (show)

See Also:


Attachments
Close icon on Windows in the dark theme (1.72 KB, image/png)
2018-10-29 09:35 EDT, Lars Vogel CLA
no flags Details
Screenshot - Aliased vs Anti-Aliased close button (7.21 KB, image/png)
2019-01-24 10:12 EST, Mike Marchand CLA
no flags Details
patch that draws antialised close button (979 bytes, application/octet-stream)
2019-01-30 15:12 EST, Mike Marchand CLA
no flags Details
disappearing tabs (21.43 MB, video/mp4)
2019-02-01 16:44 EST, Andrey Loskutov CLA
no flags Details
GC Polygon Drawing test (2.36 KB, image/png)
2019-02-03 13:57 EST, Mike Marchand CLA
no flags Details
Close light Linux (48.87 KB, image/png)
2020-05-26 05:39 EDT, Lars Vogel CLA
no flags Details
New close button on dark Linux (48.52 KB, image/png)
2020-05-26 05:46 EDT, Lars Vogel CLA
no flags Details
Screenshot (26.19 KB, image/png)
2020-09-02 04:40 EDT, Lars Vogel CLA
no flags Details
svg file (1.86 KB, image/svg+xml)
2020-10-09 08:52 EDT, Lars Vogel CLA
no flags Details
This is how it looks with patchset 16 on macOS with high resolution display (134.41 KB, image/png)
2020-10-09 10:16 EDT, Matthias Becker CLA
no flags Details
Close with gc.drawString on dark Linux (39.30 KB, image/png)
2020-10-29 10:51 EDT, Lars Vogel CLA
no flags Details
Close with gc.drawString on light Linux (38.70 KB, image/png)
2020-10-29 10:51 EDT, Lars Vogel CLA
no flags Details
Screenshot on macOS in classic, light, dark and system theme (118.67 KB, image/png)
2020-10-29 11:40 EDT, Matthias Becker CLA
no flags Details
Result with patchset 36 on macOS (124.19 KB, image/png)
2020-11-10 08:51 EST, Matthias Becker CLA
no flags Details
Gc solution on Linux - Dark theme (32.58 KB, image/png)
2021-08-11 05:44 EDT, Lars Vogel CLA
no flags Details
Gc solution on Linux - Light theme (34.83 KB, image/png)
2021-08-11 05:45 EDT, Lars Vogel CLA
no flags Details
Screenshot with https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/183887 on macOS (30.84 KB, image/png)
2021-08-12 06:50 EDT, Matthias Becker CLA
no flags Details
Linux Light side by side (933.09 KB, image/png)
2021-08-12 07:41 EDT, Lars Vogel CLA
no flags Details
Strong close color (81.11 KB, image/png)
2021-08-13 06:28 EDT, Lars Vogel CLA
no flags Details
Size changes on hover (232.79 KB, video/quicktime)
2021-08-13 06:59 EDT, Matthias Becker CLA
no flags Details
make "hot" state as thin as "normal" state (139.05 KB, video/quicktime)
2021-08-13 08:30 EDT, Matthias Becker CLA
no flags Details
making the normal state as thicl as the "hot " state (138.82 KB, video/quicktime)
2021-08-13 08:31 EDT, Matthias Becker CLA
no flags Details
hot line width used for non-hot state (118.66 KB, image/png)
2021-08-13 08:56 EDT, Andrey Loskutov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2016-09-15 08:17:03 EDT
+++ This bug was initially created as a clone of Bug #466511 +++

The custom drawing should be replaced with png icons. This would result in a more consistent user interface (IMHO the close button looks really bad on Mac).

This should also help with the work of supporting high resolution displays, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=382972#c51

Modification is needed in CTabFolderRenderer#drawClose
Comment 1 Lars Vogel CLA 2018-10-29 08:37:48 EDT
*** Bug 538710 has been marked as a duplicate of this bug. ***
Comment 2 Thomas Wolf CLA 2018-10-29 08:53:28 EDT
(In reply to Lars Vogel from comment #0)
> IMHO the close button looks really bad on Mac

I work daily with Eclipse on Mac (many hours a day, too). It has _never_ occurred to me that the close button looked bad. It's perfectly fine as it is for me.
Comment 3 Lars Vogel CLA 2018-10-29 09:35:54 EDT
Created attachment 276409 [details]
Close icon on Windows in the dark theme

Attached a screenshot of the close icon on Windows in the dark theme
Comment 4 Mike Marchand CLA 2019-01-24 10:12:09 EST
Created attachment 277269 [details]
Screenshot - Aliased vs Anti-Aliased close button
Comment 5 Mike Marchand CLA 2019-01-24 10:17:32 EST
I just encountered this issue on Windows while working on a Dark Theme for our product.  It turns out that the issue is just that the close shape needs to be drawn anti-aliased.

Unfortunately for me, extending the behavior of CTabFolderRenderer is not a straightforward task due to the private nature of many required members and functions.  Fortunately, fixing it on the SWT CTabFolderRenderer should be a rather simple change.  

In my custom renderer, I just called gc.setAntialiased(SWT.ON) at the beginning of drawClose and set it back to it's original value at the end of drawClose.  I see that there is an antialias() function call, perhaps it would have been more appropriate to use that method.
Comment 6 Lars Vogel CLA 2019-01-24 22:59:59 EST
Please provide a Gerrit patch to fix this in standard.
Comment 7 Lars Vogel CLA 2019-01-29 04:41:47 EST
(In reply to Mike Marchand from comment #5)
> I just encountered this issue on Windows while working on a Dark Theme for
> our product.  It turns out that the issue is just that the close shape needs
> to be drawn anti-aliased.

Mike, if you need help with Gerrit, please feel free to ping me via Lars.Vogel@vogella.com. I also documented it here: http://www.vogella.com/tutorials/EclipsePlatformDevelopment/article.html#exericse-eclipse-user-creation-and-gerrit-server-configuration

In our hackathons the setup usually is done in 5-10 mins + the time required to clone the repo.
Comment 8 Mike Marchand CLA 2019-01-30 15:12:50 EST
Created attachment 277389 [details]
patch that draws antialised close button

This patch will draw the close button anti-aliased.
Comment 9 Lars Vogel CLA 2019-01-30 15:15:34 EST
(In reply to Mike Marchand from comment #8)
> Created attachment 277389 [details]
> patch that draws antialised close button
> 
> This patch will draw the close button anti-aliased.

Please provide a Gerrit ;-)
Comment 10 Eclipse Genie CLA 2019-01-30 15:32:31 EST
New Gerrit change created: https://git.eclipse.org/r/136043
Comment 12 Andrey Loskutov CLA 2019-02-01 16:36:20 EST
(In reply to Eclipse Genie from comment #10)
> New Gerrit change created: https://git.eclipse.org/r/136043

This caused a *very* bad regression on Windows, if themes are disabled (and so less repaints are triggered). Open two editors. Hover the mouse from right to left over the editor tabs. As soon as the mouse goes over the close button, original tab content disappears and is never drawn until the mouse hovers over the empty area.

I'm going to revert this commit.
Comment 13 Eclipse Genie CLA 2019-02-01 16:38:05 EST
New Gerrit change created: https://git.eclipse.org/r/136170
Comment 14 Andrey Loskutov CLA 2019-02-01 16:44:14 EST
Created attachment 277407 [details]
disappearing tabs

I've recorded video, for some reason mouse position is off by few pixels, it should be hovering over tabs.
Comment 15 Mike Marchand CLA 2019-02-01 18:13:25 EST
Thanks Andrey.  I can reproduce the problem.  I'm not certain what the appropriate fix is... investigating.
Comment 16 Mike Marchand CLA 2019-02-01 19:18:46 EST
The root cause of the drawClose looking so bad is simply because 

gc.fillPolygon
and
gc.drawPolygon

do not draw to the same pixels with the same shape (When antialiasing is not enabled)

There appears to be an off by negative one bug in the X coordinates.

If I adjust the shape's x coordinates by +1 for the fillPoly, it will align correctly with the drawPoly.

Lars, could you please advise?  I'm not sure what the appropriate plan of attack here is.  Should we file a Bug against the GC?

To my knowledge, this is a problem on all platforms (Except Mac because to my knowledge Mac performs anti-aliasing by default)
Comment 17 Andrey Loskutov CLA 2019-02-02 03:08:14 EST
(In reply to Mike Marchand from comment #16)
> The root cause of the drawClose looking so bad is simply because 
> 
> gc.fillPolygon
> and
> gc.drawPolygon
> 
> do not draw to the same pixels with the same shape (When antialiasing is not
> enabled)
> 
> There appears to be an off by negative one bug in the X coordinates.
> 
> If I adjust the shape's x coordinates by +1 for the fillPoly, it will align
> correctly with the drawPoly.
> 
> Lars, could you please advise?  I'm not sure what the appropriate plan of
> attack here is.  Should we file a Bug against the GC?
> 
> To my knowledge, this is a problem on all platforms (Except Mac because to
> my knowledge Mac performs anti-aliasing by default)

I'm not sure I can follow without the code. So you mean, with same arguments given, the shapes of gc.drawPoligon and gc.fillPolygon differ? But is this not what expected, the "fill" should fill *inside* and "draw" the "border" of the polygon? What does the javadoc say?
Comment 18 Andrey Loskutov CLA 2019-02-02 05:34:19 EST
(In reply to Andrey Loskutov from comment #17)
> So you mean, with same arguments
> given, the shapes of gc.drawPoligon and gc.fillPolygon differ? But is this
> not what expected, the "fill" should fill *inside* and "draw" the "border"
> of the polygon? What does the javadoc say?

Javadoc says what I've expected: the "fill" paints *inside* the area.

I plan to submit reverted patch today before next SDK build, because I can't work with disappearing tabs anymore. If you have a patch to share, feel free to do so. I've quickly played with the patch, one thing I wonder is: why is the *unrelated* tab disappears (we hover over the close button of *another* tab)? Looks like while painting of the close button we paint way more we should. This could be the hint to start fixing the problem.
Comment 19 Lars Vogel CLA 2019-02-02 07:39:58 EST
+1 for revert, we can work on a correct fix after the revert.
Comment 21 Mike Marchand CLA 2019-02-03 13:57:01 EST
Created attachment 277416 [details]
GC Polygon Drawing test

This Bug is actually caused by Bug #139791.
Comment 22 Andrey Loskutov CLA 2019-02-03 14:03:14 EST
(In reply to Mike Marchand from comment #21)
> Created attachment 277416 [details]
> GC Polygon Drawing test
> 
> This Bug is actually caused by Bug #139791.

Cool. Bug from 2006, *at least*.
Comment 23 Mike Marchand CLA 2019-02-03 14:07:31 EST
Although the Antialiased solution seemed to make the 'x' look better, if you zoom in, you can still see that the fill is not drawn properly within the outline.
Comment 24 Mike Marchand CLA 2019-02-03 15:20:46 EST
This is the Win32 GC fillPolygon fix.
New Gerrit change created: https://git.eclipse.org/r/136209
Comment 25 Mike Marchand CLA 2019-02-03 16:31:34 EST
It is worth mentioning that we do not notice this issue without a theme or on Light theme because the fill color is the same color as the background color.  On Dark theme, the fill color is no longer the same color as the default color, which allows us to see that the fill is outside the outline.
Comment 26 Mike Marchand CLA 2019-02-04 12:22:13 EST
Bug #139791 has been resolved and merged to Master.  We should also be able to mark this Bug as resolved.
Comment 27 Andrey Loskutov CLA 2019-02-04 12:27:10 EST
(In reply to Mike Marchand from comment #26)
> Bug #139791 has been resolved and merged to Master.  We should also be able
> to mark this Bug as resolved.

But your patch is reverted - don't we need it again?
Comment 28 Mike Marchand CLA 2019-02-04 12:33:22 EST
(In reply to Andrey Loskutov from comment #27)
> (In reply to Mike Marchand from comment #26)
> > Bug #139791 has been resolved and merged to Master.  We should also be able
> > to mark this Bug as resolved.
> 
> But your patch is reverted - don't we need it again?

Oh, the bug we fixed does not resolve the disappearing tab problem.  It resolves an issue with how fillPolygon works (That was the 13 year old bug).  

The close button always looked good without a theme because the close button's fill color and the background color were the same, which means we couldn't tell that there was a drawing glitch happening.  On a dark theme, this became apparent because the background and fill are different colors.
Comment 29 Mike Marchand CLA 2019-02-04 12:36:50 EST
But since we are no longer using my patch (with anti-aliasing), there wont be any problems (which wouldn't already exist beforehand) with disappearing tabs.

Since you've mentioned it, I've seen a tab disappear once while using dark theme on a 4.10 installation.  Not sure about the cause or how reproducible the problem is though.
Comment 30 Mike Marchand CLA 2019-02-04 13:26:53 EST
FYI, the tab disappearing has already been reported in Bug #428697
Comment 31 Lars Vogel CLA 2020-05-26 05:33:16 EDT
*** Bug 560134 has been marked as a duplicate of this bug. ***
Comment 32 Lars Vogel CLA 2020-05-26 05:39:04 EDT
Created attachment 283014 [details]
Close light Linux
Comment 33 Lars Vogel CLA 2020-05-26 05:46:02 EDT
Created attachment 283016 [details]
New close button on dark Linux
Comment 34 Eclipse Genie CLA 2020-05-26 06:07:34 EDT
New Gerrit change created: https://git.eclipse.org/r/163593
Comment 35 Lars Vogel CLA 2020-05-26 06:09:21 EDT
(In reply to Eclipse Genie from comment #34)
> New Gerrit change created: https://git.eclipse.org/r/163593

With this change, we would use a tab close icon similar to VsCode, Browsers (Chrome
close icon) and Android
application. The basis for this icon is taken from the free material
icons from Google for Android.

WDYT?
Comment 36 Andrew Obuchowicz CLA 2020-05-26 08:41:44 EDT
(In reply to Lars Vogel from comment #35)
> (In reply to Eclipse Genie from comment #34)
> > New Gerrit change created: https://git.eclipse.org/r/163593
> 
> With this change, we would use a tab close icon similar to VsCode, Browsers
> (Chrome
> close icon) and Android
> application. The basis for this icon is taken from the free material
> icons from Google for Android.
> 
> WDYT?

I'm +1 for this change (once it's ready).

I prefer the look of the new suggested close buttons compared to the old ones. Looks cleaner IMO.

Also, would it be feasible to implement this in pure-gc? Meaning there's no icon file, but instead the icon is drawn? It would have the advantage of being themeable. 

However, maybe SVG's can be recoloured programmatically within Platform? If this is the case, then using a pure-gc approach seems redundant and a waste of ressources.
Comment 37 Lars Vogel CLA 2020-05-26 08:43:56 EDT
(In reply to Andrew Obuchowicz from comment #36) 
> Also, would it be feasible to implement this in pure-gc? Meaning there's no
> icon file, but instead the icon is drawn? It would have the advantage of
> being themeable. 

We use images almost everywhere, so I would prefer to remove this almost single usage of gc for creating icons.
Comment 38 Matthias Becker CLA 2020-05-26 08:47:04 EDT
(In reply to Andrew Obuchowicz from comment #36)
> Also, would it be feasible to implement this in pure-gc? Meaning there's no
> icon file, but instead the icon is drawn? It would have the advantage of
> being themeable. 
We should rather add the feature to replace icons via themes.
Comment 39 Lars Vogel CLA 2020-05-26 08:47:51 EDT
(In reply to Matthias Becker from comment #38)
> (In reply to Andrew Obuchowicz from comment #36)
> > Also, would it be feasible to implement this in pure-gc? Meaning there's no
> > icon file, but instead the icon is drawn? It would have the advantage of
> > being themeable. 
> We should rather add the feature to replace icons via themes.

+1
Comment 40 Eclipse Genie CLA 2020-06-10 11:18:20 EDT
New Gerrit change created: https://git.eclipse.org/r/164647
Comment 41 Lars Vogel CLA 2020-09-02 04:40:31 EDT
Created attachment 284018 [details]
Screenshot

Also close item is dark on Mac and light on Window
Comment 42 Niraj Modi CLA 2020-09-02 04:53:09 EDT
Mass move out to 4.18
Comment 43 Lars Vogel CLA 2020-10-09 08:52:36 EDT
Created attachment 284402 [details]
svg file
Comment 44 Matthias Becker CLA 2020-10-09 10:16:05 EDT
Created attachment 284403 [details]
This is how it looks with patchset 16 on macOS with high resolution display
Comment 45 Niraj Modi CLA 2020-10-14 04:41:05 EDT
IMO, We should add a new API in CTabFolder something like below:
CTabFolder.setCloseImage(Image image);

Advantages of this approach:
- Current implementation of drawing remains as default.
- SWT only acts as an enabler and doesn't provide any images as part of the toolkit.
- HiDPI close image management should remain in the client code.
Comment 46 Lars Vogel CLA 2020-10-29 10:51:41 EDT
Created attachment 284604 [details]
Close with gc.drawString on dark Linux
Comment 47 Lars Vogel CLA 2020-10-29 10:51:59 EDT
Created attachment 284605 [details]
Close with gc.drawString on light Linux
Comment 48 Lars Vogel CLA 2020-10-29 10:52:45 EDT
(In reply to Matthias Becker from comment #44)
> Created attachment 284403 [details]
> This is how it looks with patchset 16 on macOS with high resolution display

Can you test the latest patchset on Mac?
Comment 49 Matthias Becker CLA 2020-10-29 11:40:05 EDT
Created attachment 284608 [details]
Screenshot on macOS in classic, light, dark and system theme

For me the "x" looks not quite right. Maybe a bit too small. 
What font is that? Maybe we could check how it looks when we make it "bold".
Comment 50 Lars Vogel CLA 2020-10-29 12:23:17 EDT
(In reply to Matthias Becker from comment #49)
> Created attachment 284608 [details]
> Screenshot on macOS in classic, light, dark and system theme
> 
> For me the "x" looks not quite right. Maybe a bit too small. 

Looks fantastic to me.

> What font is that? Maybe we could check how it looks when we make it "bold".

It currently used the font of the receiver, but I think we should definitely fix it. I updated the Gerrit to use the chevronFont. Still looks fantastic to me.

Can you maybe play with the patch direct? I think you sense for aesthetic is much higher than mine. :-) 

To position the x you have to modify the x and y calculation.

int x = closeRect.x + Math.max(1, (closeRect.width-12));
int y = closeRect.y-1;
Comment 51 Lars Vogel CLA 2020-10-30 03:55:44 EDT
Matthias, unless you find a better font / setting I would suggest to merge the change after M2 so that we can fine tune it in graphics in M3.
Comment 52 Matthias Becker CLA 2020-10-30 07:25:17 EDT
(In reply to Lars Vogel from comment #51)
> Matthias, unless you find a better font / setting I would suggest to merge
> the change after M2 so that we can fine tune it in graphics in M3.

I am on vacation til next week. So I won't be able to work on that.
Comment 53 Matthias Becker CLA 2020-11-10 08:51:16 EST
Created attachment 284722 [details]
Result with patchset 36 on macOS
Comment 54 Thomas Wolf CLA 2020-11-13 06:07:34 EST
(In reply to Matthias Becker from comment #53)
> Created attachment 284722 [details]
> Result with patchset 36 on macOS

That's definitely ugly. Perhaps related to bug 568777?
Comment 55 Paul Pazderski CLA 2020-11-13 10:12:14 EST
I don't really get why use some arbitrary Unicode glyph for this. Yes it is convenient for scaling but seem to only bring more problems. There are already quite a lot problems with the limited amount of people involved in this bug. With the more diverse setups from all SWT users there will be more issues for sure.
Apparently there is not even a guarantee on the close "button" color. In Matthias screenshot (and if I see this Unicode glyph in my browser) it can be red instead of the actual font color. What if I configured my tab to have a red background too?
It also looks quite different on any platform where it is imo to large on Windows and in some cases it looks like someone made a tabTitle + "   X". As it is part of the title rather than a distinct control element. (and it lost the outline and select feature even if the last one isn't very useful before)

I would support Niraj's suggestion in comment 45.

Btw. I have no HiDPI monitor and therefore no HiDPI experience in SWT but if you just want an image for scaling stuff it should be easy to let the existing code draw into an image. The code does not care if the GC is from the paint event or an image.
Comment 56 Niraj Modi CLA 2020-11-18 04:55:18 EST
Hi Lars,
Checking if still planned for M3 ?
Comment 57 Lars Vogel CLA 2020-11-18 05:13:28 EST
(In reply to Niraj Modi from comment #56)
> Hi Lars,
> Checking if still planned for M3 ?

Thanks for checking. Lets revisit this for 4.19.
Comment 58 Niraj Modi CLA 2021-02-05 04:06:36 EST
Ping!
Is this still in plan for 4.19 ?
Comment 59 Alexander Kurtakov CLA 2021-02-15 03:35:46 EST
Too late for 4.19. Removing target milestone as it's unclear to me whether anyone is working on it.
Comment 60 Lars Vogel CLA 2021-08-11 05:41:59 EDT
As using unicode or png images did not work on all platform, I suggest we adjust drawing with gc to provide an improved icon.
Comment 61 Lars Vogel CLA 2021-08-11 05:44:52 EDT
Created attachment 286919 [details]
Gc solution on Linux - Dark theme
Comment 62 Lars Vogel CLA 2021-08-11 05:45:29 EDT
Created attachment 286920 [details]
Gc solution on Linux - Light theme
Comment 63 Eclipse Genie CLA 2021-08-11 05:48:50 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/183887
Comment 64 Matthias Becker CLA 2021-08-12 06:50:22 EDT
Created attachment 286924 [details]
Screenshot with https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/183887 on macOS

The new close icon looks really nice on macOS.
Looks good on all themes.
But I found one issue. The notification dialog still uses the old one.
Comment 65 Lars Vogel CLA 2021-08-12 07:03:07 EDT
(In reply to Matthias Becker from comment #64)
> Created attachment 286924 [details]
> Screenshot with
> https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/183887 on macOS
> 
> The new close icon looks really nice on macOS.
> Looks good on all themes.
> But I found one issue. The notification dialog still uses the old one.

Please open a new bug for that. The notification dialog uses a png file for its close button see /org.eclipse.jface.notifications/icons/eview16/notification-close.png. We can either update the png file or try to configure the shell to use the regular close functionality.
Comment 66 Andrey Loskutov CLA 2021-08-12 07:23:59 EDT
(In reply to Lars Vogel from comment #62)
> Created attachment 286920 [details]
> Gc solution on Linux - Light theme

The contrast seem to be worse with new code. Can we please have side to side screenshots old/new?

Originally the bug was about "custom drawing should be replaced with png icons" (see comment 0). That was considered more consistent (consistency with what?).

Now we change the way how they are drawn, quote from gerrit: "to look similar to common and popular tools like the Chrome browser or development tools like VScode."

Can we please have a clear goal defined for this bug, with clear success metric, so anyone can understand if the proposed patch makes sense and matches that metric?
Comment 67 Matthias Becker CLA 2021-08-12 07:33:58 EDT
(In reply to Andrey Loskutov from comment #66)
> The contrast seem to be worse with new code. Can we please have side to side
> screenshots old/new?

Yes the new one has finer lines compared to the current one. But the current one is really very heavy. I am unsure if the lines are too fine.
Comment 68 Lars Vogel CLA 2021-08-12 07:34:39 EDT
(In reply to Andrey Loskutov from comment #66)
> (In reply to Lars Vogel from comment #62)
> > Created attachment 286920 [details]
> > Gc solution on Linux - Light theme
> 
> The contrast seem to be worse with new code. Can we please have side to side
> screenshots old/new?

Sorry, screenshot of Linux is a bit old before the Gerrit was improved I push an update soon (with side by side).
 

> Can we please have a clear goal defined for this bug, with clear success
> metric, so anyone can understand if the proposed patch makes sense and
> matches that metric?

The target always was to make the close icon look better on Eclipse and more consistent with Eclipse itself (the close button on the shell) and other tools.

Originally I though we can archive this with png icons, then it looks like unicode was the way to go but both alternatives did not work. As it turns out adjusting the gc results in a nicer and consistent icon. The new icon is similar to the close icon on the Windows of Eclipse.
Comment 69 Lars Vogel CLA 2021-08-12 07:41:10 EDT
Created attachment 286925 [details]
Linux Light side by side
Comment 70 Andrey Loskutov CLA 2021-08-12 07:41:41 EDT
(In reply to Lars Vogel from comment #68)
> > Can we please have a clear goal defined for this bug, with clear success
> > metric, so anyone can understand if the proposed patch makes sense and
> > matches that metric?
> 
> The target always was to make the close icon look better on Eclipse 

don't get me wrong, but please define "better".

> and more
> consistent with Eclipse itself (the close button on the shell) and other
> tools.

OK, so please provide 3 icons side by side: original, new proposed, and the "close on the shell" that we are trying to match.

Also if I understand it right, the "red" color change is coming on top of that as a bonus?

I honestly hope we could have clear requirements and clear success criteria, especially if that is about "standards" of user interface in Eclipse.
Comment 71 Lars Vogel CLA 2021-08-12 07:46:16 EDT
(In reply to Andrey Loskutov from comment #70)
 
> don't get me wrong, but please define "better".

Please have a look at the screenshot. IMHO the old icon looks horrible and is not what the shell uses. 

> > and more
> > consistent with Eclipse itself (the close button on the shell) and other
> > tools.
> 
> OK, so please provide 3 icons side by side: original, new proposed, and the
> "close on the shell" that we are trying to match.

See see new attachment. Shell close icon is top-right side and only included once at it does not change.

> Also if I understand it right, the "red" color change is coming on top of that as a bonus?

The old color was not strong enough for the new icon according to the feedback in the Gerrit.
Comment 72 Andrey Loskutov CLA 2021-08-12 07:56:44 EDT
(In reply to Lars Vogel from comment #71)
> (In reply to Andrey Loskutov from comment #70)
>  
> > don't get me wrong, but please define "better".
> 
> Please have a look at the screenshot. IMHO the old icon looks horrible and
> is not what the shell uses. 

Again, "horrible" is not defined.

I find the old one just right.

The new icons are harder to read, and please note, the original system icon has really high contrast by using orange background color. The old one did this by using "borders". The new one is too "fine" drawn for me, so if you define "horrible" as "good contrast", and "better" as "reduced contrast", I would vote against the change.

Please define clear requirements and clear success criteria *without* using terms "better" or "horrible".
Comment 73 Lars Vogel CLA 2021-08-12 08:09:41 EDT
(In reply to Andrey Loskutov from comment #72)
> (In reply to Lars Vogel from comment #71)
> 
> Please define clear requirements and clear success criteria *without* using
> terms "better" or "horrible".

Similar looking to the standard close icon of the shell of Eclipse and other tools.
Comment 74 Thomas Wolf CLA 2021-08-12 17:57:07 EDT
(In reply to Lars Vogel from comment #73)
> (In reply to Andrey Loskutov from comment #72)
> > (In reply to Lars Vogel from comment #71)
> > 
> > Please define clear requirements and clear success criteria *without* using
> > terms "better" or "horrible".
> 
> Similar looking to the standard close icon of the shell of Eclipse and other
> tools.

Well, that is not attainable. On Mac, the close buttons on a shell are the red, yellow, and green dots.

A better metric is: this is SWT. The look and feel of SWT widgets, also custom widgets provided by SWT, should be as native as possible.

It can't be truly native since this is a custom widget, so some leeway must be given.

I'd declare success if Eclipse's close button in non-hot mode looks close enough to whatever is used normally on the corresponding platform to not stick out, contrast is OK in both hot and non-hot modes, and hot mode neither changes the button's glyph shape no does other crazy things. (So if on hover it turns into an emoji or starts playing a song or some such, I'll -2 it :-)

The current close button fails by this measure, on all three platforms.

Native look on Mac for closeable tabs appears indeed to be this plain cross, as can be seen in the Finder's tabs. As hover effect, the background is made (in light mode) a darker gray. (Darker gray rectangle with rounded corners).

Native look on Windows is also a plain cross, with the same hover effect. See for instance tabs in Microsoft Edge. Other web browsers seem to have converged on this same UI across platforms. (I only checked Firefox and Safari.) On Windows 10, the shell close button is also such a thin plain cross, as hover effect, the button gets a glaringly red background. The tab close button's cross is smaller, but appears to use also in non-hot mode a slightly thicker lines.

Native look on GTK/Adwaita on CentOS 7 for tabs appears to be also a plain cross, but with thicker lines, as can be seen for instance in gedit with multiple files open. As hover effect, the background becomes a brighter shade of gray. The shell close icon uses the same cross. Firefox uses the same cross and hover effect (darker gray) as on other platforms.

So I'd say this change is a step in the right direction. For me, the current implementation is good enough.

If there is consensus that contrast is not sufficient, one could try with slightly thicker lines (+1?) in non-hot mode, or if it's the contrast of the red vs. light or dark background, one could certainly find a color shade of red that works well in both modes.

I think a hover effect that makes the cross red is better than one that changes the background to dark gray. I find that *that* gives a really poor contrast. So I'd accept that deviation from apparently widely accepted standard.
Comment 75 Alexander Kurtakov CLA 2021-08-13 01:58:49 EDT
Thanks Thomas for the detailed analysis on all supported platforms. It made it clear that we need to move in that direction, I would say even do it with current patch and tweak later as it's already in the right direction.
Comment 76 Lars Vogel CLA 2021-08-13 06:28:56 EDT
Created attachment 286934 [details]
Strong close color

Andrey requested a stronger close color and Thomas suggested to use RGB(240, 64, 64).

Looks good to me. The suggestion is to merge this change and tweak to close color further if we see a need for it.
Comment 77 Matthias Becker CLA 2021-08-13 06:59:48 EDT
Created attachment 286936 [details]
Size changes on hover

I am unsure about the change in the line thickness.
Comment 78 Matthias Becker CLA 2021-08-13 08:30:32 EDT
Created attachment 286937 [details]
make "hot" state as thin as "normal" state

What about making the hot state as thin as the "normal " state?
Comment 79 Matthias Becker CLA 2021-08-13 08:31:24 EDT
Created attachment 286938 [details]
making the normal state as thicl as the "hot " state

What about making the normal state as thicl as the "hot " state?
Comment 80 Andrey Loskutov CLA 2021-08-13 08:56:32 EDT
Created attachment 286939 [details]
hot line width used for non-hot state

(In reply to Matthias Becker from comment #79)
> Created attachment 286938 [details]
> making the normal state as thicl as the "hot " state
> 
> What about making the normal state as thicl as the "hot " state?

This looks "too strong" on Linux, at least on non-HiDPI monitors. The current "non-hot" line width is 0 pixel, which GC then draws with 1 pixel, so adding 0 + 1 doesn't change anything, and adding 2 pixel like for the "hot" state draws too heavy icon, see attached picture.
Comment 81 Lars Vogel CLA 2021-08-13 09:16:29 EDT
(In reply to Andrey Loskutov from comment #80)
> Created attachment 286939 [details]
> hot line width used for non-hot state
> 
> (In reply to Matthias Becker from comment #79)
> > Created attachment 286938 [details]
> > making the normal state as thicl as the "hot " state
> > 
> > What about making the normal state as thicl as the "hot " state?
> 
> This looks "too strong" on Linux, at least on non-HiDPI monitors. The
> current "non-hot" line width is 0 pixel, which GC then draws with 1 pixel,
> so adding 0 + 1 doesn't change anything, and adding 2 pixel like for the
> "hot" state draws too heavy icon, see attached picture.

I opened Bug 575398 for fine tuning the color and line width.
Comment 82 Lars Vogel CLA 2021-08-13 09:17:26 EDT
Also created Bug 575395 to update the notification png files.
Comment 84 Lars Vogel CLA 2021-08-13 09:27:13 EDT
Thanks everyone for the discussion and thanks for everyone who tested the different approaches.

As the consensus seems to be that the new close icon is an improvement, I merged the change so that we can test and fine tune it in M3 or RC1 via Bug 575398.

I will also add this to N&N as soon as we have an official build with this change.
Comment 85 Eclipse Genie CLA 2021-08-16 05:13:18 EDT
New Gerrit change created: https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/184062
Comment 87 Ned Twigg CLA 2021-10-25 13:36:55 EDT
I am trying to restore the old close button for my SWT application. We have lots of screenshots in our documentation and other UI elements based on the old close button.

Can we make `void drawClose(GC gc, Rectangle closeRect, int closeImageState)` a protected method, rather than package-private? That way users can easily make a CTabFolderRenderer that overrides just the close button, and can put the old drawing code back in if they want:

https://github.com/diffplug/eclipse.platform.swt/commit/9a8d78ed435b81eb4a7fa3583d084e8b7593c543#diff-2989afee4bfc49a4a96e2612dea5130deae11347e86395bf444e874563a44c0b

The closest protected method is `protected void draw(int part, int state, Rectangle bounds, GC gc)`, but it is huge and makes extensive use of package-private variables and methods, which means that it isn't actually possible to override the close-button behavior to restore the previous behavior. I tried and you have to copy literally thousands of lines, and even still it doesn't work because you can't access package-private fields of CTabFolder.
Comment 88 Wim Jongman CLA 2021-10-25 14:28:12 EDT
(In reply to Ned Twigg from comment #87)
> I am trying to restore the old close button for my SWT application. We have
> lots of screenshots in our documentation and other UI elements based on the
> old close button.
> 
> Can we make `void drawClose(GC gc, Rectangle closeRect, int
> closeImageState)` a protected method, rather than package-private? That way
> users can easily make a CTabFolderRenderer that overrides just the close
> button, and can put the old drawing code back in if they want:
> 
> https://github.com/diffplug/eclipse.platform.swt/commit/
> 9a8d78ed435b81eb4a7fa3583d084e8b7593c543#diff-
> 2989afee4bfc49a4a96e2612dea5130deae11347e86395bf444e874563a44c0b
> 
> The closest protected method is `protected void draw(int part, int state,
> Rectangle bounds, GC gc)`, but it is huge and makes extensive use of
> package-private variables and methods, which means that it isn't actually
> possible to override the close-button behavior to restore the previous
> behavior. I tried and you have to copy literally thousands of lines, and
> even still it doesn't work because you can't access package-private fields
> of CTabFolder.

This bug is closed, Ned. Please open another issue. However, before you do that, you must realize that the chance that we are going to make API changes because you don't want to update your documentation, is very slim.