mirror of https://github.com/OpenTTD/OpenTTD
parent
09d01bd015
commit
096da3e59f
|
@ -1393,10 +1393,11 @@ void Window::InitializeData(WindowNumber window_number)
|
||||||
this->resize.step_width = this->nested_root->resize_x;
|
this->resize.step_width = this->nested_root->resize_x;
|
||||||
this->resize.step_height = this->nested_root->resize_y;
|
this->resize.step_height = this->nested_root->resize_y;
|
||||||
|
|
||||||
/* Give focus to the opened window unless a text box
|
/* Give focus to the opened window unless a dropdown menu has focus or a text box of the focused window has focus
|
||||||
* of focused window has focus (so we don't interrupt typing). But if the new
|
* (so we don't interrupt typing) unless the new window has a text box. */
|
||||||
* window has a text box, then take focus anyway. */
|
bool dropdown_active = _focused_window != nullptr && _focused_window->window_class == WC_DROPDOWN_MENU;
|
||||||
if (!EditBoxInGlobalFocus() || this->nested_root->GetWidgetOfType(WWT_EDITBOX) != nullptr) SetFocusedWindow(this);
|
bool editbox_active = EditBoxInGlobalFocus() && this->nested_root->GetWidgetOfType(WWT_EDITBOX) == nullptr;
|
||||||
|
if (!dropdown_active && !editbox_active) SetFocusedWindow(this);
|
||||||
|
|
||||||
/* Insert the window into the correct location in the z-ordering. */
|
/* Insert the window into the correct location in the z-ordering. */
|
||||||
BringWindowToFront(this, false);
|
BringWindowToFront(this, false);
|
||||||
|
|
Loading…
Reference in New Issue