mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-28 17:33:17 +00:00

The old floating textbox was extremely entwined with the controller_base, play_controller, and menu_handler classes. controller_base::have_keyboard_focus essentially controlled whether some events were executed based on whether the floating textbox was open or not. Additionally, those events weren't even reached if a UI dialog was open at all. The new design features a singleton console class that can be called from anywhere, not just the game. I've also decoupled the execution object from play_controller. The relevant functions in menu_handler are now passed to the console as callbacks. To work around map events such as clicking not being available if the console was open, I removed the exclusionary is-in-dialog check from controller_base::handle_event and instead exit early out certain types of events using controller_base::have_keyboard_focus. As mentioned in the accompanying comment, this isn't the best solution, but it will do for now. The new console also isn't fully feature-comparable with the old GUI1 one. The following are still missing: * The checkbox, for use when sending messages. * Tab completion. * A crash occurs when existing the app if a game was exited with the console open. I'm leaving the old floating_textbox code around for now for reference.