|
|
|
@ -90,6 +90,7 @@ HMONITOR hMonitorList[30]; |
|
|
|
DWORD dwMonitorCount = 0; |
|
|
|
DWORD dwMonitorCount = 0; |
|
|
|
int Code = 0; |
|
|
|
int Code = 0; |
|
|
|
HRESULT InjectStartFromExplorer(); |
|
|
|
HRESULT InjectStartFromExplorer(); |
|
|
|
|
|
|
|
void InvokeClockFlyout(); |
|
|
|
|
|
|
|
|
|
|
|
#define ORB_STYLE_WINDOWS10 0 |
|
|
|
#define ORB_STYLE_WINDOWS10 0 |
|
|
|
#define ORB_STYLE_WINDOWS11 1 |
|
|
|
#define ORB_STYLE_WINDOWS11 1 |
|
|
|
@ -390,7 +391,7 @@ HWND GetMonitorInfoFromPointForTaskbarFlyoutActivation(POINT ptCursor, DWORD dwF |
|
|
|
return hWnd; |
|
|
|
return hWnd; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
POINT GetDefaultWinXPosition(BOOL bUseRcWork, BOOL* lpBottom, BOOL* lpRight, BOOL bAdjust) |
|
|
|
POINT GetDefaultWinXPosition(BOOL bUseRcWork, BOOL* lpBottom, BOOL* lpRight, BOOL bAdjust, BOOL bToRight) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (lpBottom) *lpBottom = FALSE; |
|
|
|
if (lpBottom) *lpBottom = FALSE; |
|
|
|
if (lpRight) *lpRight = FALSE; |
|
|
|
if (lpRight) *lpRight = FALSE; |
|
|
|
@ -420,6 +421,10 @@ POINT GetDefaultWinXPosition(BOOL bUseRcWork, BOOL* lpBottom, BOOL* lpRight, BOO |
|
|
|
{ |
|
|
|
{ |
|
|
|
point.x = mi.rcMonitor.left; |
|
|
|
point.x = mi.rcMonitor.left; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (bToRight) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
point.x = mi.rcMonitor.right; |
|
|
|
|
|
|
|
} |
|
|
|
if (bAdjust) |
|
|
|
if (bAdjust) |
|
|
|
{ |
|
|
|
{ |
|
|
|
point.x++; |
|
|
|
point.x++; |
|
|
|
@ -1119,7 +1124,7 @@ INT64 CLauncherTipContextMenu_ShowLauncherTipContextMenuHook( |
|
|
|
{ |
|
|
|
{ |
|
|
|
point = *pt; |
|
|
|
point = *pt; |
|
|
|
BOOL bBottom, bRight; |
|
|
|
BOOL bBottom, bRight; |
|
|
|
POINT dPt = GetDefaultWinXPosition(FALSE, &bBottom, &bRight, FALSE); |
|
|
|
POINT dPt = GetDefaultWinXPosition(FALSE, &bBottom, &bRight, FALSE, FALSE); |
|
|
|
POINT posCursor; |
|
|
|
POINT posCursor; |
|
|
|
GetCursorPos(&posCursor); |
|
|
|
GetCursorPos(&posCursor); |
|
|
|
RECT rcHitZone; |
|
|
|
RECT rcHitZone; |
|
|
|
@ -1198,7 +1203,7 @@ INT64 CLauncherTipContextMenu_ShowLauncherTipContextMenuHook( |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
point = GetDefaultWinXPosition(FALSE, NULL, NULL, TRUE); |
|
|
|
point = GetDefaultWinXPosition(FALSE, NULL, NULL, TRUE, FALSE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
IUnknown* iunk = NULL; |
|
|
|
IUnknown* iunk = NULL; |
|
|
|
@ -2973,7 +2978,7 @@ HRESULT pnidui_CoCreateInstanceHook( |
|
|
|
#pragma endregion |
|
|
|
#pragma endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma region "Show Clock flyout on Win+C" |
|
|
|
#pragma region "Show Clock flyout on Win+C and Win+Alt+D" |
|
|
|
#ifdef _WIN64 |
|
|
|
#ifdef _WIN64 |
|
|
|
typedef struct _ClockButton_ToggleFlyoutCallback_Params |
|
|
|
typedef struct _ClockButton_ToggleFlyoutCallback_Params |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -2991,84 +2996,107 @@ void ClockButton_ToggleFlyoutCallback( |
|
|
|
*((INT64*)params->TrayUIInstance + params->CLOCKBUTTON_OFFSET_IN_TRAYUI) = params->oldClockButtonInstance; |
|
|
|
*((INT64*)params->TrayUIInstance + params->CLOCKBUTTON_OFFSET_IN_TRAYUI) = params->oldClockButtonInstance; |
|
|
|
free(params); |
|
|
|
free(params); |
|
|
|
} |
|
|
|
} |
|
|
|
INT64 winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageHook( |
|
|
|
void InvokeClockFlyout() |
|
|
|
void* _this, |
|
|
|
|
|
|
|
INT64 a2, |
|
|
|
|
|
|
|
INT a3 |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!bClockFlyoutOnWinC) |
|
|
|
POINT ptCursor; |
|
|
|
{ |
|
|
|
GetCursorPos(&ptCursor); |
|
|
|
if (winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageFunc) |
|
|
|
HWND hWnd = GetMonitorInfoFromPointForTaskbarFlyoutActivation( |
|
|
|
{ |
|
|
|
ptCursor, |
|
|
|
return winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageFunc(_this, a2, a3); |
|
|
|
MONITOR_DEFAULTTOPRIMARY, |
|
|
|
} |
|
|
|
NULL |
|
|
|
return 0; |
|
|
|
); |
|
|
|
} |
|
|
|
HWND prev_hWnd = hWnd; |
|
|
|
if (a2 == 786 && a3 == 107) |
|
|
|
HWND hShellTray_Wnd = FindWindowExW(NULL, NULL, L"Shell_TrayWnd", NULL); |
|
|
|
|
|
|
|
const unsigned int WM_TOGGLE_CLOCK_FLYOUT = 1486; |
|
|
|
|
|
|
|
if (hWnd == hShellTray_Wnd) |
|
|
|
{ |
|
|
|
{ |
|
|
|
POINT ptCursor; |
|
|
|
if (ShouldShowLegacyClockExperience() == 1) |
|
|
|
GetCursorPos(&ptCursor); |
|
|
|
|
|
|
|
HWND hWnd = GetMonitorInfoFromPointForTaskbarFlyoutActivation( |
|
|
|
|
|
|
|
ptCursor, |
|
|
|
|
|
|
|
MONITOR_DEFAULTTOPRIMARY, |
|
|
|
|
|
|
|
NULL |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
HWND prev_hWnd = hWnd; |
|
|
|
|
|
|
|
HWND hShellTray_Wnd = FindWindowExW(NULL, NULL, L"Shell_TrayWnd", NULL); |
|
|
|
|
|
|
|
const unsigned int WM_TOGGLE_CLOCK_FLYOUT = 1486; |
|
|
|
|
|
|
|
if (hWnd == hShellTray_Wnd) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
if (ShouldShowLegacyClockExperience() == 1) |
|
|
|
if (!FindWindowW(L"ClockFlyoutWindow", NULL)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!FindWindowW(L"ClockFlyoutWindow", NULL)) |
|
|
|
if (bOldTaskbar) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return ShowLegacyClockExperience(FindWindowExW(FindWindowExW(hShellTray_Wnd, NULL, L"TrayNotifyWnd", NULL), NULL, L"TrayClockWClass", NULL)); |
|
|
|
return ShowLegacyClockExperience(FindWindowExW(FindWindowExW(hShellTray_Wnd, NULL, L"TrayNotifyWnd", NULL), NULL, L"TrayClockWClass", NULL)); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
return PostMessageW(FindWindowW(L"ClockFlyoutWindow", NULL), WM_CLOSE, 0, 0); |
|
|
|
POINT pt; |
|
|
|
|
|
|
|
pt.x = 0; |
|
|
|
|
|
|
|
pt.y = 0; |
|
|
|
|
|
|
|
GetCursorPos(&pt); |
|
|
|
|
|
|
|
BOOL bBottom, bRight; |
|
|
|
|
|
|
|
POINT dPt = GetDefaultWinXPosition(FALSE, NULL, NULL, FALSE, TRUE); |
|
|
|
|
|
|
|
SetCursorPos(dPt.x - 1, dPt.y); |
|
|
|
|
|
|
|
BOOL bRet = ShowLegacyClockExperience(hShellTray_Wnd); |
|
|
|
|
|
|
|
SetCursorPos(pt.x, pt.y); |
|
|
|
|
|
|
|
return bRet; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if (ShouldShowLegacyClockExperience() == 2) |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
ToggleNotificationsFlyout(); |
|
|
|
return PostMessageW(FindWindowW(L"ClockFlyoutWindow", NULL), WM_CLOSE, 0, 0); |
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// On the main monitor, the TrayUI component of CTray handles this
|
|
|
|
|
|
|
|
// message and basically does a `ClockButton::ToggleFlyout`; that's
|
|
|
|
|
|
|
|
// the only place in code where that is used, otherwise, clicking and
|
|
|
|
|
|
|
|
// dismissing the clock flyout probably involves 2 separate methods
|
|
|
|
|
|
|
|
PostMessageW(hShellTray_Wnd, WM_TOGGLE_CLOCK_FLYOUT, 0, 0); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else if (ShouldShowLegacyClockExperience() == 2) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ToggleNotificationsFlyout(); |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// On the main monitor, the TrayUI component of CTray handles this
|
|
|
|
|
|
|
|
// message and basically does a `ClockButton::ToggleFlyout`; that's
|
|
|
|
|
|
|
|
// the only place in code where that is used, otherwise, clicking and
|
|
|
|
|
|
|
|
// dismissing the clock flyout probably involves 2 separate methods
|
|
|
|
|
|
|
|
PostMessageW(hShellTray_Wnd, WM_TOGGLE_CLOCK_FLYOUT, 0, 0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Of course, on secondary monitors, the situation is much more
|
|
|
|
|
|
|
|
// complicated; there is no simple way to do this, afaik; the way I do it
|
|
|
|
|
|
|
|
// is to obtain a pointer to TrayUI from CTray (pointers to the classes
|
|
|
|
|
|
|
|
// that created the windows are always available at location 0 in the hWnd)
|
|
|
|
|
|
|
|
// and from there issue a "show clock flyout" message manually, taking care to temporarly
|
|
|
|
|
|
|
|
// change the internal clock button pointer of the class to point
|
|
|
|
|
|
|
|
// to the clock button on the secondary monitor.
|
|
|
|
|
|
|
|
if (bOldTaskbar) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Of course, on secondary monitors, the situation is much more
|
|
|
|
|
|
|
|
// complicated; there is no simple way to do this, afaik; the way I do it
|
|
|
|
|
|
|
|
// is to obtain a pointer to TrayUI from CTray (pointers to the classes
|
|
|
|
|
|
|
|
// that created the windows are always available at location 0 in the hWnd)
|
|
|
|
|
|
|
|
// and from there issue a "show clock flyout" message manually, taking care to temporarly
|
|
|
|
|
|
|
|
// change the internal clock button pointer of the class to point
|
|
|
|
|
|
|
|
// to the clock button on the secondary monitor.
|
|
|
|
|
|
|
|
hWnd = FindWindowExW(hWnd, NULL, L"ClockButton", NULL); |
|
|
|
hWnd = FindWindowExW(hWnd, NULL, L"ClockButton", NULL); |
|
|
|
if (hWnd) |
|
|
|
} |
|
|
|
|
|
|
|
if (hWnd) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (ShouldShowLegacyClockExperience() == 1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (ShouldShowLegacyClockExperience() == 1) |
|
|
|
if (!FindWindowW(L"ClockFlyoutWindow", NULL)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!FindWindowW(L"ClockFlyoutWindow", NULL)) |
|
|
|
if (bOldTaskbar) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return ShowLegacyClockExperience(hWnd); |
|
|
|
return ShowLegacyClockExperience(hWnd); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
return PostMessageW(FindWindowW(L"ClockFlyoutWindow", NULL), WM_CLOSE, 0, 0); |
|
|
|
POINT pt; |
|
|
|
|
|
|
|
pt.x = 0; |
|
|
|
|
|
|
|
pt.y = 0; |
|
|
|
|
|
|
|
GetCursorPos(&pt); |
|
|
|
|
|
|
|
BOOL bBottom, bRight; |
|
|
|
|
|
|
|
POINT dPt = GetDefaultWinXPosition(FALSE, NULL, NULL, FALSE, TRUE); |
|
|
|
|
|
|
|
SetCursorPos(dPt.x, dPt.y); |
|
|
|
|
|
|
|
BOOL bRet = ShowLegacyClockExperience(hWnd); |
|
|
|
|
|
|
|
SetCursorPos(pt.x, pt.y); |
|
|
|
|
|
|
|
return bRet; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if (ShouldShowLegacyClockExperience() == 2) |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
ToggleNotificationsFlyout(); |
|
|
|
return PostMessageW(FindWindowW(L"ClockFlyoutWindow", NULL), WM_CLOSE, 0, 0); |
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (ShouldShowLegacyClockExperience() == 2) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ToggleNotificationsFlyout(); |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (bOldTaskbar) |
|
|
|
|
|
|
|
{ |
|
|
|
INT64* CTrayInstance = (BYTE*)(GetWindowLongPtrW(hShellTray_Wnd, 0)); // -> CTray
|
|
|
|
INT64* CTrayInstance = (BYTE*)(GetWindowLongPtrW(hShellTray_Wnd, 0)); // -> CTray
|
|
|
|
void* ClockButtonInstance = (BYTE*)(GetWindowLongPtrW(hWnd, 0)); // -> ClockButton
|
|
|
|
void* ClockButtonInstance = (BYTE*)(GetWindowLongPtrW(hWnd, 0)); // -> ClockButton
|
|
|
|
|
|
|
|
|
|
|
|
@ -3099,7 +3127,30 @@ INT64 winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageHo |
|
|
|
SendMessageCallbackW(hShellTray_Wnd, WM_TOGGLE_CLOCK_FLYOUT, 0, 0, ClockButton_ToggleFlyoutCallback, params); |
|
|
|
SendMessageCallbackW(hShellTray_Wnd, WM_TOGGLE_CLOCK_FLYOUT, 0, 0, ClockButton_ToggleFlyoutCallback, params); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
PostMessageW(hShellTray_Wnd, WM_TOGGLE_CLOCK_FLYOUT, 0, 0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
INT64 winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageHook( |
|
|
|
|
|
|
|
void* _this, |
|
|
|
|
|
|
|
INT64 a2, |
|
|
|
|
|
|
|
INT a3 |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!bClockFlyoutOnWinC) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageFunc) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageFunc(_this, a2, a3); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (a2 == 786 && a3 == 107) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
InvokeClockFlyout(); |
|
|
|
} |
|
|
|
} |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -3194,7 +3245,7 @@ LRESULT explorer_SendMessageW(HWND hWndx, UINT uMsg, WPARAM wParam, LPARAM lPara |
|
|
|
); |
|
|
|
); |
|
|
|
if (hWnd) |
|
|
|
if (hWnd) |
|
|
|
{ |
|
|
|
{ |
|
|
|
POINT pt = GetDefaultWinXPosition(FALSE, NULL, NULL, TRUE); |
|
|
|
POINT pt = GetDefaultWinXPosition(FALSE, NULL, NULL, TRUE, FALSE); |
|
|
|
// Finally implemented a variation of
|
|
|
|
// Finally implemented a variation of
|
|
|
|
// https://github.com/valinet/ExplorerPatcher/issues/3
|
|
|
|
// https://github.com/valinet/ExplorerPatcher/issues/3
|
|
|
|
// inspired by how the real Start button activates this menu
|
|
|
|
// inspired by how the real Start button activates this menu
|
|
|
|
|