Make sure we don't clip the cursor while clicking on the window title bar
authorSam Lantinga <slouken@libsdl.org>
Mon, 24 Feb 2014 22:49:30 -0800
changeset 8253 75ad8ebb3768
parent 8252 3e4846dc97b1
child 8254 f97b5166c158
Make sure we don't clip the cursor while clicking on the window title bar
src/video/windows/SDL_windowsevents.c
src/video/windows/SDL_windowswindow.c
src/video/windows/SDL_windowswindow.h
--- a/src/video/windows/SDL_windowsevents.c	Mon Feb 24 22:37:58 2014 -0800
+++ b/src/video/windows/SDL_windowsevents.c	Mon Feb 24 22:49:30 2014 -0800
@@ -570,6 +570,20 @@
         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:
         {
--- a/src/video/windows/SDL_windowswindow.c	Mon Feb 24 22:37:58 2014 -0800
+++ b/src/video/windows/SDL_windowswindow.c	Mon Feb 24 22:49:30 2014 -0800
@@ -746,7 +746,7 @@
     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;
     }
--- a/src/video/windows/SDL_windowswindow.h	Mon Feb 24 22:37:58 2014 -0800
+++ b/src/video/windows/SDL_windowswindow.h	Mon Feb 24 22:49:30 2014 -0800
@@ -38,6 +38,7 @@
     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