Bug 579351 - [Win11] SWT button controls don't seem to use the new Windows 11 theme
Summary: [Win11] SWT button controls don't seem to use the new Windows 11 theme
Status: RESOLVED INVALID
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.24   Edit
Hardware: PC Windows 11
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-21 09:55 EDT by Mike Hearn CLA
Modified: 2022-03-24 16:04 EDT (History)
5 users (show)

See Also:


Attachments
Screenshot of ControlExample on Win11 (35.31 KB, image/png)
2022-03-23 16:06 EDT, Alexandr Miloslavskiy CLA
no flags Details
Screenshot showing settings app vs SWT/Win32 controls side by side (66.63 KB, image/png)
2022-03-24 07:28 EDT, Mike Hearn CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Hearn CLA 2022-03-21 09:55:42 EDT
I tried creating a simple SWT UI with buttons. On Windows 11 the button style is a simple plain box, not the newer slightly rounded and lighter coloured Windows 11 style. Why does SWT not follow the native UI styling, given it's using native controls?
Comment 1 Rolf Theunissen CLA 2022-03-22 04:06:59 EDT
Which SWT version are you using? 

Bug 577042 did fix it for the Dark theme in 4.23, I would expect that this is fixed for the default theme too.
Comment 2 Lars Vogel CLA 2022-03-22 05:38:01 EDT
(In reply to Rolf Theunissen from comment #1)
> Which SWT version are you using? 
> 
> Bug 577042 did fix it for the Dark theme in 4.23

This is in the 2022-03 release.
Comment 3 Mike Hearn CLA 2022-03-22 05:45:05 EDT
Ah OK. When will that turn into a new released version - any idea?

From the linked bug, I'm not totally sure that'll fix it. It's hard to say because that's dark mode only, but the new light mode controls look like this:

https://docs.microsoft.com/en-us/windows/apps/get-started/make-apps-great-for-windows#4-use-the-latest-common-controls

The drop-down in the dark mode screenshots looks very different. I can see that the buttons have rounded corners post-patch, but the dropdown still looks boxy for example and lack the blue bottom edge. Is SWT really using normal Windows common controls? I'd have expected them to follow the new style automatically.
Comment 4 Lars Vogel CLA 2022-03-22 07:10:40 EDT
(In reply to Mike Hearn from comment #3)
> Ah OK. When will that turn into a new released version - any idea?

Already done, see Comment 2, you find it here https://www.eclipse.org/downloads/packages/
Comment 5 Mike Hearn CLA 2022-03-22 07:13:20 EDT
Sorry, I should have been clearer. I'm not using Eclipse, only SWT as a standalone library. I'm using SWT 3.119.0 which seems to be the latest version, uploaded the same date as the 4.23 Eclipse Platform release. So, in 3.119.0 the light mode buttons are still gray rectangles, not the new Win11 styling (at least in light mode, I haven't tried dark mode).
Comment 6 Lars Vogel CLA 2022-03-22 07:15:51 EDT
Bug 577042 was for the dark theme, please try the dark theme. SWT version seems the correct one.
Comment 7 Mike Hearn CLA 2022-03-22 07:28:04 EDT
I have no idea how to do that. There doesn't seem to be any documentation on how to make SWT use dark mode - it doesn't detect the system setting by default at any rate. I saw mention of OS.setDarkMode(OS.isDarkTheme()) in some other bugs or words to that effect but it seems to be internal non-portable API (i.e. there'd need to be platform specific code to invoke it via reflection). Is that intentional?

At any rate, I filed this bug specifically about the default (light) appearance. If it works better in dark mode, great, but, I'd still like to use the default Win11 look in light mode.
Comment 8 Thomas Singer CLA 2022-03-22 14:22:11 EDT
(In reply to Mike Hearn from comment #5)
> Sorry, I should have been clearer. I'm not using Eclipse, only SWT as a
> standalone library. I'm using SWT 3.119.0 which seems to be the latest
> version, uploaded the same date as the 4.23 Eclipse Platform release. So, in
> 3.119.0 the light mode buttons are still gray rectangles, not the new Win11
> styling (at least in light mode, I haven't tried dark mode).

Where did you get the information about SWT 3.119.0? The version.txt in my org.eclipse.swt.win32.win32.x86_64.jar shows version 4.950.
Comment 10 Mike Hearn CLA 2022-03-23 13:16:53 EDT
I think I may be mistaken in diagnosing the issue. I thought, based on light usage of Windows 11 and the MS docs, that the new button styles applied to Win32 controls. But now I search for actual examples of Win32 apps that have the new styles applied, I can't find any. The docs say under "Use the latest common controls":

"Win32 controls that use UXTheme will automatically get a repaint of the Light theme for select rejuvenated control visuals."

Yet this doesn't seem to be true. None of the controls I can find in the legacy parts of Windows look anything like their example picture. Unless "select rejuvenated controls" doesn't include buttons or combo boxes?! So, maybe SWT is doing the right thing already and I just didn't realize it. The button I get from using simple default code is very tightly packed so there's still issues here to make it look right, but, in terms of actually using the theme, I guess I should find Win32 apps that are updated first before wondering why SWT apps aren't.
Comment 11 Alexandr Miloslavskiy CLA 2022-03-23 16:06:53 EDT
Created attachment 288274 [details]
Screenshot of ControlExample on Win11

Mike, it's rather difficult for me to understand what exactly is being discussed here.

Here's a screenshot of SWT's standard ControlExample snippet, using yesterday's build of SWT from 'master' branch in sources. As it can be seen, many controls have slightly rounded corners, including Button, checkbox's icon, etc.

Are you seeing this or something else? If you're seeing something else, please attach a screenshot.
Comment 12 Mike Hearn CLA 2022-03-24 07:28:12 EDT
I've attached what I see, with a button in the Settings app next to a button created with SWT (the one labelled "Check for updates"). Zooming in with a bitmap editor, there are indeed rounded corners on the SWT button! On my hi-dpi laptop screen they're so tiny I couldn't see them; it looks square. Maybe my eyesight just isn't good enough. 

In your screenshot I can see them more clearly for some reason but that might be spacing/padding related.

I guess there's actually no bug here, in the end? I thought I'd get a UI that looks like the image in the MSDN docs and the Settings app by default, but it seems that to match the first-party apps requires a combination of SWT + different font choice/size and more internal padding, and I don't know how to match the filled style of the default button.

Presumably the settings app is made with WinUI3 and it's intentional that the Win32 controls don't match the style exactly. Windows bug, in other words.
Comment 13 Mike Hearn CLA 2022-03-24 07:28:53 EDT
Created attachment 288285 [details]
Screenshot showing settings app vs SWT/Win32 controls side by side
Comment 14 Alexandr Miloslavskiy CLA 2022-03-24 16:04:40 EDT
Indeed Settings App uses a completely different UI library and different set of controls. Whereas SWT uses the classic "common controls" for native desktop applications.

With SWT on Win11 corners are now rounded in many controls, while on Win10 they are square. To me, this already fits with Microsoft's promise to "rejuvenate" common controls. Also, Microsoft changed some colors and animations in Win11, all of that automatically available in SWT.

My conclusion: there is no bug here. Rather, it's kind of feature request where you'd like to see controls from WinUI set. This has already been discussed in Bug 568795. I can once again repeat my opinion here: SWT contains A LOT of workarounds on each platform to make controls behave the way SWT likes it. Implementing a new platform is going to be a lot of effort. I won't be able to participate in this.