A new style desktop shell for Windows 11: menu bar, Dock, Finder, Spotlight, Control Center and Liquid Glass, in native C++.
Rust
Spotlight readable over white windows and closes on a desktop click (issues #26, #27), Win+V stays open, Music in Now Playing, rounded genie start (issue #28)
Eternity070628e1c1ed7436b6
diff --git a/docs/registro-mudancas.txt b/docs/registro-mudancas.txtindex a12c848..8527416 100644--- a/docs/registro-mudancas.txt+++ b/docs/registro-mudancas.txt@@ -1111,3 +1111,12 @@ Compilado (tudo), instalado, Shell e reserva do Finder reiniciados às 23:07 sem- Apps lembram lugar e tamanho: src\comum\app2d.h (CreateMain) grava ao fechar em %APPDATA%\Shell\janela-<classe>.txt e restaura ao abrir (maximizada também), se ainda cair num monitor. Vale para Calendário, Clima, Contatos, Fotos, Lembretes, Música, Relógio, TextEdit, Time Machine e Forçar Encerrar. Conferido no Calendário: mudado para 300,200 1500x900, fechado e reaberto no mesmo lugar.Compilados e instalados Shell, Finder e os apps.DESFAZER: reverter o commit.++[2026-11-22 12:55] Issues #26, #27 e #28 (novas) revistas e corrigidas:+ - #26 Spotlight (Golden Gate): nomes e categorias do Apps sumiam sobre janela branca. O texto do Golden Gate é sempre branco, mas o vidro sem o "vidro real" usava a tinta BRANCA do modo claro, e com o vidro real a tinta escura de 42 % não bastava sobre o branco. src\shell\spotlight.cpp: MedeFundo() olha (antes de aparecer) o que fica atrás do painel e TintaGG() sobe a tinta escura de 42 % até 78 % quando é claro; vale nos dois caminhos do vidro. Log "spotlight: fundo atrás do painel". Conferido com um formulário branco por trás: fundo 1,00, tinta 78 %, nomes legíveis (foto só do Spotlight, apagada).+ - #27 Spotlight não fechava com clique no papel de parede: o gancho do mouse do revelar.cpp avisa spotlight::ClickedDesktop() (WM_SP_FORA) quando o clique cai na mesa. Não testado com clique (sem SendInput).+ - #27 Win+V piscava e fechava: ao soltar o Win o gancho mandava a tecla muda (0xE8) mesmo depois de uma combinação do Windows, e ela chegava ao painel da Área de Transferência que tinha acabado de abrir. src\shell\main.cpp: g_winPassed; se a combinação foi para o Windows (e não foi nossa), o Win solto passa sem a tecla muda (o Windows não abre o Iniciar depois de uma combinação). Não testado com teclado (sem SendInput).+ - #27 Música no "Tocando Agora": a sessão do MediaPlayer existia mas sem nome; Central e Ilha mostravam "Nada Tocando". src\musica\main.cpp: cada música vai num MediaPlaybackItem com nome, artista, álbum e capa (miniatura do arquivo, em outra thread); próxima/anterior de fora ligadas (WM_SKIP). Conferido pelo GSMTC com um WAV mudo: título, artista, álbum, Playing, próxima e anterior ligadas.+ - #28 Gênio: a janela da foto que cobre a janela no instante de minimizar era um retângulo de canto vivo; agora tem o canto arredondado do Windows (DWMWA_WINDOW_CORNER_PREFERENCE), menos maximizada.+ Não feitos (pedidos de recurso): Wallpaper Engine, Window Wobble, playlists, cor da barra seguindo a janela, prévia no Dock, cantos em janela maximizada, efeito "sugar". GIMP com a barra transparente de novo (#26): sem GIMP aqui para reproduzir.+ DESFAZER: reverter o commit.diff --git a/src/musica/main.cpp b/src/musica/main.cppindex e34567b..1a8dfab 100644--- a/src/musica/main.cpp+++ b/src/musica/main.cpp@@ -13,10 +13,14 @@#include <mutex>#include <thread>#include <random>+#include <atomic>#include <winrt/Windows.Foundation.h>#include <winrt/Windows.Media.Core.h>#include <winrt/Windows.Media.Playback.h>#include <winrt/Windows.Storage.h>+#include <winrt/Windows.Storage.FileProperties.h>+#include <winrt/Windows.Storage.Streams.h>+#include <winrt/Windows.Media.h>#pragma comment(lib, "windowsapp.lib")#pragma comment(lib, "propsys.lib")#pragma comment(lib, "shlwapi.lib")@@ -28,7 +32,7 @@ namespace wmc = winrt::Windows::Media::Core;namespace {float SB = 200, TB = 70, ROWH = 28; // macOS 27: barra de 52 (o player vai para baixo)-const UINT WM_SCAN = WM_APP + 3, WM_ART = WM_APP + 4, WM_ENDED = WM_APP + 6;+const UINT WM_SCAN = WM_APP + 3, WM_ART = WM_APP + 4, WM_ENDED = WM_APP + 6, WM_SKIP = WM_APP + 7;struct Song { std::wstring path, title, artist, album; int track = 0; double secs = 0; FILETIME added{}; };std::vector<Song> g_songs;@@ -133,12 +137,42 @@ void AskArt(const std::wstring& album, const std::wstring& file) {ID2D1Bitmap* Art(const Song& s) { auto it = g_art.find(s.album); if (it != g_art.end()) return it->second; AskArt(s.album, s.path); return nullptr; }// ---- reprodução+// O "Tocando Agora" do Windows (Central de Controle, Ilha Dinâmica, teclas de mídia) lê o nome, o artista e a capa das+// propriedades do item que o MediaPlayer toca. Sem preencher, a sessão existia mas vazia: a Central mostrava "Nada Tocando"+// e a Ilha ignorava (issue #27, 22/11/2026). O DisplayUpdater direto não serve: o player o refaz ao abrir a mídia.+// A capa vem da miniatura do arquivo, em outra thread.+std::atomic<int> g_smtcGen;+wmp::MediaPlaybackItem Item(const Song& s) {+ wmp::MediaPlaybackItem item(wmc::MediaSource::CreateFromUri(winrt::Windows::Foundation::Uri(L"file:///" + s.path)));+ try {+ auto dp = item.GetDisplayProperties();+ dp.Type(winrt::Windows::Media::MediaPlaybackType::Music);+ auto mp = dp.MusicProperties();+ mp.Title(s.title); mp.Artist(s.artist); mp.AlbumTitle(s.album);+ item.ApplyDisplayProperties(dp);+ int gen = ++g_smtcGen;+ std::wstring path = s.path;+ std::thread([item, path, gen] {+ try {+ winrt::init_apartment(winrt::apartment_type::multi_threaded);+ auto f = winrt::Windows::Storage::StorageFile::GetFileFromPathAsync(path).get();+ auto th = f.GetThumbnailAsync(winrt::Windows::Storage::FileProperties::ThumbnailMode::MusicView, 300).get();+ if (th && th.Type() == winrt::Windows::Storage::FileProperties::ThumbnailType::Image && gen == g_smtcGen) {+ auto dp = item.GetDisplayProperties();+ dp.Thumbnail(winrt::Windows::Storage::Streams::RandomAccessStreamReference::CreateFromStream(th));+ item.ApplyDisplayProperties(dp);+ }+ } catch (...) {}+ }).detach();+ } catch (...) {}+ return item;+}void PlayIndex(int pos) {if (pos < 0 || pos >= (int)g_queue.size()) return;g_pos = pos;const Song& s = g_songs[g_queue[pos]];try {- g_player.Source(wmc::MediaSource::CreateFromUri(winrt::Windows::Foundation::Uri(L"file:///" + s.path)));+ g_player.Source(Item(s));g_player.Play();} catch (...) {}SetWindowTextW(wnd, (s.title + L" — " + s.artist).c_str());@@ -519,6 +553,11 @@ LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {delete d; InvalidateRect(h, nullptr, FALSE); return 0;}case WM_ENDED: if (g_repeat == 2) PlayIndex(g_pos); else Next(1); return 0;+ case WM_SKIP: // ⏭ / ⏮ da Central de Controle, da Ilha ou das teclas de mídia+ if ((int)w < 0 && PosSecs() > 3) { try { g_player.PlaybackSession().Position(std::chrono::seconds(0)); } catch (...) {} }+ else Next((int)w);+ InvalidateRect(h, nullptr, FALSE);+ return 0;case WM_COPYDATA: { // outra abertura mandou um arquivo (o app tem uma janela só)auto* cd = (COPYDATASTRUCT*)l;if (cd->dwData == 0x4D555343 && cd->cbData >= 2) { std::wstring p((const wchar_t*)cd->lpData, cd->cbData / 2); while (!p.empty() && !p.back()) p.pop_back(); PlayFile(p); }@@ -624,6 +663,12 @@ int WINAPI wWinMain(HINSTANCE hi, HINSTANCE, PWSTR, int show) {g_player = wmp::MediaPlayer();g_player.Volume(g_volume);g_player.MediaEnded([](auto&&, auto&&) { PostMessageW(wnd, WM_ENDED, 0, 0); });+ // próxima/anterior de fora: sem isto os botões ficavam apagados no "Tocando Agora"+ auto cm = g_player.CommandManager();+ cm.NextBehavior().EnablingRule(wmp::MediaCommandEnablingRule::Always);+ cm.PreviousBehavior().EnablingRule(wmp::MediaCommandEnablingRule::Always);+ cm.NextReceived([](auto&&, wmp::MediaPlaybackCommandManagerNextReceivedEventArgs const& a) { a.Handled(true); PostMessageW(wnd, WM_SKIP, 1, 0); });+ cm.PreviousReceived([](auto&&, wmp::MediaPlaybackCommandManagerPreviousReceivedEventArgs const& a) { a.Handled(true); PostMessageW(wnd, WM_SKIP, (WPARAM)-1, 0); });} catch (...) {}Scan();SetTimer(wnd, 1, 500, nullptr);diff --git a/src/shell/genio.cpp b/src/shell/genio.cppindex 7162d8f..a64cfe3 100644--- a/src/shell/genio.cpp+++ b/src/shell/genio.cpp@@ -250,6 +250,10 @@ bool Snap(HWND h, bool show, std::vector<uint32_t>& px, int& w, int& hh) {if (w < 4 || hh < 4 || w > 16384 || hh > 16384) { HideCap(); return false; }BOOL cloak = show ? FALSE : TRUE;DwmSetWindowAttribute(g_cap, DWMWA_CLOAK, &cloak, sizeof(cloak));+ // a janela da foto cobre a janela no instante de minimizar: sem isto ela era um retângulo de canto vivo e os cantos+ // arredondados "ficavam pontudos" logo no começo do gênio (issue #28, 22/11/2026)+ DWORD corner = g_a.maxed ? 1 : 2; // DWMWCP_DONOTROUND / DWMWCP_ROUND+ DwmSetWindowAttribute(g_cap, 33, &corner, sizeof(corner));SetWindowPos(g_cap, HWND_TOPMOST, g_a.win.left, g_a.win.top, w, hh, SWP_NOACTIVATE | SWP_SHOWWINDOW);DWM_THUMBNAIL_PROPERTIES tp{};tp.dwFlags = DWM_TNP_RECTDESTINATION | DWM_TNP_RECTSOURCE | DWM_TNP_VISIBLE | DWM_TNP_OPACITY | DWM_TNP_SOURCECLIENTAREAONLY;diff --git a/src/shell/main.cpp b/src/shell/main.cppindex e352616..ebc0d19 100644--- a/src/shell/main.cpp+++ b/src/shell/main.cpp@@ -46,6 +46,7 @@ static std::atomic<bool> g_altTab; // seletor de apps aberto (Alt seguro desdestatic HHOOK g_kbHook;static bool g_winDown, g_winCombo, g_winEaten, g_spaceHeld, g_tabHeld; // eaten: a combinação foi nossa (Win+I)static DWORD g_winVk, g_winAt; // At: quando a tecla Win desceu (ms do gancho)+static bool g_winPassed; // uma tecla de combinação foi para o Windows (Win+V, Win+.): ele não abre o Iniciar ao soltarstatic void Inject(DWORD vk, bool up) {@@ -119,12 +120,16 @@ static LRESULT CALLBACK KeyHook(int code, WPARAM w, LPARAM l) {if (down) {if (!g_winDown) {g_winDown = true; g_winCombo = mods(); g_winEaten = false; g_spaceHeld = false; g_tabHeld = false; g_winVk = k->vkCode; g_winAt = k->time;+ g_winPassed = false;}return CallNextHookEx(g_kbHook, code, w, l);}if (g_winDown) {g_winDown = false;if (!g_winCombo && k->time - g_winAt <= 1000) PostMessageW(g_msg, WM_APP_LAUNCHPAD, 0, 0); // sozinha: Launchpad/Spotlight+ // Combinação que foi para o Windows (Win+V, Win+.): ele mesmo não abre o Iniciar, e a tecla muda chegava+ // ao painel que acabou de abrir: o histórico da Área de Transferência piscava e fechava (issue #27, 22/11/2026)+ if (g_winPassed && !g_winEaten) return CallNextHookEx(g_kbHook, code, w, l);// a tecla muda e o soltar do Win vão juntos, nesta ordem: deixando o soltar de verdade passar, a muda// (mandada daqui de dentro) chegava depois dele e o Iniciar abriaInject(0xE8, false); Inject(0xE8, true);@@ -261,6 +266,7 @@ static LRESULT CALLBACK KeyHook(int code, WPARAM w, LPARAM l) {} else if (g_winDown && down && !g_winCombo) {// combinação do Windows: a tecla Win já foi para ele; esta segue tambémg_winCombo = true;+ g_winPassed = true;}}}diff --git a/src/shell/revelar.cpp b/src/shell/revelar.cppindex ba1b900..5fd9945 100644--- a/src/shell/revelar.cpp+++ b/src/shell/revelar.cpp@@ -75,6 +75,7 @@ void Worker() {}g_down = pt;g_downOnDesk = IsDesktopWindow(WindowFromPoint(pt));+ if (g_downOnDesk && spotlight::IsOpen()) spotlight::ClickedDesktop();} else if (msg.message == WM_RV_UP && g_downOnDesk) {g_downOnDesk = false;if (std::abs(pt.x - g_down.x) <= 4 && std::abs(pt.y - g_down.y) <= 4) // clique, não arrasto de seleçãodiff --git a/src/shell/shell.h b/src/shell/shell.hindex 0b14f56..b8c8434 100644--- a/src/shell/shell.h+++ b/src/shell/shell.h@@ -339,6 +339,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 ClickedDesktop(); // clique na mesa (gancho do revelar.cpp, outra thread): aberto, fecha}namespace dashboard { // Dashboard do Leopard (dashboard.cpp): Win+F12 / ShellAbrirPainel 16bool Create(HINSTANCE hi);diff --git a/src/shell/spotlight.cpp b/src/shell/spotlight.cppindex b4534f7..ebe5035 100644--- a/src/shell/spotlight.cpp+++ b/src/shell/spotlight.cpp@@ -68,7 +68,7 @@ void Metricas() {WIN_H = FIELD_H + 1 + GG_GAP + MAX_LIST_H;}const float LEO_ROW = 20, LEO_COL = 112; // Leopard: linhas de 20 e a coluna das categorias-const UINT WM_SP_FILES = WM_APP + 60, WM_SP_ICON = WM_APP + 61, WM_SP_APPS = WM_APP + 62, WM_SP_FRAME = WM_APP + 63, WM_SP_SUGG = WM_APP + 64;+const UINT WM_SP_FILES = WM_APP + 60, WM_SP_ICON = WM_APP + 61, WM_SP_APPS = WM_APP + 62, WM_SP_FRAME = WM_APP + 63, WM_SP_SUGG = WM_APP + 64, WM_SP_FORA = WM_APP + 65;const UINT_PTR T_SEARCH = 1, T_CARET = 2, T_ICONS = 3, T_REGRAB = 4;enum Kind { K_APP, K_SETTING, K_DOC, K_FOLDER, K_IMAGE, K_MEDIA, K_OTHER, K_CALC, K_WEB };@@ -839,6 +839,7 @@ int g_chip; // filtro escolhido (0 = nenhum)float g_pill = -1; // Tahoe: largura atual do vidro do campo (anima entre a cápsula e o painel inteiro)double g_listIn; // quando o conteúdo do modo mudou (entra esmaecendo e subindo um pouco)void Place();+D2D1_COLOR_F TintaGG();void ModeChanged() {g_listIn = anim::Now();float w0 = W;@@ -1842,7 +1843,7 @@ void Paint() {// Tahoe (vídeo do macOS 26): vidro claro e leitoso que pega a cor do fundo (a cápsula fica azulada sobre o azul)// Tahoe: medido na tela (guia, seções 52 e 60): escuro 0,19 × fundo + 0,12 (81 % de 0,148); claro 0,26 × fundo// + 0,73 (74 % de 0,986): o Spotlight do macOS 26 é quase opaco, o "líquido" fica na borda- D2D1_COLOR_F tint = !liquid::On() ? p.tint : ui::Dark() ? D2D1::ColorF(0.148f, 0.148f, 0.155f, 0.81f) : D2D1::ColorF(0.986f, 0.986f, 0.99f, 0.74f);+ D2D1_COLOR_F tint = gg ? TintaGG() : !liquid::On() ? p.tint : ui::Dark() ? D2D1::ColorF(0.148f, 0.148f, 0.155f, 0.81f) : D2D1::ColorF(0.986f, 0.986f, 0.99f, 0.74f);if (compact && backdrop::Real()) { // cada peça com a lente dela; os círculos saem da cápsula (e encolhem até sumir)float cw = CapEnd(pw);std::vector<backdrop::Piece> pcs;@@ -1865,7 +1866,7 @@ void Paint() {}backdrop::SetPieces(g_back, W * sc, H * sc, pcs, tint, 10.f);} else if (gg && backdrop::Real()) { // Golden Gate: a barra e o painel em duas peças de vidro- tint = D2D1::ColorF(0.09f, 0.07f, 0.06f, 0.42f); // tinta escura por cima do fundo bem desfocado (nunca transparente)+ tint = TintaGG(); // tinta escura por cima do fundo bem desfocado (nunca transparente)const float fpw2 = std::min(W, GG_BAR_W), fx2 = (W - fpw2) / 2;std::vector<backdrop::Piece> pcs{ { D2D1::RectF(fx2 * sc, 0, (fx2 + fpw2) * sc, FIELD_H * sc), FIELD_H / 2 * sc } };if (H > FIELD_H + 1.5f) pcs.push_back({ D2D1::RectF(0, (FIELD_H + GG_GAP) * sc, W * sc, H * sc), 30 * sc });@@ -1881,7 +1882,7 @@ void Paint() {}// As janelas ficam sempre do tamanho máximo; o que cresce e encolhe é o recorte do vidro e o desenho.-void Place() {+RECT PlaceRect() {float sc = Sc();int wpx = (int)std::lround(W * sc), hpx = (int)std::lround(WIN_H * sc);MONITORINFO mi{ sizeof(mi) };@@ -1891,6 +1892,48 @@ void Place() {// no Mac (Sequoia) o campo fica a ~22% da altura da tela; no Tahoe a 30 % (guia, seção 39); o painel cresce para baixoint x = m.left + (m.right - m.left - wpx) / 2, y = m.top + (int)((m.bottom - m.top) * (liquid::On() ? 0.30f : 0.22f));if (liquid::Leopard()) { x = m.right - wpx - 2; y = m.top + menubar::Height(); } // Leopard: desce da lupa, na ponta direita+ return { x, y, x + wpx, y + hpx };+}++// Golden Gate: o texto do Spotlight é sempre branco (MEDIDAS, parte 3). Sobre uma janela branca o vidro desfocado+// fica claro e os nomes do painel Apps sumiam (issue #26, 22/11/2026). Ao abrir (ainda escondido), mede o que vai+// ficar atrás do painel; claro, a tinta escura fica mais forte.+float g_fundoLum = 0;+void MedeFundo() {+ g_fundoLum = 0;+ RECT r = PlaceRect();+ r.top += (LONG)std::lround((FIELD_H + GG_GAP) * Sc());+ int w = r.right - r.left, h = r.bottom - r.top;+ if (w <= 0 || h <= 0) return;+ const int BW = 24, BH = 16;+ HDC s = GetDC(nullptr); HDC m = CreateCompatibleDC(s);+ BITMAPINFO bi{}; bi.bmiHeader = { sizeof(BITMAPINFOHEADER), BW, -BH, 1, 32, BI_RGB };+ void* bits = nullptr;+ HBITMAP b = CreateDIBSection(s, &bi, DIB_RGB_COLORS, &bits, nullptr, 0);+ if (b && bits) {+ HGDIOBJ o = SelectObject(m, b);+ SetStretchBltMode(m, HALFTONE);+ StretchBlt(m, 0, 0, BW, BH, s, r.left, r.top, w, h, SRCCOPY);+ GdiFlush();+ double soma = 0;+ auto* px = (const BYTE*)bits;+ for (int i = 0; i < BW * BH; i++) soma += (0.0722 * px[i * 4] + 0.7152 * px[i * 4 + 1] + 0.2126 * px[i * 4 + 2]) / 255.0;+ g_fundoLum = (float)(soma / (BW * BH));+ SelectObject(m, o);+ }+ if (b) DeleteObject(b);+ DeleteDC(m); ReleaseDC(nullptr, s);+}++// tinta do vidro no Golden Gate: a medida (0,09; 0,07; 0,06 a 42 %) e, com o fundo claro, até 78 %+D2D1_COLOR_F TintaGG() {+ float a = 0.42f + std::clamp((g_fundoLum - 0.35f) / 0.45f, 0.f, 1.f) * 0.36f;+ return D2D1::ColorF(0.09f, 0.07f, 0.06f, a);+}++void Place() {+ RECT pr = PlaceRect();+ int x = pr.left, y = pr.top, wpx = pr.right - pr.left, hpx = pr.bottom - pr.top;SetWindowPos(g_wnd, HWND_TOPMOST, x, y, wpx, hpx, SWP_NOACTIVATE);SetWindowPos(g_back, g_wnd, x, y, wpx, hpx, SWP_NOACTIVATE | SWP_SHOWWINDOW);}@@ -2608,6 +2651,9 @@ LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {Animate();return 0;}+ case WM_SP_FORA: // clique no papel de parede: nem sempre tira o foco (mesa do Explorador por baixo), e o Spotlight ficava aberto+ if (g_open && !g_fileDrag) { Log(L"spotlight: clique na mesa, fechando"); Close(); }+ return 0;case WM_ACTIVATE:if (LOWORD(w) == WA_INACTIVE && g_fileDrag) return 0; // arrastando um arquivo para fora: o StartFileDrag decideif (LOWORD(w) == WA_INACTIVE) {@@ -2689,6 +2735,9 @@ bool spotlight::Create(HINSTANCE hi) {void spotlight::Rescan() { ScanApps(); }+// issue #27 (22/11/2026): clicar no papel de parede devia fechar o Spotlight, mas só o Win+Espaço fechava+void spotlight::ClickedDesktop() { if (g_open && g_wnd) PostMessageW(g_wnd, WM_SP_FORA, 0, 0); }+bool spotlight::IsOpen() { return g_open; }static void OpenWith(int mode);@@ -2720,6 +2769,10 @@ static void OpenWith(int mode) {g_keyNav = false;const bool wasVisible = g_visible;if (!g_visible) { g_h = FIELD_H; g_scrollNow = 0; } // nasce só com o campo; os resultados crescem dele+ if (!g_visible && liquid::Golden()) {+ MedeFundo();+ Log(L"spotlight: fundo atrás do painel %.2f (tinta %.0f %%)", g_fundoLum, TintaGG().a * 100);+ }g_visible = true;g_selTop = g_selBot = -1;g_selAll = !g_query.empty(); // como no Mac: reabre com a última busca, toda selecionada