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 #define GDK_PIXBUF_ENABLE_BACKEND
32 #include <X11/cursorfont.h>
34 #include <X11/Xcursor/Xcursor.h>
37 #include <X11/extensions/Xfixes.h>
41 #include "gdkprivate-x11.h"
42 #include "gdkcursor.h"
43 #include "gdkdisplay-x11.h"
45 #include <gdk-pixbuf/gdk-pixbuf.h>
47 static guint theme_serial = 0;
49 /* cursor_cache holds a cache of non-pixmap cursors to avoid expensive
50 * libXcursor searches, cursors are added to it but only removed when
51 * their display is closed. We make the assumption that since there are
52 * a small number of display's and a small number of cursor's that this
53 * list will stay small enough not to be a problem.
55 static GSList* cursor_cache = NULL;
57 struct cursor_cache_key
64 /* Caller should check if there is already a match first.
65 * Cursor MUST be either a typed cursor or a pixmap with
69 add_to_cache (GdkCursorPrivate* cursor)
71 cursor_cache = g_slist_prepend (cursor_cache, cursor);
73 /* Take a ref so that if the caller frees it we still have it */
74 gdk_cursor_ref ((GdkCursor*) cursor);
77 /* Returns 0 on a match
80 cache_compare_func (gconstpointer listelem,
83 GdkCursorPrivate* cursor = (GdkCursorPrivate*)listelem;
84 struct cursor_cache_key* key = (struct cursor_cache_key*)target;
86 if ((cursor->cursor.type != key->type) ||
87 (cursor->display != key->display))
88 return 1; /* No match */
90 /* Elements marked as pixmap must be named cursors
91 * (since we don't store normal pixmap cursors
93 if (key->type == GDK_CURSOR_IS_PIXMAP)
94 return strcmp (key->name, cursor->name);
99 /* Returns the cursor if there is a match, NULL if not
100 * For named cursors type shall be GDK_CURSOR_IS_PIXMAP
101 * For unnamed, typed cursors, name shall be NULL
103 static GdkCursorPrivate*
104 find_in_cache (GdkDisplay *display,
109 struct cursor_cache_key key;
111 key.display = display;
115 res = g_slist_find_custom (cursor_cache, &key, cache_compare_func);
118 return (GdkCursorPrivate *) res->data;
123 /* Called by gdk_display_x11_finalize to flush any cached cursors
124 * for a dead display.
127 _gdk_x11_cursor_display_finalize (GdkDisplay *display)
130 GSList** itemp; /* Pointer to the thing to fix when we delete an item */
132 itemp = &cursor_cache;
135 GdkCursorPrivate* cursor = (GdkCursorPrivate*)(item->data);
136 if (cursor->display == display)
139 gdk_cursor_unref ((GdkCursor*) cursor);
140 /* Remove this item from the list */
141 *(itemp) = item->next;
143 item = g_slist_next (item);
144 g_slist_free_1 (olditem);
148 itemp = &(item->next);
149 item = g_slist_next (item);
155 get_blank_cursor (GdkDisplay *display)
161 cairo_surface_t *surface;
164 screen = gdk_display_get_default_screen (display);
165 surface = _gdk_x11_window_create_bitmap_surface (gdk_screen_get_root_window (screen), 1, 1);
167 cr = cairo_create (surface);
168 cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
172 pixmap = cairo_xlib_surface_get_drawable (surface);
175 color.red = color.blue = color.green = 0;
180 cursor = XCreatePixmapCursor (GDK_DISPLAY_XDISPLAY (display),
182 &color, &color, 1, 1);
183 cairo_surface_destroy (surface);
189 * gdk_cursor_new_for_display:
190 * @display: the #GdkDisplay for which the cursor will be created
191 * @cursor_type: cursor to create
193 * Creates a new cursor from the set of builtin cursors.
194 * Some useful ones are:
197 * <inlinegraphic format="PNG" fileref="right_ptr.png"></inlinegraphic> #GDK_RIGHT_PTR (right-facing arrow)
200 * <inlinegraphic format="PNG" fileref="crosshair.png"></inlinegraphic> #GDK_CROSSHAIR (crosshair)
203 * <inlinegraphic format="PNG" fileref="xterm.png"></inlinegraphic> #GDK_XTERM (I-beam)
206 * <inlinegraphic format="PNG" fileref="watch.png"></inlinegraphic> #GDK_WATCH (busy)
209 * <inlinegraphic format="PNG" fileref="fleur.png"></inlinegraphic> #GDK_FLEUR (for moving objects)
212 * <inlinegraphic format="PNG" fileref="hand1.png"></inlinegraphic> #GDK_HAND1 (a right-pointing hand)
215 * <inlinegraphic format="PNG" fileref="hand2.png"></inlinegraphic> #GDK_HAND2 (a left-pointing hand)
218 * <inlinegraphic format="PNG" fileref="left_side.png"></inlinegraphic> #GDK_LEFT_SIDE (resize left side)
221 * <inlinegraphic format="PNG" fileref="right_side.png"></inlinegraphic> #GDK_RIGHT_SIDE (resize right side)
224 * <inlinegraphic format="PNG" fileref="top_left_corner.png"></inlinegraphic> #GDK_TOP_LEFT_CORNER (resize northwest corner)
227 * <inlinegraphic format="PNG" fileref="top_right_corner.png"></inlinegraphic> #GDK_TOP_RIGHT_CORNER (resize northeast corner)
230 * <inlinegraphic format="PNG" fileref="bottom_left_corner.png"></inlinegraphic> #GDK_BOTTOM_LEFT_CORNER (resize southwest corner)
233 * <inlinegraphic format="PNG" fileref="bottom_right_corner.png"></inlinegraphic> #GDK_BOTTOM_RIGHT_CORNER (resize southeast corner)
236 * <inlinegraphic format="PNG" fileref="top_side.png"></inlinegraphic> #GDK_TOP_SIDE (resize top side)
239 * <inlinegraphic format="PNG" fileref="bottom_side.png"></inlinegraphic> #GDK_BOTTOM_SIDE (resize bottom side)
242 * <inlinegraphic format="PNG" fileref="sb_h_double_arrow.png"></inlinegraphic> #GDK_SB_H_DOUBLE_ARROW (move vertical splitter)
245 * <inlinegraphic format="PNG" fileref="sb_v_double_arrow.png"></inlinegraphic> #GDK_SB_V_DOUBLE_ARROW (move horizontal splitter)
248 * #GDK_BLANK_CURSOR (Blank cursor). Since 2.16
252 * Return value: a new #GdkCursor
257 gdk_cursor_new_for_display (GdkDisplay *display,
258 GdkCursorType cursor_type)
260 GdkCursorPrivate *private;
264 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
272 private = find_in_cache (display, cursor_type, NULL);
276 /* Cache had it, add a ref for this user */
277 gdk_cursor_ref ((GdkCursor*) private);
279 return (GdkCursor*) private;
283 if (cursor_type != GDK_BLANK_CURSOR)
284 xcursor = XCreateFontCursor (GDK_DISPLAY_XDISPLAY (display),
287 xcursor = get_blank_cursor (display);
291 private = g_new (GdkCursorPrivate, 1);
292 private->display = display;
293 private->xcursor = xcursor;
294 private->name = NULL;
295 private->serial = theme_serial;
297 cursor = (GdkCursor *) private;
298 cursor->type = cursor_type;
299 cursor->ref_count = 1;
302 add_to_cache (private);
308 _gdk_cursor_destroy (GdkCursor *cursor)
310 GdkCursorPrivate *private;
312 g_return_if_fail (cursor != NULL);
313 g_return_if_fail (cursor->ref_count == 0);
315 private = (GdkCursorPrivate *) cursor;
316 if (!private->display->closed && private->xcursor)
317 XFreeCursor (GDK_DISPLAY_XDISPLAY (private->display), private->xcursor);
319 g_free (private->name);
324 * gdk_x11_cursor_get_xdisplay:
325 * @cursor: a #GdkCursor.
327 * Returns the display of a #GdkCursor.
329 * Return value: an Xlib <type>Display*</type>.
332 gdk_x11_cursor_get_xdisplay (GdkCursor *cursor)
334 g_return_val_if_fail (cursor != NULL, NULL);
336 return GDK_DISPLAY_XDISPLAY(((GdkCursorPrivate *)cursor)->display);
340 * gdk_x11_cursor_get_xcursor:
341 * @cursor: a #GdkCursor.
343 * Returns the X cursor belonging to a #GdkCursor.
345 * Return value: an Xlib <type>Cursor</type>.
348 gdk_x11_cursor_get_xcursor (GdkCursor *cursor)
350 g_return_val_if_fail (cursor != NULL, None);
352 return ((GdkCursorPrivate *)cursor)->xcursor;
356 * gdk_cursor_get_display:
357 * @cursor: a #GdkCursor.
359 * Returns the display on which the #GdkCursor is defined.
361 * Returns: the #GdkDisplay associated to @cursor
367 gdk_cursor_get_display (GdkCursor *cursor)
369 g_return_val_if_fail (cursor != NULL, NULL);
371 return ((GdkCursorPrivate *)cursor)->display;
374 #if defined(HAVE_XCURSOR) && defined(HAVE_XFIXES) && XFIXES_MAJOR >= 2
377 * gdk_cursor_get_image:
378 * @cursor: a #GdkCursor
380 * Returns a #GdkPixbuf with the image used to display the cursor.
382 * Note that depending on the capabilities of the windowing system and
383 * on the cursor, GDK may not be able to obtain the image data. In this
384 * case, %NULL is returned.
386 * Returns: a #GdkPixbuf representing @cursor, or %NULL
391 gdk_cursor_get_image (GdkCursor *cursor)
394 GdkCursorPrivate *private;
395 XcursorImages *images = NULL;
399 guchar *data, *p, tmp;
403 g_return_val_if_fail (cursor != NULL, NULL);
405 private = (GdkCursorPrivate *) cursor;
407 xdisplay = GDK_DISPLAY_XDISPLAY (private->display);
409 size = XcursorGetDefaultSize (xdisplay);
410 theme = XcursorGetTheme (xdisplay);
412 if (cursor->type == GDK_CURSOR_IS_PIXMAP)
415 images = XcursorLibraryLoadImages (private->name, theme, size);
418 images = XcursorShapeLoadImages (cursor->type, theme, size);
423 image = images->images[0];
425 data = g_malloc (4 * image->width * image->height);
426 memcpy (data, image->pixels, 4 * image->width * image->height);
428 for (p = data; p < data + (4 * image->width * image->height); p += 4)
435 pixbuf = gdk_pixbuf_new_from_data (data, GDK_COLORSPACE_RGB, TRUE,
436 8, image->width, image->height,
438 (GdkPixbufDestroyNotify)g_free, NULL);
441 gdk_pixbuf_set_option (pixbuf, "name", private->name);
442 g_snprintf (buf, 32, "%d", image->xhot);
443 gdk_pixbuf_set_option (pixbuf, "x_hot", buf);
444 g_snprintf (buf, 32, "%d", image->yhot);
445 gdk_pixbuf_set_option (pixbuf, "y_hot", buf);
447 XcursorImagesDestroy (images);
453 _gdk_x11_cursor_update_theme (GdkCursor *cursor)
456 GdkCursorPrivate *private;
457 Cursor new_cursor = None;
458 GdkDisplayX11 *display_x11;
460 private = (GdkCursorPrivate *) cursor;
461 xdisplay = GDK_DISPLAY_XDISPLAY (private->display);
462 display_x11 = GDK_DISPLAY_X11 (private->display);
464 if (!display_x11->have_xfixes)
467 if (private->serial == theme_serial)
470 private->serial = theme_serial;
472 if (private->xcursor != None)
474 if (cursor->type == GDK_BLANK_CURSOR)
477 if (cursor->type == GDK_CURSOR_IS_PIXMAP)
480 new_cursor = XcursorLibraryLoadCursor (xdisplay, private->name);
483 new_cursor = XcursorShapeLoadCursor (xdisplay, cursor->type);
485 if (new_cursor != None)
487 XFixesChangeCursor (xdisplay, new_cursor, private->xcursor);
488 private->xcursor = new_cursor;
494 update_cursor (gpointer data,
499 cursor = (GdkCursor*)(data);
504 _gdk_x11_cursor_update_theme (cursor);
508 * gdk_x11_display_set_cursor_theme:
509 * @display: a #GdkDisplay
510 * @theme: the name of the cursor theme to use, or %NULL to unset
511 * a previously set value
512 * @size: the cursor size to use, or 0 to keep the previous size
514 * Sets the cursor theme from which the images for cursor
517 * If the windowing system supports it, existing cursors created
518 * with gdk_cursor_new(), gdk_cursor_new_for_display() and
519 * gdk_cursor_new_for_name() are updated to reflect the theme
520 * change. Custom cursors constructed with
521 * gdk_cursor_new_from_pixbuf() will have to be handled
522 * by the application (GTK+ applications can learn about
523 * cursor theme changes by listening for change notification
524 * for the corresponding #GtkSetting).
529 gdk_x11_display_set_cursor_theme (GdkDisplay *display,
533 GdkDisplayX11 *display_x11;
538 g_return_if_fail (GDK_IS_DISPLAY (display));
540 display_x11 = GDK_DISPLAY_X11 (display);
541 xdisplay = GDK_DISPLAY_XDISPLAY (display);
543 old_theme = XcursorGetTheme (xdisplay);
544 old_size = XcursorGetDefaultSize (xdisplay);
546 if (old_size == size &&
547 (old_theme == theme ||
548 (old_theme && theme && strcmp (old_theme, theme) == 0)))
553 XcursorSetTheme (xdisplay, theme);
555 XcursorSetDefaultSize (xdisplay, size);
557 g_slist_foreach (cursor_cache, update_cursor, NULL);
563 gdk_cursor_get_image (GdkCursor *cursor)
565 g_return_val_if_fail (cursor != NULL, NULL);
571 gdk_x11_display_set_cursor_theme (GdkDisplay *display,
575 g_return_if_fail (GDK_IS_DISPLAY (display));
579 _gdk_x11_cursor_update_theme (GdkCursor *cursor)
581 g_return_if_fail (cursor != NULL);
589 create_cursor_image (GdkPixbuf *pixbuf,
594 XcursorImage *xcimage;
595 cairo_surface_t *surface;
598 width = gdk_pixbuf_get_width (pixbuf);
599 height = gdk_pixbuf_get_height (pixbuf);
601 xcimage = XcursorImageCreate (width, height);
606 surface = cairo_image_surface_create_for_data ((guchar *) xcimage->pixels,
612 cr = cairo_create (surface);
613 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
614 gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
618 cairo_surface_destroy (surface);
625 * gdk_cursor_new_from_pixbuf:
626 * @display: the #GdkDisplay for which the cursor will be created
627 * @pixbuf: the #GdkPixbuf containing the cursor image
628 * @x: the horizontal offset of the 'hotspot' of the cursor.
629 * @y: the vertical offset of the 'hotspot' of the cursor.
631 * Creates a new cursor from a pixbuf.
633 * Not all GDK backends support RGBA cursors. If they are not
634 * supported, a monochrome approximation will be displayed.
635 * The functions gdk_display_supports_cursor_alpha() and
636 * gdk_display_supports_cursor_color() can be used to determine
637 * whether RGBA cursors are supported;
638 * gdk_display_get_default_cursor_size() and
639 * gdk_display_get_maximal_cursor_size() give information about
642 * On the X backend, support for RGBA cursors requires a
643 * sufficently new version of the X Render extension.
645 * Returns: a new #GdkCursor.
650 gdk_cursor_new_from_pixbuf (GdkDisplay *display,
655 XcursorImage *xcimage;
657 GdkCursorPrivate *private;
660 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
661 g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
662 g_return_val_if_fail (0 <= x && x < gdk_pixbuf_get_width (pixbuf), NULL);
663 g_return_val_if_fail (0 <= y && y < gdk_pixbuf_get_height (pixbuf), NULL);
669 xcimage = create_cursor_image (pixbuf, x, y);
670 xcursor = XcursorImageLoadCursor (GDK_DISPLAY_XDISPLAY (display), xcimage);
671 XcursorImageDestroy (xcimage);
674 private = g_new (GdkCursorPrivate, 1);
675 private->display = display;
676 private->xcursor = xcursor;
677 private->name = NULL;
678 private->serial = theme_serial;
680 cursor = (GdkCursor *) private;
681 cursor->type = GDK_CURSOR_IS_PIXMAP;
682 cursor->ref_count = 1;
688 * gdk_cursor_new_from_name:
689 * @display: the #GdkDisplay for which the cursor will be created
690 * @name: the name of the cursor
692 * Creates a new cursor by looking up @name in the current cursor
695 * Returns: a new #GdkCursor, or %NULL if there is no cursor with
701 gdk_cursor_new_from_name (GdkDisplay *display,
706 GdkCursorPrivate *private;
709 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
715 private = find_in_cache (display, GDK_CURSOR_IS_PIXMAP, name);
719 /* Cache had it, add a ref for this user */
720 gdk_cursor_ref ((GdkCursor*) private);
722 return (GdkCursor*) private;
725 xdisplay = GDK_DISPLAY_XDISPLAY (display);
726 xcursor = XcursorLibraryLoadCursor (xdisplay, name);
731 private = g_new (GdkCursorPrivate, 1);
732 private->display = display;
733 private->xcursor = xcursor;
734 private->name = g_strdup (name);
735 private->serial = theme_serial;
737 cursor = (GdkCursor *) private;
738 cursor->type = GDK_CURSOR_IS_PIXMAP;
739 cursor->ref_count = 1;
740 add_to_cache (private);
746 * gdk_display_supports_cursor_alpha:
747 * @display: a #GdkDisplay
749 * Returns %TRUE if cursors can use an 8bit alpha channel
750 * on @display. Otherwise, cursors are restricted to bilevel
751 * alpha (i.e. a mask).
753 * Returns: whether cursors can have alpha channels.
758 gdk_display_supports_cursor_alpha (GdkDisplay *display)
760 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
762 return XcursorSupportsARGB (GDK_DISPLAY_XDISPLAY (display));
766 * gdk_display_supports_cursor_color:
767 * @display: a #GdkDisplay
769 * Returns %TRUE if multicolored cursors are supported
770 * on @display. Otherwise, cursors have only a forground
771 * and a background color.
773 * Returns: whether cursors can have multiple colors.
778 gdk_display_supports_cursor_color (GdkDisplay *display)
780 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
782 return XcursorSupportsARGB (GDK_DISPLAY_XDISPLAY (display));
786 * gdk_display_get_default_cursor_size:
787 * @display: a #GdkDisplay
789 * Returns the default size to use for cursors on @display.
791 * Returns: the default cursor size.
796 gdk_display_get_default_cursor_size (GdkDisplay *display)
798 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
800 return XcursorGetDefaultSize (GDK_DISPLAY_XDISPLAY (display));
806 gdk_cursor_new_from_pixmap (GdkDisplay *display,
807 Pixmap source_pixmap,
814 GdkCursorPrivate *private;
819 g_return_val_if_fail (fg != NULL, NULL);
820 g_return_val_if_fail (bg != NULL, NULL);
822 xfg.pixel = fg->pixel;
825 xfg.green = fg->green;
826 xbg.pixel = bg->pixel;
829 xbg.green = bg->green;
834 xcursor = XCreatePixmapCursor (GDK_DISPLAY_XDISPLAY (display),
835 source_pixmap, mask_pixmap, &xfg, &xbg, x, y);
836 private = g_new (GdkCursorPrivate, 1);
837 private->display = display;
838 private->xcursor = xcursor;
839 private->name = NULL;
840 private->serial = theme_serial;
842 cursor = (GdkCursor *) private;
843 cursor->type = GDK_CURSOR_IS_PIXMAP;
844 cursor->ref_count = 1;
850 gdk_cursor_new_from_pixbuf (GdkDisplay *display,
856 cairo_surface_t *pixmap, *mask;
857 guint width, height, n_channels, rowstride, data_stride, i, j;
858 guint8 *data, *mask_data, *pixels;
859 GdkColor fg = { 0, 0, 0, 0 };
860 GdkColor bg = { 0, 0xffff, 0xffff, 0xffff };
862 cairo_surface_t *image;
865 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
866 g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
868 width = gdk_pixbuf_get_width (pixbuf);
869 height = gdk_pixbuf_get_height (pixbuf);
871 g_return_val_if_fail (0 <= x && x < width, NULL);
872 g_return_val_if_fail (0 <= y && y < height, NULL);
874 n_channels = gdk_pixbuf_get_n_channels (pixbuf);
875 rowstride = gdk_pixbuf_get_rowstride (pixbuf);
876 pixels = gdk_pixbuf_get_pixels (pixbuf);
878 data_stride = 4 * ((width + 31) / 32);
879 data = g_new0 (guint8, data_stride * height);
880 mask_data = g_new0 (guint8, data_stride * height);
882 for (j = 0; j < height; j++)
884 guint8 *src = pixels + j * rowstride;
885 guint8 *d = data + data_stride * j;
886 guint8 *md = mask_data + data_stride * j;
888 for (i = 0; i < width; i++)
893 if (n_channels == 3 || src[3] >= 0x80)
905 screen = gdk_display_get_default_screen (display);
907 pixmap = _gdk_x11_window_create_bitmap_surface (gdk_screen_get_root_window (screen),
909 cr = cairo_create (pixmap);
910 image = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_A1,
911 width, height, data_stride);
912 cairo_set_source_surface (cr, image, 0, 0);
913 cairo_surface_destroy (image);
914 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
918 mask = _gdk_x11_window_create_bitmap_surface (gdk_screen_get_root_window (screen),
920 cr = cairo_create (mask);
921 image = cairo_image_surface_create_for_data (mask_data, CAIRO_FORMAT_A1,
922 width, height, data_stride);
923 cairo_set_source_surface (cr, image, 0, 0);
924 cairo_surface_destroy (image);
925 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
929 cursor = gdk_cursor_new_from_pixmap (display,
930 cairo_xlib_surface_get_drawable (pixmap),
931 cairo_xlib_surface_get_drawable (mask),
935 cairo_surface_destroy (pixmap);
936 cairo_surface_destroy (mask);
945 gdk_cursor_new_from_name (GdkDisplay *display,
948 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
954 gdk_display_supports_cursor_alpha (GdkDisplay *display)
956 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
962 gdk_display_supports_cursor_color (GdkDisplay *display)
964 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
970 gdk_display_get_default_cursor_size (GdkDisplay *display)
972 g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
974 /* no idea, really */
982 * gdk_display_get_maximal_cursor_size:
983 * @display: a #GdkDisplay
984 * @width: (out): the return location for the maximal cursor width
985 * @height: (out): the return location for the maximal cursor height
987 * Gets the maximal size to use for cursors on @display.
992 gdk_display_get_maximal_cursor_size (GdkDisplay *display,
999 g_return_if_fail (GDK_IS_DISPLAY (display));
1001 screen = gdk_display_get_default_screen (display);
1002 window = gdk_screen_get_root_window (screen);
1003 XQueryBestCursor (GDK_DISPLAY_XDISPLAY (display),
1004 GDK_WINDOW_XWINDOW (window),
1005 128, 128, width, height);