![]() |
![]() |
![]() |
![]() |
The XdpSession 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 XdpSession object represents and whether
it is still active, you can use xdp_session_get_session_type()
and
xdp_session_get_session_state()
.
All sessions start in an initial state. They can be made active by calling
xdp_session_start()
, and ended by calling xdp_session_close()
.
void xdp_session_start (XdpSession *session
,XdpParent *parent
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer data
);
Starts the session.
When the request is done, callback
will be called. You can then
call xdp_session_start_finish()
to get the results.
session |
a XdpSession in initial state |
|
parent |
parent window information. |
[nullable] |
cancellable |
optional GCancellable. |
[nullable] |
callback |
a callback to call when the request is done. |
[scope async] |
data |
data to pass to |
[closure] |
gboolean xdp_session_start_finish (XdpSession *session
,GAsyncResult *result
,GError **error
);
Finishes the session-start request.
int
xdp_session_open_pipewire_remote (XdpSession *session
);
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.
XdpSessionType
xdp_session_get_session_type (XdpSession *session
);
Obtains information about the type of session that is represented
by session
.
XdpSessionState
xdp_session_get_session_state (XdpSession *session
);
Obtains information about the state of the session that is represented
by session
.
XdpDeviceType
xdp_session_get_devices (XdpSession *session
);
Obtains the devices that the user selected.
Unless the session is active, this function returns XDP_DEVICE_NONE
.
GVariant *
xdp_session_get_streams (XdpSession *session
);
Obtains the streams that the user selected. The information inthe
returned GVariant 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
.
typedef struct _XdpSession XdpSession;
The XdpSession struct contains only private fields and should not be accessed directly.
“closed”
signalvoid user_function (XdpSession *xdpsession, gpointer user_data)
The ::closed signal is emitted when a session is closed externally.
Flags: No Hooks