Fix: crash when window can't be placed on low resolution screens. (#10932)

Co-authored-by: Jonathan G Rennison <j.g.rennison@gmail.com>
This commit is contained in:
Patric Stout
2023-06-04 17:39:57 +02:00
committed by GitHub
parent c43a23cea8
commit 0f3dd9c796
3 changed files with 38 additions and 2 deletions

View File

@@ -1140,8 +1140,8 @@ struct QueryWindow : public Window {
void FindWindowPlacementAndResize(int def_width, int def_height) override
{
/* Position query window over the calling window, ensuring it's within screen bounds. */
this->left = Clamp(parent->left + (parent->width / 2) - (this->width / 2), 0, _screen.width - this->width);
this->top = Clamp(parent->top + (parent->height / 2) - (this->height / 2), 0, _screen.height - this->height);
this->left = SoftClamp(parent->left + (parent->width / 2) - (this->width / 2), 0, _screen.width - this->width);
this->top = SoftClamp(parent->top + (parent->height / 2) - (this->height / 2), 0, _screen.height - this->height);
this->SetDirty();
}