Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ English (US) release notes, mirroring CHANGELOG.md (Brazilian Portuguese). Befor
- Settings → "Receive test versions (alpha and beta)": anyone can join the tests of upcoming versions from the app. Off by default; turning it on shows a warning that test versions can have bugs.

### Fixes
- Session menu: the notice that shows the shortcut when a session starts no longer gets stuck on screen; it goes away by itself after a few seconds. (#114)
- Displays: a monitor turned to portrait (rotated) keeps its rotation in the layout backup, so restoring the desk puts it back in portrait. Before, the rotation was never saved or restored. (#108)
- Playnite: a slow start no longer sends you back to the PC after a few seconds. When Playnite swaps its loading window for the main one, Console Mode now follows the new window and only restores the desk once Playnite actually closes. (#83)
- Audio: if switching the output fails, the session goes on instead of being rolled back after the screens were already switched. (#109)
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Notas em português do Brasil; a versão em inglês (Estados Unidos) fica em `CH
- Ajustes → "Receber versões de teste (alpha e beta)": qualquer pessoa pode entrar nos testes das próximas versões pelo próprio app. Desligado por padrão; ao ligar, o app avisa que a versão pode ter bugs.

### Correções
- Menu da sessão: o aviso que mostra o atalho no início da sessão não fica mais preso na tela; ele some sozinho depois de alguns segundos. (#114)
- Telas: um monitor girado (em retrato) mantém a rotação no backup do layout, então restaurar a mesa devolve o monitor em retrato. Antes a rotação nunca era salva nem restaurada. (#108)
- Playnite: quando ele demora para abrir, o app não volta mais para o PC depois de alguns segundos. Se o Playnite troca a janela de carregamento pela principal, o Console Mode passa a acompanhar a nova e só restaura a mesa quando o Playnite fecha de verdade. (#83)
- Áudio: se a troca da saída falhar, a sessão continua em vez de ser desfeita depois de as telas já terem sido trocadas. (#109)
Expand Down
1 change: 1 addition & 0 deletions docs/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Pré-condições: sessão ativa com Big Picture (ou jogo borderless) na tela; co

- [ ] Segurar **Select + Y** por ~0,3 s abre o menu centralizado na tela de jogo, por cima do Big Picture, com foco em "Voltar ao jogo". Resultado: ______
- [ ] Select + Y de novo (ou B, ou Esc) fecha o menu e o jogo continua onde estava. Resultado: ______
- [ ] O aviso "Menu do Console Mode" do início da sessão some sozinho em cerca de 7 s, em várias sessões seguidas, e nunca fica preso na tela. Resultado: ______
- [ ] Cabeçalho mostra o relógio, "Jogando há X min" e o controle detectado. Resultado: ______
- [ ] **Volume:** ◀/▶ na linha muda de 5 em 5 e o Windows reflete; A alterna mudo. O valor inicial é o atual do Windows. Resultado: ______
- [ ] **Resolução:** abre a lista com a atual marcada; escolher outra aplica na TV, o Big Picture continua aberto e a sessão não se encerra sozinha. Ao restaurar no fim, a resolução original volta. Resultado: ______
Expand Down
29 changes: 24 additions & 5 deletions src/ConsoleMode/SessionHintWindow.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Runtime.InteropServices;
using ConsoleMode.Models;
using ConsoleMode.Native;
using ConsoleMode.Services;
using Microsoft.UI;
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
Expand All @@ -21,6 +22,12 @@ public sealed class SessionHintWindow : Window
private const double HeightDip = 96;
private const double MarginDip = 28;

// Nobody holds the window after "new": without this the GC can collect it and its timer
// before they fire, and the toast then stays on screen and never closes.
private static readonly HashSet<SessionHintWindow> Live = [];

private readonly Microsoft.UI.Dispatching.DispatcherQueueTimer _timer;

public SessionHintWindow(string title, string body, ScreenRect? target, TimeSpan duration)
{
var icon = new FontIcon { Glyph = "", FontSize = 30, VerticalAlignment = VerticalAlignment.Center };
Expand Down Expand Up @@ -58,11 +65,23 @@ public SessionHintWindow(string title, string body, ScreenRect? target, TimeSpan
WindowPlacement.TopRightOn(appWindow, target, WidthDip, HeightDip, MarginDip);
appWindow.Show(activateWindow: false);

var timer = DispatcherQueue.CreateTimer();
timer.Interval = duration;
timer.IsRepeating = false;
timer.Tick += (_, _) => Close();
timer.Start();
Live.Add(this);
Closed += (_, _) =>
{
_timer?.Stop();
Live.Remove(this);
};

_timer = DispatcherQueue.CreateTimer();
_timer.Interval = duration;
_timer.IsRepeating = false;
_timer.Tick += (_, _) =>
{
_timer.Stop();
try { Close(); }
catch (Exception ex) { AppLog.Write($"Menu da sessão: aviso não fechou: {ex.Message}"); }
};
_timer.Start();
}

private const int GwlExStyle = -20;
Expand Down
Loading