Skip to content

armgit / WacOS

Public Imported from GitHub
0

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

Rust

Fix glass giving up, notification stacks, graphite buttons; add update notice

Eternity0706288a7725c18935
diff --git a/instalador/desinstalar.ps1 b/instalador/desinstalar.ps1
index 6ac3b01..e771676 100644
--- a/instalador/desinstalar.ps1
+++ b/instalador/desinstalar.ps1
@@ -106,6 +106,7 @@ if (Test-Path $log) {
}
}
Remove-Item 'HKCU:\Software\ShellProprio' -Recurse -Force -ErrorAction SilentlyContinue # cores das barras e opções da DLL das janelas
+Remove-Item 'HKCU:\Software\Classes\AppUserModelId\WacOS.Atualizacao' -Recurse -Force -ErrorAction SilentlyContinue # remetente do aviso de atualização
# QuickTime registrado como app de vídeo (tools\quicktime-registrar.ps1)
$qr = Join-Path $dest 'tools\quicktime-registrar.ps1'; if (Test-Path $qr) { & $qr -Desfazer }
# Música registrado como app de áudio (tools\musica-registrar.ps1): sai de "Abrir com" e dos apps padrão
diff --git a/src/ajustes/ajustes.h b/src/ajustes/ajustes.h
index bea69fe..1b73479 100644
--- a/src/ajustes/ajustes.h
+++ b/src/ajustes/ajustes.h
@@ -88,6 +88,7 @@ struct SideItem {
};
std::vector<SideItem>& SidebarItems();
int SidebarIndexFor(const std::wstring& idOrUri); // -1 se não houver
+void OpenUpdatePage(); // Geral > Atualização de Software (--pagina=atualizacao)
std::wstring SymbolFor(const std::wstring& label); // SF Symbol (icones\simbolos) do item, "" se não houver
// ---- sistema.cpp: o que cada página lê e muda no Windows
diff --git a/src/ajustes/main.cpp b/src/ajustes/main.cpp
index a756632..f109a8c 100644
--- a/src/ajustes/main.cpp
+++ b/src/ajustes/main.cpp
@@ -15,6 +15,7 @@
#include <mutex>
#include <cstdarg>
#include "../comum/ampliacao.h" // botão verde com a animação do ampliar do Shell
+#include "../comum/semaforo.h"
namespace {
@@ -833,7 +834,7 @@ void DrawRow(aj::Ctx& c, const aj::Row& r, D2D1_RECT_F rr, int gi, int ri) {
float SideRowsTop() { return ACCOUNT_Y + ACCOUNT_H + 10; }
void DrawLights(aj::Ctx& c) {
- static const D2D1_COLOR_F on[3] = { D2D1::ColorF(1.0f, 0.373f, 0.341f), D2D1::ColorF(0.996f, 0.737f, 0.18f), D2D1::ColorF(0.157f, 0.784f, 0.251f) };
+ static const D2D1_COLOR_F on_c[3] = { D2D1::ColorF(1.0f, 0.373f, 0.341f), D2D1::ColorF(0.996f, 0.737f, 0.18f), D2D1::ColorF(0.157f, 0.784f, 0.251f) }; const D2D1_COLOR_F* on = semaforo::Pick(on_c, semaforo::FILL);
for (int k = 0; k < 3; k++) {
D2D1_POINT_2F p{ 23 + k * 23.f, 25 }; // padrão do projeto: 14 pt, 23 entre centros
bool lit = g_winActive || g_hoverLights;
@@ -1465,6 +1466,7 @@ LRESULT CALLBACK WndProc(HWND h, UINT m, WPARAM w, LPARAM l) {
std::wstring id((const wchar_t*)cd->lpData, cd->cbData / sizeof(wchar_t));
int i = SidebarIndexFor(id);
if (i >= 0) SelectSide(i);
+ else if (id == L"atualizacao") { int g = SidebarIndexFor(L"geral"); if (g >= 0) SelectSide(g); OpenUpdatePage(); }
}
if (IsIconic(h)) ShowWindow(h, SW_RESTORE);
SetForegroundWindow(h);
@@ -1603,6 +1605,7 @@ int WINAPI wWinMain(HINSTANCE hi, HINSTANCE, LPWSTR, int) {
g_hist.push_back({ std::max(start, 0), {} });
g_histAt = 0;
ShowPage();
+ if (page == L"atualizacao") OpenUpdatePage();
// escondida (cloak) até o primeiro quadro estar pronto: sem isso a janela aparecia com a área da
// direita ainda vazia e transparente (o que estava atrás aparecia através dela por alguns quadros)
diff --git a/src/ajustes/paginas.cpp b/src/ajustes/paginas.cpp
index 39aea94..4ccf942 100644
--- a/src/ajustes/paginas.cpp
+++ b/src/ajustes/paginas.cpp
@@ -461,6 +461,9 @@ Page Atualizacao() {
} else if (u.state == 2 && u.erro.empty()) rows.push_back(Note(Tr(L"O WacOS está atualizado.")));
rows.push_back(Button(L"Confere de novo no GitHub.", L"Procurar Atualizações", [] { { std::lock_guard<std::mutex> lk(g_updMu); g_upd.state = 0; } aj::Rebuild(); }));
p.groups.push_back(G(rows, L"WacOS"));
+ p.groups.push_back(G({ Toggle(L"Avisar quando houver atualização", [] { return Setting(L"avisar_atualizacao", L"1") != L"0"; },
+ [](bool v) { SetSetting(L"avisar_atualizacao", v ? L"1" : L"0"); },
+ L"O WacOS confere o GitHub ao entrar e a cada 6 horas e mostra uma notificação quando sai uma versão nova.") }));
if (tem && !u.faltam.empty()) {
std::vector<Row> ch;
for (size_t k = 0; k < u.faltam.size() && k < 15; k++) ch.push_back(Note(L"• " + u.faltam[k]));
@@ -877,7 +880,14 @@ Page TransparenciaEfeitos() {
refr.enabled = liquid && !reduce;
refr.hasDef = true; refr.def = 0.6f;
// (o vidro real é montado pelas janelas de trás e aparece nas gravações: não há mais o que trocar para gravar)
- p.groups.push_back(G({ mat, lg, real, refr }, L"Vidro", L"Vale para o Dock, a barra de menus, os menus, a Central de Controle, o Spotlight e os painéis do Shell."));
+ Row redo = Button(L"Se o vidro ficar fosco, preto ou parado, refaz o Liquid Glass sem reiniciar o Shell.", L"Reiniciar o Liquid Glass", [] {
+ static UINT msg = RegisterWindowMessageW(L"ShellReiniciarVidro");
+ HWND sh = FindWindowExW(HWND_MESSAGE, nullptr, L"ShellMensagens", nullptr);
+ if (!sh) sh = FindWindowW(L"ShellMensagens", nullptr);
+ if (sh) PostMessageW(sh, msg, 0, 0);
+ });
+ redo.enabled = liquid && !reduce;
+ p.groups.push_back(G({ mat, lg, real, refr, redo }, L"Vidro", L"Vale para o Dock, a barra de menus, os menus, a Central de Controle, o Spotlight e os painéis do Shell."));
Row red = Toggle(L"Reduzir transparência", [] { return Setting(L"reduzir_transparencia", L"0") == L"1"; },
[](bool v) { SetSetting(L"reduzir_transparencia", v ? L"1" : L"0"); Rebuild(); },
@@ -1852,6 +1862,9 @@ std::wstring SymbolFor(const std::wstring& label) {
return L"";
}
+// --pagina=atualizacao (o aviso de versão nova do Shell): Geral > Atualização de Software
+void OpenUpdatePage() { aj::Push(L"Atualização de Software", Atualizacao); }
+
int SidebarIndexFor(const std::wstring& idOrUri) {
auto& items = SidebarItems();
std::wstring id = idOrUri;
diff --git a/src/calculadora/main.cpp b/src/calculadora/main.cpp
index 084cc59..ab8200d 100644
--- a/src/calculadora/main.cpp
+++ b/src/calculadora/main.cpp
@@ -29,6 +29,7 @@
#include "../menu/context_menu.h"
#include "../comum/ampliacao.h"
#include "../comum/idioma.h"
+#include "../comum/semaforo.h"
#pragma comment(lib, "windowscodecs.lib")
@@ -1203,9 +1204,9 @@ Pal Colors() {
void Line(ID2D1RenderTarget* rt, ID2D1Brush* b, float x1, float y1, float x2, float y2, float w) { rt->DrawLine({ x1, y1 }, { x2, y2 }, b, w, g_round); }
void DrawLights(ID2D1RenderTarget* rt, ID2D1SolidColorBrush* br) {
- static const D2D1_COLOR_F fill[3] = { D2D1::ColorF(1.0f, 0.373f, 0.345f), D2D1::ColorF(0.996f, 0.737f, 0.180f), D2D1::ColorF(0.157f, 0.784f, 0.251f) };
- static const D2D1_COLOR_F ring[3] = { D2D1::ColorF(0.886f, 0.275f, 0.247f), D2D1::ColorF(0.882f, 0.631f, 0.086f), D2D1::ColorF(0.071f, 0.675f, 0.157f) };
- static const D2D1_COLOR_F glyph[3] = { D2D1::ColorF(0.302f, 0, 0), D2D1::ColorF(0.6f, 0.341f, 0), D2D1::ColorF(0, 0.396f, 0) };
+ static const D2D1_COLOR_F fill_c[3] = { D2D1::ColorF(1.0f, 0.373f, 0.345f), D2D1::ColorF(0.996f, 0.737f, 0.180f), D2D1::ColorF(0.157f, 0.784f, 0.251f) }; const D2D1_COLOR_F* fill = semaforo::Pick(fill_c, semaforo::FILL);
+ static const D2D1_COLOR_F ring_c[3] = { D2D1::ColorF(0.886f, 0.275f, 0.247f), D2D1::ColorF(0.882f, 0.631f, 0.086f), D2D1::ColorF(0.071f, 0.675f, 0.157f) }; const D2D1_COLOR_F* ring = semaforo::Pick(ring_c, semaforo::RING);
+ static const D2D1_COLOR_F glyph_c[3] = { D2D1::ColorF(0.302f, 0, 0), D2D1::ColorF(0.6f, 0.341f, 0), D2D1::ColorF(0, 0.396f, 0) }; const D2D1_COLOR_F* glyph = semaforo::Pick(glyph_c, semaforo::GLYPH);
bool lit = g_active || g_hoverLights;
D2D1_COLOR_F off = g_dark ? Rgb(71, 76, 80) : Rgb(208, 208, 210), offRing = g_dark ? D2D1::ColorF(0, 0, 0, 0.3f) : Rgb(186, 186, 189);
for (int k = 0; k < 3; k++) {
diff --git a/src/comum/idioma_en.inc b/src/comum/idioma_en.inc
index 5e7ce9c..3cde4c3 100644
--- a/src/comum/idioma_en.inc
+++ b/src/comum/idioma_en.inc
@@ -414,6 +414,14 @@
{ L"Vidro real (refração)", L"Real glass (refraction)" },
{ L"O fundo aparece nítido e dobra nas bordas, como no Tahoe. Gravações de outros programas não mostram o Dock e os painéis; desligue para gravar a tela.", L"The background shows through sharp and bends at the edges, like in Tahoe. Recordings from other programs don’t show the Dock and panels; turn this off to record the screen." },
{ L"Refração nas bordas", L"Edge refraction" },
+{ L"Reiniciar o Liquid Glass", L"Restart Liquid Glass" },
+{ L"Atualizações Disponíveis", L"Updates Available" },
+{ L"está pronto para instalar", L"is ready to install" },
+{ L" mudança", L" change" },
+{ L" mudanças", L" changes" },
+{ L"Avisar quando houver atualização", L"Notify me when an update is available" },
+{ L"O WacOS confere o GitHub ao entrar e a cada 6 horas e mostra uma notificação quando sai uma versão nova.", L"WacOS checks GitHub at sign-in and every 6 hours and shows a notification when a new version is out." },
+{ L"Se o vidro ficar fosco, preto ou parado, refaz o Liquid Glass sem reiniciar o Shell.", L"If the glass turns frosted, black or frozen, this rebuilds Liquid Glass without restarting the Shell." },
{ L"Nenhum", L"None" },
{ L"Forte", L"Strong" },
{ L"Aparecer em gravações e transmissões", L"Show in recordings and streams" },
diff --git a/src/comum/semaforo.h b/src/comum/semaforo.h
new file mode 100644
index 0000000..74b0a95
--- /dev/null
+++ b/src/comum/semaforo.h
@@ -0,0 +1,51 @@
+#pragma once
+// Cores dos botões da janela (fechar, minimizar, zoom). Com a cor de destaque Grafite (Ajustes > Aparência,
+// `destaque=grafite` em %APPDATA%\Shell\ajustes.txt) os três ficam cinza, como no Mac.
+// Uso: static const D2D1_COLOR_F fill_c[3] = {...}; const D2D1_COLOR_F* fill = semaforo::Pick(fill_c, semaforo::FILL);
+// O arquivo é relido quando muda (no máximo a cada 0,5 s): trocar a cor no Ajustes chega no próximo desenho.
+#include <windows.h>
+#include <d2d1.h>
+#include <cstdio>
+#include <cwchar>
+#include <string>
+
+namespace semaforo {
+
+enum Kind { FILL, RING, GLYPH };
+
+inline bool Grafite() {
+ static bool on = false;
+ static DWORD lastCheck = 0;
+ static FILETIME lastWrite{};
+ DWORD now = GetTickCount();
+ if (lastCheck && now - lastCheck < 500) return on;
+ lastCheck = now;
+ wchar_t ad[MAX_PATH];
+ DWORD n = GetEnvironmentVariableW(L"APPDATA", ad, MAX_PATH);
+ if (!n || n >= MAX_PATH) return on;
+ std::wstring path = std::wstring(ad) + L"\Shell\ajustes.txt";
+ WIN32_FILE_ATTRIBUTE_DATA fa{};
+ if (!GetFileAttributesExW(path.c_str(), GetFileExInfoStandard, &fa)) return on;
+ if (!CompareFileTime(&fa.ftLastWriteTime, &lastWrite)) return on;
+ lastWrite = fa.ftLastWriteTime;
+ FILE* f = nullptr;
+ if (_wfopen_s(&f, path.c_str(), L"r, ccs=UTF-8") || !f) return on;
+ bool g = false;
+ wchar_t line[512];
+ while (fgetws(line, 512, f)) if (wcsncmp(line, L"destaque=", 9) == 0) g = wcsncmp(line + 9, L"grafite", 7) == 0;
+ fclose(f);
+ on = g;
+ return on;
+}
+
+inline const D2D1_COLOR_F* Pick(const D2D1_COLOR_F* normal, Kind k) {
+ if (!Grafite()) return normal;
+ static const D2D1_COLOR_F fill[3] = { { 0.58f, 0.58f, 0.59f, 1 }, { 0.58f, 0.58f, 0.59f, 1 }, { 0.58f, 0.58f, 0.59f, 1 } };
+ static const D2D1_COLOR_F ring[3] = { { 0.47f, 0.47f, 0.48f, 1 }, { 0.47f, 0.47f, 0.48f, 1 }, { 0.47f, 0.47f, 0.48f, 1 } };
+ static const D2D1_COLOR_F glyph[3] = { { 0.20f, 0.20f, 0.21f, 1 }, { 0.20f, 0.20f, 0.21f, 1 }, { 0.20f, 0.20f, 0.21f, 1 } };
+ return k == FILL ? fill : k == RING ? ring : glyph;
+}
+
+inline D2D1_COLOR_F Close() { static const D2D1_COLOR_F c[3] = { { 1.0f, 0.373f, 0.341f, 1 } }; return Pick(c, FILL)[0]; }
+
+} // namespace semaforo
diff --git a/src/finder/info.cpp b/src/finder/info.cpp
index 6ddf139..11fda29 100644
--- a/src/finder/info.cpp
+++ b/src/finder/info.cpp
@@ -21,6 +21,7 @@
#include <mutex>
#include <thread>
#include "../comum/idioma.h"
+#include "../comum/semaforo.h"
namespace {
@@ -439,8 +440,8 @@ void Paint(Info& in) {
D2D1_COLOR_F line = dark ? D2D1::ColorF(1, 1, 1, 0.10f) : D2D1::ColorF(0, 0, 0, 0.10f);
// bolinhas: fechar e minimizar ativas; ampliar desligada (a janela tem tamanho fixo)
- static const D2D1_COLOR_F fill[3] = { D2D1::ColorF(1.0f, 0.373f, 0.345f), D2D1::ColorF(0.996f, 0.737f, 0.180f), D2D1::ColorF(0.157f, 0.784f, 0.251f) };
- static const D2D1_COLOR_F ring[3] = { D2D1::ColorF(0.886f, 0.275f, 0.247f), D2D1::ColorF(0.882f, 0.631f, 0.086f), D2D1::ColorF(0.071f, 0.675f, 0.157f) };
+ static const D2D1_COLOR_F fill_c[3] = { D2D1::ColorF(1.0f, 0.373f, 0.345f), D2D1::ColorF(0.996f, 0.737f, 0.180f), D2D1::ColorF(0.157f, 0.784f, 0.251f) }; const D2D1_COLOR_F* fill = semaforo::Pick(fill_c, semaforo::FILL);
+ static const D2D1_COLOR_F ring_c[3] = { D2D1::ColorF(0.886f, 0.275f, 0.247f), D2D1::ColorF(0.882f, 0.631f, 0.086f), D2D1::ColorF(0.071f, 0.675f, 0.157f) }; const D2D1_COLOR_F* ring = semaforo::Pick(ring_c, semaforo::RING);
for (int k = 0; k < 3; k++) {
D2D1_POINT_2F c{ 19.f + k * 23, 14 }; // padrão do projeto: 14 pt, 23 entre centros
bool lit = k < 2 && (in.active || in.hoverLights);
@@ -449,7 +450,7 @@ void Paint(Info& in) {
br->SetColor(lit ? ring[k] : dark ? D2D1::ColorF(0, 0, 0, 0.3f) : D2D1::ColorF(0.73f, 0.73f, 0.74f));
rt->DrawEllipse(D2D1::Ellipse(c, 6.75f, 6.75f), br, 0.5f);
if (in.hoverLights && k < 2) {
- br->SetColor(k == 0 ? D2D1::ColorF(0.302f, 0, 0) : D2D1::ColorF(0.6f, 0.341f, 0));
+ br->SetColor(semaforo::Grafite() ? D2D1::ColorF(0.20f, 0.20f, 0.21f) : k == 0 ? D2D1::ColorF(0.302f, 0, 0) : D2D1::ColorF(0.6f, 0.341f, 0));
if (k == 0) { rt->DrawLine({ c.x - 2.5f, c.y - 2.5f }, { c.x + 2.5f, c.y + 2.5f }, br, 1.1f); rt->DrawLine({ c.x - 2.5f, c.y + 2.5f }, { c.x + 2.5f, c.y - 2.5f }, br, 1.1f); }
else rt->DrawLine({ c.x - 3.3f, c.y }, { c.x + 3.3f, c.y }, br, 1.2f);
}
diff --git a/src/finder/main.cpp b/src/finder/main.cpp
index e7eeaa7..5b113fb 100644
--- a/src/finder/main.cpp
+++ b/src/finder/main.cpp
@@ -39,6 +39,7 @@
#include "../comum/vidro.h"
#include "pastacor.h" // Personalizar Pasta: cor e símbolo
#include "../comum/abrircom.h" // áudio abre no Música
+#include "../comum/semaforo.h"
#pragma comment(linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
@@ -2043,9 +2044,9 @@ static void DrawDocument(ID2D1DeviceContext* dc, D2D1_RECT_F box, const std::wst
static void DrawLights(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br) {
// cores do macOS medidas na referência: preenchimento e aro de 0,5 pt um tom abaixo
- static const D2D1_COLOR_F fill[3] = { D2D1::ColorF(1.0f, 0.373f, 0.345f), D2D1::ColorF(0.996f, 0.737f, 0.180f), D2D1::ColorF(0.157f, 0.784f, 0.251f) };
- static const D2D1_COLOR_F ring[3] = { D2D1::ColorF(0.886f, 0.275f, 0.247f), D2D1::ColorF(0.882f, 0.631f, 0.086f), D2D1::ColorF(0.071f, 0.675f, 0.157f) };
- static const D2D1_COLOR_F glyph[3] = { D2D1::ColorF(0.302f, 0.0f, 0.0f), D2D1::ColorF(0.600f, 0.341f, 0.0f), D2D1::ColorF(0.0f, 0.396f, 0.0f) };
+ static const D2D1_COLOR_F fill_c[3] = { D2D1::ColorF(1.0f, 0.373f, 0.345f), D2D1::ColorF(0.996f, 0.737f, 0.180f), D2D1::ColorF(0.157f, 0.784f, 0.251f) }; const D2D1_COLOR_F* fill = semaforo::Pick(fill_c, semaforo::FILL);
+ static const D2D1_COLOR_F ring_c[3] = { D2D1::ColorF(0.886f, 0.275f, 0.247f), D2D1::ColorF(0.882f, 0.631f, 0.086f), D2D1::ColorF(0.071f, 0.675f, 0.157f) }; const D2D1_COLOR_F* ring = semaforo::Pick(ring_c, semaforo::RING);
+ static const D2D1_COLOR_F glyph_c[3] = { D2D1::ColorF(0.302f, 0.0f, 0.0f), D2D1::ColorF(0.600f, 0.341f, 0.0f), D2D1::ColorF(0.0f, 0.396f, 0.0f) }; const D2D1_COLOR_F* glyph = semaforo::Pick(glyph_c, semaforo::GLYPH);
bool lit = g_winActive || g_hoverLights;
ID2D1Factory* f = nullptr; dc->GetFactory(&f);
for (int k = 0; k < 3; k++) {
diff --git a/src/janelas/macjanela.cpp b/src/janelas/macjanela.cpp
index e5610e1..796dfb5 100644
--- a/src/janelas/macjanela.cpp
+++ b/src/janelas/macjanela.cpp
@@ -18,6 +18,7 @@
#include <cmath>
#include <map>
#include "../comum/sombra.h"
+#include "../comum/semaforo.h"
#pragma comment(lib, "comctl32.lib")
#pragma comment(lib, "uxtheme.lib")
@@ -208,7 +209,7 @@ void Paint(Info* in) {
fill(in->rightColor, D2D1::RectF(W - PATCH_R, 0, W, H), false);
}
// os três botões no tamanho padrão do projeto (o do Monitor de Atividade): 14 pt, 23 pt entre centros
- static const D2D1_COLOR_F on[3] = { D2D1::ColorF(1.0f, 0.373f, 0.341f), D2D1::ColorF(0.996f, 0.737f, 0.18f), D2D1::ColorF(0.157f, 0.784f, 0.251f) };
+ static const D2D1_COLOR_F on_c[3] = { D2D1::ColorF(1.0f, 0.373f, 0.341f), D2D1::ColorF(0.996f, 0.737f, 0.18f), D2D1::ColorF(0.157f, 0.784f, 0.251f) }; const D2D1_COLOR_F* on = semaforo::Pick(on_c, semaforo::FILL);
LONG st = in->style;
bool can[3] = { true, (st & WS_MINIMIZEBOX) != 0, (st & WS_MAXIMIZEBOX) != 0 };
float lx0 = in->tool ? 14.f : 19.f, lpitch = in->tool ? 20.f : 23.f, lr = in->tool ? 6.f : 7.f;
diff --git a/src/monitor/main.cpp b/src/monitor/main.cpp
index f4d1493..a6ba45a 100644
--- a/src/monitor/main.cpp
+++ b/src/monitor/main.cpp
@@ -41,6 +41,7 @@
#include "../comum/ampliacao.h" // botão verde com a animação do ampliar do Shell
#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"
// 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
@@ -751,9 +752,9 @@ D2D1_POINT_2F LightCenter(int k) { return { 26.f + k * 23, 25 }; } // como na r
void 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); }
void DrawLights(ID2D1RenderTarget* rt, ID2D1SolidColorBrush* br) {
- static const D2D1_COLOR_F fill[3] = { D2D1::ColorF(1.0f, 0.373f, 0.345f), D2D1::ColorF(0.996f, 0.737f, 0.180f), D2D1::ColorF(0.157f, 0.784f, 0.251f) };
- static const D2D1_COLOR_F ring[3] = { D2D1::ColorF(0.886f, 0.275f, 0.247f), D2D1::ColorF(0.882f, 0.631f, 0.086f), D2D1::ColorF(0.071f, 0.675f, 0.157f) };
- static const D2D1_COLOR_F glyph[3] = { D2D1::ColorF(0.302f, 0, 0), D2D1::ColorF(0.6f, 0.341f, 0), D2D1::ColorF(0, 0.396f, 0) };
+ static const D2D1_COLOR_F fill_c[3] = { D2D1::ColorF(1.0f, 0.373f, 0.345f), D2D1::ColorF(0.996f, 0.737f, 0.180f), D2D1::ColorF(0.157f, 0.784f, 0.251f) }; const D2D1_COLOR_F* fill = semaforo::Pick(fill_c, semaforo::FILL);
+ static const D2D1_COLOR_F ring_c[3] = { D2D1::ColorF(0.886f, 0.275f, 0.247f), D2D1::ColorF(0.882f, 0.631f, 0.086f), D2D1::ColorF(0.071f, 0.675f, 0.157f) }; const D2D1_COLOR_F* ring = semaforo::Pick(ring_c, semaforo::RING);
+ static const D2D1_COLOR_F glyph_c[3] = { D2D1::ColorF(0.302f, 0, 0), D2D1::ColorF(0.6f, 0.341f, 0), D2D1::ColorF(0, 0.396f, 0) }; const D2D1_COLOR_F* glyph = semaforo::Pick(glyph_c, semaforo::GLYPH);
bool lit = g_active || g_hoverLights;
for (int k = 0; k < 3; k++) {
auto c = LightCenter(k);
diff --git a/src/notas/main.cpp b/src/notas/main.cpp
index 10ae20a..c6abb5a 100644
--- a/src/notas/main.cpp
+++ b/src/notas/main.cpp
@@ -21,6 +21,7 @@
#include "../comum/simbolos.h"
#include "../comum/ampliacao.h" // botão verde com a animação do ampliar do Shell
#include "../comum/idioma.h"
+#include "../comum/semaforo.h"
#pragma comment(lib, "imm32.lib")
#pragma comment(lib, "windowscodecs.lib")
@@ -405,9 +406,9 @@ void Chevron(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, float cx, float c
}
void DrawLights(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br) {
- static const D2D1_COLOR_F fill[3] = { D2D1::ColorF(1.0f, 0.373f, 0.345f), D2D1::ColorF(0.996f, 0.737f, 0.180f), D2D1::ColorF(0.157f, 0.784f, 0.251f) };
- static const D2D1_COLOR_F ring[3] = { D2D1::ColorF(0.886f, 0.275f, 0.247f), D2D1::ColorF(0.882f, 0.631f, 0.086f), D2D1::ColorF(0.071f, 0.675f, 0.157f) };
- static const D2D1_COLOR_F glyph[3] = { D2D1::ColorF(0.302f, 0, 0), D2D1::ColorF(0.6f, 0.341f, 0), D2D1::ColorF(0, 0.396f, 0) };
+ static const D2D1_COLOR_F fill_c[3] = { D2D1::ColorF(1.0f, 0.373f, 0.345f), D2D1::ColorF(0.996f, 0.737f, 0.180f), D2D1::ColorF(0.157f, 0.784f, 0.251f) }; const D2D1_COLOR_F* fill = semaforo::Pick(fill_c, semaforo::FILL);
+ static const D2D1_COLOR_F ring_c[3] = { D2D1::ColorF(0.886f, 0.275f, 0.247f), D2D1::ColorF(0.882f, 0.631f, 0.086f), D2D1::ColorF(0.071f, 0.675f, 0.157f) }; const D2D1_COLOR_F* ring = semaforo::Pick(ring_c, semaforo::RING);
+ static const D2D1_COLOR_F glyph_c[3] = { D2D1::ColorF(0.302f, 0, 0), D2D1::ColorF(0.6f, 0.341f, 0), D2D1::ColorF(0, 0.396f, 0) }; const D2D1_COLOR_F* glyph = semaforo::Pick(glyph_c, semaforo::GLYPH);
bool lit = g_active || g_hoverLights;
for (int k = 0; k < 3; k++) {
auto c = LightCenter(k);
diff --git a/src/shell/ampliar.cpp b/src/shell/ampliar.cpp
index 2696b3e..9f1b61a 100644
--- a/src/shell/ampliar.cpp
+++ b/src/shell/ampliar.cpp
@@ -11,6 +11,7 @@
#include <map>
#include <dwmapi.h>
#include <cmath>
+#include "../comum/semaforo.h"
namespace {
@@ -218,7 +219,7 @@ void DrawChrome(ID2D1DeviceContext* dc, HWND h, UINT w, UINT hh, const std::vect
if (!b) return;
bool tool = (flags & 2) != 0;
float x0 = (tool ? 14.f : 19.f) * sc, pitch = (tool ? 20.f : 23.f) * sc, r = (tool ? 6.f : 7.f) * sc;
- const D2D1_COLOR_F on[3] = { D2D1::ColorF(1.0f, 0.373f, 0.341f), D2D1::ColorF(0.996f, 0.737f, 0.18f), D2D1::ColorF(0.157f, 0.784f, 0.251f) };
+ static const D2D1_COLOR_F on_c[3] = { D2D1::ColorF(1.0f, 0.373f, 0.341f), D2D1::ColorF(0.996f, 0.737f, 0.18f), D2D1::ColorF(0.157f, 0.784f, 0.251f) }; const D2D1_COLOR_F* on = semaforo::Pick(on_c, semaforo::FILL);
for (int k = 0; k < 3; k++) {
D2D1_POINT_2F p{ x0 + k * pitch, cap / 2 };
b->SetColor(on[k]);
diff --git a/src/shell/atualizacao.cpp b/src/shell/atualizacao.cpp
new file mode 100644
index 0000000..cd59bb2
--- /dev/null
+++ b/src/shell/atualizacao.cpp
@@ -0,0 +1,129 @@
+// Aviso de atualização (Ajustes do Sistema > Geral > Atualização de Software > "Avisar quando houver atualização",
+// ajuste avisar_atualizacao, ligado por padrão): 90 s depois de entrar e a cada 6 horas o Shell roda
+// tools\atualizar-github.ps1 -Verificar numa thread. Se o GitHub tem uma versão mais nova que a instalada
+// (bin\versao.txt), mostra uma notificação "Atualizações Disponíveis" uma vez por versão (atualizacao_avisada=).
+// Clicar nela abre o Ajustes na página de Atualização de Software (notificacoes.cpp, OpenApp).
+//
+// A notificação é do Windows (vira o banner do Mac pela Central de Notificações): o remetente é o AUMID
+// WacOS.Atualizacao, registrado em HKCU\Software\Classes\AppUserModelId\WacOS.Atualizacao (nome e ícone que o
+// Windows mostra). O desinstalador apaga essa chave.
+#include "shell.h"
+#include "../comum/idioma.h"
+#include <winrt/Windows.Foundation.h>
+#include <winrt/Windows.Data.Xml.Dom.h>
+#include <winrt/Windows.UI.Notifications.h>
+#include <mutex>
+#include <string>
+#include <thread>
+
+namespace {
+
+const wchar_t* AUMID = L"WacOS.Atualizacao";
+HWND g_to = nullptr;
+UINT g_msg = 0;
+std::mutex g_mx;
+std::wstring g_atual, g_novo;
+int g_mudancas = 0;
+
+std::wstring Root() { return shell::dir.substr(0, shell::dir.find_last_of(L'\\')); }
+
+// Uma checagem (≈ 2 a 10 s, rede): atual= e novo= do script
+void Checar() {
+ std::wstring script = Root() + L"\\tools\\atualizar-github.ps1";
+ if (GetFileAttributesW(script.c_str()) == INVALID_FILE_ATTRIBUTES) return;
+ wchar_t tmp[MAX_PATH], f[MAX_PATH];
+ GetTempPathW(MAX_PATH, tmp);
+ if (!GetTempFileNameW(tmp, L"wau", 0, f)) return;
+ std::wstring cmd = L"powershell.exe -NoProfile -ExecutionPolicy Bypass -File \"" + script + L"\" -Verificar -Saida \"" + f + L"\" -Bin \"" + shell::dir + L"\"";
+ STARTUPINFOW si{ sizeof(si) }; PROCESS_INFORMATION pi{};
+ if (!CreateProcessW(nullptr, cmd.data(), nullptr, nullptr, FALSE, CREATE_NO_WINDOW | BELOW_NORMAL_PRIORITY_CLASS, nullptr, nullptr, &si, &pi)) { DeleteFileW(f); return; }
+ WaitForSingleObject(pi.hProcess, 60000);
+ CloseHandle(pi.hThread); CloseHandle(pi.hProcess);
+ std::wstring atual, novo, erro;
+ int n = 0;
+ FILE* fp = nullptr;
+ if (!_wfopen_s(&fp, f, L"r, ccs=UTF-8") && fp) {
+ wchar_t line[1024];
+ while (fgetws(line, 1024, fp)) {
+ std::wstring l = line;
+ while (!l.empty() && (l.back() == L'\n' || l.back() == L'\r')) l.pop_back();
+ if (!l.empty() && l[0] == 0xFEFF) l.erase(0, 1);
+ if (l.rfind(L"atual=", 0) == 0) atual = l.substr(6);
+ else if (l.rfind(L"novo=", 0) == 0) novo = l.substr(5);
+ else if (l.rfind(L"erro=", 0) == 0) erro = l.substr(5);
+ else if (l.rfind(L"commit=", 0) == 0) n++;
+ }
+ fclose(fp);
+ }
+ DeleteFileW(f);
+ if (!erro.empty() || novo.empty() || novo == atual) {
+ if (!erro.empty()) Log(L"atualização: não deu para conferir (%ls)", erro.c_str());
+ return;
+ }
+ {
+ std::lock_guard<std::mutex> lk(g_mx);
+ g_atual = atual; g_novo = novo; g_mudancas = n;
+ }
+ PostMessageW(g_to, g_msg, 0, 0);
+}
+
+void Registrar() {
+ std::wstring key = std::wstring(L"Software\\Classes\\AppUserModelId\\") + AUMID;
+ HKEY k = nullptr;
+ DWORD disp = 0;
+ if (RegCreateKeyExW(HKEY_CURRENT_USER, key.c_str(), 0, nullptr, 0, KEY_SET_VALUE, nullptr, &k, &disp)) return;
+ std::wstring name = Tr(L"Ajustes do Sistema");
+ RegSetValueExW(k, L"DisplayName", 0, REG_SZ, (const BYTE*)name.c_str(), (DWORD)((name.size() + 1) * sizeof(wchar_t)));
+ std::wstring icon = Root() + L"\\icones\\tahoe\\Settings.png";
+ if (GetFileAttributesW(icon.c_str()) != INVALID_FILE_ATTRIBUTES)
+ RegSetValueExW(k, L"IconUri", 0, REG_SZ, (const BYTE*)icon.c_str(), (DWORD)((icon.size() + 1) * sizeof(wchar_t)));
+ RegCloseKey(k);
+ if (disp == REG_CREATED_NEW_KEY) Log(L"registro: criada HKCU\\%ls (remetente do aviso de atualização)", key.c_str());
+}
+
+std::wstring Xml(const std::wstring& s) {
+ std::wstring o;
+ for (wchar_t c : s) {
+ if (c == L'&') o += L"&amp;"; else if (c == L'<') o += L"&lt;"; else if (c == L'>') o += L"&gt;"; else if (c == L'"') o += L"&quot;"; else o += c;
+ }
+ return o;
+}
+
+} // namespace
+
+void atualizacao::Start(HWND msgWnd) {
+ g_to = msgWnd;
+ g_msg = RegisterWindowMessageW(L"ShellAtualizacaoDisponivel");
+ std::thread([] {
+ Sleep(90 * 1000); // depois de entrar: não disputa a rede e o disco com o login
+ for (;;) {
+ try { Checar(); } catch (...) {}
+ Sleep(6 * 60 * 60 * 1000);
+ }
+ }).detach();
+}
+
+bool atualizacao::Handle(UINT m) {
+ if (!g_msg || m != g_msg) return false;
+ std::wstring atual, novo;
+ int n = 0;
+ { std::lock_guard<std::mutex> lk(g_mx); atual = g_atual; novo = g_novo; n = g_mudancas; }
+ if (novo.empty()) return true;
+ if (shell::Setting(L"avisar_atualizacao", L"1") == L"0") return true;
+ if (shell::Setting(L"atualizacao_avisada", L"") == novo) return true; // uma vez por versão
+ shell::SetSetting(L"atualizacao_avisada", novo);
+ Log(L"atualização: %ls disponível (instalada %ls, %d mudanças)", novo.c_str(), atual.c_str(), n);
+ Registrar();
+ std::wstring corpo = n > 0 ? (L"WacOS " + novo + L" " + Tr(L"está pronto para instalar") + L" (" + std::to_wstring(n) + (n == 1 ? Tr(L" mudança") : Tr(L" mudanças")) + L").")
+ : (L"WacOS " + novo + L" " + Tr(L"está pronto para instalar") + L".");
+ std::wstring xml = L"<toast launch=\"atualizacao\"><visual><binding template=\"ToastGeneric\"><text>" + Xml(Tr(L"Atualizações Disponíveis")) +
+ L"</text><text>" + Xml(corpo) + L"</text></binding></visual></toast>";
+ try {
+ winrt::Windows::Data::Xml::Dom::XmlDocument doc;
+ doc.LoadXml(xml);
+ winrt::Windows::UI::Notifications::ToastNotificationManager::CreateToastNotifier(AUMID).Show(winrt::Windows::UI::Notifications::ToastNotification(doc));
+ } catch (winrt::hresult_error const& e) {
+ Log(L"atualização: notificação recusada (0x%08X %ls)", (unsigned)e.code(), e.message().c_str());
+ } catch (...) {}
+ return true;
+}
diff --git a/src/shell/backdrop.cpp b/src/shell/backdrop.cpp
index 59ca843..a9065a9 100644
--- a/src/shell/backdrop.cpp
+++ b/src/shell/backdrop.cpp
@@ -630,12 +630,14 @@ std::mutex readyMx;
std::vector<std::pair<HWND, std::shared_ptr<WinCap>>> ready; // abertas pela thread (nullptr = recusada)
std::vector<HWND> pending;
+bool capJaFuncionou = false; // alguma montagem já teve janela com quadro (a captura funciona neste PC)
+
void RefreshWindows() {
{ // sem captura nenhuma (todas recusadas, nenhuma aberta) por 3 s: também desiste
static DWORD semCaps = 0;
if (!caps.empty() || capFailed.empty()) semCaps = 0;
else if (!semCaps) semCaps = GetTickCount();
- else if (GetTickCount() - semCaps > 3000) semCaptura = true;
+ else if (GetTickCount() - semCaps > 3000 && !capJaFuncionou) semCaptura = true;
}
std::vector<std::pair<HWND, std::shared_ptr<WinCap>>> got;
{ std::lock_guard<std::mutex> lk(readyMx); got.swap(ready); }
@@ -645,7 +647,7 @@ void RefreshWindows() {
if (!capFailed.count(h)) { wchar_t cl[64] = {}; GetClassNameW(h, cl, 64); Log(L"vidro real: captura recusada para %ls", cl); }
{ // a mesa (o papel de parede) é o fundo de quase tudo: sem ela o vidro fica preto onde não há janela atrás
wchar_t cl[64] = {}; GetClassNameW(h, cl, 64);
- if (!wcscmp(cl, L"SequoiaMesa") || !wcscmp(cl, L"Progman") || !wcscmp(cl, L"WorkerW")) semCaptura = true;
+ if (!capJaFuncionou && (!wcscmp(cl, L"SequoiaMesa") || !wcscmp(cl, L"Progman") || !wcscmp(cl, L"WorkerW"))) semCaptura = true;
}
capFailed[h] = GetTickCount();
}
@@ -840,9 +842,11 @@ void Compose() {
{ // nenhuma janela entregou quadro (captura de janelas recusada: VM, área remota, política): o fundo do vidro
// ficaria PRETO (Dock, barra de menus e painéis pretos). Depois de 3 s assim, o vidro real desiste e volta o fosco.
static DWORD vazio = 0;
- if (!keep.empty()) vazio = 0;
+ // Só desiste se a captura NUNCA funcionou: com ela já funcionando, um fundo vazio é passageiro (a Captura
+ // de Tela, um jogo em tela cheia ou o bloqueio cobrindo tudo) e antes desligava o vidro até reiniciar.
+ if (!keep.empty()) { vazio = 0; capJaFuncionou = true; }
else if (!vazio) vazio = GetTickCount();
- else if (GetTickCount() - vazio > 3000) semCaptura = true;
+ else if (GetTickCount() - vazio > 3000 && !capJaFuncionou) semCaptura = true;
}
static size_t lastN = (size_t)-1;
if (caps.size() != lastN || FAILED(hr)) { // só quando muda o número de janelas (antes logava ~1,5 vez por segundo)
@@ -1203,8 +1207,8 @@ void DrawPiece(ID2D1DeviceContext* dc, float ox, float oy, float sx, float sy, f
cm._44 = 1.f / 3.f;
ms[k]->SetInputEffect(0, ds[k]);
ms[k]->SetValue(D2D1_COLORMATRIX_PROP_COLOR_MATRIX, cm);
- ms[k]->SetValue(D2D1_COLORMATRIX_PROP_ALPHA_MODE, D2D1_COLORMATRIX_ALPHA_MODE_STRAIGHT); // a matriz direto nos valores pré-multiplicados: somados dão (R, G, B, alfa).
- // (com PREMULTIPLIED o efeito desfaz e refaz o pré-multiplicado e cada canal saía com 1/3: o vidro inteiro ficava
+ ms[k]->SetValue(D2D1_COLORMATRIX_PROP_ALPHA_MODE, D2D1_COLORMATRIX_ALPHA_MODE_STRAIGHT); // a matriz direto nos valores pré-multiplicados: somados dão (R, G, B, alfa).
+ // (com PREMULTIPLIED o efeito desfaz e refaz o pré-multiplicado e cada canal saía com 1/3: o vidro inteiro ficava
// escuro e "tingido", 17/11/2026)
dc->DrawImage(ms[k], D2D1::Point2F(ox, oy), D2D1::RectF(sx, sy, sx + w, sy + h), D2D1_INTERPOLATION_MODE_LINEAR,
k == 0 ? D2D1_COMPOSITE_MODE_SOURCE_OVER : D2D1_COMPOSITE_MODE_PLUS);
@@ -1216,7 +1220,9 @@ void DrawPiece(ID2D1DeviceContext* dc, float ox, float oy, float sx, float sy, f
D2D1_COLOR_F t = backdrop::AdjustTint(tint);
// peças com texto (Spotlight, Central): a tinta não some com a "Transparência do vidro" no mínimo,
// senão o texto fica sobre o fundo quase nítido e não dá para ler
- if (minFrost > 0) t.a = std::max(t.a, tint.a * std::min(0.8f, 0.25f + 1.1f * g_style.tintK)); // texto: no mínimo 25 %
+ // (17/11/2026, o usuário: o painel de Apps sobre uma página branca ficou branco, nomes ilegíveis): no mínimo 70 %
+ // da tinta normal; daí para cima segue o slider
+ if (minFrost > 0) t.a = std::max(t.a, tint.a * std::min(1.f, 0.70f + 0.6f * g_style.tintK));
dc->CreateSolidColorBrush(t, &b);
if (b) { dc->FillRectangle(D2D1::RectF(ox, oy, ox + w, oy + h), b); b->Release(); }
}
@@ -1318,6 +1324,14 @@ void Use(Entry& e, bool want) {
const backdrop::Style& backdrop::Current() { return g_style; }
bool backdrop::Liquid() { return g_style.liquid && !g_style.reduce; }
+void backdrop::Restart() {
+ Log(L"vidro real: reiniciado pelo usuário (estava %ls%ls)", rg::active ? L"ligado" : L"desligado", rg::semCaptura ? L", desistido" : L"");
+ rg::semCaptura = false;
+ rg::capJaFuncionou = false;
+ if (rg::active) rg::SetActive(false); // fecha todas as capturas; o Reload abre de novo
+ Reload();
+}
+
void backdrop::Reload() {
Style s;
s.liquid = shell::Setting(L"liquid_glass", L"0") == L"1";
@@ -1354,8 +1368,8 @@ void backdrop::Reload() {
float backdrop::AdjustAlpha(float a) {
const auto& st = g_style;
// tinta do vidro: 0 = mais transparente, 0,5 = a de cada janela, 1 = bem mais opaco
- // 0 = totalmente transparente (17/11/2026, o usuário: "deixe o slider fazer ele ficar totalmente transparente");
- // antes o mínimo ainda deixava 35 % da tinta
+ // 0 = totalmente transparente (17/11/2026, o usuário: "deixe o slider fazer ele ficar totalmente transparente");
+ // antes o mínimo ainda deixava 35 % da tinta
if (st.tintK < 0.5f) a *= 2 * st.tintK;
else a += (1 - a) * (st.tintK - 0.5f) * 1.4f;
// Reduzir transparência: no Tahoe cor sólida, nada do fundo (medido no macOS 26: a ≈ 0; guia, seção 60); no Sequoia
diff --git a/src/shell/barras.cpp b/src/shell/barras.cpp
index 4603d25..2507872 100644
--- a/src/shell/barras.cpp
+++ b/src/shell/barras.cpp
@@ -37,6 +37,7 @@
#include <thread>
#include <vector>
#include <uiautomation.h>
+#include "../comum/semaforo.h"
namespace {
@@ -287,7 +288,7 @@ void Pintar(Info& in) {
rt->PopAxisAlignedClip();
}
// os três botões
- static const D2D1_COLOR_F on[3] = { D2D1::ColorF(1.0f, 0.373f, 0.341f), D2D1::ColorF(0.996f, 0.737f, 0.18f), D2D1::ColorF(0.157f, 0.784f, 0.251f) };
+ static const D2D1_COLOR_F on_c[3] = { D2D1::ColorF(1.0f, 0.373f, 0.341f), D2D1::ColorF(0.996f, 0.737f, 0.18f), D2D1::ColorF(0.157f, 0.784f, 0.251f) }; const D2D1_COLOR_F* on = semaforo::Pick(on_c, semaforo::FILL);
bool can[3] = { true, (in.estilo & WS_MINIMIZEBOX) != 0, (in.estilo & WS_MAXIMIZEBOX) != 0 };
for (int k = 0; k < 3; k++) {
D2D1_POINT_2F c{ LX0 + k * LPITCH, H / 2 };
diff --git a/src/shell/main.cpp b/src/shell/main.cpp
index ff62260..a8a3a63 100644
--- a/src/shell/main.cpp
+++ b/src/shell/main.cpp
@@ -685,6 +685,10 @@ static LRESULT CALLBACK MsgProc(HWND h, UINT m, WPARAM w, LPARAM l) {
if (att) AttachThreadInput(me, ft, FALSE);
return 0;
}
+ if (atualizacao::Handle(m)) return 0;
+ // Ajustes > Aparência > "Reiniciar o Liquid Glass": refaz o vidro real do zero (se ele desistiu ou travou)
+ static UINT redoGlass = RegisterWindowMessageW(L"ShellReiniciarVidro");
+ if (m == redoGlass && redoGlass) { backdrop::Restart(); return 1; }
static UINT capVis = RegisterWindowMessageW(L"ShellCapturaVisivel"); // a Captura de Tela vai tirar a foto
if (m == capVis && capVis) { backdrop::CaptureVisible(w != 0); return 1; }
if (m == WM_COPYDATA && l && ((COPYDATASTRUCT*)l)->dwData == 0x4C504150 /*'PAPL'*/) { // Ajustes: papel de parede escolhido
@@ -957,6 +961,7 @@ int WINAPI wWinMain(HINSTANCE hi, HINSTANCE, PWSTR, int) {
RegisterClassW(&mc);
g_msg = CreateWindowExW(WS_EX_TOOLWINDOW, mc.lpszClassName, L"", WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, hi, nullptr);
apps::ours.push_back(g_msg);
+ atualizacao::Start(g_msg); // aviso de versão nova no GitHub (90 s depois e a cada 6 h)
boot::Progress(0.2f);
if (!menubar::Create(hi) || !dock::Create(hi) || !launchpad::Create(hi) || !missioncontrol::Create(hi) || !central::Create(hi) || !spotlight::Create(hi) || !alertas::Create(hi) || !sobre::Create(hi) || !seletor::Create(hi) || !som::Create(hi)) { Log(L"erro criando as janelas"); Restore(); return 1; }
@@ -1047,6 +1052,7 @@ int shell::RodarNativo(HINSTANCE hi, const std::wstring& dirBin, const std::wstr
RegisterClassW(&mc);
g_msg = CreateWindowExW(WS_EX_TOOLWINDOW, mc.lpszClassName, L"", WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, hi, nullptr);
apps::ours.push_back(g_msg);
+ atualizacao::Start(g_msg); // aviso de versão nova no GitHub (90 s depois e a cada 6 h)
if (!menubar::Create(hi) || !dock::Create(hi) || !launchpad::Create(hi) || !missioncontrol::Create(hi) || !central::Create(hi) || !spotlight::Create(hi) || !alertas::Create(hi) || !sobre::Create(hi) || !seletor::Create(hi) || !som::Create(hi)) { Log(L"erro criando as janelas"); Restore(); return 1; }
instalados::Start();
diff --git a/src/shell/menubar.cpp b/src/shell/menubar.cpp
index 9b7dbae..367d4b3 100644
--- a/src/shell/menubar.cpp
+++ b/src/shell/menubar.cpp
@@ -431,24 +431,43 @@ std::vector<IconCache> g_iconCache;
const std::vector<BYTE>& IconPixels(HICON ic, UINT px) {
for (auto& c : g_iconCache) if (c.icon == ic && c.px == px) return c.bgra;
if (g_iconCache.size() > 64) g_iconCache.clear();
- BITMAPINFO bi{}; bi.bmiHeader = { sizeof(BITMAPINFOHEADER), (LONG)px, -(LONG)px, 1, 32, BI_RGB };
+ // desenhado 4× maior e reduzido pela média de cada bloco 4×4 (anti-aliasing): em 1080p (17 px) o DrawIconEx
+ // esticava o ícone de 16/32 px pelo vizinho mais próximo e a borda saía serrilhada
+ const UINT SS = 4, R = px * SS;
+ BITMAPINFO bi{}; bi.bmiHeader = { sizeof(BITMAPINFOHEADER), (LONG)R, -(LONG)R, 1, 32, BI_RGB };
void *pb, *pw;
HDC dc = CreateCompatibleDC(nullptr);
HBITMAP b = CreateDIBSection(nullptr, &bi, DIB_RGB_COLORS, &pb, nullptr, 0);
HBITMAP w = CreateDIBSection(nullptr, &bi, DIB_RGB_COLORS, &pw, nullptr, 0);
- memset(pw, 0xFF, px * px * 4);
- HGDIOBJ old = SelectObject(dc, b); DrawIconEx(dc, 0, 0, ic, px, px, 0, nullptr, DI_NORMAL);
- SelectObject(dc, w); DrawIconEx(dc, 0, 0, ic, px, px, 0, nullptr, DI_NORMAL);
- SelectObject(dc, old);
IconCache c{ ic, px, std::vector<BYTE>(px * px * 4) };
- auto* B = (BYTE*)pb; auto* W = (BYTE*)pw;
- for (UINT i = 0; i < px * px; i++) {
- int a = 255 - std::clamp((W[i * 4 + 1] - B[i * 4 + 1]), 0, 255); // alfa = 1 - (branco - preto)
- c.bgra[i * 4 + 0] = B[i * 4 + 0];
- c.bgra[i * 4 + 1] = B[i * 4 + 1];
- c.bgra[i * 4 + 2] = B[i * 4 + 2];
- c.bgra[i * 4 + 3] = (BYTE)a;
+ if (!b || !w || !pb || !pw) {
+ if (b) DeleteObject(b);
+ if (w) DeleteObject(w);
+ DeleteDC(dc);
+ g_iconCache.push_back(std::move(c));
+ return g_iconCache.back().bgra;
}
+ memset(pw, 0xFF, R * R * 4);
+ HGDIOBJ old = SelectObject(dc, b); DrawIconEx(dc, 0, 0, ic, R, R, 0, nullptr, DI_NORMAL);
+ SelectObject(dc, w); DrawIconEx(dc, 0, 0, ic, R, R, 0, nullptr, DI_NORMAL);
+ SelectObject(dc, old);
+ auto* B = (BYTE*)pb; auto* W = (BYTE*)pw;
+ for (UINT y = 0; y < px; y++)
+ for (UINT x = 0; x < px; x++) {
+ UINT sb = 0, sg = 0, sr = 0, sa = 0;
+ for (UINT dy = 0; dy < SS; dy++)
+ for (UINT dx = 0; dx < SS; dx++) {
+ size_t i = ((size_t)(y * SS + dy) * R + (x * SS + dx)) * 4;
+ int a = 255 - std::clamp((W[i + 1] - B[i + 1]), 0, 255); // alfa = 1 - (branco - preto)
+ sb += B[i + 0]; sg += B[i + 1]; sr += B[i + 2]; sa += (UINT)a;
+ }
+ const UINT n = SS * SS;
+ size_t o = ((size_t)y * px + x) * 4;
+ c.bgra[o + 3] = (BYTE)((sa + n / 2) / n);
+ c.bgra[o + 0] = (BYTE)std::min<UINT>((sb + n / 2) / n, c.bgra[o + 3]);
+ c.bgra[o + 1] = (BYTE)std::min<UINT>((sg + n / 2) / n, c.bgra[o + 3]);
+ c.bgra[o + 2] = (BYTE)std::min<UINT>((sr + n / 2) / n, c.bgra[o + 3]);
+ }
DeleteObject(b); DeleteObject(w); DeleteDC(dc);
g_iconCache.push_back(std::move(c));
return g_iconCache.back().bgra;
@@ -727,14 +746,33 @@ void Render() {
if (r - 37 < leftEnd + 60) break; // sem espaço: some, como no Mac
auto bx = slot(17, K_TRAY, i);
std::vector<BYTE> mono = IconPixels(t.icon, px);
- for (size_t k = 0; k < mono.size(); k += 4) { // só a forma do ícone, na cor do texto (como no Mac)
- BYTE a = mono[k + 3];
- BYTE v = dark ? a : 0;
- mono[k] = mono[k + 1] = mono[k + 2] = (BYTE)(v * 0.92f);
- mono[k + 3] = (BYTE)(a * (dark ? 0.92f : 0.85f));
+ // o mesmo filtro dos ícones Transparentes (ui::GlassIcon, escuro): cinza monocromático pelo tom do original,
+ // mais claro no alto e mais escuro embaixo. Antes era só a silhueta: ícone de fundo cheio (Discord,
+ // WhatsApp) virava um quadrado branco sem o desenho de dentro.
+ for (size_t k = 0; k < mono.size(); k += 4) {
+ float a = mono[k + 3] / 255.f;
+ if (a <= 0.004f) { mono[k] = mono[k + 1] = mono[k + 2] = mono[k + 3] = 0; continue; }
+ float b = mono[k] / 255.f / a, g = mono[k + 1] / 255.f / a, rr = mono[k + 2] / 255.f / a;
+ float l = std::clamp(0.2126f * rr + 0.7152f * g + 0.0722f * b, 0.f, 1.f);
+ float yy = (float)((k / 4) / px) / px;
+ float v, oa;
+ if (dark) {
+ float grad = 0.97f - 0.20f * yy;
+ v = std::clamp(grad * (0.52f + 0.52f * l), 0.36f, 0.98f);
+ oa = a * 0.94f;
+ } else { // claro: preto, o desenho de dentro um pouco mais claro
+ v = std::clamp(0.06f + 0.42f * l * l + 0.06f * yy, 0.f, 0.55f);
+ oa = a * 0.86f;
+ }
+ BYTE c = (BYTE)std::lround(v * oa * 255);
+ mono[k] = mono[k + 1] = mono[k + 2] = c;
+ mono[k + 3] = (BYTE)std::lround(oa * 255);
}
if (ID2D1Bitmap* bmp = ui::Bitmap(rt, px, px, mono)) {
- rt->DrawBitmap(bmp, D2D1::RectF(bx.left, H / 2 - 8.5f, bx.right, H / 2 + 8.5f));
+ // no pixel inteiro (1:1 com o bitmap): fora da grade o bitmap era reamostrado e borrava/serrilhava
+ float cxp = (bx.left + bx.right) / 2 * sc, cyp = H / 2 * sc;
+ float l0 = std::round(cxp - px / 2.f) / sc, t0 = std::round(cyp - px / 2.f) / sc;
+ rt->DrawBitmap(bmp, D2D1::RectF(l0, t0, l0 + px / sc, t0 + px / sc), 1, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR);
bmp->Release();
}
}
diff --git a/src/shell/notificacoes.cpp b/src/shell/notificacoes.cpp
index 9d8f1a0..9c91027 100644
--- a/src/shell/notificacoes.cpp
+++ b/src/shell/notificacoes.cpp
@@ -475,7 +475,9 @@ struct El {
float cutTop = -1e9f; // camada da pilha: só abaixo desta linha
};
struct Spring1 { float x = 0, v = 0; };
-struct Anim { El el; Spring1 l, t, r, b, a; bool live = true; std::wstring anchor; };
+struct Anim { El el; Spring1 l, t, r, b, a; bool live = true; std::wstring anchor;
+ bool emerge = false; float fromTop = 0; // cartão que sai de baixo do de cima ao abrir o grupo
+};
std::map<std::wstring, Anim> g_anim;
std::vector<std::wstring> g_order; // ordem de desenho do último layout
@@ -518,15 +520,19 @@ std::vector<El> Layout() {
out.push_back(p);
y += HEADER_H + GAP;
D2D1_RECT_F first{};
+ std::vector<El> cards;
for (int ni = 0; ni < (int)g.notes.size(); ni++) {
float h2 = CardH(g.notes[ni]);
El c{ L"n:" + std::to_wstring(g.notes[ni].id), K_CARD, D2D1::RectF(0, y, CARD_W, y + h2), A_CARD };
c.group = gi; c.note = ni;
if (ni == 0) first = c.r;
else { c.from = D2D1::RectF(first.left, first.top, first.right, first.top + h2); c.hasFrom = true; }
- out.push_back(c);
+ cards.push_back(c);
y += h2 + GAP;
}
+ // as de baixo são desenhadas antes: ao abrir saem de trás do cartão de cima (como no Mac), sem texto
+ // de uma por cima do da outra
+ out.insert(out.end(), cards.rbegin(), cards.rend());
y += GROUP_GAP - GAP;
} else {
float h2 = CardH(g.notes[0]);
@@ -594,6 +600,7 @@ void Sync(const std::vector<El>& els) {
D2D1_RECT_F f = e.hasFrom && !g_snap ? e.from : e.r;
a.l.x = f.left; a.t.x = f.top; a.r.x = f.right; a.b.x = f.bottom;
a.a.x = g_snap ? 1.f : 0.f;
+ if (e.hasFrom && !g_snap && e.kind == K_CARD) { a.emerge = true; a.fromTop = e.from.top; }
it = g_anim.emplace(e.key, a).first;
} else it->second.el = e;
it->second.live = true;
@@ -841,6 +848,12 @@ void Paint() {
D2D1_RECT_F r = Off(Cur(a), ox, oy);
if (r.bottom < -20 || r.top > viewH + 20) continue;
float alpha = a.a.x;
+ if (a.emerge && a.live) { // saindo de baixo do de cima: só aparece conforme desce (texto não se mistura)
+ float span = e.r.top - a.fromTop;
+ float k = span > 1 ? std::clamp((a.t.x - a.fromTop) / span, 0.f, 1.f) : 1.f;
+ if (k >= 0.999f && a.a.x >= 0.999f) a.emerge = false;
+ alpha *= k * k;
+ }
if (alpha <= 0.003f) continue;
D2D1_RECT_F px = D2D1::RectF(r.left * sc, r.top * sc, r.right * sc, r.bottom * sc);
bool fade = alpha < 0.999f;
@@ -1011,6 +1024,7 @@ void Frame() {
}
void OpenApp(const Note& n) {
+ if (n.aumid == L"WacOS.Atualizacao") { shell::OpenSettings(L"atualizacao"); return; } // atualizacao.cpp
for (auto& a : apps::list)
if (!a.wins.empty() && (!_wcsicmp(a.id.c_str(), (L"aumid:" + n.aumid).c_str()) || !_wcsicmp(a.name.c_str(), n.app.c_str()))) { apps::Activate(a); return; }
for (auto& a : apps::list)
@@ -1058,6 +1072,8 @@ const Hit* HitAt(D2D1_POINT_2F p) {
return hit;
}
+DWORD g_expandedAt = 0; // quando uma pilha foi aberta
+
void Click(D2D1_POINT_2F p) {
const Hit* h = HitAt(p);
if (!h) { Close(); return; } // clique no vazio da coluna: fecha, como clicar fora
@@ -1080,9 +1096,11 @@ void Click(D2D1_POINT_2F p) {
}
switch (hit.act) {
case A_STACK:
- if (hit.group >= 0 && hit.group < (int)g_groups.size()) g_expanded.insert(g_groups[hit.group].aumid);
+ if (hit.group >= 0 && hit.group < (int)g_groups.size()) { g_expanded.insert(g_groups[hit.group].aumid); g_expandedAt = GetTickCount(); }
break;
case A_CARD:
+ // segundo clique de um clique duplo na pilha: só abre o grupo (não abre o app nem fecha a central)
+ if (GetTickCount() - g_expandedAt < 500) break;
if (hit.group >= 0 && hit.group < (int)g_groups.size() && hit.note >= 0 && hit.note < (int)g_groups[hit.group].notes.size()) {
Note n = g_groups[hit.group].notes[hit.note];
RemoveIds({ n.id });
diff --git a/src/shell/progresso.cpp b/src/shell/progresso.cpp
index 9f21ff0..31d3048 100644
--- a/src/shell/progresso.cpp
+++ b/src/shell/progresso.cpp
@@ -21,6 +21,7 @@
#include <set>
#include <thread>
#include "../comum/idioma.h"
+#include "../comum/semaforo.h"
namespace {
@@ -442,7 +443,7 @@ void Paint() {
float d = c.right - c.left, gap = tahoe ? 9.f : 8.f;
for (int k = 0; k < 3; k++) {
D2D1_ELLIPSE e = D2D1::Ellipse({ c.left + d / 2 + k * (d + gap), (c.top + c.bottom) / 2 }, d / 2, d / 2);
- br->SetColor(k == 0 ? D2D1::ColorF(1.f, 0.37f, 0.34f) : (dark ? D2D1::ColorF(1, 1, 1, 0.16f) : D2D1::ColorF(0, 0, 0, 0.13f)));
+ br->SetColor(k == 0 ? semaforo::Close() : (dark ? D2D1::ColorF(1, 1, 1, 0.16f) : D2D1::ColorF(0, 0, 0, 0.13f)));
dc->FillEllipse(e, br);
if (k == 0) {
br->SetColor(D2D1::ColorF(0.75f, 0.2f, 0.18f, 0.6f));
diff --git a/src/shell/shell.h b/src/shell/shell.h
index c84db31..f1ff513 100644
--- a/src/shell/shell.h
+++ b/src/shell/shell.h
@@ -290,6 +290,10 @@ size_t Count();
// foldedQuery: minúsculas sem acento; para logo se cancelled() der true
void Search(const std::wstring& foldedQuery, size_t max, const std::function<bool()>& cancelled, std::vector<Hit>& out);
}
+namespace atualizacao { // aviso de versão nova no GitHub (atualizacao.cpp)
+void Start(HWND msgWnd); // thread: confere 90 s depois e a cada 6 h; avisa msgWnd
+bool Handle(UINT m); // na MsgProc: mostra a notificação (uma vez por versão); true = era a mensagem
+}
namespace migrar { // troca de nome Sequoia → WacOS (migrar.cpp)
bool TrocarPeloNovo(); // rodando como SequoiaShell.exe com o WacOSShell.exe ao lado: abre o novo (true = sair)
void Registro(); // caminhos do nome velho no registro e a tarefa do login
@@ -477,6 +481,7 @@ void BadgesChanged(); // chegou ou saiu notificação: redesenha os badges ver
namespace backdrop { // vidro desfocado com recorte arredondado suave (backdrop.cpp)
bool Attach(HWND h); // janela criada com WS_EX_NOREDIRECTIONBITMAP
void Detach(HWND h); // a janela vai ser destruída: solta o vidro dela
+void Restart(); // refaz o vidro real do zero (Ajustes: "Reiniciar o Liquid Glass")
void Set(HWND h, float w, float hgt, float radius, D2D1_COLOR_F tint); // px
void Fade(HWND h, float opacity, float scale, float cx, float cy); // animação: opacidade e escala em volta de (cx, cy) px
// Conteúdo desenhado DENTRO do vidro (mesma árvore da Composição): vidro e desenho chegam à tela no mesmo
diff --git a/src/shell/sobre.cpp b/src/shell/sobre.cpp
index fc9de3f..8c6ff2a 100644
--- a/src/shell/sobre.cpp
+++ b/src/shell/sobre.cpp
@@ -8,6 +8,7 @@
#include <algorithm>
#include <cmath>
#include "../comum/idioma.h"
+#include "../comum/semaforo.h"
namespace {
@@ -156,7 +157,7 @@ void Paint() {
for (int k = 0; k < 3; k++) {
D2D1_POINT_2F c{ LIGHT_X0 + k * LIGHT_PITCH, LIGHT_Y };
bool on = k == 0 && (g_active || g_hover == 0);
- br->SetColor(on ? D2D1::ColorF(1.0f, 0.373f, 0.341f) : dark ? D2D1::ColorF(1, 1, 1, 0.16f) : D2D1::ColorF(0, 0, 0, 0.14f));
+ br->SetColor(on ? semaforo::Close() : dark ? D2D1::ColorF(1, 1, 1, 0.16f) : D2D1::ColorF(0, 0, 0, 0.14f));
dc->FillEllipse(D2D1::Ellipse(c, LIGHT_R, LIGHT_R), br);
if (k == 0 && g_hover == 0) {
br->SetColor(D2D1::ColorF(0.30f, 0, 0, 0.75f));
diff --git a/src/terminal/main.cpp b/src/terminal/main.cpp
index 55d3bb2..a94c8cc 100644
--- a/src/terminal/main.cpp
+++ b/src/terminal/main.cpp
@@ -34,6 +34,7 @@
#include "../menu/context_menu.h"
#include "../comum/ampliacao.h" // botão verde com a animação do ampliar do Shell
#include "../comum/idioma.h"
+#include "../comum/semaforo.h"
FILE* g_log;
void Log(const wchar_t* fmt, ...) {
@@ -582,9 +583,9 @@ void Render() {
g_rt->FillRectangle(D2D1::RectF(0, 0, s.width, TITLE_H), br);
br->SetColor(D2D1::ColorF(0, 0, 0, 0.55f));
Line2(g_rt, br, 0, TITLE_H - 0.5f, s.width, TITLE_H - 0.5f, 1);
- static const D2D1_COLOR_F fill[3] = { D2D1::ColorF(1.0f, 0.373f, 0.345f), D2D1::ColorF(0.996f, 0.737f, 0.180f), D2D1::ColorF(0.157f, 0.784f, 0.251f) };
- static const D2D1_COLOR_F ring[3] = { D2D1::ColorF(0.886f, 0.275f, 0.247f), D2D1::ColorF(0.882f, 0.631f, 0.086f), D2D1::ColorF(0.071f, 0.675f, 0.157f) };
- static const D2D1_COLOR_F glyph[3] = { D2D1::ColorF(0.302f, 0, 0), D2D1::ColorF(0.6f, 0.341f, 0), D2D1::ColorF(0, 0.396f, 0) };
+ static const D2D1_COLOR_F fill_c[3] = { D2D1::ColorF(1.0f, 0.373f, 0.345f), D2D1::ColorF(0.996f, 0.737f, 0.180f), D2D1::ColorF(0.157f, 0.784f, 0.251f) }; const D2D1_COLOR_F* fill = semaforo::Pick(fill_c, semaforo::FILL);
+ static const D2D1_COLOR_F ring_c[3] = { D2D1::ColorF(0.886f, 0.275f, 0.247f), D2D1::ColorF(0.882f, 0.631f, 0.086f), D2D1::ColorF(0.071f, 0.675f, 0.157f) }; const D2D1_COLOR_F* ring = semaforo::Pick(ring_c, semaforo::RING);
+ static const D2D1_COLOR_F glyph_c[3] = { D2D1::ColorF(0.302f, 0, 0), D2D1::ColorF(0.6f, 0.341f, 0), D2D1::ColorF(0, 0.396f, 0) }; const D2D1_COLOR_F* glyph = semaforo::Pick(glyph_c, semaforo::GLYPH);
bool lit = g_active || g_hoverLights;
for (int k = 0; k < 3; k++) { // padrão do projeto: 14 pt, 23 entre centros; barra fina: o primeiro em 19
D2D1_POINT_2F c{ 19.f + k * 23, TITLE_H / 2 };