22// @id taskbar-labels
33// @name Taskbar Labels for Windows 11
44// @description Customize text labels and combining for running programs on the taskbar (Windows 11 only)
5- // @version 1.4.2
5+ // @version 1.4.3
66// @author m417z
77// @github https://github.com/m417z
88// @twitter https://twitter.com/m417z
99// @homepage https://m417z.com/
1010// @include explorer.exe
1111// @architecture x86-64
12- // @compilerOptions -DWINVER=0x0A00 - lole32 -loleaut32 -lruntimeobject
12+ // @compilerOptions -lole32 -loleaut32 -lruntimeobject
1313// ==/WindhawkMod==
1414
1515// Source code is published under The GNU General Public License v3.0.
@@ -189,6 +189,7 @@ Labels can also be shown or hidden per-program in the settings.
189189
190190#include < algorithm>
191191#include < atomic>
192+ #include < cmath>
192193#include < limits>
193194#include < string>
194195#include < unordered_set>
@@ -957,15 +958,18 @@ void UpdateTaskListButtonWithLabelStyle(
957958 FindChildByName (iconPanelElement, L" LabelControl" )
958959 .as <Controls::TextBlock>();
959960
960- if (secondColumnWidthPixels > 0 && labelControlElement) {
961- // In labelsWithCombining mode, pinned items have labels too. Hide them.
962- if (g_settings.mode == Mode::labelsWithCombining &&
963- !TaskListButton_IsRunning (taskListButtonElement)) {
964- secondColumnWidthPixels = 0 ;
965- labelControlElement.Visibility (Visibility::Collapsed);
966- labelControlElement = nullptr ;
967- }
961+ // In labelsWithCombining mode, pinned items have labels too. Hide them.
962+ if (g_settings.mode == Mode::labelsWithCombining && labelControlElement &&
963+ !TaskListButton_IsRunning (taskListButtonElement)) {
964+ secondColumnWidthPixels = 0 ;
965+ labelControlElement.Visibility (Visibility::Collapsed);
966+ labelControlElement = nullptr ;
968967
968+ columnDefinitions.GetAt (1 ).Width (GridLength ({
969+ .Value = 0 ,
970+ .GridUnitType = GridUnitType::Pixel,
971+ }));
972+ } else if (secondColumnWidthPixels > 0 && labelControlElement) {
969973 columnDefinitions.GetAt (1 ).Width (GridLength ({
970974 .Value = secondColumnWidthPixels,
971975 .GridUnitType = GridUnitType::Pixel,
@@ -988,9 +992,9 @@ void UpdateTaskListButtonWithLabelStyle(
988992
989993 if (g_unloading) {
990994 labelControlElement.MaxWidth (
991- std::max (0.0 , 176 - firstColumnWidthPixels));
995+ std::fmax (0.0 , 176 - firstColumnWidthPixels));
992996 } else if (g_settings.taskbarItemWidth == 0 ) {
993- labelControlElement.MaxWidth (std::max (
997+ labelControlElement.MaxWidth (std::fmax (
994998 0.0 ,
995999 g_settings.maximumTaskbarItemWidth - firstColumnWidthPixels));
9961000 } else {
@@ -1095,7 +1099,7 @@ void UpdateTaskListButtonWithLabelStyle(
10951099 winrt::box_value (2 ));
10961100 }
10971101
1098- double maxWidth = std::max (taskListButtonWidth - 6 , 0.0 );
1102+ double maxWidth = std::fmax (taskListButtonWidth - 6 , 0.0 );
10991103 indicatorElement.MaxWidth (maxWidth);
11001104
11011105 double minWidth = 0 ;
@@ -1242,8 +1246,8 @@ void UpdateTaskListButtonCustomizations(
12421246 bool isRunning = TaskListButton_IsRunning (taskListButtonElement);
12431247 bool showLabels = isRunning;
12441248 double minWidth =
1245- std::min (g_initialTaskbarItemWidth,
1246- static_cast <double >(g_settings.taskbarItemWidth ));
1249+ std::fmin (g_initialTaskbarItemWidth,
1250+ static_cast <double >(g_settings.taskbarItemWidth ));
12471251
12481252 if (g_unloading) {
12491253 showLabels = false ;
@@ -2042,6 +2046,7 @@ bool HookTaskbarDllSymbols() {
20422046 {LR"( public: virtual int __cdecl CTaskListThumbnailWnd::DisplayUI(struct ITaskBtnGroup *,struct ITaskItem *,struct ITaskItem *,unsigned long))" },
20432047 &CTaskListThumbnailWnd_DisplayUI_Original,
20442048 CTaskListThumbnailWnd_DisplayUI_Hook,
2049+ true , // Classic thumbnails, removed in or near 10.0.26100.8491.
20452050 },
20462051 };
20472052
@@ -2139,7 +2144,7 @@ BOOL ModInitWithTaskbarView(HMODULE taskbarViewModule) {
21392144 HMODULE kernelBaseModule = GetModuleHandle (L" kernelbase.dll" );
21402145 auto pKernelBaseRegGetValueW = (decltype (&RegGetValueW))GetProcAddress (
21412146 kernelBaseModule, " RegGetValueW" );
2142- WindhawkUtils::Wh_SetFunctionHookT (
2147+ WindhawkUtils::SetFunctionHook (
21432148 pKernelBaseRegGetValueW, RegGetValueW_Hook, &RegGetValueW_Original);
21442149 }
21452150
@@ -2163,9 +2168,9 @@ BOOL Wh_ModInit() {
21632168 auto pKernelBaseLoadLibraryExW =
21642169 (decltype (&LoadLibraryExW))GetProcAddress (kernelBaseModule,
21652170 " LoadLibraryExW" );
2166- WindhawkUtils::Wh_SetFunctionHookT (pKernelBaseLoadLibraryExW,
2167- LoadLibraryExW_Hook,
2168- &LoadLibraryExW_Original);
2171+ WindhawkUtils::SetFunctionHook (pKernelBaseLoadLibraryExW,
2172+ LoadLibraryExW_Hook,
2173+ &LoadLibraryExW_Original);
21692174 }
21702175
21712176 return TRUE ;
0 commit comments