Removed unneccesary code lines. Fixed mousename bug. Added lacking code in mousebutton

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403168
This commit is contained in:
Szymon Wilczek 2008-08-25 18:02:14 +00:00
parent f3a0aca8ff
commit 96e1657806
3 changed files with 47 additions and 10 deletions

View file

@ -116,8 +116,8 @@ SDL_AddMouse(const SDL_Mouse * mouse, int index, char *name, int pressure_max,
/* we're setting the mouse properties */
length = 0;
length = SDL_strlen(name);
SDL_mice[index]->name = SDL_malloc((length + 1) * sizeof(char));
SDL_strlcpy(SDL_mice[index]->name, name, length);
SDL_mice[index]->name = SDL_malloc((length + 2) * sizeof(char));
SDL_strlcpy(SDL_mice[index]->name, name, length+1);
SDL_mice[index]->pressure_max = pressure_max;
SDL_mice[index]->pressure_min = pressure_min;
SDL_mice[index]->cursor_shown = SDL_TRUE;
@ -512,6 +512,10 @@ SDL_SendMouseButton(int id, Uint8 state, Uint8 button)
mouse->buttonstate |= SDL_BUTTON(button);
break;
case SDL_RELEASED:
if(!(mouse->buttonstate & SDL_BUTTON(button))) {
/* Ignore this event, no state change */
return 0;
}
type = SDL_MOUSEBUTTONUP;
mouse->buttonstate &= ~SDL_BUTTON(button);
break;