Class

GdkCursor

Description [src]

final class Gdk.Cursor : GObject.Object
{
  /* No available fields */
}

GdkCursor is used to create and destroy cursors.

Cursors are immutable objects, so once you created them, there is no way to modify them later. You should create a new cursor when you want to change something about it.

Cursors by themselves are not very interesting: they must be bound to a window for users to see them. This is done with gdk_surface_set_cursor() or gdk_surface_set_device_cursor(). Applications will typically use higher-level GTK functions such as gtk_widget_set_cursor() instead.

Cursors are not bound to a given GdkDisplay, so they can be shared. However, the appearance of cursors may vary when used on different platforms.

Named and texture cursors

There are multiple ways to create cursors. The platform’s own cursors can be created with gdk_cursor_new_from_name(). That function lists the commonly available names that are shared with the CSS specification. Other names may be available, depending on the platform in use. On some platforms, what images are used for named cursors may be influenced by the cursor theme.

Another option to create a cursor is to use gdk_cursor_new_from_texture() and provide an image to use for the cursor.

To ease work with unsupported cursors, a fallback cursor can be provided. If a GdkSurface cannot use a cursor because of the reasons mentioned above, it will try the fallback cursor. Fallback cursors can themselves have fallback cursors again, so it is possible to provide a chain of progressively easier to support cursors. If none of the provided cursors can be supported, the default cursor will be the ultimate fallback.

Hierarchy

hierarchy this GdkCursor ancestor_0 GObject ancestor_0--this

Ancestors

Constructors

gdk_cursor_new_from_callback

Creates a new callback-based cursor object.

since: 4.16

gdk_cursor_new_from_name

Creates a new cursor by looking up name in the current cursor theme.

gdk_cursor_new_from_texture

Creates a new cursor from a GdkTexture.

Instance methods

gdk_cursor_get_fallback

Returns the fallback for this cursor.

gdk_cursor_get_hotspot_x

Returns the horizontal offset of the hotspot.

gdk_cursor_get_hotspot_y

Returns the vertical offset of the hotspot.

gdk_cursor_get_name

Returns the name of the cursor.

gdk_cursor_get_texture

Returns the texture for the cursor.

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

Gdk.Cursor:fallback

Cursor to fall back to if this cursor cannot be displayed.

Gdk.Cursor:hotspot-x

X position of the cursor hotspot in the cursor image.

Gdk.Cursor:hotspot-y

Y position of the cursor hotspot in the cursor image.

Gdk.Cursor:name

Name of this this cursor.

Gdk.Cursor:texture

The texture displayed by this cursor.

Signals

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.