| 83 | } |
| 84 | |
| 85 | bool SDLPlatform::EventFilterCallback(void* userdata, SDL_Event* event) |
| 86 | { |
| 87 | Window* draggedWindow = *(Window**)userdata; |
| 88 | if (draggedWindow == nullptr) |
| 89 | { |
| 90 | if (MacImpl::DraggingActive) |
| 91 | { |
| 92 | // Handle events during drag operation here since the normal event loop is blocked |
| 93 | if (event->type == SDL_EVENT_WINDOW_EXPOSED) |
| 94 | { |
| 95 | // The internal timer is sending exposed events every ~16ms |
| 96 | #if USE_EDITOR |
| 97 | // Flush any single-frame shapes to prevent memory leaking (eg. via terrain collision debug during scene drawing with PhysicsColliders or PhysicsDebug flag) |
| 98 | DebugDraw::UpdateContext(nullptr, 0.0f); |
| 99 | #endif |
| 100 | Engine::OnUpdate(); // For docking updates |
| 101 | Engine::OnDraw(); |
| 102 | } |
| 103 | else |
| 104 | { |
| 105 | SDLWindow* window = SDLWindow::GetWindowFromEvent(*event); |
| 106 | if (window) |
| 107 | window->HandleEvent(*event); |
| 108 | |
| 109 | // We do not receive events at steady rate to keep the engine updated... |
| 110 | #if USE_EDITOR |
| 111 | // Flush any single-frame shapes to prevent memory leaking (eg. via terrain collision debug during scene drawing with PhysicsColliders or PhysicsDebug flag) |
| 112 | DebugDraw::UpdateContext(nullptr, 0.0f); |
| 113 | #endif |
| 114 | Engine::OnUpdate(); // For docking updates |
| 115 | Engine::OnDraw(); |
| 116 | |
| 117 | if (event->type == SDL_EVENT_DROP_BEGIN || event->type == SDL_EVENT_DROP_FILE || event->type == SDL_EVENT_DROP_TEXT) |
| 118 | return true; // Filtering these event stops other following events from getting added to the queue |
| 119 | } |
| 120 | return false; |
| 121 | } |
| 122 | return true; |
| 123 | } |
| 124 | return true; |
| 125 | } |
| 126 | |
| 127 | void SDLPlatform::PreHandleEvents() |
| 128 | { |
nothing calls this directly
no test coverage detected