Fix #8971: Resize QueryStrings with interface scale change. (#10281)

* Fix: Use width of caret symbol '_' for text entry.

This replaces an arbitrary pixel width with the space actually required.

* Fix #8971: Update QueryString sizes with interface scale change.
This commit is contained in:
2022-12-25 00:40:55 +00:00
committed by GitHub
parent 3451c0a82c
commit 23eec0b7b3
3 changed files with 25 additions and 5 deletions

View File

@@ -354,6 +354,17 @@ QueryString *Window::GetQueryString(uint widnum)
return query != this->querystrings.End() ? query->second : nullptr;
}
/**
* Update size of all QueryStrings of this window.
*/
void Window::UpdateQueryStringSize()
{
for (auto &qs : this->querystrings)
{
qs.second->text.UpdateSize();
}
}
/**
* Get the current input text if an edit box has the focus.
* @return The currently focused input text or nullptr if no input focused.
@@ -3353,7 +3364,10 @@ void HideVitalWindows()
void ReInitWindow(Window *w, bool zoom_changed)
{
if (w == nullptr) return;
if (zoom_changed) w->nested_root->AdjustPaddingForZoom();
if (zoom_changed) {
w->nested_root->AdjustPaddingForZoom();
w->UpdateQueryStringSize();
}
w->ReInit();
}