src/events/SDL_mouse.c
changeset 9334 5eb5ab33286e
parent 9257 6f41196c2d6b
child 9448 3d3ed3a5ba8d
equal deleted inserted replaced
9333:de02c2d8a06f 9334:5eb5ab33286e
   301 
   301 
   302 static SDL_MouseClickState *GetMouseClickState(SDL_Mouse *mouse, Uint8 button)
   302 static SDL_MouseClickState *GetMouseClickState(SDL_Mouse *mouse, Uint8 button)
   303 {
   303 {
   304     if (button >= mouse->num_clickstates) {
   304     if (button >= mouse->num_clickstates) {
   305         int i, count = button + 1;
   305         int i, count = button + 1;
   306         mouse->clickstate = (SDL_MouseClickState *)SDL_realloc(mouse->clickstate, count * sizeof(*mouse->clickstate));
   306         SDL_MouseClickState *clickstate = (SDL_MouseClickState *)SDL_realloc(mouse->clickstate, count * sizeof(*mouse->clickstate));
   307         if (!mouse->clickstate) {
   307         if (!clickstate) {
   308             return NULL;
   308             return NULL;
   309         }
   309         }
       
   310         mouse->clickstate = clickstate;
   310 
   311 
   311         for (i = mouse->num_clickstates; i < count; ++i) {
   312         for (i = mouse->num_clickstates; i < count; ++i) {
   312             SDL_zero(mouse->clickstate[i]);
   313             SDL_zero(mouse->clickstate[i]);
   313         }
   314         }
   314         mouse->num_clickstates = count;
   315         mouse->num_clickstates = count;