SpiceClientGLib.MainChannel

g GObject.Object GObject.Object SpiceClientGLib.Channel SpiceClientGLib.Channel GObject.Object->SpiceClientGLib.Channel SpiceClientGLib.MainChannel SpiceClientGLib.MainChannel SpiceClientGLib.Channel->SpiceClientGLib.MainChannel

Subclasses:

None

Methods

Inherited:

SpiceClientGLib.Channel (13), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

agent_test_capability (cap)

clipboard_selection_grab (selection, types)

clipboard_selection_notify (selection, type, data)

clipboard_selection_release (selection)

clipboard_selection_request (selection, type)

file_copy_async (sources, flags, cancellable, progress_callback, progress_callback_data, callback, *user_data)

file_copy_finish (result)

request_mouse_mode (mode)

send_monitor_config ()

update_display (id, x, y, width, height, update)

update_display_enabled (id, enabled, update)

update_display_mm (id, width_mm, height_mm, update)

Virtual Methods

Inherited:

SpiceClientGLib.Channel (8), GObject.Object (7)

Properties

Inherited:

SpiceClientGLib.Channel (5)

Name

Type

Flags

Short Description

agent-caps-0

int

r

Agent capability bits 0 -> 31

agent-connected

bool

r

Whether the agent is connected

color-depth

int

d/r/w/c

Color depth deprecated

disable-animation

bool

r/w/c

Disable guest animations

disable-display-align

bool

r/w/c

Disable display position alignment

disable-display-position

bool

r/w/c

Disable using display position when setting monitor config

disable-font-smooth

bool

r/w/c

Disable guest font smoothing

disable-wallpaper

bool

r/w/c

Disable guest wallpaper

max-clipboard

int

r/w/c

Maximum clipboard data size

mouse-mode

int

r

Mouse mode

Signals

Inherited:

SpiceClientGLib.Channel (2), GObject.Object (1)

Name

Short Description

main-agent-update

Notify when the SpiceClientGLib.MainChannel :agent-connected or SpiceClientGLib.MainChannel :agent-caps-0 property change.

main-clipboard

Provides guest clipboard data requested by SpiceClientGLib.main_clipboard_request(). deprecated

main-clipboard-grab

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

main-clipboard-release

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

main-clipboard-request

Request clipboard data from the client. deprecated

main-clipboard-selection

Informs that clipboard selection data are available.

main-clipboard-selection-grab

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

main-clipboard-selection-release

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

main-clipboard-selection-request

Request clipboard data from the client.

main-mouse-update

Notify when the mouse mode has changed.

migration-started

Inform when migration is starting.

new-file-transfer

This signal is emitted when a new file transfer task has been initiated on this channel.

Fields

Inherited:

SpiceClientGLib.Channel (2), GObject.Object (1)

Name

Type

Access

Description

parent

SpiceClientGLib.Channel

r

Class Details

class SpiceClientGLib.MainChannel(**kwargs)
Bases:

SpiceClientGLib.Channel

Abstract:

No

Structure:

SpiceClientGLib.MainChannelClass

The SpiceClientGLib.MainChannel struct is opaque and should not be accessed directly.

agent_test_capability(cap)
Parameters:

cap (int) – an agent capability identifier

Returns:

True if cap (channel kind capability) is available.

Return type:

bool

Test capability of a remote agent.

New in version 0.35.

clipboard_selection_grab(selection, types)
Parameters:
  • selection (int) – one of the clipboard #VD_AGENT_CLIPBOARD_SELECTION_*

  • types ([int]) – an array of #VD_AGENT_CLIPBOARD types available in the clipboard

Grab the guest clipboard, with #VD_AGENT_CLIPBOARD types.

New in version 0.35.

clipboard_selection_notify(selection, type, data)
Parameters:
  • selection (int) – one of the clipboard #VD_AGENT_CLIPBOARD_SELECTION_*

  • type (int) – a #VD_AGENT_CLIPBOARD type

  • data (bytes) – clipboard data

Send the clipboard data to the guest.

New in version 0.35.

clipboard_selection_release(selection)
Parameters:

selection (int) – one of the clipboard #VD_AGENT_CLIPBOARD_SELECTION_*

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

New in version 0.35.

clipboard_selection_request(selection, type)
Parameters:
  • selection (int) – one of the clipboard #VD_AGENT_CLIPBOARD_SELECTION_*

  • type (int) – a #VD_AGENT_CLIPBOARD type

Request clipboard data of type from the guest. The reply is sent through the SpiceClientGLib.MainChannel ::main-clipboard-selection signal.

New in version 0.35.

file_copy_async(sources, flags, cancellable, progress_callback, progress_callback_data, callback, *user_data)
Parameters:

Copies the file sources to guest

If cancellable is not None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.

