Skip to content

Commit

Permalink
Windows 11 Taskbar Styler v1.1.2 (#304)
Browse files Browse the repository at this point in the history
* Fixed a crash loop when some styles are used.
  • Loading branch information
m417z authored Sep 16, 2023
1 parent c8bd45d commit 3ab1f3e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions mods/windows-11-taskbar-styler.wh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @id windows-11-taskbar-styler
// @name Windows 11 Taskbar Styler
// @description An advanced mod to override style attributes of the taskbar control elements
// @version 1.1.1
// @version 1.1.2
// @author m417z
// @github https://github.com/m417z
// @twitter https://twitter.com/m417z
Expand Down Expand Up @@ -1388,6 +1388,7 @@ struct ElementPropertyOverrides {
std::vector<PropertyKeyValue> propertyValues;
};

bool g_propertyOverridesLoaded;
std::vector<ElementPropertyOverrides> g_propertyOverrides;
DWORD g_propertyOverridesUpdateCount = 0;

Expand Down Expand Up @@ -1439,7 +1440,16 @@ const std::vector<PropertyKeyValue>* FindElementPropertyOverrides(
return nullptr;
}

void ProcessAllStylesFromSettings();
void ProcessResourceVariablesFromSettings();

void ApplyCustomizations(FrameworkElement element) {
if (!g_propertyOverridesLoaded) {
ProcessAllStylesFromSettings();
ProcessResourceVariablesFromSettings();
g_propertyOverridesLoaded = true;
}

auto propertyValues = FindElementPropertyOverrides(element);
if (!propertyValues) {
return;
Expand Down Expand Up @@ -1751,12 +1761,10 @@ void ProcessResourceVariablesFromSettings() {
void InitializeSettingsAndTap() {
g_targetThreadId = GetCurrentThreadId();

g_propertyOverridesLoaded = false;
g_propertyOverrides.clear();
g_propertyOverridesUpdateCount++;

ProcessAllStylesFromSettings();
ProcessResourceVariablesFromSettings();

HRESULT hr = InjectWindhawkTAP();
if (FAILED(hr)) {
Wh_Log(L"Error %08X", hr);
Expand Down

0 comments on commit 3ab1f3e

Please sign in to comment.