Avoid window iterations when no windows of desired class present

This commit is contained in:
Jonathan G Rennison
2023-09-18 19:05:55 +01:00
parent 52e4688851
commit b93503bb21
5 changed files with 19 additions and 1 deletions

View File

@@ -88,7 +88,7 @@ bool _mouse_hovering; ///< The mouse is hovering over the same point.
SpecialMouseMode _special_mouse_mode; ///< Mode of the mouse.
static std::bitset<WC_END> _present_window_types;
std::bitset<WC_END> _present_window_types;
/**
* List of all WindowDescs.
@@ -1105,6 +1105,8 @@ void Window::SetShaded(bool make_shaded)
*/
static Window *FindChildWindow(const Window *w, WindowClass wc)
{
if (wc < WC_END && !_present_window_types[wc]) return nullptr;
for (Window *v : Window::IterateFromBack()) {
if ((wc == WC_INVALID || wc == v->window_class) && v->parent == w) return v;
}