Sharpened code looks and a minor events upgrade gsoc2008_manymouse
authorSzymon Wilczek <kazeuser@gmail.com>
Wed, 06 Aug 2008 09:29:32 +0000
branchgsoc2008_manymouse
changeset 3777 54d08ecec1cb
parent 3776 a9c2a7071874
child 3778 a9370b995ded
Sharpened code looks and a minor events upgrade
include/SDL_events.h
src/events/SDL_mouse.c
src/video/x11/SDL_x11mouse.c
--- a/include/SDL_events.h	Wed Aug 06 08:48:43 2008 +0000
+++ b/include/SDL_events.h	Wed Aug 06 09:29:32 2008 +0000
@@ -331,6 +331,7 @@
 {
     Uint8 which;
     Uint8 type;
+    int cursor;
     int x;
     int y;
 } SDL_ProximityEvent;
--- a/src/events/SDL_mouse.c	Wed Aug 06 08:48:43 2008 +0000
+++ b/src/events/SDL_mouse.c	Wed Aug 06 09:29:32 2008 +0000
@@ -338,6 +338,7 @@
 SDL_SendProximity(int id, int x, int y, int type)
 {
     int index=SDL_GetIndexById(id);
+    SDL_Mouse* mouse=SDL_GetMouse(index);
     int posted=0;
 	last_x=x;
 	last_y=y;
@@ -347,23 +348,24 @@
         event.proximity.which=(Uint8)index;
         event.proximity.x=x;
         event.proximity.y=y;
+        event.proximity.cursor=mouse->current_end;
         event.type=type;
         event.proximity.type=type;
         posted = (SDL_PushEvent(&event) > 0);
         if(type==SDL_PROXIMITYIN)
         {
-            SDL_mice[index]->proximity=SDL_TRUE;
+            mouse->proximity=SDL_TRUE;
         }
         else
         {
-            SDL_mice[index]->proximity=SDL_FALSE;
+            mouse->proximity=SDL_FALSE;
         }
     }
     return posted;
 }
 
 int
-SDL_SendMouseMotion(int id, int relative, int x, int y,int z)
+SDL_SendMouseMotion(int id, int relative, int x, int y,int pressure)
 {
     int index=SDL_GetIndexById(id);
     SDL_Mouse *mouse = SDL_GetMouse(index);
@@ -440,7 +442,7 @@
     }
     mouse->xdelta += xrel;
     mouse->ydelta += yrel;
-    mouse->pressure=z;
+    mouse->pressure=pressure;
 
     /* Move the mouse cursor, if needed */
     if (mouse->cursor_shown && !mouse->relative_mode &&
@@ -450,7 +452,8 @@
 
     /* Post the event, if desired */
     posted = 0;
-    if (SDL_ProcessEvents[SDL_MOUSEMOTION] == SDL_ENABLE && SDL_mice[index]->proximity==SDL_TRUE) {
+    if (SDL_ProcessEvents[SDL_MOUSEMOTION] == SDL_ENABLE && \
+            mouse->proximity==SDL_TRUE) {
         SDL_Event event;
         event.motion.type = SDL_MOUSEMOTION;
 		event.motion.which = (Uint8) index;
--- a/src/video/x11/SDL_x11mouse.c	Wed Aug 06 08:48:43 2008 +0000
+++ b/src/video/x11/SDL_x11mouse.c	Wed Aug 06 09:29:32 2008 +0000
@@ -59,7 +59,7 @@
                     if(!newDevices)
                     {
                         SDL_OutOfMemory();
-                        return -1;
+                        return;
                     }
                     SDL_XDevices=newDevices;
                     SDL_XDevices[index]=XOpenDevice(data->display,DevList[i].id);