A new style desktop shell for Windows 11: menu bar, Dock, Finder, Spotlight, Control Center and Liquid Glass, in native C++.
Rust
Mac buttons in apps with their own title bar, per-theme window border, Reddit fixes
Eternity070628b6d2c77353f5
diff --git a/docs/registro-mudancas.txt b/docs/registro-mudancas.txtindex 0bf68f5..3742502 100644--- a/docs/registro-mudancas.txt+++ b/docs/registro-mudancas.txt@@ -855,3 +855,14 @@ Compilado (tudo), instalado, Shell e reserva do Finder reiniciados às 23:07 sem3) #10 (Dock/Finder "como o MyDockFinder", espelho pirata): nada copiado; sem pedido concreto.Compilado o Shell e instalado. NÃO conferido na tela: um pedido de câmera do WhatsApp (do Windows) ficou na frente de tudo e as janelas de teste não minimizavam; Photoshop/Figma não estão neste PC.Nada no registro do Windows. DESFAZER: reverter o commit.++[2026-11-21 13:45] Dock, Aurora, Mesa, Finder, widgets, borda por tema e botões do Mac nos apps de barra própria (Reddit).+ 1) Dock (src\shell\dock.cpp): a folga fixa de 4 pt entre o Dock e a janela maximizada (issue #8) virou o ajuste dock_folga, 0 por padrão (no Mac a janela encosta no Dock; parecia "descolado"). Ajustes > Mesa e Dock > Personalizar o Dock > "Espaço acima das janelas maximizadas" (0 a 24). ReloadSettings reaplica a área de trabalho quando a reserva muda.+ 2) "Usar o Aurora" (src\ajustes\paginas.cpp, UsarAurora): procura também na pasta Imagens do Windows e no que vem com o WacOS (icones\leopard\aurora.jpg, 2880x1800, 239 KB; a pasta icones\leopard fica fora do git e entra no pacote). Antes só achava a coleção de papéis de parede deste PC: nos outros o botão não fazia nada.+ 3) Mesa (src\shell\mesa.cpp, EndEdit): renomear um arquivo com a extensão escondida (o nome do Windows, SHGFI_DISPLAYNAME) tirava a extensão ("foto.png" -> "praia"); agora ela continua.+ 4) Finder (src\finder\main.cpp): Ctrl+V com um caminho copiado como texto vai para a pasta (ou abre a pasta do arquivo com ele selecionado), também na janela de escolher; Ctrl+L abre o Ir para a Pasta.+ 5) Widgets do Tempo/Nascer do Sol (src\shell\widgets.cpp, src\clima\main.cpp): menu "Editar Local…" abre o Tempo com --meu-local (a busca já aberta; a cidade achada vira o Meu Local); clicar no widget abre o app Tempo; mudou a cidade nos ajustes -> o widget busca na hora.+ 6) WacOSWindow.dll (src\janelas\macjanela.cpp): contorno da janela por tema (BordaDoTema): Sequoia/Tahoe como antes; Golden Gate medido nas capturas 2x do macOS 27 (escuro: meio ponto 95% por fora e 1 pt claro 10% por dentro; claro: meio ponto 20%, sem brilho); Leopard só o fio escuro.+ 7) WacOSWindow.dll: botões do Mac nos apps de barra própria (Chromium/Electron: Edge, Chrome, Figma, Discord, VS Code). O modo 2 volta sem converter o maximizar (o verde, Win+Up e o duplo clique maximizam de verdade, o F11 é do app) e junto com o modo leve. Ajuste barra_mac_propria (padrão 1), em Ajustes > Mesa e Dock > Janelas. O Chromium mantém WS_CAPTION: o teste é a altura da barra do Windows (< 20 pt).+ 10 frases novas nos 11 idiomas. Compilados Shell, DLL das janelas, Finder, Ajustes e apps; instalado. Conferido: a DLL pegou o Edge e o Chrome (MacJanelaPropria) e os três botões aparecem à esquerda com a faixa cobrindo os do Windows (foto só dos cantos). NÃO conferidos na tela: Dock sem folga, Aurora, renomear na Mesa, colar caminho, Editar Local, borda do Golden Gate; Adobe (não é Chromium) continua sem os botões.+ Nada no registro do Windows. DESFAZER: reverter o commit (e barra_mac_propria=0 desliga os botões nos apps de barra própria).diff --git a/src/ajustes/paginas.cpp b/src/ajustes/paginas.cppindex fa25a44..441bed5 100644--- a/src/ajustes/paginas.cpp+++ b/src/ajustes/paginas.cpp@@ -956,6 +956,24 @@ static void GGAplicaRealce(int i) {SetSetting(L"realce_texto", std::to_wstring(i));}+// "Usar o Aurora": o da coleção de papéis de parede do usuário (Imagens\Wallpapers macOS\Leopard) ou, sem ela, o que+// vem com o WacOS (icones\leopard\aurora.jpg). Antes só procurava na pasta Imagens do perfil: em quem não tinha a+// coleção o botão não fazia nada (21/11/2026).+static void UsarAurora() {+ const wchar_t* nome = L"\\Wallpapers macOS\\Leopard\\os-x-leopard-aurora-5120x3200-24048.jpg";+ std::vector<std::wstring> cands;+ wchar_t prof[MAX_PATH] = {};+ if (GetEnvironmentVariableW(L"USERPROFILE", prof, MAX_PATH)) cands.push_back(std::wstring(prof) + L"\\Pictures" + nome);+ PWSTR pics = nullptr;+ if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Pictures, 0, nullptr, &pics))) { cands.push_back(std::wstring(pics) + nome); CoTaskMemFree(pics); }+ wchar_t exe[MAX_PATH] = {}; GetModuleFileNameW(nullptr, exe, MAX_PATH);+ std::wstring inst = exe; inst = inst.substr(0, inst.find_last_of(L'\\')); inst = inst.substr(0, inst.find_last_of(L'\\')); // bin\ -> instalação+ cands.push_back(inst + L"\\icones\\leopard\\aurora.jpg");+ for (auto& f : cands)+ if (GetFileAttributesW(f.c_str()) != INVALID_FILE_ATTRIBUTES) { sys::SetWallpaper(f); break; }+ Rebuild();+}+Page AparenciaGolden() {Page p;// ---- Aparência: Claro, Escuro, Automático@@ -1246,13 +1264,7 @@ Page AparenciaGolden() {if (Setting(L"leopard", L"0") == L"1" && Setting(L"liquid_glass", L"0") != L"1") {// Leopard: o Aurora (o papel de parede padrão do 10.5) só como sugestão; trocar de tema nunca muda o papel de// parede do usuário (pedido dele), quem troca é este botão- Row aurora = Button(L"Papel de parede do Leopard", L"Usar o Aurora", [] {- wchar_t prof[MAX_PATH] = {};- if (!GetEnvironmentVariableW(L"USERPROFILE", prof, MAX_PATH)) return;- std::wstring f = std::wstring(prof) + L"\\Pictures\\Wallpapers macOS\\Leopard\\os-x-leopard-aurora-5120x3200-24048.jpg";- if (GetFileAttributesW(f.c_str()) != INVALID_FILE_ATTRIBUTES) sys::SetWallpaper(f);- Rebuild();- }, L"Aurora, o papel de parede original do Mac OS X Leopard. Trocar de tema não muda o seu papel de parede.");+ Row aurora = Button(L"Papel de parede do Leopard", L"Usar o Aurora", UsarAurora, L"Aurora, o papel de parede original do Mac OS X Leopard. Trocar de tema não muda o seu papel de parede.");p.groups.push_back(G({ tema, aurora }));} else p.groups.push_back(G({ tema }));return p;@@ -1283,13 +1295,7 @@ Page AparenciaLeopard() {}));Row tema = TemaRow();tema.label = L"Estilo do WacOS";- Row aurora = Button(L"Papel de parede do Leopard", L"Usar o Aurora", [] {- wchar_t prof[MAX_PATH] = {};- if (!GetEnvironmentVariableW(L"USERPROFILE", prof, MAX_PATH)) return;- std::wstring f = std::wstring(prof) + L"\\Pictures\\Wallpapers macOS\\Leopard\\os-x-leopard-aurora-5120x3200-24048.jpg";- if (GetFileAttributesW(f.c_str()) != INVALID_FILE_ATTRIBUTES) sys::SetWallpaper(f);- Rebuild();- }, L"Aurora, o papel de parede original do Mac OS X Leopard. Trocar de tema não muda o seu papel de parede.");+ Row aurora = Button(L"Papel de parede do Leopard", L"Usar o Aurora", UsarAurora, L"Aurora, o papel de parede original do Mac OS X Leopard. Trocar de tema não muda o seu papel de parede.");p.groups.push_back(G({ tema, aurora }));return p;}@@ -1516,7 +1522,10 @@ Page PersonalizarDock() {esp.hasDef = true; esp.def = 0;Row marg = Slider(L"Distância da borda da tela", 0, 40, [] { return NumSetting(L"dock_margem", 5); }, SetNum(L"dock_margem"), L"Encostado", L"Longe");marg.hasDef = true; marg.def = 5;- p.groups.push_back(G({ esp, marg }, L"Tamanho e Espaço"));+ // no Mac a janela maximizada encosta no Dock; quem quiser um respiro entre os dois escolhe aqui (issue #8)+ Row folga = Slider(L"Espaço acima das janelas maximizadas", 0, 24, [] { return NumSetting(L"dock_folga", 0); }, SetNum(L"dock_folga"), L"Encostado", L"Longe");+ folga.hasDef = true; folga.def = 0;+ p.groups.push_back(G({ esp, marg, folga }, L"Tamanho e Espaço"));float raioDef = tahoe ? 61.f : 43.f, opacDef = tahoe ? 39.f : 45.f;Row raio = Slider(L"Arredondamento dos cantos", 0, 100, [raioDef] { return NumSetting(L"dock_raio", raioDef); }, SetNum(L"dock_raio"), L"Reto", L"Pílula");raio.hasDef = true; raio.def = raioDef;@@ -1541,7 +1550,7 @@ Page PersonalizarDock() {ShellExecuteW(nullptr, L"open", d.c_str(), nullptr, nullptr, SW_SHOWNORMAL);}, L"Ponha um PNG com o nome do .exe (chrome.png, discord.png) ou do app (Google Chrome.png) nesta pasta para trocar o ícone dele no Dock. Imagens de 512 × 512 com a margem do Mac ficam melhores.") }, L"Ícones"));p.groups.push_back(Plain(Buttons({ { L"Restaurar o Padrão", [] {- for (auto k : { L"dock_espaco", L"dock_margem", L"dock_raio", L"dock_opacidade" }) SetSetting(k, L"");+ for (auto k : { L"dock_espaco", L"dock_margem", L"dock_folga", L"dock_raio", L"dock_opacidade" }) SetSetting(k, L"");SetSetting(L"dock_cor", L"auto"); SetSetting(L"dock_indicador", L"ponto");for (auto k : { L"dock_launchpad", L"dock_separador", L"dock_rotulos" }) SetSetting(k, L"1");Rebuild();@@ -1633,6 +1642,10 @@ Page MesaDock() {// issue #4: como no Mac, o Finder fica no Alt+Tab mesmo sem janela; desligado, só com janela abertaToggle(L"Mostrar o Finder no Alt+Tab mesmo sem janelas", [] { return Setting(L"seletor_finder", L"1") != L"0"; },[](bool v) { SetSetting(L"seletor_finder", v ? L"1" : L"0"); }),+ // Edge, Chrome, Figma, Discord, VS Code...: os três botões do Mac por cima da barra deles (WacOSWindow.dll)+ Toggle(L"Botões do Mac nos apps com barra própria", [] { return Setting(L"barra_mac_propria", L"1") != L"0"; },+ [](bool v) { SetSetting(L"barra_mac_propria", v ? L"1" : L"0"); },+ L"Edge, Chrome, Figma, Discord, VS Code e outros apps que desenham a própria barra ganham os botões do Mac no lugar dos do Windows. Vale para as janelas abertas depois de mudar."),Uri(L"Navegador padrão", L"ms-settings:defaultapps") }, L"Janelas"));// Organizador Visual (Stage Manager): só o app da frente na tela, os outros numa faixa à esquerdap.groups.push_back(G({ Toggle(L"Organizador Visual", flag(L"organizador", L"0"), setFlag(L"organizador")) }, L"",diff --git a/src/clima/main.cpp b/src/clima/main.cppindex 50c76a7..032ef73 100644--- a/src/clima/main.cpp+++ b/src/clima/main.cpp@@ -1,688 +1,701 @@-// Clima (Weather do Mac): à esquerda as cidades (a primeira é a dos Ajustes, a mesma do widget); à direita, sobre-// um fundo da cor do céu, a cidade, a temperatura grande, a condição, máx./mín., a previsão por hora (24 h), a de-// 10 dias (com a barra de mín.–máx.) e os quadros de sensação, umidade, vento e sol. Dados do Open-Meteo (sem chave).-// "+" procura uma cidade pelo nome (geocodificação do Open-Meteo); botão direito numa cidade: tornar "Meu Local"-// (vai para os Ajustes, o mesmo do widget) ou apagar (o "Meu Local" também, se houver outra para ficar no lugar).-// Cidades em %APPDATA%\Shell\clima.txt.-#include "../comum/app2d.h"-#include "../comum/cidade_padrao.h"-#include <winhttp.h>-#include <map>-#include <mutex>-#include <thread>-#pragma comment(lib, "winhttp.lib")--using namespace app2d;--namespace {--const float SB_W = 230;-bool g_side = true; // barra lateral das cidades (o botão dela esconde e mostra; antes não havia como)-const UINT WM_DATA = WM_APP + 5, WM_FIELDLOST = WM_APP + 77;--struct Hour { double t; float temp; int code; bool day; };-struct Day { double t; float hi, lo; int code; double rise, set; };-struct Wx { bool ok = false; float temp = 0, feels = 0, hum = 0, wind = 0; int code = 0; bool day = true; int off = 0; std::vector<Hour> hours; std::vector<Day> days; };-struct Place { std::wstring name; std::wstring lat, lon; Wx wx; bool loading = false; };-std::vector<Place> g_places;-int g_sel = 0;-std::mutex g_mx;-std::wstring g_file;-std::wstring g_status;-IDWriteTextFormat *g_tfSmallC, *g_tfCity, *g_tfTemp, *g_tfCond, *g_tfSmall, *g_tfCard, *g_tfCardBig, *g_tfEmoji, *g_tfEmojiSmall, *g_tfSide, *g_tfSideTemp, *g_tfIcon, *g_tfRowR;-IDWriteTextFormat *g_tfHdrC, *g_tfCardG; // macOS 27--std::string HttpGet(const wchar_t* host, const std::wstring& path) {- std::string body;- HINTERNET ses = WinHttpOpen(L"SequoiaClima/1.0", WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0);- if (!ses) return body;- WinHttpSetTimeouts(ses, 5000, 5000, 8000, 8000);- HINTERNET con = WinHttpConnect(ses, host, INTERNET_DEFAULT_HTTPS_PORT, 0);- HINTERNET req = con ? WinHttpOpenRequest(con, L"GET", path.c_str(), nullptr, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, WINHTTP_FLAG_SECURE) : nullptr;- if (req && WinHttpSendRequest(req, WINHTTP_NO_ADDITIONAL_HEADERS, 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0) && WinHttpReceiveResponse(req, nullptr)) {- DWORD status = 0, sz = sizeof(status);- WinHttpQueryHeaders(req, WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, nullptr, &status, &sz, nullptr);- DWORD avail = 0;- while (WinHttpQueryDataAvailable(req, &avail) && avail && body.size() < 512 * 1024) {- std::string chunk(avail, '\0'); DWORD got = 0;- if (!WinHttpReadData(req, chunk.data(), avail, &got) || !got) break;- body.append(chunk.data(), got);- }- if (status != 200) body.clear();- }- if (req) WinHttpCloseHandle(req);- if (con) WinHttpCloseHandle(con);- WinHttpCloseHandle(ses);- return body;-}-std::string Section(const std::string& j, const char* key) {- size_t p = j.find(std::string("\"") + key + "\":{");- if (p == std::string::npos) return "";- p = j.find('{', p);- int depth = 0;- for (size_t i = p; i < j.size(); i++) { if (j[i] == '{') depth++; else if (j[i] == '}' && --depth == 0) return j.substr(p, i - p + 1); }- return "";-}-double Number(const std::string& s, const char* key) {- size_t p = s.find(std::string("\"") + key + "\":");- if (p == std::string::npos) return NAN;- p += strlen(key) + 3;- while (p < s.size() && s[p] == ' ') p++;- if (s.compare(p, 4, "null") == 0) return NAN;- return strtod(s.c_str() + p, nullptr);-}-std::vector<double> Array(const std::string& s, const char* key) {- std::vector<double> v;- size_t p = s.find(std::string("\"") + key + "\":[");- if (p == std::string::npos) return v;- p = s.find('[', p) + 1;- while (p < s.size() && s[p] != ']') {- while (p < s.size() && (s[p] == ' ' || s[p] == ',')) p++;- if (s[p] == ']') break;- if (s.compare(p, 4, "null") == 0) { v.push_back(NAN); p += 4; continue; }- char* e = nullptr; v.push_back(strtod(s.c_str() + p, &e));- if (e == s.c_str() + p) break;- p = e - s.c_str();- }- return v;-}-std::wstring Utf8(const std::string& s) { int n = MultiByteToWideChar(CP_UTF8, 0, s.data(), (int)s.size(), nullptr, 0); std::wstring w(n, L'\0'); MultiByteToWideChar(CP_UTF8, 0, s.data(), (int)s.size(), w.data(), n); return w; }-std::string ToUtf8(const std::wstring& w) { int n = WideCharToMultiByte(CP_UTF8, 0, w.data(), (int)w.size(), nullptr, 0, nullptr, nullptr); std::string s(n, '\0'); WideCharToMultiByte(CP_UTF8, 0, w.data(), (int)w.size(), s.data(), n, nullptr, nullptr); return s; }-std::string StrField(const std::string& s, const char* key) {- size_t p = s.find(std::string("\"") + key + "\":\"");- if (p == std::string::npos) return "";- p += strlen(key) + 4;- size_t e = s.find('"', p);- return e == std::string::npos ? "" : s.substr(p, e - p);-}--bool Parse(const std::string& j, Wx& w) {- std::string cur = Section(j, "current"), hr = Section(j, "hourly"), dl = Section(j, "daily");- if (cur.empty() || hr.empty() || dl.empty()) return false;- double off = Number(j, "utc_offset_seconds"); if (!std::isnan(off)) w.off = (int)off;- w.temp = (float)Number(cur, "temperature_2m"); w.feels = (float)Number(cur, "apparent_temperature");- w.hum = (float)Number(cur, "relative_humidity_2m"); w.wind = (float)Number(cur, "wind_speed_10m");- w.code = (int)Number(cur, "weather_code"); w.day = Number(cur, "is_day") > 0.5;- auto t = Array(hr, "time"), tp = Array(hr, "temperature_2m"), c = Array(hr, "weather_code"), d = Array(hr, "is_day");- for (size_t i = 0; i < t.size() && i < tp.size() && i < c.size() && i < d.size(); i++) w.hours.push_back({ t[i], (float)tp[i], (int)c[i], d[i] > 0.5 });- auto dt = Array(dl, "time"), mx = Array(dl, "temperature_2m_max"), mn = Array(dl, "temperature_2m_min"), dc = Array(dl, "weather_code"), sr = Array(dl, "sunrise"), ss = Array(dl, "sunset");- for (size_t i = 0; i < dt.size() && i < mx.size() && i < mn.size() && i < dc.size(); i++)- w.days.push_back({ dt[i], (float)mx[i], (float)mn[i], (int)dc[i], i < sr.size() ? sr[i] : 0, i < ss.size() ? ss[i] : 0 });- w.ok = !std::isnan(w.temp) && !w.days.empty();- return w.ok;-}--void Fetch(int i) {- Place& p = g_places[i];- if (p.loading) return;- p.loading = true;- std::wstring lat = p.lat, lon = p.lon;- HWND h = wnd;- std::thread([i, lat, lon, h] {- std::wstring path = L"/v1/forecast?latitude=" + lat + L"&longitude=" + lon +- L"¤t=temperature_2m,apparent_temperature,relative_humidity_2m,wind_speed_10m,weather_code,is_day"- L"&hourly=temperature_2m,weather_code,is_day&daily=weather_code,temperature_2m_max,temperature_2m_min,sunrise,sunset"- L"&timezone=auto&forecast_days=10&timeformat=unixtime";- std::string body = HttpGet(L"api.open-meteo.com", path);- auto* w = new Wx;- if (body.empty() || !Parse(body, *w)) w->ok = false;- if (!PostMessageW(h, WM_DATA, (WPARAM)i, (LPARAM)w)) delete w;- }).detach();-}--void Save() {- std::vector<std::wstring> out{ L"# Cidades do Clima (nome, latitude, longitude); a primeira vem dos Ajustes" };- for (size_t i = 1; i < g_places.size(); i++) out.push_back(L"C\t" + Esc(g_places[i].name) + L"\t" + g_places[i].lat + L"\t" + g_places[i].lon);- WriteLines(g_file, out);-}--std::wstring Setting(const wchar_t* key, const wchar_t* def) {- for (auto& l : ReadLines(DataPath(L"ajustes.txt"))) { size_t e = l.find(L'='); if (e != std::wstring::npos && l.substr(0, e) == key) return l.substr(e + 1); }- return def;-}-// "Meu Local" vai para os Ajustes (tempoCidade/Lat/Lon), o mesmo do widget da mesa-void SetMyPlace(const Place& p) {- SetAppSetting(L"tempoCidade", p.name);- SetAppSetting(L"tempoLat", p.lat);- SetAppSetting(L"tempoLon", p.lon);-}-void Load() {- g_places.clear();- cidade::Padrao def; // sem cidade nos Ajustes: a do fuso do Windows (antes era sempre Campinas)- g_places.push_back({ Setting(L"tempoCidade", def.nome.c_str()), Setting(L"tempoLat", def.lat.c_str()), Setting(L"tempoLon", def.lon.c_str()) });- for (auto& l : ReadLines(g_file)) { auto f = Split(l); if (f.size() >= 4 && f[0] == L"C") g_places.push_back({ Unesc(f[1]), f[2], f[3] }); }-}--// procura a cidade (geocodificação) e põe na lista-void Search(const std::wstring& q) {- if (q.empty()) return;- g_status = Tr(L"Procurando…");- InvalidateRect(wnd, nullptr, FALSE);- HWND h = wnd;- std::thread([q, h] {- std::string u = ToUtf8(q), enc;- for (unsigned char c : u) { if (isalnum(c) || c == '-' || c == '.') enc += (char)c; else { char b[4]; sprintf_s(b, "%%%02X", c); enc += b; } }- std::wstring path = L"/v1/search?count=1&language=" + std::wstring(idioma::Code()) + L"&name=" + Utf8(enc);- std::string body = HttpGet(L"geocoding-api.open-meteo.com", path);- auto* p = new Place;- if (!body.empty() && body.find("\"results\"") != std::string::npos) {- double la = Number(body, "latitude"), lo = Number(body, "longitude");- std::string name = StrField(body, "name"), adm = StrField(body, "admin1");- if (!std::isnan(la)) {- wchar_t a[32], b[32]; swprintf_s(a, L"%.4f", la); swprintf_s(b, L"%.4f", lo);- p->name = Utf8(name); p->lat = a; p->lon = b;- }- }- if (!PostMessageW(h, WM_DATA, (WPARAM)-1, (LPARAM)p)) delete p;- }).detach();-}--// ---- condições (códigos WMO)-const wchar_t* CondText(int c) {- if (c == 0) return Tr(L"Céu Limpo");- if (c <= 2) return Tr(L"Parcialmente Nublado");- if (c == 3) return Tr(L"Nublado");- if (c == 45 || c == 48) return Tr(L"Neblina");- if (c >= 51 && c <= 57) return Tr(L"Garoa");- if ((c >= 61 && c <= 67) || (c >= 80 && c <= 82)) return Tr(L"Chuva");- if ((c >= 71 && c <= 77) || c == 85 || c == 86) return Tr(L"Neve");- if (c >= 95) return Tr(L"Tempestade");- return L"";-}-const wchar_t* CondEmoji(int c, bool day) {- if (c == 0) return day ? L"☀️" : L"\U0001F319";- if (c <= 2) return day ? L"⛅" : L"☁️";- if (c == 3) return L"☁️";- if (c == 45 || c == 48) return L"\U0001F32B️";- if (c >= 51 && c <= 57) return L"\U0001F326️";- if ((c >= 61 && c <= 67) || (c >= 80 && c <= 82)) return L"\U0001F327️";- if ((c >= 71 && c <= 77) || c == 85 || c == 86) return L"❄️";- if (c >= 95) return L"⛈️";- return L"☁️";-}-// cor do céu (em cima, embaixo)-void Sky(const Wx& w, D2D1_COLOR_F& a, D2D1_COLOR_F& b) {- bool cloudy = w.code >= 3, rain = w.code >= 51;- if (!w.day) { a = Rgb(16, 24, 48); b = Rgb(38, 48, 80); }- else if (rain) { a = Rgb(70, 84, 104); b = Rgb(110, 124, 140); }- else if (cloudy) { a = Rgb(92, 120, 150); b = Rgb(140, 160, 182); }- else { a = Rgb(40, 110, 200); b = Rgb(110, 170, 230); }-}-std::wstring HourOf(double unix, int off) { time_t t = (time_t)unix + off; tm g{}; gmtime_s(&g, &t); wchar_t b[8]; swprintf_s(b, L"%d", g.tm_hour); return b; }-std::wstring HmOf(double unix, int off) { time_t t = (time_t)unix + off; tm g{}; gmtime_s(&g, &t); wchar_t b[8]; swprintf_s(b, L"%d:%02d", g.tm_hour, g.tm_min); return b; }-int WdayOf(double unix, int off) { time_t t = (time_t)unix + off; tm g{}; gmtime_s(&g, &t); return g.tm_wday; }--struct Hit { int kind, arg; D2D1_RECT_F r; };-std::vector<Hit> g_hits;--void Card(D2D1_RECT_F r) { Fill(r, Rgb(255, 255, 255, 0.14f), 14); }-const wchar_t* CondText(int c);-const wchar_t* CondEmoji(int c, bool day);-// ---- macOS 27 (captura Weather do 512 Pixels, 2x, medida em pt): o céu ocupa a janela toda (a barra é-// transparente); lateral de 270, o botão de "barra lateral" (244, 26) e a busca em cápsula (9–262, 63–97); o "+"-// redondo fica no conteúdo (297, 26). A lateral segue o tema como nos outros apps (claro/escuro/automático pelo-// Windows, app2d::Dark): cor cheia da barra lateral (SidebarColor), botões e busca de vidro (GlassButton/GlassField,-// os mesmos do Contatos e do Música) e cada cidade num cartão com o céu dela, como no Tempo do Mac. Antes a lateral era-// sempre o céu escurecido: no tema claro o app abria escuro, e o campo de busca ficava com um fundo azul chapado. No meio: cidade (20), temperatura fina (64), condição e-// máx./mín. Embaixo uma grade de 622 de largura, centrada: dois quadros de 143 e um largo de 304 por linha (141 de-// altura, 16 entre eles), vidro claro com cantos 18 e o título em maiúsculas pequenas.-float g_gScroll;-float g_gTotal;-IDWriteTextFormat *g_tfCityG, *g_tfTempG, *g_tfCondG, *g_tfHdr, *g_tfBigG, *g_tfSmallW, *g_tfSearchG, *g_tfCondTitle;--void SkyFill(D2D1_RECT_F r, const Wx& w, float darken) {- D2D1_COLOR_F a, b; Sky(w, a, b);- auto dk = [&](D2D1_COLOR_F c) { return D2D1::ColorF(c.r * (1 - darken), c.g * (1 - darken), c.b * (1 - darken), 1); };- D2D1_GRADIENT_STOP gs[2] = { { 0, dk(a) }, { 1, dk(b) } };- ID2D1GradientStopCollection* st = nullptr; rt->CreateGradientStopCollection(gs, 2, &st);- ID2D1LinearGradientBrush* lg = nullptr;- if (st) rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, 0 }, { 0, Size().height }), st, &lg);- if (lg) { rt->FillRectangle(r, lg); lg->Release(); }- if (st) st->Release();-}-void GlassCard(D2D1_RECT_F r) {- Fill(r, Rgb(255, 255, 255, 0.15f), 18);- br->SetColor(Rgb(255, 255, 255, 0.20f));- rt->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 0.25f, r.top + 0.25f, r.right - 0.25f, r.bottom - 0.25f), 17.75f, 17.75f), br, 0.5f);-}-void CardHead(D2D1_RECT_F r, const wchar_t* title) { Text(title, g_tfHdr, D2D1::RectF(r.left + 14, r.top + 8, r.right - 10, r.top + 24), Rgb(255, 255, 255, 0.62f)); }--void PaintGoldenWx() {- g_hits.clear();- D2D1_SIZE_F sz = Size();- D2D1_COLOR_F white = Rgb(255, 255, 255), dim = Rgb(255, 255, 255, 0.72f);- const float SBG = g_side ? 270.f : 0.f;- Place pl; bool have = g_sel >= 0 && g_sel < (int)g_places.size();- if (have) { std::lock_guard<std::mutex> l(g_mx); pl = g_places[g_sel]; }- Wx sky = have && pl.wx.ok ? pl.wx : Wx{};- if (!have || !pl.wx.ok) { sky.day = true; sky.code = 1; }- SkyFill(D2D1::RectF(0, 0, sz.width, sz.height), sky, 0);- // ---- lateral (escondida: o botão dela fica na barra, logo depois dos três botões da janela, sobre o céu)- if (!g_side) {- D2D1_RECT_F tb = D2D1::RectF(84, 8, 120, 44);- Fill(tb, Rgb(255, 255, 255, 0.16f), 18); IconSidebar({ 102, 26 }, white); BarButton(tb);- g_hits.push_back({ 3, 0, tb });- } else {- const bool dark = Dark();- const D2D1_COLOR_F text = dark ? Rgb(245, 245, 247) : Rgb(29, 29, 31), gray = dark ? Rgb(152, 152, 157) : Rgb(134, 134, 139);- Fill(D2D1::RectF(0, 0, SBG, sz.height), SidebarColor());- Fill(D2D1::RectF(SBG - 0.5f, 0, SBG, sz.height), dark ? Rgb(0, 0, 0, 0.5f) : Rgb(0, 0, 0, 0.12f));- D2D1_RECT_F tb = D2D1::RectF(244 - 18, 8, 244 + 18, 44);- GlassButton(tb, dark); IconSidebar({ 244, 26 }, text); BarButton(tb);- g_hits.push_back({ 3, 0, tb });- D2D1_RECT_F sr = D2D1::RectF(9, 63, 262, 97);- GlassField(sr, dark);- IconSearch({ 27, 80 }, gray, 0.9f);- if (!field.h) Text(Tr(L"Buscar"), g_tfSearchG, D2D1::RectF(40, sr.top, sr.right - 10, sr.bottom), gray);- g_hits.push_back({ 2, 0, sr });- float y = 108;- rt->PushAxisAlignedClip(D2D1::RectF(0, 100, SBG, sz.height), D2D1_ANTIALIAS_MODE_ALIASED);- for (int i = 0; i < (int)g_places.size(); i++) {- auto& p = g_places[i];- D2D1_RECT_F r = D2D1::RectF(9, y, 262, y + 70);- // o cartão com o céu da cidade (cinza enquanto carrega); a escolhida com o contorno na cor de destaque- if (p.wx.ok) {- D2D1_COLOR_F a, b; Sky(p.wx, a, b);- D2D1_GRADIENT_STOP gs[2] = { { 0, a }, { 1, b } };- ID2D1GradientStopCollection* st = nullptr; rt->CreateGradientStopCollection(gs, 2, &st);- ID2D1LinearGradientBrush* lg = nullptr;- if (st) rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ r.left, r.top }, { r.right, r.bottom }), st, &lg);- if (lg) { rt->FillRoundedRectangle(D2D1::RoundedRect(r, 14, 14), lg); lg->Release(); }- if (st) st->Release();- } else Fill(r, dark ? Rgb(255, 255, 255, 0.08f) : Rgb(0, 0, 0, 0.05f), 14);- if (i == g_sel) { br->SetColor(semaforo::Aqua() ? Rgb(0, 136, 255) : Rgb(10, 132, 255)); rt->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1), 13, 13), br, 2); }- D2D1_COLOR_F tc = p.wx.ok ? white : text, tdim = p.wx.ok ? dim : gray;- Text(i == 0 ? std::wstring(Tr(L"Meu Local")) : p.name, g_tfSide, D2D1::RectF(r.left + 12, r.top + 8, r.right - 60, r.top + 30), tc);- if (i == 0) Text(p.name, g_tfSmall, D2D1::RectF(r.left + 12, r.top + 28, r.right - 60, r.top + 46), tdim);- if (p.wx.ok) {- Text(CondText(p.wx.code), g_tfSmall, D2D1::RectF(r.left + 12, r.bottom - 24, r.right - 60, r.bottom - 6), dim);- wchar_t t[16]; swprintf_s(t, L"%d°", (int)std::lround(p.wx.temp));- Text(t, g_tfSideTemp, D2D1::RectF(r.right - 80, r.top + 4, r.right - 12, r.top + 44), white);- }- g_hits.push_back({ 1, i, r });- y += 76;- }- rt->PopAxisAlignedClip();- if (!g_status.empty()) Text(g_status, g_tfSmall, D2D1::RectF(12, sz.height - 30, SBG - 10, sz.height - 8), gray);- } // g_side- // "+" no conteúdo- float addX = g_side ? 297.f : 146.f;- D2D1_RECT_F add = D2D1::RectF(addX - 18, 8, addX + 18, 44);- Fill(add, Rgb(255, 255, 255, 0.16f), 18); IconPlus({ addX, 26 }, white);- g_hits.push_back({ 2, 0, add }); BarButton(add);- if (!have) return;- float X0 = SBG, cx = (SBG + sz.width) / 2;- if (!pl.wx.ok) { Text(pl.loading ? Tr(L"Carregando…") : Tr(L"Sem conexão com o serviço do tempo."), g_tfCondG, D2D1::RectF(X0, 0, sz.width, sz.height), white); return; }- const Wx& w = pl.wx;- rt->PushAxisAlignedClip(D2D1::RectF(X0, 52, sz.width, sz.height), D2D1_ANTIALIAS_MODE_ALIASED);- float oy = -g_gScroll;- wchar_t t[64];- Text(g_sel == 0 ? std::wstring(Tr(L"Meu Local")) : pl.name, g_tfCityG, D2D1::RectF(X0, oy + 94, sz.width, oy + 120), white);- swprintf_s(t, L" %d°", (int)std::lround(w.temp));- Text(t, g_tfTempG, D2D1::RectF(X0, oy + 118, sz.width, oy + 182), white);- Text(CondText(w.code), g_tfCondG, D2D1::RectF(X0, oy + 177, sz.width, oy + 195), white);- if (!w.days.empty()) { swprintf_s(t, Tr(L"Máx.: %d° Mín.: %d°"), (int)std::lround(w.days[0].hi), (int)std::lround(w.days[0].lo)); Text(t, g_tfCondG, D2D1::RectF(X0, oy + 194, sz.width, oy + 212), white); }- float GW = 622, x0 = cx - GW / 2, y0 = oy + 266;- if (x0 < X0 + 12) { x0 = X0 + 12; GW = sz.width - X0 - 24; }- float sm = (GW - 32 - 304) / 2 > 100 ? 143.f : (GW - 16) / 2, wideX = x0 + 2 * sm + 32, wideW = x0 + GW - wideX;- // linha 1: sensação, vento, condições por hora- D2D1_RECT_F c1 = D2D1::RectF(x0, y0, x0 + sm, y0 + 141), c2 = D2D1::RectF(x0 + sm + 16, y0, x0 + 2 * sm + 16, y0 + 141);- D2D1_RECT_F c3 = D2D1::RectF(wideX, y0, wideX + wideW, y0 + 141);- GlassCard(c1); CardHead(c1, Tr(L"SENSAÇÃO"));- swprintf_s(t, L"%d°", (int)std::lround(w.feels));- Text(t, g_tfBigG, D2D1::RectF(c1.left + 14, c1.top + 28, c1.right, c1.top + 62), white);- {- IDWriteTextFormat* f = g_tfSmallW;- const wchar_t* s = w.feels < w.temp - 1 ? Tr(L"O vento deixa mais frio do que a temperatura real.") : w.feels > w.temp + 1 ? Tr(L"A umidade deixa mais quente do que a temperatura real.") : Tr(L"Parecida com a temperatura real.");- br->SetColor(white); rt->DrawTextW(s, (UINT32)wcslen(s), f, D2D1::RectF(c1.left + 14, c1.top + 66, c1.right - 12, c1.bottom - 8), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);- }- GlassCard(c2); CardHead(c2, Tr(L"VENTO"));- { // bússola com a velocidade no meio- D2D1_POINT_2F c{ (c2.left + c2.right) / 2, c2.top + 82 };- br->SetColor(Rgb(255, 255, 255, 0.35f));- for (int k = 0; k < 72; k++) {- double a = k * 3.14159265 / 36; float r0 = k % 18 == 0 ? 36.f : 40.f;- rt->DrawLine({ c.x + (float)sin(a) * r0, c.y - (float)cos(a) * r0 }, { c.x + (float)sin(a) * 44, c.y - (float)cos(a) * 44 }, br, 0.8f);- }- const wchar_t* L4[4] = { idioma::Compass(0), idioma::Compass(1), idioma::Compass(2), idioma::Compass(3) };- for (int k = 0; k < 4; k++) { double a = k * 3.14159265 / 2; Text(L4[k], g_tfHdr, D2D1::RectF(c.x + (float)sin(a) * 30 - 8, c.y - (float)cos(a) * 30 - 8, c.x + (float)sin(a) * 30 + 8, c.y - (float)cos(a) * 30 + 8), white); }- swprintf_s(t, L"%d", (int)std::lround(w.wind));- Text(t, g_tfCondTitle, D2D1::RectF(c.x - 20, c.y - 12, c.x + 20, c.y + 6), white);- Text(L"km/h", g_tfHdr, D2D1::RectF(c.x - 20, c.y + 3, c.x + 20, c.y + 15), white);- }- GlassCard(c3);- Text(Tr(L"Condições"), g_tfCondTitle, D2D1::RectF(c3.left + 14, c3.top + 10, c3.right, c3.top + 28), white);- Text(Tr(L"Temperatura (°C)"), g_tfHdr, D2D1::RectF(c3.left + 14, c3.top + 26, c3.right, c3.top + 40), dim);- {- time_t now = time(nullptr);- int start = 0; for (int i = 0; i < (int)w.hours.size(); i++) if (w.hours[i].t <= now) start = i;- int n = std::min(6, (int)w.hours.size() - start);- float cw = (c3.right - c3.left - 16) / 6;- for (int k = 0; k < n; k++) {- auto& hh = w.hours[start + k];- float x = c3.left + 8 + k * cw;- Text(k == 0 ? std::wstring(Tr(L"Agora")) : HourOf(hh.t, w.off), g_tfHdrC, D2D1::RectF(x, c3.top + 50, x + cw, c3.top + 66), white);- Text(CondEmoji(hh.code, hh.day), g_tfEmojiSmall, D2D1::RectF(x, c3.top + 70, x + cw, c3.top + 100), white);- swprintf_s(t, L"%d°", (int)std::lround(hh.temp));- Text(t, g_tfCardG, D2D1::RectF(x, c3.top + 104, x + cw, c3.top + 126), white);- }- }- // linha 2: umidade (larga) e a previsão de 10 dias (alta, na coluna da direita)- float y1 = y0 + 141 + 16;- D2D1_RECT_F c4 = D2D1::RectF(x0, y1, x0 + 2 * sm + 16, y1 + 143);- GlassCard(c4); CardHead(c4, Tr(L"UMIDADE"));- swprintf_s(t, L"%d%%", (int)std::lround(w.hum));- Text(t, g_tfBigG, D2D1::RectF(c4.left + 14, c4.top + 28, c4.right, c4.top + 62), white);- {- D2D1_RECT_F bar = D2D1::RectF(c4.left + 14, c4.top + 86, c4.right - 14, c4.top + 91);- D2D1_GRADIENT_STOP gs[3] = { { 0, Rgb(255, 210, 120) }, { 0.5f, Rgb(120, 220, 255) }, { 1, Rgb(40, 110, 255) } };- ID2D1GradientStopCollection* st = nullptr; rt->CreateGradientStopCollection(gs, 3, &st);- ID2D1LinearGradientBrush* lg = nullptr;- if (st) rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ bar.left, 0 }, { bar.right, 0 }), st, &lg);- if (lg) { rt->FillRoundedRectangle(D2D1::RoundedRect(bar, 2.5f, 2.5f), lg); lg->Release(); }- if (st) st->Release();- float px = bar.left + (bar.right - bar.left) * std::clamp(w.hum / 100.f, 0.f, 1.f);- Circle({ px, (bar.top + bar.bottom) / 2 }, 4.5f, white, true);- const wchar_t* s = w.hum >= 70 ? Tr(L"O ar está úmido agora.") : w.hum <= 35 ? Tr(L"O ar está seco agora.") : Tr(L"Umidade confortável agora.");- Text(s, g_tfSmallW, D2D1::RectF(c4.left + 14, c4.top + 100, c4.right - 12, c4.bottom - 8), white);- }- float rows = (float)std::min<size_t>(10, w.days.size());- D2D1_RECT_F c5 = D2D1::RectF(wideX, y1, wideX + wideW, y1 + 30 + rows * 42 + 8);- GlassCard(c5);- {- float lo = 999, hi = -999; for (auto& d : w.days) { lo = std::min(lo, d.lo); hi = std::max(hi, d.hi); }- for (int k = 0; k < (int)rows; k++) {- auto& d = w.days[k];- float yy = c5.top + 8 + k * 42;- if (k) Fill(D2D1::RectF(c5.left + 14, yy, c5.right - 14, yy + 0.5f), Rgb(255, 255, 255, 0.22f));- Text(k == 0 ? std::wstring(Tr(L"Hoje")) : std::wstring(WeekdayShort(WdayOf(d.t + 12 * 3600, w.off))), g_tfCondTitle, D2D1::RectF(c5.left + 14, yy, c5.left + 64, yy + 42), white);- Text(CondEmoji(d.code, true), g_tfEmojiSmall, D2D1::RectF(c5.left + 64, yy, c5.left + 100, yy + 42), white);- swprintf_s(t, L"%d°", (int)std::lround(d.lo)); Text(t, g_tfRowR, D2D1::RectF(c5.left + 100, yy, c5.left + 138, yy + 42), dim);- float bx0 = c5.left + 146, bx1 = c5.right - 52, by = yy + 21;- Fill(D2D1::RectF(bx0, by - 2.5f, bx1, by + 2.5f), Rgb(0, 0, 0, 0.16f), 2.5f);- float span = std::max(1.f, hi - lo), a = bx0 + (d.lo - lo) / span * (bx1 - bx0), b = bx0 + (d.hi - lo) / span * (bx1 - bx0);- D2D1_GRADIENT_STOP gs[2] = { { 0, Rgb(255, 196, 64) }, { 1, Rgb(255, 120, 40) } };- ID2D1GradientStopCollection* st = nullptr; rt->CreateGradientStopCollection(gs, 2, &st);- ID2D1LinearGradientBrush* lg = nullptr;- if (st) rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ a, 0 }, { std::max(a + 6, b), 0 }), st, &lg);- if (lg) { rt->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(a, by - 2.5f, std::max(a + 6, b), by + 2.5f), 2.5f, 2.5f), lg); lg->Release(); }- if (st) st->Release();- swprintf_s(t, L"%d°", (int)std::lround(d.hi)); Text(t, g_tfRowR, D2D1::RectF(c5.right - 50, yy, c5.right - 14, yy + 42), white);- }- }- // linha 3: nascer e pôr do sol- float y2 = y1 + 143 + 16;- if (!w.days.empty()) {- D2D1_RECT_F c6 = D2D1::RectF(x0, y2, x0 + sm, y2 + 141), c7 = D2D1::RectF(x0 + sm + 16, y2, x0 + 2 * sm + 16, y2 + 141);- GlassCard(c6); CardHead(c6, Tr(L"NASCER DO SOL"));- Text(HmOf(w.days[0].rise, w.off), g_tfBigG, D2D1::RectF(c6.left + 14, c6.top + 28, c6.right, c6.top + 62), white);- GlassCard(c7); CardHead(c7, Tr(L"PÔR DO SOL"));- Text(HmOf(w.days[0].set, w.off), g_tfBigG, D2D1::RectF(c7.left + 14, c7.top + 28, c7.right, c7.top + 62), white);- for (D2D1_RECT_F c : { c6, c7 }) { // a curva do sol- br->SetColor(Rgb(255, 255, 255, 0.45f));- ID2D1PathGeometry* g = nullptr; d2d->CreatePathGeometry(&g);- if (g) {- ID2D1GeometrySink* s = nullptr; g->Open(&s);- float bx = c.left + 12, bw = c.right - c.left - 24, base = c.top + 112;- s->BeginFigure({ bx, base + 6 }, D2D1_FIGURE_BEGIN_HOLLOW);- for (int k = 1; k <= 30; k++) { float u = k / 30.f; s->AddLine({ bx + bw * u, base + 6 - (float)sin(u * 3.14159265) * 28 + 14 * (1 - (float)sin(u * 3.14159265)) * 0 }); }- s->EndFigure(D2D1_FIGURE_END_OPEN); s->Close(); s->Release();- rt->DrawGeometry(g, br, 2); g->Release();- }- Fill(D2D1::RectF(c.left + 12, c.top + 112, c.right - 12, c.top + 112.6f), Rgb(255, 255, 255, 0.5f));- }- }- g_gTotal = std::max(c5.bottom, y2 + 141) + g_gScroll + 20;- rt->PopAxisAlignedClip();-}---void Paint() {- if (!BeginPaint()) return;- if (BAR > 0) { PaintGoldenWx(); EndPaint(); return; } // macOS 27- g_hits.clear();- bool dark = Dark();- D2D1_SIZE_F sz = Size();- D2D1_COLOR_F text = dark ? Rgb(245, 245, 247) : Rgb(29, 29, 31), gray = dark ? Rgb(152, 152, 157) : Rgb(134, 134, 139), white = Rgb(255, 255, 255), dim = Rgb(255, 255, 255, 0.7f);- rt->Clear(dark ? Rgb(30, 30, 30) : Rgb(242, 242, 245));- const float SB = g_side ? SB_W : 0.f;- D2D1_RECT_F tog = D2D1::RectF(10, 10, 38, 38); // mostrar/esconder a lateral- auto toggle = [&](D2D1_COLOR_F c) { IconSidebar({ (tog.left + tog.right) / 2, (tog.top + tog.bottom) / 2 }, c); g_hits.push_back({ 3, 0, tog }); }; // sidebar.left (antes o "hambúrguer" E700 do Windows)- // ---- cidades- if (g_side) {- Fill(D2D1::RectF(0, 0, SB, sz.height), dark ? Rgb(40, 40, 42) : Rgb(236, 236, 240));- toggle(text);- D2D1_RECT_F add = D2D1::RectF(SB - 40, 10, SB - 10, 38);- wchar_t p[2] = { 0xE710, 0 }; Text(p, g_tfIcon, add, text);- g_hits.push_back({ 2, 0, add });- float y = 48;- for (int i = 0; i < (int)g_places.size(); i++) {- auto& pl = g_places[i];- D2D1_RECT_F r = D2D1::RectF(8, y, SB - 8, y + 70);- if (pl.wx.ok) {- D2D1_COLOR_F a, b; Sky(pl.wx, a, b);- ID2D1GradientStopCollection* st = nullptr; D2D1_GRADIENT_STOP gs[2] = { { 0, a }, { 1, b } };- rt->CreateGradientStopCollection(gs, 2, &st);- ID2D1LinearGradientBrush* lg = nullptr;- if (st) rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ r.left, r.top }, { r.right, r.bottom }), st, &lg);- if (lg) { rt->FillRoundedRectangle(D2D1::RoundedRect(r, 12, 12), lg); lg->Release(); }- if (st) st->Release();- } else Fill(r, dark ? Rgb(58, 58, 60) : Rgb(255, 255, 255), 12);- D2D1_COLOR_F tc = pl.wx.ok ? white : text;- if (i == g_sel) { br->SetColor(Rgb(10, 132, 255)); rt->DrawRoundedRectangle(D2D1::RoundedRect(r, 12, 12), br, 2.5f); }- Text(i == 0 ? std::wstring(Tr(L"Meu Local")) : pl.name, g_tfSide, D2D1::RectF(r.left + 12, r.top + 8, r.right - 60, r.top + 30), tc);- if (i == 0) Text(pl.name, g_tfSmall, D2D1::RectF(r.left + 12, r.top + 28, r.right - 60, r.top + 46), pl.wx.ok ? dim : gray);- if (pl.wx.ok) {- Text(CondText(pl.wx.code), g_tfSmall, D2D1::RectF(r.left + 12, r.bottom - 24, r.right - 60, r.bottom - 6), dim);- wchar_t t[16]; swprintf_s(t, L"%d°", (int)std::lround(pl.wx.temp));- Text(t, g_tfSideTemp, D2D1::RectF(r.right - 70, r.top + 4, r.right - 10, r.top + 44), white);- }- g_hits.push_back({ 1, i, r });- y += 78;- }- if (!g_status.empty()) Text(g_status, g_tfSmall, D2D1::RectF(12, sz.height - 30, SB - 10, sz.height - 8), gray);- } // g_side- // ---- cidade escolhida- if (g_sel < 0 || g_sel >= (int)g_places.size()) { if (!g_side) toggle(text); EndPaint(); return; }- Place pl; { std::lock_guard<std::mutex> l(g_mx); pl = g_places[g_sel]; }- D2D1_RECT_F main = D2D1::RectF(SB, 0, sz.width, sz.height);- if (!pl.wx.ok) { Text(pl.loading ? Tr(L"Carregando…") : Tr(L"Sem conexão com o serviço do tempo."), g_tfCond, main, gray); if (!g_side) toggle(text); EndPaint(); return; }- const Wx& w = pl.wx;- {- D2D1_COLOR_F a, b; Sky(w, a, b);- ID2D1GradientStopCollection* st = nullptr; D2D1_GRADIENT_STOP gs[2] = { { 0, a }, { 1, b } };- rt->CreateGradientStopCollection(gs, 2, &st);- ID2D1LinearGradientBrush* lg = nullptr;- if (st) rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, 0 }, { 0, sz.height }), st, &lg);- if (lg) { rt->FillRectangle(main, lg); lg->Release(); }- if (st) st->Release();- }- if (!g_side) toggle(white);- float cx = (SB + sz.width) / 2, W = sz.width - SB;- Text(g_sel == 0 ? std::wstring(Tr(L"Meu Local")) : pl.name, g_tfCity, D2D1::RectF(SB, 24, sz.width, 62), white);- if (g_sel == 0) Text(pl.name, g_tfSmallC, D2D1::RectF(SB, 58, sz.width, 76), dim);- wchar_t t[32]; swprintf_s(t, L" %d°", (int)std::lround(w.temp));- Text(t, g_tfTemp, D2D1::RectF(SB, 70, sz.width, 170), white);- Text(CondText(w.code), g_tfCond, D2D1::RectF(SB, 168, sz.width, 194), white);- if (!w.days.empty()) { swprintf_s(t, Tr(L"Máx.: %d° Mín.: %d°"), (int)std::lround(w.days[0].hi), (int)std::lround(w.days[0].lo)); Text(t, g_tfCond, D2D1::RectF(SB, 192, sz.width, 218), white); }- float pad = 20, y0 = 236;- // por hora- D2D1_RECT_F hr = D2D1::RectF(SB + pad, y0, sz.width - pad, y0 + 124);- Card(hr);- Text(Tr(L"PREVISÃO POR HORA"), g_tfSmall, D2D1::RectF(hr.left + 14, hr.top + 6, hr.right, hr.top + 26), dim);- time_t now = time(nullptr);- int start = 0; for (int i = 0; i < (int)w.hours.size(); i++) if (w.hours[i].t <= now) start = i;- int n = std::min(24, (int)w.hours.size() - start);- float cw = (hr.right - hr.left - 20) / std::max(1, std::min(n, (int)((hr.right - hr.left - 20) / 52)));- int vis = (int)((hr.right - hr.left - 20) / cw);- for (int k = 0; k < n && k < vis; k++) {- auto& h = w.hours[start + k];- float x = hr.left + 10 + k * cw;- Text(k == 0 ? std::wstring(Tr(L"Agora")) : HourOf(h.t, w.off), g_tfCard, D2D1::RectF(x, hr.top + 30, x + cw, hr.top + 50), white);- Text(CondEmoji(h.code, h.day), g_tfEmojiSmall, D2D1::RectF(x, hr.top + 52, x + cw, hr.top + 84), white);- swprintf_s(t, L"%d°", (int)std::lround(h.temp));- Text(t, g_tfCardBig, D2D1::RectF(x, hr.top + 88, x + cw, hr.top + 114), white);- }- // 10 dias- float colW = (W - 3 * pad) / 2;- D2D1_RECT_F dr = D2D1::RectF(SB + pad, hr.bottom + pad, SB + pad + colW, sz.height - pad);- Card(dr);- Text(Tr(L"PREVISÃO PARA 10 DIAS"), g_tfSmall, D2D1::RectF(dr.left + 14, dr.top + 6, dr.right, dr.top + 26), dim);- float lo = 999, hi = -999; for (auto& d : w.days) { lo = std::min(lo, d.lo); hi = std::max(hi, d.hi); }- float rowH = std::min(44.f, (dr.bottom - dr.top - 34) / std::max<size_t>(1, w.days.size()));- for (int k = 0; k < (int)w.days.size(); k++) {- auto& d = w.days[k];- float yy = dr.top + 30 + k * rowH;- if (yy + rowH > dr.bottom) break;- Text(k == 0 ? std::wstring(Tr(L"Hoje")) : std::wstring(WeekdayShort(WdayOf(d.t + 12 * 3600, w.off))), g_tfCard, D2D1::RectF(dr.left + 14, yy, dr.left + 70, yy + rowH), white);- Text(CondEmoji(d.code, true), g_tfEmojiSmall, D2D1::RectF(dr.left + 64, yy, dr.left + 100, yy + rowH), white);- swprintf_s(t, L"%d°", (int)std::lround(d.lo)); Text(t, g_tfRowR, D2D1::RectF(dr.left + 96, yy, dr.left + 136, yy + rowH), dim);- float bx0 = dr.left + 146, bx1 = dr.right - 56, by = yy + rowH / 2;- Fill(D2D1::RectF(bx0, by - 2.5f, bx1, by + 2.5f), Rgb(0, 0, 0, 0.18f), 2.5f);- float span = std::max(1.f, hi - lo), a = bx0 + (d.lo - lo) / span * (bx1 - bx0), b = bx0 + (d.hi - lo) / span * (bx1 - bx0);- Fill(D2D1::RectF(a, by - 2.5f, std::max(a + 6, b), by + 2.5f), Rgb(255, 196, 64), 2.5f);- swprintf_s(t, L"%d°", (int)std::lround(d.hi)); Text(t, g_tfRowR, D2D1::RectF(dr.right - 52, yy, dr.right - 12, yy + rowH), white);- }- // quadros- float qx = dr.right + pad, qw = (sz.width - pad - qx - pad) / 2, qh = std::min(150.f, (dr.bottom - dr.top - pad) / 2);- auto quad = [&](int i, const wchar_t* title, const std::wstring& big, const std::wstring& sub) {- float x = qx + (i % 2) * (qw + pad), yy = dr.top + (i / 2) * (qh + pad);- D2D1_RECT_F r = D2D1::RectF(x, yy, x + qw, yy + qh);- Card(r);- Text(title, g_tfSmall, D2D1::RectF(r.left + 14, r.top + 6, r.right, r.top + 26), dim);- Text(big, g_tfCity, D2D1::RectF(r.left + 14, r.top + 30, r.right - 8, r.top + 70), white);- IDWriteTextFormat* f = g_tfSmall; if (f) f->SetWordWrapping(DWRITE_WORD_WRAPPING_WRAP);- Text(sub, g_tfSmall, D2D1::RectF(r.left + 14, r.top + 72, r.right - 10, r.bottom - 8), white);- if (f) f->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP);- };- if (g_tfCity) g_tfCity->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING);- swprintf_s(t, L"%d°", (int)std::lround(w.feels));- quad(0, Tr(L"SENSAÇÃO"), t, w.feels < w.temp - 1 ? Tr(L"O vento deixa mais frio do que a temperatura real.") : w.feels > w.temp + 1 ? Tr(L"A umidade deixa mais quente do que a temperatura real.") : Tr(L"Parecida com a temperatura real."));- swprintf_s(t, L"%d%%", (int)std::lround(w.hum));- quad(1, Tr(L"UMIDADE"), t, L"");- swprintf_s(t, L"%d km/h", (int)std::lround(w.wind));- quad(2, Tr(L"VENTO"), t, L"");- if (!w.days.empty()) quad(3, Tr(L"NASCER DO SOL"), HmOf(w.days[0].rise, w.off), std::wstring(Tr(L"Pôr do sol: ")) + HmOf(w.days[0].set, w.off));- if (g_tfCity) g_tfCity->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER);- (void)cx;- EndPaint();-}--LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {- switch (m) {- case WM_PAINT: { PAINTSTRUCT ps; ::BeginPaint(h, &ps); Paint(); ::EndPaint(h, &ps); return 0; }- case WM_ERASEBKGND: return 1;- case WM_SIZE: OnSize(l); return 0;- case WM_DPICHANGED: OnDpi(w, l); return 0;- case WM_SETTINGCHANGE: InvalidateRect(h, nullptr, FALSE); return 0;- case WM_CTLCOLOREDIT:- if (BAR > 0) { // macOS 27: o EDIT fica dentro da cápsula de vidro (GlassField): o fundo dele é a cor dela- if (!Dark()) return FieldColors((HDC)w, RGB(249, 250, 251));- D2D1_COLOR_F c = SidebarColor(); // escuro: branco a 8% sobre a cor da barra lateral- auto m = [](float v) { return (int)std::lround((v + (1 - v) * 0.08f) * 255); };- return FieldColors((HDC)w, RGB(m(c.r), m(c.g), m(c.b)));- }- return FieldColors((HDC)w, Dark() ? RGB(40, 40, 42) : RGB(236, 236, 240));- case WM_FIELDLOST: if (field.h && GetFocus() != field.h) FieldEnd(0); return 0;- case WM_DATA: {- int i = (int)w;- if (i == -1) { // cidade procurada- auto* p = (Place*)l;- if (!p->name.empty()) { g_places.push_back(*p); g_sel = (int)g_places.size() - 1; Save(); Fetch(g_sel); g_status.clear(); }- else g_status = Tr(L"Cidade não encontrada.");- delete p;- } else {- auto* wx = (Wx*)l;- if (i >= 0 && i < (int)g_places.size()) { std::lock_guard<std::mutex> lk(g_mx); g_places[i].loading = false; if (wx->ok) g_places[i].wx = *wx; }- delete wx;- }- InvalidateRect(h, nullptr, FALSE);- return 0;- }- case WM_TIMER: for (int i = 0; i < (int)g_places.size(); i++) Fetch(i); return 0; // a cada 15 min- case WM_MOUSEWHEEL: if (BAR > 0) { // macOS 27: o conteúdo rola- g_gScroll = std::clamp(g_gScroll - GET_WHEEL_DELTA_WPARAM(w) / 120.f * 60, 0.f, std::max(0.f, g_gTotal - Size().height));- InvalidateRect(h, nullptr, FALSE);- } return 0;- case WM_LBUTTONDOWN: case WM_RBUTTONUP: {- if (field.h) FieldEnd(0);- float s = Sc(), x = GET_X_LPARAM(l) / s, y = GET_Y_LPARAM(l) / s;- for (auto& ht : g_hits) if (In(ht.r, x, y)) {- if (ht.kind == 3) { g_side = !g_side; InvalidateRect(h, nullptr, FALSE); return 0; }- if (ht.kind == 2) {- if (!g_side) { g_side = true; Paint(); } // a busca fica na lateral- D2D1_RECT_F fr = BAR > 0 ? D2D1::RectF(40, 71, 252, 89) : D2D1::RectF(12, 12, SB_W - 46, 36);- FieldOpen(fr, L"", BAR > 0 ? 14.f : 13.f, false, [](const std::wstring& t, int key) { if (key == VK_RETURN) Search(t); });- InvalidateRect(h, nullptr, FALSE); // tira o "Buscar" de baixo do campo- return 0;- }- if (ht.kind == 1) {- if (m == WM_RBUTTONUP) {- POINT scr{ GET_X_LPARAM(l), GET_Y_LPARAM(l) }; ClientToScreen(h, &scr);- HMENU mm = CreatePopupMenu();- if (ht.arg > 0) AppendMenuW(mm, MF_STRING, 2, Tr(L"Usar como Meu Local"));- AppendMenuW(mm, MF_STRING | (g_places.size() > 1 ? 0 : MF_GRAYED), 1, Tr(L"Apagar"));- int k = TrackPopupMenu(mm, TPM_RETURNCMD | TPM_RIGHTBUTTON, scr.x, scr.y, 0, h, nullptr);- DestroyMenu(mm);- if (k == 2) { std::lock_guard<std::mutex> lk(g_mx); std::swap(g_places[0], g_places[ht.arg]); SetMyPlace(g_places[0]); g_sel = 0; Save(); }- else if (k == 1 && g_places.size() > 1) {- { std::lock_guard<std::mutex> lk(g_mx); g_places.erase(g_places.begin() + ht.arg); }- if (ht.arg == 0) SetMyPlace(g_places[0]); // o "Meu Local" saiu: a próxima cidade fica no lugar- g_sel = 0; Save();- }- } else g_sel = ht.arg;- InvalidateRect(h, nullptr, FALSE);- }- return 0;- }- return 0;- }- case WM_KEYDOWN:- if (GetKeyState(VK_CONTROL) < 0 && w == 'W') DestroyWindow(h);- if (GetKeyState(VK_CONTROL) < 0 && w == 'R') for (int i = 0; i < (int)g_places.size(); i++) Fetch(i);- if (w == VK_UP && g_sel > 0) { g_sel--; InvalidateRect(h, nullptr, FALSE); }- if (w == VK_DOWN && g_sel + 1 < (int)g_places.size()) { g_sel++; InvalidateRect(h, nullptr, FALSE); }- return 0;- case WM_DESTROY: PostQuitMessage(0); return 0;- }- return DefWindowProcW(h, m, w, l);-}--} // namespace--int WINAPI wWinMain(HINSTANCE hi, HINSTANCE, PWSTR, int show) {- if (!Init()) return 1;- g_file = DataPath(L"clima.txt");- Load();- std::wstring disp = HasFont(L"SF Pro Display") ? L"SF Pro Display" : family;- g_tfCity = Fmt(30, DWRITE_FONT_WEIGHT_MEDIUM, DWRITE_TEXT_ALIGNMENT_CENTER, false, disp.c_str());- g_tfTemp = Fmt(92, DWRITE_FONT_WEIGHT_THIN, DWRITE_TEXT_ALIGNMENT_CENTER, false, disp.c_str());- g_tfCond = Fmt(18, DWRITE_FONT_WEIGHT_MEDIUM, DWRITE_TEXT_ALIGNMENT_CENTER);- g_tfSmall = Fmt(12, DWRITE_FONT_WEIGHT_MEDIUM);- g_tfSmallC = Fmt(13, DWRITE_FONT_WEIGHT_MEDIUM, DWRITE_TEXT_ALIGNMENT_CENTER);- g_tfCard = Fmt(14, DWRITE_FONT_WEIGHT_MEDIUM, DWRITE_TEXT_ALIGNMENT_CENTER);- g_tfCardBig = Fmt(18, DWRITE_FONT_WEIGHT_MEDIUM, DWRITE_TEXT_ALIGNMENT_CENTER);- g_tfRowR = Fmt(16, DWRITE_FONT_WEIGHT_MEDIUM, DWRITE_TEXT_ALIGNMENT_TRAILING);- g_tfEmojiSmall = nullptr; dw->CreateTextFormat(L"Segoe UI Emoji", nullptr, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 20, L"", &g_tfEmojiSmall);- if (g_tfEmojiSmall) { g_tfEmojiSmall->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER); g_tfEmojiSmall->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER); }- g_tfSide = Fmt(15, DWRITE_FONT_WEIGHT_SEMI_BOLD);- g_tfSideTemp = Fmt(30, DWRITE_FONT_WEIGHT_LIGHT, DWRITE_TEXT_ALIGNMENT_TRAILING, false, disp.c_str());- g_tfIcon = Fmt(16, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_TEXT_ALIGNMENT_CENTER, false, IconFamily());- g_tfCityG = Fmt(22, DWRITE_FONT_WEIGHT_MEDIUM, DWRITE_TEXT_ALIGNMENT_CENTER, false, disp.c_str());- g_tfTempG = Fmt(64, DWRITE_FONT_WEIGHT_THIN, DWRITE_TEXT_ALIGNMENT_CENTER, false, disp.c_str());- g_tfCondG = Fmt(14, DWRITE_FONT_WEIGHT_SEMI_BOLD, DWRITE_TEXT_ALIGNMENT_CENTER);- g_tfHdr = Fmt(11, DWRITE_FONT_WEIGHT_SEMI_BOLD);- g_tfHdrC = Fmt(12, DWRITE_FONT_WEIGHT_SEMI_BOLD, DWRITE_TEXT_ALIGNMENT_CENTER);- g_tfBigG = Fmt(26, DWRITE_FONT_WEIGHT_MEDIUM, DWRITE_TEXT_ALIGNMENT_LEADING, false, disp.c_str());- g_tfSmallW = Fmt(11.5f, DWRITE_FONT_WEIGHT_MEDIUM, DWRITE_TEXT_ALIGNMENT_LEADING, true);- if (g_tfSmallW) g_tfSmallW->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_NEAR);- g_tfSearchG = Fmt(14);- g_tfCondTitle = Fmt(14, DWRITE_FONT_WEIGHT_SEMI_BOLD);- g_tfCardG = Fmt(14, DWRITE_FONT_WEIGHT_SEMI_BOLD, DWRITE_TEXT_ALIGNMENT_CENTER);- barWanted = 52; // macOS 27: o céu atrás da barra- if (!CreateMain(hi, L"ClimaJanela", Tr(L"Clima"), Proc, semaforo::Aqua() ? 1070 : 1080, semaforo::Aqua() ? 768 : 760)) return 1;- for (int i = 0; i < (int)g_places.size(); i++) Fetch(i);- SetTimer(wnd, 1, 15 * 60 * 1000, nullptr);- ShowWindow(wnd, show);- return Run();-}+// Clima (Weather do Mac): à esquerda as cidades (a primeira é a dos Ajustes, a mesma do widget); à direita, sobre+// um fundo da cor do céu, a cidade, a temperatura grande, a condição, máx./mín., a previsão por hora (24 h), a de+// 10 dias (com a barra de mín.–máx.) e os quadros de sensação, umidade, vento e sol. Dados do Open-Meteo (sem chave).+// "+" procura uma cidade pelo nome (geocodificação do Open-Meteo); botão direito numa cidade: tornar "Meu Local"+// (vai para os Ajustes, o mesmo do widget) ou apagar (o "Meu Local" também, se houver outra para ficar no lugar).+// Cidades em %APPDATA%\Shell\clima.txt.+#include "../comum/app2d.h"+#include "../comum/cidade_padrao.h"+#include <winhttp.h>+#include <map>+#include <mutex>+#include <thread>+#pragma comment(lib, "winhttp.lib")++using namespace app2d;++namespace {++const float SB_W = 230;+bool g_side = true; // barra lateral das cidades (o botão dela esconde e mostra; antes não havia como)+const UINT WM_DATA = WM_APP + 5, WM_FIELDLOST = WM_APP + 77;++struct Hour { double t; float temp; int code; bool day; };+struct Day { double t; float hi, lo; int code; double rise, set; };+struct Wx { bool ok = false; float temp = 0, feels = 0, hum = 0, wind = 0; int code = 0; bool day = true; int off = 0; std::vector<Hour> hours; std::vector<Day> days; };+struct Place { std::wstring name; std::wstring lat, lon; Wx wx; bool loading = false; };+std::vector<Place> g_places;+int g_sel = 0;+std::mutex g_mx;+std::wstring g_file;+std::wstring g_status;+bool g_meuLocal = wcsstr(GetCommandLineW(), L"--meu-local") != nullptr; // aberto pelo "Editar Local…" do widget da mesa+IDWriteTextFormat *g_tfSmallC, *g_tfCity, *g_tfTemp, *g_tfCond, *g_tfSmall, *g_tfCard, *g_tfCardBig, *g_tfEmoji, *g_tfEmojiSmall, *g_tfSide, *g_tfSideTemp, *g_tfIcon, *g_tfRowR;+IDWriteTextFormat *g_tfHdrC, *g_tfCardG; // macOS 27++std::string HttpGet(const wchar_t* host, const std::wstring& path) {+ std::string body;+ HINTERNET ses = WinHttpOpen(L"SequoiaClima/1.0", WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0);+ if (!ses) return body;+ WinHttpSetTimeouts(ses, 5000, 5000, 8000, 8000);+ HINTERNET con = WinHttpConnect(ses, host, INTERNET_DEFAULT_HTTPS_PORT, 0);+ HINTERNET req = con ? WinHttpOpenRequest(con, L"GET", path.c_str(), nullptr, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, WINHTTP_FLAG_SECURE) : nullptr;+ if (req && WinHttpSendRequest(req, WINHTTP_NO_ADDITIONAL_HEADERS, 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0) && WinHttpReceiveResponse(req, nullptr)) {+ DWORD status = 0, sz = sizeof(status);+ WinHttpQueryHeaders(req, WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, nullptr, &status, &sz, nullptr);+ DWORD avail = 0;+ while (WinHttpQueryDataAvailable(req, &avail) && avail && body.size() < 512 * 1024) {+ std::string chunk(avail, '\0'); DWORD got = 0;+ if (!WinHttpReadData(req, chunk.data(), avail, &got) || !got) break;+ body.append(chunk.data(), got);+ }+ if (status != 200) body.clear();+ }+ if (req) WinHttpCloseHandle(req);+ if (con) WinHttpCloseHandle(con);+ WinHttpCloseHandle(ses);+ return body;+}+std::string Section(const std::string& j, const char* key) {+ size_t p = j.find(std::string("\"") + key + "\":{");+ if (p == std::string::npos) return "";+ p = j.find('{', p);+ int depth = 0;+ for (size_t i = p; i < j.size(); i++) { if (j[i] == '{') depth++; else if (j[i] == '}' && --depth == 0) return j.substr(p, i - p + 1); }+ return "";+}+double Number(const std::string& s, const char* key) {+ size_t p = s.find(std::string("\"") + key + "\":");+ if (p == std::string::npos) return NAN;+ p += strlen(key) + 3;+ while (p < s.size() && s[p] == ' ') p++;+ if (s.compare(p, 4, "null") == 0) return NAN;+ return strtod(s.c_str() + p, nullptr);+}+std::vector<double> Array(const std::string& s, const char* key) {+ std::vector<double> v;+ size_t p = s.find(std::string("\"") + key + "\":[");+ if (p == std::string::npos) return v;+ p = s.find('[', p) + 1;+ while (p < s.size() && s[p] != ']') {+ while (p < s.size() && (s[p] == ' ' || s[p] == ',')) p++;+ if (s[p] == ']') break;+ if (s.compare(p, 4, "null") == 0) { v.push_back(NAN); p += 4; continue; }+ char* e = nullptr; v.push_back(strtod(s.c_str() + p, &e));+ if (e == s.c_str() + p) break;+ p = e - s.c_str();+ }+ return v;+}+std::wstring Utf8(const std::string& s) { int n = MultiByteToWideChar(CP_UTF8, 0, s.data(), (int)s.size(), nullptr, 0); std::wstring w(n, L'\0'); MultiByteToWideChar(CP_UTF8, 0, s.data(), (int)s.size(), w.data(), n); return w; }+std::string ToUtf8(const std::wstring& w) { int n = WideCharToMultiByte(CP_UTF8, 0, w.data(), (int)w.size(), nullptr, 0, nullptr, nullptr); std::string s(n, '\0'); WideCharToMultiByte(CP_UTF8, 0, w.data(), (int)w.size(), s.data(), n, nullptr, nullptr); return s; }+std::string StrField(const std::string& s, const char* key) {+ size_t p = s.find(std::string("\"") + key + "\":\"");+ if (p == std::string::npos) return "";+ p += strlen(key) + 4;+ size_t e = s.find('"', p);+ return e == std::string::npos ? "" : s.substr(p, e - p);+}++bool Parse(const std::string& j, Wx& w) {+ std::string cur = Section(j, "current"), hr = Section(j, "hourly"), dl = Section(j, "daily");+ if (cur.empty() || hr.empty() || dl.empty()) return false;+ double off = Number(j, "utc_offset_seconds"); if (!std::isnan(off)) w.off = (int)off;+ w.temp = (float)Number(cur, "temperature_2m"); w.feels = (float)Number(cur, "apparent_temperature");+ w.hum = (float)Number(cur, "relative_humidity_2m"); w.wind = (float)Number(cur, "wind_speed_10m");+ w.code = (int)Number(cur, "weather_code"); w.day = Number(cur, "is_day") > 0.5;+ auto t = Array(hr, "time"), tp = Array(hr, "temperature_2m"), c = Array(hr, "weather_code"), d = Array(hr, "is_day");+ for (size_t i = 0; i < t.size() && i < tp.size() && i < c.size() && i < d.size(); i++) w.hours.push_back({ t[i], (float)tp[i], (int)c[i], d[i] > 0.5 });+ auto dt = Array(dl, "time"), mx = Array(dl, "temperature_2m_max"), mn = Array(dl, "temperature_2m_min"), dc = Array(dl, "weather_code"), sr = Array(dl, "sunrise"), ss = Array(dl, "sunset");+ for (size_t i = 0; i < dt.size() && i < mx.size() && i < mn.size() && i < dc.size(); i++)+ w.days.push_back({ dt[i], (float)mx[i], (float)mn[i], (int)dc[i], i < sr.size() ? sr[i] : 0, i < ss.size() ? ss[i] : 0 });+ w.ok = !std::isnan(w.temp) && !w.days.empty();+ return w.ok;+}++void Fetch(int i) {+ Place& p = g_places[i];+ if (p.loading) return;+ p.loading = true;+ std::wstring lat = p.lat, lon = p.lon;+ HWND h = wnd;+ std::thread([i, lat, lon, h] {+ std::wstring path = L"/v1/forecast?latitude=" + lat + L"&longitude=" + lon ++ L"¤t=temperature_2m,apparent_temperature,relative_humidity_2m,wind_speed_10m,weather_code,is_day"+ L"&hourly=temperature_2m,weather_code,is_day&daily=weather_code,temperature_2m_max,temperature_2m_min,sunrise,sunset"+ L"&timezone=auto&forecast_days=10&timeformat=unixtime";+ std::string body = HttpGet(L"api.open-meteo.com", path);+ auto* w = new Wx;+ if (body.empty() || !Parse(body, *w)) w->ok = false;+ if (!PostMessageW(h, WM_DATA, (WPARAM)i, (LPARAM)w)) delete w;+ }).detach();+}++void Save() {+ std::vector<std::wstring> out{ L"# Cidades do Clima (nome, latitude, longitude); a primeira vem dos Ajustes" };+ for (size_t i = 1; i < g_places.size(); i++) out.push_back(L"C\t" + Esc(g_places[i].name) + L"\t" + g_places[i].lat + L"\t" + g_places[i].lon);+ WriteLines(g_file, out);+}++std::wstring Setting(const wchar_t* key, const wchar_t* def) {+ for (auto& l : ReadLines(DataPath(L"ajustes.txt"))) { size_t e = l.find(L'='); if (e != std::wstring::npos && l.substr(0, e) == key) return l.substr(e + 1); }+ return def;+}+// "Meu Local" vai para os Ajustes (tempoCidade/Lat/Lon), o mesmo do widget da mesa+void SetMyPlace(const Place& p) {+ SetAppSetting(L"tempoCidade", p.name);+ SetAppSetting(L"tempoLat", p.lat);+ SetAppSetting(L"tempoLon", p.lon);+}+void Load() {+ g_places.clear();+ cidade::Padrao def; // sem cidade nos Ajustes: a do fuso do Windows (antes era sempre Campinas)+ g_places.push_back({ Setting(L"tempoCidade", def.nome.c_str()), Setting(L"tempoLat", def.lat.c_str()), Setting(L"tempoLon", def.lon.c_str()) });+ for (auto& l : ReadLines(g_file)) { auto f = Split(l); if (f.size() >= 4 && f[0] == L"C") g_places.push_back({ Unesc(f[1]), f[2], f[3] }); }+}++// procura a cidade (geocodificação) e põe na lista+void Search(const std::wstring& q) {+ if (q.empty()) return;+ g_status = Tr(L"Procurando…");+ InvalidateRect(wnd, nullptr, FALSE);+ HWND h = wnd;+ std::thread([q, h] {+ std::string u = ToUtf8(q), enc;+ for (unsigned char c : u) { if (isalnum(c) || c == '-' || c == '.') enc += (char)c; else { char b[4]; sprintf_s(b, "%%%02X", c); enc += b; } }+ std::wstring path = L"/v1/search?count=1&language=" + std::wstring(idioma::Code()) + L"&name=" + Utf8(enc);+ std::string body = HttpGet(L"geocoding-api.open-meteo.com", path);+ auto* p = new Place;+ if (!body.empty() && body.find("\"results\"") != std::string::npos) {+ double la = Number(body, "latitude"), lo = Number(body, "longitude");+ std::string name = StrField(body, "name"), adm = StrField(body, "admin1");+ if (!std::isnan(la)) {+ wchar_t a[32], b[32]; swprintf_s(a, L"%.4f", la); swprintf_s(b, L"%.4f", lo);+ p->name = Utf8(name); p->lat = a; p->lon = b;+ }+ }+ if (!PostMessageW(h, WM_DATA, (WPARAM)-1, (LPARAM)p)) delete p;+ }).detach();+}++// ---- condições (códigos WMO)+const wchar_t* CondText(int c) {+ if (c == 0) return Tr(L"Céu Limpo");+ if (c <= 2) return Tr(L"Parcialmente Nublado");+ if (c == 3) return Tr(L"Nublado");+ if (c == 45 || c == 48) return Tr(L"Neblina");+ if (c >= 51 && c <= 57) return Tr(L"Garoa");+ if ((c >= 61 && c <= 67) || (c >= 80 && c <= 82)) return Tr(L"Chuva");+ if ((c >= 71 && c <= 77) || c == 85 || c == 86) return Tr(L"Neve");+ if (c >= 95) return Tr(L"Tempestade");+ return L"";+}+const wchar_t* CondEmoji(int c, bool day) {+ if (c == 0) return day ? L"☀️" : L"\U0001F319";+ if (c <= 2) return day ? L"⛅" : L"☁️";+ if (c == 3) return L"☁️";+ if (c == 45 || c == 48) return L"\U0001F32B️";+ if (c >= 51 && c <= 57) return L"\U0001F326️";+ if ((c >= 61 && c <= 67) || (c >= 80 && c <= 82)) return L"\U0001F327️";+ if ((c >= 71 && c <= 77) || c == 85 || c == 86) return L"❄️";+ if (c >= 95) return L"⛈️";+ return L"☁️";+}+// cor do céu (em cima, embaixo)+void Sky(const Wx& w, D2D1_COLOR_F& a, D2D1_COLOR_F& b) {+ bool cloudy = w.code >= 3, rain = w.code >= 51;+ if (!w.day) { a = Rgb(16, 24, 48); b = Rgb(38, 48, 80); }+ else if (rain) { a = Rgb(70, 84, 104); b = Rgb(110, 124, 140); }+ else if (cloudy) { a = Rgb(92, 120, 150); b = Rgb(140, 160, 182); }+ else { a = Rgb(40, 110, 200); b = Rgb(110, 170, 230); }+}+std::wstring HourOf(double unix, int off) { time_t t = (time_t)unix + off; tm g{}; gmtime_s(&g, &t); wchar_t b[8]; swprintf_s(b, L"%d", g.tm_hour); return b; }+std::wstring HmOf(double unix, int off) { time_t t = (time_t)unix + off; tm g{}; gmtime_s(&g, &t); wchar_t b[8]; swprintf_s(b, L"%d:%02d", g.tm_hour, g.tm_min); return b; }+int WdayOf(double unix, int off) { time_t t = (time_t)unix + off; tm g{}; gmtime_s(&g, &t); return g.tm_wday; }++struct Hit { int kind, arg; D2D1_RECT_F r; };+std::vector<Hit> g_hits;++void Card(D2D1_RECT_F r) { Fill(r, Rgb(255, 255, 255, 0.14f), 14); }+const wchar_t* CondText(int c);+const wchar_t* CondEmoji(int c, bool day);+// ---- macOS 27 (captura Weather do 512 Pixels, 2x, medida em pt): o céu ocupa a janela toda (a barra é+// transparente); lateral de 270, o botão de "barra lateral" (244, 26) e a busca em cápsula (9–262, 63–97); o "+"+// redondo fica no conteúdo (297, 26). A lateral segue o tema como nos outros apps (claro/escuro/automático pelo+// Windows, app2d::Dark): cor cheia da barra lateral (SidebarColor), botões e busca de vidro (GlassButton/GlassField,+// os mesmos do Contatos e do Música) e cada cidade num cartão com o céu dela, como no Tempo do Mac. Antes a lateral era+// sempre o céu escurecido: no tema claro o app abria escuro, e o campo de busca ficava com um fundo azul chapado. No meio: cidade (20), temperatura fina (64), condição e+// máx./mín. Embaixo uma grade de 622 de largura, centrada: dois quadros de 143 e um largo de 304 por linha (141 de+// altura, 16 entre eles), vidro claro com cantos 18 e o título em maiúsculas pequenas.+float g_gScroll;+float g_gTotal;+IDWriteTextFormat *g_tfCityG, *g_tfTempG, *g_tfCondG, *g_tfHdr, *g_tfBigG, *g_tfSmallW, *g_tfSearchG, *g_tfCondTitle;++void SkyFill(D2D1_RECT_F r, const Wx& w, float darken) {+ D2D1_COLOR_F a, b; Sky(w, a, b);+ auto dk = [&](D2D1_COLOR_F c) { return D2D1::ColorF(c.r * (1 - darken), c.g * (1 - darken), c.b * (1 - darken), 1); };+ D2D1_GRADIENT_STOP gs[2] = { { 0, dk(a) }, { 1, dk(b) } };+ ID2D1GradientStopCollection* st = nullptr; rt->CreateGradientStopCollection(gs, 2, &st);+ ID2D1LinearGradientBrush* lg = nullptr;+ if (st) rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, 0 }, { 0, Size().height }), st, &lg);+ if (lg) { rt->FillRectangle(r, lg); lg->Release(); }+ if (st) st->Release();+}+void GlassCard(D2D1_RECT_F r) {+ Fill(r, Rgb(255, 255, 255, 0.15f), 18);+ br->SetColor(Rgb(255, 255, 255, 0.20f));+ rt->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 0.25f, r.top + 0.25f, r.right - 0.25f, r.bottom - 0.25f), 17.75f, 17.75f), br, 0.5f);+}+void CardHead(D2D1_RECT_F r, const wchar_t* title) { Text(title, g_tfHdr, D2D1::RectF(r.left + 14, r.top + 8, r.right - 10, r.top + 24), Rgb(255, 255, 255, 0.62f)); }++void PaintGoldenWx() {+ g_hits.clear();+ D2D1_SIZE_F sz = Size();+ D2D1_COLOR_F white = Rgb(255, 255, 255), dim = Rgb(255, 255, 255, 0.72f);+ const float SBG = g_side ? 270.f : 0.f;+ Place pl; bool have = g_sel >= 0 && g_sel < (int)g_places.size();+ if (have) { std::lock_guard<std::mutex> l(g_mx); pl = g_places[g_sel]; }+ Wx sky = have && pl.wx.ok ? pl.wx : Wx{};+ if (!have || !pl.wx.ok) { sky.day = true; sky.code = 1; }+ SkyFill(D2D1::RectF(0, 0, sz.width, sz.height), sky, 0);+ // ---- lateral (escondida: o botão dela fica na barra, logo depois dos três botões da janela, sobre o céu)+ if (!g_side) {+ D2D1_RECT_F tb = D2D1::RectF(84, 8, 120, 44);+ Fill(tb, Rgb(255, 255, 255, 0.16f), 18); IconSidebar({ 102, 26 }, white); BarButton(tb);+ g_hits.push_back({ 3, 0, tb });+ } else {+ const bool dark = Dark();+ const D2D1_COLOR_F text = dark ? Rgb(245, 245, 247) : Rgb(29, 29, 31), gray = dark ? Rgb(152, 152, 157) : Rgb(134, 134, 139);+ Fill(D2D1::RectF(0, 0, SBG, sz.height), SidebarColor());+ Fill(D2D1::RectF(SBG - 0.5f, 0, SBG, sz.height), dark ? Rgb(0, 0, 0, 0.5f) : Rgb(0, 0, 0, 0.12f));+ D2D1_RECT_F tb = D2D1::RectF(244 - 18, 8, 244 + 18, 44);+ GlassButton(tb, dark); IconSidebar({ 244, 26 }, text); BarButton(tb);+ g_hits.push_back({ 3, 0, tb });+ D2D1_RECT_F sr = D2D1::RectF(9, 63, 262, 97);+ GlassField(sr, dark);+ IconSearch({ 27, 80 }, gray, 0.9f);+ if (!field.h) Text(Tr(L"Buscar"), g_tfSearchG, D2D1::RectF(40, sr.top, sr.right - 10, sr.bottom), gray);+ g_hits.push_back({ 2, 0, sr });+ float y = 108;+ rt->PushAxisAlignedClip(D2D1::RectF(0, 100, SBG, sz.height), D2D1_ANTIALIAS_MODE_ALIASED);+ for (int i = 0; i < (int)g_places.size(); i++) {+ auto& p = g_places[i];+ D2D1_RECT_F r = D2D1::RectF(9, y, 262, y + 70);+ // o cartão com o céu da cidade (cinza enquanto carrega); a escolhida com o contorno na cor de destaque+ if (p.wx.ok) {+ D2D1_COLOR_F a, b; Sky(p.wx, a, b);+ D2D1_GRADIENT_STOP gs[2] = { { 0, a }, { 1, b } };+ ID2D1GradientStopCollection* st = nullptr; rt->CreateGradientStopCollection(gs, 2, &st);+ ID2D1LinearGradientBrush* lg = nullptr;+ if (st) rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ r.left, r.top }, { r.right, r.bottom }), st, &lg);+ if (lg) { rt->FillRoundedRectangle(D2D1::RoundedRect(r, 14, 14), lg); lg->Release(); }+ if (st) st->Release();+ } else Fill(r, dark ? Rgb(255, 255, 255, 0.08f) : Rgb(0, 0, 0, 0.05f), 14);+ if (i == g_sel) { br->SetColor(semaforo::Aqua() ? Rgb(0, 136, 255) : Rgb(10, 132, 255)); rt->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1), 13, 13), br, 2); }+ D2D1_COLOR_F tc = p.wx.ok ? white : text, tdim = p.wx.ok ? dim : gray;+ Text(i == 0 ? std::wstring(Tr(L"Meu Local")) : p.name, g_tfSide, D2D1::RectF(r.left + 12, r.top + 8, r.right - 60, r.top + 30), tc);+ if (i == 0) Text(p.name, g_tfSmall, D2D1::RectF(r.left + 12, r.top + 28, r.right - 60, r.top + 46), tdim);+ if (p.wx.ok) {+ Text(CondText(p.wx.code), g_tfSmall, D2D1::RectF(r.left + 12, r.bottom - 24, r.right - 60, r.bottom - 6), dim);+ wchar_t t[16]; swprintf_s(t, L"%d°", (int)std::lround(p.wx.temp));+ Text(t, g_tfSideTemp, D2D1::RectF(r.right - 80, r.top + 4, r.right - 12, r.top + 44), white);+ }+ g_hits.push_back({ 1, i, r });+ y += 76;+ }+ rt->PopAxisAlignedClip();+ if (!g_status.empty()) Text(g_status, g_tfSmall, D2D1::RectF(12, sz.height - 30, SBG - 10, sz.height - 8), gray);+ } // g_side+ // "+" no conteúdo+ float addX = g_side ? 297.f : 146.f;+ D2D1_RECT_F add = D2D1::RectF(addX - 18, 8, addX + 18, 44);+ Fill(add, Rgb(255, 255, 255, 0.16f), 18); IconPlus({ addX, 26 }, white);+ g_hits.push_back({ 2, 0, add }); BarButton(add);+ if (!have) return;+ float X0 = SBG, cx = (SBG + sz.width) / 2;+ if (!pl.wx.ok) { Text(pl.loading ? Tr(L"Carregando…") : Tr(L"Sem conexão com o serviço do tempo."), g_tfCondG, D2D1::RectF(X0, 0, sz.width, sz.height), white); return; }+ const Wx& w = pl.wx;+ rt->PushAxisAlignedClip(D2D1::RectF(X0, 52, sz.width, sz.height), D2D1_ANTIALIAS_MODE_ALIASED);+ float oy = -g_gScroll;+ wchar_t t[64];+ Text(g_sel == 0 ? std::wstring(Tr(L"Meu Local")) : pl.name, g_tfCityG, D2D1::RectF(X0, oy + 94, sz.width, oy + 120), white);+ swprintf_s(t, L" %d°", (int)std::lround(w.temp));+ Text(t, g_tfTempG, D2D1::RectF(X0, oy + 118, sz.width, oy + 182), white);+ Text(CondText(w.code), g_tfCondG, D2D1::RectF(X0, oy + 177, sz.width, oy + 195), white);+ if (!w.days.empty()) { swprintf_s(t, Tr(L"Máx.: %d° Mín.: %d°"), (int)std::lround(w.days[0].hi), (int)std::lround(w.days[0].lo)); Text(t, g_tfCondG, D2D1::RectF(X0, oy + 194, sz.width, oy + 212), white); }+ float GW = 622, x0 = cx - GW / 2, y0 = oy + 266;+ if (x0 < X0 + 12) { x0 = X0 + 12; GW = sz.width - X0 - 24; }+ float sm = (GW - 32 - 304) / 2 > 100 ? 143.f : (GW - 16) / 2, wideX = x0 + 2 * sm + 32, wideW = x0 + GW - wideX;+ // linha 1: sensação, vento, condições por hora+ D2D1_RECT_F c1 = D2D1::RectF(x0, y0, x0 + sm, y0 + 141), c2 = D2D1::RectF(x0 + sm + 16, y0, x0 + 2 * sm + 16, y0 + 141);+ D2D1_RECT_F c3 = D2D1::RectF(wideX, y0, wideX + wideW, y0 + 141);+ GlassCard(c1); CardHead(c1, Tr(L"SENSAÇÃO"));+ swprintf_s(t, L"%d°", (int)std::lround(w.feels));+ Text(t, g_tfBigG, D2D1::RectF(c1.left + 14, c1.top + 28, c1.right, c1.top + 62), white);+ {+ IDWriteTextFormat* f = g_tfSmallW;+ const wchar_t* s = w.feels < w.temp - 1 ? Tr(L"O vento deixa mais frio do que a temperatura real.") : w.feels > w.temp + 1 ? Tr(L"A umidade deixa mais quente do que a temperatura real.") : Tr(L"Parecida com a temperatura real.");+ br->SetColor(white); rt->DrawTextW(s, (UINT32)wcslen(s), f, D2D1::RectF(c1.left + 14, c1.top + 66, c1.right - 12, c1.bottom - 8), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);+ }+ GlassCard(c2); CardHead(c2, Tr(L"VENTO"));+ { // bússola com a velocidade no meio+ D2D1_POINT_2F c{ (c2.left + c2.right) / 2, c2.top + 82 };+ br->SetColor(Rgb(255, 255, 255, 0.35f));+ for (int k = 0; k < 72; k++) {+ double a = k * 3.14159265 / 36; float r0 = k % 18 == 0 ? 36.f : 40.f;+ rt->DrawLine({ c.x + (float)sin(a) * r0, c.y - (float)cos(a) * r0 }, { c.x + (float)sin(a) * 44, c.y - (float)cos(a) * 44 }, br, 0.8f);+ }+ const wchar_t* L4[4] = { idioma::Compass(0), idioma::Compass(1), idioma::Compass(2), idioma::Compass(3) };+ for (int k = 0; k < 4; k++) { double a = k * 3.14159265 / 2; Text(L4[k], g_tfHdr, D2D1::RectF(c.x + (float)sin(a) * 30 - 8, c.y - (float)cos(a) * 30 - 8, c.x + (float)sin(a) * 30 + 8, c.y - (float)cos(a) * 30 + 8), white); }+ swprintf_s(t, L"%d", (int)std::lround(w.wind));+ Text(t, g_tfCondTitle, D2D1::RectF(c.x - 20, c.y - 12, c.x + 20, c.y + 6), white);+ Text(L"km/h", g_tfHdr, D2D1::RectF(c.x - 20, c.y + 3, c.x + 20, c.y + 15), white);+ }+ GlassCard(c3);+ Text(Tr(L"Condições"), g_tfCondTitle, D2D1::RectF(c3.left + 14, c3.top + 10, c3.right, c3.top + 28), white);+ Text(Tr(L"Temperatura (°C)"), g_tfHdr, D2D1::RectF(c3.left + 14, c3.top + 26, c3.right, c3.top + 40), dim);+ {+ time_t now = time(nullptr);+ int start = 0; for (int i = 0; i < (int)w.hours.size(); i++) if (w.hours[i].t <= now) start = i;+ int n = std::min(6, (int)w.hours.size() - start);+ float cw = (c3.right - c3.left - 16) / 6;+ for (int k = 0; k < n; k++) {+ auto& hh = w.hours[start + k];+ float x = c3.left + 8 + k * cw;+ Text(k == 0 ? std::wstring(Tr(L"Agora")) : HourOf(hh.t, w.off), g_tfHdrC, D2D1::RectF(x, c3.top + 50, x + cw, c3.top + 66), white);+ Text(CondEmoji(hh.code, hh.day), g_tfEmojiSmall, D2D1::RectF(x, c3.top + 70, x + cw, c3.top + 100), white);+ swprintf_s(t, L"%d°", (int)std::lround(hh.temp));+ Text(t, g_tfCardG, D2D1::RectF(x, c3.top + 104, x + cw, c3.top + 126), white);+ }+ }+ // linha 2: umidade (larga) e a previsão de 10 dias (alta, na coluna da direita)+ float y1 = y0 + 141 + 16;+ D2D1_RECT_F c4 = D2D1::RectF(x0, y1, x0 + 2 * sm + 16, y1 + 143);+ GlassCard(c4); CardHead(c4, Tr(L"UMIDADE"));+ swprintf_s(t, L"%d%%", (int)std::lround(w.hum));+ Text(t, g_tfBigG, D2D1::RectF(c4.left + 14, c4.top + 28, c4.right, c4.top + 62), white);+ {+ D2D1_RECT_F bar = D2D1::RectF(c4.left + 14, c4.top + 86, c4.right - 14, c4.top + 91);+ D2D1_GRADIENT_STOP gs[3] = { { 0, Rgb(255, 210, 120) }, { 0.5f, Rgb(120, 220, 255) }, { 1, Rgb(40, 110, 255) } };+ ID2D1GradientStopCollection* st = nullptr; rt->CreateGradientStopCollection(gs, 3, &st);+ ID2D1LinearGradientBrush* lg = nullptr;+ if (st) rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ bar.left, 0 }, { bar.right, 0 }), st, &lg);+ if (lg) { rt->FillRoundedRectangle(D2D1::RoundedRect(bar, 2.5f, 2.5f), lg); lg->Release(); }+ if (st) st->Release();+ float px = bar.left + (bar.right - bar.left) * std::clamp(w.hum / 100.f, 0.f, 1.f);+ Circle({ px, (bar.top + bar.bottom) / 2 }, 4.5f, white, true);+ const wchar_t* s = w.hum >= 70 ? Tr(L"O ar está úmido agora.") : w.hum <= 35 ? Tr(L"O ar está seco agora.") : Tr(L"Umidade confortável agora.");+ Text(s, g_tfSmallW, D2D1::RectF(c4.left + 14, c4.top + 100, c4.right - 12, c4.bottom - 8), white);+ }+ float rows = (float)std::min<size_t>(10, w.days.size());+ D2D1_RECT_F c5 = D2D1::RectF(wideX, y1, wideX + wideW, y1 + 30 + rows * 42 + 8);+ GlassCard(c5);+ {+ float lo = 999, hi = -999; for (auto& d : w.days) { lo = std::min(lo, d.lo); hi = std::max(hi, d.hi); }+ for (int k = 0; k < (int)rows; k++) {+ auto& d = w.days[k];+ float yy = c5.top + 8 + k * 42;+ if (k) Fill(D2D1::RectF(c5.left + 14, yy, c5.right - 14, yy + 0.5f), Rgb(255, 255, 255, 0.22f));+ Text(k == 0 ? std::wstring(Tr(L"Hoje")) : std::wstring(WeekdayShort(WdayOf(d.t + 12 * 3600, w.off))), g_tfCondTitle, D2D1::RectF(c5.left + 14, yy, c5.left + 64, yy + 42), white);+ Text(CondEmoji(d.code, true), g_tfEmojiSmall, D2D1::RectF(c5.left + 64, yy, c5.left + 100, yy + 42), white);+ swprintf_s(t, L"%d°", (int)std::lround(d.lo)); Text(t, g_tfRowR, D2D1::RectF(c5.left + 100, yy, c5.left + 138, yy + 42), dim);+ float bx0 = c5.left + 146, bx1 = c5.right - 52, by = yy + 21;+ Fill(D2D1::RectF(bx0, by - 2.5f, bx1, by + 2.5f), Rgb(0, 0, 0, 0.16f), 2.5f);+ float span = std::max(1.f, hi - lo), a = bx0 + (d.lo - lo) / span * (bx1 - bx0), b = bx0 + (d.hi - lo) / span * (bx1 - bx0);+ D2D1_GRADIENT_STOP gs[2] = { { 0, Rgb(255, 196, 64) }, { 1, Rgb(255, 120, 40) } };+ ID2D1GradientStopCollection* st = nullptr; rt->CreateGradientStopCollection(gs, 2, &st);+ ID2D1LinearGradientBrush* lg = nullptr;+ if (st) rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ a, 0 }, { std::max(a + 6, b), 0 }), st, &lg);+ if (lg) { rt->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(a, by - 2.5f, std::max(a + 6, b), by + 2.5f), 2.5f, 2.5f), lg); lg->Release(); }+ if (st) st->Release();+ swprintf_s(t, L"%d°", (int)std::lround(d.hi)); Text(t, g_tfRowR, D2D1::RectF(c5.right - 50, yy, c5.right - 14, yy + 42), white);+ }+ }+ // linha 3: nascer e pôr do sol+ float y2 = y1 + 143 + 16;+ if (!w.days.empty()) {+ D2D1_RECT_F c6 = D2D1::RectF(x0, y2, x0 + sm, y2 + 141), c7 = D2D1::RectF(x0 + sm + 16, y2, x0 + 2 * sm + 16, y2 + 141);+ GlassCard(c6); CardHead(c6, Tr(L"NASCER DO SOL"));+ Text(HmOf(w.days[0].rise, w.off), g_tfBigG, D2D1::RectF(c6.left + 14, c6.top + 28, c6.right, c6.top + 62), white);+ GlassCard(c7); CardHead(c7, Tr(L"PÔR DO SOL"));+ Text(HmOf(w.days[0].set, w.off), g_tfBigG, D2D1::RectF(c7.left + 14, c7.top + 28, c7.right, c7.top + 62), white);+ for (D2D1_RECT_F c : { c6, c7 }) { // a curva do sol+ br->SetColor(Rgb(255, 255, 255, 0.45f));+ ID2D1PathGeometry* g = nullptr; d2d->CreatePathGeometry(&g);+ if (g) {+ ID2D1GeometrySink* s = nullptr; g->Open(&s);+ float bx = c.left + 12, bw = c.right - c.left - 24, base = c.top + 112;+ s->BeginFigure({ bx, base + 6 }, D2D1_FIGURE_BEGIN_HOLLOW);+ for (int k = 1; k <= 30; k++) { float u = k / 30.f; s->AddLine({ bx + bw * u, base + 6 - (float)sin(u * 3.14159265) * 28 + 14 * (1 - (float)sin(u * 3.14159265)) * 0 }); }+ s->EndFigure(D2D1_FIGURE_END_OPEN); s->Close(); s->Release();+ rt->DrawGeometry(g, br, 2); g->Release();+ }+ Fill(D2D1::RectF(c.left + 12, c.top + 112, c.right - 12, c.top + 112.6f), Rgb(255, 255, 255, 0.5f));+ }+ }+ g_gTotal = std::max(c5.bottom, y2 + 141) + g_gScroll + 20;+ rt->PopAxisAlignedClip();+}+++void Paint() {+ if (!BeginPaint()) return;+ if (BAR > 0) { PaintGoldenWx(); EndPaint(); return; } // macOS 27+ g_hits.clear();+ bool dark = Dark();+ D2D1_SIZE_F sz = Size();+ D2D1_COLOR_F text = dark ? Rgb(245, 245, 247) : Rgb(29, 29, 31), gray = dark ? Rgb(152, 152, 157) : Rgb(134, 134, 139), white = Rgb(255, 255, 255), dim = Rgb(255, 255, 255, 0.7f);+ rt->Clear(dark ? Rgb(30, 30, 30) : Rgb(242, 242, 245));+ const float SB = g_side ? SB_W : 0.f;+ D2D1_RECT_F tog = D2D1::RectF(10, 10, 38, 38); // mostrar/esconder a lateral+ auto toggle = [&](D2D1_COLOR_F c) { IconSidebar({ (tog.left + tog.right) / 2, (tog.top + tog.bottom) / 2 }, c); g_hits.push_back({ 3, 0, tog }); }; // sidebar.left (antes o "hambúrguer" E700 do Windows)+ // ---- cidades+ if (g_side) {+ Fill(D2D1::RectF(0, 0, SB, sz.height), dark ? Rgb(40, 40, 42) : Rgb(236, 236, 240));+ toggle(text);+ D2D1_RECT_F add = D2D1::RectF(SB - 40, 10, SB - 10, 38);+ wchar_t p[2] = { 0xE710, 0 }; Text(p, g_tfIcon, add, text);+ g_hits.push_back({ 2, 0, add });+ float y = 48;+ for (int i = 0; i < (int)g_places.size(); i++) {+ auto& pl = g_places[i];+ D2D1_RECT_F r = D2D1::RectF(8, y, SB - 8, y + 70);+ if (pl.wx.ok) {+ D2D1_COLOR_F a, b; Sky(pl.wx, a, b);+ ID2D1GradientStopCollection* st = nullptr; D2D1_GRADIENT_STOP gs[2] = { { 0, a }, { 1, b } };+ rt->CreateGradientStopCollection(gs, 2, &st);+ ID2D1LinearGradientBrush* lg = nullptr;+ if (st) rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ r.left, r.top }, { r.right, r.bottom }), st, &lg);+ if (lg) { rt->FillRoundedRectangle(D2D1::RoundedRect(r, 12, 12), lg); lg->Release(); }+ if (st) st->Release();+ } else Fill(r, dark ? Rgb(58, 58, 60) : Rgb(255, 255, 255), 12);+ D2D1_COLOR_F tc = pl.wx.ok ? white : text;+ if (i == g_sel) { br->SetColor(Rgb(10, 132, 255)); rt->DrawRoundedRectangle(D2D1::RoundedRect(r, 12, 12), br, 2.5f); }+ Text(i == 0 ? std::wstring(Tr(L"Meu Local")) : pl.name, g_tfSide, D2D1::RectF(r.left + 12, r.top + 8, r.right - 60, r.top + 30), tc);+ if (i == 0) Text(pl.name, g_tfSmall, D2D1::RectF(r.left + 12, r.top + 28, r.right - 60, r.top + 46), pl.wx.ok ? dim : gray);+ if (pl.wx.ok) {+ Text(CondText(pl.wx.code), g_tfSmall, D2D1::RectF(r.left + 12, r.bottom - 24, r.right - 60, r.bottom - 6), dim);+ wchar_t t[16]; swprintf_s(t, L"%d°", (int)std::lround(pl.wx.temp));+ Text(t, g_tfSideTemp, D2D1::RectF(r.right - 70, r.top + 4, r.right - 10, r.top + 44), white);+ }+ g_hits.push_back({ 1, i, r });+ y += 78;+ }+ if (!g_status.empty()) Text(g_status, g_tfSmall, D2D1::RectF(12, sz.height - 30, SB - 10, sz.height - 8), gray);+ } // g_side+ // ---- cidade escolhida+ if (g_sel < 0 || g_sel >= (int)g_places.size()) { if (!g_side) toggle(text); EndPaint(); return; }+ Place pl; { std::lock_guard<std::mutex> l(g_mx); pl = g_places[g_sel]; }+ D2D1_RECT_F main = D2D1::RectF(SB, 0, sz.width, sz.height);+ if (!pl.wx.ok) { Text(pl.loading ? Tr(L"Carregando…") : Tr(L"Sem conexão com o serviço do tempo."), g_tfCond, main, gray); if (!g_side) toggle(text); EndPaint(); return; }+ const Wx& w = pl.wx;+ {+ D2D1_COLOR_F a, b; Sky(w, a, b);+ ID2D1GradientStopCollection* st = nullptr; D2D1_GRADIENT_STOP gs[2] = { { 0, a }, { 1, b } };+ rt->CreateGradientStopCollection(gs, 2, &st);+ ID2D1LinearGradientBrush* lg = nullptr;+ if (st) rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ 0, 0 }, { 0, sz.height }), st, &lg);+ if (lg) { rt->FillRectangle(main, lg); lg->Release(); }+ if (st) st->Release();+ }+ if (!g_side) toggle(white);+ float cx = (SB + sz.width) / 2, W = sz.width - SB;+ Text(g_sel == 0 ? std::wstring(Tr(L"Meu Local")) : pl.name, g_tfCity, D2D1::RectF(SB, 24, sz.width, 62), white);+ if (g_sel == 0) Text(pl.name, g_tfSmallC, D2D1::RectF(SB, 58, sz.width, 76), dim);+ wchar_t t[32]; swprintf_s(t, L" %d°", (int)std::lround(w.temp));+ Text(t, g_tfTemp, D2D1::RectF(SB, 70, sz.width, 170), white);+ Text(CondText(w.code), g_tfCond, D2D1::RectF(SB, 168, sz.width, 194), white);+ if (!w.days.empty()) { swprintf_s(t, Tr(L"Máx.: %d° Mín.: %d°"), (int)std::lround(w.days[0].hi), (int)std::lround(w.days[0].lo)); Text(t, g_tfCond, D2D1::RectF(SB, 192, sz.width, 218), white); }+ float pad = 20, y0 = 236;+ // por hora+ D2D1_RECT_F hr = D2D1::RectF(SB + pad, y0, sz.width - pad, y0 + 124);+ Card(hr);+ Text(Tr(L"PREVISÃO POR HORA"), g_tfSmall, D2D1::RectF(hr.left + 14, hr.top + 6, hr.right, hr.top + 26), dim);+ time_t now = time(nullptr);+ int start = 0; for (int i = 0; i < (int)w.hours.size(); i++) if (w.hours[i].t <= now) start = i;+ int n = std::min(24, (int)w.hours.size() - start);+ float cw = (hr.right - hr.left - 20) / std::max(1, std::min(n, (int)((hr.right - hr.left - 20) / 52)));+ int vis = (int)((hr.right - hr.left - 20) / cw);+ for (int k = 0; k < n && k < vis; k++) {+ auto& h = w.hours[start + k];+ float x = hr.left + 10 + k * cw;+ Text(k == 0 ? std::wstring(Tr(L"Agora")) : HourOf(h.t, w.off), g_tfCard, D2D1::RectF(x, hr.top + 30, x + cw, hr.top + 50), white);+ Text(CondEmoji(h.code, h.day), g_tfEmojiSmall, D2D1::RectF(x, hr.top + 52, x + cw, hr.top + 84), white);+ swprintf_s(t, L"%d°", (int)std::lround(h.temp));+ Text(t, g_tfCardBig, D2D1::RectF(x, hr.top + 88, x + cw, hr.top + 114), white);+ }+ // 10 dias+ float colW = (W - 3 * pad) / 2;+ D2D1_RECT_F dr = D2D1::RectF(SB + pad, hr.bottom + pad, SB + pad + colW, sz.height - pad);+ Card(dr);+ Text(Tr(L"PREVISÃO PARA 10 DIAS"), g_tfSmall, D2D1::RectF(dr.left + 14, dr.top + 6, dr.right, dr.top + 26), dim);+ float lo = 999, hi = -999; for (auto& d : w.days) { lo = std::min(lo, d.lo); hi = std::max(hi, d.hi); }+ float rowH = std::min(44.f, (dr.bottom - dr.top - 34) / std::max<size_t>(1, w.days.size()));+ for (int k = 0; k < (int)w.days.size(); k++) {+ auto& d = w.days[k];+ float yy = dr.top + 30 + k * rowH;+ if (yy + rowH > dr.bottom) break;+ Text(k == 0 ? std::wstring(Tr(L"Hoje")) : std::wstring(WeekdayShort(WdayOf(d.t + 12 * 3600, w.off))), g_tfCard, D2D1::RectF(dr.left + 14, yy, dr.left + 70, yy + rowH), white);+ Text(CondEmoji(d.code, true), g_tfEmojiSmall, D2D1::RectF(dr.left + 64, yy, dr.left + 100, yy + rowH), white);+ swprintf_s(t, L"%d°", (int)std::lround(d.lo)); Text(t, g_tfRowR, D2D1::RectF(dr.left + 96, yy, dr.left + 136, yy + rowH), dim);+ float bx0 = dr.left + 146, bx1 = dr.right - 56, by = yy + rowH / 2;+ Fill(D2D1::RectF(bx0, by - 2.5f, bx1, by + 2.5f), Rgb(0, 0, 0, 0.18f), 2.5f);+ float span = std::max(1.f, hi - lo), a = bx0 + (d.lo - lo) / span * (bx1 - bx0), b = bx0 + (d.hi - lo) / span * (bx1 - bx0);+ Fill(D2D1::RectF(a, by - 2.5f, std::max(a + 6, b), by + 2.5f), Rgb(255, 196, 64), 2.5f);+ swprintf_s(t, L"%d°", (int)std::lround(d.hi)); Text(t, g_tfRowR, D2D1::RectF(dr.right - 52, yy, dr.right - 12, yy + rowH), white);+ }+ // quadros+ float qx = dr.right + pad, qw = (sz.width - pad - qx - pad) / 2, qh = std::min(150.f, (dr.bottom - dr.top - pad) / 2);+ auto quad = [&](int i, const wchar_t* title, const std::wstring& big, const std::wstring& sub) {+ float x = qx + (i % 2) * (qw + pad), yy = dr.top + (i / 2) * (qh + pad);+ D2D1_RECT_F r = D2D1::RectF(x, yy, x + qw, yy + qh);+ Card(r);+ Text(title, g_tfSmall, D2D1::RectF(r.left + 14, r.top + 6, r.right, r.top + 26), dim);+ Text(big, g_tfCity, D2D1::RectF(r.left + 14, r.top + 30, r.right - 8, r.top + 70), white);+ IDWriteTextFormat* f = g_tfSmall; if (f) f->SetWordWrapping(DWRITE_WORD_WRAPPING_WRAP);+ Text(sub, g_tfSmall, D2D1::RectF(r.left + 14, r.top + 72, r.right - 10, r.bottom - 8), white);+ if (f) f->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP);+ };+ if (g_tfCity) g_tfCity->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING);+ swprintf_s(t, L"%d°", (int)std::lround(w.feels));+ quad(0, Tr(L"SENSAÇÃO"), t, w.feels < w.temp - 1 ? Tr(L"O vento deixa mais frio do que a temperatura real.") : w.feels > w.temp + 1 ? Tr(L"A umidade deixa mais quente do que a temperatura real.") : Tr(L"Parecida com a temperatura real."));+ swprintf_s(t, L"%d%%", (int)std::lround(w.hum));+ quad(1, Tr(L"UMIDADE"), t, L"");+ swprintf_s(t, L"%d km/h", (int)std::lround(w.wind));+ quad(2, Tr(L"VENTO"), t, L"");+ if (!w.days.empty()) quad(3, Tr(L"NASCER DO SOL"), HmOf(w.days[0].rise, w.off), std::wstring(Tr(L"Pôr do sol: ")) + HmOf(w.days[0].set, w.off));+ if (g_tfCity) g_tfCity->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER);+ (void)cx;+ EndPaint();+}++LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {+ switch (m) {+ case WM_PAINT: { PAINTSTRUCT ps; ::BeginPaint(h, &ps); Paint(); ::EndPaint(h, &ps); return 0; }+ case WM_ERASEBKGND: return 1;+ case WM_SIZE: OnSize(l); return 0;+ case WM_DPICHANGED: OnDpi(w, l); return 0;+ case WM_SETTINGCHANGE: InvalidateRect(h, nullptr, FALSE); return 0;+ case WM_CTLCOLOREDIT:+ if (BAR > 0) { // macOS 27: o EDIT fica dentro da cápsula de vidro (GlassField): o fundo dele é a cor dela+ if (!Dark()) return FieldColors((HDC)w, RGB(249, 250, 251));+ D2D1_COLOR_F c = SidebarColor(); // escuro: branco a 8% sobre a cor da barra lateral+ auto m = [](float v) { return (int)std::lround((v + (1 - v) * 0.08f) * 255); };+ return FieldColors((HDC)w, RGB(m(c.r), m(c.g), m(c.b)));+ }+ return FieldColors((HDC)w, Dark() ? RGB(40, 40, 42) : RGB(236, 236, 240));+ case WM_FIELDLOST: if (field.h && GetFocus() != field.h) FieldEnd(0); return 0;+ case WM_DATA: {+ int i = (int)w;+ if (i == -1) { // cidade procurada+ auto* p = (Place*)l;+ if (!p->name.empty() && g_meuLocal) { // aberto pelo "Editar Local…" do widget: a cidade vira o Meu Local+ g_meuLocal = false;+ g_places.push_back(*p);+ { std::lock_guard<std::mutex> lk(g_mx); std::swap(g_places[0], g_places.back()); }+ SetMyPlace(g_places[0]); g_sel = 0; Save(); Fetch(0); Fetch((int)g_places.size() - 1); g_status.clear();+ } else if (!p->name.empty()) { g_places.push_back(*p); g_sel = (int)g_places.size() - 1; Save(); Fetch(g_sel); g_status.clear(); }+ else g_status = Tr(L"Cidade não encontrada.");+ delete p;+ } else {+ auto* wx = (Wx*)l;+ if (i >= 0 && i < (int)g_places.size()) { std::lock_guard<std::mutex> lk(g_mx); g_places[i].loading = false; if (wx->ok) g_places[i].wx = *wx; }+ delete wx;+ }+ InvalidateRect(h, nullptr, FALSE);+ return 0;+ }+ case WM_TIMER: for (int i = 0; i < (int)g_places.size(); i++) Fetch(i); return 0; // a cada 15 min+ case WM_MOUSEWHEEL: if (BAR > 0) { // macOS 27: o conteúdo rola+ g_gScroll = std::clamp(g_gScroll - GET_WHEEL_DELTA_WPARAM(w) / 120.f * 60, 0.f, std::max(0.f, g_gTotal - Size().height));+ InvalidateRect(h, nullptr, FALSE);+ } return 0;+ case WM_LBUTTONDOWN: case WM_RBUTTONUP: {+ if (field.h) FieldEnd(0);+ float s = Sc(), x = GET_X_LPARAM(l) / s, y = GET_Y_LPARAM(l) / s;+ for (auto& ht : g_hits) if (In(ht.r, x, y)) {+ if (ht.kind == 3) { g_side = !g_side; InvalidateRect(h, nullptr, FALSE); return 0; }+ if (ht.kind == 2) {+ if (!g_side) { g_side = true; Paint(); } // a busca fica na lateral+ D2D1_RECT_F fr = BAR > 0 ? D2D1::RectF(40, 71, 252, 89) : D2D1::RectF(12, 12, SB_W - 46, 36);+ FieldOpen(fr, L"", BAR > 0 ? 14.f : 13.f, false, [](const std::wstring& t, int key) { if (key == VK_RETURN) Search(t); });+ InvalidateRect(h, nullptr, FALSE); // tira o "Buscar" de baixo do campo+ return 0;+ }+ if (ht.kind == 1) {+ if (m == WM_RBUTTONUP) {+ POINT scr{ GET_X_LPARAM(l), GET_Y_LPARAM(l) }; ClientToScreen(h, &scr);+ HMENU mm = CreatePopupMenu();+ if (ht.arg > 0) AppendMenuW(mm, MF_STRING, 2, Tr(L"Usar como Meu Local"));+ AppendMenuW(mm, MF_STRING | (g_places.size() > 1 ? 0 : MF_GRAYED), 1, Tr(L"Apagar"));+ int k = TrackPopupMenu(mm, TPM_RETURNCMD | TPM_RIGHTBUTTON, scr.x, scr.y, 0, h, nullptr);+ DestroyMenu(mm);+ if (k == 2) { std::lock_guard<std::mutex> lk(g_mx); std::swap(g_places[0], g_places[ht.arg]); SetMyPlace(g_places[0]); g_sel = 0; Save(); }+ else if (k == 1 && g_places.size() > 1) {+ { std::lock_guard<std::mutex> lk(g_mx); g_places.erase(g_places.begin() + ht.arg); }+ if (ht.arg == 0) SetMyPlace(g_places[0]); // o "Meu Local" saiu: a próxima cidade fica no lugar+ g_sel = 0; Save();+ }+ } else g_sel = ht.arg;+ InvalidateRect(h, nullptr, FALSE);+ }+ return 0;+ }+ return 0;+ }+ case WM_KEYDOWN:+ if (GetKeyState(VK_CONTROL) < 0 && w == 'W') DestroyWindow(h);+ if (GetKeyState(VK_CONTROL) < 0 && w == 'R') for (int i = 0; i < (int)g_places.size(); i++) Fetch(i);+ if (w == VK_UP && g_sel > 0) { g_sel--; InvalidateRect(h, nullptr, FALSE); }+ if (w == VK_DOWN && g_sel + 1 < (int)g_places.size()) { g_sel++; InvalidateRect(h, nullptr, FALSE); }+ return 0;+ case WM_DESTROY: PostQuitMessage(0); return 0;+ }+ return DefWindowProcW(h, m, w, l);+}++} // namespace++int WINAPI wWinMain(HINSTANCE hi, HINSTANCE, PWSTR, int show) {+ if (!Init()) return 1;+ g_file = DataPath(L"clima.txt");+ Load();+ std::wstring disp = HasFont(L"SF Pro Display") ? L"SF Pro Display" : family;+ g_tfCity = Fmt(30, DWRITE_FONT_WEIGHT_MEDIUM, DWRITE_TEXT_ALIGNMENT_CENTER, false, disp.c_str());+ g_tfTemp = Fmt(92, DWRITE_FONT_WEIGHT_THIN, DWRITE_TEXT_ALIGNMENT_CENTER, false, disp.c_str());+ g_tfCond = Fmt(18, DWRITE_FONT_WEIGHT_MEDIUM, DWRITE_TEXT_ALIGNMENT_CENTER);+ g_tfSmall = Fmt(12, DWRITE_FONT_WEIGHT_MEDIUM);+ g_tfSmallC = Fmt(13, DWRITE_FONT_WEIGHT_MEDIUM, DWRITE_TEXT_ALIGNMENT_CENTER);+ g_tfCard = Fmt(14, DWRITE_FONT_WEIGHT_MEDIUM, DWRITE_TEXT_ALIGNMENT_CENTER);+ g_tfCardBig = Fmt(18, DWRITE_FONT_WEIGHT_MEDIUM, DWRITE_TEXT_ALIGNMENT_CENTER);+ g_tfRowR = Fmt(16, DWRITE_FONT_WEIGHT_MEDIUM, DWRITE_TEXT_ALIGNMENT_TRAILING);+ g_tfEmojiSmall = nullptr; dw->CreateTextFormat(L"Segoe UI Emoji", nullptr, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 20, L"", &g_tfEmojiSmall);+ if (g_tfEmojiSmall) { g_tfEmojiSmall->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER); g_tfEmojiSmall->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER); }+ g_tfSide = Fmt(15, DWRITE_FONT_WEIGHT_SEMI_BOLD);+ g_tfSideTemp = Fmt(30, DWRITE_FONT_WEIGHT_LIGHT, DWRITE_TEXT_ALIGNMENT_TRAILING, false, disp.c_str());+ g_tfIcon = Fmt(16, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_TEXT_ALIGNMENT_CENTER, false, IconFamily());+ g_tfCityG = Fmt(22, DWRITE_FONT_WEIGHT_MEDIUM, DWRITE_TEXT_ALIGNMENT_CENTER, false, disp.c_str());+ g_tfTempG = Fmt(64, DWRITE_FONT_WEIGHT_THIN, DWRITE_TEXT_ALIGNMENT_CENTER, false, disp.c_str());+ g_tfCondG = Fmt(14, DWRITE_FONT_WEIGHT_SEMI_BOLD, DWRITE_TEXT_ALIGNMENT_CENTER);+ g_tfHdr = Fmt(11, DWRITE_FONT_WEIGHT_SEMI_BOLD);+ g_tfHdrC = Fmt(12, DWRITE_FONT_WEIGHT_SEMI_BOLD, DWRITE_TEXT_ALIGNMENT_CENTER);+ g_tfBigG = Fmt(26, DWRITE_FONT_WEIGHT_MEDIUM, DWRITE_TEXT_ALIGNMENT_LEADING, false, disp.c_str());+ g_tfSmallW = Fmt(11.5f, DWRITE_FONT_WEIGHT_MEDIUM, DWRITE_TEXT_ALIGNMENT_LEADING, true);+ if (g_tfSmallW) g_tfSmallW->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_NEAR);+ g_tfSearchG = Fmt(14);+ g_tfCondTitle = Fmt(14, DWRITE_FONT_WEIGHT_SEMI_BOLD);+ g_tfCardG = Fmt(14, DWRITE_FONT_WEIGHT_SEMI_BOLD, DWRITE_TEXT_ALIGNMENT_CENTER);+ barWanted = 52; // macOS 27: o céu atrás da barra+ if (!CreateMain(hi, L"ClimaJanela", Tr(L"Clima"), Proc, semaforo::Aqua() ? 1070 : 1080, semaforo::Aqua() ? 768 : 760)) return 1;+ for (int i = 0; i < (int)g_places.size(); i++) Fetch(i);+ SetTimer(wnd, 1, 15 * 60 * 1000, nullptr);+ ShowWindow(wnd, show);+ if (g_meuLocal) { // "Editar Local…" do widget da mesa: a busca já aberta; a cidade achada vira o Meu Local+ g_side = true; Paint();+ D2D1_RECT_F fr = BAR > 0 ? D2D1::RectF(40, 71, 252, 89) : D2D1::RectF(12, 12, SB_W - 46, 36);+ FieldOpen(fr, L"", BAR > 0 ? 14.f : 13.f, false, [](const std::wstring& t, int key) { if (key == VK_RETURN) Search(t); else if (key == VK_ESCAPE) g_meuLocal = false; });+ g_status = Tr(L"Digite a cidade do Meu Local");+ InvalidateRect(wnd, nullptr, FALSE);+ }+ return Run();+}diff --git a/src/comum/idioma_de.inc b/src/comum/idioma_de.incindex cf5c297..ee0cf22 100644--- a/src/comum/idioma_de.inc+++ b/src/comum/idioma_de.inc@@ -1525,6 +1525,7 @@{ L"Juntos", L"Eng" },{ L"Separados", L"Weit" },{ L"Distância da borda da tela", L"Abstand zum Bildschirmrand" },+{ L"Espaço acima das janelas maximizadas", L"Abstand über maximierten Fenstern" },{ L"Encostado", L"Anliegend" },{ L"Longe", L"Weit weg" },{ L"Tamanho e Espaço", L"Größe und Abstand" },@@ -1622,3 +1623,7 @@{ L"Captura feita", L"Bildschirmfoto erstellt" },{ L"Captura copiada", L"Bildschirmfoto kopiert" },{ L"Win+Shift+3 tela inteira, Win+Shift+4 região, Win+Shift+5 a barra de Captura de Tela (com as mesmas opções em Opções). Segure Ctrl para copiar em vez de salvar.", L"Win+Umschalt+3 ganzer Bildschirm, Win+Umschalt+4 ein Bereich, Win+Umschalt+5 die Bildschirmfoto-Leiste (dieselben Optionen unter „Optionen“). Strg halten, um zu kopieren statt zu sichern." },+{ L"Editar Local…", L"Ort bearbeiten …" },+{ L"Digite a cidade do Meu Local", L"Stadt für „Mein Standort“ eingeben" },+{ L"Botões do Mac nos apps com barra própria", L"Mac-Tasten in Apps mit eigener Titelleiste" },+{ L"Edge, Chrome, Figma, Discord, VS Code e outros apps que desenham a própria barra ganham os botões do Mac no lugar dos do Windows. Vale para as janelas abertas depois de mudar.", L"Edge, Chrome, Figma, Discord, VS Code und andere Apps mit eigener Titelleiste erhalten die Mac-Tasten statt der Windows-Tasten. Gilt für Fenster, die danach geöffnet werden." },diff --git a/src/comum/idioma_en.inc b/src/comum/idioma_en.incindex 9034bd9..9fa6330 100644--- a/src/comum/idioma_en.inc+++ b/src/comum/idioma_en.inc@@ -1525,6 +1525,7 @@{ L"Juntos", L"Together" },{ L"Separados", L"Apart" },{ L"Distância da borda da tela", L"Distance from screen edge" },+{ L"Espaço acima das janelas maximizadas", L"Space above maximized windows" },{ L"Encostado", L"Touching" },{ L"Longe", L"Far" },{ L"Tamanho e Espaço", L"Size and Spacing" },@@ -1622,3 +1623,7 @@{ L"Captura feita", L"Screenshot taken" },{ L"Captura copiada", L"Screenshot copied" },{ L"Win+Shift+3 tela inteira, Win+Shift+4 região, Win+Shift+5 a barra de Captura de Tela (com as mesmas opções em Opções). Segure Ctrl para copiar em vez de salvar.", L"Win+Shift+3 full screen, Win+Shift+4 a region, Win+Shift+5 the Screenshot toolbar (same options under Options). Hold Ctrl to copy instead of saving." },+{ L"Editar Local…", L"Edit Location…" },+{ L"Digite a cidade do Meu Local", L"Type the city for My Location" },+{ L"Botões do Mac nos apps com barra própria", L"Mac buttons in apps with their own title bar" },+{ L"Edge, Chrome, Figma, Discord, VS Code e outros apps que desenham a própria barra ganham os botões do Mac no lugar dos do Windows. Vale para as janelas abertas depois de mudar.", L"Edge, Chrome, Figma, Discord, VS Code and other apps that draw their own title bar get the Mac buttons instead of the Windows ones. Applies to windows opened after the change." },diff --git a/src/comum/idioma_es.inc b/src/comum/idioma_es.incindex 442981b..25880f6 100644--- a/src/comum/idioma_es.inc+++ b/src/comum/idioma_es.inc@@ -1525,6 +1525,7 @@{ L"Juntos", L"Juntos" },{ L"Separados", L"Separados" },{ L"Distância da borda da tela", L"Distancia del borde de la pantalla" },+{ L"Espaço acima das janelas maximizadas", L"Espacio sobre las ventanas maximizadas" },{ L"Encostado", L"Pegado" },{ L"Longe", L"Lejos" },{ L"Tamanho e Espaço", L"Tamaño y espacio" },@@ -1622,3 +1623,7 @@{ L"Captura feita", L"Captura hecha" },{ L"Captura copiada", L"Captura copiada" },{ L"Win+Shift+3 tela inteira, Win+Shift+4 região, Win+Shift+5 a barra de Captura de Tela (com as mesmas opções em Opções). Segure Ctrl para copiar em vez de salvar.", L"Win+Mayús+3 pantalla completa, Win+Mayús+4 una región, Win+Mayús+5 la barra de Captura de pantalla (con las mismas opciones en Opciones). Mantén Ctrl para copiar en vez de guardar." },+{ L"Editar Local…", L"Editar ubicación…" },+{ L"Digite a cidade do Meu Local", L"Escribe la ciudad de Mi ubicación" },+{ L"Botões do Mac nos apps com barra própria", L"Botones del Mac en apps con barra propia" },+{ L"Edge, Chrome, Figma, Discord, VS Code e outros apps que desenham a própria barra ganham os botões do Mac no lugar dos do Windows. Vale para as janelas abertas depois de mudar.", L"Edge, Chrome, Figma, Discord, VS Code y otras apps que dibujan su propia barra reciben los botones del Mac en lugar de los de Windows. Se aplica a las ventanas abiertas después del cambio." },diff --git a/src/comum/idioma_fr.inc b/src/comum/idioma_fr.incindex cddae5e..1b179f2 100644--- a/src/comum/idioma_fr.inc+++ b/src/comum/idioma_fr.inc@@ -1525,6 +1525,7 @@{ L"Juntos", L"Serrés" },{ L"Separados", L"Espacés" },{ L"Distância da borda da tela", L"Distance du bord de l’écran" },+{ L"Espaço acima das janelas maximizadas", L"Espace au-dessus des fenêtres agrandies" },{ L"Encostado", L"Collé" },{ L"Longe", L"Éloigné" },{ L"Tamanho e Espaço", L"Taille et espacement" },@@ -1622,3 +1623,7 @@{ L"Captura feita", L"Capture effectuée" },{ L"Captura copiada", L"Capture copiée" },{ L"Win+Shift+3 tela inteira, Win+Shift+4 região, Win+Shift+5 a barra de Captura de Tela (com as mesmas opções em Opções). Segure Ctrl para copiar em vez de salvar.", L"Win+Maj+3 tout l’écran, Win+Maj+4 une zone, Win+Maj+5 la barre de capture d’écran (mêmes réglages dans Options). Maintenez Ctrl pour copier au lieu d’enregistrer." },+{ L"Editar Local…", L"Modifier le lieu…" },+{ L"Digite a cidade do Meu Local", L"Saisissez la ville de Ma position" },+{ L"Botões do Mac nos apps com barra própria", L"Boutons du Mac dans les apps à barre propre" },+{ L"Edge, Chrome, Figma, Discord, VS Code e outros apps que desenham a própria barra ganham os botões do Mac no lugar dos do Windows. Vale para as janelas abertas depois de mudar.", L"Edge, Chrome, Figma, Discord, VS Code et les autres apps qui dessinent leur propre barre reçoivent les boutons du Mac à la place de ceux de Windows. S’applique aux fenêtres ouvertes après le changement." },diff --git a/src/comum/idioma_it.inc b/src/comum/idioma_it.incindex 763d36a..7a4e8d6 100644--- a/src/comum/idioma_it.inc+++ b/src/comum/idioma_it.inc@@ -1525,6 +1525,7 @@{ L"Juntos", L"Vicine" },{ L"Separados", L"Distanti" },{ L"Distância da borda da tela", L"Distanza dal bordo dello schermo" },+{ L"Espaço acima das janelas maximizadas", L"Spazio sopra le finestre ingrandite" },{ L"Encostado", L"Attaccato" },{ L"Longe", L"Lontano" },{ L"Tamanho e Espaço", L"Dimensioni e spazio" },@@ -1622,3 +1623,7 @@{ L"Captura feita", L"Istantanea acquisita" },{ L"Captura copiada", L"Istantanea copiata" },{ L"Win+Shift+3 tela inteira, Win+Shift+4 região, Win+Shift+5 a barra de Captura de Tela (com as mesmas opções em Opções). Segure Ctrl para copiar em vez de salvar.", L"Win+Maiusc+3 schermo intero, Win+Maiusc+4 un’area, Win+Maiusc+5 la barra Istantanea schermo (stesse opzioni in Opzioni). Tieni premuto Ctrl per copiare invece di salvare." },+{ L"Editar Local…", L"Modifica posizione…" },+{ L"Digite a cidade do Meu Local", L"Digita la città della Mia posizione" },+{ L"Botões do Mac nos apps com barra própria", L"Pulsanti del Mac nelle app con barra propria" },+{ L"Edge, Chrome, Figma, Discord, VS Code e outros apps que desenham a própria barra ganham os botões do Mac no lugar dos do Windows. Vale para as janelas abertas depois de mudar.", L"Edge, Chrome, Figma, Discord, VS Code e le altre app che disegnano la propria barra ricevono i pulsanti del Mac al posto di quelli di Windows. Vale per le finestre aperte dopo la modifica." },diff --git a/src/comum/idioma_ja.inc b/src/comum/idioma_ja.incindex c47ecaa..8afcc52 100644--- a/src/comum/idioma_ja.inc+++ b/src/comum/idioma_ja.inc@@ -1525,6 +1525,7 @@{ L"Juntos", L"狭く" },{ L"Separados", L"広く" },{ L"Distância da borda da tela", L"画面の端からの距離" },+{ L"Espaço acima das janelas maximizadas", L"最大化したウインドウの上の間隔" },{ L"Encostado", L"端に寄せる" },{ L"Longe", L"離す" },{ L"Tamanho e Espaço", L"サイズと間隔" },@@ -1622,3 +1623,7 @@{ L"Captura feita", L"スクリーンショットを撮りました" },{ L"Captura copiada", L"スクリーンショットをコピーしました" },{ L"Win+Shift+3 tela inteira, Win+Shift+4 região, Win+Shift+5 a barra de Captura de Tela (com as mesmas opções em Opções). Segure Ctrl para copiar em vez de salvar.", L"Win+Shift+3で画面全体、Win+Shift+4で範囲、Win+Shift+5でスクリーンショットのツールバー(同じ設定は「オプション」にもあります)。保存せずにコピーするにはCtrlを押したままにします。" },+{ L"Editar Local…", L"場所を編集…" },+{ L"Digite a cidade do Meu Local", L"現在地にする都市を入力" },+{ L"Botões do Mac nos apps com barra própria", L"独自のタイトルバーを持つアプリにMacのボタン" },+{ L"Edge, Chrome, Figma, Discord, VS Code e outros apps que desenham a própria barra ganham os botões do Mac no lugar dos do Windows. Vale para as janelas abertas depois de mudar.", L"Edge、Chrome、Figma、Discord、VS Code など独自のタイトルバーを描くアプリで、Windows のボタンの代わりに Mac のボタンを使います。変更後に開いたウインドウに適用されます。" },diff --git a/src/comum/idioma_ko.inc b/src/comum/idioma_ko.incindex 62647a5..d83287d 100644--- a/src/comum/idioma_ko.inc+++ b/src/comum/idioma_ko.inc@@ -1525,6 +1525,7 @@{ L"Juntos", L"좁게" },{ L"Separados", L"넓게" },{ L"Distância da borda da tela", L"화면 가장자리와의 거리" },+{ L"Espaço acima das janelas maximizadas", L"최대화된 윈도우 위 간격" },{ L"Encostado", L"붙임" },{ L"Longe", L"멀리" },{ L"Tamanho e Espaço", L"크기 및 간격" },@@ -1622,3 +1623,7 @@{ L"Captura feita", L"스크린샷 찍음" },{ L"Captura copiada", L"스크린샷 복사됨" },{ L"Win+Shift+3 tela inteira, Win+Shift+4 região, Win+Shift+5 a barra de Captura de Tela (com as mesmas opções em Opções). Segure Ctrl para copiar em vez de salvar.", L"Win+Shift+3 전체 화면, Win+Shift+4 영역, Win+Shift+5 스크린샷 막대(같은 설정은 옵션에도 있음). 저장 대신 복사하려면 Ctrl을 누르고 있으십시오." },+{ L"Editar Local…", L"위치 편집…" },+{ L"Digite a cidade do Meu Local", L"나의 위치로 쓸 도시를 입력하세요" },+{ L"Botões do Mac nos apps com barra própria", L"자체 제목 막대가 있는 앱에 Mac 버튼" },+{ L"Edge, Chrome, Figma, Discord, VS Code e outros apps que desenham a própria barra ganham os botões do Mac no lugar dos do Windows. Vale para as janelas abertas depois de mudar.", L"Edge, Chrome, Figma, Discord, VS Code 등 자체 제목 막대를 그리는 앱에 Windows 버튼 대신 Mac 버튼을 씁니다. 변경 후 연 윈도우에 적용됩니다." },diff --git a/src/comum/idioma_pl.inc b/src/comum/idioma_pl.incindex b1b4453..16e7a4c 100644--- a/src/comum/idioma_pl.inc+++ b/src/comum/idioma_pl.inc@@ -1525,6 +1525,7 @@{ L"Juntos", L"Blisko" },{ L"Separados", L"Daleko" },{ L"Distância da borda da tela", L"Odległość od krawędzi ekranu" },+{ L"Espaço acima das janelas maximizadas", L"Odstęp nad zmaksymalizowanymi oknami" },{ L"Encostado", L"Przy krawędzi" },{ L"Longe", L"Daleko" },{ L"Tamanho e Espaço", L"Rozmiar i odstępy" },@@ -1622,3 +1623,7 @@{ L"Captura feita", L"Zrzut zrobiony" },{ L"Captura copiada", L"Zrzut skopiowany" },{ L"Win+Shift+3 tela inteira, Win+Shift+4 região, Win+Shift+5 a barra de Captura de Tela (com as mesmas opções em Opções). Segure Ctrl para copiar em vez de salvar.", L"Win+Shift+3 cały ekran, Win+Shift+4 obszar, Win+Shift+5 pasek zrzutu ekranu (te same ustawienia w Opcjach). Przytrzymaj Ctrl, aby skopiować zamiast zachować." },+{ L"Editar Local…", L"Edytuj lokalizację…" },+{ L"Digite a cidade do Meu Local", L"Wpisz miasto dla Mojej lokalizacji" },+{ L"Botões do Mac nos apps com barra própria", L"Przyciski Maca w aplikacjach z własnym paskiem" },+{ L"Edge, Chrome, Figma, Discord, VS Code e outros apps que desenham a própria barra ganham os botões do Mac no lugar dos do Windows. Vale para as janelas abertas depois de mudar.", L"Edge, Chrome, Figma, Discord, VS Code i inne aplikacje z własnym paskiem dostają przyciski Maca zamiast przycisków Windows. Dotyczy okien otwartych po zmianie." },diff --git a/src/comum/idioma_ru.inc b/src/comum/idioma_ru.incindex bfe125e..be8b6d4 100644--- a/src/comum/idioma_ru.inc+++ b/src/comum/idioma_ru.inc@@ -1525,6 +1525,7 @@{ L"Juntos", L"Плотно" },{ L"Separados", L"Свободно" },{ L"Distância da borda da tela", L"Отступ от края экрана" },+{ L"Espaço acima das janelas maximizadas", L"Отступ над развёрнутыми окнами" },{ L"Encostado", L"Вплотную" },{ L"Longe", L"Далеко" },{ L"Tamanho e Espaço", L"Размер и отступы" },@@ -1622,3 +1623,7 @@{ L"Captura feita", L"Снимок сделан" },{ L"Captura copiada", L"Снимок скопирован" },{ L"Win+Shift+3 tela inteira, Win+Shift+4 região, Win+Shift+5 a barra de Captura de Tela (com as mesmas opções em Opções). Segure Ctrl para copiar em vez de salvar.", L"Win+Shift+3 весь экран, Win+Shift+4 область, Win+Shift+5 панель снимков экрана (те же настройки в «Параметрах»). Удерживайте Ctrl, чтобы скопировать вместо сохранения." },+{ L"Editar Local…", L"Изменить место…" },+{ L"Digite a cidade do Meu Local", L"Введите город для «Моё место»" },+{ L"Botões do Mac nos apps com barra própria", L"Кнопки Mac в приложениях со своей панелью" },+{ L"Edge, Chrome, Figma, Discord, VS Code e outros apps que desenham a própria barra ganham os botões do Mac no lugar dos do Windows. Vale para as janelas abertas depois de mudar.", L"Edge, Chrome, Figma, Discord, VS Code и другие приложения со своей панелью получают кнопки Mac вместо кнопок Windows. Действует для окон, открытых после изменения." },diff --git a/src/comum/idioma_tr.inc b/src/comum/idioma_tr.incindex 727f151..770c903 100644--- a/src/comum/idioma_tr.inc+++ b/src/comum/idioma_tr.inc@@ -1525,6 +1525,7 @@{ L"Juntos", L"Bitişik" },{ L"Separados", L"Ayrık" },{ L"Distância da borda da tela", L"Ekran kenarına uzaklık" },+{ L"Espaço acima das janelas maximizadas", L"Ekranı kaplayan pencerelerin üstündeki boşluk" },{ L"Encostado", L"Bitişik" },{ L"Longe", L"Uzak" },{ L"Tamanho e Espaço", L"Boyut ve Boşluk" },@@ -1622,3 +1623,7 @@{ L"Captura feita", L"Ekran resmi alındı" },{ L"Captura copiada", L"Ekran resmi kopyalandı" },{ L"Win+Shift+3 tela inteira, Win+Shift+4 região, Win+Shift+5 a barra de Captura de Tela (com as mesmas opções em Opções). Segure Ctrl para copiar em vez de salvar.", L"Win+Shift+3 tüm ekran, Win+Shift+4 bir bölge, Win+Shift+5 Ekran Resmi araç çubuğu (aynı ayarlar Seçenekler’de). Kaydetmek yerine kopyalamak için Ctrl’yi basılı tutun." },+{ L"Editar Local…", L"Konumu Düzenle…" },+{ L"Digite a cidade do Meu Local", L"Konumum için şehri yazın" },+{ L"Botões do Mac nos apps com barra própria", L"Kendi başlık çubuğu olan uygulamalarda Mac düğmeleri" },+{ L"Edge, Chrome, Figma, Discord, VS Code e outros apps que desenham a própria barra ganham os botões do Mac no lugar dos do Windows. Vale para as janelas abertas depois de mudar.", L"Edge, Chrome, Figma, Discord, VS Code ve kendi başlık çubuğunu çizen diğer uygulamalar Windows düğmeleri yerine Mac düğmelerini alır. Değişiklikten sonra açılan pencerelerde geçerlidir." },diff --git a/src/comum/idioma_zh.inc b/src/comum/idioma_zh.incindex e9ad029..c3938ac 100644--- a/src/comum/idioma_zh.inc+++ b/src/comum/idioma_zh.inc@@ -1525,6 +1525,7 @@{ L"Juntos", L"紧密" },{ L"Separados", L"宽松" },{ L"Distância da borda da tela", L"与屏幕边缘的距离" },+{ L"Espaço acima das janelas maximizadas", L"最大化窗口上方的间距" },{ L"Encostado", L"贴边" },{ L"Longe", L"远离" },{ L"Tamanho e Espaço", L"大小与间距" },@@ -1622,3 +1623,7 @@{ L"Captura feita", L"已截屏" },{ L"Captura copiada", L"已拷贝截屏" },{ L"Win+Shift+3 tela inteira, Win+Shift+4 região, Win+Shift+5 a barra de Captura de Tela (com as mesmas opções em Opções). Segure Ctrl para copiar em vez de salvar.", L"Win+Shift+3 截取整个屏幕,Win+Shift+4 截取区域,Win+Shift+5 打开截屏工具栏(“选项”中也有相同设置)。按住 Ctrl 可拷贝而不存储。" },+{ L"Editar Local…", L"编辑位置…" },+{ L"Digite a cidade do Meu Local", L"输入“我的位置”的城市" },+{ L"Botões do Mac nos apps com barra própria", L"在自带标题栏的应用中使用 Mac 按钮" },+{ L"Edge, Chrome, Figma, Discord, VS Code e outros apps que desenham a própria barra ganham os botões do Mac no lugar dos do Windows. Vale para as janelas abertas depois de mudar.", L"Edge、Chrome、Figma、Discord、VS Code 等自带标题栏的应用将使用 Mac 按钮代替 Windows 按钮。对更改后打开的窗口生效。" },diff --git a/src/finder/main.cpp b/src/finder/main.cppindex e12713d..9ca77aa 100644--- a/src/finder/main.cpp+++ b/src/finder/main.cpp@@ -6009,6 +6009,29 @@ static bool HandleKey(UINT vk) {}if (ctrl && vk == 'C') { RunVerb("copy"); return true; }if (ctrl && vk == 'X') { RunVerb("cut"); return true; }+ // Colar um caminho copiado como texto ("C:\Users\...\Pastas", com ou sem aspas, %VAR% ou ~) vai direto para ele,+ // como colar na barra de endereço do Windows; um arquivo abre a pasta dele com ele selecionado. Vale também na+ // janela de escolher (trocar ícones do Dock pasta por pasta: Reddit, 21/11/2026). Arquivos copiados continuam+ // sendo colados na pasta.+ if (ctrl && !shift && vk == 'V' && !IsClipboardFormatAvailable(CF_HDROP) && IsClipboardFormatAvailable(CF_UNICODETEXT) && OpenClipboard(g_hwnd)) {+ std::wstring t;+ if (HANDLE hd = GetClipboardData(CF_UNICODETEXT)) { if (auto* s = (const wchar_t*)GlobalLock(hd)) { t = s; GlobalUnlock(hd); } }+ CloseClipboard();+ while (!t.empty() && iswspace(t.back())) t.pop_back();+ while (!t.empty() && iswspace(t.front())) t.erase(0, 1);+ if (t.size() >= 2 && t.front() == L'"' && t.back() == L'"') t = t.substr(1, t.size() - 2);+ if (!t.empty() && t.size() < 1024 && t.find(L'\n') == std::wstring::npos) {+ t = GoExpand(t);+ while (t.size() > 3 && t.back() == L'\\') t.pop_back();+ DWORD a = GetFileAttributesW(t.c_str());+ if (a != INVALID_FILE_ATTRIBUTES) {+ if (a & FILE_ATTRIBUTE_DIRECTORY) Navigate(t.size() == 2 ? t + L"\\" : t);+ else { std::wstring dir = t.substr(0, t.find_last_of(L'\\')); if (dir.size() == 2) dir += L'\\'; Navigate(dir, true, PathFindFileNameW(t.c_str())); }+ return true;+ }+ }+ }+ if (ctrl && !shift && vk == 'L') { GoOpen(true); return true; } // a barra de endereço do Windows (Ctrl+L): Ir para a Pastaif (ctrl && vk == 'V') { if (g_folder.empty()) Flash(Tr(L"Abra uma pasta para colar")); else if (FAILED(PasteInto(g_hwnd, g_folder))) Flash(Tr(L"Nada para colar")); return true; }if (ctrl && shift && vk == 'N') { NewFolder(); return true; }if (ctrl && !shift && vk == 'N') {diff --git a/src/janelas/macjanela.cpp b/src/janelas/macjanela.cppindex 4012bca..35c271b 100644--- a/src/janelas/macjanela.cpp+++ b/src/janelas/macjanela.cpp@@ -97,7 +97,7 @@ struct Info {COLORREF bottom[2]{ CLR_INVALID, CLR_INVALID }; // cor do app junto aos cantos de baixo (esq., dir.)COLORREF topc[2]{ CLR_INVALID, CLR_INVALID }; // e junto aos de cima, quando o próprio app desenha ali (barra unificada)// o que a moldura desenhou da última vez (W, H, raio, cor de cima, de baixo esq./dir., escuro): igual, só anda- UINT32 cornerKey[9]{};+ UINT32 cornerKey[10]{};};bool Dark() {@@ -123,6 +123,9 @@ RECT CaptionRect(HWND h) {// com os cantos, a sombra, o ampliar e os três botões, desenhados por cima no meio dessa faixa, a 26 pt da borda.int UnifiedBar(HWND h) { return (int)(INT_PTR)GetPropW(h, L"WacOSBarraUnificada"); }+bool BarraPropria(); // mais abaixo: barra_mac_propria (padrão ligado) no ajustes.txt do Shell+bool ProcessoChromium(); // mais abaixo+bool Fullscreen(HWND h); // mais abaixo// 0: não mexe; 1: barra padrão do Windows; 2: barra desenhada pelo próprio app (Chromium/Electron e afins)int Mode(HWND h, bool showing = false) { // showing: chamada no WM_SHOWWINDOW, antes de ficar visívelif (GetAncestor(h, GA_ROOT) != h || (!showing && !IsWindowVisible(h)) || GetPropW(h, PROP)) return 0;@@ -145,7 +148,16 @@ int Mode(HWND h, bool showing = false) { // showing: chamada no WM_SHOWWINDOW,// Apps com barra própria (Chrome, Discord, Electron): desligado. Converter o maximizar quebrava o F11// (tela cheia passa pelo maximizado), o recorte errava as bordas deles e o ganho era pequeno// (já têm cantos do Windows 11 e a sombra vem do Shell). Fica o modo 2 no código para outra tentativa.+ // Volta (21/11/2026, "a barra do Mac em todos os apps"; Reddit: botões do Mac não apareciam no Edge e no Figma):+ // os três botões do Mac à esquerda e a faixa da cor da barra por cima dos botões do Windows, SEM converter o+ // maximizar (o app maximiza e entra em tela cheia sozinho: o F11 continua o dele) e sem recorte. O modo leve+ // (cantos do DWM, contorno e a animação de ampliar) continua junto. Desliga com barra_mac_propria=0.(void)cr;+ if (cap < 20 * sc && BarraPropria() && /* o Chromium mantém WS_CAPTION; a barra do Windows é que não existe */ (st & WS_THICKFRAME) && (st & WS_MAXIMIZEBOX) &&+ !(ex & (WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE)) && !Fullscreen(h)) {+ wchar_t cls[32] = {}; GetClassNameW(h, cls, 32);+ if (!wcscmp(cls, L"Chrome_WidgetWin_1") && ProcessoChromium() && wr.right - wr.left >= 300 && wr.bottom - wr.top >= 200) return 2;+ }return 0;}@@ -163,6 +175,7 @@ RECT FrameRect(HWND h) {}bool TemaTahoe(bool force = false); // mais abaixo: tema Tahoe ligado no ajustes.txt do Shell+bool TemaGolden(); // mais abaixo: macOS 27 Golden Gate (liquid_glass=1 + golden_gate=1)int CornerRadius(HWND h); // mais abaixo: o canto da janela (px)// Recorte arredondado [x0, x1) × [y0, y1) com raio r (px), simétrico e sempre por dentro do arco que a moldura@@ -484,6 +497,10 @@ bool OwnApp() {if (own < 0) { wchar_t p[MAX_PATH] = {}; GetModuleFileNameW(nullptr, p, MAX_PATH); const wchar_t* n = wcsrchr(p, L'\\'); own = n && !_wcsnicmp(n + 1, L"WacOS", 5) ? 1 : 0; }return own == 1;}+static bool g_golden; // lido junto com o Tahoe (TemaTahoe)+static bool g_propria = true; // barra_mac_propria (TemaTahoe)+bool BarraPropria() { TemaTahoe(); return g_propria; }+bool TemaGolden() { return TemaTahoe() && g_golden; }bool TemaTahoe(bool force) {static DWORD at; static bool on;DWORD now = GetTickCount();@@ -499,6 +516,8 @@ bool TemaTahoe(bool force) {CloseHandle(f);buf[n] = 0;on = strstr(buf, "liquid_glass=1") != nullptr;+ g_golden = strstr(buf, "golden_gate=1") != nullptr;+ g_propria = strstr(buf, "barra_mac_propria=0") == nullptr;return on;}int CornerRadius(HWND h) { return (int)std::lround((TemaTahoe() ? 16 : 12) /* Golden Gate: também 16 pt (medido) */ * Scale(h)); }@@ -520,6 +539,18 @@ LRESULT CALLBACK CornerProc(HWND h, UINT m, WPARAM w, LPARAM l) {return DefWindowProcW(h, m, w, l);}+// O contorno da janela, de cada tema (em px da tela; larguras fracionárias viram meio-tom na borda):+// - Sequoia e Tahoe: 1 px escuro por fora (55% no escuro, 22% no claro) e, no escuro, o brilho de 1 px por dentro (16%);+// - macOS 27 Golden Gate (capturas 2x do 512 Pixels: Contatos, Calculadora, Relógio): por fora meio ponto quase preto+// no escuro (95%) e fraco no claro (20%); por dentro, só no escuro, 1 pt claro (10%);+// - Leopard (10.5): só o fio escuro de 1 px, sem brilho por dentro (o metal já tem o próprio realce).+struct Borda { float outW, outA, inW, inA; int id; };+Borda BordaDoTema(bool dark, float sc) {+ if (leopard::On()) return { 1.f, dark ? 0.60f : 0.38f, 0.f, 0.f, 3 };+ if (TemaGolden()) return { std::clamp(0.5f * sc, 0.75f, 1.f), dark ? 0.95f : 0.20f, dark ? 1.f * sc : 0.f, dark ? 0.10f : 0.f, 2 };+ return { 1.f, dark ? 0.55f : 0.22f, 1.f, dark ? 0.16f : 0.f, TemaTahoe() ? 1 : 0 };+}+void HideCorners(Info* in) { for (HWND c : in->corner) if (c) ShowWindow(c, SW_HIDE); }void KeepAbove(Info* in); // mais abaixo@@ -575,7 +606,8 @@ void UpdateCorners(Info* in, RECT vis) {// janela inteira (3440×1400 = 19 MB, alocado, zerado e enviado ao DWM) dentro do programa dos outros.POINT pos{ vis.left - M, vis.top - M };COLORREF top = CapColor(in);- UINT32 key[9]{ (UINT32)W, (UINT32)H, (UINT32)r, (UINT32)top, (UINT32)in->bottom[0], (UINT32)in->bottom[1], (UINT32)in->dark, (UINT32)in->topc[0], (UINT32)in->topc[1] };+ Borda bd = BordaDoTema(in->dark, Scale(h));+ UINT32 key[10]{ (UINT32)W, (UINT32)H, (UINT32)r, (UINT32)top, (UINT32)in->bottom[0], (UINT32)in->bottom[1], (UINT32)in->dark, (UINT32)in->topc[0], (UINT32)in->topc[1], (UINT32)bd.id };if (!memcmp(key, in->cornerKey, sizeof(key)) && IsWindowVisible(fw)) {UpdateLayeredWindow(fw, nullptr, &pos, nullptr, nullptr, nullptr, 0, nullptr, 0);return;@@ -589,7 +621,8 @@ void UpdateCorners(Info* in, RECT vis) {if (!bmp) { DeleteDC(mem); return; }auto* px = (UINT32*)bits;bool dark = in->dark;- float outerA = dark ? 0.55f : 0.22f, innerA = dark ? 0.16f : 0.f; // contorno escuro / brilho (Mac: claro só no escuro)+ (void)dark;+ float outerA = bd.outA, innerA = bd.inA, outW = bd.outW, inW = bd.inW; // contorno escuro / brilho, do tema (BordaDoTema)float hw = (vis.right - vis.left) / 2.f, hh = (vis.bottom - vis.top) / 2.f, cxm = M + hw, cym = M + hh;auto cov = [](float d) { return std::clamp(0.5f - d, 0.f, 1.f); }; // fração do pixel com distância <= 0auto pixel = [&](int x, int y) {@@ -603,8 +636,8 @@ void UpdateCorners(Info* in, RECT vis) {if (c == CLR_INVALID) c = top;over(GetRValue(c) / 255.f, GetGValue(c) / 255.f, GetBValue(c) / 255.f, cov(d));}- if (innerA > 0) over(1, 1, 1, innerA * (cov(d) - cov(d + 1))); // brilho: 1 px por dentro da borda- over(0, 0, 0, outerA * (cov(d - 1) - cov(d))); // contorno: 1 px por fora+ if (innerA > 0) over(1, 1, 1, innerA * (cov(d) - cov(d + inW))); // brilho: por dentro da borda+ over(0, 0, 0, outerA * (cov(d - outW) - cov(d))); // contorno: por foraif (A <= 0) return;px[y * W + x] = (UINT32)std::lround(A * 255) << 24 | (UINT32)std::lround(R * 255) << 16 | (UINT32)std::lround(G * 255) << 8 | (UINT32)std::lround(B * 255);};@@ -965,6 +998,7 @@ LRESULT CALLBACK OverlayProc(HWND h, UINT m, WPARAM w, LPARAM l) {if (k >= 0 && k == in->press) {if (k == 0) PostMessageW(in->owner, WM_SYSCOMMAND, SC_CLOSE, 0);else if (k == 1 && (in->style & WS_MINIMIZEBOX)) ShowWindow(in->owner, SW_MINIMIZE);+ else if (k == 2 && (in->style & WS_MAXIMIZEBOX) && in->custom) PostMessageW(in->owner, WM_SYSCOMMAND, IsZoomed(in->owner) ? SC_RESTORE : SC_MAXIMIZE, 0);else if (k == 2 && (in->style & WS_MAXIMIZEBOX)) ToggleZoom(in);}in->press = -1;@@ -1197,6 +1231,7 @@ LRESULT CALLBACK OwnerProc(HWND h, UINT m, WPARAM w, LPARAM l, UINT_PTR, DWORD_PRECT s = in->lastStart; // do arrasto que acabou agora (Win+←/→ não arrasta: o retângulo de agora)if (s.right <= s.left || GetTickCount() - in->lastStartAt > 3000) GetWindowRect(h, &s);if (!w && !l) {+ if (in->custom) { if (!IsZoomed(h)) PostMessageW(h, WM_SYSCOMMAND, SC_MAXIMIZE, 0); in->tiled = false; return 1; }if (!in->zoomed) { in->before = s; ToggleZoom(in); in->before = s; }in->tiled = false;return 1;@@ -1221,10 +1256,14 @@ LRESULT CALLBACK OwnerProc(HWND h, UINT m, WPARAM w, LPARAM l, UINT_PTR, DWORD_P// Pedido de maximizar pelo menu do sistema (Alt+Espaço, Win+↑ do Windows, atalho do app): vira o "ampliar" ANTES// de o Windows maximizar. Pelo caminho de baixo (WM_SIZE maximizado) a janela aparecia um quadro maximizada,// voltava ao tamanho de antes e só então animava: o "salto" do OBS no vídeo do Reddit (20/11/2026).- if (m == WM_SYSCOMMAND && (w & 0xFFF0) == SC_MAXIMIZE && !IsZoomed(h) && !IsIconic(h) && (in->style & WS_MAXIMIZEBOX) && !in->zoomed && g_msgZoom) {+ if (m == WM_SYSCOMMAND && (w & 0xFFF0) == SC_MAXIMIZE && !in->custom && !IsZoomed(h) && !IsIconic(h) && (in->style & WS_MAXIMIZEBOX) && !in->zoomed && g_msgZoom) {ToggleZoom(in);return 0;}+ if (m == g_msgZoom && g_msgZoom && in->custom) { // barra própria: Win+↑/↓ do Shell maximiza de verdade (w = 0)+ if (w == 0) PostMessageW(h, WM_SYSCOMMAND, IsZoomed(h) ? SC_RESTORE : SC_MAXIMIZE, 0);+ return 1;+ }if (m == g_msgZoom && g_msgZoom) {// w = 1: o app (ou o Windows) maximizou; vira o "ampliar" com cantos. w = 0: alternar (Win+↑/↓ do Shell)if (w == 1 && IsZoomed(h)) {@@ -1364,7 +1403,7 @@ LRESULT CALLBACK OwnerProc(HWND h, UINT m, WPARAM w, LPARAM l, UINT_PTR, DWORD_Preturn r;}case WM_NCLBUTTONDBLCLK: // sem o botão de maximizar do Windows: o duplo clique na barra continua maximizando- if (w == HTCAPTION && (in->style & WS_MAXIMIZEBOX)) { ToggleZoom(in); return 0; } // (barra própria: o app maximiza; vira ampliar)+ if (w == HTCAPTION && (in->style & WS_MAXIMIZEBOX) && !in->custom) { ToggleZoom(in); return 0; } // (barra própria: o app maximiza; vira ampliar)break;case WM_NCRBUTTONUP: // o menu do sistema (sem WS_SYSMENU) não abre mais no clique direito da barrabreak;@@ -1451,10 +1490,10 @@ void Attach(HWND h, int mode) {ApplyColors(in);SetWindowPos(h, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);} else {- in->dark = Dark(); // barra própria: sem botões nem faixas por cima do app; só cantos, sombra e o "ampliar"+ in->dark = Dark(); // barra própria: os botões do Mac e a faixa por cima dos botões do app (BarRect/Paint)+ SetPropW(h, L"MacJanelaPropria", (HANDLE)1);}- if (!in->custom)- in->overlay = CreateWindowExW(WS_EX_LAYERED | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE, L"MacJanelaBarra", L"", WS_POPUP, 0, 0, 1, 1, h, nullptr, g_mod, nullptr);+ in->overlay = CreateWindowExW(WS_EX_LAYERED | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE, L"MacJanelaBarra", L"", WS_POPUP, 0, 0, 1, 1, h, nullptr, g_mod, nullptr);if (in->overlay) { SetWindowLongPtrW(in->overlay, GWLP_USERDATA, (LONG_PTR)in); in->fastUntil = GetTickCount() + 900; SetTimer(in->overlay, 1, 16, nullptr); }DWORD corner = leopard::On() ? 3 : 2; // DWMWCP_ROUND (Leopard: ROUNDSMALL, o canto pequeno do 10.5); mesmo em apps que pedem cantos retosDwmSetWindowAttribute(h, 33 /*DWMWA_WINDOW_CORNER_PREFERENCE*/, &corner, sizeof(corner));@@ -1502,7 +1541,7 @@ void Detach(HWND h, Info* in) {DwmSetWindowAttribute(h, DWMWA_NCRENDERING_POLICY, &on, sizeof(on));}if (in->custom) {- RemovePropW(h, L"MacJanelaAmpliada"); RemovePropW(h, PROP);+ RemovePropW(h, L"MacJanelaAmpliada"); RemovePropW(h, PROP); RemovePropW(h, L"MacJanelaPropria");RemoveWindowSubclass(h, OwnerProc, SUBCLASS_ID);delete in;return;@@ -1642,7 +1681,7 @@ LRESULT CALLBACK LeveProc(HWND h, UINT m, WPARAM w, LPARAM l, UINT_PTR, DWORD_PT// Chromium/Electron chegava só depois de já ter maximizado: a foto saía grande, um "snap").HANDLE zNow = (HANDLE)(INT_PTR)(IsZoomed(h) ? 2 : 1);if (GetPropW(h, PROP_LEVE) != zNow && !(wp->flags & (SWP_NOSIZE | SWP_HIDEWINDOW)) && wp->x > -30000 &&- IsWindowVisible(h) && !IsIconic(h) && !GetPropW(h, PROP) && (SetPropW(h, PROP_LEVE, zNow), true) &&+ IsWindowVisible(h) && !IsIconic(h) && (!GetPropW(h, PROP) || GetPropW(h, L"MacJanelaPropria")) && (SetPropW(h, PROP_LEVE, zNow), true) &&!(SUCCEEDED(DwmGetWindowAttribute(h, DWMWA_CLOAKED, &cloaked, sizeof(cloaked))) && cloaked)) {MONITORINFO mi{ sizeof(mi) };GetMonitorInfoW(MonitorFromWindow(h, MONITOR_DEFAULTTONEAREST), &mi);@@ -1671,7 +1710,7 @@ LRESULT CALLBACK LeveProc(HWND h, UINT m, WPARAM w, LPARAM l, UINT_PTR, DWORD_PT// janela principal com barra própria: redimensionável, com maximizar, sem a barra do Windowsvoid AttachLeve(HWND h) {- if (GetAncestor(h, GA_ROOT) != h || !IsWindowVisible(h) || GetPropW(h, PROP) || GetPropW(h, PROP_LEVE)) return;+ if (GetAncestor(h, GA_ROOT) != h || !IsWindowVisible(h) || (GetPropW(h, PROP) && !GetPropW(h, L"MacJanelaPropria")) || GetPropW(h, PROP_LEVE)) return;LONG st = GetWindowLongW(h, GWL_STYLE), ex = GetWindowLongW(h, GWL_EXSTYLE);if ((st & WS_CHILD) || !(st & WS_THICKFRAME) || !(st & WS_MAXIMIZEBOX) || (ex & (WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE))) return;// só a janela principal do Chromium/Electron (regra de 20/11/2026): em qualquer outro programa sem a barra do@@ -1706,7 +1745,7 @@ BOOL CALLBACK EnumProc(HWND h, LPARAM) {if (GetClassNameW(h, cls, 64) && jogos::ClasseDeJogo(cls)) { g_fora = true; return FALSE; }TakeOver(h);if (int mode = Mode(h)) Attach(h, mode);- else AttachLeve(h);+ AttachLeve(h); // barra própria: o modo leve também (cantos, contorno, animação); nas outras não faz nadareturn TRUE;}diff --git a/src/shell/dock.cpp b/src/shell/dock.cppindex 3c40c74..4939da9 100644--- a/src/shell/dock.cpp+++ b/src/shell/dock.cpp@@ -23,6 +23,7 @@ float g_tile = 48; // tamanho do ícone (pt)// Personalização (Ajustes > Mesa e Dock > Personalizar o Dock, pedido de 20/11/2026, "como o MyDockFinder"). Valor// negativo = o padrão medido do Mac (as medidas de cada tema logo abaixo continuam valendo).float g_espaco = 0; // dock_espaco: espaço a mais entre os ícones (pt)+float g_folgaPt = 0; // dock_folga: espaço entre o Dock e as janelas maximizadas (pt; o Mac não tem)float g_margemPt = -1; // dock_margem: distância do Dock até a borda da tela (pt)float g_raioPct = -1; // dock_raio: arredondamento do fundo, 0 (reto) a 1 (pílula)float g_vidroOpac = -1; // dock_opacidade: tinta do vidro, 0 (só o desfoque) a 1 (sólido)@@ -1801,9 +1802,10 @@ int dock::Posicao() { return Pos(); }int dock::ReservedHeight() { // a espessura do Dock na borda dele (embaixo, à esquerda ou à direita: dock::Posicao)if (!g_icons || g_autohide) return 0;- // + 4 pt de folga (issue #8, todos os temas): a janela maximizada não encosta no vidro do Dock. Na escala da tela;- // com o Dock oculto (automático ou inteligente) não há reserva nem folga- return (int)std::lround((g_tile + PAD_TOP + PAD_BOTTOM + MARGIN + 4) * Sc());+ // + a folga (dock_folga): no Mac a janela maximizada encosta no Dock. A folga fixa de 4 pt (issue #8) deixava o+ // Dock "descolado" da janela (21/11/2026); agora é opcional, 0 por padrão. Na escala da tela; com o Dock oculto+ // (automático ou inteligente) não há reserva nem folga+ return (int)std::lround((g_tile + PAD_TOP + PAD_BOTTOM + MARGIN + g_folgaPt) * Sc());}static void ReadSettings() {@@ -1818,6 +1820,7 @@ static void ReadSettings() {// personalização (vazio = o padrão do Mac)auto num = [](const wchar_t* k, float def) { std::wstring v = shell::Setting(k, L""); return v.empty() ? def : (float)_wtof(v.c_str()); };g_espaco = std::clamp(num(L"dock_espaco", 0), 0.f, 48.f);+ g_folgaPt = std::clamp(num(L"dock_folga", 0), 0.f, 24.f);g_margemPt = num(L"dock_margem", -1); if (g_margemPt >= 0) g_margemPt = std::min(g_margemPt, 80.f);g_raioPct = num(L"dock_raio", -1); if (g_raioPct >= 0) g_raioPct = std::min(g_raioPct / 100.f, 1.f);g_vidroOpac = num(L"dock_opacidade", -1); if (g_vidroOpac >= 0) g_vidroOpac = std::min(g_vidroOpac / 100.f, 1.f);@@ -1855,7 +1858,7 @@ void dock::IconsChanged() {void dock::ReloadSettings() {bool hide = g_autohide, smart = g_smart;- int pos = g_pos;+ int pos = g_pos, reserva = dock::ReservedHeight();ReadSettings();if (!g_icons) return;if (pos != g_pos) { // mudou de lado: a área de trabalho reserva a borda nova (e as janelas maximizadas se ajeitam)@@ -1872,7 +1875,7 @@ void dock::ReloadSettings() {g_bmps.clear();BuildItems(); // a pasta Downloads, a divisória ou o Launchpad podem ter entrado ou saídoPaint();- if (pos != g_pos) shell::ApplyWorkArea();+ if (pos != g_pos || reserva != dock::ReservedHeight()) shell::ApplyWorkArea(); // lado, tamanho, margem ou folga}bool dock::Create(HINSTANCE hi) {diff --git a/src/shell/mesa.cpp b/src/shell/mesa.cppindex 6d5f30c..20c265a 100644--- a/src/shell/mesa.cpp+++ b/src/shell/mesa.cpp@@ -988,6 +988,16 @@ void EndEdit(bool commit) {g_editEnding = false;while (!text.empty() && text.back() == L' ') text.pop_back();if (commit && idx >= 0 && idx < (int)g_items.size() && !text.empty() && text != g_items[idx].name) {+ // A mesa mostra o nome do Windows (SHGFI_DISPLAYNAME), que esconde a extensão quando "ocultar extensões" está+ // ligado: "foto.png" aparece "foto" e, renomeada para "praia", virava "praia" sem extensão (o arquivo ficava+ // inutilizável; Reddit, 21/11/2026). Extensão escondida continua no arquivo, como no Mac.+ if (!g_items[idx].dir) {+ const wchar_t* real = PathFindFileNameW(g_items[idx].path.c_str());+ std::wstring ext = PathFindExtensionW(real);+ bool escondida = !ext.empty() && _wcsicmp(g_items[idx].name.c_str(), real) != 0 &&+ g_items[idx].name.size() + ext.size() == wcslen(real);+ if (escondida && (text.size() < ext.size() || _wcsicmp(text.c_str() + text.size() - ext.size(), ext.c_str()))) text += ext;+ }IFileOperation* op = nullptr; IShellItem* si = nullptr;if (SUCCEEDED(CoCreateInstance(CLSID_FileOperation, nullptr, CLSCTX_ALL, IID_PPV_ARGS(&op))) &&SUCCEEDED(SHCreateItemFromParsingName(g_items[idx].path.c_str(), nullptr, IID_PPV_ARGS(&si)))) {diff --git a/src/shell/widgets.cpp b/src/shell/widgets.cppindex d8f2a35..4a3b0eb 100644--- a/src/shell/widgets.cpp+++ b/src/shell/widgets.cpp@@ -834,6 +834,8 @@ void Click(Widget& wd) {std::wstring url;switch (wd.kind) {case K_WEATHER: case K_SUN: {+ std::wstring app = shell::dir + L"\\" EXE_WEATHER; // como no Mac: o widget abre o app Tempo+ if (GetFileAttributesW(app.c_str()) != INVALID_FILE_ATTRIBUTES) { ShellExecuteW(nullptr, L"open", app.c_str(), nullptr, shell::dir.c_str(), SW_SHOWNORMAL); return; }url = L"https://www.google.com/search?q=tempo+" + City();for (auto& c : url) if (c == L' ') c = L'+';target = url.c_str(); break;@@ -850,6 +852,10 @@ void Menu(Widget* wd, POINT pt) { // wd nulo: "Editar Widgets…" da mesa (sóctxmenu::Item it; it.label = Tr(g_w[i].name); it.id = 10 + (int)i; it.checked = g_w[i].on; items.push_back(it);}ctxmenu::Item sep; sep.separator = true; items.push_back(sep);+ // Tempo e Nascer do Sol: o local é o "Meu Local" do app Tempo; daqui abre o Tempo já na busca (Reddit, 21/11/2026:+ // "só dá para ver em Campinas")+ bool local = wd && (wd->kind == K_WEATHER || wd->kind == K_SUN);+ if (local) { ctxmenu::Item ed; ed.label = Tr(L"Editar Local…"); ed.id = 3; items.push_back(ed); }if (wd) { ctxmenu::Item rm; rm.label = Tr(L"Remover Widget"); rm.id = 1; items.push_back(rm); }ctxmenu::Item reset; reset.label = Tr(L"Organizar Widgets"); reset.id = 2; items.push_back(reset);HWND fg = GetForegroundWindow();@@ -858,7 +864,10 @@ void Menu(Widget* wd, POINT pt) { // wd nulo: "Editar Widgets…" da mesa (sóSetForegroundWindow(g_menuOwner);if (att) AttachThreadInput(me, ft, FALSE);int id = ctxmenu::ShowItems(g_menuOwner, pt, items);- if (id == 1 && wd) { Show(*wd, false); shell::SetSetting((std::wstring(L"widget.") + wd->id + L".on").c_str(), L"0"); }+ if (id == 3) {+ std::wstring exe = shell::dir + L"\\" EXE_WEATHER;+ ShellExecuteW(nullptr, L"open", exe.c_str(), L"--meu-local", shell::dir.c_str(), SW_SHOWNORMAL);+ } else if (id == 1 && wd) { Show(*wd, false); shell::SetSetting((std::wstring(L"widget.") + wd->id + L".on").c_str(), L"0"); }else if (id == 2) {for (auto& w : g_w) w.rc = -1;for (auto& w : g_w) { shell::SetSetting((std::wstring(L"widget.") + w.id).c_str(), L""); if (w.on) Position(w, true, true); }@@ -999,6 +1008,11 @@ void widgets::EditMenu(POINT pt) { if (!g_w.empty()) Menu(nullptr, pt); }// Ajustes > Mesa e Dock > Personalizar a Mesa liga/desliga cada widget (widget.<id>.on): segue o arquivovoid widgets::SettingsChanged() {+ // a cidade do tempo mudou (Tempo > Usar como Meu Local, ou "Editar Local…" do widget): busca já, sem esperar 15 min+ static cidade::Padrao def;+ static std::wstring lastPlace = shell::Setting(L"tempoLat", def.lat.c_str()) + L"," + shell::Setting(L"tempoLon", def.lon.c_str());+ std::wstring place = shell::Setting(L"tempoLat", def.lat.c_str()) + L"," + shell::Setting(L"tempoLon", def.lon.c_str());+ if (place != lastPlace) { lastPlace = place; Fetch(); }for (auto& wd : g_w) {if (!wd.wnd) continue;bool want = shell::Setting((std::wstring(L"widget.") + wd.id + L".on").c_str(), L"1") != L"0";