Main Channel

Main Channel — the main Spice channel

Stability Level

Stable, unless otherwise indicated

Synopsis

#include <channel-main.h>

                    SpiceMainChannel;
                    SpiceMainChannelClass;
typedef             spice_main_channel;
void                spice_main_set_display              (SpiceMainChannel *channel,
                                                         int id,
                                                         int x,
                                                         int y,
                                                         int width,
                                                         int height);
void                spice_main_clipboard_grab           (SpiceMainChannel *channel,
                                                         guint32 *types,
                                                         int ntypes);
void                spice_main_clipboard_release        (SpiceMainChannel *channel);
void                spice_main_clipboard_notify         (SpiceMainChannel *channel,
                                                         guint32 type,
                                                         const guchar *data,
                                                         size_t size);
void                spice_main_clipboard_request        (SpiceMainChannel *channel,
                                                         guint32 type);

Object Hierarchy

  GObject
   +----SpiceChannel
         +----SpiceMainChannel

Properties

  "agent-caps-0"             gint                  : Read
  "agent-connected"          gboolean              : Read
  "color-depth"              guint                 : Read / Write / Construct
  "disable-animation"        gboolean              : Read / Write / Construct
  "disable-font-smooth"      gboolean              : Read / Write / Construct
  "disable-wallpaper"        gboolean              : Read / Write / Construct
  "mouse-mode"               gint                  : Read
  "set-color-depth"          gboolean              : Read / Write / Construct

Signals

  "main-agent-update"                              : Run First
  "main-clipboard"                                 : Run Last
  "main-clipboard-grab"                            : Run Last
  "main-clipboard-release"                         : Run Last
  "main-clipboard-request"                         : Run Last
  "main-mouse-update"                              : Run First
  "migration-started"                              : Run Last

Description

The main channel is the Spice session control channel. It handles communication initialization (channels list), migrations, mouse modes, multimedia time, and agent communication.

Details

SpiceMainChannel

typedef struct _SpiceMainChannel SpiceMainChannel;

SpiceMainChannelClass

typedef struct {
    SpiceChannelClass parent_class;

    /* signals */
    void (*mouse_update)(SpiceChannel *channel);
    void (*agent_update)(SpiceChannel *channel);
} SpiceMainChannelClass;

spice_main_channel

typedef struct spice_main_channel spice_main_channel;

spice_main_set_display ()

void                spice_main_set_display              (SpiceMainChannel *channel,
                                                         int id,
                                                         int x,
                                                         int y,
                                                         int width,
                                                         int height);

Notify the guest of screen resolution change. The notification is sent 1 second later, if no further changes happen.

id :

display channel ID

x :

x position

y :

y position

width :

display width

height :

display height

spice_main_clipboard_grab ()

void                spice_main_clipboard_grab           (SpiceMainChannel *channel,
                                                         guint32 *types,
                                                         int ntypes);

Grab the guest clipboard, with VD_AGENT_CLIPBOARD types.

types :

an array of VD_AGENT_CLIPBOARD types available in the clipboard

ntypes :

the number of types

spice_main_clipboard_release ()

void                spice_main_clipboard_release        (SpiceMainChannel *channel);

Release the clipboard (for example, when the client looses the clipboard grab): Inform the guest no clipboard data is available.


spice_main_clipboard_notify ()

void                spice_main_clipboard_notify         (SpiceMainChannel *channel,
                                                         guint32 type,
                                                         const guchar *data,
                                                         size_t size);

Send the clipboard data to the guest.

type :

a VD_AGENT_CLIPBOARD type

data :

clipboard data

size :

data length in bytes

spice_main_clipboard_request ()

void                spice_main_clipboard_request        (SpiceMainChannel *channel,
                                                         guint32 type);

Request clipboard data of type from the guest. The reply is sent through the "main-clipboard" signal.

type :

a VD_AGENT_CLIPBOARD type

Property Details

The "agent-caps-0" property

  "agent-caps-0"             gint                  : Read

Agent capability bits 0 -> 31.

