A new style desktop shell for Windows 11: menu bar, Dock, Finder, Spotlight, Control Center and Liquid Glass, in native C++.
Rust
Fix issues #248 #250 #254 #257 #258 #259 #264 #266 #268 #269
Eternity0706287c9ce8d2b7f7
diff --git a/docs/registro-mudancas.txt b/docs/registro-mudancas.txtindex 3df9e93..b1ee80f 100644--- a/docs/registro-mudancas.txt+++ b/docs/registro-mudancas.txt@@ -2123,3 +2123,26 @@ Compilado (tudo), instalado, Shell e reserva do Finder reiniciados às 23:07 semjanelas Mozilla* ganham 1 px de movimento e voltam (macjanela.cpp Attach; mj5.rs attach).Compilado (build.cmd shell, build.cmd janelas; build-rust.ps1 -Zip). Não instalado, não testado ao vivo.DESFAZER: reverter os commits (main e claude/rust-port-teste-23da8b) e compilar de novo.+[2026-11-29 09:30] Issues e PRs de 29/11 (C++ e Rust):+ - PRs mesclados no main: #262 (widget do calendário abre o Calendário do WacOS, Wallpaper Engine fora do Modo Jogo,+ clique no aviso do Thunderbird/Firefox abre o app, ícones só pequenos ampliados, cantos dos ícones quadrados no Dock),+ #263 (faixa dos botões no Chromium só onde desenha; sem piscar os botões do Windows), #270 (papel de parede animado:+ ícones do Explorador escondidos, nomes claros/escuros), #271 (números do Monitor de Atividade no formato do idioma),+ #272 (textos e nomes dos apps traduzidos). No Rust: #262, #263, #271 e a lista de nomes do #272; dicionários+ sincronizados. #270, #203, #194, #196 e #227 ainda só no C++.+ - #248: o gancho das barras não entrava se a NOSSA mesa (ou outra janela do Shell em tela cheia) estivesse na frente+ (QUNS_BUSY). Janela do próprio Shell na frente não conta mais; quando bloqueia, o log diz o estado e quem está na frente.+ - #250: o truque do Alt (keybd_event Alt+vkE8) só quando o SetForegroundWindow falha (TrazPraFrente / traz_pra_frente):+ as teclas falsas chegavam ao Noctty como "@".+ - #268/#254: app aberto pelo Spotlight ou pelo Ctrl+Shift+Esc voltava para trás. apps::EsperaAbrir: a primeira janela de+ app que aparece nos 8 s seguintes fica na frente por 1,5 s (para se o usuário clicar).+ - #258: o ajustes.txt grava só as chaves mudadas por cima do arquivo relido (Shell C++ e Rust): linhas à mão, de+ outro app ou da outra edição não somem mais.+ - #259: ícone da barra lateral dos Ajustes centrado na linha (Tahoe: 32 px).+ - #257: nos idiomas ko/ja/zh, altura e linha de base uniformes pela fonte do formato (cjk::Format / cjk::format).+ - #269: o volume (Central de Controle e menu de som) gravado numa thread, só o último valor, com a marca do Shell.+ - #266: Finder em colunas: a roda sobre a coluna da pasta aberta ativa essa coluna e rola ela.+ - #247/#264: temperatura=auto|c|f (Ajustes > Barra de menus > Temperatura). Automático segue a região do Windows.+ Widgets e app Tempo convertem na hora de mostrar (comum/temperatura.h, comum/src/temperatura.rs).+ Compilado (build.cmd, build.cmd janelas, cargo check). Não testado ao vivo.+ DESFAZER: reverter os commits (main e claude/rust-port-teste-23da8b) e compilar de novo.diff --git a/src/ajustes/main.cpp b/src/ajustes/main.cppindex 16eb1c2..48f55b2 100644--- a/src/ajustes/main.cpp+++ b/src/ajustes/main.cpp@@ -1215,7 +1215,10 @@ void DrawSidebar(aj::Ctx& c, const Pal& pal, float H) {if (sel) { c.br->SetColor(pal.sideSel); c.dc->FillRoundedRectangle(D2D1::RoundedRect(rr, selR, selR), c.br); }g_tileBare = true;- aj::Tile(c, D2D1::RectF(14, y + 4, 34, y + 24), it.glyph, it.color, SymbolFor(it.name));+ { // centrado na linha (28 no Sequoia, 32 no Tahoe: o ícone ficava 2 px acima do nome, issue #259)+ float ty = y + (SIDE_ROW - 20) / 2;+ aj::Tile(c, D2D1::RectF(14, ty, 34, ty + 20), it.glyph, it.color, SymbolFor(it.name));+ }g_tileBare = false;aj::Text(c, it.name, D2D1::RectF(42, y, SIDE_W - 14, y + SIDE_ROW), g_tfSide, sel ? pal.sideSelText : pal.text);g_hits.push_back({ H_SIDE, rr, i });diff --git a/src/ajustes/paginas.cpp b/src/ajustes/paginas.cppindex 8772601..8d2fc56 100644--- a/src/ajustes/paginas.cpp+++ b/src/ajustes/paginas.cpp@@ -1730,6 +1730,11 @@ Page CentralControle() {[] { auto v = Setting(L"relogio_formato", L"auto"); return v == L"24" ? 1 : v == L"12" ? 2 : 0; },[](int i) { SetSetting(L"relogio_formato", i == 1 ? L"24" : i == 2 ? L"12" : L"auto"); });formato.icon = 0xE916; formato.iconColor = C_GRAY;+ // issues #247 e #264: Celsius ou Fahrenheit (widgets, app Tempo); Automático segue a região do Windows+ Row temp = Popup(L"Temperatura", { L"Automático", L"Celsius (°C)", L"Fahrenheit (°F)" },+ [] { auto v = Setting(L"temperatura", L"auto"); return v == L"c" ? 1 : v == L"f" ? 2 : 0; },+ [](int i) { SetSetting(L"temperatura", i == 1 ? L"c" : i == 2 ? L"f" : L"auto"); });+ temp.icon = 0xE9CA; temp.iconColor = C_GRAY;// issue #38: os segundos no relógio da barraRow segundos = Toggle(L"Mostrar os segundos", [] { return Setting(L"relogio_segundos", L"0") == L"1"; },[](bool v) { SetSetting(L"relogio_segundos", v ? L"1" : L"0"); });@@ -1774,7 +1779,7 @@ Page CentralControle() {[] { return Setting(L"logo_barra", L"apple") == L"windows" ? 1 : 0; },[](int i) { SetSetting(L"logo_barra", i == 1 ? L"windows" : L"apple"); });logo.icon = 0xE782; logo.iconColor = C_GRAY;- p.groups.push_back(G({ clock, formato, segundos, desligar, ocultar, telaCheia, altura, logo, baixo, todos, priv }));+ p.groups.push_back(G({ clock, formato, segundos, temp, desligar, ocultar, telaCheia, altura, logo, baixo, todos, priv }));return p;}diff --git a/src/clima/main.cpp b/src/clima/main.cppindex 0af177b..fab94c8 100644--- a/src/clima/main.cpp+++ b/src/clima/main.cpp@@ -7,6 +7,7 @@#include "../comum/app2d.h"#include "../comum/fonte_cjk.h" // a reserva para coreano, japonês e chinês#include "../comum/cidade_padrao.h"+#include "../comum/temperatura.h" // temperatura=auto|c|f (issues #247 e #264)#include <winhttp.h>#include <map>#include <mutex>@@ -142,6 +143,8 @@ std::wstring Setting(const wchar_t* key, const wchar_t* def) {for (auto& l : ReadLines(DataPath(L"ajustes.txt"))) { size_t e = l.find(L'='); if (e != std::wstring::npos && l.substr(0, e) == key) return l.substr(e + 1); }return def;}+// a temperatura na unidade escolhida (lida uma vez: trocar nos Ajustes vale ao abrir o Tempo de novo)+float TF(float c) { static bool f = temperatura::Fahrenheit(Setting(L"temperatura", L"auto")); return temperatura::Mostra(c, f); }// "Meu Local" vai para os Ajustes (tempoCidade/Lat/Lon), o mesmo do widget da mesavoid SetMyPlace(const Place& p) {SetAppSetting(L"tempoCidade", p.name);@@ -298,7 +301,7 @@ void PaintGoldenWx() {if (i == 0) Text(Tr(p.name), g_tfSmall, D2D1::RectF(r.left + 12, r.top + 28, r.right - 60, r.top + 46), tdim);if (p.wx.ok) {Text(CondText(p.wx.code), g_tfSmall, D2D1::RectF(r.left + 12, r.bottom - 24, r.right - 60, r.bottom - 6), dim);- wchar_t t[16]; swprintf_s(t, L"%d°", (int)std::lround(p.wx.temp));+ wchar_t t[16]; swprintf_s(t, L"%d°", (int)std::lround(TF(p.wx.temp)));Text(t, g_tfSideTemp, D2D1::RectF(r.right - 80, r.top + 4, r.right - 12, r.top + 44), white);}g_hits.push_back({ 1, i, r });@@ -320,10 +323,10 @@ void PaintGoldenWx() {float oy = -g_gScroll;wchar_t t[64];Text(g_sel == 0 ? std::wstring(Tr(L"Meu Local")) : Tr(pl.name), g_tfCityG, D2D1::RectF(X0, oy + 94, sz.width, oy + 120), white);- swprintf_s(t, L" %d°", (int)std::lround(w.temp));+ swprintf_s(t, L" %d°", (int)std::lround(TF(w.temp)));Text(t, g_tfTempG, D2D1::RectF(X0, oy + 118, sz.width, oy + 182), white);Text(CondText(w.code), g_tfCondG, D2D1::RectF(X0, oy + 177, sz.width, oy + 195), white);- if (!w.days.empty()) { swprintf_s(t, Tr(L"Máx.: %d° Mín.: %d°"), (int)std::lround(w.days[0].hi), (int)std::lround(w.days[0].lo)); Text(t, g_tfCondG, D2D1::RectF(X0, oy + 194, sz.width, oy + 212), white); }+ if (!w.days.empty()) { swprintf_s(t, Tr(L"Máx.: %d° Mín.: %d°"), (int)std::lround(TF(w.days[0].hi)), (int)std::lround(TF(w.days[0].lo))); Text(t, g_tfCondG, D2D1::RectF(X0, oy + 194, sz.width, oy + 212), white); }float GW = 622, x0 = cx - GW / 2, y0 = oy + 266;if (x0 < X0 + 12) { x0 = X0 + 12; GW = sz.width - X0 - 24; }float sm = (GW - 32 - 304) / 2 > 100 ? 143.f : (GW - 16) / 2, wideX = x0 + 2 * sm + 32, wideW = x0 + GW - wideX;@@ -331,7 +334,7 @@ void PaintGoldenWx() {D2D1_RECT_F c1 = D2D1::RectF(x0, y0, x0 + sm, y0 + 141), c2 = D2D1::RectF(x0 + sm + 16, y0, x0 + 2 * sm + 16, y0 + 141);D2D1_RECT_F c3 = D2D1::RectF(wideX, y0, wideX + wideW, y0 + 141);GlassCard(c1); CardHead(c1, Tr(L"SENSAÇÃO"));- swprintf_s(t, L"%d°", (int)std::lround(w.feels));+ swprintf_s(t, L"%d°", (int)std::lround(TF(w.feels)));Text(t, g_tfBigG, D2D1::RectF(c1.left + 14, c1.top + 28, c1.right, c1.top + 62), white);{IDWriteTextFormat* f = g_tfSmallW;@@ -365,7 +368,7 @@ void PaintGoldenWx() {float x = c3.left + 8 + k * cw;Text(k == 0 ? std::wstring(Tr(L"Agora")) : HourOf(hh.t, w.off), g_tfHdrC, D2D1::RectF(x, c3.top + 50, x + cw, c3.top + 66), white);Text(CondEmoji(hh.code, hh.day), g_tfEmojiSmall, D2D1::RectF(x, c3.top + 70, x + cw, c3.top + 100), white);- swprintf_s(t, L"%d°", (int)std::lround(hh.temp));+ swprintf_s(t, L"%d°", (int)std::lround(TF(hh.temp)));Text(t, g_tfCardG, D2D1::RectF(x, c3.top + 104, x + cw, c3.top + 126), white);}}@@ -399,7 +402,7 @@ void PaintGoldenWx() {if (k) Fill(D2D1::RectF(c5.left + 14, yy, c5.right - 14, yy + 0.5f), Rgb(255, 255, 255, 0.22f));Text(k == 0 ? std::wstring(Tr(L"Hoje")) : std::wstring(WeekdayShort(WdayOf(d.t + 12 * 3600, w.off))), g_tfCondTitle, D2D1::RectF(c5.left + 14, yy, c5.left + 64, yy + 42), white);Text(CondEmoji(d.code, true), g_tfEmojiSmall, D2D1::RectF(c5.left + 64, yy, c5.left + 100, yy + 42), white);- swprintf_s(t, L"%d°", (int)std::lround(d.lo)); Text(t, g_tfRowR, D2D1::RectF(c5.left + 100, yy, c5.left + 138, yy + 42), dim);+ swprintf_s(t, L"%d°", (int)std::lround(TF(d.lo))); Text(t, g_tfRowR, D2D1::RectF(c5.left + 100, yy, c5.left + 138, yy + 42), dim);float bx0 = c5.left + 146, bx1 = c5.right - 52, by = yy + 21;Fill(D2D1::RectF(bx0, by - 2.5f, bx1, by + 2.5f), Rgb(0, 0, 0, 0.16f), 2.5f);float span = std::max(1.f, hi - lo), a = bx0 + (d.lo - lo) / span * (bx1 - bx0), b = bx0 + (d.hi - lo) / span * (bx1 - bx0);@@ -409,7 +412,7 @@ void PaintGoldenWx() {if (st) rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ a, 0 }, { std::max(a + 6, b), 0 }), st, &lg);if (lg) { rt->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(a, by - 2.5f, std::max(a + 6, b), by + 2.5f), 2.5f, 2.5f), lg); lg->Release(); }if (st) st->Release();- swprintf_s(t, L"%d°", (int)std::lround(d.hi)); Text(t, g_tfRowR, D2D1::RectF(c5.right - 50, yy, c5.right - 14, yy + 42), white);+ swprintf_s(t, L"%d°", (int)std::lround(TF(d.hi))); Text(t, g_tfRowR, D2D1::RectF(c5.right - 50, yy, c5.right - 14, yy + 42), white);}}// linha 3: nascer e pôr do sol@@ -476,7 +479,7 @@ void Paint() {if (i == 0) Text(Tr(pl.name), g_tfSmall, D2D1::RectF(r.left + 12, r.top + 28, r.right - 60, r.top + 46), pl.wx.ok ? dim : gray);if (pl.wx.ok) {Text(CondText(pl.wx.code), g_tfSmall, D2D1::RectF(r.left + 12, r.bottom - 24, r.right - 60, r.bottom - 6), dim);- wchar_t t[16]; swprintf_s(t, L"%d°", (int)std::lround(pl.wx.temp));+ wchar_t t[16]; swprintf_s(t, L"%d°", (int)std::lround(TF(pl.wx.temp)));Text(t, g_tfSideTemp, D2D1::RectF(r.right - 70, r.top + 4, r.right - 10, r.top + 44), white);}g_hits.push_back({ 1, i, r });@@ -503,10 +506,10 @@ void Paint() {float cx = (SB + sz.width) / 2, W = sz.width - SB;Text(g_sel == 0 ? std::wstring(Tr(L"Meu Local")) : Tr(pl.name), g_tfCity, D2D1::RectF(SB, 24, sz.width, 62), white);if (g_sel == 0) Text(Tr(pl.name), g_tfSmallC, D2D1::RectF(SB, 58, sz.width, 76), dim);- wchar_t t[32]; swprintf_s(t, L" %d°", (int)std::lround(w.temp));+ wchar_t t[32]; swprintf_s(t, L" %d°", (int)std::lround(TF(w.temp)));Text(t, g_tfTemp, D2D1::RectF(SB, 70, sz.width, 170), white);Text(CondText(w.code), g_tfCond, D2D1::RectF(SB, 168, sz.width, 194), white);- if (!w.days.empty()) { swprintf_s(t, Tr(L"Máx.: %d° Mín.: %d°"), (int)std::lround(w.days[0].hi), (int)std::lround(w.days[0].lo)); Text(t, g_tfCond, D2D1::RectF(SB, 192, sz.width, 218), white); }+ if (!w.days.empty()) { swprintf_s(t, Tr(L"Máx.: %d° Mín.: %d°"), (int)std::lround(TF(w.days[0].hi)), (int)std::lround(TF(w.days[0].lo))); Text(t, g_tfCond, D2D1::RectF(SB, 192, sz.width, 218), white); }float pad = 20, y0 = 236;// por horaD2D1_RECT_F hr = D2D1::RectF(SB + pad, y0, sz.width - pad, y0 + 124);@@ -522,7 +525,7 @@ void Paint() {float x = hr.left + 10 + k * cw;Text(k == 0 ? std::wstring(Tr(L"Agora")) : HourOf(h.t, w.off), g_tfCard, D2D1::RectF(x, hr.top + 30, x + cw, hr.top + 50), white);Text(CondEmoji(h.code, h.day), g_tfEmojiSmall, D2D1::RectF(x, hr.top + 52, x + cw, hr.top + 84), white);- swprintf_s(t, L"%d°", (int)std::lround(h.temp));+ swprintf_s(t, L"%d°", (int)std::lround(TF(h.temp)));Text(t, g_tfCardBig, D2D1::RectF(x, hr.top + 88, x + cw, hr.top + 114), white);}// 10 dias@@ -538,12 +541,12 @@ void Paint() {if (yy + rowH > dr.bottom) break;Text(k == 0 ? std::wstring(Tr(L"Hoje")) : std::wstring(WeekdayShort(WdayOf(d.t + 12 * 3600, w.off))), g_tfCard, D2D1::RectF(dr.left + 14, yy, dr.left + 70, yy + rowH), white);Text(CondEmoji(d.code, true), g_tfEmojiSmall, D2D1::RectF(dr.left + 64, yy, dr.left + 100, yy + rowH), white);- swprintf_s(t, L"%d°", (int)std::lround(d.lo)); Text(t, g_tfRowR, D2D1::RectF(dr.left + 96, yy, dr.left + 136, yy + rowH), dim);+ swprintf_s(t, L"%d°", (int)std::lround(TF(d.lo))); Text(t, g_tfRowR, D2D1::RectF(dr.left + 96, yy, dr.left + 136, yy + rowH), dim);float bx0 = dr.left + 146, bx1 = dr.right - 56, by = yy + rowH / 2;Fill(D2D1::RectF(bx0, by - 2.5f, bx1, by + 2.5f), Rgb(0, 0, 0, 0.18f), 2.5f);float span = std::max(1.f, hi - lo), a = bx0 + (d.lo - lo) / span * (bx1 - bx0), b = bx0 + (d.hi - lo) / span * (bx1 - bx0);Fill(D2D1::RectF(a, by - 2.5f, std::max(a + 6, b), by + 2.5f), Rgb(255, 196, 64), 2.5f);- swprintf_s(t, L"%d°", (int)std::lround(d.hi)); Text(t, g_tfRowR, D2D1::RectF(dr.right - 52, yy, dr.right - 12, yy + rowH), white);+ swprintf_s(t, L"%d°", (int)std::lround(TF(d.hi))); Text(t, g_tfRowR, D2D1::RectF(dr.right - 52, yy, dr.right - 12, yy + rowH), white);}// quadrosfloat qx = dr.right + pad, qw = (sz.width - pad - qx - pad) / 2, qh = std::min(150.f, (dr.bottom - dr.top - pad) / 2);@@ -558,7 +561,7 @@ void Paint() {if (f) f->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP);};if (g_tfCity) g_tfCity->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING);- swprintf_s(t, L"%d°", (int)std::lround(w.feels));+ swprintf_s(t, L"%d°", (int)std::lround(TF(w.feels)));quad(0, Tr(L"SENSAÇÃO"), t, w.feels < w.temp - 1 ? Tr(L"O vento deixa mais frio do que a temperatura real.") : w.feels > w.temp + 1 ? Tr(L"A umidade deixa mais quente do que a temperatura real.") : Tr(L"Parecida com a temperatura real."));swprintf_s(t, L"%d%%", (int)std::lround(w.hum));quad(1, Tr(L"UMIDADE"), t, L"");diff --git a/src/comum/fonte_cjk.h b/src/comum/fonte_cjk.hindex 8aa9fee..3ae57ed 100644--- a/src/comum/fonte_cjk.h+++ b/src/comum/fonte_cjk.h@@ -95,12 +95,43 @@ inline void Apply(IDWriteFactory* factory, IDWriteTextFormat* tf) {if (SUCCEEDED(tf->QueryInterface(__uuidof(IDWriteTextFormat1), (void**)&t1)) && t1) { t1->SetFontFallback(fb); t1->Release(); }}+// Issue #257 (aoiro-labo): cada linha pega a altura e a linha de base da fonte que desenha o texto. Hiragino/PingFang+// têm a subida maior e um espaço entre linhas que o SF não tem: a 13 px, um nome em japonês ficava ~2 px mais baixo que+// o valor em latim ao lado (Sobre Este Mac, barras laterais). Nos idiomas CJK, a altura e a linha de base de todo+// formato vêm da fonte do próprio formato (o SF): latim, CJK e misturado na mesma linha. Quem põe o próprio+// espaçamento no texto (editor do Notas, avisos) continua mandando. Nos outros idiomas fica como antes.+inline void Uniforme(IDWriteTextFormat* tf, IDWriteFontCollection* collection, const wchar_t* family, DWRITE_FONT_WEIGHT weight,+ DWRITE_FONT_STYLE style, DWRITE_FONT_STRETCH stretch, float size) {+ const Prefs& p = ReadPrefs();+ if (!tf || !family || (p.lang != L"ko" && p.lang != L"ja" && p.lang != L"zh")) return;+ IDWriteFontCollection* col = collection;+ if (!col) tf->GetFontCollection(&col); else col->AddRef();+ if (!col) return;+ UINT32 idx = 0; BOOL existe = FALSE;+ IDWriteFontFamily* fam = nullptr; IDWriteFont* font = nullptr;+ if (SUCCEEDED(col->FindFamilyName(family, &idx, &existe)) && existe && SUCCEEDED(col->GetFontFamily(idx, &fam)) && fam &&+ SUCCEEDED(fam->GetFirstMatchingFont(weight, stretch, style, &font)) && font) {+ DWRITE_FONT_METRICS m{};+ font->GetMetrics(&m);+ if (m.designUnitsPerEm) {+ float em = size / m.designUnitsPerEm;+ tf->SetLineSpacing(DWRITE_LINE_SPACING_METHOD_UNIFORM, (m.ascent + m.descent + m.lineGap) * em, m.ascent * em);+ }+ }+ if (font) font->Release();+ if (fam) fam->Release();+ col->Release();+}+// factory->CreateTextFormat(...) com a reserva CJKinline HRESULT Format(IDWriteFactory* factory, const wchar_t* family, IDWriteFontCollection* collection, DWRITE_FONT_WEIGHT weight,DWRITE_FONT_STYLE style, DWRITE_FONT_STRETCH stretch, float size, const wchar_t* locale, IDWriteTextFormat** out) {if (!factory) return E_POINTER;HRESULT hr = factory->CreateTextFormat(family, collection, weight, style, stretch, size, locale, out);- if (SUCCEEDED(hr) && out && *out) Apply(factory, *out);+ if (SUCCEEDED(hr) && out && *out) {+ Apply(factory, *out);+ Uniforme(*out, collection, family, weight, style, stretch, size);+ }return hr;}diff --git a/src/comum/idioma_de.inc b/src/comum/idioma_de.incindex fb86b88..c813596 100644--- a/src/comum/idioma_de.inc+++ b/src/comum/idioma_de.inc@@ -1695,6 +1695,8 @@{ L"Roda no próprio PC: as perguntas não saem dele. Abra o app antes de perguntar.", L"Läuft auf diesem PC: Deine Fragen verlassen ihn nicht. Öffne die App, bevor du fragst." },{ L"Mostrar os segundos", L"Sekunden anzeigen" },{ L"Pergunte à Siri…", L"Siri fragen …" },+{ L"Celsius (°C)", L"Celsius (°C)" },+{ L"Fahrenheit (°F)", L"Fahrenheit (°F)" },{ L"Formato da hora", L"Zeitformat" },{ L"24 horas", L"24 Stunden" },{ L"12 horas (AM/PM)", L"12 Stunden (AM/PM)" },diff --git a/src/comum/idioma_en.inc b/src/comum/idioma_en.incindex d0da610..60348df 100644--- a/src/comum/idioma_en.inc+++ b/src/comum/idioma_en.inc@@ -1705,6 +1705,8 @@{ L"Roda no próprio PC: as perguntas não saem dele. Abra o app antes de perguntar.", L"Runs on this PC: your questions don't leave it. Open the app before asking." },{ L"Mostrar os segundos", L"Show seconds" },{ L"Pergunte à Siri…", L"Ask Siri…" },+{ L"Celsius (°C)", L"Celsius (°C)" },+{ L"Fahrenheit (°F)", L"Fahrenheit (°F)" },{ L"Formato da hora", L"Time format" },{ L"24 horas", L"24-hour" },{ L"12 horas (AM/PM)", L"12-hour (AM/PM)" },diff --git a/src/comum/idioma_es.inc b/src/comum/idioma_es.incindex 1211a7d..cc81e4f 100644--- a/src/comum/idioma_es.inc+++ b/src/comum/idioma_es.inc@@ -1695,6 +1695,8 @@{ L"Roda no próprio PC: as perguntas não saem dele. Abra o app antes de perguntar.", L"Se ejecuta en este PC: tus preguntas no salen de él. Abre la app antes de preguntar." },{ L"Mostrar os segundos", L"Mostrar los segundos" },{ L"Pergunte à Siri…", L"Pregunta a Siri…" },+{ L"Celsius (°C)", L"Celsius (°C)" },+{ L"Fahrenheit (°F)", L"Fahrenheit (°F)" },{ L"Formato da hora", L"Formato de hora" },{ L"24 horas", L"24 horas" },{ L"12 horas (AM/PM)", L"12 horas (AM/PM)" },diff --git a/src/comum/idioma_fr.inc b/src/comum/idioma_fr.incindex da2491b..caa9b1c 100644--- a/src/comum/idioma_fr.inc+++ b/src/comum/idioma_fr.inc@@ -1695,6 +1695,8 @@{ L"Roda no próprio PC: as perguntas não saem dele. Abra o app antes de perguntar.", L"Fonctionne sur ce PC : vos questions n'en sortent pas. Ouvrez l'app avant de poser une question." },{ L"Mostrar os segundos", L"Afficher les secondes" },{ L"Pergunte à Siri…", L"Demandez à Siri…" },+{ L"Celsius (°C)", L"Celsius (°C)" },+{ L"Fahrenheit (°F)", L"Fahrenheit (°F)" },{ L"Formato da hora", L"Format de l'heure" },{ L"24 horas", L"24 heures" },{ L"12 horas (AM/PM)", L"12 heures (AM/PM)" },diff --git a/src/comum/idioma_it.inc b/src/comum/idioma_it.incindex a3790f4..ab962fb 100644--- a/src/comum/idioma_it.inc+++ b/src/comum/idioma_it.inc@@ -1695,6 +1695,8 @@{ L"Roda no próprio PC: as perguntas não saem dele. Abra o app antes de perguntar.", L"Funziona su questo PC: le domande non escono da qui. Apri l'app prima di chiedere." },{ L"Mostrar os segundos", L"Mostra i secondi" },{ L"Pergunte à Siri…", L"Chiedi a Siri…" },+{ L"Celsius (°C)", L"Celsius (°C)" },+{ L"Fahrenheit (°F)", L"Fahrenheit (°F)" },{ L"Formato da hora", L"Formato ora" },{ L"24 horas", L"24 ore" },{ L"12 horas (AM/PM)", L"12 ore (AM/PM)" },diff --git a/src/comum/idioma_ja.inc b/src/comum/idioma_ja.incindex d8ef372..68e8a66 100644--- a/src/comum/idioma_ja.inc+++ b/src/comum/idioma_ja.inc@@ -1695,6 +1695,8 @@{ L"Roda no próprio PC: as perguntas não saem dele. Abra o app antes de perguntar.", L"この PC で動作します: 質問は PC の外に出ません。質問する前にアプリを開いてください。" },{ L"Mostrar os segundos", L"秒を表示" },{ L"Pergunte à Siri…", L"Siri に聞く…" },+{ L"Celsius (°C)", L"摂氏 (°C)" },+{ L"Fahrenheit (°F)", L"華氏 (°F)" },{ L"Formato da hora", L"時刻の形式" },{ L"24 horas", L"24 時間" },{ L"12 horas (AM/PM)", L"12 時間 (AM/PM)" },diff --git a/src/comum/idioma_ko.inc b/src/comum/idioma_ko.incindex 9e8ff9d..455ff85 100644--- a/src/comum/idioma_ko.inc+++ b/src/comum/idioma_ko.inc@@ -1695,6 +1695,8 @@{ L"Roda no próprio PC: as perguntas não saem dele. Abra o app antes de perguntar.", L"이 PC에서 실행됩니다: 질문이 PC 밖으로 나가지 않습니다. 질문하기 전에 앱을 여세요." },{ L"Mostrar os segundos", L"초 표시" },{ L"Pergunte à Siri…", L"Siri에게 묻기…" },+{ L"Celsius (°C)", L"섭씨 (°C)" },+{ L"Fahrenheit (°F)", L"화씨 (°F)" },{ L"Formato da hora", L"시간 형식" },{ L"24 horas", L"24시간" },{ L"12 horas (AM/PM)", L"12시간(AM/PM)" },diff --git a/src/comum/idioma_pl.inc b/src/comum/idioma_pl.incindex e727a7b..d18814a 100644--- a/src/comum/idioma_pl.inc+++ b/src/comum/idioma_pl.inc@@ -1695,6 +1695,8 @@{ L"Roda no próprio PC: as perguntas não saem dele. Abra o app antes de perguntar.", L"Działa na tym komputerze: pytania go nie opuszczają. Otwórz aplikację przed pytaniem." },{ L"Mostrar os segundos", L"Pokazuj sekundy" },{ L"Pergunte à Siri…", L"Zapytaj Siri…" },+{ L"Celsius (°C)", L"Celsjusz (°C)" },+{ L"Fahrenheit (°F)", L"Fahrenheit (°F)" },{ L"Formato da hora", L"Format godziny" },{ L"24 horas", L"24-godzinny" },{ L"12 horas (AM/PM)", L"12-godzinny (AM/PM)" },diff --git a/src/comum/idioma_ru.inc b/src/comum/idioma_ru.incindex 47b9330..55cfd66 100644--- a/src/comum/idioma_ru.inc+++ b/src/comum/idioma_ru.inc@@ -1695,6 +1695,8 @@{ L"Roda no próprio PC: as perguntas não saem dele. Abra o app antes de perguntar.", L"Работает на этом ПК: вопросы не покидают его. Откройте приложение перед вопросом." },{ L"Mostrar os segundos", L"Показывать секунды" },{ L"Pergunte à Siri…", L"Спросите Siri…" },+{ L"Celsius (°C)", L"Цельсий (°C)" },+{ L"Fahrenheit (°F)", L"Фаренгейт (°F)" },{ L"Formato da hora", L"Формат времени" },{ L"24 horas", L"24 часа" },{ L"12 horas (AM/PM)", L"12 часов (AM/PM)" },diff --git a/src/comum/idioma_tr.inc b/src/comum/idioma_tr.incindex a0f372c..bb3f629 100644--- a/src/comum/idioma_tr.inc+++ b/src/comum/idioma_tr.inc@@ -1695,6 +1695,8 @@{ L"Roda no próprio PC: as perguntas não saem dele. Abra o app antes de perguntar.", L"Bu bilgisayarda çalışır: sorularınız dışarı çıkmaz. Sormadan önce uygulamayı açın." },{ L"Mostrar os segundos", L"Saniyeleri göster" },{ L"Pergunte à Siri…", L"Siri'ye sorun…" },+{ L"Celsius (°C)", L"Santigrat (°C)" },+{ L"Fahrenheit (°F)", L"Fahrenhayt (°F)" },{ L"Formato da hora", L"Saat biçimi" },{ L"24 horas", L"24 saat" },{ L"12 horas (AM/PM)", L"12 saat (ÖÖ/ÖS)" },diff --git a/src/comum/idioma_zh.inc b/src/comum/idioma_zh.incindex b38906a..1623e72 100644--- a/src/comum/idioma_zh.inc+++ b/src/comum/idioma_zh.inc@@ -1698,6 +1698,8 @@{ L"Roda no próprio PC: as perguntas não saem dele. Abra o app antes de perguntar.", L"在此电脑上运行:你的问题不会离开电脑。提问前请先打开应用。" },{ L"Mostrar os segundos", L"显示秒" },{ L"Pergunte à Siri…", L"询问 Siri…" },+{ L"Celsius (°C)", L"摄氏度 (°C)" },+{ L"Fahrenheit (°F)", L"华氏度 (°F)" },{ L"Formato da hora", L"时间格式" },{ L"24 horas", L"24 小时制" },{ L"12 horas (AM/PM)", L"12 小时制(上午/下午)" },diff --git a/src/comum/temperatura.h b/src/comum/temperatura.hnew file mode 100644index 0000000..c1ba147--- /dev/null+++ b/src/comum/temperatura.h@@ -0,0 +1,20 @@+// Unidade da temperatura (issues #247 e #264): ajustes.txt temperatura=auto|c|f.+// Automático segue a região do Windows, como o Mac: sistema de medidas dos EUA (LOCALE_IMEASURE = 1) em Fahrenheit,+// o resto em Celsius. A previsão continua vindo e ficando guardada em Celsius; só o número mostrado muda.+#pragma once+#include <windows.h>+#include <string>++namespace temperatura {++inline bool Fahrenheit(const std::wstring& ajuste) {+ if (ajuste == L"f") return true;+ if (ajuste == L"c") return false;+ DWORD m = 0;+ if (!GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_IMEASURE | LOCALE_RETURN_NUMBER, (LPWSTR)&m, sizeof(m) / sizeof(wchar_t))) return false;+ return m == 1;+}++inline float Mostra(float celsius, bool f) { return f ? celsius * 9.f / 5.f + 32.f : celsius; }++} // namespace temperaturadiff --git a/src/finder/main.cpp b/src/finder/main.cppindex e3f5b9f..9c0f36e 100644--- a/src/finder/main.cpp+++ b/src/finder/main.cpp@@ -6866,6 +6866,11 @@ static LRESULT CALLBACK WndProc(HWND h, UINT m, WPARAM w, LPARAM l) {Invalidate();return 0;}+ // issue #266: a roda sobre a coluna da pasta aberta (à direita da ativa) rolava a coluna de antes. Como no Mac+ // (rola a coluna embaixo do ponteiro): a pasta aberta vira a coluna ativa e é ela que rola+ int s = SingleSelected();+ float rx = ActiveColX() + ColLay::COL_W;+ if (s >= 0 && g_items[s].dir && x >= rx && x < rx + ColLay::COL_W && !ChildItems(g_items[s].path).empty()) ColumnEnter(s, false);}bool notched = std::abs(delta) >= WHEEL_DELTA && std::abs(delta) % WHEEL_DELTA == 0;ScrollBy(-delta / (float)WHEEL_DELTA * 90.f, notched); // touchpad: segue o dedo sem animaçãodiff --git a/src/shell/apps.cpp b/src/shell/apps.cppindex 2eff531..01cc591 100644--- a/src/shell/apps.cpp+++ b/src/shell/apps.cpp@@ -1087,6 +1087,7 @@ static void LaunchNow(App a, const std::wstring& args);void apps::Launch(App& a, const std::wstring& args) {a.launchedAt = a.abertoEm = GetTickCount();AllowSetForegroundWindow(ASFW_ANY); // o app aberto pela thread vem para a frente+ EsperaAbrir();std::thread([c = a, args] {HRESULT ci = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);LaunchNow(c, args);@@ -1131,6 +1132,42 @@ static void ForceForeground(HWND h) {SetForegroundWindow(h);}+// apps::EsperaAbrir (issues #268 e #254)+static ULONGLONG g_abrindo; // quando um app foi aberto (0 = nada esperando)+static HWND g_abriu; // a janela que apareceu+static ULONGLONG g_abriuEm;+static HWINEVENTHOOK g_abrindoEv;+static void CALLBACK VigiaAbriu(HWND, UINT, UINT_PTR id, DWORD) {+ HWND h = g_abriu;+ bool clicou = GetAsyncKeyState(VK_LBUTTON) < 0 || GetAsyncKeyState(VK_RBUTTON) < 0;+ if (!h || !IsWindow(h) || !IsWindowVisible(h) || IsIconic(h) || clicou || GetTickCount64() - g_abriuEm > 1500) { KillTimer(nullptr, id); g_abriu = nullptr; return; }+ HWND fg = GetForegroundWindow();+ DWORD pa = 0, pf = 0;+ GetWindowThreadProcessId(h, &pa);+ if (fg) GetWindowThreadProcessId(fg, &pf);+ if (fg == h || pf == pa) return; // na frente (ou outra janela dele, como a principal depois da de abertura)+ if (fg && shell::Nossa(fg) && GetAncestor(fg, GA_ROOT) == fg && IsWindowVisible(fg)) {+ wchar_t c[64] = {}; GetClassNameW(fg, c, 64);+ if (wcsncmp(c, L"ShellSpotlight", 14)) return; // um painel nosso aberto depois (menu, Launchpad): fica+ }+ wchar_t c[64] = {}; if (fg) GetClassNameW(fg, c, 64);+ Log(L"apps: o app aberto foi para trás (frente: %ls); trazendo de volta", c);+ KillTimer(nullptr, id); g_abriu = nullptr;+ shell::TrazPraFrente(h);+}+static void CALLBACK AbriuJanela(HWINEVENTHOOK, DWORD, HWND h, LONG obj, LONG, DWORD, DWORD) {+ if (obj != OBJID_WINDOW || !h || !g_abrindo) return;+ if (GetTickCount64() - g_abrindo > 8000) { g_abrindo = 0; return; }+ if (GetAncestor(h, GA_ROOT) != h || shell::Nossa(h) || !IsTaskbarWindow(h)) return;+ g_abrindo = 0;+ g_abriu = h; g_abriuEm = GetTickCount64();+ SetTimer(nullptr, 0, 100, VigiaAbriu);+}+void apps::EsperaAbrir() {+ g_abrindo = GetTickCount64();+ if (!g_abrindoEv) g_abrindoEv = SetWinEventHook(EVENT_OBJECT_SHOW, EVENT_OBJECT_SHOW, nullptr, AbriuJanela, 0, 0, WINEVENT_OUTOFCONTEXT | shell::SemProprio());+}+// Ocultar: por baixo é minimizar (o Windows não deixa esconder janela de outro programa com segurança),// mas o Shell marca as janelas: sem o gênio, sem a miniatura no Dock, e o clique no ícone traz todas.static std::map<HWND, DWORD> g_hiddenWins; // janela -> quando foi ocultadiff --git a/src/shell/central.cpp b/src/shell/central.cppindex feb6ebd..71447dd 100644--- a/src/shell/central.cpp+++ b/src/shell/central.cpp@@ -2182,12 +2182,30 @@ void Close() {ui::FrameClock(g_wnd, WM_CC_FRAME, true);}-void SetVolume(float v) {- if (IAudioEndpointVolume* e = Endpoint()) {- e->SetMasterVolumeLevelScalar(std::clamp(v, 0.f, 1.f), nullptr);- e->SetMute(v <= 0.001f, nullptr);- e->Release();+// Issue #269: arrastar o volume travava e às vezes parava o WacOS por segundos. Cada movimento do mouse abria a saída+// de som de novo na thread da interface (o serviço de áudio pode demorar) e, sem a marca do Shell, o aviso de "volume+// mudado fora" (som.cpp) relia tudo de novo a cada passo. Agora vai numa thread, só o último valor, com a marca do Shell.+const GUID CTX_SHELL_VOL = { 0x5f3c7a21, 0x9b4e, 0x4d6a, { 0x8e, 0x12, 0x6c, 0x0b, 0x77, 0x3a, 0x51, 0xd4 } }; // o mesmo de som.cpp+std::atomic<float> g_volWant{ -1 };+std::atomic<bool> g_volBusy{ false };+void VolWorker() {+ HRESULT ci = CoInitializeEx(nullptr, COINIT_MULTITHREADED);+ IAudioEndpointVolume* e = Endpoint();+ float v;+ while ((v = g_volWant.exchange(-1)) >= 0) {+ if (!e) break;+ e->SetMasterVolumeLevelScalar(v, &CTX_SHELL_VOL);+ e->SetMute(v <= 0.001f, &CTX_SHELL_VOL);}+ if (e) e->Release();+ if (SUCCEEDED(ci)) CoUninitialize();+ g_volBusy = false;+ if (g_volWant.load() >= 0 && !g_volBusy.exchange(true)) std::thread(VolWorker).detach(); // chegou um valor no fim+}+void SetVolume(float v) {+ v = std::clamp(v, 0.f, 1.f);+ g_volWant = v;+ if (!g_volBusy.exchange(true)) std::thread(VolWorker).detach();std::lock_guard<std::mutex> l(g_mx);g_st.volume = v; g_st.mute = v <= 0.001f;}diff --git a/src/shell/dock.cpp b/src/shell/dock.cppindex a4b1cb0..664d427 100644--- a/src/shell/dock.cpp+++ b/src/shell/dock.cpp@@ -1732,7 +1732,7 @@ void LeftClick(int i) {RECT from = ToScreenRect({ it.cx - s / 2, top, it.cx + s / 2, top + s });if (genio::Restore(h, from)) { apps::Refresh(); BuildItems(); Paint(); return; }shell::Restaurar(h);- shell::LiberaFrente(); SetForegroundWindow(h);+ shell::TrazPraFrente(h);apps::Refresh(); BuildItems(); Paint();return;}diff --git a/src/shell/genio.cpp b/src/shell/genio.cppindex 25ed0e8..fc88de4 100644--- a/src/shell/genio.cpp+++ b/src/shell/genio.cpp@@ -56,7 +56,7 @@ void RealBack() {if (g_a.realBack || !IsWindow(g_a.target)) return;g_a.realBack = true;shell::Restaurar(g_a.target);- shell::LiberaFrente(); SetForegroundWindow(g_a.target);+ shell::TrazPraFrente(g_a.target);// Issues #142 e #143: o app só refazia o quadro (cantos arredondados, botões do semáforo, barra de rolagem do Chromium) depois// que a camada saía, e isso aparecia como um estalo. Força o quadro e o conteúdo a se refazerem já, ainda escondidos.// (de outro processo: sem esperar a resposta, senão um app travado travava o Shell junto; ele refaz no tempo dele,diff --git a/src/shell/janelas.cpp b/src/shell/janelas.cppindex b936b6b..07bc539 100644--- a/src/shell/janelas.cpp+++ b/src/shell/janelas.cpp@@ -148,9 +148,23 @@ void LoadExtra() {}// Um app está em tela cheia exclusiva (Direct3D) ou em modo apresentação/jogo: nenhum gancho novo agora.+// QUNS_BUSY vem também quando a janela da frente é a NOSSA mesa ou outra janela do Shell que cobre a tela (o Windows+// acha que é um app em tela cheia): aí o gancho nunca entrava nos apps abertos a partir da mesa (issue #248). Janela do+// próprio Shell na frente não conta. Quando bloqueia, o log diz (uma vez por minuto) o estado e quem está na frente.bool TelaCheiaExclusiva() {QUERY_USER_NOTIFICATION_STATE q{};- return SUCCEEDED(SHQueryUserNotificationState(&q)) && (q == QUNS_RUNNING_D3D_FULL_SCREEN || q == QUNS_BUSY || q == QUNS_PRESENTATION_MODE);+ if (FAILED(SHQueryUserNotificationState(&q)) || !(q == QUNS_RUNNING_D3D_FULL_SCREEN || q == QUNS_BUSY || q == QUNS_PRESENTATION_MODE)) return false;+ HWND fg = GetForegroundWindow();+ DWORD fpid = 0;+ if (fg) GetWindowThreadProcessId(fg, &fpid);+ if (q == QUNS_BUSY && (!fg || fpid == GetCurrentProcessId())) return false;+ static ULONGLONG ultimo = 0;+ if (GetTickCount64() - ultimo > 60000) {+ ultimo = GetTickCount64();+ wchar_t cls[64] = {}; if (fg) GetClassNameW(fg, cls, 64);+ Log(L"janelas: nada novo agora: tela cheia/apresentação (estado %d, frente: %ls, processo %lu)", (int)q, cls, fpid);+ }+ return true;}bool CobreMonitor(HWND h) {diff --git a/src/shell/main.cpp b/src/shell/main.cppindex ae6afd6..f051330 100644--- a/src/shell/main.cpp+++ b/src/shell/main.cpp@@ -446,20 +446,20 @@ static std::wstring SettingsPath() {// várias mudanças seguidas viram uma gravação só. Quem relê o arquivo (LoadSettings) e a saída do Shell esperam a fila.static std::mutex g_ajMx;static std::condition_variable g_ajCv;-static std::map<std::wstring, std::wstring> g_ajMapa; // os ajustes inteiros a gravar (os mais novos)+// só as chaves mudadas (issue #258): a gravação relê o arquivo e aplica as mudanças por cima. Gravar o mapa inteiro da+// memória apagava as linhas postas no arquivo depois de o Shell ler (à mão, por outro app ou por uma versão mais nova)+static std::map<std::wstring, std::wstring> g_ajMapa;static bool g_ajTem = false, g_ajOcupado = false;static void EsperaAjustes() {std::unique_lock<std::mutex> l(g_ajMx);g_ajCv.wait_for(l, std::chrono::seconds(3), [] { return !g_ajTem && !g_ajOcupado; });}void shell::SetSetting(const wchar_t* key, const std::wstring& value) {- std::map<std::wstring, std::wstring> copia;AcquireSRWLockExclusive(&g_settingsLock);g_settings[key] = value;- copia = g_settings;ReleaseSRWLockExclusive(&g_settingsLock);// na thread de gravação, atômico (.tmp + troca): quem lê no meio não vê o arquivo vazio- { std::lock_guard<std::mutex> l(g_ajMx); g_ajMapa = std::move(copia); g_ajTem = true; }+ { std::lock_guard<std::mutex> l(g_ajMx); g_ajMapa[key] = value; g_ajTem = true; }static std::once_flag umaVez;std::call_once(umaVez, [] {std::thread([] {@@ -470,7 +470,10 @@ void shell::SetSetting(const wchar_t* key, const std::wstring& value) {g_ajCv.wait(l, [] { return g_ajTem; });m.swap(g_ajMapa); g_ajTem = false; g_ajOcupado = true;}- ajarq::Gravar(SettingsPath(), m);+ std::map<std::wstring, std::wstring> tudo;+ if (!ajarq::Ler(SettingsPath(), tudo)) { AcquireSRWLockShared(&g_settingsLock); tudo = g_settings; ReleaseSRWLockShared(&g_settingsLock); }+ for (auto& kv : m) tudo[kv.first] = kv.second;+ ajarq::Gravar(SettingsPath(), tudo);{ std::lock_guard<std::mutex> l(g_ajMx); g_ajOcupado = false; }g_ajCv.notify_all();}@@ -1387,6 +1390,7 @@ static LRESULT CALLBACK MsgProc(HWND h, UINT m, WPARAM w, LPARAM l) {bloqueio::Lock(); // o bloqueio do Windows (a tela do WacOS saiu)return 0;case WM_APP_MONITOR:+ apps::EsperaAbrir(); // a tecla foi engolida pelo gancho: o app aberto não ganhava a frente (issue #268)if (w == 1) shell::OpenForceQuit(false); else shell::OpenMonitor();return 0;case WM_APP_SWITCH: seletor::Step((int)(INT_PTR)w); return 0;diff --git a/src/shell/missioncontrol.cpp b/src/shell/missioncontrol.cppindex 384202b..236f356 100644--- a/src/shell/missioncontrol.cpp+++ b/src/shell/missioncontrol.cpp@@ -760,8 +760,7 @@ void Finish() {g_xFor = nullptr; g_xHot = false;if (g_cd && g_cwins) { g_cwins->RemoveAllVisuals(); g_wallFx->SetOpacity(1.f); g_barFx->SetOpacity(1.f); g_cd->Commit(); }if (g_pick) {- shell::LiberaFrente(); // permite trazer a janela para a frente- SetForegroundWindow(g_pick);+ shell::TrazPraFrente(g_pick);g_pick = nullptr;}if (g_wall) { g_wall->Release(); g_wall = nullptr; }diff --git a/src/shell/palco.cpp b/src/shell/palco.cppindex ebfc52c..a20f3b6 100644--- a/src/shell/palco.cpp+++ b/src/shell/palco.cpp@@ -469,7 +469,7 @@ void TrocaPalco(std::vector<std::wstring> prox, HWND foco, bool ativar) {Traz(entram);for (HWND h : saem) if (h != foco) Estaciona(h);Troca(prox);- if (ativar && foco) { shell::LiberaFrente(); SetForegroundWindow(foco); }+ if (ativar && foco) shell::TrazPraFrente(foco);std::wstring nomes; for (auto& a : prox) { App* ap = nullptr; for (auto& j : g_jan) if (j.app == a) { ap = apps::OfWindow(j.h); break; } nomes += (nomes.empty() ? L"" : L", ") + (ap ? ap->name : a); }Log(L"organizador: no palco %ls (%zu saem, %zu entram, %zu estacionadas)", nomes.c_str(), saem.size(), entram.size(), g_vagas.size());g_ocupado = false;@@ -532,7 +532,7 @@ void AssentaFrente() { // settleForeground// fechou uma janela do palco e o Windows passou a frente para outro app: o palco fica com a outra janela deleif (g_fechou.on && Agora() - g_fechou.em < FECHOU_MS) {for (auto& o : g_jan)- if (o.h != g_fechou.h && !Estacionada(o.h) && NoPalco(o.app)) { g_fechou.on = false; shell::LiberaFrente(); SetForegroundWindow(o.h); return; }+ if (o.h != g_fechou.h && !Estacionada(o.h) && NoPalco(o.app)) { g_fechou.on = false; shell::TrazPraFrente(o.h); return; }}g_fechou.on = false;TrocaPalco(GrupoCompleto(j->app), j->h, false);diff --git a/src/shell/revelar.cpp b/src/shell/revelar.cppindex e3a41aa..f866186 100644--- a/src/shell/revelar.cpp+++ b/src/shell/revelar.cpp@@ -360,7 +360,7 @@ void Step() {if (back) {g_revealed = false;if (!g_moved.empty() && IsWindow(g_moved.front().h)) { // a que estava na frente volta a ter o foco- shell::LiberaFrente(); SetForegroundWindow(g_moved.front().h);+ shell::TrazPraFrente(g_moved.front().h);}g_moved.clear();}diff --git a/src/shell/shell.h b/src/shell/shell.hindex d3d5fcc..18bbabd 100644--- a/src/shell/shell.h+++ b/src/shell/shell.h@@ -172,6 +172,10 @@ App* FindById(const std::wstring& id);App* OfWindow(HWND h);void EnsureIcon(App& a, int px);void Launch(App& a, const std::wstring& args = L"");+// Issues #268 e #254: o app aberto pelo Spotlight/atalho aparecia na frente por um instante e voltava para trás (o Windows+// devolvia a frente ao app de antes quando o Spotlight sumia, ou o app nem ganhava a frente quando abria por outro+// processo). Chamado ao abrir: a primeira janela de app que aparecer nos próximos 8 s fica na frente por 1,5 s.+void EsperaAbrir();// Apps Chromium/Electron: abre com a opção que mantém a miniatura viva no Mission Control.// false se o alvo não for um deles (quem chamou abre do jeito normal).bool LaunchNoOcclusion(const std::wstring& target, const std::wstring& args = L"", const std::wstring& exeHint = L"");@@ -696,6 +700,14 @@ inline void LiberaFrente() {const ULONG_PTR M = 0x53484C4C;keybd_event(VK_MENU, 0, 0, M); keybd_event(0xE8, 0, 0, M); keybd_event(0xE8, 0, KEYEVENTF_KEYUP, M); keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, M);}+// Traz h para a frente; o truque do Alt só se o Windows recusar. Issue #250: as teclas falsas chegavam ao app que+// acabava de ganhar o foco (o Noctty escrevia um "@" a cada vez que voltava pelo Dock). O clique foi no nosso processo,+// então quase sempre o SetForegroundWindow já basta.+inline void TrazPraFrente(HWND h) {+ if (SetForegroundWindow(h) && GetForegroundWindow() == h) return;+ LiberaFrente();+ SetForegroundWindow(h);+}int RodarNativo(HINSTANCE dll, const std::wstring& dirBin, const std::wstring& logPath);// abre o Finder com estes argumentos: no nativo, no Finder de dentro do explorer (MacFinder.dll); senão o WacOSFinder.exevoid AbrirFinder(const std::wstring& args);diff --git a/src/shell/som.cpp b/src/shell/som.cppindex 5bc0e1e..27a553e 100644--- a/src/shell/som.cpp+++ b/src/shell/som.cpp@@ -15,7 +15,9 @@#include <audiopolicy.h>#include <functiondiscoverykeys_devpkey.h>#include <algorithm>+#include <atomic>#include <cmath>+#include <thread>#include "../comum/idioma.h"namespace {@@ -67,6 +69,9 @@ IAudioEndpointVolume* Endpoint() {return v;}+std::atomic<float> g_volWant{ -1 }; // SetVolume: o valor esperando a thread+std::atomic<bool> g_volBusy{ false };+float g_volUltimo; // o último valor pedido (a leitura não volta atrás enquanto a thread grava)// volume, mudo e nome da saída padrão; com `outs`, a lista das saídas ativasvoid Read(bool outs) {g_au.ok = false;@@ -82,6 +87,7 @@ void Read(bool outs) {if (SUCCEEDED(d->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, nullptr, (void**)&v))) {BOOL m = FALSE; v->GetMasterVolumeLevelScalar(&g_au.vol); v->GetMute(&m);g_au.mute = m != FALSE; g_au.ok = true;+ if (g_volBusy) { g_au.vol = g_volUltimo; g_au.mute = g_volUltimo <= 0.001f; }v->Release();}d->Release();@@ -215,13 +221,26 @@ void RegistraVolume() {g_volRegAt = GetTickCount();}-void SetVolume(float v) {- v = std::clamp(v, 0.f, 1.f);- if (IAudioEndpointVolume* e = Endpoint()) {+// numa thread, só o último valor (issue #269: arrastar o controle abria a saída de som de novo na thread da interface a+// cada movimento do mouse, e o serviço de áudio às vezes demora)+void VolWorker() {+ HRESULT ci = CoInitializeEx(nullptr, COINIT_MULTITHREADED);+ IAudioEndpointVolume* e = Endpoint();+ float v;+ while ((v = g_volWant.exchange(-1)) >= 0) {+ if (!e) break;e->SetMasterVolumeLevelScalar(v, &CTX_SHELL);e->SetMute(v <= 0.001f, &CTX_SHELL); // no zero, mudo (o ícone vira o alto-falante cortado, como no Mac)- e->Release();}+ if (e) e->Release();+ if (SUCCEEDED(ci)) CoUninitialize();+ g_volBusy = false;+ if (g_volWant.load() >= 0 && !g_volBusy.exchange(true)) std::thread(VolWorker).detach();+}+void SetVolume(float v) {+ v = std::clamp(v, 0.f, 1.f);+ g_volWant = v; g_volUltimo = v;+ if (!g_volBusy.exchange(true)) std::thread(VolWorker).detach();g_au.vol = v; g_au.mute = v <= 0.001f;menubar::SoundChanged(false);}diff --git a/src/shell/spotlight.cpp b/src/shell/spotlight.cppindex 9d8c068..9fe7dcd 100644--- a/src/shell/spotlight.cpp+++ b/src/shell/spotlight.cpp@@ -2385,6 +2385,7 @@ void Open(int row, bool reveal) {for (auto& a : g_apps) if (a.parsing == target) { a.use += 3; break; }}Close();+ apps::EsperaAbrir(); // o app aberto fica na frente quando o Spotlight some (issue #268)switch (r.kind) {case K_APP: {std::wstring target = L"shell:AppsFolder\\" + r.target;diff --git a/src/shell/widgets.cpp b/src/shell/widgets.cppindex e42000d..c8e68ec 100644--- a/src/shell/widgets.cpp+++ b/src/shell/widgets.cpp@@ -6,6 +6,7 @@// O tempo vem do Open-Meteo (sem chave), a cada 15 min, para a cidade em ajustes.txt (padrão: a do fuso do Windows, comum/cidade_padrao.h);// a última resposta fica em %APPDATA%\Shell\tempo.json para aparecer já ao ligar.#include "shell.h"+#include "../comum/temperatura.h"#include "../comum/fonte_cjk.h" // a reserva para coreano, japonês e chinês#include "../comum/cidade_padrao.h"#include "../menu/context_menu.h"@@ -67,6 +68,10 @@ std::wstring City() { static cidade::Padrao def; return shell::Setting(L"tempoCi// Para a Siri (issue #38: ela não sabia nada do PC): a condição do código WMO do Open-Meteo, em inglês (o modelo responde// no idioma da pergunta)+// a temperatura na unidade escolhida (Ajustes > Barra de menus > Temperatura; issues #247 e #264)+static bool UnidadeF() { return temperatura::Fahrenheit(shell::Setting(L"temperatura", L"auto")); }+static float TF(float c) { return temperatura::Mostra(c, UnidadeF()); }+std::wstring widgets::ResumoTempo() {Weather w;{ std::lock_guard<std::mutex> lk(g_mx); w = g_wx; }@@ -76,7 +81,8 @@ std::wstring widgets::ResumoTempo() {: c <= 57 ? L"drizzle" : c <= 67 ? L"rain" : c <= 77 ? L"snow" : c <= 82 ? L"rain showers": c <= 86 ? L"snow showers" : L"thunderstorm";wchar_t b[300];- swprintf_s(b, L"Weather now in %ls: %.0f°C, %ls; today's high %.0f°C, low %.0f°C.", City().c_str(), w.temp, cond, w.hi, w.lo);+ const wchar_t* u = UnidadeF() ? L"°F" : L"°C";+ swprintf_s(b, L"Weather now in %ls: %.0f%ls, %ls; today's high %.0f%ls, low %.0f%ls.", City().c_str(), TF(w.temp), u, cond, TF(w.hi), u, TF(w.lo), u);return b;}@@ -501,12 +507,12 @@ void PaintWeather(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, float w, flodc->PushAxisAlignedClip(D2D1::RectF(0, 0, w - 12, h), D2D1_ANTIALIAS_MODE_ALIASED);Txt(dc, br, city, 14, DWRITE_FONT_WEIGHT_SEMI_BOLD, DWRITE_TEXT_ALIGNMENT_LEADING, D2D1::RectF(16, 12, 400, 30), WHITE);dc->PopAxisAlignedClip();- if (wx.ok) swprintf_s(b, L"%ld°", lround(wx.temp)); else wcscpy_s(b, L"--°");+ if (wx.ok) swprintf_s(b, L"%ld°", lround(TF(wx.temp))); else wcscpy_s(b, L"--°");Txt(dc, br, b, 40, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_TEXT_ALIGNMENT_LEADING, D2D1::RectF(13, 30, w, 80), WHITE, true);if (!wx.ok) return;DrawIcon(dc, br, IconOf(wx.code, wx.day), 27, 104, 18, dark);Txt(dc, br, ConditionOf(wx.code, wx.day), 12, DWRITE_FONT_WEIGHT_SEMI_BOLD, DWRITE_TEXT_ALIGNMENT_LEADING, D2D1::RectF(16, 118, w - 10, 136), WHITE);- swprintf_s(b, Tr(L"Máx.: %ld° Mín.: %ld°"), lround(wx.hi), lround(wx.lo));+ swprintf_s(b, Tr(L"Máx.: %ld° Mín.: %ld°"), lround(TF(wx.hi)), lround(TF(wx.lo)));Txt(dc, br, b, 12, DWRITE_FONT_WEIGHT_SEMI_BOLD, DWRITE_TEXT_ALIGNMENT_LEADING, D2D1::RectF(16, 136, w - 10, 154), WHITE);return;}@@ -524,7 +530,7 @@ void PaintWeather(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, float w, flo}if (f) f->Release();}- if (wx.ok) swprintf_s(b, L"%ld°", lround(wx.temp)); else wcscpy_s(b, L"--°");+ if (wx.ok) swprintf_s(b, L"%ld°", lround(TF(wx.temp))); else wcscpy_s(b, L"--°");Txt(dc, br, b, 44, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_TEXT_ALIGNMENT_LEADING, D2D1::RectF(14, 32, 200, 86), WHITE, true);if (!wx.ok) {Txt(dc, br, Tr(L"Buscando o tempo…"), 13, DWRITE_FONT_WEIGHT_SEMI_BOLD, DWRITE_TEXT_ALIGNMENT_CENTER, D2D1::RectF(0, 110, w, 140), C(1, 1, 1, 0.7f));@@ -532,7 +538,7 @@ void PaintWeather(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, float w, flo}DrawIcon(dc, br, IconOf(wx.code, wx.day), w - 26, 24, 22, dark);Txt(dc, br, ConditionOf(wx.code, wx.day), 13, DWRITE_FONT_WEIGHT_SEMI_BOLD, DWRITE_TEXT_ALIGNMENT_TRAILING, D2D1::RectF(120, 38, w - 17, 56), WHITE);- swprintf_s(b, Tr(L"Máx.: %ld° Mín.: %ld°"), lround(wx.hi), lround(wx.lo));+ swprintf_s(b, Tr(L"Máx.: %ld° Mín.: %ld°"), lround(TF(wx.hi)), lround(TF(wx.lo)));Txt(dc, br, b, 13, DWRITE_FONT_WEIGHT_SEMI_BOLD, DWRITE_TEXT_ALIGNMENT_TRAILING, D2D1::RectF(120, 57, w - 17, 75), WHITE);// próximas horas: 6 no médio, 18 (três fileiras) no grandedouble now = (double)time(nullptr);@@ -549,7 +555,7 @@ void PaintWeather(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, float w, floswprintf_s(b, L"%dh", LocalMinuteOfDay(hr.t, wx.utcOffset) / 60);Txt(dc, br, b, 11, DWRITE_FONT_WEIGHT_SEMI_BOLD, DWRITE_TEXT_ALIGNMENT_CENTER, D2D1::RectF(cx - 30, 92 + dy, cx + 30, 108 + dy), C(1, 1, 1, 0.75f));DrawIcon(dc, br, IconOf(hr.code, hr.day), cx, 125 + dy, 21, dark);- swprintf_s(b, L"%ld°", lround(hr.temp));+ swprintf_s(b, L"%ld°", lround(TF(hr.temp)));Txt(dc, br, b, 13, DWRITE_FONT_WEIGHT_SEMI_BOLD, DWRITE_TEXT_ALIGNMENT_CENTER, D2D1::RectF(cx - 30, 144 + dy, cx + 30, 162 + dy), WHITE);}}