From 3df305b2e16c3300570dea12b04a96002ea2dd6e Mon Sep 17 00:00:00 2001 From: Valentin Radu Date: Sun, 5 Dec 2021 20:37:46 +0200 Subject: [PATCH] Possibility to disable per-application window lists (Alt+`) in sws (283#issuecomment-986261712) --- CHANGELOG.md | 1 + ExplorerPatcher/GUI.c | 20 ++++++++++++++++++++ ExplorerPatcher/dllmain.c | 22 +++++++++++++++++++--- ExplorerPatcher/settings.reg | 2 ++ libs/sws | 2 +- version.h | 6 +++--- 6 files changed, 46 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a85f71a..e7bdb20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ Tested on build 22000.348. * Added some more debug messages * Fixed some rendering problems when themes are disabled * Fixed regression of [#161](https://github.com/valinet/ExplorerPatcher/issues/161#issuecomment-986234002) (.1) +* Possibility to disable per-application window lists (`Alt`+`) ([#283](https://github.com/valinet/ExplorerPatcher/issues/283#issuecomment-986261712)) (.2) ## 22000.348.39 diff --git a/ExplorerPatcher/GUI.c b/ExplorerPatcher/GUI.c index d71324f..592c9ed 100644 --- a/ExplorerPatcher/GUI.c +++ b/ExplorerPatcher/GUI.c @@ -1478,6 +1478,21 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) { dwMaxWidth = rcNew.right - rcNew.left + 50 * dx; } + if (!wcsncmp(text + 3, L"%PLACEHOLDER_0001%", 18)) + { + WCHAR key = 0; + BYTE kb[256]; + ZeroMemory(kb, 256); + ToUnicode( + MapVirtualKeyW(0x29, MAPVK_VSC_TO_VK_EX), + 0x29, + kb, + &key, + 1, + 0 + ); + swprintf(text + 3, MAX_LINE_LENGTH, L"Disable per-application window list ( Alt + %c )", key); + } if (IsThemeActive()) { DrawThemeTextEx( @@ -1842,6 +1857,11 @@ static LRESULT CALLBACK GUI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR EndPaint(hWnd, &ps); return 0; } + else if (uMsg == WM_INPUTLANGCHANGE) + { + InvalidateRect(hWnd, NULL, FALSE); + return 0; + } else if (uMsg == WM_MSG_GUI_SECTION && wParam == WM_MSG_GUI_SECTION_GET) { return _this->section + 1; diff --git a/ExplorerPatcher/dllmain.c b/ExplorerPatcher/dllmain.c index 43eb4f7..3d69618 100644 --- a/ExplorerPatcher/dllmain.c +++ b/ExplorerPatcher/dllmain.c @@ -3425,8 +3425,19 @@ void sws_ReadSettings(sws_WindowSwitcher* sws) &(sws->dwMaxAbsoluteHP), &dwSize ); - if (sws) + dwSize = sizeof(DWORD); + RegQueryValueExW( + hKey, + TEXT("NoPerApplicationList"), + 0, + NULL, + &(sws->bNoPerApplicationList), + &dwSize + ); + if (sws->bIsInitialized) { + sws_WindowSwitcher_UnregisterHotkeys(sws); + sws_WindowSwitcher_RegisterHotkeys(sws, NULL); sws_WindowSwitcher_RefreshTheme(sws); } } @@ -3449,9 +3460,13 @@ DWORD WindowSwitcher(DWORD unused) if (sws_IsEnabled) { sws_error_t err; - sws_WindowSwitcher* sws = NULL; - err = sws_error_Report(sws_error_GetFromInternalError(sws_WindowSwitcher_Initialize(&sws, FALSE)), NULL); + sws_WindowSwitcher* sws = calloc(1, sizeof(sws_WindowSwitcher)); + if (!sws) + { + return 0; + } sws_ReadSettings(sws); + err = sws_error_Report(sws_error_GetFromInternalError(sws_WindowSwitcher_Initialize(&sws, FALSE)), NULL); if (err == SWS_ERROR_SUCCESS) { sws_WindowSwitcher_RefreshTheme(sws); @@ -3498,6 +3513,7 @@ DWORD WindowSwitcher(DWORD unused) } } sws_WindowSwitcher_Clear(sws); + free(sws); } else { diff --git a/ExplorerPatcher/settings.reg b/ExplorerPatcher/settings.reg index 86c8bdc..dae46f0 100644 --- a/ExplorerPatcher/settings.reg +++ b/ExplorerPatcher/settings.reg @@ -227,6 +227,8 @@ "PrimaryOnly"=dword:00000000 ;b Show windows only from current monitor "PerMonitor"=dword:00000000 +;b %PLACEHOLDER_0001% +"NoPerApplicationList"=dword:00000000 ;c 3 Theme ;x 0 Default ;x 1 Acrylic diff --git a/libs/sws b/libs/sws index 44e2627..b0d9d07 160000 --- a/libs/sws +++ b/libs/sws @@ -1 +1 @@ -Subproject commit 44e262791333ef6ba5fe128e8abf20d28787f594 +Subproject commit b0d9d07916fce59f83689a7428463569606440ef diff --git a/version.h b/version.h index 86dc638..e6b3a07 100644 --- a/version.h +++ b/version.h @@ -1,7 +1,7 @@ #define VER_MAJOR 22000 #define VER_MINOR 348 #define VER_BUILD_HI 40 -#define VER_BUILD_LO 1 +#define VER_BUILD_LO 2 #define VER_FLAGS VS_FF_PRERELEASE @@ -12,5 +12,5 @@ #define VER_STR(arg) #arg // The String form of the version numbers -#define VER_FILE_STRING VALUE "FileVersion", "22000.348.40.1" -#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.348.40.1" +#define VER_FILE_STRING VALUE "FileVersion", "22000.348.40.2" +#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.348.40.2"