GVnc.Connection

g GObject.Object GObject.Object GVnc.Connection GVnc.Connection GObject.Object->GVnc.Connection

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

audio_disable ()

audio_enable ()

client_cut_text (data, length)

framebuffer_update_request (incremental, x, y, width, height)

get_abs_pointer ()

get_audio_format ()

get_cursor ()

get_ext_key_event ()

get_height ()

get_ledstate ()

get_name ()

get_pixel_format ()

get_power_control ()

get_shared ()

get_width ()

has_error ()

is_initialized ()

is_open ()

key_event (down_flag, key, scancode)

open_addr (addr, hostname)

open_fd (fd)

open_fd_with_hostname (fd, hostname)

open_host (host, port)

pointer_event (button_mask, x, y)

power_control (action)

set_audio (audio)

set_audio_format (fmt)

set_auth_subtype (type)

set_auth_type (type)

set_credential (type, data)

set_encodings (encoding)

set_framebuffer (fb)

set_pixel_format (fmt)

set_shared (shared)

set_size (width, height)

shutdown ()

Virtual Methods

Inherited:

GObject.Object (7)

do_vnc_auth_choose_subtype (type, subtypes)

do_vnc_auth_choose_type (types)

do_vnc_auth_credential (creds)

do_vnc_auth_failure (reason)

do_vnc_auth_unsupported (authType)

do_vnc_bell ()

do_vnc_connected ()

do_vnc_cursor_changed (cursor)

do_vnc_desktop_rename (name)

do_vnc_desktop_resize (width, height)

do_vnc_disconnected ()

do_vnc_error (message)

do_vnc_framebuffer_update (x, y, width, height)

do_vnc_initialized ()

do_vnc_led_state ()

do_vnc_pixel_format_changed (format)

do_vnc_pointer_mode_changed (absPointer)

do_vnc_power_control_failed ()

do_vnc_power_control_initialized ()

do_vnc_server_cut_text (text)

Properties

Name

Type

Flags

Short Description

framebuffer

GVnc.Framebuffer

r/w

The desktop framebuffer instance

Signals

Inherited:

GObject.Object (1)

Name

Short Description

vnc-auth-choose-subtype

vnc-auth-choose-type

vnc-auth-credential

vnc-auth-failure

vnc-auth-unsupported

vnc-bell

vnc-connected

vnc-cursor-changed

Emitted when the cursor is changed.

vnc-desktop-rename

vnc-desktop-resize

vnc-disconnected

vnc-error

vnc-framebuffer-update

vnc-initialized

vnc-led-state

vnc-pixel-format-changed

vnc-pointer-mode-changed

vnc-power-control-failed

vnc-power-control-initialized

