Browse Source

Start menu positioning reliability enhancements

pull/91/head
Valentin Radu 4 years ago
parent
commit
21cc562f45
  1. 19
      ExplorerPatcher/dllmain.c

19
ExplorerPatcher/dllmain.c

@ -1083,7 +1083,11 @@ DEFINE_GUID(_uuidof_v13,
0x4F7F, 0x5DE5, 0xA5, 0x28, 0x4F7F, 0x5DE5, 0xA5, 0x28,
0x7e, 0xfe, 0xf4, 0x18, 0xaa, 0x48 0x7e, 0xfe, 0xf4, 0x18, 0xaa, 0x48
); );
void PositionStartMenuForMonitor(HMONITOR hMonitor, DWORD location) BOOL PositionStartMenuForMonitor(
HMONITOR hMonitor,
HDC unused1,
LPRECT unused2,
DWORD location)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
HSTRING_HEADER hstringHeader; HSTRING_HEADER hstringHeader;
@ -1161,6 +1165,7 @@ void PositionStartMenuForMonitor(HMONITOR hMonitor, DWORD location)
WindowsDeleteString(string); WindowsDeleteString(string);
RoUninitialize(); RoUninitialize();
} }
return TRUE;
} }
void PositionStartMenu(INT64 unused, DWORD location) void PositionStartMenu(INT64 unused, DWORD location)
@ -1175,7 +1180,7 @@ void PositionStartMenu(INT64 unused, DWORD location)
L"Shell_SecondaryTrayWnd", L"Shell_SecondaryTrayWnd",
NULL NULL
); );
PositionStartMenuForMonitor(MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY), location); PositionStartMenuForMonitor(MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY), NULL, NULL, location);
} while (hWnd); } while (hWnd);
if (!hWnd) if (!hWnd)
{ {
@ -1185,14 +1190,16 @@ void PositionStartMenu(INT64 unused, DWORD location)
L"Shell_TrayWnd", L"Shell_TrayWnd",
NULL NULL
); );
PositionStartMenuForMonitor(MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY), location); PositionStartMenuForMonitor(MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY), NULL, NULL, location);
} }
} }
DWORD PositionStartMenuTimeout(INT64 timeout) DWORD PositionStartMenuTimeout(INT64 timeout)
{ {
Sleep(timeout); Sleep(timeout);
PositionStartMenu(0, GetStartMenuPosition()); printf("Started \"Position Start menu\" thread.\n");
EnumDisplayMonitors(NULL, NULL, PositionStartMenuForMonitor, GetStartMenuPosition());
printf("Ended \"Position Start menu\" thread.\n");
} }
DWORD GetStartMenuPosition() DWORD GetStartMenuPosition()
@ -1493,7 +1500,6 @@ DWORD SignalShellReady(DWORD wait)
0 0
); );
*/ */
PositionStartMenu(0, GetStartMenuPosition());
/*printf("hook show desktop\n"); /*printf("hook show desktop\n");
void* ShellTrayWndProcFuncT = GetWindowLongPtrW(hWnd, GWLP_WNDPROC); void* ShellTrayWndProcFuncT = GetWindowLongPtrW(hWnd, GWLP_WNDPROC);
if (ShellTrayWndProcHook != ShellTrayWndProcFuncT) if (ShellTrayWndProcHook != ShellTrayWndProcFuncT)
@ -1977,6 +1983,9 @@ __declspec(dllexport) DWORD WINAPI main(
{ {
RegCloseKey(hKey); RegCloseKey(hKey);
} }
CreateThread(0, 0, PositionStartMenuTimeout, 0, 0, 0);
} }
else else
{ {

Loading…
Cancel
Save