Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aerexplorer 1.6.2 #743

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 35 additions & 20 deletions mods/aerexplorer.wh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @id aerexplorer
// @name Aerexplorer
// @description Various tweaks for Windows Explorer to make it more like older versions.
// @version 1.6.1
// @version 1.6.2
// @author aubymori
// @github https://github.com/aubymori
// @include *
Expand Down Expand Up @@ -1056,7 +1056,7 @@ bool THISCALL CShellBrowser__ShouldShowRibbon_hook(
# define IShellBrowser_IShellItem(pThis) *((IShellItem **)pThis + 47)
#endif

/* Get the pointer to a navbar from an Explorer window */
/* Is the Ribbon visible? */
bool ExplorerHasRibbon(HWND hWnd)
{
if (GetParent(hWnd))
Expand Down Expand Up @@ -1224,7 +1224,28 @@ LRESULT CALLBACK CNscTree_s_SubClassTreeWndProc_hook(
);
}

#pragma endregion
#ifdef _WIN64
# define CNscTree_Indent(pThis) *((DWORD *)pThis + 116)
#else
# define CNscTree_Indent(pThis) *((DWORD *)pThis + 75)
#endif

void *CNscTree_ScaleAndSetIndent_addr SHARED_SECTION = nullptr;
void (THISCALL *CNscTree_ScaleAndSetIndent_orig)(void *);
void THISCALL CNscTree_ScaleAndSetIndent_hook(
void *pThis
)
{
/* It's inaccurate in Vista but changing this value doesn't
seem to do anything there */
if (settings.npst == NPST_SEVEN)
{
CNscTree_Indent(pThis) = 10;
}
CNscTree_ScaleAndSetIndent_orig(pThis);
}

#pragma endregion // ""Old navigation pane sizing""

#pragma region "Navbar glass"

Expand Down Expand Up @@ -1258,7 +1279,6 @@ void CNavBar__UpdateGlass(void *pThis)

if (rc.top == 0 || rc.top == captionHeight)
{
Wh_Log(L"Extending.");
MARGINS mrg = { 0 };
mrg.cyTopHeight = rc.bottom;
DwmExtendFrameIntoClientArea_orig(
Expand Down Expand Up @@ -1338,9 +1358,6 @@ LRESULT CALLBACK CNavBar_s_SizableWndProc_hook(
hWnd, uMsg, wParam, lParam
);

// if (uMsg == 0x41f)
// Wh_Log(L"0x%X, %d, %d", uMsg, wParam, lParam);

if (settings.navbarglass)
{
void *pThis = (void *)GetWindowLongPtrW(hWnd, 0);
Expand Down Expand Up @@ -1396,15 +1413,6 @@ LRESULT CALLBACK RebarSubclassWndProc(
EndPaint(hWnd, &ps);
}

if (uMsg == WM_PAINT)
{
Wh_Log(L"WM_PAINT %d", ExplorerHasRibbon(hWnd));
}
else if (uMsg == WM_ERASEBKGND)
{
Wh_Log(L"WM_ERASEBKGND %d", ExplorerHasRibbon(hWnd));
}

return 0;
}
else if (uMsg == WM_NCDESTROY)
Expand Down Expand Up @@ -1926,8 +1934,6 @@ HRESULT STDCALL CShellBrowser_GetFolderFlags_hook(
FOLDERFLAGS *pfolderFlags
)
{
Wh_Log(L"CShellBrowser::GetFolderFlags(this = %p)", pThis);
Wh_Log(L"getfolderflags");
HRESULT hr = CShellBrowser_GetFolderFlags_orig(pThis, pfolderMask, pfolderFlags);
if (SUCCEEDED(hr) && settings.colheaders)
{
Expand Down Expand Up @@ -1982,8 +1988,6 @@ void STDCALL CShellBrowser___OnRibbonVisibilityChange_hook(void *pThis, int newS
// inside of the explorer window.
HWND hWnd = CShellBrowser_Window(pThis);

Wh_Log(L"CShellBrowser::OnRibbonVisibilityChange: HWND = %p", hWnd);

HWND hWndExplorerRoot = GetAncestor(hWnd, GA_ROOTOWNER);
HWND hWndWorkerW = FindWindowExW(hWndExplorerRoot, NULL, L"WorkerW", NULL);

Expand Down Expand Up @@ -2828,6 +2832,17 @@ BOOL Wh_ModInit(void)
false,
&CNscTree_s_SubClassTreeWndProc_addr
},
{
{
L"private: void "
STHISCALL
L" CNscTree::ScaleAndSetIndent(void)"
},
&CNscTree_ScaleAndSetIndent_orig,
CNscTree_ScaleAndSetIndent_hook,
false,
&CNscTree_ScaleAndSetIndent_addr
},
{
{
L"protected: void "
Expand Down