diff src/events/SDL_mouse.c @ 2718:abacf2555bb4

Removed unneccesary code lines. Fixed mousename bug. Added lacking code in mousebutton
author Szymon Wilczek <kazeuser@gmail.com>
date Mon, 25 Aug 2008 18:02:14 +0000
parents c4e697245676
children 6ce6d56b63bf
line wrap: on
line diff
--- a/src/events/SDL_mouse.c	Mon Aug 25 17:34:58 2008 +0000
+++ b/src/events/SDL_mouse.c	Mon Aug 25 18:02:14 2008 +0000
@@ -116,8 +116,8 @@
     /* 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 @@
         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;