A new style desktop shell for Windows 11: menu bar, Dock, Finder, Spotlight, Control Center and Liquid Glass, in native C++.
Rust
Fix Notification Center stacks, desktop reveal after Win+D, add desktop options
Eternity070628d0a87448994c
diff --git a/src/ajustes/paginas.cpp b/src/ajustes/paginas.cppindex b251355..5687011 100644--- a/src/ajustes/paginas.cpp+++ b/src/ajustes/paginas.cpp@@ -1377,7 +1377,9 @@ Page MesaDock() {Row dl = Toggle(L"Mostrar a pasta Downloads no Dock", flag(L"dock_downloads", L"1"), setFlag(L"dock_downloads"));p.groups.push_back(G({ size, mag, magSize, pos, monRow, hide, anim, ind, dl }, L"Dock"));// como no macOS 15/26 (Mesa e Dock > Área de Trabalho e Organizador Visual)- p.groups.push_back(G({ Popup(L"Clicar no papel de parede para mostrar a mesa", { L"Sempre", L"Só no Organizador Visual", L"Nunca" },+ // macOS 14+: "Mostrar Itens: Na Mesa" (o mesmo que o menu da mesa "Ocultar Ícones da Mesa")+ Row icons = Toggle(L"Mostrar ícones na mesa", [] { return Setting(L"mesa_icones", L"1") != L"0"; }, [](bool v) { SetSetting(L"mesa_icones", v ? L"1" : L"0"); });+ p.groups.push_back(G({ icons, Popup(L"Clicar no papel de parede para mostrar a mesa", { L"Sempre", L"Só no Organizador Visual", L"Nunca" },[] { std::wstring v = Setting(L"clique_mostra_mesa", L"palco"); return v == L"1" ? 0 : v == L"0" ? 2 : 1; },[](int i) { SetSetting(L"clique_mostra_mesa", i == 0 ? L"1" : i == 2 ? L"0" : L"palco"); }) }, L"Área de Trabalho"));p.groups.push_back(G({ Toggle(L"Arrastar janelas para as bordas da tela para organizar", [] { return sys::SnapEnabled(); }, [](bool on) { sys::SetSnapEnabled(on); }),diff --git a/src/comum/idioma_en.inc b/src/comum/idioma_en.incindex 6eb9f8b..69ec20d 100644--- a/src/comum/idioma_en.inc+++ b/src/comum/idioma_en.inc@@ -1418,3 +1418,6 @@{ L"%d notas", L"%d notes" },{ L"Apagar Nota", L"Delete Note" },{ L"Ordem Padrão", L"Default Order" },+{ L"Ocultar Ícones da Mesa", L"Hide Desktop Icons" },+{ L"Mostrar Ícones na Mesa", L"Show Desktop Icons" },+{ L"Mostrar ícones na mesa", L"Show icons on desktop" },diff --git a/src/comum/semaforo.h b/src/comum/semaforo.hindex b55147a..bf57309 100644--- a/src/comum/semaforo.h+++ b/src/comum/semaforo.h@@ -16,7 +16,7 @@ namespace semaforo {enum Kind { FILL, RING, GLYPH };// lê destaque= e o tema (golden_gate=1 junto com liquid_glass=1 = macOS Golden Gate) do ajustes.txt-struct Estado { bool grafite = false, aqua = false; };+struct Estado { bool grafite = false, aqua = false, liquid = false; };inline const Estado& Ler() {static Estado st;static DWORD lastCheck = 0;@@ -44,6 +44,7 @@ inline const Estado& Ler() {fclose(f);st.grafite = g;st.aqua = liquid && golden;+ st.liquid = liquid;return st;}@@ -57,6 +58,7 @@ inline bool Grafite() { return Ler().grafite; }// minim. (251,185,39) -> (254,211,66); aro (157,9,9)// zoom (96,208,40) -> (152,218,120); aro (9,85,9)inline bool Aqua() { return Ler().aqua; }+inline bool Liquid() { return Ler().liquid; } // Tahoe ou Golden Gate (cantos de 16)#include "semaforo_mac27.inc" // os três botões do macOS 27 tirados da captura 2x (tools/semaforo-mac27.py)diff --git a/src/notas/main.cpp b/src/notas/main.cppindex 7eb97a4..6d1ed88 100644--- a/src/notas/main.cpp+++ b/src/notas/main.cpp@@ -354,7 +354,7 @@ void LayoutButtons() {if (gg) { g_btn[B_TRASH].shown = false; put(B_MORE, ListR() - 28, L"", 36, 16, 4); g_btn[B_MORE].r.top = TOOL_CY - 18; g_btn[B_MORE].r.bottom = TOOL_CY + 18; }}float e1 = c.width;- put(B_COMPOSE, e0 + 29, L"square.and.pencil", 32, 16, 16);+ put(B_COMPOSE, e0 + 29, L"square.and.pencil", semaforo::Aqua() ? 28.f : 32.f, 16, 16); // macOS 27: com a cápsula de 4, um círculo de 36put(B_FORMAT, e0 + 92, L"textformat", 34, 20, 13);put(B_CHECK, e0 + 133, L"checklist", 32, 17, 15);put(B_TABLE, e0 + 176, L"tablecells", 32, 17, 14);@@ -472,7 +472,7 @@ void DrawSidebar(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const Pal& paauto r = SideRowRect(s);bool sel = s.id == g_folder && !Searching();bool drop = g_dragging && s.id == g_dropFolder;- if (sel) { br->SetColor(g_dark ? D2D1::ColorF(1, 1, 1, g_focus == F_SIDE ? 0.16f : 0.11f) : D2D1::ColorF(0, 0, 0, g_focus == F_SIDE ? 0.12f : 0.085f)); dc->FillRoundedRectangle(D2D1::RoundedRect(r, 6, 6), br); }+ if (sel) { br->SetColor(g_dark ? D2D1::ColorF(1, 1, 1, g_focus == F_SIDE ? 0.16f : 0.11f) : D2D1::ColorF(0, 0, 0, g_focus == F_SIDE ? 0.12f : 0.085f)); float fr2 = semaforo::Aqua() ? 10.f : 6.f; dc->FillRoundedRectangle(D2D1::RoundedRect(r, fr2, fr2), br); }if (drop) {auto a = Accent(); br->SetColor(D2D1::ColorF(a.r, a.g, a.b, 0.30f)); dc->FillRoundedRectangle(D2D1::RoundedRect(r, 6, 6), br);br->SetColor(a); dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1), 5, 5), br, 2);@@ -544,7 +544,11 @@ void DrawToolbarButtons(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, constif (!b.shown) continue;if (b.enabled && (g_hoverBtn == i || g_pressBtn == i || (i == B_FORMAT && g_fmtOpen)) && i != B_LIST && i != B_GALLERY) {br->SetColor(g_pressBtn == i || (i == B_FORMAT && g_fmtOpen) ? (g_dark ? D2D1::ColorF(1, 1, 1, 0.14f) : D2D1::ColorF(0, 0, 0, 0.09f)) : pal.hover);- dc->FillRoundedRectangle(D2D1::RoundedRect(b.r, 7, 7), br);+ float rr = semaforo::Aqua() ? (b.r.bottom - b.r.top) / 2 : 7.f; // macOS 27: o realce segue o vidro redondo+ if (semaforo::Aqua() && (i == B_COMPOSE || i == B_SHARE || i == B_SIDEBAR || i == B_FOLDER || i == B_MORE || i == B_SEARCH)) {+ float cx2 = (b.r.left + b.r.right) / 2, cy2 = (b.r.top + b.r.bottom) / 2, rad = i == B_SEARCH ? 0 : 16.f;+ if (rad > 0) dc->FillEllipse(D2D1::Ellipse({ cx2, cy2 }, rad, rad), br); else dc->FillRoundedRectangle(D2D1::RoundedRect(b.r, 18, 18), br);+ } else dc->FillRoundedRectangle(D2D1::RoundedRect(b.r, rr, rr), br);}D2D1_COLOR_F col = b.enabled ? pal.icon : pal.iconOff;if ((i == B_LIST && !g_gallery) || (i == B_GALLERY && g_gallery)) col = g_dark ? D2D1::ColorF(1, 1, 1, 0.85f) : D2D1::ColorF(0, 0, 0, 0.75f);@@ -605,7 +609,7 @@ void DrawList(ID2D1DeviceContext* dc, ID2D1SolidColorBrush* br, const Pal& pal)Note* n = r.n;bool sel = n == g_sel;D2D1_RECT_F rr{ L + 10, y + 1, R - 10, y + r.h - 1 };- if (sel) { br->SetColor(listFocus ? pal.selFocus : pal.sel); dc->FillRoundedRectangle(D2D1::RoundedRect(rr, 8, 8), br); }+ if (sel) { float sr = semaforo::Aqua() ? 12.f : 8.f; br->SetColor(listFocus ? pal.selFocus : pal.sel); dc->FillRoundedRectangle(D2D1::RoundedRect(rr, sr, sr), br); } // macOS 27: mais redondaelse { // divisória fina entre as notas (não encosta na selecionada)bool nextSel = i + 1 < g_rows.size() && g_rows[i + 1].n == g_sel && g_sel;bool nextHeader = i + 1 >= g_rows.size() || g_rows[i + 1].header;@@ -829,7 +833,17 @@ void Paint() {ID2D1DeviceContext* dc = gfx::Begin(g_dpi);if (!dc) return;dc->Clear(D2D1::ColorF(0, 0, 0, 0));+ // os cantos redondos da janela (16 no Tahoe e no Golden Gate, 12 no Sequoia): sem isso o conteúdo ia até o canto+ // reto e sobrava um pedaço branco fora do arco da borda+ ID2D1Factory* f = nullptr; dc->GetFactory(&f);+ ID2D1RoundedRectangleGeometry* rg = nullptr;+ auto c = ClientDip();+ float R = IsZoomed(g_hwnd) ? 0.f : semaforo::Liquid() ? 16.f : 12.f;+ if (f && R > 0) f->CreateRoundedRectangleGeometry(D2D1::RoundedRect(D2D1::RectF(0, 0, c.width, c.height), R, R), &rg);+ if (rg) dc->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), rg), nullptr);Render(dc);+ if (rg) { dc->PopLayer(); rg->Release(); }+ if (f) f->Release();gfx::End();}diff --git a/src/shell/mesa.cpp b/src/shell/mesa.cppindex f7c2809..4056d6c 100644--- a/src/shell/mesa.cpp+++ b/src/shell/mesa.cpp@@ -125,6 +125,8 @@ std::map<std::wstring, std::pair<float, float>> g_off; // e o deslocamento livr// Como no Mac (botão direito > Ordenar Por): "Nenhum" (padrão) deixa cada ícone onde foi solto; "Alinhar à Grade"// encaixa nas casas. mesa_grade=1 liga a grade.bool Livre() { return shell::Setting(L"mesa_grade", L"0") != L"1"; }+// "Ocultar Ícones da Mesa" (menu da mesa e Ajustes > Mesa e Dock): os arquivos continuam lá, só não aparecem+bool IconesOn() { return shell::Setting(L"mesa_icones", L"1") != L"0"; }POINT g_grab{ -1, -1 }; // onde o ícone foi pego (px, a partir do canto do ícone), para soltar exatamente aliIDWriteTextFormat* g_tf = nullptr;float g_tfScale = 0;@@ -665,6 +667,7 @@ D2D1_RECT_F LabelBox(const Item& it) {return D2D1::RectF(c.left + 3 * s, ib.bottom + LABEL_GAP * s, c.right - 3 * s, ib.bottom + (LABEL_GAP + LABEL_H) * s);}int HitClient(POINT p) {+ if (!IconesOn()) return -1; // ícones ocultos: clique na mesa vaziafor (int i = (int)g_items.size() - 1; i >= 0; i--) {auto& it = g_items[i];if (it.col < 0) continue;@@ -697,6 +700,7 @@ void DrawIcons(ID2D1RenderTarget* rt) {EnsureFormat();if (!g_br) rt->CreateSolidColorBrush(D2D1::ColorF(1, 1, 1, 1), &g_br);if (!g_tf || !g_br) return;+ if (!IconesOn()) return; // "Ocultar Ícones da Mesa"float s = Sc();for (int i = 0; i < (int)g_items.size(); i++) {auto& it = g_items[i];@@ -1191,7 +1195,7 @@ void ItemMenu(HWND h, POINT screen, int idx) {void BackgroundMenu(HWND h, POINT screen) {enum { ID_NEW = 1, ID_INFO, ID_PASTE, ID_WALL, ID_CLEAN, ID_BY_NAME, ID_BY_KIND, ID_BY_DATE, ID_BY_SIZE, ID_MORE, ID_DISPLAY, ID_PERSONAL, ID_STACKS,- ID_SORT_NONE, ID_SORT_GRID };+ ID_SORT_NONE, ID_SORT_GRID, ID_WIDGETS, ID_ICONS };bool canPaste = IsClipboardFormatAvailable(CF_HDROP) || IsClipboardFormatAvailable(RegisterClipboardFormatW(CFSTR_SHELLIDLIST));std::vector<ctxmenu::Item> items;auto add = [&](const wchar_t* t, int id, bool dis = false) { ctxmenu::Item i; i.label = t; i.id = id; i.disabled = dis; items.push_back(i); return &items.back(); };@@ -1202,7 +1206,9 @@ void BackgroundMenu(HWND h, POINT screen) {add(Tr(L"Colar"), ID_PASTE, !canPaste)->shortcut = L"Ctrl+V";sep();add(Tr(L"Alterar Fundo da Mesa…"), ID_WALL);+ add(Tr(L"Editar Widgets…"), ID_WIDGETS); // como no macOS: traz de volta os widgets removidossep();+ add(IconesOn() ? Tr(L"Ocultar Ícones da Mesa") : Tr(L"Mostrar Ícones na Mesa"), ID_ICONS);add(Tr(L"Usar Pilhas"), ID_STACKS)->checked = g_stacks;if (!g_stacks) { // como no Mac: Ordenar Por > Nenhum (solto) / Alinhar à Gradectxmenu::Item sb; sb.label = Tr(L"Ordenar Por");@@ -1236,6 +1242,8 @@ void BackgroundMenu(HWND h, POINT screen) {break;}case ID_WALL: shell::OpenSettings(L"fundo"); break;+ case ID_WIDGETS: widgets::EditMenu(screen); break;+ case ID_ICONS: shell::SetSetting(L"mesa_icones", IconesOn() ? L"0" : L"1"); for (auto& it : g_items) it.sel = false; Redraw(); break;case ID_STACKS: SetStacks(!g_stacks); break;case ID_SORT_NONE: shell::SetSetting(L"mesa_grade", L"0"); Redraw(); break;case ID_SORT_GRID: // encaixa todos nas casas (a mais perto de onde cada um está)@@ -1818,6 +1826,7 @@ void mesa::Start(HINSTANCE hi, HWND msgWnd) {void mesa::SettingsChanged() {Log(L"mesa: ajustes mudaram (explorer=%ls)", shell::Setting(L"explorer", L"1").c_str());if (g_ctl) { g_closeTries = 0; Tick(); }+ { static int lastIcons = -1; int on = IconesOn() ? 1 : 0; if (lastIcons >= 0 && on != lastIcons && Primary()) Redraw(); lastIcons = on; } // ícones ligados/desligados nos Ajustesif ((shell::Setting(L"mesa_pilhas", L"0") == L"1") != g_stacks && Primary()) { // Pilhas ligadas/desligadas fora do menu da mesag_openStacks.clear();for (auto& it : g_items) it.col = it.row = -1;diff --git a/src/shell/notificacoes.cpp b/src/shell/notificacoes.cppindex 83db541..60c127f 100644--- a/src/shell/notificacoes.cpp+++ b/src/shell/notificacoes.cpp@@ -67,7 +67,7 @@ inline float WidgetR() { return liquid::On() ? 26.f : WIDGET_R_SEQ; }const int MAX_GROUPS = 6; // grupos mostrados antes de "N notificações a mais"const UINT WM_NC_FRAME = WM_APP + 90, WM_NC_DATA = WM_APP + 91, WM_NC_NEW = WM_APP + 92, WM_NC_BFRAME = WM_APP + 93;-const UINT_PTR T_TICK = 1;+const UINT_PTR T_TICK = 1, T_FOCO = 2; // T_FOCO: confere quem ficou na frente depois de perder o foco "para ninguém"HWND g_wnd, g_back;bool IsOurBanner(HWND h) { wchar_t c[64] = {}; GetClassNameW(h, c, 64); return wcsstr(c, L"Notifica") != nullptr || wcsstr(c, L"Banner") != nullptr; }@@ -1134,7 +1134,8 @@ void Click(D2D1_POINT_2F p) {case A_MORE: g_showAll = true; break;case A_EDIT:Close();- if (g_editWidgets) g_editWidgets(); else shell::OpenSettings(L"notificacoes");+ if (g_editWidgets) g_editWidgets();+ else { POINT c; GetCursorPos(&c); widgets::EditMenu(c); } // os widgets da mesa: ligar/desligar cada umreturn;case A_SETTINGS: Close(); shell::OpenSettings(L"notificacoes"); return;case A_PERMISSION: Close(); ShellExecuteW(nullptr, L"open", L"ms-settings:privacy-notifications", nullptr, nullptr, SW_SHOWNORMAL); return;@@ -1172,6 +1173,14 @@ LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {return 0;case WM_TIMER:if (w == T_TICK && g_open) Paint(); // horas relativas e o relógio+ if (w == T_FOCO) {+ KillTimer(h, T_FOCO);+ if (!g_open || g_menu) return 0;+ HWND f = GetForegroundWindow(); DWORD pid = 0;+ if (f) GetWindowThreadProcessId(f, &pid);+ if (f && pid != GetCurrentProcessId()) { Log(L"notificações: fechou (outro programa na frente)"); Close(); }+ else SetForegroundWindow(g_wnd); // ninguém (ou o próprio Shell) na frente: continua aberta+ }return 0;case WM_LBUTTONDOWN: if (g_open) Click(Pt(l)); return 0;case WM_RBUTTONUP: return 0;@@ -1197,6 +1206,7 @@ LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {SetForegroundWindow(g_wnd);return 0;}+ if (!to) { SetTimer(h, T_FOCO, 150, nullptr); return 0; } // "para ninguém" (ao abrir uma pilha): confere já jáwchar_t cls[64] = {}; if (to) GetClassNameW(to, cls, 64);Log(L"notificações: fechou (perdeu o foco para %ls)", cls);Close();diff --git a/src/shell/quicklook.cpp b/src/shell/quicklook.cppindex eeb53c9..6d2c8ff 100644--- a/src/shell/quicklook.cpp+++ b/src/shell/quicklook.cpp@@ -122,6 +122,10 @@ void SyncBack();void KeepTop() {if (!g_wnd || !IsWindowVisible(g_wnd)) return;bool want = WantTop(), is = (GetWindowLongW(g_wnd, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;+ // como no Mac: saiu do Finder (outro app na frente), o Quick Look fecha. Duas leituras seguidas (0,6 s), para+ // não fechar no instante em que o Windows troca a janela da frente+ static int away;+ if (!want && GetForegroundWindow()) { if (++away >= 2) { away = 0; quicklook::Close(); return; } } else away = 0;if (want != is) { SetWindowPos(g_wnd, want ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); SyncBack(); }}@@ -390,19 +394,21 @@ void DrawGolden(ID2D1RenderTarget* rt, float W, float H, bool dark, bool glass)}if (g_isIcon || (g_text.empty() && !g_bmp)) { // sem prévia: ícone grande e informações, direto no vidrofloat k = g_media ? 1.f : H / 440; // música: posições fixas (a barra fica embaixo)+ float nameY = 311 * k; // o nome fica abaixo do ícone desenhado (os de documento são altos e encostavam nele)if (g_bmp) {float s = std::min(200.f / g_iw, 200.f / g_ih), w = g_iw * s, h = g_ih * s, x = W / 2, y = 210 * k;+ nameY = std::max(nameY, y + h / 2 + 18);rt->DrawBitmap(g_bmp, D2D1::RectF(x - w / 2, y - h / 2, x + w / 2, y + h / 2), 1, D2D1_BITMAP_INTERPOLATION_MODE_LINEAR);}static IDWriteTextFormat* tfN = ui::Format(14, DWRITE_FONT_WEIGHT_BOLD, false, DWRITE_TEXT_ALIGNMENT_CENTER);static IDWriteTextFormat* tfI = ui::Format(11.5f, DWRITE_FONT_WEIGHT_NORMAL, false, DWRITE_TEXT_ALIGNMENT_CENTER);for (auto* f : { tfN, tfI }) if (f) { f->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER); f->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP); DWRITE_TRIMMING tr{ DWRITE_TRIMMING_GRANULARITY_CHARACTER, 0, 0 }; f->SetTrimming(&tr, nullptr); }br->SetColor(text);- if (tfN) rt->DrawTextW(g_name.c_str(), (UINT32)g_name.size(), tfN, D2D1::RectF(20, 311 * k - 11, W - 20, 311 * k + 11), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);+ if (tfN) rt->DrawTextW(g_name.c_str(), (UINT32)g_name.size(), tfN, D2D1::RectF(20, nameY - 11, W - 20, nameY + 11), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);br->SetColor(text2);if (tfI) {- rt->DrawTextW(g_info.c_str(), (UINT32)g_info.size(), tfI, D2D1::RectF(20, 354 * k - 9, W - 20, 354 * k + 9), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);- rt->DrawTextW(g_date.c_str(), (UINT32)g_date.size(), tfI, D2D1::RectF(20, 372 * k - 9, W - 20, 372 * k + 9), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);+ rt->DrawTextW(g_info.c_str(), (UINT32)g_info.size(), tfI, D2D1::RectF(20, nameY + 43 - 9, W - 20, nameY + 43 + 9), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);+ rt->DrawTextW(g_date.c_str(), (UINT32)g_date.size(), tfI, D2D1::RectF(20, nameY + 61 - 9, W - 20, nameY + 61 + 9), br, D2D1_DRAW_TEXT_OPTIONS_CLIP);}br->Release(); fac->Release();return;@@ -880,6 +886,7 @@ bool Ensure() {} // namespace+bool quicklook::IsOpen() { return g_wnd && IsWindowVisible(g_wnd); }std::wstring quicklook::Path() { return IsOpen() ? g_path : L""; }diff --git a/src/shell/revelar.cpp b/src/shell/revelar.cppindex 70e2179..8d58d9c 100644--- a/src/shell/revelar.cpp+++ b/src/shell/revelar.cpp@@ -27,6 +27,7 @@ struct Moved {RECT from{}, to{};bool minimized = false; // estava maximizada: foi minimizadabool failed = false; // o Windows recusou mover (janela de administrador)+ bool atEdge = false; // foi mesmo para a borda (para devolver também se for minimizada lá)RECT src{}; // parte visível da janela (sem a borda invisível; nas maximizadas ela fica fora da tela)};@@ -287,7 +288,21 @@ void MoveReal(float k) {for (auto& m : g_moved) {if (!IsWindow(m.h)) continue;RECT r = At(m, k);- if (!SetWindowPos(m.h, nullptr, r.left, r.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_ASYNCWINDOWPOS) && !m.failed) {+ if (IsIconic(m.h)) {+ // minimizada com as janelas na borda (Win+D, ocultar): mover a janela minimizada não muda onde ela volta.+ // Muda o lugar de restaurar, a partir da borda (onde ela foi minimizada), sem tirar do Dock+ WINDOWPLACEMENT wp{ sizeof(wp) };+ if (m.atEdge && k < 0.5f && GetWindowPlacement(m.h, &wp)) {+ m.atEdge = false;+ OffsetRect(&wp.rcNormalPosition, r.left - m.to.left, 0);+ wp.flags = 0; wp.showCmd = SW_SHOWMINNOACTIVE;+ SetWindowPlacement(m.h, &wp);+ }+ continue;+ }+ bool ok = SetWindowPos(m.h, nullptr, r.left, r.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_ASYNCWINDOWPOS) != FALSE;+ if (ok) m.atEdge = k > 0.5f;+ if (!ok && !m.failed) {m.failed = true;wchar_t t[80] = {}; GetWindowTextW(m.h, t, 80);Log(L"revelar: o Windows não deixou mover \"%ls\" (%lu)", t, GetLastError());diff --git a/src/shell/shell.h b/src/shell/shell.hindex 98b1d79..e5a8c50 100644--- a/src/shell/shell.h+++ b/src/shell/shell.h@@ -352,6 +352,7 @@ bool MoveWindow(HWND h, int index); // leva a janela (de qualquer programa) parnamespace widgets { // widgets da mesa: Relógio Mundial, Tempo, Relógio, Calendário, Nascer do Sol (widgets.cpp)void Create(HINSTANCE hi);std::vector<RECT> Areas(); // onde estão (tela): os ícones da mesa não ficam embaixo deles+void EditMenu(POINT pt); // "Editar Widgets…": ligar/desligar cada widget (também sem nenhum na tela)}namespace mesa { // mesa própria (papel de parede + ícones) e o modo sem explorer.exe (mesa.cpp, docs/sem-explorer.md)void Start(HINSTANCE hi, HWND msgWnd); // ajuste explorer=0: fecha o Explorador e assume a mesadiff --git a/src/shell/widgets.cpp b/src/shell/widgets.cppindex 2d93887..b840e36 100644--- a/src/shell/widgets.cpp+++ b/src/shell/widgets.cpp@@ -830,13 +830,13 @@ void Click(Widget& wd) {if (target) ShellExecuteW(nullptr, L"open", target, nullptr, nullptr, SW_SHOWNORMAL);}-void Menu(Widget& wd, POINT pt) {+void Menu(Widget* wd, POINT pt) { // wd nulo: "Editar Widgets…" da mesa (só ligar/desligar e organizar)std::vector<ctxmenu::Item> items;for (size_t i = 0; i < g_w.size(); i++) {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);- ctxmenu::Item rm; rm.label = Tr(L"Remover Widget"); rm.id = 1; items.push_back(rm);+ 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();DWORD ft = fg ? GetWindowThreadProcessId(fg, nullptr) : 0, me = GetCurrentThreadId();@@ -844,7 +844,7 @@ void Menu(Widget& wd, POINT pt) {SetForegroundWindow(g_menuOwner);if (att) AttachThreadInput(me, ft, FALSE);int id = ctxmenu::ShowItems(g_menuOwner, pt, items);- if (id == 1) { Show(wd, false); shell::SetSetting((std::wstring(L"widget.") + wd.id + L".on").c_str(), L"0"); }+ 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); }@@ -914,7 +914,7 @@ LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM wp, LPARAM lp) {}return 0;case WM_RBUTTONUP:- if (wd) { POINT c; GetCursorPos(&c); Menu(*wd, c); }+ if (wd) { POINT c; GetCursorPos(&c); Menu(wd, c); }return 0;}return DefWindowProcW(h, m, wp, lp);@@ -979,6 +979,10 @@ LRESULT CALLBACK BackProc(HWND h, UINT m, WPARAM w, LPARAM l) {} // namespace+// "Editar Widgets…" (menu da mesa e da Central): a lista dos widgets para ligar ou desligar, mesmo sem nenhum na+// tela (antes só dava pelo menu de um widget: removidos todos, não havia como trazer de volta)+void widgets::EditMenu(POINT pt) { if (!g_w.empty()) Menu(nullptr, pt); }+void widgets::Create(HINSTANCE hi) {WNDCLASSW bc{}; bc.lpfnWndProc = BackProc; bc.hInstance = hi; bc.lpszClassName = L"ShellWidgetFundo";RegisterClassW(&bc);