A new style desktop shell for Windows 11: menu bar, Dock, Finder, Spotlight, Control Center and Liquid Glass, in native C++.
Rust
Issues #441 #451 #449 #421 #463 #455 #404 #448 #397
Eternity070628fe5f63442a24
diff --git a/docs/registro-mudancas.txt b/docs/registro-mudancas.txtindex 15f6f88..61d725f 100644--- a/docs/registro-mudancas.txt+++ b/docs/registro-mudancas.txt@@ -2255,3 +2255,20 @@ Compilado (tudo), instalado, Shell e reserva do Finder reiniciados às 23:07 sem- dialogo.cpp/dialogo lib.rs: depois do Finder, o diálogo de dentro recebe a pasta e, com vários arquivos, os nomesentre aspas ("a.png" "b.png"). Quem lê pelo comdlg32 (webmail, WhatsApp) ficava só com o 1º. DialogoMac.dlltrocada no PC (o registro aponta para bin do repositório). Não testado com WhatsApp. DESFAZER: git revert do commit.++[2026-12-01 15:30] Issues #441 #451 #449 #421 #463 #455 #404 #448 #397 (C++ e Rust)+ - #441 #451 alertas.cpp/alertas.rs: os títulos e as perguntas das confirmações (apagar, substituir) vêm do shell32 e do+ comdlg32 no idioma do Windows (IDs 16792.. e 435/257); antes só inglês e português, e no Windows em espanhol a caixa+ ficava a do Windows com a barra do Mac.+ - #449 genio.cpp/genio.rs: o MinAnimate salvo (registro) vale ao abrir; um Shell fechado à força deixava a animação de+ minimizar do Windows desligada até sair da conta, mesmo com o gênio desligado.+ - #404 #448 genio + main.cpp/principal.rs: ligar/desligar o efeito gênio no Ajustes vale na hora (antes só reiniciando).+ - #421 apps.cpp/apps.rs: o AUMID guardado da janela vale 3 s (o LibreOffice troca o AUMID da mesma janela entre Writer,+ Calc e Impress; o Impress ficava no ícone do Writer).+ - #463 Finder main.cpp / vistas.rs+pasta.rs: Lixeira, etiquetas e Este Computador entram no Voltar/Avançar.+ - #455 Pré-Visualização main.cpp/main.rs: Imprimir pelo próprio app (PrintDlgEx, páginas do PDF a até 300 ppp); o verbo+ "print" do Windows não fazia nada quando o leitor de PDF padrão não tem esse verbo.+ - #397 spotlight.cpp/spotlight.rs: o "Apps" do Tahoe/Golden Gate solta os ícones dos apps quando um ícone próprio muda.+ Compilado (C++). Finder e Pré-Visualização instalados no PC (backup em Programs\WacOS\backup-2026-12-01-1525); o+ WacOSShell.exe do PC é o do ramo da Ilha com IA e não foi trocado. Não testado na tela (cliques e impressora).+ DESFAZER: git revert do commit (e o do Rust).diff --git a/src/finder/main.cpp b/src/finder/main.cppindex e4f9258..9674e86 100644--- a/src/finder/main.cpp+++ b/src/finder/main.cpp@@ -1225,6 +1225,12 @@ static void ApplyFolderGroup() {// a escolha de grupo atual vale para a pasta em que ela foi feita (Downloads ou as outras)static void NoteGroupChoice() { if (g_inDownloads) g_groupDl = (int)g_groupBy; else g_groupMain = g_groupBy; }+// No histórico (Voltar/Avançar) também a Lixeira, as etiquetas e Este Computador, que não têm caminho: antes, ao abrir+// uma pasta da Lixeira, Voltar ia para a pasta de antes dela, e não para a Lixeira (#463).+static const wchar_t VISAO_HIST[] = L"\x1Fvisao:";+static std::wstring Onde() { return !g_folder.empty() ? g_folder : g_tagView >= 0 ? VISAO_HIST + std::to_wstring(g_tagView) : std::wstring(); }+static int VisaoDoHist(const std::wstring& s) { return s.rfind(VISAO_HIST, 0) == 0 ? _wtoi(s.c_str() + wcslen(VISAO_HIST)) : -1; }+static void Navigate(const std::wstring& path, bool push = true, const std::wstring& selectName = L"", bool keepColumns = false) {DWORD a = GetFileAttributesW(path.c_str());// raiz de unidade recém-conectada (pendrive, HD externo): o Windows ainda está montando o volume e a primeira leitura@@ -1238,7 +1244,7 @@ static void Navigate(const std::wstring& path, bool push = true, const std::wstrstd::wstring p = path;while (p.size() > 3 && p.back() == L'\\') p.pop_back();if (p.size() == 2) p += L"\\";- if (push && !g_folder.empty() && !SamePath(p, g_folder)) { g_back.push_back(g_folder); g_fwd.clear(); }+ if (push) { std::wstring o = Onde(); if (!o.empty() && !SamePath(p, o)) { g_back.push_back(o); g_fwd.clear(); } }if (!keepColumns) g_colTrail.clear();g_tagView = -1;g_searching = false; g_searchBusy = false; g_searchGen++;@@ -1422,9 +1428,9 @@ static void RefreshTagView() {Invalidate();}-static void NavigateTag(int t) {+static void NavigateTag(int t, bool push = true) {if (g_renameIdx >= 0) EndRename(false);- if (!g_folder.empty()) { g_back.push_back(g_folder); g_fwd.clear(); }+ if (push) { std::wstring o = Onde(); if (!o.empty() && VisaoDoHist(o) != t) { g_back.push_back(o); g_fwd.clear(); } }if (g_notifyId) { SHChangeNotifyDeregister(g_notifyId); g_notifyId = 0; }g_tagView = t;g_searching = false; g_searchBusy = false; g_searchGen++;@@ -1557,17 +1563,19 @@ static void OnSearchBatch(int gen, SearchBatch* b) {static void GoBack() {if (g_searching) { ExitSearch(); return; } // voltar sai da buscaif (g_back.empty()) return;- std::wstring from = g_folder, to = g_back.back();+ std::wstring from = Onde(), to = g_back.back();g_back.pop_back();- g_fwd.push_back(from);- Navigate(to, false, from.substr(from.find_last_of(L'\\') + 1));+ if (!from.empty()) g_fwd.push_back(from);+ if (int v = VisaoDoHist(to); v >= 0) { NavigateTag(v, false); return; }+ Navigate(to, false, VisaoDoHist(from) >= 0 ? L"" : from.substr(from.find_last_of(L'\\') + 1));}static void GoForward() {if (g_fwd.empty()) return;std::wstring to = g_fwd.back();g_fwd.pop_back();- g_back.push_back(g_folder);+ if (std::wstring o = Onde(); !o.empty()) g_back.push_back(o);+ if (int v = VisaoDoHist(to); v >= 0) { NavigateTag(v, false); return; }Navigate(to, false);}@@ -6482,7 +6490,7 @@ static bool OverTitle(D2D1_POINT_2F p) {// Menu do caminho, como no Finder: Cmd-clique, Ctrl-clique ou clique direito no título da janela abre a hierarquia de// pastas (a atual em cima e cada pasta acima dela, até o disco e o computador); escolher uma vai para ela. Aqui um// clique simples no título (sem arrastar a janela) também abre.-static void NavigateTag(int t);+static void NavigateTag(int t, bool push);static void PathMenu() {if (g_folder.empty()) return; // etiqueta, Lixeira, Este Computador: não há caminhostd::vector<std::wstring> chain;diff --git a/src/preview/main.cpp b/src/preview/main.cppindex 01faea0..3fd02a6 100644--- a/src/preview/main.cpp+++ b/src/preview/main.cpp@@ -12,6 +12,7 @@#include "../comum/fonte_cjk.h" // a reserva para coreano, japonês e chinês#include <windowsx.h>#include <shellapi.h>+#include <commdlg.h> // PrintDlgEx (imprimir, #455)#include <shobjidl.h>#include <shlobj.h>#include <shlwapi.h>@@ -828,6 +829,85 @@ void OpenDialog() {d->Release();}+// Imprimir pelo próprio Pré-Visualização. Antes ia pelo verbo "print" do Windows, que não faz nada quando o+// leitor de PDF padrão não tem esse verbo (o próprio WacOS, o Edge em alguns PCs) (#455).+void ImprimePagina(HDC dc, std::vector<BYTE> px, UINT w, UINT h) {+ if (px.size() < (size_t)w * h * 4 || !w || !h) return;+ for (size_t i = 0; i + 3 < px.size(); i += 4) { // pré-multiplicado: o transparente sai branco no papel, não preto+ BYTE f = (BYTE)(255 - px[i + 3]);+ px[i] = (BYTE)std::min(255, px[i] + f); px[i + 1] = (BYTE)std::min(255, px[i + 1] + f); px[i + 2] = (BYTE)std::min(255, px[i + 2] + f);+ }+ int pw = GetDeviceCaps(dc, HORZRES), ph = GetDeviceCaps(dc, VERTRES);+ double s = std::min((double)pw / w, (double)ph / h);+ int dw = (int)(w * s), dh = (int)(h * s);+ BITMAPINFO bi{}; bi.bmiHeader.biSize = sizeof(bi.bmiHeader);+ bi.bmiHeader.biWidth = (LONG)w; bi.bmiHeader.biHeight = -(LONG)h; bi.bmiHeader.biPlanes = 1;+ bi.bmiHeader.biBitCount = 32; bi.bmiHeader.biCompression = BI_RGB;+ SetStretchBltMode(dc, HALFTONE); SetBrushOrgEx(dc, 0, 0, nullptr);+ StretchDIBits(dc, (pw - dw) / 2, (ph - dh) / 2, dw, dh, 0, 0, w, h, px.data(), &bi, DIB_RGB_COLORS, SRCCOPY);+}++void Imprimir() {+ if (!g_pdf && g_imgPx.empty()) { ShellExecuteW(g_wnd, L"print", g_path.c_str(), nullptr, nullptr, SW_SHOWNORMAL); return; }+ if (!g_pdf && g_rot) BakeRotation();+ PRINTPAGERANGE faixas[16] = {};+ PRINTDLGEXW pd{ sizeof(pd) };+ pd.hwndOwner = g_wnd;+ pd.Flags = PD_RETURNDC | PD_NOSELECTION | PD_NOCURRENTPAGE | (g_pdf ? 0 : PD_NOPAGENUMS);+ pd.nStartPage = START_PAGE_GENERAL;+ pd.nCopies = 1;+ pd.nMinPage = 1; pd.nMaxPage = (DWORD)std::max<size_t>(1, g_pages.size());+ pd.nMaxPageRanges = 16; pd.lpPageRanges = faixas;+ if (FAILED(PrintDlgExW(&pd)) || pd.dwResultAction != PD_RESULT_PRINT || !pd.hDC) {+ if (pd.hDC) DeleteDC(pd.hDC);+ if (pd.hDevMode) GlobalFree(pd.hDevMode);+ if (pd.hDevNames) GlobalFree(pd.hDevNames);+ return;+ }+ std::vector<int> paginas;+ int total = (int)std::max<size_t>(1, g_pages.size());+ if (g_pdf && (pd.Flags & PD_PAGENUMS)) {+ for (DWORD i = 0; i < pd.nPageRanges; i++)+ for (DWORD p = faixas[i].nFromPage; p <= faixas[i].nToPage && (int)p <= total; p++) if (p >= 1) paginas.push_back((int)p - 1);+ } else for (int i = 0; i < total; i++) paginas.push_back(i);+ if (pd.hDevMode) GlobalFree(pd.hDevMode);+ if (pd.hDevNames) GlobalFree(pd.hDevNames);+ HDC dc = pd.hDC;+ std::wstring path = g_path, nome = path.substr(path.find_last_of(L"\\/") + 1);+ bool pdf = g_pdf;+ std::vector<BYTE> img = pdf ? std::vector<BYTE>() : g_imgPx;+ UINT iw = g_imgW, ih = g_imgH;+ std::thread([=] {+ winrt::init_apartment(winrt::apartment_type::multi_threaded);+ DOCINFOW di{ sizeof(di) }; di.lpszDocName = nome.c_str();+ if (StartDocW(dc, &di) <= 0) { DeleteDC(dc); return; }+ if (!pdf) { StartPage(dc); ImprimePagina(dc, img, iw, ih); EndPage(dc); }+ else try {+ auto file = wst::StorageFile::GetFileFromPathAsync(path).get();+ auto doc = wdp::PdfDocument::LoadFromFileAsync(file).get();+ int larg = std::max(1, GetDeviceCaps(dc, HORZRES));+ for (int i : paginas) {+ if (i >= (int)doc.PageCount()) break;+ auto page = doc.GetPage(i);+ // até ~300 ppp da página (a resolução da impressora pode passar disso e gastar muita memória)+ int w = std::min(larg, (int)(page.Size().Width / 72.f * 300.f));+ wss::InMemoryRandomAccessStream ms;+ wdp::PdfPageRenderOptions opt;+ opt.DestinationWidth(std::max(1, w));+ opt.BackgroundColor(winrt::Windows::UI::Color{ 255, 255, 255, 255 });+ page.RenderToStreamAsync(ms, opt).get();+ ms.Seek(0);+ UINT pw = 0, ph = 0; std::vector<BYTE> px;+ IStream* st = nullptr;+ if (SUCCEEDED(CreateStreamOverRandomAccessStream(winrt::get_unknown(ms), IID_PPV_ARGS(&st)))) { DecodeStream(st, pw, ph, px); st->Release(); }+ StartPage(dc); ImprimePagina(dc, px, pw, ph); EndPage(dc);+ }+ } catch (...) {}+ EndDoc(dc);+ DeleteDC(dc);+ }).detach();+}+void Action(int id) {if (id == B_SIDE) { g_side = !g_side; ClampScroll(); InvalidateRect(g_wnd, nullptr, FALSE); return; }if (g_pages.empty()) return;@@ -836,7 +916,7 @@ void Action(int id) {case B_OUT: SetZoom(Zoom() / 1.25f); break;case B_IN: SetZoom(Zoom() * 1.25f); break;case B_FIT: g_fit = true; g_sx = g_sy = 0; ClampScroll(); InvalidateRect(g_wnd, nullptr, FALSE); break;- case B_PRINT: ShellExecuteW(g_wnd, L"print", g_path.c_str(), nullptr, nullptr, SW_SHOWNORMAL); break;+ case B_PRINT: Imprimir(); break;case B_MARK: SetMarkup(!g_markup); break;case B_EXPORT: Export(); break;}diff --git a/src/shell/alertas.cpp b/src/shell/alertas.cppindex a572574..4f0dc58 100644--- a/src/shell/alertas.cpp+++ b/src/shell/alertas.cpp@@ -562,6 +562,56 @@ bool HasDirectUI(HWND dlg) {return f;}+// Os textos dessas confirmações no idioma do Windows, lidos do shell32/comdlg32: antes só reconhecia inglês e+// português, e no Windows em espanhol a caixa ficava a do Windows com a barra do Mac por cima (#441, #451).+std::wstring TextoSis(const wchar_t* dll, UINT id) {+ HMODULE m = GetModuleHandleW(dll);+ if (!m) m = LoadLibraryExW(dll, nullptr, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE | LOAD_LIBRARY_SEARCH_SYSTEM32);+ const wchar_t* t = nullptr;+ int n = m ? LoadStringW(m, id, (LPWSTR)&t, 0) : 0;+ return n > 0 && t ? std::wstring(t, n) : std::wstring();+}+std::wstring Minusc(std::wstring s) { for (auto& c : s) c = towlower(c); return s; }+std::wstring Comeco(const std::wstring& s) { return Minusc(s.substr(0, s.find_first_of(L"%\n\r"))); } // até o 1º %n+struct TextosSis {+ std::vector<std::wstring> titulos, apagar, lixeira;+ std::wstring salvar, existeAntes, existeDepois; // "%1 already exists." → "" e " already exists."+};+const TextosSis& Sis() {+ static const TextosSis t = [] {+ TextosSis r;+ for (UINT id : { 16792u, 16793u, 16877u, 16884u, 16934u, 16979u }) { // Delete File/Folder/Multiple Items/Shortcut/Item+ std::wstring s = TextoSis(L"shell32.dll", id);+ if (!s.empty()) r.titulos.push_back(s);+ }+ r.salvar = TextoSis(L"comdlg32.dll", 435); // Confirm Save As+ if (!r.salvar.empty()) r.titulos.push_back(r.salvar);+ for (UINT id : { 16724u, 16725u, 16731u, 16800u, 16855u, 16977u, 16983u, 16984u }) { // "...permanently delete..."+ std::wstring s = Comeco(TextoSis(L"shell32.dll", id));+ if (s.size() > 8) r.apagar.push_back(s);+ }+ for (UINT id : { 16722u, 16723u, 16730u, 16798u }) { // "...move ... to the Recycle Bin?"+ std::wstring s = Comeco(TextoSis(L"shell32.dll", id));+ if (s.size() > 8) r.lixeira.push_back(s);+ }+ std::wstring e = TextoSis(L"comdlg32.dll", 257); // "%1 already exists.\nDo you want to replace it?"+ size_t a = e.find(L"%1");+ if (a != std::wstring::npos) {+ size_t f = e.find_first_of(L"\n\r", a);+ r.existeAntes = Minusc(e.substr(0, a));+ r.existeDepois = Minusc(e.substr(a + 2, f == std::wstring::npos ? std::wstring::npos : f - a - 2));+ while (!r.existeDepois.empty() && (r.existeDepois.back() == L'.' || r.existeDepois.back() == L' ')) r.existeDepois.pop_back();+ if (r.existeDepois.size() < 4) r.existeDepois.clear();+ }+ return r;+ }();+ return t;+}+bool ComecaCom(const std::wstring& l, const std::vector<std::wstring>& v) {+ for (auto& p : v) if (l.compare(0, p.size(), p) == 0) return true;+ return false;+}+// A posição original fica numa propriedade da própria janela (de outro programa). O vigia encerra o Shell travado// sem passar pelo Stop: a caixa ficava em -32000 para sempre e o programa, esperando a resposta, parecia travado.// O Shell novo (alertas::Create) devolve à tela as que ficaram assim.@@ -613,7 +663,8 @@ void Take(HWND dlg) {std::wstring q, file;// substituir: "x.wav already exists." / "x.wav já existe." + "Do you want to replace it?"wchar_t cap[128] = {}; GetWindowTextW(dlg, cap, 128);- bool saveAs = !_wcsicmp(cap, L"Confirm Save As") || !_wcsicmp(cap, L"Confirmar Salvar como");+ bool saveAs = !_wcsicmp(cap, L"Confirm Save As") || !_wcsicmp(cap, L"Confirmar Salvar como") ||+ (!Sis().salvar.empty() && !_wcsicmp(cap, Sis().salvar.c_str()));bool achou = false;std::wstring name;for (auto& t : texts) {@@ -621,8 +672,13 @@ void Take(HWND dlg) {for (auto& c : l) c = towlower(c);size_t at = l.find(L" already exists");if (at == std::wstring::npos) at = l.find(L" já existe");- if (at == std::wstring::npos || at == 0) continue;- name = t.substr(0, at); achou = true;+ if (at != std::wstring::npos && at > 0) { name = t.substr(0, at); achou = true; break; }+ // no idioma do Windows: "<antes>nome<depois>" ("x.png ya existe.")+ const auto& S = Sis();+ if (S.existeDepois.empty() || l.compare(0, S.existeAntes.size(), S.existeAntes)) continue;+ at = l.find(S.existeDepois, S.existeAntes.size());+ if (at == std::wstring::npos || at <= S.existeAntes.size()) continue;+ name = t.substr(S.existeAntes.size(), at - S.existeAntes.size()); achou = true;break;}// A do Abrir/Salvar novo (a do Ableton) é um TaskDialog: nem o texto nem a UI Automation leem por fora@@ -661,7 +717,8 @@ void Take(HWND dlg) {for (size_t i = 0; i < texts.size(); i++) {std::wstring l = texts[i];for (auto& c : l) c = towlower(c);- if (q.empty() && (l.find(L"are you sure") != std::wstring::npos || l.find(L"tem certeza") != std::wstring::npos)) {+ if (q.empty() && (l.find(L"are you sure") != std::wstring::npos || l.find(L"tem certeza") != std::wstring::npos ||+ ComecaCom(l, Sis().apagar) || ComecaCom(l, Sis().lixeira))) {q = texts[i];if (i + 1 < texts.size() && texts[i + 1].find(L':') == std::wstring::npos) file = texts[i + 1];}@@ -672,8 +729,9 @@ void Take(HWND dlg) {}std::wstring lq = q;for (auto& c : lq) c = towlower(c);- bool permanent = lq.find(L"permanent") != std::wstring::npos;- bool toBin = lq.find(L"recycle bin") != std::wstring::npos || lq.find(L"lixeira") != std::wstring::npos;+ bool permanent = lq.find(L"permanent") != std::wstring::npos || ComecaCom(lq, Sis().apagar);+ bool toBin = !permanent && (lq.find(L"recycle bin") != std::wstring::npos || lq.find(L"lixeira") != std::wstring::npos ||+ ComecaCom(lq, Sis().lixeira));int count = 0;for (size_t i = 0; i < lq.size(); i++) if (iswdigit(lq[i])) { count = _wtoi(lq.c_str() + i); break; }std::wstring what = !file.empty() && count == 0 ? L"“" + file + L"”" : count > 1 ? Tr(L"estes ") + std::to_wstring(count) + Tr(L" itens") : Tr(L"este item");@@ -862,6 +920,7 @@ bool IsDeleteDialog(HWND h) {L"Excluir Arquivo", L"Excluir Pasta", L"Excluir Vários Itens", L"Excluir Atalho",L"Confirm Save As", L"Confirmar Salvar como", L"Confirmar Salvar Como" })if (!_wcsicmp(t, s)) return true;+ for (auto& s : Sis().titulos) if (!_wcsicmp(t, s.c_str())) return true; // no idioma do Windowsreturn false;}diff --git a/src/shell/apps.cpp b/src/shell/apps.cppindex 1a644cc..8e99ab3 100644--- a/src/shell/apps.cpp+++ b/src/shell/apps.cpp@@ -66,7 +66,7 @@ static std::wstring ExeOfProcess(DWORD pid) {// (pilha: menubar::Update -> OfWindow -> ExeOfWindow). A chave é janela + processo + thread: um HWND reaproveitado não casa.struct DaJanela {DWORD pid = 0, tid = 0;- ULONGLONG desde = 0;+ ULONGLONG desde = 0, aumidEm = 0;std::wstring exe, aumid, aumidProc;bool temAumidProc = false;};@@ -97,8 +97,11 @@ static std::wstring ExeOfWindow(HWND h) {static std::wstring AumidOfWindow(HWND h) {DaJanela d = Guardado(h);- // o da janela pode chegar ou mudar logo depois de ela abrir: só fica guardado depois de 10 s- if (!d.aumid.empty()) return d.aumid;+ // o da janela pode chegar ou mudar logo depois de ela abrir: só fica guardado depois de 10 s. E vale por+ // 3 s: o LibreOffice usa a mesma janela da Central Inicial para o Writer, o Calc ou o Impress e troca o+ // AUMID dela; guardado para sempre, o Impress ficava no ícone do Writer (#421).+ ULONGLONG agora = GetTickCount64();+ if (!d.aumid.empty() && agora - d.aumidEm < 3000) return d.aumid;IPropertyStore* ps = nullptr;std::wstring out;if (SUCCEEDED(SHGetPropertyStoreForWindow(h, IID_PPV_ARGS(&ps)))) {@@ -108,7 +111,7 @@ static std::wstring AumidOfWindow(HWND h) {ps->Release();}if (!out.empty()) {- if (GetTickCount64() - d.desde > 10000) Guarda(h, d, [&](DaJanela& g) { g.aumid = out; });+ if (agora - d.desde > 10000) Guarda(h, d, [&](DaJanela& g) { g.aumid = out; g.aumidEm = agora; });return out;}// app da Loja cuja janela não traz o AUMID (WhatsApp, WinUI/WebView2): o do processo, que não muda@@ -812,6 +815,7 @@ void apps::ReloadIcons() {dock::IconsChanged();seletor::IconsChanged();launchpad::IconsChanged();+ spotlight::IconsChanged(); // o "Apps" do Tahoe/Golden Gate (#397)notificacoes::IconsChanged(); // o ícone próprio vale também nas notificações (issue #8)}diff --git a/src/shell/genio.cpp b/src/shell/genio.cppindex e3110ca..7abc508 100644--- a/src/shell/genio.cpp+++ b/src/shell/genio.cpp@@ -775,27 +775,53 @@ void CALLBACK OnMinimize(HWINEVENTHOOK, DWORD ev, HWND h, LONG obj, LONG, DWORD,} // namespace+// O valor salvo do usuário. O que está em vigor pode ser o que um Shell fechado à força (ou que caiu) deixou:+// a animação do Windows ficava desligada até sair da conta, mesmo com o gênio desligado (#449).+static int MinAnimateSalvo() {+ wchar_t b[8] = {}; DWORD n = sizeof(b);+ if (RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Desktop\\WindowMetrics", L"MinAnimate", RRF_RT_REG_SZ, nullptr, b, &n) != ERROR_SUCCESS) return -1;+ return _wtoi(b) ? 1 : 0;+}++static bool g_ligado; // o gênio liga e desliga pelo Ajustes na hora, sem reiniciar o Shell (#404, #448)+void genio::Create(HINSTANCE hi) {- if (shell::Setting(L"genio", L"1") != L"1") return;- WNDCLASSW wc{}; wc.lpfnWndProc = Proc; wc.hInstance = hi; wc.lpszClassName = L"ShellGenio";- RegisterClassW(&wc);- g_ov = CreateWindowExW(WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE | WS_EX_NOREDIRECTIONBITMAP | WS_EX_TRANSPARENT, wc.lpszClassName, L"", WS_POPUP, 0, 0, 1, 1, nullptr, nullptr, hi, nullptr);- if (!g_ov) return;- apps::ours.push_back(g_ov);+ if (g_ligado) return;+ int salvo = MinAnimateSalvo();+ if (shell::Setting(L"genio", L"1") != L"1") {+ ANIMATIONINFO ai{ sizeof(ai) };+ if (salvo == 1 && SystemParametersInfoW(SPI_GETANIMATION, sizeof(ai), &ai, 0) && !ai.iMinAnimate) {+ ai.iMinAnimate = TRUE;+ SystemParametersInfoW(SPI_SETANIMATION, sizeof(ai), &ai, 0);+ Log(L"gênio: desligado; a animação de minimizar do Windows tinha ficado desligada e voltou");+ }+ return;+ }+ if (!g_ov) { // ligado de novo pelo Ajustes: a mesma janela+ WNDCLASSW wc{}; wc.lpfnWndProc = Proc; wc.hInstance = hi; wc.lpszClassName = L"ShellGenio";+ RegisterClassW(&wc);+ g_ov = CreateWindowExW(WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE | WS_EX_NOREDIRECTIONBITMAP | WS_EX_TRANSPARENT, wc.lpszClassName, L"", WS_POPUP, 0, 0, 1, 1, nullptr, nullptr, hi, nullptr);+ if (!g_ov) return;+ apps::ours.push_back(g_ov);+ }// a animação de minimizar do Windows sai de cena enquanto o Shell roda (só nesta sessão, sem gravar).// (Tentei manter ligada e cobrir a tela com uma cópia viva dela: apps Chromium/Electron param de// desenhar quando se acham cobertos e a cópia ficava preta. Descartado.)ANIMATIONINFO ai{ sizeof(ai) };if (SystemParametersInfoW(SPI_GETANIMATION, sizeof(ai), &ai, 0)) {- g_prevAnim = ai.iMinAnimate;- if (ai.iMinAnimate) { ai.iMinAnimate = FALSE; SystemParametersInfoW(SPI_SETANIMATION, sizeof(ai), &ai, 0); g_changedAnim = true; }+ g_prevAnim = salvo >= 0 ? salvo : ai.iMinAnimate;+ if (ai.iMinAnimate) { ai.iMinAnimate = FALSE; SystemParametersInfoW(SPI_SETANIMATION, sizeof(ai), &ai, 0); }+ g_changedAnim = g_prevAnim != 0; // ao sair devolve a do usuário, mesmo que já estivesse desligada por um Shell anterior}- if (shell::Setting(L"genio_motor", L"composicao") == L"composicao") comp::Init(hi);+ static bool compIniciado;+ if (!compIniciado && shell::Setting(L"genio_motor", L"composicao") == L"composicao") { comp::Init(hi); compIniciado = true; }+ g_ligado = true;g_hook = SetWinEventHook(EVENT_SYSTEM_MINIMIZESTART, EVENT_SYSTEM_MINIMIZESTART, nullptr, OnMinimize, 0, 0, WINEVENT_OUTOFCONTEXT | shell::SemProprio());Log(L"gênio: ligado (animação do Windows %ls)", g_changedAnim ? L"desligada nesta sessão" : L"já estava desligada");}void genio::Stop() {+ g_ligado = false;if (g_hook) { UnhookWinEvent(g_hook); g_hook = nullptr; }if (g_running) { if (comp::g_active) comp::FinishComp(); else Finish(); }if (g_changedAnim) { // devolve a animação do Windows@@ -811,7 +837,7 @@ void genio::Pause(DWORD ms) { g_pauseUntil = GetTickCount() + ms; }// HSHELL_GETMINRECT: o Windows vai minimizar `h` (ela ainda está na tela). Começa o gênio agora e responde// com o lugar no Dock. false: não é uma janela nossa de animar (ou é a volta de uma restauração).bool genio::OnMinRect(HWND h, RECT* out) {- if (!g_ov || !Wanted(h) || revelar::Owns(h) || IsIconic(h) || (int)(g_pauseUntil - GetTickCount()) > 0) return false;+ if (!g_ov || !g_ligado || !Wanted(h) || revelar::Owns(h) || IsIconic(h) || (int)(g_pauseUntil - GetTickCount()) > 0) return false;if (g_running && g_a.target == h) { *out = g_a.slot; return true; }// oculta pelo clique no ícone do Dock: entra no ícone do app pelo gênio, como o botão de minimizar (issue #29: "seria// legal usar o gênio também ao clicar no ícone"). Só a da frente (apps::Hide marca); as outras somem sem animação@@ -829,7 +855,7 @@ int genio::Phase(HWND h) { return g_running && g_a.target == h ? (g_a.restore ?// clique na miniatura do Dock: a janela sai do lugar dela (tela) e volta pelo funilbool genio::Restore(HWND h, RECT fromSlot) {- if (!g_ov) return false;+ if (!g_ov || !g_ligado) return false;Start(h, fromSlot, true);return true;}diff --git a/src/shell/main.cpp b/src/shell/main.cppindex 233eab0..b93a813 100644--- a/src/shell/main.cpp+++ b/src/shell/main.cpp@@ -1333,6 +1333,15 @@ static LRESULT CALLBACK MsgProc(HWND h, UINT m, WPARAM w, LPARAM l) {if (lastTheme < 0) lastTheme = themeNow();LoadSettings();ilha::Reload();+ { // efeito gênio ligado/desligado no Ajustes: vale na hora (antes só depois de reiniciar o Shell, #404 #448)+ static std::wstring lastGenio = L"?";+ std::wstring genioAgora = shell::Setting(L"genio", L"1");+ if (lastGenio != L"?" && genioAgora != lastGenio) {+ if (genioAgora == L"1") genio::Create(GetModuleHandleW(nullptr)); else genio::Stop();+ Log(L"gênio: %ls pelo Ajustes", genioAgora == L"1" ? L"ligado" : L"desligado");+ }+ lastGenio = genioAgora;+ }{ // barra_todos_monitores mudou: cria ou tira as barras dos monitores secundários (e a área de trabalho deles)static std::wstring lastAll = L"?";std::wstring all = shell::Setting(L"barra_todos_monitores", L"1");diff --git a/src/shell/shell.h b/src/shell/shell.hindex de3e3c5..9ea5bb2 100644--- a/src/shell/shell.h+++ b/src/shell/shell.h@@ -383,6 +383,7 @@ void Toggle();bool IsOpen();void OpenMode(int mode); // Tahoe: abre direto num modo (1 Aplicativos = o "Apps" do Dock, 2 Arquivos, 3 Ações); de novo fechavoid Rescan(); // relê a lista de apps (um programa foi instalado ou removido)+void IconsChanged(); // ícone próprio mudou: os ícones dos apps são lidos de novo (#397)void ClickedDesktop(); // clique na mesa (gancho do revelar.cpp, outra thread): aberto, fechaRECT Lugar(); // onde o painel abre agora (px): a Siri abre alinhada a elefloat LarguraCampo(); // a largura do campo de busca (DIP) no tema atualdiff --git a/src/shell/spotlight.cpp b/src/shell/spotlight.cppindex f5c9763..90f7a91 100644--- a/src/shell/spotlight.cpp+++ b/src/shell/spotlight.cpp@@ -3078,6 +3078,21 @@ bool spotlight::Create(HINSTANCE hi) {void spotlight::Rescan() { ScanApps(); }+// Ícone próprio escolhido ou restaurado: o "Apps" do Tahoe/Golden Gate (este painel) guardava o ícone velho para sempre,+// e só o Launchpad do Sequoia e o Dock trocavam (#397). Os dos apps saem do cache e são lidos de novo.+void spotlight::IconsChanged() {+ {+ std::lock_guard<std::mutex> l(g_iconMu);+ for (auto it = g_icons.begin(); it != g_icons.end();) {+ if (it->first.rfind(L"app:", 0) == 0 && !it->second.loading) {+ if (it->second.bmp) it->second.bmp->Release();+ it = g_icons.erase(it);+ } else ++it;+ }+ }+ if (g_open && g_wnd) InvalidateRect(g_wnd, nullptr, FALSE);+}+// issue #27 (22/11/2026): clicar no papel de parede devia fechar o Spotlight, mas só o Win+Espaço fechavavoid spotlight::ClickedDesktop() { if (g_open && g_wnd) PostMessageW(g_wnd, WM_SP_FORA, 0, 0); }