RFR: 8321151: JDK-8294427 breaks Windows L&F on all older Windows versions

Alexey Ivanov aivanov at openjdk.org
Thu Dec 21 18:41:48 UTC 2023


On Thu, 21 Dec 2023 01:19:40 GMT, Rajat Mahajan <rmahajan at openjdk.org> wrote:

> **Issue:**
> https://bugs.openjdk.org/browse/JDK-8294427 starts to use this API
> https://learn.microsoft.com/en-us/windows/win32/api/uxtheme/nf-uxtheme-openthemedatafordpi
> 
> which was introduced only in Windows 10 1703.
> So the theming engine won't load on anything earlier like the original windows 10 or windows 8.1 etc.
> 
> So as an undocumented side-effect it completely breaks the theming of Windows L&F on anything earlier
> and it falls back to hard-coded rendering like Windows NT/Windows 2000
> 
> Whilst those older versions are technically out of at least "mainstream" support, this is not the way
> to make that breaking change and I see this fix has been backported to older releases which expect stability
> 
> it seems to me that this code should NOT fail if the new API is missing and instead fall back to the old code.
> No one will care about a pixel being off on hi-dpi if the entire UI is wrong.
> 
> **Fix:**
> Added fallback path to support older versions of Windows that do not support OpenThemeDataForDpi().
> 
> **Testing:**
> Tested on my Windows 10 machine with and without the fallback path and it works as expected.
> Alexey tested on Windows 7 and on Windows 10 v1607 — it works correctly (jdk 21.0.2 can't render themes as reported).
> He also tested on Windows 11 .

Looks good to me.

I tested it on Windows 7, Windows 10 v1607 as well as current versions of Windows 10 and 11. I ran SwingSet2 side-by-side and I didn't spot any differences.

-------------

Marked as reviewed by aivanov (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/17173#pullrequestreview-1793493900


More information about the client-libs-dev mailing list