Spice GTK Session: Spice-GTK Reference Manual

## Spice GTK Session Spice GTK Session — handles GTK connection details |

## Stability Level

Stable, unless otherwise indicated

## Functions

SpiceGtkSession * | spice_gtk_session_get ()
void | spice_gtk_session_copy_to_guest ()
void | spice_gtk_session_paste_from_guest ()

## Properties

gboolean | auto-clipboard | Read / Write / Construct
gboolean | auto-usbredir | Read / Write / Construct
gboolean | pointer-grabbed | Read
SpiceSession * | session | Read / Write / Construct Only
gboolean | sync-modifiers | Read / Write / Construct

## Types and Values

| SpiceGtkSession
| SpiceGtkSessionClass

## Object Hierarchy

        GObject
        ╰── SpiceGtkSession

## Includes

    #include <spice-client-gtk.h>

## Description

The SpiceGtkSession class is the spice-client-gtk counter part of SpiceSession. It contains functionality which should be handled per session rather then per SpiceDisplay (one session can have multiple displays), but which cannot live in SpiceSession as it depends on GTK. For example the clipboard functionality.

There should always be a 1:1 relation between SpiceGtkSession objects and SpiceSession objects. Therefor there is no spice_gtk_session_new, instead there is `spice_gtk_session_get()` which ensures this 1:1 relation.

Client and guest clipboards will be shared automatically if “auto-clipboard” is set to TRUE. Alternatively, you can send / receive clipboard data from client to guest with `spice_gtk_session_copy_to_guest()` / `spice_gtk_session_paste_from_guest()`.

## Functions

### spice_gtk_session_get ()

    SpiceGtkSession *
    spice_gtk_session_get (SpiceSession *session);

Gets the SpiceGtkSession associated with the passed in SpiceSession. A new SpiceGtkSession instance will be created the first time this function is called for a certain SpiceSession.

Note that this function returns a weak reference, which should not be used after the SpiceSession itself has been unref-ed by the caller.

#### Parameters

session | SpiceSession for which to get the SpiceGtkSession |

#### Returns

a weak reference to the SpiceGtkSession associated with the passed in SpiceSession

Since 0.8.

[transfer none]

### spice_gtk_session_copy_to_guest ()

    void
    spice_gtk_session_copy_to_guest (SpiceGtkSession *self);

Copy client-side clipboard to guest clipboard.

Since 0.8

#### Parameters

self | SpiceGtkSession |

### spice_gtk_session_paste_from_guest ()

    void
    spice_gtk_session_paste_from_guest (SpiceGtkSession *self);

Copy guest clipboard to client-side clipboard.

Since 0.8

#### Parameters

self | SpiceGtkSession |

## Types and Values

### SpiceGtkSession

    typedef struct _SpiceGtkSession SpiceGtkSession;

The SpiceGtkSession struct is opaque and should not be accessed directly.

### SpiceGtkSessionClass

    typedef struct _SpiceGtkSessionClass SpiceGtkSessionClass;

Class structure for SpiceGtkSession. It is opaque and should not be accessed directly.

## Property Details

### The `“auto-clipboard”` property

      “auto-clipboard”           gboolean

When this is true the clipboard gets automatically shared between host and guest.

Owner: SpiceGtkSession

Flags: Read / Write / Construct

Default value: TRUE

Since: 0.8

### The `“auto-usbredir”` property

      “auto-usbredir”            gboolean

Automatically redirect newly plugged in USB devices. Note the auto redirection only happens when a SpiceDisplay associated with the session had keyboard focus.

Owner: SpiceGtkSession

Flags: Read / Write / Construct

Default value: FALSE

Since: 0.8

### The `“pointer-grabbed”` property

      “pointer-grabbed”          gboolean

Returns `TRUE` if the pointer is currently grabbed by this session.

Owner: SpiceGtkSession

Flags: Read

Default value: FALSE

Since: 0.27

### The `“session”` property

      “session”                  SpiceSession *

SpiceSession this SpiceGtkSession is associated with

Owner: SpiceGtkSession

Flags: Read / Write / Construct Only

Since: 0.8

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

      “sync-modifiers”           gboolean

Automatically sync modifiers (Caps, Num and Scroll locks) with the guest.

Owner: SpiceGtkSession

Flags: Read / Write / Construct

Default value: TRUE

Since: 0.32

## See Also

SpiceSession, and the GTK widget SpiceDisplay