Skip to content

Commit

Permalink
Update accent-color-sync.wh.cpp (#1127)
Browse files Browse the repository at this point in the history
* Re-added 'older OpenGlass' option to DWM modification software selection.
* Updated readme and made instructions clearer.
  • Loading branch information
CatmanFan authored Oct 23, 2024
1 parent 5edf7a5 commit 0bf9b7f
Showing 1 changed file with 33 additions and 16 deletions.
49 changes: 33 additions & 16 deletions mods/accent-color-sync.wh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// @description:fr-FR Retour de la fonctionnalité d'opacité des couleurs du Panneau de configuration
// @description:es-ES Recuperar la funcionalidad de opacidad de colores del Panel de control
// @description:ja-JP コントロールパネルの色の不透明度機能を復元する
// @version 1.52
// @version 1.53
// @author CatmanFan / Mr._Lechkar
// @github https://github.com/CatmanFan
// @include explorer.exe
Expand All @@ -20,29 +20,26 @@ Brings back the functionality of the Control Panel's "Color intensity" slider to
## **⚠️ Requirements:**
**This mod requires that *one* of the following supported DWM shader applications is installed and running:**
* **[Legacy OpenGlass](https://github.com/ALTaleX531/OpenGlass/tree/legacy)**, supports Windows 10 1809 ― Windows 11 23H2;
* It is generally recommended to compile the source code from the official repo, but a list of OpenGlass-legacy downloads is also available *[here](https://github.com/ALTaleX531/OpenGlass/releases)*.
* **[OpenGlass](https://github.com/ALTaleX531/OpenGlass)**, available in two editions: the [original version](https://github.com/ALTaleX531/OpenGlass/tree/master) which uses DComp (supports Windows 10 1809 ― Windows 11 23H2) and the [legacy version](https://github.com/ALTaleX531/OpenGlass/tree/legacy) (supports Windows 10 2004 ― 22H2 only) which uses Direct2D. I recommend that you use OpenGlass-legacy due to its closer accurateness to the Windows 7 shader.
* It is generally recommended to compile the source code from the official repo, but a list of downloads is also available [here](https://github.com/ALTaleX531/OpenGlass/releases).
* **[Glass8](https://archive.org/details/full-glass8-archive)**, supports Windows 10 RTM to 1909 builds.
* Please note that the shader used by this software is not accurate to the original.
### **Additional tips:**
* If you are updating this mod from version 1.3, it is recommended to also enable the *Sync with DWM* option in the mod settings, although this can have some minor bugs (see below).
* If you are updating this mod from version 1.0, it is required to disable or uninstall any unsupported DWM shader software (e.g. regular OpenGlass or DWMBlurGlass).
* You may need to try changing the accent color manually if changes do not automatically take effect.
* If one of the OpenGlass options in the *'DWM customization software'* section of the mod settings (i.e. the options labelled "OpenGlass" or "OpenGlass (old registry name)") is not working, try setting it to the other one. This is because while official builds of OpenGlass now use the registry value name template "{xxx}Override" instead of the older "og_{xxx}", this is not the case for older separately-compiled builds.
----
### Known bugs:
* ***Sync with DWM* option enabled:**
* When changing the color intensity in the Control Panel without changing the color itself, the theme preview icon used for the color does not change unless after the theme preview is regenerated by changing the color RGB values or the desktop background.
* ***Sync with DWM* option enabled:** When changing the color intensity in the Control Panel without changing the color itself, the theme preview icon used for the color does not change unless after the theme preview is regenerated by changing the color RGB values or the desktop background.
* Actually closing the Personalization window does not produce the same behaviour as clicking "Cancel" (i.e. the RGB color is changed but the OpenGlass opacity stays the same).
* When using [Explorer7](https://github.com/Erizur/explorer7-releases/), the Start menu may not immediately change in opacity and requires a restart of explorer.exe. This may be fixed with schm1dt's glass POC mod downloadable [here](https://winclassic.net/post/24274).
### Special credits:
* [OjasK](https://github.com/ojask) for his DirectUI reverse-engineering work, part of which was referenced in the making of this mod.
* [ALTaleX](https://github.com/ALTaleX531) for the incredible work on OpenGlass, and on porting the Windows 7 DWM colorization functionality to open-source code with [this formula](https://github.com/ALTaleX531/dwm_colorization_calculator); as well as [kfh83](https://github.com/kfh83) on porting the Windows 7-esque shader to OpenGlass-legacy.
*/
// ==/WindhawkModReadme==

Expand Down Expand Up @@ -79,13 +76,26 @@ Brings back the functionality of the Control Panel's "Color intensity" slider to
- glassSoftware: openglass
$options:
- openglass: OpenGlass
- openglass1: OpenGlass (older versions)
- glass8: Glass8
$options:fr-FR:
- openglass: OpenGlass
- openglass1: OpenGlass (anciennes versions)
- glass8: Glass8
$options:es-ES:
- openglass: OpenGlass
- openglass1: OpenGlass (versiones anteriores)
- glass8: Glass8
$name: DWM customization software
$options:ja-JP:
- openglass: OpenGlass
- openglass1: OpenGlass(旧バージョン)
- glass8: Glass8
$name: DWM software
$name:fr-FR: Logiciel de modification du gestionnaire des fenêtres (DWM)
$name:es-ES: Software de modificación de interfaz gráfica DWM
$name:ja-JP: DWMカスタマイズソフトウェア
$description: The application currently being used to implement the Aero shader.
$description:fr-FR: L'application actuellement utilisée pour implémenter le shader Aero classique.
$description:fr-FR: Choisir l'application qui est actuellement utilisée pour implémenter le shader Aero.
$description:es-ES: La aplicación que se utiliza actualmente para implementar la funcionalidad de Aero.
$description:ja-JP: Aeroシェーダー効果を反映するために現在使用されているアプリケーション
*/
Expand Down Expand Up @@ -118,7 +128,7 @@ Brings back the functionality of the Control Panel's "Color intensity" slider to
const std::wstring dwmKey = L"SOFTWARE\\Microsoft\\Windows\\DWM";
const std::wstring opacityValue = L"og_Opacity";

enum class GlassSoftware { OpenGlass, Glass8 };
enum class GlassSoftware { OpenGlassOld, OpenGlass, Glass8 };
enum class WinVersion { None, Unsupported, Win10Legacy, Win10, Win11 };
WinVersion winVer;

Expand Down Expand Up @@ -903,12 +913,17 @@ void setValueNames()
{
DWORD value;

std::wstring old1 = L"og_ColorizationColorBalance";
std::wstring old2 = L"og_ColorizationAfterglowBalance";
std::wstring old3 = L"og_ColorizationBlurBalance";
std::wstring new1 = L"ColorizationColorBalanceOverride";
std::wstring new2 = L"ColorizationAfterglowBalanceOverride";
std::wstring new3 = L"ColorizationBlurBalanceOverride";
balanceColor = L"ColorizationColorBalance";
balanceAfterglow = L"ColorizationAfterglowBalance";
balanceBlur = L"ColorizationBlurBalance";
bool isOld = settings.glassApp == GlassSoftware::OpenGlassOld;

std::wstring old1 = isOld ? balanceColor + L"Override" : L"og_" + balanceColor;
std::wstring old2 = isOld ? balanceAfterglow + L"Override" : L"og_" + balanceAfterglow;
std::wstring old3 = isOld ? balanceBlur + L"Override" : L"og_" + balanceBlur;
std::wstring new1 = isOld ? L"og_" + balanceColor : balanceColor + L"Override";
std::wstring new2 = isOld ? L"og_" + balanceAfterglow : balanceAfterglow + L"Override";
std::wstring new3 = isOld ? L"og_" + balanceBlur : balanceBlur + L"Override";

balanceColor = new1;
balanceAfterglow = new2;
Expand Down Expand Up @@ -939,6 +954,8 @@ BOOL LoadSettings()
LPCWSTR glassAppName = Wh_GetStringSetting(L"glassSoftware");
if (lstrcmpW(glassAppName, L"glass8") == 0)
settings.glassApp = GlassSoftware::Glass8;
else if (lstrcmpW(glassAppName, L"openglass1") == 0)
settings.glassApp = GlassSoftware::OpenGlassOld;
else
settings.glassApp = GlassSoftware::OpenGlass;
Wh_FreeStringSetting(glassAppName);
Expand Down

0 comments on commit 0bf9b7f

Please sign in to comment.