mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-24 04:00:02 +01:00
FancyZones: do not zone windows on startup (#982)
This commit is contained in:
committed by
GitHub
parent
3eb38e558e
commit
47bcb117b4
@@ -43,6 +43,7 @@ public:
|
||||
IFACEMETHODIMP_(void) MoveSizeUpdate(HMONITOR monitor, POINT const& ptScreen) noexcept;
|
||||
IFACEMETHODIMP_(void) MoveSizeEnd(HWND window, POINT const& ptScreen) noexcept;
|
||||
IFACEMETHODIMP_(void) VirtualDesktopChanged() noexcept;
|
||||
IFACEMETHODIMP_(void) VirtualDesktopInitialize() noexcept;
|
||||
IFACEMETHODIMP_(void) WindowCreated(HWND window) noexcept;
|
||||
IFACEMETHODIMP_(bool) OnKeyDown(PKBDLLHOOKSTRUCT info) noexcept;
|
||||
IFACEMETHODIMP_(void) ToggleEditor() noexcept;
|
||||
@@ -123,6 +124,7 @@ private:
|
||||
OnThreadExecutor m_virtualDesktopTrackerThread;
|
||||
|
||||
static UINT WM_PRIV_VDCHANGED; // Message to get back on to the UI thread when virtual desktop changes
|
||||
static UINT WM_PRIV_VDINIT; // Message to get back to the UI thread when FancyZones are initialized
|
||||
static UINT WM_PRIV_EDITOR; // Message to get back on to the UI thread when the editor exits
|
||||
|
||||
// Did we terminate the editor or was it closed cleanly?
|
||||
@@ -134,6 +136,7 @@ private:
|
||||
};
|
||||
|
||||
UINT FancyZones::WM_PRIV_VDCHANGED = RegisterWindowMessage(L"{128c2cb0-6bdf-493e-abbe-f8705e04aa95}");
|
||||
UINT FancyZones::WM_PRIV_VDINIT = RegisterWindowMessage(L"{469818a8-00fa-4069-b867-a1da484fcd9a}");
|
||||
UINT FancyZones::WM_PRIV_EDITOR = RegisterWindowMessage(L"{87543824-7080-4e91-9d9c-0404642fc7b6}");
|
||||
|
||||
// IFancyZones
|
||||
@@ -155,7 +158,7 @@ IFACEMETHODIMP_(void) FancyZones::Run() noexcept
|
||||
|
||||
RegisterHotKey(m_window, 1, m_settings->GetSettings().editorHotkey.get_modifiers(), m_settings->GetSettings().editorHotkey.get_code());
|
||||
|
||||
VirtualDesktopChanged();
|
||||
VirtualDesktopInitialize();
|
||||
|
||||
m_dpiUnawareThread.submit(OnThreadExecutor::task_t{[]{
|
||||
SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE);
|
||||
@@ -218,6 +221,12 @@ IFACEMETHODIMP_(void) FancyZones::VirtualDesktopChanged() noexcept
|
||||
PostMessage(m_window, WM_PRIV_VDCHANGED, 0, 0);
|
||||
}
|
||||
|
||||
// IFancyZonesCallback
|
||||
IFACEMETHODIMP_(void) FancyZones::VirtualDesktopInitialize() noexcept
|
||||
{
|
||||
PostMessage(m_window, WM_PRIV_VDINIT, 0, 0);
|
||||
}
|
||||
|
||||
// IFancyZonesCallback
|
||||
IFACEMETHODIMP_(void) FancyZones::WindowCreated(HWND window) noexcept
|
||||
{
|
||||
@@ -449,6 +458,10 @@ LRESULT FancyZones::WndProc(HWND window, UINT message, WPARAM wparam, LPARAM lpa
|
||||
{
|
||||
OnDisplayChange(DisplayChangeType::VirtualDesktop);
|
||||
}
|
||||
else if (message == WM_PRIV_VDINIT)
|
||||
{
|
||||
OnDisplayChange(DisplayChangeType::Initialization);
|
||||
}
|
||||
else if (message == WM_PRIV_EDITOR)
|
||||
{
|
||||
if (lparam == static_cast<LPARAM>(EditorExitKind::Exit))
|
||||
@@ -475,7 +488,8 @@ LRESULT FancyZones::WndProc(HWND window, UINT message, WPARAM wparam, LPARAM lpa
|
||||
|
||||
void FancyZones::OnDisplayChange(DisplayChangeType changeType) noexcept
|
||||
{
|
||||
if (changeType == DisplayChangeType::VirtualDesktop)
|
||||
if (changeType == DisplayChangeType::VirtualDesktop ||
|
||||
changeType == DisplayChangeType::Initialization)
|
||||
{
|
||||
// Explorer persists this value to the registry on a per session basis but only after
|
||||
// the first virtual desktop switch happens. If the user hasn't switched virtual desktops in this session
|
||||
|
||||
@@ -8,7 +8,8 @@ enum class DisplayChangeType
|
||||
WorkArea,
|
||||
DisplayChange,
|
||||
VirtualDesktop,
|
||||
Editor
|
||||
Editor,
|
||||
Initialization
|
||||
};
|
||||
|
||||
interface __declspec(uuid("{50D3F0F5-736E-4186-BDF4-3D6BEE150C3A}")) IFancyZones : public IUnknown
|
||||
|
||||
Reference in New Issue
Block a user