[maemo-commits] [maemo-commits] r18631 - in projects/haf/trunk/gtk+: . gdk/x11

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Jun 5 17:31:19 EEST 2009
Author: mitch
Date: 2009-06-05 17:31:16 +0300 (Fri, 05 Jun 2009)
New Revision: 18631

Modified:
   projects/haf/trunk/gtk+/ChangeLog
   projects/haf/trunk/gtk+/configure.in
   projects/haf/trunk/gtk+/gdk/x11/gdkinput-x11.c
   projects/haf/trunk/gtk+/gdk/x11/gdkinput-xfree.c
Log:
Apply patch from Carlos:

2009-06-05  Carlos Garnacho  <carlos at lanedo.com>

        Fixes: NB#95806 - Pressure data not received from motion events.

        * configure.in: Detect XInput >= 1.1.99.
        * gdk/x11/gdkinput-xfree.c (gdk_input_init):
        * gdk/x11/gdkinput-x11.c (_gdk_input_common_init)
        (gdk_input_translate_coordinates) (gdk_input_device_new)
        (_gdk_input_common_other_event): Use XInput 2 features if available,
        initialize correctly all devices in this case, and also translate
        axis/coordinates from the extended events.



Modified: projects/haf/trunk/gtk+/ChangeLog
===================================================================
--- projects/haf/trunk/gtk+/ChangeLog	2009-06-05 14:15:10 UTC (rev 18630)
+++ projects/haf/trunk/gtk+/ChangeLog	2009-06-05 14:31:16 UTC (rev 18631)
@@ -1,3 +1,15 @@
+2009-06-05  Carlos Garnacho  <carlos at lanedo.com>
+
+	Fixes: NB#95806 - Pressure data not received from motion events.
+
+	* configure.in: Detect XInput >= 1.1.99.
+	* gdk/x11/gdkinput-xfree.c (gdk_input_init):
+	* gdk/x11/gdkinput-x11.c (_gdk_input_common_init)
+	(gdk_input_translate_coordinates) (gdk_input_device_new)
+	(_gdk_input_common_other_event): Use XInput 2 features if available,
+	initialize correctly all devices in this case, and also translate
+	axis/coordinates from the extended events.
+
 2009-06-05  Kristian Rietveld  <kris at lanedo.com>
 
 	Fixes: NB#114454 - Not possible to set hildon icon size to toolbar

Modified: projects/haf/trunk/gtk+/configure.in
===================================================================
--- projects/haf/trunk/gtk+/configure.in	2009-06-05 14:15:10 UTC (rev 18630)
+++ projects/haf/trunk/gtk+/configure.in	2009-06-05 14:31:16 UTC (rev 18631)
@@ -1531,6 +1531,10 @@
     
     if $PKG_CONFIG --exists xi ; then
       X_PACKAGES="$X_PACKAGES xi"
+
+      if $PKG_CONFIG --exists "xi >= 1.1.99" ; then
+        AC_DEFINE(XINPUT_2, 1, [Define to 1 if XInput 2.0 is available])
+      fi
     else
       GTK_ADD_LIB(x_extra_libs, Xi)
     fi

Modified: projects/haf/trunk/gtk+/gdk/x11/gdkinput-x11.c
===================================================================
--- projects/haf/trunk/gtk+/gdk/x11/gdkinput-x11.c	2009-06-05 14:15:10 UTC (rev 18630)
+++ projects/haf/trunk/gtk+/gdk/x11/gdkinput-x11.c	2009-06-05 14:31:16 UTC (rev 18631)
@@ -114,7 +114,12 @@
       (fixed in 3.2A) */
    gdkdev->info.name = g_strdup ("pointer");
 
-  gdkdev->info.mode = GDK_MODE_DISABLED;
+#if defined (MAEMO_CHANGES) && defined (XINPUT_2)
+  if (device->use == IsXPointer)
+    gdkdev->info.mode = GDK_MODE_SCREEN;
+  else
+#endif
+    gdkdev->info.mode = GDK_MODE_DISABLED;
 
   /* Try to figure out what kind of device this is by its name -
      could invite a very, very, long list... Lowercase name
@@ -122,7 +127,11 @@
 
   tmp_name = g_ascii_strdown (gdkdev->info.name, -1);
   
+#ifdef MAEMO_CHANGES
+  if (g_str_has_suffix (tmp_name, "pointer"))
+#else
   if (!strcmp (tmp_name, "pointer"))
+#endif
     gdkdev->info.source = GDK_SOURCE_MOUSE;
   else if (!strcmp (tmp_name, "wacom") ||
 	   !strcmp (tmp_name, "pen"))
@@ -222,8 +231,10 @@
       (!include_core && device->use == IsXPointer))
     goto error;
 
+#if !defined (MAEMO_CHANGES) || !defined (XINPUT_2)
   if (device->use != IsXPointer)
     {
+#endif
       gdk_error_trap_push ();
       gdkdev->xdevice = XOpenDevice (GDK_DISPLAY_XDISPLAY (display),
 				     gdkdev->deviceid);
@@ -231,7 +242,9 @@
       /* return NULL if device is not ready */
       if (gdk_error_trap_pop ())
 	goto error;
