reapack

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

commit 2895c00ad4066f5169b25a5bcfb217b26fecd9d2
parent 887c418d1ddea6f4295faa5c07ac26041dee4c15
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Fri,  7 Oct 2022 13:58:36 -0400

fix clamping of window positions to visible area (was broken in v1.2.4)

Fixes #49

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

diff --git a/src/dialog.cpp b/src/dialog.cpp @@ -228,13 +228,21 @@ void Dialog::center() boundedMove(left, top); } -void Dialog::boundedMove(int x, int y) +void Dialog::boundedMove(const int x, const int y) { RECT rect; GetWindowRect(m_handle, &rect); + + const int deltaX = x - rect.left, + deltaY = y - rect.top; + rect.left += deltaX; + rect.top += deltaY; + rect.right += deltaX; + rect.bottom += deltaY; + EnsureNotCompletelyOffscreen(&rect); - SetWindowPos(m_handle, nullptr, x, y, + SetWindowPos(m_handle, nullptr, rect.left, rect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); }