Bug 577042 - [dark theme] Consider using native dark theme for windows buttons
Summary: [dark theme] Consider using native dark theme for windows buttons
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.22   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: 4.23 M2   Edit
Assignee: Alexandr Miloslavskiy CLA
QA Contact: Niraj Modi CLA
URL:
Whiteboard:
Keywords: noteworthy
Depends on: 23837
Blocks: 577357 578157 576614
  Show dependency tree
 
Reported: 2021-11-03 10:49 EDT by Lars Vogel CLA
Modified: 2022-12-01 15:17 EST (History)
7 users (show)

See Also:


Attachments
Win10 screenshot (9.24 KB, image/png)
2021-11-10 18:13 EST, Alexandr Miloslavskiy CLA
no flags Details
Win11 screenshot (9.62 KB, image/png)
2021-11-10 18:14 EST, Alexandr Miloslavskiy CLA
no flags Details
Win11_BeforePatch (10.26 KB, image/png)
2021-12-26 19:41 EST, Alexandr Miloslavskiy CLA
no flags Details
Win11_AfterPatch (10.34 KB, image/png)
2021-12-26 19:42 EST, Alexandr Miloslavskiy CLA
no flags Details
Screenshot - Side by side (103.49 KB, image/png)
2022-01-11 07:07 EST, Lars Vogel CLA
no flags Details
Win10 Eclipse before patches (96.35 KB, image/png)
2022-01-11 13:16 EST, Alexandr Miloslavskiy CLA
no flags Details
Win10 Eclipse after patches (95.26 KB, image/png)
2022-01-11 13:17 EST, Alexandr Miloslavskiy 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 2021-11-03 10:49:17 EDT
AFAIK we are currently using custom drawing for Windows to style the buttons. As Windows also has the native stying for windows toolbars, scrollbars, etc I assume we could also not set the background color and rely on the native dark styling of buttons.
Comment 1 Lars Vogel CLA 2021-11-03 10:50:46 EDT
Alexandr, does the dark mode on windows also affects the button background?
Comment 2 Alexandr Miloslavskiy CLA 2021-11-03 16:25:04 EDT
Indeed Windows has a custom dark theme for Button, 'DarkMode_Explorer::Button'.

I can look into that later.

If you're interested, try calling 'Display.maybeEnableDarkSystemTheme()' in 'Button.createHandle()' and see what happens.
Comment 3 Rolf Theunissen CLA 2021-11-09 08:12:53 EST
This themes are already (partly) used for the buttons, tough I expect that code is not robust, see also Bug 575352.
Comment 4 Alexandr Miloslavskiy CLA 2021-11-10 17:43:47 EST
Rolf, I'm not sure what you mean here.

My guess is that you're talking about 'Display.hButtonTheme'? I had a look now and it seems that it doesn't really affect buttons. Also, it doesn't seem to be connected to the undocumented 'DarkMode_Explorer::Button' in Win10.

Therefore, I understand that Lars's suggestion and my reply are up to date.
Comment 5 Alexandr Miloslavskiy CLA 2021-11-10 18:13:50 EST
Created attachment 287485 [details]
Win10 screenshot
Comment 6 Alexandr Miloslavskiy CLA 2021-11-10 18:14:49 EST
Created attachment 287486 [details]
Win11 screenshot
Comment 7 Alexandr Miloslavskiy CLA 2021-11-10 18:15:55 EST
On Win11, Button got rounded corners, and it's more obvious now that it has a white border in Dark Theme. Even though the difference is just a few pixels, it didn't catch my eye in Win10. Hopefully the undocumented Windows's Dark Theme will solve this.
Comment 8 Eclipse Genie CLA 2021-12-26 19:24:11 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/189151
Comment 9 Eclipse Genie CLA 2021-12-26 19:24:16 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/189152
Comment 10 Eclipse Genie CLA 2021-12-26 19:24:21 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/189153
Comment 11 Eclipse Genie CLA 2021-12-26 19:24:26 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/189154
Comment 12 Eclipse Genie CLA 2021-12-26 19:24:30 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/189155
Comment 13 Alexandr Miloslavskiy CLA 2021-12-26 19:32:35 EST
Here's what to pay attention to when using test snippet that I submitted along with patches:

1) It uses all combinations of Colors (Default, Light, Dark, Green) and
   Themes (Native Default, Native Light). For this reason, some controls always
   look weird: for example "Theme:Default Color:Default All:Dark" have barely
   readable labels in Check/Radio, because by default, they have black text.
   With simple words, if you notice something weird, pay attention to what
   combination you're looking at.
2) Native dark theme only affects Push/Toggle currently. As of Win11, they don't
   have support for check/radio.
3) There's a colors selector at the bottom.
Comment 14 Alexandr Miloslavskiy CLA 2021-12-26 19:41:40 EST
Created attachment 287737 [details]
Win11_BeforePatch
Comment 15 Alexandr Miloslavskiy CLA 2021-12-26 19:42:00 EST
Created attachment 287738 [details]
Win11_AfterPatch
Comment 16 Alexandr Miloslavskiy CLA 2021-12-26 19:52:05 EST
Lars, with this series of patches, it is no longer needed to set custom Button colors on Win10+. It also fixes a few other visual problems. Eclipse will activate this patch automatically because it's connected to the old Display.setData() property already used in Eclipse.

