src/video/win32/SDL_win32events.c
changeset 2766 5955b6550d7e
parent 2733 264037dd3c7a
child 2794 f7872b7a8732
--- 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);