:right-sidebar: True InputCaptureSession =================================================================== .. currentmodule:: gi.repository.Xdp .. class:: InputCaptureSession(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` A representation of a long-lived input capture portal interaction. The :obj:`~gi.repository.Xdp.InputCaptureSession` object is used to represent portal interactions with the input capture desktop portal that extend over multiple portal calls. Usually a caller creates an input capture session, requests the available zones and sets up pointer barriers on those zones before enabling the session. To find available zones, call :obj:`~gi.repository.InputCaptureSession.get_zones`\. These :obj:`~gi.repository.Xdp.InputCaptureZone` object represent the accessible desktop area for input capturing. :obj:`~gi.repository.Xdp.InputCapturePointerBarrier` objects can be set up on these zones to trigger input capture. The :obj:`~gi.repository.Xdp.InputCaptureSession` wraps a :obj:`~gi.repository.Xdp.Session` object. Methods ------- .. rst-class:: interim-class .. class:: InputCaptureSession :no-index: .. method:: connect_to_eis() -> int Connect this session 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 is a sync DBus invocation. .. method:: disable() -> None Disables this input capture session. .. method:: enable() -> None Enables this input capture session. In the future, this client may receive input events. .. method:: get_restore_token() -> str Returns the restore token for this session or NULL if none exists. This token can be passed to :obj:`~gi.repository.InputCaptureSession.set_restore_token` for a future session to restore this session, possibly skipping interactive permission dialogs. This method only returns a token for a session created with :obj:`~gi.repository.Portal.create_input_capture_session2` and only once :obj:`~gi.repository.InputCaptureSession.start_finish` has completed. The token may change with every session. .. method:: get_session() -> ~gi.repository.Xdp.Session Return the :obj:`~gi.repository.Xdp.XdpSession` for this InputCapture session. .. method:: get_zones() -> list[~gi.repository.Xdp.InputCaptureZone] Obtains the current set of :obj:`~gi.repository.Xdp.InputCaptureZone` objects. The returned object is valid until the zones are invalidated by the :obj:`~gi.repository.Xdp.InputCaptureSession.signals.zones_changed` signal. Unless the session is active, this function returns ``NULL``\. .. method:: release(activation_id: int) -> None Releases this input capture session without a suggested cursor position. :param activation_id: .. method:: release_at(activation_id: int, cursor_x_position: float, cursor_y_position: float) -> None Releases this input capture session with a suggested cursor position. Note that the implementation is not required to honour this position. :param activation_id: :param cursor_x_position: the suggested cursor x position once capture has been released :param cursor_y_position: the suggested cursor y position once capture has been released .. method:: set_pointer_barriers(self, barriers: list[~gi.repository.Xdp.InputCapturePointerBarrier]) -> list[~gi.repository.Xdp.InputCapturePointerBarrier] :async: This is the `awaitable `_ version of :meth:`set_pointer_barriers`. :param barriers: the pointer barriers to apply .. method:: set_pointer_barriers(barriers: list[~gi.repository.Xdp.InputCapturePointerBarrier], cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~collections.abc.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, data: ~typing.Any = None) -> None Sets the pointer barriers for this session. When the request is done, ``callback`` will be called. You can then call :obj:`~gi.repository.InputCaptureSession.set_pointer_barriers_finish` to get the results. The result of this request is the list of pointer barriers that failed to apply - barriers not present in the returned list are active. Once the pointer barrier is applied (i.e. the reply to the DBus Request has been received), the the :obj:`~gi.repository.Xdp.InputCapturePointerBarrier.props.is_active` property is changed on that barrier. Failed barriers have the property set to a :const:`False` value. :param barriers: the pointer barriers to apply :param cancellable: :param callback: :param data: .. method:: set_pointer_barriers_finish(result: ~gi.repository.Gio.AsyncResult) -> list[~gi.repository.Xdp.InputCapturePointerBarrier] Finishes the set-pointer-barriers request, and returns a GList with the pointer barriers that failed to apply and should be cleaned up by the caller. :param result: a :obj:`~gi.repository.Gio.AsyncResult` .. method:: set_restore_token(restore_token: str) -> None Sets the restore token for the session about to be started. This instructs the portal to restore the previous session identified by this token. This method can only be called for a session created with :obj:`~gi.repository.Portal.create_input_capture_session2` and only before :obj:`~gi.repository.InputCaptureSession.start` has been called. It has no effect otherwise. The restore token for the current session can be obtained with :obj:`~gi.repository.InputCaptureSession.get_restore_token`\. :param restore_token: a restore token from a previous session .. method:: set_session_persistence(persistence: ~gi.repository.Xdp.InputCaptureSessionPersistence) -> None Requests session persistence from the portal. A persistent session can be restored using the restore token, see :obj:`~gi.repository.InputCaptureSession.set_restore_token`\. This method can only be called for a session created with :obj:`~gi.repository.Portal.create_input_capture_session2` and only before :obj:`~gi.repository.InputCaptureSession.start` has been called. It has no effect otherwise. The default persistence is none. :param persistence: the session persistence for this session .. method:: start(self, parent: ~gi.repository.Xdp.Parent | None, capabilities: ~gi.repository.Xdp.InputCapability) -> bool :async: This is the `awaitable `_ version of :meth:`start`. :param parent: parent window information :param capabilities: which kinds of capabilities to request .. method:: start(parent: ~gi.repository.Xdp.Parent | None, capabilities: ~gi.repository.Xdp.InputCapability, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~collections.abc.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, data: ~typing.Any = None) -> None Start the input capture session. When the request is done, ``callback`` will be called. You can then call :obj:`~gi.repository.InputCaptureSession.start_finish` to get the results. :param parent: parent window information :param capabilities: which kinds of capabilities to request :param cancellable: optional :obj:`~gi.repository.Gio.Cancellable` :param callback: a callback to call when the request is done :param data: data to pass to ``callback`` .. method:: start_finish(result: ~gi.repository.Gio.AsyncResult) -> bool Finishes the InputCapture Start request, and returns TRUE if it was successful. :param result: a :obj:`~gi.repository.Gio.AsyncResult` Signals ------- .. rst-class:: interim-class .. class:: InputCaptureSession.signals :no-index: .. method:: activated(activation_id: int, options: ~gi.repository.GLib.Variant) -> None Emitted when an InputCapture session activates and sends events. When this signal is emitted, events will appear on the transport layer. :param activation_id: the unique activation_id to identify this input capture :param options: a GVariant with the signal options .. method:: deactivated(activation_id: int, options: ~gi.repository.GLib.Variant) -> None Emitted when an InputCapture session deactivates and no longer sends events. :param activation_id: the unique activation_id to identify this input capture :param options: a GVariant with the signal options .. method:: disabled(options: ~gi.repository.GLib.Variant) -> None Emitted when an InputCapture session is disabled. This signal is emitted when capturing was disabled by the server. :param options: a GVariant with the signal options .. method:: zones_changed(options: ~gi.repository.GLib.Variant) -> None Emitted when an InputCapture session's zones have changed. When this signal is emitted, all current zones will have their :obj:`~gi.repository.Xdp.InputCaptureZone.props.is_valid` property set to :const:`False` and all internal references to those zones have been released. This signal is sent after libportal has fetched the updated zones, a caller should call :func:`~gi.repository.Xdp.InputCaptureSession.get_zones` to retrieve the new zones. :param options: a GVariant with the signal options