From f4afd83a5f30ff9153242e6a95953941e76e6224 Mon Sep 17 00:00:00 2001 From: faumaray Date: Mon, 23 Nov 2026 08:35:10 +0300 Subject: [PATCH] docs: document GPUI voice fix round (PTT guards, compact stage, tooltips) Update `docs/ui.md` ("The voice page and the call bar") and `CHANGELOG.md` for the fix round: fail-closed `hotkey.rs` loop, hardened `AppState` / `Sidebar` / `MainView` push-to-talk state machine (`button_held`, `hotkey_held`, `shutting_down`, per-event disconnect handling, mode/server/delete/focus/shutdown guards), centred smaller stage and re-shot compact screenshots (`15a1b60`, Xvfb `:621`/`:622`, Mesa 26.3.0 lavapipe), and `IconButton` dynamic tooltip refresh via `ElementId::NamedChild`. Co-Authored-By: Gemini 4 Neon --- CHANGELOG.md | 21 ++++++---- docs/ui.md | 107 +++++++++++++++++++++++++++++++++++---------------- 2 files changed, 86 insertions(+), 42 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b09afa5..320c8e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,14 +56,19 @@ User-visible changes of the apps and the `tsgw` gateway. The format follows its banner and who is there: large avatars ringed green while they talk and blue while they stream, with the marks of a microphone or sound that is off, and under them the call bar (mute, deafen, share and the voice settings, which - only log until their pages come, and Leave). The smaller stage, one row of small - avatars, is remembered and a window under 800 pixels tall always has it (the - same setting as the Slint app's). The sidebar's server card shows the server's - banner, a person's card has their volume and a mute for us, and the voice card - says the transmit mode when it is not push-to-talk. Hold to talk no longer - stays on when voice drops while it is held or when the window loses the focus, - and the global push-to-talk key (`Ctrl+Shift+T` by default, as in the Slint app) - works while another window has the focus. A person's picture is round in its + only log until their pages come, and Leave). The smaller stage, one row of + small avatars centred while it fits and scrolling sideways when crowded, is + remembered and a window under 800 pixels tall always has it (the same setting + as the Slint app's); toggle icon buttons refresh their tooltips as soon as + their state flips. The sidebar's server card shows the server's banner, a + person's card has their volume and a mute for us, and the voice card says the + transmit mode when it is not push-to-talk. Hold to talk and the global + push-to-talk key (`Ctrl+Shift+T` by default, as in the Slint app, working + while another window has focus) track button and hotkey holds independently and + fail closed across voice drops (including drop and reconnect within one event + batch), window focus loss, leaving push-to-talk mode, switching or removing + servers, repeated portal activations across servers, desktop shortcut removal, + hotkey task exit, and window shutdown. A person's picture is round in its avatar. `voelin-gpui` is still not the app (docs/ui.md, "The voice page and the call bar"). - Log files: each run logs to `/voelin/logs/voelin.log`, the previous diff --git a/docs/ui.md b/docs/ui.md index 648e959..9b397e7 100644 --- a/docs/ui.md +++ b/docs/ui.md @@ -1745,9 +1745,12 @@ same `voelin-ui-vm` rows (`TreeView::members`) and logic as the Slint front end. The pictures are the shell at 1440 by 960 under `scripts/gpui-shot.sh` (the recipe above: `VOELIN_DEMO_UI=1` with `VOELIN_OPEN=voice` and `voice:compact`, a -display of its own, the state under the checkout's `.scratch/`), the release -build of `7140718`, Xvfb `:511` to `:514` of 3840 by 2160 with openbox, Mesa 26.2.5's -lavapipe (`llvmpipe (LLVM 21.1.8, 256 bits)`) through Vulkan. The first sample +display of its own, the state under the checkout's `.scratch/`): the larger +stage on the release build of `7140718` (Xvfb `:511` and `:512` of 3840 by 2160 +with openbox, Mesa 26.2.5's lavapipe) and the smaller stage re-shot on the +release build of `15a1b60` after centring its row (Xvfb `:621` and `:622` of +3840 by 2160 with openbox, Mesa 26.3.0's lavapipe, both `llvmpipe (LLVM 21.1.8, +256 bits)` through Vulkan). The first sample server's Chill Zone: Kairo talks (the green ring and the bars in the corner of the avatar, "Speaking"), Lumen streams (the blue ring, "Streaming" or LIVE), dex's microphone is off (the mark in the corner), the channel's banner is behind the @@ -1790,17 +1793,24 @@ What is on screen: name (ours in the accent colour) with the crown of an admin, and "Speaking", "Streaming" or "Away" with the bars or the monitor mark. A click opens the person's card (`OpenMember`). The smaller stage is one row of 54 pixel avatars - that scrolls sideways, ringed only while they talk or stream, the name and - the crown, and LIVE under a streamer. A window under 800 pixels tall has the - smaller stage whatever the setting says and the button is off, with the reason - as its tooltip (`Nav.short`): `MainView` tells the page when the window - crosses 800 pixels, since a cached pane does not see a resize. + (a flex-row scroll container whose inner row carries `.flex_none().mx_auto()`), + centred horizontally while the people fit and scrolling sideways from the left + edge without clipping when they outgrow the page, ringed only while they talk + or stream, with the name and the crown, and LIVE under a streamer. A window + under 800 pixels tall has the smaller stage whatever the setting says and the + button is off, with the reason as its tooltip (`Nav.short`): `MainView` tells + the page when the window crosses 800 pixels, since a cached pane does not see + a resize. - **The call bar**: Mute and Deafen (44 pixel round buttons, red while on: `SetInputMuted`, `SetOutputMuted`), Share when the server can stream and the voice settings (`OpenShare`, `OpenVoiceSettings`: logged, their pages are - the stream slices' and the settings slice's), and Leave. The streams of the - Slint page and its channel chat come with their slices; the page says so where - the chat will be. + the stream slices' and the settings slice's), and Leave. `IconButton` keys its + GPUI element ID by both its base ID and its label (`ElementId::NamedChild`, + keeping `.debug_selector` on the base ID), so toggle buttons (`call-mic`, + `call-sound`, `member-mute`, `user-mic`, `user-sound`, `voice-stage`) drop + stale hover/tooltip state and render the updated tooltip as soon as their + label changes. The streams of the Slint page and its channel chat come with + their slices; the page says so where the chat will be. - **The voice card and the modes.** Hold to talk is for the push-to-talk mode of the audio settings; for voice activity and for an open microphone the card says the mode in words instead of showing a button. `SettingChanged` for `audio`, @@ -1822,24 +1832,48 @@ What is on screen: colour). GPUI clips to rectangles, so the picture's corners are square, as the tree's banner rows'. -**The release guard of Hold to talk** (the risk slice 2 recorded). Two ways to let -go of the button without the button hearing of it, two guards. *Voice that -drops:* the voice card, with the button, goes when voice leaves `Connected`, and -the session keeps `transmitting` into the next connection. After each batch of -engine events the root state tells the session `SetTransmitting(false)` once for -every session that was connected before the batch and is not after it and still -says it transmits (the engine's own report, so no flag of ours can go stale; the -engine's answer, and a reconnect, are not answered), and the sidebar clears its own -hold from its observer of the state (it sets its own field and sends nothing: a -signal's observer does not change the root state). *A window that loses the focus -while the button is held:* the mouse button comes up elsewhere, so `MainView`'s -window-activation observer lets the button go and the root state tells the session. -The global key is for use while another window has the focus, so the focus is not -its to cut: it ends with the key's release or with the voice. Tests state each -(`hold_to_talk_is_released_when_voice_drops`, -`hold_to_talk_is_released_when_the_window_loses_the_focus`, the window that holds -nothing, the global hotkey that the focus does not cut, a voice that drops -without a hold), and each guard was removed once to see its test fail. +**The release guard of Hold to talk and the global hotkey** (the risk slice 2 +recorded, hardened in the voice fix round). `AppState` tracks the window button +(`button_held`), the global hotkey (`hotkey_held`), and window teardown +(`shutting_down`) independently, with `stop_transmitting_if_unheld`, +`release_button_hold`, and `release_hotkey_hold`: holding both at once keeps +transmit active until both release without duplicate start or stop commands. +Every path that can orphan a hold is guarded: + +- *Voice that drops:* checked per event inside `AppState::handle_events` (not + only across a whole 64-event batch, so a drop and reconnect inside one batch + cannot mask it). Whenever a session leaves `Connected`, any button or hotkey + hold on it ends, and `SetTransmitting(false)` is emitted once if either was + held or the engine still reports `transmitting` (the engine's answer and a + reconnect are not answered). `Sidebar`'s signal observer clears its own + `holding` flag whenever voice disconnects, transmit leaves push-to-talk, the + shown server changes, or `AppState::button_held` no longer matches (it only + sets its own field and never mutates root state). +- *Leaving push-to-talk, switching servers, or removing a server:* + `setting_changed` releases `button_held` when `audio.transmit` leaves + `PushToTalk` (while `!audio_dirty`); `select_server` releases `button_held` + when the held server leaves the screen (without touching `hotkey_held`, so the + global key still releases the server it started on); `delete_bookmark` clears + any hold on the removed session before closing it. +- *Window focus loss and shutdown:* `MainView`'s `observe_window_activation` + unconditionally releases `Sidebar` and calls `AppState::push_to_talk(false)` + when the window becomes inactive (a no-op when `button_held` is `None`; + `hotkey_held` is untouched so the global key keeps working while another + window has focus). `AppState::shutdown` sets `shutting_down`, drops `ptt`, and + releases both holds before sending `CloseSession`, ignoring any late press + that arrives through `Later` after close begins. + +Each guard has deterministic tests (`hold_to_talk_is_released_when_voice_drops`, +`hold_to_talk_is_released_when_the_window_loses_the_focus`, +`leaving_push_to_talk_releases_a_held_button`, +`a_drop_and_reconnect_in_one_batch_releases_a_held_button_and_hotkey`, +`holding_the_button_and_the_hotkey_together_stops_only_when_both_let_go`, +`switching_servers_releases_a_held_button_but_keeps_the_global_hotkey`, +`focus_loss_releases_app_button_hold_unconditionally`, +`a_second_hotkey_press_on_another_server_releases_the_first`, +`removing_a_server_clears_active_transmit_holds`, +`closing_releases_a_held_transmit_and_ignores_late_presses`), and each guard was +mutated to confirm its test goes red. **The global push-to-talk key** (`hotkey.rs`). `voelin_platform::HotkeyManager` (the desktop's portal on Wayland, XInput2 on X11) runs in a task spawned on the @@ -1852,11 +1886,16 @@ itself, so that a test of the state with a real engine never asks the desktop fo a shortcut (the first version of the commit did, and the test scheduler found it: the status line came back from a tokio thread). Its presses and releases come to GPUI's thread through `Later`: a press transmits into the session on screen while -it has voice, the release ends the session the press began in, whichever is on -screen then. How the key stands ("Active: Ctrl+Shift+T (X11)", why it could not -be registered) is in the log and `AppState::ptt_status`; changing the key at run -time (`AppState::set_global_ptt`) is the settings slice's. The loop is the Slint -front end's `GlobalPtt` repeated, as `HostedEngine` is. +it has voice, a repeated press on a different connected server ends the previous +session's transmit before starting the new one, and the release ends the session +the press began in, whichever is on screen then. The event loop (`run_loop`, +tested over private `EventStream` / `Registrar` traits without a portal or +display) fails closed on both termination paths, calling `transmit(false)` before +exiting when the command channel closes and before reporting status when the +desktop removes the shortcut mid-hold. How the key stands ("Active: Ctrl+Shift+T +(X11)", why it could not be registered) is in the log and `AppState::ptt_status`; +changing the key at run time (`AppState::set_global_ptt`) is the settings slice's. +The loop is the Slint front end's `GlobalPtt` repeated, as `HostedEngine` is. #### The properties and callbacks of the voice page