If progress_callback is not None, then the operation can be monitored by setting this to a Gio.FileProgressCallback function. progress_callback_data will be passed to this function. It is guaranteed that this callback will be called after all data has been transferred with the total number of bytes copied during the operation. Note that before release 0.31, progress_callback was broken since it only provided status for a single file transfer, but did not provide a way to determine which file it referred to. In release 0.31, this behavior was changed so that progress_callback provides the status of all ongoing file transfers. If you need to monitor the status of individual files, please connect to the SpiceClientGLib.MainChannel ::new-file-transfer signal.

When the operation is finished, callback will be called. You can then call SpiceClientGLib.main_file_copy_finish() to get the result of the operation. Note that before release 0.33 the callback was called for each file in multiple file transfer. This behavior was changed for the same reason as the progress_callback (above). If you need to monitor the ending of individual files, you can connect to “finished” signal from each SpiceClientGLib.FileTransferTask.

New in version 0.35.

file_copy_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

a True on success, False on error.

Return type:

bool

Finishes copying the file started with SpiceClientGLib.main_file_copy_async().

request_mouse_mode(mode)
Parameters:

mode (int) – a SPICE_MOUSE_MODE

Request a mouse mode to the server. The server may not be able to change the mouse mode, but spice-gtk will try to request it when possible.

New in version 0.35.

send_monitor_config()
Returns:

True on success.

Return type:

bool

Send monitors configuration previously set with SpiceClientGLib.main_set_display() and SpiceClientGLib.main_set_display_enabled()

New in version 0.35.

update_display(id, x, y, width, height, update)
Parameters:
  • id (int) – display ID

  • x (int) – x position

  • y (int) – y position

  • width (int) – display width

  • height (int) – display height

  • update (bool) – if True, update guest resolution after 1sec.

Update the display id resolution.

If update is True, the remote configuration will be updated too after 1 second without further changes. You can send when you want without delay the new configuration to the remote with SpiceClientGLib.main_send_monitor_config()

New in version 0.35.

update_display_enabled(id, enabled, update)
Parameters:
  • id (int) – display ID (if -1: set all displays)

  • enabled (bool) – wether display id is enabled

  • update (bool) – if True, update guest display state after 1sec.

When sending monitor configuration to agent guest, if enabled is False, don’t set display id, which the agent translates to disabling the display id. If enabled is True, the monitor will be included in the next monitor update. Note: this will take effect next time the monitor configuration is sent.

If update is False, no server update will be triggered by this call, but the value will be saved and used in the next configuration update.

New in version 0.35.

update_display_mm(id, width_mm, height_mm, update)
Parameters:
  • id (int) – display ID

  • width_mm (int) – physical display width in millimeters

  • height_mm (int) – physical display height in millimeters

  • update (bool) – if True, update guest resolution after 1sec.

Update the display id physical size.

If update is True, the remote configuration will be updated too after 1 second without further changes. You can send when you want without delay the new configuration to the remote with SpiceClientGLib.main_send_monitor_config()

New in version 0.39.

Signal Details

SpiceClientGLib.MainChannel.signals.main_agent_update(main_channel)
Signal Name:

main-agent-update

Flags:

RUN_FIRST

Parameters:

main_channel (SpiceClientGLib.MainChannel) – The object which received the signal

Notify when the SpiceClientGLib.MainChannel :agent-connected or SpiceClientGLib.MainChannel :agent-caps-0 property change.

SpiceClientGLib.MainChannel.signals.main_clipboard(main_channel, type, data)
Signal Name:

main-clipboard

Flags:

RUN_LAST, DEPRECATED

Parameters:

Provides guest clipboard data requested by SpiceClientGLib.main_clipboard_request().

Deprecated since version 0.6: use SpiceClientGLib.MainChannel ::main-clipboard-selection instead.

SpiceClientGLib.MainChannel.signals.main_clipboard_grab(main_channel, types)
Signal Name:

main-clipboard-grab

Flags:

RUN_LAST, DEPRECATED

Parameters:
Return type:

bool

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

Deprecated since version 0.6: use SpiceClientGLib.MainChannel ::main-clipboard-selection-grab instead.

SpiceClientGLib.MainChannel.signals.main_clipboard_release(main_channel)
Signal Name:

main-clipboard-release

Flags:

RUN_LAST, DEPRECATED

Parameters:

main_channel (SpiceClientGLib.MainChannel) – The object which received the signal

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

Deprecated since version 0.6: use SpiceClientGLib.MainChannel ::main-clipboard-selection-release instead.

SpiceClientGLib.MainChannel.signals.main_clipboard_request(main_channel, types)
Signal Name:

main-clipboard-request

Flags:

RUN_LAST, DEPRECATED

Parameters:
Returns:

True if the request is successful

Return type:

bool

Request clipboard data from the client.

