## Spice Display Spice Display — a GTK display widget |

## Stability Level

Stable, unless otherwise indicated

## Functions

SpiceDisplay * | spice_display_new ()
SpiceDisplay * | spice_display_new_with_monitor ()
void | spice_display_mouse_ungrab ()
void | spice_display_set_grab_keys ()
SpiceGrabSequence * | spice_display_get_grab_keys ()
void | spice_display_send_keys ()
GdkPixbuf * | spice_display_get_pixbuf ()
SpiceGrabSequence * | spice_grab_sequence_new ()
SpiceGrabSequence * | spice_grab_sequence_new_from_string ()
SpiceGrabSequence * | spice_grab_sequence_copy ()
void | spice_grab_sequence_free ()
gchar * | spice_grab_sequence_as_string ()

## Types and Values

enum | SpiceDisplayKeyEvent
| SpiceGrabSequence

## Object Hierarchy

        GBoxed
        ╰── SpiceGrabSequence

## Includes

    #include <spice-client-gtk.h>

## Description

A GTK widget that displays a SPICE server. It sends keyboard/mouse events and can also share clipboard...

Arbitrary key events can be sent thanks to `spice_display_send_keys()`.

The widget will optionally grab the keyboard and the mouse when focused if the properties “grab-keyboard” and “grab-mouse” are TRUE respectively. It can be ungrabbed with `spice_display_mouse_ungrab()`, and by setting a key combination with `spice_display_set_grab_keys()`.

Finally, `spice_display_get_pixbuf()` will take a screenshot of the current display and return an GdkPixbuf (that you can then easily save to disk).

## Functions

### spice_display_new ()

    SpiceDisplay *
    spice_display_new (SpiceSession *session,
                       int channel_id);

Creates a new SpiceDisplay widget.

#### Parameters

session | a SpiceSession |
channel_id | the display channel ID to associate with SpiceDisplay |

#### Returns

a new SpiceDisplay widget.

### spice_display_new_with_monitor ()

    SpiceDisplay *
    spice_display_new_with_monitor (SpiceSession *session,
                                    gint channel_id,
                                    gint monitor_id);

Creates a new SpiceDisplay widget associated with the monitor id.

#### Parameters

session | a SpiceSession |
channel_id | the display channel ID to associate with SpiceDisplay |
monitor_id | the monitor id within the display channel |

#### Returns

a new SpiceDisplay widget.

Since: 0.13

### spice_display_mouse_ungrab ()

    void
    spice_display_mouse_ungrab (SpiceDisplay *display);

Ungrab the mouse.

#### Parameters

display | a SpiceDisplay |

### spice_display_set_grab_keys ()

    void
    spice_display_set_grab_keys (SpiceDisplay *display,
                                 SpiceGrabSequence *seq);

Set the key combination to grab/ungrab the keyboard. The default is "Control L + Alt L".

#### Parameters

display | the display widget |
seq | key sequence. | [transfer none]

### spice_display_get_grab_keys ()

    SpiceGrabSequence *
    spice_display_get_grab_keys (SpiceDisplay *display);

Finds the current grab key combination for the `display` .

#### Parameters

display | the display widget |

#### Returns

the current grab key combination.

[transfer none]

### spice_display_send_keys ()

    void
    spice_display_send_keys (SpiceDisplay *display,
                             const guint *keyvals,
                             int nkeyvals,
                             SpiceDisplayKeyEvent kind);

Send keyval press/release events to the display.

#### Parameters

display | The SpiceDisplay |
keyvals | Keyval array. | [array length=nkeyvals]
nkeyvals | Length of keyvals |
kind | SpiceDisplayKeyEvent action |

### spice_display_get_pixbuf ()

    GdkPixbuf *
    spice_display_get_pixbuf (SpiceDisplay *display);

Take a screenshot of the display.

#### Parameters

display | a SpiceDisplay |

#### Returns

a GdkPixbuf with the screenshot image buffer.

[transfer full]

### spice_grab_sequence_new ()

    SpiceGrabSequence *
    spice_grab_sequence_new (guint nkeysyms,
                             guint *keysyms);

Creates a new grab sequence from a list of keysym values

#### Parameters

nkeysyms | length of `keysyms` |
keysyms | the keysym values. | [array length=nkeysyms]

#### Returns

a new grab sequence object.

[transfer full]

### spice_grab_sequence_new_from_string ()

    SpiceGrabSequence *
    spice_grab_sequence_new_from_string (const gchar *str);

Creates a new SpiceGrabSequence from the string representation.

#### Parameters

str | a string of '+' separated key names (ex: "Control_L+Alt_L") |

#### Returns

a new SpiceGrabSequence.

### spice_grab_sequence_copy ()

    SpiceGrabSequence *
    spice_grab_sequence_copy (SpiceGrabSequence *sequence);

Creates a copy of the `sequence` .

#### Parameters

sequence | sequence to copy |

#### Returns

a copy of `sequence` .

[transfer full]

### spice_grab_sequence_free ()

    void
    spice_grab_sequence_free (SpiceGrabSequence *sequence);

Free `sequence` .

#### Parameters

sequence | a SpiceGrabSequence |

### spice_grab_sequence_as_string ()

    gchar *
    spice_grab_sequence_as_string (SpiceGrabSequence *sequence);

Creates a string representing the `sequence` .

#### Parameters

sequence | a SpiceGrabSequence |

#### Returns

a newly allocated string representing the key sequence.

[transfer full]

## Types and Values

### enum SpiceDisplayKeyEvent

Constants for key events.

#### Members

SPICE_DISPLAY_KEY_EVENT_PRESS | key press |
SPICE_DISPLAY_KEY_EVENT_RELEASE | key release |
SPICE_DISPLAY_KEY_EVENT_CLICK | key click (press and release) |

### SpiceGrabSequence

    typedef struct {
    } SpiceGrabSequence;

An opaque type that represents a grab sequence.