Browse Source

Re-enable cursor clipping when clicking into a window when relative mouse mode is enabled

Sam Lantinga 1 year ago
parent
commit
a8ed32c5f7
1 changed files with 12 additions and 0 deletions
  1. 12 0
      src/video/windows/SDL_windowsevents.c

+ 12 - 0
src/video/windows/SDL_windowsevents.c

@@ -621,6 +621,18 @@ static void WIN_HandleRawMouseInput(Uint64 timestamp, SDL_VideoData *data, HANDL
                         button = SDL_BUTTON_LEFT;
                     }
                 }
+
+                if (windowdata->focus_click_pending & SDL_BUTTON(button)) {
+                    /* Ignore the button click for activation */
+                    if (!state) {
+                        windowdata->focus_click_pending &= ~SDL_BUTTON(button);
+                        WIN_UpdateClipCursor(window);
+                    }
+                    if (WIN_ShouldIgnoreFocusClick(windowdata)) {
+                        continue;
+                    }
+                }
+
                 SDL_SendMouseButton(timestamp, window, mouseID, state, button);
             }
         }