mirror of https://github.com/encounter/SDL.git
Don't calculate relative mouse motion if we don't have a valid position
Fixes https://github.com/libsdl-org/SDL/issues/1928
This commit is contained in:
parent
b204db1e6b
commit
0e61c106f5
|
@ -361,8 +361,8 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ
|
||||||
{
|
{
|
||||||
SDL_Mouse *mouse = SDL_GetMouse();
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
int posted;
|
int posted;
|
||||||
int xrel;
|
int xrel = 0;
|
||||||
int yrel;
|
int yrel = 0;
|
||||||
|
|
||||||
/* SDL_HINT_MOUSE_TOUCH_EVENTS: controlling whether mouse events should generate synthetic touch events */
|
/* SDL_HINT_MOUSE_TOUCH_EVENTS: controlling whether mouse events should generate synthetic touch events */
|
||||||
if (mouse->mouse_touch_events) {
|
if (mouse->mouse_touch_events) {
|
||||||
|
@ -416,7 +416,7 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ
|
||||||
yrel = y;
|
yrel = y;
|
||||||
x = (mouse->last_x + xrel);
|
x = (mouse->last_x + xrel);
|
||||||
y = (mouse->last_y + yrel);
|
y = (mouse->last_y + yrel);
|
||||||
} else {
|
} else if (mouse->has_position) {
|
||||||
xrel = x - mouse->last_x;
|
xrel = x - mouse->last_x;
|
||||||
yrel = y - mouse->last_y;
|
yrel = y - mouse->last_y;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue