| 275 | } |
| 276 | |
| 277 | bool MainInterface::handleInputEvent(InputEvent const& event) { |
| 278 | auto player = m_client->mainPlayer(); |
| 279 | auto inv = player->inventory(); |
| 280 | auto& root = Root::singleton(); |
| 281 | |
| 282 | if (auto mouseMove = event.ptr<MouseMoveEvent>()) |
| 283 | m_cursorScreenIPos = Vec2I::round(m_cursorScreenPos = mouseMove->mousePosition); |
| 284 | |
| 285 | if (m_paneManager.sendInputEvent(event)) { |
| 286 | if (!event.is<MouseButtonUpEvent>() && !event.is<KeyUpEvent>()) |
| 287 | return true; |
| 288 | } |
| 289 | |
| 290 | if (event.is<KeyDownEvent>()) { |
| 291 | if (m_chat->hasFocus()) { |
| 292 | if (m_guiContext->actions(event).contains(InterfaceAction::ChatSendLine)) { |
| 293 | doChat(m_chat->currentChat(), true); |
| 294 | m_chat->clearCurrentChat(); |
| 295 | m_chat->stopChat(); |
| 296 | return true; |
| 297 | } |
| 298 | } else if (!m_paneManager.keyboardCapturedWidget()) { |
| 299 | Maybe<InventorySlot> swapSlot; |
| 300 | |
| 301 | for (auto action : m_guiContext->actions(event)) { |
| 302 | switch (action) { |
| 303 | default: |
| 304 | break; |
| 305 | case InterfaceAction::GuiShifting: |
| 306 | m_guiContext->setShiftHeld(true); |
| 307 | break; |
| 308 | case InterfaceAction::ChatBegin: |
| 309 | m_chat->startChat(); |
| 310 | break; |
| 311 | |
| 312 | case InterfaceAction::InterfaceHideHud: |
| 313 | m_disableHud = !m_disableHud; |
| 314 | break; |
| 315 | |
| 316 | case InterfaceAction::InterfaceRepeatCommand: |
| 317 | if (!m_lastCommand.empty()) |
| 318 | doChat(m_lastCommand, false); |
| 319 | break; |
| 320 | |
| 321 | case InterfaceAction::InterfaceToggleFullscreen: |
| 322 | m_optionsMenu->toggleFullscreen(); |
| 323 | break; |
| 324 | |
| 325 | case InterfaceAction::InterfaceReload: |
| 326 | root.reload(); |
| 327 | root.fullyLoad(); |
| 328 | break; |
| 329 | |
| 330 | case InterfaceAction::ChatBeginCommand: |
| 331 | m_chat->startCommand(); |
| 332 | break; |
| 333 | |
| 334 | case InterfaceAction::InterfaceEscapeMenu: |
nothing calls this directly
no test coverage detected