[gtk+/xi2: 1229/1239] GdkDeviceManagerXI: Add device axes using private GdkDevice API.



commit 7ebefed09006aabc909b490c4866974b046f9d3e
Author: Carlos Garnacho <carlos gnome org>
Date:   Sat Sep 26 20:37:26 2009 +0200

    GdkDeviceManagerXI: Add device axes using private GdkDevice API.

 gdk/x11/gdkdevicemanager-xi.c |   63 ++++++++++++++++++++++-------------------
 1 files changed, 34 insertions(+), 29 deletions(-)
---
diff --git a/gdk/x11/gdkdevicemanager-xi.c b/gdk/x11/gdkdevicemanager-xi.c
index 3113246..3e5ad39 100644
--- a/gdk/x11/gdkdevicemanager-xi.c
+++ b/gdk/x11/gdkdevicemanager-xi.c
@@ -145,36 +145,41 @@ translate_class_info (GdkDevice   *device,
 	{
 	  XValuatorInfo *xvi = (XValuatorInfo *)class;
 
-          device->num_axes = xvi->num_axes;
-	  device->axes = g_new0 (GdkDeviceAxis, xvi->num_axes);
-#if 0
-	  gdkdev->axes = g_new (GdkAxisInfo, xvi->num_axes);
-
           for (j = 0; j < xvi->num_axes; j++)
-	    {
-	      gdkdev->axes[j].resolution =
-		gdkdev->axes[j].xresolution = xvi->axes[j].resolution;
-	      gdkdev->axes[j].min_value =
-		gdkdev->axes[j].xmin_value = xvi->axes[j].min_value;
-	      gdkdev->axes[j].max_value =
-		gdkdev->axes[j].xmax_value = xvi->axes[j].max_value;
-	      gdkdev->info.axes[j].use = GDK_AXIS_IGNORE;
-	    }
-#endif
-	  j=0;
-
-          if (j < xvi->num_axes)
-	    gdk_device_set_axis_use (device, j++, GDK_AXIS_X);
-	  if (j < xvi->num_axes)
-	    gdk_device_set_axis_use (device, j++, GDK_AXIS_Y);
-	  if (j < xvi->num_axes)
-	    gdk_device_set_axis_use (device, j++, GDK_AXIS_PRESSURE);
-	  if (j < xvi->num_axes)
-	    gdk_device_set_axis_use (device, j++, GDK_AXIS_XTILT);
-	  if (j < xvi->num_axes)
-	    gdk_device_set_axis_use (device, j++, GDK_AXIS_YTILT);
-	  if (j < xvi->num_axes)
-	    gdk_device_set_axis_use (device, j++, GDK_AXIS_WHEEL);
+            {
+              GdkAxisUse use;
+
+              switch (j)
+                {
+                case 0:
+                  use = GDK_AXIS_X;
+                  break;
+                case 1:
+                  use = GDK_AXIS_Y;
+                  break;
+                case 2:
+                  use = GDK_AXIS_PRESSURE;
+                  break;
+                case 3:
+                  use = GDK_AXIS_XTILT;
+                  break;
+                case 4:
+                  use = GDK_AXIS_YTILT;
+                  break;
+                case 5:
+                  use = GDK_AXIS_WHEEL;
+                  break;
+                default:
+                  use = GDK_AXIS_IGNORE;
+                }
+
+              _gdk_device_add_axis (device,
+                                    GDK_NONE,
+                                    use,
+                                    xvi->axes[j].min_value,
+                                    xvi->axes[j].max_value,
+                                    xvi->axes[j].resolution);
+            }
 
 	  break;
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]