Pop out now opens ViewerWindow: the player alone, titled with the stream, which a pin keeps on top of other windows (always-on-top). The main window goes on; the stream's card on the voice page says it plays in its own window, with Bring back; closing the window brings it back too, on the stream's server, and Leave closes it. Pictures go only to the window that shows the player, so none is scaled twice; full screen and the cursor follow that window. The stream callbacks take a Bridge, the models attach to any Bridge, the theme is copied to every window of its own, and one main-window close handler, installed at start, closes the studio's and the stream's windows (the studio installed its own before). Desktop only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AVRENKftQqGoEeswiR9TDQ
53 lines
1.5 KiB
Rust
53 lines
1.5 KiB
Rust
//! The streams panel, the share dialog and the viewer, for the main window
|
|
//! and for the viewer's own window (each has its own Bridge global).
|
|
|
|
use crate::app::{Bridge, with_app};
|
|
|
|
pub(crate) fn wire(bridge: &Bridge) {
|
|
bridge.on_open_share(|| with_app(|app| app.open_share()).unwrap_or_default());
|
|
bridge.on_start_share(|form| {
|
|
with_app(|app| app.start_share(form));
|
|
});
|
|
bridge.on_stop_share(|| {
|
|
with_app(|app| app.stop_share());
|
|
});
|
|
bridge.on_respond_viewer(|viewer, accept| {
|
|
with_app(|app| app.respond_viewer(viewer as u16, accept));
|
|
});
|
|
bridge.on_kick_viewer(|viewer| {
|
|
with_app(|app| app.kick_viewer(viewer as u16));
|
|
});
|
|
bridge.on_watch_stream(|id| {
|
|
with_app(|app| app.watch_stream(id.to_string()));
|
|
});
|
|
bridge.on_watch_client(|client| {
|
|
if let Ok(client) = u16::try_from(client) {
|
|
with_app(|app| app.watch_client(client));
|
|
}
|
|
});
|
|
bridge.on_show_viewer(|| {
|
|
with_app(|app| app.show_viewer(true));
|
|
});
|
|
bridge.on_hide_viewer(|| {
|
|
with_app(|app| app.show_viewer(false));
|
|
});
|
|
bridge.on_leave_stream(|| {
|
|
with_app(|app| app.leave_stream());
|
|
});
|
|
bridge.on_set_stream_volume(|volume| {
|
|
with_app(|app| app.set_stream_volume(volume));
|
|
});
|
|
bridge.on_toggle_fullscreen(|| {
|
|
with_app(|app| app.toggle_fullscreen());
|
|
});
|
|
bridge.on_pop_out_viewer(|out| {
|
|
with_app(|app| if out { app.viewer_pop_out() } else { app.viewer_dock() });
|
|
});
|
|
bridge.on_show_cursor(|shown| {
|
|
with_app(|app| app.viewer_cursor(shown));
|
|
});
|
|
bridge.on_set_stream_quality(|index| {
|
|
with_app(|app| app.set_stream_quality(index));
|
|
});
|
|
}
|