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

## Stability Level

Stable, unless otherwise indicated

## Functions

void | spice_inputs_motion ()
void | spice_inputs_position ()
void | spice_inputs_button_press ()
void | spice_inputs_button_release ()
void | spice_inputs_key_press ()
void | spice_inputs_key_press_and_release ()
void | spice_inputs_key_release ()
void | spice_inputs_set_key_locks ()

## Properties

gint | key-modifiers | Read

## Signals

void | inputs-modifiers | Run First

## Types and Values

struct | SpiceInputsChannel
struct | SpiceInputsChannelClass
enum | SpiceInputsLock

## Object Hierarchy

        GFlags
        ╰── SpiceInputsLock
        GObject
        ╰── SpiceChannel
            ╰── SpiceInputsChannel

## Includes

    #include <channel-inputs.h>

## 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 a modified variant of PC XT scancodes.

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.

## Functions

### 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).

#### Parameters

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).

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

scancode | a PC XT (set 1) key scancode. For scancodes with an `0xe0` prefix, drop the prefix and OR the scancode with `0x100`. |

### 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).

#### Parameters

scancode | a PC XT (set 1) key scancode. For scancodes with an `0xe0` prefix, drop the prefix and OR the scancode with `0x100`. |

Since 0.13

### spice_inputs_key_release ()

    void
    spice_inputs_key_release (SpiceInputsChannel *channel,
                              guint scancode);

Release a key.

#### Parameters

scancode | a PC XT (set 1) key scancode. For scancodes with an `0xe0` prefix, drop the prefix and OR the scancode with `0x100`. |

### 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..)

#### Parameters

locks | SpiceInputsLock modifiers flags |

## Types and Values

### 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.

#### Members

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

### enum SpiceInputsLock

#### Members

SPICE_INPUTS_SCROLL_LOCK |  |
SPICE_INPUTS_NUM_LOCK |  |
SPICE_INPUTS_CAPS_LOCK |  |

## Property Details

### The `“key-modifiers”` property

      “key-modifiers”            gint

Guest keyboard lock/led state.

Flags: Read

Allowed values: >= 0

Default value: 0

## Signal Details

### The `“inputs-modifiers”` signal

    void
    user_function (SpiceInputsChannel *spiceinputschannel,
                   gpointer            user_data)

Flags: Run First

## See Also

SpiceChannel, and the GTK widget SpiceDisplay