| 
     
      
      
      From: <gi...@gp...> - 2011-09-05 13:34:15
      
     
   | 
The branch, master has been updated
       via  cbd2f49e3b4f48c45e70b76ce207e9e76a81dcb8 (commit)
      from  b372ca668852701f5e19b878ee3aa97361e377c8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
=========
 Summary
=========
 src/hid/gtk/gui-misc.c |   59 ++++++++++++++++++++++++-----------------------
 1 files changed, 30 insertions(+), 29 deletions(-)
=================
 Commit Messages
=================
commit cbd2f49e3b4f48c45e70b76ce207e9e76a81dcb8
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
    hid/gtk: Clean and make gport_set_cursor_type() more GTK3.0 compatible
    
    Also removes the DEFAULT_CURSOR return value (for the case of no window
    being setup) to GDK_X_CURSOR (the 0 enum value), as the code path which
    returned DEFAULT_CURSOR would never have been hit.
:100644 100644 3ed276c... dbed88e... M	src/hid/gtk/gui-misc.c
=========
 Changes
=========
commit cbd2f49e3b4f48c45e70b76ce207e9e76a81dcb8
Author: Peter Clifton <pc...@ca...>
Commit: Peter Clifton <pc...@ca...>
    hid/gtk: Clean and make gport_set_cursor_type() more GTK3.0 compatible
    
    Also removes the DEFAULT_CURSOR return value (for the case of no window
    being setup) to GDK_X_CURSOR (the 0 enum value), as the code path which
    returned DEFAULT_CURSOR would never have been hit.
diff --git a/src/hid/gtk/gui-misc.c b/src/hid/gtk/gui-misc.c
index 3ed276c..dbed88e 100644
--- a/src/hid/gtk/gui-misc.c
+++ b/src/hid/gtk/gui-misc.c
@@ -45,8 +45,6 @@
 
 RCSID ("$Id$");
 
-#define DEFAULT_CURSORSHAPE	GDK_CROSSHAIR
-
 #define CUSTOM_CURSOR_CLOCKWISE		(GDK_LAST_CURSOR + 10)
 #define CUSTOM_CURSOR_DRAG			(GDK_LAST_CURSOR + 11)
 #define CUSTOM_CURSOR_LOCK			(GDK_LAST_CURSOR + 12)
@@ -85,43 +83,46 @@ ghid_cursor_position_relative_label_set_text (gchar * text)
 static GdkCursorType
 gport_set_cursor (GdkCursorType shape)
 {
+  GdkWindow *window;
   GdkCursorType old_shape = gport->X_cursor_shape;
   GdkColor fg = { 0, 65535, 65535, 65535 };	/* white */
   GdkColor bg = { 0, 0, 0, 0 };	/* black */
 
-  if (!gport->drawing_area || !gport->drawing_area->window)
-    return (GdkCursorType)0;
+  if (gport->drawing_area == NULL)
+    return GDK_X_CURSOR;
+
+  window = gtk_widget_get_window (gport->drawing_area);
+
   if (gport->X_cursor_shape == shape)
     return shape;
 
   /* check if window exists to prevent from fatal errors */
-  if (gport->drawing_area->window)
+  if (window == NULL)
+    return GDK_X_CURSOR;
+
+  gport->X_cursor_shape = shape;
+  if (shape > GDK_LAST_CURSOR)
     {
-      gport->X_cursor_shape = shape;
-      if (shape > GDK_LAST_CURSOR)
-	{
-	  if (shape == CUSTOM_CURSOR_CLOCKWISE)
-	    gport->X_cursor =
-	      gdk_cursor_new_from_pixmap (XC_clock_source, XC_clock_mask, &fg,
-					  &bg, ICON_X_HOT, ICON_Y_HOT);
-	  else if (shape == CUSTOM_CURSOR_DRAG)
-	    gport->X_cursor =
-	      gdk_cursor_new_from_pixmap (XC_hand_source, XC_hand_mask, &fg,
-					  &bg, ICON_X_HOT, ICON_Y_HOT);
-	  else if (shape == CUSTOM_CURSOR_LOCK)
-	    gport->X_cursor =
-	      gdk_cursor_new_from_pixmap (XC_lock_source, XC_lock_mask, &fg,
-					  &bg, ICON_X_HOT, ICON_Y_HOT);
-	}
-      else
-	gport->X_cursor = gdk_cursor_new (shape);
+      if (shape == CUSTOM_CURSOR_CLOCKWISE)
+        gport->X_cursor =
+          gdk_cursor_new_from_pixmap (XC_clock_source, XC_clock_mask, &fg,
+                                      &bg, ICON_X_HOT, ICON_Y_HOT);
+      else if (shape == CUSTOM_CURSOR_DRAG)
+        gport->X_cursor =
+          gdk_cursor_new_from_pixmap (XC_hand_source, XC_hand_mask, &fg,
+                                      &bg, ICON_X_HOT, ICON_Y_HOT);
+      else if (shape == CUSTOM_CURSOR_LOCK)
+        gport->X_cursor =
+          gdk_cursor_new_from_pixmap (XC_lock_source, XC_lock_mask, &fg,
+                                      &bg, ICON_X_HOT, ICON_Y_HOT);
+    }
+  else
+    gport->X_cursor = gdk_cursor_new (shape);
 
-      gdk_window_set_cursor (gport->drawing_area->window, gport->X_cursor);
-      gdk_cursor_unref (gport->X_cursor);
+  gdk_window_set_cursor (window, gport->X_cursor);
+  gdk_cursor_unref (gport->X_cursor);
 
-      return (old_shape);
-    }
-  return (DEFAULT_CURSORSHAPE);
+  return old_shape;
 }
 
 void
 |