mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-11-23 23:21:08 +01:00
Win+X positioning improvements; fixes #31
This commit is contained in:
parent
a94c0347a7
commit
44b84e9666
15
CHANGELOG.md
15
CHANGELOG.md
@ -2,6 +2,19 @@
|
||||
|
||||
This document includes the same release notes as in the [Releases](https://github.com/valinet/ExplorerPatcher/releases) section on GitHub.
|
||||
|
||||
## 22000.194.0.23
|
||||
|
||||
Tested on build: 22000.194.
|
||||
|
||||
* Fixed a bug that showed`Win`+`X` on the wrong monitor in certain scenarios
|
||||
* `Win`+`X` shows in Windows 11 fashion (centered, above the Start button) if using a centered taskbar with centered Start button as well (using a program like [TaskbarX](https://github.com/valinet/TaskbarX))
|
||||
* Fixed the bug that prevented the application from loading in`StartMenuExperienceHost.exe` (thanks to @BraINstinct0 for the report)
|
||||
* Fixed padding and element sizes in GUI so it better fits on smaller screens (thanks to @Gaurav-Original-ClassicShellTester for the report)
|
||||
* GUI shows application title when run outside of File Explorer
|
||||
* GUI stays on screen and just reloads the settings when restoring defaults (instead of closing)
|
||||
* Keyboard (tab) support for GUI: `Esc` to close the window, `Tab` to select the next option, `Shift`+`Tab` to select the previous option, `Space` to toggle (or activate) the option
|
||||
* Possibility of running the GUI standalone; run this command: `rundll32.exe C:\Windows\dxgi.dll,ZZGUI`; this has the advantage that it stays on the screen after restarting File Explorer
|
||||
|
||||
## 22000.194.0.22
|
||||
|
||||
Tested on build: 22000.194.
|
||||
@ -12,7 +25,7 @@ Tested on build: 22000.194.
|
||||
|
||||
Tested on build: 22000.194.
|
||||
|
||||
* Implemented configuration GUI; to access it, right click the Start button (or press `Win`+`X`) and choose "Properties"
|
||||
* Implemented configuration GUI; to access it, right click the Start button (or press `Win`+`X`) and choose "Properties" (thanks to @BraINstinct0 for the suggestion)
|
||||
|
||||
## 22000.194.0.20
|
||||
|
||||
|
@ -51,8 +51,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 22000,194,0,22
|
||||
PRODUCTVERSION 22000,194,0,22
|
||||
FILEVERSION 22000,194,0,23
|
||||
PRODUCTVERSION 22000,194,0,23
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@ -69,12 +69,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "VALINET Solutions SRL"
|
||||
VALUE "FileDescription", "ExplorerPatcher"
|
||||
VALUE "FileVersion", "22000.194.0.22"
|
||||
VALUE "FileVersion", "22000.194.0.23"
|
||||
VALUE "InternalName", "ExplorerPatcher.dll"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2006-2021 VALINET Solutions SRL. All rights reserved."
|
||||
VALUE "OriginalFilename", "ExplorerPatcher.dll"
|
||||
VALUE "ProductName", "ExplorerPatcher"
|
||||
VALUE "ProductVersion", "22000.194.0.22"
|
||||
VALUE "ProductVersion", "22000.194.0.23"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
@ -208,6 +208,7 @@ typedef struct
|
||||
void* _this;
|
||||
POINT point;
|
||||
IUnknown* iunk;
|
||||
BOOL bShouldCenterWinXHorizontally;
|
||||
} ShowLauncherTipContextMenuParameters;
|
||||
HWND hWinXWnd;
|
||||
DWORD ShowLauncherTipContextMenu(
|
||||
@ -287,7 +288,7 @@ DWORD ShowLauncherTipContextMenu(
|
||||
|
||||
BOOL res = TrackPopupMenu(
|
||||
*((HMENU*)((char*)params->_this + 0xe8)),
|
||||
TPM_RETURNCMD | TPM_RIGHTBUTTON,
|
||||
TPM_RETURNCMD | TPM_RIGHTBUTTON | (params->bShouldCenterWinXHorizontally ? TPM_CENTERALIGN : 0),
|
||||
params->point.x,
|
||||
params->point.y,
|
||||
0,
|
||||
@ -355,59 +356,83 @@ INT64 CLauncherTipContextMenu_ShowLauncherTipContextMenuHook(
|
||||
goto finalize;
|
||||
}
|
||||
|
||||
BOOL bShouldCenterWinXHorizontally = FALSE;
|
||||
POINT point;
|
||||
if (pt)
|
||||
{
|
||||
point = *pt;
|
||||
BOOL bBottom, bRight;
|
||||
POINT dPt = GetDefaultWinXPosition(FALSE, &bBottom, &bRight);
|
||||
POINT dPt = GetDefaultWinXPosition(FALSE, &bBottom, &bRight, FALSE);
|
||||
if (bBottom)
|
||||
{
|
||||
HMONITOR hMonitor = MonitorFromPoint(point, MONITOR_DEFAULTTOPRIMARY);
|
||||
MONITORINFO mi;
|
||||
mi.cbSize = sizeof(MONITORINFO);
|
||||
GetMonitorInfo(hMonitor, &mi);
|
||||
UINT dpiX, dpiY;
|
||||
HRESULT hr = GetDpiForMonitor(
|
||||
hMonitor,
|
||||
MDT_DEFAULT,
|
||||
&dpiX,
|
||||
&dpiY
|
||||
);
|
||||
double dx = dpiX / 96.0, dy = dpiY / 96.0;
|
||||
BOOL xo = FALSE, yo = FALSE;
|
||||
if (point.x - WINX_ADJUST_X * dx < mi.rcMonitor.left)
|
||||
HWND hWndUnder = WindowFromPoint(*pt);
|
||||
TCHAR wszClassName[100];
|
||||
GetClassNameW(hWndUnder, wszClassName, 100);
|
||||
if (!wcscmp(wszClassName, L"Shell_TrayWnd") || !wcscmp(wszClassName, L"Shell_SecondaryTrayWnd"))
|
||||
{
|
||||
xo = TRUE;
|
||||
hWndUnder = FindWindowEx(
|
||||
hWndUnder,
|
||||
NULL,
|
||||
L"Start",
|
||||
NULL
|
||||
);
|
||||
}
|
||||
if (point.y + WINX_ADJUST_Y * dy > mi.rcMonitor.bottom)
|
||||
RECT rcUnder;
|
||||
GetWindowRect(hWndUnder, &rcUnder);
|
||||
if (mi.rcMonitor.left != rcUnder.left)
|
||||
{
|
||||
yo = TRUE;
|
||||
}
|
||||
POINT ptCursor;
|
||||
GetCursorPos(&ptCursor);
|
||||
if (xo)
|
||||
{
|
||||
ptCursor.x += (WINX_ADJUST_X * 2) * dx;
|
||||
bShouldCenterWinXHorizontally = TRUE;
|
||||
point.x = rcUnder.left + (rcUnder.right - rcUnder.left) / 2;
|
||||
point.y = rcUnder.top;
|
||||
}
|
||||
else
|
||||
{
|
||||
point.x -= WINX_ADJUST_X * dx;
|
||||
UINT dpiX, dpiY;
|
||||
HRESULT hr = GetDpiForMonitor(
|
||||
hMonitor,
|
||||
MDT_DEFAULT,
|
||||
&dpiX,
|
||||
&dpiY
|
||||
);
|
||||
double dx = dpiX / 96.0, dy = dpiY / 96.0;
|
||||
BOOL xo = FALSE, yo = FALSE;
|
||||
if (point.x - WINX_ADJUST_X * dx < mi.rcMonitor.left)
|
||||
{
|
||||
xo = TRUE;
|
||||
}
|
||||
if (point.y + WINX_ADJUST_Y * dy > mi.rcMonitor.bottom)
|
||||
{
|
||||
yo = TRUE;
|
||||
}
|
||||
POINT ptCursor;
|
||||
GetCursorPos(&ptCursor);
|
||||
if (xo)
|
||||
{
|
||||
ptCursor.x += (WINX_ADJUST_X * 2) * dx;
|
||||
}
|
||||
else
|
||||
{
|
||||
point.x -= WINX_ADJUST_X * dx;
|
||||
}
|
||||
if (yo)
|
||||
{
|
||||
ptCursor.y -= (WINX_ADJUST_Y * 2) * dy;
|
||||
}
|
||||
else
|
||||
{
|
||||
point.y += WINX_ADJUST_Y * dy;
|
||||
}
|
||||
SetCursorPos(ptCursor.x, ptCursor.y);
|
||||
}
|
||||
if (yo)
|
||||
{
|
||||
ptCursor.y -= (WINX_ADJUST_Y * 2) * dy;
|
||||
}
|
||||
else
|
||||
{
|
||||
point.y += WINX_ADJUST_Y * dy;
|
||||
}
|
||||
SetCursorPos(ptCursor.x, ptCursor.y);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
point = GetDefaultWinXPosition(FALSE, NULL, NULL);
|
||||
point = GetDefaultWinXPosition(FALSE, NULL, NULL, TRUE);
|
||||
}
|
||||
|
||||
IUnknown* iunk;
|
||||
@ -424,6 +449,7 @@ INT64 CLauncherTipContextMenu_ShowLauncherTipContextMenuHook(
|
||||
params->_this = _this;
|
||||
params->point = point;
|
||||
params->iunk = iunk;
|
||||
params->bShouldCenterWinXHorizontally = bShouldCenterWinXHorizontally;
|
||||
hIsWinXShown = CreateThread(
|
||||
0,
|
||||
0,
|
||||
@ -1004,7 +1030,7 @@ LRESULT explorer_SendMessageW(HWND hWndx, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||
);
|
||||
if (hWnd)
|
||||
{
|
||||
POINT pt = GetDefaultWinXPosition(FALSE, NULL, NULL);
|
||||
POINT pt = GetDefaultWinXPosition(FALSE, NULL, NULL, TRUE);
|
||||
PostMessage(
|
||||
hWnd,
|
||||
WM_CONTEXTMENU,
|
||||
|
@ -264,7 +264,7 @@ __declspec(dllexport) CALLBACK ZZLaunchExplorerDelayed(HWND hWnd, HINSTANCE hIns
|
||||
ZZLaunchExplorer(hWnd, hInstance, lpszCmdLine, nCmdShow);
|
||||
}
|
||||
|
||||
POINT GetDefaultWinXPosition(BOOL bUseRcWork, BOOL* lpBottom, BOOL* lpRight)
|
||||
POINT GetDefaultWinXPosition(BOOL bUseRcWork, BOOL* lpBottom, BOOL* lpRight, BOOL bAdjust)
|
||||
{
|
||||
if (lpBottom) *lpBottom = FALSE;
|
||||
if (lpRight) *lpRight = FALSE;
|
||||
@ -294,6 +294,10 @@ POINT GetDefaultWinXPosition(BOOL bUseRcWork, BOOL* lpBottom, BOOL* lpRight)
|
||||
{
|
||||
point.x = mi.rcMonitor.left;
|
||||
}
|
||||
if (bAdjust)
|
||||
{
|
||||
point.x++;
|
||||
}
|
||||
if (rc.top - mi.rcMonitor.top == 0)
|
||||
{
|
||||
if (bUseRcWork)
|
||||
@ -304,6 +308,10 @@ POINT GetDefaultWinXPosition(BOOL bUseRcWork, BOOL* lpBottom, BOOL* lpRight)
|
||||
{
|
||||
point.y = mi.rcMonitor.top;
|
||||
}
|
||||
if (bAdjust)
|
||||
{
|
||||
point.y++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -316,6 +324,10 @@ POINT GetDefaultWinXPosition(BOOL bUseRcWork, BOOL* lpBottom, BOOL* lpRight)
|
||||
{
|
||||
point.y = mi.rcMonitor.bottom;
|
||||
}
|
||||
if (bAdjust)
|
||||
{
|
||||
point.y--;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -329,6 +341,10 @@ POINT GetDefaultWinXPosition(BOOL bUseRcWork, BOOL* lpBottom, BOOL* lpRight)
|
||||
{
|
||||
point.x = mi.rcMonitor.right;
|
||||
}
|
||||
if (bAdjust)
|
||||
{
|
||||
point.x--;
|
||||
}
|
||||
if (rc.top - mi.rcMonitor.top == 0)
|
||||
{
|
||||
if (bUseRcWork)
|
||||
@ -339,6 +355,10 @@ POINT GetDefaultWinXPosition(BOOL bUseRcWork, BOOL* lpBottom, BOOL* lpRight)
|
||||
{
|
||||
point.y = mi.rcMonitor.top;
|
||||
}
|
||||
if (bAdjust)
|
||||
{
|
||||
point.y++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -351,6 +371,10 @@ POINT GetDefaultWinXPosition(BOOL bUseRcWork, BOOL* lpBottom, BOOL* lpRight)
|
||||
{
|
||||
point.y = mi.rcMonitor.bottom;
|
||||
}
|
||||
if (bAdjust)
|
||||
{
|
||||
point.y--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ __declspec(dllexport) CALLBACK ZZLaunchExplorer(HWND hWnd, HINSTANCE hInstance,
|
||||
|
||||
__declspec(dllexport) CALLBACK ZZLaunchExplorerDelayed(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);
|
||||
|
||||
POINT GetDefaultWinXPosition(BOOL bUseRcWork, BOOL* lpBottom, BOOL* lpRight);
|
||||
POINT GetDefaultWinXPosition(BOOL bUseRcWork, BOOL* lpBottom, BOOL* lpRight, BOOL bAdjust);
|
||||
|
||||
void QueryVersionInfo(HMODULE hModule, WORD Resource, DWORD*, DWORD*, DWORD*, DWORD*);
|
||||
#endif
|
33
README.md
33
README.md
@ -39,9 +39,9 @@ Now, the classic taskbar should be enabled. Still, there is some more setup to d
|
||||
|
||||
## Configuration interface
|
||||
|
||||
To configure the most common options, the application now comes with a configuration user interface. To open it, right click the Start button (or press `Win`+`X`) and choose "Properties".
|
||||
To configure the most common options, the application now comes with a configuration user interface. To open it, right click the Start button (or press `Win`+`X`) and choose "Properties". Alternatively, to open the GUI standalone, run the following command: `rundll32.exe C:\Windows\dxgi.dll,ZZGUI`.
|
||||
|
||||
<img src="https://user-images.githubusercontent.com/6503598/135698816-b97b7305-f425-4320-b5e6-69843677e510.png" width=70% height=70%>
|
||||
<img src="https://user-images.githubusercontent.com/6503598/135729021-6befba47-84ae-4c65-8133-e380f1d36fe1.png" width=60% height=60%>
|
||||
|
||||
The icon near an option signifies its current state:
|
||||
|
||||
@ -51,6 +51,26 @@ The icon near an option signifies its current state:
|
||||
|
||||
The links at the bottom allow you to perform the most frequent actions.
|
||||
|
||||
## Recommended tools
|
||||
|
||||
Here is a list of things you may want to try to fix/enhance a few of the aspects which are not addressed by this patcher directly:
|
||||
|
||||
### Fix the battery applet
|
||||
|
||||
As you will notice, the battery flyout in the taskbar is broken in Windows 11. You can replace it with a much better alternative called [Battery Mode](https://en.bmode.tarcode.ru/) which has all the stock options and more.
|
||||
|
||||
### Disable blue highlight in menus
|
||||
|
||||
To disable the blue highlight in the context menu and return to the classic gray highlight from early Windows 11 builds, read [here](https://github.com/valinet/ExplorerPatcher/issues/18).
|
||||
|
||||
### Center taskbar icons
|
||||
|
||||
If you want the same behavior as the default one in Windows 11, which is to have the icons centered along with the Start button, but would like to use this proper classic taskbar which has features like button labels, toolbars and more, you can use my fork of the popular [TaskbarX](https://github.com/ChrisAnd1998/TaskbarX) program which fixes compatibility with Windows 11 and adds this behavior; a guide about how to set it up is available [here](https://github.com/valinet/ExplorerPatcher/issues/33).
|
||||
|
||||
### Disable window rounded corners
|
||||
|
||||
You can try one of my other utilities available [here](https://github.com/valinet/Win11DisableRoundedCorners).
|
||||
|
||||
## Manual configuration
|
||||
|
||||
To learn how to configure all the options manually, read on:
|
||||
@ -131,15 +151,6 @@ reg.exe delete "HKCU\Software\Classes\CLSID\{1d64637d-31e9-4b06-9124-e83fb178ac6
|
||||
|
||||
Also, in the next section, which desribes the configuration options for the software, you will learn about how to disable the search box altogether, should you want to.
|
||||
|
||||
### Fix the battery applet
|
||||
As you will notice, the battery flyout in the taskbar is broken in Windows 11. You can replace it with a much better alternative called [Battery Mode](https://en.bmode.tarcode.ru/) which has all the stock options and more.
|
||||
|
||||
### Disable blue highlight in menus
|
||||
To disable the blue highlight in the context menu and return to the classic gray highlight from early Windows 11 builds, read [here](https://github.com/valinet/ExplorerPatcher/issues/18).
|
||||
|
||||
### Disable window rounded corners
|
||||
You can try one of my other utilities available [here](https://github.com/valinet/Win11DisableRoundedCorners).
|
||||
|
||||
### Patcher settings
|
||||
Now that you have set up the basic stuff, you can choose to enable additional settings to enhance the experience even more. For this, customize the following commands by changing the number acording to your needs:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user