1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2025-01-26 16:13:43 +01:00

StartUI: Add padding only to the sides near the edge of the screen

This commit is contained in:
Valentin Radu 2022-03-01 20:01:44 +02:00
parent 54f12ee128
commit 4aa045b01d
2 changed files with 58 additions and 6 deletions

View File

@ -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);
}

View File

@ -7,6 +7,11 @@
#include <winstring.h>
#include <stdio.h>
#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;