mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[Shortcut Guide] Suppress Windows Menu appearing (#13553)
* Get the new settings values * Suppress windows menu appearing * Send new settings telemetry * Address PR comments
This commit is contained in:
@@ -7,4 +7,6 @@ struct ShortcutGuideSettings
|
|||||||
int overlayOpacity = 90;
|
int overlayOpacity = 90;
|
||||||
std::wstring theme = L"system";
|
std::wstring theme = L"system";
|
||||||
std::wstring disabledApps = L"";
|
std::wstring disabledApps = L"";
|
||||||
|
bool shouldReactToPressedWinKey = false;
|
||||||
|
int windowsKeyPressTime = 900;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -221,6 +221,15 @@ void OverlayWindow::CloseWindow(HideWindowType type, int mainThreadId)
|
|||||||
|
|
||||||
if (this->winkey_popup)
|
if (this->winkey_popup)
|
||||||
{
|
{
|
||||||
|
if (shouldReactToPressedWinKey.value)
|
||||||
|
{
|
||||||
|
// Send a dummy key to prevent Start Menu from activating
|
||||||
|
INPUT dummyEvent[1] = {};
|
||||||
|
dummyEvent[0].type = INPUT_KEYBOARD;
|
||||||
|
dummyEvent[0].ki.wVk = 0xFF;
|
||||||
|
dummyEvent[0].ki.dwFlags = KEYEVENTF_KEYUP;
|
||||||
|
SendInput(1, dummyEvent, sizeof(INPUT));
|
||||||
|
}
|
||||||
this->winkey_popup->SetWindowCloseType(ToWstring(type));
|
this->winkey_popup->SetWindowCloseType(ToWstring(type));
|
||||||
Logger::trace(L"Terminating process");
|
Logger::trace(L"Terminating process");
|
||||||
PostThreadMessage(mainThreadId, WM_QUIT, 0, 0);
|
PostThreadMessage(mainThreadId, WM_QUIT, 0, 0);
|
||||||
@@ -300,6 +309,7 @@ void OverlayWindow::init_settings()
|
|||||||
overlayOpacity.value = settings.overlayOpacity;
|
overlayOpacity.value = settings.overlayOpacity;
|
||||||
theme.value = settings.theme;
|
theme.value = settings.theme;
|
||||||
disabledApps.value = settings.disabledApps;
|
disabledApps.value = settings.disabledApps;
|
||||||
|
shouldReactToPressedWinKey.value = settings.shouldReactToPressedWinKey;
|
||||||
update_disabled_apps();
|
update_disabled_apps();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,6 +409,22 @@ ShortcutGuideSettings OverlayWindow::GetSettings() noexcept
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
settings.shouldReactToPressedWinKey = properties.GetNamedObject(ShouldReactToPressedWinKey::name).GetNamedBoolean(L"value");
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
settings.windowsKeyPressTime = (int)properties.GetNamedObject(WindowsKeyPressTime::name).GetNamedNumber(L"value");
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
settings.theme = (std::wstring)properties.GetNamedObject(Theme::name).GetNamedString(L"value");
|
settings.theme = (std::wstring)properties.GetNamedObject(Theme::name).GetNamedString(L"value");
|
||||||
|
|||||||
@@ -78,6 +78,17 @@ private:
|
|||||||
std::wstring value;
|
std::wstring value;
|
||||||
} disabledApps;
|
} disabledApps;
|
||||||
|
|
||||||
|
struct ShouldReactToPressedWinKey
|
||||||
|
{
|
||||||
|
static inline PCWSTR name = L"use_legacy_press_win_key_behavior";
|
||||||
|
bool value;
|
||||||
|
} shouldReactToPressedWinKey;
|
||||||
|
|
||||||
|
struct WindowsKeyPressTime
|
||||||
|
{
|
||||||
|
static inline PCWSTR name = L"press_time";
|
||||||
|
} windowsKeyPressTime;
|
||||||
|
|
||||||
struct OpenShortcut
|
struct OpenShortcut
|
||||||
{
|
{
|
||||||
static inline PCWSTR name = L"open_shortcutguide";
|
static inline PCWSTR name = L"open_shortcutguide";
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ void Trace::SendSettings(ShortcutGuideSettings settings) noexcept
|
|||||||
TraceLoggingInt32(settings.overlayOpacity, "OverlayOpacity"),
|
TraceLoggingInt32(settings.overlayOpacity, "OverlayOpacity"),
|
||||||
TraceLoggingWideString(settings.theme.c_str(), "Theme"),
|
TraceLoggingWideString(settings.theme.c_str(), "Theme"),
|
||||||
TraceLoggingWideString(settings.disabledApps.c_str(), "DisabledApps"),
|
TraceLoggingWideString(settings.disabledApps.c_str(), "DisabledApps"),
|
||||||
|
TraceLoggingBoolean(settings.shouldReactToPressedWinKey, "ShouldReactToPressedWinKey"),
|
||||||
|
TraceLoggingInt32(settings.windowsKeyPressTime, "WindowsKeyPressTime"),
|
||||||
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
||||||
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
||||||
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
||||||
|
|||||||
Reference in New Issue
Block a user