Everything is working.

This commit is contained in:
Bret Anderson
2019-09-15 13:34:00 -07:00
parent d4c8c84445
commit c0cdf7aaa6
6 changed files with 41 additions and 29 deletions

View File

@@ -249,11 +249,23 @@ void FancyZones::ToggleEditor() noexcept
UINT dpi_y = 96;
DPIAware::GetScreenDPIForWindow(foregroundWindow, dpi_x, dpi_y);
MONITORINFOEX mi;
mi.cbSize = sizeof(mi);
GetMonitorInfo(monitor, &mi);
// Location that the editor should occupy, scaled by DPI
std::wstring editorLocation =
std::to_wstring(MulDiv(mi.rcWork.left, 96, dpi_x)) + L"_" +
std::to_wstring(MulDiv(mi.rcWork.top, 96, dpi_y)) + L"_" +
std::to_wstring(MulDiv(mi.rcWork.right - mi.rcWork.left, 96, dpi_x)) + L"_" +
std::to_wstring(MulDiv(mi.rcWork.bottom - mi.rcWork.top, 96, 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)) + L" " +
editorLocation + L" " +
iter->second->WorkAreaKey() + L" " +
std::to_wstring(static_cast<float>(dpi_x) / 96.0f);
SHELLEXECUTEINFO sei{ sizeof(sei) };

View File

@@ -18,6 +18,7 @@ public:
IFACEMETHODIMP_(void) CycleActiveZoneSet(DWORD vkCode) noexcept;
IFACEMETHODIMP_(std::wstring) DeviceId() noexcept { return { m_deviceId.get() }; }
IFACEMETHODIMP_(std::wstring) UniqueId() noexcept { return { m_uniqueId }; }
IFACEMETHODIMP_(std::wstring) WorkAreaKey() noexcept { return { m_workArea }; }
IFACEMETHODIMP_(void) SaveWindowProcessToZoneIndex(HWND window) noexcept;
IFACEMETHODIMP_(IZoneSet*) ActiveZoneSet() noexcept { return m_activeZoneSet.get(); }

View File

@@ -16,6 +16,7 @@ interface __declspec(uuid("{7F017528-8110-4FB3-BE41-F472969C2560}")) IZoneWindow
IFACEMETHOD_(void, SaveWindowProcessToZoneIndex)(HWND window) = 0;
IFACEMETHOD_(std::wstring, DeviceId)() = 0;
IFACEMETHOD_(std::wstring, UniqueId)() = 0;
IFACEMETHOD_(std::wstring, WorkAreaKey)() = 0;
IFACEMETHOD_(IZoneSet*, ActiveZoneSet)() = 0;
};