Skip to main content

Module window_share

Module window_share 

Expand description

Sharing a window live: one app shows another app’s view of a resource, and the desktop says which windows there are to share.

A message that shares a window shows the window’s resource as it is now — not a picture of the sharer’s screen: every reader’s desktop runs the resource’s own app on its own copy of the record and draws that app’s view, scaled down, where the message asked for it. The record syncs like any other, so the miniature follows the sharer’s work, and what a reader sees is what their grants let their copy hold.

  • Embeds. An app declares where it wants which resource drawn (declare, one Embed each) and reads back how each is coming along (state). The host draws them over the app’s content, clipped to Embed::clip, and never hands them input: opening the resource is the app’s own action. A window no host draws embeds for (drawn is false) shows what it draws itself in their place.
  • Windows to share. The desktop lists the windows open on a record (publish_windows), so a picker names real ones (windows); a window’s own menu asks the sharing app to share it (ask_to_share, take_ask).
  • What is shared. The sharing app says which windows it shares (publish_shared), so the desktop marks them and offers “Stop sharing” on them (Ask::Stop).

An app in a process of its own makes the same calls: its runner carries them over the app’s shell-ui connection (crate::floating_surface), and outside a session nothing hosts them. What every desktop does with the windows and the views is one host.

Modules§

host
What a desktop does for windows shared live (super), the same in the browser desktop and the session’s shell.

Structs§

DeclaredEmbed
An Embed as the shell-ui connection carries it: its geometry as plain logical-pixel arrays ([x0, y0, x1, y1]).
Embed
One place an app wants a resource drawn by its own app.
KeyedEmbedState
How the embed key is coming along, as the shell tells its app.
OpenWindow
A window its person has open on a record, as the desktop lists it.
ResourceView
A resource as one app’s view shows it: the app, the record it keeps the resource in and the resource itself.
SharedWindow
A window the sharing app shares, as it tells the desktop.

Enums§

Ask
What the desktop asks of the sharing app on its person’s behalf.
EmbedState
How an embed is coming along, as its host reports it.

Constants§

MAX_EMBEDS
The most embeds one window may ask for at once: a host runs an app for each, so a long scroll of shares shows the ones in view.
MAX_SHARED
The most windows one app says it shares.
MAX_WINDOWS
The most windows a desktop lists for the sharing app’s picker.
SHARING_APP
The app that shares windows into conversations and takes the desktop’s asks (take_ask): the desktop brings it forward when a window’s menu asks to share.

Functions§

ask_to_share
Ask the sharing app to share window.
ask_to_stop
Ask the sharing app to stop sharing what message shares.
asked
Whether the desktop asked the sharing app something it has not taken yet.
bounded
text cut to the most the connection carries of an id, a title or a place, at a character boundary.
declare
Ask for embeds in the window the app is shown in, at most MAX_EMBEDS (the first ones). Cheap when nothing changed.
deliver_ask
Hand the sharing app ask: the runner of an app in a process of its own, as the shell asked it.
drawn
Whether a host draws this window’s embeds. Without one, the app draws its own stand-in where each would be.
host_lost
The shell that drew the embeds and listed the windows went away: a new one is told everything afresh.
own_embeds_since
The process window’s embeds and their revision, when the revision is not seen (the one last sent to the shell; 0 before any).
publish_shared
Tell the desktop which windows this app shares now.
publish_windows
List the windows the person has open on a record. Returns whether the list changed.
set_drawn
The host draws embeds on this thread (true), or no longer does.
set_own_states
How the shell says the process window’s embeds are coming along: every one it draws, so an embed it no longer names has no state. Returns whether that changed.
shared
The windows the sharing app says it shares.
shared_since
What the app shares and its revision, when the revision is not seen (the one last sent to the shell; 0 before any).
state
How the host says key’s embed is coming along; None before it said.
take_ask
The oldest thing the desktop asked of the sharing app and it has not taken yet.
windows
The windows the person has open on a record, as the desktop last listed them.