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"
44 #include "gdkpixmap-x11.h"
46 #include <gdk/gdkpixmap.h>
47 #include <gdk-pixbuf/gdk-pixbuf.h>
49 static guint theme_serial = 0;
51 /* cursor_cache holds a cache of non-pixmap cursors to avoid expensive
52 * libXcursor searches, cursors are added to it but only removed when
53 * their display is closed. We make the assumption that since there are
54 * a small number of display's and a small number of cursor's that this
55 * list will stay small enough not to be a problem.
57 static GSList* cursor_cache = NULL;
59 struct cursor_cache_key
66 /* Caller should check if there is already a match first.
67 * Cursor MUST be either a typed cursor or a pixmap with
71 add_to_cache (GdkCursorPrivate* cursor)
73 cursor_cache = g_slist_prepend (cursor_cache, cursor);
75 /* Take a ref so that if the caller frees it we still have it */
76 gdk_cursor_ref ((GdkCursor*) cursor);
79 /* Returns 0 on a match
82 cache_compare_func (gconstpointer listelem,
85 GdkCursorPrivate* cursor = (GdkCursorPrivate*)listelem;
86 struct cursor_cache_key* key = (struct cursor_cache_key*)target;
88 if ((cursor->cursor.type != key->type) ||
89 (cursor->display != key->display))
90 return 1; /* No match */
92 /* Elements marked as pixmap must be named cursors
93 * (since we don't store normal pixmap cursors
95 if (key->type == GDK_CURSOR_IS_PIXMAP)
96 return strcmp (key->name, cursor->name);
101 /* Returns the cursor if there is a match, NULL if not
102 * For named cursors type shall be GDK_CURSOR_IS_PIXMAP
103 * For unnamed, typed cursors, name shall be NULL
105 static GdkCursorPrivate*
106 find_in_cache (GdkDisplay *display,
111 struct cursor_cache_key key;
113 key.display = display;
117 res = g_slist_find_custom (cursor_cache, &key, cache_compare_func);
120 return (GdkCursorPrivate *) res->data;
125 /* Called by gdk_display_x11_finalize to flush any cached cursors
126 * for a dead display.
129 _gdk_x11_cursor_display_finalize (GdkDisplay *display)
132 GSList** itemp; /* Pointer to the thing to fix when we delete an item */
134 itemp = &cursor_cache;
137 GdkCursorPrivate* cursor = (GdkCursorPrivate*)(item->data);
138 if (cursor->display == display)
141 gdk_cursor_unref ((GdkCursor*) cursor);
142 /* Remove this item from the list */
143 *(itemp) = item->next;
145 item = g_slist_next (item);
146 g_slist_free_1 (olditem);
150 itemp = &(item->next);
151 item = g_slist_next (item);
157 get_blank_cursor (GdkDisplay *display)
163 cairo_surface_t *surface;
166 screen = gdk_display_get_default_screen (display);
167 surface = _gdk_x11_window_create_bitmap_surface (gdk_screen_get_root_window (screen), 1, 1);
169 cr = cairo_create (surface);
170 cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
174 pixmap = cairo_xlib_surface_get_drawable (surface);
177 color.red = color.blue = color.green = 0;
182 cursor = XCreatePixmapCursor (GDK_DISPLAY_XDISPLAY (display),
184 &color, &color, 1, 1);
185 cairo_surface_destroy (surface);
191 * gdk_cursor_new_for_display:
192 * @display: the #GdkDisplay for which the cursor will be created
193 * @cursor_type: cursor to create
195 * Creates a new cursor from the set of builtin cursors.
196 * Some useful ones are:
199 * <inlinegraphic format="PNG" fileref="right_ptr.png"></inlinegraphic> #GDK_RIGHT_PTR (right-facing arrow)
202 * <inlinegraphic format="PNG" fileref="crosshair.png"></inlinegraphic> #GDK_CROSSHAIR (crosshair)
205 * <inlinegraphic format="PNG" fileref="xterm.png"></inlinegraphic> #GDK_XTERM (I-beam)
208 * <inlinegraphic format="PNG" fileref="watch.png"></inlinegraphic> #GDK_WATCH (busy)
211 * <inlinegraphic format="PNG" fileref="fleur.png"></inlinegraphic> #GDK_FLEUR (for moving objects)
214 * <inlinegraphic format="PNG" fileref="hand1.png"></inlinegraphic> #GDK_HAND1 (a right-pointing hand)
217 * <inlinegraphic format="PNG" fileref="hand2.png"></inlinegraphic> #GDK_HAND2 (a left-pointing hand)
220 * <inlinegraphic format="PNG" fileref="left_side.png"></inlinegraphic> #GDK_LEFT_SIDE (resize left side)
223 * <inlinegraphic format="PNG" fileref="right_side.png"></inlinegraphic> #GDK_RIGHT_SIDE (resize right side)
226 * <inlinegraphic format="PNG" fileref="top_left_corner.png"></inlinegraphic> #GDK_TOP_LEFT_CORNER (resize northwest corner)
229 * <inlinegraphic format="PNG" fileref="top_right_corner.png"></inlinegraphic> #GDK_TOP_RIGHT_CORNER (resize northeast corner)
232 * <inlinegraphic format="PNG" fileref="bottom_left_corner.png"></inlinegraphic> #GDK_BOTTOM_LEFT_CORNER (resize southwest corner)
235 * <inlinegraphic format="PNG" fileref="bottom_right_corner.png"></inlinegraphic> #GDK_BOTTOM_RIGHT_CORNER (resize southeast corner)
238 * <inlinegraphic format="PNG" fileref="top_side.png"></inlinegraphic> #GDK_TOP_SIDE (resize top side)
241 * <inlinegraphic format="PNG" fileref="bottom_side.png"></inlinegraphic> #GDK_BOTTOM_SIDE (resize bottom side)
244 * <inlinegraphic format="PNG" fileref="sb_h_double_arrow.png"></inlinegraphic> #GDK_SB_H_DOUBLE_ARROW (move vertical splitter)
247 * <inlinegraphic format="PNG" fileref="sb_v_double_arrow.png"></inlinegraphic> #GDK_SB_V_DOUBLE_ARROW (move horizontal splitter)
250 * #GDK_BLANK_CURSOR (Blank cursor). Since 2.16
254 * Return value: a new #GdkCursor
259 gdk_cursor_new_for_display (GdkDisplay *display,
260 GdkCursorType cursor_type)
262 GdkCursorPrivate *private;
266 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
274 private = find_in_cache (display, cursor_type, NULL);
278 /* Cache had it, add a ref for this user */
279 gdk_cursor_ref ((GdkCursor*) private);
281 return (GdkCursor*) private;
285 if (cursor_type != GDK_BLANK_CURSOR)
286 xcursor = XCreateFontCursor (GDK_DISPLAY_XDISPLAY (display),
289 xcursor = get_blank_cursor (display);
293 private = g_new (GdkCursorPrivate, 1);
294 private->display = display;
295 private->xcursor = xcursor;
296 private->name = NULL;
297 private->serial = theme_serial;
299 cursor = (GdkCursor *) private;
300 cursor->type = cursor_type;
301 cursor->ref_count = 1;
304 add_to_cache (private);
310 _gdk_cursor_destroy (GdkCursor *cursor)
312 GdkCursorPrivate *private;
314 g_return_if_fail (cursor != NULL);
315 g_return_if_fail (cursor->ref_count == 0);
317 private = (GdkCursorPrivate *) cursor;
318 if (!private->display->closed && private->xcursor)
319 XFreeCursor (GDK_DISPLAY_XDISPLAY (private->display), private->xcursor);
321 g_free (private->name);
326 * gdk_x11_cursor_get_xdisplay:
327 * @cursor: a #GdkCursor.
329 * Returns the display of a #GdkCursor.
331 * Return value: an Xlib <type>Display*</type>.
334 gdk_x11_cursor_get_xdisplay (GdkCursor *cursor)
336 g_return_val_if_fail (cursor != NULL, NULL);
338 return GDK_DISPLAY_XDISPLAY(((GdkCursorPrivate *)cursor)->display);
342 * gdk_x11_cursor_get_xcursor:
343 * @cursor: a #GdkCursor.
345 * Returns the X cursor belonging to a #GdkCursor.
347 * Return value: an Xlib <type>Cursor</type>.
350 gdk_x11_cursor_get_xcursor (GdkCursor *cursor)
352 g_return_val_if_fail (cursor != NULL, None);
354 return ((GdkCursorPrivate *)cursor)->xcursor;
358 * gdk_cursor_get_display:
359 * @cursor: a #GdkCursor.
361 * Returns the display on which the #GdkCursor is defined.
363 * Returns: the #GdkDisplay associated to @cursor
369 gdk_cursor_get_display (GdkCursor *cursor)
371 g_return_val_if_fail (cursor != NULL, NULL);
373 return ((GdkCursorPrivate *)cursor)->display;
376 #if defined(HAVE_XCURSOR) && defined(HAVE_XFIXES) && XFIXES_MAJOR >= 2
379 * gdk_cursor_get_image:
380 * @cursor: a #GdkCursor
382 * Returns a #GdkPixbuf with the image used to display the cursor.
384 * Note that depending on the capabilities of the windowing system and
385 * on the cursor, GDK may not be able to obtain the image data. In this
386 * case, %NULL is returned.
388 * Returns: a #GdkPixbuf representing @cursor, or %NULL
393 gdk_cursor_get_image (GdkCursor *cursor)
396 GdkCursorPrivate *private;
397 XcursorImages *images = NULL;
401 guchar *data, *p, tmp;
405 g_return_val_if_fail (cursor != NULL, NULL);
407 private = (GdkCursorPrivate *) cursor;
409 xdisplay = GDK_DISPLAY_XDISPLAY (private->display);
411 size = XcursorGetDefaultSize (xdisplay);
412 theme = XcursorGetTheme (xdisplay);
414 if (cursor->type == GDK_CURSOR_IS_PIXMAP)
417 images = XcursorLibraryLoadImages (private->name, theme, size);
420 images = XcursorShapeLoadImages (cursor->type, theme, size);
425 image = images->images[0];
427 data = g_malloc (4 * image->width * image->height);
428 memcpy (data, image->pixels, 4 * image->width * image->height);
430 for (p = data; p < data + (4 * image->width * image->height); p += 4)
437 pixbuf = gdk_pixbuf_new_from_data (data, GDK_COLORSPACE_RGB, TRUE,
438 8, image->width, image->height,
440 (GdkPixbufDestroyNotify)g_free, NULL);
443 gdk_pixbuf_set_option (pixbuf, "name", private->name);
444 g_snprintf (buf, 32, "%d", image->xhot);
445 gdk_pixbuf_set_option (pixbuf, "x_hot", buf);
446 g_snprintf (buf, 32, "%d", image->yhot);
447 gdk_pixbuf_set_option (pixbuf, "y_hot", buf);
449 XcursorImagesDestroy (images);
455 _gdk_x11_cursor_update_theme (GdkCursor *cursor)
458 GdkCursorPrivate *private;
459 Cursor new_cursor = None;
460 GdkDisplayX11 *display_x11;
462 private = (GdkCursorPrivate *) cursor;
463 xdisplay = GDK_DISPLAY_XDISPLAY (private->display);
464 display_x11 = GDK_DISPLAY_X11 (private->display);
466 if (!display_x11->have_xfixes)
469 if (private->serial == theme_serial)
472 private->serial = theme_serial;
474 if (private->xcursor != None)
476 if (cursor->type == GDK_BLANK_CURSOR)
479 if (cursor->type == GDK_CURSOR_IS_PIXMAP)
482 new_cursor = XcursorLibraryLoadCursor (xdisplay, private->name);
485 new_cursor = XcursorShapeLoadCursor (xdisplay, cursor->type);
487 if (new_cursor != None)
489 XFixesChangeCursor (xdisplay, new_cursor, private->xcursor);
490 private->xcursor = new_cursor;
496 update_cursor (gpointer data,
501 cursor = (GdkCursor*)(data);
506 _gdk_x11_cursor_update_theme (cursor);
510 * gdk_x11_display_set_cursor_theme:
511 * @display: a #GdkDisplay
512 * @theme: the name of the cursor theme to use, or %NULL to unset
513 * a previously set value
514 * @size: the cursor size to use, or 0 to keep the previous size
516 * Sets the cursor theme from which the images for cursor
519 * If the windowing system supports it, existing cursors created
520 * with gdk_cursor_new(), gdk_cursor_new_for_display() and
521 * gdk_cursor_new_for_name() are updated to reflect the theme
522 * change. Custom cursors constructed with
523 * gdk_cursor_new_from_pixbuf() will have to be handled
524 * by the application (GTK+ applications can learn about
525 * cursor theme changes by listening for change notification
526 * for the corresponding #GtkSetting).
531 gdk_x11_display_set_cursor_theme (GdkDisplay *display,
535 GdkDisplayX11 *display_x11;
540 g_return_if_fail (GDK_IS_DISPLAY (display));
542 display_x11 = GDK_DISPLAY_X11 (display);
543 xdisplay = GDK_DISPLAY_XDISPLAY (display);
545 old_theme = XcursorGetTheme (xdisplay);
546 old_size = XcursorGetDefaultSize (xdisplay);
548 if (old_size == size &&
549 (old_theme == theme ||
550 (old_theme && theme && strcmp (old_theme, theme) == 0)))
555 XcursorSetTheme (xdisplay, theme);
557 XcursorSetDefaultSize (xdisplay, size);
559 g_slist_foreach (cursor_cache, update_cursor, NULL);
565 gdk_cursor_get_image (GdkCursor *cursor)
567 g_return_val_if_fail (cursor != NULL, NULL);
573 gdk_x11_display_set_cursor_theme (GdkDisplay *display,
577 g_return_if_fail (GDK_IS_DISPLAY (display));
581 _gdk_x11_cursor_update_theme (GdkCursor *cursor)
583 g_return_if_fail (cursor != NULL);
591 create_cursor_image (GdkPixbuf *pixbuf,
596 XcursorImage *xcimage;
597 cairo_surface_t *surface;
600 width = gdk_pixbuf_get_width (pixbuf);
601 height = gdk_pixbuf_get_height (pixbuf);
603 xcimage = XcursorImageCreate (width, height);
608 surface = cairo_image_surface_create_for_data ((guchar *) xcimage->pixels,
614 cr = cairo_create (surface);
615 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
616 gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
620 cairo_surface_destroy (surface);
627 * gdk_cursor_new_from_pixbuf:
628 * @display: the #GdkDisplay for which the cursor will be created
629 * @pixbuf: the #GdkPixbuf containing the cursor image
630 * @x: the horizontal offset of the 'hotspot' of the cursor.
631 * @y: the vertical offset of the 'hotspot' of the cursor.
633 * Creates a new cursor from a pixbuf.
635 * Not all GDK backends support RGBA cursors. If they are not
636 * supported, a monochrome approximation will be displayed.
637 * The functions gdk_display_supports_cursor_alpha() and
638 * gdk_display_supports_cursor_color() can be used to determine
639 * whether RGBA cursors are supported;
640 * gdk_display_get_default_cursor_size() and
641 * gdk_display_get_maximal_cursor_size() give information about
644 * On the X backend, support for RGBA cursors requires a
645 * sufficently new version of the X Render extension.
647 * Returns: a new #GdkCursor.
652 gdk_cursor_new_from_pixbuf (GdkDisplay *display,
657 XcursorImage *xcimage;
659 GdkCursorPrivate *private;
662 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
663 g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
664 g_return_val_if_fail (0 <= x && x < gdk_pixbuf_get_width (pixbuf), NULL);
665 g_return_val_if_fail (0 <= y && y < gdk_pixbuf_get_height (pixbuf), NULL);
671 xcimage = create_cursor_image (pixbuf, x, y);
672 xcursor = XcursorImageLoadCursor (GDK_DISPLAY_XDISPLAY (display), xcimage);
673 XcursorImageDestroy (xcimage);
676 private = g_new (GdkCursorPrivate, 1);
677 private->display = display;
678 private->xcursor = xcursor;
679 private->name = NULL;
680 private->serial = theme_serial;
682 cursor = (GdkCursor *) private;
683 cursor->type = GDK_CURSOR_IS_PIXMAP;
684 cursor->ref_count = 1;
690 * gdk_cursor_new_from_name:
691 * @display: the #GdkDisplay for which the cursor will be created
692 * @name: the name of the cursor
694 * Creates a new cursor by looking up @name in the current cursor
697 * Returns: a new #GdkCursor, or %NULL if there is no cursor with
703 gdk_cursor_new_from_name (GdkDisplay *display,
708 GdkCursorPrivate *private;
711 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
717 private = find_in_cache (display, GDK_CURSOR_IS_PIXMAP, name);
721 /* Cache had it, add a ref for this user */
722 gdk_cursor_ref ((GdkCursor*) private);
724 return (GdkCursor*) private;
727 xdisplay = GDK_DISPLAY_XDISPLAY (display);
728 xcursor = XcursorLibraryLoadCursor (xdisplay, name);
733 private = g_new (GdkCursorPrivate, 1);
734 private->display = display;
735 private->xcursor = xcursor;
736 private->name = g_strdup (name);
737 private->serial = theme_serial;
739 cursor = (GdkCursor *) private;
740 cursor->type = GDK_CURSOR_IS_PIXMAP;
741 cursor->ref_count = 1;
742 add_to_cache (private);
748 * gdk_display_supports_cursor_alpha:
749 * @display: a #GdkDisplay
751 * Returns %TRUE if cursors can use an 8bit alpha channel
752 * on @display. Otherwise, cursors are restricted to bilevel
753 * alpha (i.e. a mask).
755 * Returns: whether cursors can have alpha channels.
760 gdk_display_supports_cursor_alpha (GdkDisplay *display)
762 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
764 return XcursorSupportsARGB (GDK_DISPLAY_XDISPLAY (display));
768 * gdk_display_supports_cursor_color:
769 * @display: a #GdkDisplay
771 * Returns %TRUE if multicolored cursors are supported
772 * on @display. Otherwise, cursors have only a forground
773 * and a background color.
775 * Returns: whether cursors can have multiple colors.
780 gdk_display_supports_cursor_color (GdkDisplay *display)
782 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
784 return XcursorSupportsARGB (GDK_DISPLAY_XDISPLAY (display));
788 * gdk_display_get_default_cursor_size:
789 * @display: a #GdkDisplay
791 * Returns the default size to use for cursors on @display.
793 * Returns: the default cursor size.
798 gdk_display_get_default_cursor_size (GdkDisplay *display)
800 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
802 return XcursorGetDefaultSize (GDK_DISPLAY_XDISPLAY (display));
808 gdk_cursor_new_from_pixmap (GdkDisplay *display,
809 Pixmap source_pixmap,
816 GdkCursorPrivate *private;
821 g_return_val_if_fail (fg != NULL, NULL);
822 g_return_val_if_fail (bg != NULL, NULL);
824 xfg.pixel = fg->pixel;
827 xfg.green = fg->green;
828 xbg.pixel = bg->pixel;
831 xbg.green = bg->green;
836 xcursor = XCreatePixmapCursor (GDK_DISPLAY_XDISPLAY (display),
837 source_pixmap, mask_pixmap, &xfg, &xbg, x, y);
838 private = g_new (GdkCursorPrivate, 1);
839 private->display = display;
840 private->xcursor = xcursor;
841 private->name = NULL;
842 private->serial = theme_serial;
844 cursor = (GdkCursor *) private;
845 cursor->type = GDK_CURSOR_IS_PIXMAP;
846 cursor->ref_count = 1;
852 gdk_cursor_new_from_pixbuf (GdkDisplay *display,
858 cairo_surface_t *pixmap, *mask;
859 guint width, height, n_channels, rowstride, data_stride, i, j;
860 guint8 *data, *mask_data, *pixels;
861 GdkColor fg = { 0, 0, 0, 0 };
862 GdkColor bg = { 0, 0xffff, 0xffff, 0xffff };
864 cairo_surface_t *image;
867 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
868 g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
870 width = gdk_pixbuf_get_width (pixbuf);
871 height = gdk_pixbuf_get_height (pixbuf);
873 g_return_val_if_fail (0 <= x && x < width, NULL);
874 g_return_val_if_fail (0 <= y && y < height, NULL);
876 n_channels = gdk_pixbuf_get_n_channels (pixbuf);
877 rowstride = gdk_pixbuf_get_rowstride (pixbuf);
878 pixels = gdk_pixbuf_get_pixels (pixbuf);
880 data_stride = 4 * ((width + 31) / 32);
881 data = g_new0 (guint8, data_stride * height);
882 mask_data = g_new0 (guint8, data_stride * height);
884 for (j = 0; j < height; j++)
886 guint8 *src = pixels + j * rowstride;
887 guint8 *d = data + data_stride * j;
888 guint8 *md = mask_data + data_stride * j;
890 for (i = 0; i < width; i++)
895 if (n_channels == 3 || src[3] >= 0x80)
907 screen = gdk_display_get_default_screen (display);
909 pixmap = _gdk_x11_window_create_bitmap_surface (gdk_screen_get_root_window (screen),
911 cr = cairo_create (pixmap);
912 image = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_A1,
913 width, height, data_stride);
914 cairo_set_source_surface (cr, image, 0, 0);
915 cairo_surface_destroy (image);
916 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
920 mask = _gdk_x11_window_create_bitmap_surface (gdk_screen_get_root_window (screen),
922 cr = cairo_create (mask);
923 image = cairo_image_surface_create_for_data (mask_data, CAIRO_FORMAT_A1,
924 width, height, data_stride);
925 cairo_set_source_surface (cr, image, 0, 0);
926 cairo_surface_destroy (image);
927 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
931 cursor = gdk_cursor_new_from_pixmap (display,
932 cairo_xlib_surface_get_drawable (pixmap),
933 cairo_xlib_surface_get_drawable (mask),
937 cairo_surface_destroy (pixmap);
938 cairo_surface_destroy (mask);
947 gdk_cursor_new_from_name (GdkDisplay *display,
950 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
956 gdk_display_supports_cursor_alpha (GdkDisplay *display)
958 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
964 gdk_display_supports_cursor_color (GdkDisplay *display)
966 g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
972 gdk_display_get_default_cursor_size (GdkDisplay *display)
974 g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
976 /* no idea, really */
984 * gdk_display_get_maximal_cursor_size:
985 * @display: a #GdkDisplay
986 * @width: (out): the return location for the maximal cursor width
987 * @height: (out): the return location for the maximal cursor height
989 * Gets the maximal size to use for cursors on @display.
994 gdk_display_get_maximal_cursor_size (GdkDisplay *display,
1001 g_return_if_fail (GDK_IS_DISPLAY (display));
1003 screen = gdk_display_get_default_screen (display);
1004 window = gdk_screen_get_root_window (screen);
1005 XQueryBestCursor (GDK_DISPLAY_XDISPLAY (display),
1006 GDK_WINDOW_XWINDOW (window),
1007 128, 128, width, height);