]> Pileus Git - ~andy/gtk/blobdiff - gdk/x11/gdkcursor-x11.c
Change FSF Address
[~andy/gtk] / gdk / x11 / gdkcursor-x11.c
index 1a900885b7de29a0b05334fcaf8e801f4bef3473..8d4da14a3ee94eefdc15362840b6247d2514f9c4 100644 (file)
@@ -12,9 +12,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -152,7 +150,7 @@ _gdk_x11_cursor_display_finalize (GdkDisplay *display)
       if (gdk_cursor_get_display (GDK_CURSOR (cursor)) == display)
         {
           GSList* olditem;
-          gdk_cursor_unref ((GdkCursor*) cursor);
+          g_object_unref ((GdkCursor*) cursor);
           /* Remove this item from the list */
           *(itemp) = item->next;
           olditem = item;
@@ -286,11 +284,11 @@ _gdk_x11_display_get_cursor_for_type (GdkDisplay    *display,
 
 /**
  * gdk_x11_cursor_get_xdisplay:
- * @cursor: a #GdkCursor.
+ * @cursor: (type GdkX11Cursor): a #GdkCursor.
  * 
  * Returns the display of a #GdkCursor.
  * 
- * Return value: an Xlib <type>Display*</type>.
+ * Return value: (transfer none): an Xlib <type>Display*</type>.
  **/
 Display *
 gdk_x11_cursor_get_xdisplay (GdkCursor *cursor)
@@ -302,7 +300,7 @@ gdk_x11_cursor_get_xdisplay (GdkCursor *cursor)
 
 /**
  * gdk_x11_cursor_get_xcursor:
- * @cursor: a #GdkCursor.
+ * @cursor: (type GdkX11Cursor): a #GdkCursor.
  * 
  * Returns the X cursor belonging to a #GdkCursor.
  * 
@@ -429,26 +427,26 @@ update_cursor (gpointer data,
 
   if (!cursor)
     return;
-  
+
   _gdk_x11_cursor_update_theme (cursor);
 }
 
 /**
  * gdk_x11_display_set_cursor_theme:
- * @display: a #GdkDisplay
+ * @display: (type GdkX11Display): a #GdkDisplay
  * @theme: the name of the cursor theme to use, or %NULL to unset
- *         a previously set value 
+ *         a previously set value
  * @size: the cursor size to use, or 0 to keep the previous size
  *
  * Sets the cursor theme from which the images for cursor
- * should be taken. 
- * 
- * If the windowing system supports it, existing cursors created 
- * with gdk_cursor_new(), gdk_cursor_new_for_display() and 
- * gdk_cursor_new_for_name() are updated to reflect the theme 
+ * should be taken.
+ *
+ * If the windowing system supports it, existing cursors created
+ * with gdk_cursor_new(), gdk_cursor_new_for_display() and
+ * gdk_cursor_new_for_name() are updated to reflect the theme
  * change. Custom cursors constructed with
  * gdk_cursor_new_from_pixbuf() will have to be handled
- * by the application (GTK+ applications can learn about 
+ * by the application (GTK+ applications can learn about
  * cursor theme changes by listening for change notification
  * for the corresponding #GtkSetting).
  *
@@ -459,14 +457,12 @@ gdk_x11_display_set_cursor_theme (GdkDisplay  *display,
                                   const gchar *theme,
                                   const gint   size)
 {
-  GdkX11Display *display_x11;
   Display *xdisplay;
   gchar *old_theme;
   gint old_size;
 
   g_return_if_fail (GDK_IS_DISPLAY (display));
 
-  display_x11 = GDK_X11_DISPLAY (display);
   xdisplay = GDK_DISPLAY_XDISPLAY (display);
 
   old_theme = XcursorGetTheme (xdisplay);
@@ -482,13 +478,13 @@ gdk_x11_display_set_cursor_theme (GdkDisplay  *display,
   XcursorSetTheme (xdisplay, theme);
   if (size > 0)
     XcursorSetDefaultSize (xdisplay, size);
-    
+
   g_slist_foreach (cursor_cache, update_cursor, NULL);
 }
 
 #else
 
-static GdkPixbuf*  
+static GdkPixbuf*
 gdk_x11_cursor_get_image (GdkCursor *cursor)
 {
   return NULL;
@@ -675,8 +671,8 @@ static GdkCursor*
 gdk_cursor_new_from_pixmap (GdkDisplay     *display,
                             Pixmap          source_pixmap,
                             Pixmap          mask_pixmap,
-                            const GdkColor *fg,
-                            const GdkColor *bg,
+                            const GdkRGBA  *fg,
+                            const GdkRGBA  *bg,
                             gint            x,
                             gint            y)
 {
@@ -687,16 +683,15 @@ gdk_cursor_new_from_pixmap (GdkDisplay     *display,
   g_return_val_if_fail (fg != NULL, NULL);
   g_return_val_if_fail (bg != NULL, NULL);
 
-  xfg.pixel = fg->pixel;
-  xfg.red = fg->red;
-  xfg.blue = fg->blue;
-  xfg.green = fg->green;
-  xbg.pixel = bg->pixel;
-  xbg.red = bg->red;
-  xbg.blue = bg->blue;
-  xbg.green = bg->green;
-  
-  if (gdk_display_is_closed (display->closed))
+  xfg.red = fg->red * 65535;
+  xfg.blue = fg->blue * 65535;
+  xfg.green = fg->green * 65535;
+
+  xbg.red = bg->red * 65535;
+  xbg.blue = bg->blue * 65535;
+  xbg.green = bg->green * 65535;
+
+  if (gdk_display_is_closed (display))
     xcursor = None;
   else
     xcursor = XCreatePixmapCursor (GDK_DISPLAY_XDISPLAY (display),
@@ -722,8 +717,8 @@ _gdk_x11_display_get_cursor_for_pixbuf (GdkDisplay *display,
   cairo_surface_t *pixmap, *mask;
   guint width, height, n_channels, rowstride, data_stride, i, j;
   guint8 *data, *mask_data, *pixels;
-  GdkColor fg = { 0, 0, 0, 0 };
-  GdkColor bg = { 0, 0xffff, 0xffff, 0xffff };
+  GdkRGBA fg = { 0, 0, 0, 1 };
+  GdkRGBA bg = { 1, 1, 1, 1 };
   GdkScreen *screen;
   cairo_surface_t *image;
   cairo_t *cr;
@@ -824,10 +819,13 @@ _gdk_x11_display_supports_cursor_color (GdkDisplay *display)
 }
 
 void
-_gdk_x11_display_get_default_cursor_size (GdkDisplay *display)
+_gdk_x11_display_get_default_cursor_size (GdkDisplay *display,
+                                          guint      *width,
+                                          guint      *height)
 {
   /* no idea, really */
-  return 20;
+  *width = *height = 20;
+  return;
 }
 
 #endif