1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-28 01:10:55 +01:00

Win+X shows correctly on multi monitor setups

This commit is contained in:
Valentin Radu 2021-09-01 07:07:53 +03:00
parent 9074649c73
commit 557c74da28

View File

@ -913,6 +913,8 @@ DWORD ShowLauncherTipContextMenu(
POINT GetDefaultWinXPosition() POINT GetDefaultWinXPosition()
{ {
POINT point, ptCursor; POINT point, ptCursor;
point.x = 0;
point.y = 0;
GetCursorPos(&ptCursor); GetCursorPos(&ptCursor);
HMONITOR hMonitor = MonitorFromPoint(ptCursor, MONITOR_DEFAULTTOPRIMARY); HMONITOR hMonitor = MonitorFromPoint(ptCursor, MONITOR_DEFAULTTOPRIMARY);
MONITORINFO mi; MONITORINFO mi;
@ -924,33 +926,37 @@ POINT GetDefaultWinXPosition()
), ),
&mi &mi
); );
HWND hWnd = FindWindowEx( HWND hWnd = NULL;
NULL, do
NULL, {
L"Shell_TrayWnd", hWnd = FindWindowEx(
NULL NULL,
); hWnd,
if (MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY) != hMonitor) L"Shell_SecondaryTrayWnd",
NULL
);
if (MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY) == hMonitor)
{
break;
}
} while (hWnd);
if (!hWnd)
{ {
hWnd = FindWindowEx( hWnd = FindWindowEx(
NULL, NULL,
NULL, NULL,
L"Shell_SecondaryTrayWnd", L"Shell_TrayWnd",
NULL NULL
); );
while (hWnd) ptCursor.x = 0;
{ ptCursor.y = 0;
if (MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY) == hMonitor) GetMonitorInfo(
{ MonitorFromPoint(
break; ptCursor,
} MONITOR_DEFAULTTOPRIMARY
hWnd = FindWindowEx( ),
NULL, &mi
hWnd, );
L"Shell_SecondaryTrayWnd",
NULL
);
}
} }
if (hWnd) if (hWnd)
{ {