mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
Add a hotkey settings control and use it in FancyZones (#450)
Add a hotkey settings control and use it in FancyZones
This commit is contained in:
committed by
GitHub
parent
de08485db8
commit
64f606daaa
@@ -24,6 +24,7 @@ public:
|
||||
IFACEMETHODIMP_(void) WindowCreated(HWND window) noexcept;
|
||||
IFACEMETHODIMP_(bool) OnKeyDown(PKBDLLHOOKSTRUCT info) noexcept;
|
||||
IFACEMETHODIMP_(void) ToggleEditor() noexcept;
|
||||
IFACEMETHODIMP_(void) SettingsChanged() noexcept;
|
||||
|
||||
// IZoneWindowHost
|
||||
IFACEMETHODIMP_(void) ToggleZoneViewers() noexcept;
|
||||
@@ -117,7 +118,7 @@ IFACEMETHODIMP_(void) FancyZones::Run() noexcept
|
||||
m_window = CreateWindowExW(WS_EX_TOOLWINDOW, L"SuperFancyZones", L"", WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, m_hinstance, this);
|
||||
if (!m_window) return;
|
||||
|
||||
RegisterHotKey(m_window, 1, MOD_WIN, VK_OEM_3);
|
||||
RegisterHotKey(m_window, 1, m_settings->GetSettings().editorHotkey.get_modifiers(), m_settings->GetSettings().editorHotkey.get_code());
|
||||
VirtualDesktopChanged();
|
||||
}
|
||||
|
||||
@@ -328,6 +329,13 @@ void FancyZones::ToggleEditor() noexcept
|
||||
waitForEditorThread.detach();
|
||||
}
|
||||
|
||||
void FancyZones::SettingsChanged() noexcept
|
||||
{
|
||||
// Update the hotkey
|
||||
UnregisterHotKey(m_window, 1);
|
||||
RegisterHotKey(m_window, 1, m_settings->GetSettings().editorHotkey.get_modifiers(), m_settings->GetSettings().editorHotkey.get_code());
|
||||
}
|
||||
|
||||
// IZoneWindowHost
|
||||
IFACEMETHODIMP_(void) FancyZones::ToggleZoneViewers() noexcept
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user