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

Method PostHandleEvents

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

Source from the content-addressed store, hash-verified

130}
131
132void SDLPlatform::PostHandleEvents()
133{
134 SDL_SetEventFilter(EventFilterCallback, &MacImpl::DraggedWindow);
135
136 // Handle window dragging release here
137 if (MacImpl::DraggedWindow != nullptr)
138 {
139 Float2 mousePosition;
140 auto buttons = SDL_GetGlobalMouseState(&mousePosition.X, &mousePosition.Y);
141 bool buttonReleased = (buttons & SDL_BUTTON_MASK(SDL_BUTTON_LEFT)) == 0;
142 if (buttonReleased)
143 {
144 // Send simulated mouse up event
145 SDL_Event buttonUpEvent { 0 };
146 buttonUpEvent.motion.type = SDL_EVENT_MOUSE_BUTTON_UP;
147 buttonUpEvent.button.down = false;
148 buttonUpEvent.motion.windowID = SDL_GetWindowID(MacImpl::DraggedWindow->GetSDLWindow());
149 buttonUpEvent.motion.timestamp = SDL_GetTicksNS();
150 buttonUpEvent.motion.state = SDL_BUTTON_LEFT;
151 buttonUpEvent.button.clicks = 1;
152 buttonUpEvent.motion.x = mousePosition.X;
153 buttonUpEvent.motion.y = mousePosition.Y;
154 MacImpl::DraggedWindow->HandleEvent(buttonUpEvent);
155 MacImpl::DraggedWindow = nullptr;
156 }
157 }
158}
159
160bool SDLWindow::HandleEventInternal(SDL_Event& event)
161{

Callers

nothing calls this directly

Calls 2

GetSDLWindowMethod · 0.80
HandleEventMethod · 0.45

Tested by

no test coverage detected