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

Keep app badges red in styled icons; roomier Notes list header

Eternity0706285c382d24f0ed
diff --git a/src/notas/main.cpp b/src/notas/main.cpp
index 6d1ed88..ee2633f 100644
--- a/src/notas/main.cpp
+++ b/src/notas/main.cpp
@@ -90,7 +90,10 @@ void Invalidate() { if (g_hwnd) InvalidateRect(g_hwnd, nullptr, FALSE); }
float SideW() { return g_sideHidden ? 0.f : g_sideW; }
float ListL() { return SideW(); }
-float ListR() { return g_gallery ? ClientDip().width : SideW() + g_listW; }
+// macOS 27 com a lateral escondida: a coluna das notas carrega os três botões, o da lateral, o nome da pasta e o
+// "⋯" na barra; com menos de 310 pt ficava tudo apertado ("Not…")
+float ListW() { return g_sideHidden && semaforo::Aqua() ? std::max(g_listW, 310.f) : g_listW; }
+float ListR() { return g_gallery ? ClientDip().width : SideW() + ListW(); }
float EdL() { return g_gallery ? SideW() : ListR(); }
bool EditorShown() { return !g_gallery || g_galleryOpen; }
float ToolStart() { return g_sideHidden ? 128.f : SideW(); } // onde começam os botões da lista (sem barra lateral, depois das bolinhas)
diff --git a/src/shell/ui.cpp b/src/shell/ui.cpp
index 39f5bed..7a8478f 100644
--- a/src/shell/ui.cpp
+++ b/src/shell/ui.cpp
@@ -473,8 +473,31 @@ static void GlassIcon(UINT w, UINT h, std::vector<BYTE>& px, bool tinted, float
// Escuro: o fundo claro do ícone vira grafite e o desenho colorido fica (um pouco mais vivo);
// Transparente e Tingido: o ícone vira vidro (GlassIcon).
+static void StyleIconRaw(UINT w, UINT h, std::vector<BYTE>& px, const std::wstring& style);
+// O selo vermelho que o app pinta no próprio ícone (WhatsApp, Discord: o número de mensagens no canto de cima à
+// direita) continua vermelho nos estilos Escuro, Transparente e Tingido, como no Mac. Antes ele virava vidro branco.
void ui::StyleIcon(UINT w, UINT h, std::vector<BYTE>& px, const std::wstring& style) {
if (style == L"padrao" || style.empty() || px.size() < (size_t)w * h * 4) return;
+ std::vector<BYTE> orig = px;
+ StyleIconRaw(w, h, px, style);
+ // vermelho forte só no quarto de cima à direita: a caixa dele é o selo (com o número branco dentro)
+ UINT x0 = w, y0 = h, x1 = 0, y1 = 0, n = 0;
+ for (UINT y = 0; y < h / 2; y++)
+ for (UINT x = w / 2; x < w; x++) {
+ const BYTE* q = &orig[((size_t)y * w + x) * 4];
+ if (q[3] < 200) continue;
+ int r = q[2], g = q[1], b = q[0];
+ if (r > 170 && g < r * 0.45f && b < r * 0.45f) { n++; x0 = std::min(x0, x); y0 = std::min(y0, y); x1 = std::max(x1, x); y1 = std::max(y1, y); }
+ }
+ if (n < (w * h) / 200 || x1 <= x0 || y1 <= y0) return; // pouco vermelho: não é selo
+ if ((x1 - x0) > w / 2 || (y1 - y0) > h / 2) return; // grande demais: é o desenho do ícone, não um selo
+ for (UINT y = y0; y <= y1; y++)
+ for (UINT x = x0; x <= x1; x++) {
+ size_t i = ((size_t)y * w + x) * 4;
+ if (orig[i + 3] > 0) memcpy(&px[i], &orig[i], 4);
+ }
+}
+static void StyleIconRaw(UINT w, UINT h, std::vector<BYTE>& px, const std::wstring& style) {
float tr = 0.04f, tg = 0.52f, tb = 1.0f; // azul do Mac
{
static const std::pair<const wchar_t*, UINT32> acc[] = { { L"roxo", 0x953D96 }, { L"rosa", 0xF74F9E }, { L"vermelho", 0xE0383E },