Skip to content

Commit

Permalink
Editor: fixed zone offset scaling (#1876)
Browse files Browse the repository at this point in the history
  • Loading branch information
SeraphimaZykova committed Apr 7, 2020
1 parent 01ec472 commit f5ed9f1
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions src/modules/fancyzones/lib/FancyZones.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,6 @@ void FancyZones::ToggleEditor() noexcept
HMONITOR monitor{};
HWND foregroundWindow{};

UINT dpi_x = DPIAware::DEFAULT_DPI;
UINT dpi_y = DPIAware::DEFAULT_DPI;

const bool use_cursorpos_editor_startupscreen = m_settings->GetSettings()->use_cursorpos_editor_startupscreen;
POINT currentCursorPos{};
if (use_cursorpos_editor_startupscreen)
Expand Down Expand Up @@ -473,24 +470,14 @@ void FancyZones::ToggleEditor() noexcept
} })
.wait();

if (use_cursorpos_editor_startupscreen)
{
DPIAware::GetScreenDPIForPoint(currentCursorPos, dpi_x, dpi_y);
}
else
{
DPIAware::GetScreenDPIForWindow(foregroundWindow, dpi_x, dpi_y);
}

auto zoneWindow = iter->second;

const auto& fancyZonesData = JSONHelpers::FancyZonesDataInstance();
fancyZonesData.CustomZoneSetsToJsonFile(ZoneWindowUtils::GetCustomZoneSetsTmpPath());

const auto taskbar_x_offset = MulDiv(mi.rcWork.left - mi.rcMonitor.left, DPIAware::DEFAULT_DPI, dpi_x);
const auto taskbar_y_offset = MulDiv(mi.rcWork.top - mi.rcMonitor.top, DPIAware::DEFAULT_DPI, dpi_y);

// Do not scale window params by the dpi, that will be done in the editor - see LayoutModel.Apply
const auto taskbar_x_offset = mi.rcWork.left - mi.rcMonitor.left;
const auto taskbar_y_offset = mi.rcWork.top - mi.rcMonitor.top;
const auto x = mi.rcMonitor.left + taskbar_x_offset;
const auto y = mi.rcMonitor.top + taskbar_y_offset;
const auto width = mi.rcWork.right - mi.rcWork.left;
Expand Down

0 comments on commit f5ed9f1

Please sign in to comment.