Skip to content
This repository has been archived by the owner on Nov 18, 2023. It is now read-only.

Commit

Permalink
Merge branch 'valinet:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
creeper-0910 authored Nov 21, 2022
2 parents cfd1439 + 7c4567a commit 8adca04
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Please make sure you are connected to the Internet while installing, the applica
* Windows 11 taskbar: Option to use the stock taskbar context menu. (451db3c)
* Fixed a bug that could display the Start menu on a wrong monitor or outside the screen when the taskbar was moved to the top of the screen and the previous setting was at the right edge of the screen. (53fad19)

##### 2

* Windows 11 Start menu: Fixed a bug that prevented the disable "Recommended" section feature from working when the scaling level of the screen the Start menu is displayed on is set to 125% (120 DPI). (9f9d43e)

## 22621.608.51

Tested on OS builds 22621.608 and 22000.1042.
Expand Down
87 changes: 87 additions & 0 deletions ExplorerPatcher/lvt.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,79 @@ void LVT_StartUI_EnableRoundedCorners(HWND hWnd, DWORD dwReceipe, DWORD dwPos, H
}
}

void LVT_StartDocked_120DPIHack(int maxHeight)
{
HRESULT hr = S_OK;
Windows_UI_Xaml_IDependencyObject* pRootDependencyObject = NULL;
if (SUCCEEDED(hr))
{
HSTRING_HEADER hshWindowStatics;
HSTRING hsWindowStatics = NULL;
hr = WindowsCreateStringReference(L"Windows.UI.Xaml.Window", 22, &hshWindowStatics, &hsWindowStatics);
if (SUCCEEDED(hr) && hsWindowStatics)
{
Windows_UI_Xaml_IWindowStatics* pWindowStatics = NULL;
hr = RoGetActivationFactory(hsWindowStatics, &IID_Windows_UI_Xaml_IWindowStatics, &pWindowStatics);
if (SUCCEEDED(hr))
{
Windows_UI_Xaml_IWindow* pWindow = NULL;
hr = pWindowStatics->lpVtbl->get_Current(pWindowStatics, &pWindow);
if (SUCCEEDED(hr))
{
IInspectable* pUIElement = NULL;
hr = pWindow->lpVtbl->get_Content(pWindow, &pUIElement);
if (SUCCEEDED(hr))
{
hr = pUIElement->lpVtbl->QueryInterface(pUIElement, &IID_Windows_UI_Xaml_IDependencyObject, &pRootDependencyObject);

pUIElement->lpVtbl->Release(pUIElement);
}
pWindow->lpVtbl->Release(pWindow);
}
pWindowStatics->lpVtbl->Release(pWindowStatics);
}
WindowsDeleteString(hsWindowStatics);
}
}
if (pRootDependencyObject)
{
HSTRING_HEADER hshVisualTreeHelperStatics;
HSTRING hsVisualTreeHelperStatics = NULL;
hr = WindowsCreateStringReference(L"Windows.UI.Xaml.Media.VisualTreeHelper", 38, &hshVisualTreeHelperStatics, &hsVisualTreeHelperStatics);
if (SUCCEEDED(hr) && hsVisualTreeHelperStatics)
{
Windows_UI_Xaml_IVisualTreeHelperStatics* pVisualTreeHelperStatics = NULL;
hr = RoGetActivationFactory(hsVisualTreeHelperStatics, &IID_Windows_UI_Xaml_IVisualTreeHelperStatics, &pVisualTreeHelperStatics);
if (SUCCEEDED(hr))
{
Windows_UI_Xaml_IDependencyObject* pStartSizingFrame = LVT_FindChildByClassName(pRootDependencyObject, pVisualTreeHelperStatics, L"StartDocked.StartSizingFrame", NULL);
if (pStartSizingFrame)
{
Windows_UI_Xaml_IUIElement* pIUIElement = NULL;
pStartSizingFrame->lpVtbl->QueryInterface(pStartSizingFrame, &IID_Windows_UI_Xaml_IUIElement, &pIUIElement);
if (pIUIElement)
{
Windows_UI_Xaml_IFrameworkElement* pFrameworkElement = NULL;
pStartSizingFrame->lpVtbl->QueryInterface(pStartSizingFrame, &IID_Windows_UI_Xaml_IFrameworkElement, &pFrameworkElement);
if (pFrameworkElement)
{
pIUIElement->lpVtbl->put_Visibility(pIUIElement, Windows_UI_Xaml_Visibility_Collapsed);
pFrameworkElement->lpVtbl->put_MaxHeight(pFrameworkElement, maxHeight);
pIUIElement->lpVtbl->put_Visibility(pIUIElement, Windows_UI_Xaml_Visibility_Visible);
pFrameworkElement->lpVtbl->Release(pFrameworkElement);
}
pIUIElement->lpVtbl->Release(pIUIElement);
}
pStartSizingFrame->lpVtbl->Release(pStartSizingFrame);
}
pVisualTreeHelperStatics->lpVtbl->Release(pVisualTreeHelperStatics);
}
WindowsDeleteString(hsVisualTreeHelperStatics);
}
pRootDependencyObject->lpVtbl->Release(pRootDependencyObject);
}
}

