Fixed bug 4265 - SDL window falls to the bottom of the screen when dragged down and stuck there

Alexei

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.
Sam Lantinga 2018-09-26 11:17:43 -07:00
parent ffc19ee255
commit 55b24b93b4
3 changed files with 13 additions and 1 deletions

View File

@ -414,6 +414,13 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
break;
case WM_NCACTIVATE:
{
/* Don't immediately clip the cursor in case we're clicking minimize/maximize buttons */
data->skip_update_clipcursor = SDL_TRUE;
}
break;
case WM_ACTIVATE:
{
POINT cursorPos;

View File

@ -904,7 +904,11 @@ WIN_UpdateClipCursor(SDL_Window *window)
SDL_Mouse *mouse = SDL_GetMouse();
RECT rect;
if (data->focus_click_pending) {
if (data->in_title_click || data->focus_click_pending) {
return;
}
if (data->skip_update_clipcursor) {
data->skip_update_clipcursor = SDL_FALSE;
return;
}

View File

@ -44,6 +44,7 @@ typedef struct
SDL_bool in_border_change;
SDL_bool in_title_click;
Uint8 focus_click_pending;
SDL_bool skip_update_clipcursor;
SDL_bool windowed_mode_was_maximized;
SDL_bool in_window_deactivation;
RECT cursor_clipped_rect;