| 415 | } |
| 416 | |
| 417 | void WindowTextInputKey(WindowBase* w, uint32_t keycode) |
| 418 | { |
| 419 | const auto wndNumber = w->number; |
| 420 | const auto wndClass = w->classification; |
| 421 | |
| 422 | // If the return button is pressed stop text input |
| 423 | if (keycode == SDLK_RETURN || keycode == SDLK_KP_ENTER) |
| 424 | { |
| 425 | if (w->classification == WindowClass::textinput) |
| 426 | { |
| 427 | auto textInputWindow = static_cast<TextInputWindow*>(w); |
| 428 | textInputWindow->onReturnPressed(); |
| 429 | } |
| 430 | } |
| 431 | |
| 432 | // The window can be potentially closed within a callback, we need to check if its still alive. |
| 433 | auto* windowMgr = GetWindowManager(); |
| 434 | w = windowMgr->FindByNumber(wndClass, wndNumber); |
| 435 | if (w != nullptr) |
| 436 | w->invalidate(); |
| 437 | } |
| 438 | } // namespace OpenRCT2::Ui::Windows |
no test coverage detected