mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
[FancyZones] Move window into last known position on active work area (if possible) (#4218)
* Move window into last known position on active work area (if possible) * Refactor code to avoid double checks * Address PR comments * Perform all HWND checks at one place * Improve handling of active/primary work area in app zone history * Address PR comments: naming, arguments checks * Rename some functions to increase readability * Implement special handling in 2+ monitor scenario * Minor naming change * Simplify * Improve readability * Remove blank line * Don't move away from secondary monitor if there is no app zone history * Update comment * FancyZonesEditor should not be zoned * Preserve width and height (if possible) when opening on active monitor * Maintain w/h whenever possible * Remove scaling, add window coordinates on active monitor top-left corner * If there is no app zone history on secondary screen, fallback to default windows behavior.
This commit is contained in:
@@ -4,6 +4,12 @@
|
||||
#include <common/common.h>
|
||||
#include <common/dpi_aware.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
const wchar_t POWER_TOYS_APP_POWER_LAUCHER[] = L"POWERLAUNCHER.EXE";
|
||||
const wchar_t POWER_TOYS_APP_FANCY_ZONES_EDITOR[] = L"FANCYZONESEDITOR.EXE";
|
||||
}
|
||||
|
||||
typedef BOOL(WINAPI* GetDpiForMonitorInternalFunc)(HMONITOR, UINT, UINT*, UINT*);
|
||||
UINT GetDpiForMonitor(HMONITOR monitor) noexcept
|
||||
{
|
||||
@@ -157,7 +163,11 @@ bool IsInterestingWindow(HWND window, const std::vector<std::wstring>& excludedA
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (find_app_name_in_path(filtered.process_path, { L"POWERLAUNCHER.EXE" }))
|
||||
if (find_app_name_in_path(filtered.process_path, { POWER_TOYS_APP_POWER_LAUCHER }))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (find_app_name_in_path(filtered.process_path, { POWER_TOYS_APP_FANCY_ZONES_EDITOR }))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user