Allowed values: >= 0

Default value: 0


The "agent-connected" property

  "agent-connected"          gboolean              : Read

Whether the agent is connected.

Default value: FALSE


The "color-depth" property

  "color-depth"              guint                 : Read / Write / Construct

Color depth.

Allowed values: [8,32]

Default value: 32


The "disable-animation" property

  "disable-animation"        gboolean              : Read / Write / Construct

Disable guest animations.

Default value: FALSE


The "disable-font-smooth" property

  "disable-font-smooth"      gboolean              : Read / Write / Construct

Disable guest font smoothing.

Default value: FALSE


The "disable-wallpaper" property

  "disable-wallpaper"        gboolean              : Read / Write / Construct

Disable guest wallpaper.

Default value: FALSE


The "mouse-mode" property

  "mouse-mode"               gint                  : Read

Spice protocol specifies two mouse modes, client mode and server mode. In client mode (SPICE_MOUSE_MODE_CLIENT), the affective mouse is the client side mouse: the client sends mouse position within the display and the server sends mouse shape messages. In server mode (SPICE_MOUSE_MODE_SERVER), the client sends relative mouse movements and the server sends position and shape commands.

Allowed values: >= 0

Default value: 0


The "set-color-depth" property

  "set-color-depth"          gboolean              : Read / Write / Construct

Set display color depth.

Default value: FALSE

Signal Details

The "main-agent-update" signal

void                user_function                      (SpiceMainChannel *spicemainchannel,
                                                        gpointer          user_data)             : Run First

The "main-clipboard" signal

void                user_function                      (SpiceMainChannel *main,
                                                        guint             type,
                                                        gpointer          data,
                                                        guint             size,
                                                        gpointer          user_data)      : Run Last

Provides guest clipboard data requested by spice_main_clipboard_request().

main :

the SpiceMainChannel that emitted the signal

type :

the VD_AGENT_CLIPBOARD data type

data :

clipboard data

size :

size of data in bytes

user_data :

user data set when the signal handler was connected.

The "main-clipboard-grab" signal

gboolean            user_function                      (SpiceMainChannel *main,
                                                        gpointer          types,
                                                        guint             ntypes,
                                                        gpointer          user_data)      : Run Last

Inform when clipboard data is available from the guest, and for which types.

main :

the SpiceMainChannel that emitted the signal

types :

the VD_AGENT_CLIPBOARD data types

ntypes :

the number of types

user_data :

user data set when the signal handler was connected.

The "main-clipboard-release" signal

void                user_function                      (SpiceMainChannel *main,
                                                        gpointer          user_data)      : Run Last

Inform when the clipboard is released from the guest, when no clipboard data is available from the guest.

main :

the SpiceMainChannel that emitted the signal

user_data :

user data set when the signal handler was connected.

The "main-clipboard-request" signal

gboolean            user_function                      (SpiceMainChannel *main,
                                                        guint             types,
                                                        gpointer          user_data)      : Run Last

Request clipbard data from the client.

main :

the SpiceMainChannel that emitted the signal

types :

the VD_AGENT_CLIPBOARD request type Returns: TRUE if the request is successful

user_data :

user data set when the signal handler was connected.

The "main-mouse-update" signal

void                user_function                      (SpiceMainChannel *main,
                                                        gpointer          user_data)      : Run First

Notify when the mouse mode has changed.

main :

the SpiceMainChannel that emitted the signal

user_data :

user data set when the signal handler was connected.

The "migration-started" signal

void                user_function                      (SpiceMainChannel *main,
                                                        GObject          *session,
                                                        gpointer          user_data)      : Run Last

Inform when migration is starting. Application wishing to make connections themself can set the "client-sockets" to TRUE, then follow "channel-new" creation, and use spice_channel_open_fd() once the socket is created.

main :

the SpiceMainChannel that emitted the signal

session :

a migration SpiceSession

user_data :

user data set when the signal handler was connected.

See Also

SpiceChannel, and the GTK widget SpiceDisplay