Mercurial > sdl-ios-xcode
diff src/video/x11/SDL_x11events.c @ 3195:08747e24a50f
Mouse events now report the correct window id and window enter/leave events are now reported.
author | Bob Pendleton <bob@pendleton.com> |
---|---|
date | Thu, 11 Jun 2009 20:08:33 +0000 |
parents | 102b7880543a |
children | 08c5964f2a34 |
line wrap: on
line diff
--- a/src/video/x11/SDL_x11events.c Thu Jun 11 06:03:05 2009 +0000 +++ b/src/video/x11/SDL_x11events.c Thu Jun 11 20:08:33 2009 +0000 @@ -83,8 +83,10 @@ /* Gaining mouse coverage? */ case EnterNotify:{ #ifdef DEBUG_XEVENTS - printf("EnterNotify! (%d,%d)\n", xevent.xcrossing.x, - xevent.xcrossing.y); + printf("EnterNotify! (%d,%d,%d)\n", + xevent.xcrossing.x, + xevent.xcrossing.y, + xevent.xcrossing.mode); if (xevent.xcrossing.mode == NotifyGrab) printf("Mode: NotifyGrab\n"); if (xevent.xcrossing.mode == NotifyUngrab) @@ -92,10 +94,12 @@ #endif if ((xevent.xcrossing.mode != NotifyGrab) && (xevent.xcrossing.mode != NotifyUngrab)) { +#if 1 /* FIXME: Should we reset data for all mice? */ -#if 0 - SDL_SetMouseFocus(0, data->windowID); - SDL_SendMouseMotion(0, 0, move->x, move->y, 0); + for (i = 0; i < SDL_GetNumMice(); ++i) { + SDL_Mouse *mouse = SDL_GetMouse(i); + SDL_SetMouseFocus(mouse->id, data->windowID); + } #endif } } @@ -104,8 +108,10 @@ /* Losing mouse coverage? */ case LeaveNotify:{ #ifdef DEBUG_XEVENTS - printf("LeaveNotify! (%d,%d)\n", xevent.xcrossing.x, - xevent.xcrossing.y); + printf("LeaveNotify! (%d,%d,%d)\n", + xevent.xcrossing.x, + xevent.xcrossing.y, + xevent.xcrossing.mode); if (xevent.xcrossing.mode == NotifyGrab) printf("Mode: NotifyGrab\n"); if (xevent.xcrossing.mode == NotifyUngrab) @@ -114,9 +120,12 @@ if ((xevent.xcrossing.mode != NotifyGrab) && (xevent.xcrossing.mode != NotifyUngrab) && (xevent.xcrossing.detail != NotifyInferior)) { +#if 1 /* FIXME: Should we reset data for all mice? */ -#if 0 - SDL_SetMouseFocus(0, 0); + for (i = 0; i < SDL_GetNumMice(); ++i) { + SDL_Mouse *mouse = SDL_GetMouse(i); + SDL_SetMouseFocus(mouse->id, 0); + } #endif } }