diff src/video/x11/SDL_x11video.c @ 3773:3b5691f85c0d gsoc2008_manymouse

Further x11 code improvments + comments
author Szymon Wilczek <kazeuser@gmail.com>
date Mon, 04 Aug 2008 11:18:10 +0000
parents 9087a84cba51
children
line wrap: on
line diff
--- a/src/video/x11/SDL_x11video.c	Sat Aug 02 17:40:49 2008 +0000
+++ b/src/video/x11/SDL_x11video.c	Mon Aug 04 11:18:10 2008 +0000
@@ -220,7 +220,7 @@
 int
 X11_VideoInit(_THIS)
 {
-    int i,index=0,c_not_needed;
+    int i,index=0,event_code;
     XEventClass xEvent;
     SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
 
@@ -250,90 +250,46 @@
         return -1;
     }
     X11_InitMouse(_this);
+
     /*we're generating the table of events that should be recognized*/
     for(i=0;i<SDL_NumOfXDevices;++i)
-    {   
-        DeviceKeyPress(SDL_XDevices[i],c_not_needed,xEvent);
-	    if (xEvent) SDL_XEvents[index++] = xEvent;
-	    DeviceKeyRelease(SDL_XDevices[i],c_not_needed,xEvent);
-	if (xEvent) SDL_XEvents[index++] = xEvent;
-
-	/*focus events*/
-	DeviceFocusIn(SDL_XDevices[i],c_not_needed,xEvent);
-	if (xEvent) SDL_XEvents[index++] = xEvent;
-	DeviceFocusOut(SDL_XDevices[i],c_not_needed,xEvent);
-	if (xEvent) SDL_XEvents[index++] = xEvent;
-
-	/*button events*/
-	DeviceButtonPress(SDL_XDevices[i],c_not_needed,xEvent);
-	if (xEvent) 
-    {
-        SDL_XEvents[index++] = xEvent;
-        button_pressed=c_not_needed;
-    }
-	DeviceButtonRelease(SDL_XDevices[i],c_not_needed,xEvent);
-	if (xEvent)
-    {
-        SDL_XEvents[index++] = xEvent;
-        button_released=c_not_needed;
-    }
+    {  
+	    /*button events*/
+	    DeviceButtonPress(SDL_XDevices[i],event_code,xEvent);
+	    if (xEvent) 
+        {
+            SDL_XEvents[index++] = xEvent;
+            button_pressed=event_code;
+        }
+	    DeviceButtonRelease(SDL_XDevices[i],event_code,xEvent);
+	    if (xEvent)
+        {
+            SDL_XEvents[index++] = xEvent;
+            button_released=event_code;
+        }
 
-	/*proximity events*/
-	ProximityIn(SDL_XDevices[i],c_not_needed,xEvent);
-	if (xEvent)
-    {
-        SDL_XEvents[index++] = xEvent;
-        proximity_in=c_not_needed;
-    }
-	ProximityOut(SDL_XDevices[i],c_not_needed,xEvent);
-	if (xEvent)
-    {
-        SDL_XEvents[index++] = xEvent;
-        proximity_out=c_not_needed;
-    }
-	/*motion events*/
-	DeviceMotionNotify(SDL_XDevices[i],c_not_needed,xEvent);
-	if (xEvent) 
-    {
-        SDL_XEvents[index++] = xEvent;
-        motion=c_not_needed;
-    }
+	    /*proximity events*/
+	    ProximityIn(SDL_XDevices[i],event_code,xEvent);
+	    if (xEvent)
+        {
+            SDL_XEvents[index++] = xEvent;
+            proximity_in=event_code;
+        }
+	    ProximityOut(SDL_XDevices[i],event_code,xEvent);
+	    if (xEvent)
+        {
+            SDL_XEvents[index++] = xEvent;
+            proximity_out=event_code;
+        }
 
-	/*device state*/
-	DeviceStateNotify(SDL_XDevices[i],c_not_needed,xEvent);
-	if (xEvent) SDL_XEvents[index++] = xEvent;
-	DeviceMappingNotify(SDL_XDevices[i],
-			c_not_needed,xEvent);
-	if (xEvent) SDL_XEvents[index++] = xEvent;
-	ChangeDeviceNotify(SDL_XDevices[i],c_not_needed,xEvent);
-	if (xEvent) SDL_XEvents[index++] = xEvent;
-
-#if 0
-	/* this cuts the motion data down - not sure if this is useful */
-	DevicePointerMotionHint(SDL_XDevices[i],
-			c_not_neededINPUTEVENT_DEVICE_POINTER_MOTION_HINT],xEvent);
-	if (xEvent) SDL_XEvents[index++] = xEvent;
-#endif
+	    /*motion events*/
+	    DeviceMotionNotify(SDL_XDevices[i],event_code,xEvent);
+	    if (xEvent) 
+        {
+            SDL_XEvents[index++] = xEvent;
+            motion=event_code;
+        }
 
-	/*button motion*/
-	DeviceButtonMotion(SDL_XDevices[i],
-			c_not_needed,xEvent);
-	if (xEvent) SDL_XEvents[index++] = xEvent;
-	DeviceButton1Motion(SDL_XDevices[i],
-			c_not_needed,xEvent);
-	if (xEvent) SDL_XEvents[index++] = xEvent;
-	DeviceButton2Motion(SDL_XDevices[i],
-			c_not_needed,xEvent);
-	if (xEvent) SDL_XEvents[index++] = xEvent;
-	DeviceButton3Motion(SDL_XDevices[i],
-			c_not_needed,xEvent);
-	if (xEvent) SDL_XEvents[index++] = xEvent;
-	DeviceButton4Motion(SDL_XDevices[i],
-			c_not_needed,xEvent);
-	if (xEvent) SDL_XEvents[index++] = xEvent;
-	DeviceButton5Motion(SDL_XDevices[i],
-			c_not_needed,xEvent);
-	if (xEvent) SDL_XEvents[index++] = xEvent;
     }
     SDL_NumOfXEvents=index;