Mercurial > sdl-ios-xcode
changeset 2766:5955b6550d7e
Fixed memory leak in raw mouse input processing.
Corrected the mouse button indices.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 12 Oct 2008 16:05:34 +0000 |
parents | f55c87ae336b |
children | 73b9f5fc6690 |
files | src/video/win32/SDL_win32events.c |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/video/win32/SDL_win32events.c Sat Oct 04 06:46:59 2008 +0000 +++ b/src/video/win32/SDL_win32events.c Sun Oct 12 16:05:34 2008 +0000 @@ -226,7 +226,7 @@ /* we're collecting data from the mouse */ GetRawInputData((HRAWINPUT) lParam, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER)); - lpb = SDL_malloc(size * sizeof(LPBYTE)); + lpb = SDL_stack_alloc(BYTE, size); GetRawInputData((HRAWINPUT) lParam, RID_INPUT, lpb, &size, sizeof(RAWINPUTHEADER)); raw = (RAWINPUT *) lpb; @@ -252,19 +252,19 @@ SDL_SendMouseMotion(index, 0, point.x, point.y, 0); } /* we're sending mouse buttons messages to check up if sth changed */ - if (flags & RI_MOUSE_BUTTON_1_DOWN) { + if (flags & RI_MOUSE_LEFT_BUTTON_DOWN) { SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_LEFT); - } else if (flags & RI_MOUSE_BUTTON_1_UP) { + } else if (flags & RI_MOUSE_LEFT_BUTTON_UP) { SDL_SendMouseButton(index, SDL_RELEASED, SDL_BUTTON_LEFT); } - if (flags & RI_MOUSE_BUTTON_2_DOWN) { + if (flags & RI_MOUSE_MIDDLE_BUTTON_DOWN) { SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_MIDDLE); - } else if (flags & RI_MOUSE_BUTTON_2_UP) { + } else if (flags & RI_MOUSE_MIDDLE_BUTTON_UP) { SDL_SendMouseButton(index, SDL_RELEASED, SDL_BUTTON_MIDDLE); } - if (flags & RI_MOUSE_BUTTON_3_DOWN) { + if (flags & RI_MOUSE_RIGHT_BUTTON_DOWN) { SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_RIGHT); - } else if (flags & RI_MOUSE_BUTTON_3_UP) { + } else if (flags & RI_MOUSE_RIGHT_BUTTON_UP) { SDL_SendMouseButton(index, SDL_RELEASED, SDL_BUTTON_RIGHT); } if (flags & RI_MOUSE_BUTTON_4_DOWN) { @@ -283,6 +283,7 @@ raw->data.mouse.usButtonData); } } + SDL_stack_free(lpb); } return (0);