Report and reset held input blocking LAN handoffs

Refs #227
This commit is contained in:
agrynco committed 2026-12-01 20:38:02 +02:00
1 parent 92b72c2e7b
commit 240cc535ba
10 files changed
+356 -48

No files matched your search

+4 -1
View File
@@ -48,7 +48,7 @@ void chooseInputAction(HWND resident, DWORD pid, const wchar_t *expected)
std::wstring_view(label).starts_with(expected), "incorrect input state in tray menu");
HMENU help{};
MENUITEMINFOW donation{sizeof(donation), MIIM_BITMAP};
bool donationSeparated = false;
bool donationSeparated = false, resetAvailable = false;
const auto menuTitle = [&](HMENU source, int index) {
if (!GetMenuStringW(source, index, label, std::size(label), MF_BYPOSITION)) return std::wstring_view{};
const std::wstring_view text(label);
@@ -56,6 +56,8 @@ void chooseInputAction(HWND resident, DWORD pid, const wchar_t *expected)
};
for (int i = 0, count = GetMenuItemCount(menu); i < count; ++i) {
const auto title = menuTitle(menu, i);
if (title == L"Reset held keys and mouse buttons" || title == L"Скинути затиснуті клавіші й кнопки миші")
resetAvailable = (GetMenuState(menu, i, MF_BYPOSITION) & (MF_GRAYED | MF_DISABLED)) == 0;
if (title == L"&Donate via Monobank" && i > 0 && i + 1 < count) {
donationSeparated = (GetMenuState(menu, i - 1, MF_BYPOSITION) & MF_SEPARATOR) &&
(GetMenuState(menu, i + 1, MF_BYPOSITION) & MF_SEPARATOR);
@@ -66,6 +68,7 @@ void chooseInputAction(HWND resident, DWORD pid, const wchar_t *expected)
break;
}
}
require(resetAvailable, "the tray offers manual input reset while active or paused");
require(donationSeparated && donation.hbmpItem, "tray donation item has an icon and both separators");
require(help && GetMenuItemCount(help) == 3 && menuTitle(help, 0) == L"&User guide" &&
menuTitle(help, 1) == ks::whatsNewTitle(GetThreadUILanguage()) &&