+#if !defined (MAEMO_CHANGES) || !defined (XINPUT_2)
     }
+#endif
 
   gdkdev->buttonpress_type = 0;
   gdkdev->buttonrelease_type = 0;
@@ -400,6 +413,10 @@
   if (XQueryExtension (display_x11->xdisplay, "XInputExtension",
 		       &ignore, &event_base, &ignore))
     {
+#if defined (MAEMO_CHANGES) && defined (XINPUT_2)
+      XQueryInputVersion(display_x11->xdisplay, XI_2_Major, XI_2_Minor);
+#endif
+
       gdk_x11_register_standard_event_type (display,
 					    event_base, 15 /* Number of events */);
 
@@ -594,11 +611,24 @@
       event->button.time = xdbe->time;
 
       event->button.axes = g_new (gdouble, gdkdev->info.num_axes);
-      gdk_input_translate_coordinates (gdkdev,input_window, xdbe->axis_data,
-				       event->button.axes, 
-				       &event->button.x,&event->button.y);
+
+#if !defined (MAEMO_CHANGES) || !defined (XINPUT_2)
+      gdk_input_translate_coordinates (gdkdev, input_window, xdbe->axis_data,
+                                       event->button.axes,
+                                       &event->button.x, &event->button.y);
       event->button.x_root = event->button.x + input_window->root_x;
       event->button.y_root = event->button.y + input_window->root_y;
+#else
+      gdk_input_translate_coordinates (gdkdev, input_window, xdbe->axis_data,
+                                       event->button.axes,
+                                       NULL, NULL);
+
+      event->button.x = (gdouble) xdbe->x;
+      event->button.y = (gdouble) xdbe->y;
+      event->button.x_root = (gdouble) xdbe->x_root;
+      event->button.y_root = (gdouble) xdbe->y_root;
+#endif
+
       event->button.state = gdk_input_translate_state(xdbe->state,xdbe->device_state);
       event->button.button = xdbe->button;
 
@@ -696,12 +726,24 @@
       event->motion.device = &gdkdev->info;
       
       event->motion.axes = g_new (gdouble, gdkdev->info.num_axes);
-      gdk_input_translate_coordinates(gdkdev,input_window,xdme->axis_data,
-				      event->motion.axes,
-				      &event->motion.x,&event->motion.y);
+
+#if !defined (MAEMO_CHANGES) || !defined (XINPUT_2)
+      gdk_input_translate_coordinates (gdkdev, input_window, xdme->axis_data,
+                                       event->motion.axes,
+                                       &event->motion.x, &event->motion.y);
       event->motion.x_root = event->motion.x + input_window->root_x;
       event->motion.y_root = event->motion.y + input_window->root_y;
+#else
+      gdk_input_translate_coordinates (gdkdev, input_window, xdme->axis_data,
+                                       event->motion.axes,
+                                       NULL, NULL);
 
+      event->motion.x = (gdouble) xdme->x;
+      event->motion.y = (gdouble) xdme->y;
+      event->motion.x_root = (gdouble) xdme->x_root;
+      event->motion.y_root = (gdouble) xdme->y_root;
+#endif
+
       event->motion.type = GDK_MOTION_NOTIFY;
       event->motion.window = input_window->window;
       event->motion.time = xdme->time;

Modified: projects/haf/trunk/gtk+/gdk/x11/gdkinput-xfree.c
===================================================================
--- projects/haf/trunk/gtk+/gdk/x11/gdkinput-xfree.c	2009-06-05 14:15:10 UTC (rev 18630)
+++ projects/haf/trunk/gtk+/gdk/x11/gdkinput-xfree.c	2009-06-05 14:31:16 UTC (rev 18631)
@@ -38,7 +38,11 @@
 {
   _gdk_init_input_core (display);
   GDK_DISPLAY_X11 (display)->input_ignore_core = FALSE;
+#ifdef MAEMO_CHANGES
+  _gdk_input_common_init (display, TRUE);
+#else
   _gdk_input_common_init (display, FALSE);
+#endif
 }
 
 gboolean


More information about the maemo-commits mailing list