MCPcopy Create free account
hub / github.com/MrNeRF/LichtFeld-Studio / waitEvents

Method waitEvents

src/visualizer/window/window_manager.cpp:489–518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

487 }
488
489 void WindowManager::waitEvents(double timeout_seconds) {
490 frame_input_.beginFrame();
491 const bool imgui_ready = ImGui::GetCurrentContext() != nullptr;
492 const SDL_WindowID main_window_id = window_ ? SDL_GetWindowID(window_) : 0;
493 SDL_Event event;
494 if (vulkan_context_ &&
495 vulkan_context_->hasPendingSwapchainResize()) {
496 const double resize_wait = vulkan_context_->secondsUntilPendingSwapchainResizeReady();
497 timeout_seconds = std::min(timeout_seconds,
498 resize_wait > 0.0
499 ? std::max(kPendingResizeMinWaitSeconds, resize_wait)
500 : 0.0);
501 }
502 const int timeout_ms = static_cast<int>(timeout_seconds * 1000.0);
503 if (SDL_WaitEventTimeout(&event, timeout_ms)) {
504 if (imgui_ready)
505 ImGui_ImplSDL3_ProcessEvent(&event);
506 frame_input_.processEvent(event, main_window_id);
507 processEvent(event);
508 while (SDL_PollEvent(&event)) {
509 if (imgui_ready)
510 ImGui_ImplSDL3_ProcessEvent(&event);
511 frame_input_.processEvent(event, main_window_id);
512 processEvent(event);
513 }
514 }
515 finishTitlebarDragIfReleased();
516 frame_input_.finalize(window_);
517 flushPendingTitlebarDoubleClick();
518 }
519
520 bool WindowManager::shouldClose() const {
521 return should_close_;

Callers 1

waitForNextEventMethod · 0.80

Calls 7

minFunction · 0.50
maxFunction · 0.50
beginFrameMethod · 0.45
processEventMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected