Mercurial > sdl-ios-xcode
changeset 3689:af25b5586af7
Fixed crash when there was no mouse focus for some reason (iPhone bug?)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 21 Jan 2010 16:11:55 +0000 |
parents | 6512cba48440 |
children | e431b888ac6c |
files | src/events/SDL_mouse.c |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/events/SDL_mouse.c Thu Jan 21 07:28:01 2010 +0000 +++ b/src/events/SDL_mouse.c Thu Jan 21 16:11:55 2010 +0000 @@ -373,7 +373,7 @@ event.proximity.cursor = mouse->current_end; event.proximity.type = type; /* FIXME: is this right? */ - event.proximity.windowID = mouse->focus->id; + event.proximity.windowID = mouse->focus ? mouse->focus->id : 0; posted = (SDL_PushEvent(&event) > 0); if (type == SDL_PROXIMITYIN) { mouse->proximity = SDL_TRUE; @@ -479,7 +479,7 @@ event.motion.cursor = mouse->current_end; event.motion.xrel = xrel; event.motion.yrel = yrel; - event.motion.windowID = mouse->focus->id; + event.motion.windowID = mouse->focus ? mouse->focus->id : 0; posted = (SDL_PushEvent(&event) > 0); } mouse->last_x = mouse->x; @@ -532,7 +532,7 @@ event.button.button = button; event.button.x = mouse->x; event.button.y = mouse->y; - event.button.windowID = mouse->focus->id; + event.button.windowID = mouse->focus ? mouse->focus->id : 0; posted = (SDL_PushEvent(&event) > 0); } return posted; @@ -556,7 +556,7 @@ event.wheel.which = (Uint8) index; event.wheel.x = x; event.wheel.y = y; - event.wheel.windowID = mouse->focus->id; + event.wheel.windowID = mouse->focus ? mouse->focus->id : 0; posted = (SDL_PushEvent(&event) > 0); } return posted;