mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 23:35:38 +00:00
Relative mouse motion is delivered to the window with keyboard focus
This was the original intent (note SDL_UpdateWindowGrab() in SDL_OnWindowFocusGained() and SDL_OnWindowFocusLost()) and fixes a bug where relative motion unexpectedly stops if the task bar is covering the bottom of the game window and the mouse happens to move over it while relative mode is enabled. Another alternative would be to confine the mouse when relative mode is enabled, but that generates mouse motion which would need to be ignored, and it's possible for the user moving the mouse to combine with the mouse moving into the confined area so you can't easily tell whether to ignore the mouse motion. See https://github.com/libsdl-org/SDL/issues/4165 for a case where this is problematic.
This commit is contained in:
parent
694771513c
commit
91a55a02de
|
@ -714,7 +714,8 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
const SDL_bool isRelative = mouse->relative_mode || mouse->relative_mode_warp;
|
||||
const SDL_bool isCapture = ((data->window->flags & SDL_WINDOW_MOUSE_CAPTURE) != 0);
|
||||
|
||||
if (!isRelative || mouse->focus != data->window) {
|
||||
/* Relative mouse motion is delivered to the window with keyboard focus */
|
||||
if (!isRelative || data->window != SDL_GetKeyboardFocus()) {
|
||||
if (!isCapture) {
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue