The events for releasing the mouse during window dragging are missing, handle the mouse release event here
| 31 | |
| 32 | // The events for releasing the mouse during window dragging are missing, handle the mouse release event here |
| 33 | bool SDLCALL SDLPlatform::EventMessageHook(void* userdata, MSG* msg) |
| 34 | { |
| 35 | if (msg->message == WM_NCLBUTTONDOWN) |
| 36 | { |
| 37 | Window* window = WindowsManager::GetByNativePtr(msg->hwnd); |
| 38 | Float2 mousePosition(static_cast<float>(static_cast<LONG>(WINDOWS_GET_X_LPARAM(msg->lParam))), static_cast<float>(static_cast<LONG>(WINDOWS_GET_Y_LPARAM(msg->lParam)))); |
| 39 | |
| 40 | WinImpl::DraggedWindow = window; |
| 41 | WinImpl::DraggedWindowStartPosition = window->GetClientPosition(); |
| 42 | WinImpl::DraggedWindowMousePosition = mousePosition - WinImpl::DraggedWindowStartPosition; |
| 43 | WinImpl::DraggedWindowSize = window->GetClientSize(); |
| 44 | |
| 45 | bool result = false; |
| 46 | WindowHitCodes hit = static_cast<WindowHitCodes>(msg->wParam); |
| 47 | window->OnHitTest(mousePosition, hit, result); |
| 48 | //if (result && hit != WindowHitCodes::Caption) |
| 49 | // return false; |
| 50 | |
| 51 | if (hit == WindowHitCodes::Caption) |
| 52 | { |
| 53 | SDL_Event event{ 0 }; |
| 54 | event.button.type = SDL_EVENT_MOUSE_BUTTON_DOWN; |
| 55 | event.button.down = true; |
| 56 | event.button.timestamp = SDL_GetTicksNS(); |
| 57 | event.button.windowID = SDL_GetWindowID(window->GetSDLWindow()); |
| 58 | event.button.button = SDL_BUTTON_LEFT; |
| 59 | event.button.clicks = 1; |
| 60 | event.button.x = WinImpl::DraggedWindowMousePosition.X; |
| 61 | event.button.y = WinImpl::DraggedWindowMousePosition.Y; |
| 62 | |
| 63 | SDL_PushEvent(&event); |
| 64 | } |
| 65 | } |
| 66 | return true; |
| 67 | } |
| 68 | |
| 69 | bool SDLPlatform::InitInternal() |
| 70 | { |
nothing calls this directly
no test coverage detected