src/events/SDL_mouse.c
changeset 2152 003c1b5b07da
parent 2049 5f6550e5184f
child 2710 44e49d3fa6cf
child 3760 64f346a83ed3
equal deleted inserted replaced
2151:1e0692271600 2152:003c1b5b07da
   425     }
   425     }
   426     return posted;
   426     return posted;
   427 }
   427 }
   428 
   428 
   429 int
   429 int
   430 SDL_SendMouseWheel(int index, int motion)
   430 SDL_SendMouseWheel(int index, int x, int y)
   431 {
   431 {
   432     SDL_Mouse *mouse = SDL_GetMouse(index);
   432     SDL_Mouse *mouse = SDL_GetMouse(index);
   433     int posted;
   433     int posted;
   434 
   434 
   435     if (!mouse || !motion) {
   435     if (!mouse || (!x && !y)) {
   436         return 0;
   436         return 0;
   437     }
   437     }
   438 
   438 
   439     /* Post the event, if desired */
   439     /* Post the event, if desired */
   440     posted = 0;
   440     posted = 0;
   441     if (SDL_ProcessEvents[SDL_MOUSEWHEEL] == SDL_ENABLE) {
   441     if (SDL_ProcessEvents[SDL_MOUSEWHEEL] == SDL_ENABLE) {
   442         SDL_Event event;
   442         SDL_Event event;
   443         event.type = SDL_MOUSEWHEEL;
   443         event.type = SDL_MOUSEWHEEL;
   444         event.wheel.which = (Uint8) index;
   444         event.wheel.which = (Uint8) index;
   445         event.wheel.motion = motion;
   445         event.wheel.x = x;
       
   446         event.wheel.y = y;
   446         event.wheel.windowID = mouse->focus;
   447         event.wheel.windowID = mouse->focus;
   447         posted = (SDL_PushEvent(&event) > 0);
   448         posted = (SDL_PushEvent(&event) > 0);
   448     }
   449     }
   449     return posted;
   450     return posted;
   450 }
   451 }