Remote desktop: libportal Reference Manual

## Remote desktop Remote desktop — allow remote control of the session |

## Functions

void | xdp_portal_create_remote_desktop_session ()
XdpSession * | xdp_portal_create_remote_desktop_session_finish ()
void | xdp_session_pointer_motion ()
void | xdp_session_pointer_position ()
void | xdp_session_pointer_button ()
void | xdp_session_pointer_axis ()
void | xdp_session_pointer_axis_discrete ()
void | xdp_session_keyboard_key ()
void | xdp_session_touch_down ()
void | xdp_session_touch_position ()
void | xdp_session_touch_up ()

## Types and Values

enum | XdpDeviceType
enum | XdpRemoteDesktopFlags
enum | XdpButtonState
enum | XdpDiscreteAxis
enum | XdpKeyState

## Description

A remote desktop session allows to inject events into the input stream.

The underlying portal is org.freedesktop.portal.RemoteDesktop.

## Functions

### xdp_portal_create_remote_desktop_session ()

    void
    xdp_portal_create_remote_desktop_session
                                   (XdpPortal *portal,
                                    XdpDeviceType devices,
                                    XdpOutputType outputs,
                                    XdpRemoteDesktopFlags flags,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback callback,
                                    gpointer data);

Creates a session for remote desktop.

When the request is done, `callback` will be called. You can then call `xdp_portal_create_remote_desktop_session_finish()` to get the results.

#### Parameters

portal | a XdpPortal |
devices | which kinds of input devices to ofer in the new dialog |
outputs | which kinds of source to offer in the dialog |
flags | options for this call |
cancellable | optional GCancellable. | [nullable]
callback | a callback to call when the request is done. | [scope async]
data | data to pass to `callback` . | [closure]

### xdp_portal_create_remote_desktop_session_finish ()

    XdpSession *
    xdp_portal_create_remote_desktop_session_finish
                                   (XdpPortal *portal,
                                    GAsyncResult *result,
                                    GError **error);

Finishes the create-remote-desktop request, and returns an XdpSession.

#### Parameters

portal | a XdpPortal |
result | a GAsyncResult |
error | return location for an error |

#### Returns

a XdpSession.

[transfer full]

### xdp_session_pointer_motion ()

    void
    xdp_session_pointer_motion (XdpSession *session,
                                double dx,
                                double dy);

Moves the pointer from its current position.

May only be called on a remote desktop session with `XDP_DEVICE_POINTER` access.

#### Parameters

session | a XdpSession |
dx | relative horizontal movement |
dy | relative vertical movement |

### xdp_session_pointer_position ()

    void
    xdp_session_pointer_position (XdpSession *session,
                                  guint stream,
                                  double x,
                                  double y);

Moves the pointer to a new position in the given streams logical coordinate space.

May only be called on a remote desktop session with `XDP_DEVICE_POINTER` access.

#### Parameters

session | a XdpSession |
stream | the node ID of the pipewire stream the position is relative to |
x | new X position |
y | new Y position |

### xdp_session_pointer_button ()

    void
    xdp_session_pointer_button (XdpSession *session,
                                int button,
                                XdpButtonState state);

Changes the state of the button to `state` .

May only be called on a remote desktop session with `XDP_DEVICE_POINTER` access.

#### Parameters

session | a XdpSession |
button | the button |
state | the new state |

### xdp_session_pointer_axis ()

    void
    xdp_session_pointer_axis (XdpSession *session,
                              gboolean finish,
                              double dx,
                              double dy);

The axis movement from a smooth scroll device, such as a touchpad. When applicable, the size of the motion delta should be equivalent to the motion vector of a pointer motion done using the same advice.

May only be called on a remote desktop session with `XDP_DEVICE_POINTER` access.

#### Parameters

session | a XdpSession |
finish | whether this is the last in a series of related events |
dx | relative axis movement on the X axis |
dy | relative axis movement on the Y axis |

### xdp_session_pointer_axis_discrete ()

    void
    xdp_session_pointer_axis_discrete (XdpSession *session,
                                       XdpDiscreteAxis axis,
                                       int steps);

The axis movement from a discrete scroll device.

May only be called on a remote desktop session with `XDP_DEVICE_POINTER` access.

#### Parameters

session | a XdpSession |
axis | the axis to change |
steps | number of steps scrolled |

### xdp_session_keyboard_key ()

    void
    xdp_session_keyboard_key (XdpSession *session,
                              gboolean keysym,
                              int key,
                              XdpKeyState state);

Changes the state of the key to `state` .

May only be called on a remote desktop session with `XDP_DEVICE_KEYBOARD` access.

#### Parameters

session | a remote desktop XdpSession |
keysym | whether to interpret `key` as a keysym instead of a keycode |
key | the keysym or keycode to change |
state | the new state |

### xdp_session_touch_down ()

    void
    xdp_session_touch_down (XdpSession *session,
                            guint stream,
                            guint slot,
                            double x,
                            double y);

Notify about a new touch down event. The (x, y) position represents the new touch point position in the streams logical coordinate space.

May only be called on a remote desktop session with `XDP_DEVICE_TOUCHSCREEN` access.

#### Parameters

session | a XdpSession |
stream | the node ID of the pipewire stream the position is relative to |
slot | touch slot where the touch point appeared |
x | new X position |
y | new Y position |

### xdp_session_touch_position ()

    void
    xdp_session_touch_position (XdpSession *session,
                                guint stream,
                                guint slot,
                                double x,
                                double y);

Notify about a new touch motion event. The (x, y) position represents where the touch point position in the streams logical coordinate space moved.

May only be called on a remote desktop session with `XDP_DEVICE_TOUCHSCREEN` access.

#### Parameters

session | a XdpSession |
stream | the node ID of the pipewire stream the position is relative to |
slot | touch slot that is changing position |
x | new X position |
y | new Y position |

### xdp_session_touch_up ()

    void
    xdp_session_touch_up (XdpSession *session,
                          guint slot);

Notify about a new touch up event.

May only be called on a remote desktop session with `XDP_DEVICE_TOUCHSCREEN` access.

#### Parameters

session | a XdpSession |
slot | touch slot that changed |

## Types and Values

### enum XdpDeviceType

Flags to specify what input devices to control for a remote desktop session.

#### Members

XDP_DEVICE_NONE | no device |
XDP_DEVICE_KEYBOARD | control the keyboard. |
XDP_DEVICE_POINTER | control the pointer. |
XDP_DEVICE_TOUCHSCREEN | control the touchscreen. |

### enum XdpRemoteDesktopFlags

Options for starting remote desktop sessions.

#### Members

XDP_REMOTE_DESKTOP_FLAG_NONE | No options |
XDP_REMOTE_DESKTOP_FLAG_MULTIPLE | allow opening multiple streams |

### enum XdpButtonState

The XdpButtonState enumeration is used to describe the state of buttons.

#### Members

XDP_BUTTON_RELEASED | the button is down |
XDP_BUTTON_PRESSED | the button is up |

### enum XdpDiscreteAxis

The XdpDiscreteAxis enumeration is used to describe the discrete scroll axes.

#### Members

XDP_AXIS_HORIZONTAL_SCROLL | the horizontal scroll axis |
XDP_AXIS_VERTICAL_SCROLL | the horizontal scroll axis |

### enum XdpKeyState

The XdpKeyState enumeration is used to describe the state of keys.

#### Members

XDP_KEY_RELEASED | the key is down |
XDP_KEY_PRESSED | the key is up |