Deprecated since version 0.6: use SpiceClientGLib.MainChannel ::main-clipboard-selection-request instead.

SpiceClientGLib.MainChannel.signals.main_clipboard_selection(main_channel, selection, type, data)
Signal Name:

main-clipboard-selection

Flags:

RUN_LAST

Parameters:
  • main_channel (SpiceClientGLib.MainChannel) – The object which received the signal

  • selection (int) – a VD_AGENT_CLIPBOARD_SELECTION clipboard

  • type (int) – the VD_AGENT_CLIPBOARD data type

  • data (bytes) – clipboard data

Informs that clipboard selection data are available.

New in version 0.6.

SpiceClientGLib.MainChannel.signals.main_clipboard_selection_grab(main_channel, selection, types)
Signal Name:

main-clipboard-selection-grab

Flags:

RUN_LAST

Parameters:
  • main_channel (SpiceClientGLib.MainChannel) – The object which received the signal

  • selection (int) – a VD_AGENT_CLIPBOARD_SELECTION clipboard

  • types ([int]) – the VD_AGENT_CLIPBOARD data types

Return type:

bool

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

New in version 0.6.

SpiceClientGLib.MainChannel.signals.main_clipboard_selection_release(main_channel, selection)
Signal Name:

main-clipboard-selection-release

Flags:

RUN_LAST

Parameters:

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

New in version 0.6.

SpiceClientGLib.MainChannel.signals.main_clipboard_selection_request(main_channel, selection, types)
Signal Name:

main-clipboard-selection-request

Flags:

RUN_LAST

Parameters:
  • main_channel (SpiceClientGLib.MainChannel) – The object which received the signal

  • selection (int) – a VD_AGENT_CLIPBOARD_SELECTION clipboard

  • types (int) – the VD_AGENT_CLIPBOARD request type

Returns:

True if the request is successful

Return type:

bool

Request clipboard data from the client.

New in version 0.6.

SpiceClientGLib.MainChannel.signals.main_mouse_update(main_channel)
Signal Name:

main-mouse-update

Flags:

RUN_FIRST

Parameters:

main_channel (SpiceClientGLib.MainChannel) – The object which received the signal

Notify when the mouse mode has changed.

SpiceClientGLib.MainChannel.signals.migration_started(main_channel, session)
Signal Name:

migration-started

Flags:

RUN_LAST

Parameters:

Inform when migration is starting. Application wishing to make connections themself can set the SpiceClientGLib.Session :client-sockets to True, then follow SpiceClientGLib.Session ::channel-new creation, and use SpiceClientGLib.Channel.open_fd() once the socket is created.

SpiceClientGLib.MainChannel.signals.new_file_transfer(main_channel, task)
Signal Name:

new-file-transfer

Flags:

RUN_LAST

Parameters:

This signal is emitted when a new file transfer task has been initiated on this channel. Client applications may take a reference on the task object and use it to monitor the status of the file transfer task.

New in version 0.31.

Property Details

SpiceClientGLib.MainChannel.props.agent_caps_0
Name:

agent-caps-0

Type:

int

Default Value:

0

Flags:

READABLE

Agent capability bits 0 -> 31

SpiceClientGLib.MainChannel.props.agent_connected
Name:

agent-connected

Type:

bool

Default Value:

False

Flags:

READABLE

Whether the agent is connected

SpiceClientGLib.MainChannel.props.color_depth
Name:

color-depth

Type:

int

Default Value:

0

Flags:

DEPRECATED, READABLE, WRITABLE, CONSTRUCT

Color depth

Deprecated since version 0.37: Deprecated due lack of support in drivers, only Windows 7 and older. This option is currently ignored.

SpiceClientGLib.MainChannel.props.disable_animation
Name:

disable-animation

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT

Disable guest animations

SpiceClientGLib.MainChannel.props.disable_display_align
Name:

disable-display-align

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT

Disable automatic horizontal display position alignment.

New in version 0.13.

SpiceClientGLib.MainChannel.props.disable_display_position
Name:

disable-display-position

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, CONSTRUCT

Disable using display position when setting monitor config

SpiceClientGLib.MainChannel.props.disable_font_smooth
Name:

disable-font-smooth

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT

Disable guest font smoothing

SpiceClientGLib.MainChannel.props.disable_wallpaper
Name:

disable-wallpaper

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT

Disable guest wallpaper

SpiceClientGLib.MainChannel.props.max_clipboard
Name:

max-clipboard

Type:

int

Default Value:

104857600

Flags:

READABLE, WRITABLE, CONSTRUCT

Maximum size of clipboard operations in bytes (default 100MB, -1 for unlimited size);

New in version 0.22.

SpiceClientGLib.MainChannel.props.mouse_mode
Name:

mouse-mode

Type:

int

Default Value:

0

Flags:

READABLE

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.