| Summary: | SDL window falls to the bottom of the screen when dragged down and stuck there | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Alexei <al3x3i.k> |
| Component: | events | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | minor | ||
| Priority: | P2 | ||
| Version: | 2.0.8 | ||
| Hardware: | x86 | ||
| OS: | Windows 10 | ||
This should be fixed, can you check it? https://hg.libsdl.org/SDL/rev/e653f009e6c0 Thanks! Looks good :) Thanks! Great! :) |
On WM_WINDOWPOSCHANGED event, WIN_UpdateClipCursor() is called. SDL_WINDOW_INPUT_FOCUS is set even when the mouse pointer is not inside the SDL window and therefore ClipCursor(&rect) is called. When dragging the window and rect.bottom=800 (i.e. the bottom edge of the screen) the SDL window is clipped to the bottom of the screen and it is not possible to move it back to the center of the screen. Possible solution : sending SDL_WINDOWEVENT_FOCUS_LOST event when mouse pointer leaves the SDL window. Add this to beginning of SDL_PrivateSendMouseMotion(): /* disable SDL_WINDOW_INPUT_FOCUS when mouse leaves window borders */ int xx; int yy; mouse->GetGlobalMouseState(&xx, &yy); if (xx < window->x | yy < window->y | yy >(window->y + window->h) | xx > (window->x + window->w)) { //SDL_Log("OUTSIDE"); SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); } /* **************************************************************** */