// Reference: https://www.reddit.com/r/Windows11/comments/p1ksou/this_is_not_a_concept_microsoft_in_windows_11/
void LVT_StartDocked_DisableRecommendedSection(HWND hWnd, BOOL bApply, RECT* rect)
{
Expand Down Expand Up @@ -604,6 +677,20 @@ void LVT_StartDocked_DisableRecommendedSection(HWND hWnd, BOOL bApply, RECT* rec
SetRect(&rc, drc.Left, drc.Top, drc.Right, drc.Bottom);
SetRect(&rc, MulDiv(rc.left, dpi, 96), MulDiv(rc.top, dpi, 96), MulDiv(rc.right, dpi, 96), MulDiv(rc.bottom, dpi, 96));
*rect = rc;
if (bApply && dpi == 120)
{
HANDLE hRealThreadHandle = NULL;
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hRealThreadHandle, THREAD_SET_CONTEXT, FALSE, 0);
if (hRealThreadHandle)
{
QueueUserAPC(LVT_StartDocked_120DPIHack, hRealThreadHandle, 826);
CloseHandle(hRealThreadHandle);
}
}
else if (pFrameworkElement)
{
pFrameworkElement->lpVtbl->put_MaxHeight(pFrameworkElement, 726.0);
}
if (pFrameworkElement)
{
pFrameworkElement->lpVtbl->Release(pFrameworkElement);
Expand Down
7 changes: 5 additions & 2 deletions ExplorerPatcher/lvt.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <roapi.h>
#include <winstring.h>
#include <stdio.h>
#include <Shlwapi.h>

#define LVT_LOC_NONE 0
#define LVT_LOC_BOTTOMLEFT 1
Expand Down Expand Up @@ -460,10 +461,12 @@ typedef struct Windows_UI_Xaml_IFrameworkElement_Vtbl
__RPC__in Windows_UI_Xaml_IFrameworkElement* This);

HRESULT(STDMETHODCALLTYPE* get_MaxHeight)(
__RPC__in Windows_UI_Xaml_IFrameworkElement* This);
__RPC__in Windows_UI_Xaml_IFrameworkElement* This,
/* [out] */ __RPC__out DOUBLE* value);

HRESULT(STDMETHODCALLTYPE* put_MaxHeight)(
__RPC__in Windows_UI_Xaml_IFrameworkElement* This);
__RPC__in Windows_UI_Xaml_IFrameworkElement* This,
/* [in] */ __RPC__in DOUBLE value);

HRESULT(STDMETHODCALLTYPE* get_HorizontalAlignment)(
__RPC__in Windows_UI_Xaml_IFrameworkElement* This);
Expand Down
6 changes: 3 additions & 3 deletions version.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define VER_MAJOR 22621
#define VER_MINOR 819
#define VER_BUILD_HI 52
#define VER_BUILD_LO 1
#define VER_BUILD_LO 2
#define VER_FLAGS VS_FF_PRERELEASE


Expand All @@ -12,5 +12,5 @@
#define VER_STR(arg) #arg

// The String form of the version numbers
#define VER_FILE_STRING VALUE "FileVersion", "22621.819.52.1"
#define VER_PRODUCT_STRING VALUE "ProductVersion", "22621.819.52.1"
#define VER_FILE_STRING VALUE "FileVersion", "22621.819.52.2"
#define VER_PRODUCT_STRING VALUE "ProductVersion", "22621.819.52.2"

0 comments on commit 8adca04

Please sign in to comment.