[gtk+/xi2: 527/1239] Implement set_window_cursor() for GdkDeviceXI2.



commit e29964cd87a1c583cae15e669c5f98bd39180e6f
Author: Carlos Garnacho <carlos lanedo com>
Date:   Sat Jul 11 22:07:12 2009 +0200

    Implement set_window_cursor() for GdkDeviceXI2.

 gdk/x11/gdkdevice-xi2.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/gdk/x11/gdkdevice-xi2.c b/gdk/x11/gdkdevice-xi2.c
index fb3a65a..36838c8 100644
--- a/gdk/x11/gdkdevice-xi2.c
+++ b/gdk/x11/gdkdevice-xi2.c
@@ -17,8 +17,10 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#include <X11/extensions/XInput2.h>
 #include "gdkdevice-xi2.h"
 #include "gdkintl.h"
+#include "gdkx.h"
 
 
 #define GDK_DEVICE_XI2_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDK_TYPE_DEVICE_XI2, GdkDeviceXI2Private))
@@ -48,6 +50,10 @@ static gboolean gdk_device_xi2_get_axis (GdkDevice    *device,
                                          gdouble      *axes,
                                          GdkAxisUse    use,
                                          gdouble      *value);
+static void gdk_device_xi2_set_window_cursor (GdkDevice *device,
+                                              GdkWindow *window,
+                                              GdkCursor *cursor);
+
 
 G_DEFINE_TYPE (GdkDeviceXI2, gdk_device_xi2, GDK_TYPE_DEVICE)
 
@@ -68,6 +74,7 @@ gdk_device_xi2_class_init (GdkDeviceXI2Class *klass)
 
   device_class->get_state = gdk_device_xi2_get_state;
   device_class->get_axis = gdk_device_xi2_get_axis;
+  device_class->set_window_cursor = gdk_device_xi2_set_window_cursor;
 
   g_object_class_install_property (object_class,
 				   PROP_DEVICE_ID,
@@ -178,6 +185,31 @@ gdk_device_xi2_get_axis (GdkDevice  *device,
   return FALSE;
 }
 
+static void
+gdk_device_xi2_set_window_cursor (GdkDevice *device,
+                                  GdkWindow *window,
+                                  GdkCursor *cursor)
+{
+  GdkDeviceXI2Private *priv;
+  GdkCursorPrivate *cursor_private;
+
+  priv = GDK_DEVICE_XI2_GET_PRIVATE (device);
+
+  if (cursor)
+    {
+      cursor_private = (GdkCursorPrivate*) cursor;
+
+      XIDefineCursor (GDK_WINDOW_XDISPLAY (window),
+                      priv->device_id,
+                      GDK_WINDOW_XWINDOW (window),
+                      cursor_private->xcursor);
+    }
+  else
+    XIUndefineCursor (GDK_WINDOW_XDISPLAY (window),
+                      priv->device_id,
+                      GDK_WINDOW_XWINDOW (window));
+}
+
 void
 gdk_device_xi2_add_axis (GdkDeviceXI2 *device,
                          GdkAxisUse    use)



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