| 130 | } |
| 131 | |
| 132 | void 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 | |
| 160 | bool SDLWindow::HandleEventInternal(SDL_Event& event) |
| 161 | { |
nothing calls this directly
no test coverage detected