## Cursor Channel

Cursor Channel — update cursor shape and position

## Stability Level

Stable, unless otherwise indicated

## Properties

SpiceCursorShape * | cursor | Read

## Signals

void | cursor-hide | Run First
void | cursor-move | Run First
void | cursor-reset | Run First
void | cursor-set | Run First

## Types and Values

struct | SpiceCursorChannel
struct | SpiceCursorChannelClass
struct | SpiceCursorShape

## Object Hierarchy

        GBoxed
        ╰── SpiceCursorShape
        GObject
        ╰── SpiceChannel
            ╰── SpiceCursorChannel

## Includes

    #include <spice-client.h>

## Description

The Spice protocol defines a set of messages for controlling cursor shape and position on the remote display area. The cursor changes that should be reflected on the display are notified by signals. See for example “cursor-set” and “cursor-move” signals and the “cursor” property.

## Functions

## Types and Values

### struct SpiceCursorChannel

    struct SpiceCursorChannel;

The SpiceCursorChannel struct is opaque and should not be accessed directly.

### struct SpiceCursorChannelClass

    struct SpiceCursorChannelClass {
        SpiceChannelClass parent_class;

        /* signals */
        void (*cursor_set)(SpiceCursorChannel *channel, gint width, gint height,
                           gint hot_x, gint hot_y, gpointer rgba);
        void (*cursor_move)(SpiceCursorChannel *channel, gint x, gint y);
        void (*cursor_hide)(SpiceCursorChannel *channel);
        void (*cursor_reset)(SpiceCursorChannel *channel);
    };

Class structure for SpiceCursorChannel.

#### Members

`cursor_set` () | Signal class handler for the “cursor-set” signal. |
`cursor_move` () | Signal class handler for the “cursor-move” signal. |
`cursor_hide` () | Signal class handler for the “cursor-hide” signal. |
`cursor_reset` () | Signal class handler for the “cursor-reset” signal. |

### struct SpiceCursorShape

    struct SpiceCursorShape {
        SpiceCursorType type;
        guint16 width;
        guint16 height;
        guint16 hot_spot_x;
        guint16 hot_spot_y;
        gpointer data;
    };

The SpiceCursorShape structure defines the remote cursor's shape.

#### Members

SpiceCursorType `type`; | a SpiceCursorType of `data` |
guint16 `width`; | a width of the remote cursor |
guint16 `height`; | a height of the remote cursor |
guint16 `hot_spot_x`; | a 'x' coordinate of the remote cursor |
guint16 `hot_spot_y`; | a 'y' coordinate of the remote cursor |
gpointer `data`; | image data of the remote cursor |

## Property Details

### The `“cursor”` property

      “cursor”                   SpiceCursorShape *

The last SpiceCursorShape received.

Flags: Read

Since: 0.34

## Signal Details

### The `“cursor-hide”` signal

    void
    user_function (SpiceCursorChannel *cursor,
                   gpointer            user_data)

The “cursor-hide” signal is emitted to hide the cursor/pointer on the display area.

#### Parameters

cursor | the SpiceCursorChannel that emitted the signal |
user_data | user data set when the signal handler was connected. |

Flags: Run First

### The `“cursor-move”` signal

    void
    user_function (SpiceCursorChannel *cursor,
                   gint                x,
                   gint                y,
                   gpointer            user_data)

The “cursor-move” signal is emitted to update the cursor position on the display area.

#### Parameters

cursor | the SpiceCursorChannel that emitted the signal |
x | x position |
y | y position |
user_data | user data set when the signal handler was connected. |

Flags: Run First

### The `“cursor-reset”` signal

    void
    user_function (SpiceCursorChannel *cursor,
                   gpointer            user_data)

The “cursor-reset” signal is emitted to reset the cursor to its default context.

#### Parameters

cursor | the SpiceCursorChannel that emitted the signal |
user_data | user data set when the signal handler was connected. |

Flags: Run First

### The `“cursor-set”` signal

    void
    user_function (SpiceCursorChannel *cursor,
                   gint                width,
                   gint                height,
                   gint                hot_x,
                   gint                hot_y,
                   gpointer            rgba,
                   gpointer            user_data)

The “cursor-set” signal is emitted to modify cursor aspect and position on the display area.

`SpiceCursorChannel::cursor-set` has been deprecated since version 0.34 and should not be used in newly-written code.

Use “cursor” notify instead.

#### Parameters

cursor | the SpiceCursorChannel that emitted the signal |
width | width of the shape |
height | height of the shape |
hot_x | horizontal offset of the 'hotspot' of the cursor |
hot_y | vertical offset of the 'hotspot' of the cursor |
rgba | 32bits shape data, or `NULL` if default cursor. It might be freed after the signal is emitted, so make sure to copy it if you need it later! |
user_data | user data set when the signal handler was connected. |

Flags: Run First

## See Also

SpiceChannel, and the GTK widget SpiceDisplay