Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Applied the same logic as the fix for bug 894.
Browse files Browse the repository at this point in the history
Anytime we enter the window, we gain the mouse focus.  If we leave the window because of a normal LeaveNotify, then we lose mouse focus.
  • Loading branch information
slouken committed Jul 20, 2010
1 parent f908aca commit eceab3f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/video/x11/SDL_x11events.c
Expand Up @@ -25,7 +25,7 @@
#include <sys/time.h>
#include <signal.h>
#include <unistd.h>
#include <limits.h> /* For INT_MAX */
#include <limits.h> /* For INT_MAX */

#include "SDL_x11video.h"
#include "../../events/SDL_events_c.h"
Expand Down Expand Up @@ -92,8 +92,8 @@ X11_DispatchEvent(_THIS)
case EnterNotify:{
#ifdef DEBUG_XEVENTS
printf("EnterNotify! (%d,%d,%d)\n",
xevent.xcrossing.x,
xevent.xcrossing.y,
xevent.xcrossing.x,
xevent.xcrossing.y,
xevent.xcrossing.mode);
if (xevent.xcrossing.mode == NotifyGrab)
printf("Mode: NotifyGrab\n");
Expand All @@ -108,15 +108,17 @@ X11_DispatchEvent(_THIS)
case LeaveNotify:{
#ifdef DEBUG_XEVENTS
printf("LeaveNotify! (%d,%d,%d)\n",
xevent.xcrossing.x,
xevent.xcrossing.y,
xevent.xcrossing.x,
xevent.xcrossing.y,
xevent.xcrossing.mode);
if (xevent.xcrossing.mode == NotifyGrab)
printf("Mode: NotifyGrab\n");
if (xevent.xcrossing.mode == NotifyUngrab)
printf("Mode: NotifyUngrab\n");
#endif
if (xevent.xcrossing.detail != NotifyInferior) {
if (xevent.xcrossing.mode != NotifyGrab &&
xevent.xcrossing.mode != NotifyUngrab &&
xevent.xcrossing.detail != NotifyInferior) {
SDL_SetMouseFocus(NULL);
}
}
Expand Down

0 comments on commit eceab3f

Please sign in to comment.