diff options
Diffstat (limited to 'win32/PlatWin.cxx')
-rw-r--r-- | win32/PlatWin.cxx | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 8e06b7f4c..2e3ed0d00 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -2441,20 +2441,6 @@ void ListBoxX::SetRedraw(bool on) { ::InvalidateRect(lb, NULL, TRUE); } -static XYPOSITION XYMinimum(XYPOSITION a, XYPOSITION b) { - if (a < b) - return a; - else - return b; -} - -static XYPOSITION XYMaximum(XYPOSITION a, XYPOSITION b) { - if (a > b) - return a; - else - return b; -} - void ListBoxX::ResizeToCursor() { PRectangle rc = GetPosition(); POINT ptw; @@ -2497,10 +2483,10 @@ void ListBoxX::ResizeToCursor() { POINT ptMin = MinTrackSize(); POINT ptMax = MaxTrackSize(); // We don't allow the left edge to move at present, but just in case - rc.left = XYMaximum(XYMinimum(rc.left, rcPreSize.right - ptMin.x), rcPreSize.right - ptMax.x); - rc.top = XYMaximum(XYMinimum(rc.top, rcPreSize.bottom - ptMin.y), rcPreSize.bottom - ptMax.y); - rc.right = XYMaximum(XYMinimum(rc.right, rcPreSize.left + ptMax.x), rcPreSize.left + ptMin.x); - rc.bottom = XYMaximum(XYMinimum(rc.bottom, rcPreSize.top + ptMax.y), rcPreSize.top + ptMin.y); + rc.left = std::clamp(rc.left, rcPreSize.right - ptMax.x, rcPreSize.right - ptMin.x); + rc.top = std::clamp(rc.top, rcPreSize.bottom - ptMax.y, rcPreSize.bottom - ptMin.y); + rc.right = std::clamp(rc.right, rcPreSize.left + ptMin.x, rcPreSize.left + ptMax.x); + rc.bottom = std::clamp(rc.bottom, rcPreSize.top + ptMin.y, rcPreSize.top + ptMax.y); SetPosition(rc); } |