Inputs Channel

Inputs Channel — control the server mouse and keyboard

Stability Level

Stable, unless otherwise indicated

Functions

Properties

Signals

Types and Values

Object Hierarchy

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

Includes

#include <spice-client.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

channel

a SpiceInputsChannel

 

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

channel

a SpiceInputsChannel

 

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

channel

a SpiceInputsChannel

 

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

channel

a SpiceInputsChannel

 

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

channel

a SpiceInputsChannel

 

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

channel

a SpiceInputsChannel

 

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

channel

a SpiceInputsChannel

 

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

channel

a SpiceInputsChannel

 

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

Constants used to synchronize modifiers between a client and a guest.

Members

SPICE_INPUTS_SCROLL_LOCK

Scroll Lock

 

SPICE_INPUTS_NUM_LOCK

Num Lock

 

SPICE_INPUTS_CAPS_LOCK

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 *display,
               gpointer            user_data)

The “inputs-modifiers” signal is emitted when the guest keyboard locks are changed. You can read the current state from “key-modifiers” property.

Parameters

display

the SpiceInputsChannel that emitted the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First

See Also

SpiceChannel, and the GTK widget SpiceDisplay