A new style desktop shell for Windows 11: menu bar, Dock, Finder, Spotlight, Control Center and Liquid Glass, in native C++.
Rust
Mac OS X Leopard theme, Game Mode, apps and title bars without the shell, MIT license
Eternity070628680c323e77c1
diff --git a/.gitignore b/.gitignoreindex f484ecb..eabc0c5 100644--- a/.gitignore+++ b/.gitignore@@ -27,3 +27,6 @@ icones/goldengate/icones/leopard/# Mac OS X cursor pack (RaZcaLinSIDe), downloaded by the user: personal use, rebuilt by tools/cursor-leopard.pycursor/Leopard/++# Python bytecode of the tools+__pycache__/diff --git a/LICENSE b/LICENSEnew file mode 100644index 0000000..5dff5e3--- /dev/null+++ b/LICENSE@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2026 renzyxx++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.diff --git a/README.md b/README.mdindex e33c284..bf6cf6d 100644--- a/README.md+++ b/README.md@@ -21,8 +21,8 @@WacOS runs on top of Windows (same kernel, drivers and apps) and replaces what you see and touch: the menu bar,the Dock, Finder, Spotlight, Control Center, Notification Center, Mission Control, Launchpad, window title bars and a-set of built-in apps. Pick the new macOS 27 **Golden Gate** look, the macOS Tahoe look with Liquid Glass, or the-macOS Sequoia look.+set of built-in apps. Pick the new macOS 27 **Golden Gate** look, the macOS Tahoe look with Liquid Glass, the+macOS Sequoia look, or the classic **Mac OS X Leopard** (2007) Aqua look.Everything is native C++ (Win32, Direct2D, DirectComposition). No Electron, no web views. It uses about 750 MB of RAMand under 1% CPU on a 3440×1440 desktop.@@ -30,11 +30,11 @@ and under 1% CPU on a 3440×1440 desktop.**Contents:** [Screenshots](#screenshots) · [Features](#features) · [Install](#install) · [Is it safe?](#is-it-safe) ·-[Roadmap](#roadmap) · [Support the project](#support-the-project) · [Build](#build)+[Roadmap](#roadmap) · [Support the project](#support-the-project) · [Build](#build) · [License](#license)## Screenshots-Three themes, in System Settings > Appearance > Theme. Switching themes never changes your own wallpaper.+Four themes, in System Settings > Appearance > Theme. Switching themes never changes your own wallpaper.### 1. macOS 27 Golden Gate (new)@@ -83,6 +83,20 @@ The same shell with the macOS 15 look (System Settings > Appearance > Theme).|  **Launchpad** |  **Spotlight** ||  **Finder** |  **System Settings** with the Sequoia wallpapers |+### 4. Mac OS X Leopard (new)++The 2007 Aqua look, drawn from scratch (nothing reused from the modern themes): the glossy 3D Dock shelf with+reflections, the translucent menu bar, gel buttons, brushed-metal windows, Cover Flow in Finder, System Preferences+laid out like 10.5, Quick Look as a dark HUD, Dashboard, Spaces, Time Machine and the Leopard cursor (your previous cursor comes back when you switch+themes).++++| | |+|---|---|+|  **Finder** with Cover Flow |  **System Preferences** |+|  **Quick Look** HUD |  **About This Mac** with your PC's real specs |+## Features- **Menu bar** with the active app's real menus, the Apple menu, status icons and the system tray.@@ -96,7 +110,12 @@ The same shell with the macOS 15 look (System Settings > Appearance > Theme).Reminders, Calendar, TextEdit, Preview, Photos, Music, QuickTime Player, Clock, Weather, Contacts,Time Machine, Screenshot and Force Quit.- **Memory management like macOS**: memory pressure, App Nap and purgeable memory.-- **Themes**: macOS 27 Golden Gate, macOS Tahoe and macOS Sequoia.+- **Themes**: macOS 27 Golden Gate, macOS Tahoe, macOS Sequoia and Mac OS X Leopard.+- **Dynamic Island** (optional, System Settings > Control Center): music, timers, notifications and volume in a pill+ or a notch at the top of the screen.+- **Game Mode** like macOS: when a game comes to the front, WacOS turns off what costs the most (real glass, mouse+ effects, Hot Corners, file indexing) until the game quits. System Settings > Energy.+- **Launchpad**: hide any app (right-click > Hide from Launchpad), or all of Windows' system tools at once.- **Icon styles** (Default, Dark, Clear, Tinted), accent colors, light and dark appearance.- **English and Portuguese** interface (English is the default; System Settings > General > Language).@@ -119,6 +138,23 @@ Everything it changes is logged in `instalacao.log` there, and `desinstalar.cmd`- Quit WacOS: `Ctrl+Alt+Shift+F12`. Emergency exit (brings Explorer back): `Ctrl+Alt+Shift+F11`.+### Use only the apps, or only the title bars++Have your own setup? `instalar.cmd` asks what to install:++1. **Full WacOS** (menu bar, Dock, Finder...).+2. **Only the apps you pick** (Finder, Notes, Calculator, Music, Preview...): shortcuts go to a **WacOS** folder in+ the Start menu. Each app draws its own Mac title bar, with or without the shell running.+3. **Only the Mac title bars** on your other apps: `WacOSTitleBars.exe`, with an optional start at sign-in.+ Turn it off with `WacOSTitleBars.exe --sair` (it also stops when the full shell starts, which takes over).+4. **Apps + title bars**.++Options 2 to 4 keep the Windows taskbar, Explorer and your folders as they are, and don't add the shell's sign-in+task. Themes and language are read from System Settings (install it as one of the apps to change them).+Apps that should never get the Mac title bar go one per line in `%APPDATA%\Shell\janelas-excluidas.txt`.+The built-in apps keep the window corners Windows draws, so mods that change the corner radius (like Windhawk's+rounded corners) should no longer leave a square frame around them.+## UpdatesNew versions are published as numbered releases (`build-N`). In **System Settings > General > Software Update**,@@ -139,13 +175,14 @@ Fair question for anything that replaces your taskbar. You don't have to trust t- **Antivirus.** A shell has to do things that look suspicious to heuristics: start at sign-in, use keyboard andmouse hooks for shortcuts like the Win key and hot corners, and load its title bar DLL into other apps. Thebuild-12 package shows [1/66 on VirusTotal](https://www.virustotal.com/gui/file/310ab4f16824500a8d77225fef66a62e499c32d6d5484a8752b119b7f24e67f3),- a single AI-based heuristic. If Microsoft Defender flags it on your PC, it's a false positive that has been+ a single AI-based heuristic. The install scripts are plain PowerShell you can read: no inline C#, no hidden+ windows, and the updater checks the package's SHA-256 against the one GitHub publishes. If Microsoft Defender flags it on your PC, it's a false positive that has beenreported to Microsoft; please [open an issue](https://github.com/renzyxx/WacOS/issues) with the threat name.## Roadmap-- **Dynamic Island**: in progress, inspired by [Atoll](https://github.com/Ebullioscopic/Atoll).-- **4th theme: Mac OS X Leopard**: Aqua, the glossy 3D Dock with reflections, the translucent menu bar and Stacks.+- **Dynamic Island**: more activities (inspired by [Atoll](https://github.com/Ebullioscopic/Atoll); no code copied).+- **Signed releases**, so antivirus heuristics stop flagging the installer scripts.- Your idea? [Open an issue](https://github.com/renzyxx/WacOS/issues).## Support the project@@ -164,7 +201,8 @@ Requires Visual Studio 2022 (or Build Tools 2022) with the C++ workload.build.cmd everythingbuild.cmd shell the shell only (WacOSShell.exe: menu bar, Dock, Spotlight...)build.cmd finder Finder only-build.cmd janelas Mac title bars for other apps (WacOSWindow.dll, 32 and 64 bit)+build.cmd janelas Mac title bars for other apps (WacOSWindow.dll, 32 and 64 bit, and WacOSTitleBars.exe)+build.cmd titulos WacOSTitleBars.exe only (the title bars without the shell)tools\empacotar.ps1 the installer package (dist\WacOS-<date>.zip)```@@ -172,12 +210,26 @@ tools\empacotar.ps1 the installer package (dist\WacOS-<date>.zip)- `src/shell`: the shell (menu bar, Dock, Spotlight, Control Center, Mission Control, Liquid Glass...).- `src/finder`, `src/ajustes` (System Settings), `src/monitor` (Activity Monitor) and the other apps in `src/*`.-- `src/janelas`: Mac title bars injected into other apps' windows.+- `src/janelas`: Mac title bars injected into other apps' windows; `src/titulos`: the title bars without the shell.- `src/menu`: context menus on top of the real Windows shell extensions.- `src/comum`: shared code (names, language, glass, shadows).- `instalador`: install, update and uninstall scripts. `tools`: build and packaging tools.- `icones`: icon packs (Sequoia, Tahoe) and SF Symbols.+## Performance++Measured on the author's PC (i9-14900K, RTX 3070 Ti, 3440×1440 at 174 Hz). At rest the shell uses about 1% of one+CPU core and no GPU time; with a game in front (Game Mode on) about 2% of one core and no GPU time. Memory: about+350 to 500 MB for the shell (most of it is the Spotlight file index), plus around 100 MB for the hidden Finder that+makes Finder windows open instantly. Animations run on the display's refresh clock, not timers, and nothing polls while+idle.++## License++The WacOS source code is released under the [MIT License](LICENSE). Apple's icons, fonts, sounds and wallpapers, and+the third-party icon and cursor packs bundled in the release package, are not covered by it: they belong to their+owners and are included for personal use only.+## NoteApple, macOS, Finder and related names and icons belong to Apple Inc. This is a personal, non-commercial projectdiff --git a/build.cmd b/build.cmdindex 9ac40e0..0a46267 100644--- a/build.cmd+++ b/build.cmd@@ -14,7 +14,8 @@ rem build.cmd notas so o Notas (WacOSNotes.exe)rem build.cmd captura so a Captura de Tela (WacOSScreenshot.exe: Win+Shift+3/4/5)rem build.cmd preview so a Pre-Visualizacao (WacOSPreview.exe: imagens e PDF)rem build.cmd apps so Lembretes, Calendario e TextEdit-rem build.cmd janelas barra de titulo do Mac nos outros programas (WacOSWindow.dll, 32 e 64 bits)+rem build.cmd janelas barra de titulo do Mac nos outros programas (WacOSWindow.dll, 32 e 64 bits, e WacOSTitleBars.exe)+rem build.cmd titulos so o WacOSTitleBars.exe (as barras de titulo sem o Shell)rem build.cmd bandeja so o prototipo da bandeja (BandejaTeste.exe)setlocalset "VSDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools"@@ -29,7 +30,7 @@ if not exist bin\ferramentas mkdir bin\ferramentasrem icones e descricoes (VERSIONINFO) de cada programaset "RES=bin\obj\res"powershell -NoProfile -ExecutionPolicy Bypass -File tools\recursos.ps1 -Out %RES% >nul || exit /b 1-for %%n in (WacOSShell WacOSFinder WacOSSettings WacOSActivityMonitor WacOSTerminal WacOSCalculator WacOSNotes WacOSScreenshot WacOSPreview WacOSReminders WacOSCalendar WacOSTextEdit WacOSClock WacOSWeather WacOSContacts WacOSPhotos WacOSTimeMachine WacOSMusic WacOSQuickTime WacOSForceQuit WacOSWindow WacOSWindow32) do (+for %%n in (WacOSShell WacOSFinder WacOSSettings WacOSActivityMonitor WacOSTerminal WacOSCalculator WacOSNotes WacOSScreenshot WacOSPreview WacOSReminders WacOSCalendar WacOSTextEdit WacOSClock WacOSWeather WacOSContacts WacOSPhotos WacOSTimeMachine WacOSMusic WacOSQuickTime WacOSForceQuit WacOSTitleBars WacOSWindow WacOSWindow32) do (rc /nologo /fo %RES%\%%n.res %RES%\%%n.rc >nul || exit /b 1)@@ -46,12 +47,18 @@ if /i "%1"=="dialogo" (if /i "%1"=="janelas" (rem barra de titulo do Mac nas janelas dos outros programas: DLL de 64 bits e de 32 (esta roda no rundll32 de 32 bits do Windows)cl %CFLAGS% /LD src\janelas\macjanela.cpp src\janelas\controles.cpp %RES%\WacOSWindow.res /Fe:bin\WacOSWindow.dll /link /IMPLIB:bin\obj\WacOSWindow.lib %LIBS% || exit /b 1+ call :titulos || exit /b 1call "%VSDIR%\VC\Auxiliary\Build\vcvarsall.bat" x86 >nul || exit /b 1if not exist bin\obj32 mkdir bin\obj32cl /nologo /EHsc /O2 /W3 /std:c++20 /utf-8 /DUNICODE /D_UNICODE /Fo:bin\obj32\ /LD src\janelas\macjanela.cpp src\janelas\controles.cpp %RES%\WacOSWindow32.res /Fe:bin\WacOSWindow32.dll /link /IMPLIB:bin\obj32\WacOSWindow32.lib %LIBS% || exit /b 1exit /b 0)+if /i "%1"=="titulos" (+ call :titulos || exit /b 1+ exit /b 0+)+if /i "%1"=="bandeja" (cl %CFLAGS% src\tools\bandeja_teste.cpp /Fe:bin\ferramentas\BandejaTeste.exe %LFLAGS% || exit /b 1exit /b 0@@ -137,3 +144,10 @@ if /i "%1"=="apps" exit /b 0:shellrem /Zi + /DEBUG: simbolos em bin\obj\WacOSShell.pdb (perfil de CPU e falhas); /OPT:REF,ICF mantem o exe enxutocl %CFLAGS% /Zi /Fd:bin\obj\shell.pdb src\shell\*.cpp bin\obj\context_menu.obj %RES%\WacOSShell.res /Fe:bin\WacOSShell.exe %LFLAGS% version.lib wlanapi.lib powrprof.lib propsys.lib windowscodecs.lib d3d11.lib dxgi.lib dcomp.lib dxguid.lib /DEBUG /OPT:REF /OPT:ICF /PDB:bin\obj\WacOSShell.pdb || exit /b 1+exit /b 0++rem so as barras de titulo, sem o Shell: src\titulos + o janelas.cpp do Shell (objetos em pasta propria)+:titulos+if not exist bin\obj\titulos mkdir bin\obj\titulos+cl %CFLAGS% /Fo:bin\obj\titulos\ src\titulos\main.cpp src\shell\janelas.cpp %RES%\WacOSTitleBars.res /Fe:bin\WacOSTitleBars.exe %LFLAGS% || exit /b 1+exit /b 0diff --git a/docs/BRIEFING.md b/docs/BRIEFING.mdindex 58e1b18..f890eb5 100644--- a/docs/BRIEFING.md+++ b/docs/BRIEFING.md@@ -68,7 +68,7 @@ Objetivo de qualidade: **ficar idêntico ao Mac** (medidas, curvas, tempos, text### 4.1 Build`build.cmd [alvo]` na raiz. Alvos: (vazio = tudo), `shell`, `finder`, `ajustes`, `monitor`, `terminal`,-`calculadora`, `notas`, `captura`, `menu` (bancada MenuTeste), `janelas` (SequoiaWindow.dll 64/32 ++`calculadora`, `notas`, `captura`, `menu` (bancada MenuTeste), `titulos` (WacOSTitleBars.exe; também sai no `janelas`), `janelas` (SequoiaWindow.dll 64/32 +host 32), `dialogo` (DialogoMac.dll), `bandeja`. O build "tudo" **não** inclui `janelas` nem `dialogo`.Ícone e descrição de cada exe: `tools/recursos.ps1` (gerado no build).Flags: `/O2 /W3 /std:c++20 /utf-8 /DUNICODE`. Sem MSBuild, sem projeto .vcxproj.@@ -112,6 +112,7 @@ início automático (tarefa agendada `SequoiaShell`), abrir agora. `desinstalar.| `SequoiaNotes.exe` | `src/notas` | Notas (texto rico, `%APPDATA%\Shell\Notas`) || `SequoiaScreenshot.exe` | `src/captura` | Captura de Tela (Win+Shift+3/4/5) || `WacOSWindow.dll` / `WacOSWindow32.dll` | `src/janelas` | barra de título do Mac e controles nas janelas dos outros programas (gancho em 64 bits pelo Shell; 32 bits pela própria DLL dentro do rundll32 de 32 bits do Windows, entrada WacOSHost) |+| `WacOSTitleBars.exe` | `src/titulos` + `src/shell/janelas.cpp` | só as barras de título do Mac, sem o Shell (`--sair` desliga; o Shell fecha e assume). Os apps sem botões próprios (app2d.h, Pré-Visualização) carregam a `WacOSWindow.dll` sozinhos (`src/comum/barra_mac.h`, entrada `WacOSPropria`); o Shell não põe gancho em exe com "wacos" no nome || `DialogoMac.dll` / `DialogoMac32.dll` | `src/dialogo` | troca IFileOpenDialog/IFileSaveDialog pelo Finder (HKCU CLSID, `tools/dialogo-ligar.ps1`) || `ferramentas\MenuTeste.exe` | `src/tools/menu_teste.cpp` | bancada do menu de contexto (`--dump`, `--demo`, `--demo <pasta> --quente`) |@@ -125,7 +126,7 @@ apps (Dock: fixos em dock.txt, abertos, recentes), atalhos (tarefas do app no mebackdrop (vidro: Composition + **vidro real** por captura de janelas), bloqueio (tela de bloqueio própria),boot (tela de inicialização), cantos (Cantos Ativos), central (Central de Controle + Editar Controles),dialogs (Abrir/Salvar trocado por fora), dock, foto/fotogpu (fotos de janelas), genio (efeito gênio),-indice (índice de arquivos do Spotlight), instalados (lista de apps), janelas (aplica a SequoiaWindow.dll),+indice (índice de arquivos do Spotlight), instalados (lista de apps), jogo (Modo Jogo: jogo na frente desliga vidro real, ganchos de posição e de mouse, Cantos Ativos e o índice; `modo_jogo`, `jogos.txt`), janelas (aplica a SequoiaWindow.dll),launchpad (Launchpad/Apps do Tahoe), limites (barra e Dock são limites das janelas), liquid (desenho do Tahoe),menubar, menus (menus Win32 dos apps no visual do Mac, sem injetar), mesa (papel de parede e ícones, semExplorer), mesas (áreas virtuais), missioncontrol (Mission Control e Exposé), notarapida, notificacoes,diff --git a/docs/fotos-ilha/notch-abas-leopard.png b/docs/fotos-ilha/notch-abas-leopard.pngnew file mode 100644index 0000000..0287d08Binary files /dev/null and b/docs/fotos-ilha/notch-abas-leopard.png differdiff --git a/docs/fotos-ilha/notch-leopard-aberto.png b/docs/fotos-ilha/notch-leopard-aberto.pngnew file mode 100644index 0000000..080e941Binary files /dev/null and b/docs/fotos-ilha/notch-leopard-aberto.png differdiff --git a/docs/fotos-ilha/notch-leopard-fechado.png b/docs/fotos-ilha/notch-leopard-fechado.pngnew file mode 100644index 0000000..71492e9Binary files /dev/null and b/docs/fotos-ilha/notch-leopard-fechado.png differdiff --git a/docs/fotos-ilha/pilula-aberta.png b/docs/fotos-ilha/pilula-aberta.pngnew file mode 100644index 0000000..fbb5c18Binary files /dev/null and b/docs/fotos-ilha/pilula-aberta.png differdiff --git a/docs/fotos-ilha/pilula-leopard-musica.png b/docs/fotos-ilha/pilula-leopard-musica.pngnew file mode 100644index 0000000..5e5462bBinary files /dev/null and b/docs/fotos-ilha/pilula-leopard-musica.png differdiff --git a/docs/registro-mudancas.txt b/docs/registro-mudancas.txtindex 8883526..3a97f40 100644--- a/docs/registro-mudancas.txt+++ b/docs/registro-mudancas.txt@@ -575,3 +575,17 @@ Compilado (tudo), instalado, Shell e reserva do Finder reiniciados às 23:07 sem[2026-11-19 PC] TEMA MAC OS X LEOPARD (leopard=1, só com liquid_glass=0). CURSOR: ao entrar no Leopard o Shell (ponteiro.cpp, ponteiro::TemaLeopard) grava em HKCU\Control Panel\Cursors o esquema "Mac OS X Leopard" (15 papéis apontando para <instalação>\cursor\Leopard, do pacote Mac OS X Cursors de RaZcaLinSIDe; tools\cursor-leopard.py) e chama SPI_SETCURSORS. VALOR ANTIGO: guardado em %APPDATA%\Shell\cursor-antes.txt (antes era o cursor macOS Tahoe em ...\Programs\SequoiaShell\cursor\MacOS Tahoe Cursor (With Shadow)\). DESFAZER: escolher outro tema em Ajustes > Aparência (o Shell devolve o esquema guardado, só se o cursor ainda for o do Leopard, e apaga o arquivo); ou à mão, com os valores do cursor-antes.txt. Nada vai para C:\Windows\Cursors (o .inf do pacote copiaria para lá; não usado). Ícones: icones\leopard (tools\icones-leopard.py). Nada mais no registro.[2026-11-19 PC] HOSPEDEIRO DE 32 BITS SEM EXE PRÓPRIO. O WacOSWindow32Host.exe dava 18/71 no VirusTotal (heurística Gen:Trojan.Heur3.LPT etc.: exe pequeno que copia DLL e põe gancho em outros programas). Agora a WacOSWindow32.dll roda no rundll32.exe de 32 bits do Windows (SysWOW64), entrada WacOSHost (macjanela.cpp); o Shell (janelas.cpp, OwnCopy) faz a cópia em bin\obj\mj e abre "rundll32 <cópia>,WacOSHost". VirusTotal: WacOSWindow32.dll 1/71 (só SecureAge), WacOSWindow.dll 0/71. host32.cpp apagado; fora do build, do pacote e dos recursos; instalar.ps1 apaga o exe antigo de quem atualiza. VERSIONINFO de todos os programas: CompanyName "WacOS (open source)", ProductName "WacOS", Comments com o link do GitHub. Nada no registro.++[2026-11-20 PC] (1) Central de Notificações: o Calendário e o Relógio podem sair ("Editar Widgets…" da Central e botão direito no widget > Remover Widget); ajustes central_calendario / central_relogio (0 = fora). "Widgets da Mesa…" leva ao menu antigo. (2) Launchpad e painel Apps: "Ocultar do Launchpad" no botão direito de um app; no Launchpad do Sequoia o botão direito no fundo traz de volta os ocultos; "Ocultar Apps do Sistema" (launchpad_sem_sistema=1) esconde as ferramentas do Windows (atalhos para System32/SysWOW64/Windows, Microsoft.Windows.* que não são pacotes da Store, Ferramentas do Windows por nome); os ocultos agora valem em todos os temas. (3) Quick Look: fotos decodificadas inteiras pelo WIC até o tamanho da tela, giradas pelo EXIF (ui::LoadPhoto), em vez da miniatura do Windows (~1024 px, borrada em 3440). Nada no registro.++[2026-11-20 01:00 PC] APPS E BARRAS SEM O SHELL (Reddit, BeOutsider: "duplicated title bar buttons or missing all together" e o quadro quadrado com o mod de cantos do Windhawk). (1) Os apps sem botões próprios (os do app2d.h: Lembretes, Calendário, TextEdit, Relógio, Clima, Contatos, Fotos, Time Machine, Música, QuickTime, Forçar Encerrar; e a Pré-Visualização) dependiam da WacOSWindow.dll que só o Shell injetava: sem o Shell ficavam com a barra do Windows ou, no Golden Gate, sem botão nenhum. Agora o próprio app carrega a DLL da pasta dele (src\comum\barra_mac.h -> entrada nova WacOSPropria, gancho só na thread dele, sem módulo); o "desfazer" do Shell não tira essa barra; o Shell não põe mais gancho em exe com "wacos" no nome (janelas.cpp). Sem a DLL, fica a barra do Windows (nunca a unificada sem botões). (2) WacOSTitleBars.exe (src\titulos + janelas.cpp): só as barras de título do Mac nos outros programas, sem o Shell; --sair desliga; o Shell ao abrir fecha ele e assume. Log em bin\barras-titulo.log. (3) Sombra dos apps (finder\shadow.cpp: Finder, Ajustes, Monitor, Notas) no Sequoia/Leopard: o buraco embaixo da janela era retangular e sobrava um canto claro fora da curva do DWM (com raio maior, um quadro quadrado); agora com cantos de 24 pt. (4) instalar.ps1 pergunta: completo / só apps (escolhidos, atalhos em Menu Iniciar\Programas\WacOS) / só barras (tarefa agendada opcional "WacOS Title Bars") / apps + barras; modo em <instalação>\modo.txt (a atualização mantém). Fora do completo: sem barra de tarefas trocada, sem finder_padrao, sem tarefa "WacOS" (apagada se existia), sem cursor/sons. DESFAZER: desinstalar.cmd (fecha o WacOSTitleBars com --sair, apaga a tarefa "WacOS Title Bars" e a pasta WacOS do Menu Iniciar). Testado aqui: Lembretes com o Shell; Lembretes, Calendário, Pré-Visualização, Música e TextEdit com o Shell fechado (~1 min, reaberto pelo WMI); WacOSTitleBars no msinfo32 e o --sair. Não testado: o instalador de verdade (só a sintaxe) e o mod do Windhawk (não instalado aqui). Nada no registro deste PC.++[2026-11-20 01:10 PC] ILHA DINÂMICA (src\shell\ilha.cpp, inspirada no Atoll, github.com/Ebullioscopic/Atoll, GPL-3.0: só medidas e comportamento, nenhum código copiado). Ajustes > Central de Controle > Ilha Dinâmica: ilha=1 liga (padrão 0); ilha_estilo = notch (entalhe grudado no topo, padrão) | ilha (pílula sempre na barra de menus) | notificacao (só quando acontece algo); ilha_passar (abrir ao passar o ponteiro), ilha_notificacoes (a notificação aparece na ilha no lugar do banner do canto), ilha_volume (o volume aparece na ilha no lugar do aviso). Fechada: música (capa + barrinhas na cor da capa), timer, volume, Caps Lock, bateria ao ligar/desligar da tomada, ponto verde/laranja com câmera/microfone em uso (lido de HKCU\...\CapabilityAccessManager\ConsentStore, só leitura). Espiadas: notificações, download concluído (vigia a pasta Downloads, só leitura), timer concluído. Aberta, abas: Início (player), Timer, Transferência (histórico do que foi copiado, só na memória; respeita o aviso dos gerenciadores de senha), Estante (arquivos arrastados para a ilha, lista em %APPDATA%\Shell\estante.txt; os arquivos não saem do lugar) e Sistema (CPU, memória, rede). Acabamento por tema (Sequoia, Tahoe, Golden Gate, Leopard). Ganchos: notificacoes.cpp (BannerShowNote), som.cpp (som::Key), main.cpp (criação, ajustes, tela cheia, Caps Lock no gancho de teclado). Às 01:00:52 o Shell caiu (sessão de mídia fechando devolvia nulo); fora ~45 s, reaberto pelo WMI com ilha=0; corrigido e testado com três sessões fechando. Ajustes deste PC mexidos no teste: ilha=1 e ilha_estilo=notch (antes não existiam; DESFAZER: ilha=0 nos Ajustes ou apagar as linhas ilha*). Nada no registro.++[2026-11-20 01:20 PC] FALSO POSITIVO "Trojan:Script/Wacatac.H!ml" (Reddit, YuzukiMiyazono). É a análise por IA na nuvem do Defender sobre os scripts (o scan local deste PC, assinaturas 1.463.373, não acusa nada em instalador\ nem tools\). Tirados os padrões de "script malicioso" do que vai no pacote: (1) nenhum Add-Type com C# embutido (DllImport): fechar o Shell, devolver as janelas, aplicar o cursor e avisar o Explorador dos ícones agora são do próprio WacOSShell.exe, modo ajudante (src\shell\ajudante.cpp: --sair, --aplicar-cursor, --avisar-icones, --avisar-pasta, --desfazer-janelas), usado por instalar/desinstalar.ps1, icones-sistema*.ps1, musica/quicktime-registrar.ps1; os scripts só chamam um exe que tenha o ajudante (os antigos abririam o Shell). (2) Auto-elevação sem janela escondida (icones-sistema-extra.ps1: sem -WindowStyle Hidden). (3) atualizar-github.ps1: confere o SHA-256 do .zip com o "digest" que o GitHub publica e roda o instalar.ps1 no mesmo PowerShell (antes abria outro powershell -ExecutionPolicy Bypass no arquivo baixado). README: frase sobre os scripts. Não dá para confirmar aqui que a IA do Defender parou de acusar: só no próximo pacote publicado (e enviando ao portal da Microsoft como falso positivo). Nada no registro deste PC.++[2026-11-20 01:20 PC] Ilha Dinâmica, notch no tema Leopard (ilha.cpp): vira o painel HUD do 10.5 pendurado reto na barra de menus (sem as orelhas do entalhe moderno, que encostavam na barra clara e ficavam estranhas), grafite em degradê com o verniz na faixa da barra, filete claro por dentro e contorno escuro por fora só nas laterais e na base, sombra embaixo, faixa de título com filete quando aberto, aba escolhida em gel azul, reflexo da capa (Cover Flow), fonte Lucida Sans Unicode (a da barra do tema) e mola sem quicar. Nada no registro.++[2026-11-20 01:25 PC] Ilha Dinâmica some em toda tela cheia do monitor principal (ilha.cpp FullOnPrimary): jogo em Direct3D exclusivo ou apresentação (SHQueryUserNotificationState), ou a janela mais de cima daquele monitor cobrindo a tela (app, vídeo do navegador ou do player), mesmo sem ser a da frente; ignora as nossas janelas, as transparentes ao clique (sobreposições) e avisos pequenos por cima; maximizada com barra de título não conta. Some na hora, sem animar (janela "sempre no topo" por cima de jogo pode tirá-lo da tela cheia); confere também antes de aparecer. main.cpp CheckFullscreen passa só "tela travada". Testado com uma janela de teste em tela cheia: sumiu e voltou. Nada no registro.++[2026-11-20 02:10 PC] MODO JOGO E DESEMPENHO. Medido com o Fortnite aberto (antes): Shell a ~50% de um núcleo, 4,5% da GPU, 514 MB. Causas achadas: vidro real remontando o fundo a cada quadro do jogo (335 montagens/10 s); a mesa recriada (papel de parede 5K decodificado) a cada troca de modo de tela do jogo, ~1 por segundo; ganchos de EVENT_OBJECT_LOCATIONCHANGE (main, notificações, sombras, vidro) recebendo cada movimento do cursor; Raw Input do "sacudir ponteiro"; gancho global de mouse do "clique mostra a mesa"; Cantos Ativos lendo o ponteiro 20x/s; índice do Spotlight reindexando o que o jogo escreve e varrendo o disco inteiro 30 s depois de cada abertura do Shell. NOVO src\shell\jogo.cpp: jogo na frente (classe do motor: UnrealWindow, UnityWndClass, SDL...; pasta de loja: steamapps\common, Epic, Riot, XboxGames...; Direct3D em tela cheia; ou %APPDATA%\Shell\jogos.txt) liga o modo até o jogo não ter mais janela (~4 s): vidro real fora, ganchos de posição soltos (jogo::GanchoPosicao), sem Raw Input, sem gancho de mouse, sem Cantos Ativos, índice só junta as pastas, Shell em BELOW_NORMAL + EcoQoS (núcleos E). mesa.cpp: aviso de tela espera 1,2 s e só refaz se os monitores mudaram (fora do jogo). Ajuste modo_jogo (1 padrão), Ajustes > Energia > Modo Jogo. Depois (Fortnite na frente, Shell assentado, 75 s): 2,0% de um núcleo, 0% de GPU. Parado sem jogo, antes: 1,3%. Não testado: a saída do modo (fechar o jogo; o log diz "modo jogo: desligado"). Também: leopard_previa=1 gravado no ajustes.txt real (o menu de tema do Ajustes volta a mostrar o Mac OS X Leopard; desfazer: leopard_previa=0). Nada no registro do Windows.diff --git a/docs/screenshots/leopard-about.png b/docs/screenshots/leopard-about.pngnew file mode 100644index 0000000..15e5d9cBinary files /dev/null and b/docs/screenshots/leopard-about.png differdiff --git a/docs/screenshots/leopard-dock.png b/docs/screenshots/leopard-dock.pngnew file mode 100644index 0000000..1033b4eBinary files /dev/null and b/docs/screenshots/leopard-dock.png differdiff --git a/docs/screenshots/leopard-finder.png b/docs/screenshots/leopard-finder.pngnew file mode 100644index 0000000..b83d7f1Binary files /dev/null and b/docs/screenshots/leopard-finder.png differdiff --git a/docs/screenshots/leopard-quick-look.png b/docs/screenshots/leopard-quick-look.pngnew file mode 100644index 0000000..7c45514Binary files /dev/null and b/docs/screenshots/leopard-quick-look.png differdiff --git a/docs/screenshots/leopard-system-preferences.png b/docs/screenshots/leopard-system-preferences.pngnew file mode 100644index 0000000..1f64dcaBinary files /dev/null and b/docs/screenshots/leopard-system-preferences.png differdiff --git a/instalador/desinstalar.ps1 b/instalador/desinstalar.ps1index e771676..b9c3033 100644--- a/instalador/desinstalar.ps1+++ b/instalador/desinstalar.ps1@@ -9,39 +9,45 @@ function Pergunta($texto) { (Read-Host "$texto (s/n)").Trim().ToLower().StartsWiWrite-Host "WacOS - desinstalar`n"if (-not (Pergunta "Remover o WacOS de $dest?")) { exit }-Add-Type -Namespace SeqDes -Name U -MemberDefinition '[DllImport("user32.dll",CharSet=CharSet.Unicode)] public static extern System.IntPtr FindWindow(string c,string t); [DllImport("user32.dll")] public static extern bool PostMessage(System.IntPtr h,uint m,System.IntPtr w,System.IntPtr l);'+# as chamadas do Windows (fechar o Shell, devolver as janelas, cursor) são feitas pelo próprio WacOSShell.exe (modo+# ajudante, src\shell\ajudante.cpp), sem C# embutido no script (o antivírus estranhava)+# um WacOSShell.exe que já tem o modo ajudante (os antigos abririam o Shell em vez de ajudar)+function Ajudante([string[]]$lista) {+ foreach ($e in $lista) {+ if (-not (Test-Path $e)) { continue }+ $b = [IO.File]::ReadAllBytes($e)+ foreach ($o in 0, 1) { if ([Text.Encoding]::Unicode.GetString($b, $o, $b.Length - $o).Contains('--desfazer-janelas')) { return (Resolve-Path $e).Path } }+ }+ return $null+}+$ajudante = Ajudante @((Join-Path $dest 'bin\WacOSShell.exe'), (Join-Path $PSScriptRoot 'bin\WacOSShell.exe'), (Join-Path $PSScriptRoot '..\bin\WacOSShell.exe'))+if ($ajudante -and -not $ajudante.StartsWith($dest)) { # o do pacote: copiado para fora, a pasta da instalação sai no fim+ $c = Join-Path $env:TEMP 'WacOSShell-ajudante.exe'; Copy-Item $ajudante $c -Force; $ajudante = $c+}if (Get-Process WacOSShell -ErrorAction SilentlyContinue) {- $h = [SeqDes.U]::FindWindow('ShellMensagens', $null)- if ($h -ne [IntPtr]::Zero) { [SeqDes.U]::PostMessage($h, 0x0312, [IntPtr]1, [IntPtr]::Zero) | Out-Null }+ if ($ajudante) { Start-Process $ajudante -ArgumentList '--sair' -Wait }for ($i = 0; $i -lt 40 -and (Get-Process WacOSShell -ErrorAction SilentlyContinue); $i++) { Start-Sleep -Milliseconds 500 }}if (Get-Process WacOSShell -ErrorAction SilentlyContinue) { Write-Host 'O Shell não fechou: feche com Ctrl+Alt+Shift+F12 e rode de novo.'; Read-Host 'Enter para sair'; exit }+# Só as barras de título (WacOSTitleBars, instalação sem o Shell): sai devolvendo as janelas ao Windows+if (Get-Process WacOSTitleBars -ErrorAction SilentlyContinue) {+ $tb = Join-Path $dest 'bin\WacOSTitleBars.exe'+ if (Test-Path $tb) { Start-Process $tb -ArgumentList '--sair' -Wait }+ for ($i = 0; $i -lt 20 -and (Get-Process WacOSTitleBars -ErrorAction SilentlyContinue); $i++) { Start-Sleep -Milliseconds 250 }+ Get-Process WacOSTitleBars -ErrorAction SilentlyContinue | Stop-Process -Force+}+# Janelas dos apps com a barra do Mac: o Shell manda cada uma voltar ao normal ao sair, mas com pouco tempo# (300 ms) e uma vez só; app ocupado ou janela escondida ficava com a barra do Mac. Aqui manda de novo, com# mais tempo, a todas que ainda estão marcadas, e confere.-Add-Type -Namespace SeqDes -Name J -MemberDefinition @'-public delegate bool EP(System.IntPtr h, System.IntPtr l);-[DllImport("user32.dll")] public static extern bool EnumWindows(EP f, System.IntPtr l);-[DllImport("user32.dll", CharSet=CharSet.Unicode)] public static extern System.IntPtr GetPropW(System.IntPtr h, string s);-[DllImport("user32.dll", CharSet=CharSet.Unicode)] public static extern uint RegisterWindowMessageW(string s);-[DllImport("user32.dll")] public static extern System.IntPtr SendMessageTimeoutW(System.IntPtr h, uint m, System.IntPtr w, System.IntPtr l, uint f, uint t, out System.IntPtr r);-public static int Undo(bool send) {- uint msg = RegisterWindowMessageW("MacJanelaDesfazer"); int n = 0;- EnumWindows((h, l) => {- if (GetPropW(h, "MacJanela") != System.IntPtr.Zero || GetPropW(h, "MacJanelaLeve") != System.IntPtr.Zero) {- n++; System.IntPtr r; if (send) SendMessageTimeoutW(h, msg, System.IntPtr.Zero, System.IntPtr.Zero, 2 /*SMTO_ABORTIFHUNG*/, 3000, out r);- }- return true; }, System.IntPtr.Zero);- return n;+if ($ajudante) {+ $sobrou = (Start-Process $ajudante -ArgumentList '--desfazer-janelas' -Wait -PassThru).ExitCode+ if ($sobrou -gt 0) { Write-Host "$sobrou janela(s) não responderam (app travado): voltam ao normal quando o app for fechado e aberto de novo." }}-'@-$marcadas = [SeqDes.J]::Undo($true)-Start-Sleep -Milliseconds 500-$sobrou = [SeqDes.J]::Undo($false)-if ($marcadas) { Write-Host ("Janelas devolvidas ao visual do Windows: {0}" -f ($marcadas - $sobrou)) }-if ($sobrou) { Write-Host "$sobrou janela(s) não responderam (app travado): voltam ao normal quando o app for fechado e aberto de novo." }-Get-Process WacOSFinder, WacOSSettings, WacOSActivityMonitor, WacOSTerminal, WacOSCalculator, WacOSNotes, WacOSScreenshot, WacOSWindow32Host -ErrorAction SilentlyContinue | Stop-Process -Force+Get-Process WacOSFinder, WacOSSettings, WacOSActivityMonitor, WacOSTerminal, WacOSCalculator, WacOSNotes, WacOSScreenshot, WacOSWindow32Host,+ WacOSPreview, WacOSReminders, WacOSCalendar, WacOSTextEdit, WacOSClock, WacOSWeather, WacOSContacts, WacOSPhotos,+ WacOSTimeMachine, WacOSMusic, WacOSQuickTime, WacOSForceQuit -ErrorAction SilentlyContinue | Stop-Process -Forceif (-not (Get-Process explorer -ErrorAction SilentlyContinue)) { Start-Process explorer.exe }# barra do Windows nos outros monitores (o Shell desliga enquanto roda e devolve ao sair; se não devolveu, devolve aqui)@@ -56,10 +62,12 @@ if ($antes -match '=(.+)$') {Unregister-ScheduledTask -TaskName 'WacOS' -Confirm:$false -ErrorAction SilentlyContinueUnregister-ScheduledTask -TaskName 'SequoiaShell' -Confirm:$false -ErrorAction SilentlyContinue # nome antigo+Unregister-ScheduledTask -TaskName 'WacOS Title Bars' -Confirm:$false -ErrorAction SilentlyContinue # só as barras de título# pastas voltam a abrir no Explorador (desfaz o --padrao on)$finder = Join-Path $dest 'bin\WacOSFinder.exe'if (Test-Path $finder) { Start-Process $finder -ArgumentList '--quieto', '--padrao', 'off' -Wait }Remove-Item (Join-Path ([Environment]::GetFolderPath('Programs')) 'WacOS.lnk') -ErrorAction SilentlyContinue+Remove-Item (Join-Path ([Environment]::GetFolderPath('Programs')) 'WacOS') -Recurse -Force -ErrorAction SilentlyContinue # atalhos dos apps avulsos# extras: janela de Abrir/Salvar e ícones do sistema voltam aos do Windows. Decide pelo que está aplicado de# verdade (chaves e backups), não só pelo log: instalação antiga, atualizada ou com o log perdido também volta.@@ -85,6 +93,17 @@ if ((Test-Path "$docs\backup-icones-sistema.json") -or (Test-Path "$docs\backup-} else { Write-Host "Os ícones do Mac estão aplicados, mas falta $dest\tools\icones-sistema.ps1 para desfazer. Nada foi apagado."; Read-Host 'Enter para sair'; exit }}+# tema Leopard ligado: o cursor dele (em $dest\cursor\Leopard, que vai ser apagado) dá lugar ao que o Shell guardou+# ao entrar no tema (%APPDATA%\Shell\cursor-antes.txt, papel=caminho)+$curAntes = Join-Path $env:APPDATA 'Shell\cursor-antes.txt'+$curReg = 'HKCU:\Control Panel\Cursors'+if ((Test-Path $curAntes) -and ((Get-ItemProperty $curReg -ErrorAction SilentlyContinue).Arrow -like "$dest\cursor\Leopard\*")) {+ foreach ($l in Get-Content $curAntes -Encoding utf8) { if ($l -match '^([^=]+)=(.*)$') { Set-ItemProperty $curReg -Name $Matches[1] -Value $Matches[2] } }+ Remove-Item $curAntes -ErrorAction SilentlyContinue+ if ($ajudante) { Start-Process $ajudante -ArgumentList '--aplicar-cursor' -Wait }+ Write-Host 'Cursor de antes do tema Leopard devolvido.'+}+# cursor: volta o que estava antesif (Test-Path $log) {$creg = 'HKCU:\Control Panel\Cursors'@@ -93,8 +112,7 @@ if (Test-Path $log) {if ($l -match 'cursor-antes: ([^=]+)=(.*)$') { Set-ItemProperty $creg -Name $Matches[1] -Value $Matches[2]; $voltou = $true }}if ($voltou) {- Add-Type -Namespace SeqCurD -Name U -MemberDefinition '[DllImport("user32.dll")] public static extern bool SystemParametersInfo(uint a, uint b, System.IntPtr c, uint d);'- [SeqCurD.U]::SystemParametersInfo(0x57, 0, [IntPtr]::Zero, 3) | Out-Null+ if ($ajudante) { Start-Process $ajudante -ArgumentList '--aplicar-cursor' -Wait }}}diff --git a/instalador/instalar.ps1 b/instalador/instalar.ps1index a3dfd1d..d3cae39 100644--- a/instalador/instalar.ps1+++ b/instalador/instalar.ps1@@ -7,6 +7,10 @@# -Atualizar (atualizar.cmd): só troca os programas, ícones e sons de uma instalação que já existe; não mexe em# ajustes, fontes, cursor, atalho nem início automático, e não faz perguntas além de fechar o que está aberto.# -Silencioso (o botão Atualizar Agora do Ajustes, tools\atualizar-github.ps1): sem perguntas; fecha o que estiver aberto+# O que instalar (perguntado no começo; fica em modo.txt e a atualização mantém): o WacOS completo, só os apps+# escolhidos (atalhos no Menu Iniciar, pasta "WacOS"), só as barras de título do Mac nos outros programas+# (WacOSTitleBars.exe) ou apps + barras. Fora do completo: a barra de tarefas do Windows, o Explorador e as pastas+# ficam como estão e não há tarefa de login do Shell.param([switch]$Atualizar, [switch]$Silencioso)$ErrorActionPreference = 'Stop'$src = $PSScriptRoot@@ -43,18 +47,37 @@ if ($build -lt 22621) {if (-not (Pergunta 'Continuar mesmo assim?')) { exit }}-# Shell aberto (atualização): fecha do jeito certo, devolvendo a barra do Windows-Add-Type -Namespace SeqInst -Name U -MemberDefinition '[DllImport("user32.dll",CharSet=CharSet.Unicode)] public static extern System.IntPtr FindWindow(string c,string t); [DllImport("user32.dll")] public static extern bool PostMessage(System.IntPtr h,uint m,System.IntPtr w,System.IntPtr l);'+# Shell aberto (atualização): fecha do jeito certo, devolvendo a barra do Windows. Quem fecha é o WacOSShell.exe do+# pacote (--sair, src\shell\ajudante.cpp), sem C# embutido no script (o antivírus estranhava)+# um WacOSShell.exe que já tem o modo ajudante (os antigos abririam o Shell em vez de ajudar)+function Ajudante([string[]]$lista) {+ foreach ($e in $lista) {+ if (-not (Test-Path $e)) { continue }+ $b = [IO.File]::ReadAllBytes($e)+ foreach ($o in 0, 1) { if ([Text.Encoding]::Unicode.GetString($b, $o, $b.Length - $o).Contains('--desfazer-janelas')) { return (Resolve-Path $e).Path } }+ }+ return $null+}+$ajudante = Ajudante @((Join-Path $src '..\bin\WacOSShell.exe'), (Join-Path $src 'bin\WacOSShell.exe'), (Join-Path $dest 'bin\WacOSShell.exe'))if (Get-Process WacOSShell, SequoiaShell -ErrorAction SilentlyContinue) {if (-not $Atualizar -and -not (Pergunta 'O WacOS está aberto. Fechar para instalar a versão nova?')) { exit }if ($Atualizar) { Write-Host 'Fechando o WacOS para atualizar (ele abre de novo no fim)...' }- $h = [SeqInst.U]::FindWindow('ShellMensagens', $null)- if ($h -ne [IntPtr]::Zero) { [SeqInst.U]::PostMessage($h, 0x0312, [IntPtr]1, [IntPtr]::Zero) | Out-Null } # o mesmo do atalho "sair do Shell"+ if ($ajudante) { Start-Process $ajudante -ArgumentList '--sair' -Wait } # o mesmo do atalho "sair do Shell"+ else { Write-Host 'Feche o WacOS com Ctrl+Alt+Shift+F12. / Quit WacOS with Ctrl+Alt+Shift+F12.' }for ($i = 0; $i -lt 40 -and (Get-Process WacOSShell, SequoiaShell -ErrorAction SilentlyContinue); $i++) { Start-Sleep -Milliseconds 500 }if (Get-Process WacOSShell, SequoiaShell -ErrorAction SilentlyContinue) { Write-Host 'O Shell não fechou. Feche-o (Ctrl+Alt+Shift+F12) e rode o instalador de novo.'; Sair }}# os nossos apps abertos também seguram os arquivos+# só as barras (WacOSTitleBars): ao sair devolve as janelas ao Windows; o --sair pede isso+$barrasAbertas = [bool](Get-Process WacOSTitleBars -ErrorAction SilentlyContinue)+if ($barrasAbertas) {+ $tb = Join-Path $dest 'bin\WacOSTitleBars.exe'+ if (Test-Path $tb) { Start-Process $tb -ArgumentList '--sair' -Wait }+ for ($i = 0; $i -lt 20 -and (Get-Process WacOSTitleBars -ErrorAction SilentlyContinue); $i++) { Start-Sleep -Milliseconds 250 }+}$apps = 'WacOSFinder','WacOSSettings','WacOSActivityMonitor','WacOSTerminal','WacOSCalculator','WacOSNotes','WacOSScreenshot','WacOSWindow32Host',+ 'WacOSPreview','WacOSReminders','WacOSCalendar','WacOSTextEdit','WacOSClock','WacOSWeather','WacOSContacts','WacOSPhotos',+ 'WacOSTimeMachine','WacOSMusic','WacOSQuickTime','WacOSForceQuit','WacOSTitleBars','SequoiaFinder','SequoiaSettings','SequoiaActivityMonitor','SequoiaTerminal','SequoiaCalculator','SequoiaNotes','SequoiaScreenshot','SequoiaWindow32Host'$abertos = Get-Process $apps -ErrorAction SilentlyContinueif ($abertos) {@@ -67,6 +90,11 @@ if ($abertos) {# 1. Programas, ícones e sonsNew-Item -ItemType Directory -Force $dest | Out-NullAnota "instalando de $src"+# cursor-leopard: o cursor do tema Mac OS X Leopard, em <instalação>\cursor\Leopard (o Shell aplica ao entrar no tema)+if (Test-Path "$src\cursor-leopard\Leopard") {+ robocopy "$src\cursor-leopard\Leopard" "$dest\cursor\Leopard" /E /NFL /NDL /NJH /NJS /NP | Out-Null+ Anota 'copiado: cursor\Leopard'+}foreach ($pasta in 'bin', 'icones', 'sons', 'tools') {if (Test-Path "$src\$pasta") {robocopy "$src\$pasta" "$dest\$pasta" /E /NFL /NDL /NJH /NJS /NP /XF *.log | Out-Null@@ -106,8 +134,46 @@ if ($temVelho) {Write-Host 'A instalação antiga (Sequoia Shell) foi trocada pelo WacOS.'}+# 1d. O que instalar. Atualização e -Silencioso: o que já estava (modo.txt; sem ele, o completo)+$modoArq = Join-Path $dest 'modo.txt'+$modo = if (Test-Path $modoArq) { (Get-Content $modoArq -Encoding utf8 | Select-Object -First 1).Trim() } else { 'completo' }+# os apps que dá para instalar avulsos: exe|nome no Menu Iniciar+$catalogo = @(+ 'WacOSFinder|Finder', 'WacOSSettings|System Settings', 'WacOSActivityMonitor|Activity Monitor', 'WacOSTerminal|Terminal',+ 'WacOSCalculator|Calculator', 'WacOSNotes|Notes', 'WacOSScreenshot|Screenshot', 'WacOSPreview|Preview', 'WacOSReminders|Reminders',+ 'WacOSCalendar|Calendar', 'WacOSTextEdit|TextEdit', 'WacOSClock|Clock', 'WacOSWeather|Weather', 'WacOSContacts|Contacts',+ 'WacOSPhotos|Photos', 'WacOSTimeMachine|Time Machine', 'WacOSMusic|Music', 'WacOSQuickTime|QuickTime Player',+ 'WacOSForceQuit|Force Quit Applications'+) | ForEach-Object { $p = $_ -split '\|'; [pscustomobject]@{ Exe = $p[0]; Nome = $p[1] } } | Where-Object { Test-Path (Join-Path $dest "bin\$($_.Exe).exe") }+if (-not $Atualizar -and -not $Silencioso) {+ Write-Host ""+ Write-Host "O que instalar? / What to install?"+ Write-Host " 1) WacOS completo (barra de menus, Dock, Finder...) / Full WacOS (menu bar, Dock, Finder...)"+ Write-Host " 2) Só os apps que eu escolher / Only the apps I choose"+ Write-Host " 3) Só as barras de título do Mac nos outros programas / Only the Mac title bars on other apps"+ Write-Host " 4) Apps + barras de título / Apps + title bars"+ $r = (Read-Host "1-4 [1]").Trim()+ $modo = switch ($r) { '2' { 'apps' } '3' { 'barras' } '4' { 'apps+barras' } default { 'completo' } }+}+$completo = $modo -eq 'completo'+$escolhidos = @()+if ($modo -like 'apps*') {+ $ja = @(Get-Content $modoArq -Encoding utf8 -ErrorAction SilentlyContinue | Select-Object -Skip 1) # os escolhidos da vez anterior+ if ($Atualizar -or $Silencioso) { $escolhidos = @($catalogo | Where-Object { $ja -contains $_.Exe }) }+ else {+ Write-Host ""+ for ($i = 0; $i -lt $catalogo.Count; $i++) { Write-Host (" {0,2}) {1}" -f ($i + 1), $catalogo[$i].Nome) }+ $r = Read-Host "Números separados por vírgula, ou Enter para todos / Numbers separated by commas, or Enter for all"+ if ($r.Trim()) { $escolhidos = @($r -split '[,; ]+' | Where-Object { $_ -match '^\d+$' -and [int]$_ -ge 1 -and [int]$_ -le $catalogo.Count } | ForEach-Object { $catalogo[[int]$_ - 1] }) }+ else { $escolhidos = @($catalogo) }+ }+}+Set-Content -Encoding utf8 $modoArq (@($modo) + @($escolhidos | ForEach-Object { $_.Exe }))+Anota ("modo: $modo " + (($escolhidos | ForEach-Object { $_.Exe }) -join ','))+if ($Atualizar) { # só os arquivos; o resto (ajustes, fontes, cursor, atalho, início automático) fica como estavaAnota 'atualização concluída'+ if ($barrasAbertas) { Start-Process (Join-Path $dest 'bin\WacOSTitleBars.exe') -WorkingDirectory (Join-Path $dest 'bin') }$exe = Join-Path $dest 'bin\WacOSShell.exe'if ($shellAberto) { Start-Process $exe -WorkingDirectory (Split-Path $exe); Write-Host "`nAtualizado. O WacOS abriu de novo." }elseif ($Silencioso) { Write-Host "`nAtualizado." }@@ -127,12 +193,12 @@ if ((Test-Path $baixar) -and -not $temFontes -and(Pergunta 'Baixar as fontes SF Pro e SF Mono do site da Apple (developer.apple.com/fonts; licença da Apple)?')) {& powershell -NoProfile -ExecutionPolicy Bypass -File $baixar -Fontes "$apple\fontes"}-if ((Test-Path $baixar) -and -not $temSons -and+if ($completo -and (Test-Path $baixar) -and -not $temSons -and(Pergunta 'Baixar os sons de alerta do macOS (github.com/extratone/macOSsystemsounds)?')) {& powershell -NoProfile -ExecutionPolicy Bypass -File $baixar -Sons "$dest\sons\mac"Anota "sons do macOS baixados em $dest\sons\mac"}-if ((Test-Path $baixar) -and -not $temCursor -and+if ($completo -and (Test-Path $baixar) -and -not $temCursor -and(Pergunta 'Usar o cursor do macOS Tahoe (baixado do DeviantArt, autor jimmyxd2)?')) {& powershell -NoProfile -ExecutionPolicy Bypass -File $baixar -Cursor "$apple\cursor"}@@ -163,7 +229,7 @@ if ($fontes) {$curRaiz = "$src\cursor"if (-not (Get-ChildItem $curRaiz -Directory -ErrorAction SilentlyContinue)) { $curRaiz = "$apple\cursor" } # o baixado agora$cur = Get-ChildItem $curRaiz -Directory -ErrorAction SilentlyContinue | Select-Object -First 1-if ($cur -and ($curRaiz -like "$apple*" -or (Pergunta "Usar o cursor do Mac ($($cur.Name))?"))) {+if ($completo -and $cur -and ($curRaiz -like "$apple*" -or (Pergunta "Usar o cursor do Mac ($($cur.Name))?"))) {$cdir = Join-Path $dest "cursor\$($cur.Name)"robocopy $cur.FullName $cdir /E /NFL /NDL /NJH /NJS /NP | Out-NullGet-ChildItem $cdir -File | Unblock-File@@ -181,13 +247,65 @@ if ($cur -and ($curRaiz -like "$apple*" -or (Pergunta "Usar o cursor do Mac ($($Set-ItemProperty $creg -Name '(default)' -Value $cur.NameSet-ItemProperty $creg -Name 'Scheme Source' -Value 1 -Type DWordAnota "registro: $creg (cursor do Mac)"- Add-Type -Namespace SeqCur -Name U -MemberDefinition '[DllImport("user32.dll")] public static extern bool SystemParametersInfo(uint a, uint b, System.IntPtr c, uint d);'- [SeqCur.U]::SystemParametersInfo(0x57, 0, [IntPtr]::Zero, 3) | Out-Null # SPI_SETCURSORS: aplica agora+ if ($ajudante = Ajudante @((Join-Path $dest 'bin\WacOSShell.exe'))) { Start-Process $ajudante -ArgumentList '--aplicar-cursor' -Wait } # SPI_SETCURSORS: aplica agoraWrite-Host 'Cursor do Mac aplicado.'}Remove-Item $apple -Recurse -Force -ErrorAction SilentlyContinue # o baixado já foi copiado+# 2c. Só os apps e/ou só as barras de título: atalhos no Menu Iniciar (pasta "WacOS") e, para as barras, o início+# automático próprio (tarefa "WacOS Title Bars"). Nada do Shell: sem trocar a barra de tarefas, o Explorador+# ou as pastas, e sem a tarefa "WacOS". Os apps leem o tema em %APPDATA%\Shell\ajustes.txt (Ajustes do Sistema).+if (-not $completo) {+ $menu = Join-Path ([Environment]::GetFolderPath('Programs')) 'WacOS'+ New-Item -ItemType Directory -Force $menu | Out-Null+ Get-ChildItem $menu -Filter *.lnk -ErrorAction SilentlyContinue | Remove-Item -Force # refeitos pela escolha de agora+ Anota "menu iniciar: $menu"+ $ws = New-Object -ComObject WScript.Shell+ function Atalho($nome, $exe) {+ $l = $ws.CreateShortcut((Join-Path $menu "$nome.lnk"))+ $l.TargetPath = $exe; $l.WorkingDirectory = Split-Path $exe; $l.IconLocation = "$exe,0"; $l.Save()+ }+ # quem vinha do WacOS completo: o Shell não abre mais sozinho+ if (Get-ScheduledTask -TaskName 'WacOS' -ErrorAction SilentlyContinue) {+ Unregister-ScheduledTask -TaskName 'WacOS' -Confirm:$false+ Anota 'tarefa agendada WacOS removida (modo sem o Shell)'+ }+ Remove-Item (Join-Path ([Environment]::GetFolderPath('Programs')) 'WacOS.lnk') -ErrorAction SilentlyContinue+ foreach ($a in $escolhidos) { Atalho $a.Nome (Join-Path $dest "bin\$($a.Exe).exe") }+ if ($escolhidos) { Write-Host ("Apps no Menu Iniciar (pasta WacOS) / Apps in the Start menu (WacOS folder): " + (($escolhidos | ForEach-Object { $_.Nome }) -join ', ')) }+ if ($modo -like '*barras') {+ $tb = Join-Path $dest 'bin\WacOSTitleBars.exe'+ Atalho 'WacOS Title Bars' $tb+ if (Pergunta 'Ligar as barras de título sozinhas toda vez que você entrar no Windows? / Start the title bars at every sign-in?') {+ $user = "$env:USERDOMAIN\$env:USERNAME"+ $action = New-ScheduledTaskAction -Execute $tb -WorkingDirectory (Split-Path $tb)+ $trigger = New-ScheduledTaskTrigger -AtLogOn -User $user+ $settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit ([TimeSpan]::Zero) -MultipleInstances IgnoreNew+ $principal = New-ScheduledTaskPrincipal -UserId $user -LogonType Interactive -RunLevel Limited+ Register-ScheduledTask -TaskName 'WacOS Title Bars' -Action $action -Trigger $trigger -Settings $settings -Principal $principal `+ -Description 'Mac title bars on other apps, without the WacOS Shell (desinstalar.cmd removes it)' -Force | Out-Null+ Anota 'tarefa agendada: WacOS Title Bars (ao entrar)'+ }+ Start-Process $tb -WorkingDirectory (Split-Path $tb)+ Write-Host 'Barras de título ligadas. Desligar: WacOSTitleBars.exe --sair (ou desinstalar.cmd).'+ Write-Host 'Title bars are on. Turn off: WacOSTitleBars.exe --sair (or desinstalar.cmd).'+ }+ if (($escolhidos | Where-Object { $_.Exe -eq 'WacOSMusic' }) -and (Test-Path "$dest\tools\musica-registrar.ps1") -and+ (Pergunta 'Registrar o Música para abrir arquivos de áudio? / Register Music for audio files?')) {+ & (Join-Path $dest 'tools\musica-registrar.ps1') -Exe (Join-Path $dest 'bin\WacOSMusic.exe') -AbrirAjustes+ Anota 'Música registrado como app de áudio (desinstalar.cmd remove)'+ }+ if (($escolhidos | Where-Object { $_.Exe -eq 'WacOSQuickTime' }) -and (Test-Path "$dest\tools\quicktime-registrar.ps1") -and+ (Pergunta 'Registrar o QuickTime Player para abrir vídeos? / Register QuickTime Player for videos?')) {+ & (Join-Path $dest 'tools\quicktime-registrar.ps1') -Exe (Join-Path $dest 'bin\WacOSQuickTime.exe') -AbrirAjustes+ Anota 'QuickTime registrado como app de vídeo (desinstalar.cmd remove)'+ }+ Anota 'instalação concluída (sem o Shell)'+ Write-Host "`nPronto / Done. Desinstalar / Uninstall: desinstalar.cmd"+ Sair+}+# 3. Ajustes (se vierem no pacote e este PC ainda não tiver os seus)$cfg = Join-Path $env:APPDATA 'Shell'if (Test-Path "$src\ajustes") {diff --git a/src/ajustes/paginas.cpp b/src/ajustes/paginas.cppindex 323d70c..d9463e3 100644--- a/src/ajustes/paginas.cpp+++ b/src/ajustes/paginas.cpp@@ -324,6 +324,10 @@ Page Energia() {p.groups.push_back(G({ Toggle(L"Soneca de Apps", [] { return Setting(L"app_nap", L"1") != L"0"; },[](bool v) { SetSetting(L"app_nap", v ? L"1" : L"0"); },L"Programas com todas as janelas escondidas, minimizadas ou cobertas por 30 segundos passam a gastar menos processador, como o App Nap do Mac. Voltam ao normal assim que aparecem. Não vale para o que está tocando ou gravando som.") }));+ // Modo Jogo do Mac (shell\jogo.cpp): jogo na frente → o Shell desliga o que mais pesa até o jogo fechar+ p.groups.push_back(G({ Toggle(L"Modo Jogo", [] { return Setting(L"modo_jogo", L"1") != L"0"; },+ [](bool v) { SetSetting(L"modo_jogo", v ? L"1" : L"0"); },+ L"Quando um jogo vem para a frente, o WacOS desliga o vidro real, os efeitos que acompanham o mouse e os Cantos Ativos e passa a usar menos processador, até o jogo fechar. Jogos que não forem reconhecidos podem ser postos em jogos.txt, na pasta de ajustes.") }));p.groups.push_back(Plain(Buttons({ { L"Opções de Energia…", [] { OpenUri(L"ms-settings:powersleep"); } } })));return p;}@@ -652,21 +656,19 @@ Row TemaRow() {// Leopard continua no visual do Sequoia) e, por cima, o Aqua de 2007: barra de menus clara com a maçã grafite, Dock// em prateleira espelhada, botões de gel e barras cinza metálico. Ligar o Liquid Glass em outro lugar desliga o// Leopard sozinho (leopard só vale com liquid_glass=0).- // O Leopard ainda não saiu (fora do build-12): só aparece com leopard_previa=1 no ajustes.txt, ou para quem já- // está nele (para conseguir sair). Sem a opção, o pacote também não leva icones\leopard nem cursor\Leopard.- bool leopardOn = Setting(L"leopard_previa", L"0") == L"1" || Setting(L"leopard", L"0") == L"1";- std::vector<std::wstring> temas = { L"macOS Sequoia", L"macOS Tahoe", L"macOS Golden Gate" };- if (leopardOn) temas.push_back(L"Mac OS X Leopard");+ // Lançado em 20/11/2026 (antes só aparecia com leopard_previa=1): o pacote leva icones\leopard e cursor\Leopard.+ // ordem do usuário: o mais novo primeiro (0 Golden Gate, 1 Tahoe, 2 Sequoia, 3 Leopard)+ std::vector<std::wstring> temas = { L"macOS Golden Gate", L"macOS Tahoe", L"macOS Sequoia", L"Mac OS X Leopard" };return Popup(L"Tema", temas,[] {- if (Setting(L"liquid_glass", L"0") != L"1") return Setting(L"leopard", L"0") == L"1" ? 3 : 0;- return Setting(L"golden_gate", L"0") == L"1" ? 2 : 1;+ if (Setting(L"liquid_glass", L"0") != L"1") return Setting(L"leopard", L"0") == L"1" ? 3 : 2;+ return Setting(L"golden_gate", L"0") == L"1" ? 0 : 1;},[](int i) {- if (i == 2) SetSetting(L"liquid_estilo", L"nitido"); // o vidro do Golden Gate é o controle deslizante+ if (i == 0) SetSetting(L"liquid_estilo", L"nitido"); // o vidro do Golden Gate é o controle deslizanteSetSetting(L"leopard", i == 3 ? L"1" : L"0");- SetSetting(L"golden_gate", i == 2 ? L"1" : L"0");- SetSetting(L"liquid_glass", i == 1 || i == 2 ? L"1" : L"0");+ SetSetting(L"golden_gate", i == 0 ? L"1" : L"0");+ SetSetting(L"liquid_glass", i == 0 || i == 1 ? L"1" : L"0");// o papel de parede do usuário nunca muda ao trocar de tema (o usuário pediu)Rebuild();});@@ -1395,6 +1397,22 @@ Page CentralControle() {[](int i) { SetSetting(L"relogio_curto", i == 1 ? L"1" : L"0"); });clock.icon = 0xE787; clock.iconColor = C_GRAY;p.groups.push_back(G({ clock }));+ // Ilha Dinâmica (src/shell/ilha.cpp): desligada por padrão; as outras opções só valem com ela ligada+ auto on = [](const wchar_t* k, const wchar_t* d) { std::wstring kk = k, dd = d; return std::function<bool()>([kk, dd] { return Setting(kk.c_str(), dd.c_str()) == L"1"; }); };+ auto set = [](const wchar_t* k) { std::wstring kk = k; return std::function<void(bool)>([kk](bool v) { SetSetting(kk.c_str(), v ? L"1" : L"0"); Rebuild(); }); };+ std::vector<Row> ilha = { Toggle(L"Ilha Dinâmica", on(L"ilha", L"0"), set(L"ilha"),+ L"Mostra no topo da tela a música tocando, timers, notificações, downloads, o volume e uma estante de arquivos. Passe o ponteiro sobre ela para abrir.") };+ if (Setting(L"ilha", L"0") == L"1") {+ // estilo: notch (entalhe grudado no topo), ilha (pílula sempre na barra) ou só quando acontece algo+ Row est = Popup(L"Estilo", { L"Notch", L"Ilha", L"Só quando houver algo" },+ [] { std::wstring v = Setting(L"ilha_estilo", L"notch"); return v == L"ilha" ? 1 : v == L"notificacao" ? 2 : 0; },+ [](int i) { SetSetting(L"ilha_estilo", i == 1 ? L"ilha" : i == 2 ? L"notificacao" : L"notch"); });+ ilha.push_back(est);+ ilha.push_back(Toggle(L"Abrir ao passar o ponteiro", on(L"ilha_passar", L"1"), set(L"ilha_passar")));+ ilha.push_back(Toggle(L"Mostrar notificações na ilha", on(L"ilha_notificacoes", L"1"), set(L"ilha_notificacoes")));+ ilha.push_back(Toggle(L"Mostrar o volume na ilha", on(L"ilha_volume", L"1"), set(L"ilha_volume")));+ }+ p.groups.push_back(G(ilha, L"Ilha Dinâmica"));return p;}diff --git a/src/calculadora/main.cpp b/src/calculadora/main.cppindex d7e24be..a4388aa 100644--- a/src/calculadora/main.cpp+++ b/src/calculadora/main.cpp@@ -30,6 +30,7 @@#include "../comum/ampliacao.h"#include "../comum/idioma.h"#include "../comum/semaforo.h"+#include "../comum/leopard.h" // tema Mac OS X Leopard: o metal da janela#pragma comment(lib, "windowscodecs.lib")@@ -631,16 +632,20 @@ float Side() { return g_sidebar ? SBW : 0; }bool ConvOn() { return g_convert && g_mode != M_PROG; }D2D1_SIZE_F ContentSize() { // sem a barra lateralfloat conv = ConvOn() ? CONV_H : 0;- if (g_mode == M_BASIC) return { 229, 405 + conv };+ if (g_mode == M_BASIC) return { 229, (semaforo::Leopard() ? 282.f : 405.f) + conv }; // Leopard: teclas baixas, janela compactaif (g_mode == M_SCI) return { g_sciW, g_sciH + conv };return { 572, 442 };}-float KeysTop() { return (g_mode == M_BASIC ? 132.f : g_mode == M_SCI ? 113.f : 206.f) + (ConvOn() ? CONV_H : 0); }+float KeysTop() {+ if (semaforo::Leopard() && g_mode != M_PROG) return 96.f + (ConvOn() ? CONV_H : 0); // Leopard: o visor baixo do 10.5+ return (g_mode == M_BASIC ? 132.f : g_mode == M_SCI ? 113.f : 206.f) + (ConvOn() ? CONV_H : 0);+}D2D1_RECT_F KeyRect(const KeyDef& k) {auto c = Client();float x0 = Side(), W = c.width - x0, H = c.height, top = KeysTop();if (g_mode == M_BASIC) {float d = 47.5f, cx = x0 + 34.5f + 53.5f * k.col, cy = top + d / 2 + 53.1f * k.row;+ if (semaforo::Leopard()) { cy = top + 13 + 34 * k.row; return { cx - d / 2 - 2, cy - 14, cx + d / 2 + 2, cy + 14 }; } // Leopard: passo de 34return { cx - d / 2, cy - d / 2, cx + d / 2, cy + d / 2 };}int cols = g_mode == M_SCI ? 10 : 8;@@ -649,9 +654,10 @@ D2D1_RECT_F KeyRect(const KeyDef& k) {float x = x0 + mx + k.col * (kw + gx), y = top + k.row * (kh + gy);return { x, y, x + kw, y + kh };}-D2D1_POINT_2F LightCenter(int k) { return { 23.f + k * 23, 25 }; }-D2D1_POINT_2F SideBtnCenter() { return { Side() + (g_mode == M_BASIC ? 123.5f : 105.5f), 26 }; }-D2D1_POINT_2F ModeBtnCenter() { return { Client().width - 26.5f, 26 }; }+D2D1_POINT_2F LightCenter(int k) { return semaforo::Leopard() ? D2D1_POINT_2F{ 14.5f + k * 21, 11 } : D2D1_POINT_2F{ 23.f + k * 23, 25 }; } // Leopard: na barra de 22+// Leopard: os dois botões redondos ficam pequenos (metade) na ponta direita da barra de título de 22+D2D1_POINT_2F SideBtnCenter() { return semaforo::Leopard() ? D2D1_POINT_2F{ Client().width - 34, 11 } : D2D1_POINT_2F{ Side() + (g_mode == M_BASIC ? 123.5f : 105.5f), 26 }; }+D2D1_POINT_2F ModeBtnCenter() { return semaforo::Leopard() ? D2D1_POINT_2F{ Client().width - 13, 11 } : D2D1_POINT_2F{ Client().width - 26.5f, 26 }; }const float ROUND_R = 18;D2D1_RECT_F HistRect(int i) { float y = TB + 4 + i * HIST_H - g_histScroll; return { 8, y, SBW - 8, y + HIST_H - 4 }; }bool In(D2D1_RECT_F r, D2D1_POINT_2F p) { return p.x >= r.left && p.x < r.right && p.y >= r.top && p.y < r.bottom; }@@ -1191,6 +1197,11 @@ D2D1_COLOR_F Rgb(int r, int g, int b, float a = 1) { return D2D1::ColorF(r / 255D2D1_COLOR_F Mix(D2D1_COLOR_F a, D2D1_COLOR_F b, float t) { return D2D1::ColorF(a.r + (b.r - a.r) * t, a.g + (b.g - a.g) * t, a.b + (b.b - a.b) * t, a.a + (b.a - a.a) * t); }struct Pal { D2D1_COLOR_F bg, key[4], text, opText, sub, round, roundBorder, icon, sidebar, line, rim, hover, disabled; };Pal Colors() {+ // Leopard (Calculadora do 10.5/10.6): corpo de metal cinza, teclas em pílula perolada com texto preto, visor amarelo+ if (semaforo::Leopard())+ return { Rgb(196, 196, 196), { Rgb(250, 250, 250), Rgb(250, 250, 250), Rgb(250, 250, 250), Rgb(250, 250, 250) }, Rgb(0, 0, 0), Rgb(0, 0, 0),+ Rgb(0, 0, 0, 0.55f), Rgb(240, 240, 240), Rgb(0, 0, 0, 0.35f), Rgb(40, 40, 40), Rgb(214, 221, 229), Rgb(0, 0, 0, 0.15f),+ Rgb(0, 0, 0, 0.10f), Rgb(0, 0, 0, 0.06f), Rgb(0, 0, 0, 0.30f) };if (g_dark) return { Rgb(36, 41, 45), { Rgb(48, 52, 55), Rgb(70, 74, 76), Rgb(113, 117, 119), Rgb(255, 139, 0) }, Rgb(236, 237, 237), Rgb(255, 255, 255),Rgb(255, 255, 255, 0.52f), Rgb(25, 29, 32), Rgb(255, 255, 255, 0.07f), Rgb(233, 234, 234), Rgb(29, 33, 36), Rgb(255, 255, 255, 0.09f),Rgb(255, 255, 255, 0.06f), Rgb(255, 255, 255, 0.07f), Rgb(255, 255, 255, 0.28f) };@@ -1257,6 +1268,8 @@ void DrawRoundButtons(ID2D1RenderTarget* rt, ID2D1SolidColorBrush* br, const Palauto c = which == 0 ? SideBtnCenter() : ModeBtnCenter();bool hov = g_hover.kind == (which == 0 ? TG_SIDEBTN : TG_MODEBTN);bool on = which == 0 && g_sidebar;+ D2D1_MATRIX_3X2_F oldT; rt->GetTransform(&oldT);+ if (semaforo::Leopard()) rt->SetTransform(D2D1::Matrix3x2F::Scale(0.5f, 0.5f, c) * oldT);br->SetColor(hov || on ? Mix(pal.round, g_dark ? Rgb(255, 255, 255) : Rgb(0, 0, 0), g_dark ? 0.1f : 0.06f) : pal.round);rt->FillEllipse(D2D1::Ellipse(c, ROUND_R, ROUND_R), br);GlassRim(rt, { c.x - ROUND_R, c.y - ROUND_R, c.x + ROUND_R, c.y + ROUND_R }, ROUND_R, 3);@@ -1276,6 +1289,7 @@ void DrawRoundButtons(ID2D1RenderTarget* rt, ID2D1SolidColorBrush* br, const Palrt->FillRectangle({ x, y, x + 1.9f, y + 1.6f }, br);}}+ rt->SetTransform(oldT);}}@@ -1341,10 +1355,31 @@ void DrawKeys(ID2D1RenderTarget* rt, ID2D1SolidColorBrush* br, const Pal& pal) {D2D1_COLOR_F toward = (g_dark || style == S_OP) ? Rgb(255, 255, 255) : Rgb(0, 0, 0);if (hov) c = Mix(c, toward, style == S_OP ? 0.1f : g_dark ? 0.07f : 0.04f);if (glow > 0) c = Mix(c, toward, glow * (style == S_OP ? 0.4f : g_dark ? 0.32f : 0.14f));+ if (semaforo::Leopard()) {+ // Leopard: tecla de canto 5 com o degradê perolado (branco em cima, cinza no meio) e o contorno cinza;+ // apertada ou acesa pelo teclado, azul do Aqua+ float cy0 = (r.top + r.bottom) / 2, hh = std::min(r.bottom - r.top - 4, k.id == K_EQ && r.bottom - r.top > 60 ? 999.f : 26.f);+ D2D1_RECT_F q{ r.left + 2, cy0 - hh / 2, r.right - 2, cy0 + hh / 2 };+ bool blue = glow > 0.3f;+ D2D1_GRADIENT_STOP st[4] = { { 0, blue ? Rgb(170, 205, 250) : Rgb(255, 255, 255) }, { 0.5f, blue ? Rgb(100, 155, 235) : Rgb(242, 242, 242) },+ { 0.5f, blue ? Rgb(60, 120, 222) : Rgb(226, 226, 226) }, { 1, blue ? Rgb(150, 205, 255) : Rgb(248, 248, 248) } };+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;+ br->SetColor(Rgb(255, 255, 255, 0.5f));+ rt->FillRoundedRectangle({ { q.left, q.top + 1, q.right, q.bottom + 1 }, 5, 5 }, br);+ if (SUCCEEDED(rt->CreateGradientStopCollection(st, 4, &gs)) &&+ SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, q.top }, { 0, q.bottom }), gs, &lb)))+ rt->FillRoundedRectangle({ q, 5, 5 }, lb);+ if (lb) lb->Release();+ if (gs) gs->Release();+ br->SetColor(hov ? Rgb(0, 0, 0, 0.55f) : Rgb(0, 0, 0, 0.38f));+ rt->DrawRoundedRectangle({ { q.left + 0.5f, q.top + 0.5f, q.right - 0.5f, q.bottom - 0.5f }, 4.5f, 4.5f }, br, 1);+ r = q;+ } else {br->SetColor(c);D2D1_ROUNDED_RECT rr{ r, rad, rad };rt->FillRoundedRectangle(rr, br);GlassRim(rt, r, rad, style == S_OP ? 2 : style == S_TOP ? 1 : 0);+ }D2D1_COLOR_F tc = style == S_OP ? pal.opText : (style == S_TOP && !g_dark ? pal.text : pal.text);if (!en) tc = pal.disabled;br->SetColor(tc);@@ -1361,6 +1396,7 @@ void DrawKeys(ID2D1RenderTarget* rt, ID2D1SolidColorBrush* br, const Pal& pal) {else size = digit ? 19 : lab.size() > 3 ? 14 : 16;if (k.id == K_NEG) size = g_mode == M_BASIC ? 22 : 19;if (k.id == K_PCT && g_mode == M_BASIC) size = 24;+ if (semaforo::Leopard()) size = std::min(size, 14.f); // Leopard: o texto pequeno das teclas do 10.5size = std::min(size, (r.bottom - r.top) * 0.5f);float w = RunsWidth(rs, size, DWRITE_FONT_WEIGHT_NORMAL);float maxW = (r.right - r.left) - 8;@@ -1380,6 +1416,7 @@ void DrawStdDisplay(ID2D1RenderTarget* rt, ID2D1SolidColorBrush* br, const Pal&bool basic = g_mode == M_BASIC;float greySize = basic ? 21 : 17, bigSize = basic ? 32 : 27;float greyBase = basic ? 80 : 68, bigBase = basic ? 118 : 101;+ if (semaforo::Leopard()) { greySize = 13; bigSize = 22; greyBase = 50; bigBase = 78; } // Leopard: no visor de cristal líquidostd::vector<Run> grey, big;auto num = [&](double v) { std::vector<Run> r(1); r[0].t = FormatNum(v, basic ? 10 : 15); return r; };if (g_rpn) {@@ -1532,6 +1569,41 @@ void Render() {g_rt->Clear(pal.bg);ID2D1SolidColorBrush* br = nullptr;g_rt->CreateSolidColorBrush(pal.text, &br);+ if (semaforo::Leopard()) {+ // Leopard: a janela inteira de metal (degradê cinza), o título no meio da barra e o visor de cristal líquido+ auto cs = Client();+ D2D1_GRADIENT_STOP st[2] = { { 0, Rgb(214, 214, 214) }, { 1, Rgb(170, 170, 170) } };+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;+ if (SUCCEEDED(g_rt->CreateGradientStopCollection(st, 2, &gs)) &&+ SUCCEEDED(g_rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, 0 }, { 0, cs.height }), gs, &lb)))+ g_rt->FillRectangle({ 0, 0, cs.width, cs.height }, lb);+ if (lb) lb->Release();+ if (gs) gs->Release();+ leopard::Metal(g_rt, { 0, 0, cs.width, 22 }, g_active, false, true, 0);+ static IDWriteTextFormat* tt = [] {+ IDWriteTextFormat* f = nullptr; IDWriteFactory* dw = nullptr;+ DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), (IUnknown**)&dw);+ if (dw) { dw->CreateTextFormat(L"Lucida Sans Unicode", nullptr, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 13, L"pt-br", &f); dw->Release(); }+ if (f) { f->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER); f->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER); }+ return f;+ }();+ std::wstring title = Tr(L"Calculadora");+ br->SetColor(Rgb(0, 0, 0, g_active ? 0.85f : 0.45f));+ if (tt) g_rt->DrawTextW(title.c_str(), (UINT32)title.size(), tt, { 80, 0, cs.width - 80, 22 }, br);+ if (g_mode != M_PROG) {+ D2D1_RECT_F lcd{ Side() + 10, 30, cs.width - 10, KeysTop() - 10 };+ D2D1_GRADIENT_STOP s2[2] = { { 0, Rgb(226, 234, 190) }, { 1, Rgb(240, 245, 205) } };+ if (SUCCEEDED(g_rt->CreateGradientStopCollection(s2, 2, &gs)) &&+ SUCCEEDED(g_rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, lcd.top }, { 0, lcd.bottom }), gs, &lb)))+ g_rt->FillRoundedRectangle({ lcd, 4, 4 }, lb);+ if (lb) lb->Release();+ if (gs) gs->Release();+ br->SetColor(Rgb(0, 0, 0, 0.45f));+ g_rt->DrawRoundedRectangle({ { lcd.left + 0.5f, lcd.top + 0.5f, lcd.right - 0.5f, lcd.bottom - 0.5f }, 3.5f, 3.5f }, br, 1);+ br->SetColor(Rgb(0, 0, 0, 0.12f)); // a sombra por dentro em cima+ g_rt->FillRectangle({ lcd.left + 1, lcd.top + 1, lcd.right - 1, lcd.top + 3 }, br);+ }+ }DrawSidebar(g_rt, br, pal);if (g_mode == M_PROG) DrawProgDisplay(g_rt, br, pal);else if (ConvOn()) DrawConvert(g_rt, br, pal);@@ -1553,8 +1625,8 @@ void Invalidate() { InvalidateRect(g_hwnd, nullptr, FALSE); }Target HitTarget(D2D1_POINT_2F p) {Target t;for (int k = 0; k < 3; k++) if (InCircle(LightCenter(k), 8, p)) return { TG_LIGHT, k };- if (InCircle(SideBtnCenter(), ROUND_R, p)) return { TG_SIDEBTN, 0 };- if (InCircle(ModeBtnCenter(), ROUND_R, p)) return { TG_MODEBTN, 0 };+ if (InCircle(SideBtnCenter(), semaforo::Leopard() ? ROUND_R / 2 : ROUND_R, p)) return { TG_SIDEBTN, 0 };+ if (InCircle(ModeBtnCenter(), semaforo::Leopard() ? ROUND_R / 2 : ROUND_R, p)) return { TG_MODEBTN, 0 };if (g_sidebar && p.x < SBW && p.y >= TB)for (int i = 0; i < (int)g_hist.size(); i++) if (In(HistRect(i), p)) return { TG_HIST, i };for (size_t i = 0; i < g_keys.size(); i++) if (In(KeyRect(g_keys[i]), p)) return { TG_KEY, (int)i };@@ -2042,7 +2114,7 @@ int WINAPI wWinMain(HINSTANCE hi, HINSTANCE, PWSTR cmd, int show) {float sc = dx / 96.f;float side = g_sidebar ? SBW : 0;float cw = g_mode == M_BASIC ? 229 : g_mode == M_SCI ? g_sciW : 572;- float ch = g_mode == M_BASIC ? 405 : g_mode == M_SCI ? g_sciH : 442;+ float ch = g_mode == M_BASIC ? (semaforo::Leopard() ? 282.f : 405.f) : g_mode == M_SCI ? g_sciH : 442;if (g_convert && g_mode != M_PROG) ch += CONV_H;int w = (int)std::lround((cw + side) * sc), hgt = (int)std::lround(ch * sc);int x, y;diff --git a/src/comum/app2d.h b/src/comum/app2d.hindex 8cf6f9c..844b5b7 100644--- a/src/comum/app2d.h+++ b/src/comum/app2d.h@@ -1,7 +1,8 @@#pragma once// Base dos apps pequenos desenhados com Direct2D (Lembretes, Calendário): fábricas, fonte SF/Inter/Segoe,// tema claro/escuro, texto, campo de edição (EDIT do Windows por cima, sem borda) e o arquivo de dados em-// %APPDATA%\Shell. A barra de título do Mac vem da WacOSWindow.dll (a janela é comum, com barra do Windows).+// %APPDATA%\Shell. A barra de título do Mac vem da WacOSWindow.dll (a janela é comum, com barra do Windows),+// que o próprio app carrega no CreateMain (barra_mac.h), com ou sem o Shell.#define WIN32_LEAN_AND_MEAN#define NOMINMAX#include <windows.h>@@ -21,6 +22,7 @@#include <vector>#include "idioma.h"#include "semaforo.h" // semaforo::Aqua(): tema macOS Golden Gate+#include "barra_mac.h" // a WacOSWindow.dll carregada pelo próprio app (barra do Mac sem o Shell)#include <commctrl.h>#include <shellapi.h>#pragma comment(lib, "comctl32.lib")@@ -413,10 +415,13 @@ inline HWND CreateMain(HINSTANCE hi, const wchar_t* cls, const wchar_t* title, WGetMonitorInfoW(MonitorFromPoint(c, MONITOR_DEFAULTTOPRIMARY), &mi);float s = GetDpiForSystem() / 96.f;int W = (int)(w * s), H = (int)(h * s);+ // os três botões do Mac vêm da WacOSWindow.dll, carregada aqui mesmo (barra_mac.h): sem ela (DLL faltando),+ // fica a barra comum do Windows, nunca a barra unificada sem botão nenhum+ bool mac = barramac::Ligar();wnd = CreateWindowExW(0, cls, title, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, mi.rcWork.left + (mi.rcWork.right - mi.rcWork.left - W) / 2,mi.rcWork.top + (mi.rcWork.bottom - mi.rcWork.top - H) / 2, W, H, nullptr, nullptr, hi, nullptr);if (wnd) { BOOL dark = Dark(); DwmSetWindowAttribute(wnd, 20, &dark, sizeof(dark)); }- if (wnd && semaforo::Aqua() && barWanted > 0) { // macOS 27: barra de ferramentas unificada+ if (wnd && mac && semaforo::Aqua() && barWanted > 0) { // macOS 27: barra de ferramentas unificadaBAR = barWanted;SetPropW(wnd, L"WacOSBarraUnificada", (HANDLE)(INT_PTR)std::lround(BAR));SetWindowSubclass(wnd, UnifiedSub, 0x55A1, 0);diff --git a/src/comum/barra_mac.h b/src/comum/barra_mac.hnew file mode 100644index 0000000..f7d6e38--- /dev/null+++ b/src/comum/barra_mac.h@@ -0,0 +1,28 @@+// Barra de título do Mac nos apps do WacOS que não desenham os próprios botões (os do app2d.h: Lembretes,+// Calendário, Música, Fotos, TextEdit..., e a Pré-Visualização): o próprio app carrega a WacOSWindow.dll da+// pasta dele e pede a barra na thread da interface (WacOSPropria). Antes só o Shell punha a DLL (gancho), e o+// app aberto sem o Shell ficava com a barra do Windows, ou sem botão nenhum no tema Golden Gate (Reddit,+// 20/11/2026: "duplicated title bar buttons or then missing all together"). Agora é igual com e sem o Shell;+// o Shell não põe mais o gancho nos WacOS*.exe (janelas.cpp) e o "desfazer" dele não tira a barra do app.+// Chamar antes de criar a janela principal, na thread dela.+#pragma once+#include <windows.h>++namespace barramac {++inline bool Ligar() {+ static int st = -1;+ if (st >= 0) return st == 1;+ st = 0;+ wchar_t p[MAX_PATH] = {};+ DWORD n = GetModuleFileNameW(nullptr, p, MAX_PATH);+ wchar_t* s = n ? wcsrchr(p, L'\\') : nullptr;+ if (!s || (size_t)(s + 1 - p) + 20 >= MAX_PATH) return false;+ wcscpy_s(s + 1, MAX_PATH - (s + 1 - p), L"WacOSWindow.dll");+ HMODULE m = LoadLibraryExW(p, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH);+ auto f = m ? (BOOL(WINAPI*)())GetProcAddress(m, "WacOSPropria") : nullptr;+ if (f && f()) st = 1;+ return st == 1;+}++} // namespace barramacdiff --git a/src/comum/idioma_en.inc b/src/comum/idioma_en.incindex c80b579..5a5c0a4 100644--- a/src/comum/idioma_en.inc+++ b/src/comum/idioma_en.inc@@ -220,6 +220,9 @@{ L"Nascer do sol: ", L"Sunrise:" },{ L"Pôr do sol: ", L"Sunset:" },{ L"Remover Widget", L"Remove Widget" },+{ L"Widgets da Mesa…", L"Desktop Widgets…" },+{ L"Ocultar do Launchpad", L"Hide from Launchpad" },+{ L"Ocultar Apps do Sistema", L"Hide System Apps" },{ L"Organizar Widgets", L"Arrange Widgets" },{ L"Tempo", L"Weather" },{ L"Relógio", L"Clock" },@@ -1369,6 +1372,8 @@{ L"O aplicativo pode estar rodando como administrador.", L"The app may be running as administrator." },{ L"Soneca de Apps", L"App Nap" },{ L"Programas com todas as janelas escondidas, minimizadas ou cobertas por 30 segundos passam a gastar menos processador, como o App Nap do Mac. Voltam ao normal assim que aparecem. Não vale para o que está tocando ou gravando som.", L"Apps whose windows are all hidden, minimized or covered for 30 seconds use less processor time, like App Nap on the Mac. They return to normal as soon as they appear. Doesn’t apply to apps playing or recording sound." },+{ L"Modo Jogo", L"Game Mode" },+{ L"Quando um jogo vem para a frente, o WacOS desliga o vidro real, os efeitos que acompanham o mouse e os Cantos Ativos e passa a usar menos processador, até o jogo fechar. Jogos que não forem reconhecidos podem ser postos em jogos.txt, na pasta de ajustes.", L"When a game comes to the front, WacOS turns off real glass, the effects that follow the mouse and Hot Corners, and uses less processor time until the game quits. Games that aren’t recognized can be added to jogos.txt in the settings folder." },{ L"Mostrar a pasta Downloads no Dock", L"Show Downloads folder in Dock" },{ L"Versão instalada", L"Installed version" },{ L"Versão mais nova", L"Latest version" },@@ -1443,3 +1448,47 @@{ L"Mostrar Todos", L"Show All" },{ L"Hardware", L"Hardware" },{ L"Internet e Rede", L"Internet & Network" },+{ L"Ilha Dinâmica", L"Dynamic Island" },+{ L"Mostrar notificações na ilha", L"Show notifications in the island" },+{ L"Mostrar o volume na ilha", L"Show volume in the island" },+{ L"Mostra no topo da tela a música tocando, timers, notificações, downloads, o volume e uma estante de arquivos. Passe o ponteiro sobre ela para abrir.", L"Shows what’s playing, timers, notifications, downloads, volume and a file shelf at the top of the screen. Hover over it to open." },+{ L"Notch", L"Notch" },+{ L"Ilha", L"Island" },+{ L"Só quando houver algo", L"Only when something happens" },+{ L"Abrir ao passar o ponteiro", L"Open on hover" },+{ L"Transferência", L"Clipboard" },+{ L"Estante", L"Shelf" },+{ L"Timer concluído", L"Timer done" },+{ L"Copiado", L"Copied" },+{ L"O que você copiar aparece aqui", L"What you copy shows up here" },+{ L"Arraste arquivos para cá", L"Drag files here" },+{ L"Download concluído", L"Download complete" },+{ L"Caps Lock desligado", L"Caps Lock off" },+{ L"Estilo", L"Style" },+{ L"Hoje (Agora)", L"Today (Now)" },+{ L"Restaurar", L"Restore" },+{ L"Hora Local", L"Local Time" },+{ L"Pasta vazia", L"Empty folder" },+{ L"restaurado", L"restored" },+{ L"Entrar no Time Machine", L"Enter Time Machine" },+{ L"Nenhum backup encontrado. Escolha o disco de backup no app Time Machine.", L"No backups found. Choose a backup disk in the Time Machine app." },+{ L"Ainda não há backups desta pasta.", L"There are no backups of this folder yet." },+{ L"Domingo", L"Sunday" },+{ L"Segunda", L"Monday" },+{ L"Terça", L"Tuesday" },+{ L"Quarta", L"Wednesday" },+{ L"Quinta", L"Thursday" },+{ L"Sexta", L"Friday" },+{ L"Sábado", L"Saturday" },+{ L"Janeiro", L"January" },+{ L"Fevereiro", L"February" },+{ L"Março", L"March" },+{ L"Abril", L"April" },+{ L"Maio", L"May" },+{ L"Junho", L"June" },+{ L"Julho", L"July" },+{ L"Agosto", L"August" },+{ L"Setembro", L"September" },+{ L"Outubro", L"October" },+{ L"Novembro", L"November" },+{ L"Dezembro", L"December" },diff --git a/src/comum/leopard.h b/src/comum/leopard.hindex 59c572b..3b01613 100644--- a/src/comum/leopard.h+++ b/src/comum/leopard.h@@ -12,6 +12,9 @@// claros, então continuam legíveis).#include <d2d1.h>#include "semaforo.h"+#include <map>+#include <string>+#include <cwctype>namespace leopard {@@ -79,4 +82,33 @@ inline D2D1_COLOR_F Sidebar(bool active, bool dark) {return active ? D2D1::ColorF(214 / 255.f, 221 / 255.f, 229 / 255.f, 1) : D2D1::ColorF(232 / 255.f, 232 / 255.f, 232 / 255.f, 1);}+// o ícone de documento do 10.5 pela extensão (nome do PNG em icones\leopard; "" = a miniatura do Windows: fotos,+// vídeos, apps). Usado pelo Finder e pelas Pilhas da Dock.+inline std::wstring DocIcon(const std::wstring& name) {+ const wchar_t* d = wcsrchr(name.c_str(), L'.');+ std::wstring x = d ? d + 1 : L"";+ for (auto& c : x) c = towlower(c);+ static const std::map<std::wstring, const wchar_t*> m = {+ { L"txt", L"doc texto" }, { L"md", L"doc texto" }, { L"ini", L"doc texto" }, { L"cfg", L"doc texto" }, { L"toml", L"doc texto" },+ { L"json", L"doc texto" }, { L"yaml", L"doc texto" }, { L"yml", L"doc texto" }, { L"csv", L"doc planilha" }, { L"log", L"doc log" },+ { L"pdf", L"doc pdf" }, { L"doc", L"doc word" }, { L"docx", L"doc word" }, { L"rtf", L"doc rich" }, { L"odt", L"doc word" },+ { L"xls", L"doc planilha" }, { L"xlsx", L"doc planilha" }, { L"ods", L"doc planilha" },+ { L"ppt", L"doc apresentacao" }, { L"pptx", L"doc apresentacao" }, { L"key", L"doc apresentacao" },+ { L"zip", L"doc zip" }, { L"rar", L"doc zip" }, { L"7z", L"doc zip" }, { L"tar", L"doc zip" }, { L"gz", L"doc zip" },+ { L"mp3", L"doc audio" }, { L"wav", L"doc audio" }, { L"flac", L"doc audio" }, { L"m4a", L"doc audio" }, { L"ogg", L"doc audio" },+ { L"aif", L"doc audio" }, { L"aiff", L"doc audio" }, { L"mid", L"doc audio" }, { L"midi", L"doc audio" },+ { L"html", L"doc html" }, { L"htm", L"doc html" }, { L"xml", L"doc xml" }, { L"js", L"doc script" }, { L"ps1", L"doc script" },+ { L"sh", L"doc script" }, { L"bat", L"doc script" }, { L"cmd", L"doc script" }, { L"py", L"doc python" }, { L"c", L"doc c" },+ { L"h", L"doc c" }, { L"cpp", L"doc cpp" }, { L"hpp", L"doc cpp" }, { L"cs", L"doc cpp" }, { L"java", L"doc java" },+ { L"iso", L"doc disco" }, { L"img", L"doc disco" }, { L"ttf", L"doc fonte" }, { L"otf", L"doc fonte" },+ { L"dll", L"doc exe" }, { L"sys", L"doc exe" },+ };+ auto it = m.find(x);+ if (it != m.end()) return it->second;+ static const wchar_t* media[] = { L"png", L"jpg", L"jpeg", L"gif", L"bmp", L"webp", L"heic", L"tif", L"tiff", L"ico", L"svg",+ L"mp4", L"mov", L"mkv", L"avi", L"wmv", L"webm", L"m4v", L"exe", L"msi", L"lnk", L"url", L"appref-ms" };+ for (auto* mm : media) if (x == mm) return L"";+ return L"doc generico";+}+} // namespace leoparddiff --git a/src/comum/nomes.h b/src/comum/nomes.hindex c569030..86a9ec6 100644--- a/src/comum/nomes.h+++ b/src/comum/nomes.h@@ -22,6 +22,7 @@#define EXE_MUSIC L"WacOSMusic.exe" // Música#define EXE_QUICKTIME L"WacOSQuickTime.exe" // QuickTime Player#define EXE_FORCEQUIT L"WacOSForceQuit.exe" // Forçar Encerrar Aplicativos (Ctrl+Alt+Esc)+#define EXE_TITLEBARS L"WacOSTitleBars.exe" // só as barras de título do Mac, sem o Shell (src itulos)#define DLL_WINDOW L"WacOSWindow.dll" // antes MacJanela.dll#define DLL_WINDOW32 L"WacOSWindow32.dll" // antes MacJanela32.dll// (WacOSWindow32Host.exe saiu no build-12: o hospedeiro de 32 bits agora é o rundll32 do Windows)diff --git a/src/finder/main.cpp b/src/finder/main.cppindex a3343f1..4437e59 100644--- a/src/finder/main.cpp+++ b/src/finder/main.cpp@@ -374,7 +374,8 @@ static float CoverFlowH();static float TopH() { return Lay::TOOLBAR_H + TabBarH() + ScopeBarH() + TrashBarH() + CoverFlowH(); } // fim das barras de cimanamespace ListLay {-const float HEADER_H = 28, GROUP_H = 40, SIZE_W = 90, KIND_W = 160, DATE_W = 190;+inline float HEADER_H = 28; // Leopard: 17 (o cabeçalho baixo do 10.5; ApplyWindowTheme)+const float GROUP_H = 40, SIZE_W = 90, KIND_W = 160, DATE_W = 190;}// Opções de Visualização (Ctrl+J), guardadas em %APPDATA%\Arquivos\opcoes.txt@@ -799,7 +800,6 @@ static D2D1_RECT_F ToolRect(int k) {const float H = 11;if (k == TB_BACK) return { 10, cy - H, 37, cy + H };if (k == TB_FWD) return { 37, cy - H, 64, cy + H };- if (k == TB_GROUP) return { 72, cy - H, 114, cy + H };if (k == TB_SEARCH) return { s.width - 12 - std::min(200.f, s.width * 0.22f), cy - 10, s.width - 12, cy + 10 };float vl = std::max(124.f, s.width / 2 - 70);if (k >= TB_V_ICONS && k <= TB_V_GALLERY) {@@ -807,7 +807,10 @@ static D2D1_RECT_F ToolRect(int k) {float x = vl + (k - TB_V_ICONS) * 29.f;return { x, cy - H, x + 29, cy + H };}- if (k == TB_ACTION) { float x = vl + (WideToolbar() ? 4 * 29.f : 40.f) + 10; return { x, cy - H, x + 42, cy + H }; }+ // captura do 10.5: depois das visões, o olho do Quick Look (44) e a engrenagem ▾ (46), 8 entre eles+ float ex = vl + (WideToolbar() ? 4 * 29.f : 40.f) + 14;+ if (k == TB_GROUP) return { ex, cy - H, ex + 44, cy + H }; // Leopard: o olho do Quick Look (não havia "Arrumar")+ if (k == TB_ACTION) return { ex + 52, cy - H, ex + 98, cy + H };return { 0, 0, 0, 0 }; // Compartilhar, Etiquetas, Lixeira}if (Golden()) {@@ -1794,8 +1797,94 @@ static void DrawGlyph(ID2D1DeviceContext* dc, wchar_t g, D2D1_RECT_F r, ID2D1Bru}// Ícones da barra de ferramentas: traço fino e pontas arredondadas, desenhados aqui mesmo.+// Leopard: os glifos pretos cheios da barra do Finder do 10.5 (captura real: ◀ ▶, quadradinhos, linhas, colunas, as+// capas do Cover Flow, o olho do Quick Look e a engrenagem ▾)+static bool DrawToolIconLeopard(ID2D1DeviceContext* dc, int k, D2D1_RECT_F r, ID2D1Brush* b) {+ float cx = (r.left + r.right) / 2, cy = (r.top + r.bottom) / 2;+ ID2D1Factory* f = nullptr; dc->GetFactory(&f);+ if (!f) return false;+ auto poly = [&](std::initializer_list<D2D1_POINT_2F> pts) {+ ID2D1PathGeometry* g = nullptr;+ if (SUCCEEDED(f->CreatePathGeometry(&g))) {+ ID2D1GeometrySink* s = nullptr;+ if (SUCCEEDED(g->Open(&s))) {+ auto it = pts.begin();+ s->BeginFigure(*it, D2D1_FIGURE_BEGIN_FILLED);+ for (++it; it != pts.end(); ++it) s->AddLine(*it);+ s->EndFigure(D2D1_FIGURE_END_CLOSED); s->Close(); s->Release();+ dc->FillGeometry(g, b);+ }+ g->Release();+ }+ };+ auto arrow = [&](float ax) { poly({ { ax - 3.5f, cy - 1.8f }, { ax + 3.5f, cy - 1.8f }, { ax, cy + 2.2f } }); }; // ▾ cheio+ bool done = true;+ switch (k) {+ case TB_BACK: poly({ { cx - 4.5f, cy }, { cx + 3.5f, cy - 5.5f }, { cx + 3.5f, cy + 5.5f } }); break;+ case TB_FWD: poly({ { cx + 4.5f, cy }, { cx - 3.5f, cy - 5.5f }, { cx - 3.5f, cy + 5.5f } }); break;+ case TB_V_ICONS: {+ if (r.right - r.left > 40) { done = false; break; } // recolhido: o desenho comum+ for (int i = 0; i < 4; i++) {+ D2D1_RECT_F q{ cx - 6.5f + (i % 2) * 7.5f, cy - 6.5f + (i / 2) * 7.5f, cx - 6.5f + (i % 2) * 7.5f + 5.5f, cy - 6.5f + (i / 2) * 7.5f + 5.5f };+ dc->DrawRectangle(D2D1::RectF(q.left + 0.75f, q.top + 0.75f, q.right - 0.75f, q.bottom - 0.75f), b, 1.5f);+ }+ break;+ }+ case TB_V_LIST:+ for (int i = 0; i < 4; i++) dc->FillRectangle(D2D1::RectF(cx - 7, cy - 6 + i * 3.6f, cx + 7, cy - 6 + i * 3.6f + 1.5f), b);+ break;+ case TB_V_COLS:+ dc->DrawRectangle(D2D1::RectF(cx - 7.5f, cy - 5.5f, cx + 7.5f, cy + 5.5f), b, 1.6f);+ dc->FillRectangle(D2D1::RectF(cx - 2.8f, cy - 5.5f, cx - 1.6f, cy + 5.5f), b);+ dc->FillRectangle(D2D1::RectF(cx + 1.6f, cy - 5.5f, cx + 2.8f, cy + 5.5f), b);+ break;+ case TB_V_GALLERY: // Cover Flow: a moldura com as capas em pé+ dc->FillRectangle(D2D1::RectF(cx - 8.5f, cy - 5, cx - 6.5f, cy + 5), b);+ dc->FillRectangle(D2D1::RectF(cx + 6.5f, cy - 5, cx + 8.5f, cy + 5), b);+ for (int i = 0; i < 4; i++) dc->FillRectangle(D2D1::RectF(cx - 4.6f + i * 2.8f, cy - 3.5f, cx - 4.6f + i * 2.8f + 1.5f, cy + 3.5f), b);+ dc->DrawRectangle(D2D1::RectF(cx - 8, cy - 4.5f, cx + 8, cy + 4.5f), b, 1);+ break;+ case TB_GROUP: { // o olho: amêndoa preta, a íris branca e a pupila+ ID2D1PathGeometry* g = nullptr;+ if (SUCCEEDED(f->CreatePathGeometry(&g))) {+ ID2D1GeometrySink* s = nullptr;+ if (SUCCEEDED(g->Open(&s))) {+ s->BeginFigure({ cx - 9, cy }, D2D1_FIGURE_BEGIN_FILLED);+ s->AddQuadraticBezier(D2D1::QuadraticBezierSegment({ cx, cy - 9 }, { cx + 9, cy }));+ s->AddQuadraticBezier(D2D1::QuadraticBezierSegment({ cx, cy + 9 }, { cx - 9, cy }));+ s->EndFigure(D2D1_FIGURE_END_CLOSED); s->Close(); s->Release();+ dc->FillGeometry(g, b);+ }+ g->Release();+ }+ ID2D1SolidColorBrush* w = nullptr;+ dc->CreateSolidColorBrush(D2D1::ColorF(0.93f, 0.93f, 0.93f), &w);+ if (w) { dc->FillEllipse(D2D1::Ellipse({ cx, cy }, 3.4f, 3.4f), w); w->Release(); }+ dc->FillEllipse(D2D1::Ellipse({ cx, cy }, 1.7f, 1.7f), b);+ break;+ }+ case TB_ACTION: { // engrenagem preta cheia com o furo, e o ▾+ float gx = cx - 6, gr = 5.3f;+ for (int i = 0; i < 8; i++) {+ float a = i * 3.14159265f / 4;+ dc->DrawLine({ gx + std::cos(a) * gr, cy + std::sin(a) * gr }, { gx + std::cos(a) * (gr + 2.8f), cy + std::sin(a) * (gr + 2.8f) }, b, 2.6f);+ }+ dc->FillEllipse(D2D1::Ellipse({ gx, cy }, gr + 0.4f, gr + 0.4f), b);+ ID2D1SolidColorBrush* w = nullptr;+ dc->CreateSolidColorBrush(D2D1::ColorF(0.90f, 0.90f, 0.90f), &w);+ if (w) { dc->FillEllipse(D2D1::Ellipse({ gx, cy }, 2.1f, 2.1f), w); w->Release(); }+ arrow(r.right - 10);+ break;+ }+ default: done = false;+ }+ f->Release();+ return done;+}+static void DrawToolIcon(ID2D1DeviceContext* dc, int k, D2D1_RECT_F r, ID2D1Brush* b) {float cx = (r.left + r.right) / 2, cy = (r.top + r.bottom) / 2;+ if (!g_tahoe && tahoe::Leopard() && DrawToolIconLeopard(dc, k, r, b)) return;switch (k) {case TB_BACK: Line(dc, b, cx + 3, cy - 6, cx - 3, cy, 1.9f); Line(dc, b, cx - 3, cy, cx + 3, cy + 6, 1.9f); break;case TB_FWD: Line(dc, b, cx - 3, cy - 6, cx + 3, cy, 1.9f); Line(dc, b, cx + 3, cy, cx - 3, cy + 6, 1.9f); break;@@ -1944,32 +2033,7 @@ static bool DrawLeoPng(ID2D1DeviceContext* dc, const std::wstring& name, D2D1_REreturn true;}// Leopard: o ícone de documento do 10.5 pela extensão ("" = deixa a miniatura do Windows: fotos, vídeos, apps)-static std::wstring LeoDocIcon(const std::wstring& name) {- const wchar_t* d = wcsrchr(name.c_str(), L'.');- std::wstring x = d ? d + 1 : L"";- for (auto& c : x) c = towlower(c);- static const std::map<std::wstring, const wchar_t*> m = {- { L"txt", L"doc texto" }, { L"md", L"doc texto" }, { L"ini", L"doc texto" }, { L"cfg", L"doc texto" }, { L"toml", L"doc texto" },- { L"json", L"doc texto" }, { L"yaml", L"doc texto" }, { L"yml", L"doc texto" }, { L"csv", L"doc planilha" }, { L"log", L"doc log" },- { L"pdf", L"doc pdf" }, { L"doc", L"doc word" }, { L"docx", L"doc word" }, { L"rtf", L"doc rich" }, { L"odt", L"doc word" },- { L"xls", L"doc planilha" }, { L"xlsx", L"doc planilha" }, { L"ods", L"doc planilha" },- { L"ppt", L"doc apresentacao" }, { L"pptx", L"doc apresentacao" }, { L"key", L"doc apresentacao" },- { L"zip", L"doc zip" }, { L"rar", L"doc zip" }, { L"7z", L"doc zip" }, { L"tar", L"doc zip" }, { L"gz", L"doc zip" },- { L"mp3", L"doc audio" }, { L"wav", L"doc audio" }, { L"flac", L"doc audio" }, { L"m4a", L"doc audio" }, { L"ogg", L"doc audio" },- { L"aif", L"doc audio" }, { L"aiff", L"doc audio" }, { L"mid", L"doc audio" }, { L"midi", L"doc audio" },- { L"html", L"doc html" }, { L"htm", L"doc html" }, { L"xml", L"doc xml" }, { L"js", L"doc script" }, { L"ps1", L"doc script" },- { L"sh", L"doc script" }, { L"bat", L"doc script" }, { L"cmd", L"doc script" }, { L"py", L"doc python" }, { L"c", L"doc c" },- { L"h", L"doc c" }, { L"cpp", L"doc cpp" }, { L"hpp", L"doc cpp" }, { L"cs", L"doc cpp" }, { L"java", L"doc java" },- { L"iso", L"doc disco" }, { L"img", L"doc disco" }, { L"ttf", L"doc fonte" }, { L"otf", L"doc fonte" },- { L"dll", L"doc exe" }, { L"sys", L"doc exe" },- };- auto it = m.find(x);- if (it != m.end()) return it->second;- static const wchar_t* media[] = { L"png", L"jpg", L"jpeg", L"gif", L"bmp", L"webp", L"heic", L"tif", L"tiff", L"ico", L"svg",- L"mp4", L"mov", L"mkv", L"avi", L"wmv", L"webm", L"m4v", L"exe", L"msi", L"lnk", L"url", L"appref-ms" };- for (auto* mm : media) if (x == mm) return L"";- return L"doc generico";-}+static std::wstring LeoDocIcon(const std::wstring& name) { return leopard::DocIcon(name); }// Leopard (leo = true): as pastas azuis do 10.5 em icones\leopard (tools\icones-leopard.py), com os mesmos nomes.static bool DrawTahoeFolder(ID2D1DeviceContext* dc, D2D1_RECT_F box, wchar_t emblem, bool leo = false) {@@ -2450,7 +2514,7 @@ static void DrawToolbar(ID2D1DeviceContext* dc, const Palette& pal, ID2D1SolidCo(k == TB_V_COLS && g_view == View::Columns) || (k == TB_V_GALLERY && (g_view == View::Gallery || g_coverFlow)));if (leo) { // Leopard: a moldura já foi desenhada; o ícone escuro (branco no modo atual), apertado escureceif (enabled && g_pressTool == k) { br->SetColor(D2D1::ColorF(0, 0, 0, 0.18f)); dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 1, Lay::TOOL_CY - 10, r.right - 1, Lay::TOOL_CY + 10), 3, 3), br); }- br->SetColor(current ? D2D1::ColorF(1, 1, 1, 0.95f) : enabled ? D2D1::ColorF(0.15f, 0.15f, 0.15f, 0.9f) : D2D1::ColorF(0, 0, 0, 0.28f));+ br->SetColor(current ? D2D1::ColorF(1, 1, 1, 0.95f) : enabled ? D2D1::ColorF(0.05f, 0.05f, 0.05f, 0.95f) : D2D1::ColorF(0, 0, 0, 0.30f));DrawToolIcon(dc, k, r, br);continue;}@@ -2486,6 +2550,18 @@ static void DrawToolbar(ID2D1DeviceContext* dc, const Palette& pal, ID2D1SolidCodc->DrawTextW(title.c_str(), (UINT32)title.size(), g_tfTitle, D2D1::RectF(x0 + 20, 1, x0 + 20 + tw + 4, 23), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);br->SetColor(D2D1::ColorF(0, 0, 0, g_winActive ? 0.85f : 0.45f));dc->DrawTextW(title.c_str(), (UINT32)title.size(), g_tfTitle, D2D1::RectF(x0 + 20, 0, x0 + 20 + tw + 4, 22), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);+ { // a pílula oval de mostrar/ocultar a barra de ferramentas no canto direito do título (captura do 10.5)+ D2D1_RECT_F pr = D2D1::RectF(s.width - 31, 6, s.width - 9, 16);+ D2D1_GRADIENT_STOP st[3] = { { 0, D2D1::ColorF(0.99f, 0.99f, 0.99f) }, { 0.5f, D2D1::ColorF(0.86f, 0.86f, 0.86f) }, { 1, D2D1::ColorF(0.97f, 0.97f, 0.97f) } };+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;+ if (SUCCEEDED(dc->CreateGradientStopCollection(st, 3, &gs)) &&+ SUCCEEDED(dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, pr.top }, { 0, pr.bottom }), gs, &lb)))+ dc->FillRoundedRectangle(D2D1::RoundedRect(pr, 5, 5), lb);+ if (lb) lb->Release();+ if (gs) gs->Release();+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.45f));+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(pr.left + 0.5f, pr.top + 0.5f, pr.right - 0.5f, pr.bottom - 0.5f), 4.5f, 4.5f), br, 1);+ }} else {// título; a pastinha só aparece com o mouse em cima (como no Sequoia) e empurra o nomefloat tx = ToolRect(TB_FWD).right + 12;@@ -2721,6 +2797,56 @@ static void DrawListHeader(ID2D1DeviceContext* dc, const Palette& pal, ID2D1Soliauto s = ClientDip();auto k = Cols();float top = TopH(), bottom = top + ListLay::HEADER_H;+ if (!g_tahoe && tahoe::Leopard()) {+ // Leopard (captura do 10.5): faixa branca com degradê leve, fio cinza embaixo, divisórias de cima a baixo, os+ // títulos em preto normal e o ▲/▼ cheio na coluna da ordem+ D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(1, 1, 1) }, { 1, D2D1::ColorF(0.92f, 0.92f, 0.92f) } };+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;+ if (SUCCEEDED(dc->CreateGradientStopCollection(st, 2, &gs)) &&+ SUCCEEDED(dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, top }, { 0, bottom }), gs, &lb)))+ dc->FillRectangle(D2D1::RectF(Lay::SIDEBAR_W, top, s.width, bottom), lb);+ if (lb) lb->Release();+ if (gs) gs->Release();+ br->SetColor(D2D1::ColorF(0.62f, 0.62f, 0.62f));+ dc->DrawLine({ Lay::SIDEBAR_W, bottom - 0.5f }, { s.width, bottom - 0.5f }, br, 1);+ static IDWriteTextFormat* tfH = [] {+ IDWriteTextFormat* f = nullptr;+ gfx::dw->CreateTextFormat(L"Lucida Sans Unicode", nullptr, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 11, L"pt-br", &f);+ if (f) { f->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER); f->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP); }+ return f;+ }();+ struct C2 { SortCol id; const wchar_t* t; float l, r; bool show; };+ const C2 cs[] = { { SORT_NAME, Tr(L"Nome"), k.nameL, k.nameR, true }, { SORT_SIZE, Tr(L"Tamanho"), k.sizeL, k.sizeR, k.size },+ { SORT_KIND, Tr(L"Tipo"), k.kindL, k.kindR, k.kind }, { SORT_DATE, Tr(L"Data de Modificação"), k.dateL, k.dateR, k.date },+ { SORT_CREATED, Tr(L"Data de Criação"), k.crL, k.crR, k.created } };+ for (auto& c : cs) {+ if (!c.show) continue;+ float l = c.id == SORT_NAME ? c.l + 20 : c.l;+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.88f));+ if (tfH) dc->DrawTextW(c.t, (UINT32)wcslen(c.t), tfH, D2D1::RectF(l, top, c.r - 16, bottom), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);+ if (c.id == g_sortCol) { // ▲/▼ cheio na ponta direita da coluna+ float ax = c.r - 12, cy = (top + bottom) / 2;+ ID2D1Factory* f = nullptr; dc->GetFactory(&f);+ ID2D1PathGeometry* g = nullptr;+ if (f && SUCCEEDED(f->CreatePathGeometry(&g))) {+ ID2D1GeometrySink* sk = nullptr;+ if (SUCCEEDED(g->Open(&sk))) {+ if (g_sortAsc) { sk->BeginFigure({ ax - 3.5f, cy + 2 }, D2D1_FIGURE_BEGIN_FILLED); sk->AddLine({ ax + 3.5f, cy + 2 }); sk->AddLine({ ax, cy - 2.5f }); }+ else { sk->BeginFigure({ ax - 3.5f, cy - 2 }, D2D1_FIGURE_BEGIN_FILLED); sk->AddLine({ ax + 3.5f, cy - 2 }); sk->AddLine({ ax, cy + 2.5f }); }+ sk->EndFigure(D2D1_FIGURE_END_CLOSED); sk->Close(); sk->Release();+ br->SetColor(D2D1::ColorF(0.25f, 0.25f, 0.25f));+ dc->FillGeometry(g, br);+ }+ g->Release();+ }+ if (f) f->Release();+ }+ br->SetColor(D2D1::ColorF(0.72f, 0.72f, 0.72f)); // divisória à direita da coluna, de cima a baixo+ float x = std::floor(c.r - 7) + 0.5f;+ dc->DrawLine({ x, top }, { x, bottom - 1 }, br, 1);+ }+ return;+ }br->SetColor(pal.content);dc->FillRectangle(D2D1::RectF(Lay::SIDEBAR_W, top, s.width, bottom), br);br->SetColor(pal.line);@@ -2796,7 +2922,7 @@ static void DrawListRows(ID2D1DeviceContext* dc, const Palette& pal, ID2D1SolidCn++;DrawItemIcon(dc, i, ToView(IconDoc(i)), br);D2D1_COLOR_F main = selActive ? D2D1::ColorF(1, 1, 1, 1) : pal.text;- D2D1_COLOR_F second = selActive ? D2D1::ColorF(1, 1, 1, 0.85f) : pal.text2;+ D2D1_COLOR_F second = selActive ? D2D1::ColorF(1, 1, 1, 0.85f) : leo ? D2D1::ColorF(0, 0, 0, 0.85f) : pal.text2; // Leopard: todas as colunas em preto (captura do 10.5)if (i != g_renameIdx) {auto lr = ToView(LabelDoc(i));float dots = TagDotsWidth(e.tags);@@ -4878,6 +5004,7 @@ static void ToolClick(int k) {case TB_V_COLS: SetView(View::Columns); break;case TB_V_GALLERY: SetView(View::Gallery); break;case TB_GROUP: {+ if (!g_tahoe && tahoe::Leopard()) { QlToggle(); break; } // Leopard: o botão é o olho do Quick Lookint id = ctxmenu::ShowItems(g_hwnd, BelowTool(TB_GROUP), GroupItems(100));if (id >= 100) { g_groupBy = (GroupBy)(id - 100); Resort(); }break;@@ -5819,6 +5946,8 @@ static void ApplyWindowTheme() {else if (g_coverFlow) { g_coverFlow = false; g_view = View::Gallery; g_rowsDirty = true; }Lay::TOOLBAR_H = g_tahoe ? 52.f : leoLay ? 56.f : 53.f;Lay::TOOL_CY = leoLay ? 38.5f : 26.3f;+ ListLay::HEADER_H = leoLay ? 17.f : 28.f;+ g_rowsDirty = true;Lay::SIDE_TOP = leoLay ? Lay::TOOLBAR_H + 8 : 47.f;g_sideClipTop = Lay::SIDE_TOP;BOOL dark = g_dark;diff --git a/src/finder/shadow.cpp b/src/finder/shadow.cppindex b3b0a4d..1848e61 100644--- a/src/finder/shadow.cpp+++ b/src/finder/shadow.cpp@@ -61,11 +61,17 @@ void Rebuild(int w, int h, RECT win, float scale) {}return;}+ // Embaixo da janela não escurece (a barra lateral é translúcida), menos nos cantos: o DWM arredonda a janela e,+ // com o buraco retangular, sobrava um canto claro fora da curva. Com cantos maiores (mod "rounded corners" do+ // Windhawk, raio que não dá para saber) isso aparecia como um quadro quadrado em volta (Reddit, 20/11/2026).+ // O buraco agora tem os cantos redondos com raio folgado (24 pt): cobre qualquer canto até esse tamanho.+ float rc = 24.f * scale;for (int y = 0; y < h; y++) {bool rowInside = y >= win.top && y < win.bottom;+ float fy = y + 0.5f, cy = std::fmax(std::fmax(win.top + rc - fy, fy - (win.bottom - rc)), 0.f);for (int x = 0; x < w; x++) {- // embaixo da janela não escurece: a barra lateral é translúcida- if (rowInside && x >= win.left && x < win.right) { px[y * w + x] = 0; continue; }+ float fx = x + 0.5f, cx = std::fmax(std::fmax(win.left + rc - fx, fx - (win.right - rc)), 0.f);+ if (rowInside && x >= win.left && x < win.right && cx * cx + cy * cy <= rc * rc) { px[y * w + x] = 0; continue; }float a = amount * ax[x] * ay[y];BYTE A = (BYTE)std::lround(std::fmin(a, 1.f) * 255);px[y * w + x] = (UINT32)A << 24; // preto pré-multiplicadodiff --git a/src/janelas/macjanela.cpp b/src/janelas/macjanela.cppindex 5d8edfc..21aafdc 100644--- a/src/janelas/macjanela.cpp+++ b/src/janelas/macjanela.cpp@@ -47,6 +47,9 @@ const wchar_t* PROP = L"MacJanela"; // janela já tratadaconst wchar_t* PROP_MENU = L"MacJanelaMenu"; // a barra de menus guardada (a barra do Shell lê daqui)const UINT_PTR SUBCLASS_ID = 0x4D41434A;UINT g_msgTile; // "MacJanelaEncaixar": reaplica o encaixe logo depois do fim do arrasto+// carregada pelo próprio app do WacOS (WacOSPropria, barra_mac.h), não pelo gancho do Shell: a barra é do app e+// o "desfazer" do Shell (ao sair) não vale aqui+bool g_proprio = false;UINT g_msgUndo, g_msgZoom; // Zoom: "MacJanelaAmpliar" (o Shell manda no Win+↑/↓; a DLL usa para converter o maximizar)ID2D1Factory* g_d2d;IDWriteFactory* g_dw;@@ -1068,6 +1071,7 @@ LRESULT CALLBACK OwnerProc(HWND h, UINT m, WPARAM w, LPARAM l, UINT_PTR, DWORD_PSetPropW(h, L"MacJanelaPintando", (HANDLE)2);SetTimer(h, 0x4D50, 34, UncloakShown);}+ if (m == g_msgUndo && g_proprio) return 1; // app do WacOS: a barra fica (o Shell saindo não a tira)if (m == g_msgUndo) { StopShowHook(); Detach(h, in); return 1; }static UINT msgSettings = RegisterWindowMessageW(L"ShellAjustesMudaram"); // tema trocado (Leopard, Tahoe…): redesenha jáif (m == msgSettings && msgSettings) {@@ -1462,6 +1466,7 @@ void CantoLeve(HWND h) {LRESULT CALLBACK LeveProc(HWND h, UINT m, WPARAM w, LPARAM l, UINT_PTR, DWORD_PTR) {static UINT msgShow = RegisterWindowMessageW(L"MacJanelaMostrar");+ if (m == g_msgUndo && g_msgUndo && g_proprio) return DefSubclassProc(h, m, w, l);if (m == g_msgUndo && g_msgUndo && GetPropW(h, PROP_CANTO)) { SetWindowRgn(h, nullptr, TRUE); RemovePropW(h, PROP_CANTO); }if (m == WM_NCDESTROY) { RemovePropW(h, PROP_CANTO); RemovePropW(h, L"MacJanelaCantoB"); }if (m == WM_WINDOWPOSCHANGED && l && !(((WINDOWPOS*)l)->flags & SWP_NOSIZE)) CantoLeve(h);@@ -1742,6 +1747,24 @@ extern "C" __declspec(dllexport) LRESULT CALLBACK GetMsgProc(int code, WPARAM w,return CallNextHookEx(nullptr, code, w, l);}+// Os apps do WacOS que não desenham os próprios botões (app2d.h, Pré-Visualização) carregam esta DLL eles mesmos+// (src\comumarra_mac.h) e chamam esta entrada na thread da interface, antes de criar a janela: o mesmo gancho+// do Shell, mas posto pelo próprio app só na thread dele e sem módulo (não ocupa lugar na lista de DLLs de gancho+// do Windows). Assim a barra é igual com e sem o Shell aberto.+extern "C" __declspec(dllexport) BOOL WINAPI WacOSPropria() {+ if (g_proprio) return TRUE;+ g_proprio = true;+ if (!g_msgUndo) g_msgUndo = RegisterWindowMessageW(L"MacJanelaDesfazer");+ if (!g_msgZoom) g_msgZoom = RegisterWindowMessageW(L"MacJanelaAmpliar");+ if (!g_msgTile) g_msgTile = RegisterWindowMessageW(L"MacJanelaEncaixar");+ DWORD tid = GetCurrentThreadId();+ HHOOK hk = SetWindowsHookExW(WH_GETMESSAGE, GetMsgProc, nullptr, tid);+ // o gancho do WM_SHOWWINDOW já agora: a janela principal nasce com a barra do Mac (sem esperar a 1ª mensagem)+ if (g_tlsShow != TLS_OUT_OF_INDEXES && !TlsGetValue(g_tlsShow))+ TlsSetValue(g_tlsShow, SetWindowsHookExW(WH_CALLWNDPROCRET, ShowProc, nullptr, tid));+ return hk != nullptr;+}+// Programas de 32 bits: o Shell é de 64 bits e um gancho só carrega DLL da mesma arquitetura. Então o Shell// abre o rundll32.exe de 32 bits do próprio Windows (SysWOW64) com esta DLL, entrada WacOSHost: ela fica lá// esperando os pedidos do Shell ("ponha a barra de título do Mac na thread X") e sai quando o Shell manda.diff --git a/src/monitor/main.cpp b/src/monitor/main.cppindex 9aef4bc..bfe0ba9 100644--- a/src/monitor/main.cpp+++ b/src/monitor/main.cpp@@ -42,6 +42,8 @@#include "../comum/idioma.h"#include "../comum/pressao.h" // pressão de memória como a do Mac (a mesma conta do Shell)#include "../comum/semaforo.h"+#include "../comum/leopard.h" // tema Mac OS X: o metal da barra unificada+#define LEO (semaforo::Leopard())// Peças do Finder (src/finder): desenho com alfa real (Direct2D sobre DirectComposition), a janela do// Tahoe com cantos de 26 pt e vidro da Composição, e a sombra própria que segue o canto redondo. As mesmas@@ -580,6 +582,10 @@ Pal Colors() { // Tahoe: o fundo da janela leva 10 % da cor do papel de paredereturn p;}Pal ColorsBase() {+ // Mac OS X (Leopard): fundo branco, listras azul-acinzentadas bem claras, seleção azul do Aqua, painel de metal claro+ if (LEO) return { D2D1::ColorF(1, 1, 1), D2D1::ColorF(0.80f, 0.80f, 0.80f), D2D1::ColorF(0, 0, 0, 0.90f), D2D1::ColorF(0, 0, 0, 0.55f),+ D2D1::ColorF(0, 0, 0, 0.15f), D2D1::ColorF(243 / 255.f, 246 / 255.f, 250 / 255.f), D2D1::ColorF(0.89f, 0.89f, 0.89f), D2D1::ColorF(1, 1, 1),+ D2D1::ColorF(56 / 255.f, 117 / 255.f, 215 / 255.f), D2D1::ColorF(1, 1, 1), D2D1::ColorF(0.55f, 0.55f, 0.56f), D2D1::ColorF(1, 1, 1) };if (g_tahoe) { // a barra e o painel são o próprio fundo; cápsulas de vidro claras por cimaif (g_dark) return { D2D1::ColorF(0.110f, 0.110f, 0.118f), D2D1::ColorF(0.110f, 0.110f, 0.118f), D2D1::ColorF(1, 1, 1, 0.90f), D2D1::ColorF(1, 1, 1, 0.50f),D2D1::ColorF(1, 1, 1, 0.10f), D2D1::ColorF(1, 1, 1, 0.045f), D2D1::ColorF(0.110f, 0.110f, 0.118f), D2D1::ColorF(1, 1, 1, 0.035f),@@ -740,13 +746,22 @@ std::vector<std::pair<float, float>> ColSpans() { // (esquerda, direita) de cad// pílula 1: Encerrar (273) e Informações (307,5); pílula 2: Ações (354,5) com a setinha (371)const D2D1_RECT_F PILL_A{ 282, PILL_TOP, 350, PILL_TOP + PILL_H }, PILL_B{ 362, PILL_TOP, 406, PILL_TOP + PILL_H }; // medidas do TahoeD2D1_RECT_F BtnRect(int k) { // área de clique de cada botão+ // Mac OS X: na linha de ferramentas (embaixo do título de 22): Encerrar, Informações e a engrenagem ▾ em molduras de metal+ if (LEO) return k == 0 ? D2D1_RECT_F{ 12, 26, 44, 48 } : k == 1 ? D2D1_RECT_F{ 50, 26, 82, 48 } : D2D1_RECT_F{ 88, 26, 128, 48 };if (k == 0) return { PILL_A.left, PILL_A.top, 317, PILL_A.bottom };if (k == 1) return { 317, PILL_A.top, PILL_A.right, PILL_A.bottom };return PILL_B;}-D2D1_RECT_F SegRect(int i) { return { SEG_X + i * SEG_W, PILL_TOP, SEG_X + (i + 1) * SEG_W, PILL_TOP + SEG_H }; }-D2D1_RECT_F SearchRect() { auto s = Client(); float r = s.width - 8; return { std::max(SEG_X + SEG_W * T_COUNT + 10, r - SEARCH_W), PILL_TOP, r, PILL_TOP + PILL_H }; }-D2D1_POINT_2F LightCenter(int k) { return { 26.f + k * 23, 25 }; } // como na referência+D2D1_RECT_F SegRect(int i) {+ if (LEO) { float w = 62, x0 = std::round(Client().width / 2 - w * T_COUNT / 2); return { x0 + i * w, 27, x0 + (i + 1) * w, 47 }; } // Mac OS X: abas no meio+ return { SEG_X + i * SEG_W, PILL_TOP, SEG_X + (i + 1) * SEG_W, PILL_TOP + SEG_H };+}+D2D1_RECT_F SearchRect() {+ auto s = Client();+ if (LEO) return { s.width - 12 - 130, 27, s.width - 12, 47 };+ float r = s.width - 8; return { std::max(SEG_X + SEG_W * T_COUNT + 10, r - SEARCH_W), PILL_TOP, r, PILL_TOP + PILL_H };+}+D2D1_POINT_2F LightCenter(int k) { return LEO ? D2D1_POINT_2F{ 14.5f + k * 21, 11 } : D2D1_POINT_2F{ 26.f + k * 23, 25 }; } // como na referência// ---- desenhovoid Line(ID2D1RenderTarget* rt, ID2D1Brush* b, float x1, float y1, float x2, float y2, float w = 1.4f) { rt->DrawLine({ x1, y1 }, { x2, y2 }, b, w); }@@ -771,7 +786,97 @@ void DrawLights(ID2D1RenderTarget* rt, ID2D1SolidColorBrush* br) {}}+void Grad(ID2D1RenderTarget* rt, D2D1_RECT_F r, float rad, std::initializer_list<D2D1_GRADIENT_STOP> st) {+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;+ if (SUCCEEDED(rt->CreateGradientStopCollection(st.begin(), (UINT32)st.size(), &gs)) &&+ SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, r.top }, { 0, r.bottom }), gs, &lb)))+ rt->FillRoundedRectangle(D2D1::RoundedRect(r, rad, rad), lb);+ if (lb) lb->Release();+ if (gs) gs->Release();+}+// Mac OS X: a barra unificada de metal (título de 22 no meio e a linha de ferramentas embaixo)+void DrawToolbarLeopard(ID2D1RenderTarget* rt, ID2D1SolidColorBrush* br, const Pal& pal) {+ auto s = Client();+ leopard::Metal(rt, D2D1::RectF(0, 0, s.width, TOOLBAR_H), g_active, false, true, 0);+ DrawLights(rt, br);+ static IDWriteTextFormat* tt = [] {+ IDWriteTextFormat* f = nullptr;+ g_dw->CreateTextFormat(L"Lucida Sans Unicode", nullptr, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 13, L"pt-br", &f);+ if (f) { f->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER); f->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER); f->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP); }+ return f;+ }();+ std::wstring title = Tr(L"Monitor de Atividade") + std::wstring(L" (") + Tr(L"Todos os Processos") + L")";+ Text(rt, br, title, tt, D2D1::RectF(80, 0, s.width - 80, 22), D2D1::ColorF(0, 0, 0, g_active ? 0.85f : 0.45f));+ auto bezel = [&](D2D1_RECT_F r, bool down) { // moldura de metal clara dos botões do 10.5+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.45f));+ rt->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left, r.top + 1, r.right, r.bottom + 1), 4, 4), br);+ if (down) Grad(rt, r, 4, { { 0, D2D1::ColorF(0.50f, 0.50f, 0.51f) }, { 1, D2D1::ColorF(0.66f, 0.66f, 0.67f) } });+ else Grad(rt, r, 4, { { 0, D2D1::ColorF(0.99f, 0.99f, 0.99f) }, { 1, D2D1::ColorF(0.84f, 0.84f, 0.84f) } });+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.42f));+ rt->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 0.5f, r.top + 0.5f, r.right - 0.5f, r.bottom - 0.5f), 3.5f, 3.5f), br, 1);+ };+ bool sel = Selected() != nullptr;+ for (int k = 0; k < 3; k++) {+ auto r = BtnRect(k);+ bezel(r, false);+ bool en = k == 2 || sel;+ br->SetColor(D2D1::ColorF(0.1f, 0.1f, 0.1f, en ? 0.85f : 0.30f));+ float cx = k == 2 ? r.left + 15 : (r.left + r.right) / 2, cy = (r.top + r.bottom) / 2;+ if (k == 0) { // o círculo com o X (Encerrar Processo)+ rt->FillEllipse(D2D1::Ellipse({ cx, cy }, 7, 7), br);+ br->SetColor(D2D1::ColorF(0.95f, 0.95f, 0.95f));+ Line(rt, br, cx - 3, cy - 3, cx + 3, cy + 3, 1.6f); Line(rt, br, cx - 3, cy + 3, cx + 3, cy - 3, 1.6f);+ } else if (k == 1) { // o "i" num círculo+ rt->FillEllipse(D2D1::Ellipse({ cx, cy }, 7, 7), br);+ br->SetColor(D2D1::ColorF(0.95f, 0.95f, 0.95f));+ rt->FillEllipse(D2D1::Ellipse({ cx, cy - 3.3f }, 1.1f, 1.1f), br);+ Line(rt, br, cx, cy - 0.8f, cx, cy + 3.8f, 1.7f);+ } else { // a engrenagem ▾+ for (int i = 0; i < 8; i++) { float a = i * 3.14159265f / 4; Line(rt, br, cx + std::cos(a) * 4.8f, cy + std::sin(a) * 4.8f, cx + std::cos(a) * 7.2f, cy + std::sin(a) * 7.2f, 2.2f); }+ rt->FillEllipse(D2D1::Ellipse({ cx, cy }, 5, 5), br);+ br->SetColor(D2D1::ColorF(0.9f, 0.9f, 0.9f)); rt->FillEllipse(D2D1::Ellipse({ cx, cy }, 1.8f, 1.8f), br);+ br->SetColor(D2D1::ColorF(0.1f, 0.1f, 0.1f, 0.85f));+ float ax = r.right - 10;+ Line(rt, br, ax - 3, cy - 1.5f, ax, cy + 1.5f, 1.6f); Line(rt, br, ax, cy + 1.5f, ax + 3, cy - 1.5f, 1.6f);+ }+ }+ // as abas: controle segmentado de metal, a escolhida afundada+ D2D1_RECT_F all{ SegRect(0).left, SegRect(0).top, SegRect(T_COUNT - 1).right, SegRect(0).bottom };+ bezel(all, false);+ {+ auto r = SegRect(g_tab);+ Grad(rt, D2D1::RectF(r.left + 0.5f, r.top + 0.5f, r.right - 0.5f, r.bottom - 0.5f), g_tab == 0 || g_tab == T_COUNT - 1 ? 3.f : 0.f,+ { { 0, D2D1::ColorF(0.52f, 0.52f, 0.53f) }, { 1, D2D1::ColorF(0.68f, 0.68f, 0.69f) } });+ }+ static IDWriteTextFormat* ts = [] {+ IDWriteTextFormat* f = nullptr;+ g_dw->CreateTextFormat(L"Lucida Sans Unicode", nullptr, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 12, L"pt-br", &f);+ if (f) { f->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER); f->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER); f->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP); }+ return f;+ }();+ for (int i = 0; i < T_COUNT; i++) {+ auto r = SegRect(i);+ if (i + 1 < T_COUNT) { br->SetColor(D2D1::ColorF(0, 0, 0, 0.30f)); Line(rt, br, std::floor(r.right) + 0.5f, r.top + 1, std::floor(r.right) + 0.5f, r.bottom - 1, 1); }+ Text(rt, br, TAB_NAMES[i], ts, r, i == g_tab ? D2D1::ColorF(1, 1, 1) : D2D1::ColorF(0, 0, 0, 0.88f));+ }+ // a busca: o campo branco redondo afundado com a lupa ▾+ auto sr = SearchRect();+ float rad = (sr.bottom - sr.top) / 2;+ br->SetColor(D2D1::ColorF(1, 1, 1));+ rt->FillRoundedRectangle(D2D1::RoundedRect(sr, rad, rad), br);+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.12f));+ rt->FillRectangle(D2D1::RectF(sr.left + rad, sr.top + 1, sr.right - rad, sr.top + 3), br);+ br->SetColor(g_searchFocus ? D2D1::ColorF(0.36f, 0.60f, 0.95f, 0.9f) : D2D1::ColorF(0, 0, 0, 0.45f));+ rt->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(sr.left + 0.5f, sr.top + 0.5f, sr.right - 0.5f, sr.bottom - 0.5f), rad - 0.5f, rad - 0.5f), br, g_searchFocus ? 2.f : 1.f);+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.6f));+ float mx = sr.left + 12, my = (sr.top + sr.bottom) / 2 - 1;+ rt->DrawEllipse(D2D1::Ellipse({ mx, my }, 4, 4), br, 1.4f);+ Line(rt, br, mx + 2.8f, my + 2.8f, mx + 5.5f, my + 5.5f, 1.6f);+ Text(rt, br, g_search + (g_searchFocus && GetTickCount() / 530 % 2 == 0 ? L"|" : L""), g_f13, D2D1::RectF(sr.left + 24, sr.top, sr.right - 10, sr.bottom), pal.text);+}+void DrawToolbar(ID2D1RenderTarget* rt, ID2D1SolidColorBrush* br, const Pal& pal) {+ if (LEO) { DrawToolbarLeopard(rt, br, pal); return; }auto s = Client();br->SetColor(pal.bar);rt->FillRectangle(D2D1::RectF(0, 0, s.width, TOOLBAR_H), br);@@ -868,6 +973,13 @@ void DrawHeader(ID2D1RenderTarget* rt, ID2D1SolidColorBrush* br, const Pal& pal)br->SetColor(pal.bg);rt->FillRectangle(D2D1::RectF(0, TOOLBAR_H, s.width, TOOLBAR_H + HEADER_H), br);auto spans = ColSpans();+ if (LEO) { // Mac OS X: cabeçalho branco com degradê, a coluna da ordem em azul claro do Aqua+ Grad(rt, D2D1::RectF(0, TOOLBAR_H, s.width, TOOLBAR_H + HEADER_H), 0, { { 0, D2D1::ColorF(1, 1, 1) }, { 1, D2D1::ColorF(0.90f, 0.90f, 0.90f) } });+ int sc = g_sortCol[g_tab];+ if (sc >= 0 && sc < (int)spans.size())+ Grad(rt, D2D1::RectF(spans[sc].first, TOOLBAR_H, spans[sc].second, TOOLBAR_H + HEADER_H), 0,+ { { 0, D2D1::ColorF(0.80f, 0.89f, 0.99f) }, { 0.5f, D2D1::ColorF(0.64f, 0.79f, 0.97f) }, { 1, D2D1::ColorF(0.74f, 0.86f, 0.99f) } });+ }for (size_t i = 0; i < COLS[g_tab].size(); i++) {const Col& c = COLS[g_tab][i];bool sorted = (int)i == g_sortCol[g_tab];@@ -1297,7 +1409,8 @@ LRESULT HitTestNC(HWND h, LPARAM l) {}D2D1_POINT_2F p{ pt.x / sc, pt.y / sc };if (p.y < TOOLBAR_H && g_sheet == SH_NONE) {- bool control = (p.x < 82) || In(SearchRect(), p) || In(PILL_A, p) || In(PILL_B, p) || (p.x >= SEG_X && p.x < SEG_X + T_COUNT * SEG_W);+ bool control = (p.x < 82 && (!LEO || p.y < 22)) || In(SearchRect(), p) || In(BtnRect(0), p) || In(BtnRect(1), p) || In(BtnRect(2), p) ||+ (LEO ? (p.x >= SegRect(0).left && p.x < SegRect(T_COUNT - 1).right && p.y >= 22) : (p.x >= SEG_X && p.x < SEG_X + T_COUNT * SEG_W));for (int k = 0; k < 3; k++) if (In(BtnRect(k), p)) control = true;if (!control) return HTCAPTION;}diff --git a/src/notas/editor.cpp b/src/notas/editor.cppindex 3f4e5fa..d8a2aae 100644--- a/src/notas/editor.cpp+++ b/src/notas/editor.cpp@@ -7,6 +7,7 @@#include <algorithm>#include <cmath>#include "../comum/simbolos.h"+#include "../comum/semaforo.h" // tema Leopard: o papel amarelo pautado das Notas do 10.5using editor::Pos;@@ -387,6 +388,19 @@ void Draw(ID2D1DeviceContext* dc, D2D1_RECT_F a) {dc->PushAxisAlignedClip(a, D2D1_ANTIALIAS_MODE_ALIASED);ID2D1SolidColorBrush* br = nullptr;dc->CreateSolidColorBrush(TextColor(), &br);+ if (semaforo::Leopard()) {+ // Leopard: o bloco amarelo das Notas do Mail — amarelo-claro, as pautas finas a cada 24 (rolam com o texto) e a+ // margem dupla avermelhada à esquerda+ br->SetColor(D2D1::ColorF(1, 0.976f, 0.73f));+ dc->FillRectangle(a, br);+ br->SetColor(D2D1::ColorF(0.55f, 0.62f, 0.80f, 0.35f));+ float y0 = a.top + 40 - std::fmod(scrollY, 24.f);+ for (float y = y0; y < a.bottom; y += 24) dc->DrawLine({ a.left, y }, { a.right, y }, br, 1);+ br->SetColor(D2D1::ColorF(0.85f, 0.35f, 0.30f, 0.45f));+ dc->DrawLine({ a.left + 10, a.top }, { a.left + 10, a.bottom }, br, 1);+ dc->DrawLine({ a.left + 13, a.top }, { a.left + 13, a.bottom }, br, 1);+ br->SetColor(TextColor());+ }// data no alto, centralizada e cinza{diff --git a/src/notas/main.cpp b/src/notas/main.cppindex ee2633f..f1b1b0c 100644--- a/src/notas/main.cpp+++ b/src/notas/main.cpp@@ -22,6 +22,7 @@#include "../comum/ampliacao.h" // botão verde com a animação do ampliar do Shell#include "../comum/idioma.h"#include "../comum/semaforo.h"+#include "../comum/leopard.h" // tema Mac OS X Leopard: a barra de metal e a barra lateral azul-acinzentada#pragma comment(lib, "imm32.lib")#pragma comment(lib, "windowscodecs.lib")@@ -101,6 +102,13 @@ float ToolStart() { return g_sideHidden ? 128.f : SideW(); } // onde começam o// ---- coresstruct Pal { D2D1_COLOR_F side, list, editor, text, text2, text3, line, sel, selFocus, icon, iconOff, hover, field; };Pal Colors() {+ // Leopard (as Notas do Mail do 10.5): barra lateral azul-acinzentada, lista branca com a seleção azul do Aqua; o papel+ // amarelo pautado é desenhado pelo editor (editor.cpp)+ if (semaforo::Leopard())+ return { leopard::Sidebar(true, false), D2D1::ColorF(1, 1, 1), D2D1::ColorF(1, 0.98f, 0.76f),+ D2D1::ColorF(0, 0, 0, 0.90f), D2D1::ColorF(0, 0, 0, 0.55f), D2D1::ColorF(0, 0, 0, 0.30f), D2D1::ColorF(0, 0, 0, 0.12f),+ D2D1::ColorF(0.83f, 0.83f, 0.83f), D2D1::ColorF(56 / 255.f, 117 / 255.f, 215 / 255.f), D2D1::ColorF(0, 0, 0, 0.60f), D2D1::ColorF(0, 0, 0, 0.22f),+ D2D1::ColorF(0, 0, 0, 0.06f), D2D1::ColorF(1, 1, 1) };if (g_dark) return { D2D1::ColorF(0, 0, 0, 0.22f), D2D1::ColorF(0.157f, 0.157f, 0.165f), D2D1::ColorF(0.118f, 0.118f, 0.122f),D2D1::ColorF(1, 1, 1, 0.88f), D2D1::ColorF(1, 1, 1, 0.50f), D2D1::ColorF(1, 1, 1, 0.30f), D2D1::ColorF(1, 1, 1, 0.09f),D2D1::ColorF(1, 1, 1, 0.13f), D2D1::ColorF(0.60f, 0.47f, 0.07f), D2D1::ColorF(1, 1, 1, 0.58f), D2D1::ColorF(1, 1, 1, 0.22f),@@ -823,6 +831,7 @@ void Render(ID2D1DeviceContext* dc) {if (!g_sideHidden) dc->FillRectangle(D2D1::RectF(SideW() - 0.5f, 0, SideW() + 0.5f, c.height), br);if (!g_gallery) dc->FillRectangle(D2D1::RectF(ListR() - 0.5f, 0, ListR() + 0.5f, c.height), br);if (g_listScroll > 0 && !g_gallery) { br->SetColor(pal.line); dc->FillRectangle(D2D1::RectF(ListL(), TOOLBAR_H - 0.5f, ListR(), TOOLBAR_H + 0.5f), br); }+ if (semaforo::Leopard()) leopard::Metal(dc, D2D1::RectF(0, 0, c.width, TOOLBAR_H), GetForegroundWindow() == g_hwnd, false, true, 0); // a barra unificada de metalDrawSidebar(dc, br, pal);DrawLights(dc, br);DrawToolbarButtons(dc, br, pal);@@ -1321,7 +1330,7 @@ LRESULT CALLBACK WndProc(HWND h, UINT m, WPARAM w, LPARAM l) {if (l && !wcscmp((const wchar_t*)l, L"ImmersiveColorSet")) {DWORD v = 1, cb = sizeof(v);RegGetValueW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", L"AppsUseLightTheme", RRF_RT_REG_DWORD, nullptr, &v, &cb);- g_dark = v == 0;+ g_dark = v == 0 && !semaforo::Leopard();BOOL dm = g_dark; DwmSetWindowAttribute(h, 20, &dm, sizeof(dm));COLORREF border = g_dark ? RGB(88, 88, 92) : RGB(196, 196, 200); DwmSetWindowAttribute(h, 34, &border, sizeof(border));editor::SetDark(g_dark);@@ -1689,7 +1698,7 @@ void CreateFormats() {if (g_fThumbT) g_fThumbT->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_NEAR);if (g_fThumb) g_fThumb->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_NEAR);g_fFmt[S_TITLE] = Fmt(19, B); g_fFmt[S_HEADING] = Fmt(15.5f, B); g_fFmt[S_SUBHEADING] = Fmt(13, B); g_fFmt[S_BODY] = Fmt(13, N); g_fFmt[S_MONO] = Fmt(12, N, DWRITE_TEXT_ALIGNMENT_LEADING, g_mono);- editor::SetFormats(g_family, g_mono);+ editor::SetFormats(semaforo::Leopard() ? std::wstring(L"Segoe Print") : g_family, g_mono); // Leopard: a letra manuscrita das notas (Marker Felt no Mac)}HICON PackIcon(const std::wstring& png, int px) {@@ -1854,6 +1863,7 @@ int WINAPI wWinMain(HINSTANCE hi, HINSTANCE, PWSTR, int show) {DWORD v = 1, cb = sizeof(v);RegGetValueW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", L"AppsUseLightTheme", RRF_RT_REG_DWORD, nullptr, &v, &cb);g_dark = forceDark >= 0 ? forceDark == 1 : v == 0;+ if (semaforo::Leopard()) g_dark = false; // o 10.5 não tinha modo escuroeditor::SetDark(g_dark);store::Load();if (!g_capture && !g_quick) {diff --git a/src/preview/main.cpp b/src/preview/main.cppindex 3bb0bfb..ad63901 100644--- a/src/preview/main.cpp+++ b/src/preview/main.cpp@@ -29,6 +29,7 @@#include <thread>#include <vector>#include "../comum/semaforo.h" // semaforo::Aqua(): tema macOS Golden Gate+#include "../comum/barra_mac.h" // os três botões do Mac (WacOSWindow.dll), com ou sem o Shell#include <winrt/Windows.Foundation.h>#include <winrt/Windows.Data.Pdf.h>#include <winrt/Windows.Storage.h>@@ -1059,12 +1060,13 @@ int WINAPI wWinMain(HINSTANCE hi, HINSTANCE, PWSTR, int show) {MONITORINFO mi{ sizeof(mi) }; POINT c; GetCursorPos(&c);GetMonitorInfoW(MonitorFromPoint(c, MONITOR_DEFAULTTOPRIMARY), &mi);int W = std::min(1400L, (mi.rcWork.right - mi.rcWork.left) * 7 / 10), H = (mi.rcWork.bottom - mi.rcWork.top) * 8 / 10;+ bool mac = barramac::Ligar();g_wnd = CreateWindowExW(WS_EX_ACCEPTFILES, wc.lpszClassName, Tr(L"Pré-Visualização"), WS_OVERLAPPEDWINDOW,mi.rcWork.left + (mi.rcWork.right - mi.rcWork.left - W) / 2, mi.rcWork.top + (mi.rcWork.bottom - mi.rcWork.top - H) / 2, W, H,nullptr, nullptr, hi, nullptr);if (!g_wnd) return 1;BOOL dark = Dark(); DwmSetWindowAttribute(g_wnd, 20 /*DWMWA_USE_IMMERSIVE_DARK_MODE*/, &dark, sizeof(dark));- if (semaforo::Aqua()) { // macOS 27: barra unificada (a DLL só desenha os três botões)+ if (mac && semaforo::Aqua()) { // macOS 27: barra unificada (a DLL só desenha os três botões)g_unified = true;SetPropW(g_wnd, L"WacOSBarraUnificada", (HANDLE)(INT_PTR)52);SetWindowPos(g_wnd, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);diff --git a/src/quicktime/main.cpp b/src/quicktime/main.cppindex f3afc72..ba10504 100644--- a/src/quicktime/main.cpp+++ b/src/quicktime/main.cpp@@ -500,13 +500,14 @@ int WINAPI wWinMain(HINSTANCE hi, HINSTANCE, PWSTR, int show) {RegisterClassExW(&bc);MONITORINFO mi{ sizeof(mi) }; POINT c; GetCursorPos(&c); GetMonitorInfoW(MonitorFromPoint(c, MONITOR_DEFAULTTOPRIMARY), &mi);float s = GetDpiForSystem() / 96.f; int W = (int)(800 * s), H = (int)(480 * s);+ bool mac = barramac::Ligar(); // os três botões do Mac (WacOSWindow.dll), com ou sem o Shellwnd = CreateWindowExW(WS_EX_ACCEPTFILES, wc.lpszClassName, L"QuickTime Player", WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,mi.rcWork.left + (mi.rcWork.right - mi.rcWork.left - W) / 2, mi.rcWork.top + (mi.rcWork.bottom - mi.rcWork.top - H) / 2, W, H, nullptr, nullptr, hi, nullptr);if (!wnd) return 1;BOOL dark = TRUE; DwmSetWindowAttribute(wnd, 20, &dark, sizeof(dark)); // o QuickTime é sempre escurog_video = CreateWindowExW(WS_EX_ACCEPTFILES, vc.lpszClassName, L"", WS_CHILD | WS_VISIBLE, 0, 0, W, H, wnd, nullptr, hi, nullptr);g_bar = CreateWindowExW(WS_EX_LAYERED | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE, bc.lpszClassName, L"", WS_POPUP, 0, 0, 10, 10, wnd, nullptr, hi, nullptr);- if (semaforo::Aqua()) {+ if (mac && semaforo::Aqua()) {// a barra de título de 32 do app (a DLL só põe os três botões a 16)SetPropW(wnd, L"WacOSBarraUnificada", (HANDLE)(INT_PTR)std::lround(GG_TOP));BAR = GG_TOP;diff --git a/src/shell/ajudante.cpp b/src/shell/ajudante.cppnew file mode 100644index 0000000..d98f75f--- /dev/null+++ b/src/shell/ajudante.cpp@@ -0,0 +1,66 @@+// Modo ajudante do WacOSShell.exe: chamadas do Windows que os scripts do instalador faziam com Add-Type/DllImport+// (C# compilado na memória do PowerShell). Esse padrão, junto com o resto do instalador, fazia a análise por IA do+// Microsoft Defender acusar o pacote ("Trojan:Script/Wacatac.H!ml", Reddit 20/11/2026). Agora os scripts chamam o+// nosso exe, que faz a mesma coisa às claras e sai:+// --sair fecha o Shell aberto do jeito certo (o mesmo do Ctrl+Alt+Shift+F12) e espera até 20 s+// --aplicar-cursor avisa o Windows que o esquema de cursor do registro mudou (SPI_SETCURSORS)+// --avisar-icones avisa o Explorador que as associações e os ícones mudaram (SHCNE_ASSOCCHANGED)+// --avisar-pasta "<p>" avisa que o desktop.ini de uma pasta mudou (SHCNE_UPDATEDIR)+// --desfazer-janelas pede a cada janela com a barra do Mac que volte ao visual do Windows; o código de saída é+// quantas não responderam+// Funciona com qualquer versão do Shell aberta (só usa a janela ShellMensagens e as mensagens de sempre).+#include "shell.h"+#include <shlobj.h>++namespace {+bool Tem(const wchar_t* cmd, const wchar_t* op) { return cmd && wcsstr(cmd, op); }++int Sair() {+ HWND h = FindWindowW(L"ShellMensagens", nullptr);+ if (!h) return 0;+ DWORD pid = 0; GetWindowThreadProcessId(h, &pid);+ HANDLE ph = OpenProcess(SYNCHRONIZE, FALSE, pid);+ PostMessageW(h, WM_HOTKEY, 1, 0); // o mesmo do atalho "sair do Shell"+ DWORD r = ph ? WaitForSingleObject(ph, 20000) : WAIT_FAILED;+ if (ph) CloseHandle(ph);+ if (r == WAIT_OBJECT_0) return 0;+ for (int i = 0; i < 80 && FindWindowW(L"ShellMensagens", nullptr); i++) Sleep(250);+ return FindWindowW(L"ShellMensagens", nullptr) ? 1 : 0;+}++int DesfazerJanelas() {+ struct C { UINT msg; bool send; int n; } c{ RegisterWindowMessageW(L"MacJanelaDesfazer"), true, 0 };+ auto pass = [](C& c) {+ c.n = 0;+ EnumWindows([](HWND h, LPARAM l) -> BOOL {+ auto* c = (C*)l;+ if (GetPropW(h, L"MacJanela") || GetPropW(h, L"MacJanelaLeve")) {+ c->n++;+ if (c->send) SendMessageTimeoutW(h, c->msg, 0, 0, SMTO_ABORTIFHUNG, 3000, nullptr);+ }+ return TRUE;+ }, (LPARAM)&c);+ };+ pass(c);+ Sleep(500);+ c.send = false;+ pass(c); // as que ainda estão marcadas: não responderam (app travado)+ return c.n;+}+} // namespace++// -1: não é um pedido do modo ajudante (o Shell abre normalmente)+int AjudanteRodar(const wchar_t* cmd) {+ if (Tem(cmd, L"--sair")) return Sair();+ if (Tem(cmd, L"--aplicar-cursor")) return SystemParametersInfoW(SPI_SETCURSORS, 0, nullptr, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE) ? 0 : 1;+ if (Tem(cmd, L"--avisar-icones")) { SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nullptr, nullptr); return 0; }+ if (Tem(cmd, L"--desfazer-janelas")) return DesfazerJanelas();+ if (Tem(cmd, L"--avisar-pasta")) { // --avisar-pasta "<pasta>": o desktop.ini dela mudou (ícone da pasta)+ int n = 0; LPWSTR* a = CommandLineToArgvW(cmd, &n);+ for (int i = 1; a && i + 1 < n; i++)+ if (!wcscmp(a[i], L"--avisar-pasta")) SHChangeNotify(SHCNE_UPDATEDIR, SHCNF_PATHW | SHCNF_FLUSH, a[i + 1], nullptr);+ if (a) LocalFree(a);+ return 0;+ }+ return -1;+}diff --git a/src/shell/backdrop.cpp b/src/shell/backdrop.cppindex f08a85c..12fc8ac 100644--- a/src/shell/backdrop.cpp+++ b/src/shell/backdrop.cpp@@ -947,7 +947,7 @@ void Dump() {void Poll(bool refresh) {static HWINEVENTHOOK fg = SetWinEventHook(EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND, nullptr, OnWinChange, 0, 0, WINEVENT_OUTOFCONTEXT);static HWINEVENTHOOK ch = SetWinEventHook(EVENT_OBJECT_DESTROY, EVENT_OBJECT_REORDER, nullptr, OnWinChange, 0, 0, WINEVENT_OUTOFCONTEXT | shell::SemProprio());- static HWINEVENTHOOK mv = SetWinEventHook(EVENT_OBJECT_LOCATIONCHANGE, EVENT_OBJECT_LOCATIONCHANGE, nullptr, OnWinChange, 0, 0, WINEVENT_OUTOFCONTEXT | shell::SemProprio());+ static bool mv = (jogo::GanchoPosicao(OnWinChange, WINEVENT_OUTOFCONTEXT | shell::SemProprio()), true); // sai no modo jogo (jogo.cpp)(void)fg; (void)ch; (void)mv;if (g_busy) { capDirty = true; return; } // chamada de dentro dela mesma: o temporizador pega depoisg_busy = true;@@ -1380,6 +1380,8 @@ void backdrop::Reload() {s.refraction = std::clamp(s.refraction, 0.f, 1.f);s.tintK = std::clamp(s.tintK, 0.f, 1.f);s.real = s.liquid && !s.reduce && shell::Setting(L"vidro_real", L"1") == L"1" && !rg::semCaptura; // aparece nas gravações (montado pelas janelas)+ // modo jogo (jogo.cpp): o vidro real remontava o fundo a cada quadro do jogo atrás das peças; fica o vidro comum+ if (jogo::Ativo()) s.real = false;g_style = s;if (g_comp) rg::SetActive(s.real);// menus (barra de menus, Dock, Central): mais opacos que os painéis, para ler bemdiff --git a/src/shell/cantos.cpp b/src/shell/cantos.cppindex 00e354d..6a4c67f 100644--- a/src/shell/cantos.cpp+++ b/src/shell/cantos.cpp@@ -70,8 +70,15 @@ void CALLBACK Tick(HWND, UINT, UINT_PTR, DWORD) {} // namespace+static UINT_PTR g_timer; // sem janela: o Windows dá o número do temporizador (o T_CANTO é ignorado)void cantos::Start() {- SetTimer(nullptr, T_CANTO, 50, Tick);+ g_timer = SetTimer(nullptr, T_CANTO, 50, Tick);+}++// modo jogo (jogo.cpp): sem ler o ponteiro 20 vezes por segundo enquanto o jogo roda+void cantos::Pausar(bool p) {+ if (p && g_timer) { KillTimer(nullptr, g_timer); g_timer = 0; }+ else if (!p && !g_timer) g_timer = SetTimer(nullptr, T_CANTO, 50, Tick);}bool cantos::NotaRapida() { return ActionOf(3) == L"nota"; }diff --git a/src/shell/central.cpp b/src/shell/central.cppindex 8fa5c8a..23d5485 100644--- a/src/shell/central.cpp+++ b/src/shell/central.cpp@@ -602,6 +602,11 @@ void Key(WORD vk, bool up) {// ================= desenhostruct Pal { D2D1_COLOR_F tint, tile, tileLine, text, text2, off, offGlyph, track, fill, knobIcon; };Pal Colors() {+ // Leopard: o branco dos menus do 10.5 (sempre claro), texto preto em Lucida, grupos em caixas cinza+ if (liquid::Leopard())+ return { D2D1::ColorF(1, 1, 1, 0.96f), D2D1::ColorF(0, 0, 0, 0.045f), D2D1::ColorF(0, 0, 0, 0.16f), D2D1::ColorF(0, 0, 0, 0.92f),+ D2D1::ColorF(0, 0, 0, 0.55f), D2D1::ColorF(1, 1, 1, 1), D2D1::ColorF(0.25f, 0.25f, 0.27f, 1), D2D1::ColorF(0, 0, 0, 0.2f),+ D2D1::ColorF(0.24f, 0.47f, 0.87f, 1), D2D1::ColorF(0, 0, 0, 0.6f) };if (ui::Dark())return { D2D1::ColorF(0.11f, 0.11f, 0.12f, 0.42f), D2D1::ColorF(1, 1, 1, 0.09f), D2D1::ColorF(1, 1, 1, 0.10f), D2D1::ColorF(1, 1, 1, 0.94f),D2D1::ColorF(1, 1, 1, 0.55f), D2D1::ColorF(1, 1, 1, 0.16f), D2D1::ColorF(1, 1, 1, 0.9f), D2D1::ColorF(1, 1, 1, 0.14f),@@ -625,7 +630,48 @@ void Sym(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const wchar_t* name,dc->DrawTextW(&g, 1, g_tfGlyph, D2D1::RectF(cx - s / 2, cy - s / 2, cx + s / 2, cy + s / 2), br);}-float PanelR() { return liquid::On() ? 26.f : RADIUS; } // Tahoe: painel bem mais redondo+float PanelR() { return liquid::On() ? 26.f : liquid::Leopard() ? 6.f : RADIUS; } // Tahoe: painel bem mais redondo; Leopard: o canto do menu++// ---- Mac OS X Leopard: peças do Aqua desenhadas aqui (o 10.5 não tinha Central de Controle; ela vira um menu da+// barra no estilo da época: fundo branco de menu, caixas de grupo cinza, botões redondos em gel e controles+// deslizantes com a trilha azul)+void LeoGrad(ID2D1DeviceContext* dc, D2D1_RECT_F r, float rad, const D2D1_GRADIENT_STOP* st, UINT n, bool ellipse = false) {+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;+ if (SUCCEEDED(dc->CreateGradientStopCollection(st, n, &gs)) &&+ SUCCEEDED(dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, r.top }, { 0, r.bottom }), gs, &lb))) {+ if (ellipse) dc->FillEllipse(D2D1::Ellipse({ (r.left + r.right) / 2, (r.top + r.bottom) / 2 }, (r.right - r.left) / 2, (r.bottom - r.top) / 2), lb);+ else dc->FillRoundedRectangle(D2D1::RoundedRect(r, rad, rad), lb);+ }+ if (lb) lb->Release();+ if (gs) gs->Release();+}+// gel do Aqua: azul (ligado) ou perolado (desligado), com o brilho forte na metade de cima+void LeoGel(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F r, float rad, bool blue, bool ellipse = false) {+ D2D1_GRADIENT_STOP st[4] = { { 0, blue ? D2D1::ColorF(0.66f, 0.80f, 0.98f) : D2D1::ColorF(1, 1, 1) },+ { 0.5f, blue ? D2D1::ColorF(0.38f, 0.60f, 0.93f) : D2D1::ColorF(0.94f, 0.94f, 0.94f) },+ { 0.5f, blue ? D2D1::ColorF(0.22f, 0.45f, 0.86f) : D2D1::ColorF(0.86f, 0.86f, 0.86f) },+ { 1, blue ? D2D1::ColorF(0.56f, 0.80f, 1.0f) : D2D1::ColorF(0.98f, 0.98f, 0.98f) } };+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.10f)); // a sombrinha embaixo+ if (ellipse) dc->FillEllipse(D2D1::Ellipse({ (r.left + r.right) / 2, (r.top + r.bottom) / 2 + 1 }, (r.right - r.left) / 2, (r.bottom - r.top) / 2), br);+ else dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left, r.top + 1, r.right, r.bottom + 1), rad, rad), br);+ LeoGrad(dc, r, rad, st, 4, ellipse);+ br->SetColor(blue ? D2D1::ColorF(0.12f, 0.27f, 0.58f, 0.9f) : D2D1::ColorF(0, 0, 0, 0.40f));+ D2D1_RECT_F e = D2D1::RectF(r.left + 0.5f, r.top + 0.5f, r.right - 0.5f, r.bottom - 0.5f);+ if (ellipse) dc->DrawEllipse(D2D1::Ellipse({ (e.left + e.right) / 2, (e.top + e.bottom) / 2 }, (e.right - e.left) / 2, (e.bottom - e.top) / 2), br, 1);+ else dc->DrawRoundedRectangle(D2D1::RoundedRect(e, rad - 0.5f, rad - 0.5f), br, 1);+}+IDWriteTextFormat* LeoFmt(float size, bool bold, bool center = false) {+ auto* f = ui::FormatFace(L"Lucida Sans Unicode", size, bold ? DWRITE_FONT_WEIGHT_BOLD : DWRITE_FONT_WEIGHT_NORMAL);+ if (f) {+ f->SetWordWrapping(center ? DWRITE_WORD_WRAPPING_WRAP : DWRITE_WORD_WRAPPING_NO_WRAP);+ if (center) f->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER);+ DWRITE_TRIMMING t{ DWRITE_TRIMMING_GRANULARITY_CHARACTER, 0, 0 };+ IDWriteInlineObject* dots = nullptr; ui::dw->CreateEllipsisTrimmingSign(f, &dots);+ f->SetTrimming(&t, dots);+ if (dots) dots->Release();+ }+ return f;+}void Tile(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const Pal& p, D2D1_RECT_F r) {if (liquid::On()) { // Tahoe: módulos em cápsulas de vidro (meia altura até 24 pt)@@ -636,6 +682,15 @@ void Tile(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const Pal& p, D2D1_Rliquid::Tile(dc, r, rad, ui::Dark());return;}+ if (liquid::Leopard()) { // caixa de grupo do 10.5: cinza bem claro afundado, fio mais escuro em cima+ br->SetColor(p.tile);+ dc->FillRoundedRectangle(D2D1::RoundedRect(r, 5, 5), br);+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.13f));+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 0.5f, r.top + 0.5f, r.right - 0.5f, r.bottom - 0.5f), 4.5f, 4.5f), br, 1);+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.07f));+ dc->DrawLine({ r.left + 5, r.top + 1.5f }, { r.right - 5, r.top + 1.5f }, br, 1);+ return;+ }br->SetColor(p.tile);dc->FillRoundedRectangle(D2D1::RoundedRect(r, TILE_R, TILE_R), br);br->SetColor(p.tileLine);@@ -644,6 +699,12 @@ void Tile(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const Pal& p, D2D1_R// círculo de liga/desliga (azul quando ligado) com o símbolo brancovoid Circle(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const Pal& p, D2D1_POINT_2F c, float r, bool on, const wchar_t* sym, wchar_t fb, D2D1_COLOR_F onColor) {+ if (liquid::Leopard()) { // botão redondo de gel: azul ligado, perolado desligado+ LeoGel(dc, br, D2D1::RectF(c.x - r, c.y - r, c.x + r, c.y + r), r, on, true);+ float s = r * 0.58f;+ Sym(dc, br, sym, fb, D2D1::RectF(c.x - s, c.y - s, c.x + s, c.y + s), on ? D2D1::ColorF(1, 1, 1, 1) : p.offGlyph);+ return;+ }if (liquid::On() && !on) liquid::Tile(dc, D2D1::RectF(c.x - r, c.y - r, c.x + r, c.y + r), r, ui::Dark(), 1.3f); // Tahoe: círculo de vidroelse if (liquid::On()) { // Tahoe ligado: círculo branco com o símbolo na cor do controlebr->SetColor(D2D1::ColorF(1, 1, 1, 0.97f));@@ -663,6 +724,24 @@ void Circle(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const Pal& p, D2D1// controle deslizante grosso do Sequoia: trilho translúcido, parte cheia branca e botão redondo na pontavoid Slider(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const Pal& p, D2D1_RECT_F t, float v, const wchar_t* sym, wchar_t fb) {float h = t.bottom - t.top, rad = h / 2;+ if (liquid::Leopard()) {+ // controle deslizante do 10.5: símbolo pequeno à esquerda, trilha fina afundada com a parte cheia em gel azul+ // e o botão redondo perolado+ float cy = (t.top + t.bottom) / 2, s = 7;+ Sym(dc, br, sym, fb, D2D1::RectF(t.left, cy - s, t.left + 2 * s, cy + s), p.text2);+ D2D1_RECT_F tr = D2D1::RectF(t.left + 2 * s + 10, cy - 3, t.right - 4, cy + 3);+ D2D1_GRADIENT_STOP g0[2] = { { 0, D2D1::ColorF(0.62f, 0.62f, 0.64f) }, { 1, D2D1::ColorF(0.86f, 0.86f, 0.87f) } };+ LeoGrad(dc, tr, 3, g0, 2);+ float x = tr.left + std::clamp(v, 0.f, 1.f) * (tr.right - tr.left);+ if (x > tr.left + 1) {+ D2D1_GRADIENT_STOP g1[3] = { { 0, D2D1::ColorF(0.30f, 0.52f, 0.90f) }, { 0.5f, D2D1::ColorF(0.42f, 0.66f, 0.96f) }, { 1, D2D1::ColorF(0.62f, 0.82f, 1.0f) } };+ LeoGrad(dc, D2D1::RectF(tr.left, tr.top, x, tr.bottom), 3, g1, 3);+ }+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.35f));+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(tr.left + 0.5f, tr.top + 0.5f, tr.right - 0.5f, tr.bottom - 0.5f), 2.5f, 2.5f), br, 1);+ LeoGel(dc, br, D2D1::RectF(x - 8, cy - 8, x + 8, cy + 8), 8, false, true);+ return;+ }if (liquid::On()) { // Tahoe: trilho fino (4 pt) com a parte cheia branca, símbolo à esquerda, sem botão grande// guia macOS26-Theme-Reference (seções 21 e 40, medido): trilho de 219 no meio do módulo, ícones de 16 nas// duas pontas, trilho #E8E8E8 (claro) / #232323 (escuro) e a parte cheia branca@@ -725,8 +804,41 @@ void Paint() {dc->CreateLayer(nullptr, &layer);dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), nullptr, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1::IdentityMatrix(), t), layer);const float R = PanelR();- if (!g_glass) { dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(0, 0, PW, PanelH()), R, R), br); }- if (liquid::On()) {+ const bool leo = liquid::Leopard();+ // Leopard: as fontes em Lucida (trocadas só durante este desenho)+ static IDWriteTextFormat *lB = LeoFmt(13, true), *lS = LeoFmt(11, false), *lT = LeoFmt(10, false, true);+ struct Swap { IDWriteTextFormat **a, *b; ~Swap() { if (a) *a = b; } };+ Swap sw1{ leo && lB ? &g_tfBold : nullptr, g_tfBold }, sw2{ leo && lS ? &g_tfSmall : nullptr, g_tfSmall }, sw3{ leo && lT ? &g_tfTile : nullptr, g_tfTile };+ if (leo) {+ if (lB) g_tfBold = lB;+ if (lS) g_tfSmall = lS;+ if (lT) { lT->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_NEAR); lT->SetLineSpacing(DWRITE_LINE_SPACING_METHOD_UNIFORM, 12, 9.5f); g_tfTile = lT; }+ if (g_back && IsWindowVisible(g_back)) ShowWindow(g_back, SW_HIDE); // sem o vidro desfocado+ // o menu do 10.5: preso embaixo da barra (topo reto), cantos de baixo arredondados, branco quase opaco+ ID2D1Factory* fac = nullptr; dc->GetFactory(&fac);+ ID2D1PathGeometry* pg = nullptr;+ float W = PW, H = PanelH();+ if (fac && SUCCEEDED(fac->CreatePathGeometry(&pg))) {+ ID2D1GeometrySink* sk = nullptr;+ if (SUCCEEDED(pg->Open(&sk))) {+ sk->BeginFigure({ 0, 0 }, D2D1_FIGURE_BEGIN_FILLED);+ sk->AddLine({ W, 0 }); sk->AddLine({ W, H - R });+ sk->AddArc(D2D1::ArcSegment({ W - R, H }, { R, R }, 0, D2D1_SWEEP_DIRECTION_CLOCKWISE, D2D1_ARC_SIZE_SMALL));+ sk->AddLine({ R, H });+ sk->AddArc(D2D1::ArcSegment({ 0, H - R }, { R, R }, 0, D2D1_SWEEP_DIRECTION_CLOCKWISE, D2D1_ARC_SIZE_SMALL));+ sk->EndFigure(D2D1_FIGURE_END_CLOSED); sk->Close(); sk->Release();+ br->SetColor(p.tint);+ dc->FillGeometry(pg, br);+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.28f));+ dc->DrawGeometry(pg, br, 1);+ }+ pg->Release();+ }+ if (fac) fac->Release();+ }+ else if (!g_glass) { dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(0, 0, PW, PanelH()), R, R), br); }+ if (leo) {}+ else if (liquid::On()) {if (!backdrop::Liquid()) liquid::Rim(dc, D2D1::RectF(0, 0, PW, PanelH()), R, ui::Dark()); // com o Liquid Glass o vidro já desenha o contorno} else {// borda do painel: escura por fora, clara por dentro (como o Dock)@@ -773,8 +885,11 @@ void Paint() {std::tuple{ mir, L"rectangle.on.rectangle", (wchar_t)0xEC15, Tr(L"Espelhar\nTela"), H_MIRROR } }) {Tile(dc, br, p, r);if (id == H_STAGE && palco::On()) { // ligado: o módulo fica aceso (azul), como os outros ligados+ if (leo) LeoGel(dc, br, r, 5, true);+ else {br->SetColor(D2D1::ColorF(0.04f, 0.47f, 1.f, 0.85f));dc->FillRoundedRectangle(D2D1::RoundedRect(r, 12, 12), br);+ }}float cx = (r.left + r.right) / 2;Sym(dc, br, sym, fb, D2D1::RectF(cx - 10, r.top + 12, cx + 10, r.top + 28), id == H_STAGE && palco::On() ? D2D1::ColorF(1, 1, 1, 1) : p.text);@@ -845,7 +960,7 @@ void Paint() {ui::GpuEnd(g_s);float pvx, pvy; Pivot(wpx, pvx, pvy);ui::GpuScale(g_s, mo.scale, pvx, pvy);- if (g_glass) backdrop::Fade(g_back, t, mo.scale, pvx, pvy);+ if (g_glass && !leo) backdrop::Fade(g_back, t, mo.scale, pvx, pvy);}void Place() {@@ -856,8 +971,9 @@ void Place() {int x = mi.rcMonitor.right - wpx - (int)std::lround(8 * sc), y = mi.rcMonitor.top + menubar::Height() + (int)std::lround(6 * sc);// Tahoe (guia, seção 40): os módulos começam 12 abaixo da barra e terminam a 14 da borda direitaif (Tahoe()) { x = mi.rcMonitor.right - wpx - (int)std::lround((14 - T_M) * sc); y = mi.rcMonitor.top + menubar::Height() + (int)std::lround((12 - T_M) * sc); }+ if (liquid::Leopard()) y = mi.rcMonitor.top + menubar::Height(); // Leopard: o menu sai colado na barraSetWindowPos(g_wnd, HWND_TOPMOST, x, y, wpx, hpx, SWP_NOACTIVATE);- SetWindowPos(g_back, g_wnd, x, y, wpx, hpx, SWP_NOACTIVATE | SWP_SHOWWINDOW);+ SetWindowPos(g_back, g_wnd, x, y, wpx, hpx, SWP_NOACTIVATE | (liquid::Leopard() ? 0 : SWP_SHOWWINDOW));// o desfoque por baixo da Central (só o desfoque, embaixo da barra de menus). Desligado por padrão desde// 16/11/2026: em cima de alguns fundos (Discord) ele embaçava o vidro dos módulos e deixava um brilho em// volta deles; o usuário confirmou que sumiu sem ele. central_veu=1 liga de novo.diff --git a/src/shell/dashboard.cpp b/src/shell/dashboard.cppnew file mode 100644index 0000000..cd13b9d--- /dev/null+++ b/src/shell/dashboard.cpp@@ -0,0 +1,434 @@+// Dashboard do Mac OS X Leopard (tema Leopard; Win+F12, como o F12 do Mac): a tela escurece e os widgets aparecem+// por cima de tudo, crescendo um pouco ao entrar. Widgets do 10.5 desenhados aqui: o Relógio (mostrador branco, aro+// cromado, ponteiro vermelho dos segundos e a cidade embaixo), o Calendário (a folha do dia com a faixa vermelha e o+// mês ao lado, hoje marcado) e a Calculadora (corpo grafite, visor cinza-esverdeado, teclas que funcionam, também+// pelo teclado). O "+" no canto de baixo abre a barra de widgets para ligar/desligar cada um; os widgets se arrastam+// e a posição fica guardada (ajustes dashboard_pos / dashboard_on). Clicar fora dos widgets, Esc ou Win+F12 fecha.+#include "shell.h"+#include <cmath>+#include <algorithm>+#include "../comum/idioma.h"++namespace {++const UINT WM_DB_FRAME = WM_APP + 181;+const int T_CLOCK = 1;+enum { W_CLOCK, W_CAL, W_CALC, W_COUNT };+struct Wd { float w, h; float x, y; bool on; };+Wd g_w[W_COUNT] = { { 160, 178, 0, 0, true }, { 300, 150, 0, 0, true }, { 156, 226, 0, 0, true } };++HWND g_wnd;+ui::GpuSurface g_s;+bool g_open, g_closing, g_bar;+double g_at; // início da animação de abrir/fechar+float g_W, g_H; // tela em DIP+int g_drag = -1; D2D1_POINT_2F g_dragOff{}, g_downPt{}; bool g_moved;+int g_press = -1; // tecla da calculadora apertada (índice)+// calculadora+double g_acc = 0, g_mem = 0; wchar_t g_op = 0; std::wstring g_disp = L"0"; bool g_fresh = true;++float Sc() { return ui::Scale(g_wnd); }++IDWriteTextFormat* F(float size, bool bold, bool center = true) {+ auto* f = ui::FormatFace(L"Lucida Sans Unicode", size, bold ? DWRITE_FONT_WEIGHT_BOLD : DWRITE_FONT_WEIGHT_NORMAL);+ if (f) {+ f->SetTextAlignment(center ? DWRITE_TEXT_ALIGNMENT_CENTER : DWRITE_TEXT_ALIGNMENT_TRAILING);+ f->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER);+ f->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP);+ }+ return f;+}+void Txt(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const std::wstring& s, IDWriteTextFormat* f, D2D1_RECT_F r, D2D1_COLOR_F c) {+ if (!f) return;+ br->SetColor(c);+ dc->DrawTextW(s.c_str(), (UINT32)s.size(), f, r, br);+}+void Grad(ID2D1DeviceContext* dc, D2D1_RECT_F r, float rad, std::initializer_list<D2D1_GRADIENT_STOP> st, bool ellipse = false) {+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;+ if (SUCCEEDED(dc->CreateGradientStopCollection(st.begin(), (UINT32)st.size(), &gs)) &&+ SUCCEEDED(dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, r.top }, { 0, r.bottom }), gs, &lb))) {+ if (ellipse) dc->FillEllipse(D2D1::Ellipse({ (r.left + r.right) / 2, (r.top + r.bottom) / 2 }, (r.right - r.left) / 2, (r.bottom - r.top) / 2), lb);+ else dc->FillRoundedRectangle(D2D1::RoundedRect(r, rad, rad), lb);+ }+ if (lb) lb->Release();+ if (gs) gs->Release();+}+void Shadow(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F r, float rad, bool ellipse = false) {+ for (int i = 4; i >= 1; i--) { // sombra macia feita de camadas+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.07f));+ D2D1_RECT_F q = D2D1::RectF(r.left - i, r.top - i + 4, r.right + i, r.bottom + i + 5);+ if (ellipse) dc->FillEllipse(D2D1::Ellipse({ (q.left + q.right) / 2, (q.top + q.bottom) / 2 }, (q.right - q.left) / 2, (q.bottom - q.top) / 2), br);+ else dc->FillRoundedRectangle(D2D1::RoundedRect(q, rad + i, rad + i), br);+ }+}++// ---- Relógio+void PaintClock(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F r) {+ float R = (r.right - r.left) / 2 - 8;+ D2D1_POINT_2F c{ (r.left + r.right) / 2, r.top + 8 + R };+ D2D1_RECT_F o = D2D1::RectF(c.x - R, c.y - R, c.x + R, c.y + R);+ Shadow(dc, br, o, R, true);+ Grad(dc, o, 0, { { 0, D2D1::ColorF(0.98f, 0.98f, 0.99f) }, { 0.5f, D2D1::ColorF(0.58f, 0.59f, 0.62f) }, { 1, D2D1::ColorF(0.93f, 0.93f, 0.95f) } }, true);+ float r2 = R * 0.87f;+ Grad(dc, D2D1::RectF(c.x - r2, c.y - r2, c.x + r2, c.y + r2), 0, { { 0, D2D1::ColorF(0.84f, 0.84f, 0.86f) }, { 1, D2D1::ColorF(1, 1, 1) } }, true);+ static IDWriteTextFormat* num = F(15, true);+ for (int i = 1; i <= 12; i++) {+ float a = i * 3.14159265f / 6, x = c.x + std::sin(a) * r2 * 0.76f, y = c.y - std::cos(a) * r2 * 0.76f;+ Txt(dc, br, std::to_wstring(i), num, D2D1::RectF(x - 14, y - 10, x + 14, y + 10), D2D1::ColorF(0.08f, 0.08f, 0.08f));+ }+ SYSTEMTIME t; GetLocalTime(&t);+ float mn = t.wMinute + t.wSecond / 60.f, hr = (t.wHour % 12) + mn / 60;+ auto hand = [&](float ang, float len, float wd, D2D1_COLOR_F col, float tail) {+ br->SetColor(col);+ D2D1_POINT_2F d{ std::sin(ang), -std::cos(ang) };+ dc->DrawLine({ c.x - d.x * tail, c.y - d.y * tail }, { c.x + d.x * len, c.y + d.y * len }, br, wd);+ };+ hand(hr * 3.14159265f / 6, r2 * 0.50f, 4, D2D1::ColorF(0.08f, 0.08f, 0.08f), r2 * 0.08f);+ hand(mn * 3.14159265f / 30, r2 * 0.74f, 3, D2D1::ColorF(0.08f, 0.08f, 0.08f), r2 * 0.08f);+ hand(t.wSecond * 3.14159265f / 30, r2 * 0.80f, 1.3f, D2D1::ColorF(0.85f, 0.10f, 0.08f), r2 * 0.18f);+ br->SetColor(D2D1::ColorF(0.85f, 0.10f, 0.08f));+ dc->FillEllipse(D2D1::Ellipse(c, 3, 3), br);+ // o brilho de vidro em cima do mostrador+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.25f));+ dc->FillEllipse(D2D1::Ellipse({ c.x, c.y - r2 * 0.45f }, r2 * 0.70f, r2 * 0.42f), br);+ static IDWriteTextFormat* city = F(12, true);+ Txt(dc, br, Tr(L"Hora Local"), city, D2D1::RectF(r.left - 20, r.bottom - 16, r.right + 20, r.bottom + 2), D2D1::ColorF(1, 1, 1, 0.95f));+}++// ---- Calendário+void PaintCal(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F r) {+ Shadow(dc, br, r, 12);+ Grad(dc, r, 12, { { 0, D2D1::ColorF(0.30f, 0.30f, 0.32f) }, { 1, D2D1::ColorF(0.12f, 0.12f, 0.13f) } });+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.25f));+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 0.5f, r.top + 0.5f, r.right - 0.5f, r.bottom - 0.5f), 11.5f, 11.5f), br, 1);+ SYSTEMTIME t; GetLocalTime(&t);+ // a folha do dia (como o ícone do iCal)+ D2D1_RECT_F pg = D2D1::RectF(r.left + 10, r.top + 10, r.left + 120, r.bottom - 10);+ Grad(dc, pg, 6, { { 0, D2D1::ColorF(1, 1, 1) }, { 1, D2D1::ColorF(0.88f, 0.88f, 0.89f) } });+ D2D1_RECT_F band = D2D1::RectF(pg.left, pg.top, pg.right, pg.top + 30);+ Grad(dc, band, 6, { { 0, D2D1::ColorF(0.93f, 0.36f, 0.33f) }, { 1, D2D1::ColorF(0.72f, 0.07f, 0.07f) } });+ br->SetColor(D2D1::ColorF(0.72f, 0.07f, 0.07f));+ dc->FillRectangle(D2D1::RectF(band.left, band.bottom - 6, band.right, band.bottom), br);+ static const wchar_t* dias[] = { L"Domingo", L"Segunda", L"Terça", L"Quarta", L"Quinta", L"Sexta", L"Sábado" };+ static IDWriteTextFormat *fd = F(13, true), *big = F(64, true), *fm = F(12, true), *fs = F(10, false);+ Txt(dc, br, Tr(dias[t.wDayOfWeek]), fd, band, D2D1::ColorF(1, 1, 1));+ Txt(dc, br, std::to_wstring(t.wDay), big, D2D1::RectF(pg.left, band.bottom, pg.right, pg.bottom), D2D1::ColorF(0.1f, 0.1f, 0.1f));+ // o mês+ static const wchar_t* meses[] = { L"Janeiro", L"Fevereiro", L"Março", L"Abril", L"Maio", L"Junho", L"Julho", L"Agosto", L"Setembro", L"Outubro", L"Novembro", L"Dezembro" };+ float gx = pg.right + 10, gw = r.right - 10 - gx;+ Txt(dc, br, std::wstring(Tr(meses[t.wMonth - 1])) + L" " + std::to_wstring(t.wYear), fm, D2D1::RectF(gx, r.top + 8, gx + gw, r.top + 24), D2D1::ColorF(1, 1, 1, 0.95f));+ static const wchar_t* ini[] = { L"D", L"S", L"T", L"Q", L"Q", L"S", L"S" };+ float cw = gw / 7;+ for (int i = 0; i < 7; i++) Txt(dc, br, ini[i], fs, D2D1::RectF(gx + i * cw, r.top + 26, gx + (i + 1) * cw, r.top + 38), D2D1::ColorF(1, 1, 1, 0.55f));+ SYSTEMTIME f1 = t; f1.wDay = 1; FILETIME ft; SystemTimeToFileTime(&f1, &ft); FileTimeToSystemTime(&ft, &f1);+ int first = f1.wDayOfWeek;+ static const int dm[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };+ int days = dm[t.wMonth - 1] + (t.wMonth == 2 && ((t.wYear % 4 == 0 && t.wYear % 100) || t.wYear % 400 == 0) ? 1 : 0);+ float rh = (r.bottom - 8 - (r.top + 40)) / 6;+ for (int d = 1; d <= days; d++) {+ int idx = first + d - 1, col = idx % 7, row = idx / 7;+ D2D1_RECT_F cr = D2D1::RectF(gx + col * cw, r.top + 40 + row * rh, gx + (col + 1) * cw, r.top + 40 + (row + 1) * rh);+ if (d == t.wDay) {+ Grad(dc, D2D1::RectF(cr.left + 1, cr.top, cr.right - 1, cr.bottom), 3, { { 0, D2D1::ColorF(0.95f, 0.45f, 0.40f) }, { 1, D2D1::ColorF(0.75f, 0.10f, 0.10f) } });+ }+ Txt(dc, br, std::to_wstring(d), fs, cr, D2D1::ColorF(1, 1, 1, d == t.wDay ? 1.f : 0.85f));+ }+}++// ---- Calculadora+const wchar_t* KEYS[] = { L"mc", L"m+", L"m-", L"mr", L"C", L"±", L"÷", L"×", L"7", L"8", L"9", L"−", L"4", L"5", L"6", L"+", L"1", L"2", L"3", L"=", L"0", L".", };+D2D1_RECT_F KeyRect(D2D1_RECT_F r, int i) {+ float x0 = r.left + 12, y0 = r.top + 70, kw = (r.right - r.left - 24 - 3 * 5) / 4, kh = 20, g = 5;+ if (i < 20) {+ int col = i % 4, row = i / 4;+ D2D1_RECT_F k = D2D1::RectF(x0 + col * (kw + g), y0 + row * (kh + g), x0 + col * (kw + g) + kw, y0 + row * (kh + g) + kh);+ if (i == 19) k.bottom += kh + g; // "=" alto+ return k;+ }+ float y = y0 + 5 * (kh + g);+ if (i == 20) return D2D1::RectF(x0, y, x0 + 2 * kw + g, y + kh); // "0" largo+ return D2D1::RectF(x0 + 2 * (kw + g), y, x0 + 2 * (kw + g) + kw, y + kh);+}+void PaintCalc(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F r) {+ Shadow(dc, br, r, 16);+ Grad(dc, r, 16, { { 0, D2D1::ColorF(0.40f, 0.40f, 0.42f) }, { 0.5f, D2D1::ColorF(0.22f, 0.22f, 0.23f) }, { 1, D2D1::ColorF(0.12f, 0.12f, 0.13f) } });+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.28f));+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 0.5f, r.top + 0.5f, r.right - 0.5f, r.bottom - 0.5f), 15.5f, 15.5f), br, 1);+ // o visor de cristal líquido+ D2D1_RECT_F lcd = D2D1::RectF(r.left + 12, r.top + 14, r.right - 12, r.top + 56);+ Grad(dc, lcd, 6, { { 0, D2D1::ColorF(0.62f, 0.67f, 0.60f) }, { 0.25f, D2D1::ColorF(0.80f, 0.85f, 0.77f) }, { 1, D2D1::ColorF(0.86f, 0.90f, 0.83f) } });+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.45f));+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(lcd.left + 0.5f, lcd.top + 0.5f, lcd.right - 0.5f, lcd.bottom - 0.5f), 5.5f, 5.5f), br, 1);+ static IDWriteTextFormat* fl = F(24, false, false), *fk = F(11, true);+ Txt(dc, br, g_disp, fl, D2D1::RectF(lcd.left + 6, lcd.top, lcd.right - 8, lcd.bottom), D2D1::ColorF(0.10f, 0.12f, 0.10f));+ if (g_mem != 0) { static IDWriteTextFormat* fm = F(9, true); Txt(dc, br, L"M", fm, D2D1::RectF(lcd.left + 4, lcd.top + 2, lcd.left + 16, lcd.top + 14), D2D1::ColorF(0.1f, 0.12f, 0.1f, 0.8f)); }+ for (int i = 0; i < 22; i++) {+ D2D1_RECT_F k = KeyRect(r, i);+ bool op = i < 8 || i % 4 == 3 || i == 19;+ bool down = g_press == i;+ Grad(dc, k, 6, { { 0, down ? D2D1::ColorF(0.20f, 0.20f, 0.21f) : op ? D2D1::ColorF(0.55f, 0.55f, 0.57f) : D2D1::ColorF(0.42f, 0.42f, 0.44f) },+ { 0.5f, down ? D2D1::ColorF(0.12f, 0.12f, 0.13f) : op ? D2D1::ColorF(0.36f, 0.36f, 0.38f) : D2D1::ColorF(0.25f, 0.25f, 0.27f) },+ { 1, down ? D2D1::ColorF(0.16f, 0.16f, 0.17f) : op ? D2D1::ColorF(0.30f, 0.30f, 0.32f) : D2D1::ColorF(0.18f, 0.18f, 0.19f) } });+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.55f));+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(k.left + 0.5f, k.top + 0.5f, k.right - 0.5f, k.bottom - 0.5f), 5.5f, 5.5f), br, 1);+ Txt(dc, br, KEYS[i], fk, k, D2D1::ColorF(1, 1, 1, 0.95f));+ }+}+std::wstring Fmt(double v) {+ if (!std::isfinite(v)) return L"Erro";+ wchar_t b[64]; swprintf_s(b, L"%.10g", v);+ std::wstring s = b;+ for (auto& ch : s) if (ch == L'.') ch = L',';+ return s;+}+double Val() { std::wstring s = g_disp; for (auto& ch : s) if (ch == L',') ch = L'.'; return _wtof(s.c_str()); }+void Apply() {+ double v = Val();+ switch (g_op) {+ case L'+': g_acc += v; break; case L'−': g_acc -= v; break;+ case L'×': g_acc *= v; break; case L'÷': g_acc = v != 0 ? g_acc / v : NAN; break;+ default: g_acc = v;+ }+ g_disp = Fmt(g_acc);+}+void CalcKey(const std::wstring& k) {+ if (k.size() == 1 && k[0] >= L'0' && k[0] <= L'9') {+ if (g_fresh || g_disp == L"0") g_disp.clear();+ if (g_disp.size() < 14) g_disp += k;+ g_fresh = false;+ } else if (k == L"." || k == L",") {+ if (g_fresh) { g_disp = L"0"; g_fresh = false; }+ if (g_disp.find(L',') == std::wstring::npos) g_disp += L',';+ } else if (k == L"C") { g_disp = L"0"; g_acc = 0; g_op = 0; g_fresh = true; }+ else if (k == L"±") { if (g_disp != L"0") g_disp = g_disp[0] == L'-' ? g_disp.substr(1) : L"-" + g_disp; }+ else if (k == L"=") { Apply(); g_op = 0; g_fresh = true; }+ else if (k == L"mc") g_mem = 0;+ else if (k == L"m+") { g_mem += Val(); g_fresh = true; }+ else if (k == L"m-") { g_mem -= Val(); g_fresh = true; }+ else if (k == L"mr") { g_disp = Fmt(g_mem); g_fresh = true; }+ else if (k == L"+" || k == L"−" || k == L"×" || k == L"÷") { if (!g_fresh || !g_op) Apply(); g_op = k[0]; g_fresh = true; }+}++D2D1_RECT_F WRect(int i) { return D2D1::RectF(g_w[i].x, g_w[i].y, g_w[i].x + g_w[i].w, g_w[i].y + g_w[i].h); }+D2D1_RECT_F PlusRect() { return D2D1::RectF(18, g_H - 52, 52, g_H - 18); }+const float BAR_H = 132;+D2D1_RECT_F BarItem(int i) { float x = 100 + i * 170.f; return D2D1::RectF(x, g_H - BAR_H + 14, x + 150, g_H - 14); }++void LoadPos() {+ std::wstring on = shell::Setting(L"dashboard_on", L"111");+ for (int i = 0; i < W_COUNT; i++) g_w[i].on = i < (int)on.size() ? on[i] == L'1' : true;+ std::wstring p = shell::Setting(L"dashboard_pos", L"");+ float def[W_COUNT][2] = { { 0.22f, 0.26f }, { 0.40f, 0.30f }, { 0.68f, 0.24f } };+ for (int i = 0; i < W_COUNT; i++) { g_w[i].x = g_W * def[i][0]; g_w[i].y = g_H * def[i][1]; }+ size_t s = 0; int i = 0;+ while (i < W_COUNT && s < p.size()) {+ size_t e = p.find(L';', s); if (e == std::wstring::npos) e = p.size();+ float fx = 0, fy = 0;+ if (swscanf_s(p.substr(s, e - s).c_str(), L"%f,%f", &fx, &fy) == 2) { g_w[i].x = fx * g_W; g_w[i].y = fy * g_H; }+ s = e + 1; i++;+ }+ for (auto& w : g_w) { w.x = std::clamp(w.x, 0.f, g_W - w.w); w.y = std::clamp(w.y, 24.f, g_H - w.h); }+}+void SavePos() {+ std::wstring p, on;+ for (int i = 0; i < W_COUNT; i++) {+ wchar_t b[48]; swprintf_s(b, L"%.4f,%.4f;", g_w[i].x / g_W, g_w[i].y / g_H);+ p += b; on += g_w[i].on ? L'1' : L'0';+ }+ shell::SetSetting(L"dashboard_pos", p);+ shell::SetSetting(L"dashboard_on", on);+}++float Progress() {+ float k = (float)std::clamp((anim::Now() - g_at) / 260.0, 0.0, 1.0);+ k = anim::Ease(k);+ return g_closing ? 1 - k : k;+}++void Paint() {+ if (!g_open) return;+ float sc = Sc();+ RECT rc; GetClientRect(g_wnd, &rc);+ auto* dc = ui::GpuBegin(g_s, rc.right, rc.bottom, sc);+ if (!dc) return;+ ID2D1SolidColorBrush* br = nullptr;+ dc->CreateSolidColorBrush(D2D1::ColorF(0, 0, 0), &br);+ float k = Progress();+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.48f * k)); // a tela escurece por trás+ dc->FillRectangle(D2D1::RectF(0, 0, g_W, g_H), br);+ float lift = g_bar ? BAR_H : 0;+ ID2D1Layer* layer = nullptr; dc->CreateLayer(nullptr, &layer);+ for (int i = 0; i < W_COUNT; i++) {+ if (!g_w[i].on) continue;+ D2D1_RECT_F r = WRect(i);+ float s = 1.12f - 0.12f * k; // entram crescendo um pouco (e saem do mesmo jeito)+ D2D1_POINT_2F c{ (r.left + r.right) / 2, (r.top + r.bottom) / 2 };+ dc->SetTransform(D2D1::Matrix3x2F::Scale(s, s, c) * D2D1::Matrix3x2F::Translation(0, -lift * 0.0f));+ dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), nullptr, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1::IdentityMatrix(), k), nullptr);+ if (i == W_CLOCK) PaintClock(dc, br, r); else if (i == W_CAL) PaintCal(dc, br, r); else PaintCalc(dc, br, r);+ dc->PopLayer();+ dc->SetTransform(D2D1::Matrix3x2F::Identity());+ }+ dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), nullptr, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1::IdentityMatrix(), k), nullptr);+ if (g_bar) { // a barra de widgets: faixa de metal escovado embaixo+ D2D1_RECT_F b = D2D1::RectF(0, g_H - BAR_H, g_W, g_H);+ Grad(dc, b, 0, { { 0, D2D1::ColorF(0.62f, 0.62f, 0.64f) }, { 0.08f, D2D1::ColorF(0.50f, 0.50f, 0.52f) }, { 1, D2D1::ColorF(0.30f, 0.30f, 0.32f) } });+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.5f));+ dc->DrawLine({ 0, b.top + 0.5f }, { g_W, b.top + 0.5f }, br, 1);+ static const wchar_t* nomes[] = { L"Relógio", L"Calendário", L"Calculadora" };+ static IDWriteTextFormat* fn = F(11, true);+ for (int i = 0; i < W_COUNT; i++) {+ D2D1_RECT_F it = BarItem(i);+ D2D1_RECT_F mini = D2D1::RectF(it.left + 40, it.top + 4, it.right - 40, it.bottom - 26);+ // miniatura: o próprio widget reduzido+ float ww = g_w[i].w, hh = g_w[i].h, s = std::min((mini.right - mini.left) / ww, (mini.bottom - mini.top) / hh);+ D2D1_RECT_F wr = D2D1::RectF(0, 0, ww, hh);+ dc->SetTransform(D2D1::Matrix3x2F::Scale(s, s) * D2D1::Matrix3x2F::Translation((mini.left + mini.right) / 2 - ww * s / 2, (mini.top + mini.bottom) / 2 - hh * s / 2));+ dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), nullptr, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1::IdentityMatrix(), g_w[i].on ? 0.45f : 1.f), nullptr);+ if (i == W_CLOCK) PaintClock(dc, br, wr); else if (i == W_CAL) PaintCal(dc, br, wr); else PaintCalc(dc, br, wr);+ dc->PopLayer();+ dc->SetTransform(D2D1::Matrix3x2F::Identity());+ Txt(dc, br, std::wstring(Tr(nomes[i])) + (g_w[i].on ? L" ✓" : L""), fn, D2D1::RectF(it.left, it.bottom - 22, it.right, it.bottom), D2D1::ColorF(1, 1, 1, 0.95f));+ }+ }+ // o "+" (ou o "×" com a barra aberta) no canto de baixo à esquerda+ D2D1_RECT_F pr = PlusRect();+ if (g_bar) { pr.top -= BAR_H; pr.bottom -= BAR_H; }+ Shadow(dc, br, pr, 17, true);+ Grad(dc, pr, 0, { { 0, D2D1::ColorF(0.55f, 0.55f, 0.57f) }, { 1, D2D1::ColorF(0.20f, 0.20f, 0.21f) } }, true);+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.6f));+ dc->DrawEllipse(D2D1::Ellipse({ (pr.left + pr.right) / 2, (pr.top + pr.bottom) / 2 }, 16.5f, 16.5f), br, 1.2f);+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.95f));+ float cx = (pr.left + pr.right) / 2, cy = (pr.top + pr.bottom) / 2;+ if (g_bar) { dc->DrawLine({ cx - 6, cy - 6 }, { cx + 6, cy + 6 }, br, 3); dc->DrawLine({ cx + 6, cy - 6 }, { cx - 6, cy + 6 }, br, 3); }+ else { dc->DrawLine({ cx - 8, cy }, { cx + 8, cy }, br, 3); dc->DrawLine({ cx, cy - 8 }, { cx, cy + 8 }, br, 3); }+ dc->PopLayer();+ layer->Release();+ br->Release();+ ui::GpuEnd(g_s);+}++void HideNow() {+ ui::FrameClock(g_wnd, WM_DB_FRAME, false);+ KillTimer(g_wnd, T_CLOCK);+ ShowWindow(g_wnd, SW_HIDE);+ g_open = g_closing = false;+}+void Close() {+ if (!g_open || g_closing) return;+ SavePos();+ g_closing = true; g_at = anim::Now();+ ui::FrameClock(g_wnd, WM_DB_FRAME, true);+}++int HitWidget(D2D1_POINT_2F p) {+ for (int i = W_COUNT - 1; i >= 0; i--) {+ if (!g_w[i].on) continue;+ D2D1_RECT_F r = WRect(i);+ if (p.x >= r.left && p.x < r.right && p.y >= r.top && p.y < r.bottom) return i;+ }+ return -1;+}+int HitKey(D2D1_POINT_2F p) {+ if (!g_w[W_CALC].on) return -1;+ for (int i = 0; i < 22; i++) { D2D1_RECT_F k = KeyRect(WRect(W_CALC), i); if (p.x >= k.left && p.x < k.right && p.y >= k.top && p.y < k.bottom) return i; }+ return -1;+}+D2D1_POINT_2F Pt(LPARAM l) { float sc = Sc(); return { (short)LOWORD(l) / sc, (short)HIWORD(l) / sc }; }+bool In(D2D1_RECT_F r, D2D1_POINT_2F p) { return p.x >= r.left && p.x < r.right && p.y >= r.top && p.y < r.bottom; }++LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {+ switch (m) {+ case WM_DB_FRAME:+ ui::FrameAck(h, WM_DB_FRAME);+ Paint();+ if (anim::Now() - g_at > 280) { if (g_closing) HideNow(); else ui::FrameClock(h, WM_DB_FRAME, false); }+ return 0;+ case WM_TIMER: if (w == T_CLOCK) Paint(); return 0;+ case WM_LBUTTONDOWN: {+ SetCapture(h);+ D2D1_POINT_2F p = Pt(l); g_downPt = p; g_moved = false;+ D2D1_RECT_F pr = PlusRect(); if (g_bar) { pr.top -= BAR_H; pr.bottom -= BAR_H; }+ if (In(pr, p)) { g_bar = !g_bar; Paint(); return 0; }+ if (g_bar && p.y >= g_H - BAR_H) {+ for (int i = 0; i < W_COUNT; i++) if (In(BarItem(i), p)) { g_w[i].on = !g_w[i].on; SavePos(); Paint(); }+ return 0;+ }+ int k = HitKey(p);+ if (k >= 0) { g_press = k; CalcKey(KEYS[k]); Paint(); return 0; }+ int wi = HitWidget(p);+ if (wi >= 0) { g_drag = wi; g_dragOff = { p.x - g_w[wi].x, p.y - g_w[wi].y }; return 0; }+ Close(); // fora dos widgets: fecha, como no Mac+ return 0;+ }+ case WM_MOUSEMOVE:+ if (g_drag >= 0 && (w & MK_LBUTTON)) {+ D2D1_POINT_2F p = Pt(l);+ g_w[g_drag].x = std::clamp(p.x - g_dragOff.x, 0.f, g_W - g_w[g_drag].w);+ g_w[g_drag].y = std::clamp(p.y - g_dragOff.y, 24.f, g_H - g_w[g_drag].h);+ g_moved = true; Paint();+ }+ return 0;+ case WM_LBUTTONUP:+ ReleaseCapture();+ if (g_press >= 0) { g_press = -1; Paint(); }+ if (g_drag >= 0) { g_drag = -1; if (g_moved) SavePos(); }+ return 0;+ case WM_KEYDOWN: {+ if (w == VK_ESCAPE || w == VK_F12) { Close(); return 0; }+ std::wstring k;+ if (w >= '0' && w <= '9' && GetKeyState(VK_SHIFT) >= 0) k = std::wstring(1, (wchar_t)w);+ else if (w >= VK_NUMPAD0 && w <= VK_NUMPAD9) k = std::wstring(1, (wchar_t)(L'0' + (w - VK_NUMPAD0)));+ else if (w == VK_ADD || (w == VK_OEM_PLUS && GetKeyState(VK_SHIFT) < 0)) k = L"+";+ else if (w == VK_SUBTRACT || w == VK_OEM_MINUS) k = L"−";+ else if (w == VK_MULTIPLY) k = L"×";+ else if (w == VK_DIVIDE || w == VK_OEM_2) k = L"÷";+ else if (w == VK_RETURN || w == VK_OEM_PLUS) k = L"=";+ else if (w == VK_DECIMAL || w == VK_OEM_COMMA || w == VK_OEM_PERIOD) k = L",";+ else if (w == VK_BACK || w == VK_DELETE) k = L"C";+ if (!k.empty() && g_w[W_CALC].on) { CalcKey(k); Paint(); }+ return 0;+ }+ case WM_ACTIVATE: if (LOWORD(w) == WA_INACTIVE && g_open && !g_closing) Close(); return 0;+ case WM_MOUSEACTIVATE: return MA_ACTIVATE;+ case WM_CLOSE: Close(); return 0; // nunca destrói+ }+ return DefWindowProcW(h, m, w, l);+}++} // namespace++bool dashboard::Create(HINSTANCE hi) {+ WNDCLASSW wc{}; wc.lpfnWndProc = Proc; wc.hInstance = hi; wc.lpszClassName = L"ShellDashboard"; wc.hCursor = LoadCursorW(nullptr, IDC_ARROW);+ RegisterClassW(&wc);+ g_wnd = CreateWindowExW(WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOREDIRECTIONBITMAP, wc.lpszClassName, L"Dashboard", WS_POPUP, 0, 0, 10, 10, nullptr, nullptr, hi, nullptr);+ if (!g_wnd) return false;+ apps::ours.push_back(g_wnd);+ g_s.hwnd = g_wnd;+ return true;+}++bool dashboard::IsOpen() { return g_open && !g_closing; }++void dashboard::Toggle() {+ if (!g_wnd && !dashboard::Create(shell::inst)) return;+ if (g_open && !g_closing) { Close(); return; }+ POINT c; GetCursorPos(&c);+ MONITORINFO mi{ sizeof(mi) };+ GetMonitorInfoW(MonitorFromPoint(c, MONITOR_DEFAULTTOPRIMARY), &mi);+ RECT r = mi.rcMonitor;+ SetWindowPos(g_wnd, HWND_TOPMOST, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOACTIVATE);+ float sc = Sc();+ g_W = (r.right - r.left) / sc; g_H = (r.bottom - r.top) / sc;+ LoadPos();+ g_open = true; g_closing = false; g_bar = false; g_at = anim::Now();+ Paint();+ ShowWindow(g_wnd, SW_SHOW);+ HWND fg = GetForegroundWindow();+ DWORD ft = fg ? GetWindowThreadProcessId(fg, nullptr) : 0, me = GetCurrentThreadId();+ bool att = ft && ft != me && AttachThreadInput(me, ft, TRUE);+ SetForegroundWindow(g_wnd); SetFocus(g_wnd);+ if (att) AttachThreadInput(me, ft, FALSE);+ SetTimer(g_wnd, T_CLOCK, 1000, nullptr);+ ui::FrameClock(g_wnd, WM_DB_FRAME, true);+}diff --git a/src/shell/dock.cpp b/src/shell/dock.cppindex 266cc0c..79cde78 100644--- a/src/shell/dock.cpp+++ b/src/shell/dock.cpp@@ -42,14 +42,14 @@ const DWORD ACR_DARK = 0x401E1C1C, ACR_LIGHT = 0x40F6F6F6; // AABBGGRR// sobre ela, refletidos no tampo, e o app aberto ganha a luz azul na frente da prateleira (desenho em Paint)#define LEO_DOCK (liquid::Leopard())#define PAD_TOP (g_tile * (TAHOE_DOCK ? 0.156f : LEO_DOCK ? 0.06f : 0.099f))-#define PAD_BOTTOM (g_tile * (TAHOE_DOCK ? 0.148f : LEO_DOCK ? 0.48f : 0.196f))+#define PAD_BOTTOM (g_tile * (TAHOE_DOCK ? 0.148f : LEO_DOCK ? 0.36f : 0.196f)) // Leopard: a frente ~0,32 ícone abaixo do pé (fotos de referência)// Tahoe, guia macOS26-Theme-Reference (seção 36, medido com ícone de 64): cada ícone ocupa 68 × 84 (passo// 1,0625), 8 de margem antes do primeiro, separador de 31 (0,484); a altura reservada dá os 90 medidos#define PAD_X (g_tile * (TAHOE_DOCK ? 0.125f : LEO_DOCK ? 0.55f : 0.041f))#define MARGIN (g_tile * (LEO_DOCK ? 0.f : 0.10f)) // Leopard: a prateleira encosta no pé da tela-#define SEP_W (g_tile * (TAHOE_DOCK ? 0.484f : 0.40f))-// Leopard (comparado com a Dock do 10.5): os ícones ocupam o espaço inteiro e quase se encostam (passo de 1,06 ícone)-#define SLOT (g_tile * (TAHOE_DOCK ? 1.0625f : LEO_DOCK ? 1.06f : 1.076f))+#define SEP_W (g_tile * (TAHOE_DOCK ? 0.484f : LEO_DOCK ? 0.80f : 0.40f)) // Leopard: o vão largo da faixa zebrada (~0,85 ícone na captura)+// Leopard (comparado com as fotos de referência): passo de ~1,17 ícone entre os desenhos+#define SLOT (g_tile * (TAHOE_DOCK ? 1.0625f : LEO_DOCK ? 1.17f : 1.076f)) // Leopard: passo de ~1,17 ícone (medido nas fotos de referência do usuário)#define DOCK_RADIUS (g_tile * (TAHOE_DOCK ? 0.40f : 0.28f)) // Tahoe: 0,5 A (medido); Sequoia: 0,3 Aconst float ART_PACK_0 = 1.0f; // PNGs do pacote: já têm a margem do Mac (desenho = 80%)const float ART_WIN_0 = 0.80f; // ícones do Windows (recortados): mesmo corpo visual@@ -739,7 +739,7 @@ void Paint() {};if (leo) {float base = g_bg.top + PAD_TOP + g_tile;- leoBack = base - g_tile * 0.42f; leoFront = g_bg.bottom - std::max(2.f, g_tile * 0.04f); leoIn = (leoFront - leoBack) * 0.95f;+ leoBack = base - g_tile * 0.52f; leoFront = g_bg.bottom - std::max(2.f, g_tile * 0.04f); leoIn = (leoFront - leoBack) * 0.95f;ID2D1Factory* fac = nullptr; rt->GetFactory(&fac);if (fac && SUCCEEDED(fac->CreatePathGeometry(&shelf))) {ID2D1GeometrySink* sk = nullptr;@@ -751,16 +751,17 @@ void Paint() {}}if (fac) fac->Release();- // tampo (comparado com a Dock do 10.5): vidro prateado claro e mais opaco — o fundo escuro aparece pouco —, mais- // claro atrás, com a faixa de brilho junto da borda de trás- if (shelf) lin({ 0, leoBack }, { 0, leoFront }, { { 0, D2D1::ColorF(0.95f, 0.95f, 0.96f, 0.70f) }, { 0.10f, D2D1::ColorF(0.90f, 0.90f, 0.92f, 0.62f) }, { 0.35f, D2D1::ColorF(0.82f, 0.83f, 0.85f, 0.56f) }, { 1, D2D1::ColorF(0.74f, 0.75f, 0.78f, 0.58f) } },+ // tampo (captura do 10.5 sobre o fundo cinza: ~80 vira ~125 atrás e ~150 na frente): vidro TRANSLÚCIDO — o+ // papel de parede aparece através dele —, um véu branco fraco, um pouco mais forte junto da borda de trás+ if (shelf) lin({ 0, leoBack }, { 0, leoFront }, { { 0, D2D1::ColorF(1, 1, 1, 0.36f) }, { 0.08f, D2D1::ColorF(0.96f, 0.96f, 0.98f, 0.24f) }, { 0.45f, D2D1::ColorF(0.92f, 0.92f, 0.95f, 0.20f) }, { 1, D2D1::ColorF(0.95f, 0.95f, 0.97f, 0.30f) } },[&](ID2D1Brush* b) { rt->FillGeometry(shelf, b); });// frente: a borda fina do vidro — um fio escuro e, embaixo, o fio claro- br->SetColor(D2D1::ColorF(0.55f, 0.56f, 0.58f, 0.95f)); // a borda da frente: um fio médio e o fio claro embaixo+ // a borda da frente do vidro: a quina clara e brilhante (o fio branco forte) e a face fina embaixo, mais clara que o tampo+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.92f));rt->FillRectangle(D2D1::RectF(g_bg.left, leoFront, g_bg.right, leoFront + px), br);- br->SetColor(D2D1::ColorF(0.92f, 0.92f, 0.93f, 0.98f));- rt->FillRectangle(D2D1::RectF(g_bg.left, leoFront + px, g_bg.right, g_bg.bottom), br);- br->SetColor(D2D1::ColorF(1, 1, 1, 0.55f)); // a borda do fundo e os lados+ lin({ 0, leoFront + px }, { 0, g_bg.bottom }, { { 0, D2D1::ColorF(0.86f, 0.86f, 0.88f, 0.80f) }, { 1, D2D1::ColorF(0.62f, 0.62f, 0.65f, 0.80f) } },+ [&](ID2D1Brush* b) { rt->FillRectangle(D2D1::RectF(g_bg.left, leoFront + px, g_bg.right, g_bg.bottom), b); });+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.70f)); // a borda do fundo (o fio de luz atrás dos ícones) e os ladosrt->DrawLine({ g_bg.left + leoIn, leoBack }, { g_bg.right - leoIn, leoBack }, br, px);br->SetColor(D2D1::ColorF(1, 1, 1, 0.35f));rt->DrawLine({ g_bg.left + leoIn, leoBack }, { g_bg.left, leoFront }, br, px);@@ -770,10 +771,10 @@ void Paint() {// para a frenteauto reflect = [&](float baseY, auto draw) {if (!leo || !shelf) return;- D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(1, 1, 1, 0.55f) }, { 1, D2D1::ColorF(1, 1, 1, 0) } }; // reflexo forte, como no 10.5+ D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(1, 1, 1, 0.30f) }, { 1, D2D1::ColorF(1, 1, 1, 0) } }; // reflexo sutil e curto (captura do 10.5)ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;if (SUCCEEDED(rt->CreateGradientStopCollection(st, 2, &gs)) &&- SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, baseY }, { 0, baseY + g_tile * 0.60f }), gs, &lb))) {+ SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, baseY }, { 0, baseY + g_tile * 0.42f }), gs, &lb))) {rt->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), shelf, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1::IdentityMatrix(), 1, lb), nullptr);D2D1_MATRIX_3X2_F old; rt->GetTransform(&old);rt->SetTransform(D2D1::Matrix3x2F::Scale(1, -1, { 0, baseY }) * old);@@ -795,13 +796,30 @@ void Paint() {for (int i = 0; i < (int)g_items.size(); i++) {auto& it = g_items[i];if (it.kind == I_SEP && leo) {- // Leopard: a faixa tracejada branca que atravessa o tampo em perspectiva (do fundo para a frente)+ // Leopard: a "faixa de pedestres" do 10.5 — barrinhas brancas horizontais empilhadas do fundo até a frente,+ // em perspectiva (mais largas e mais altas na frente), seguindo a fuga do tampofloat w = g_bg.right - g_bg.left, t = w > 0 ? (it.cx - g_bg.left) / w : 0.5f;- float bx = g_bg.left + leoIn + t * (w - 2 * leoIn);- br->SetColor(D2D1::ColorF(1, 1, 1, 0.85f));- for (int d = 0; d < 5; d++) {- float a = d / 5.f, b2 = (d + 0.55f) / 5.f;- rt->DrawLine({ bx + (it.cx - bx) * a, leoBack + (leoFront - leoBack) * a }, { bx + (it.cx - bx) * b2, leoBack + (leoFront - leoBack) * b2 }, br, 1.3f + a);+ float bx = it.cx + (g_bg.left + leoIn + t * (w - 2 * leoIn) - it.cx) * 0.35f; // a captura mostra a coluna quase em pé (só um pouco de fuga)+ const int N = 7;+ for (int d = 0; d < N; d++) {+ float a = (d + 0.15f) / N, b2 = (d + 0.62f) / N;+ float ya = leoBack + (leoFront - leoBack) * a, yb = leoBack + (leoFront - leoBack) * b2;+ float xa = bx + (it.cx - bx) * a, xb = bx + (it.cx - bx) * b2;+ float ha = g_tile * (0.10f + 0.09f * a), hb = g_tile * (0.10f + 0.09f * b2);+ ID2D1Factory* f2 = nullptr; rt->GetFactory(&f2);+ ID2D1PathGeometry* g2 = nullptr;+ if (f2 && SUCCEEDED(f2->CreatePathGeometry(&g2))) {+ ID2D1GeometrySink* s2 = nullptr;+ if (SUCCEEDED(g2->Open(&s2))) {+ s2->BeginFigure({ xa - ha, ya }, D2D1_FIGURE_BEGIN_FILLED);+ s2->AddLine({ xa + ha, ya }); s2->AddLine({ xb + hb, yb }); s2->AddLine({ xb - hb, yb });+ s2->EndFigure(D2D1_FIGURE_END_CLOSED); s2->Close(); s2->Release();+ br->SetColor(D2D1::ColorF(0.86f, 0.86f, 0.88f, 0.28f + 0.22f * a)); // cinza discreto (fotos de referência do usuário)+ rt->FillGeometry(g2, br);+ }+ g2->Release();+ }+ if (f2) f2->Release();}continue;}@@ -1590,6 +1608,16 @@ void dock::OpenAppsStack() {}}+void dock::OpenDownloadsStack() {+ for (auto& it : g_items) {+ if (it.kind != I_DOWNLOADS) continue;+ float sc = Sc(); RECT mon = Monitor(); int H = (int)std::lround(WinH() * sc);+ POINT a{ mon.left + (LONG)std::lround(it.cx * sc), mon.bottom - H + (LONG)std::lround((g_bg.top - 4) * sc) };+ pilhas::Show(a);+ return;+ }+}+void dock::Raise() { // por cima de janelas de tela inteira nossas (Launchpad)if (!g_icons) return;SetWindowPos(g_back, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);diff --git a/src/shell/espacos.cpp b/src/shell/espacos.cppnew file mode 100644index 0000000..92fabab--- /dev/null+++ b/src/shell/espacos.cpp@@ -0,0 +1,355 @@+// Spaces do Mac OS X Leopard (tema Leopard; Win+F8, como o F8 do Mac): a tela recua e mostra todas as áreas de+// trabalho lado a lado numa grade, sobre o cinza-escuro do 10.5. A área atual aparece como está (foto da tela tirada+// antes de abrir); as outras com o papel de parede e as janelas de cada uma (moldura de metal com o ícone e o nome).+// Clicar numa área vai para ela (a grade amplia até a escolhida); a casa "+" cria outra área. Esc ou Win+F8 fecha.+// As áreas são as do Windows (mesas.cpp: as mesmas do Mission Control).+#include "shell.h"+#include <shobjidl.h>+#include <dwmapi.h>+#include <cmath>+#include <algorithm>+#include "../comum/idioma.h"+#include "../comum/leopard.h"++namespace {++const UINT WM_SP_FRAME = WM_APP + 182;+struct WinBox { RECT r; std::wstring title; ID2D1Bitmap* icon = nullptr; };+struct Space { GUID id; std::vector<WinBox> wins; };++HWND g_wnd;+ui::GpuSurface g_s;+bool g_open, g_closing;+double g_at;+int g_cur, g_pick = -1, g_hover = -1;+std::vector<Space> g_sp;+RECT g_mon;+float g_W, g_H;+ID2D1Bitmap *g_shot, *g_wall;+UINT g_shotW, g_shotH; std::vector<BYTE> g_shotPx;++float Sc() { return ui::Scale(g_wnd); }++void Release() {+ if (g_shot) { g_shot->Release(); g_shot = nullptr; }+ for (auto& s : g_sp) for (auto& w : s.wins) if (w.icon) w.icon->Release();+ g_sp.clear();+}++// as áreas do Windows (registro do Explorador) e a atual+void LoadSpaces() {+ const wchar_t* key = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\VirtualDesktops";+ BYTE ids[16 * 32]; DWORD cb = sizeof(ids);+ BYTE cur[16]; DWORD cc = sizeof(cur);+ bool hasCur = RegGetValueW(HKEY_CURRENT_USER, key, L"CurrentVirtualDesktop", RRF_RT_REG_BINARY, nullptr, cur, &cc) == ERROR_SUCCESS && cc == 16;+ g_cur = 0;+ if (RegGetValueW(HKEY_CURRENT_USER, key, L"VirtualDesktopIDs", RRF_RT_REG_BINARY, nullptr, ids, &cb) == ERROR_SUCCESS && cb >= 16)+ for (DWORD i = 0; i + 16 <= cb; i += 16) {+ Space s; memcpy(&s.id, ids + i, 16);+ if (hasCur && !memcmp(cur, ids + i, 16)) g_cur = (int)g_sp.size();+ g_sp.push_back(s);+ }+ if (g_sp.empty()) { g_sp.push_back({}); g_cur = 0; }+}++ID2D1Bitmap* IconBitmap(HWND h) {+ HICON ic = nullptr;+ DWORD_PTR res = 0;+ if (SendMessageTimeoutW(h, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 50, &res) && res) ic = (HICON)res;+ if (!ic) ic = (HICON)GetClassLongPtrW(h, GCLP_HICON);+ if (!ic) return nullptr;+ const int N = 48;+ BITMAPINFO bi{}; bi.bmiHeader = { sizeof(BITMAPINFOHEADER), N, -N, 1, 32, BI_RGB };+ void* bits = nullptr;+ HDC dc = CreateCompatibleDC(nullptr);+ HBITMAP bm = CreateDIBSection(dc, &bi, DIB_RGB_COLORS, &bits, nullptr, 0);+ if (!bm) { DeleteDC(dc); return nullptr; }+ HGDIOBJ old = SelectObject(dc, bm);+ DrawIconEx(dc, 0, 0, ic, N, N, 0, nullptr, DI_NORMAL);+ SelectObject(dc, old);+ std::vector<BYTE> px((BYTE*)bits, (BYTE*)bits + N * N * 4);+ DeleteObject(bm); DeleteDC(dc);+ bool anyA = false;+ for (int i = 3; i < N * N * 4; i += 4) if (px[i]) { anyA = true; break; }+ if (!anyA) for (int i = 3; i < N * N * 4; i += 4) px[i] = 255;+ for (int i = 0; i < N * N * 4; i += 4) { BYTE a = px[i + 3]; px[i] = px[i] * a / 255; px[i + 1] = px[i + 1] * a / 255; px[i + 2] = px[i + 2] * a / 255; }+ return ui::Bitmap(ui::Gpu(), N, N, px);+}++// as janelas de cada área (as das outras áreas ficam "escondidas" pelo Windows, mas a posição continua valendo)+void LoadWindows() {+ IVirtualDesktopManager* vdm = nullptr;+ CoCreateInstance(CLSID_VirtualDesktopManager, nullptr, CLSCTX_ALL, IID_PPV_ARGS(&vdm));+ if (!vdm) return;+ std::vector<HWND> hs;+ for (HWND h = GetTopWindow(nullptr); h; h = GetWindow(h, GW_HWNDNEXT)) {+ if (!IsWindowVisible(h) || IsIconic(h) || apps::IsShellWindow(h)) continue;+ LONG ex = GetWindowLongW(h, GWL_EXSTYLE);+ if ((ex & WS_EX_TOOLWINDOW) && !(ex & WS_EX_APPWINDOW)) continue;+ if (GetWindow(h, GW_OWNER) && !(ex & WS_EX_APPWINDOW)) continue;+ if (GetWindowTextLengthW(h) == 0) continue;+ DWORD cloaked = 0; DwmGetWindowAttribute(h, DWMWA_CLOAKED, &cloaked, sizeof(cloaked));+ if (cloaked & 1) continue; // escondida pelo próprio app (não é de outra área)+ wchar_t cls[64]; GetClassNameW(h, cls, 64);+ if (mesa::IsDeskClass(cls) || !wcscmp(cls, L"Shell_TrayWnd")) continue;+ hs.push_back(h);+ }+ for (auto it = hs.rbegin(); it != hs.rend(); ++it) { // de baixo para cima: a de cima é desenhada por último+ GUID d{};+ if (FAILED(vdm->GetWindowDesktopId(*it, &d))) continue;+ for (auto& s : g_sp) {+ if (memcmp(&s.id, &d, sizeof(GUID))) continue;+ WinBox b;+ if (FAILED(DwmGetWindowAttribute(*it, DWMWA_EXTENDED_FRAME_BOUNDS, &b.r, sizeof(b.r)))) GetWindowRect(*it, &b.r);+ if (b.r.right - b.r.left < 60 || b.r.bottom - b.r.top < 40) break;+ wchar_t t[256]; GetWindowTextW(*it, t, 256); b.title = t;+ b.icon = IconBitmap(*it);+ s.wins.push_back(b);+ break;+ }+ }+ vdm->Release();+}++void Shot() { // a área atual como está agora+ int w = g_mon.right - g_mon.left, h = g_mon.bottom - g_mon.top;+ BITMAPINFO bi{}; bi.bmiHeader = { sizeof(BITMAPINFOHEADER), w, -h, 1, 32, BI_RGB };+ void* bits = nullptr;+ HDC sdc = GetDC(nullptr), mdc = CreateCompatibleDC(sdc);+ HBITMAP bm = CreateDIBSection(sdc, &bi, DIB_RGB_COLORS, &bits, nullptr, 0);+ if (bm) {+ HGDIOBJ old = SelectObject(mdc, bm);+ BitBlt(mdc, 0, 0, w, h, sdc, g_mon.left, g_mon.top, SRCCOPY | CAPTUREBLT);+ SelectObject(mdc, old);+ g_shotPx.assign((BYTE*)bits, (BYTE*)bits + (size_t)w * h * 4);+ for (size_t i = 3; i < g_shotPx.size(); i += 4) g_shotPx[i] = 255;+ g_shotW = w; g_shotH = h;+ UINT dw = w, dh = h;+ ui::Downscale(dw, dh, g_shotPx, 1600);+ g_shotW = dw; g_shotH = dh;+ DeleteObject(bm);+ }+ DeleteDC(mdc); ReleaseDC(nullptr, sdc);+}++void Wallpaper() {+ if (g_wall) return;+ wchar_t p[MAX_PATH] = {};+ SystemParametersInfoW(SPI_GETDESKWALLPAPER, MAX_PATH, p, 0);+ UINT w = 0, h = 0; std::vector<BYTE> px;+ if (p[0] && ui::LoadPhoto(p, 800, w, h, px)) g_wall = ui::Bitmap(ui::Gpu(), w, h, px);+}++// a grade: colunas e linhas para n casas (mais a casa "+")+D2D1_RECT_F Tile(int i, int n) {+ int cols = (int)std::ceil(std::sqrt((double)n)), rows = (n + cols - 1) / cols;+ float gap = 26, ar = g_W / g_H;+ float aw = g_W * 0.86f, ah = g_H * 0.80f;+ float tw = (aw - (cols - 1) * gap) / cols, th = tw / ar;+ if (th * rows + (rows - 1) * gap > ah) { th = (ah - (rows - 1) * gap) / rows; tw = th * ar; }+ float x0 = (g_W - (cols * tw + (cols - 1) * gap)) / 2, y0 = (g_H - (rows * th + (rows - 1) * gap)) / 2;+ int c = i % cols, r = i / cols;+ return D2D1::RectF(x0 + c * (tw + gap), y0 + r * (th + gap), x0 + c * (tw + gap) + tw, y0 + r * (th + gap) + th);+}+int Count() { return (int)g_sp.size() + (g_sp.size() < 16 ? 1 : 0); } // a última casa é o "+"++float Prog() {+ float k = (float)std::clamp((anim::Now() - g_at) / 320.0, 0.0, 1.0);+ k = anim::Ease(k);+ return g_closing ? 1 - k : k;+}+D2D1_RECT_F Lerp(D2D1_RECT_F a, D2D1_RECT_F b, float t) {+ return { a.left + (b.left - a.left) * t, a.top + (b.top - a.top) * t, a.right + (b.right - a.right) * t, a.bottom + (b.bottom - a.bottom) * t };+}++void DrawBitmapCover(ID2D1DeviceContext* dc, ID2D1Bitmap* b, D2D1_RECT_F r) {+ auto s = b->GetSize();+ float k = std::max((r.right - r.left) / s.width, (r.bottom - r.top) / s.height);+ float cx = (r.left + r.right) / 2, cy = (r.top + r.bottom) / 2;+ dc->PushAxisAlignedClip(r, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);+ dc->DrawBitmap(b, D2D1::RectF(cx - s.width * k / 2, cy - s.height * k / 2, cx + s.width * k / 2, cy + s.height * k / 2), 1, D2D1_INTERPOLATION_MODE_LINEAR);+ dc->PopAxisAlignedClip();+}++void DrawSpace(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, int i, D2D1_RECT_F r) {+ if (i == g_cur && g_shot) { dc->DrawBitmap(g_shot, r, 1, D2D1_INTERPOLATION_MODE_LINEAR); return; }+ if (g_wall) DrawBitmapCover(dc, g_wall, r);+ else { br->SetColor(D2D1::ColorF(0.20f, 0.28f, 0.45f)); dc->FillRectangle(r, br); }+ float kx = (r.right - r.left) / (g_mon.right - g_mon.left), ky = (r.bottom - r.top) / (g_mon.bottom - g_mon.top);+ static IDWriteTextFormat* ft = [] { auto* f = ui::FormatFace(L"Lucida Sans Unicode", 9, DWRITE_FONT_WEIGHT_NORMAL); if (f) { f->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER); f->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP); } return f; }();+ dc->PushAxisAlignedClip(r, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);+ for (auto& w : g_sp[i].wins) { // a janela em miniatura: corpo claro, a barra de metal com o nome e o ícone no meio+ D2D1_RECT_F q = D2D1::RectF(r.left + (w.r.left - g_mon.left) * kx, r.top + (w.r.top - g_mon.top) * ky,+ r.left + (w.r.right - g_mon.left) * kx, r.top + (w.r.bottom - g_mon.top) * ky);+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.30f));+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(q.left + 1, q.top + 2, q.right + 1, q.bottom + 3), 3, 3), br);+ br->SetColor(D2D1::ColorF(0.93f, 0.93f, 0.93f, 0.97f));+ dc->FillRoundedRectangle(D2D1::RoundedRect(q, 3, 3), br);+ float bh = std::min(14.f, (q.bottom - q.top) * 0.2f);+ leopard::Metal(dc, D2D1::RectF(q.left, q.top, q.right, q.top + bh), true, false, true, 3);+ if (ft && q.right - q.left > 40) {+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.8f));+ dc->DrawTextW(w.title.c_str(), (UINT32)w.title.size(), ft, D2D1::RectF(q.left + 4, q.top, q.right - 4, q.top + bh), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);+ }+ if (w.icon) {+ float s = std::min(40.f, std::min(q.right - q.left, q.bottom - q.top - bh) * 0.5f);+ float cx = (q.left + q.right) / 2, cy = (q.top + bh + q.bottom) / 2;+ dc->DrawBitmap(w.icon, D2D1::RectF(cx - s / 2, cy - s / 2, cx + s / 2, cy + s / 2), 1, D2D1_INTERPOLATION_MODE_LINEAR);+ }+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.35f));+ dc->DrawRoundedRectangle(D2D1::RoundedRect(q, 3, 3), br, 0.8f);+ }+ dc->PopAxisAlignedClip();+}++void Paint() {+ if (!g_open) return;+ float sc = Sc();+ RECT rc; GetClientRect(g_wnd, &rc);+ auto* dc = ui::GpuBegin(g_s, rc.right, rc.bottom, sc);+ if (!dc) return;+ ID2D1SolidColorBrush* br = nullptr;+ dc->CreateSolidColorBrush(D2D1::ColorF(0, 0, 0), &br);+ float k = Prog();+ D2D1_RECT_F full = D2D1::RectF(0, 0, g_W, g_H);+ br->SetColor(D2D1::ColorF(0.24f, 0.24f, 0.25f, std::min(1.f, k * 1.5f))); // o cinza do Spaces do 10.5+ dc->FillRectangle(full, br);+ int n = Count();+ int focus = g_pick >= 0 ? g_pick : g_cur; // a casa que cresce para a tela inteira (abrindo: a atual; escolhendo: a escolhida)+ ID2D1Layer* layer = nullptr; dc->CreateLayer(nullptr, &layer);+ static IDWriteTextFormat* fnum = [] { auto* f = ui::FormatFace(L"Lucida Sans Unicode", 13, DWRITE_FONT_WEIGHT_BOLD); if (f) { f->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER); f->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER); } return f; }();+ for (int pass = 0; pass < 2; pass++) // a casa em foco por último (por cima das outras enquanto cresce)+ for (int i = 0; i < n; i++) {+ bool f = i == focus;+ if ((pass == 0) == f) continue;+ D2D1_RECT_F t = Tile(i, n);+ D2D1_RECT_F r = f ? Lerp(full, t, k) : t;+ float a = f ? 1.f : k;+ dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), nullptr, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1::IdentityMatrix(), a), nullptr);+ if (i >= (int)g_sp.size()) { // a casa "+": criar outra área+ br->SetColor(D2D1::ColorF(1, 1, 1, g_hover == i ? 0.16f : 0.08f));+ dc->FillRoundedRectangle(D2D1::RoundedRect(r, 6, 6), br);+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.35f));+ ID2D1StrokeStyle* dash = nullptr; ID2D1Factory* fac = nullptr; dc->GetFactory(&fac);+ if (fac) { fac->CreateStrokeStyle(D2D1::StrokeStyleProperties(D2D1_CAP_STYLE_FLAT, D2D1_CAP_STYLE_FLAT, D2D1_CAP_STYLE_FLAT, D2D1_LINE_JOIN_MITER, 10, D2D1_DASH_STYLE_DASH), nullptr, 0, &dash); fac->Release(); }+ dc->DrawRoundedRectangle(D2D1::RoundedRect(r, 6, 6), br, 2, dash);+ if (dash) dash->Release();+ float cx = (r.left + r.right) / 2, cy = (r.top + r.bottom) / 2, s = std::min(r.right - r.left, r.bottom - r.top) * 0.12f;+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.7f));+ dc->DrawLine({ cx - s, cy }, { cx + s, cy }, br, 4); dc->DrawLine({ cx, cy - s }, { cx, cy + s }, br, 4);+ } else {+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.45f * k));+ dc->FillRectangle(D2D1::RectF(r.left + 2, r.top + 4, r.right + 2, r.bottom + 6), br);+ DrawSpace(dc, br, i, r);+ if (k > 0.05f) {+ // contorno: claro na área sob o mouse, mais forte na atual (como o destaque do 10.5)+ br->SetColor(D2D1::ColorF(1, 1, 1, (i == g_cur ? 0.85f : g_hover == i ? 0.6f : 0.18f) * k));+ dc->DrawRectangle(D2D1::RectF(r.left - 1.5f, r.top - 1.5f, r.right + 1.5f, r.bottom + 1.5f), br, i == g_cur || g_hover == i ? 3.f : 1.f);+ if (fnum) { // o número da área num selinho embaixo+ D2D1_RECT_F nb = D2D1::RectF((r.left + r.right) / 2 - 13, r.bottom - 30, (r.left + r.right) / 2 + 13, r.bottom - 8);+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.55f * k));+ dc->FillRoundedRectangle(D2D1::RoundedRect(nb, 11, 11), br);+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.95f * k));+ std::wstring s = std::to_wstring(i + 1);+ dc->DrawTextW(s.c_str(), (UINT32)s.size(), fnum, nb, br);+ }+ }+ }+ dc->PopLayer();+ }+ layer->Release();+ br->Release();+ ui::GpuEnd(g_s);+}++void HideNow() {+ ui::FrameClock(g_wnd, WM_SP_FRAME, false);+ ShowWindow(g_wnd, SW_HIDE);+ bool sw = g_pick >= 0 && g_pick != g_cur && g_pick < (int)g_sp.size();+ int to = g_pick;+ g_open = g_closing = false;+ Release();+ if (sw) mesas::Switch(to);+}+void Close(int pick) {+ if (!g_open || g_closing) return;+ g_pick = pick;+ g_closing = true; g_at = anim::Now();+ ui::FrameClock(g_wnd, WM_SP_FRAME, true);+}+int Hit(LPARAM l) {+ float sc = Sc();+ D2D1_POINT_2F p{ (short)LOWORD(l) / sc, (short)HIWORD(l) / sc };+ int n = Count();+ for (int i = 0; i < n; i++) { D2D1_RECT_F r = Tile(i, n); if (p.x >= r.left && p.x < r.right && p.y >= r.top && p.y < r.bottom) return i; }+ return -1;+}++LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {+ switch (m) {+ case WM_SP_FRAME:+ ui::FrameAck(h, WM_SP_FRAME);+ Paint();+ if (anim::Now() - g_at > 340) { if (g_closing) HideNow(); else ui::FrameClock(h, WM_SP_FRAME, false); }+ return 0;+ case WM_MOUSEMOVE: { int i = Hit(l); if (i != g_hover && !g_closing) { g_hover = i; Paint(); } return 0; }+ case WM_LBUTTONUP: {+ int i = Hit(l);+ if (i < 0) { Close(g_cur); return 0; }+ if (i >= (int)g_sp.size()) { // "+": cria a área e mostra a grade de novo+ if (mesas::Create()) { Release(); LoadSpaces(); Shot(); LoadWindows(); if (!g_shotPx.empty()) g_shot = ui::Bitmap(ui::Gpu(), g_shotW, g_shotH, g_shotPx); Paint(); }+ return 0;+ }+ Close(i);+ return 0;+ }+ case WM_KEYDOWN:+ if (w == VK_ESCAPE || w == VK_F8) Close(g_cur);+ else if (w >= '1' && w <= '9' && (int)(w - '1') < (int)g_sp.size()) Close((int)(w - '1'));+ return 0;+ case WM_ACTIVATE: if (LOWORD(w) == WA_INACTIVE && g_open && !g_closing) Close(g_cur); return 0;+ case WM_CLOSE: Close(g_cur); return 0;+ }+ return DefWindowProcW(h, m, w, l);+}++} // namespace++bool espacos::Create(HINSTANCE hi) {+ WNDCLASSW wc{}; wc.lpfnWndProc = Proc; wc.hInstance = hi; wc.lpszClassName = L"ShellSpaces"; wc.hCursor = LoadCursorW(nullptr, IDC_ARROW);+ RegisterClassW(&wc);+ g_wnd = CreateWindowExW(WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOREDIRECTIONBITMAP, wc.lpszClassName, L"Spaces", WS_POPUP, 0, 0, 10, 10, nullptr, nullptr, hi, nullptr);+ if (!g_wnd) return false;+ apps::ours.push_back(g_wnd);+ g_s.hwnd = g_wnd;+ return true;+}++bool espacos::IsOpen() { return g_open && !g_closing; }++void espacos::Toggle() {+ if (!g_wnd && !espacos::Create(shell::inst)) return;+ if (g_open) { if (!g_closing) Close(g_cur); return; }+ MONITORINFO mi{ sizeof(mi) };+ GetMonitorInfoW(MonitorFromPoint({ 0, 0 }, MONITOR_DEFAULTTOPRIMARY), &mi);+ g_mon = mi.rcMonitor;+ Release();+ LoadSpaces();+ Shot();+ LoadWindows();+ Wallpaper();+ if (!g_shotPx.empty()) g_shot = ui::Bitmap(ui::Gpu(), g_shotW, g_shotH, g_shotPx);+ SetWindowPos(g_wnd, HWND_TOPMOST, g_mon.left, g_mon.top, g_mon.right - g_mon.left, g_mon.bottom - g_mon.top, SWP_NOACTIVATE);+ float sc = Sc();+ g_W = (g_mon.right - g_mon.left) / sc; g_H = (g_mon.bottom - g_mon.top) / sc;+ g_open = true; g_closing = false; g_pick = -1; g_hover = -1; g_at = anim::Now();+ Paint();+ ShowWindow(g_wnd, SW_SHOW);+ HWND fg = GetForegroundWindow();+ DWORD ft = fg ? GetWindowThreadProcessId(fg, nullptr) : 0, me = GetCurrentThreadId();+ bool att = ft && ft != me && AttachThreadInput(me, ft, TRUE);+ SetForegroundWindow(g_wnd); SetFocus(g_wnd);+ if (att) AttachThreadInput(me, ft, FALSE);+ ui::FrameClock(g_wnd, WM_SP_FRAME, true);+ Log(L"spaces: %zu áreas, atual %d", g_sp.size(), g_cur + 1);+}diff --git a/src/shell/ilha.cpp b/src/shell/ilha.cppnew file mode 100644index 0000000..7e5cad5--- /dev/null+++ b/src/shell/ilha.cpp@@ -0,0 +1,1946 @@+// Ilha Dinâmica (Dynamic Island) no topo da tela, em três estilos (ajuste `ilha_estilo`):+// - notch (padrão): um entalhe preto grudado na borda de cima, centrado, da altura da barra de menus, com as+// "orelhas" côncavas do entalhe do MacBook. Fica sempre lá; cresce para os lados (asas) com o que está+// acontecendo e para baixo quando abre.+// - ilha: uma pílula preta sempre visível dentro da barra de menus, com contorno fino, brilho em cima e sombra.+// - notificacao: a mesma pílula, mas só aparece quando acontece alguma coisa (música, aviso, volume...).+//+// O que mostra fechada (asas): música (capa à esquerda, barrinhas na cor da capa à direita), timer correndo,+// volume, Caps Lock, bateria ao ligar/desligar da tomada, ponto verde/laranja com câmera/microfone em uso.+// "Espiada" (cresce para baixo uns segundos): notificações (no lugar do banner do canto), download concluído,+// timer concluído, texto copiado. Aberta (passar o ponteiro ou clicar), com abas no cabeçalho:+// Início (o player: capa, barrinhas, tempo com o restante na cor da capa, aleatório/anterior/tocar/próxima/saída),+// Timer, Transferência (histórico do que foi copiado, só na memória), Estante (arquivos arrastados para a ilha;+// arrastar de volta para fora) e Sistema (CPU, memória e rede com gráfico).+//+// Referência: o projeto Atoll (github.com/Ebullioscopic/Atoll, GPL-3.0, derivado do boring.notch). Nada do código+// dele foi copiado (é Swift/SwiftUI); vieram só as medidas e o comportamento observados: entalhe com raio de cima+// 6 / de baixo 14 fechado e 19 / 24 aberto, pílula com raio 24 aberta, mola de abrir (resposta 0,42) e de fechar+// (0,45, sem quicar), troca de atividade fechada (0,34 / 0,88), capa pequena nas asas, barrinhas e tempo restante+// na cor da capa, abas Início/Estante/Timer/Sistema/Transferência, espiadas, abrir ao passar o ponteiro.+//+// Janela de tamanho fixo com SetWindowRgn (retângulo) acompanhando a forma: redimensionar a swap chain a cada quadro+// da mola deixava a borda um quadro atrás do desenho. Fora da forma o clique passa para quem está embaixo.+// Ocioso tem que ser ocioso: mídia, microfone/câmera, downloads e área de transferência chegam por eventos; o relógio+// de quadros só roda enquanto a mola mexe; barrinhas (30 q/s), timer (4/s) e Sistema (1/s) só enquanto aparecem.+#include "shell.h"+#include "../comum/simbolos.h"+#include <mmdeviceapi.h>+#include <endpointvolume.h>+#include <wincodec.h>+#include <shcore.h>+#include <shlobj.h>+#include <shellapi.h>+#include <dwmapi.h>+#include <windowsx.h>+#include <iphlpapi.h>+#include <winrt/Windows.Foundation.h>+#include <winrt/Windows.Media.Control.h>+#include <winrt/Windows.Storage.Streams.h>+#include <algorithm>+#include <cmath>+#include <condition_variable>+#include <deque>+#include <map>+#include <mutex>+#include <thread>++#pragma comment(lib, "windowsapp.lib")+#pragma comment(lib, "iphlpapi.lib")+#pragma comment(lib, "dwmapi.lib")++namespace wmc = winrt::Windows::Media::Control;++namespace {++const UINT WM_IL_FRAME = WM_APP + 1, WM_IL_MEDIA = WM_APP + 2, WM_IL_CAPS = WM_APP + 3, WM_IL_PRIV = WM_APP + 4, WM_IL_DOWN = WM_APP + 5;+const UINT_PTR TM_HOVER = 1, TM_LEAVE = 2, TM_PEEK = 3, TM_HUD = 4, TM_EQ = 5, TM_PAUSE = 6, TM_GONE = 7, TM_TICK = 8, TM_STATS = 9, TM_CAPS = 10;++enum Style { S_NOTCH, S_ILHA, S_AVISO };+enum Mode { M_HIDDEN, M_IDLE, M_MEDIA, M_TIMER, M_HUD, M_PEEK, M_OPEN };+enum Tab { TAB_HOME, TAB_TIMER, TAB_CLIP, TAB_SHELF, TAB_STATS, TAB_N };+enum HudKind { HUD_VOL, HUD_CAPS, HUD_BAT };++// medidas em pt+const float WMAX = 470, HMAX = 210; // a janela: o maior tamanho (aberta) com folga para a mola e a sombra+const float PILL_H = 22; // pílula fechada (estilos ilha/notificação): cabe na barra de menus+const float OPEN_W = 300, BODY_H = 106; // aberta: corpo de 300 pt (o player do Atoll tem ~280) e conteúdo abaixo do cabeçalho+const float NOTCH_W = 184; // entalhe parado+const float SHADOW = 10; // margem da sombra (estilo ilha)++// ---- mola do SwiftUI (resposta, amortecimento), integrada por quadro: pode trocar de alvo no meio+struct Spr {+ float x = 0, v = 0, t = 0;+ bool Step(float dtMs, float response, float damping, float eps) {+ float wn = 6.2831853f / response, k = wn * wn, c = 4 * 3.1415927f * damping / response;+ float left = dtMs / 1000.f;+ while (left > 0) {+ float h = std::min(left, 0.002f);+ v += (-k * (x - t) - c * v) * h;+ x += v * h;+ left -= h;+ }+ if (std::fabs(x - t) < eps && std::fabs(v) < eps * 10) { x = t; v = 0; return false; }+ return true;+ }+};++HWND g_wnd;+ui::GpuSurface g_s;+bool g_on, g_notesOn, g_volOn, g_hoverOpen;+Style g_style = S_NOTCH;+float g_barPt = 24; // altura da barra de menus (pt)+bool g_full; // app em tela cheia no monitor principal (ou tela travada): some+bool g_shown;+Mode g_mode = M_HIDDEN, g_prev = M_HIDDEN;+double g_modeAt, g_frameAt;+int g_springKind; // 0 troca fechada, 1 abrindo, 2 fechando+Spr g_w, g_h, g_rt, g_rb, g_a; // largura, altura, raio de cima (orelha no notch), raio de baixo, opacidade+bool g_running;+RECT g_rgn{};+IDWriteTextFormat *g_tfTitle, *g_tfSub, *g_tfSmall, *g_tfSmallR, *g_tfSmallC, *g_tfWing, *g_tfWingR, *g_tfBig, *g_tfVal,+ *g_tfIcon, *g_tfIconS, *g_tfIconL, *g_tfChip;++// ---- estados+bool g_openOn, g_hoverIn, g_pauseHold, g_dragIn;+Tab g_tab = TAB_HOME;+double g_tabAt; int g_tabDir = 1;+struct Peek {+ std::wstring title, sub;+ wchar_t glyph = 0; D2D1_COLOR_F color{ 1, 1, 1, 1 };+ std::function<void(ID2D1DeviceContext*, ID2D1SolidColorBrush*, D2D1_RECT_F)> icon;+ std::function<void()> click;+};+bool g_peekOn; Peek g_peek;+bool g_hudOn; HudKind g_hud; float g_vol; bool g_mute; bool g_caps; int g_batPct; bool g_batAC;+int g_priv; // 1 microfone em uso, 2 câmera em uso+bool g_hasBattery;++// ---- timer+bool g_tRun, g_tPaused; double g_tEnd, g_tLeft, g_tTotal; // ms (anim::Now); g_tLeft quando pausado++// ---- mídia (escrita pela thread da mídia; a janela copia ao receber WM_IL_MEDIA)+struct Media {+ bool has = false, playing = false, shuffle = false, canShuffle = false;+ std::wstring title, artist, aumid;+ std::vector<BYTE> art; UINT aw = 0, ah = 0; unsigned artGen = 0;+ D2D1_COLOR_F tint{ 1, 1, 1, 1 };+ double pos = 0, len = 0, start = 0, at = 0;+};+std::mutex g_mmx;+std::condition_variable g_mcv;+Media g_md;+bool g_mWake, g_mRebind;+struct Cmd { int c; double v; };+std::vector<Cmd> g_cmds; // 1 tocar/pausar, 2 próxima, 3 anterior, 4 aleatório (v), 5 posição (v s)+bool g_mThread;+Media g_m;+unsigned g_artGenUi = ~0u;+ID2D1Bitmap* g_art;++// ---- barrinhas+IAudioMeterInformation* g_meter;+double g_meterAt, g_eqFrame;+float g_bars[4];++// ---- Transferência (só na memória) e Estante (%APPDATA%\Shell\estante.txt)+std::deque<std::wstring> g_clips;+bool g_selfCopy;+std::vector<std::wstring> g_shelf;+std::map<std::wstring, ID2D1Bitmap*> g_shelfIcons;++// ---- Sistema+struct Stats { std::deque<float> cpu, mem, net; float cpuNow = 0, memNow = 0; double down = 0, up = 0; } g_st;+ULONGLONG g_lastIdle, g_lastKern, g_lastUser; double g_lastNetAt;++// ---- interação+enum HitId { H_NONE, H_TAB, H_GEAR, H_PREV, H_PLAY, H_NEXT, H_SHUF, H_OUT, H_SEEK, H_ART, H_PRESET, H_TPAUSE, H_TSTOP, H_TPLUS,+ H_CLIP, H_CLIPCLR, H_SHELF, H_SHELFCLR };+struct Hit { HitId id; D2D1_RECT_F r; int arg = 0; };+std::vector<Hit> g_hits;+HitId g_hoverHit = H_NONE; int g_hoverArg = -1;+HitId g_pressHit = H_NONE; int g_pressArg = -1; POINT g_pressPt;+double g_flashAt; int g_flashClip = -1; // "Copiado" no item clicado++float Sc() { return ui::Scale(g_wnd); }+const D2D1_COLOR_F WHITE{ 1, 1, 1, 1 }, GRAY{ 1, 1, 1, 0.55f }, GRAY2{ 1, 1, 1, 0.35f };+const D2D1_COLOR_F ORANGE{ 1.f, 0.62f, 0.04f, 1 }, GREEN{ 0.2f, 0.84f, 0.29f, 1 }, RED{ 1.f, 0.27f, 0.23f, 1 };++void Update();+void Paint();+void UpdateTimers();++// ================= mídia (thread própria, por eventos)+void MediaWake(bool rebind) {+ { std::lock_guard<std::mutex> l(g_mmx); g_mWake = true; g_mRebind |= rebind; }+ g_mcv.notify_all();+}++bool DecodeThumb(const wmc::GlobalSystemMediaTransportControlsSessionMediaProperties& p, std::vector<BYTE>& px, UINT& w, UINT& h) {+ if (!p.Thumbnail()) return false;+ winrt::Windows::Storage::Streams::IRandomAccessStreamWithContentType stream{ nullptr };+ try { stream = p.Thumbnail().OpenReadAsync().get(); } catch (...) { return false; } // capa ilegível: segue sem ela+ if (!stream) return false;+ IStream* is = nullptr;+ bool ok = false;+ if (SUCCEEDED(CreateStreamOverRandomAccessStream(winrt::get_unknown(stream), IID_PPV_ARGS(&is)))) {+ IWICImagingFactory* f = nullptr;+ if (SUCCEEDED(CoCreateInstance(CLSID_WICImagingFactory, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&f)))) {+ IWICBitmapDecoder* dec = nullptr; IWICBitmapFrameDecode* fr = nullptr; IWICFormatConverter* cv = nullptr;+ IWICBitmapScaler* sc = nullptr;+ if (SUCCEEDED(f->CreateDecoderFromStream(is, nullptr, WICDecodeMetadataCacheOnDemand, &dec)) && SUCCEEDED(dec->GetFrame(0, &fr))) {+ UINT fw = 0, fh = 0; fr->GetSize(&fw, &fh);+ IWICBitmapSource* src = fr;+ if (fw > 256 || fh > 256) { // capa no máximo 256 px: menos memória e cópia+ float k = 256.f / std::max(fw, fh);+ if (SUCCEEDED(f->CreateBitmapScaler(&sc)) && SUCCEEDED(sc->Initialize(fr, std::max(1u, (UINT)(fw * k)), std::max(1u, (UINT)(fh * k)), WICBitmapInterpolationModeFant)))+ src = sc;+ }+ if (SUCCEEDED(f->CreateFormatConverter(&cv)) &&+ SUCCEEDED(cv->Initialize(src, GUID_WICPixelFormat32bppPBGRA, WICBitmapDitherTypeNone, nullptr, 0, WICBitmapPaletteTypeCustom))) {+ cv->GetSize(&w, &h);+ px.resize((size_t)w * h * 4);+ ok = SUCCEEDED(cv->CopyPixels(nullptr, w * 4, (UINT)px.size(), px.data()));+ if (!ok) px.clear();+ }+ }+ if (cv) cv->Release(); if (sc) sc->Release(); if (fr) fr->Release(); if (dec) dec->Release();+ f->Release();+ }+ is->Release();+ }+ return ok;+}++// cor das barrinhas e do tempo restante: a média da capa, viva e clara o bastante para aparecer no preto+D2D1_COLOR_F ArtTint(const std::vector<BYTE>& px) {+ double r = 0, g = 0, b = 0, n = 0;+ for (size_t i = 0; i + 3 < px.size(); i += 4 * 7) {+ double a = px[i + 3]; if (a < 8) continue;+ double pb = px[i] / a, pg = px[i + 1] / a, pr = px[i + 2] / a;+ double mx = std::max({ pr, pg, pb }), mn = std::min({ pr, pg, pb });+ double wgt = 0.25 + (mx - mn); // cores vivas pesam mais que cinzas+ r += pr * wgt; g += pg * wgt; b += pb * wgt; n += wgt;+ }+ if (n <= 0) return { 1, 1, 1, 1 };+ r /= n; g /= n; b /= n;+ double mx = std::max({ r, g, b, 0.001 });+ r /= mx; g /= mx; b /= mx;+ const double k = 0.25;+ return D2D1::ColorF((float)(r + (1 - r) * k), (float)(g + (1 - g) * k), (float)(b + (1 - b) * k), 1);+}++void MediaThread() {+ winrt::init_apartment(winrt::apartment_type::multi_threaded);+ wmc::GlobalSystemMediaTransportControlsSessionManager mgr{ nullptr };+ wmc::GlobalSystemMediaTransportControlsSession ses{ nullptr };+ winrt::event_token tProp{}, tPlay{}, tTime{};+ try {+ mgr = wmc::GlobalSystemMediaTransportControlsSessionManager::RequestAsync().get();+ mgr.CurrentSessionChanged([](auto&&, auto&&) { MediaWake(true); });+ } catch (...) { Log(L"ilha: sem acesso aos controles de mídia do Windows"); return; }+ std::wstring lastKey;+ for (;;) {+ bool rebind; std::vector<Cmd> cmds;+ {+ std::unique_lock<std::mutex> l(g_mmx);+ g_mcv.wait(l, [] { return g_mWake; });+ g_mWake = false; rebind = g_mRebind; g_mRebind = false; cmds.swap(g_cmds);+ }+ Media out;+ try {+ if (rebind) {+ if (ses) {+ try { ses.MediaPropertiesChanged(tProp); ses.PlaybackInfoChanged(tPlay); ses.TimelinePropertiesChanged(tTime); } catch (...) {}+ }+ ses = mgr.GetCurrentSession();+ if (ses) {+ tProp = ses.MediaPropertiesChanged([](auto&&, auto&&) { MediaWake(false); });+ tPlay = ses.PlaybackInfoChanged([](auto&&, auto&&) { MediaWake(false); });+ tTime = ses.TimelinePropertiesChanged([](auto&&, auto&&) { MediaWake(false); });+ }+ }+ if (ses) {+ double startNow;+ { std::lock_guard<std::mutex> l(g_mmx); startNow = g_md.start; }+ for (auto& c : cmds) {+ try {+ if (c.c == 1) ses.TryTogglePlayPauseAsync().get();+ else if (c.c == 2) ses.TrySkipNextAsync().get();+ else if (c.c == 3) ses.TrySkipPreviousAsync().get();+ else if (c.c == 4) ses.TryChangeShuffleActiveAsync(c.v != 0).get();+ else if (c.c == 5) ses.TryChangePlaybackPositionAsync((int64_t)((c.v + startNow) * 1e7)).get();+ } catch (...) {}+ }+ // sessão fechando: o Windows devolve objetos nulos (e um nulo do C++/WinRT derruba o Shell, não lança)+ auto pi = ses.GetPlaybackInfo();+ if (!pi) throw winrt::hresult_error(E_POINTER);+ auto st = pi.PlaybackStatus();+ using PS = wmc::GlobalSystemMediaTransportControlsSessionPlaybackStatus;+ out.has = st == PS::Playing || st == PS::Paused;+ out.playing = st == PS::Playing;+ if (auto ctl = pi.Controls()) out.canShuffle = ctl.IsShuffleEnabled();+ if (auto sh = pi.IsShuffleActive()) out.shuffle = sh.Value();+ out.aumid = ses.SourceAppUserModelId().c_str();+ auto p = ses.TryGetMediaPropertiesAsync().get();+ if (!p) throw winrt::hresult_error(E_POINTER);+ out.title = p.Title().c_str();+ out.artist = p.Artist().c_str();+ if (out.title.empty()) out.has = false; // sessão sem nada (aba do navegador parada)+ auto tl = ses.GetTimelineProperties();+ if (!tl) throw winrt::hresult_error(E_POINTER);+ double start = tl.StartTime().count() / 1e7, end = tl.EndTime().count() / 1e7, pos = tl.Position().count() / 1e7;+ out.start = start;+ out.len = std::max(0.0, end - start);+ pos -= start;+ if (out.playing && out.len > 0) { // o app avisa a posição de vez em quando: soma o tempo desde o aviso+ double age = std::chrono::duration<double>(winrt::clock::now() - tl.LastUpdatedTime()).count();+ if (age > 0 && age < 6 * 3600) pos += age;+ }+ out.pos = std::clamp(pos, 0.0, std::max(out.len, 0.0));+ out.at = anim::Now();+ std::wstring key = out.title + L"\x1f" + out.artist + L"\x1f" + out.aumid;+ bool needArt;+ { std::lock_guard<std::mutex> l(g_mmx); needArt = key != lastKey || g_md.art.empty(); }+ if (out.has && needArt) {+ std::vector<BYTE> px; UINT w = 0, h = 0;+ bool thumb = (bool)p.Thumbnail();+ if (DecodeThumb(p, px, w, h)) { out.tint = ArtTint(px); out.art = std::move(px); out.aw = w; out.ah = h; }+ else if (key != lastKey) Log(L"ilha: '%ls' sem capa (%ls)", out.title.c_str(), thumb ? L"não decodificou" : L"o app não mandou");+ }+ std::lock_guard<std::mutex> l(g_mmx);+ if (out.has && needArt && (!out.art.empty() || key != lastKey)) { // faixa nova (ou a capa chegou depois)+ g_md.art = std::move(out.art); g_md.aw = out.aw; g_md.ah = out.ah; g_md.tint = out.tint; g_md.artGen++;+ }+ if (out.has) lastKey = key;+ g_md.has = out.has; g_md.playing = out.playing; g_md.shuffle = out.shuffle; g_md.canShuffle = out.canShuffle;+ g_md.title = out.title; g_md.artist = out.artist; g_md.aumid = out.aumid;+ g_md.pos = out.pos; g_md.len = out.len; g_md.start = out.start; g_md.at = out.at;+ } else {+ std::lock_guard<std::mutex> l(g_mmx);+ g_md.has = g_md.playing = false;+ }+ } catch (...) {+ std::lock_guard<std::mutex> l(g_mmx);+ g_md.has = g_md.playing = false;+ }+ if (g_wnd) PostMessageW(g_wnd, WM_IL_MEDIA, 0, 0);+ }+}++void MediaStart() {+ if (g_mThread) return;+ g_mThread = true;+ { std::lock_guard<std::mutex> l(g_mmx); g_mWake = g_mRebind = true; }+ std::thread(MediaThread).detach();+}++void MediaCmd(int c, double v = 0) {+ { std::lock_guard<std::mutex> l(g_mmx); g_cmds.push_back({ c, v }); g_mWake = true; }+ g_mcv.notify_all();+}++// ================= microfone e câmera em uso (o mesmo registro que o Windows usa para o ícone da bandeja)+// HKCU\...\CapabilityAccessManager\ConsentStore\{microphone,webcam}\<app> (e NonPackaged\<exe>): em uso enquanto+// LastUsedTimeStart > 0 e LastUsedTimeStop = 0. Avisado por RegNotifyChangeKeyValue, sem reler em laço.+bool InUse(HKEY k) {+ bool use = false;+ wchar_t name[512];+ for (DWORD i = 0;; i++) {+ DWORD n = 512;+ if (RegEnumKeyExW(k, i, name, &n, nullptr, nullptr, nullptr, nullptr) != ERROR_SUCCESS) break;+ HKEY s;+ if (RegOpenKeyExW(k, name, 0, KEY_READ, &s) != ERROR_SUCCESS) continue;+ if (!_wcsicmp(name, L"NonPackaged")) use |= InUse(s);+ else {+ ULONGLONG a = 0, b = 1; DWORD cb = sizeof(a);+ RegQueryValueExW(s, L"LastUsedTimeStart", nullptr, nullptr, (BYTE*)&a, &cb); cb = sizeof(b);+ if (RegQueryValueExW(s, L"LastUsedTimeStop", nullptr, nullptr, (BYTE*)&b, &cb) == ERROR_SUCCESS && a && !b) use = true;+ }+ RegCloseKey(s);+ if (use) break;+ }+ return use;+}++void PrivacyThread() {+ const wchar_t* base = L"Software\\Microsoft\\Windows\\CurrentVersion\\CapabilityAccessManager\\ConsentStore\\";+ HKEY k[2]{};+ HANDLE ev[2]{};+ for (int i = 0; i < 2; i++) {+ RegOpenKeyExW(HKEY_CURRENT_USER, (std::wstring(base) + (i ? L"webcam" : L"microphone")).c_str(), 0, KEY_READ | KEY_NOTIFY, &k[i]);+ ev[i] = CreateEventW(nullptr, FALSE, FALSE, nullptr);+ }+ if (!k[0] && !k[1]) return;+ int last = -1;+ for (;;) {+ int bits = 0;+ for (int i = 0; i < 2; i++) {+ if (!k[i]) continue;+ RegNotifyChangeKeyValue(k[i], TRUE, REG_NOTIFY_CHANGE_LAST_SET | REG_NOTIFY_CHANGE_NAME, ev[i], TRUE);+ if (InUse(k[i])) bits |= i ? 2 : 1;+ }+ if (bits != last) { last = bits; if (g_wnd) PostMessageW(g_wnd, WM_IL_PRIV, bits, 0); }+ WaitForMultipleObjects(2, ev, FALSE, INFINITE);+ Sleep(150); // o app grava início/fim em seguida: lê uma vez só+ }+}++// ================= downloads concluídos (pasta Downloads, ReadDirectoryChangesW)+void DownloadsThread() {+ PWSTR p = nullptr;+ if (FAILED(SHGetKnownFolderPath(FOLDERID_Downloads, 0, nullptr, &p))) return;+ std::wstring dir = p; CoTaskMemFree(p);+ HANDLE h = CreateFileW(dir.c_str(), FILE_LIST_DIRECTORY, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr);+ if (h == INVALID_HANDLE_VALUE) return;+ alignas(DWORD) BYTE buf[16384];+ for (;;) {+ DWORD got = 0;+ if (!ReadDirectoryChangesW(h, buf, sizeof(buf), FALSE, FILE_NOTIFY_CHANGE_FILE_NAME, &got, nullptr, nullptr)) break;+ if (!got) continue;+ for (auto* fi = (FILE_NOTIFY_INFORMATION*)buf;; fi = (FILE_NOTIFY_INFORMATION*)((BYTE*)fi + fi->NextEntryOffset)) {+ if (fi->Action == FILE_ACTION_ADDED || fi->Action == FILE_ACTION_RENAMED_NEW_NAME) {+ std::wstring name(fi->FileName, fi->FileNameLength / sizeof(wchar_t));+ std::wstring low = name; for (auto& c : low) c = towlower(c);+ auto ends = [&](const wchar_t* e) { size_t n = wcslen(e); return low.size() >= n && low.compare(low.size() - n, n, e) == 0; };+ // arquivos parciais dos navegadores e temporários: espera virar o arquivo final+ bool partial = ends(L".crdownload") || ends(L".part") || ends(L".tmp") || ends(L".partial") || ends(L".download") || ends(L".opdownload") ||+ low.rfind(L"unconfirmed ", 0) == 0 || low[0] == L'~' || low[0] == L'.' || name.find(L'\\') != std::wstring::npos;+ if (!partial) {+ std::wstring full = dir + L"\\" + name;+ std::thread([full] {+ Sleep(500);+ WIN32_FILE_ATTRIBUTE_DATA fa{};+ if (!GetFileAttributesExW(full.c_str(), GetFileExInfoStandard, &fa) || (fa.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) return;+ if (!fa.nFileSizeHigh && !fa.nFileSizeLow) return;+ if (g_wnd) PostMessageW(g_wnd, WM_IL_DOWN, 0, (LPARAM)new std::wstring(full));+ }).detach();+ }+ }+ if (!fi->NextEntryOffset) break;+ }+ }+ CloseHandle(h);+}++// ================= barrinhas (nível de pico da saída padrão)+float Peak() {+ double now = anim::Now();+ if (!g_meter && now - g_meterAt > 3000) {+ g_meterAt = now;+ IMMDeviceEnumerator* en = nullptr; IMMDevice* dev = nullptr;+ if (SUCCEEDED(CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL, IID_PPV_ARGS(&en))) &&+ SUCCEEDED(en->GetDefaultAudioEndpoint(eRender, eConsole, &dev)))+ dev->Activate(__uuidof(IAudioMeterInformation), CLSCTX_ALL, nullptr, (void**)&g_meter);+ if (dev) dev->Release(); if (en) en->Release();+ }+ float p = 0;+ if (g_meter && FAILED(g_meter->GetPeakValue(&p))) { g_meter->Release(); g_meter = nullptr; p = 0; }+ return p;+}++void StepBars() {+ double now = anim::Now();+ float dt = (float)std::clamp(now - g_eqFrame, 1.0, 100.0);+ g_eqFrame = now;+ float t = (float)(now / 1000.0);+ static const float freq[4] = { 7.3f, 9.1f, 5.7f, 8.3f }, ph[4] = { 0.3f, 1.9f, 3.1f, 4.4f };+ float lvl = 0.18f;+ if (g_m.playing) {+ float p = Peak();+ lvl = p > 0.002f ? std::clamp(0.45f + std::sqrt(p) * 0.8f, 0.f, 1.f) : 0.8f; // sem medida: balanço calmo+ }+ for (int i = 0; i < 4; i++) {+ float target = g_m.playing ? lvl * (0.4f + 0.6f * std::fabs(std::sin(t * freq[i] + ph[i]))) : 0.18f;+ g_bars[i] += (target - g_bars[i]) * (1 - std::exp(-dt / 70.f));+ }+}++// ================= Sistema+void SampleStats() {+ FILETIME fi, fk, fu;+ if (GetSystemTimes(&fi, &fk, &fu)) {+ auto q = [](FILETIME f) { return ((ULONGLONG)f.dwHighDateTime << 32) | f.dwLowDateTime; };+ ULONGLONG i = q(fi), k = q(fk), u = q(fu);+ if (g_lastKern) {+ ULONGLONG di = i - g_lastIdle, dt = (k - g_lastKern) + (u - g_lastUser);+ g_st.cpuNow = dt ? std::clamp(1.f - (float)di / dt, 0.f, 1.f) : 0;+ g_st.cpu.push_back(g_st.cpuNow);+ }+ g_lastIdle = i; g_lastKern = k; g_lastUser = u;+ }+ MEMORYSTATUSEX ms{ sizeof(ms) };+ if (GlobalMemoryStatusEx(&ms)) { g_st.memNow = ms.dwMemoryLoad / 100.f; g_st.mem.push_back(g_st.memNow); }+ // GetIfTable2 pede o winsock2 (briga com o windows.h do Shell): o GetIfTable clássico, contadores de 32 bits+ // (a diferença em DWORD já trata a virada)+ ULONG sz = 0;+ GetIfTable(nullptr, &sz, FALSE);+ std::vector<BYTE> buf(sz ? sz : 1);+ auto* t = (MIB_IFTABLE*)buf.data();+ if (sz && GetIfTable(t, &sz, FALSE) == NO_ERROR) {+ static std::map<DWORD, std::pair<DWORD, DWORD>> last; // por interface: in/out da última leitura+ ULONGLONG din = 0, dout = 0;+ for (DWORD j = 0; j < t->dwNumEntries; j++) {+ auto& r = t->table[j];+ if (r.dwType == MIB_IF_TYPE_LOOPBACK || r.dwOperStatus != IF_OPER_STATUS_OPERATIONAL) continue;+ if (r.dwType != MIB_IF_TYPE_ETHERNET && r.dwType != IF_TYPE_IEEE80211) continue;+ auto it = last.find(r.dwIndex);+ if (it != last.end()) { din += (DWORD)(r.dwInOctets - it->second.first); dout += (DWORD)(r.dwOutOctets - it->second.second); }+ last[r.dwIndex] = { r.dwInOctets, r.dwOutOctets };+ }+ double now = anim::Now();+ if (g_lastNetAt > 0 && now > g_lastNetAt) {+ double s = (now - g_lastNetAt) / 1000.0;+ g_st.down = din / s; g_st.up = dout / s;+ g_st.net.push_back((float)(g_st.down + g_st.up));+ }+ g_lastNetAt = now;+ }+ for (auto* d : { &g_st.cpu, &g_st.mem, &g_st.net }) while (d->size() > 40) d->pop_front();+}++std::wstring Rate(double bps) {+ wchar_t b[32];+ if (bps >= 1e6) swprintf_s(b, L"%.1f MB/s", bps / 1e6);+ else swprintf_s(b, L"%.0f KB/s", bps / 1e3);+ return b;+}++// ================= Estante+std::wstring ShelfFile() {+ PWSTR p = nullptr;+ std::wstring r;+ if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &p))) { r = std::wstring(p) + L"\\Shell\\estante.txt"; CoTaskMemFree(p); }+ return r;+}++void ShelfSave() {+ std::wstring s;+ for (auto& p : g_shelf) s += p + L"\r\n";+ FILE* f = nullptr;+ if (_wfopen_s(&f, ShelfFile().c_str(), L"w, ccs=UTF-8") == 0 && f) { fputws(s.c_str(), f); fclose(f); }+}++void ShelfLoad() {+ g_shelf.clear();+ FILE* f = nullptr;+ if (_wfopen_s(&f, ShelfFile().c_str(), L"r, ccs=UTF-8") || !f) return;+ wchar_t line[1024];+ while (fgetws(line, 1024, f)) {+ std::wstring p = line;+ while (!p.empty() && (p.back() == L'\n' || p.back() == L'\r')) p.pop_back();+ if (!p.empty() && GetFileAttributesW(p.c_str()) != INVALID_FILE_ATTRIBUTES) g_shelf.push_back(p);+ }+ fclose(f);+}++void ShelfAdd(const std::wstring& p) {+ if (std::find(g_shelf.begin(), g_shelf.end(), p) != g_shelf.end()) return;+ g_shelf.push_back(p);+ if (g_shelf.size() > 24) g_shelf.erase(g_shelf.begin());+ ShelfSave();+}++ID2D1Bitmap* ShelfIcon(ID2D1DeviceContext* dc, const std::wstring& p) {+ auto it = g_shelfIcons.find(p);+ if (it != g_shelfIcons.end()) return it->second;+ UINT w = 0, h = 0; std::vector<BYTE> px;+ ID2D1Bitmap* b = ui::FileImage(p, 64, w, h, px) ? ui::Bitmap(dc, w, h, px) : nullptr;+ g_shelfIcons[p] = b;+ return b;+}++// arrastar de volta para fora: o objeto de dados do próprio Windows para o arquivo+struct DropSource : IDropSource {+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID r, void** o) override {+ if (r == IID_IUnknown || r == IID_IDropSource) { *o = this; return S_OK; }+ *o = nullptr; return E_NOINTERFACE;+ }+ ULONG STDMETHODCALLTYPE AddRef() override { return 2; }+ ULONG STDMETHODCALLTYPE Release() override { return 1; }+ HRESULT STDMETHODCALLTYPE QueryContinueDrag(BOOL esc, DWORD keys) override {+ if (esc) return DRAGDROP_S_CANCEL;+ if (!(keys & MK_LBUTTON)) return DRAGDROP_S_DROP;+ return S_OK;+ }+ HRESULT STDMETHODCALLTYPE GiveFeedback(DWORD) override { return DRAGDROP_S_USEDEFAULTCURSORS; }+} g_dropSrc;++void ShelfDragOut(int i) {+ if (i < 0 || i >= (int)g_shelf.size()) return;+ std::wstring p = g_shelf[i];+ IShellItem* it = nullptr; IDataObject* d = nullptr;+ if (SUCCEEDED(SHCreateItemFromParsingName(p.c_str(), nullptr, IID_PPV_ARGS(&it))) &&+ SUCCEEDED(it->BindToHandler(nullptr, BHID_DataObject, IID_PPV_ARGS(&d)))) {+ DWORD eff = 0;+ HRESULT hr = DoDragDrop(d, &g_dropSrc, DROPEFFECT_COPY | DROPEFFECT_MOVE | DROPEFFECT_LINK, &eff);+ if (hr == DRAGDROP_S_DROP && (eff & DROPEFFECT_MOVE || GetFileAttributesW(p.c_str()) == INVALID_FILE_ATTRIBUTES)) {+ g_shelf.erase(std::remove(g_shelf.begin(), g_shelf.end(), p), g_shelf.end());+ ShelfSave();+ }+ }+ if (d) d->Release();+ if (it) it->Release();+}++// arrastar arquivos para a ilha: abre na Estante+struct DropTarget : IDropTarget {+ bool files = false;+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID r, void** o) override {+ if (r == IID_IUnknown || r == IID_IDropTarget) { *o = this; return S_OK; }+ *o = nullptr; return E_NOINTERFACE;+ }+ ULONG STDMETHODCALLTYPE AddRef() override { return 2; }+ ULONG STDMETHODCALLTYPE Release() override { return 1; }+ HRESULT STDMETHODCALLTYPE DragEnter(IDataObject* d, DWORD, POINTL, DWORD* eff) override {+ FORMATETC fe{ CF_HDROP, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };+ files = d && d->QueryGetData(&fe) == S_OK;+ *eff = files ? DROPEFFECT_COPY : DROPEFFECT_NONE;+ if (files) {+ g_dragIn = true;+ KillTimer(g_wnd, TM_LEAVE);+ if (g_tab != TAB_SHELF) { g_tabDir = TAB_SHELF > g_tab ? 1 : -1; g_tab = TAB_SHELF; g_tabAt = anim::Now(); }+ g_openOn = true;+ Update();+ }+ return S_OK;+ }+ HRESULT STDMETHODCALLTYPE DragOver(DWORD, POINTL, DWORD* eff) override { *eff = files ? DROPEFFECT_COPY : DROPEFFECT_NONE; return S_OK; }+ HRESULT STDMETHODCALLTYPE DragLeave() override {+ g_dragIn = false;+ SetTimer(g_wnd, TM_LEAVE, 400, nullptr);+ return S_OK;+ }+ HRESULT STDMETHODCALLTYPE Drop(IDataObject* d, DWORD, POINTL, DWORD* eff) override {+ g_dragIn = false;+ *eff = DROPEFFECT_NONE;+ FORMATETC fe{ CF_HDROP, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };+ STGMEDIUM sm{};+ if (d && SUCCEEDED(d->GetData(&fe, &sm))) {+ if (HDROP hd = (HDROP)GlobalLock(sm.hGlobal)) {+ UINT n = DragQueryFileW(hd, 0xFFFFFFFF, nullptr, 0);+ for (UINT i = 0; i < n; i++) {+ wchar_t p[MAX_PATH * 2];+ if (DragQueryFileW(hd, i, p, MAX_PATH * 2)) ShelfAdd(p);+ }+ GlobalUnlock(sm.hGlobal);+ Log(L"ilha: %u arquivo(s) na Estante", n);+ }+ ReleaseStgMedium(&sm);+ *eff = DROPEFFECT_COPY;+ }+ SetTimer(g_wnd, TM_LEAVE, 1500, nullptr);+ if (!g_running) Paint();+ return S_OK;+ }+} g_dropTgt;++// ================= Transferência+void ReadClipboard() {+ static UINT exclude = RegisterClipboardFormatW(L"ExcludeClipboardContentFromMonitorProcessing");+ static UINT history = RegisterClipboardFormatW(L"CanIncludeInClipboardHistory");+ // gerenciadores de senha marcam o que não deve ir para históricos: respeita+ if (IsClipboardFormatAvailable(exclude)) return;+ if (!IsClipboardFormatAvailable(CF_UNICODETEXT)) return;+ for (int i = 0; i < 5 && !OpenClipboard(g_wnd); i++) Sleep(20);+ std::wstring s;+ bool skip = false;+ if (HANDLE hh = GetClipboardData(history)) { if (DWORD* v = (DWORD*)GlobalLock(hh)) { skip = *v == 0; GlobalUnlock(hh); } }+ if (!skip)+ if (HANDLE h = GetClipboardData(CF_UNICODETEXT)) {+ if (auto* t = (const wchar_t*)GlobalLock(h)) { s.assign(t, wcsnlen(t, 20000)); GlobalUnlock(h); }+ }+ CloseClipboard();+ size_t a = s.find_first_not_of(L" \t\r\n"), b = s.find_last_not_of(L" \t\r\n");+ if (skip || a == std::wstring::npos) return;+ s = s.substr(a, b - a + 1);+ g_clips.erase(std::remove(g_clips.begin(), g_clips.end(), s), g_clips.end());+ g_clips.push_front(s);+ while (g_clips.size() > 12) g_clips.pop_back();+}++void CopyText(const std::wstring& s) {+ if (!OpenClipboard(g_wnd)) return;+ EmptyClipboard();+ if (HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, (s.size() + 1) * sizeof(wchar_t))) {+ memcpy(GlobalLock(h), s.c_str(), (s.size() + 1) * sizeof(wchar_t));+ GlobalUnlock(h);+ if (!SetClipboardData(CF_UNICODETEXT, h)) GlobalFree(h);+ }+ CloseClipboard();+ g_selfCopy = true;+}++// ================= o que a ilha mostra+bool ShowsMedia() { return g_m.has && (g_m.playing || g_pauseHold); }+bool Notch() { return g_style == S_NOTCH; }+float HeadH() { return Notch() ? g_barPt : 28.f; } // cabeçalho das abas (no notch, a própria altura da barra)+float TopOff() { return Notch() ? 0.f : std::max(0.f, (g_barPt - PILL_H) / 2); }++Mode Want() {+ if (!g_on || g_full) return M_HIDDEN;+ if (g_peekOn) return M_PEEK;+ if (g_hudOn) return M_HUD;+ if (g_openOn) return M_OPEN;+ if (ShowsMedia()) return M_MEDIA;+ if (g_tRun) return M_TIMER;+ if (g_style == S_AVISO && !g_priv) return M_HIDDEN;+ return M_IDLE;+}++struct Size { float w, h, rt, rb; };+Size SizeOf(Mode m) {+ float priv = g_priv ? 24.f : 0.f; // ponto verde/laranja na asa direita+ if (Notch()) {+ const float H = g_barPt;+ if (liquid::Leopard()) { // o HUD do 10.5 pendurado reto da barra (sem as orelhas do entalhe moderno), cantos de painel 6/10+ switch (m) {+ case M_IDLE: return { NOTCH_W + priv, H, 0, 6 };+ case M_MEDIA: case M_TIMER: return { NOTCH_W + 2 * 40 + priv, H, 0, 6 };+ case M_HUD: return { NOTCH_W + 2 * 66, H, 0, 6 };+ case M_PEEK: return { 320, H + 50, 0, 10 };+ case M_OPEN: return { OPEN_W, H + BODY_H, 0, 10 };+ default: return { NOTCH_W * 0.7f, H * 0.5f, 0, 4 };+ }+ }+ switch (m) {+ case M_IDLE: return { NOTCH_W + priv, H, 6, 9 };+ case M_MEDIA: case M_TIMER: return { NOTCH_W + 2 * 40 + priv, H, 6, 9 };+ case M_HUD: return { NOTCH_W + 2 * 66, H, 6, 9 };+ case M_PEEK: return { 320 + 2 * 12, H + 50, 12, 20 };+ case M_OPEN: return { OPEN_W + 2 * 19, H + BODY_H, 19, 24 }; // largura com as orelhas (Atoll: 19 em cima, 24 embaixo)+ default: return { NOTCH_W * 0.7f, H * 0.5f, 4, 6 };+ }+ }+ switch (m) {+ case M_IDLE: return { 112 + priv, PILL_H, 11, 11 };+ case M_MEDIA: case M_TIMER: return { 232 + priv, PILL_H, 11, 11 };+ case M_HUD: return { 244, PILL_H, 11, 11 };+ case M_PEEK: return { 320, 54, 20, 20 };+ case M_OPEN: { // cantos do cartão por tema: Golden Gate maiores (macOS 27), Leopard o HUD do 10.5+ float r = liquid::Golden() ? 30.f : liquid::Leopard() ? 12.f : 24.f;+ return { OPEN_W, 28 + BODY_H, r, r };+ }+ default: return { 90, 14, 7, 7 };+ }+}++void UpdateTimers() {+ bool eq = g_shown && g_m.has && (g_mode == M_MEDIA || (g_mode == M_OPEN && g_tab == TAB_HOME)) &&+ (g_m.playing || std::any_of(std::begin(g_bars), std::end(g_bars), [](float b) { return std::fabs(b - 0.18f) > 0.01f; }));+ if (eq) SetTimer(g_wnd, TM_EQ, 33, nullptr); else KillTimer(g_wnd, TM_EQ);+ bool tick = g_shown && g_tRun && (g_mode == M_TIMER || g_mode == M_MEDIA || (g_mode == M_OPEN && g_tab == TAB_TIMER));+ if (g_tRun && !g_tPaused) SetTimer(g_wnd, TM_TICK, 250, nullptr); // corre mesmo escondido: precisa avisar ao acabar+ else KillTimer(g_wnd, TM_TICK);+ (void)tick;+ if (g_shown && g_mode == M_OPEN && g_tab == TAB_STATS) {+ if (g_st.cpu.empty() && !g_lastKern) SampleStats();+ SetTimer(g_wnd, TM_STATS, 1000, nullptr);+ } else KillTimer(g_wnd, TM_STATS);+}++void Place() {+ HMONITOR mon = MonitorFromPoint({ 0, 0 }, MONITOR_DEFAULTTOPRIMARY);+ MONITORINFO mi{ sizeof(mi) };+ GetMonitorInfoW(mon, &mi);+ UINT dpi = 96;+ if (HWND mb = menubar::Hwnd()) dpi = GetDpiForWindow(mb);+ float sc = dpi / 96.f;+ g_barPt = std::max(18.f, menubar::HeightOn(mon) / sc);+ int w = (int)std::lround(WMAX * sc), h = (int)std::lround(HMAX * sc);+ int x = mi.rcMonitor.left + (mi.rcMonitor.right - mi.rcMonitor.left - w) / 2;+ SetWindowPos(g_wnd, HWND_TOPMOST, x, mi.rcMonitor.top, w, h, SWP_NOACTIVATE | (g_shown ? 0 : SWP_NOREDRAW));+}++void StartFrames() {+ if (g_running) return;+ g_running = true;+ g_frameAt = anim::Now();+ ui::FrameClock(g_wnd, WM_IL_FRAME, true);+}++bool FullOnPrimary();+void Update() {+ if (!g_wnd) return;+ Mode m = Want();+ // ia aparecer do nada: confere antes se não há algo em tela cheia (vídeo que entrou em tela cheia sem trocar de janela)+ if (m != M_HIDDEN && !g_shown && FullOnPrimary()) { g_full = true; Log(L"ilha: tela cheia, some"); m = M_HIDDEN; }+ double now = anim::Now();+ if (m != g_mode) {+ bool big = m == M_OPEN || m == M_PEEK, wasBig = g_mode == M_OPEN || g_mode == M_PEEK;+ g_springKind = big ? 1 : wasBig ? 2 : 0;+ g_prev = now - g_modeAt < 90 ? g_prev : g_mode;+ g_mode = m;+ g_modeAt = now;+ g_hits.clear();+ if (m != M_OPEN) { g_hoverHit = g_pressHit = H_NONE; }+ Log(L"ilha: %d -> %d", (int)g_prev, (int)m);+ }+ Size s = SizeOf(m);+ float a = m == M_HIDDEN ? 0.f : 1.f;+ bool retarget = s.w != g_w.t || s.h != g_h.t || s.rt != g_rt.t || s.rb != g_rb.t || a != g_a.t;+ g_w.t = s.w; g_h.t = s.h; g_rt.t = s.rt; g_rb.t = s.rb; g_a.t = a;+ if (m != M_HIDDEN && !g_shown) {+ // vem do nada: nasce menor e transparente e cresce com a mola+ Size s0 = SizeOf(M_HIDDEN);+ g_w.x = s0.w; g_h.x = s0.h; g_rt.x = s0.rt; g_rb.x = s0.rb; g_a.x = 0;+ g_w.v = g_h.v = g_rt.v = g_rb.v = g_a.v = 0;+ g_prev = M_HIDDEN;+ Place();+ g_shown = true;+ Paint();+ ShowWindow(g_wnd, SW_SHOWNOACTIVATE);+ }+ if (g_shown) SetWindowPos(g_wnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); // acima da barra de menus+ if (retarget || now - g_modeAt < 1) StartFrames();+ UpdateTimers();+}++void ShowPeek(Peek p, UINT ms) {+ g_peek = std::move(p);+ bool again = g_peekOn && g_mode == M_PEEK;+ g_peekOn = true;+ g_hudOn = false; KillTimer(g_wnd, TM_HUD);+ SetTimer(g_wnd, TM_PEEK, ms, nullptr);+ if (again) { g_modeAt = anim::Now() - 90; g_prev = M_PEEK; StartFrames(); } // outra espiada: só o conteúdo troca+ Update();+}++void ShowHud(HudKind k, UINT ms) {+ g_hud = k;+ g_hudOn = true;+ SetTimer(g_wnd, TM_HUD, ms, nullptr);+ if (g_mode == M_HUD) { if (!g_running) Paint(); }+ else Update();+}++// ---- timer+double TimerLeft() { return !g_tRun ? 0 : g_tPaused ? g_tLeft : std::max(0.0, g_tEnd - anim::Now()); }+void TimerStart(double minutes) {+ g_tTotal = minutes * 60000; g_tEnd = anim::Now() + g_tTotal; g_tRun = true; g_tPaused = false;+ Log(L"ilha: timer de %.0f min", minutes);+ Update();+}+void TimerStop() { g_tRun = g_tPaused = false; Update(); }++std::wstring Clock(double s) {+ int t = (int)std::max(0.0, std::ceil(s - 0.001));+ wchar_t b[32];+ if (t >= 3600) swprintf_s(b, L"%d:%02d:%02d", t / 3600, t / 60 % 60, t % 60);+ else swprintf_s(b, L"%d:%02d", t / 60, t % 60);+ return b;+}+std::wstring ClockFloor(double s) {+ int t = (int)std::max(0.0, s);+ wchar_t b[32];+ if (t >= 3600) swprintf_s(b, L"%d:%02d:%02d", t / 3600, t / 60 % 60, t % 60);+ else swprintf_s(b, L"%d:%02d", t / 60, t % 60);+ return b;+}++// ================= desenho+void Text(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const std::wstring& s, IDWriteTextFormat* tf, D2D1_RECT_F r, D2D1_COLOR_F c) {+ if (!tf || s.empty()) return;+ br->SetColor(c);+ dc->DrawText(s.c_str(), (UINT32)s.size(), tf, r, br, D2D1_DRAW_TEXT_OPTIONS_CLIP);+}+void Glyph(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, wchar_t g, IDWriteTextFormat* tf, D2D1_RECT_F r, D2D1_COLOR_F c) {+ wchar_t s[2] = { g, 0 };+ br->SetColor(c);+ dc->DrawText(s, 1, tf, r, br);+}+void Sym(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const wchar_t* name, D2D1_RECT_F r, D2D1_COLOR_F c) {+ br->SetColor(c);+ simbolo::Draw(dc, name, r, br);+}+D2D1_RECT_F Around(float cx, float cy, float w, float h) { return D2D1::RectF(cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2); }+void AddHit(HitId id, D2D1_RECT_F r, int arg = 0) { g_hits.push_back({ id, r, arg }); }+bool Hover(HitId id, int arg = 0) { return g_hoverHit == id && (g_hoverArg == arg || id != H_CLIP && id != H_SHELF && id != H_TAB && id != H_PRESET); }++void DrawArt(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F r, float rad) {+ if (g_art) {+ D2D1_SIZE_F bs = g_art->GetSize();+ float side = std::min(bs.width, bs.height);+ D2D1_RECT_F src = D2D1::RectF((bs.width - side) / 2, (bs.height - side) / 2, (bs.width + side) / 2, (bs.height + side) / 2);+ ID2D1Factory* f = nullptr; dc->GetFactory(&f); // geometria da fábrica do contexto (D2DERR_WRONG_FACTORY)+ ID2D1RoundedRectangleGeometry* gg = nullptr;+ if (f) { f->CreateRoundedRectangleGeometry(D2D1::RoundedRect(r, rad, rad), &gg); f->Release(); }+ if (gg) dc->PushLayer(D2D1::LayerParameters1(D2D1::InfiniteRect(), gg, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE), nullptr);+ dc->DrawBitmap(g_art, r, 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC, src);+ if (gg) { dc->PopLayer(); gg->Release(); }+ return;+ }+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.14f));+ dc->FillRoundedRectangle(D2D1::RoundedRect(r, rad, rad), br);+ float s = r.right - r.left;+ Sym(dc, br, L"music.note", D2D1::RectF(r.left + s * 0.28f, r.top + s * 0.25f, r.right - s * 0.28f, r.bottom - s * 0.25f), D2D1::ColorF(1, 1, 1, 0.6f));+}++void DrawBars(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F r) { // 4 barrinhas encostadas à direita de r+ const float bw = 3, gap = 2.2f;+ float total = 4 * bw + 3 * gap, x = r.right - total, cy = (r.top + r.bottom) / 2, hmax = r.bottom - r.top;+ br->SetColor(g_m.tint);+ for (int i = 0; i < 4; i++) {+ float h = std::max(bw, g_bars[i] * hmax);+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(x, cy - h / 2, x + bw, cy + h / 2), bw / 2, bw / 2), br);+ x += bw + gap;+ }+}++void DrawPrivDot(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F b) {+ if (!g_priv) return;+ float cy = (b.top + b.bottom) / 2, x = b.right - 13;+ br->SetColor(g_priv & 2 ? GREEN : ORANGE); // câmera ganha (verde); só o microfone, laranja+ dc->FillEllipse(D2D1::Ellipse({ x, cy }, 3.2f, 3.2f), br);+}++// caixa do conteúdo: tamanho final do modo, centrada no topo da janela (com o deslocamento da pílula)+D2D1_RECT_F BoxOf(Mode m) {+ Size s = SizeOf(m);+ float top = TopOff();+ return D2D1::RectF((WMAX - s.w) / 2, top, (WMAX + s.w) / 2, top + s.h);+}++void DrawProgress(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F tr, float f, D2D1_COLOR_F c) {+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.2f));+ float r = (tr.bottom - tr.top) / 2;+ dc->FillRoundedRectangle(D2D1::RoundedRect(tr, r, r), br);+ if (f > 0.001f) {+ br->SetColor(c);+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(tr.left, tr.top, tr.left + std::max(2 * r, f * (tr.right - tr.left)), tr.bottom), r, r), br);+ }+}++void CircleBtn(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F r, HitId id, bool always = false, int arg = 0) {+ float cx = (r.left + r.right) / 2, cy = (r.top + r.bottom) / 2, rad = std::min(r.right - r.left, r.bottom - r.top) / 2;+ bool hv = Hover(id, arg);+ if (hv || always) {+ br->SetColor(D2D1::ColorF(1, 1, 1, (g_pressHit == id ? 0.22f : hv ? 0.13f : 0.08f)));+ dc->FillEllipse(D2D1::Ellipse({ cx, cy }, rad, rad), br);+ }+}++// ---- acabamento por tema (Sequoia, Tahoe, Golden Gate, Leopard)+// O notch é sempre preto (como o entalhe de verdade); o que muda por tema é o desenho dos botões, das fichas e da+// barra de tempo, e no estilo "ilha" o próprio corpo: Sequoia = preto com contorno fino e brilho; Tahoe = vidro+// escuro com a borda especular do Liquid Glass; Golden Gate = o mesmo com cantos maiores e brilho mais forte;+// Leopard = o painel HUD do Mac OS X 10.5 (cinza-escuro translúcido, verniz em cima, contorno claro, Lucida Grande,+// barra de progresso em gel azul).+enum Theme { TH_SEQUOIA, TH_TAHOE, TH_GOLDEN, TH_LEOPARD };+Theme g_theme = TH_SEQUOIA;+Theme ThemeNow() { return liquid::Leopard() ? TH_LEOPARD : liquid::Golden() ? TH_GOLDEN : liquid::On() ? TH_TAHOE : TH_SEQUOIA; }+bool Glassy() { return g_theme == TH_TAHOE || g_theme == TH_GOLDEN; }+float ChipR(float h) { return g_theme == TH_LEOPARD ? 5.f : g_theme == TH_GOLDEN ? h / 2 : g_theme == TH_TAHOE ? h / 2 : 9.f; }+D2D1_COLOR_F Accent() {+ if (g_theme == TH_LEOPARD) return D2D1::ColorF(0.33f, 0.6f, 1.f, 1);+ if (Glassy()) { D2D1_COLOR_F a = ui::Accent(); return D2D1::ColorF(a.r * 0.7f + 0.3f, a.g * 0.7f + 0.3f, a.b * 0.7f + 0.3f, 1); }+ return WHITE;+}++// ficha/botão de fundo: preenchimento do tema (+ a borda de vidro no Tahoe/Golden Gate, o verniz no Leopard)+void Chip(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F r, float rad, float level) { // level 0 repouso, 1 ponteiro, 2 apertado+ float a = level >= 2 ? 0.22f : level >= 1 ? 0.15f : 0.09f;+ br->SetColor(D2D1::ColorF(1, 1, 1, a));+ dc->FillRoundedRectangle(D2D1::RoundedRect(r, rad, rad), br);+ if (Glassy()) liquid::Rim(dc, r, rad, true, g_theme == TH_GOLDEN ? 0.9f : 0.6f, level >= 1 ? 1.f : 0.f);+ else if (g_theme == TH_LEOPARD) {+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.10f));+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 1, r.top + 1, r.right - 1, (r.top + r.bottom) / 2), std::max(0.f, rad - 1), std::max(0.f, rad - 1)), br);+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.28f));+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 0.5f, r.top + 0.5f, r.right - 0.5f, r.bottom - 0.5f), rad, rad), br, 1);+ }+}++void DrawProgressT(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F tr, float f) {+ if (g_theme != TH_LEOPARD) { DrawProgress(dc, br, tr, f, D2D1::ColorF(1, 1, 1, 0.92f)); return; }+ // Leopard: trilho escuro afundado e o gel azul com o verniz+ float r = (tr.bottom - tr.top) / 2;+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.55f));+ dc->FillRoundedRectangle(D2D1::RoundedRect(tr, r, r), br);+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.22f));+ dc->DrawRoundedRectangle(D2D1::RoundedRect(tr, r, r), br, 0.75f);+ if (f > 0.001f) {+ D2D1_RECT_F fr = D2D1::RectF(tr.left, tr.top, tr.left + std::max(2 * r, f * (tr.right - tr.left)), tr.bottom);+ br->SetColor(D2D1::ColorF(0.2f, 0.48f, 0.95f, 1));+ dc->FillRoundedRectangle(D2D1::RoundedRect(fr, r, r), br);+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.35f));+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(fr.left, fr.top, fr.right, (fr.top + fr.bottom) / 2), r / 2, r / 2), br);+ }+}++// ---- abas+const wchar_t TAB_GLYPH[TAB_N] = { 0xE80F, 0xE916, 0xE77F, 0xE7B8, 0xE9D9 };+const wchar_t* TAB_NAME[TAB_N] = { L"Início", L"Timer", L"Transferência", L"Estante", L"Sistema" };++// b = o corpo (no notch, sem as orelhas); o cabeçalho fica na faixa da barra de menus, como as abas do Atoll+void DrawHeader(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F b) {+ float H = HeadH(), cy = b.top + H / 2 + (Notch() ? 0 : 2);+ float x = b.left + 12;+ for (int i = 0; i < TAB_N; i++) {+ D2D1_RECT_F r = D2D1::RectF(x, cy - 9, x + 24, cy + 9);+ bool on = g_tab == i;+ if (on && g_theme == TH_LEOPARD) { // o segmento escolhido em gel azul Aqua+ float rr = 5;+ br->SetColor(D2D1::ColorF(0.16f, 0.42f, 0.92f, 1));+ dc->FillRoundedRectangle(D2D1::RoundedRect(r, rr, rr), br);+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.30f));+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 1, r.top + 1, r.right - 1, (r.top + r.bottom) / 2), rr - 1, rr - 1), br);+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.5f));+ dc->DrawRoundedRectangle(D2D1::RoundedRect(r, rr, rr), br, 0.75f);+ } else if (on || Hover(H_TAB, i)) Chip(dc, br, r, ChipR(18), on ? 1.f : 0.f);+ Glyph(dc, br, TAB_GLYPH[i], g_tfIconS, r, on ? WHITE : GRAY);+ AddHit(H_TAB, r, i);+ x += 27;+ }+ D2D1_RECT_F gr = D2D1::RectF(b.right - 12 - 22, cy - 9, b.right - 12, cy + 9);+ if (Hover(H_GEAR)) Chip(dc, br, gr, ChipR(18), 1);+ Glyph(dc, br, 0xE713, g_tfIconS, gr, GRAY);+ AddHit(H_GEAR, gr);+}++// o player do Atoll (modo minimalista), nas proporções da captura do projeto: capa 40 pt a 14 pt da borda,+// título 12,5 / artista 11, barrinhas à direita na altura do título; linha do tempo 3 pt com o restante na cor da+// capa; 5 botões a 50 pt um do outro+void DrawHome(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F b, float y0) {+ const float L = b.left + 14, R = b.right - 16;+ D2D1_RECT_F art = D2D1::RectF(L, y0, L + 40, y0 + 40);+ DrawArt(dc, br, art, g_theme == TH_LEOPARD ? 4.f : g_theme == TH_GOLDEN ? 11.f : 9.f);+ if (g_theme == TH_LEOPARD) {+ // o reflexo do Cover Flow embaixo da capa: espelhada, sumindo em 10 pt+ ID2D1GradientStopCollection* gs = nullptr;+ D2D1_GRADIENT_STOP st[] = { { 0, D2D1::ColorF(0, 0, 0, 0.35f) }, { 1, D2D1::ColorF(0, 0, 0, 0) } };+ dc->CreateGradientStopCollection(st, 2, &gs);+ ID2D1LinearGradientBrush* mask = nullptr;+ if (gs) dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, art.bottom + 1 }, { 0, art.bottom + 11 }), gs, &mask);+ if (mask) {+ D2D1_MATRIX_3X2_F old; dc->GetTransform(&old);+ dc->PushLayer(D2D1::LayerParameters1(D2D1::RectF(art.left, art.bottom + 1, art.right, art.bottom + 11), nullptr, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1::IdentityMatrix(), 1, mask), nullptr);+ dc->SetTransform(D2D1::Matrix3x2F::Scale(1, -1, { 0, art.bottom + 0.5f }) * old);+ DrawArt(dc, br, art, 4);+ dc->SetTransform(old);+ dc->PopLayer();+ mask->Release();+ }+ if (gs) gs->Release();+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.25f)); // moldura fina da capa, como os ícones do 10.5+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(art.left + 0.5f, art.top + 0.5f, art.right - 0.5f, art.bottom - 0.5f), 3.5f, 3.5f), br, 1);+ }+ AddHit(H_ART, art);+ bool has = g_m.has;+ Text(dc, br, has ? g_m.title : Tr(L"Nada tocando"), g_tfTitle, D2D1::RectF(art.right + 9, y0 + 3, R - 24, y0 + 20), WHITE);+ if (has) Text(dc, br, g_m.artist, g_tfSub, D2D1::RectF(art.right + 9, y0 + 20, R - 24, y0 + 35), GRAY);+ if (has) DrawBars(dc, br, D2D1::RectF(R - 16, y0 + 6, R, y0 + 18));+ float ty = y0 + 54;+ double pos = 0, len = g_m.len;+ bool tl = has && len > 1;+ if (tl) pos = std::clamp(g_m.pos + (g_m.playing ? (anim::Now() - g_m.at) / 1000.0 : 0), 0.0, len);+ D2D1_RECT_F tr = D2D1::RectF(L + 36, ty - 1.5f, R - 38, ty + 1.5f);+ Text(dc, br, tl ? ClockFloor(pos) : L"", g_tfSmall, D2D1::RectF(L, ty - 7, tr.left - 4, ty + 7), WHITE);+ Text(dc, br, tl ? L"-" + ClockFloor(len - pos) : L"", g_tfSmallR, D2D1::RectF(tr.right + 4, ty - 7, R, ty + 7), g_theme == TH_LEOPARD ? Accent() : g_m.tint);+ DrawProgressT(dc, br, Hover(H_SEEK) ? D2D1::RectF(tr.left, ty - 2.5f, tr.right, ty + 2.5f) : tr, tl ? (float)(pos / len) : 0);+ if (tl) AddHit(H_SEEK, D2D1::RectF(tr.left, ty - 7, tr.right, ty + 7));+ float cy = y0 + 82, cx = (b.left + b.right) / 2;+ D2D1_COLOR_F ink = has ? WHITE : GRAY2;+ struct B { HitId id; float x; } bs[] = { { H_SHUF, cx - 100 }, { H_PREV, cx - 50 }, { H_PLAY, cx }, { H_NEXT, cx + 50 }, { H_OUT, cx + 100 } };+ for (auto& bt : bs) {+ float s = bt.id == H_PLAY ? 32.f : 28.f;+ D2D1_RECT_F r = Around(bt.x, cy, s, s);+ bool live = has || bt.id == H_OUT;+ if (live && (Hover(bt.id) || g_pressHit == bt.id)) Chip(dc, br, r, s / 2, g_pressHit == bt.id ? 2.f : 1.f);+ switch (bt.id) {+ case H_SHUF: Glyph(dc, br, 0xE8B1, g_tfIconS, r, has && g_m.shuffle ? (g_theme == TH_SEQUOIA ? g_m.tint : Accent()) : has && g_m.canShuffle ? WHITE : GRAY2); break;+ case H_OUT: Glyph(dc, br, 0xE7F4, g_tfIconS, r, WHITE); break; // a saída de som (o menu Som)+ case H_PLAY:+ if (g_m.playing) Sym(dc, br, L"pause.fill", Around(bt.x, cy, 13, 17), ink);+ else Sym(dc, br, L"play.fill", Around(bt.x + 1.5f, cy, 15, 17), ink);+ break;+ default: {+ D2D1_RECT_F sr = Around(bt.x, cy, 21, 12);+ if (bt.id == H_PREV) { // não há "backward.fill" no pacote: o "forward.fill" espelhado+ D2D1_MATRIX_3X2_F old; dc->GetTransform(&old);+ dc->SetTransform(D2D1::Matrix3x2F::Scale(-1, 1, { bt.x, cy }) * old);+ Sym(dc, br, L"forward.fill", sr, ink);+ dc->SetTransform(old);+ } else Sym(dc, br, L"forward.fill", sr, ink);+ }+ }+ if (live) AddHit(bt.id, r);+ }+}++void Ring(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_POINT_2F c, float rad, float f, float stroke) {+ br->SetColor(D2D1::ColorF(1.f, 0.62f, 0.04f, 0.22f));+ dc->DrawEllipse(D2D1::Ellipse(c, rad, rad), br, stroke);+ if (f <= 0.001f) return;+ ID2D1Factory* fac = nullptr; dc->GetFactory(&fac);+ ID2D1PathGeometry* g = nullptr;+ if (fac && SUCCEEDED(fac->CreatePathGeometry(&g))) {+ ID2D1GeometrySink* s = nullptr; g->Open(&s);+ float a0 = -3.1415927f / 2, a1 = a0 + 6.2831853f * std::min(f, 0.9999f);+ s->BeginFigure({ c.x + rad * std::cos(a0), c.y + rad * std::sin(a0) }, D2D1_FIGURE_BEGIN_HOLLOW);+ s->AddArc(D2D1::ArcSegment({ c.x + rad * std::cos(a1), c.y + rad * std::sin(a1) }, D2D1::SizeF(rad, rad), 0, D2D1_SWEEP_DIRECTION_CLOCKWISE,+ f > 0.5f ? D2D1_ARC_SIZE_LARGE : D2D1_ARC_SIZE_SMALL));+ s->EndFigure(D2D1_FIGURE_END_OPEN); s->Close(); s->Release();+ ID2D1StrokeStyle* ss = nullptr;+ fac->CreateStrokeStyle(D2D1::StrokeStyleProperties(D2D1_CAP_STYLE_ROUND, D2D1_CAP_STYLE_ROUND), nullptr, 0, &ss);+ br->SetColor(ORANGE);+ dc->DrawGeometry(g, br, stroke, ss);+ if (ss) ss->Release();+ g->Release();+ }+ if (fac) fac->Release();+}++void DrawTimer(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F b, float y0) {+ const float L = b.left + 14, R = b.right - 14;+ if (!g_tRun) {+ static const int mins[6] = { 1, 3, 5, 10, 15, 30 };+ float gap = 8, cw = (R - L - 2 * gap) / 3, ch = 32;+ for (int i = 0; i < 6; i++) {+ float x = L + (i % 3) * (cw + gap), y = y0 + 6 + (i / 3) * (ch + gap);+ D2D1_RECT_F r = D2D1::RectF(x, y, x + cw, y + ch);+ Chip(dc, br, r, ChipR(ch), Hover(H_PRESET, mins[i]) ? (g_pressHit == H_PRESET ? 2.f : 1.f) : 0.f);+ Text(dc, br, std::to_wstring(mins[i]) + L" min", g_tfChip, r, WHITE);+ AddHit(H_PRESET, r, mins[i]);+ }+ return;+ }+ // correndo: anel com o que falta, tempo grande, pausar/parar/+1 min+ double left = TimerLeft();+ D2D1_POINT_2F c = { L + 30, y0 + 38 };+ Ring(dc, br, c, 28, g_tTotal > 0 ? (float)(left / g_tTotal) : 0, 5);+ Sym(dc, br, L"timer", Around(c.x, c.y, 18, 18), ORANGE);+ float x = c.x + 44;+ Text(dc, br, Clock(left / 1000), g_tfBig, D2D1::RectF(x, y0 + 4, R, y0 + 42), g_tPaused ? GRAY : WHITE);+ float by = y0 + 62;+ D2D1_RECT_F rp = D2D1::RectF(x, by - 14, x + 28, by + 14), rs = D2D1::RectF(x + 36, by - 14, x + 64, by + 14), r1 = D2D1::RectF(x + 72, by - 13, x + 130, by + 13);+ Chip(dc, br, rp, 14, Hover(H_TPAUSE) ? 1.f : 0.f);+ if (g_tPaused) Sym(dc, br, L"play.fill", Around(x + 15, by, 10, 11), ORANGE);+ else Sym(dc, br, L"pause.fill", Around(x + 14, by, 9, 11), ORANGE);+ Chip(dc, br, rs, 14, Hover(H_TSTOP) ? 1.f : 0.f);+ Glyph(dc, br, 0xE711, g_tfIconS, rs, WHITE);+ Chip(dc, br, r1, ChipR(26), Hover(H_TPLUS) ? 1.f : 0.f);+ Text(dc, br, L"+1 min", g_tfChip, r1, WHITE);+ AddHit(H_TPAUSE, rp); AddHit(H_TSTOP, rs); AddHit(H_TPLUS, r1);+}++void DrawClip(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F b, float y0) {+ const float L = b.left + 10, R = b.right - 10;+ if (g_clips.empty()) {+ Glyph(dc, br, 0xE77F, g_tfIconL, D2D1::RectF(L, y0 + 14, R, y0 + 42), GRAY2);+ Text(dc, br, Tr(L"O que você copiar aparece aqui"), g_tfSmallC, D2D1::RectF(L, y0 + 46, R, y0 + 62), GRAY);+ return;+ }+ float rowH = 23, y = y0;+ for (int i = 0; i < (int)g_clips.size() && i < 4; i++, y += rowH) {+ D2D1_RECT_F r = D2D1::RectF(L, y, R - (i == 0 ? 44 : 0), y + rowH - 2);+ if (Hover(H_CLIP, i)) Chip(dc, br, r, ChipR(rowH - 2) * 0.8f, 1);+ std::wstring s = g_clips[i];+ for (auto& c : s) if (c == L'\r' || c == L'\n' || c == L'\t') c = L' ';+ bool flash = g_flashClip == i && anim::Now() - g_flashAt < 1200;+ Glyph(dc, br, flash ? 0xE73E : 0xE8C8, g_tfIconS, D2D1::RectF(r.left + 4, r.top, r.left + 22, r.bottom), flash ? GREEN : GRAY);+ Text(dc, br, flash ? Tr(L"Copiado") : s, g_tfSub, D2D1::RectF(r.left + 27, r.top, r.right - 6, r.bottom), flash ? GREEN : WHITE);+ AddHit(H_CLIP, r, i);+ }+ D2D1_RECT_F cl = D2D1::RectF(R - 42, y0, R, y0 + 21);+ Text(dc, br, Tr(L"Limpar"), g_tfSmallC, cl, Hover(H_CLIPCLR) ? WHITE : GRAY);+ AddHit(H_CLIPCLR, cl);+}++void DrawShelf(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F b, float y0) {+ const float L = b.left + 12, R = b.right - 12;+ D2D1_RECT_F box = D2D1::RectF(L, y0 + 2, R, y0 + BODY_H - 14);+ if (g_shelf.empty() || g_dragIn) {+ ID2D1Factory* f = nullptr; dc->GetFactory(&f);+ ID2D1StrokeStyle* ss = nullptr;+ float dash[] = { 4, 3 };+ if (f) { f->CreateStrokeStyle(D2D1::StrokeStyleProperties(D2D1_CAP_STYLE_ROUND, D2D1_CAP_STYLE_ROUND, D2D1_CAP_STYLE_ROUND, D2D1_LINE_JOIN_ROUND, 10, D2D1_DASH_STYLE_CUSTOM), dash, 2, &ss); f->Release(); }+ float rr = g_theme == TH_LEOPARD ? 6.f : 14.f;+ if (g_dragIn) { br->SetColor(D2D1::ColorF(1, 1, 1, 0.08f)); dc->FillRoundedRectangle(D2D1::RoundedRect(box, rr, rr), br); }+ br->SetColor(D2D1::ColorF(1, 1, 1, g_dragIn ? 0.6f : 0.25f));+ dc->DrawRoundedRectangle(D2D1::RoundedRect(box, rr, rr), br, 1.5f, ss);+ if (ss) ss->Release();+ float cy = (box.top + box.bottom) / 2;+ Glyph(dc, br, 0xE7B8, g_tfIconL, D2D1::RectF(L, cy - 24, R, cy), g_dragIn ? WHITE : GRAY);+ Text(dc, br, Tr(L"Arraste arquivos para cá"), g_tfSmallC, D2D1::RectF(L, cy + 2, R, cy + 18), g_dragIn ? WHITE : GRAY);+ return;+ }+ float tw = 56, x = L;+ int n = (int)g_shelf.size(), shown = std::min(n, (int)((R - L) / tw));+ for (int i = n - shown; i < n; i++, x += tw) { // os mais novos+ D2D1_RECT_F r = D2D1::RectF(x, y0 + 2, x + tw - 4, y0 + 70);+ if (Hover(H_SHELF, i)) Chip(dc, br, r, g_theme == TH_LEOPARD ? 5.f : 10.f, 1);+ if (ID2D1Bitmap* bmp = ShelfIcon(dc, g_shelf[i])) {+ D2D1_SIZE_F s = bmp->GetSize();+ float k = std::min(34 / s.width, 34 / s.height);+ dc->DrawBitmap(bmp, Around((r.left + r.right) / 2, r.top + 22, s.width * k, s.height * k), 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC);+ } else Glyph(dc, br, 0xE8A5, g_tfIconL, Around((r.left + r.right) / 2, r.top + 22, 34, 34), GRAY);+ std::wstring name = g_shelf[i].substr(g_shelf[i].find_last_of(L'\\') + 1);+ Text(dc, br, name, g_tfSmallC, D2D1::RectF(r.left + 2, r.top + 44, r.right - 2, r.top + 60), WHITE);+ AddHit(H_SHELF, r, i);+ }+ D2D1_RECT_F cl = D2D1::RectF(R - 50, y0 + BODY_H - 30, R, y0 + BODY_H - 14);+ Text(dc, br, Tr(L"Limpar"), g_tfSmallR, cl, Hover(H_SHELFCLR) ? WHITE : GRAY);+ AddHit(H_SHELFCLR, cl);+}++void Spark(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const std::deque<float>& d, D2D1_RECT_F r, float mx, D2D1_COLOR_F c) {+ if (d.size() < 2) return;+ ID2D1Factory* f = nullptr; dc->GetFactory(&f);+ ID2D1PathGeometry* g = nullptr;+ if (f && SUCCEEDED(f->CreatePathGeometry(&g))) {+ ID2D1GeometrySink* s = nullptr; g->Open(&s);+ float step = (r.right - r.left) / 39;+ float x0 = r.right - step * (d.size() - 1);+ auto Y = [&](float v) { return r.bottom - std::clamp(v / mx, 0.f, 1.f) * (r.bottom - r.top); };+ s->BeginFigure({ x0, r.bottom }, D2D1_FIGURE_BEGIN_FILLED);+ for (size_t i = 0; i < d.size(); i++) s->AddLine({ x0 + i * step, Y(d[i]) });+ s->AddLine({ r.right, r.bottom });+ s->EndFigure(D2D1_FIGURE_END_CLOSED); s->Close(); s->Release();+ br->SetColor(D2D1::ColorF(c.r, c.g, c.b, 0.25f));+ dc->FillGeometry(g, br);+ g->Release();+ br->SetColor(c);+ for (size_t i = 1; i < d.size(); i++) dc->DrawLine({ x0 + (i - 1) * step, Y(d[i - 1]) }, { x0 + i * step, Y(d[i]) }, br, 1.3f);+ }+ if (f) f->Release();+}++void DrawStats(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F b, float y0) {+ const float L = b.left + 10, R = b.right - 10, gap = 6;+ float cw = (R - L - 2 * gap) / 3;+ struct C { const wchar_t* name; std::wstring val; const std::deque<float>* d; float mx; D2D1_COLOR_F c; } cs[3] = {+ { L"CPU", std::to_wstring((int)std::lround(g_st.cpuNow * 100)) + L"%", &g_st.cpu, 1, D2D1::ColorF(0.35f, 0.65f, 1.f, 1) },+ { L"Memória", std::to_wstring((int)std::lround(g_st.memNow * 100)) + L"%", &g_st.mem, 1, GREEN },+ { L"Rede", L"↓ " + Rate(g_st.down), &g_st.net, 1, ORANGE },+ };+ float netMax = 50e3f;+ for (float v : g_st.net) netMax = std::max(netMax, v);+ cs[2].mx = netMax * 1.1f;+ for (int i = 0; i < 3; i++) {+ float x = L + i * (cw + gap);+ D2D1_RECT_F r = D2D1::RectF(x, y0 + 2, x + cw, y0 + BODY_H - 12);+ Chip(dc, br, r, g_theme == TH_LEOPARD ? 6.f : g_theme == TH_GOLDEN ? 16.f : 12.f, 0);+ Text(dc, br, Tr(cs[i].name), g_tfSmall, D2D1::RectF(r.left + 9, r.top + 6, r.right - 6, r.top + 20), GRAY);+ Text(dc, br, cs[i].val, i == 2 ? g_tfSub : g_tfVal, D2D1::RectF(r.left + 9, r.top + 20, r.right - 6, r.top + 42), WHITE);+ if (i == 2) Text(dc, br, L"↑ " + Rate(g_st.up), g_tfSmall, D2D1::RectF(r.left + 9, r.top + 36, r.right - 6, r.top + 50), GRAY);+ Spark(dc, br, *cs[i].d, D2D1::RectF(r.left + 8, r.top + 54, r.right - 8, r.bottom - 8), cs[i].mx, cs[i].c);+ }+}++// t = ms desde a troca de modo (aparecer: o cabeçalho primeiro, o corpo logo depois, descendo um tiquinho)+void DrawContent(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, Mode m, double t) {+ D2D1_RECT_F b = BoxOf(m);+ float inset = Notch() ? SizeOf(m).rt : 0; // no notch, as orelhas ficam fora do corpo+ b.left += inset; b.right -= inset;+ float closedH = Notch() ? g_barPt : PILL_H, cy = b.top + closedH / 2;+ float wingL = b.left + (Notch() ? 6 : 4), wingR = b.right - (Notch() ? 8 : 7) - (g_priv ? 18 : 0);+ D2D1_RECT_F closedBox = D2D1::RectF(b.left, b.top, b.right - (Notch() ? 2 : 0), b.top + closedH);+ switch (m) {+ case M_IDLE:+ DrawPrivDot(dc, br, closedBox);+ break;+ case M_MEDIA:+ case M_TIMER: {+ if (m == M_MEDIA) DrawArt(dc, br, D2D1::RectF(wingL, cy - 8, wingL + 16, cy + 8), g_theme == TH_LEOPARD ? 2.5f : 4.f);+ else Sym(dc, br, L"timer", D2D1::RectF(wingL, cy - 7.5f, wingL + 15, cy + 7.5f), ORANGE);+ if (g_tRun) Text(dc, br, Clock(TimerLeft() / 1000), g_tfWingR, D2D1::RectF(wingR - 60, cy - 8, wingR, cy + 8), ORANGE);+ else DrawBars(dc, br, D2D1::RectF(wingR - 18, cy - 6, wingR, cy + 6));+ DrawPrivDot(dc, br, closedBox);+ break;+ }+ case M_HUD: {+ float rr = b.right - (Notch() ? 10 : 11);+ if (g_hud == HUD_VOL) {+ const float v = g_mute ? 0 : g_vol;+ const wchar_t* s = g_mute || v < 0.001f ? L"speaker.slash.fill" : v < 0.34f ? L"speaker.wave.1.fill" : v < 0.67f ? L"speaker.wave.2.fill" : L"speaker.wave.3.fill";+ Sym(dc, br, s, D2D1::RectF(wingL + 2, cy - 5.5f, wingL + 19, cy + 5.5f), WHITE);+ DrawProgressT(dc, br, D2D1::RectF(rr - 84, cy - 2, rr, cy + 2), v);+ } else if (g_hud == HUD_CAPS) {+ Glyph(dc, br, 0xE765, g_tfIconS, D2D1::RectF(wingL, cy - 9, wingL + 22, cy + 9), g_caps ? GREEN : GRAY);+ Text(dc, br, g_caps ? L"Caps Lock" : Tr(L"Caps Lock desligado"), g_tfWingR, D2D1::RectF(rr - 130, cy - 8, rr, cy + 8), g_caps ? GREEN : GRAY);+ } else {+ Sym(dc, br, g_batAC ? L"bolt.fill" : L"battery.50percent", D2D1::RectF(wingL + 2, cy - 6.5f, wingL + (g_batAC ? 12 : 24), cy + 6.5f), g_batAC ? GREEN : g_batPct <= 20 ? RED : WHITE);+ Text(dc, br, std::to_wstring(g_batPct) + L"%", g_tfWingR, D2D1::RectF(rr - 60, cy - 8, rr, cy + 8), g_batAC ? GREEN : g_batPct <= 20 ? RED : WHITE);+ }+ break;+ }+ case M_PEEK: {+ float top = b.top + (Notch() ? g_barPt : 0), h = b.bottom - top;+ float icy = top + h / 2 - (Notch() ? 3 : 0);+ D2D1_RECT_F ic = Around(b.left + 14 + 16, icy, 32, 32);+ if (g_peek.icon) g_peek.icon(dc, br, ic);+ else {+ br->SetColor(D2D1::ColorF(g_peek.color.r, g_peek.color.g, g_peek.color.b, 0.22f));+ dc->FillEllipse(D2D1::Ellipse({ (ic.left + ic.right) / 2, icy }, 16, 16), br);+ Glyph(dc, br, g_peek.glyph, g_tfIconS, ic, g_peek.color);+ }+ float x = ic.right + 10, rr = b.right - 16;+ bool sub = !g_peek.sub.empty();+ float ty = sub ? icy - 16 : icy - 8;+ Text(dc, br, g_peek.title, g_tfTitle, D2D1::RectF(x, ty, rr, ty + 17), WHITE);+ if (sub) Text(dc, br, g_peek.sub, g_tfSub, D2D1::RectF(x, ty + 17, rr, ty + 32), GRAY);+ break;+ }+ case M_OPEN: {+ D2D1_MATRIX_3X2_F old; dc->GetTransform(&old);+ float eh = anim::EaseOut(std::clamp((float)((t - 30) / 170), 0.f, 1.f));+ if (eh < 1) dc->PushLayer(D2D1::LayerParameters1(D2D1::InfiniteRect(), nullptr, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1::IdentityMatrix(), eh), nullptr);+ DrawHeader(dc, br, b);+ if (eh < 1) dc->PopLayer();+ float y0 = b.top + HeadH() + (Notch() ? 2 : 4);+ // o corpo entra descendo 8 pt e crescendo de 96% (o "blurReplace" do Atoll sem o desfoque) e, ao trocar de aba,+ // deslizando para o lado+ float eb = anim::EaseOut(std::clamp((float)((t - 70) / 230), 0.f, 1.f));+ float et = anim::EaseOut(std::clamp((float)((anim::Now() - g_tabAt) / 220), 0.f, 1.f));+ float e = std::min(eb, et);+ if (e < 1) {+ float s = 0.96f + 0.04f * eb;+ D2D1_POINT_2F c = { (b.left + b.right) / 2, y0 };+ dc->SetTransform(D2D1::Matrix3x2F::Scale(s, s, c) * D2D1::Matrix3x2F::Translation(g_tabDir * (1 - et) * 22, -(1 - eb) * 8) * old);+ dc->PushLayer(D2D1::LayerParameters1(D2D1::InfiniteRect(), nullptr, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1::IdentityMatrix(), e), nullptr);+ }+ switch (g_tab) {+ case TAB_HOME: DrawHome(dc, br, b, y0); break;+ case TAB_TIMER: DrawTimer(dc, br, b, y0); break;+ case TAB_CLIP: DrawClip(dc, br, b, y0); break;+ case TAB_SHELF: DrawShelf(dc, br, b, y0); break;+ case TAB_STATS: DrawStats(dc, br, b, y0); break;+ default: break;+ }+ if (e < 1) { dc->PopLayer(); dc->SetTransform(old); }+ break;+ }+ default: break;+ }+}++// a forma: no notch, o entalhe com as orelhas côncavas em cima e cantos redondos embaixo; senão, a pílula/cartão+ID2D1Geometry* Shape(ID2D1Factory* f, D2D1_RECT_F p, float rt, float rb) {+ if (!Notch()) {+ ID2D1RoundedRectangleGeometry* g = nullptr;+ float r = std::min({ rb, (p.bottom - p.top) / 2, (p.right - p.left) / 2 });+ f->CreateRoundedRectangleGeometry(D2D1::RoundedRect(p, r, r), &g);+ return g;+ }+ ID2D1PathGeometry* g = nullptr;+ if (FAILED(f->CreatePathGeometry(&g))) return nullptr;+ float L = p.left, R = p.right, B = p.bottom;+ rt = std::clamp(rt, 0.f, (R - L) / 4);+ rb = std::clamp(rb, 0.f, std::min((B - p.top - rt), (R - L - 2 * rt) / 2));+ ID2D1GeometrySink* s = nullptr; g->Open(&s);+ s->BeginFigure({ L, p.top }, D2D1_FIGURE_BEGIN_FILLED);+ s->AddQuadraticBezier(D2D1::QuadraticBezierSegment({ L + rt, p.top }, { L + rt, p.top + rt }));+ s->AddLine({ L + rt, B - rb });+ s->AddQuadraticBezier(D2D1::QuadraticBezierSegment({ L + rt, B }, { L + rt + rb, B }));+ s->AddLine({ R - rt - rb, B });+ s->AddQuadraticBezier(D2D1::QuadraticBezierSegment({ R - rt, B }, { R - rt, B - rb }));+ s->AddLine({ R - rt, p.top + rt });+ s->AddQuadraticBezier(D2D1::QuadraticBezierSegment({ R - rt, p.top }, { R, p.top }));+ s->EndFigure(D2D1_FIGURE_END_CLOSED);+ s->Close(); s->Release();+ return g;+}++// contorno do painel do Leopard: desce pela esquerda, contorna a base e sobe pela direita (sem a borda de cima,+// que encosta na barra de menus)+ID2D1PathGeometry* Outline(ID2D1Factory* f, D2D1_RECT_F p, float rb) {+ ID2D1PathGeometry* g = nullptr;+ if (FAILED(f->CreatePathGeometry(&g))) return nullptr;+ rb = std::clamp(rb, 0.f, std::min(p.bottom - p.top, (p.right - p.left) / 2));+ ID2D1GeometrySink* s = nullptr; g->Open(&s);+ s->BeginFigure({ p.left, p.top }, D2D1_FIGURE_BEGIN_HOLLOW);+ s->AddLine({ p.left, p.bottom - rb });+ s->AddQuadraticBezier(D2D1::QuadraticBezierSegment({ p.left, p.bottom }, { p.left + rb, p.bottom }));+ s->AddLine({ p.right - rb, p.bottom });+ s->AddQuadraticBezier(D2D1::QuadraticBezierSegment({ p.right, p.bottom }, { p.right, p.bottom - rb }));+ s->AddLine({ p.right, p.top });+ s->EndFigure(D2D1_FIGURE_END_OPEN);+ s->Close(); s->Release();+ return g;+}++D2D1_RECT_F ShapeRect() {+ float w = std::max(1.f, g_w.x), h = std::max(1.f, g_h.x), top = TopOff();+ return D2D1::RectF((WMAX - w) / 2, top, (WMAX + w) / 2, top + h);+}++void SetRegion() {+ float sc = Sc();+ D2D1_RECT_F p = ShapeRect();+ float m = Notch() && g_theme != TH_LEOPARD ? 1.f : 4.f;+ RECT r{ (LONG)std::floor((p.left - m) * sc), (LONG)std::floor(std::max(0.f, p.top - m) * sc), (LONG)std::ceil((p.right + m) * sc), (LONG)std::ceil((p.bottom + m) * sc) };+ if (g_a.x < 0.05f && g_a.t == 0) r = { 0, 0, 0, 0 }; // sumindo: o clique já passa+ if (EqualRect(&r, &g_rgn)) return;+ g_rgn = r;+ SetWindowRgn(g_wnd, CreateRectRgn(r.left, r.top, r.right, r.bottom), FALSE);+}++void Paint() {+ if (!g_wnd || !g_shown) return;+ if (g_m.artGen != g_artGenUi) {+ g_artGenUi = g_m.artGen;+ if (g_art) { g_art->Release(); g_art = nullptr; }+ if (ID2D1DeviceContext* gdc = ui::Gpu()) g_art = ui::Bitmap(gdc, g_m.aw, g_m.ah, g_m.art);+ }+ float sc = Sc();+ auto* dc = ui::GpuBegin(g_s, (int)std::lround(WMAX * sc), (int)std::lround(HMAX * sc), sc);+ if (!dc) return;+ ID2D1SolidColorBrush* br = nullptr;+ dc->CreateSolidColorBrush(D2D1::ColorF(0, 0, 0, 1), &br);+ if (!br) { ui::GpuEnd(g_s); return; }+ D2D1_RECT_F p = ShapeRect();+ float alpha = std::clamp(g_a.x, 0.f, 1.f);+ ID2D1Factory* f = nullptr; dc->GetFactory(&f);+ ID2D1Geometry* geo = f ? Shape(f, p, std::max(0.f, g_rt.x), std::max(0.f, g_rb.x)) : nullptr;+ float rad = std::min({ std::max(0.f, g_rb.x), (p.bottom - p.top) / 2, (p.right - p.left) / 2 });+ const bool pill = !Notch();+ const bool leoNotch = Notch() && g_theme == TH_LEOPARD;+ if (leoNotch && alpha > 0.01f && geo) {+ // sombra do Leopard embaixo do painel (os menus e HUDs do 10.5 têm sombra larga e macia)+ for (int i = 5; i >= 1; i--) {+ float e = i * 1.4f;+ D2D1_MATRIX_3X2_F old; dc->GetTransform(&old);+ dc->SetTransform(D2D1::Matrix3x2F::Translation(0, e) * old);+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.06f * alpha * (6 - i) / 5));+ dc->DrawGeometry(geo, br, e * 1.6f);+ dc->FillGeometry(geo, br);+ dc->SetTransform(old);+ }+ }+ if (pill && alpha > 0.01f) {+ // sombra suave em volta da pílula (anéis cada vez mais largos e mais fracos); no Leopard, a do HUD, mais forte+ float k = g_theme == TH_LEOPARD ? 1.6f : 1.f;+ for (int i = 4; i >= 1; i--) {+ float e = i * 1.6f;+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.07f * k * alpha * (5 - i) / 4));+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(p.left - e, p.top - e * 0.5f, p.right + e, p.bottom + e * 1.3f), rad + e, rad + e), br);+ }+ }+ dc->PushLayer(D2D1::LayerParameters1(D2D1::InfiniteRect(), geo, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1::IdentityMatrix(), alpha), nullptr);+ // o corpo: o notch é sempre preto; a pílula muda com o tema+ D2D1_COLOR_F fill = D2D1::ColorF(0, 0, 0, 1);+ if (pill && Glassy()) fill = D2D1::ColorF(0.055f, 0.055f, 0.065f, 0.95f);+ if (pill && g_theme == TH_LEOPARD) fill = D2D1::ColorF(0.10f, 0.10f, 0.11f, 0.90f);+ br->SetColor(fill);+ if (leoNotch) {+ // grafite do HUD: degradê de cima (mais claro) para baixo, e o verniz Aqua na faixa da barra de menus+ ID2D1GradientStopCollection* gs = nullptr;+ D2D1_GRADIENT_STOP st[] = { { 0, D2D1::ColorF(0.24f, 0.24f, 0.26f, 0.96f) }, { 0.22f, D2D1::ColorF(0.13f, 0.13f, 0.14f, 0.95f) }, { 1, D2D1::ColorF(0.07f, 0.07f, 0.08f, 0.95f) } };+ dc->CreateGradientStopCollection(st, 3, &gs);+ ID2D1LinearGradientBrush* lg = nullptr;+ if (gs) dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, p.top }, { 0, std::max(p.top + g_barPt * 1.4f, p.bottom) }), gs, &lg);+ if (lg) { dc->FillRectangle(D2D1::RectF(p.left, p.top - 1, p.right, p.bottom), lg); lg->Release(); }+ else dc->FillRectangle(D2D1::RectF(p.left, p.top - 1, p.right, p.bottom), br);+ if (gs) gs->Release();+ float band = std::min(g_barPt, p.bottom - p.top);+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.11f));+ dc->FillRectangle(D2D1::RectF(p.left, p.top, p.right, p.top + band / 2), br); // verniz: metade de cima da faixa, corte nítido+ if (p.bottom - p.top > g_barPt + 6) { // aberto: a faixa vira a barra de título do HUD, com o filete embaixo+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.55f));+ dc->FillRectangle(D2D1::RectF(p.left, p.top + band, p.right, p.top + band + 1), br);+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.09f));+ dc->FillRectangle(D2D1::RectF(p.left, p.top + band + 1, p.right, p.top + band + 2), br);+ }+ } else dc->FillRectangle(D2D1::RectF(p.left, p.top - 1, p.right, p.bottom), br);+ if (pill) {+ if (g_theme == TH_LEOPARD) {+ // o verniz do HUD do 10.5: metade de cima mais clara, com corte nítido+ float mid = p.top + std::min(11.f, (p.bottom - p.top) / 2);+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.13f));+ dc->FillRectangle(D2D1::RectF(p.left, p.top, p.right, mid), br);+ } else {+ float strength = g_theme == TH_GOLDEN ? 0.18f : g_theme == TH_TAHOE ? 0.14f : 0.10f;+ ID2D1GradientStopCollection* gs = nullptr;+ D2D1_GRADIENT_STOP st[] = { { 0, D2D1::ColorF(1, 1, 1, strength) }, { 1, D2D1::ColorF(1, 1, 1, 0) } };+ dc->CreateGradientStopCollection(st, 2, &gs);+ ID2D1LinearGradientBrush* lg = nullptr;+ if (gs) dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, p.top }, { 0, p.top + std::min(26.f, (p.bottom - p.top) * 0.6f) }), gs, &lg);+ if (lg) { dc->FillRectangle(p, lg); lg->Release(); }+ if (gs) gs->Release();+ }+ }+ // conteúdo: o anterior some em 70 ms enquanto o novo já começa a aparecer (a forma está mudando por baixo)+ double t = anim::Now() - g_modeAt;+ auto layer = [&](Mode m, float a, double tm) {+ if (a <= 0.01f || m == M_HIDDEN) return;+ bool open = m == M_OPEN;+ float s = open ? 1.f : 0.92f + 0.08f * a;+ D2D1_RECT_F b = BoxOf(m);+ dc->SetTransform(D2D1::Matrix3x2F::Scale(s, s, { (b.left + b.right) / 2, b.top + (Notch() ? g_barPt / 2 : PILL_H / 2) }));+ if (!open) dc->PushLayer(D2D1::LayerParameters1(D2D1::InfiniteRect(), nullptr, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1::IdentityMatrix(), a), nullptr);+ DrawContent(dc, br, m, tm);+ if (!open) dc->PopLayer();+ dc->SetTransform(D2D1::Matrix3x2F::Identity());+ };+ if (t < 70 && g_prev != M_OPEN) layer(g_prev, 1 - (float)(t / 70), 1e9);+ else if (t < 70) layer(g_prev, 1 - (float)(t / 70), 1e9);+ g_hits.clear();+ float delay = g_mode == M_OPEN ? 0.f : (g_prev == M_OPEN || g_prev == M_PEEK) ? 110.f : 40.f; // fechando: as asas voltam quando a forma pousa+ layer(g_mode, anim::EaseOut(std::clamp((float)((t - delay) / 200), 0.f, 1.f)), t);+ ID2D1PathGeometry* line = leoNotch && f ? Outline(f, p, std::max(0.f, g_rb.x)) : nullptr;+ if (line) { // filete claro por dentro (metade do traço fica dentro do recorte)+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.22f));+ dc->DrawGeometry(line, br, 2);+ }+ dc->PopLayer();+ if (line) { // e o contorno escuro por fora, para o painel não sumir na barra clara+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.40f * alpha));+ dc->DrawGeometry(line, br, 1);+ line->Release();+ }+ if (pill && alpha > 0.01f) {+ if (Glassy()) liquid::Rim(dc, p, rad, true, g_theme == TH_GOLDEN ? 1.f : 0.8f, 0.35f);+ else {+ br->SetColor(D2D1::ColorF(1, 1, 1, (g_theme == TH_LEOPARD ? 0.32f : 0.13f) * alpha));+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(p.left + 0.5f, p.top + 0.5f, p.right - 0.5f, p.bottom - 0.5f), std::max(0.f, rad - 0.5f), std::max(0.f, rad - 0.5f)), br, 1);+ }+ }+ if (geo) geo->Release();+ if (f) f->Release();+ br->Release();+ ui::GpuEnd(g_s);+ SetRegion();+}++void Frame() {+ double now = anim::Now();+ float dt = (float)std::clamp(now - g_frameAt, 1.0, 50.0);+ g_frameAt = now;+ // abrindo: a mola do Atoll com um pulinho; fechando: sem quicar; troca de atividade fechada: firme+ float resp = 0.34f, damp = 0.88f;+ if (g_springKind == 1) { resp = 0.42f; damp = 0.78f; }+ else if (g_springKind == 2) { resp = 0.45f; damp = 1.0f; }+ if (g_theme == TH_LEOPARD) { resp = g_springKind == 1 ? 0.36f : 0.32f; damp = 1.0f; }+ if (anim::reduceMotion) { resp = 0.2f; damp = 1; }+ bool moving = false;+ moving |= g_w.Step(dt, resp, damp, 0.05f);+ moving |= g_h.Step(dt, resp, damp, 0.05f);+ moving |= g_rt.Step(dt, resp, damp, 0.05f);+ moving |= g_rb.Step(dt, resp, damp, 0.05f);+ moving |= g_a.Step(dt, 0.25f, 1.0f, 0.004f);+ moving |= now - g_modeAt < 320 || now - g_tabAt < 230;+ if (g_mode == M_OPEN || g_mode == M_MEDIA) StepBars();+ Paint();+ if (!moving) {+ g_running = false;+ ui::FrameClock(g_wnd, WM_IL_FRAME, false);+ if (g_mode == M_HIDDEN) {+ ShowWindow(g_wnd, SW_HIDE);+ g_shown = false;+ g_rgn = {};+ }+ UpdateTimers();+ }+}++// ================= interação+D2D1_POINT_2F Pt(LPARAM l) { float sc = Sc(); return { (short)LOWORD(l) / sc, (short)HIWORD(l) / sc }; }+bool In(D2D1_RECT_F r, D2D1_POINT_2F p) { return p.x >= r.left && p.x < r.right && p.y >= r.top && p.y < r.bottom; }+const Hit* HitAt(D2D1_POINT_2F p) {+ for (auto it = g_hits.rbegin(); it != g_hits.rend(); ++it) if (In(it->r, p)) return &*it;+ return nullptr;+}++void Activate(const std::wstring& aumid) { // traz o app que está tocando+ if (aumid.empty()) return;+ for (auto& a : apps::list)+ if (!a.wins.empty() && (!_wcsicmp(a.id.c_str(), (L"aumid:" + aumid).c_str()) ||+ (aumid.size() > 4 && !_wcsicmp(aumid.c_str(), (a.id.substr(a.id.find_last_of(L'\\') + 1)).c_str())))) {+ apps::Activate(a); return;+ }+ if (aumid.find(L'!') != std::wstring::npos && !apps::ActivatePackaged(L"shell:AppsFolder\\" + aumid))+ ShellExecuteW(nullptr, L"open", (L"shell:AppsFolder\\" + aumid).c_str(), nullptr, nullptr, SW_SHOWNORMAL);+}++void Close() { g_openOn = false; KillTimer(g_wnd, TM_LEAVE); Update(); }+void SetTab(int t) {+ if (t == g_tab) return;+ g_tabDir = t > g_tab ? 1 : -1;+ g_tab = (Tab)t;+ g_tabAt = anim::Now();+ StartFrames();+ UpdateTimers();+}++void ClickHit(const Hit& h, D2D1_POINT_2F p) {+ switch (h.id) {+ case H_TAB: SetTab(h.arg); break;+ case H_GEAR: Close(); shell::OpenSettings(L"central"); break;+ case H_PLAY: g_m.playing = !g_m.playing; MediaCmd(1); break; // já mostra o novo estado; o evento confirma+ case H_NEXT: MediaCmd(2); break;+ case H_PREV: MediaCmd(3); break;+ case H_SHUF: if (g_m.canShuffle) { g_m.shuffle = !g_m.shuffle; MediaCmd(4, g_m.shuffle); } break;+ case H_OUT: {+ Close();+ RECT r;+ if (menubar::SoundIcon(&r)) som::Toggle(r); else shell::OpenSettings(L"som");+ break;+ }+ case H_SEEK: {+ float f = std::clamp((p.x - h.r.left) / (h.r.right - h.r.left), 0.f, 1.f);+ g_m.pos = f * g_m.len; g_m.at = anim::Now();+ MediaCmd(5, g_m.pos);+ break;+ }+ case H_ART: Close(); Activate(g_m.aumid); break;+ case H_PRESET: TimerStart(h.arg); break;+ case H_TPAUSE:+ if (g_tPaused) { g_tEnd = anim::Now() + g_tLeft; g_tPaused = false; }+ else { g_tLeft = TimerLeft(); g_tPaused = true; }+ UpdateTimers();+ break;+ case H_TSTOP: TimerStop(); break;+ case H_TPLUS:+ if (g_tPaused) g_tLeft += 60000; else g_tEnd += 60000;+ g_tTotal = std::max(g_tTotal, TimerLeft());+ break;+ case H_CLIP:+ if (h.arg < (int)g_clips.size()) { CopyText(g_clips[h.arg]); g_flashClip = h.arg; g_flashAt = anim::Now(); SetTimer(g_wnd, TM_TICK + 100, 1250, nullptr); }+ break;+ case H_CLIPCLR: g_clips.clear(); break;+ case H_SHELF:+ if (h.arg < (int)g_shelf.size()) ShellExecuteW(nullptr, L"open", g_shelf[h.arg].c_str(), nullptr, nullptr, SW_SHOWNORMAL);+ break;+ case H_SHELFCLR: g_shelf.clear(); ShelfSave(); break;+ default: break;+ }+ if (!g_running) Paint();+}++LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {+ switch (m) {+ case WM_PAINT: { PAINTSTRUCT ps; BeginPaint(h, &ps); EndPaint(h, &ps); Paint(); return 0; }+ case WM_MOUSEACTIVATE: return MA_NOACTIVATE;+ case WM_IL_FRAME: ui::FrameAck(h, WM_IL_FRAME); if (g_running) Frame(); return 0;+ case WM_IL_MEDIA: {+ bool was = g_m.playing;+ {+ std::lock_guard<std::mutex> k(g_mmx);+ // a mídia "sumiu": muitos apps passam um instante por "sem sessão" ao trocar de faixa (ou ao repetir);+ // só vale se continuar assim por 1,5 s, senão a ilha fechava e abria de novo+ if (!g_md.has && g_m.has && w != 1) { SetTimer(h, TM_GONE, 1500, nullptr); return 0; }+ KillTimer(h, TM_GONE);+ g_m = g_md;+ }+ if (was && !g_m.playing && g_m.has) { g_pauseHold = true; SetTimer(h, TM_PAUSE, 5000, nullptr); }+ if (g_m.playing) { g_pauseHold = false; KillTimer(h, TM_PAUSE); }+ if (!g_m.has) g_pauseHold = false;+ Update();+ if (!g_running) Paint();+ return 0;+ }+ case WM_IL_PRIV:+ if ((int)w != g_priv) { g_priv = (int)w; Log(L"ilha: microfone %d câmera %d", g_priv & 1, (g_priv >> 1) & 1); Update(); if (!g_running) Paint(); }+ return 0;+ case WM_IL_DOWN: {+ std::wstring* p = (std::wstring*)l;+ std::wstring full = *p; delete p;+ if (g_on && !g_full) {+ Peek pk;+ pk.title = Tr(L"Download concluído");+ pk.sub = full.substr(full.find_last_of(L'\\') + 1);+ pk.glyph = 0xE896; pk.color = D2D1::ColorF(0.35f, 0.65f, 1.f, 1);+ pk.click = [full] { ShellExecuteW(nullptr, L"open", L"explorer.exe", (L"/select,\"" + full + L"\"").c_str(), nullptr, SW_SHOWNORMAL); };+ ShowPeek(pk, 4000);+ }+ return 0;+ }+ case WM_IL_CAPS: SetTimer(h, TM_CAPS, 40, nullptr); return 0; // o Windows ainda não trocou o estado da tecla+ case WM_CLIPBOARDUPDATE:+ if (g_selfCopy) { g_selfCopy = false; return 0; }+ if (g_on) { ReadClipboard(); if (g_mode == M_OPEN && g_tab == TAB_CLIP && !g_running) Paint(); }+ return 0;+ case WM_POWERBROADCAST:+ if (w == PBT_APMPOWERSTATUSCHANGE && g_on) {+ SYSTEM_POWER_STATUS ps{};+ if (GetSystemPowerStatus(&ps) && !(ps.BatteryFlag & 128) && ps.BatteryLifePercent <= 100) {+ bool ac = ps.ACLineStatus == 1;+ int pct = ps.BatteryLifePercent;+ bool low = !ac && (pct == 20 || pct == 10 || pct == 5) && pct != g_batPct;+ if (ac != g_batAC || low) { g_batAC = ac; g_batPct = pct; ShowHud(HUD_BAT, 2500); }+ g_batPct = pct;+ }+ }+ return TRUE;+ case WM_TIMER:+ switch (w) {+ case TM_EQ: StepBars(); if (!g_running) Paint(); UpdateTimers(); break;+ case TM_HOVER: KillTimer(h, TM_HOVER); if (g_hoverIn && g_mode != M_OPEN && g_mode != M_PEEK) { g_openOn = true; Update(); } break;+ case TM_LEAVE: KillTimer(h, TM_LEAVE); if (!g_hoverIn && !g_dragIn) { Log(L"ilha: ponteiro saiu, fecha"); Close(); if (g_peekOn) SetTimer(h, TM_PEEK, 1500, nullptr); } break;+ case TM_PEEK: KillTimer(h, TM_PEEK); if (g_hoverIn && g_mode == M_PEEK) break; g_peekOn = false; g_peek = {}; Update(); break;+ case TM_HUD: KillTimer(h, TM_HUD); g_hudOn = false; Update(); break;+ case TM_PAUSE: KillTimer(h, TM_PAUSE); g_pauseHold = false; Update(); break;+ case TM_GONE: KillTimer(h, TM_GONE); PostMessageW(h, WM_IL_MEDIA, 1, 0); break; // w = 1: aplica mesmo sem mídia+ case TM_STATS: SampleStats(); if (!g_running) Paint(); break;+ case TM_CAPS: {+ KillTimer(h, TM_CAPS);+ g_caps = (GetKeyState(VK_CAPITAL) & 1) != 0;+ if (g_on && !g_full) ShowHud(HUD_CAPS, 1300);+ break;+ }+ case TM_TICK + 100: KillTimer(h, w); g_flashClip = -1; if (!g_running) Paint(); break;+ case TM_TICK:+ if (g_tRun && !g_tPaused && TimerLeft() <= 0) {+ g_tRun = false;+ KillTimer(h, TM_TICK);+ shell::Sound(L"Glass");+ Log(L"ilha: timer concluído");+ if (g_on) {+ Peek pk; pk.title = Tr(L"Timer concluído"); pk.sub = Clock(g_tTotal / 1000);+ pk.glyph = 0xE916; pk.color = ORANGE;+ ShowPeek(pk, 6000);+ } else Update();+ } else if (g_shown && !g_running) Paint();+ break;+ }+ return 0;+ case WM_MOUSEMOVE: {+ D2D1_POINT_2F p = Pt(l);+ if (!g_hoverIn) {+ g_hoverIn = true;+ TRACKMOUSEEVENT t{ sizeof(t), TME_LEAVE, h, 0 };+ TrackMouseEvent(&t);+ if (g_hoverOpen && g_mode != M_OPEN && g_mode != M_PEEK && g_mode != M_HUD) SetTimer(h, TM_HOVER, 200, nullptr); // Atoll: passar o ponteiro abre+ }+ KillTimer(h, TM_LEAVE);+ // arrastar um arquivo da Estante para fora+ if (g_pressHit == H_SHELF && (w & MK_LBUTTON) && (std::abs(GET_X_LPARAM(l) - g_pressPt.x) > 5 || std::abs(GET_Y_LPARAM(l) - g_pressPt.y) > 5)) {+ int i = g_pressArg;+ g_pressHit = H_NONE;+ if (GetCapture() == h) ReleaseCapture();+ ShelfDragOut(i);+ if (!g_running) Paint();+ return 0;+ }+ const Hit* ht = HitAt(p);+ HitId id = ht ? ht->id : H_NONE; int arg = ht ? ht->arg : -1;+ if (id == H_ART) id = H_NONE;+ if (id != g_hoverHit || arg != g_hoverArg) { g_hoverHit = id; g_hoverArg = arg; if (!g_running) Paint(); }+ return 0;+ }+ case WM_MOUSELEAVE:+ g_hoverIn = false;+ KillTimer(h, TM_HOVER);+ if (g_hoverHit != H_NONE) { g_hoverHit = H_NONE; g_hoverArg = -1; if (!g_running) Paint(); }+ if (g_openOn) SetTimer(h, TM_LEAVE, 250, nullptr);+ if (g_peekOn) SetTimer(h, TM_PEEK, 1500, nullptr);+ return 0;+ case WM_LBUTTONDOWN: {+ const Hit* ht = g_mode == M_OPEN ? HitAt(Pt(l)) : nullptr;+ g_pressHit = ht ? ht->id : H_NONE; g_pressArg = ht ? ht->arg : -1;+ g_pressPt = { GET_X_LPARAM(l), GET_Y_LPARAM(l) };+ if (g_pressHit != H_NONE) { SetCapture(h); if (!g_running) Paint(); }+ return 0;+ }+ case WM_LBUTTONUP: {+ D2D1_POINT_2F p = Pt(l);+ HitId pressed = g_pressHit; int parg = g_pressArg;+ g_pressHit = H_NONE;+ if (GetCapture() == h) ReleaseCapture();+ if (pressed != H_NONE) {+ const Hit* ht = HitAt(p);+ if (ht && ht->id == pressed && ht->arg == parg) { Hit copy = *ht; ClickHit(copy, p); }+ else if (!g_running) Paint();+ return 0;+ }+ if (g_mode == M_PEEK) {+ auto click = g_peek.click;+ g_peekOn = false; g_peek = {}; KillTimer(h, TM_PEEK);+ Update();+ if (click) click();+ } else if (g_mode != M_OPEN) { KillTimer(h, TM_HOVER); g_openOn = true; Update(); }+ return 0;+ }+ case WM_RBUTTONUP: {+ const Hit* ht = g_mode == M_OPEN ? HitAt(Pt(l)) : nullptr;+ if (ht && ht->id == H_SHELF && ht->arg < (int)g_shelf.size()) { // tira da Estante (o arquivo fica onde está)+ g_shelf.erase(g_shelf.begin() + ht->arg); ShelfSave();+ if (!g_running) Paint();+ } else if (g_mode == M_OPEN) Close();+ return 0;+ }+ case WM_DISPLAYCHANGE: case WM_DPICHANGED:+ Place();+ if (g_shown) { Update(); Paint(); }+ return 0;+ }+ return DefWindowProcW(h, m, w, l);+}++IDWriteTextFormat* Fmt(float size, DWRITE_FONT_WEIGHT wt, DWRITE_TEXT_ALIGNMENT a = DWRITE_TEXT_ALIGNMENT_LEADING, bool icons = false) {+ IDWriteTextFormat* tf = nullptr;+ if (!icons && g_theme == TH_LEOPARD) { // Leopard: a Lucida da barra de menus do tema (Lucida Sans Unicode, o desenho da Lucida Grande)+ tf = ui::FormatFace(L"Lucida Sans Unicode", size - 0.5f, wt >= DWRITE_FONT_WEIGHT_SEMI_BOLD ? DWRITE_FONT_WEIGHT_BOLD : wt);+ if (tf) tf->SetTextAlignment(a);+ }+ if (!tf) tf = ui::Format(size, wt, icons, a);+ if (!tf) return nullptr;+ tf->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER);+ tf->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP);+ if (!icons) {+ IDWriteInlineObject* sign = nullptr;+ ui::dw->CreateEllipsisTrimmingSign(tf, &sign);+ DWRITE_TRIMMING tr{ DWRITE_TRIMMING_GRANULARITY_CHARACTER, 0, 0 };+ tf->SetTrimming(&tr, sign);+ if (sign) sign->Release();+ }+ return tf;+}++// fontes nas proporções do Atoll (título 12,5, artista 11, tempo 10,5); recriadas ao trocar de tema (Leopard: Lucida)+void MakeFonts() {+ for (auto** tf : { &g_tfTitle, &g_tfSub, &g_tfSmall, &g_tfSmallR, &g_tfSmallC, &g_tfWing, &g_tfWingR, &g_tfBig, &g_tfVal, &g_tfChip, &g_tfIcon, &g_tfIconS, &g_tfIconL })+ if (*tf) { (*tf)->Release(); *tf = nullptr; }+ g_tfTitle = Fmt(12.5f, DWRITE_FONT_WEIGHT_SEMI_BOLD);+ g_tfSub = Fmt(11, DWRITE_FONT_WEIGHT_NORMAL);+ g_tfSmall = Fmt(10.5f, DWRITE_FONT_WEIGHT_NORMAL);+ g_tfSmallR = Fmt(10.5f, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_TEXT_ALIGNMENT_TRAILING);+ g_tfSmallC = Fmt(10.5f, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_TEXT_ALIGNMENT_CENTER);+ g_tfWing = Fmt(11, DWRITE_FONT_WEIGHT_SEMI_BOLD);+ g_tfWingR = Fmt(11, DWRITE_FONT_WEIGHT_SEMI_BOLD, DWRITE_TEXT_ALIGNMENT_TRAILING);+ g_tfBig = Fmt(28, DWRITE_FONT_WEIGHT_SEMI_BOLD);+ g_tfVal = Fmt(17, DWRITE_FONT_WEIGHT_SEMI_BOLD);+ g_tfChip = Fmt(12, DWRITE_FONT_WEIGHT_SEMI_BOLD, DWRITE_TEXT_ALIGNMENT_CENTER);+ g_tfIcon = Fmt(14, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_TEXT_ALIGNMENT_CENTER, true);+ g_tfIconS = Fmt(12, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_TEXT_ALIGNMENT_CENTER, true);+ g_tfIconL = Fmt(20, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_TEXT_ALIGNMENT_CENTER, true);+}++} // namespace++bool ilha::Create(HINSTANCE hi) {+ WNDCLASSW wc{};+ wc.lpfnWndProc = Proc;+ wc.hInstance = hi;+ wc.hCursor = LoadCursorW(nullptr, IDC_ARROW);+ wc.lpszClassName = L"ShellIlha";+ RegisterClassW(&wc);+ g_wnd = CreateWindowExW(WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE | WS_EX_NOREDIRECTIONBITMAP, wc.lpszClassName, L"Ilha Dinâmica",+ WS_POPUP, 0, 0, 10, 10, nullptr, nullptr, hi, nullptr);+ if (!g_wnd) return false;+ g_s.hwnd = g_wnd;+ g_theme = ThemeNow();+ MakeFonts();+ SYSTEM_POWER_STATUS ps{};+ if (GetSystemPowerStatus(&ps) && !(ps.BatteryFlag & 128)) { g_hasBattery = true; g_batAC = ps.ACLineStatus == 1; g_batPct = ps.BatteryLifePercent; }+ ShelfLoad();+ RegisterDragDrop(g_wnd, &g_dropTgt);+ Place();+ ilha::Reload();+ return true;+}++void ilha::Reload() {+ if (!g_wnd) return;+ bool was = g_on;+ g_on = shell::Setting(L"ilha", L"0") == L"1";+ std::wstring st = shell::Setting(L"ilha_estilo", L"notch");+ Style ns = st == L"ilha" ? S_ILHA : st == L"notificacao" ? S_AVISO : S_NOTCH;+ g_notesOn = shell::Setting(L"ilha_notificacoes", L"1") != L"0";+ g_volOn = shell::Setting(L"ilha_volume", L"1") != L"0";+ g_hoverOpen = shell::Setting(L"ilha_passar", L"1") != L"0";+ if (Theme th = ThemeNow(); th != g_theme) { g_theme = th; MakeFonts(); Log(L"ilha: tema %d", (int)th); }+ if (g_on) {+ MediaStart();+ static bool threads;+ if (!threads) { // microfone/câmera, downloads e a área de transferência: só depois de ligar a ilha+ threads = true;+ std::thread(PrivacyThread).detach();+ std::thread(DownloadsThread).detach();+ AddClipboardFormatListener(g_wnd);+ }+ }+ if (g_on != was || ns != g_style) Log(L"ilha: %ls (%ls)", g_on ? L"ligada" : L"desligada", st.c_str());+ if (ns != g_style && g_shown) { // trocou de estilo: some e volta no outro formato+ g_style = ns;+ ShowWindow(g_wnd, SW_HIDE); g_shown = false; g_rgn = {}; g_mode = M_HIDDEN;+ }+ g_style = ns;+ if (!g_volOn && g_hud == HUD_VOL) g_hudOn = false;+ if (!g_notesOn) g_peekOn = false;+ Place();+ Update();+}++namespace {+// Tela cheia no monitor principal: jogo em Direct3D exclusivo ou apresentação (estado do Windows), ou a janela mais de+// cima daquele monitor cobrindo a tela inteira (app em tela cheia, vídeo em tela cheia do navegador ou do player), mesmo+// que ela não seja a janela da frente. Pula as nossas janelas, as escondidas/"cloaked", as transparentes ao clique e os+// avisos pequenos (dicas, OSD de volume) que passam por cima do vídeo.+bool FullOnPrimary() {+ QUERY_USER_NOTIFICATION_STATE q{};+ if (SUCCEEDED(SHQueryUserNotificationState(&q)) && (q == QUNS_RUNNING_D3D_FULL_SCREEN || q == QUNS_PRESENTATION_MODE)) return true;+ MONITORINFO mi{ sizeof(mi) };+ if (!GetMonitorInfoW(MonitorFromPoint({ 0, 0 }, MONITOR_DEFAULTTOPRIMARY), &mi)) return false;+ const RECT& m = mi.rcMonitor;+ const LONG monArea = (m.right - m.left) * (m.bottom - m.top);+ for (HWND h = GetTopWindow(nullptr); h; h = GetWindow(h, GW_HWNDNEXT)) {+ if (!IsWindowVisible(h) || IsIconic(h) || shell::Nossa(h)) continue;+ BOOL cloaked = FALSE;+ if (SUCCEEDED(DwmGetWindowAttribute(h, DWMWA_CLOAKED, &cloaked, sizeof(cloaked))) && cloaked) continue;+ LONG ex = GetWindowLongW(h, GWL_EXSTYLE), st = GetWindowLongW(h, GWL_STYLE);+ if (ex & WS_EX_TRANSPARENT) continue; // sobreposições que não pegam clique (Discord, NVIDIA...)+ RECT r, x;+ if (!GetWindowRect(h, &r) || !IntersectRect(&x, &r, &m)) continue;+ wchar_t cls[64] = {}; GetClassNameW(h, cls, 64);+ if (!wcscmp(cls, L"Shell_TrayWnd") || !wcscmp(cls, L"Shell_SecondaryTrayWnd")) continue;+ if (mesa::IsDeskClass(cls)) return false; // chegou na mesa: nada em tela cheia+ bool covers = r.left <= m.left && r.top <= m.top && r.right >= m.right && r.bottom >= m.bottom;+ if (covers) return !(IsZoomed(h) && (st & WS_CAPTION) == WS_CAPTION); // maximizada com barra de título não é tela cheia+ LONG area = (x.right - x.left) * (x.bottom - x.top);+ if (area < monArea / 4) continue; // aviso pequeno por cima (dica, OSD, notificação)+ return false; // uma janela normal na frente: quem está em tela cheia (se houver) ficou atrás+ }+ return false;+}++void ApplyFull(bool on) {+ if (on == g_full) return;+ g_full = on;+ if (!g_wnd) return;+ Log(L"ilha: %ls", on ? L"tela cheia, some" : L"saiu da tela cheia");+ if (on) {+ // some na hora, sem animar: uma janela "sempre no topo" por cima do jogo/vídeo, mesmo esmaecendo, pode tirar o+ // jogo da tela cheia (o Shell já viu isso com o Fortnite e os banners)+ KillTimer(g_wnd, TM_EQ); KillTimer(g_wnd, TM_HOVER); KillTimer(g_wnd, TM_LEAVE);+ if (g_running) { g_running = false; ui::FrameClock(g_wnd, WM_IL_FRAME, false); }+ ShowWindow(g_wnd, SW_HIDE);+ g_shown = false; g_rgn = {};+ g_mode = g_prev = M_HIDDEN;+ g_openOn = g_hoverIn = false;+ Size s0 = SizeOf(M_HIDDEN);+ g_w.x = g_w.t = s0.w; g_h.x = g_h.t = s0.h; g_rt.x = g_rt.t = s0.rt; g_rb.x = g_rb.t = s0.rb; g_a.x = g_a.t = 0;+ g_w.v = g_h.v = g_rt.v = g_rb.v = g_a.v = 0;+ }+ Update();+}++} // namespace++void ilha::SetFullscreen(bool locked) {+ ApplyFull(locked || FullOnPrimary());+}++bool ilha::Notificacao(const std::wstring& app, const std::wstring& title, const std::wstring& body,+ std::function<void(ID2D1DeviceContext*, ID2D1SolidColorBrush*, D2D1_RECT_F)> icon, std::function<void()> click) {+ if (!g_wnd || !g_on || !g_notesOn || g_full) return false;+ Peek p;+ p.title = title.empty() ? app : title;+ p.sub = body.empty() ? (title.empty() ? L"" : app) : body;+ p.icon = std::move(icon);+ p.click = std::move(click);+ ShowPeek(std::move(p), 4500);+ return true;+}++bool ilha::Volume(float level, bool mute) {+ if (!g_wnd || !g_on || !g_volOn || g_full || g_peekOn) return false;+ g_vol = level; g_mute = mute;+ ShowHud(HUD_VOL, 1500);+ return true;+}++void ilha::CapsLock() { if (g_wnd && g_on) PostMessageW(g_wnd, WM_IL_CAPS, 0, 0); }++bool ilha::On() { return g_on; }diff --git a/src/shell/indice.cpp b/src/shell/indice.cppindex 4c83787..5b73717 100644--- a/src/shell/indice.cpp+++ b/src/shell/indice.cpp@@ -419,6 +419,9 @@ void Watcher() {DWORD now = GetTickCount(), d = GetLogicalDrives();bool drivesChanged = d != drives;bool calm = now - lastChange > 3000;+ // modo jogo (jogo.cpp): o jogo escreve sem parar (logs, cache de shaders) e cada leva de mudanças virava uma+ // reindexação no meio da partida; as pastas ficam anotadas em `pending` e entram quando o jogo fechar+ if (jogo::Ativo() && !drivesChanged) continue;if (drivesChanged || (full && calm && now - lastBuild > 120000) || (!full && !pending.empty() && calm)) {SetThreadPriority(GetCurrentThread(), THREAD_MODE_BACKGROUND_BEGIN); // CPU e disco em prioridade de fundobool ok = !drivesChanged && !full && pending.size() <= 300;@@ -466,6 +469,7 @@ void indice::Start() {// junto com o boot por ~3 minutos, disputando disco com o Windows e os apps)Sleep(GetTickCount64() < 10 * 60 * 1000 ? 4 * 60 * 1000 : 30 * 1000);}+ while (jogo::Ativo()) Sleep(5000); // a varredura da abertura (disco inteiro) espera o jogo fecharSetThreadPriority(GetCurrentThread(), THREAD_MODE_BACKGROUND_BEGIN);Rebuild(); // atualiza o que mudou enquanto o Shell estava fechadoSetThreadPriority(GetCurrentThread(), THREAD_MODE_BACKGROUND_END);diff --git a/src/shell/janelas.cpp b/src/shell/janelas.cppindex d75db41..3aa75fc 100644--- a/src/shell/janelas.cpp+++ b/src/shell/janelas.cpp@@ -85,6 +85,10 @@ bool Allowed(DWORD pid, bool* is32) {// Xbox/jogos da Loja continuam fora (anti-cheat)if (full.find(L"\\windowsapps\\") != std::wstring::npos && (full.find(L"microsoft.gaming") != std::wstring::npos || full.find(L"xbox") != std::wstring::npos)) ok = false;for (auto e : EXCLUDED_EXE) if (exe == e) ok = false;+ // os apps do WacOS: os que usam esta barra carregam a DLL eles mesmos (src\comum\barra_mac.h), com ou sem o+ // Shell; os outros desenham a própria. O gancho aqui punha uma segunda cópia por cima+ // (também as cópias renomeadas na hora de instalar, "inst-...-wacosfinder.exe")+ if (exe.find(L"wacos") != std::wstring::npos) ok = false;for (auto e : EXCLUDED_PATH) if (full.find(e) != std::wstring::npos) ok = false;for (auto& e : g_extra) if (exe == e || full.find(e) != std::wstring::npos) ok = false;g_procOk[pid] = ok;@@ -186,7 +190,19 @@ std::wstring OwnCopy(const std::wstring& file, const wchar_t* prefix) {} // namespacevoid janelas::Start() {- if (shell::Setting(L"janelas_mac", L"1") != L"1" || g_dll) return;+ if (g_dll) return;+ // só as barras, sem o Shell (WacOSTitleBars.exe, src\titulos): o Shell assume. Fechar devolve as janelas+ // ao Windows e o gancho daqui entra logo depois (esperando ele sair: dois ganchos na mesma thread não)+ if (HWND only = FindWindowW(L"WacOSBarrasDeTitulo", nullptr)) {+ DWORD pid = 0; GetWindowThreadProcessId(only, &pid);+ if (pid != GetCurrentProcessId()) {+ HANDLE ph = OpenProcess(SYNCHRONIZE, FALSE, pid);+ PostMessageW(only, WM_CLOSE, 0, 0);+ if (ph) { WaitForSingleObject(ph, 3000); CloseHandle(ph); }+ Log(L"janelas: WacOSTitleBars fechado (o Shell assume as barras)");+ }+ }+ if (shell::Setting(L"janelas_mac", L"1") != L"1") return;std::wstring copy = OwnCopy(DLL_WINDOW, L"WacOSWindow");// sem cópia própria, nada de gancho: o mesmo caminho com outra versão trava os programas (ver Consider)if (copy.empty()) {diff --git a/src/shell/jogo.cpp b/src/shell/jogo.cppnew file mode 100644index 0000000..dfc1363--- /dev/null+++ b/src/shell/jogo.cpp@@ -0,0 +1,182 @@+// Modo Jogo (como o Game Mode do macOS): quando um jogo vem para a frente, o Shell desliga o que mais pesa nele e+// devolve tudo quando o jogo fecha. Medido em 20/11/2026 com o Fortnite aberto: o Shell ia a ~50% de um núcleo,+// 4,5% da GPU e 514 MB, por causa de:+// - vidro real: remontava o fundo a cada quadro do jogo atrás das peças (335 montagens e 1255 redesenhos em 10 s);+// - "sacudir para localizar" (ponteiro.cpp): Raw Input de TODO movimento do mouse (mouse de 1000 Hz = 1000/s);+// - "clique mostra a mesa" (revelar.cpp): gancho global de mouse (cada clique do jogo passa pelo Shell);+// - Cantos Ativos: leitura do ponteiro 20 vezes por segundo;+// - a mesa recriada (papel de parede 5K decodificado de novo) a cada troca de modo de tela do jogo (mesa.cpp).+// No modo jogo: vidro real desligado (fica o vidro comum), sem Raw Input, sem gancho de mouse, sem Cantos Ativos,+// a mesa só se refaz depois, e o Shell em prioridade abaixo do normal e no modo eficiência (EcoQoS: núcleos E).+// O teclado (Win, Alt+Tab do Mac) continua. Ajuste modo_jogo (1 liga, padrão). Jogos a mais: %APPDATA%\Shell\jogos.txt+// (um .exe ou parte do caminho por linha). Não abre o processo do jogo além do nome do .exe (anti-cheat).+#include "shell.h"+#include <shlobj.h>+#include <shellapi.h>+#include <atomic>++namespace {++std::atomic<bool> g_on{ false }; // lido também pela thread do índice+bool g_enabled = true;+DWORD g_pid = 0;+int g_gone = 0; // verificações seguidas sem janela do jogo+std::wstring g_name;+std::vector<std::wstring> g_extra;++// motores e bibliotecas de jogos (classe da janela principal)+const wchar_t* CLASSES[] = { L"UnrealWindow", L"UnityWndClass", L"SDL_app", L"GLFW30", L"Valve001", L"CryENGINE", L"RiotWindowClass",+ L"LWJGL", L"SFML_Window", L"OgreD3D11Wnd", L"TankWindowClass" };+// pastas de jogos das lojas+const wchar_t* PATHS[] = { L"\\steamapps\\common\\", L"\\epic games\\", L"\\riot games\\", L"\\xboxgames\\", L"\\ea games\\",+ L"\\electronic arts\\", L"\\ubisoft game launcher\\games\\", L"\\gog galaxy\\games\\", L"\\rockstar games\\",+ L"\\call of duty\\", L"\\overwatch\\" };+// o que fica em tela cheia e não é jogo (vídeo, apresentação, navegador)+const wchar_t* NOT_GAMES[] = { L"chrome.exe", L"msedge.exe", L"firefox.exe", L"opera.exe", L"brave.exe", L"vivaldi.exe", L"vlc.exe",+ L"mpc-hc64.exe", L"mpc-be64.exe", L"mpv.exe", L"potplayermini64.exe", L"powerpnt.exe", L"obs64.exe",+ L"steam.exe", L"steamwebhelper.exe", L"epicgameslauncher.exe", L"explorer.exe", L"applicationframehost.exe" };++std::wstring Lower(std::wstring s) { for (auto& c : s) c = towlower(c); return s; }++void LoadExtra() {+ g_extra.clear();+ PWSTR p = nullptr;+ if (FAILED(SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &p))) return;+ std::wstring f = std::wstring(p) + L"\\Shell\\jogos.txt";+ CoTaskMemFree(p);+ FILE* fp = nullptr;+ if (_wfopen_s(&fp, f.c_str(), L"r, ccs=UTF-8") || !fp) return;+ wchar_t line[512];+ while (fgetws(line, 512, fp)) {+ std::wstring s = line;+ while (!s.empty() && iswspace(s.back())) s.pop_back();+ if (!s.empty() && s[0] != L'#') g_extra.push_back(Lower(s));+ }+ fclose(fp);+}++// caminho do .exe só com o direito mínimo (o mesmo que o Gerenciador de Tarefas usa)+std::wstring ExePath(DWORD pid) {+ HANDLE ph = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, pid);+ if (!ph) return L"";+ wchar_t path[MAX_PATH] = {}; DWORD n = MAX_PATH;+ QueryFullProcessImageNameW(ph, 0, path, &n);+ CloseHandle(ph);+ return Lower(path);+}++bool CoversMonitor(HWND h) {+ MONITORINFO mi{ sizeof(mi) };+ if (!GetMonitorInfoW(MonitorFromWindow(h, MONITOR_DEFAULTTONEAREST), &mi)) return false;+ RECT r; if (!GetWindowRect(h, &r)) return false;+ return r.left <= mi.rcMonitor.left && r.top <= mi.rcMonitor.top && r.right >= mi.rcMonitor.right && r.bottom >= mi.rcMonitor.bottom;+}++// a janela da frente é de um jogo? (por que: para o log)+bool IsGame(HWND fg, DWORD pid, std::wstring& exe, const wchar_t*& why) {+ if (!fg || !pid || pid == GetCurrentProcessId() || apps::IsShellWindow(fg)) return false;+ wchar_t cls[64] = {}; GetClassNameW(fg, cls, 64);+ if (mesa::IsDeskClass(cls)) return false;+ std::wstring path = ExePath(pid);+ exe = path.substr(path.find_last_of(L'\\') + 1);+ if (exe.empty() || exe.find(L"wacos") != std::wstring::npos) return false;+ for (auto n : NOT_GAMES) if (exe == n) return false;+ for (auto& e : g_extra) if (exe == e || path.find(e) != std::wstring::npos) { why = L"jogos.txt"; return true; }+ for (auto c : CLASSES) if (!wcscmp(cls, c)) { why = L"motor de jogo"; return true; }+ for (auto p : PATHS) if (path.find(p) != std::wstring::npos) { why = L"pasta de jogos"; return true; }+ // Direct3D em tela cheia exclusiva (o Windows sabe): jogo+ QUERY_USER_NOTIFICATION_STATE q{};+ if (SUCCEEDED(SHQueryUserNotificationState(&q)) && q == QUNS_RUNNING_D3D_FULL_SCREEN && CoversMonitor(fg)) { why = L"Direct3D em tela cheia"; return true; }+ return false;+}++bool HasWindow(DWORD pid) {+ struct C { DWORD pid; bool found; } c{ pid, false };+ EnumWindows([](HWND h, LPARAM l) -> BOOL {+ auto* c = (C*)l;+ DWORD p = 0; GetWindowThreadProcessId(h, &p);+ if (p == c->pid && IsWindowVisible(h)) { c->found = true; return FALSE; }+ return TRUE;+ }, (LPARAM)&c);+ return c.found;+}++// Ganchos de EVENT_OBJECT_LOCATIONCHANGE (tela cheia, notificações, sombras, vidro): o Windows não deixa filtrar o+// objeto, então cada movimento do CURSOR também chega ao Shell, uma vez por gancho. Num jogo (o cursor é recentrado a+// cada quadro, mouse de 1000 Hz) eram milhares de avisos por segundo na thread principal; medido 20/11/2026, com o+// vidro real já desligado: 43% de um núcleo logo depois de abrir. No modo jogo eles saem e voltam quando o jogo fecha.+struct Gancho { WINEVENTPROC fn; DWORD flags; HWINEVENTHOOK h; };+std::vector<Gancho> g_ganchos;+HWINEVENTHOOK Ligar(const Gancho& g) { return SetWinEventHook(EVENT_OBJECT_LOCATIONCHANGE, EVENT_OBJECT_LOCATIONCHANGE, nullptr, g.fn, 0, 0, g.flags); }+void Ganchos(bool on) {+ for (auto& g : g_ganchos) {+ if (on && !g.h) g.h = Ligar(g);+ if (!on && g.h) { UnhookWinEvent(g.h); g.h = nullptr; }+ }+}++void Eco(bool on) {+ SetPriorityClass(GetCurrentProcess(), on ? BELOW_NORMAL_PRIORITY_CLASS : NORMAL_PRIORITY_CLASS);+ PROCESS_POWER_THROTTLING_STATE s{ PROCESS_POWER_THROTTLING_CURRENT_VERSION, PROCESS_POWER_THROTTLING_EXECUTION_SPEED,+ on ? (ULONG)PROCESS_POWER_THROTTLING_EXECUTION_SPEED : 0UL };+ SetProcessInformation(GetCurrentProcess(), ProcessPowerThrottling, &s, sizeof(s));+}++void Apply(bool on) {+ g_on = on;+ Log(on ? L"modo jogo: ligado (%ls, pid %lu)" : L"modo jogo: desligado (%ls fechou)", g_name.c_str(), g_pid);+ backdrop::Reload(); // vidro real fora (backdrop.cpp confere jogo::Ativo)+ ponteiro::Pausar(on); // sem Raw Input do mouse+ revelar::Pausar(on); // sem gancho global do mouse+ cantos::Pausar(on); // sem ler o ponteiro 20x/s+ Ganchos(!on); // sem os avisos de posição (cada movimento do cursor)+ Eco(on);+ if (!on) mesa::DepoisDoJogo(); // a troca de tela que ficou para depois+}++void Check(HWND fg) {+ if (!g_enabled) return;+ if (g_on) {+ if (HasWindow(g_pid)) { g_gone = 0; return; }+ if (++g_gone < 2) return; // ~4 s sem janela nenhuma: o jogo fechou+ Apply(false);+ g_pid = 0; g_gone = 0;+ return;+ }+ DWORD pid = 0; GetWindowThreadProcessId(fg, &pid);+ std::wstring exe; const wchar_t* why = L"";+ if (!IsGame(fg, pid, exe, why)) return;+ g_pid = pid; g_name = exe; g_gone = 0;+ Log(L"modo jogo: %ls detectado (%ls)", exe.c_str(), why);+ Apply(true);+}++void CALLBACK Tick(HWND, UINT, UINT_PTR, DWORD) { Check(GetForegroundWindow()); }++} // namespace++void jogo::Start() {+ Reload();+ SetTimer(nullptr, 0, 2000, Tick);+}++void jogo::Reload() {+ bool was = g_enabled;+ g_enabled = shell::Setting(L"modo_jogo", L"1") != L"0";+ LoadExtra();+ if (was && !g_enabled && g_on) { Apply(false); g_pid = 0; }+}++void jogo::Foreground(HWND h) { Check(h); }++// no lugar de SetWinEventHook(EVENT_OBJECT_LOCATIONCHANGE...): o mesmo gancho, que sai durante o modo jogo+void jogo::GanchoPosicao(WINEVENTPROC fn, DWORD flags) {+ Gancho g{ fn, flags, nullptr };+ if (!g_on) g.h = Ligar(g);+ g_ganchos.push_back(g);+}+void jogo::SoltarPosicao(WINEVENTPROC fn) {+ for (size_t i = 0; i < g_ganchos.size(); i++)+ if (g_ganchos[i].fn == fn) { if (g_ganchos[i].h) UnhookWinEvent(g_ganchos[i].h); g_ganchos.erase(g_ganchos.begin() + i); return; }+}+bool jogo::Ativo() { return g_on; }diff --git a/src/shell/launchpad.cpp b/src/shell/launchpad.cppindex 9068077..d51ebf2 100644--- a/src/shell/launchpad.cpp+++ b/src/shell/launchpad.cpp@@ -101,6 +101,52 @@ bool Hidden(const std::wstring& name) {std::wstring all = L"|" + shell::Setting(L"launchpad_ocultos", L"") + L"|";return all.find(L"|" + name + L"|") != std::wstring::npos;}+} // namespace++// Ferramentas do próprio Windows na lista de apps: atalhos para exes do Windows (o shell:AppsFolder os mostra+// pela pasta conhecida: {1AC14E77...} = System32, {D65231B0...} = SysWOW64, {F38BF404...} = Windows), os+// "Microsoft.Windows.*" (Painel de Controle, Executar...) e os atalhos gerados de Ferramentas do Windows. Os apps+// comuns da Microsoft (Fotos, Edge, Store, Xbox...) ficam.+bool launchpad::AppDoSistema(const std::wstring& name, const std::wstring& parsing) {+ std::wstring p = parsing;+ for (auto& c : p) c = towlower(c);+ if (p.find(L"wacos") != std::wstring::npos) return false; // os nossos apps nunca+ // (o "Microsoft.AutoGenerated.{...}" NÃO entra: é o ID de qualquer atalho sem ID próprio, inclusive jogos como+ // VALORANT e League of Legends; as Ferramentas do Windows que vêm assim estão na lista de nomes abaixo)+ for (auto pre : { L"{1ac14e77-02e7-4e5d-b744-2eb1ae5198b7}", L"{d65231b0-b2f1-4857-a4ce-a8e7c6ea7d27}",+ L"{f38bf404-1d43-42f2-9305-67de0b28fc23}", L"c:\\windows\\" })+ if (p.rfind(pre, 0) == 0) return true;+ // "Microsoft.Windows.ControlPanel", "Microsoft.Windows.Shell.RunDialog"...; os pacotes da Store também começam+ // assim ("Microsoft.Windows.Photos_8wekyb3d8bbwe!App", o Fotos) e esses ficam+ if (p.rfind(L"microsoft.windows.", 0) == 0 && p.find(L'!') == std::wstring::npos) return true;+ std::wstring n = name;+ for (auto& c : n) c = towlower(c);+ for (auto w : { L"ferramentas do windows", L"windows tools", L"painel de controle", L"control panel", L"windows powershell ise",+ L"recuperação", L"recovery drive", L"unidade de recuperação", L"windows media player legacy", L"internet explorer",+ L"odbc", L"iscsi", L"desfragmentar", L"defragment", L"limpeza de disco", L"disk cleanup", L"windows fax",+ L"teclado virtual", L"on-screen keyboard", L"narrador", L"narrator", L"lupa", L"magnifier", L"executar", L"run",+ L"task scheduler", L"agendador de tarefas", L"computer management", L"gerenciamento do computador",+ L"performance monitor", L"monitor de desempenho", L"event viewer", L"visualizador de eventos",+ L"resource monitor", L"monitor de recursos", L"local security policy", L"política de segurança local",+ L"hyper-v manager", L"gerenciador do hyper-v", L"task manager", L"gerenciador de tarefas",+ L"windows memory diagnostic", L"diagnóstico de memória do windows" })+ if (n == w) return true;+ return false;+}++bool launchpad::Escondido(const std::wstring& name, const std::wstring& parsing) {+ if (Hidden(name)) return true;+ return shell::Setting(L"launchpad_sem_sistema", L"0") == L"1" && AppDoSistema(name, parsing);+}++void launchpad::Ocultar(const std::wstring& name) {+ if (Hidden(name)) return;+ std::wstring cur = shell::Setting(L"launchpad_ocultos", L"");+ shell::SetSetting(L"launchpad_ocultos", cur.empty() ? name : cur + L"|" + name);+ Log(L"launchpad: \"%ls\" oculto", name.c_str());+}++namespace {bool Skip(const std::wstring& n) { // atalhos que não são apps (desinstaladores, manuais, sites)std::wstring l = n;@@ -221,10 +267,9 @@ void Filter() {std::wstring q = g_query;for (auto& c : q) c = towlower(c);bool cats = liquid::On() && g_cat > 0;- std::wstring hid = L"|" + shell::Setting(L"launchpad_ocultos", L"") + L"|";for (int i = 0; i < (int)g_all.size(); i++) {if (cats && CategoryOf(g_all[i].name) != g_cat) continue;- if (!liquid::On() && hid.size() > 2 && hid.find(L"|" + g_all[i].name + L"|") != std::wstring::npos) continue; // tirado no modo tremendo+ if (launchpad::Escondido(g_all[i].name, g_all[i].parsing)) continue; // tirado (modo tremendo, botão direito) ou do sistemaif (!q.empty()) {std::wstring n = g_all[i].name;for (auto& c : n) c = towlower(c);@@ -535,18 +580,22 @@ void Paint() {float cx = (cr[i].left + cr[i].right) / 2;dc->DrawTextW(Tr(CATS[i]), (UINT32)wcslen(Tr(CATS[i])), g_tfSearch, D2D1::RectF(cx - tw2 / 2, cr[i].top, cx + tw2 / 2 + 4, cr[i].bottom), br);}+ } else if (liquid::Leopard() && g_query.empty()) {+ // Mac OS X (o Launchpad do Lion): sem campo de busca; digitar ainda filtra, e aí o campo aparece} else {br->SetColor(D2D1::ColorF(1, 1, 1, 0.08f));dc->FillRoundedRectangle(D2D1::RoundedRect(sr, rad, rad), br);br->SetColor(D2D1::ColorF(1, 1, 1, 0.20f));dc->DrawRoundedRectangle(D2D1::RoundedRect(sr, rad, rad), br, 1);}+ if (!(liquid::Leopard() && g_query.empty())) {std::wstring shown = g_query.empty() ? (tahoe ? Tr(L"Buscar apps") : Tr(L"Buscar")) : g_query;float tw = ui::TextWidth(g_tfSearch, shown), gw = 20 * g.k;float tx = tahoe ? sr.left + 16 * g.k : g_query.empty() ? (sr.left + sr.right) / 2 - (tw + gw) / 2 : sr.left + 10 * g.k;br->SetColor(D2D1::ColorF(1, 1, 1, g_query.empty() ? 0.50f : 0.92f));dc->DrawTextW(L"", 1, g_tfIcon, D2D1::RectF(tx, sr.top, tx + gw, sr.bottom), br);dc->DrawTextW(shown.c_str(), (UINT32)shown.size(), g_tfSearch, D2D1::RectF(tx + gw, sr.top, sr.right - 8, sr.bottom), br);+ }{std::lock_guard<std::mutex> lk(g_mu);@@ -591,6 +640,20 @@ void Paint() {dc->FillRoundedRectangle(D2D1::RoundedRect(dr, art * 0.2f, art * 0.2f), br);}D2D1_RECT_F lr{ c.x - g.step / 2 + 6, c.y + 57 * g.k, c.x + g.step / 2 - 6, c.y + 77 * g.k };+ static IDWriteTextFormat* tfLeo = [] { // Mac OS X: o nome em Lucida negrito com a sombra escura do Lion+ auto* f = ui::FormatFace(L"Lucida Sans Unicode", 12, DWRITE_FONT_WEIGHT_BOLD);+ if (f) { f->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER); f->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP);+ DWRITE_TRIMMING t{ DWRITE_TRIMMING_GRANULARITY_CHARACTER, 0, 0 }; IDWriteInlineObject* d = nullptr; ui::dw->CreateEllipsisTrimmingSign(f, &d); f->SetTrimming(&t, d); if (d) d->Release(); }+ return f;+ }();+ if (liquid::Leopard() && tfLeo) {+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.75f));+ dc->DrawTextW(a.name.c_str(), (UINT32)a.name.size(), tfLeo, D2D1::RectF(lr.left, lr.top + 1.5f, lr.right, lr.bottom + 1.5f), br);+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.98f));+ dc->DrawTextW(a.name.c_str(), (UINT32)a.name.size(), tfLeo, lr, br);+ if (g_jiggle) dc->SetTransform(base);+ continue;+ }br->SetColor(D2D1::ColorF(0, 0, 0, 0.35f)); // sombra leve do textodc->DrawTextW(a.name.c_str(), (UINT32)a.name.size(), g_tfLabel, D2D1::RectF(lr.left, lr.top + 1, lr.right, lr.bottom + 1), br);br->SetColor(D2D1::ColorF(1, 1, 1, 0.96f));@@ -849,12 +912,44 @@ LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {int idx = -1;if (liquid::On()) { for (auto& hh : g_apHits) if (hh.kind == 0 && pt.x >= hh.r.left && pt.x < hh.r.right && pt.y >= hh.r.top && pt.y < hh.r.bottom) idx = hh.v; }else { Geo g = Layout(); std::lock_guard<std::mutex> lk(g_mu); int hit = HitIcon(g, pt); if (hit >= 0) idx = g_view[hit]; }- if (idx < 0 || idx >= (int)g_all.size()) return 0;- std::wstring path = L"shell:AppsFolder\\" + g_all[idx].parsing;POINT sp{ (short)LOWORD(l), (short)HIWORD(l) };ClientToScreen(h, &sp);+ if (idx < 0 || idx >= (int)g_all.size()) { // fundo: trazer de volta o que foi tirado e as ferramentas do Windows+ auto mi = [](const std::wstring& t, int id) { ctxmenu::Item i; i.label = t; i.id = id; return i; };+ std::vector<ctxmenu::Item> items;+ ctxmenu::Item sys = mi(Tr(L"Ocultar Apps do Sistema"), 1);+ sys.checked = shell::Setting(L"launchpad_sem_sistema", L"0") == L"1";+ items.push_back(sys);+ std::vector<std::wstring> hid;+ for (std::wstring s = shell::Setting(L"launchpad_ocultos", L""), part; !s.empty();) {+ size_t b = s.find(L'|'); part = s.substr(0, b); s = b == std::wstring::npos ? L"" : s.substr(b + 1);+ if (!part.empty()) hid.push_back(part);+ }+ if (!hid.empty()) {+ ctxmenu::Item sub = mi(Tr(L"Trazer de Volta"), 0);+ for (int k = 0; k < (int)hid.size() && k < 40; k++) sub.sub.push_back(mi(hid[k], 100 + k));+ ctxmenu::Item sep; sep.separator = true; sub.sub.push_back(sep);+ sub.sub.push_back(mi(Tr(L"Trazer Todos"), 99));+ items.push_back(sub);+ }+ int id = ctxmenu::ShowItems(h, sp, items);+ if (id == 1) shell::SetSetting(L"launchpad_sem_sistema", sys.checked ? L"0" : L"1");+ else if (id == 99) shell::SetSetting(L"launchpad_ocultos", L"");+ else if (id >= 100 && id - 100 < (int)hid.size()) {+ hid.erase(hid.begin() + (id - 100));+ std::wstring s; for (auto& x : hid) { if (!s.empty()) s += L'|'; s += x; }+ shell::SetSetting(L"launchpad_ocultos", s);+ }+ if (id) { std::lock_guard<std::mutex> lk(g_mu); Filter(); }+ Paint();+ return 0;+ }+ std::wstring path = L"shell:AppsFolder\\" + g_all[idx].parsing, name = g_all[idx].name;+ ctxmenu::ExtraNext({ { Tr(L"Ocultar do Launchpad"), 2, false, false, false, L"", {}, 0xED1A } });auto res = ctxmenu::Show(h, sp, L"shell:AppsFolder", { path }, GetKeyState(VK_SHIFT) < 0);- Log(L"launchpad: menu de %ls%ls", g_all[idx].name.c_str(), res.chosen ? L" (comando escolhido)" : L"");+ ctxmenu::ExtraNext({});+ Log(L"launchpad: menu de %ls%ls", name.c_str(), res.chosen ? L" (comando escolhido)" : L"");+ if (res.extra == 2) { launchpad::Ocultar(name); { std::lock_guard<std::mutex> lk(g_mu); Filter(); } Paint(); return 0; }if (res.chosen) Close();return 0;}diff --git a/src/shell/main.cpp b/src/shell/main.cppindex e68f79e..a2f395e 100644--- a/src/shell/main.cpp+++ b/src/shell/main.cpp@@ -69,6 +69,7 @@ const UINT WM_APP_VOLUME = WM_APP + 42;static bool g_volumeKeys = true; // ajuste volume_mac: teclas de volume com o aviso do Mac (0 = o Windows trata)static LRESULT CALLBACK KeyHook(int code, WPARAM w, LPARAM l) {+ if (code == HC_ACTION && w == WM_KEYDOWN && ((KBDLLHOOKSTRUCT*)l)->vkCode == VK_CAPITAL) ilha::CapsLock(); // Ilha Dinâmica: aviso do Caps Lockif (code == HC_ACTION && g_volumeKeys && !bloqueio::Active()) {// teclas de volume (Fn + F-teclas): o Shell muda o volume em 16 passos e mostra o aviso do Mac// (o painel do Windows não aparece). Só essas três teclas: os atalhos Ctrl+Alt+Shift+F11/F12 seguem livres.@@ -163,6 +164,13 @@ static LRESULT CALLBACK KeyHook(int code, WPARAM w, LPARAM l) {g_tabHeld = down;g_winCombo = g_winEaten = true;return 1;+ } else if (g_winDown && down && (k->vkCode == VK_F12 || k->vkCode == VK_F8) && liquid::Leopard()) {+ // Leopard: Win+F12 = Dashboard (o F12 do Mac), Win+F8 = Spaces (o F8 do Mac). Só com o Win: o F12 sozinho+ // continua dos apps (ferramentas do navegador)+ static UINT openPanel = RegisterWindowMessageW(L"ShellAbrirPainel");+ PostMessageW(g_msg, openPanel, k->vkCode == VK_F12 ? 16 : 17, 0);+ g_winCombo = g_winEaten = true;+ return 1;} else if (g_winDown && down && !g_winCombo && (k->vkCode == 'I' || k->vkCode == VK_TAB)) {// Win+I: o nosso Ajustes do Sistema; Win+Tab: o Mission Control (no lugar da Visão de Tarefas)g_winCombo = g_winEaten = true;@@ -645,11 +653,12 @@ static void CheckFullscreen() {}dock::SetFullscreen(locked || (fs && fm == dock::MonitorHandle()));menubar::SetFullscreen(locked || fs, fm);+ ilha::SetFullscreen(locked); // a ilha confere sozinha a tela cheia do monitor principal (jogo, vídeo, app)}static void CALLBACK OnWinEvent(HWINEVENTHOOK, DWORD ev, HWND h, LONG obj, LONG, DWORD, DWORD) {if (ev == EVENT_OBJECT_LOCATIONCHANGE && (obj != OBJID_WINDOW || h != GetForegroundWindow())) return;- if (ev == EVENT_SYSTEM_FOREGROUND) revelar::Foreground(h);+ if (ev == EVENT_SYSTEM_FOREGROUND) { revelar::Foreground(h); jogo::Foreground(h); }CheckFullscreen();}@@ -723,6 +732,10 @@ static LRESULT CALLBACK MsgProc(HWND h, UINT m, WPARAM w, LPARAM l) {else if (w == 12) dock::OpenAppsStack(); // Leopard: a pilha Aplicativos (testes)else if (w == 13) seletor::Step(1); // o seletor de apps sem segurar o Alt (testes; 14 fecha)else if (w == 14) seletor::Key(VK_ESCAPE);+ else if (w == 15) dock::OpenDownloadsStack(); // a pilha Downloads (testes)+ else if (w == 16) dashboard::Toggle(); // Leopard: Dashboard (Win+F12)+ else if (w == 17) espacos::Toggle(); // Leopard: Spaces (Win+F8)+ else if (w == 18) tempo::Enter(); // Leopard: a viagem no tempo do Time Machineelse if (w == 11) { // Quick Look de uma foto do macOS 27 (testes)wchar_t p[MAX_PATH] = {}; GetEnvironmentVariableW(L"USERPROFILE", p, MAX_PATH);quicklook::Toggle(std::wstring(p) + L"\\Pictures\\Wallpapers macOS\\macOS 27\\macos-27-golden-4096x2160-27635.jpg");@@ -804,6 +817,7 @@ static LRESULT CALLBACK MsgProc(HWND h, UINT m, WPARAM w, LPARAM l) {auto themeNow = [] { return liquid::Leopard() ? 3 : liquid::Golden() ? 2 : (int)liquid::On(); };if (lastTheme < 0) lastTheme = themeNow();LoadSettings();+ ilha::Reload();static int lastEn = -1;if (lastEn < 0) lastEn = idioma::En();if (bool en = shell::Setting(L"idioma", L"en") == L"en"; (int)en != lastEn) { // Ajustes > Geral > Idioma@@ -837,6 +851,7 @@ static LRESULT CALLBACK MsgProc(HWND h, UINT m, WPARAM w, LPARAM l) {menubar::Update();shell::ApplyWorkArea();mesa::SettingsChanged();+ jogo::Reload(); // modo_jogo e jogos.txtpalco::Sync();return 0;}@@ -981,7 +996,10 @@ static LRESULT CALLBACK MsgProc(HWND h, UINT m, WPARAM w, LPARAM l) {return DefWindowProcW(h, m, w, l);}+int AjudanteRodar(const wchar_t* cmd); // ajudante.cpp: --sair, --aplicar-cursor... (para os scripts do instalador)+int WINAPI wWinMain(HINSTANCE hi, HINSTANCE, PWSTR, int) {+ if (int r = AjudanteRodar(GetCommandLineW()); r >= 0) return r;if (migrar::TrocarPeloNovo()) return 0; // nome velho (SequoiaShell.exe): o WacOSShell.exe ao lado assumeif (const wchar_t* a = wcsstr(GetCommandLineW(), L"--depois-de ")) { // reinício: espera o Shell antigo sair (até 20 s)if (HANDLE old = OpenProcess(SYNCHRONIZE, FALSE, wcstoul(a + 12, nullptr, 10))) { WaitForSingleObject(old, 20000); CloseHandle(old); }@@ -1063,9 +1081,11 @@ int WINAPI wWinMain(HINSTANCE hi, HINSTANCE, PWSTR, int) {widgets::Create(hi); // widgets na mesa (abaixo de todas as janelas)bloqueio::Create(hi); // tela de bloqueio do Sequoia (Win+L)notificacoes::Create(hi); // Central de Notificações (clique no relógio da barra de menus)+ ilha::Create(hi); // Ilha Dinâmica (ajuste ilha=1)notarapida::Create(hi); // canto inferior direito: Nota Rápidaprogresso::Create(hi); // copiar/mover/apagar: a janela de progresso do Finder no lugar da do Windowscantos::Start(); // Cantos Ativos (Mission Control, mesa, Launchpad... por canto)+ jogo::Start(); // Modo Jogo: jogo na frente desliga o que mais pesa (vidro real, ganchos do mouse...)boot::Progress(0.7f);tray::Start([] { menubar::Update(); });mesa::Start(hi, g_msg); // ajuste explorer=0: a mesa é nossa e o explorer.exe sai@@ -1091,7 +1111,7 @@ int WINAPI wWinMain(HINSTANCE hi, HINSTANCE, PWSTR, int) {g_volumeKeys = shell::Setting(L"volume_mac", L"1") == L"1";if (g_fullHook || g_volumeKeys || shell::Setting(L"bloqueio", L"1") != L"0") std::thread(KeyThread).detach(); // sem o Launchpad: só barra teclas com a tela travadaSetWinEventHook(EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND, nullptr, OnWinEvent, 0, 0, WINEVENT_OUTOFCONTEXT);- SetWinEventHook(EVENT_OBJECT_LOCATIONCHANGE, EVENT_OBJECT_LOCATIONCHANGE, nullptr, OnWinEvent, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS);+ jogo::GanchoPosicao(OnWinEvent, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS); // sai no modo jogo (jogo.cpp)SetTimer(g_msg, 1, 1000, nullptr);SetTimer(g_msg, 2, 200, nullptr);SetTimer(g_msg, 9, 3000, nullptr); // pré-carregar o menu de contexto (depois que o Shell já apareceu)@@ -1152,6 +1172,7 @@ int shell::RodarNativo(HINSTANCE hi, const std::wstring& dirBin, const std::wstrgenio::Create(hi);widgets::Create(hi);notificacoes::Create(hi);+ ilha::Create(hi);notarapida::Create(hi);progresso::Create(hi);cantos::Start();@@ -1182,7 +1203,7 @@ int shell::RodarNativo(HINSTANCE hi, const std::wstring& dirBin, const std::wstrg_volumeKeys = shell::Setting(L"volume_mac", L"1") == L"1";if (g_fullHook || g_volumeKeys) std::thread(KeyThread).detach();SetWinEventHook(EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND, nullptr, OnWinEvent, 0, 0, WINEVENT_OUTOFCONTEXT);- SetWinEventHook(EVENT_OBJECT_LOCATIONCHANGE, EVENT_OBJECT_LOCATIONCHANGE, nullptr, OnWinEvent, 0, 0, WINEVENT_OUTOFCONTEXT);+ jogo::GanchoPosicao(OnWinEvent, WINEVENT_OUTOFCONTEXT); // sai no modo jogo (jogo.cpp)SetTimer(g_msg, 1, 1000, nullptr);SetTimer(g_msg, 9, 3000, nullptr);Log(L"pronto (nativo): %zu apps no Dock", apps::list.size());diff --git a/src/shell/menubar.cpp b/src/shell/menubar.cppindex 89d37a7..a39d804 100644--- a/src/shell/menubar.cpp+++ b/src/shell/menubar.cpp@@ -517,10 +517,11 @@ bool BarBackground() {void BarGlass(HWND bar) {if (!bar) return;- if (liquid::Leopard()) { // Leopard: o degradê branco translúcido vem do Render (opaca: acrílico cheio por baixo)- ui::Acrylic(bar, shell::Setting(L"barra_translucida", L"1") == L"1" ? 0x30F2F2F2u : 0xFFE6E6E6u);- return;- }+ // Leopard: o degradê branco translúcido vem do Render. Translúcida (padrão): transparência de verdade, SEM desfoque+ // (o 10.5 deixava o papel de parede aparecer nítido através da barra); opaca: acrílico cheio por baixo+ const bool leoClear = liquid::Leopard() && shell::Setting(L"barra_translucida", L"1") == L"1";+ if (liquid::Leopard() && !leoClear) { ui::Acrylic(bar, 0xFFE6E6E6u); return; }+ if (!leoClear)if (BarBackground()) { ui::Acrylic(bar, ui::Dark() ? 0x40141414u : 0x55F4F4F4u); return; } // vidro bem claro: o papel de parede aparece, como no Mac// sem fundo: o DWM só respeita o alfa do que a barra desenha (nada de desfoque)struct ACCENT_POLICY { int state, flags; DWORD gradient; int anim; };@@ -639,7 +640,7 @@ void Render() {bool liquid = backdrop::Liquid(), bgOn = BarBackground();D2D1_COLOR_F veil = dark ? D2D1::ColorF(0.06f, 0.06f, 0.07f, 0.18f) : D2D1::ColorF(1, 1, 1, 0.26f);if (liquid) veil.a = backdrop::Current().tinted ? veil.a : veil.a * 0.35f;- if (!bgOn) veil.a = 0; // sem fundo (Tahoe): só o papel de parede atrás+ if (!bgOn || leo) veil.a = 0; // sem fundo (Tahoe): só o papel de parede atrás; Leopard: o degradê do Render é o fundo todort->CreateSolidColorBrush(veil, &br);rt->FillRectangle(D2D1::RectF(0, 0, W, H), br); // tinta leve por cima do acrílicoif (leo) {@@ -649,7 +650,9 @@ void Render() {// medido numa captura do 10.5 a 1x: 248 no alto -> 204 embaixo, a linha de baixo quase preta// Aparência > "Barra de menus translúcida" desligada (o 10.5.2 trouxe a opção): opacaconst float op = shell::Setting(L"barra_translucida", L"1") == L"1" ? 1.f : 1.12f;- D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(248 / 255.f, 248 / 255.f, 248 / 255.f, std::min(1.f, 0.90f * op)) }, { 1, D2D1::ColorF(204 / 255.f, 204 / 255.f, 204 / 255.f, std::min(1.f, 0.88f * op)) } };+ // translúcida: ~72 % de branco (o papel de parede passa nítido, como nas capturas do 10.5); opaca: cheia+ const float a0 = op > 1 ? 1.f : 0.74f, a1 = op > 1 ? 1.f : 0.70f;+ D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(248 / 255.f, 248 / 255.f, 248 / 255.f, a0) }, { 1, D2D1::ColorF(214 / 255.f, 214 / 255.f, 214 / 255.f, a1) } };ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;if (SUCCEEDED(rt->CreateGradientStopCollection(st, 2, &gs)) &&SUCCEEDED(rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, 0 }, { 0, H }), gs, &lb)))diff --git a/src/shell/mesa.cpp b/src/shell/mesa.cppindex bc49c54..7e08c69 100644--- a/src/shell/mesa.cpp+++ b/src/shell/mesa.cpp@@ -1303,7 +1303,7 @@ LRESULT CALLBACK DeskProc(HWND h, UINT m, WPARAM w, LPARAM l) {if (w == SPI_SETWORKAREA && primary) { Arrange(); Redraw(); }return 0;case WM_DISPLAYCHANGE: case WM_DPICHANGED:- PostMessageW(g_ctl, WM_MS_REBUILD, 0, 0);+ PostMessageW(g_ctl, WM_MS_REBUILD, 0, m == WM_DPICHANGED); // DPI: refaz mesmo com os mesmos retângulosreturn 0;case WM_MS_ENDEDIT: if (g_edit && GetFocus() != g_edit) EndEdit(w != 0); return 0;case WM_LBUTTONDOWN: {@@ -1483,6 +1483,24 @@ void DestroyDesk() {g_live = false; // as janelas novas nascem opacas; o Tick confere de novo}+// os monitores de agora são outros que os da mesa (número ou retângulos)?+bool g_forceRebuild = false, g_rebuildLater = false;+bool MonitorsChanged() {+ std::vector<RECT> now;+ EnumDisplayMonitors(nullptr, nullptr, [](HMONITOR hm, HDC, LPRECT, LPARAM l) -> BOOL {+ MONITORINFO mi{ sizeof(mi) }; GetMonitorInfoW(hm, &mi);+ ((std::vector<RECT>*)l)->push_back(mi.rcMonitor);+ return TRUE;+ }, (LPARAM)&now);+ if (now.size() != g_mons.size()) return true;+ for (auto& r : now) {+ bool found = false;+ for (auto& m : g_mons) if (EqualRect(&r, &m.r)) { found = true; break; }+ if (!found) return true;+ }+ return false;+}+void CreateDesk() {if (DeskExists()) return;EnumDisplayMonitors(nullptr, nullptr, [](HMONITOR hm, HDC, LPRECT, LPARAM) -> BOOL {@@ -1693,6 +1711,7 @@ LRESULT CALLBACK CtlProc(HWND h, UINT m, WPARAM w, LPARAM l) {case WM_TIMER:if (w == 1) Tick();if (w == 2) { KillTimer(h, 2); if (DeskExists()) Reload(); }+ if (w == 7) { KillTimer(h, 7); PostMessageW(h, WM_MS_REBUILD, 1, 0); } // a tela assentou: confere e refazif (w == 3) { // widgets mudaram de lugar?if (!DeskExists()) return 0;static std::vector<RECT> last;@@ -1715,6 +1734,14 @@ LRESULT CALLBACK CtlProc(HWND h, UINT m, WPARAM w, LPARAM l) {case WM_MS_ICONS: TakeIcons(); return 0;case WM_MS_WALLNOW: if (DeskExists()) { Log(L"mesa: papel de parede escolhido no Ajustes; mostrando já"); LoadWallpapers(); } return 0;case WM_MS_REBUILD:+ // Cada aviso de tela (WM_DISPLAYCHANGE/DPI) refazia a mesa na hora e decodificava o papel de parede de novo: um+ // jogo entrando e saindo da tela cheia dava isso a cada segundo (Fortnite, 20/11/2026: 101 linhas da mesa no+ // log). Agora espera a tela assentar (1,2 s), só refaz se os monitores mudaram mesmo, e não no meio de um jogo+ // (fica para quando ele fechar: mesa::DepoisDoJogo)+ if (w != 1) { if (l) g_forceRebuild = true; SetTimer(h, 7, 1200, nullptr); return 0; }+ if (jogo::Ativo()) { g_rebuildLater = true; return 0; }+ if (!g_forceRebuild && !MonitorsChanged()) { Log(L"mesa: aviso de tela sem mudança nos monitores; mesa mantida"); return 0; }+ g_forceRebuild = false;if (DeskExists()) {bool shellWas = g_standalone;if (shellWas) CallUser32("SetShellWindow", nullptr);@@ -1830,6 +1857,11 @@ void mesa::Start(HINSTANCE hi, HWND msgWnd) {Tick();}+// o jogo fechou: a troca de tela que ficou para depois (confere de novo se os monitores mudaram)+void mesa::DepoisDoJogo() {+ if (g_rebuildLater && g_ctl) { g_rebuildLater = false; PostMessageW(g_ctl, WM_MS_REBUILD, 1, 0); }+}+void mesa::SettingsChanged() {Log(L"mesa: ajustes mudaram (explorer=%ls)", shell::Setting(L"explorer", L"1").c_str());if (g_ctl) { g_closeTries = 0; Tick(); }diff --git a/src/shell/notificacoes.cpp b/src/shell/notificacoes.cppindex e859312..4acd03d 100644--- a/src/shell/notificacoes.cpp+++ b/src/shell/notificacoes.cpp@@ -365,11 +365,11 @@ void GlassEnd() {// ================= coresstruct Pal { D2D1_COLOR_F tint, tintPill, text, text2, line, close, closeGlyph, chip, header; };Pal Colors() {- // Leopard: os avisos da época eram os balões do Growl ("Smoke"): cartão preto translúcido, texto branco+ // Leopard: cartão claro do Aqua (o usuário preferiu claro ao "Smoke" escuro do Growl): branco perolado, texto pretoif (liquid::Leopard())- return { D2D1::ColorF(0.04f, 0.04f, 0.05f, 0.80f), D2D1::ColorF(0.10f, 0.10f, 0.11f, 0.80f), D2D1::ColorF(1, 1, 1, 0.97f),- D2D1::ColorF(1, 1, 1, 0.70f), D2D1::ColorF(1, 1, 1, 0.12f), D2D1::ColorF(0.30f, 0.30f, 0.32f, 0.98f),- D2D1::ColorF(1, 1, 1, 0.90f), D2D1::ColorF(1, 1, 1, 0.16f), D2D1::ColorF(1, 1, 1, 0.97f) };+ return { D2D1::ColorF(0.97f, 0.97f, 0.97f, 0.95f), D2D1::ColorF(0.95f, 0.95f, 0.95f, 0.95f), D2D1::ColorF(0, 0, 0, 0.90f),+ D2D1::ColorF(0, 0, 0, 0.60f), D2D1::ColorF(0, 0, 0, 0.25f), D2D1::ColorF(0.93f, 0.93f, 0.93f, 1),+ D2D1::ColorF(0, 0, 0, 0.70f), D2D1::ColorF(0, 0, 0, 0.08f), D2D1::ColorF(1, 1, 1, 0.97f) };if (liquid::On()) { // Tahoe: vidro de verdade, o fundo desfocado aparece (antes a tinta deixava o cartão quase opaco)Pal p = Dark()? Pal{ D2D1::ColorF(0.10f, 0.10f, 0.11f, 0.40f), D2D1::ColorF(0.16f, 0.16f, 0.17f, 0.36f), D2D1::ColorF(1, 1, 1, 0.95f),@@ -754,21 +754,35 @@ void Border(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const Pal& p, D2D1dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 0.5f, r.top + 0.5f, r.right - 0.5f, r.bottom - 0.5f), rad - 0.5f, rad - 0.5f), br, 1);}+// Leopard: o cartão claro do Aqua (degradê branco -> cinza bem claro, fio cinza, luz no alto e sombra leve)+void LeoCard(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F r, float rad, float a) {+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.18f * a));+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left, r.top + 1.5f, r.right, r.bottom + 2), rad, rad), br);+ D2D1_GRADIENT_STOP st[2] = { { 0, D2D1::ColorF(1, 1, 1, 0.97f * a) }, { 1, D2D1::ColorF(0.89f, 0.89f, 0.90f, 0.97f * a) } };+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;+ if (SUCCEEDED(dc->CreateGradientStopCollection(st, 2, &gs)) &&+ SUCCEEDED(dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, r.top }, { 0, r.bottom }), gs, &lb)))+ dc->FillRoundedRectangle(D2D1::RoundedRect(r, rad, rad), lb);+ if (lb) lb->Release();+ if (gs) gs->Release();+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.30f * a));+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 0.5f, r.top + 0.5f, r.right - 0.5f, r.bottom - 0.5f), rad - 0.5f, rad - 0.5f), br, 1);+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.9f * a));+ dc->DrawLine({ r.left + rad, r.top + 1.5f }, { r.right - rad, r.top + 1.5f }, br, 1);+}+void DrawCard(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const Pal& p, const Group& g, const Note& n, D2D1_RECT_F r, const std::wstring& key) {if (liquid::Leopard()) {- // Leopard (balão "Smoke" do Growl): preto translúcido de cantos 8 com o fio claro, o ícone à esquerda, o título- // em negrito branco e o texto branco embaixo; sem a hora- br->SetColor(D2D1::ColorF(0.04f, 0.04f, 0.05f, 0.78f));- dc->FillRoundedRectangle(D2D1::RoundedRect(r, 8, 8), br);- br->SetColor(D2D1::ColorF(1, 1, 1, 0.18f));- dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 0.5f, r.top + 0.5f, r.right - 0.5f, r.bottom - 0.5f), 7.5f, 7.5f), br, 1);+ // Leopard: cartão claro do Aqua de cantos 8, o ícone à esquerda, o título+ // em negrito preto e o texto embaixo; sem a hora+ LeoCard(dc, br, r, 8, 1);float cy0 = (r.top + r.bottom) / 2;DrawIcon(dc, br, g, D2D1::RectF(r.left + ICON_X, cy0 - ICON / 2, r.left + ICON_X + ICON, cy0 + ICON / 2));float tx0 = r.left + TEXT_X, top0 = r.top + PAD_V;- Text(dc, br, n.title, g_tfTitle, D2D1::RectF(tx0, top0, r.right - PAD_R, top0 + TITLE_H), D2D1::ColorF(1, 1, 1, 0.97f));+ Text(dc, br, n.title, g_tfTitle, D2D1::RectF(tx0, top0, r.right - PAD_R, top0 + TITLE_H), D2D1::ColorF(0, 0, 0, 0.92f));auto& b0 = Body(n);if (b0.first) {- br->SetColor(D2D1::ColorF(1, 1, 1, 0.92f));+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.78f));dc->DrawTextLayout({ tx0, top0 + TITLE_H }, b0.first, br, D2D1_DRAW_TEXT_OPTIONS_CLIP);}return;@@ -865,10 +879,104 @@ void PaintClock(ID2D1DeviceContext* dc, float w, float h, bool dark) {br->Release();}+// ---- Mac OS X Leopard: os widgets do Dashboard do 10.5 (o iCal em folha de calendário e o relógio redondo)+void LeoGrad(ID2D1DeviceContext* dc, D2D1_RECT_F r, float rad, std::initializer_list<D2D1_GRADIENT_STOP> st, bool ellipse = false) {+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;+ if (SUCCEEDED(dc->CreateGradientStopCollection(st.begin(), (UINT)st.size(), &gs)) &&+ SUCCEEDED(dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, r.top }, { 0, r.bottom }), gs, &lb))) {+ if (ellipse) dc->FillEllipse(D2D1::Ellipse({ (r.left + r.right) / 2, (r.top + r.bottom) / 2 }, (r.right - r.left) / 2, (r.bottom - r.top) / 2), lb);+ else dc->FillRoundedRectangle(D2D1::RoundedRect(r, rad, rad), lb);+ }+ if (lb) lb->Release();+ if (gs) gs->Release();+}+void PaintCalendarLeo(ID2D1DeviceContext* dc, float w, float h, bool) {+ ID2D1SolidColorBrush* br = nullptr;+ dc->CreateSolidColorBrush(D2D1::ColorF(0, 0, 0), &br);+ SYSTEMTIME t; GetLocalTime(&t);+ D2D1_RECT_F pg = D2D1::RectF(14, 12, w - 14, h - 16);+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.35f)); // a sombra do widget+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(pg.left, pg.top + 3, pg.right, pg.bottom + 4), 9, 9), br);+ LeoGrad(dc, pg, 9, { { 0, D2D1::ColorF(1, 1, 1) }, { 1, D2D1::ColorF(0.88f, 0.88f, 0.89f) } });+ float band = (pg.bottom - pg.top) * 0.30f;+ ID2D1Layer* l = nullptr; dc->CreateLayer(nullptr, &l);+ ID2D1Factory* f = nullptr; dc->GetFactory(&f);+ ID2D1RoundedRectangleGeometry* rg = nullptr; f->CreateRoundedRectangleGeometry(D2D1::RoundedRect(pg, 9, 9), &rg);+ dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), rg), l);+ LeoGrad(dc, D2D1::RectF(pg.left, pg.top, pg.right, pg.top + band), 0, { { 0, D2D1::ColorF(0.93f, 0.36f, 0.33f) }, { 0.5f, D2D1::ColorF(0.82f, 0.13f, 0.12f) }, { 1, D2D1::ColorF(0.70f, 0.06f, 0.06f) } });+ dc->PopLayer();+ rg->Release(); f->Release(); l->Release();+ static const wchar_t* meses[] = { L"JAN", L"FEV", L"MAR", L"ABR", L"MAI", L"JUN", L"JUL", L"AGO", L"SET", L"OUT", L"NOV", L"DEZ" };+ IDWriteTextFormat* tm = Fmt(band * 0.55f, DWRITE_FONT_WEIGHT_BOLD, L"Lucida Sans Unicode");+ Text(dc, br, Tr(meses[(t.wMonth + 11) % 12]), tm, D2D1::RectF(pg.left, pg.top, pg.right, pg.top + band), D2D1::ColorF(1, 1, 1, 1), DWRITE_TEXT_ALIGNMENT_CENTER);+ if (tm) tm->Release();+ IDWriteTextFormat* big = Fmt((pg.bottom - pg.top - band) * 0.66f, DWRITE_FONT_WEIGHT_BOLD, L"Lucida Sans Unicode");+ Text(dc, br, std::to_wstring(t.wDay), big, D2D1::RectF(pg.left, pg.top + band, pg.right, pg.bottom), D2D1::ColorF(0.1f, 0.1f, 0.1f, 1), DWRITE_TEXT_ALIGNMENT_CENTER);+ if (big) big->Release();+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.35f));+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(pg.left + 0.5f, pg.top + 0.5f, pg.right - 0.5f, pg.bottom - 0.5f), 8.5f, 8.5f), br, 1);+ br->Release();+}+void PaintClockLeo(ID2D1DeviceContext* dc, float w, float h, bool) {+ ID2D1SolidColorBrush* br = nullptr;+ dc->CreateSolidColorBrush(D2D1::ColorF(0, 0, 0), &br);+ D2D1_POINT_2F c{ w / 2, h / 2 - 2 };+ float R = std::min(w, h) / 2 - 12;+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.35f));+ dc->FillEllipse(D2D1::Ellipse({ c.x, c.y + 3 }, R + 1, R + 1), br);+ // o aro cromado e o mostrador branco do relógio do Dashboard+ LeoGrad(dc, D2D1::RectF(c.x - R, c.y - R, c.x + R, c.y + R), 0, { { 0, D2D1::ColorF(0.97f, 0.97f, 0.98f) }, { 0.5f, D2D1::ColorF(0.62f, 0.63f, 0.66f) }, { 1, D2D1::ColorF(0.92f, 0.92f, 0.94f) } }, true);+ float r2 = R * 0.88f;+ LeoGrad(dc, D2D1::RectF(c.x - r2, c.y - r2, c.x + r2, c.y + r2), 0, { { 0, D2D1::ColorF(0.86f, 0.86f, 0.87f) }, { 1, D2D1::ColorF(1, 1, 1) } }, true);+ D2D1_COLOR_F ink = D2D1::ColorF(0.08f, 0.08f, 0.08f, 1);+ IDWriteTextFormat* num = Fmt(r2 * 0.24f, DWRITE_FONT_WEIGHT_BOLD, L"Lucida Sans Unicode");+ for (int i = 1; i <= 12; i++) {+ float a = i * 3.14159265f / 6;+ float x = c.x + std::sin(a) * r2 * 0.76f, y = c.y - std::cos(a) * r2 * 0.76f;+ Text(dc, br, std::to_wstring(i), num, D2D1::RectF(x - 14, y - 10, x + 14, y + 10), ink, DWRITE_TEXT_ALIGNMENT_CENTER);+ }+ if (num) num->Release();+ SYSTEMTIME t; GetLocalTime(&t);+ float mn = t.wMinute + t.wSecond / 60.f, hr = (t.wHour % 12) + mn / 60;+ ID2D1StrokeStyle* st = nullptr;+ ID2D1Factory* f = nullptr; dc->GetFactory(&f);+ f->CreateStrokeStyle(D2D1::StrokeStyleProperties(D2D1_CAP_STYLE_ROUND, D2D1_CAP_STYLE_ROUND), nullptr, 0, &st);+ auto hand = [&](float ang, float len, float width, D2D1_COLOR_F col, float tail) {+ br->SetColor(col);+ D2D1_POINT_2F d{ std::sin(ang), -std::cos(ang) };+ dc->DrawLine({ c.x - d.x * tail, c.y - d.y * tail }, { c.x + d.x * len, c.y + d.y * len }, br, width, st);+ };+ hand(hr * 3.14159265f / 6, r2 * 0.50f, 3.6f, ink, r2 * 0.08f);+ hand(mn * 3.14159265f / 30, r2 * 0.74f, 2.6f, ink, r2 * 0.08f);+ hand((float)t.wSecond * 3.14159265f / 30, r2 * 0.80f, 1.2f, D2D1::ColorF(0.85f, 0.10f, 0.08f, 1), r2 * 0.18f);+ br->SetColor(D2D1::ColorF(0.85f, 0.10f, 0.08f, 1));+ dc->FillEllipse(D2D1::Ellipse(c, 2.8f, 2.8f), br);+ if (st) st->Release();+ f->Release();+ br->Release();+}++// Os widgets da Central (embaixo das notificações): cada um some com central_<id>=0 no ajustes.txt, pelo+// "Editar Widgets…" da Central ou pelo botão direito em cima dele ("Remover Widget")+struct CentralWidget { const wchar_t* id; const wchar_t* name; };+const CentralWidget CENTRAL_W[] = { { L"calendario", L"Calendário" }, { L"relogio", L"Relógio" } };+std::vector<int> g_widgetKind; // g_widgets[i] é CENTRAL_W[g_widgetKind[i]] (só com os padrões)++bool CentralOn(int k) { return shell::Setting((std::wstring(L"central_") + CENTRAL_W[k].id).c_str(), L"1") != L"0"; }+void DefaultWidgets() {g_widgets.clear();- g_widgets.push_back({ WIDGET_S, WIDGET_S, PaintCalendar, [] { ShellExecuteW(nullptr, L"open", L"outlookcal:", nullptr, nullptr, SW_SHOWNORMAL); } });- g_widgets.push_back({ WIDGET_S, WIDGET_S, PaintClock, [] { ShellExecuteW(nullptr, L"open", L"ms-clock:", nullptr, nullptr, SW_SHOWNORMAL); } });+ g_widgetKind.clear();+ if (CentralOn(0)) {+ g_widgets.push_back({ WIDGET_S, WIDGET_S, [](ID2D1DeviceContext* dc, float w, float h, bool d) { (liquid::Leopard() ? PaintCalendarLeo : PaintCalendar)(dc, w, h, d); },+ [] { ShellExecuteW(nullptr, L"open", L"outlookcal:", nullptr, nullptr, SW_SHOWNORMAL); } });+ g_widgetKind.push_back(0);+ }+ if (CentralOn(1)) {+ g_widgets.push_back({ WIDGET_S, WIDGET_S, [](ID2D1DeviceContext* dc, float w, float h, bool d) { (liquid::Leopard() ? PaintClockLeo : PaintClock)(dc, w, h, d); },+ [] { ShellExecuteW(nullptr, L"open", L"ms-clock:", nullptr, nullptr, SW_SHOWNORMAL); } });+ g_widgetKind.push_back(1);+ }}D2D1_RECT_F Cur(const Anim& a) { return D2D1::RectF(a.l.x, a.t.x, a.r.x, a.b.x); }@@ -896,6 +1004,9 @@ void Paint() {g_hits.clear();ID2D1Layer* layer = nullptr;dc->CreateLayer(nullptr, &layer);+ // Leopard: nada de vidro; tudo em cartões claros do Aqua, widgets soltos como no Dashboard+ const bool leo = liquid::Leopard();+ auto smoke = [&](D2D1_RECT_F r, float rad, float a) { LeoCard(dc, br, r, rad, std::min(1.f, a + 0.2f)); }; // o cartão clarofor (auto& key : g_order) {auto it = g_anim.find(key);if (it == g_anim.end()) continue;@@ -921,13 +1032,14 @@ void Paint() {switch (e.kind) {case K_CARD:if (!g || e.note < 0 || e.note >= (int)g->notes.size()) break;- GlassRect(px, CardR() * sc, p.tint, alpha);- if (!g_hasGlass) { br->SetColor(dark ? D2D1::ColorF(0.17f, 0.17f, 0.18f, 0.96f) : D2D1::ColorF(0.95f, 0.95f, 0.96f, 0.96f)); dc->FillRoundedRectangle(D2D1::RoundedRect(r, CardR(), CardR()), br); }+ if (!leo) GlassRect(px, CardR() * sc, p.tint, alpha);+ if (!g_hasGlass && !leo) { br->SetColor(dark ? D2D1::ColorF(0.17f, 0.17f, 0.18f, 0.96f) : D2D1::ColorF(0.95f, 0.95f, 0.96f, 0.96f)); dc->FillRoundedRectangle(D2D1::RoundedRect(r, CardR(), CardR()), br); }DrawCard(dc, br, p, *g, g->notes[e.note], r, e.key);g_hits.push_back({ r, e.act, e.group, e.note, -1, e.key });break;case K_UNDER: {D2D1_COLOR_F t = p.tint; t.a *= e.layer == 1 ? 0.85f : 0.7f;+ if (leo) { smoke(r, 8, e.layer == 1 ? 0.62f : 0.48f); g_hits.push_back({ D2D1::RectF(r.left, cut, r.right, r.bottom), e.act, e.group, 0, -1, L"n:" + std::to_wstring(g ? g->notes[0].id : 0) }); break; }GlassRect(px, CardR() * sc, t, alpha * (e.layer == 1 ? 0.9f : 0.75f), std::max(0.f, cut * sc));if (!g_hasGlass) { br->SetColor(dark ? D2D1::ColorF(0.2f, 0.2f, 0.21f, 0.9f) : D2D1::ColorF(0.9f, 0.9f, 0.91f, 0.9f)); dc->FillRoundedRectangle(D2D1::RoundedRect(r, CardR(), CardR()), br); }Border(dc, br, p, r, CardR());@@ -942,8 +1054,14 @@ void Paint() {}case K_PILL: {float rad = (r.bottom - r.top) / 2;- GlassRect(px, rad * sc, p.tintPill, alpha);bool hv = g_hover == e.key;+ if (leo) {+ smoke(r, rad, hv ? 0.85f : 0.70f);+ Text(dc, br, e.text, g_tfPill, r, D2D1::ColorF(0, 0, 0, 0.85f), DWRITE_TEXT_ALIGNMENT_CENTER);+ g_hits.push_back({ r, e.act, e.group, -1, -1, e.key });+ break;+ }+ GlassRect(px, rad * sc, p.tintPill, alpha);if (hv) { br->SetColor(p.chip); dc->FillRoundedRectangle(D2D1::RoundedRect(r, rad, rad), br); }if (!g_hasGlass) { br->SetColor(dark ? D2D1::ColorF(0.2f, 0.2f, 0.21f, 0.9f) : D2D1::ColorF(0.92f, 0.92f, 0.93f, 0.9f)); dc->FillRoundedRectangle(D2D1::RoundedRect(r, rad, rad), br); }Border(dc, br, p, r, rad);@@ -953,17 +1071,20 @@ void Paint() {}case K_CIRCLE: {float rad = (r.right - r.left) / 2;- GlassRect(px, rad * sc, p.tintPill, alpha);- if (!g_hasGlass) { br->SetColor(dark ? D2D1::ColorF(0.2f, 0.2f, 0.21f, 0.9f) : D2D1::ColorF(0.92f, 0.92f, 0.93f, 0.9f)); dc->FillEllipse(D2D1::Ellipse({ (r.left + r.right) / 2, (r.top + r.bottom) / 2 }, rad, rad), br); }+ if (leo) smoke(r, rad, 0.70f);+ else GlassRect(px, rad * sc, p.tintPill, alpha);+ if (!g_hasGlass && !leo) { br->SetColor(dark ? D2D1::ColorF(0.2f, 0.2f, 0.21f, 0.9f) : D2D1::ColorF(0.92f, 0.92f, 0.93f, 0.9f)); dc->FillEllipse(D2D1::Ellipse({ (r.left + r.right) / 2, (r.top + r.bottom) / 2 }, rad, rad), br); }DrawCircleButton(dc, br, p, r, e.act == A_SETTINGS, g_hover == e.key);g_hits.push_back({ r, e.act, e.group, -1, -1, e.key });break;}case K_WIDGET: {if (e.widget < 0 || e.widget >= (int)g_widgets.size()) break;+ if (!leo) { // Leopard: o widget do Dashboard desenha a própria forma, sem placaGlassRect(px, WidgetR() * sc, p.tint, alpha);if (!g_hasGlass) { br->SetColor(dark ? D2D1::ColorF(0.17f, 0.17f, 0.18f, 0.96f) : D2D1::ColorF(0.95f, 0.95f, 0.96f, 0.96f)); dc->FillRoundedRectangle(D2D1::RoundedRect(r, WidgetR(), WidgetR()), br); }Border(dc, br, p, r, WidgetR());+ }D2D1_MATRIX_3X2_F old; dc->GetTransform(&old);dc->PushAxisAlignedClip(r, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);dc->SetTransform(D2D1::Matrix3x2F::Translation(r.left, r.top) * old);@@ -977,9 +1098,10 @@ void Paint() {Text(dc, br, e.text, g_tfEmpty, r, D2D1::ColorF(1, 1, 1, 0.92f), DWRITE_TEXT_ALIGNMENT_CENTER, true);break;case K_EMPTY: {- GlassRect(px, CardR() * sc, p.tint, alpha);- if (!g_hasGlass) { br->SetColor(dark ? D2D1::ColorF(0.17f, 0.17f, 0.18f, 0.96f) : D2D1::ColorF(0.95f, 0.95f, 0.96f, 0.96f)); dc->FillRoundedRectangle(D2D1::RoundedRect(r, CardR(), CardR()), br); }- Border(dc, br, p, r, CardR());+ if (leo) smoke(r, 8, 0.75f);+ else GlassRect(px, CardR() * sc, p.tint, alpha);+ if (!g_hasGlass && !leo) { br->SetColor(dark ? D2D1::ColorF(0.17f, 0.17f, 0.18f, 0.96f) : D2D1::ColorF(0.95f, 0.95f, 0.96f, 0.96f)); dc->FillRoundedRectangle(D2D1::RoundedRect(r, CardR(), CardR()), br); }+ if (!leo) Border(dc, br, p, r, CardR());br->SetColor(p.text2);float cx = (r.left + r.right) / 2;simbolo::Draw(dc, L"bell.badge.fill", D2D1::RectF(cx - 11, r.top + 14, cx + 11, r.top + 36), br);@@ -1142,6 +1264,35 @@ void Options(int gi, int ni, D2D1_RECT_F r) {Animate();}+// "Editar Widgets…" da Central (e o botão direito num widget dela): ligar/desligar o Calendário e o Relógio daqui;+// os widgets da mesa têm o menu deles ("Widgets da Mesa…")+void WidgetsMenu(D2D1_RECT_F r, int widget) {+ std::vector<ctxmenu::Item> items;+ for (int k = 0; k < (int)std::size(CENTRAL_W); k++) {+ ctxmenu::Item it; it.label = Tr(CENTRAL_W[k].name); it.id = 10 + k; it.checked = CentralOn(k); items.push_back(it);+ }+ ctxmenu::Item sep; sep.separator = true; items.push_back(sep);+ if (widget >= 0 && widget < (int)g_widgetKind.size()) { ctxmenu::Item rm; rm.label = Tr(L"Remover Widget"); rm.id = 1; items.push_back(rm); }+ ctxmenu::Item desk; desk.label = Tr(L"Widgets da Mesa…"); desk.id = 2; items.push_back(desk);+ RECT wr; GetWindowRect(g_wnd, &wr);+ float sc = Sc();+ POINT pt{ wr.left + (LONG)(r.left * sc), wr.top + (LONG)((r.bottom + 4) * sc) };+ g_menu = true;+ int id = ctxmenu::ShowItems(g_wnd, pt, items);+ g_menu = false;+ int off = -1;+ if (id == 1) off = g_widgetKind[widget];+ else if (id >= 10 && id < 10 + (int)std::size(CENTRAL_W)) {+ int k = id - 10;+ if (CentralOn(k)) off = k;+ else shell::SetSetting((std::wstring(L"central_") + CENTRAL_W[k].id).c_str(), L"1");+ } else if (id == 2) { Close(); POINT c; GetCursorPos(&c); widgets::EditMenu(c); return; }+ if (off >= 0) shell::SetSetting((std::wstring(L"central_") + CENTRAL_W[off].id).c_str(), L"0");+ if (id > 0 && !g_customWidgets) DefaultWidgets();+ SetForegroundWindow(g_wnd);+ Animate();+}+const Hit* HitAt(D2D1_POINT_2F p) {const Hit* hit = nullptr;for (auto& h : g_hits) if (p.x >= h.r.left && p.x < h.r.right && p.y >= h.r.top && p.y < h.r.bottom) hit = &h; // o último desenhado vence@@ -1198,9 +1349,8 @@ void Click(D2D1_POINT_2F p) {}case A_MORE: g_showAll = true; break;case A_EDIT:- Close();- if (g_editWidgets) g_editWidgets();- else { POINT c; GetCursorPos(&c); widgets::EditMenu(c); } // os widgets da mesa: ligar/desligar cada um+ if (g_editWidgets) { Close(); g_editWidgets(); return; }+ WidgetsMenu(hit.r, -1); // Calendário e Relógio da Central; "Widgets da Mesa…" leva ao menu da mesareturn;case A_SETTINGS: Close(); shell::OpenSettings(L"notificacoes"); return;case A_PERMISSION: Close(); ShellExecuteW(nullptr, L"open", L"ms-settings:privacy-notifications", nullptr, nullptr, SW_SHOWNORMAL); return;@@ -1265,7 +1415,12 @@ LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {if (g_open) Click(p);return 0;}- case WM_RBUTTONUP: return 0;+ case WM_RBUTTONUP: { // botão direito num widget da Central: ligar/desligar e "Remover Widget"+ if (!g_open || g_customWidgets) return 0;+ const Hit* hh = HitAt(Pt(l));+ if (hh && hh->act == A_WIDGET) { Hit copy = *hh; WidgetsMenu(copy.r, copy.widget); }+ return 0;+ }case WM_MOUSEMOVE: {if (!g_open) return 0;TRACKMOUSEEVENT t{ sizeof(t), TME_LEAVE, h, 0 }; TrackMouseEvent(&t);@@ -1511,6 +1666,14 @@ void ChecarAvisos() {void BannerShowNote(const Note& n) {// jogo ou vídeo em tela cheia no monitor do banner: sem banner (ela fica na Central), senão o jogo sai da tela cheiaif (shell::NaoIncomodar(MonitorFromPoint({ 0, 0 }, MONITOR_DEFAULTTOPRIMARY))) { Log(L"notificação: banner calado (app em tela cheia)"); return; }+ // Ilha Dinâmica ligada: a notificação aparece nela, no lugar do banner do canto+ if (!g_open && !g_closing) {+ Group gr{ n.aumid, n.app, {} };+ Note nn = n;+ if (ilha::Notificacao(n.app, n.title, n.body,+ [gr](ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, D2D1_RECT_F r) { DrawIcon(dc, br, gr, r); },+ [nn] { OpenApp(nn); })) { Log(L"notificação na ilha: %ls", n.app.c_str()); return; }+ }if (g_open || g_closing || !BannersOn() || !g_bwnd) return;bool wasIn = g_bshow && !g_bout;g_bnote = n;@@ -1666,7 +1829,7 @@ bool notificacoes::Create(HINSTANCE hi) {}// o toast do Windows sai da tela assim que aparece (o banner do Mac fica no lugar)SetWinEventHook(EVENT_OBJECT_SHOW, EVENT_OBJECT_SHOW, nullptr, OnToast, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS);- SetWinEventHook(EVENT_OBJECT_LOCATIONCHANGE, EVENT_OBJECT_LOCATIONCHANGE, nullptr, OnToast, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS);+ jogo::GanchoPosicao(OnToast, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS); // sai no modo jogo (jogo.cpp)std::thread(Worker).detach();return true;}diff --git a/src/shell/pilhas.cpp b/src/shell/pilhas.cppindex 2dd2df1..9c50e62 100644--- a/src/shell/pilhas.cpp+++ b/src/shell/pilhas.cpp@@ -3,6 +3,7 @@// (painel de vidro com as miniaturas) ou em Lista (menu). O botão direito escolhe a ordem e o jeito de ver// (pilha_ordem / pilha_ver no ajustes.txt). Clicar num arquivo abre o arquivo; Esc ou clique fora fecha.#include "shell.h"+#include "../comum/leopard.h" // Leopard: as pastas azuis e os documentos do 10.5 nas Pilhas#include "../menu/context_menu.h"#include <dwmapi.h>#include <shlobj.h>@@ -600,6 +601,12 @@ void ShowStack(POINT anchor, bool apps) {std::wstring png = apps::PackIconByName(nm, L"");got = !png.empty() && ui::LoadPng(png, w, h, bgra);}+ if (!got && !appsIcons && liquid::Leopard()) { // Leopard: pasta azul / documento do Aqua (fotos e vídeos: miniatura)+ DWORD at = GetFileAttributesW(paths[i].c_str());+ std::wstring nm = at != INVALID_FILE_ATTRIBUTES && (at & FILE_ATTRIBUTE_DIRECTORY) ? std::wstring(L"folder default") : leopard::DocIcon(paths[i]);+ std::wstring png = nm.empty() ? L"" : ui::PackIcon(nm);+ got = !png.empty() && ui::LoadPng(png, w, h, bgra);+ }if (!got && !ui::FileImage(paths[i], px, w, h, bgra)) continue;{std::lock_guard<std::mutex> l(g_mx);diff --git a/src/shell/ponteiro.cpp b/src/shell/ponteiro.cppindex 284cd66..830247f 100644--- a/src/shell/ponteiro.cpp+++ b/src/shell/ponteiro.cpp@@ -135,7 +135,16 @@ void AnimateTo(float target, double now) {g_animMs = target > g_mag ? GROW_MS : SHRINK_MS;}+const UINT WM_PT_PAUSA = WM_APP + 0x50; // modo jogo: wParam 1 tira o Raw Input, 0 devolve+LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {+ if (m == WM_PT_PAUSA) {+ // num jogo, cada movimento do mouse (1000 por segundo num mouse de jogo) acordava esta thread+ RAWINPUTDEVICE rid{ 0x01, 0x02, w ? (DWORD)RIDEV_REMOVE : (DWORD)RIDEV_INPUTSINK, w ? nullptr : h };+ RegisterRawInputDevices(&rid, 1, sizeof(rid));+ if (w) { g_hist.clear(); AnimateTo(1.f, anim::Now()); }+ return 0;+ }if (m == WM_INPUT) {RAWINPUT ri; UINT sz = sizeof(ri);if (GetRawInputData((HRAWINPUT)l, RID_INPUT, &ri, &sz, sizeof(RAWINPUTHEADER)) != (UINT)-1 && ri.header.dwType == RIM_TYPEMOUSE) {@@ -201,6 +210,8 @@ void ponteiro::Start() {std::thread(Thread).detach();}+void ponteiro::Pausar(bool p) { if (g_wnd) PostMessageW(g_wnd, WM_PT_PAUSA, p ? 1 : 0, 0); }+void ponteiro::Stop() {if (DWORD t = g_tid) PostThreadMessageW(t, WM_QUIT, 0, 0);SystemParametersInfoW(SPI_SETCURSORS, 0, nullptr, 0); // o cursor volta mesmo se a thread não chegar a tempodiff --git a/src/shell/quicklook.cpp b/src/shell/quicklook.cppindex 66f6bf4..a560ff8 100644--- a/src/shell/quicklook.cpp+++ b/src/shell/quicklook.cpp@@ -739,11 +739,22 @@ void Load(const std::wstring& path) {HWND w = g_wnd;int px = (int)std::lround((g_isIcon ? 400 : 1200) * Sc());bool icon = g_isIcon;- std::thread([path, gen, w, px, icon, dir] {+ // fotos: o arquivo inteiro até o tamanho da tela (a tela cheia do Quick Look usa tudo), não a miniatura+ std::wstring ext = path.substr(path.find_last_of(L'.') == std::wstring::npos ? path.size() : path.find_last_of(L'.'));+ for (auto& c : ext) c = towlower(c);+ bool photo = !icon && !dir;+ if (photo) {+ photo = false;+ for (auto e : { L".jpg", L".jpeg", L".jpe", L".jfif", L".png", L".bmp", L".gif", L".webp", L".heic", L".heif",+ L".avif", L".tif", L".tiff", L".jxr", L".wdp", L".ico", L".dds" })+ if (ext == e) photo = true;+ }+ UINT screen = (UINT)std::max({ GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), 1600 });+ std::thread([path, gen, w, px, icon, dir, photo, screen] {HRESULT co = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);auto* r = new std::tuple<int, UINT, UINT, std::vector<BYTE>>(gen, 0, 0, std::vector<BYTE>{});auto& [g, iw, ih, px2] = *r;- bool got = false;+ bool got = photo && ui::LoadPhoto(path, screen, iw, ih, px2); // sem codec (HEIC sem a extensão): a miniaturaif (icon && dir && GetFileAttributesW((path + L"\\desktop.ini").c_str()) == INVALID_FILE_ATTRIBUTES) { // a pasta do Mac (pacote de ícones)std::wstring png = ui::PackIcon(L"folder default");got = !png.empty() && ui::LoadPng(png, iw, ih, px2);diff --git a/src/shell/revelar.cpp b/src/shell/revelar.cppindex 08f6c23..653011e 100644--- a/src/shell/revelar.cpp+++ b/src/shell/revelar.cpp@@ -483,6 +483,14 @@ void revelar::Start() {t.detach();}+// Modo jogo (jogo.cpp): sem o gancho global do mouse enquanto o jogo roda (cada clique do jogo passava pelo Shell);+// o gancho volta numa thread nova quando o jogo fecha+void revelar::Pausar(bool p) {+ if (!g_wnd) return; // "clique mostra a mesa" desligado: não há gancho+ if (p) { if (DWORD t = g_hookThread) { g_hookThread = 0; PostThreadMessageW(t, WM_QUIT, 0, 0); } }+ else if (!g_hookThread) std::thread([] { g_hookThread = GetCurrentThreadId(); HookThread(); }).detach();+}+// outra janela veio para a frente (clicou na faixa de uma janela, Alt+Tab, Dock): todas voltamvoid revelar::Foreground(HWND h) {if (!g_revealed || !h || apps::IsShellWindow(h) || IsDesktopWindow(h)) return;diff --git a/src/shell/shell.h b/src/shell/shell.hindex a406635..8d20d9b 100644--- a/src/shell/shell.h+++ b/src/shell/shell.h@@ -126,6 +126,8 @@ bool FileImage(const std::wstring& path, int px, UINT& w, UINT& h, std::vector<Bvoid TrimToSquare(UINT& w, UINT& h, std::vector<BYTE>& bgra);void Downscale(UINT& w, UINT& h, std::vector<BYTE>& bgra, UINT maxSide); // reduz (média por área) se passar de maxSidebool LoadPng(const std::wstring& path, UINT& w, UINT& h, std::vector<BYTE>& bgra); // BGRA pré-multiplicado+// foto inteira (JPG, PNG, WebP, HEIC...) pelo WIC, girada pelo EXIF e reduzida até maxSide (o Quick Look)+bool LoadPhoto(const std::wstring& path, UINT maxSide, UINT& w, UINT& h, std::vector<BYTE>& bgra);std::wstring PackIcon(const std::wstring& name); // "icones\sequoia\<nome>.png" se existir, senão ""void DrawFolder(ID2D1RenderTarget* rt, D2D1_RECT_F box, wchar_t glyph); // pasta azul do Arquivos@@ -318,6 +320,21 @@ 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)}+namespace dashboard { // Dashboard do Leopard (dashboard.cpp): Win+F12 / ShellAbrirPainel 16+bool Create(HINSTANCE hi);+void Toggle();+bool IsOpen();+}+namespace espacos { // Spaces do Leopard (espacos.cpp): Win+F8 / ShellAbrirPainel 17+bool Create(HINSTANCE hi);+void Toggle();+bool IsOpen();+}+namespace tempo { // a "viagem no tempo" do Time Machine do Leopard (tempo.cpp): app Time Machine / ShellAbrirPainel 18+bool Create(HINSTANCE hi);+void Enter();+bool IsOpen();+}namespace sobre { // "Sobre Este Mac" do menu da Apple (sobre.cpp)bool Create(HINSTANCE hi);void Show();@@ -342,6 +359,7 @@ void IconsChanged(); // o pacote de ícones mudou (tema): solta os ícones gnamespace revelar { // clique no vazio da área de trabalho mostra a mesa, como no Mac (revelar.cpp)void Start();void Stop();+void Pausar(bool p); // modo jogo: sem o gancho global do mousevoid Foreground(HWND h);bool Owns(HWND h); // janela minimizada por "mostrar a mesa" (não vai para o Dock)}@@ -365,6 +383,7 @@ void SettingsChanged(); // ajustes.txt mudou (explorer=0/1)bool TopColor(int barPx, float& r, float& g, float& b);bool Standalone(); // sem Explorador agora (qualquer thread)void WallpaperNow(const std::wstring& path); // o Ajustes escolheu este papel de parede: mostra já+void DepoisDoJogo(); // modo jogo acabou: refaz a mesa se a tela mudou durante o jogo// App antigo da Loja (UWP: Segurança do Windows...) não abre sem o Explorador (a janela dele vem de uma peça// que vive no explorer.exe). Abre o Explorador escondido, abre o app de novo e, sem nenhum desses apps// aberto por 15 s, volta ao modo sem Explorador. Qualquer thread.@@ -395,6 +414,17 @@ void SetWidgets(std::vector<Widget> list, std::function<void()> onEdit); // onEstruct Brief { std::wstring aumid, app; long long time; }; // notificação do Windows (só o necessário para o badge)std::vector<Brief> Recentes(); // as notificações da Central agora (qualquer thread)}+namespace ilha { // Ilha Dinâmica (ilha.cpp): notch/pílula preta no topo (música, timer, avisos, Estante...); ajuste ilha=1, ilha_estilo+bool Create(HINSTANCE hi);+void Reload(); // ajustes mudaram (ilha, ilha_estilo, ilha_notificacoes, ilha_volume, ilha_passar)+void SetFullscreen(bool locked); // a janela da frente mudou: confere tela cheia no monitor principal (jogo, vídeo, app) e some na hora+bool On();+// notificação nova: true = a ilha mostrou (o banner do canto não aparece). icon desenha o ícone do app em r (DIP)+bool Notificacao(const std::wstring& app, const std::wstring& title, const std::wstring& body,+ std::function<void(ID2D1DeviceContext*, ID2D1SolidColorBrush*, D2D1_RECT_F)> icon, std::function<void()> click);+bool Volume(float level, bool mute); // teclas de volume: true = a ilha mostrou (sem o aviso de volume)+void CapsLock(); // a tecla Caps Lock foi apertada (gancho de teclado do main.cpp)+}namespace palco { // Organizador Visual / Stage Manager (palco.cpp): ajuste organizador=1bool On();void Sync(); // liga/desliga conforme o ajuste@@ -431,6 +461,7 @@ void MediaCommand(const std::wstring& exePath, const std::wstring& aumid, int cmnamespace cantos { // Cantos Ativos (cantos.cpp): canto_se/sd/ie/id = nada|mission|mesa|launchpad|notificacoes|central|spotlight|bloquear|tela|notavoid Start();bool NotaRapida(); // o canto inferior direito é o da Nota Rápida+void Pausar(bool p); // modo jogo: sem ler o ponteiro}namespace notarapida { // canto inferior direito da tela abre a Nota Rápida (notarapida.cpp); `canto_nota_rapida=0` desligavoid Create(HINSTANCE hi);@@ -462,6 +493,11 @@ int Category(const std::wstring& appName); // categoria do app (1..CategoryCounint CategoryCount();const wchar_t* CategoryName(int k);void Rescan(); // relê a lista de apps (um programa foi instalado ou removido)+// Fora do Launchpad e do painel Apps: tirado à mão (launchpad_ocultos) ou ferramenta do Windows com+// launchpad_sem_sistema=1 (Painel de Controle, Mapa de Caracteres, Ferramentas do Windows...)+bool Escondido(const std::wstring& name, const std::wstring& parsing);+bool AppDoSistema(const std::wstring& name, const std::wstring& parsing);+void Ocultar(const std::wstring& name); // acrescenta a launchpad_ocultos}namespace instalados { // vigia o Menu Iniciar e os apps da Store e avisa o Spotlight e o Launchpad (instalados.cpp)void Start();@@ -475,6 +511,7 @@ int ReservedHeight(); // px reservados embaixo (área de trabalho)HMONITOR MonitorHandle(); // o monitor do Dock (ajuste dock_monitor; vazio = o principal)void Raise(); // traz o Dock para cima (ex.: por cima do Launchpad)void OpenAppsStack(); // Leopard: a pasta Aplicativos como Pilha em Grade+void OpenDownloadsStack(); // a pilha Downloads (testes: ShellAbrirPainel 15)void ReloadSettings(); // o Ajustes do Sistema mudou tamanho, ampliação...void ApplyTheme(); // claro/escuro mudouvoid IconsChanged(); // o pacote de ícones mudou (tema Sequoia/Tahoe): solta os ícones guardados@@ -597,4 +634,14 @@ void Start();void Stop();// tema Mac OS X Leopard: liga o cursor do Mac OS X (guardando o esquema de antes) ou devolve o de antesvoid TemaLeopard(bool on);+void Pausar(bool p); // modo jogo: sem Raw Input do mouse enquanto o jogo roda+}+namespace jogo { // Modo Jogo (jogo.cpp): jogo na frente → desliga o que mais pesa; ajuste modo_jogo, lista %APPDATA%\Shell\jogos.txt+void Start();+void Reload(); // ajustes mudaram+void Foreground(HWND h); // a janela da frente mudou+bool Ativo();+// gancho de EVENT_OBJECT_LOCATIONCHANGE que sai durante o modo jogo (cada movimento do cursor chegava ao Shell)+void GanchoPosicao(WINEVENTPROC fn, DWORD flags);+void SoltarPosicao(WINEVENTPROC fn);}diff --git a/src/shell/som.cpp b/src/shell/som.cppindex 20b210a..d934fbf 100644--- a/src/shell/som.cpp+++ b/src/shell/som.cpp@@ -743,5 +743,6 @@ void som::Key(UINT vk, bool fine) {SetVolume(g_au.mute ? 0 : v);}if (g_open) { PaintMenu(); return; } // com o menu aberto, o controle dele mostra+ if (ilha::Volume(g_au.mute ? 0 : g_au.vol, g_au.mute)) { HideHud(); return; } // Ilha Dinâmica ligada: o volume aparece nelaShowHud();}diff --git a/src/shell/sombras.cpp b/src/shell/sombras.cppindex 60753e1..22d5b28 100644--- a/src/shell/sombras.cpp+++ b/src/shell/sombras.cpp@@ -74,12 +74,13 @@ void sombras::Start() {g_hooks[0] = SetWinEventHook(EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND, nullptr, OnEvent, 0, 0, f);g_hooks[1] = SetWinEventHook(EVENT_SYSTEM_MINIMIZESTART, EVENT_SYSTEM_MINIMIZEEND, nullptr, OnEvent, 0, 0, f);g_hooks[2] = SetWinEventHook(EVENT_OBJECT_DESTROY, EVENT_OBJECT_HIDE, nullptr, OnEvent, 0, 0, f); // destruir, mostrar, esconder- g_hooks[3] = SetWinEventHook(EVENT_OBJECT_LOCATIONCHANGE, EVENT_OBJECT_LOCATIONCHANGE, nullptr, OnEvent, 0, 0, f);+ jogo::GanchoPosicao(OnEvent, f); // sai no modo jogo (jogo.cpp)EnumWindows([](HWND h, LPARAM) -> BOOL { Handle(h); return TRUE; }, 0);}void sombras::Stop() {for (auto& hk : g_hooks) if (hk) { UnhookWinEvent(hk); hk = nullptr; }+ jogo::SoltarPosicao(OnEvent);for (auto& [h, s] : g_s) s->Destroy();g_s.clear();}diff --git a/src/shell/spotlight.cpp b/src/shell/spotlight.cppindex 21040e1..fe84438 100644--- a/src/shell/spotlight.cpp+++ b/src/shell/spotlight.cpp@@ -971,11 +971,10 @@ bool CanArrange() { return g_mode == 1 && !g_appsList && g_chip == 0 && Fold(g_qvoid BuildMode() {if (g_mode == 1) {std::vector<Result> v;- std::wstring hid = L"|" + shell::Setting(L"launchpad_ocultos", L"") + L"|";{std::lock_guard<std::mutex> l(g_mu);- for (auto& a : g_apps)- if (ChipAllows(K_APP, a.name) && hid.find(L"|" + a.name + L"|") == std::wstring::npos) v.push_back({ K_APP, a.name, a.parsing, L"", a.use });+ for (auto& a : g_apps) // sem os tirados à mão e, com launchpad_sem_sistema, sem as ferramentas do Windows+ if (ChipAllows(K_APP, a.name) && !launchpad::Escondido(a.name, a.parsing)) v.push_back({ K_APP, a.name, a.parsing, L"", a.use });}std::sort(v.begin(), v.end(), [](const Result& a, const Result& b) { return _wcsicmp(a.name.c_str(), b.name.c_str()) < 0; });auto ord = SplitBar(shell::Setting(L"apps_ordem", L"")); // a ordem arrastada; quem não está nela vai para o fim@@ -2224,6 +2223,10 @@ void AppsMenu(HWND h, LPARAM l) {std::vector<ctxmenu::Item> items;items.push_back(mi(Tr(g_edit ? L"Concluir Edição" : L"Editar Apps"), 1, !g_edit && !CanArrange()));items.push_back(mi(Tr(L"Organizar por Nome"), 2, shell::Setting(L"apps_ordem", L"").empty()));+ bool semSis = shell::Setting(L"launchpad_sem_sistema", L"0") == L"1";+ ctxmenu::Item sys = mi(Tr(L"Ocultar Apps do Sistema"), 3); // Painel de Controle, Mapa de Caracteres, Ferramentas do Windows...+ sys.checked = semSis;+ items.push_back(sys);auto hid = SplitBar(shell::Setting(L"launchpad_ocultos", L""));if (!hid.empty()) {ctxmenu::Item sub = mi(Tr(L"Trazer de Volta"), 0);@@ -2237,6 +2240,7 @@ void AppsMenu(HWND h, LPARAM l) {int id = ctxmenu::ShowItems(h, sp, items);if (id == 1) { if (g_edit) EndEdit(); else StartEdit(); }else if (id == 2) { shell::SetSetting(L"apps_ordem", L""); RebuildKeep(); }+ else if (id == 3) { shell::SetSetting(L"launchpad_sem_sistema", semSis ? L"0" : L"1"); RebuildKeep(); }else if (id == 99) { shell::SetSetting(L"launchpad_ocultos", L""); RebuildKeep(); }else if (id >= 100 && id - 100 < (int)hid.size()) {hid.erase(hid.begin() + (id - 100));@@ -2572,11 +2576,15 @@ LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {ClientToScreen(h, &sp);// "Mostrar no Finder" (abrir o local do arquivo), como no menu do Spotlight do Macbool onDisk = path.find(L":\\") != std::wstring::npos;- if (onDisk) ctxmenu::ExtraNext({ { Tr(L"Mostrar no Finder"), 1, false, false, false, L"Ctrl+Enter", {}, 0xE838 } });+ std::vector<ctxmenu::Item> extra;+ if (onDisk) extra.push_back({ Tr(L"Mostrar no Finder"), 1, false, false, false, L"Ctrl+Enter", {}, 0xE838 });+ if (r.kind == K_APP && g_mode == 1) extra.push_back({ Tr(L"Ocultar do Launchpad"), 2, false, false, false, L"", {}, 0xED1A }); // painel Apps+ if (!extra.empty()) ctxmenu::ExtraNext(extra);auto res = ctxmenu::Show(h, sp, folder, { path }, GetKeyState(VK_SHIFT) < 0);ctxmenu::ExtraNext({});Log(L"spotlight: menu de %ls%ls", path.c_str(), res.chosen ? L" (comando escolhido)" : L"");if (res.extra == 1) { Open(i, true); return 0; }+ if (res.extra == 2) { HideApp(i); return 0; }if (res.chosen) Close();return 0;}diff --git a/src/shell/tempo.cpp b/src/shell/tempo.cppnew file mode 100644index 0000000..e7738fc--- /dev/null+++ b/src/shell/tempo.cpp@@ -0,0 +1,445 @@+// A "viagem no tempo" do Time Machine do Mac OS X Leopard (tema Leopard): a tela vira o espaço (galáxia com estrelas+// piscando), a janela do Finder da pasta Documentos fica na frente e as versões antigas dela se empilham para trás,+// sumindo no fundo; a linha do tempo fica na direita ("Hoje (Agora)" embaixo, os backups subindo), as setas+// andam no tempo, e embaixo ficam Cancelar, a data da janela da frente e Restaurar.+// Os backups são os do Histórico de Arquivos do Windows (o que o app Time Machine configura): a cópia de cada+// arquivo fica em <disco>\FileHistory\<usuário>\<PC>\Data\<C>\<caminho> com a data no nome+// ("nome (2026_11_19 22_00_00 UTC).ext"). Restaurar copia a versão escolhida de volta para a pasta, sem apagar a+// atual (se já existir, a restaurada ganha " (restaurado)" no nome). Abre pelo app Time Machine ou ShellAbrirPainel 18.+#include "shell.h"+#include <shlobj.h>+#include <cmath>+#include <algorithm>+#include <map>+#include <set>+#include "../comum/idioma.h"+#include "../comum/leopard.h"++namespace {++const UINT T_ANIM = 1;+struct Item { std::wstring name, src; bool dir = false; ULONGLONG mtime = 0; };+struct Snap { ULONGLONG t = 0; std::vector<Item> items; }; // t = 0: agora++HWND g_wnd;+ui::GpuSurface g_s;+bool g_open, g_closing;+double g_at, g_lastTick;+float g_W, g_H, g_pos; // g_pos anda até g_sel (índice em g_snaps: 0 = agora, 1 = o backup mais novo...)+int g_sel, g_row = -1, g_hoverTick = -1;+std::vector<Snap> g_snaps;+std::wstring g_folder, g_root; // a pasta (Documentos) e a cópia dela no backup ("" = sem backup)+std::wstring g_msg;++float Sc() { return ui::Scale(g_wnd); }++ULONGLONG FtOf(const FILETIME& f) { return ((ULONGLONG)f.dwHighDateTime << 32) | f.dwLowDateTime; }++// "nome (2026_11_19 22_00_00 UTC).ext" -> nome.ext e a hora (UTC, FILETIME)+bool ParseVersion(const std::wstring& fn, std::wstring& orig, ULONGLONG& t) {+ size_t p = fn.rfind(L" UTC)");+ if (p == std::wstring::npos || p < 21 || fn[p - 20] != L'(' || fn[p - 21] != L' ') return false;+ SYSTEMTIME st{};+ if (swscanf_s(fn.c_str() + p - 19, L"%hu_%hu_%hu %hu_%hu_%hu", &st.wYear, &st.wMonth, &st.wDay, &st.wHour, &st.wMinute, &st.wSecond) != 6) return false;+ FILETIME ft; if (!SystemTimeToFileTime(&st, &ft)) return false;+ t = FtOf(ft);+ orig = fn.substr(0, p - 21) + fn.substr(p + 5);+ return true;+}++std::wstring FindRoot() {+ wchar_t user[256] = {}, pc[256] = {};+ GetEnvironmentVariableW(L"USERNAME", user, 256); GetEnvironmentVariableW(L"COMPUTERNAME", pc, 256);+ std::vector<std::wstring> bases;+ // o disco escolhido no Histórico de Arquivos (Config1.xml guarda o caminho do destino)+ wchar_t la[MAX_PATH]; GetEnvironmentVariableW(L"LOCALAPPDATA", la, MAX_PATH);+ for (const wchar_t* cfg : { L"\\Microsoft\\Windows\\FileHistory\\Configuration\\Config1.xml", L"\\Microsoft\\Windows\\FileHistory\\Configuration\\Config2.xml" }) {+ HANDLE f = CreateFileW((std::wstring(la) + cfg).c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr);+ if (f == INVALID_HANDLE_VALUE) continue;+ std::string s(1 << 16, '\0'); DWORD n = 0;+ ReadFile(f, s.data(), (DWORD)s.size(), &n, nullptr); CloseHandle(f);+ s.resize(n);+ std::wstring ws;+ if (n >= 2 && (BYTE)s[0] == 0xFF && (BYTE)s[1] == 0xFE) ws.assign((const wchar_t*)(s.data() + 2), (n - 2) / 2);+ else ws.assign(s.begin(), s.end());+ for (const wchar_t* tag : { L"<TargetUrl>", L"<TargetDriveSignature>" }) {+ size_t a = ws.find(tag); if (a == std::wstring::npos) continue;+ a += wcslen(tag); size_t b = ws.find(L'<', a);+ if (b != std::wstring::npos && tag[7] == L'U') bases.push_back(ws.substr(a, b - a));+ }+ }+ DWORD drives = GetLogicalDrives();+ for (int d = 0; d < 26; d++) if (drives & (1u << d)) { wchar_t r[4] = { (wchar_t)(L'A' + d), L':', L'\\', 0 }; UINT ty = GetDriveTypeW(r); if (ty == DRIVE_FIXED || ty == DRIVE_REMOVABLE || ty == DRIVE_REMOTE) bases.push_back(r); }+ for (auto b : bases) {+ if (!b.empty() && b.back() != L'\\') b += L'\\';+ std::wstring p = b + L"FileHistory\\" + user + L"\\" + pc + L"\\Data";+ DWORD a = GetFileAttributesW(p.c_str());+ if (a != INVALID_FILE_ATTRIBUTES && (a & FILE_ATTRIBUTE_DIRECTORY)) return p;+ }+ return L"";+}++void Load() {+ g_snaps.clear(); g_msg.clear();+ PWSTR docs = nullptr;+ if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Documents, 0, nullptr, &docs))) { g_folder = docs; CoTaskMemFree(docs); }+ // agora: a pasta como está+ Snap now;+ WIN32_FIND_DATAW fd;+ HANDLE h = FindFirstFileW((g_folder + L"\\*").c_str(), &fd);+ if (h != INVALID_HANDLE_VALUE) {+ do {+ if (fd.cFileName[0] == L'.' || (fd.dwFileAttributes & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM))) continue;+ now.items.push_back({ fd.cFileName, g_folder + L"\\" + fd.cFileName, (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0, FtOf(fd.ftLastWriteTime) });+ } while (FindNextFileW(h, &fd));+ FindClose(h);+ }+ g_snaps.push_back(now);+ // os backups+ std::wstring root = FindRoot();+ g_root.clear();+ if (!root.empty() && g_folder.size() > 2 && g_folder[1] == L':') g_root = root + L"\\" + g_folder.substr(0, 1) + g_folder.substr(2);+ std::map<std::wstring, std::vector<std::pair<ULONGLONG, std::wstring>>> files; // nome -> versões+ std::set<ULONGLONG> times;+ std::vector<std::wstring> dirs;+ if (!g_root.empty()) {+ h = FindFirstFileW((g_root + L"\\*").c_str(), &fd);+ if (h != INVALID_HANDLE_VALUE) {+ do {+ if (fd.cFileName[0] == L'.') continue;+ if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { dirs.push_back(fd.cFileName); continue; }+ std::wstring orig; ULONGLONG t;+ if (!ParseVersion(fd.cFileName, orig, t)) continue;+ t -= t % 600000000ull; // junta as versões do mesmo backup (mesmo minuto)+ files[orig].push_back({ t, g_root + L"\\" + fd.cFileName });+ times.insert(t);+ } while (FindNextFileW(h, &fd));+ FindClose(h);+ }+ }+ for (auto it = times.rbegin(); it != times.rend(); ++it) { // do mais novo para o mais antigo+ Snap s; s.t = *it;+ for (auto& d : dirs) s.items.push_back({ d, L"", true, 0 });+ for (auto& [name, vs] : files) {+ const std::pair<ULONGLONG, std::wstring>* best = nullptr;+ for (auto& v : vs) if (v.first <= s.t && (!best || v.first > best->first)) best = &v;+ if (best) s.items.push_back({ name, best->second, false, best->first });+ }+ g_snaps.push_back(s);+ }+ for (auto& s : g_snaps)+ std::sort(s.items.begin(), s.items.end(), [](const Item& a, const Item& b) { return a.dir != b.dir ? a.dir : _wcsicmp(a.name.c_str(), b.name.c_str()) < 0; });+ if (g_root.empty()) g_msg = Tr(L"Nenhum backup encontrado. Escolha o disco de backup no app Time Machine.");+ else if (g_snaps.size() == 1) g_msg = Tr(L"Ainda não há backups desta pasta.");+}++std::wstring DateText(ULONGLONG t, bool full) {+ if (!t) return Tr(L"Hoje (Agora)");+ FILETIME ft{ (DWORD)t, (DWORD)(t >> 32) }, lt; SYSTEMTIME st;+ FileTimeToLocalFileTime(&ft, <); FileTimeToSystemTime(<, &st);+ static const wchar_t* meses[] = { L"janeiro", L"fevereiro", L"março", L"abril", L"maio", L"junho", L"julho", L"agosto", L"setembro", L"outubro", L"novembro", L"dezembro" };+ wchar_t b[96];+ if (full) swprintf_s(b, L"%d de %ls de %d, %02d:%02d", st.wDay, Tr(meses[st.wMonth - 1]), st.wYear, st.wHour, st.wMinute);+ else swprintf_s(b, L"%02d/%02d %02d:%02d", st.wDay, st.wMonth, st.wHour, st.wMinute);+ return b;+}++IDWriteTextFormat* F(float size, bool bold, DWRITE_TEXT_ALIGNMENT al = DWRITE_TEXT_ALIGNMENT_LEADING) {+ auto* f = ui::FormatFace(L"Lucida Sans Unicode", size, bold ? DWRITE_FONT_WEIGHT_BOLD : DWRITE_FONT_WEIGHT_NORMAL);+ if (f) { f->SetTextAlignment(al); f->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER); f->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP);+ DWRITE_TRIMMING tr{ DWRITE_TRIMMING_GRANULARITY_CHARACTER, 0, 0 }; f->SetTrimming(&tr, nullptr); }+ return f;+}++D2D1_RECT_F FrontRect() {+ float w = std::min(900.f, g_W * 0.56f), h = g_H * 0.52f;+ return D2D1::RectF(g_W / 2 - w / 2, g_H * 0.84f - 60 - h, g_W / 2 + w / 2, g_H * 0.84f - 60);+}+D2D1_POINT_2F VP() { return { g_W / 2, g_H * 0.10f }; }+const float ROW = 19, HEAD = 22 + 17;+D2D1_RECT_F TimelineRect() { return D2D1::RectF(g_W - 84, g_H * 0.08f, g_W - 20, g_H * 0.84f - 60); }+D2D1_POINT_2F TickPt(int i) { // 0 = agora (embaixo), os backups subindo+ auto t = TimelineRect();+ int n = (int)g_snaps.size();+ float step = n > 1 ? std::min(28.f, (t.bottom - t.top - 20) / (n - 1)) : 0;+ return { (t.left + t.right) / 2, t.bottom - 10 - i * step };+}+D2D1_RECT_F ArrowRect(bool up) { auto f = FrontRect(); float x = f.right + 30; return up ? D2D1::RectF(x, f.bottom - 120, x + 56, f.bottom - 70) : D2D1::RectF(x, f.bottom - 62, x + 56, f.bottom - 12); }+D2D1_RECT_F BtnRect(int k) { float cx = g_W / 2, y = g_H - 44; return k == 0 ? D2D1::RectF(cx - 280, y, cx - 180, y + 26) : D2D1::RectF(cx + 180, y, cx + 280, y + 26); }++void Grad(ID2D1DeviceContext* dc, D2D1_RECT_F r, float rad, std::initializer_list<D2D1_GRADIENT_STOP> st) {+ ID2D1GradientStopCollection* gs = nullptr; ID2D1LinearGradientBrush* lb = nullptr;+ if (SUCCEEDED(dc->CreateGradientStopCollection(st.begin(), (UINT32)st.size(), &gs)) &&+ SUCCEEDED(dc->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, r.top }, { 0, r.bottom }), gs, &lb)))+ dc->FillRoundedRectangle(D2D1::RoundedRect(r, rad, rad), lb);+ if (lb) lb->Release();+ if (gs) gs->Release();+}+void Nebula(ID2D1DeviceContext* dc, D2D1_POINT_2F c, float rx, float ry, D2D1_COLOR_F col) {+ D2D1_GRADIENT_STOP st[2] = { { 0, col }, { 1, D2D1::ColorF(col.r, col.g, col.b, 0) } };+ ID2D1GradientStopCollection* gs = nullptr; ID2D1RadialGradientBrush* rb = nullptr;+ if (SUCCEEDED(dc->CreateGradientStopCollection(st, 2, &gs)) &&+ SUCCEEDED(dc->CreateRadialGradientBrush(D2D1::RadialGradientBrushProperties(c, { 0, 0 }, rx, ry), gs, &rb)))+ dc->FillEllipse(D2D1::Ellipse(c, rx, ry), rb);+ if (rb) rb->Release();+ if (gs) gs->Release();+}++void DrawWindow(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const Snap& s, D2D1_RECT_F r, bool front) {+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.45f));+ dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left - 2, r.top + 2, r.right + 2, r.bottom + 8), 7, 7), br);+ br->SetColor(D2D1::ColorF(1, 1, 1));+ dc->FillRoundedRectangle(D2D1::RoundedRect(r, 5, 5), br);+ float k = (r.right - r.left) / (FrontRect().right - FrontRect().left); // escala desta janela+ D2D1_MATRIX_3X2_F old; dc->GetTransform(&old);+ dc->SetTransform(D2D1::Matrix3x2F::Scale(k, k) * D2D1::Matrix3x2F::Translation(r.left, r.top) * old);+ float W = FrontRect().right - FrontRect().left, H = FrontRect().bottom - FrontRect().top;+ dc->PushAxisAlignedClip(D2D1::RectF(0, 0, W, H), D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);+ leopard::Metal(dc, D2D1::RectF(0, 0, W, 22), front, false, true, 5);+ for (int i = 0; i < 3; i++) { // os três botões (cinza nas de trás)+ D2D1_POINT_2F c{ 14.5f + i * 21.f, 11 };+ D2D1_COLOR_F col = !front ? D2D1::ColorF(0.75f, 0.75f, 0.76f) : i == 0 ? D2D1::ColorF(0.93f, 0.33f, 0.31f) : i == 1 ? D2D1::ColorF(0.97f, 0.74f, 0.25f) : D2D1::ColorF(0.40f, 0.76f, 0.26f);+ br->SetColor(col); dc->FillEllipse(D2D1::Ellipse(c, 6, 6), br);+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.35f)); dc->DrawEllipse(D2D1::Ellipse(c, 6, 6), br, 0.8f);+ }+ static IDWriteTextFormat *ft = F(13, false, DWRITE_TEXT_ALIGNMENT_CENTER), *fr = F(12, false), *fh = F(11, false);+ std::wstring title = g_folder.substr(g_folder.find_last_of(L'\\') + 1);+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.85f));+ if (ft) dc->DrawTextW(title.c_str(), (UINT32)title.size(), ft, D2D1::RectF(80, 0, W - 80, 22), br);+ // cabeçalho da lista e as linhas (listras azul-claras do 10.5)+ Grad(dc, D2D1::RectF(0, 22, W, HEAD), 0, { { 0, D2D1::ColorF(1, 1, 1) }, { 1, D2D1::ColorF(0.90f, 0.90f, 0.90f) } });+ br->SetColor(D2D1::ColorF(0.62f, 0.62f, 0.62f)); dc->DrawLine({ 0, HEAD - 0.5f }, { W, HEAD - 0.5f }, br, 1);+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.85f));+ std::wstring hn = Tr(L"Nome"), hd = Tr(L"Data de Modificação");+ if (fh) { dc->DrawTextW(hn.c_str(), (UINT32)hn.size(), fh, D2D1::RectF(30, 22, W * 0.6f, HEAD), br); dc->DrawTextW(hd.c_str(), (UINT32)hd.size(), fh, D2D1::RectF(W * 0.62f, 22, W - 10, HEAD), br); }+ int rows = (int)((H - HEAD) / ROW) + 1;+ for (int i = 0; i < rows; i++) {+ float y = HEAD + i * ROW;+ bool sel = front && i == g_row && i < (int)s.items.size();+ if (sel) { br->SetColor(D2D1::ColorF(56 / 255.f, 117 / 255.f, 215 / 255.f)); dc->FillRectangle(D2D1::RectF(0, y, W, y + ROW), br); }+ else if (i % 2) { br->SetColor(D2D1::ColorF(237 / 255.f, 243 / 255.f, 254 / 255.f)); dc->FillRectangle(D2D1::RectF(0, y, W, y + ROW), br); }+ if (i >= (int)s.items.size()) continue;+ auto& it = s.items[i];+ D2D1_COLOR_F ink = sel ? D2D1::ColorF(1, 1, 1) : D2D1::ColorF(0, 0, 0, 0.9f);+ // a pastinha azul ou a folha do documento, desenhadas (simples)+ if (it.dir) { br->SetColor(D2D1::ColorF(0.45f, 0.65f, 0.90f)); dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(10, y + 5, 24, y + 15), 1.5f, 1.5f), br); dc->FillRectangle(D2D1::RectF(10, y + 3.5f, 16, y + 6), br); }+ else { br->SetColor(D2D1::ColorF(0.97f, 0.97f, 0.97f)); dc->FillRectangle(D2D1::RectF(12, y + 3, 22, y + 16), br); br->SetColor(D2D1::ColorF(0.55f, 0.55f, 0.55f)); dc->DrawRectangle(D2D1::RectF(12.5f, y + 3.5f, 21.5f, y + 15.5f), br, 1); }+ br->SetColor(ink);+ if (fr) dc->DrawTextW(it.name.c_str(), (UINT32)it.name.size(), fr, D2D1::RectF(30, y, W * 0.6f, y + ROW), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);+ std::wstring d = it.dir ? L"--" : DateText(it.mtime ? it.mtime : 1, true);+ if (!it.dir && s.t == 0) { // agora: a data do arquivo de verdade+ d = DateText(it.mtime, true);+ }+ if (fr) dc->DrawTextW(d.c_str(), (UINT32)d.size(), fr, D2D1::RectF(W * 0.62f, y, W - 10, y + ROW), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);+ }+ if (s.items.empty() && front) {+ static IDWriteTextFormat* fe = F(13, false, DWRITE_TEXT_ALIGNMENT_CENTER);+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.5f));+ std::wstring e = Tr(L"Pasta vazia");+ if (fe) dc->DrawTextW(e.c_str(), (UINT32)e.size(), fe, D2D1::RectF(0, H / 2 - 10, W, H / 2 + 10), br);+ }+ dc->PopAxisAlignedClip();+ dc->SetTransform(old);+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.5f));+ dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 0.5f, r.top + 0.5f, r.right - 0.5f, r.bottom - 0.5f), 5, 5), br, 1);+}++void Paint() {+ if (!g_open) return;+ float sc = Sc();+ RECT rc; GetClientRect(g_wnd, &rc);+ auto* dc = ui::GpuBegin(g_s, rc.right, rc.bottom, sc);+ if (!dc) return;+ ID2D1SolidColorBrush* br = nullptr;+ dc->CreateSolidColorBrush(D2D1::ColorF(0, 0, 0), &br);+ double now = anim::Now();+ float k = (float)std::clamp((now - g_at) / 450.0, 0.0, 1.0); k = anim::Ease(k);+ if (g_closing) k = 1 - k;+ ID2D1Layer* layer = nullptr; dc->CreateLayer(nullptr, &layer);+ dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), nullptr, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1::IdentityMatrix(), k), nullptr);+ // o espaço: azul-escuro quase preto, nebulosas e as estrelas piscando devagar+ Grad(dc, D2D1::RectF(0, 0, g_W, g_H), 0, { { 0, D2D1::ColorF(0.01f, 0.02f, 0.06f) }, { 1, D2D1::ColorF(0.04f, 0.03f, 0.10f) } });+ Nebula(dc, { g_W * 0.30f, g_H * 0.30f }, g_W * 0.42f, g_H * 0.38f, D2D1::ColorF(0.42f, 0.22f, 0.58f, 0.40f));+ Nebula(dc, { g_W * 0.72f, g_H * 0.22f }, g_W * 0.36f, g_H * 0.30f, D2D1::ColorF(0.18f, 0.32f, 0.70f, 0.35f));+ Nebula(dc, { g_W * 0.52f, g_H * 0.12f }, g_W * 0.20f, g_H * 0.14f, D2D1::ColorF(0.85f, 0.80f, 0.95f, 0.30f)); // o brilho no ponto de fuga+ unsigned seed = 12345;+ auto rnd = [&] { seed = seed * 1103515245u + 12345u; return (seed >> 8) / 16777216.f; };+ for (int i = 0; i < 520; i++) {+ float x = rnd() * g_W, y = rnd() * g_H, s = 0.5f + rnd() * 1.4f, ph = rnd() * 6.28f;+ float a = 0.35f + 0.65f * (0.5f + 0.5f * std::sin((float)(now / 900.0) + ph));+ br->SetColor(D2D1::ColorF(0.9f, 0.92f, 1, a * (0.4f + 0.6f * rnd())));+ dc->FillEllipse(D2D1::Ellipse({ x, y }, s, s), br);+ }+ // a pilha de janelas: a escolhida na frente, as mais antigas para trás, rumo ao ponto de fuga+ auto f0 = FrontRect(); auto vp = VP();+ D2D1_POINT_2F c0{ (f0.left + f0.right) / 2, (f0.top + f0.bottom) / 2 };+ int first = std::max(0, (int)std::floor(g_pos)), last = std::min((int)g_snaps.size() - 1, first + 9);+ for (int i = last; i >= first; i--) {+ float d = i - g_pos;+ if (d < -0.95f) continue;+ float s = std::pow(0.84f, d) * (0.85f + 0.15f * k);+ D2D1_POINT_2F c{ vp.x + (c0.x - vp.x) * std::pow(0.80f, d), vp.y + (c0.y - vp.y) * std::pow(0.80f, d) };+ if (d < 0) { s = 1 + (-d) * 0.6f; c.y = c0.y + (-d) * g_H * 0.5f; } // saindo para a frente (indo para o futuro)+ float w = (f0.right - f0.left) * s, h = (f0.bottom - f0.top) * s;+ float a = d < 0 ? 1 + d : std::clamp(1 - d * 0.10f, 0.f, 1.f);+ dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), nullptr, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1::IdentityMatrix(), a), nullptr);+ DrawWindow(dc, br, g_snaps[i], D2D1::RectF(c.x - w / 2, c.y - h / 2, c.x + w / 2, c.y + h / 2), std::fabs(d) < 0.5f);+ dc->PopLayer();+ }+ // a linha do tempo na direita+ static IDWriteTextFormat *ftl = F(11, true, DWRITE_TEXT_ALIGNMENT_TRAILING), *fdate = F(16, true, DWRITE_TEXT_ALIGNMENT_CENTER), *fbtn = F(13, false, DWRITE_TEXT_ALIGNMENT_CENTER), *fmsg = F(13, false, DWRITE_TEXT_ALIGNMENT_CENTER);+ for (int i = 0; i < (int)g_snaps.size(); i++) {+ auto p = TickPt(i);+ bool on = i == g_sel, hv = i == g_hoverTick;+ br->SetColor(D2D1::ColorF(1, 1, 1, on ? 1.f : hv ? 0.85f : 0.45f));+ float hw = on ? 22 : hv ? 18 : 12;+ dc->FillRectangle(D2D1::RectF(p.x - hw / 2, p.y - 1.5f, p.x + hw / 2, p.y + 1.5f), br);+ if (on || hv || i == 0) {+ std::wstring t = DateText(g_snaps[i].t, false);+ br->SetColor(D2D1::ColorF(1, 1, 1, on ? 1.f : 0.8f));+ if (ftl) dc->DrawTextW(t.c_str(), (UINT32)t.size(), ftl, D2D1::RectF(p.x - 200, p.y - 9, p.x - 16, p.y + 9), br);+ }+ }+ // as setas (para trás = mais antigo; para a frente = mais novo)+ for (int up = 1; up >= 0; up--) {+ auto r = ArrowRect(up != 0);+ bool en = up ? g_sel + 1 < (int)g_snaps.size() : g_sel > 0;+ Grad(dc, r, 8, { { 0, D2D1::ColorF(0.55f, 0.55f, 0.58f, en ? 0.95f : 0.4f) }, { 1, D2D1::ColorF(0.20f, 0.20f, 0.22f, en ? 0.95f : 0.4f) } });+ br->SetColor(D2D1::ColorF(1, 1, 1, en ? 0.95f : 0.35f));+ float cx = (r.left + r.right) / 2, cy = (r.top + r.bottom) / 2;+ if (up) { dc->DrawLine({ cx - 12, cy + 6 }, { cx, cy - 6 }, br, 4); dc->DrawLine({ cx, cy - 6 }, { cx + 12, cy + 6 }, br, 4); }+ else { dc->DrawLine({ cx - 12, cy - 6 }, { cx, cy + 6 }, br, 4); dc->DrawLine({ cx, cy + 6 }, { cx + 12, cy - 6 }, br, 4); }+ }+ // a barra de baixo: Cancelar, a data da janela da frente e Restaurar+ Grad(dc, D2D1::RectF(0, g_H - 60, g_W, g_H), 0, { { 0, D2D1::ColorF(0.15f, 0.15f, 0.17f, 0.85f) }, { 1, D2D1::ColorF(0.05f, 0.05f, 0.06f, 0.95f) } });+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.18f)); dc->DrawLine({ 0, g_H - 59.5f }, { g_W, g_H - 59.5f }, br, 1);+ std::wstring dt = g_sel < (int)g_snaps.size() ? DateText(g_snaps[g_sel].t, true) : L"";+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.95f));+ if (fdate) dc->DrawTextW(dt.c_str(), (UINT32)dt.size(), fdate, D2D1::RectF(g_W / 2 - 170, g_H - 47, g_W / 2 + 170, g_H - 17), br);+ bool canRestore = g_sel > 0 && g_row >= 0 && g_row < (int)g_snaps[g_sel].items.size() && !g_snaps[g_sel].items[g_row].dir;+ for (int b = 0; b < 2; b++) {+ auto r = BtnRect(b);+ bool en = b == 0 || canRestore;+ float rad = (r.bottom - r.top) / 2;+ Grad(dc, r, rad, { { 0, D2D1::ColorF(1, 1, 1, en ? 1.f : 0.5f) }, { 0.5f, D2D1::ColorF(0.93f, 0.93f, 0.93f, en ? 1.f : 0.5f) }, { 0.5f, D2D1::ColorF(0.85f, 0.85f, 0.85f, en ? 1.f : 0.5f) }, { 1, D2D1::ColorF(0.97f, 0.97f, 0.97f, en ? 1.f : 0.5f) } });+ br->SetColor(D2D1::ColorF(0, 0, 0, 0.5f)); dc->DrawRoundedRectangle(D2D1::RoundedRect(r, rad, rad), br, 1);+ std::wstring t = b == 0 ? Tr(L"Cancelar") : Tr(L"Restaurar");+ br->SetColor(D2D1::ColorF(0, 0, 0, en ? 0.9f : 0.4f));+ if (fbtn) dc->DrawTextW(t.c_str(), (UINT32)t.size(), fbtn, r, br);+ }+ if (!g_msg.empty()) {+ br->SetColor(D2D1::ColorF(1, 1, 1, 0.85f));+ if (fmsg) dc->DrawTextW(g_msg.c_str(), (UINT32)g_msg.size(), fmsg, D2D1::RectF(0, f0.top - 40, g_W, f0.top - 14), br);+ }+ dc->PopLayer();+ layer->Release();+ br->Release();+ ui::GpuEnd(g_s);+}++void HideNow() { KillTimer(g_wnd, T_ANIM); ShowWindow(g_wnd, SW_HIDE); g_open = g_closing = false; g_snaps.clear(); }+void Close() { if (!g_open || g_closing) return; g_closing = true; g_at = anim::Now(); }++void Go(int to) {+ to = std::clamp(to, 0, (int)g_snaps.size() - 1);+ if (to == g_sel) return;+ g_sel = to; g_row = -1;+}++void Restore() {+ if (g_sel <= 0 || g_row < 0 || g_row >= (int)g_snaps[g_sel].items.size()) return;+ auto& it = g_snaps[g_sel].items[g_row];+ if (it.dir || it.src.empty()) return;+ std::wstring dst = g_folder + L"\\" + it.name;+ if (GetFileAttributesW(dst.c_str()) != INVALID_FILE_ATTRIBUTES) { // mantém as duas: a restaurada ganha " (restaurado)"+ size_t dot = it.name.find_last_of(L'.');+ std::wstring base = dot == std::wstring::npos ? it.name : it.name.substr(0, dot), ext = dot == std::wstring::npos ? L"" : it.name.substr(dot);+ dst = g_folder + L"\\" + base + L" (" + Tr(L"restaurado") + L")" + ext;+ for (int n = 2; GetFileAttributesW(dst.c_str()) != INVALID_FILE_ATTRIBUTES && n < 100; n++)+ dst = g_folder + L"\\" + base + L" (" + Tr(L"restaurado") + L" " + std::to_wstring(n) + L")" + ext;+ }+ bool ok = CopyFileW(it.src.c_str(), dst.c_str(), TRUE) != FALSE;+ Log(L"time machine: restaurar %ls -> %ls: %ls", it.src.c_str(), dst.c_str(), ok ? L"ok" : L"falhou");+ Close();+}++D2D1_POINT_2F Pt(LPARAM l) { float sc = Sc(); return { (short)LOWORD(l) / sc, (short)HIWORD(l) / sc }; }+bool In(D2D1_RECT_F r, D2D1_POINT_2F p) { return p.x >= r.left && p.x < r.right && p.y >= r.top && p.y < r.bottom; }++LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {+ switch (m) {+ case WM_TIMER:+ if (w == T_ANIM) {+ double now = anim::Now(), dt = std::min(100.0, now - g_lastTick); g_lastTick = now;+ float diff = g_sel - g_pos;+ g_pos += diff * (1 - std::exp(-(float)dt / 110.f));+ if (std::fabs(g_sel - g_pos) < 0.002f) g_pos = (float)g_sel;+ Paint();+ if (g_closing && now - g_at > 470) HideNow();+ }+ return 0;+ case WM_LBUTTONDOWN: {+ D2D1_POINT_2F p = Pt(l);+ if (In(BtnRect(0), p)) { Close(); return 0; }+ if (In(BtnRect(1), p)) { Restore(); return 0; }+ if (In(ArrowRect(true), p)) { Go(g_sel + 1); return 0; }+ if (In(ArrowRect(false), p)) { Go(g_sel - 1); return 0; }+ for (int i = 0; i < (int)g_snaps.size(); i++) { auto t = TickPt(i); if (std::fabs(p.x - t.x) < 30 && std::fabs(p.y - t.y) < 8) { Go(i); return 0; } }+ auto f = FrontRect();+ if (In(f, p) && p.y > f.top + HEAD) { int r = (int)((p.y - f.top - HEAD) / ROW); g_row = r < (int)g_snaps[g_sel].items.size() ? r : -1; }+ return 0;+ }+ case WM_MOUSEMOVE: {+ D2D1_POINT_2F p = Pt(l); int hv = -1;+ for (int i = 0; i < (int)g_snaps.size(); i++) { auto t = TickPt(i); if (std::fabs(p.x - t.x) < 30 && std::fabs(p.y - t.y) < 8) hv = i; }+ g_hoverTick = hv;+ return 0;+ }+ case WM_MOUSEWHEEL: Go(g_sel + (GET_WHEEL_DELTA_WPARAM(w) > 0 ? 1 : -1)); return 0;+ case WM_KEYDOWN:+ if (w == VK_ESCAPE) Close();+ else if (w == VK_UP) Go(g_sel + 1);+ else if (w == VK_DOWN) Go(g_sel - 1);+ else if (w == VK_RETURN) Restore();+ return 0;+ case WM_CLOSE: Close(); return 0;+ }+ return DefWindowProcW(h, m, w, l);+}++} // namespace++bool tempo::Create(HINSTANCE hi) {+ WNDCLASSW wc{}; wc.lpfnWndProc = Proc; wc.hInstance = hi; wc.lpszClassName = L"ShellTimeMachine"; wc.hCursor = LoadCursorW(nullptr, IDC_ARROW);+ RegisterClassW(&wc);+ g_wnd = CreateWindowExW(WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOREDIRECTIONBITMAP, wc.lpszClassName, L"Time Machine", WS_POPUP, 0, 0, 10, 10, nullptr, nullptr, hi, nullptr);+ if (!g_wnd) return false;+ apps::ours.push_back(g_wnd);+ g_s.hwnd = g_wnd;+ return true;+}++bool tempo::IsOpen() { return g_open && !g_closing; }++void tempo::Enter() {+ if (!g_wnd && !tempo::Create(shell::inst)) return;+ if (g_open) { if (!g_closing) Close(); return; }+ Load();+ MONITORINFO mi{ sizeof(mi) };+ GetMonitorInfoW(MonitorFromPoint({ 0, 0 }, MONITOR_DEFAULTTOPRIMARY), &mi);+ RECT r = mi.rcMonitor;+ SetWindowPos(g_wnd, HWND_TOPMOST, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOACTIVATE);+ float sc = Sc();+ g_W = (r.right - r.left) / sc; g_H = (r.bottom - r.top) / sc;+ g_open = true; g_closing = false; g_sel = 0; g_pos = 0; g_row = -1; g_hoverTick = -1;+ g_at = g_lastTick = anim::Now();+ Paint();+ ShowWindow(g_wnd, SW_SHOW);+ HWND fg = GetForegroundWindow();+ DWORD ft = fg ? GetWindowThreadProcessId(fg, nullptr) : 0, me = GetCurrentThreadId();+ bool att = ft && ft != me && AttachThreadInput(me, ft, TRUE);+ SetForegroundWindow(g_wnd); SetFocus(g_wnd);+ if (att) AttachThreadInput(me, ft, FALSE);+ SetTimer(g_wnd, T_ANIM, 16, nullptr);+ Log(L"time machine: %zu versões de %ls (backup: %ls)", g_snaps.size(), g_folder.c_str(), g_root.empty() ? L"nenhum" : g_root.c_str());+}diff --git a/src/shell/ui.cpp b/src/shell/ui.cppindex 6b95652..cef1676 100644--- a/src/shell/ui.cpp+++ b/src/shell/ui.cpp@@ -677,6 +677,71 @@ bool ui::LoadPng(const std::wstring& path, UINT& w, UINT& h, std::vector<BYTE>&return ok;}+// Foto inteira pelo WIC (o Quick Look): a miniatura do Windows para em ~1024 px e ficava borrada numa tela de+// 3440. Gira pela orientação do EXIF (foto de celular) e reduz (Fant) até maxSide; nunca amplia.+bool ui::LoadPhoto(const std::wstring& path, UINT maxSide, UINT& w, UINT& h, std::vector<BYTE>& bgra) {+ IWICImagingFactory* wic = nullptr;+ if (FAILED(CoCreateInstance(CLSID_WICImagingFactory, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&wic)))) return false;+ IWICBitmapDecoder* dec = nullptr;+ bool ok = false;+ if (SUCCEEDED(wic->CreateDecoderFromFilename(path.c_str(), nullptr, GENERIC_READ, WICDecodeMetadataCacheOnDemand, &dec))) {+ IWICBitmapFrameDecode* fr = nullptr;+ if (SUCCEEDED(dec->GetFrame(0, &fr))) {+ UINT fw = 0, fh = 0; fr->GetSize(&fw, &fh);+ USHORT orient = 1; // 1 normal, 3 = 180°, 6 = 90° horário, 8 = 90° anti-horário (2/4/5/7: espelhadas)+ IWICMetadataQueryReader* q = nullptr;+ if (SUCCEEDED(fr->GetMetadataQueryReader(&q))) {+ for (auto key : { L"/app1/ifd/{ushort=274}", L"/ifd/{ushort=274}", L"System.Photo.Orientation" }) {+ PROPVARIANT v; PropVariantInit(&v);+ if (SUCCEEDED(q->GetMetadataByName(key, &v)) && v.vt == VT_UI2) { orient = v.uiVal; PropVariantClear(&v); break; }+ PropVariantClear(&v);+ }+ q->Release();+ }+ IWICBitmapSource* src = fr; src->AddRef();+ if (fw && fh && maxSide && (fw > maxSide || fh > maxSide)) {+ double k = (double)maxSide / std::max(fw, fh);+ IWICBitmapScaler* sc = nullptr;+ if (SUCCEEDED(wic->CreateBitmapScaler(&sc)) &&+ SUCCEEDED(sc->Initialize(src, std::max(1u, (UINT)(fw * k)), std::max(1u, (UINT)(fh * k)), WICBitmapInterpolationModeFant))) {+ src->Release(); src = sc;+ } else if (sc) sc->Release();+ }+ WICBitmapTransformOptions tr = WICBitmapTransformRotate0;+ switch (orient) {+ case 2: tr = WICBitmapTransformFlipHorizontal; break;+ case 3: tr = WICBitmapTransformRotate180; break;+ case 4: tr = WICBitmapTransformFlipVertical; break;+ case 5: tr = (WICBitmapTransformOptions)(WICBitmapTransformRotate90 | WICBitmapTransformFlipHorizontal); break;+ case 6: tr = WICBitmapTransformRotate90; break;+ case 7: tr = (WICBitmapTransformOptions)(WICBitmapTransformRotate270 | WICBitmapTransformFlipHorizontal); break;+ case 8: tr = WICBitmapTransformRotate270; break;+ }+ if (tr != WICBitmapTransformRotate0) {+ IWICBitmapFlipRotator* rot = nullptr;+ if (SUCCEEDED(wic->CreateBitmapFlipRotator(&rot)) && SUCCEEDED(rot->Initialize(src, tr))) { src->Release(); src = rot; }+ else if (rot) rot->Release();+ }+ IWICFormatConverter* cv = nullptr;+ if (SUCCEEDED(wic->CreateFormatConverter(&cv)) &&+ SUCCEEDED(cv->Initialize(src, GUID_WICPixelFormat32bppPBGRA, WICBitmapDitherTypeNone, nullptr, 0, WICBitmapPaletteTypeCustom))) {+ cv->GetSize(&w, &h);+ if (w && h && (size_t)w * h <= 80'000'000) {+ bgra.resize((size_t)w * h * 4);+ ok = SUCCEEDED(cv->CopyPixels(nullptr, w * 4, (UINT)bgra.size(), bgra.data()));+ }+ }+ if (cv) cv->Release();+ src->Release();+ fr->Release();+ }+ dec->Release();+ }+ wic->Release();+ if (!ok) bgra.clear();+ return ok;+}+// Pasta dos ícones do Sequoia (icones\sequoia, ao lado de bin\): uso pessoal, ver icones\LEIA-ME.txt.std::wstring ui::PackIcon(const std::wstring& name) {std::wstring root = shell::dir.substr(0, shell::dir.find_last_of(L'\\')) + L"\\icones";diff --git a/src/timemachine/main.cpp b/src/timemachine/main.cppindex 0700408..b6eca3c 100644--- a/src/timemachine/main.cpp+++ b/src/timemachine/main.cpp@@ -134,7 +134,7 @@ void Paint() {y += 10;float bx = X;Button(D2D1::RectF(bx, y, bx + 190, y + 32), Tr(L"Fazer Backup Agora"), H_NOW, true, dark); bx += 200;- Button(D2D1::RectF(bx, y, bx + 190, y + 32), Tr(L"Restaurar Arquivos…"), H_RESTORE, false, dark); bx += 200;+ Button(D2D1::RectF(bx, y, bx + 190, y + 32), semaforo::Leopard() ? Tr(L"Entrar no Time Machine") : Tr(L"Restaurar Arquivos…"), H_RESTORE, false, dark); bx += 200;y += 44; bx = X;Button(D2D1::RectF(bx, y, bx + 190, y + 32), Tr(L"Escolher Disco…"), H_DISK, false, dark); bx += 200;Button(D2D1::RectF(bx, y, bx + 190, y + 32), Tr(L"Opções…"), H_OPTIONS, false, dark);@@ -225,7 +225,17 @@ LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {SetTimer(h, 1, 3000, nullptr);break;}- case H_RESTORE: ShellExecuteW(nullptr, L"open", L"FileHistory.exe", nullptr, nullptr, SW_SHOWNORMAL); break;+ case H_RESTORE: {+ // tema Leopard: a "viagem no tempo" do Mac (galáxia e a pilha de janelas), desenhada pelo Shell+ // (tempo.cpp); nos outros temas, a restauração do Windows+ HWND sh = semaforo::Leopard() ? FindWindowW(L"ShellMensagens", nullptr) : nullptr;+ if (sh) {+ DWORD pid = 0; GetWindowThreadProcessId(sh, &pid);+ AllowSetForegroundWindow(pid);+ PostMessageW(sh, RegisterWindowMessageW(L"ShellAbrirPainel"), 18, 0);+ } else ShellExecuteW(nullptr, L"open", L"FileHistory.exe", nullptr, nullptr, SW_SHOWNORMAL);+ break;+ }case H_OPTIONS: Options(scr); break;}InvalidateRect(h, nullptr, FALSE);diff --git a/src/titulos/main.cpp b/src/titulos/main.cppnew file mode 100644index 0000000..4931888--- /dev/null+++ b/src/titulos/main.cpp@@ -0,0 +1,90 @@+// WacOSTitleBars.exe: só a barra de título do Mac nas janelas dos outros programas, sem o resto do WacOS (sem+// barra de menus, Dock, mesa; a barra de tarefas do Windows fica). Para quem tem o próprio visual e quer só as+// barras (Reddit, 20/11/2026). O trabalho é o mesmo do Shell: src\shell\janelas.cpp (gancho por thread com a+// WacOSWindow.dll, os de 32 bits pelo rundll32 do Windows), compilado junto com este arquivo.+// WacOSTitleBars.exe liga (uma instância só; com o Shell aberto não faz nada: ele já põe as barras)+// WacOSTitleBars.exe --sair desliga a que estiver rodando (as janelas voltam ao visual do Windows)+// O Shell, ao abrir, fecha esta (janelas.cpp) e assume. Exclusões: %APPDATA%\Shell\janelas-excluidas.txt.+// Ajustes lidos: janelas_mac (0 desliga) e o tema (a DLL lê o ajustes.txt sozinha).+#include "../shell/shell.h"+#include <shlobj.h>+#include <cstdarg>++std::wstring shell::dir;+namespace {+FILE* g_log;+HWND g_wnd;+}++void Log(const wchar_t* fmt, ...) {+ if (!g_log) return;+ SYSTEMTIME t; GetLocalTime(&t);+ fwprintf(g_log, L"%02d:%02d:%02d.%03d ", t.wHour, t.wMinute, t.wSecond, t.wMilliseconds);+ va_list a; va_start(a, fmt); vfwprintf(g_log, fmt, a); va_end(a);+ fwprintf(g_log, L"\n");+ fflush(g_log);+}++// %APPDATA%\Shell\ajustes.txt (o mesmo do Shell), só leitura+std::wstring shell::Setting(const wchar_t* key, const wchar_t* def) {+ PWSTR p = nullptr;+ if (FAILED(SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &p))) return def;+ std::wstring f = std::wstring(p) + L"\\Shell\\ajustes.txt";+ CoTaskMemFree(p);+ FILE* fp = nullptr;+ if (_wfopen_s(&fp, f.c_str(), L"r, ccs=UTF-8") || !fp) return def;+ std::wstring want = std::wstring(key) + L"=", val = def;+ wchar_t line[1024];+ while (fgetws(line, 1024, fp)) {+ std::wstring s = line;+ while (!s.empty() && (s.back() == L'\n' || s.back() == L'\r')) s.pop_back();+ if (s.rfind(want, 0) == 0) val = s.substr(want.size());+ }+ fclose(fp);+ return val;+}++namespace {++void CALLBACK OnForeground(HWINEVENTHOOK, DWORD, HWND h, LONG obj, LONG, DWORD, DWORD) {+ if (obj == OBJID_WINDOW && h) janelas::Foreground(h);+}++LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {+ if (m == WM_CLOSE) { DestroyWindow(h); return 0; }+ if (m == WM_ENDSESSION && w) { janelas::Stop(); return 0; }+ if (m == WM_DESTROY) { PostQuitMessage(0); return 0; }+ return DefWindowProcW(h, m, w, l);+}++} // namespace++int WINAPI wWinMain(HINSTANCE hi, HINSTANCE, PWSTR cmd, int) {+ if (cmd && wcsstr(cmd, L"--sair")) {+ if (HWND h = FindWindowW(L"WacOSBarrasDeTitulo", nullptr)) PostMessageW(h, WM_CLOSE, 0, 0);+ return 0;+ }+ HANDLE one = CreateMutexW(nullptr, TRUE, L"WacOSBarrasDeTituloUmaInstancia");+ if (GetLastError() == ERROR_ALREADY_EXISTS) return 0;+ if (FindWindowW(L"ShellMensagens", nullptr)) return 0; // o Shell aberto já põe as barras+ SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);+ wchar_t exe[MAX_PATH]; GetModuleFileNameW(nullptr, exe, MAX_PATH);+ shell::dir = exe; shell::dir = shell::dir.substr(0, shell::dir.find_last_of(L'\\'));+ g_log = _wfsopen((shell::dir + L"\\barras-titulo.log").c_str(), L"w, ccs=UTF-8", _SH_DENYNO);+ Log(L"WacOSTitleBars iniciando (só as barras de título, sem o Shell)");+ WNDCLASSW wc{}; wc.lpfnWndProc = Proc; wc.hInstance = hi; wc.lpszClassName = L"WacOSBarrasDeTitulo";+ RegisterClassW(&wc);+ // janela comum escondida (não "message-only"): o Shell e o --sair a acham pelo FindWindow+ g_wnd = CreateWindowExW(WS_EX_TOOLWINDOW, wc.lpszClassName, L"WacOS Title Bars", WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, hi, nullptr);+ if (!g_wnd) return 1;+ if (shell::Setting(L"janelas_mac", L"1") != L"1") Log(L"janelas_mac=0 no ajustes.txt: nada a fazer");+ janelas::Start();+ SetWinEventHook(EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND, nullptr, OnForeground, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS);+ MSG msg;+ while (GetMessageW(&msg, nullptr, 0, 0) > 0) { TranslateMessage(&msg); DispatchMessageW(&msg); }+ janelas::Stop(); // as janelas voltam ao visual do Windows+ Log(L"WacOSTitleBars saiu");+ if (g_log) fclose(g_log);+ ReleaseMutex(one);+ return 0;+}diff --git a/tools/atualizar-github.ps1 b/tools/atualizar-github.ps1index 3cf12f6..dbdc7ea 100644--- a/tools/atualizar-github.ps1+++ b/tools/atualizar-github.ps1@@ -64,11 +64,17 @@ Write-Host "Downloading $($asset.name) ($([math]::Round($asset.size / 1MB)) MB).$dh = $h.Clone(); $dh['Accept'] = 'application/octet-stream'$ProgressPreference = 'SilentlyContinue' # the PowerShell progress bar makes downloads very slowInvoke-WebRequest -UseBasicParsing -Headers $dh -Uri $asset.url -OutFile $zip+# the package must be exactly the one GitHub published (the release lists its SHA-256 as "digest")+if ($asset.digest -match '^sha256:([0-9a-fA-F]{64})$') {+ if ((Get-FileHash $zip -Algorithm SHA256).Hash -ne $Matches[1].ToUpper()) { Remove-Item $tmp -Recurse -Force; Fim 'The download does not match the published package (SHA-256). Nothing was installed.' 8 }+ Write-Host 'SHA-256 checked.'+}Write-Host 'Extracting...'Expand-Archive $zip (Join-Path $tmp 'pacote') -Force$script = Get-ChildItem (Join-Path $tmp 'pacote') -Recurse -Filter instalar.ps1 | Select-Object -First 1if (-not $script) { Fim 'The package has no instalar.ps1.' 8 }Write-Host 'Installing (only the files that changed; WacOS closes and reopens by itself)...'-& powershell -NoProfile -ExecutionPolicy Bypass -File $script.FullName -Atualizar -Silencioso+# in this same PowerShell, no second PowerShell started on the downloaded file+& $script.FullName -Atualizar -SilenciosoRemove-Item $tmp -Recurse -Force -ErrorAction SilentlyContinueFim "Done: WacOS $novo installed."diff --git a/tools/empacotar.ps1 b/tools/empacotar.ps1index d9c5959..7580968 100644--- a/tools/empacotar.ps1+++ b/tools/empacotar.ps1@@ -19,7 +19,7 @@ New-Item -ItemType Directory -Force "$pkg\bin" | Out-Null# programas: só o que o Shell usa (bin\ferramentas, bin\obj, logs e cópias .run/.old ficam de fora)$progs = 'WacOSShell.exe', 'WacOSFinder.exe', 'WacOSSettings.exe', 'WacOSActivityMonitor.exe', 'WacOSTerminal.exe',- 'WacOSCalculator.exe', 'WacOSNotes.exe', 'WacOSScreenshot.exe', 'WacOSPreview.exe', 'WacOSReminders.exe', 'WacOSCalendar.exe', 'WacOSTextEdit.exe', 'WacOSClock.exe', 'WacOSWeather.exe', 'WacOSContacts.exe', 'WacOSPhotos.exe', 'WacOSTimeMachine.exe', 'WacOSMusic.exe', 'WacOSQuickTime.exe', 'WacOSForceQuit.exe', 'WacOSWindow.dll', 'WacOSWindow32.dll',+ 'WacOSCalculator.exe', 'WacOSNotes.exe', 'WacOSScreenshot.exe', 'WacOSPreview.exe', 'WacOSReminders.exe', 'WacOSCalendar.exe', 'WacOSTextEdit.exe', 'WacOSClock.exe', 'WacOSWeather.exe', 'WacOSContacts.exe', 'WacOSPhotos.exe', 'WacOSTimeMachine.exe', 'WacOSMusic.exe', 'WacOSQuickTime.exe', 'WacOSForceQuit.exe', 'WacOSTitleBars.exe', 'WacOSWindow.dll', 'WacOSWindow32.dll','DialogoMac.dll', 'DialogoMac32.dll'if ($SemSistema) { $progs = $progs | Where-Object { $_ -notlike 'DialogoMac*' } }$progs += 'versao.txt' # a versão (o GitHub Actions grava; o atualizador compara)@@ -39,10 +39,12 @@ if (-not $SemSistema) {Copy-Item "$PSScriptRoot\dialogo-ligar.ps1" "$pkg\tools\dialogo-ligar.ps1"}-# ícones e sons (a pasta inteira de cada). O tema Leopard ainda não saiu: icones\leopard fica de fora+# ícones e sons (a pasta inteira de cada, com icones\leopard: o tema Mac OS X Leopard saiu em 20/11/2026)foreach ($pasta in 'icones', 'sons') {- if (Test-Path "$root\$pasta") { robocopy "$root\$pasta" "$pkg\$pasta" /E /XD leopard /NFL /NDL /NJH /NJS /NP | Out-Null }+ if (Test-Path "$root\$pasta") { robocopy "$root\$pasta" "$pkg\$pasta" /E /NFL /NDL /NJH /NJS /NP | Out-Null }}+# o cursor do tema Leopard (o Shell aplica ao entrar no tema e devolve o anterior ao sair: ponteiro::TemaLeopard)+if (Test-Path "$root\cursor\Leopard") { robocopy "$root\cursor\Leopard" "$pkg\cursor-leopard\Leopard" /E /NFL /NDL /NJH /NJS /NP | Out-Null }# fontes SF instaladas neste PC (por usuário e do sistema)if (-not $Atualizacao) {@@ -62,7 +64,7 @@ foreach ($d in (Join-Path $env:LOCALAPPDATA 'Microsoft\Windows\Fonts'), (Join-Pa# cursor em uso (se for um esquema de arquivos próprio): a pasta dele e o mapa papel=arquivo$creg = Get-ItemProperty 'HKCU:\Control Panel\Cursors'-# com o tema Leopard ligado neste PC o cursor em uso é o do Leopard (ainda não saiu): vai o que o Shell guardou+# com o tema Leopard ligado neste PC o cursor em uso é o do Leopard (esse vai à parte, em cursor-leopard): vai o que o Shell guardou# antes de trocar (%APPDATA%\Shell\cursor-antes.txt, papel=caminho), o cursor do Tahoe$antes = Join-Path $env:APPDATA 'Shell\cursor-antes.txt'if ((Split-Path (Split-Path $creg.Arrow) -Leaf) -eq 'Leopard' -and (Test-Path $antes)) {diff --git a/tools/icones-leopard-desenhados.py b/tools/icones-leopard-desenhados.pynew file mode 100644index 0000000..cb988ac--- /dev/null+++ b/tools/icones-leopard-desenhados.py@@ -0,0 +1,180 @@+# Ícones do tema Leopard desenhados aqui (não vêm do pacote): apps que não existiam em 2007 ganham um desenho no estilo+# da época, feito a partir da forma do logo de hoje (icones\extra / icones\sequoia).+# Chrome: o ícone de 2008 — a "esfera" 3D com os três gomos em relevo (vermelho, amarelo, verde), o anel branco e o+# centro azul de vidro, com o brilho forte em cima e a sombra embaixo.+# Claude: a estrela laranja com volume (degradê de cima para baixo), relevo nas bordas e brilho.+# Saída no formato de icones\leopard (quadro 25 % maior que o desenho, sombra projetada). Chamado por+# tools\icones-leopard.py depois do "aquificar" (sobrescreve as versões aquificadas desses apps).+# python tools\icones-leopard-desenhados.py [destino]+import os, sys, colorsys+import numpy as np+from PIL import Image, ImageFilter, ImageDraw++AQUI = os.path.dirname(os.path.abspath(__file__))+sys.path.insert(0, AQUI)+from aqua_icone import recorta, tira_placa++RAIZ = os.path.join(AQUI, '..', 'icones')+DST = sys.argv[1] if len(sys.argv) > 1 else os.path.join(RAIZ, 'leopard')+LADO = 320+++def fonte(*nomes):+ for sub in ('extra', 'sequoia'):+ for n in nomes:+ p = os.path.join(RAIZ, sub, n + '.png')+ if os.path.isfile(p): return p+ return None+++def logo_solto(path):+ im = recorta(Image.open(path).convert('RGBA'))+ s = tira_placa(im)+ return recorta(s if s else im)+++def quadro(art):+ """centraliza o desenho (80 % do quadro) com a sombra projetada embaixo"""+ s = int(LADO * 0.8)+ k = s / max(art.size)+ art = art.convert('RGBa').resize((max(1, round(art.width * k)), max(1, round(art.height * k))), Image.LANCZOS).convert('RGBA') # pré-multiplicado: sem halo claro na borda+ q = Image.new('RGBA', (LADO, LADO), (0, 0, 0, 0))+ x0, y0 = (LADO - art.width) // 2, (LADO - art.height) // 2 - int(LADO * 0.01)+ sa = Image.new('L', (LADO, LADO), 0)+ sa.paste(art.getchannel('A').point(lambda v: int(v * 0.5)), (x0, y0 + int(LADO * 0.025)))+ sh = Image.new('RGBA', (LADO, LADO), (0, 0, 0, 0)); sh.putalpha(sa.filter(ImageFilter.GaussianBlur(LADO * 0.022)))+ q = Image.alpha_composite(q, sh)+ q.alpha_composite(art, (x0, y0))+ return q+++def chrome():+ src = fonte('Google Chrome', 'chrome', 'google chrome')+ if not src: return None+ im = logo_solto(src)+ N = 512+ k = N / max(im.size)+ im = im.resize((round(im.width * k), round(im.height * k)), Image.LANCZOS)+ a = np.asarray(im).astype(np.float32) / 255+ h, w = a.shape[:2]+ rgb, al = a[..., :3], a[..., 3]+ # classifica cada pixel pela cor do logo de hoje (a geometria dos gomos é a mesma de 2008)+ mx, mn = rgb.max(2), rgb.min(2)+ sat = np.where(mx > 0, (mx - mn) / np.maximum(mx, 1e-6), 0)+ r, g, b = rgb[..., 0], rgb[..., 1], rgb[..., 2]+ hue = np.zeros_like(r)+ d = np.maximum(mx - mn, 1e-6)+ hue = np.where(mx == r, ((g - b) / d) % 6, np.where(mx == g, (b - r) / d + 2, (r - g) / d + 4)) * 60+ lab = np.full((h, w), -1, np.int8) # 0 vermelho, 1 amarelo, 2 verde, 3 azul, 4 branco+ on = al > 0.5+ lab[on & (sat < 0.25) & (mx > 0.75)] = 4+ col = on & (sat >= 0.25)+ lab[col & ((hue < 25) | (hue >= 330))] = 0+ lab[col & (hue >= 25) & (hue < 75)] = 1+ lab[col & (hue >= 75) & (hue < 180)] = 2+ lab[col & (hue >= 180) & (hue < 330)] = 3+ # o centro: mantém o círculo (anel branco e miolo azul) medindo pelo próprio logo+ ys, xs = np.nonzero(on)+ cy, cx = ys.mean(), xs.mean()+ R = max(ys.max() - ys.min(), xs.max() - xs.min()) / 2+ yy, xx = np.mgrid[0:h, 0:w].astype(np.float32)+ dist = np.hypot(yy - cy, xx - cx) / R+ blue = lab == 3+ rb = np.percentile(dist[blue], 98) if blue.any() else 0.36+ rw = rb * 1.25+ # cores de 2008: mais vivas e com volume (claras em cima, escuras embaixo e na borda)+ base = {0: (0.86, 0.13, 0.11), 1: (1.0, 0.80, 0.10), 2: (0.16, 0.62, 0.20)}+ out = np.zeros((h, w, 4), np.float32)+ luz = 1.18 - 0.45 * ((yy - (cy - R)) / (2 * R)) # luz de cima+ borda = 1 - 0.38 * np.clip((dist - 0.55) / 0.45, 0, 1) ** 2 # escurece perto do aro (esfera)+ for kk, c in base.items():+ m = lab == kk+ for i in range(3):+ out[..., i] = np.where(m, np.clip(c[i] * luz * borda, 0, 1), out[..., i])+ # anel branco (perolado) e o miolo azul de vidro+ ring = (dist <= rw) & (dist > rb) & on+ pr = np.clip(1.0 - 0.18 * ((yy - cy) / (rw * R) + 1) / 2, 0, 1)+ for i in range(3): out[..., i] = np.where(ring, pr * (0.98, 0.98, 1.0)[i], out[..., i])+ core = (dist <= rb) & on+ t = np.clip(((yy - cy) / (rb * R) + 1) / 2, 0, 1) # 0 em cima, 1 embaixo+ cb = [(0.45 + 0.20 * (1 - t)), (0.68 + 0.18 * (1 - t)), (0.98 + 0.0 * t)]+ cb = [np.clip(cb[0] - 0.25 * t, 0, 1), np.clip(cb[1] - 0.30 * t, 0, 1), np.clip(cb[2] - 0.15 * t, 0, 1)]+ for i in range(3): out[..., i] = np.where(core, cb[i], out[..., i])+ # o que sobrou sem rótulo dentro do logo (antisserrilhado): cor original+ rest = on & (lab == -1)+ for i in range(3): out[..., i] = np.where(rest, rgb[..., i], out[..., i])+ out[..., 3] = al+ img = Image.fromarray((np.clip(out, 0, 1) * 255).astype(np.uint8), 'RGBA')+ # divisões em relevo entre os gomos (fio escuro) e o aro escuro de fora+ lab_img = Image.fromarray(((lab.astype(np.int16) + 1) * 40).astype(np.uint8), 'L')+ ed = np.asarray(lab_img.filter(ImageFilter.FIND_EDGES)).astype(np.float32)+ ed = (ed > 10).astype(np.float32) * on+ ed = np.asarray(Image.fromarray((ed * 255).astype(np.uint8)).filter(ImageFilter.GaussianBlur(1.6))).astype(np.float32) / 255+ dark = Image.new('RGBA', (w, h), (0, 0, 0, 0)); dark.putalpha(Image.fromarray((np.clip(ed * 0.55, 0, 1) * 255).astype(np.uint8)))+ img = Image.alpha_composite(img, dark)+ am = Image.fromarray((al * 255).astype(np.uint8))+ aro = np.asarray(am).astype(np.float32) - np.asarray(am.filter(ImageFilter.MinFilter(7))).astype(np.float32)+ rimg = Image.new('RGBA', (w, h), (40, 10, 10, 0)); rimg.putalpha(Image.fromarray((np.clip(aro, 0, 255) * 0.5).astype(np.uint8)))+ img = Image.alpha_composite(img, rimg)+ # o brilho de vidro: elipse branca na metade de cima, sumindo para baixo+ gl = Image.new('L', (w, h), 0)+ ImageDraw.Draw(gl).ellipse((cx - R * 0.80, cy - R * 0.97, cx + R * 0.80, cy + R * 0.05), fill=255)+ grad = np.clip(1 - (yy - (cy - R)) / (R * 1.0), 0, 1) * 0.45+ gla = np.asarray(gl.filter(ImageFilter.GaussianBlur(2))).astype(np.float32) / 255 * grad * al+ white = Image.new('RGBA', (w, h), (255, 255, 255, 0)); white.putalpha(Image.fromarray((gla * 255).astype(np.uint8)))+ img = Image.alpha_composite(img, white)+ # brilhinho no miolo azul+ sp = Image.new('L', (w, h), 0)+ ImageDraw.Draw(sp).ellipse((cx - rb * R * 0.6, cy - rb * R * 0.85, cx + rb * R * 0.6, cy - rb * R * 0.15), fill=170)+ spw = Image.new('RGBA', (w, h), (255, 255, 255, 0)); spw.putalpha(sp.filter(ImageFilter.GaussianBlur(3)))+ img = Image.alpha_composite(img, spw)+ return quadro(img)+++def claude():+ src = fonte('Claude')+ if not src: return None+ im = logo_solto(src)+ N = 512+ k = N / max(im.size)+ im = im.resize((round(im.width * k), round(im.height * k)), Image.LANCZOS)+ w, h = im.size+ # forma suavizada (o recorte da placa deixa a borda serrilhada): desfoca e aperta de novo+ a0 = np.asarray(im.getchannel('A').filter(ImageFilter.GaussianBlur(2.2))).astype(np.float32) / 255+ al = np.clip((a0 - 0.5) * 4 + 0.5, 0, 1)+ yy, xx = np.mgrid[0:h, 0:w].astype(np.float32)+ # o laranja do Claude (#D97757) com volume: mais claro em cima, terracota embaixo+ t = yy / h+ cor = np.stack([0.93 - 0.14 * t, 0.56 - 0.20 * t, 0.42 - 0.18 * t], -1)+ # relevo: a luz vem de cima à esquerda (derivada do alfa desfocado)+ ab = np.asarray(Image.fromarray((al * 255).astype(np.uint8)).filter(ImageFilter.GaussianBlur(5))).astype(np.float32) / 255+ gy, gx = np.gradient(ab)+ rel = -(gx * 0.6 + gy * 0.8) * 9+ cor = np.clip(cor + np.clip(rel, -0.6, 0.6)[..., None] * 0.12, 0, 1)+ out = np.dstack([cor, al])+ img = Image.fromarray((out * 255).astype(np.uint8), 'RGBA')+ # contorno fino mais escuro (como os ícones da época)+ am = img.getchannel('A')+ aro = np.asarray(am).astype(np.float32) - np.asarray(am.filter(ImageFilter.MinFilter(5))).astype(np.float32)+ rimg = Image.new('RGBA', (w, h), (120, 45, 20, 0)); rimg.putalpha(Image.fromarray((np.clip(aro, 0, 255) * 0.35).astype(np.uint8)).filter(ImageFilter.GaussianBlur(0.8)))+ img = Image.alpha_composite(img, rimg)+ # brilho: faixa branca na metade de cima, só dentro da forma+ grad = np.clip(1 - yy / (h * 0.55), 0, 1) * 0.40+ gla = grad * np.asarray(am.filter(ImageFilter.MinFilter(9))).astype(np.float32) / 255+ white = Image.new('RGBA', (w, h), (255, 255, 255, 0)); white.putalpha(Image.fromarray((gla * 255).astype(np.uint8)))+ img = Image.alpha_composite(img, white)+ return quadro(img)+++if __name__ == '__main__':+ os.makedirs(DST, exist_ok=True)+ feitos = []+ c = chrome()+ if c:+ for n in ('Google Chrome', 'chrome', 'google chrome', 'Google_Chrome 2'):+ c.save(os.path.join(DST, n + '.png'))+ feitos.append('Chrome')+ c = claude()+ if c:+ c.save(os.path.join(DST, 'Claude.png')); feitos.append('Claude')+ print('desenhados:', ', '.join(feitos))diff --git a/tools/icones-leopard.py b/tools/icones-leopard.pyindex d62d3a5..701bcf0 100644--- a/tools/icones-leopard.py+++ b/tools/icones-leopard.py@@ -163,6 +163,9 @@ for sub in ('extra', 'sequoia'):try: aquifica(os.path.join(pasta, arq), os.path.join(DST, arq)); aq += 1except Exception as e: print('não deu para aquificar', arq, e)print(f'{aq} ícones modernos no estilo Aqua')+# os desenhados à mão para o Leopard (Chrome de 2008, Claude com volume) por cima dos aquificados+import subprocess+subprocess.run([sys.executable, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'icones-leopard-desenhados.py'), DST], check=False)with open(os.path.join(DST, 'CREDITOS.txt'), 'w', encoding='utf-8') as f:f.write('Pacote "Leopard Icons" (650 ícones, itransform.freehostia.com), baixado pelo usuário. Uso pessoal; não distribuir.\n''Gerado por tools\\icones-leopard.py.\n')diff --git a/tools/icones-sistema-extra.ps1 b/tools/icones-sistema-extra.ps1index 57b7c82..ab80823 100644--- a/tools/icones-sistema-extra.ps1+++ b/tools/icones-sistema-extra.ps1@@ -17,13 +17,16 @@ $lines = New-Object System.Collections.Generic.List[string]function Say($s) { $lines.Add($s) }function Fim { $lines | Set-Content $out -Encoding utf8 }function Stamp { Get-Date -Format 'yyyy-MM-dd HH:mm' }-Add-Type -Namespace W -Name N -MemberDefinition '[DllImport("shell32.dll", CharSet=CharSet.Unicode)] public static extern void SHChangeNotify(int e, uint f, string a, System.IntPtr b);'+# avisar o Explorador: pelo WacOSShell.exe (modo ajudante), sem C# embutido no script+$ajudante = Join-Path $PSScriptRoot '..\bin\WacOSShell.exe'+function AvisarIcones { if (Test-Path $ajudante) { Start-Process $ajudante -ArgumentList '--avisar-icones' -Wait } }+function AvisarPasta($p) { if (Test-Path $ajudante) { Start-Process $ajudante -ArgumentList '--avisar-pasta', ('"' + $p + '"') -Wait } }function Refresh {- [W.N]::SHChangeNotify(0x08000000, 0x1000, $null, [IntPtr]::Zero) # SHCNE_ASSOCCHANGED- try { Start-Process "$env:WINDIR\System32\ie4uinit.exe" -ArgumentList '-show' -Wait -WindowStyle Hidden } catch {}+ AvisarIcones # SHCNE_ASSOCCHANGED+ try { Start-Process "$env:WINDIR\System32\ie4uinit.exe" -ArgumentList '-show' -Wait } catch {}}function Elevated($a) {- try { $p = Start-Process powershell.exe -Verb RunAs -Wait -PassThru -WindowStyle Hidden -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`" -Maquina $a"; Say "parte da máquina (administrador): saída $($p.ExitCode)" }+ try { $p = Start-Process powershell.exe -Verb RunAs -Wait -PassThru -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`" -Maquina $a"; Say "parte da máquina (administrador): saída $($p.ExitCode)" }catch { Say "parte da máquina: permissão de administrador negada ($($_.Exception.Message))" }}@@ -93,7 +96,7 @@ if ($Desfazer) {if ($it.folderAttrs) { (Get-Item $it.folder -Force).Attributes = $it.folderAttrs }Say "removido $p"}- [W.N]::SHChangeNotify(0x00001000, 0x0005 -bor 0x1000, $it.folder, [IntPtr]::Zero) # SHCNE_UPDATEDIR+ AvisarPasta $it.folder # SHCNE_UPDATEDIR}Remove-Item $bdir -Recurse -ForceAdd-Content $log -Encoding utf8 "`r`n[$(Stamp)] desktop.ini das pastas do usuário: DESFEITO (cópias originais devolvidas)."@@ -140,7 +143,7 @@ else {(Get-Item $f -Force).Attributes = (Get-Item $f -Force).Attributes -bor [IO.FileAttributes]::ReadOnly # o Windows só lê o desktop.ini de pasta marcada$list += [pscustomobject]@{ folder = $f; existed = $false; folderAttrs = $fa }}- [W.N]::SHChangeNotify(0x00001000, 0x0005 -bor 0x1000, $f, [IntPtr]::Zero)+ AvisarPasta $fSay "$p -> IconResource=$icon"}ConvertTo-Json @($list) -Depth 3 | Set-Content $bini -Encoding utf8diff --git a/tools/icones-sistema.ps1 b/tools/icones-sistema.ps1index 22e7b1f..a96d857 100644--- a/tools/icones-sistema.ps1+++ b/tools/icones-sistema.ps1@@ -15,11 +15,13 @@ $HK = [Microsoft.Win32.Registry]::CurrentUser$lines = New-Object System.Collections.Generic.List[string]function Say($s) { $lines.Add($s) }-Add-Type -Namespace W -Name N -MemberDefinition '[DllImport("shell32.dll")] public static extern void SHChangeNotify(int e, uint f, System.IntPtr a, System.IntPtr b);'+# avisar o Explorador: pelo WacOSShell.exe (modo ajudante), sem C# embutido no script+$ajudante = Join-Path $PSScriptRoot '..\bin\WacOSShell.exe'+function AvisarIcones { if (Test-Path $ajudante) { Start-Process $ajudante -ArgumentList '--avisar-icones' -Wait } }function Refresh {- [W.N]::SHChangeNotify(0x08000000, 0x1000, [IntPtr]::Zero, [IntPtr]::Zero) # SHCNE_ASSOCCHANGED, SHCNF_FLUSH- try { Start-Process "$env:WINDIR\System32\ie4uinit.exe" -ArgumentList '-show' -Wait -WindowStyle Hidden } catch {}+ AvisarIcones # SHCNE_ASSOCCHANGED, SHCNF_FLUSH+ try { Start-Process "$env:WINDIR\System32\ie4uinit.exe" -ArgumentList '-show' -Wait } catch {}}if ($Desfazer) {diff --git a/tools/musica-registrar.ps1 b/tools/musica-registrar.ps1index aa64580..dbb796f 100644--- a/tools/musica-registrar.ps1+++ b/tools/musica-registrar.ps1@@ -45,6 +45,8 @@ if ($Desfazer) {"Música registrado ($Exe)"}# avisa o Explorador que as associações mudaram-Add-Type -Namespace SQ -Name A -MemberDefinition '[DllImport("shell32.dll")] public static extern void SHChangeNotify(int e, uint f, IntPtr a, IntPtr b);'-[SQ.A]::SHChangeNotify(0x08000000, 0, [IntPtr]::Zero, [IntPtr]::Zero)+# avisar o Explorador: pelo WacOSShell.exe (modo ajudante), sem C# embutido no script+$ajudante = Join-Path $PSScriptRoot '..\bin\WacOSShell.exe'+function AvisarIcones { if (Test-Path $ajudante) { Start-Process $ajudante -ArgumentList '--avisar-icones' -Wait } }+AvisarIconesif ($AbrirAjustes -and -not $Desfazer) { Start-Process ("ms-settings:defaultapps?registeredAppUser=" + [uri]::EscapeDataString($regName)) }diff --git a/tools/quicktime-registrar.ps1 b/tools/quicktime-registrar.ps1index ddd0f13..179daf7 100644--- a/tools/quicktime-registrar.ps1+++ b/tools/quicktime-registrar.ps1@@ -45,6 +45,8 @@ if ($Desfazer) {"QuickTime registrado ($Exe)"}# avisa o Explorador que as associações mudaram-Add-Type -Namespace SQ -Name A -MemberDefinition '[DllImport("shell32.dll")] public static extern void SHChangeNotify(int e, uint f, IntPtr a, IntPtr b);'-[SQ.A]::SHChangeNotify(0x08000000, 0, [IntPtr]::Zero, [IntPtr]::Zero)+# avisar o Explorador: pelo WacOSShell.exe (modo ajudante), sem C# embutido no script+$ajudante = Join-Path $PSScriptRoot '..\bin\WacOSShell.exe'+function AvisarIcones { if (Test-Path $ajudante) { Start-Process $ajudante -ArgumentList '--avisar-icones' -Wait } }+AvisarIconesif ($AbrirAjustes -and -not $Desfazer) { Start-Process ("ms-settings:defaultapps?registeredAppUser=" + [uri]::EscapeDataString($regName)) }diff --git a/tools/recursos.ps1 b/tools/recursos.ps1index 4444865..bfc8935 100644--- a/tools/recursos.ps1+++ b/tools/recursos.ps1@@ -29,6 +29,7 @@ $itens = @('WacOSContacts|Contacts|Contacts.png','WacOSPhotos|Photos|Photos.png','WacOSTimeMachine|Time Machine|Time Machine.png',+ 'WacOSTitleBars|WacOS Title Bars|','WacOSWindow|WacOS Window Frames|','WacOSWindow32|WacOS Window Frames (32-bit)|')