Xdp.Session

g GObject.Object GObject.Object Xdp.Session Xdp.Session GObject.Object->Xdp.Session

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

close ()

connect_to_eis ()

get_devices ()

get_persist_mode ()

get_restore_token ()

get_session_state ()

get_session_type ()

get_streams ()

keyboard_key (keysym, key, state)

open_pipewire_remote ()

pointer_axis (finish, dx, dy)

pointer_axis_discrete (axis, steps)

pointer_button (button, state)

pointer_motion (dx, dy)

pointer_position (stream, x, y)

start (parent, cancellable, callback, *data)

start_finish (result)

touch_down (stream, slot, x, y)

touch_position (stream, slot, x, y)

touch_up (slot)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Name

Short Description

closed

Emitted when a session is closed externally.

Fields

Inherited:

GObject.Object (1)

Class Details

class Xdp.Session(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Xdp.SessionClass

A representation of long-lived screencast portal interactions.

The Xdp.Session object is used to represent portal interactions with the screencast or remote desktop portals that extend over multiple portal calls.

To find out what kind of session an Xdp.Session object represents and whether it is still active, you can use [method`Session`.get_session_type] and [method`Session`.get_session_state].

All sessions start in an initial state. They can be made active by calling [method`Session`.start], and ended by calling [method`Session`.close].

close()

Closes the session.

connect_to_eis()
Raises:

GLib.Error

Returns:

the file descriptor to the EIS implementation

Return type:

int

Connect this XdpRemoteDesktopSession to an EIS implementation and return the fd. This fd can be passed into ei_setup_backend_fd(). See the libei documentation for details.

This call must be issued before Xdp.Session.start(). If successful, all input event emulation must be handled via the EIS connection and calls to Xdp.Session.pointer_motion() etc. are silently ignored.

get_devices()
Returns:

the selected devices

Return type:

Xdp.DeviceType

Obtains the devices that the user selected.

Unless the session is active, this function returns XDP_DEVICE_NONE.

get_persist_mode()
Returns:

the effective persist mode of self

Return type:

Xdp.PersistMode

Retrieves the effective persist mode of self.

May only be called after self is successfully started, i.e. after [method`Session`.start_finish].

get_restore_token()
Returns:

the restore token of self

Return type:

str or None

Retrieves the restore token of self.

A restore token will only be available if XDP_PERSIST_MODE_TRANSIENT or XDP_PERSIST_MODE_PERSISTENT was passed when creating the screencast session.

Remote desktop sessions cannot be restored.

May only be called after self is successfully started, i.e. after [method`Session`.start_finish].

get_session_state()
Returns:

the state of self

Return type:

Xdp.SessionState

Obtains information about the state of the session that is represented by self.

get_session_type()
Returns:

the type of self

Return type:

Xdp.SessionType

Obtains information about the type of session that is represented by self.

get_streams()
Returns:

the selected streams

Return type:

GLib.Variant

Obtains the streams that the user selected.

The information in the returned [struct`GLib`.Variant] has the format a(ua{sv}). Each item in the array is describing a stream. The first member is the pipewire node ID, the second is a dictionary of stream properties, including:

  • position, (ii): a tuple consisting of the position (x, y) in the compositor coordinate space. Note that the position may not be equivalent to a position in a pixel coordinate space. Only available for monitor streams.

  • size, (ii): a tuple consisting of (width, height). The size represents the size of the stream as it is displayed in the compositor coordinate space. Note that this size may not be equivalent to a size in a pixel coordinate space. The size may differ from the size of the stream.

Unless the session is active, this function returns NULL.

keyboard_key(keysym, key, state)
Parameters:
  • keysym (bool) – whether to interpret key as a keysym instead of a keycode

  • key (int) – the keysym or keycode to change

  • state (Xdp.KeyState) – the new state

Changes the state of the key to state.

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

open_pipewire_remote()
Returns:

the file descriptor

Return type:

int

Opens a file descriptor to the pipewire remote where the screencast streams are available.

The file descriptor should be used to create a pw_remote object, by using pw_remote_connect_fd(). Only the screencast stream nodes will be available from this pipewire node.

pointer_axis(finish, dx, dy)
Parameters:
  • finish (bool) – whether this is the last in a series of related events

  • dx (float) – relative axis movement on the X axis

  • dy (float) – relative axis movement on the Y axis

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.

pointer_axis_discrete(axis, steps)
Parameters:

The axis movement from a discrete scroll device.

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

pointer_button(button, state)
Parameters:

Changes the state of the button to state.

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

pointer_motion(dx, dy)
Parameters:
  • dx (float) – relative horizontal movement

  • dy (float) – relative vertical movement

Moves the pointer from its current position.

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

pointer_position(stream, x, y)
Parameters:
  • stream (int) – the node ID of the pipewire stream the position is relative to

  • x (float) – new X position

  • y (float) – new Y position

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.

start(parent, cancellable, callback, *data)
Parameters:

Starts the session.

When the request is done, callback will be called. You can then call [method`Session`.start_finish] to get the results.

start_finish(result)
Parameters:

result (Gio.AsyncResult) – a [iface`Gio`.AsyncResult]

Raises:

GLib.Error

Returns:

TRUE if the session was started successfully.

Return type:

bool

Finishes the session-start request.

touch_down(stream, slot, x, y)
Parameters:
  • stream (int) – the node ID of the pipewire stream the position is relative to

  • slot (int) – touch slot where the touch point appeared

  • x (float) – new X position

  • y (float) – new Y position

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.

touch_position(stream, slot, x, y)
Parameters:
  • stream (int) – the node ID of the pipewire stream the position is relative to

  • slot (int) – touch slot that is changing position

  • x (float) – new X position

  • y (float) – new Y position

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.

touch_up(slot)
Parameters:

slot (int) – touch slot that changed

Notify about a new touch up event.

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

Signal Details

Xdp.Session.signals.closed(session)
Signal Name:

closed

Flags:

RUN_CLEANUP, NO_RECURSE, NO_HOOKS

Parameters:

session (Xdp.Session) – The object which received the signal

Emitted when a session is closed externally.