Skip to content

armgit / WacOS

Public Imported from GitHub
0

A new style desktop shell for Windows 11: menu bar, Dock, Finder, Spotlight, Control Center and Liquid Glass, in native C++.

Rust

Siri: the answer appears as if typed (#38)

Eternity070628d2fdade9a9f2
diff --git a/docs/registro-mudancas.txt b/docs/registro-mudancas.txt
index 4ea21cf..f4d80dd 100644
--- a/docs/registro-mudancas.txt
+++ b/docs/registro-mudancas.txt
@@ -1659,3 +1659,8 @@ Compilado (tudo), instalado, Shell e reserva do Finder reiniciados às 23:07 sem
Compilação completa e instalação. NÃO visto na tela: o relógio em 12 horas (o usuário estava num jogo em tela cheia, a barra
some), a pesquisa na web (a cota grátis do Gemini da conta acabou hoje).
DESFAZER: reverter o commit.
+
+[2026-11-23 17:40, hora do PC] Siri: a resposta aparece digitando (pedido do #38).
+ - src/shell/siri.cpp: a resposta aparece aos poucos, ~110 letras por segundo (no máximo 2,2 s; as longas vão mais rápido);
+ a altura do painel já é a do texto inteiro, para ele não crescer aos pulos. Compilado e instalado; não visto na tela.
+ DESFAZER: reverter o commit.
diff --git a/src/shell/siri.cpp b/src/shell/siri.cpp
index c87cf79..5ab49ab 100644
--- a/src/shell/siri.cpp
+++ b/src/shell/siri.cpp
@@ -320,7 +320,8 @@ float ForcaBrilho(double now) {
return k >= 1 ? 0.f : (1 - k) * (1 - k);
}
bool Animando(double now) {
- return g_closing || g_busy || !anim::PanelIn(now - g_openAt).done || now - g_answerAt < 950;
+ double digitar = g_a.size() / std::max(110.0, g_a.size() / 2.2) * 1000.0; // o tempo da resposta "digitando"
+ return g_closing || g_busy || !anim::PanelIn(now - g_openAt).done || now - g_answerAt < std::max(950.0, digitar + 50);
}
void Paint() {
@@ -330,7 +331,14 @@ void Paint() {
bool dark = ui::Dark();
float textW = W - PAD * 2 - ORB - 14;
std::wstring a = g_busy ? std::wstring(Tr(L"Pensando")) + std::wstring((size_t)(g_pontos % 3 + 1), L'.') : g_a;
- float qh = AlturaTexto(g_q, g_tfQ, textW), ah = AlturaTexto(a, g_tfA, textW);
+ float ah = AlturaTexto(a, g_tfA, textW); // a altura é a do texto inteiro: o painel não cresce aos pulos enquanto ele "digita"
+ // a resposta aparece como se fosse digitada (issue #38): ~110 letras por segundo, no máximo 2,2 s (as longas vão mais rápido)
+ if (!g_busy && !g_entrada && g_answerAt > 0) {
+ double vel = std::max(110.0, g_a.size() / 2.2);
+ size_t n = (size_t)std::max(0.0, (now - g_answerAt) / 1000.0 * vel);
+ if (n < a.size()) { a = a.substr(0, n); if (n && IS_HIGH_SURROGATE(a.back())) a.pop_back(); }
+ }
+ float qh = AlturaTexto(g_q, g_tfQ, textW);
g_contentH = PAD + qh + 8 + ah + PAD;
if (g_entrada) { // só o campo: uma linha (ou mais, se o texto quebrar)
qh = 0; ah = std::max(AlturaTexto(g_texto.empty() ? L"M" : g_texto, g_tfA, textW), 20.f);