mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
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_height = this->nested_root->resize_y;
|
||||
|
||||
/* Give focus to the opened window unless a text box
|
||||
* of focused window has focus (so we don't interrupt typing). But if the new
|
||||
* window has a text box, then take focus anyway. */
|
||||
if (!EditBoxInGlobalFocus() || this->nested_root->GetWidgetOfType(WWT_EDITBOX) != nullptr) SetFocusedWindow(this);
|
||||
/* Give focus to the opened window unless a dropdown menu has focus or a text box of the focused window has focus
|
||||
* (so we don't interrupt typing) unless the new window has a text box. */
|
||||
bool dropdown_active = _focused_window != nullptr && _focused_window->window_class == WC_DROPDOWN_MENU;
|
||||
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. */
|
||||
BringWindowToFront(this, false);
|
||||
|
Loading…
Reference in New Issue
Block a user