src/video/win32/SDL_win32events.c
changeset 2766 5955b6550d7e
parent 2733 264037dd3c7a
child 2794 f7872b7a8732
equal deleted inserted replaced
2765:f55c87ae336b 2766:5955b6550d7e
   224             USHORT flags;
   224             USHORT flags;
   225 
   225 
   226             /* we're collecting data from the mouse */
   226             /* we're collecting data from the mouse */
   227             GetRawInputData((HRAWINPUT) lParam, RID_INPUT, NULL, &size,
   227             GetRawInputData((HRAWINPUT) lParam, RID_INPUT, NULL, &size,
   228                             sizeof(RAWINPUTHEADER));
   228                             sizeof(RAWINPUTHEADER));
   229             lpb = SDL_malloc(size * sizeof(LPBYTE));
   229             lpb = SDL_stack_alloc(BYTE, size);
   230             GetRawInputData((HRAWINPUT) lParam, RID_INPUT, lpb, &size,
   230             GetRawInputData((HRAWINPUT) lParam, RID_INPUT, lpb, &size,
   231                             sizeof(RAWINPUTHEADER));
   231                             sizeof(RAWINPUTHEADER));
   232             raw = (RAWINPUT *) lpb;
   232             raw = (RAWINPUT *) lpb;
   233             header = &raw->header;
   233             header = &raw->header;
   234             flags = raw->data.mouse.usButtonFlags;
   234             flags = raw->data.mouse.usButtonFlags;
   250                 SDL_SendMouseMotion(index, 0, point.x, point.y, pressure);
   250                 SDL_SendMouseMotion(index, 0, point.x, point.y, pressure);
   251             } else {
   251             } else {
   252                 SDL_SendMouseMotion(index, 0, point.x, point.y, 0);
   252                 SDL_SendMouseMotion(index, 0, point.x, point.y, 0);
   253             }
   253             }
   254             /* we're sending mouse buttons messages to check up if sth changed */
   254             /* we're sending mouse buttons messages to check up if sth changed */
   255             if (flags & RI_MOUSE_BUTTON_1_DOWN) {
   255             if (flags & RI_MOUSE_LEFT_BUTTON_DOWN) {
   256                 SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_LEFT);
   256                 SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_LEFT);
   257             } else if (flags & RI_MOUSE_BUTTON_1_UP) {
   257             } else if (flags & RI_MOUSE_LEFT_BUTTON_UP) {
   258                 SDL_SendMouseButton(index, SDL_RELEASED, SDL_BUTTON_LEFT);
   258                 SDL_SendMouseButton(index, SDL_RELEASED, SDL_BUTTON_LEFT);
   259             }
   259             }
   260             if (flags & RI_MOUSE_BUTTON_2_DOWN) {
   260             if (flags & RI_MOUSE_MIDDLE_BUTTON_DOWN) {
   261                 SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_MIDDLE);
   261                 SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_MIDDLE);
   262             } else if (flags & RI_MOUSE_BUTTON_2_UP) {
   262             } else if (flags & RI_MOUSE_MIDDLE_BUTTON_UP) {
   263                 SDL_SendMouseButton(index, SDL_RELEASED, SDL_BUTTON_MIDDLE);
   263                 SDL_SendMouseButton(index, SDL_RELEASED, SDL_BUTTON_MIDDLE);
   264             }
   264             }
   265             if (flags & RI_MOUSE_BUTTON_3_DOWN) {
   265             if (flags & RI_MOUSE_RIGHT_BUTTON_DOWN) {
   266                 SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_RIGHT);
   266                 SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_RIGHT);
   267             } else if (flags & RI_MOUSE_BUTTON_3_UP) {
   267             } else if (flags & RI_MOUSE_RIGHT_BUTTON_UP) {
   268                 SDL_SendMouseButton(index, SDL_RELEASED, SDL_BUTTON_RIGHT);
   268                 SDL_SendMouseButton(index, SDL_RELEASED, SDL_BUTTON_RIGHT);
   269             }
   269             }
   270             if (flags & RI_MOUSE_BUTTON_4_DOWN) {
   270             if (flags & RI_MOUSE_BUTTON_4_DOWN) {
   271                 SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_X1);
   271                 SDL_SendMouseButton(index, SDL_PRESSED, SDL_BUTTON_X1);
   272             } else if (flags & RI_MOUSE_BUTTON_4_UP) {
   272             } else if (flags & RI_MOUSE_BUTTON_4_UP) {
   281                 if (raw->data.mouse.usButtonData != 0) {
   281                 if (raw->data.mouse.usButtonData != 0) {
   282                     SDL_SendMouseWheel(index, 0,
   282                     SDL_SendMouseWheel(index, 0,
   283                                        raw->data.mouse.usButtonData);
   283                                        raw->data.mouse.usButtonData);
   284                 }
   284                 }
   285             }
   285             }
       
   286             SDL_stack_free(lpb);
   286         }
   287         }
   287         return (0);
   288         return (0);
   288 
   289 
   289     case WM_MOUSELEAVE:
   290     case WM_MOUSELEAVE:
   290         {
   291         {