evdev: Don't oveflow when translating buttons to masks
authorDamien Lespiau <damien.lespiau@intel.com>
Fri, 19 Nov 2010 19:19:52 +0000 (14:19 -0500)
committerDamien Lespiau <damien.lespiau@intel.com>
Tue, 30 Nov 2010 14:40:38 +0000 (14:40 +0000)
An array is used to translate the button to its mask. Clutter defines
the masks for button 1 to 5 but we report BTN_LEFT..BTN_TASK ie
0x110..0x117. We need to pad the array for the translation not to access
random data for buttons between 0x115 and 0x117.

clutter/evdev/clutter-device-manager-evdev.c

index ab2dfca..7e12093 100644 (file)
@@ -219,10 +219,10 @@ notify_button (ClutterEventSource *source,
   ClutterEvent *event;
   ClutterActor *stage;
   gint button_nr;
-  static gint maskmap[5] =
+  static gint maskmap[8] =
     {
       CLUTTER_BUTTON1_MASK, CLUTTER_BUTTON2_MASK, CLUTTER_BUTTON3_MASK,
-      CLUTTER_BUTTON4_MASK, CLUTTER_BUTTON5_MASK
+      CLUTTER_BUTTON4_MASK, CLUTTER_BUTTON5_MASK, 0, 0, 0
     };
 
   stage = clutter_stage_get_default ();