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, oneEmbedeach) and reads back how each is coming along (state). The host draws them over the app’s content, clipped toEmbed::clip, and never hands them input: opening the resource is the app’s own action. A window no host draws embeds for (drawnis 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§
- Declared
Embed - An
Embedas 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.
- Keyed
Embed State - How the embed
keyis coming along, as the shell tells its app. - Open
Window - A window its person has open on a record, as the desktop lists it.
- Resource
View - A resource as one app’s view shows it: the app, the record it keeps the resource in and the resource itself.
- Shared
Window - 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.
- Embed
State - 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
messageshares. - asked
- Whether the desktop asked the sharing app something it has not taken yet.
- bounded
textcut to the most the connection carries of an id, a title or a place, at a character boundary.- declare
- Ask for
embedsin the window the app is shown in, at mostMAX_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;Nonebefore 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.