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:
Bartosz Sosnowski
2019-10-02 17:18:55 +02:00
committed by GitHub
parent de08485db8
commit 64f606daaa
13 changed files with 237 additions and 17 deletions

View File

@@ -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
{