Skip to content

armgit / WacOS

Public Imported from GitHub
0

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

Rust

Fix stacks that didn't open, glass under fullscreen video, ghost outlines

Eternity07062831e67d115c79
diff --git a/src/comum/idioma_en.inc b/src/comum/idioma_en.inc
index 69ec20d..b676796 100644
--- a/src/comum/idioma_en.inc
+++ b/src/comum/idioma_en.inc
@@ -160,6 +160,8 @@
{ L"Mostrar menos", L"Show less" },
{ L" notificação a mais", L" more notification" },
{ L" notificações a mais", L" more notifications" },
+{ L" notificação mais antiga", L" older notification" },
+{ L" notificações mais antigas", L" older notifications" },
{ L"Editar Widgets…", L"Edit Widgets…" },
{ L"Nenhum evento hoje", L"No events today" },
{ L"Permita que o Shell leia as notificações do Windows.", L"Allow the Shell to read Windows notifications." },
diff --git a/src/janelas/macjanela.cpp b/src/janelas/macjanela.cpp
index ea562c3..24eb99b 100644
--- a/src/janelas/macjanela.cpp
+++ b/src/janelas/macjanela.cpp
@@ -445,6 +445,7 @@ LRESULT CALLBACK CornerProc(HWND h, UINT m, WPARAM w, LPARAM l) {
}
void HideCorners(Info* in) { for (HWND c : in->corner) if (c) ShowWindow(c, SW_HIDE); }
+void KeepAbove(Info* in); // mais abaixo
// Moldura por cima da janela (uma janela em camadas, transparente para cliques, do tamanho da parte
// visível + 1 px): o SetWindowRgn só corta pixel inteiro, então aqui vão
@@ -528,7 +529,7 @@ void UpdateCorners(Info* in, RECT vis) {
SelectObject(mem, old);
DeleteObject(bmp);
DeleteDC(mem);
- if (!IsWindowVisible(fw)) ShowWindow(fw, SW_SHOWNOACTIVATE);
+ if (!IsWindowVisible(fw)) { ShowWindow(fw, SW_SHOWNOACTIVATE); KeepAbove(in); } // nasce no topo da tela: desce para junto da janela
}
// sombra na parte visível (com o recorte, sem a borda invisível); os cantos suaves vão junto
@@ -875,8 +876,15 @@ void KeepAbove(Info* in) {
if (!IsWindowVisible(h)) return;
for (HWND o : { in->overlay, in->corner[0] }) {
if (!o || !IsWindowVisible(o)) continue;
+ // logo acima da janela: só as camadas dela (faixa, cantos, prévia) podem estar no meio. Antes bastava estar
+ // "em algum lugar acima"; ao reiniciar o Shell a DLL recria as camadas no topo da tela e as de janelas que
+ // estavam atrás de outras (o Relógio atrás do Chrome) ficavam por cima de tudo: o contorno e os três botões
+ // "fantasma" por cima do Chrome (19/11/2026)
bool above = false;
- for (HWND x = GetWindow(h, GW_HWNDPREV); x; x = GetWindow(x, GW_HWNDPREV)) if (x == o) { above = true; break; }
+ for (HWND x = GetWindow(h, GW_HWNDPREV); x; x = GetWindow(x, GW_HWNDPREV)) {
+ if (x == o) { above = true; break; }
+ if (GetWindow(x, GW_OWNER) != h && IsWindowVisible(x)) break; // outra janela no meio: não está colada
+ }
if (above) continue;
HWND prev = GetWindow(h, GW_HWNDPREV);
SetWindowPos(o, prev ? prev : HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOOWNERZORDER);
diff --git a/src/shell/abrir.cpp b/src/shell/abrir.cpp
index b299aa0..5a76882 100644
--- a/src/shell/abrir.cpp
+++ b/src/shell/abrir.cpp
@@ -21,7 +21,7 @@ const double DUR_SEQUOIA = 180; // ms (era 220: abrir mais ágil)
bool g_tahoeAbrir;
double Dur() { return g_tahoeAbrir ? 170 : DUR_SEQUOIA; }
const UINT WM_AB_DONE = WM_APP + 1; // o movimento de uma janela terminou (wParam = hwnd)
-const UINT_PTR T_REMOVE = 1;
+const UINT_PTR T_REMOVE = 1, T_SAFE = 2;
struct Item {
HWND h = nullptr;
@@ -116,6 +116,25 @@ LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {
if (!pending) KillTimer(h, T_REMOVE);
if (g_items.empty()) ShowWindow(h, SW_HIDE);
}
+ if (w == T_SAFE) {
+ // Segurança: miniatura que não terminou (o aviso do fim se perdeu, a janela foi minimizada/fechada no meio)
+ // ficava presa na camada por cima de tudo, quase transparente: o contorno e os três botões da janela
+ // "fantasma" por cima do Chrome (print do usuário, 19/11/2026). Passou do tempo: sai e a janela aparece.
+ std::lock_guard<std::mutex> k(g_mx);
+ double now = anim::Now();
+ for (size_t i = 0; i < g_items.size();) {
+ Item& it = g_items[i];
+ bool gone = !IsWindow(it.h) || IsIconic(it.h) || !IsWindowVisible(it.h);
+ if (gone || now - it.t0 > Dur() + 700) {
+ Log(L"abrir: miniatura presa removida (%.0f ms%ls)", now - it.t0, gone ? L", janela sumiu" : L"");
+ DwmUnregisterThumbnail(it.th);
+ if (it.bar) DwmUnregisterThumbnail(it.bar);
+ if (!gone) Show(it.h);
+ g_items.erase(g_items.begin() + i);
+ } else i++;
+ }
+ if (g_items.empty()) { KillTimer(h, T_SAFE); ShowWindow(h, SW_HIDE); }
+ }
return 0;
}
return DefWindowProcW(h, m, w, l);
@@ -163,4 +182,5 @@ void abrir::Open(HWND h, HWND bar) {
std::lock_guard<std::mutex> k(g_mx);
g_items.push_back(it);
if (!g_thread) { g_thread = true; std::thread(Worker).detach(); }
+ SetTimer(g_ov, T_SAFE, 300, nullptr);
}
diff --git a/src/shell/backdrop.cpp b/src/shell/backdrop.cpp
index 9ef5a7e..b8c3a47 100644
--- a/src/shell/backdrop.cpp
+++ b/src/shell/backdrop.cpp
@@ -745,11 +745,33 @@ void RefreshWindows() {
// embaixo davam a tela inteira, montada de novo a cada quadro de qualquer janela).
const LONG COMPOSE_MARGIN = 64;
std::vector<RECT> composed; // as áreas montadas da última vez
+// Peça escondida atrás de um app em tela cheia (YouTube/F11/jogo): a janela da frente cobre o monitor inteiro e
+// está acima dela. Os widgets da mesa continuam "visíveis" atrás do vídeo, e cada quadro do vídeo remontava o vidro
+// deles (~60 vezes/s, 19/11/2026: o YouTube em tela cheia engasgava com o tema Golden Gate).
+bool CoveredByFullscreen(HWND piece) {
+ static DWORD at; static HWND lastFg, lastPiece; static bool lastRes;
+ HWND fg = GetForegroundWindow();
+ if (GetTickCount() - at < 100 && fg == lastFg && piece == lastPiece) return lastRes;
+ at = GetTickCount(); lastFg = fg; lastPiece = piece;
+ lastRes = false;
+ if (!fg || fg == piece || !IsWindowVisible(fg) || IsIconic(fg) || Cloaked(fg)) return false;
+ DWORD pid = 0; GetWindowThreadProcessId(fg, &pid);
+ if (pid == GetCurrentProcessId()) return false; // janela do próprio Shell (Launchpad, Mission Control): o vidro é dela
+ if (GetWindowLongW(piece, GWL_EXSTYLE) & WS_EX_TOPMOST && !(GetWindowLongW(fg, GWL_EXSTYLE) & WS_EX_TOPMOST)) return false;
+ MONITORINFO mi{ sizeof(mi) };
+ if (!GetMonitorInfoW(MonitorFromWindow(fg, MONITOR_DEFAULTTONEAREST), &mi)) return false;
+ RECT r; GetWindowRect(fg, &r);
+ if (r.left > mi.rcMonitor.left || r.top > mi.rcMonitor.top || r.right < mi.rcMonitor.right || r.bottom < mi.rcMonitor.bottom) return false;
+ RECT pr; GetWindowRect(piece, &pr);
+ RECT x; if (!IntersectRect(&x, &pr, &mi.rcMonitor) || !EqualRect(&x, &pr)) return false; // a peça sai do monitor do app
+ for (HWND w = GetWindow(piece, GW_HWNDPREV); w; w = GetWindow(w, GW_HWNDPREV)) if (w == fg) { lastRes = true; break; } // o app está acima
+ return lastRes;
+}
std::vector<RECT> GlassAreas() {
std::vector<RECT> v;
RECT all{ 0, 0, (LONG)texW, (LONG)texH };
for (auto& [hh, e] : g_entries) {
- if (!e.real || !IsWindowVisible(e.hwnd)) continue;
+ if (!e.real || !IsWindowVisible(e.hwnd) || CoveredByFullscreen(e.hwnd)) continue;
RECT r; GetWindowRect(e.hwnd, &r);
OffsetRect(&r, -mon.left, -mon.top);
InflateRect(&r, COMPOSE_MARGIN, COMPOSE_MARGIN);
@@ -1256,6 +1278,7 @@ void DrawPiece(ID2D1DeviceContext* dc, float ox, float oy, float sx, float sy, f
void Redraw(Entry& e) {
st_redraws++;
if (!active || !screen || !e.surf) return;
+ if (CoveredByFullscreen(e.hwnd)) return; // atrás do app em tela cheia: ninguém vê; redesenha quando ele sair
// peça nova ou que se mexeu para fora da área montada: monta o fundo de novo (a montagem redesenha todas)
if (!g_busy && IsWindowVisible(e.hwnd) && !Composed(e.hwnd)) { capDirty = true; allDirty = true; Poll(); return; }
RECT r; GetWindowRect(e.hwnd, &r);
diff --git a/src/shell/dock.cpp b/src/shell/dock.cpp
index 149ed7b..cc2d89c 100644
--- a/src/shell/dock.cpp
+++ b/src/shell/dock.cpp
@@ -1454,7 +1454,8 @@ void dock::Update() {
void dock::SetFullscreen(bool on) {
if (!g_icons || on == g_fullscreen) return;
g_fullscreen = on;
- if (on) { ShowWindow(g_icons, SW_HIDE); ShowWindow(g_back, SW_HIDE); return; }
+ // as miniaturas das janelas minimizadas também (ficavam por cima do YouTube em tela cheia, 19/11/2026)
+ if (on) { ShowWindow(g_icons, SW_HIDE); ShowWindow(g_back, SW_HIDE); if (g_thumbWnd) ShowWindow(g_thumbWnd, SW_HIDE); return; }
g_win = {}; g_lastBg = {}; // força reposicionar e mostrar
Paint();
}
diff --git a/src/shell/notificacoes.cpp b/src/shell/notificacoes.cpp
index a4ab66f..978ea74 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, T_FOCO = 2; // T_FOCO: confere quem ficou na frente depois de perder o foco "para ninguém"
+const UINT_PTR T_TICK = 1, T_FOCO = 2, T_ANIM = 3; // 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; }
@@ -78,6 +78,7 @@ float g_slide = 1; // 0 = no lugar, 1 = fora da tela à direita
DWORD g_closedAt;
float g_scroll, g_scrollTarget, g_contentH;
double g_lastFrame;
+DWORD g_clickAt = 0; // último clique dentro da Central: o foco que some logo depois não fecha (abrir a pilha)
bool g_snap; // próximo desenho sem animar os cartões (acabou de abrir)
IDWriteTextFormat *g_tfTitle, *g_tfBody, *g_tfTime, *g_tfPill, *g_tfHeader, *g_tfEmpty;
@@ -532,7 +533,12 @@ std::vector<El> Layout() {
y += HEADER_H + GAP;
D2D1_RECT_F first{};
std::vector<El> cards;
- for (int ni = 0; ni < (int)g.notes.size(); ni++) {
+ // Pilha aberta com centenas de notificações (o Chrome guarda todas): cada quadro da animação refazia o
+ // layout e a mola de todas e a Central travava ~3 s; o clique seguinte caía no Chrome e ela fechava
+ // (19/11/2026). Mostra as mais novas; o resto continua no grupo (Limpar limpa tudo).
+ const int MAX_OPEN = 20;
+ int nOpen = std::min((int)g.notes.size(), MAX_OPEN);
+ for (int ni = 0; ni < nOpen; ni++) {
float h2 = CardH(g.notes[ni]);
El c{ L"n:" + std::to_wstring(g.notes[ni].id), K_CARD, D2D1::RectF(0, y, CARD_W, y + h2), A_CARD };
c.group = gi; c.note = ni;
@@ -544,6 +550,13 @@ std::vector<El> Layout() {
// as de baixo são desenhadas antes: ao abrir saem de trás do cartão de cima (como no Mac), sem texto
// de uma por cima do da outra
out.insert(out.end(), cards.rbegin(), cards.rend());
+ if ((int)g.notes.size() > nOpen) {
+ El more{ L"hm:" + g.aumid, K_LABEL, D2D1::RectF(0, y, CARD_W, y + 22) };
+ int rest = (int)g.notes.size() - nOpen;
+ more.text = std::to_wstring(rest) + (rest == 1 ? Tr(L" notificação mais antiga") : Tr(L" notificações mais antigas"));
+ out.push_back(more);
+ y += 22 + GAP;
+ }
y += GROUP_GAP - GAP;
} else {
float h2 = CardH(g.notes[0]);
@@ -639,6 +652,15 @@ bool Step(Spring1& s, float target, float dt, float response = 0.38f) {
return true;
}
+bool Settled() {
+ for (auto& [k, a] : g_anim) {
+ if (std::fabs(a.l.x - a.el.r.left) > 0.05f || std::fabs(a.t.x - a.el.r.top) > 0.05f ||
+ std::fabs(a.r.x - a.el.r.right) > 0.05f || std::fabs(a.b.x - a.el.r.bottom) > 0.05f) return false;
+ if (std::fabs(a.a.x - (a.live ? 1.f : 0.f)) > 0.01f) return false;
+ }
+ return std::fabs(g_scroll - g_scrollTarget) < 0.3f;
+}
+
bool Advance(float dt) {
bool busy = false;
for (auto it = g_anim.begin(); it != g_anim.end();) {
@@ -981,20 +1003,35 @@ void Place() {
SetWindowPos(g_back, g_wnd, x, top, w, h, SWP_NOACTIVATE | SWP_SHOWWINDOW);
}
-void Animate() { g_lastFrame = anim::Now(); ui::FrameClock(g_wnd, WM_NC_FRAME, true); }
+// Os quadros vêm do relógio de quadros (DwmFlush numa thread). Às vezes ele não entregava nenhum: o clique abria a
+// pilha (o log dizia "abriu a pilha") e a tela não mudava, nem o fechar escondia a janela (19/11/2026). Um temporizador
+// de reserva desenha o quadro quando o relógio ficou mais de 50 ms sem mandar nada.
+double g_frameMsgAt = 0;
+// O relógio do passo (g_lastFrame) só recomeça se a animação estava parada. Antes cada Animate() o zerava: com os
+// dados chegando a cada segundo (WM_NC_DATA chama Animate) e o clique, o passo de cada quadro ficava em 1 ms e as
+// molas quase não andavam: a pilha "abria" (o log dizia) mas os cartões ficavam parados no lugar (19/11/2026)
+bool g_running = false;
+void Animate() {
+ if (!g_running) { g_lastFrame = anim::Now(); g_running = true; }
+ ui::FrameClock(g_wnd, WM_NC_FRAME, true);
+ SetTimer(g_wnd, T_ANIM, 33, nullptr);
+}
void Hide() {
g_open = g_closing = false;
g_hover.clear(); g_hoverPart.clear();
KillTimer(g_wnd, T_TICK);
ui::FrameClock(g_wnd, WM_NC_FRAME, false);
+ KillTimer(g_wnd, T_ANIM);
+ g_running = false;
ShowWindow(g_wnd, SW_HIDE);
ShowWindow(g_back, SW_HIDE);
for (auto& gl : g_hostPanel.pool) gl.outer.IsVisible(false);
}
-void Close() {
+void Close(const wchar_t* why = nullptr) {
if (!g_open) return;
+ if (why) Log(L"notificações: fechou (%ls)", why); // cada caminho diz por quê (a Central sumia sem rastro)
g_open = false;
menubar::SoundChanged(false); // a cápsula do relógio da barra sai
g_closing = true;
@@ -1006,7 +1043,7 @@ void Close() {
void Frame() {
double now = anim::Now();
- float dt = (float)std::clamp((now - g_lastFrame) / 1000.0, 0.001, 0.034);
+ float dt = (float)std::clamp((now - g_lastFrame) / 1000.0, 0.0, 0.034);
g_lastFrame = now;
float t = (float)((now - g_slideAt) / 1000.0);
bool slideBusy;
@@ -1032,7 +1069,11 @@ void Frame() {
}
bool busy = Advance(dt);
Paint();
- if (!busy && !slideBusy) ui::FrameClock(g_wnd, WM_NC_FRAME, false);
+ // O layout novo (Sync, dentro do Paint) só entra agora: a pilha que acabou de abrir tem alvos novos que o Advance
+ // ainda não via. Antes o relógio desligava aqui ("nada a animar") e os cartões ficavam parados no lugar antigo:
+ // a pilha não abria (19/11/2026). Só para se, depois do desenho, tudo já estiver no alvo.
+ if (!busy && !slideBusy) busy = !Settled();
+ if (!busy && !slideBusy) { ui::FrameClock(g_wnd, WM_NC_FRAME, false); KillTimer(g_wnd, T_ANIM); g_running = false; }
}
void OpenApp(const Note& n) {
@@ -1085,12 +1126,11 @@ const Hit* HitAt(D2D1_POINT_2F p) {
}
DWORD g_expandedAt = 0; // quando uma pilha foi aberta
-DWORD g_clickAt = 0; // último clique dentro da Central: o foco que some logo depois não fecha (abrir a pilha)
void Click(D2D1_POINT_2F p) {
g_clickAt = GetTickCount();
const Hit* h = HitAt(p);
- if (!h) { Close(); return; } // clique no vazio da coluna: fecha, como clicar fora
+ if (!h) { Close(L"clique no vazio"); return; } // clique no vazio da coluna: fecha, como clicar fora
Hit hit = *h;
if (hit.key == L"x") { // ✕ do cartão: numa pilha fechada limpa o grupo todo
if (hit.group >= 0 && hit.group < (int)g_groups.size()) {
@@ -1110,7 +1150,7 @@ void Click(D2D1_POINT_2F p) {
}
switch (hit.act) {
case A_STACK:
- if (hit.group >= 0 && hit.group < (int)g_groups.size()) { g_expanded.insert(g_groups[hit.group].aumid); g_expandedAt = GetTickCount(); Log(L"notificações: abriu a pilha de %ls", g_groups[hit.group].app.c_str()); }
+ if (hit.group >= 0 && hit.group < (int)g_groups.size()) { g_expanded.insert(g_groups[hit.group].aumid); g_expandedAt = GetTickCount(); Log(L"notificações: abriu a pilha de %ls (%zu notificações, aumid %ls)", g_groups[hit.group].app.c_str(), g_groups[hit.group].notes.size(), g_groups[hit.group].aumid.c_str()); }
break;
case A_CARD:
// segundo clique de um clique duplo na pilha: só abre o grupo (não abre o app nem fecha a central)
@@ -1118,7 +1158,7 @@ void Click(D2D1_POINT_2F p) {
if (hit.group >= 0 && hit.group < (int)g_groups.size() && hit.note >= 0 && hit.note < (int)g_groups[hit.group].notes.size()) {
Note n = g_groups[hit.group].notes[hit.note];
RemoveIds({ n.id });
- Close();
+ Close(L"clique no cartão: abre o app");
OpenApp(n);
return;
}
@@ -1166,7 +1206,7 @@ void BannerShow(UINT id);
LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {
switch (m) {
case WM_PAINT: { PAINTSTRUCT ps; BeginPaint(h, &ps); EndPaint(h, &ps); Paint(); return 0; }
- case WM_NC_FRAME: Frame(); return 0;
+ case WM_NC_FRAME: g_frameMsgAt = anim::Now(); Frame(); return 0;
case WM_NC_NEW: BannerShow((UINT)l); return 0;
case WM_NC_DATA:
dock::BadgesChanged();
@@ -1175,16 +1215,33 @@ 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_ANIM) {
+ if (anim::Now() - g_frameMsgAt > 50) {
+ static int avisos = 0;
+ if (avisos++ < 5) Log(L"notificações: relógio de quadros parado; desenhando pelo temporizador");
+ Frame();
+ }
+ return 0;
+ }
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() && GetTickCount() - g_clickAt >= 800) { Log(L"notificações: fechou (outro programa na frente)"); Close(); }
+ if (f && pid != GetCurrentProcessId() && GetTickCount() - g_clickAt >= 800) {
+ wchar_t fc[64] = {}; GetClassNameW(f, fc, 64);
+ Log(L"notificações: fechou (outro programa na frente: %ls)", fc); 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_LBUTTONDOWN: {
+ D2D1_POINT_2F p = Pt(l);
+ const Hit* hh = HitAt(p);
+ Log(L"notificações: clique em %.0f,%.0f (%ls, ação %d, aberta %d, frente %p)", p.x, p.y, hh ? hh->key.c_str() : L"nada", hh ? (int)hh->act : -1, (int)g_open, GetForegroundWindow());
+ if (g_open) Click(p);
+ return 0;
+ }
case WM_RBUTTONUP: return 0;
case WM_MOUSEMOVE: {
if (!g_open) return 0;
@@ -1197,7 +1254,7 @@ LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {
g_scrollTarget -= GET_WHEEL_DELTA_WPARAM(w) / 120.f * 60.f;
Animate();
return 0;
- case WM_KEYDOWN: if (w == VK_ESCAPE) Close(); return 0;
+ case WM_KEYDOWN: if (w == VK_ESCAPE) Close(L"Esc"); return 0;
case WM_ACTIVATE:
if (LOWORD(w) == WA_INACTIVE && !g_menu) {
// a ativação foi para outra janela do próprio Shell (o vidro de trás, o banner, a barra): não fecha. Antes um
@@ -1208,6 +1265,13 @@ LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {
SetForegroundWindow(g_wnd);
return 0;
}
+ { // onde estava o ponteiro e que janela havia embaixo dele (o clique que "não chegava" na Central)
+ wchar_t c0[64] = {}, c1[64] = {}; if (to) GetClassNameW(to, c0, 64);
+ POINT cp{}; GetCursorPos(&cp); HWND under = WindowFromPoint(cp); if (under) GetClassNameW(GetAncestor(under, GA_ROOT), c1, 64);
+ RECT wr{}; GetWindowRect(g_wnd, &wr);
+ Log(L"notificações: perdeu a ativação para %ls (%u ms depois do clique); ponteiro %ld,%ld sobre %ls; Central %ld,%ld-%ld,%ld visível %d",
+ to ? c0 : L"ninguém", GetTickCount() - g_clickAt, cp.x, cp.y, c1, wr.left, wr.top, wr.right, wr.bottom, (int)IsWindowVisible(g_wnd));
+ }
if (!to) { SetTimer(h, T_FOCO, 150, nullptr); return 0; } // "para ninguém" (ao abrir uma pilha): confere já já
if (GetTickCount() - g_clickAt < 800) { SetTimer(h, T_FOCO, 150, nullptr); return 0; } // logo depois de um clique aqui dentro: não foi clique fora
wchar_t cls[64] = {}; if (to) GetClassNameW(to, cls, 64);
@@ -1586,7 +1650,7 @@ bool notificacoes::IsOpen() { return g_open; }
bool notificacoes::BannerVisible() { return g_bshow && !g_bout; }
void notificacoes::Toggle() {
- if (g_open) { Close(); return; }
+ if (g_open) { Close(L"clique no relógio / canto ativo"); return; }
if (GetTickCount() - g_closedAt < 300) return; // o clique no relógio acabou de fechar (perdeu o foco): não reabre
BannerHide();
g_open = true;
diff --git a/src/shell/revelar.cpp b/src/shell/revelar.cpp
index fd2f48e..08f6c23 100644
--- a/src/shell/revelar.cpp
+++ b/src/shell/revelar.cpp
@@ -52,6 +52,10 @@ LRESULT CALLBACK MouseHook(int code, WPARAM w, LPARAM l) {
if (code == HC_ACTION) {
auto* m = (MSLLHOOKSTRUCT*)l;
if (w == WM_LBUTTONDOWN) {
+ if (notificacoes::IsOpen()) { // diagnóstico: onde o clique cai com a Central aberta (clique que "não chegava")
+ HWND at = WindowFromPoint(m->pt); wchar_t c[64] = {}; if (at) GetClassNameW(GetAncestor(at, GA_ROOT), c, 64);
+ Log(L"clique com a Central aberta: %ld,%ld sobre %ls%ls", m->pt.x, m->pt.y, c, (m->flags & LLMHF_INJECTED) ? L" (simulado)" : L"");
+ }
g_down = m->pt;
g_downOnDesk = IsDesktopWindow(WindowFromPoint(m->pt));
} else if (w == WM_LBUTTONUP && g_downOnDesk) {