From 7197d0808302f5ba3205f3571c312f0687998f41 Mon Sep 17 00:00:00 2001 From: Jannis Weis <31143295+weisJ@users.noreply.github.com> Date: Mon, 27 Dec 2021 21:58:32 +0100 Subject: [PATCH] Windows: Update titlebar icons used on Windows 11 To maximize and restore icons look differently on Windows 11. We update our versions accordingly when Windows 11 is detected. --- .../windows/WindowsDecorationsProvider.java | 15 ++++++---- .../windows/icons/window/maximize11.svg | 11 +++++++ .../icons/window/maximize11Inactive.svg | 11 +++++++ .../windows/icons/window/restore11.svg | 14 +++++++++ .../icons/window/restore11Inactive.svg | 14 +++++++++ .../windows/windows_11_decorations.properties | 30 +++++++++++++++++++ 6 files changed, 89 insertions(+), 6 deletions(-) create mode 100644 windows/src/main/resources/com/github/weisj/darklaf/platform/windows/icons/window/maximize11.svg create mode 100644 windows/src/main/resources/com/github/weisj/darklaf/platform/windows/icons/window/maximize11Inactive.svg create mode 100644 windows/src/main/resources/com/github/weisj/darklaf/platform/windows/icons/window/restore11.svg create mode 100644 windows/src/main/resources/com/github/weisj/darklaf/platform/windows/icons/window/restore11Inactive.svg create mode 100644 windows/src/main/resources/com/github/weisj/darklaf/platform/windows/windows_11_decorations.properties diff --git a/windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsDecorationsProvider.java b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsDecorationsProvider.java index 925d4e3b..3eb588e9 100644 --- a/windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsDecorationsProvider.java +++ b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsDecorationsProvider.java @@ -23,6 +23,7 @@ package com.github.weisj.darklaf.platform.windows; import java.awt.*; import java.util.Properties; +import java.util.function.Consumer; import javax.swing.*; import javax.swing.border.Border; @@ -101,11 +102,13 @@ public class WindowsDecorationsProvider implements DecorationsProvider { @Override public void loadDecorationProperties(final Properties properties, final UIDefaults currentDefaults) { IconLoader iconLoader = IconLoader.get(WindowsDecorationsProvider.class); - PropertyLoader.putProperties( - PropertyLoader.loadProperties(WindowsDecorationsProvider.class, "windows_decorations", ""), properties, - currentDefaults, iconLoader); - PropertyLoader.putProperties( - PropertyLoader.loadProperties(WindowsDecorationsProvider.class, "windows_icons", ""), properties, - currentDefaults, iconLoader); + Consumer loadProps = fileName -> PropertyLoader.putProperties( + PropertyLoader.loadProperties(WindowsDecorationsProvider.class, fileName, ""), + properties, currentDefaults, iconLoader); + loadProps.accept("windows_icons"); + loadProps.accept("windows_decorations"); + if (SystemInfo.isWindows11OrGreater) { + loadProps.accept("windows_11_decorations"); + } } } diff --git a/windows/src/main/resources/com/github/weisj/darklaf/platform/windows/icons/window/maximize11.svg b/windows/src/main/resources/com/github/weisj/darklaf/platform/windows/icons/window/maximize11.svg new file mode 100644 index 00000000..4e0ea89f --- /dev/null +++ b/windows/src/main/resources/com/github/weisj/darklaf/platform/windows/icons/window/maximize11.svg @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/windows/src/main/resources/com/github/weisj/darklaf/platform/windows/icons/window/maximize11Inactive.svg b/windows/src/main/resources/com/github/weisj/darklaf/platform/windows/icons/window/maximize11Inactive.svg new file mode 100644 index 00000000..c9f761c2 --- /dev/null +++ b/windows/src/main/resources/com/github/weisj/darklaf/platform/windows/icons/window/maximize11Inactive.svg @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/windows/src/main/resources/com/github/weisj/darklaf/platform/windows/icons/window/restore11.svg b/windows/src/main/resources/com/github/weisj/darklaf/platform/windows/icons/window/restore11.svg new file mode 100644 index 00000000..77870d61 --- /dev/null +++ b/windows/src/main/resources/com/github/weisj/darklaf/platform/windows/icons/window/restore11.svg @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/windows/src/main/resources/com/github/weisj/darklaf/platform/windows/icons/window/restore11Inactive.svg b/windows/src/main/resources/com/github/weisj/darklaf/platform/windows/icons/window/restore11Inactive.svg new file mode 100644 index 00000000..0af8adcb --- /dev/null +++ b/windows/src/main/resources/com/github/weisj/darklaf/platform/windows/icons/window/restore11Inactive.svg @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/windows/src/main/resources/com/github/weisj/darklaf/platform/windows/windows_11_decorations.properties b/windows/src/main/resources/com/github/weisj/darklaf/platform/windows/windows_11_decorations.properties new file mode 100644 index 00000000..60eb4f11 --- /dev/null +++ b/windows/src/main/resources/com/github/weisj/darklaf/platform/windows/windows_11_decorations.properties @@ -0,0 +1,30 @@ +# +# MIT License +# +# Copyright (c) 2021 Jannis Weis +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# +# +# suppress inspection "UnusedProperty" for whole file +# +Windows.TitlePane.maximize.icon = icons/window/maximize11.svg[themed] +Windows.TitlePane.maximizeInactive.icon = icons/window/maximize11Inactive.svg[themed] +Windows.TitlePane.restore.icon = icons/window/restore11.svg[themed] +Windows.TitlePane.restoreInactive.icon = icons/window/restore11Inactive.svg[themed]