[Commits] SDL: Fixed bug 4265 - SDL window falls to the bottom of the scre...

libsdl.org revision control commits-owner at libsdl.org
Wed Sep 26 11:18:17 PDT 2018


details:   https://hg.libsdl.org/SDL/rev/e653f009e6c0
changeset: 12231:e653f009e6c0
user:      Sam Lantinga <slouken at libsdl.org>
date:      Wed Sep 26 11:17:43 2018 -0700
description:
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.

diffstat:

 src/video/windows/SDL_windowsevents.c |  7 +++++++
 src/video/windows/SDL_windowswindow.c |  6 +++++-
 src/video/windows/SDL_windowswindow.h |  1 +
 3 files changed, 13 insertions(+), 1 deletions(-)

diffs (44 lines):

diff -r 162b6f94df3a -r e653f009e6c0 src/video/windows/SDL_windowsevents.c
--- a/src/video/windows/SDL_windowsevents.c	Wed Sep 26 20:47:34 2018 +0300
+++ b/src/video/windows/SDL_windowsevents.c	Wed Sep 26 11:17:43 2018 -0700
@@ -414,6 +414,13 @@
         }
         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;
diff -r 162b6f94df3a -r e653f009e6c0 src/video/windows/SDL_windowswindow.c
--- a/src/video/windows/SDL_windowswindow.c	Wed Sep 26 20:47:34 2018 +0300
+++ b/src/video/windows/SDL_windowswindow.c	Wed Sep 26 11:17:43 2018 -0700
@@ -904,7 +904,11 @@
     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;
     }
 
diff -r 162b6f94df3a -r e653f009e6c0 src/video/windows/SDL_windowswindow.h
--- a/src/video/windows/SDL_windowswindow.h	Wed Sep 26 20:47:34 2018 +0300
+++ b/src/video/windows/SDL_windowswindow.h	Wed Sep 26 11:17:43 2018 -0700
@@ -44,6 +44,7 @@
     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;


More information about the commits mailing list