Fix #10987: Double-close of dropdown stopped land-info tool working as default. (#11000)

Clicking and releasing on the query toolbar icon is meant to select the land-info tool.

This did not work as during closing a window, OnFocusLost() is called, which then closes the window again. These two calls toggled the land-info tool one and off in the same action.

Resolve by not calling Window::Close in OnFocusLost() if the window is already closing.
This commit is contained in:
PeterN
2023-06-12 08:42:02 +01:00
committed by GitHub
parent 613ad80581
commit ebc451b071
5 changed files with 16 additions and 9 deletions

View File

@@ -197,9 +197,9 @@ struct DropdownWindow : Window {
if (nwc != nullptr) SetBit(nwc->disp_flags, NDB_DROPDOWN_CLOSED);
}
void OnFocusLost() override
void OnFocusLost(bool closing) override
{
this->Close();
if (!closing) this->Close();
}
Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) override