## Inputs Channel Inputs Channel — control the server mouse and keyboard |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

    #include <channel-inputs.h>

    struct              SpiceInputsChannel;
    struct              SpiceInputsChannelClass;
    enum                SpiceInputsLock;

    void                spice_inputs_motion                 (SpiceInputsChannel *channel,
                                                             gint dx,
                                                             gint dy,
                                                             gint button_state);
    void                spice_inputs_position               (SpiceInputsChannel *channel,
                                                             gint x,
                                                             gint y,
                                                             gint display,
                                                             gint button_state);
    void                spice_inputs_button_press           (SpiceInputsChannel *channel,
                                                             gint button,
                                                             gint button_state);
    void                spice_inputs_button_release         (SpiceInputsChannel *channel,
                                                             gint button,
                                                             gint button_state);
    void                spice_inputs_key_press              (SpiceInputsChannel *channel,
                                                             guint scancode);
    void                spice_inputs_key_press_and_release  (SpiceInputsChannel *channel,
                                                             guint scancode);
    void                spice_inputs_key_release            (SpiceInputsChannel *channel,
                                                             guint scancode);
    void                spice_inputs_set_key_locks          (SpiceInputsChannel *channel,
                                                             guint locks);

## Object Hierarchy

      GObject
       +----SpiceChannel
             +----SpiceInputsChannel

      GFlags
       +----SpiceInputsLock

## Properties

      "key-modifiers"            gint                  : Read

## Signals

      "inputs-modifiers"                               : Run First

## Description

Spice supports sending keyboard key events and keyboard leds synchronization. The key events are sent using `spice_inputs_key_press()` and `spice_inputs_key_release()` using PC AT scancode.

Guest keyboard leds state can be manipulated with `spice_inputs_set_key_locks()`. When key lock change, a notification is emitted with "inputs-modifiers" signal.

## Details

### struct SpiceInputsChannel

    struct SpiceInputsChannel;

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

### struct SpiceInputsChannelClass

    struct SpiceInputsChannelClass {
        SpiceChannelClass parent_class;

        /* signals */
        void (*inputs_modifiers)(SpiceChannel *channel);
    };

Class structure for SpiceInputsChannel.

SpiceChannelClass `parent_class`; | Parent class.
`inputs_modifiers` () | Signal class handler for the "inputs-modifiers" signal.

### enum SpiceInputsLock

    typedef enum {
        SPICE_INPUTS_SCROLL_LOCK = (1 << 0),
        SPICE_INPUTS_NUM_LOCK    = (1 << 1),
        SPICE_INPUTS_CAPS_LOCK   = (1 << 2)
    } SpiceInputsLock;

### spice_inputs_motion ()

    void                spice_inputs_motion                 (SpiceInputsChannel *channel,
                                                             gint dx,
                                                             gint dy,
                                                             gint button_state);

Change mouse position (used in SPICE_MOUSE_MODE_CLIENT).

`dx` : | delta X mouse coordinates
`dy` : | delta Y mouse coordinates
`button_state` : | SPICE_MOUSE_BUTTON_MASK flags

### spice_inputs_position ()

    void                spice_inputs_position               (SpiceInputsChannel *channel,
                                                             gint x,
                                                             gint y,
                                                             gint display,
                                                             gint button_state);

Change mouse position (used in SPICE_MOUSE_MODE_CLIENT).

`x` : | X mouse coordinates
`y` : | Y mouse coordinates
`display` : | display channel id
`button_state` : | SPICE_MOUSE_BUTTON_MASK flags

### spice_inputs_button_press ()

    void                spice_inputs_button_press           (SpiceInputsChannel *channel,
                                                             gint button,
                                                             gint button_state);

Press a mouse button.

`button` : | a SPICE_MOUSE_BUTTON
`button_state` : | SPICE_MOUSE_BUTTON_MASK flags

### spice_inputs_button_release ()

    void                spice_inputs_button_release         (SpiceInputsChannel *channel,
                                                             gint button,
                                                             gint button_state);

Release a button.

`button` : | a SPICE_MOUSE_BUTTON
`button_state` : | SPICE_MOUSE_BUTTON_MASK flags

### spice_inputs_key_press ()

    void                spice_inputs_key_press              (SpiceInputsChannel *channel,
                                                             guint scancode);

Press a key.

`scancode` : | a PC AT key scancode

### spice_inputs_key_press_and_release ()

    void                spice_inputs_key_press_and_release  (SpiceInputsChannel *channel,
                                                             guint scancode);

Press and release a key event atomically (in the same message).

`scancode` : | a PC AT key scancode

Since 0.13

### spice_inputs_key_release ()

    void                spice_inputs_key_release            (SpiceInputsChannel *channel,
                                                             guint scancode);

Release a key.

`scancode` : | a PC AT key scancode

### spice_inputs_set_key_locks ()

    void                spice_inputs_set_key_locks          (SpiceInputsChannel *channel,
                                                             guint locks);

Set the keyboard locks on the guest (Caps, Num, Scroll..)

`locks` : | SpiceInputsLock modifiers flags

## Property Details

### The `"key-modifiers"` property

      "key-modifiers"            gint                  : Read

Guest keyboard lock/led state.

Allowed values: >= 0

Default value: 0

## Signal Details

### The `"inputs-modifiers"` signal

    void                user_function                      (SpiceInputsChannel *spiceinputschannel,
                                                            gpointer            user_data)               : Run First

## See Also

SpiceChannel, and the GTK widget SpiceDisplay