From 4aa045b01dc42fccc9e28ef5daa332d52993a2c4 Mon Sep 17 00:00:00 2001 From: Valentin Radu Date: Tue, 1 Mar 2022 20:01:44 +0200 Subject: [PATCH] StartUI: Add padding only to the sides near the edge of the screen --- ExplorerPatcher/lvt.c | 59 ++++++++++++++++++++++++++++++++++++++----- ExplorerPatcher/lvt.h | 5 ++++ 2 files changed, 58 insertions(+), 6 deletions(-) diff --git a/ExplorerPatcher/lvt.c b/ExplorerPatcher/lvt.c index 695158e..5c34dc6 100644 --- a/ExplorerPatcher/lvt.c +++ b/ExplorerPatcher/lvt.c @@ -157,7 +157,7 @@ void LVT_StartUI_EnableRoundedCorners(HWND hWnd, BOOL bApply) Windows_UI_Xaml_IDependencyObject* pStartSizingFrame = LVT_FindChildByClassName(pRootDependencyObject, pVisualTreeHelperStatics, L"StartUI.StartSizingFrame", NULL); if (pStartSizingFrame) { - BOOL bApplyPadding = bApply; + int location = LVT_LOC_NONE; if (bApply) { @@ -188,7 +188,26 @@ void LVT_StartUI_EnableRoundedCorners(HWND hWnd, BOOL bApply) GetMonitorInfoW(hMonitor, &mi); //swprintf(wszDebug, MAX_PATH, L"RECT %d %d %d %d - %d %d %d %d\n", rc.left, rc.top, rc.right, rc.bottom, 0, 0, mi.rcWork.right - mi.rcWork.left, mi.rcWork.bottom - mi.rcWork.top); //OutputDebugStringW(wszDebug); - bApplyPadding = !(rc.left == 0 && rc.top == 0 && abs(mi.rcWork.right - mi.rcWork.left - rc.right) < 5 && abs(mi.rcWork.bottom - mi.rcWork.top - rc.bottom) < 5); + if (!(rc.left == 0 && rc.top == 0 && abs(mi.rcWork.right - mi.rcWork.left - rc.right) < 5 && abs(mi.rcWork.bottom - mi.rcWork.top - rc.bottom) < 5)) + { + if (rc.left == 0) + { + if (rc.top == 0) + { + location = LVT_LOC_TOPLEFT; + } + else + { + location = LVT_LOC_BOTTOMLEFT; + } + } + else + { + location = LVT_LOC_TOPRIGHT; + } + } + //swprintf_s(wszDebug, MAX_PATH, L"Location: %d\n", location); + //OutputDebugStringW(wszDebug); if (pFrameworkElement) { pFrameworkElement->lpVtbl->Release(pFrameworkElement); @@ -232,11 +251,39 @@ void LVT_StartUI_EnableRoundedCorners(HWND hWnd, BOOL bApply) pFrame->lpVtbl->QueryInterface(pFrame, &IID_Windows_UI_Xaml_Controls_IControl, &pIBorder); if (pIBorder) { + double pad = 12.0; Windows_UI_Xaml_Thickness th; - th.Left = (bApplyPadding ? 10.0 : 0.0); - th.Bottom = th.Left; - th.Right = th.Left; - th.Top = th.Left; + if (location) + { + if (location == LVT_LOC_BOTTOMLEFT) + { + th.Left = bApply ? pad : 0.0; + th.Bottom = bApply ? pad : 0.0; + th.Right = 0.0; + th.Top = 0.0; + } + else if (location == LVT_LOC_TOPLEFT) + { + th.Left = bApply ? pad : 0.0; + th.Bottom = 0.0; + th.Right = 0.0; + th.Top = bApply ? 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; + } + } + else + { + th.Left = 0.0; + th.Bottom = 0.0; + th.Right = 0.0; + th.Top = 0.0; + } pIBorder->lpVtbl->put_Padding(pIBorder, th); pIBorder->lpVtbl->Release(pIBorder); } diff --git a/ExplorerPatcher/lvt.h b/ExplorerPatcher/lvt.h index 0cc7e62..768644f 100644 --- a/ExplorerPatcher/lvt.h +++ b/ExplorerPatcher/lvt.h @@ -7,6 +7,11 @@ #include #include +#define LVT_LOC_NONE 0 +#define LVT_LOC_BOTTOMLEFT 1 +#define LVT_LOC_TOPLEFT 2 +#define LVT_LOC_TOPRIGHT 3 + typedef struct _Windows_UI_Xaml_CornerRadius { double TopLeft;