Skip to content

Commit

Permalink
Attempt to improve synchronization of task bars on other displays.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgjackson committed Feb 9, 2024
1 parent 315e08f commit cd68de1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
23 changes: 11 additions & 12 deletions toggle.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,8 @@ BOOL SetLightDark(DWORD light)

RegCloseKey(hKey);

// Delay -- this appears to help update taskbars on other displays
Sleep(1000);
// Delay -- this may to help update taskbars on other displays?
Sleep(500);

// Broadcast WM_SETTINGSCHANGE using SendMessageTimeout with lParam set to "ImmersiveColorSet" -- required by some apps such as explorer.exe (File Explorer)
{
Expand All @@ -474,6 +474,15 @@ BOOL SetLightDark(DWORD light)
SendMessageTimeout(hWnd, msg, wParam, lParam, SMTO_ABORTIFHUNG, 5000, NULL);
}

// Broadcast WM_THEMECHANGED -- this may to help update taskbars on other displays?
{
HWND hWnd = HWND_BROADCAST;
UINT msg = WM_THEMECHANGED;
WPARAM wParam = 0;
LPARAM lParam = 0;
SendMessageTimeout(hWnd, msg, wParam, lParam, SMTO_ABORTIFHUNG, 5000, NULL);
}

// Broadcast a second WM_SETTINGSCHANGE using SendMessageTimeout with lParam set to "ImmersiveColorSet" -- this second broadcast fixes Task Manager
{
HWND hWnd = HWND_BROADCAST;
Expand All @@ -483,16 +492,6 @@ BOOL SetLightDark(DWORD light)
SendMessageTimeout(hWnd, msg, wParam, lParam, SMTO_ABORTIFHUNG, 5000, NULL);
}


// // Broadcast WM_THEMECHANGED
// {
// HWND hWnd = HWND_BROADCAST;
// UINT msg = WM_THEMECHANGED;
// WPARAM wParam = 0;
// LPARAM lParam = 0;
// SendMessageTimeout(hWnd, msg, wParam, lParam, SMTO_ABORTIFHUNG, 5000, NULL);
// }

// // Broadcast WM_SYSCOLORCHANGE
// {
// HWND hWnd = HWND_BROADCAST;
Expand Down
2 changes: 1 addition & 1 deletion toggle.rc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ MAINICON ICON "icon.ico"
#define STRINGIZE(x) STRINGIZE_HELPER(x)
#define VER_MAJOR 1
#define VER_MINOR 0
#define VER_BUILD 11 // Patch ('build' in MS version order)
#define VER_BUILD 12 // Patch ('build' in MS version order)
#define VER_REVISION 0 // Build ('revision' in MS version order)
#define VER_STRING STRINGIZE(VER_MAJOR) "." STRINGIZE(VER_MINOR) "." STRINGIZE(VER_BUILD) "." STRINGIZE(VER_REVISION)

Expand Down

0 comments on commit cd68de1

Please sign in to comment.