vnc-server-cut-text

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class GVnc.Connection(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

GVnc.ConnectionClass

classmethod new()
Returns:

the new connection

Return type:

GVnc.Connection

Create a new connection object, which is initially in the disconnected state.

audio_disable()
Returns:

True if the connection is ok, False if it has an error

Return type:

bool

Tell the server that it is no longer permitted to send audio. The client may continue to receive audio for a time after this, since packets may already be in flight.

audio_enable()
Returns:

True if the connection is ok, False if it has an error

Return type:

bool

Tell the server that it is permitted to send audio data.

client_cut_text(data, length)
Parameters:
Return type:

bool

framebuffer_update_request(incremental, x, y, width, height)
Parameters:
  • incremental (bool) – True to only receive region with changes

  • x (int) – horizontal offset to region of update

  • y (int) – vertical offset to region of update

  • width (int) – horizontal size of region of update

  • height (int) – vertical size of region of update

Returns:

True if the connection is ok, False if it has an error

Return type:

bool

Request that the server send a framebuffer update when the region positioned at (x, y) wth size (width, height) sees damage. The update sent may be a subset of the region requested, if incremental is False.

get_abs_pointer()
Returns:

True if the server supports absolute pointer mode

Return type:

bool

Determine if the remote server supports absolute pointer motion events. This will only be valid once the “vnc-initialized” signal has been emitted.

get_audio_format()
Returns:

the current audio format

Return type:

GVnc.AudioFormat

Get the current audio format specification

get_cursor()
Returns:

the cursor or None

Return type:

GVnc.Cursor

Get the cursor currently associated with the desktop, if any.

get_ext_key_event()
Returns:

True if supported, False otherwise

Return type:

bool

Determine if the remote server supports the extended keyboard event which transmits raw XT scancodes. This will only be valid once the “vnc-initialized” signal has been emitted

get_height()
Returns:

the desktop height

Return type:

int

Get the height of the remote display. The height will only be set once the “vnc-initialized” signal has been emitted

get_ledstate()
Returns:

the LED state

Return type:

int

Get the current LED state bitmap. This is only valid once the “vnc-initialized” signal has been emitted.

get_name()
Returns:

the remote display name

Return type:

str

Get the name of the remote display. A name will only be available once the “vnc-initialized” signal has been emitted

get_pixel_format()
Returns:

the current pixel format

Return type:

GVnc.PixelFormat

Get a specification of the current pixel format

get_power_control()
Returns:

True if the server supports power control

Return type:

bool

Determine if the remote server supports power control. This will only be valid once the “vnc-initialized” signal has been emitted.

get_shared()
Returns:

True if other clients are permitted, False otherwise

Return type:

bool

Get the sharing state for the connection

get_width()
Returns:

the desktop width

Return type:

int

Get the width of the remote display. The width will only be set once the “vnc-initialized” signal has been emitted

has_error()
Returns:

True if an error has occurred, False otherwise

Return type:

bool

Determine if the current connection is in an error state

is_initialized()
Returns:

True if initialized, False if closed or still negotiating

Return type:

bool

Determine if the connection to the remote desktop is fully initialized and thus receiving framebuffer updates.

is_open()
Returns:

True if open, False if closing/closed

Return type:

bool

Check if the connection is currently open

key_event(down_flag, key, scancode)
Parameters:
  • down_flag (bool) – True if this is a key press, False for a key release

  • key (int) – the X11 key code

  • scancode (int) – the XT scan code

Returns:

True if the connection is ok, False if it has an error

Return type:

bool

Send a key press/release event to the server. By default the event will be sent with the X11 key code from key. If the extended key event protocol extension is active, the scancode will be sent instead.

open_addr(addr, hostname)
Parameters:
Returns:

True if a connection was opened, False if already open

Return type:

bool

Open a socket connection to server identified by addr. addr may refer to either a TCP address (IPv4/6) or a UNIX socket address. The hostname provided should reflect the name of the host that the addr provides a connection to, if it is not already available in addr. For example, if addr points to a proxy server, then hostname can be used to provide the name of the final endpoint. This will be used by some authentication schemes, for example x509 certificate validation against hostname.

open_fd(fd)
Parameters:

fd (int) – file descriptor to use for the connection

Returns:

True if a connection was opened, False if already open

Return type:

bool

Open a connection using fd as the transport. If fd refers to a TCP connection, it is recommended to use GVnc.Connection.open_fd_with_hostname instead, to provide the remote hostname. This allows use of x509 based authentication which requires a hostname to be available.

open_fd_with_hostname(fd, hostname)
Parameters:
  • fd (int) – file descriptor to use for the connection

  • hostname (str or None) – the host associated with the connection

Returns:

True if a connection was opened, False if already open

Return type:

bool

Open a connection using fd as the transport. The hostname provided should reflect the name of the host that the fd provides a connection to. This will be used by some authentication schemes, for example x509 certificate validation against hostname.

open_host(host, port)
Parameters:
  • host (str) – the host name or IP address

  • port (str) – the service name or port number

Returns:

True if a connection was opened, False if already open

Return type:

bool

Open a TCP connection to the remote desktop at host listening on port.

pointer_event(button_mask, x, y)
Parameters:
  • button_mask (int) – the new state of the buttons

  • x (int) – the new horizontal position of the pointer

  • y (int) – the new veritical position of the pointer

Returns:

True if the connection is ok, False if it has an error

Return type:

bool

Send a pointer event to the server, reflecting either movement of the pointer, or a change in state of its buttons, or both.

power_control(action)
Parameters:

action (GVnc.ConnectionPowerAction) –

Returns:

True if the action was sent, False if power control is not supported

Return type:

bool

Perform a power control action on the remote server.

This is only valid if the “vnc-power-control” signal has been emitted with a VNC_CONNECTION_POWER_STATUS_INIT code.

The action should be assumed to be accepted unless “vnc-power-control” signal is emitted with a VNC_CONNECTION_POWER_STATUS_FAIL code.

set_audio(audio)
Parameters:

audio (GVnc.Audio) – the audio sink

Returns:

True if the connection is ok, False if it has an error

Return type:

bool

Set the audio sink to use for playing back audio from the remote session.

set_audio_format(fmt)
Parameters:

fmt (GVnc.AudioFormat) – the audio format

Returns:

True if the connection is ok, False if it has an error

Return type:

bool

Set the audio format specification to use for playback from the remote session. The format should only be set when the audio stream is not active, otherwise it will be impossible to determine when the server has switched to sending data in the new format

set_auth_subtype(type)
Parameters:

type (int) – the auth sub-type

Returns:

True if the connection is ok, False if it has an error

Return type:

bool

If a multi-level authentication scheme was requested, this identifies which auth type to use for the second phase.

set_auth_type(type)
Parameters:

type (int) – the requested auth type

Returns:

True if the connection is ok, False if it has an error

Return type:

bool

Set the authentication type to use to complete the connection.

set_credential(type, data)
Parameters:
  • type (int) – the authentication credential type

  • data (str) – the value associated with the credential

Returns:

True if the connection is ok, False if it has an error

Return type:

bool

Sets the value of the authentication credential type to the string data.

type is one of the GVnc.ConnectionCredential enum vlaues

set_encodings(encoding)
Parameters:

encoding ([int]) – the list of permitted encodings

Returns:

True if the connection is ok, False if it has an error

Return type:

bool

Inform the server of the list of encodings that it is allowed to send. This should be done before requesting any framebuffer updates

set_framebuffer(fb)
Parameters:

fb (GVnc.Framebuffer) – the framebuffer object

Returns:

True if the connection is ok, False if it has an error

Return type:

bool

Set the framebuffer object to which frame buffer updates will be written.

set_pixel_format(fmt)
Parameters:

fmt (GVnc.PixelFormat) – the new pixel format

Returns:

True if the connection is ok, False if it has an error

Return type:

bool

Tell the server what pixel format to use for framebuffer updates. It is only safe to use this when no framebuffer updates are pending, otherwise it is impossible to determine when the server has switched over to using the new format.

set_shared(shared)
Parameters:

shared (bool) – the new sharing state

Returns:

True if the connection is ok, False if it has an error

Return type:

bool

Set the shared state for the connection. A True value allow allow this client to co-exist with other existing clients. A False value will cause other clients to be dropped

set_size(width, height)
Parameters:
  • width (int) –

  • height (int) –

Return type:

GVnc.ConnectionResizeStatus

shutdown()

Initiate a shutdown of the current connection by closing its socket

do_vnc_auth_choose_subtype(type, subtypes) virtual
Parameters:
do_vnc_auth_choose_type(types) virtual
Parameters:

types (GObject.ValueArray) –

do_vnc_auth_credential(creds) virtual
Parameters:

creds (GObject.ValueArray) –

do_vnc_auth_failure(reason) virtual
Parameters:

reason (str) –

do_vnc_auth_unsupported(authType) virtual
Parameters:

authType (int) –

do_vnc_bell() virtual
do_vnc_connected() virtual
do_vnc_cursor_changed(cursor) virtual
Parameters:

cursor (GVnc.Cursor) –

do_vnc_desktop_rename(name) virtual
Parameters:

name (str) –

do_vnc_desktop_resize(width, height) virtual
Parameters:
  • width (int) –

  • height (int) –

do_vnc_disconnected() virtual
do_vnc_error(message) virtual
Parameters:

message (str) –

do_vnc_framebuffer_update(x, y, width, height) virtual
Parameters:
do_vnc_initialized() virtual
do_vnc_led_state() virtual
do_vnc_pixel_format_changed(format) virtual
Parameters:

format (GVnc.PixelFormat) –

do_vnc_pointer_mode_changed(absPointer) virtual
Parameters:

absPointer (bool) –

do_vnc_power_control_failed() virtual
do_vnc_power_control_initialized() virtual
do_vnc_server_cut_text(text) virtual
Parameters:

text (GLib.String) –

Signal Details

GVnc.Connection.signals.vnc_auth_choose_subtype(connection, object, p0)
Signal Name:

vnc-auth-choose-subtype

Flags:

RUN_FIRST

Parameters:
GVnc.Connection.signals.vnc_auth_choose_type(connection, object)
Signal Name:

vnc-auth-choose-type

Flags:

RUN_FIRST

Parameters:
GVnc.Connection.signals.vnc_auth_credential(connection, object)
Signal Name:

vnc-auth-credential

Flags:

RUN_FIRST

Parameters:
GVnc.Connection.signals.vnc_auth_failure(connection, object)
Signal Name:

vnc-auth-failure

Flags:

RUN_FIRST

Parameters:
GVnc.Connection.signals.vnc_auth_unsupported(connection, object)
Signal Name:

vnc-auth-unsupported

Flags:

RUN_FIRST

Parameters:
GVnc.Connection.signals.vnc_bell(connection)
Signal Name:

vnc-bell

Flags:

RUN_FIRST

Parameters:

connection (GVnc.Connection) – The object which received the signal

GVnc.Connection.signals.vnc_connected(connection)
Signal Name:

vnc-connected

Flags:

RUN_FIRST

Parameters:

connection (GVnc.Connection) – The object which received the signal

GVnc.Connection.signals.vnc_cursor_changed(connection, cursor)
Signal Name:

vnc-cursor-changed

Flags:

RUN_FIRST

Parameters:

Emitted when the cursor is changed.

GVnc.Connection.signals.vnc_desktop_rename(connection, object)
Signal Name:

vnc-desktop-rename

Flags:

RUN_FIRST

Parameters:
GVnc.Connection.signals.vnc_desktop_resize(connection, object, p0)
Signal Name:

vnc-desktop-resize

Flags:

RUN_FIRST

Parameters:
GVnc.Connection.signals.vnc_disconnected(connection)
Signal Name:

vnc-disconnected

Flags:

RUN_FIRST

Parameters:

connection (GVnc.Connection) – The object which received the signal

GVnc.Connection.signals.vnc_error(connection, object)
Signal Name:

vnc-error

Flags:

RUN_FIRST

Parameters:
GVnc.Connection.signals.vnc_framebuffer_update(connection, object, p0, p1, p2)
Signal Name:

vnc-framebuffer-update

Flags:

RUN_FIRST

Parameters:
GVnc.Connection.signals.vnc_initialized(connection)
Signal Name:

vnc-initialized

Flags:

RUN_FIRST

Parameters:

connection (GVnc.Connection) – The object which received the signal

GVnc.Connection.signals.vnc_led_state(connection)
Signal Name:

vnc-led-state

Flags:

RUN_FIRST

Parameters:

connection (GVnc.Connection) – The object which received the signal

GVnc.Connection.signals.vnc_pixel_format_changed(connection, object)
Signal Name:

vnc-pixel-format-changed

Flags:

RUN_FIRST

Parameters:
GVnc.Connection.signals.vnc_pointer_mode_changed(connection, object)
Signal Name:

vnc-pointer-mode-changed

Flags:

RUN_FIRST

Parameters:
GVnc.Connection.signals.vnc_power_control_failed(connection)
Signal Name:

vnc-power-control-failed

Flags:

RUN_FIRST

Parameters:

connection (GVnc.Connection) – The object which received the signal

GVnc.Connection.signals.vnc_power_control_initialized(connection)
Signal Name:

vnc-power-control-initialized

Flags:

RUN_FIRST

Parameters:

connection (GVnc.Connection) – The object which received the signal

GVnc.Connection.signals.vnc_server_cut_text(connection, object)
Signal Name:

vnc-server-cut-text

Flags:

RUN_FIRST

Parameters:

Property Details

GVnc.Connection.props.framebuffer
Name:

framebuffer

Type:

GVnc.Framebuffer

Default Value:

None

Flags:

READABLE, WRITABLE

The desktop framebuffer instance