Pass DPI through to editor. It is more reliable.

This commit is contained in:
Bret Anderson
2019-09-08 23:53:30 -07:00
parent 3836aaa9d1
commit d4c8c84445
2 changed files with 339 additions and 332 deletions

View File

@@ -1,4 +1,5 @@
#include "pch.h"
#include "common/dpi_aware.h"
struct FancyZones : public winrt::implements<FancyZones, IFancyZones, IFancyZonesCallback, IZoneWindowHost>
{
@@ -244,11 +245,16 @@ void FancyZones::ToggleEditor() noexcept
auto iter = m_zoneWindowMap.find(monitor);
if (iter != m_zoneWindowMap.end())
{
UINT dpi_x = 96;
UINT dpi_y = 96;
DPIAware::GetScreenDPIForWindow(foregroundWindow, dpi_x, dpi_y);
const std::wstring params =
iter->second->UniqueId() + L" " +
std::to_wstring(iter->second->ActiveZoneSet()->LayoutId()) + L" " +
std::to_wstring(reinterpret_cast<UINT_PTR>(foregroundWindow)) + L" " +
std::to_wstring(reinterpret_cast<UINT_PTR>(monitor));
std::to_wstring(reinterpret_cast<UINT_PTR>(monitor)) + L" " +
std::to_wstring(static_cast<float>(dpi_x) / 96.0f);
SHELLEXECUTEINFO sei{ sizeof(sei) };
sei.fMask = { SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI };