mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-11-28 09:21:02 +01:00
Clock flyout improvements when using Windows 11 taskbar
This commit is contained in:
parent
008eddd597
commit
a3c21396a1
@ -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,21 +2996,7 @@ 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)
|
|
||||||
{
|
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
POINT ptCursor;
|
POINT ptCursor;
|
||||||
GetCursorPos(&ptCursor);
|
GetCursorPos(&ptCursor);
|
||||||
@ -3022,10 +3013,26 @@ INT64 winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageHo
|
|||||||
if (ShouldShowLegacyClockExperience() == 1)
|
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
|
||||||
|
{
|
||||||
|
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
|
||||||
{
|
{
|
||||||
return PostMessageW(FindWindowW(L"ClockFlyoutWindow", NULL), WM_CLOSE, 0, 0);
|
return PostMessageW(FindWindowW(L"ClockFlyoutWindow", NULL), WM_CLOSE, 0, 0);
|
||||||
}
|
}
|
||||||
@ -3050,16 +3057,35 @@ INT64 winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageHo
|
|||||||
// and from there issue a "show clock flyout" message manually, taking care to temporarly
|
// 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
|
// change the internal clock button pointer of the class to point
|
||||||
// to the clock button on the secondary monitor.
|
// to the clock button on the secondary monitor.
|
||||||
|
if (bOldTaskbar)
|
||||||
|
{
|
||||||
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
|
||||||
|
{
|
||||||
|
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
|
||||||
{
|
{
|
||||||
return PostMessageW(FindWindowW(L"ClockFlyoutWindow", NULL), WM_CLOSE, 0, 0);
|
return PostMessageW(FindWindowW(L"ClockFlyoutWindow", NULL), WM_CLOSE, 0, 0);
|
||||||
}
|
}
|
||||||
@ -3069,6 +3095,8 @@ INT64 winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageHo
|
|||||||
ToggleNotificationsFlyout();
|
ToggleNotificationsFlyout();
|
||||||
return 0;
|
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,8 +3127,31 @@ 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;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user