MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / EventFilterCallback

Method EventFilterCallback

Source/Engine/Platform/SDL/SDLPlatform.Mac.cpp:85–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85bool 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
127void SDLPlatform::PreHandleEvents()
128{

Callers

nothing calls this directly

Calls 2

OnUpdateFunction · 0.50
HandleEventMethod · 0.45

Tested by

no test coverage detected