A new style desktop shell for Windows 11: menu bar, Dock, Finder, Spotlight, Control Center and Liquid Glass, in native C++.
Rust
Menu owner windows hidden outside menus (#199), bottom-corner snap fits windows with a large minimum size (#205), Firefox/Zen dialogs relayout after the frame change (#246)
Eternity0706289476b6ac4828
diff --git a/docs/registro-mudancas.txt b/docs/registro-mudancas.txtindex 8bfcea5..3df9e93 100644--- a/docs/registro-mudancas.txt+++ b/docs/registro-mudancas.txt@@ -2111,3 +2111,15 @@ Compilado (tudo), instalado, Shell e reserva do Finder reiniciados às 23:07 sempara conferir". Confere e atualiza pela instalação normal (Programs\WacOS, WacOSSetup --atualizar).Compilado (build.cmd shell, build.cmd ajustes; build-rust.ps1 -Zip). Não instalado.DESFAZER: reverter os commits (main e claude/rust-port-teste-23da8b) e compilar de novo.+[2026-11-28 22:30] Issues da noite de 28/11 (C++ e Rust):+ - #199 (interface "trava" depois de minimizar): as janelas donas dos menus do Dock, da barra de menus e dos widgets+ eram WS_VISIBLE (invisíveis, em -32000). Ao minimizar a janela da frente o Windows passava o foco para uma delas+ (o log do usuário: "frente: ShellWidgetsRelogio") e o teclado ia para uma janela invisível. Agora ficam escondidas+ e só aparecem (SW_SHOWNA) enquanto o menu está aberto (dock, menubar, widgets).+ - #205: encaixe nos cantos de baixo com janela de tamanho mínimo maior que o quarto (Finder: 640x420 pt) crescia para+ baixo e saía da tela. Encostada na borda de baixo/direita, a janela sobe/vai para a esquerda até caber+ (encaixe.cpp Place e o MacJanelaEncaixar da DLL; encaixe.rs e mj5.rs).+ - #246: "Sobre o Firefox"/Zen com o conteúdo deslocado até mover a janela: depois do SWP_FRAMECHANGED do anexar,+ janelas Mozilla* ganham 1 px de movimento e voltam (macjanela.cpp Attach; mj5.rs attach).+ Compilado (build.cmd shell, build.cmd janelas; build-rust.ps1 -Zip). Não instalado, não testado ao vivo.+ DESFAZER: reverter os commits (main e claude/rust-port-teste-23da8b) e compilar de novo.diff --git a/src/janelas/macjanela.cpp b/src/janelas/macjanela.cppindex 1e1ca19..a891966 100644--- a/src/janelas/macjanela.cpp+++ b/src/janelas/macjanela.cpp@@ -2505,6 +2505,16 @@ LRESULT CALLBACK OwnerProc(HWND h, UINT m, WPARAM w, LPARAM l, UINT_PTR, DWORD_Pint il, it, ir, ib;Insets(in, il, it, ir, ib); // bordas invisíveis ficam para fora, como no ampliarSetWindowPos(h, nullptr, t.left - il, t.top - it, (t.right - t.left) + il + ir, (t.bottom - t.top) + it + ib, SWP_NOZORDER | SWP_NOACTIVATE);+ { // tamanho mínimo maior que o quarto: nos cantos de baixo/direita a janela saía da tela (#205); sobe até caber+ RECT now; GetWindowRect(h, &now);+ MONITORINFO mi{ sizeof(mi) };+ if (GetMonitorInfoW(MonitorFromRect(&t, MONITOR_DEFAULTTONEAREST), &mi)) {+ LONG dx = 0, dy = 0;+ if (now.bottom - ib > t.bottom && t.bottom >= mi.rcWork.bottom) dy = t.bottom - (now.bottom - ib);+ if (now.right - ir > t.right && t.right >= mi.rcWork.right) dx = t.right - (now.right - ir);+ if (dx || dy) SetWindowPos(h, nullptr, now.left + dx, now.top + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);+ }+ }in->tiled = true;UpdateShadow(in);return 1;@@ -2804,6 +2814,16 @@ void Attach(HWND h, int mode) {if (in->cap == CLR_INVALID) in->cap = GetSysColor(COLOR_3DFACE); // fundo padrão das janelas (a maioria desses apps)ApplyColors(in);SetWindowPos(h, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);+ // Firefox/Zen (Gecko): a moldura nova só vale para ele quando a janela se move; até lá o conteúdo ficava+ // deslocado, com uma faixa branca à direita e embaixo (o "Sobre o Firefox", #246). 1 px e de volta+ wchar_t cls[32] = L"";+ GetClassNameW(h, cls, 32);+ if (!wcsncmp(cls, L"Mozilla", 7)) {+ RECT wr; GetWindowRect(h, &wr);+ const UINT f = SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER;+ SetWindowPos(h, nullptr, wr.left + 1, wr.top, 0, 0, f);+ SetWindowPos(h, nullptr, wr.left, wr.top, 0, 0, f);+ }} else {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);diff --git a/src/shell/dock.cpp b/src/shell/dock.cppindex 2c225c1..c3178f9 100644--- a/src/shell/dock.cpp+++ b/src/shell/dock.cpp@@ -1491,8 +1491,11 @@ int ShowMenu(int itemIndex, const std::vector<ctxmenu::Item>& items) {ctxmenu::AboveNext();} else // dos lados: ao lado do ícone, centrado nele (à direita o menu vira para a esquerda sozinho: não cabe)pt.y -= (LONG)std::lround((items.size() * 22 * sc + 12 * sc) / 2);+ ShowWindow(g_owner, SW_SHOWNA); // escondida fora do menu: visível, recebia o foco ao minimizar a janela da frente (#199)SetForegroundWindow(g_owner);- return ctxmenu::ShowItems(g_owner, pt, items);+ int id = ctxmenu::ShowItems(g_owner, pt, items);+ ShowWindow(g_owner, SW_HIDE);+ return id;}std::vector<std::wstring> LatestDownloads(int n) {@@ -1665,6 +1668,7 @@ void ContextMenu(int i) {void BackgroundMenu() {POINT c; GetCursorPos(&c);+ ShowWindow(g_owner, SW_SHOWNA); // escondida fora do menu: visível, recebia o foco ao minimizar a janela da frente (#199)SetForegroundWindow(g_owner);if (!Vert()) { c.y = ToScreen(0, g_bg.top - 8).y; ctxmenu::AboveNext(); } // como o menu dos ícones: logo acima do Dockstd::wstring tema = shell::Setting(L"tema", L"auto");@@ -1673,6 +1677,7 @@ void BackgroundMenu() {MI(Tr(L"Aparência Automática"), 4, tema != L"claro" && tema != L"escuro"),MI(Tr(L"Aparência Clara"), 5, tema == L"claro"), MI(Tr(L"Aparência Escura"), 6, tema == L"escuro"), MSep(),MI(Tr(L"Ajustes do Dock…"), 3) });+ ShowWindow(g_owner, SW_HIDE);if (id >= 4 && id <= 6) {shell::SetSetting(L"tema", id == 4 ? L"auto" : id == 5 ? L"claro" : L"escuro");dock::ApplyTheme();@@ -2189,7 +2194,7 @@ bool dock::Create(HINSTANCE hi) {g_back = CreateWindowExW(WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE, bc.lpszClassName, L"", WS_POPUP,0, 0, 10, 10, nullptr, nullptr, hi, nullptr);}- g_owner = CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_LAYERED, oc.lpszClassName, L"", WS_POPUP | WS_VISIBLE, -32000, -32000, 1, 1, nullptr, nullptr, hi, nullptr);+ g_owner = CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_LAYERED, oc.lpszClassName, L"", WS_POPUP, -32000, -32000, 1, 1, nullptr, nullptr, hi, nullptr);WNDCLASSW tc{}; tc.lpfnWndProc = [](HWND h, UINT m, WPARAM w, LPARAM l) -> LRESULT {if (m == WM_MOUSEACTIVATE) return MA_NOACTIVATE;if (m == WM_NCHITTEST) return HTTRANSPARENT; // o clique vai para a janela dos ícones, por cimadiff --git a/src/shell/encaixe.cpp b/src/shell/encaixe.cppindex 3012497..d664a8f 100644--- a/src/shell/encaixe.cpp+++ b/src/shell/encaixe.cpp@@ -165,6 +165,16 @@ void Place(HWND h, RECT want) {RECT wr, vis = Visible(h, wr);RECT r{ want.left - (vis.left - wr.left), want.top - (vis.top - wr.top), want.right + (wr.right - vis.right), want.bottom + (wr.bottom - vis.bottom) };SetWindowPos(h, nullptr, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE);+ // tamanho mínimo maior que o quarto: a janela crescia para baixo/direita a partir do canto de cima e, nos cantos de+ // baixo (ou à direita), saía da tela (#205). Encostada na borda de baixo/direita, sobe/vai para a esquerda até caber+ RECT now; GetWindowRect(h, &now);+ MONITORINFO mi{ sizeof(mi) };+ if (GetMonitorInfoW(MonitorFromRect(&want, MONITOR_DEFAULTTONEAREST), &mi)) {+ LONG dx = 0, dy = 0;+ if (now.bottom > r.bottom && want.bottom >= mi.rcWork.bottom) dy = r.bottom - now.bottom;+ if (now.right > r.right && want.right >= mi.rcWork.right) dx = r.right - now.right;+ if (dx || dy) SetWindowPos(h, nullptr, now.left + dx, now.top + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);+ }}UINT TileMsg() { static UINT m = RegisterWindowMessageW(L"MacJanelaEncaixar"); return m; }diff --git a/src/shell/menubar.cpp b/src/shell/menubar.cppindex 1bc1b6c..5ddd094 100644--- a/src/shell/menubar.cpp+++ b/src/shell/menubar.cpp@@ -1539,8 +1539,10 @@ void ShowAt(int hit, const std::vector<ctxmenu::Item>& items, std::function<voidpt = { wr.left + (LONG)std::lround((g_hits[hit].r.left + g_hits[hit].r.right) / 2 * sc), wr.top - (LONG)std::lround(4 * sc) };ctxmenu::AboveNext();}+ ShowWindow(g_owner, SW_SHOWNA); // escondida fora do menu: visível, recebia o foco ao minimizar a janela da frente (#199)SetForegroundWindow(g_owner); // o menu fecha se a janela dona não estiver na frenteint id = ctxmenu::ShowItems(g_owner, pt, items);+ ShowWindow(g_owner, SW_HIDE);g_closedHit = hit; g_closedHitAt = GetTickCount();g_open = -1;Render();@@ -2184,7 +2186,7 @@ bool menubar::Create(HINSTANCE hi) {RegisterClassW(&wc);WNDCLASSW oc{}; oc.lpfnWndProc = DefWindowProcW; oc.hInstance = hi; oc.lpszClassName = L"ShellDonoDosMenus";RegisterClassW(&oc);- g_owner = CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_LAYERED, oc.lpszClassName, L"", WS_POPUP | WS_VISIBLE, -32000, -32000, 1, 1, nullptr, nullptr, hi, nullptr);+ g_owner = CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_LAYERED, oc.lpszClassName, L"", WS_POPUP, -32000, -32000, 1, 1, nullptr, nullptr, hi, nullptr);SetLayeredWindowAttributes(g_owner, 0, 0, LWA_ALPHA);g_bar = CreateWindowExW(WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE, wc.lpszClassName, L"Barra de menus", WS_POPUP,0, 0, GetSystemMetrics(SM_CXSCREEN), menubar::Height(), nullptr, nullptr, hi, nullptr);diff --git a/src/shell/widgets.cpp b/src/shell/widgets.cppindex b8fa549..7d17a4c 100644--- a/src/shell/widgets.cpp+++ b/src/shell/widgets.cpp@@ -957,9 +957,13 @@ void Menu(Widget* wd, POINT pt) { // wd nulo: "Editar Widgets…" da mesa (sóHWND fg = GetForegroundWindow();DWORD ft = fg ? GetWindowThreadProcessId(fg, nullptr) : 0, me = GetCurrentThreadId();bool att = ft && ft != me && AttachThreadInput(me, ft, TRUE);+ // visível só enquanto o menu está aberto: sempre visível, o Windows passava o foco para ela ao minimizar+ // a janela da frente, e o teclado ia para uma janela invisível (#199)+ ShowWindow(g_menuOwner, SW_SHOWNA);SetForegroundWindow(g_menuOwner);if (att) AttachThreadInput(me, ft, FALSE);int id = ctxmenu::ShowItems(g_menuOwner, pt, items);+ ShowWindow(g_menuOwner, SW_HIDE);if (id == 3) {std::wstring exe = shell::dir + L"\\" EXE_WEATHER;shell::Abrir(L"open", exe.c_str(), L"--meu-local", shell::dir.c_str(), SW_SHOWNORMAL);@@ -1138,7 +1142,7 @@ void widgets::Create(HINSTANCE hi) {RegisterClassW(&gc);g_ghost = CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE | WS_EX_LAYERED | WS_EX_TRANSPARENT, gc.lpszClassName, L"", WS_POPUP, 0, 0, 10, 10, nullptr, nullptr, hi, nullptr);g_ghostS.hwnd = g_ghost;- g_menuOwner = CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_LAYERED, tc.lpszClassName, L"", WS_POPUP | WS_VISIBLE, -32000, -32000, 1, 1, nullptr, nullptr, hi, nullptr);+ g_menuOwner = CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_LAYERED, tc.lpszClassName, L"", WS_POPUP, -32000, -32000, 1, 1, nullptr, nullptr, hi, nullptr);SetLayeredWindowAttributes(g_menuOwner, 0, 0, LWA_ALPHA);apps::ours.push_back(g_menuOwner);apps::ours.push_back(g_ghost);