| 273 | } |
| 274 | |
| 275 | void onFrameEnd() |
| 276 | { |
| 277 | // this is needed to prevent unexpected closing on progress bar window in: |
| 278 | // ImGui::NewFrame() / ImGui::UpdateMouseMovingWindowNewFrame() / ImGui::FocusWindow() |
| 279 | // that can happen if progress bar is ordered on clicking to the window |
| 280 | // (for example on finish editing some InputFloat, clicking on window makes ImGui think this window is moving |
| 281 | // and close progress bar modal before it starts, task of progress bar is going but post-processing is not) |
| 282 | auto& inst = ProgressBarImpl::instance(); |
| 283 | if ( !inst.isOrdered_ ) |
| 284 | return; |
| 285 | auto ctx = ImGui::GetCurrentContext(); |
| 286 | if ( !ctx ) |
| 287 | return; |
| 288 | if ( !ctx->MovingWindow ) |
| 289 | return; |
| 290 | if ( std::string( ctx->MovingWindow->Name ).ends_with( "###GlobalProgressBarPopup" ) ) |
| 291 | return; |
| 292 | ctx->MovingWindow = nullptr; |
| 293 | } |
| 294 | |
| 295 | void order( const char* name, const std::function<void()>& task, int taskCount ) |
| 296 | { |