Enjoy your slightly late Christmas present :)
I trust that you will do Eclipse testing?
Comment 19 Lars Vogel CLA 2022-01-07 05:53:08 EST
(In reply to Alexandr Miloslavskiy from comment #16)

> Enjoy your slightly late Christmas present :)

Awesome, thanks. Sorry was in vacation so I did not see your update.
Comment 20 Alexandr Miloslavskiy CLA 2022-01-07 16:58:56 EST
Lars, please give it a try.
Comment 23 Lars Vogel CLA 2022-01-11 06:16:51 EST
(In reply to Alexandr Miloslavskiy from comment #20)
> Lars, please give it a try.

In the default dark theme, Eclipse looks the same (for me). I assume the current dark theme which styles button triggers the custom drawing code. I plan to remove the dark styling for buttons via Bug 578157.
Comment 24 Alexandr Miloslavskiy CLA 2022-01-11 06:43:51 EST
Are you on Win10 or Win11?
Either way, Eclipse shouldn't look the same. The thick light frame around buttons should be no more, that's the most visible change. See screenshots attached in this Bug.
Comment 25 Lars Vogel CLA 2022-01-11 07:07:57 EST
Created attachment 287813 [details]
Screenshot - Side by side

(In reply to Alexandr Miloslavskiy from comment #24)
> Are you on Win10 or Win11?
> Either way, Eclipse shouldn't look the same. The thick light frame around
> buttons should be no more, that's the most visible change. See screenshots
> attached in this Bug.

This is what I see. The gray border in 2022 is focus related. I also get it in 2021-12 if I focus the dialog.
Comment 26 Lars Vogel CLA 2022-01-11 10:09:22 EST
> (In reply to Alexandr Miloslavskiy from comment #24)
> > Are you on Win10 or Win11?

I'm using Windows 10 Pro build 19042.1415
Comment 27 Alexandr Miloslavskiy CLA 2022-01-11 13:16:42 EST
Created attachment 287818 [details]
Win10 Eclipse before patches
Comment 28 Alexandr Miloslavskiy CLA 2022-01-11 13:17:18 EST
Created attachment 287819 [details]
Win10 Eclipse after patches

Lars, judging from your screenshots, you're testing without patches applied. Note that 'master' still doesn't have all patches. As for 'I20220110-0550' on the right of screenshot, it is missing even more patches that were merged yesterday.

I have posted proper screenshots from Win10 with and without patches.
Comment 30 Niraj Modi CLA 2022-01-12 07:40:47 EST
(In reply to Eclipse Genie from comment #29)
> Gerrit change
> https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/189155 was
> merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=528429b3f99c6b8ba46abcea00c0889506a7dea3

Thanks Alexandr for the efforts on this bug.

@Lars
All patches have been merged today, so next Eclipse IBuild should be good for testing.
Comment 31 Andrey Loskutov CLA 2022-01-15 05:15:25 EST
Note, that on Windows, PDE API reports a false positive error, see bug 578228.

I will push a fix in a moment.
Comment 32 Eclipse Genie CLA 2022-01-15 05:16:16 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/189672
Comment 34 Alexandr Miloslavskiy CLA 2022-01-16 17:16:55 EST
Thanks all for your assistance with this patch!
Comment 35 Lars Vogel CLA 2022-01-18 05:26:05 EST
Thanks for this work, Buttons under Windows look much nicer now.
Comment 36 Niraj Modi CLA 2022-01-18 06:29:58 EST
(In reply to Lars Vogel from comment #35)
> Thanks for this work, Buttons under Windows look much nicer now.

Thanks Lars for the feedback, resolving now.
Comment 37 Niraj Modi CLA 2022-01-18 06:30:40 EST
N&N is pending here.
Comment 38 Alexandr Miloslavskiy CLA 2022-01-18 16:04:45 EST
Lars, would you please make the N&N entry?
Comment 39 Lars Vogel CLA 2022-01-24 03:49:28 EST
(In reply to Alexandr Miloslavskiy from comment #38)
> Lars, would you please make the N&N entry?

Yes, can do.
Comment 40 Eclipse Genie CLA 2022-01-24 04:38:51 EST
New Gerrit change created: https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/189934
Comment 42 Niraj Modi CLA 2022-02-17 01:22:19 EST
Verified on Win10 using Eclipse Build id: I20220216-1800
Comment 43 Mike Marchand CLA 2022-12-01 15:16:36 EST
I previously opened a bug for a similar issue that was fixed by this pull request:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=576812

(Note that I was immediately dismissed since I reported the issue in the form of a question)

I believe that answering my question from #576812 may have been able to produce a better result than calling maybeEnableDarkSystemTheme() for buttons since the results are not always desirable.

I've opened a new github issue to discuss the issue that I am now seeing by using the default dark explorer theme.
https://github.com/eclipse-platform/eclipse.platform.swt/issues/483
Comment 44 Mike Marchand CLA 2022-12-01 15:17:35 EST
The interesting thing is, before making the changes for this bug, not all buttons were created with those thick borders.  Which was the question that I was asking in https://bugs.eclipse.org/bugs/show_bug.cgi?id=576812