From 32f9e7296dbcd7a4d7cfa9403fcc8bd844a6a770 Mon Sep 17 00:00:00 2001 From: narzoul Date: Sun, 26 Jun 2022 13:16:00 +0200 Subject: [PATCH] Position combobox dropdown to fit within config overlay window --- DDrawCompat/Overlay/ComboBoxDropDown.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/DDrawCompat/Overlay/ComboBoxDropDown.cpp b/DDrawCompat/Overlay/ComboBoxDropDown.cpp index 48cb678..b2643ae 100644 --- a/DDrawCompat/Overlay/ComboBoxDropDown.cpp +++ b/DDrawCompat/Overlay/ComboBoxDropDown.cpp @@ -22,8 +22,15 @@ namespace Overlay RECT ComboBoxDropDown::calculateRect(ComboBoxControl& parent, DWORD itemCount) { const RECT parentRect = parent.getRect(); - return { parentRect.left, parentRect.bottom, parentRect.right, + RECT rect = { parentRect.left, parentRect.bottom, parentRect.right, parentRect.bottom + static_cast(itemCount) * ARROW_SIZE + 4 }; + + const RECT rootWindowRect = static_cast(parent.getRoot()).getRect(); + if (rect.bottom > rootWindowRect.bottom - rootWindowRect.top) + { + OffsetRect(&rect, 0, parentRect.top - rect.bottom); + } + return rect; } RECT ComboBoxDropDown::calculateRect(const RECT& /*monitorRect*/) const