1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
29 #include "gdkcursor.h"
31 #include "gdkprivate-x11.h"
32 #include "gdkdisplay-x11.h"
35 #define GDK_PIXBUF_ENABLE_BACKEND
36 #include <gdk-pixbuf/gdk-pixbuf.h>
39 #include <X11/cursorfont.h>
41 #include <X11/Xcursor/Xcursor.h>
44 #include <X11/extensions/Xfixes.h>
50 static guint theme_serial = 0;
52 /* cursor_cache holds a cache of non-pixmap cursors to avoid expensive
53 * libXcursor searches, cursors are added to it but only removed when
54 * their display is closed. We make the assumption that since there are
55 * a small number of display's and a small number of cursor's that this
56 * list will stay small enough not to be a problem.
58 static GSList* cursor_cache = NULL;
60 struct cursor_cache_key
67 /* Caller should check if there is already a match first.
68 * Cursor MUST be either a typed cursor or a pixmap with
72 add_to_cache (GdkCursorPrivate* cursor)
74 cursor_cache = g_slist_prepend (cursor_cache, cursor);
76 /* Take a ref so that if the caller frees it we still have it */
77 gdk_cursor_ref ((GdkCursor*) cursor);
80 /* Returns 0 on a match
83 cache_compare_func (gconstpointer listelem,
86 GdkCursorPrivate* cursor = (GdkCursorPrivate*)listelem;
87 struct cursor_cache_key* key = (struct cursor_cache_key*)target;
89 if ((cursor->cursor.type != key->type) ||
90 (cursor->display != key->display))
91 return 1; /* No match */
93 /* Elements marked as pixmap must be named cursors
94 * (since we don't store normal pixmap cursors
96 if (key->type == GDK_CURSOR_IS_PIXMAP)
97 return strcmp (key->name, cursor->name);
102 /* Returns the cursor if there is a match, NULL if not
103 * For named cursors type shall be GDK_CURSOR_IS_PIXMAP
104 * For unnamed, typed cursors, name shall be NULL
106 static GdkCursorPrivate*
107 find_in_cache (GdkDisplay *display,
112 struct cursor_cache_key key;
114 key.display = display;
118 res = g_slist_find_custom (cursor_cache, &key, cache_compare_func);
121 return (GdkCursorPrivate *) res->data;
126 /* Called by gdk_display_x11_finalize to flush any cached cursors
127 * for a dead display.
130 _gdk_x11_cursor_display_finalize (GdkDisplay *display)
133 GSList** itemp; /* Pointer to the thing to fix when we delete an item */
135 itemp = &cursor_cache;
138 GdkCursorPrivate* cursor = (GdkCursorPrivate*)(item->data);
139 if (cursor->display == display)
142 gdk_cursor_unref ((GdkCursor*) cursor);
143 /* Remove this item from the list */
144 *(itemp) = item->next;
146 item = g_slist_next (item);
147 g_slist_free_1 (olditem);
151 itemp = &(item->next);
152 item = g_slist_next (item);
158 get_blank_cursor (GdkDisplay *display)
164 cairo_surface_t *surface;
167 screen = gdk_display_get_default_screen (display);
168 surface = _gdk_x11_window_create_bitmap_surface (gdk_screen_get_root_window (screen), 1, 1);
170 cr = cairo_create (surface);
171 cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
175 pixmap = cairo_xlib_surface_get_drawable (surface);
178 color.red = color.blue = color.green = 0;
183 cursor = XCreatePixmapCursor (GDK_DISPLAY_XDISPLAY (display),
185 &color, &color, 1, 1);
186 cairo_surface_destroy (surface);
192 * gdk_cursor_new_for_display:
193 * @display: the #GdkDisplay for which the cursor will be created
194 * @cursor_type: cursor to create
196 * Creates a new cursor from the set of builtin cursors.
197 * Some useful ones are:
200 * <inlinegraphic format="PNG" fileref="right_ptr.png"></inlinegraphic> #GDK_RIGHT_PTR (right-facing arrow)
203 * <inlinegraphic format="PNG" fileref="crosshair.png"></inlinegraphic> #GDK_CROSSHAIR (crosshair)
206 * <inlinegraphic format="PNG" fileref="xterm.png"></inlinegraphic> #GDK_XTERM (I-beam)
209 * <inlinegraphic format="PNG" fileref="watch.png"></inlinegraphic> #GDK_WATCH (busy)
212 * <inlinegraphic format="PNG" fileref="fleur.png"></inlinegraphic> #GDK_FLEUR (for moving objects)
215 * <inlinegraphic format="PNG" fileref="hand1.png"></inlinegraphic> #GDK_HAND1 (a right-pointing hand)
218 * <inlinegraphic format="PNG" fileref="hand2.png"></inlinegraphic> #GDK_HAND2 (a left-pointing hand)
221 * <inlinegraphic format="PNG" fileref="left_side.png"></inlinegraphic> #GDK_LEFT_SIDE (resize left side)
224 * <inlinegraphic format="PNG" fileref="right_side.png"></inlinegraphic> #GDK_RIGHT_SIDE (resize right side)
227 * <inlinegraphic format="PNG" fileref="top_left_corner.png"></inlinegraphic> #GDK_TOP_LEFT_CORNER (resize northwest corner)
230 * <inlinegraphic format="PNG" fileref="top_right_corner.png"></inlinegraphic> #GDK_TOP_RIGHT_CORNER (resize northeast corner)
233 * <inlinegraphic format="PNG" fileref="bottom_left_corner.png"></inlinegraphic> #GDK_BOTTOM_LEFT_CORNER (resize southwest corner)
236 * <inlinegraphic format="PNG" fileref="bottom_right_corner.png"></inlinegraphic> #GDK_BOTTOM_RIGHT_CORNER (resize southeast corner)
239 * <inlinegraphic format="PNG" fileref="top_side.png"></inlinegraphic> #GDK_TOP_SIDE (resize top side)
242 * <inlinegraphic format="PNG" fileref="bottom_side.png"></inlinegraphic> #GDK_BOTTOM_SIDE (resize bottom side)
245 * <inlinegraphic format="PNG" fileref="sb_h_double_arrow.png"></inlinegraphic> #GDK_SB_H_DOUBLE_ARROW (move vertical splitter)
248 * <inlinegraphic format="PNG" fileref="sb_v_double_arrow.png"></inlinegraphic> #GDK_SB_V_DOUBLE_ARROW (move horizontal splitter)
251 * #GDK_BLANK_CURSOR (Blank cursor). Since 2.16
255 * Return value: a new #GdkCursor
260 gdk_cursor_new_for_display (GdkDisplay *display,
261 GdkCursorType cursor_type)
263 GdkCursorPrivate *private;
267 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
275 private = find_in_cache (display, cursor_type, NULL);
279 /* Cache had it, add a ref for this user */
280 gdk_cursor_ref ((GdkCursor*) private);
282 return (GdkCursor*) private;
286 if (cursor_type != GDK_BLANK_CURSOR)
287 xcursor = XCreateFontCursor (GDK_DISPLAY_XDISPLAY (display),
290 xcursor = get_blank_cursor (display);
294 private = g_new (GdkCursorPrivate, 1);
295 private->display = display;
296 private->xcursor = xcursor;
297 private->name = NULL;
298 private->serial = theme_serial;
300 cursor = (GdkCursor *) private;
301 cursor->type = cursor_type;
302 cursor->ref_count = 1;
305 add_to_cache (private);
311 _gdk_cursor_destroy (GdkCursor *cursor)
313 GdkCursorPrivate *private;
315 g_return_if_fail (cursor != NULL);
316 g_return_if_fail (cursor->ref_count == 0);
318 private = (GdkCursorPrivate *) cursor;
319 if (!private->display->closed && private->xcursor)
320 XFreeCursor (GDK_DISPLAY_XDISPLAY (private->display), private->xcursor);
322 g_free (private->name);
327 * gdk_x11_cursor_get_xdisplay:
328 * @cursor: a #GdkCursor.
330 * Returns the display of a #GdkCursor.
332 * Return value: an Xlib <type>Display*</type>.
335 gdk_x11_cursor_get_xdisplay (GdkCursor *cursor)
337 g_return_val_if_fail (cursor != NULL, NULL);
339 return GDK_DISPLAY_XDISPLAY(((GdkCursorPrivate *)cursor)->display);
343 * gdk_x11_cursor_get_xcursor:
344 * @cursor: a #GdkCursor.
346 * Returns the X cursor belonging to a #GdkCursor.
348 * Return value: an Xlib <type>Cursor</type>.
351 gdk_x11_cursor_get_xcursor (GdkCursor *cursor)
353 g_return_val_if_fail (cursor != NULL, None);
355 return ((GdkCursorPrivate *)cursor)->xcursor;
359 * gdk_cursor_get_display:
360 * @cursor: a #GdkCursor.
362 * Returns the display on which the #GdkCursor is defined.
364 * Returns: the #GdkDisplay associated to @cursor
370 gdk_cursor_get_display (GdkCursor *cursor)
372 g_return_val_if_fail (cursor != NULL, NULL);
374 return ((GdkCursorPrivate *)cursor)->display;
377 #if defined(HAVE_XCURSOR) && defined(HAVE_XFIXES) && XFIXES_MAJOR >= 2
380 * gdk_cursor_get_image:
381 * @cursor: a #GdkCursor
383 * Returns a #GdkPixbuf with the image used to display the cursor.
385 * Note that depending on the capabilities of the windowing system and
386 * on the cursor, GDK may not be able to obtain the image data. In this
387 * case, %NULL is returned.
389 * Returns: a #GdkPixbuf representing @cursor, or %NULL
394 gdk_cursor_get_image (GdkCursor *cursor)
397 GdkCursorPrivate *private;
398 XcursorImages *images = NULL;
402 guchar *data, *p, tmp;
406 g_return_val_if_fail (cursor != NULL, NULL);
408 private = (GdkCursorPrivate *) cursor;
410 xdisplay = GDK_DISPLAY_XDISPLAY (private->display);
412 size = XcursorGetDefaultSize (xdisplay);
413 theme = XcursorGetTheme (xdisplay);
415 if (cursor->type == GDK_CURSOR_IS_PIXMAP)
418 images = XcursorLibraryLoadImages (private->name, theme, size);
421 images = XcursorShapeLoadImages (cursor->type, theme, size);
426 image = images->images[0];
428 data = g_malloc (4 * image->width * image->height);
429 memcpy (data, image->pixels, 4 * image->width * image->height);
431 for (p = data; p < data + (4 * image->width * image->height); p += 4)
438 pixbuf = gdk_pixbuf_new_from_data (data, GDK_COLORSPACE_RGB, TRUE,
439 8, image->width, image->height,
441 (GdkPixbufDestroyNotify)g_free, NULL);
444 gdk_pixbuf_set_option (pixbuf, "name", private->name);
445 g_snprintf (buf, 32, "%d", image->xhot);
446 gdk_pixbuf_set_option (pixbuf, "x_hot", buf);
447 g_snprintf (buf, 32, "%d", image->yhot);
448 gdk_pixbuf_set_option (pixbuf, "y_hot", buf);
450 XcursorImagesDestroy (images);
456 _gdk_x11_cursor_update_theme (GdkCursor *cursor)
459 GdkCursorPrivate *private;
460 Cursor new_cursor = None;
461 GdkDisplayX11 *display_x11;
463 private = (GdkCursorPrivate *) cursor;
464 xdisplay = GDK_DISPLAY_XDISPLAY (private->display);
465 display_x11 = GDK_DISPLAY_X11 (private->display);
467 if (!display_x11->have_xfixes)
470 if (private->serial == theme_serial)
473 private->serial = theme_serial;
475 if (private->xcursor != None)
477 if (cursor->type == GDK_BLANK_CURSOR)
480 if (cursor->type == GDK_CURSOR_IS_PIXMAP)
483 new_cursor = XcursorLibraryLoadCursor (xdisplay, private->name);
486 new_cursor = XcursorShapeLoadCursor (xdisplay, cursor->type);
488 if (new_cursor != None)
490 XFixesChangeCursor (xdisplay, new_cursor, private->xcursor);
491 private->xcursor = new_cursor;
497 update_cursor (gpointer data,
502 cursor = (GdkCursor*)(data);
507 _gdk_x11_cursor_update_theme (cursor);
511 * gdk_x11_display_set_cursor_theme:
512 * @display: a #GdkDisplay
513 * @theme: the name of the cursor theme to use, or %NULL to unset
514 * a previously set value
515 * @size: the cursor size to use, or 0 to keep the previous size
517 * Sets the cursor theme from which the images for cursor
520 * If the windowing system supports it, existing cursors created
521 * with gdk_cursor_new(), gdk_cursor_new_for_display() and
522 * gdk_cursor_new_for_name() are updated to reflect the theme
523 * change. Custom cursors constructed with
524 * gdk_cursor_new_from_pixbuf() will have to be handled
525 * by the application (GTK+ applications can learn about
526 * cursor theme changes by listening for change notification
527 * for the corresponding #GtkSetting).
532 gdk_x11_display_set_cursor_theme (GdkDisplay *display,
536 GdkDisplayX11 *display_x11;
541 g_return_if_fail (GDK_IS_DISPLAY (display));
543 display_x11 = GDK_DISPLAY_X11 (display);
544 xdisplay = GDK_DISPLAY_XDISPLAY (display);
546 old_theme = XcursorGetTheme (xdisplay);
547 old_size = XcursorGetDefaultSize (xdisplay);
549 if (old_size == size &&
550 (old_theme == theme ||
551 (old_theme && theme && strcmp (old_theme, theme) == 0)))
556 XcursorSetTheme (xdisplay, theme);
558 XcursorSetDefaultSize (xdisplay, size);
560 g_slist_foreach (cursor_cache, update_cursor, NULL);
566 gdk_cursor_get_image (GdkCursor *cursor)
568 g_return_val_if_fail (cursor != NULL, NULL);
574 gdk_x11_display_set_cursor_theme (GdkDisplay *display,
578 g_return_if_fail (GDK_IS_DISPLAY (display));
582 _gdk_x11_cursor_update_theme (GdkCursor *cursor)
584 g_return_if_fail (cursor != NULL);
592 create_cursor_image (GdkPixbuf *pixbuf,
597 XcursorImage *xcimage;
598 cairo_surface_t *surface;
601 width = gdk_pixbuf_get_width (pixbuf);
602 height = gdk_pixbuf_get_height (pixbuf);
604 xcimage = XcursorImageCreate (width, height);
609 surface = cairo_image_surface_create_for_data ((guchar *) xcimage->pixels,
615 cr = cairo_create (surface);
616 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
617 gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
621 cairo_surface_destroy (surface);
628 * gdk_cursor_new_from_pixbuf:
629 * @display: the #GdkDisplay for which the cursor will be created
630 * @pixbuf: the #GdkPixbuf containing the cursor image
631 * @x: the horizontal offset of the 'hotspot' of the cursor.
632 * @y: the vertical offset of the 'hotspot' of the cursor.
634 * Creates a new cursor from a pixbuf.
636 * Not all GDK backends support RGBA cursors. If they are not
637 * supported, a monochrome approximation will be displayed.
638 * The functions gdk_display_supports_cursor_alpha() and
639 * gdk_display_supports_cursor_color() can be used to determine
640 * whether RGBA cursors are supported;
641 * gdk_display_get_default_cursor_size() and
642 * gdk_display_get_maximal_cursor_size() give information about
645 * If @x or @y are <literal>-1</literal>, the pixbuf must have
646 * options named "x_hot" and "y_hot", resp., containing
647 * integer values between %0 and the width resp. height of
648 * the pixbuf. (Since: 3.0)
650 * On the X backend, support for RGBA cursors requires a
651 * sufficently new version of the X Render extension.
653 * Returns: a new #GdkCursor.
658 gdk_cursor_new_from_pixbuf (GdkDisplay *display,
663 XcursorImage *xcimage;
665 GdkCursorPrivate *private;
671 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
672 g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
674 if (x == -1 && (option = gdk_pixbuf_get_option (pixbuf, "x_hot")))
678 value = g_ascii_strtoll (option, &end, 10);
681 value >= 0 && value < G_MAXINT)
684 if (y == -1 && (option = gdk_pixbuf_get_option (pixbuf, "y_hot")))
688 value = g_ascii_strtoll (option, &end, 10);
691 value >= 0 && value < G_MAXINT)
695 g_return_val_if_fail (0 <= x && x < gdk_pixbuf_get_width (pixbuf), NULL);
696 g_return_val_if_fail (0 <= y && y < gdk_pixbuf_get_height (pixbuf), NULL);
702 xcimage = create_cursor_image (pixbuf, x, y);
703 xcursor = XcursorImageLoadCursor (GDK_DISPLAY_XDISPLAY (display), xcimage);
704 XcursorImageDestroy (xcimage);
707 private = g_new (GdkCursorPrivate, 1);
708 private->display = display;
709 private->xcursor = xcursor;
710 private->name = NULL;
711 private->serial = theme_serial;
713 cursor = (GdkCursor *) private;
714 cursor->type = GDK_CURSOR_IS_PIXMAP;
715 cursor->ref_count = 1;
721 * gdk_cursor_new_from_name:
722 * @display: the #GdkDisplay for which the cursor will be created
723 * @name: the name of the cursor
725 * Creates a new cursor by looking up @name in the current cursor
728 * Returns: a new #GdkCursor, or %NULL if there is no cursor with
734 gdk_cursor_new_from_name (GdkDisplay *display,
739 GdkCursorPrivate *private;
742 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
748 private = find_in_cache (display, GDK_CURSOR_IS_PIXMAP, name);
752 /* Cache had it, add a ref for this user */
753 gdk_cursor_ref ((GdkCursor*) private);
755 return (GdkCursor*) private;
758 xdisplay = GDK_DISPLAY_XDISPLAY (display);
759 xcursor = XcursorLibraryLoadCursor (xdisplay, name);
764 private = g_new (GdkCursorPrivate, 1);
765 private->display = display;
766 private->xcursor = xcursor;
767 private->name = g_strdup (name);
768 private->serial = theme_serial;
770 cursor = (GdkCursor *) private;
771 cursor->type = GDK_CURSOR_IS_PIXMAP;
772 cursor->ref_count = 1;
773 add_to_cache (private);
779 * gdk_display_supports_cursor_alpha:
780 * @display: a #GdkDisplay
782 * Returns %TRUE if cursors can use an 8bit alpha channel
783 * on @display. Otherwise, cursors are restricted to bilevel
784 * alpha (i.e. a mask).
786 * Returns: whether cursors can have alpha channels.
791 gdk_display_supports_cursor_alpha (GdkDisplay *display)
793 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
795 return XcursorSupportsARGB (GDK_DISPLAY_XDISPLAY (display));
799 * gdk_display_supports_cursor_color:
800 * @display: a #GdkDisplay
802 * Returns %TRUE if multicolored cursors are supported
803 * on @display. Otherwise, cursors have only a forground
804 * and a background color.
806 * Returns: whether cursors can have multiple colors.
811 gdk_display_supports_cursor_color (GdkDisplay *display)
813 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
815 return XcursorSupportsARGB (GDK_DISPLAY_XDISPLAY (display));
819 * gdk_display_get_default_cursor_size:
820 * @display: a #GdkDisplay
822 * Returns the default size to use for cursors on @display.
824 * Returns: the default cursor size.
829 gdk_display_get_default_cursor_size (GdkDisplay *display)
831 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
833 return XcursorGetDefaultSize (GDK_DISPLAY_XDISPLAY (display));
839 gdk_cursor_new_from_pixmap (GdkDisplay *display,
840 Pixmap source_pixmap,
847 GdkCursorPrivate *private;
852 g_return_val_if_fail (fg != NULL, NULL);
853 g_return_val_if_fail (bg != NULL, NULL);
855 xfg.pixel = fg->pixel;
858 xfg.green = fg->green;
859 xbg.pixel = bg->pixel;
862 xbg.green = bg->green;
867 xcursor = XCreatePixmapCursor (GDK_DISPLAY_XDISPLAY (display),
868 source_pixmap, mask_pixmap, &xfg, &xbg, x, y);
869 private = g_new (GdkCursorPrivate, 1);
870 private->display = display;
871 private->xcursor = xcursor;
872 private->name = NULL;
873 private->serial = theme_serial;
875 cursor = (GdkCursor *) private;
876 cursor->type = GDK_CURSOR_IS_PIXMAP;
877 cursor->ref_count = 1;
883 gdk_cursor_new_from_pixbuf (GdkDisplay *display,
889 cairo_surface_t *pixmap, *mask;
890 guint width, height, n_channels, rowstride, data_stride, i, j;
891 guint8 *data, *mask_data, *pixels;
892 GdkColor fg = { 0, 0, 0, 0 };
893 GdkColor bg = { 0, 0xffff, 0xffff, 0xffff };
895 cairo_surface_t *image;
898 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
899 g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
901 width = gdk_pixbuf_get_width (pixbuf);
902 height = gdk_pixbuf_get_height (pixbuf);
904 g_return_val_if_fail (0 <= x && x < width, NULL);
905 g_return_val_if_fail (0 <= y && y < height, NULL);
907 n_channels = gdk_pixbuf_get_n_channels (pixbuf);
908 rowstride = gdk_pixbuf_get_rowstride (pixbuf);
909 pixels = gdk_pixbuf_get_pixels (pixbuf);
911 data_stride = 4 * ((width + 31) / 32);
912 data = g_new0 (guint8, data_stride * height);
913 mask_data = g_new0 (guint8, data_stride * height);
915 for (j = 0; j < height; j++)
917 guint8 *src = pixels + j * rowstride;
918 guint8 *d = data + data_stride * j;
919 guint8 *md = mask_data + data_stride * j;
921 for (i = 0; i < width; i++)
926 if (n_channels == 3 || src[3] >= 0x80)
938 screen = gdk_display_get_default_screen (display);
940 pixmap = _gdk_x11_window_create_bitmap_surface (gdk_screen_get_root_window (screen),
942 cr = cairo_create (pixmap);
943 image = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_A1,
944 width, height, data_stride);
945 cairo_set_source_surface (cr, image, 0, 0);
946 cairo_surface_destroy (image);
947 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
951 mask = _gdk_x11_window_create_bitmap_surface (gdk_screen_get_root_window (screen),
953 cr = cairo_create (mask);
954 image = cairo_image_surface_create_for_data (mask_data, CAIRO_FORMAT_A1,
955 width, height, data_stride);
956 cairo_set_source_surface (cr, image, 0, 0);
957 cairo_surface_destroy (image);
958 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
962 cursor = gdk_cursor_new_from_pixmap (display,
963 cairo_xlib_surface_get_drawable (pixmap),
964 cairo_xlib_surface_get_drawable (mask),
968 cairo_surface_destroy (pixmap);
969 cairo_surface_destroy (mask);
978 gdk_cursor_new_from_name (GdkDisplay *display,
981 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
987 gdk_display_supports_cursor_alpha (GdkDisplay *display)
989 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
995 gdk_display_supports_cursor_color (GdkDisplay *display)
997 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
1003 gdk_display_get_default_cursor_size (GdkDisplay *display)
1005 g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
1007 /* no idea, really */
1015 * gdk_display_get_maximal_cursor_size:
1016 * @display: a #GdkDisplay
1017 * @width: (out): the return location for the maximal cursor width
1018 * @height: (out): the return location for the maximal cursor height
1020 * Gets the maximal size to use for cursors on @display.
1025 gdk_display_get_maximal_cursor_size (GdkDisplay *display,
1032 g_return_if_fail (GDK_IS_DISPLAY (display));
1034 screen = gdk_display_get_default_screen (display);
1035 window = gdk_screen_get_root_window (screen);
1036 XQueryBestCursor (GDK_DISPLAY_XDISPLAY (display),
1037 GDK_WINDOW_XWINDOW (window),
1038 128, 128, width, height);