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 /* needs to be first because any header might include gdk-pixbuf.h otherwise */
30 #define GDK_PIXBUF_ENABLE_BACKEND
31 #include <gdk-pixbuf/gdk-pixbuf.h>
33 #include "gdkcursor.h"
35 #include "gdkprivate-x11.h"
36 #include "gdkdisplay-x11.h"
40 #include <X11/cursorfont.h>
42 #include <X11/Xcursor/Xcursor.h>
45 #include <X11/extensions/Xfixes.h>
51 static guint theme_serial = 0;
53 /* cursor_cache holds a cache of non-pixmap cursors to avoid expensive
54 * libXcursor searches, cursors are added to it but only removed when
55 * their display is closed. We make the assumption that since there are
56 * a small number of display's and a small number of cursor's that this
57 * list will stay small enough not to be a problem.
59 static GSList* cursor_cache = NULL;
61 struct cursor_cache_key
68 /* Caller should check if there is already a match first.
69 * Cursor MUST be either a typed cursor or a pixmap with
73 add_to_cache (GdkCursorPrivate* cursor)
75 cursor_cache = g_slist_prepend (cursor_cache, cursor);
77 /* Take a ref so that if the caller frees it we still have it */
78 gdk_cursor_ref ((GdkCursor*) cursor);
81 /* Returns 0 on a match
84 cache_compare_func (gconstpointer listelem,
87 GdkCursorPrivate* cursor = (GdkCursorPrivate*)listelem;
88 struct cursor_cache_key* key = (struct cursor_cache_key*)target;
90 if ((cursor->cursor.type != key->type) ||
91 (cursor->display != key->display))
92 return 1; /* No match */
94 /* Elements marked as pixmap must be named cursors
95 * (since we don't store normal pixmap cursors
97 if (key->type == GDK_CURSOR_IS_PIXMAP)
98 return strcmp (key->name, cursor->name);
100 return 0; /* Match */
103 /* Returns the cursor if there is a match, NULL if not
104 * For named cursors type shall be GDK_CURSOR_IS_PIXMAP
105 * For unnamed, typed cursors, name shall be NULL
107 static GdkCursorPrivate*
108 find_in_cache (GdkDisplay *display,
113 struct cursor_cache_key key;
115 key.display = display;
119 res = g_slist_find_custom (cursor_cache, &key, cache_compare_func);
122 return (GdkCursorPrivate *) res->data;
127 /* Called by gdk_display_x11_finalize to flush any cached cursors
128 * for a dead display.
131 _gdk_x11_cursor_display_finalize (GdkDisplay *display)
134 GSList** itemp; /* Pointer to the thing to fix when we delete an item */
136 itemp = &cursor_cache;
139 GdkCursorPrivate* cursor = (GdkCursorPrivate*)(item->data);
140 if (cursor->display == display)
143 gdk_cursor_unref ((GdkCursor*) cursor);
144 /* Remove this item from the list */
145 *(itemp) = item->next;
147 item = g_slist_next (item);
148 g_slist_free_1 (olditem);
152 itemp = &(item->next);
153 item = g_slist_next (item);
159 get_blank_cursor (GdkDisplay *display)
165 cairo_surface_t *surface;
168 screen = gdk_display_get_default_screen (display);
169 surface = _gdk_x11_window_create_bitmap_surface (gdk_screen_get_root_window (screen), 1, 1);
171 cr = cairo_create (surface);
172 cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
176 pixmap = cairo_xlib_surface_get_drawable (surface);
179 color.red = color.blue = color.green = 0;
184 cursor = XCreatePixmapCursor (GDK_DISPLAY_XDISPLAY (display),
186 &color, &color, 1, 1);
187 cairo_surface_destroy (surface);
193 * gdk_cursor_new_for_display:
194 * @display: the #GdkDisplay for which the cursor will be created
195 * @cursor_type: cursor to create
197 * Creates a new cursor from the set of builtin cursors.
198 * Some useful ones are:
201 * <inlinegraphic format="PNG" fileref="right_ptr.png"></inlinegraphic> #GDK_RIGHT_PTR (right-facing arrow)
204 * <inlinegraphic format="PNG" fileref="crosshair.png"></inlinegraphic> #GDK_CROSSHAIR (crosshair)
207 * <inlinegraphic format="PNG" fileref="xterm.png"></inlinegraphic> #GDK_XTERM (I-beam)
210 * <inlinegraphic format="PNG" fileref="watch.png"></inlinegraphic> #GDK_WATCH (busy)
213 * <inlinegraphic format="PNG" fileref="fleur.png"></inlinegraphic> #GDK_FLEUR (for moving objects)
216 * <inlinegraphic format="PNG" fileref="hand1.png"></inlinegraphic> #GDK_HAND1 (a right-pointing hand)
219 * <inlinegraphic format="PNG" fileref="hand2.png"></inlinegraphic> #GDK_HAND2 (a left-pointing hand)
222 * <inlinegraphic format="PNG" fileref="left_side.png"></inlinegraphic> #GDK_LEFT_SIDE (resize left side)
225 * <inlinegraphic format="PNG" fileref="right_side.png"></inlinegraphic> #GDK_RIGHT_SIDE (resize right side)
228 * <inlinegraphic format="PNG" fileref="top_left_corner.png"></inlinegraphic> #GDK_TOP_LEFT_CORNER (resize northwest corner)
231 * <inlinegraphic format="PNG" fileref="top_right_corner.png"></inlinegraphic> #GDK_TOP_RIGHT_CORNER (resize northeast corner)
234 * <inlinegraphic format="PNG" fileref="bottom_left_corner.png"></inlinegraphic> #GDK_BOTTOM_LEFT_CORNER (resize southwest corner)
237 * <inlinegraphic format="PNG" fileref="bottom_right_corner.png"></inlinegraphic> #GDK_BOTTOM_RIGHT_CORNER (resize southeast corner)
240 * <inlinegraphic format="PNG" fileref="top_side.png"></inlinegraphic> #GDK_TOP_SIDE (resize top side)
243 * <inlinegraphic format="PNG" fileref="bottom_side.png"></inlinegraphic> #GDK_BOTTOM_SIDE (resize bottom side)
246 * <inlinegraphic format="PNG" fileref="sb_h_double_arrow.png"></inlinegraphic> #GDK_SB_H_DOUBLE_ARROW (move vertical splitter)
249 * <inlinegraphic format="PNG" fileref="sb_v_double_arrow.png"></inlinegraphic> #GDK_SB_V_DOUBLE_ARROW (move horizontal splitter)
252 * #GDK_BLANK_CURSOR (Blank cursor). Since 2.16
256 * Return value: a new #GdkCursor
261 gdk_cursor_new_for_display (GdkDisplay *display,
262 GdkCursorType cursor_type)
264 GdkCursorPrivate *private;
268 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
276 private = find_in_cache (display, cursor_type, NULL);
280 /* Cache had it, add a ref for this user */
281 gdk_cursor_ref ((GdkCursor*) private);
283 return (GdkCursor*) private;
287 if (cursor_type != GDK_BLANK_CURSOR)
288 xcursor = XCreateFontCursor (GDK_DISPLAY_XDISPLAY (display),
291 xcursor = get_blank_cursor (display);
295 private = g_new (GdkCursorPrivate, 1);
296 private->display = display;
297 private->xcursor = xcursor;
298 private->name = NULL;
299 private->serial = theme_serial;
301 cursor = (GdkCursor *) private;
302 cursor->type = cursor_type;
303 cursor->ref_count = 1;
306 add_to_cache (private);
312 _gdk_cursor_destroy (GdkCursor *cursor)
314 GdkCursorPrivate *private;
316 g_return_if_fail (cursor != NULL);
317 g_return_if_fail (cursor->ref_count == 0);
319 private = (GdkCursorPrivate *) cursor;
320 if (!private->display->closed && private->xcursor)
321 XFreeCursor (GDK_DISPLAY_XDISPLAY (private->display), private->xcursor);
323 g_free (private->name);
328 * gdk_x11_cursor_get_xdisplay:
329 * @cursor: a #GdkCursor.
331 * Returns the display of a #GdkCursor.
333 * Return value: an Xlib <type>Display*</type>.
336 gdk_x11_cursor_get_xdisplay (GdkCursor *cursor)
338 g_return_val_if_fail (cursor != NULL, NULL);
340 return GDK_DISPLAY_XDISPLAY(((GdkCursorPrivate *)cursor)->display);
344 * gdk_x11_cursor_get_xcursor:
345 * @cursor: a #GdkCursor.
347 * Returns the X cursor belonging to a #GdkCursor.
349 * Return value: an Xlib <type>Cursor</type>.
352 gdk_x11_cursor_get_xcursor (GdkCursor *cursor)
354 g_return_val_if_fail (cursor != NULL, None);
356 return ((GdkCursorPrivate *)cursor)->xcursor;
360 * gdk_cursor_get_display:
361 * @cursor: a #GdkCursor.
363 * Returns the display on which the #GdkCursor is defined.
365 * Returns: (transfer none): the #GdkDisplay associated to @cursor
371 gdk_cursor_get_display (GdkCursor *cursor)
373 g_return_val_if_fail (cursor != NULL, NULL);
375 return ((GdkCursorPrivate *)cursor)->display;
378 #if defined(HAVE_XCURSOR) && defined(HAVE_XFIXES) && XFIXES_MAJOR >= 2
381 * gdk_cursor_get_image:
382 * @cursor: a #GdkCursor
384 * Returns a #GdkPixbuf with the image used to display the cursor.
386 * Note that depending on the capabilities of the windowing system and
387 * on the cursor, GDK may not be able to obtain the image data. In this
388 * case, %NULL is returned.
390 * Returns: (transfer full): a #GdkPixbuf representing @cursor, or %NULL
395 gdk_cursor_get_image (GdkCursor *cursor)
398 GdkCursorPrivate *private;
399 XcursorImages *images = NULL;
403 guchar *data, *p, tmp;
407 g_return_val_if_fail (cursor != NULL, NULL);
409 private = (GdkCursorPrivate *) cursor;
411 xdisplay = GDK_DISPLAY_XDISPLAY (private->display);
413 size = XcursorGetDefaultSize (xdisplay);
414 theme = XcursorGetTheme (xdisplay);
416 if (cursor->type == GDK_CURSOR_IS_PIXMAP)
419 images = XcursorLibraryLoadImages (private->name, theme, size);
422 images = XcursorShapeLoadImages (cursor->type, theme, size);
427 image = images->images[0];
429 data = g_malloc (4 * image->width * image->height);
430 memcpy (data, image->pixels, 4 * image->width * image->height);
432 for (p = data; p < data + (4 * image->width * image->height); p += 4)
439 pixbuf = gdk_pixbuf_new_from_data (data, GDK_COLORSPACE_RGB, TRUE,
440 8, image->width, image->height,
442 (GdkPixbufDestroyNotify)g_free, NULL);
445 gdk_pixbuf_set_option (pixbuf, "name", private->name);
446 g_snprintf (buf, 32, "%d", image->xhot);
447 gdk_pixbuf_set_option (pixbuf, "x_hot", buf);
448 g_snprintf (buf, 32, "%d", image->yhot);
449 gdk_pixbuf_set_option (pixbuf, "y_hot", buf);
451 XcursorImagesDestroy (images);
457 _gdk_x11_cursor_update_theme (GdkCursor *cursor)
460 GdkCursorPrivate *private;
461 Cursor new_cursor = None;
462 GdkDisplayX11 *display_x11;
464 private = (GdkCursorPrivate *) cursor;
465 xdisplay = GDK_DISPLAY_XDISPLAY (private->display);
466 display_x11 = GDK_DISPLAY_X11 (private->display);
468 if (!display_x11->have_xfixes)
471 if (private->serial == theme_serial)
474 private->serial = theme_serial;
476 if (private->xcursor != None)
478 if (cursor->type == GDK_BLANK_CURSOR)
481 if (cursor->type == GDK_CURSOR_IS_PIXMAP)
484 new_cursor = XcursorLibraryLoadCursor (xdisplay, private->name);
487 new_cursor = XcursorShapeLoadCursor (xdisplay, cursor->type);
489 if (new_cursor != None)
491 XFixesChangeCursor (xdisplay, new_cursor, private->xcursor);
492 private->xcursor = new_cursor;
498 update_cursor (gpointer data,
503 cursor = (GdkCursor*)(data);
508 _gdk_x11_cursor_update_theme (cursor);
512 * gdk_x11_display_set_cursor_theme:
513 * @display: a #GdkDisplay
514 * @theme: the name of the cursor theme to use, or %NULL to unset
515 * a previously set value
516 * @size: the cursor size to use, or 0 to keep the previous size
518 * Sets the cursor theme from which the images for cursor
521 * If the windowing system supports it, existing cursors created
522 * with gdk_cursor_new(), gdk_cursor_new_for_display() and
523 * gdk_cursor_new_for_name() are updated to reflect the theme
524 * change. Custom cursors constructed with
525 * gdk_cursor_new_from_pixbuf() will have to be handled
526 * by the application (GTK+ applications can learn about
527 * cursor theme changes by listening for change notification
528 * for the corresponding #GtkSetting).
533 gdk_x11_display_set_cursor_theme (GdkDisplay *display,
537 GdkDisplayX11 *display_x11;
542 g_return_if_fail (GDK_IS_DISPLAY (display));
544 display_x11 = GDK_DISPLAY_X11 (display);
545 xdisplay = GDK_DISPLAY_XDISPLAY (display);
547 old_theme = XcursorGetTheme (xdisplay);
548 old_size = XcursorGetDefaultSize (xdisplay);
550 if (old_size == size &&
551 (old_theme == theme ||
552 (old_theme && theme && strcmp (old_theme, theme) == 0)))
557 XcursorSetTheme (xdisplay, theme);
559 XcursorSetDefaultSize (xdisplay, size);
561 g_slist_foreach (cursor_cache, update_cursor, NULL);
567 gdk_cursor_get_image (GdkCursor *cursor)
569 g_return_val_if_fail (cursor != NULL, NULL);
575 gdk_x11_display_set_cursor_theme (GdkDisplay *display,
579 g_return_if_fail (GDK_IS_DISPLAY (display));
583 _gdk_x11_cursor_update_theme (GdkCursor *cursor)
585 g_return_if_fail (cursor != NULL);
593 create_cursor_image (GdkPixbuf *pixbuf,
598 XcursorImage *xcimage;
599 cairo_surface_t *surface;
602 width = gdk_pixbuf_get_width (pixbuf);
603 height = gdk_pixbuf_get_height (pixbuf);
605 xcimage = XcursorImageCreate (width, height);
610 surface = cairo_image_surface_create_for_data ((guchar *) xcimage->pixels,
616 cr = cairo_create (surface);
617 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
618 gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
622 cairo_surface_destroy (surface);
629 * gdk_cursor_new_from_pixbuf:
630 * @display: the #GdkDisplay for which the cursor will be created
631 * @pixbuf: the #GdkPixbuf containing the cursor image
632 * @x: the horizontal offset of the 'hotspot' of the cursor.
633 * @y: the vertical offset of the 'hotspot' of the cursor.
635 * Creates a new cursor from a pixbuf.
637 * Not all GDK backends support RGBA cursors. If they are not
638 * supported, a monochrome approximation will be displayed.
639 * The functions gdk_display_supports_cursor_alpha() and
640 * gdk_display_supports_cursor_color() can be used to determine
641 * whether RGBA cursors are supported;
642 * gdk_display_get_default_cursor_size() and
643 * gdk_display_get_maximal_cursor_size() give information about
646 * If @x or @y are <literal>-1</literal>, the pixbuf must have
647 * options named "x_hot" and "y_hot", resp., containing
648 * integer values between %0 and the width resp. height of
649 * the pixbuf. (Since: 3.0)
651 * On the X backend, support for RGBA cursors requires a
652 * sufficently new version of the X Render extension.
654 * Returns: a new #GdkCursor.
659 gdk_cursor_new_from_pixbuf (GdkDisplay *display,
664 XcursorImage *xcimage;
666 GdkCursorPrivate *private;
672 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
673 g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
675 if (x == -1 && (option = gdk_pixbuf_get_option (pixbuf, "x_hot")))
679 value = g_ascii_strtoll (option, &end, 10);
682 value >= 0 && value < G_MAXINT)
685 if (y == -1 && (option = gdk_pixbuf_get_option (pixbuf, "y_hot")))
689 value = g_ascii_strtoll (option, &end, 10);
692 value >= 0 && value < G_MAXINT)
696 g_return_val_if_fail (0 <= x && x < gdk_pixbuf_get_width (pixbuf), NULL);
697 g_return_val_if_fail (0 <= y && y < gdk_pixbuf_get_height (pixbuf), NULL);
703 xcimage = create_cursor_image (pixbuf, x, y);
704 xcursor = XcursorImageLoadCursor (GDK_DISPLAY_XDISPLAY (display), xcimage);
705 XcursorImageDestroy (xcimage);
708 private = g_new (GdkCursorPrivate, 1);
709 private->display = display;
710 private->xcursor = xcursor;
711 private->name = NULL;
712 private->serial = theme_serial;
714 cursor = (GdkCursor *) private;
715 cursor->type = GDK_CURSOR_IS_PIXMAP;
716 cursor->ref_count = 1;
722 * gdk_cursor_new_from_name:
723 * @display: the #GdkDisplay for which the cursor will be created
724 * @name: the name of the cursor
726 * Creates a new cursor by looking up @name in the current cursor
729 * Returns: a new #GdkCursor, or %NULL if there is no cursor with
735 gdk_cursor_new_from_name (GdkDisplay *display,
740 GdkCursorPrivate *private;
743 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
749 private = find_in_cache (display, GDK_CURSOR_IS_PIXMAP, name);
753 /* Cache had it, add a ref for this user */
754 gdk_cursor_ref ((GdkCursor*) private);
756 return (GdkCursor*) private;
759 xdisplay = GDK_DISPLAY_XDISPLAY (display);
760 xcursor = XcursorLibraryLoadCursor (xdisplay, name);
765 private = g_new (GdkCursorPrivate, 1);
766 private->display = display;
767 private->xcursor = xcursor;
768 private->name = g_strdup (name);
769 private->serial = theme_serial;
771 cursor = (GdkCursor *) private;
772 cursor->type = GDK_CURSOR_IS_PIXMAP;
773 cursor->ref_count = 1;
774 add_to_cache (private);
780 * gdk_display_supports_cursor_alpha:
781 * @display: a #GdkDisplay
783 * Returns %TRUE if cursors can use an 8bit alpha channel
784 * on @display. Otherwise, cursors are restricted to bilevel
785 * alpha (i.e. a mask).
787 * Returns: whether cursors can have alpha channels.
792 gdk_display_supports_cursor_alpha (GdkDisplay *display)
794 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
796 return XcursorSupportsARGB (GDK_DISPLAY_XDISPLAY (display));
800 * gdk_display_supports_cursor_color:
801 * @display: a #GdkDisplay
803 * Returns %TRUE if multicolored cursors are supported
804 * on @display. Otherwise, cursors have only a forground
805 * and a background color.
807 * Returns: whether cursors can have multiple colors.
812 gdk_display_supports_cursor_color (GdkDisplay *display)
814 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
816 return XcursorSupportsARGB (GDK_DISPLAY_XDISPLAY (display));
820 * gdk_display_get_default_cursor_size:
821 * @display: a #GdkDisplay
823 * Returns the default size to use for cursors on @display.
825 * Returns: the default cursor size.
830 gdk_display_get_default_cursor_size (GdkDisplay *display)
832 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
834 return XcursorGetDefaultSize (GDK_DISPLAY_XDISPLAY (display));
840 gdk_cursor_new_from_pixmap (GdkDisplay *display,
841 Pixmap source_pixmap,
848 GdkCursorPrivate *private;
853 g_return_val_if_fail (fg != NULL, NULL);
854 g_return_val_if_fail (bg != NULL, NULL);
856 xfg.pixel = fg->pixel;
859 xfg.green = fg->green;
860 xbg.pixel = bg->pixel;
863 xbg.green = bg->green;
868 xcursor = XCreatePixmapCursor (GDK_DISPLAY_XDISPLAY (display),
869 source_pixmap, mask_pixmap, &xfg, &xbg, x, y);
870 private = g_new (GdkCursorPrivate, 1);
871 private->display = display;
872 private->xcursor = xcursor;
873 private->name = NULL;
874 private->serial = theme_serial;
876 cursor = (GdkCursor *) private;
877 cursor->type = GDK_CURSOR_IS_PIXMAP;
878 cursor->ref_count = 1;
884 gdk_cursor_new_from_pixbuf (GdkDisplay *display,
890 cairo_surface_t *pixmap, *mask;
891 guint width, height, n_channels, rowstride, data_stride, i, j;
892 guint8 *data, *mask_data, *pixels;
893 GdkColor fg = { 0, 0, 0, 0 };
894 GdkColor bg = { 0, 0xffff, 0xffff, 0xffff };
896 cairo_surface_t *image;
899 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
900 g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
902 width = gdk_pixbuf_get_width (pixbuf);
903 height = gdk_pixbuf_get_height (pixbuf);
905 g_return_val_if_fail (0 <= x && x < width, NULL);
906 g_return_val_if_fail (0 <= y && y < height, NULL);
908 n_channels = gdk_pixbuf_get_n_channels (pixbuf);
909 rowstride = gdk_pixbuf_get_rowstride (pixbuf);
910 pixels = gdk_pixbuf_get_pixels (pixbuf);
912 data_stride = 4 * ((width + 31) / 32);
913 data = g_new0 (guint8, data_stride * height);
914 mask_data = g_new0 (guint8, data_stride * height);
916 for (j = 0; j < height; j++)
918 guint8 *src = pixels + j * rowstride;
919 guint8 *d = data + data_stride * j;
920 guint8 *md = mask_data + data_stride * j;
922 for (i = 0; i < width; i++)
927 if (n_channels == 3 || src[3] >= 0x80)
939 screen = gdk_display_get_default_screen (display);
941 pixmap = _gdk_x11_window_create_bitmap_surface (gdk_screen_get_root_window (screen),
943 cr = cairo_create (pixmap);
944 image = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_A1,
945 width, height, data_stride);
946 cairo_set_source_surface (cr, image, 0, 0);
947 cairo_surface_destroy (image);
948 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
952 mask = _gdk_x11_window_create_bitmap_surface (gdk_screen_get_root_window (screen),
954 cr = cairo_create (mask);
955 image = cairo_image_surface_create_for_data (mask_data, CAIRO_FORMAT_A1,
956 width, height, data_stride);
957 cairo_set_source_surface (cr, image, 0, 0);
958 cairo_surface_destroy (image);
959 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
963 cursor = gdk_cursor_new_from_pixmap (display,
964 cairo_xlib_surface_get_drawable (pixmap),
965 cairo_xlib_surface_get_drawable (mask),
969 cairo_surface_destroy (pixmap);
970 cairo_surface_destroy (mask);
979 gdk_cursor_new_from_name (GdkDisplay *display,
982 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
988 gdk_display_supports_cursor_alpha (GdkDisplay *display)
990 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
996 gdk_display_supports_cursor_color (GdkDisplay *display)
998 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
1004 gdk_display_get_default_cursor_size (GdkDisplay *display)
1006 g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
1008 /* no idea, really */
1016 * gdk_display_get_maximal_cursor_size:
1017 * @display: a #GdkDisplay
1018 * @width: (out): the return location for the maximal cursor width
1019 * @height: (out): the return location for the maximal cursor height
1021 * Gets the maximal size to use for cursors on @display.
1026 gdk_display_get_maximal_cursor_size (GdkDisplay *display,
1033 g_return_if_fail (GDK_IS_DISPLAY (display));
1035 screen = gdk_display_get_default_screen (display);
1036 window = gdk_screen_get_root_window (screen);
1037 XQueryBestCursor (GDK_DISPLAY_XDISPLAY (display),
1038 GDK_WINDOW_XWINDOW (window),
1039 128, 128, width, height);