reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit e04ed685b0a2f9d0aa9e7dcd7c15f3eddf174b92
parent 759201bbcd1eb9f44bb9cb2a691dadeef008d1b1
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Thu,  7 May 2020 14:00:12 -0700

dialog: use the target screen's DPI when restoring window sizes

Diffstat:
Msrc/dialog.cpp | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/dialog.cpp b/src/dialog.cpp @@ -378,8 +378,16 @@ void Dialog::restoreState(Serializer::Data &data) const auto &[x, y] = *it++; const auto &[width, height] = *it++; - SetWindowPos(m_handle, nullptr, 0, 0, - width, height, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); +#ifdef _WIN32 + // Move to the target screen first so the new size is applied with the + // correct DPI in Per-Monitor v2 mode. + // Then boundedMove will correct the position if necessary. + SetWindowPos(m_handle, nullptr, x, y, 0, 0, + SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); +#endif + + SetWindowPos(m_handle, nullptr, 0, 0, width, height, + SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); onResize(); boundedMove(x, y);