From 79a0b7532770a42fe4c8a46e9b65e8115c6996bf Mon Sep 17 00:00:00 2001 From: Valentin Radu Date: Wed, 2 Mar 2022 00:48:35 +0200 Subject: [PATCH] StartUI: Implemented docked rounded corners style --- ExplorerPatcher/lvt.c | 58 ++++++++++++++++++++++++++---------- ExplorerPatcher/lvt.h | 2 +- ExplorerPatcher/settings.reg | 7 +++-- 3 files changed, 49 insertions(+), 18 deletions(-) diff --git a/ExplorerPatcher/lvt.c b/ExplorerPatcher/lvt.c index 5c34dc6..e1614d8 100644 --- a/ExplorerPatcher/lvt.c +++ b/ExplorerPatcher/lvt.c @@ -92,7 +92,7 @@ Windows_UI_Xaml_IDependencyObject* LVT_FindChildByName(Windows_UI_Xaml_IDependen } // Referenece: https://www.reddit.com/r/Windows10/comments/nvcrie/windows_11_start_menu_how_to_temporary_make_your/ -void LVT_StartUI_EnableRoundedCorners(HWND hWnd, BOOL bApply) +void LVT_StartUI_EnableRoundedCorners(HWND hWnd, DWORD dwReceipe) { WCHAR wszDebug[MAX_PATH]; HRESULT hr = S_OK; @@ -159,7 +159,7 @@ void LVT_StartUI_EnableRoundedCorners(HWND hWnd, BOOL bApply) { int location = LVT_LOC_NONE; - if (bApply) + if (dwReceipe) { Windows_UI_Xaml_Thickness drc; drc.Left = 0.0; drc.Right = 0.0; drc.Top = 0.0; drc.Bottom = 0.0; @@ -228,7 +228,7 @@ void LVT_StartUI_EnableRoundedCorners(HWND hWnd, BOOL bApply) pDropShadow->lpVtbl->QueryInterface(pDropShadow, &IID_Windows_UI_Xaml_IUIElement, &pIUIElement); if (pIUIElement) { - if (bApply) + if (dwReceipe) { pIUIElement->lpVtbl->put_Visibility(pIUIElement, Windows_UI_Xaml_Visibility_Collapsed); } @@ -253,28 +253,28 @@ void LVT_StartUI_EnableRoundedCorners(HWND hWnd, BOOL bApply) { double pad = 12.0; Windows_UI_Xaml_Thickness th; - if (location) + if (location && dwReceipe == 1) { if (location == LVT_LOC_BOTTOMLEFT) { - th.Left = bApply ? pad : 0.0; - th.Bottom = bApply ? pad : 0.0; + th.Left = dwReceipe ? pad : 0.0; + th.Bottom = dwReceipe ? pad : 0.0; th.Right = 0.0; th.Top = 0.0; } else if (location == LVT_LOC_TOPLEFT) { - th.Left = bApply ? pad : 0.0; + th.Left = dwReceipe ? pad : 0.0; th.Bottom = 0.0; th.Right = 0.0; - th.Top = bApply ? pad : 0.0; + th.Top = dwReceipe ? pad : 0.0; } else if (location == LVT_LOC_TOPRIGHT) { th.Left = 0.0; th.Bottom = 0.0; - th.Right = bApply ? pad : 0.0; - th.Top = bApply ? pad : 0.0; + th.Right = dwReceipe ? pad : 0.0; + th.Top = dwReceipe ? pad : 0.0; } } else @@ -304,11 +304,39 @@ void LVT_StartUI_EnableRoundedCorners(HWND hWnd, BOOL bApply) pAcrylicBorder->lpVtbl->QueryInterface(pAcrylicBorder, &IID_Windows_UI_Xaml_Controls_IBorder, &pIBorder); if (pIBorder) { + double pad = 10.0; Windows_UI_Xaml_CornerRadius cr; - cr.BottomLeft = (bApply ? 10.0 : 0.0); - cr.BottomRight = cr.BottomLeft; - cr.TopLeft = cr.BottomLeft; - cr.TopRight = cr.BottomLeft; + if (location && dwReceipe == 2) + { + if (location == LVT_LOC_BOTTOMLEFT) + { + cr.BottomLeft = 0.0; + cr.BottomRight = 0.0; + cr.TopLeft = 0.0; + cr.TopRight = dwReceipe ? pad : 0.0; + } + else if (location == LVT_LOC_TOPLEFT) + { + cr.BottomLeft = 0.0; + cr.BottomRight = dwReceipe ? pad : 0.0; + cr.TopLeft = 0.0; + cr.TopRight = 0.0; + } + else if (location == LVT_LOC_TOPRIGHT) + { + cr.BottomLeft = dwReceipe ? pad : 0.0; + cr.BottomRight = 0.0; + cr.TopLeft = 0.0; + cr.TopRight = 0.0; + } + } + else + { + cr.BottomLeft = (dwReceipe ? 10.0 : 0.0); + cr.BottomRight = cr.BottomLeft; + cr.TopLeft = cr.BottomLeft; + cr.TopRight = cr.BottomLeft; + } pIBorder->lpVtbl->put_CornerRadius(pIBorder, cr); pIBorder->lpVtbl->Release(pIBorder); } @@ -409,7 +437,7 @@ void LVT_StartUI_EnableRoundedCorners(HWND hWnd, BOOL bApply) if (pIGrid2) { Windows_UI_Xaml_CornerRadius cr; - cr.BottomLeft = (bApply ? 5.0 : 0.0); + cr.BottomLeft = (dwReceipe ? 5.0 : 0.0); cr.BottomRight = cr.BottomLeft; cr.TopLeft = cr.BottomLeft; cr.TopRight = cr.BottomLeft; diff --git a/ExplorerPatcher/lvt.h b/ExplorerPatcher/lvt.h index 768644f..24e2ecd 100644 --- a/ExplorerPatcher/lvt.h +++ b/ExplorerPatcher/lvt.h @@ -1022,7 +1022,7 @@ Windows_UI_Xaml_IDependencyObject* LVT_FindChildByClassName(Windows_UI_Xaml_IDep Windows_UI_Xaml_IDependencyObject* LVT_FindChildByName(Windows_UI_Xaml_IDependencyObject* pRootDependencyObject, Windows_UI_Xaml_IVisualTreeHelperStatics* pVisualTreeHelperStatics, LPCWSTR pwszRefName); -void LVT_StartUI_EnableRoundedCorners(HWND, BOOL); +void LVT_StartUI_EnableRoundedCorners(HWND, DWORD); void LVT_StartDocked_DisableRecommendedSection(HWND, BOOL); diff --git a/ExplorerPatcher/settings.reg b/ExplorerPatcher/settings.reg index e24741c..5fd895d 100644 --- a/ExplorerPatcher/settings.reg +++ b/ExplorerPatcher/settings.reg @@ -228,10 +228,13 @@ "TaskbarAl"=dword:00000001 ;t The following settings only apply to the Windows 10 Start menu: [HKEY_CURRENT_USER\Software\ExplorerPatcher] -;b Enable rounded corners -;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_StartUI_EnableRoundedCorners"=dword:00000000 ;b Show more tiles ;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_StartUI_ShowMoreTiles"=dword:00000000 +;c 3 Corner preference +;x 1 Rounded corners, floating menu +;x 2 Rounded corners, docked menu +;x 0 Not rounded +;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_StartUI_EnableRoundedCorners"=dword:00000000 [HKEY_CURRENT_USER\Software\ExplorerPatcher] ;c 3 Display mode ;x 0 Default