[gtk+/events-refactor: 508/1085] Implement set_window_cursor() for GdkDeviceCore.



commit 6d0b51c10c04a61220cf49f1f37517607b3d3d6e
Author: Carlos Garnacho <carlos lanedo com>
Date:   Fri Jul 10 20:28:01 2009 +0100

    Implement set_window_cursor() for GdkDeviceCore.

 gdk/x11/gdkdevice-core.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/gdk/x11/gdkdevice-core.c b/gdk/x11/gdkdevice-core.c
index 789c400..2f1317a 100644
--- a/gdk/x11/gdkdevice-core.c
+++ b/gdk/x11/gdkdevice-core.c
@@ -19,11 +19,16 @@
 
 #include <gdk/gdkwindow.h>
 #include "gdkdevice-core.h"
+#include "gdkprivate-x11.h"
+#include "gdkx.h"
 
 static void gdk_device_core_get_state (GdkDevice       *device,
                                        GdkWindow       *window,
                                        gdouble         *axes,
                                        GdkModifierType *mask);
+static void gdk_device_core_set_window_cursor (GdkDevice *device,
+                                               GdkWindow *window,
+                                               GdkCursor *cursor);
 
 
 G_DEFINE_TYPE (GdkDeviceCore, gdk_device_core, GDK_TYPE_DEVICE)
@@ -39,6 +44,7 @@ gdk_device_core_class_init (GdkDeviceCoreClass *klass)
   GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
 
   device_class->get_state = gdk_device_core_get_state;
+  device_class->set_window_cursor = gdk_device_core_set_window_cursor;
 }
 
 static void
@@ -71,3 +77,23 @@ gdk_device_core_get_state (GdkDevice       *device,
       axes[1] = y_int;
     }
 }
+
+static void
+gdk_device_core_set_window_cursor (GdkDevice *device,
+                                   GdkWindow *window,
+                                   GdkCursor *cursor)
+{
+  GdkCursorPrivate *cursor_private;
+  Cursor xcursor;
+
+  cursor_private = (GdkCursorPrivate*) cursor;
+
+  if (!cursor)
+    xcursor = None;
+  else
+    xcursor = cursor_private->xcursor;
+
+  XDefineCursor (GDK_WINDOW_XDISPLAY (window),
+                 GDK_WINDOW_XID (window),
+                 xcursor);
+}



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