Skip to content

Commit

Permalink
Make sure we don't clip the cursor while clicking on the window title…
Browse files Browse the repository at this point in the history
… bar
  • Loading branch information
slouken committed Feb 25, 2014
1 parent 973d890 commit 2a6213a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/video/windows/SDL_windowsevents.c
Expand Up @@ -570,6 +570,20 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
break;
#endif /* WM_INPUTLANGCHANGE */

case WM_NCLBUTTONDOWN:
{
data->in_title_click = SDL_TRUE;
WIN_UpdateClipCursor(data->window);
}
break;

case WM_NCMOUSELEAVE:
{
data->in_title_click = SDL_FALSE;
WIN_UpdateClipCursor(data->window);
}
break;

case WM_ENTERSIZEMOVE:
case WM_ENTERMENULOOP:
{
Expand Down
2 changes: 1 addition & 1 deletion src/video/windows/SDL_windowswindow.c
Expand Up @@ -746,7 +746,7 @@ WIN_UpdateClipCursor(SDL_Window *window)
SDL_Mouse *mouse = SDL_GetMouse();

/* Don't clip the cursor while we're in the modal resize or move loop */
if (data->in_modal_loop) {
if (data->in_title_click || data->in_modal_loop) {
ClipCursor(NULL);
return;
}
Expand Down
1 change: 1 addition & 0 deletions src/video/windows/SDL_windowswindow.h
Expand Up @@ -38,6 +38,7 @@ typedef struct
SDL_bool created;
WPARAM mouse_button_flags;
BOOL expected_resize;
SDL_bool in_title_click;
SDL_bool in_modal_loop;
struct SDL_VideoData *videodata;
#if SDL_VIDEO_OPENGL_EGL
Expand Down

0 comments on commit 2a6213a

Please sign in to comment.