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.8 KiB
Plaintext
53 lines
1.8 KiB
Plaintext
// The stream we watch in a window of its own (desktop), while the main
|
|
// window goes on: the player alone, as in full screen, optionally over the
|
|
// other windows. It has its own globals, which Rust fills like the main
|
|
// window's (src/popout.rs). Closing it brings the stream back into the
|
|
// main window.
|
|
|
|
import { Palette } from "std-widgets.slint";
|
|
import { Theme } from "theme.slint";
|
|
import { Icons } from "icons.slint";
|
|
import { Bridge } from "bridge.slint";
|
|
import { StreamPlayer } from "screens/streams.slint";
|
|
|
|
export component ViewerWindow inherits Window {
|
|
title: Bridge.viewer-title;
|
|
preferred-width: 960px;
|
|
preferred-height: 540px;
|
|
min-width: 480px;
|
|
min-height: 270px;
|
|
// Under the player, which is black.
|
|
background: Theme.bg-app;
|
|
default-font-family: "Inter";
|
|
default-font-size: Theme.font-body;
|
|
icon: Icons.logo;
|
|
always-on-top: Bridge.viewer-on-top;
|
|
|
|
// Scroll bars and menus follow the theme (Rust copies the main
|
|
// window's Theme here).
|
|
property <bool> dark: Theme.dark;
|
|
changed dark => { Palette.color-scheme = Theme.dark ? ColorScheme.dark : ColorScheme.light; }
|
|
init => {
|
|
Palette.color-scheme = Theme.dark ? ColorScheme.dark : ColorScheme.light;
|
|
keys.focus();
|
|
}
|
|
// Into full screen and out of it the clicked button keeps the focus:
|
|
// the keys take it back, so Escape works.
|
|
property <bool> fullscreen: Bridge.viewer-fullscreen;
|
|
changed fullscreen => { keys.focus(); }
|
|
|
|
keys := FocusScope {
|
|
// Escape leaves full screen.
|
|
key-pressed(event) => {
|
|
if event.text == Key.Escape && Bridge.viewer-fullscreen {
|
|
Bridge.toggle-fullscreen();
|
|
return accept;
|
|
}
|
|
reject
|
|
}
|
|
StreamPlayer {
|
|
compact: true;
|
|
}
|
|
}
|
|
}
|