Skip to content

Commit

Permalink
x11: make last mouse coords sane upon window entry (thanks, Cengiz!).
Browse files Browse the repository at this point in the history
(and thanks to Cengiz for many of the previous Unreal-related
patches! They were generically credited to Epic Games, but a large
amount of that work was his contribution.)

Fixes Bugzilla #3067.
  • Loading branch information
icculus committed Jan 8, 2016
1 parent 757e994 commit ed62033
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/video/x11/SDL_x11events.c
Expand Up @@ -636,6 +636,7 @@ X11_DispatchEvent(_THIS)

/* Gaining mouse coverage? */
case EnterNotify:{
SDL_Mouse *mouse = SDL_GetMouse();
#ifdef DEBUG_XEVENTS
printf("window %p: EnterNotify! (%d,%d,%d)\n", data,
xevent.xcrossing.x,
Expand All @@ -648,7 +649,10 @@ X11_DispatchEvent(_THIS)
#endif
SDL_SetMouseFocus(data->window);

if (!SDL_GetMouse()->relative_mode) {
mouse->last_x = xevent.xcrossing.x;
mouse->last_y = xevent.xcrossing.y;

if (!mouse->relative_mode) {
SDL_SendMouseMotion(data->window, 0, 0, xevent.xcrossing.x, xevent.xcrossing.y);
}
}
Expand Down

0 comments on commit ed62033

Please sign in to comment.