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 issues #350 #348 #337 #321 #311 #313 #314 #329 #306 #357 #346 #328 #336 #304 #335 #352

Eternity070628657df094bb2d
diff --git a/src/ajustes/paginas.cpp b/src/ajustes/paginas.cpp
index c02034c..e66095a 100644
--- a/src/ajustes/paginas.cpp
+++ b/src/ajustes/paginas.cpp
@@ -24,7 +24,21 @@
void AskText(const std::wstring& title, const std::wstring& message, const std::wstring& okLabel, bool password,
std::function<void(const std::wstring&)> ok, const std::wstring& prefill = L"");
-using namespace aj;
+using namespace aj;
+
+// Issue #346: os nomes embaixo das miniaturas (Estilo de ícones e widgets) passavam um por cima do outro nos idiomas
+// de palavras compridas (vietnamita: "Trong suốt", "Nhuộm màu"). O espaço entre elas cresce com o nome mais largo.
+static float g_estiloPasso = 0; // passo entre as miniaturas do macOS 26/27, medido no último desenho (o clique usa o mesmo)
+static float g_estiloCelula = 0; // o mesmo para a versão antiga (Tahoe)
+static float LarguraRotulo(const wchar_t* pt, IDWriteTextFormat* tf) {
+ static IDWriteFactory* dw = [] { IDWriteFactory* f = nullptr; DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), (IUnknown**)&f); return f; }();
+ if (!dw || !tf) return 0;
+ std::wstring s = Tr(pt);
+ IDWriteTextLayout* tl = nullptr;
+ float w = 0;
+ if (SUCCEEDED(dw->CreateTextLayout(s.c_str(), (UINT32)s.size(), tf, 4000, 100, &tl))) { DWRITE_TEXT_METRICS m{}; tl->GetMetrics(&m); w = m.width; tl->Release(); }
+ return w;
+}
Page Armazenamento();
@@ -936,7 +950,12 @@ Page Aparencia() {
std::wstring v = Setting(L"estilo_icones", L"padrao");
int cur = 0;
for (int k = 0; k < 4; k++) if (v == ESTILOS[k]) cur = k;
- float w = 52, h = 44, gap = 14, x = rr.right - 10 - 4 * w - 3 * gap;
+ float w = 52, h = 44, gap = 14;
+ float rot = 0;
+ for (int k = 0; k < 4; k++) rot = std::max(rot, LarguraRotulo(names[k], c.noteCenter));
+ gap = std::max(gap, rot + 6 - w);
+ g_estiloCelula = w + gap;
+ float x = rr.right - 10 - 4 * w - 3 * gap;
for (int k = 0; k < 4; k++, x += w + gap) {
D2D1_RECT_F t = D2D1::RectF(x, rr.top + 12, x + w, rr.top + 12 + h);
c.br->SetColor(c.dark ? D2D1::ColorF(0.22f, 0.22f, 0.24f, 1) : D2D1::ColorF(0.88f, 0.89f, 0.92f, 1));
@@ -955,11 +974,11 @@ Page Aparencia() {
c.br->SetColor(fg);
c.dc->FillEllipse(D2D1::Ellipse({ cx, cy }, 7, 7), c.br);
if (k == cur) { c.br->SetColor(c.accent); c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(t.left - 3, t.top - 3, t.right + 3, t.bottom + 3), 8, 8), c.br, 2.5f); }
- Text(c, names[k], D2D1::RectF(t.left - 12, t.bottom + 6, t.right + 12, t.bottom + 24), c.noteCenter, k == cur ? c.text : c.text2);
+ Text(c, names[k], D2D1::RectF(t.left - gap / 2, t.bottom + 6, t.right + gap / 2, t.bottom + 24), c.noteCenter, k == cur ? c.text : c.text2);
}
};
icons.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) {
- float w = 52, gap = 14, x = rr.right - 10 - 4 * w - 3 * gap;
+ float w = 52, gap = std::max(14.f, g_estiloCelula - w), x = rr.right - 10 - 4 * w - 3 * gap;
for (int k = 0; k < 4; k++, x += w + gap)
if (pt.x >= x - 5 && pt.x <= x + w + 5) { SetSetting(L"estilo_icones", ESTILOS[k]); Rebuild(); }
};
@@ -1252,7 +1271,14 @@ Page AparenciaGolden() {
std::wstring v = Setting(L"estilo_icones", L"padrao");
int cur = 0;
for (int k = 0; k < 4; k++) if (v == ESTILOS[k]) cur = k;
- const float s = 29.5f, pitch = 51.5f;
+ const float s = 29.5f;
+ float pitch = 51.5f;
+ {
+ float rot = 0;
+ for (int k = 0; k < 4; k++) rot = std::max(rot, LarguraRotulo(names[k], k == cur && c.noteBoldCenter ? c.noteBoldCenter : c.noteCenter));
+ pitch = std::max(pitch, rot + 6);
+ g_estiloPasso = pitch;
+ }
for (int k = 0; k < 4; k++) {
float x = rr.right - 13 - s - (3 - k) * pitch;
D2D1_RECT_F t = D2D1::RectF(x, rr.top + 13, x + s, rr.top + 13 + s); // medido: 13 do alto da linha
@@ -1276,7 +1302,7 @@ Page AparenciaGolden() {
c.dc->FillEllipse(D2D1::Ellipse({ cx + 1, cy }, 5.5f, 5.5f), c.br);
c.dc->FillRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(cx - 9, cy + 1.5f, cx + 9, cy + 7.5f), 3, 3), c.br);
if (k == cur) { c.br->SetColor(c.accent); c.dc->DrawRoundedRectangle(D2D1::RoundedRect(D2D1::RectF(t.left - 2.5f, t.top - 2.5f, t.right + 2.5f, t.bottom + 2.5f), 9, 9), c.br, 3); }
- Text(c, names[k], D2D1::RectF(t.left - 22, rr.top + 46, t.right + 22, rr.top + 62), k == cur && c.noteBoldCenter ? c.noteBoldCenter : c.noteCenter, k == cur ? c.text : c.text2);
+ Text(c, names[k], D2D1::RectF((t.left + t.right) / 2 - pitch / 2, rr.top + 46, (t.left + t.right) / 2 + pitch / 2, rr.top + 62), k == cur && c.noteBoldCenter ? c.noteBoldCenter : c.noteCenter, k == cur ? c.text : c.text2);
}
if (cur == 1) { // medido: bolinhas a 123,5 e 52,5 da borda, textos a 13 delas, centro a 85,5 do alto
bool autoOn = Setting(L"estilo_escuro_auto", L"0") == L"1";
@@ -1297,7 +1323,7 @@ Page AparenciaGolden() {
}
};
icons.clickAt = [](D2D1_POINT_2F pt, D2D1_RECT_F rr) {
- const float s = 29.5f, pitch = 51.5f;
+ const float s = 29.5f, pitch = std::max(51.5f, g_estiloPasso);
for (int k = 0; k < 4; k++) {
float x = rr.right - 13 - s - (3 - k) * pitch;
if (pt.x >= x - 10 && pt.x <= x + s + 10 && pt.y >= rr.top + 8 && pt.y <= rr.top + 64) { SetSetting(L"estilo_icones", ESTILOS[k]); Rebuild(); }
diff --git a/src/comum/temperatura.h b/src/comum/temperatura.h
index c1ba147..d0573b0 100644
--- a/src/comum/temperatura.h
+++ b/src/comum/temperatura.h
@@ -12,7 +12,17 @@ inline bool Fahrenheit(const std::wstring& ajuste) {
if (ajuste == L"c") return false;
DWORD m = 0;
if (!GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_IMEASURE | LOCALE_RETURN_NUMBER, (LPWSTR)&m, sizeof(m) / sizeof(wchar_t))) return false;
- return m == 1;
+ if (m != 1) return false;
+ // Issue #328: muita gente fora dos EUA usa o formato "Inglês (Estados Unidos)" no Windows, e o Automático mostrava
+ // Fahrenheit na Eslováquia e no Vietnã. Com o local do Windows (Configurações > Hora e idioma > Região) fora dos
+ // países que usam Fahrenheit, fica em Celsius; sem local conhecido, segue o sistema de medidas como antes.
+ wchar_t geo[8] = {};
+ if (GetUserDefaultGeoName(geo, 8) > 1) {
+ static const wchar_t* F[] = { L"US", L"PR", L"GU", L"VI", L"AS", L"MP", L"UM", L"LR", L"BS", L"BZ", L"KY", L"PW", L"FM", L"MH" };
+ for (auto c : F) if (!_wcsicmp(geo, c)) return true;
+ return false;
+ }
+ return true;
}
inline float Mostra(float celsius, bool f) { return f ? celsius * 9.f / 5.f + 32.f : celsius; }
diff --git a/src/comum/vidro.h b/src/comum/vidro.h
index 6c2c642..00edb54 100644
--- a/src/comum/vidro.h
+++ b/src/comum/vidro.h
@@ -34,13 +34,24 @@ inline void Borda(ID2D1RenderTarget* rt, D2D1_RECT_F r, float rad, float px, boo
// reflexo dos cantos bem mais fraco e o fio em volta mais por igual: no macOS 26 a borda é um fio fino quase
// uniforme (prints do usuário, 16/11/2026); antes o canto de cima à esquerda acendia forte
// dois degradês: do canto de cima à esquerda (luz) e do de baixo à direita (reflexo), sumindo para o meio
- auto corner = [&](float x0, float y0, float x1, float y1, float a) -> ID2D1LinearGradientBrush* {
- D2D1_GRADIENT_STOP st[3] = { { 0, D2D1::ColorF(1, 1, 1, a) }, { 0.45f, D2D1::ColorF(1, 1, 1, a * 0.28f) }, { 1, D2D1::ColorF(1, 1, 1, 0) } };
- ID2D1GradientStopCollection* sc = nullptr;
- if (FAILED(rt->CreateGradientStopCollection(st, 3, &sc))) return nullptr;
+ // Issue #304: a coleção de paradas do degradê (uma textura na placa de vídeo) era criada de novo a cada borda, duas
+ // por peça e por quadro: com os ícones de vidro dos Ajustes (Transparente/Tingido) a rolagem engasgava. Agora é uma
+ // só por alvo de desenho (por thread), com alfa 1; a força de cada canto vai na opacidade do pincel.
+ thread_local ID2D1RenderTarget* cacheRt = nullptr;
+ thread_local ID2D1GradientStopCollection* cacheSc = nullptr;
+ if (rt != cacheRt) {
+ if (cacheSc) { cacheSc->Release(); cacheSc = nullptr; }
+ if (cacheRt) cacheRt->Release();
+ cacheRt = rt; rt->AddRef();
+ D2D1_GRADIENT_STOP st[3] = { { 0, D2D1::ColorF(1, 1, 1, 1) }, { 0.45f, D2D1::ColorF(1, 1, 1, 0.28f) }, { 1, D2D1::ColorF(1, 1, 1, 0) } };
+ if (FAILED(rt->CreateGradientStopCollection(st, 3, &cacheSc))) cacheSc = nullptr;
+ }
+ float litA = 0, backA = 0;
+ auto corner = [&](float x0, float y0, float x1, float y1, float a, float& alpha) -> ID2D1LinearGradientBrush* {
+ if (!cacheSc) return nullptr;
ID2D1LinearGradientBrush* b = nullptr;
- rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ x0, y0 }, { x1, y1 }), sc, &b);
- sc->Release();
+ rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties({ x0, y0 }, { x1, y1 }), cacheSc, &b);
+ alpha = a;
return b;
};
float d = span / 1.41421f;
@@ -52,9 +63,9 @@ inline void Borda(ID2D1RenderTarget* rt, D2D1_RECT_F r, float rad, float px, boo
if (len > 0.5f) { ux = -vx / len; uy = -vy / len; } else { ux = uy = 0.70711f; }
kx = cx - ux * (w / 2); ky = cy - uy * (h / 2);
} else { ux = uy = 0.70711f; }
- ID2D1LinearGradientBrush* lit = spec > 0.001f ? corner(kx, ky, kx + ux * d, ky + uy * d, 0.42f * gain * spec) : nullptr;
+ ID2D1LinearGradientBrush* lit = spec > 0.001f ? corner(kx, ky, kx + ux * d, ky + uy * d, 0.42f * gain * spec, litA) : nullptr;
float bx = 2 * ((r.left + r.right) / 2) - kx, by = 2 * ((r.top + r.bottom) / 2) - ky;
- ID2D1LinearGradientBrush* back = spec > 0.001f ? corner(bx, by, bx - ux * d, by - uy * d, 0.20f * gain * spec) : nullptr;
+ ID2D1LinearGradientBrush* back = spec > 0.001f ? corner(bx, by, bx - ux * d, by - uy * d, 0.20f * gain * spec, backA) : nullptr;
// aros de 1 px de fora para dentro: o primeiro é o fio nítido, o segundo um resto bem fraco do brilho.
// Eram 5 aros (a borda parecia uma linha grossa); o macOS 26 tem só um fio fino (print do usuário, 16/11/2026)
const int N = 2;
@@ -62,8 +73,8 @@ inline void Borda(ID2D1RenderTarget* rt, D2D1_RECT_F r, float rad, float px, boo
float in = (1.0f + i) * px;
float a = i == 0 ? 0.85f : 0.10f;
D2D1_ROUNDED_RECT rr = D2D1::RoundedRect(D2D1::RectF(r.left + in, r.top + in, r.right - in, r.bottom - in), std::max(0.f, rad - in), std::max(0.f, rad - in));
- if (lit) { lit->SetOpacity(a); rt->DrawRoundedRectangle(rr, lit, px); }
- if (back) { back->SetOpacity(a); rt->DrawRoundedRectangle(rr, back, px); }
+ if (lit) { lit->SetOpacity(std::min(1.f, a * litA)); rt->DrawRoundedRectangle(rr, lit, px); }
+ if (back) { back->SetOpacity(std::min(1.f, a * backA)); rt->DrawRoundedRectangle(rr, back, px); }
}
{ // fio bem fraco em volta toda (o vidro nunca fica sem borda nos lados)
ID2D1SolidColorBrush* amb = nullptr;
diff --git a/src/finder/main.cpp b/src/finder/main.cpp
index bb17068..16241d6 100644
--- a/src/finder/main.cpp
+++ b/src/finder/main.cpp
@@ -7853,6 +7853,17 @@ static LRESULT OnLaunchRequest(const COPYDATASTRUCT* cd) {
return GetCurrentProcessId();
}
if (!g_reserva) return 0;
+ if (!g_finderNativo) {
+ // issue #346: a reserva nasceu antes de a pessoa trocar o idioma e abria o Finder no idioma antigo. Idioma
+ // mudou: recusa (quem pediu abre um Finder novo, já no idioma certo) e sai; o Shell prepara outra reserva
+ int antes = idioma::Current();
+ idioma::Reload();
+ if (idioma::Current() != antes) {
+ Log(L"reserva: o idioma mudou desde que ela abriu; saindo para o Shell preparar outra");
+ PostQuitMessage(0);
+ return 0;
+ }
+ }
std::wstring cmd((const wchar_t*)cd->lpData, cd->cbData / sizeof(wchar_t));
int argc; wchar_t** argv = CommandLineToArgvW(cmd.c_str(), &argc);
LoadOptions(); // opções atuais (visão, ícones, barra lateral, janela) antes dos argumentos do pedido
diff --git a/src/shell/apps.cpp b/src/shell/apps.cpp
index a6ceabb..ae6dd82 100644
--- a/src/shell/apps.cpp
+++ b/src/shell/apps.cpp
@@ -1258,7 +1258,7 @@ static HWINEVENTHOOK g_abrindoEv;
static void CALLBACK VigiaAbriu(HWND, UINT, UINT_PTR id, DWORD) {
HWND h = g_abriu;
bool clicou = GetAsyncKeyState(VK_LBUTTON) < 0 || GetAsyncKeyState(VK_RBUTTON) < 0;
- if (!h || !IsWindow(h) || !IsWindowVisible(h) || IsIconic(h) || clicou || GetTickCount64() - g_abriuEm > 1500) { KillTimer(nullptr, id); g_abriu = nullptr; return; }
+ if (!h || !IsWindow(h) || !IsWindowVisible(h) || IsIconic(h) || clicou || GetTickCount64() - g_abriuEm > 3000) { KillTimer(nullptr, id); g_abriu = nullptr; return; }
HWND fg = GetForegroundWindow();
DWORD pa = 0, pf = 0;
GetWindowThreadProcessId(h, &pa);
diff --git a/src/shell/backdrop.cpp b/src/shell/backdrop.cpp
index 20f8814..0904c50 100644
--- a/src/shell/backdrop.cpp
+++ b/src/shell/backdrop.cpp
@@ -34,7 +34,8 @@
#include <d3d11_4.h>
#include <dxgi1_4.h>
#include "../comum/gpu.h"
-#include <winrt/Windows.Graphics.Capture.h>
+#include <winrt/Windows.Graphics.Capture.h>
+#include <winrt/Windows.Security.Authorization.AppCapabilityAccess.h>
#include <winrt/Windows.Graphics.DirectX.h>
#include <winrt/Windows.Graphics.DirectX.Direct3D11.h>
#include <windows.graphics.capture.interop.h>
@@ -228,7 +229,13 @@ std::vector<wuc::CompositionEffectFactory> g_frostFx;
int g_frostOk = -1; // índice da receita que funciona; -2 = nenhuma (fundo puro)
bool g_leveFosco = false; // modo leve (leve.cpp) valendo para o fosco: sem o desfoque extra
+// Issue #335: com a Economia de energia do Windows ligada (notebook na bateria) ou "Efeitos de transparência" desligado,
+// o Windows não entrega o fundo desfocado: o fosco ficava preto (Dock, barra de menus, widgets). Como o "Reduzir
+// transparência" do Mac, vira um cinza sólido no tema claro ou escuro.
+bool g_semTransp = false; // o que valia no último Reload
+winrt::Windows::UI::Color Col(float r, float g, float b, float a); // mais abaixo
wuc::CompositionBrush MakeFrost() {
+ if (g_semTransp) return g_comp.CreateColorBrush(ui::Dark() ? Col(0.14f, 0.14f, 0.15f, 1) : Col(0.92f, 0.92f, 0.93f, 1));
if (g_frostFx.empty() && g_frostOk == -1) {
auto src = [] { return wuc::CompositionEffectSourceParameter(L"fundo"); };
auto add = [&](IGraphicsEffect fx) {
@@ -568,7 +575,13 @@ std::atomic<bool> st_nonDesk{ true };
// papel de parede mudou, o ritmo se ajusta sozinho: a montagem demorou, a próxima espera mais (até 1 s); voltou a
// ser rápida, o ritmo sobe de novo até 30/s. Janela mexendo ou conteúdo de app atrás do vidro seguem a 60/s.
double g_papelGap = 33; // ms entre montagens quando só o papel de parede mudou
-bool g_pollSoPapel = false; // a montagem pedida agora é só pelo papel de parede
+bool g_pollSoPapel = false; // a montagem pedida agora é só pelo papel de parede
+// Issues #348/#350 (build-60): o ritmo que se ajusta valia também para a nossa mesa (widgets arrastados, a Central de
+// Notificações rolando por cima dela): depois de uma montagem lenta o vidro esperava até 1 s e ficava para trás. Agora
+// só vale com um papel de parede animado de verdade (a mesa transparente, ou quadros da mesa do Explorador).
+std::atomic<bool> st_deskExplorer{ false }; // o último quadro "só papel de parede" veio da Progman/WorkerW
+bool PapelVivo() { return mesa::PapelAnimado() || st_deskExplorer.load(); }
+double PapelGap() { return PapelVivo() ? g_papelGap : 33.0; }
std::mutex st_mx;
void Dump();
double CapturasMb(size_t& n); // memória de vídeo segura pelas capturas (2 quadros por janela)
@@ -606,9 +619,9 @@ LRESULT CALLBACK MsgProc(HWND h, UINT m, WPARAM w, LPARAM l) {
if (w == 1) frameDirty = true; else capDirty = true;
static double last = 0;
bool soPapel = w == 1 && !capDirty && !st_nonDesk.load(); // só o papel de parede animado: até 30 por segundo
- double gap = soPapel ? g_papelGap : 15.5;
+ double gap = soPapel ? PapelGap() : 15.5;
if (anim::Now() - last >= gap) { last = anim::Now(); g_pollSoPapel = soPapel; st_nonDesk = false; Poll(w != 1); }
- else SetTimer(h, T_RG + 1, soPapel ? (UINT)g_papelGap : 16, nullptr); // cedo demais: monta no próximo tique (uma vez só)
+ else SetTimer(h, T_RG + 1, soPapel ? (UINT)PapelGap() : 16, nullptr); // cedo demais: monta no próximo tique (uma vez só)
return 0;
}
// o que ficou pendente; o temporizador só existe enquanto há algo (antes acordava 60 vezes/s sempre)
@@ -617,7 +630,7 @@ LRESULT CALLBACK MsgProc(HWND h, UINT m, WPARAM w, LPARAM l) {
g_pollSoPapel = !capDirty && !st_nonDesk.load();
st_nonDesk = false;
Poll(false);
- if (frameDirty || capDirty) SetTimer(h, T_RG + 1, g_pollSoPapel && !capDirty ? (UINT)g_papelGap : 16, nullptr);
+ if (frameDirty || capDirty) SetTimer(h, T_RG + 1, g_pollSoPapel && !capDirty ? (UINT)PapelGap() : 16, nullptr);
return 0;
}
if (m == WM_TIMER && w == T_RG && g_busy) return 0;
@@ -794,7 +807,8 @@ std::shared_ptr<WinCap> StartCap(HWND h) {
c->fresh = true;
if (c->relevant) {
wchar_t cl[48] = {}; GetClassNameW(c->h, cl, 48);
- if (wcscmp(cl, L"Progman") && wcscmp(cl, L"WorkerW") && wcscmp(cl, L"SequoiaMesa")) st_nonDesk = true;
+ if (wcscmp(cl, L"Progman") && wcscmp(cl, L"WorkerW") && wcscmp(cl, L"SequoiaMesa")) st_nonDesk = true;
+ else st_deskExplorer = wcscmp(cl, L"SequoiaMesa") != 0;
std::lock_guard<std::mutex> lk(st_mx); st_frameBy[cl]++;
}
if (c->relevant && !posted.exchange(true)) PostMessageW(msgWnd, WM_RG_FRAME, 1, 0);
@@ -1246,7 +1260,7 @@ void Poll(bool refresh) {
}
bool go = capDirty.exchange(false);
const bool soPapel = !go && g_pollSoPapel;
- if (!go && frameDirty && anim::Now() - lastFrameCompose >= (soPapel ? g_papelGap - 1 : 15)) go = true;
+ if (!go && frameDirty && anim::Now() - lastFrameCompose >= (soPapel ? PapelGap() - 1 : 15)) go = true;
if (!go) return;
frameDirty = false;
lastFrameCompose = anim::Now();
@@ -1264,7 +1278,8 @@ void Poll(bool refresh) {
double ms = anim::Now() - t0;
st_msSoma += ms; st_msMax = std::max(st_msMax, ms);
if (ms > 12 && slow++ < 20) Log(L"vidro real: montagem lenta, %.1f ms", ms);
- if (soPapel) { // issue #276: o ritmo do papel de parede animado segue o tempo da montagem
+ if (!PapelVivo()) g_papelGap = 33; // sem papel de parede animado: nada de ritmo lento guardado
+ else if (soPapel) { // issue #276: o ritmo do papel de parede animado segue o tempo da montagem
double antes = g_papelGap;
if (ms > 25) g_papelGap = std::min(1000.0, std::max(g_papelGap * 2, ms * 4));
else if (ms < 10) g_papelGap = std::max(33.0, g_papelGap * 0.85);
@@ -1273,7 +1288,7 @@ void Poll(bool refresh) {
ultimoLog = GetTickCount();
Log(L"vidro real: papel de parede animado %ls (montagem %.0f ms, uma a cada %.0f ms)", g_papelGap >= 200 ? L"em ritmo lento" : L"em ritmo normal", ms, g_papelGap);
}
- } else if (ms > 250) g_papelGap = std::max(g_papelGap, 250.0); // a placa está engasgada: o papel de parede espera
+ } else if (ms > 250) g_papelGap = std::max(g_papelGap, 250.0); // a placa está engasgada: o papel de parede espera (só com ele animado)
}
bool Init() {
@@ -1281,7 +1296,21 @@ bool Init() {
if (tried && GetTickCount() - lastTry < 10000) return false; // não insiste a cada janela nova
tried = true; lastTry = GetTickCount();
try {
- if (!wgc::GraphicsCaptureSession::IsSupported()) { Log(L"vidro real: captura de janelas indisponível"); return false; }
+ if (!wgc::GraphicsCaptureSession::IsSupported()) { Log(L"vidro real: captura de janelas indisponível"); return false; }
+ // Issue #337: em alguns Windows (26H2) o IsBorderRequired(false) só vale depois de pedir a captura sem borda;
+ // sem o pedido aparecia a borda amarela em volta das janelas atrás do vidro. Fora da thread da interface (o
+ // .get() não pode esperar numa STA); as capturas abertas depois já saem sem borda.
+ static bool pediu = false;
+ if (!pediu) {
+ pediu = true;
+ std::thread([] {
+ try { winrt::init_apartment(winrt::apartment_type::multi_threaded); } catch (...) {}
+ try {
+ auto st = wgc::GraphicsCaptureAccess::RequestAccessAsync(wgc::GraphicsCaptureAccessKind::Borderless).get();
+ Log(L"vidro real: captura sem borda %ls", st == winrt::Windows::Security::Authorization::AppCapabilityAccess::AppCapabilityAccessStatus::Allowed ? L"permitida" : L"recusada pelo Windows");
+ } catch (...) { Log(L"vidro real: pedido de captura sem borda indisponível neste Windows"); }
+ }).detach();
+ }
if (!d3d) {
// a placa da tela: os quadros capturados vêm do DWM; noutra placa cada um seria copiado entre as duas (comum/gpu.h)
HRESULT hr = gpu::CriarNaTela(D3D11CreateDevice, D3D11_CREATE_DEVICE_BGRA_SUPPORT, &d3d, &ctx);
@@ -1660,7 +1689,14 @@ void Use(Entry& e, bool want) {
} // namespace
const backdrop::Style& backdrop::Current() { return g_style; }
-bool backdrop::Liquid() { return g_style.liquid && !g_style.reduce; }
+bool backdrop::Liquid() { return g_style.liquid && !g_style.reduce; }
+bool backdrop::SemTransparencia() {
+ DWORD v = 1, n = sizeof(v);
+ if (RegGetValueW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", L"EnableTransparency",
+ RRF_RT_REG_DWORD, nullptr, &v, &n) == ERROR_SUCCESS && v == 0) return true;
+ SYSTEM_POWER_STATUS ps{};
+ return GetSystemPowerStatus(&ps) && ps.SystemStatusFlag == 1; // Economia de energia ligada
+}
void backdrop::Restart() {
Log(L"vidro real: reiniciado pelo usuário (estava %ls%ls)", rg::active ? L"ligado" : L"desligado", rg::semCaptura ? L", desistido" : L"");
@@ -1691,7 +1727,12 @@ void backdrop::Reload() {
rg::g_semRitmo = shell::Setting(L"vidro_ritmo", L"1") == L"0";
// modo leve (leve.cpp: PC fraco ou na bateria): também sem o vidro real, e o fosco sem o desfoque extra (MakeFrost)
leve::Atualizar();
- bool leveMudou = g_leveFosco != leve::Ativo();
+ bool leveMudou = g_leveFosco != leve::Ativo();
+ { // issue #335: transparência do Windows ligou ou desligou (Economia de energia): o fosco é refeito
+ bool st = backdrop::SemTransparencia();
+ if (st != g_semTransp) { leveMudou = true; Log(L"vidro: transparência do Windows %ls", st ? L"desligada (economia de energia ou ajuste): fosco em cinza sólido" : L"de volta"); }
+ g_semTransp = st;
+ }
g_leveFosco = leve::Ativo();
if (g_leveFosco) s.real = false;
// issue #31: o log só dizia "estava desligado" e parecia defeito; agora diz quem segurou o vidro real
diff --git a/src/shell/central.cpp b/src/shell/central.cpp
index 71447dd..7484e0a 100644
--- a/src/shell/central.cpp
+++ b/src/shell/central.cpp
@@ -2226,7 +2226,9 @@ void DragTo(float x) {
g_brightWant = v;
if (!g_brightBusy.exchange(true)) std::thread(BrightWorker).detach();
}
- Paint();
+ // issues #329/#269: um mouse de 1000 Hz mandava 1000 WM_MOUSEMOVE por segundo, e cada um redesenhava a Central
+ // inteira (vidro, blocos, ícones). Agora o desenho espera o próximo quadro da tela: um por quadro, o valor mais novo
+ ui::FrameClock(g_wnd, WM_CC_FRAME, true);
}
void OpenSettings(const wchar_t* page) { Close(); shell::OpenSettings(page); }
diff --git a/src/shell/dock.cpp b/src/shell/dock.cpp
index b6ba1e2..5fbaa2d 100644
--- a/src/shell/dock.cpp
+++ b/src/shell/dock.cpp
@@ -1174,6 +1174,37 @@ void CALLBACK FgEvent(HWINEVENTHOOK, DWORD, HWND h, LONG obj, LONG, DWORD, DWORD
}
}
+// Issue #357: o ícone do Calendário mostra o dia de hoje, como no Mac (o PNG do pacote traz uma data fixa). Por cima
+// do corpo do ícone (80% do desenho do pacote): o fundo branco, o dia da semana em vermelho e o número grande.
+bool IsCalendarApp(const App& a) {
+ if (g_customIcon[a.id]) return false; // ícone escolhido pela pessoa fica como está
+ const std::wstring& e = a.exe;
+ static const std::wstring nome = [] { std::wstring n = EXE_CALENDAR; for (auto& c : n) c = towlower(c); return n; }();
+ return e.size() >= nome.size() && e.compare(e.size() - nome.size(), nome.size(), nome) == 0;
+}
+void DrawCalendarDate(ID2D1RenderTarget* rt, ID2D1SolidColorBrush* br, D2D1_RECT_F iw) {
+ static IDWriteTextFormat* tfDia = ui::Format(58, DWRITE_FONT_WEIGHT_LIGHT, false, DWRITE_TEXT_ALIGNMENT_CENTER);
+ static IDWriteTextFormat* tfSemana = ui::Format(17, DWRITE_FONT_WEIGHT_SEMI_BOLD, false, DWRITE_TEXT_ALIGNMENT_CENTER);
+ if (!tfDia || !tfSemana) return;
+ SYSTEMTIME st; GetLocalTime(&st);
+ wchar_t sem[32] = {}, dia[8];
+ GetDateFormatEx(LOCALE_NAME_USER_DEFAULT, 0, &st, L"ddd", sem, 32, nullptr);
+ for (wchar_t* p = sem; *p; p++) *p = towupper(*p);
+ for (wchar_t* p = sem; *p; p++) if (*p == L'.') { *p = 0; break; } // "TER." -> "TER"
+ swprintf_s(dia, L"%d", st.wDay);
+ float W = iw.right - iw.left, m = W * 0.10f, B = W - 2 * m;
+ D2D1_RECT_F body{ iw.left + m, iw.top + m, iw.right - m, iw.bottom - m };
+ br->SetColor(D2D1::ColorF(1, 1, 1, 1));
+ rt->FillRoundedRectangle(D2D1::RoundedRect(body, B * 0.225f, B * 0.225f), br);
+ D2D1_MATRIX_3X2_F antes; rt->GetTransform(&antes);
+ rt->SetTransform(D2D1::Matrix3x2F::Scale(B / 100.f, B / 100.f) * D2D1::Matrix3x2F::Translation(body.left, body.top) * antes);
+ br->SetColor(D2D1::ColorF(0.96f, 0.23f, 0.21f, 1));
+ rt->DrawTextW(sem, (UINT32)wcslen(sem), tfSemana, D2D1::RectF(0, 8, 100, 30), br);
+ br->SetColor(D2D1::ColorF(0.16f, 0.16f, 0.17f, 1));
+ rt->DrawTextW(dia, (UINT32)wcslen(dia), tfDia, D2D1::RectF(0, 22, 100, 96), br);
+ rt->SetTransform(antes);
+}
+
// A etiqueta com o nome (pt, na janela dos ícones, sempre em pé): embaixo, acima do ícone com a setinha para baixo;
// dos lados, ao lado do ícone com a setinha apontando para ele (como no Mac com o Dock à esquerda ou à direita).
struct LabelBox { D2D1_RECT_F r{}; D2D1_POINT_2F tri[3]{}; std::wstring t; };
@@ -1429,6 +1460,7 @@ void Paint() {
D2D1_RECT_F iw = Up(ir);
rt->SetTransform(base);
if (b) rt->DrawBitmap(b, iw, 1, D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC); // reduz 256 px sem serrilhar
+ if (b && mac && !leo && it.kind == I_APP && IsCalendarApp(apps::list[it.app])) DrawCalendarDate(rt, br, iw); // issue #357
else if (it.kind == I_APP) { if (apps::list[it.app].finder) ui::DrawFolder(rt, iw, 0xE8B7); }
else if (it.kind == I_DOWNLOADS) ui::DrawFolder(rt, iw, 0xE896);
else if (it.kind == I_FOLDER) ui::DrawFolder(rt, iw, 0xE8B7);
diff --git a/src/shell/genio.cpp b/src/shell/genio.cpp
index fc88de4..e3110ca 100644
--- a/src/shell/genio.cpp
+++ b/src/shell/genio.cpp
@@ -710,6 +710,11 @@ void Start(HWND h, RECT slot, bool restore) {
}
MONITORINFO mi{ sizeof(mi) }; GetMonitorInfoW(MonitorFromRect(&vis, MONITOR_DEFAULTTONEAREST), &mi);
g_ovRect = mi.rcMonitor;
+ { // issue #336: janela no segundo monitor e o Dock no principal: a camada do gênio cobria só o monitor da janela,
+ // e a animação sumia no meio do caminho, na borda entre os dois. Agora cobre os dois monitores.
+ MONITORINFO ms{ sizeof(ms) };
+ if (GetMonitorInfoW(MonitorFromRect(&slot, MONITOR_DEFAULTTONEAREST), &ms)) UnionRect(&g_ovRect, &g_ovRect, &ms.rcMonitor);
+ }
int inset = g_a.inset; bool maxed = g_a.maxed; // calculados pelo WindowArea
g_a = Anim{};
g_a.target = h; g_a.win = vis; g_a.slot = slot; g_a.src = src; g_a.restore = restore; g_a.inset = inset; g_a.maxed = maxed;
diff --git a/src/shell/launchpad.cpp b/src/shell/launchpad.cpp
index 8519326..6fc0a4d 100644
--- a/src/shell/launchpad.cpp
+++ b/src/shell/launchpad.cpp
@@ -76,6 +76,7 @@ void StyleCheck() {
for (auto& a : g_all) if (a.bmp) { a.bmp->Release(); a.bmp = nullptr; }
}
int g_page = 0, g_press = -1;
+bool g_desceu; // issue #313: o botão desceu nesta janela (senão o clique só a ativou e o soltar abre o app)
std::wstring g_query;
double g_openedAt, g_closingAt; // ms de anim::Now (relógio de alta precisão)
bool g_open, g_closing;
@@ -893,6 +894,7 @@ LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {
}
case WM_ACTIVATE: if (LOWORD(w) == WA_INACTIVE) { if (g_open && !g_closing) Log(L"launchpad: perdeu o foco, fechando"); Close(); } return 0;
case WM_LBUTTONDOWN: {
+ g_desceu = true;
Geo g = Layout();
if (liquid::On()) {
auto pt = Pt(l);
@@ -906,6 +908,7 @@ LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {
}
case WM_LBUTTONUP: {
ReleaseCapture();
+ const bool semDescer = !g_desceu; g_desceu = false;
Geo g = Layout();
if (liquid::On()) {
auto pt = Pt(l);
@@ -916,7 +919,7 @@ LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {
for (auto& hh : g_apHits) {
if (pt.x < hh.r.left || pt.x >= hh.r.right || pt.y < hh.r.top || pt.y >= hh.r.bottom) continue;
if (hh.kind == 1 && hh.v < 16) { g_apMore[hh.v] = !g_apMore[hh.v]; break; }
- if (hh.kind == 0 && hh.v == p) { Launch(hh.v); return 0; }
+ if (hh.kind == 0 && (hh.v == p || (p < 0 && semDescer))) { Launch(hh.v); return 0; } // issue #313: o 1º clique (só ativou a janela) também abre
}
Paint();
return 0;
@@ -959,7 +962,8 @@ LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {
for (int i = 0; i < NCATS; i++) if (pt.x >= cr[i].left && pt.x < cr[i].right && pt.y >= cr[i].top && pt.y < cr[i].bottom) cat = i;
}
if (cat >= 0) { g_cat = cat; g_page = 0; std::lock_guard<std::mutex> lk(g_mu); Filter(); }
- else if (hit >= 0 && hit == p) { int i; { std::lock_guard<std::mutex> lk(g_mu); i = g_view[hit]; } Launch(i); }
+ else if (hit >= 0 && (hit == p || (p < 0 && semDescer))) { int i; // issue #313: sem o aperto (o clique que ativou a janela), abre igual
+ { std::lock_guard<std::mutex> lk(g_mu); i = g_view[hit]; } Launch(i); }
else if (!(pt.x >= sr.left && pt.x < sr.right && pt.y >= sr.top && pt.y < sr.bottom)) {
int n = Pages(); // bolinhas trocam de página; qualquer outro lugar vazio fecha
float y = DotsY(g), x0 = g.W / 2 - (n - 1) * 12.f * g.k;
@@ -1132,7 +1136,7 @@ void launchpad::Toggle() {
if (g_ready && GetTickCount64() - g_scannedAt > 5 * 60 * 1000) Scan(); // por garantia: o vigia (instalados.cpp) já avisa na hora
{ std::lock_guard<std::mutex> lk(g_mu); if (g_ready) Filter(); }
- g_open = true; g_closing = false;
+ g_open = true; g_closing = false; g_desceu = false;
g_openedAt = anim::Now();
if (g_comp) {
// a grade pronta (parada) e as curvas entregues antes de a janela aparecer: o primeiro quadro já é o certo
diff --git a/src/shell/main.cpp b/src/shell/main.cpp
index 3976664..e5b66e1 100644
--- a/src/shell/main.cpp
+++ b/src/shell/main.cpp
@@ -1408,6 +1408,12 @@ static LRESULT CALLBACK MsgProc(HWND h, UINT m, WPARAM w, LPARAM l) {
if (w == 7) { KillTimer(g_msg, 7); Changed(); return 0; }
if (w == 1) {
if (g_stopOtherMappings && (g_swapLeftModifiers || g_macSpaceKeys)) UpdateKeyboardRemap();
+ { // issue #335: a Economia de energia liga e desliga sem aviso nos ajustes: o vidro é refeito quando muda
+ static int semT = -1;
+ int st = backdrop::SemTransparencia() ? 1 : 0;
+ if (semT >= 0 && st != semT) backdrop::Reload();
+ semT = st;
+ }
static int ticks;
if (ticks++ % 60 == 0) AutoAppearance();
Changed(); CheckFullscreen(); HideTaskbars(); shell::ApplyWorkArea(); if (shell::Setting(L"finder_reserva", L"1") == L"1") EnsureReserve(); EnsureScreenshot();
diff --git a/src/shell/mesa.cpp b/src/shell/mesa.cpp
index 0fc5abc..94ee960 100644
--- a/src/shell/mesa.cpp
+++ b/src/shell/mesa.cpp
@@ -687,8 +687,18 @@ void QueueIcons() {
// nativo: pasta comum com a pasta do Mac (do pacote de ícones). Sem isto vinha o ícone de pasta do Windows,
// que na VM (sem a troca de ícones do sistema do PC) é uma folha branca. Pasta com ícone próprio (desktop.ini) fica.
bool got = false;
- DWORD at = shell::nativo || !pastaTema.empty() ? GetFileAttributesW(p.c_str()) : INVALID_FILE_ATTRIBUTES;
- if (at != INVALID_FILE_ATTRIBUTES && (at & FILE_ATTRIBUTE_DIRECTORY) && GetFileAttributesW((p + L"\\desktop.ini").c_str()) == INVALID_FILE_ATTRIBUTES) {
+ // issue #306: no Sequoia também (antes só nos temas de vidro e no nativo vinha a pasta do Mac; no resto, a
+ // amarela do Windows). E o desktop.ini só conta quando ele troca o ícone (muitos só traduzem o nome).
+ DWORD at = GetFileAttributesW(p.c_str());
+ auto iconeProprio = [](const std::wstring& pasta) {
+ std::wstring ini = pasta + L"\\desktop.ini";
+ if (GetFileAttributesW(ini.c_str()) == INVALID_FILE_ATTRIBUTES) return false;
+ wchar_t v[MAX_PATH] = {};
+ if (GetPrivateProfileStringW(L".ShellClassInfo", L"IconResource", L"", v, MAX_PATH, ini.c_str()) && v[0]) return true;
+ if (GetPrivateProfileStringW(L".ShellClassInfo", L"IconFile", L"", v, MAX_PATH, ini.c_str()) && v[0]) return true;
+ return GetPrivateProfileStringW(L".ShellClassInfo", L"CLSID", L"", v, MAX_PATH, ini.c_str()) && v[0]; // pasta especial
+ };
+ if (at != INVALID_FILE_ATTRIBUTES && (at & FILE_ATTRIBUTE_DIRECTORY) && !iconeProprio(p)) {
std::wstring png = !pastaTema.empty() ? pastaTema : ui::PackIcon(L"folder default");
got = !png.empty() && ui::LoadPng(png, l.w, l.h, l.px);
}
@@ -1000,12 +1010,17 @@ template <class F> void ForEachExplorerIconView(F f) {
in(FindWindowW(L"Progman", nullptr));
for (HWND w = nullptr; (w = FindWindowExW(nullptr, w, L"WorkerW", nullptr));) in(w);
}
+// Issue #352: escondendo a SHELLDLL_DefView inteira, o Lively Wallpaper achava que a mesa do Windows tinha sido
+// refeita (ele procura a WorkerW pela DefView) e reiniciava o papel de parede sem parar, abrindo e fechando. Agora só a
+// lista de ícones dentro dela (SysListView32 "FolderView") some; a DefView continua como o Windows deixou.
+HWND IconList(HWND dv) { HWND l = FindWindowExW(dv, nullptr, L"SysListView32", nullptr); return l ? l : nullptr; }
int HideExplorerIcons() {
int n = 0;
ForEachExplorerIconView([&](HWND dv) {
- if (!IsWindowVisible(dv)) return;
- SetPropW(dv, PROP_ICONES, (HANDLE)1);
- ShowWindow(dv, SW_HIDE);
+ HWND l = IconList(dv);
+ if (!l || !IsWindowVisible(l)) return;
+ SetPropW(l, PROP_ICONES, (HANDLE)1);
+ ShowWindow(l, SW_HIDE);
n++;
});
return n;
@@ -1013,10 +1028,12 @@ int HideExplorerIcons() {
int RestoreExplorerIcons() { // também roda no vigia (outro processo): sem Log
int n = 0;
ForEachExplorerIconView([&](HWND dv) {
- if (!GetPropW(dv, PROP_ICONES)) return;
- RemovePropW(dv, PROP_ICONES);
- ShowWindow(dv, SW_SHOWNA);
- n++;
+ for (HWND w : { dv, IconList(dv) }) { // dv: escondida pela build-60 (a DefView inteira)
+ if (!w || !GetPropW(w, PROP_ICONES)) continue;
+ RemovePropW(w, PROP_ICONES);
+ ShowWindow(w, SW_SHOWNA);
+ n++;
+ }
});
return n;
}
@@ -2129,6 +2146,7 @@ bool mesa::IsDeskWindow(HWND h) {
return IsDeskClass(c);
}
bool mesa::Standalone() { return g_standalone.load(); }
+bool mesa::PapelAnimado() { return g_live; }
// a faixa do papel de parede atrás da barra de menus, como a mesa a desenhou (o mesmo corte e estilo da tela):
// a barra do Tahoe é transparente e a cor do texto segue o que está atrás dela
diff --git a/src/shell/pilhas.cpp b/src/shell/pilhas.cpp
index af3474c..ce57461 100644
--- a/src/shell/pilhas.cpp
+++ b/src/shell/pilhas.cpp
@@ -14,7 +14,7 @@
namespace {
-const UINT WM_PL_ICON = WM_APP + 81, WM_PL_FRAME = WM_APP + 82;
+const UINT WM_PL_ICON = WM_APP + 81, WM_PL_FRAME = WM_APP + 82, WM_PL_REFOCO = WM_APP + 83;
const int COLS = 6;
int MAXN = 18; // Downloads: 18; a pilha Aplicativos do Leopard mostra mais (g_apps)
bool g_apps; // Leopard: a pasta Aplicativos da Dock como Pilha em Grade (os atalhos do Menu Iniciar)
@@ -393,7 +393,21 @@ LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {
quicklook::Toggle(p);
}
return 0;
- case WM_ACTIVATE: if (LOWORD(w) == WA_INACTIVE) Hide(); return 0;
+ case WM_ACTIVATE:
+ if (LOWORD(w) == WA_INACTIVE) {
+ // issue #314: logo depois de abrir, o clique no Dock (que soltou depois) às vezes ativava o Dock e a pilha
+ // fechava na hora. Perdeu o foco para uma janela nossa sem clique novo: pega de volta em vez de fechar
+ HWND to = (HWND)l; if (!to) to = GetForegroundWindow();
+ bool clicou = GetAsyncKeyState(VK_LBUTTON) < 0 || GetAsyncKeyState(VK_RBUTTON) < 0;
+ if (g_open && !g_closing && to && shell::Nossa(to) && !clicou && anim::Now() - g_openAt < 700) {
+ Log(L"pilha: o foco foi para outra janela do Shell logo depois de abrir; pegando de volta");
+ PostMessageW(h, WM_PL_REFOCO, 0, 0);
+ return 0;
+ }
+ Hide();
+ }
+ return 0;
+ case WM_PL_REFOCO: if (g_open && !g_closing) { SetForegroundWindow(h); SetFocus(h); } return 0;
case WM_CLOSE: Hide(true); return 0; // nunca destruir: a janela é reaproveitada (destruída, os cliques no Dock paravam)
}
return DefWindowProcW(h, m, w, l);
diff --git a/src/shell/shell.h b/src/shell/shell.h
index 6b78ca5..2c34d48 100644
--- a/src/shell/shell.h
+++ b/src/shell/shell.h
@@ -452,7 +452,8 @@ bool TopColor(int barPx, float& r, float& g, float& b, bool baixo = false);
// a imagem do papel de parede do monitor principal como a mesa desenhou (BGRA, opaca) e onde fica na tela. key muda
// quando o papel de parede é refeito: com key igual ao que se passou, não copia nada e devolve true
bool Papel(void*& key, int& w, int& h, RECT& tela, std::vector<BYTE>& px);
-bool Standalone(); // sem Explorador agora (qualquer thread)
+bool Standalone(); // sem Explorador agora (qualquer thread)
+bool PapelAnimado(); // papel de parede animado atrás da mesa transparente (qualquer thread)
void WallpaperNow(const std::wstring& path); // o Ajustes escolheu este papel de parede: mostra já
void DepoisDoJogo(); // modo jogo acabou: refaz a mesa se a tela mudou durante o jogo
// App antigo da Loja (UWP: Segurança do Windows...) não abre sem o Explorador (a janela dele vem de uma peça
@@ -677,7 +678,8 @@ bool Real(); // vidro real ativo (senão, o fosco)
void CaptureVisible(bool show); // Captura de Tela do projeto: mostrar as peças só durante a foto
const Style& Current();
bool Liquid(); // Liquid Glass ligado (e transparência não reduzida)
-void Reload(); // lê os ajustes e reaplica em todos os vidros
+void Reload(); // lê os ajustes e reaplica em todos os vidros
+bool SemTransparencia(); // "Efeitos de transparência" desligado ou Economia de energia ligada (issue #335)
float AdjustAlpha(float a); // opacidade da tinta conforme os ajustes
D2D1_COLOR_F AdjustTint(D2D1_COLOR_F c);
}
diff --git a/src/shell/spotlight.cpp b/src/shell/spotlight.cpp
index 9fe7dcd..f5c9763 100644
--- a/src/shell/spotlight.cpp
+++ b/src/shell/spotlight.cpp
@@ -70,6 +70,9 @@ void Metricas() {
const float LEO_ROW = 20, LEO_COL = 112; // Leopard: linhas de 20 e a coluna das categorias
const UINT WM_SP_FILES = WM_APP + 60, WM_SP_ICON = WM_APP + 61, WM_SP_APPS = WM_APP + 62, WM_SP_FRAME = WM_APP + 63, WM_SP_SUGG = WM_APP + 64, WM_SP_FORA = WM_APP + 65;
const UINT_PTR T_SEARCH = 1, T_CARET = 2, T_ICONS = 3, T_REGRAB = 4, T_VOZ = 5;
+// issue #321: clicar no campo de texto de outro app às vezes não desativa o Spotlight (o Windows não manda o
+// WM_ACTIVATE): enquanto aberto, confere a janela da frente e fecha quando ela é de outro programa
+const UINT_PTR T_FRENTE = 9;
const UINT WM_SP_VOZ = WM_APP + 66; // voz.cpp: o texto falado (ditado pelo microfone do campo)
enum Kind { K_APP, K_SETTING, K_DOC, K_FOLDER, K_IMAGE, K_MEDIA, K_OTHER, K_CALC, K_WEB, K_AI }; // K_AI: Perguntar à Siri (issue #39)
@@ -2357,6 +2360,7 @@ void Close(bool restore = false) {
menubar::SoundChanged(false); // a cápsula da lupa da barra sai
g_edit = g_dragging = false; g_press = -1; g_cellAt.clear();
KillTimer(g_wnd, T_REGRAB);
+ KillTimer(g_wnd, T_FRENTE);
// fechado pelo Esc ou pelo atalho: o app de antes volta para a frente (senão o Windows escolhia outro,
// e o Notas sumia atrás do Chrome)
if (restore && g_prevFg && IsWindow(g_prevFg) && GetForegroundWindow() == g_wnd) Grab(g_prevFg);
@@ -2384,6 +2388,9 @@ void Open(int row, bool reveal) {
std::lock_guard<std::mutex> l(g_mu);
for (auto& a : g_apps) if (a.parsing == target) { a.use += 3; break; }
}
+ // issue #311: um app já aberto (Claude, Electron de instância única) só pede a frente para a janela dele; sem
+ // permissão o Windows negava e a frente ia para outro app. Com o Spotlight ainda na frente, qualquer processo pode.
+ AllowSetForegroundWindow(ASFW_ANY);
Close();
apps::EsperaAbrir(); // o app aberto fica na frente quando o Spotlight some (issue #268)
switch (r.kind) {
@@ -2665,6 +2672,16 @@ LRESULT CALLBACK Proc(HWND h, UINT m, WPARAM w, LPARAM l) {
} else if (w == T_CARET) { g_caretOn = !g_caretOn; Paint(); }
else if (w == T_VOZ) { if (!voz::Ouvindo()) KillTimer(h, T_VOZ); Paint(); } // o microfone pulsando
else if (w == T_REGRAB) { KillTimer(h, T_REGRAB); if (g_open) Grab(h); }
+ else if (w == T_FRENTE) {
+ if (!g_open) { KillTimer(h, T_FRENTE); return 0; }
+ HWND fg = GetForegroundWindow();
+ DWORD pid = 0; if (fg) GetWindowThreadProcessId(fg, &pid);
+ if (fg && fg != h && pid && pid != GetCurrentProcessId() && !g_fileDrag && anim::Now() - g_openAt > 1500) {
+ wchar_t cls[64] = {}; GetClassNameW(fg, cls, 64);
+ Log(L"spotlight: outra janela na frente (%ls) sem tirar o foco, fechando", cls);
+ Close();
+ }
+ }
else if (w == T_ICONS) { KillTimer(h, T_ICONS); Paint(); }
else if (w == T_HOLD) { // segurou um app: a grade treme (como no Launchpad)
KillTimer(h, T_HOLD);
@@ -3092,6 +3109,7 @@ static void OpenWith(int mode) {
if (!g_visible) Metricas(); // tema (ou o modo Apps, mais largo) pode ter mudado desde a última vez
g_scroll = 0;
g_openAt = anim::Now();
+ SetTimer(g_wnd, T_FRENTE, 300, nullptr);
g_keyNav = false;
const bool wasVisible = g_visible;
if (!g_visible) { g_h = FIELD_H; g_scrollNow = 0; } // nasce só com o campo; os resultados crescem dele
diff --git a/src/shell/ui.cpp b/src/shell/ui.cpp
index 374ff93..e4673e6 100644
--- a/src/shell/ui.cpp
+++ b/src/shell/ui.cpp
@@ -721,6 +721,8 @@ void ui::Acrylic(HWND h, DWORD tint) {
float a = backdrop::AdjustAlpha((tint >> 24) / 255.f);
tint = (tint & 0x00FFFFFFu) | ((DWORD)std::lround(std::clamp(a, 0.f, 1.f) * 255) << 24);
ACCENT_POLICY ap{ 4 /*ACCENT_ENABLE_ACRYLICBLURBEHIND*/, 0, tint, 0 };
+ // issue #335: sem transparência no Windows o acrílico vira a cor da tinta, opaca (preta no escuro): cinza sólido
+ if (backdrop::SemTransparencia()) { ap.state = 1 /*ACCENT_ENABLE_GRADIENT*/; ap.gradient = ui::Dark() ? 0xFF262423u : 0xFFEDEBEBu; }
WCA_DATA d{ 19 /*WCA_ACCENT_POLICY*/, &ap, sizeof(ap) };
fn(h, &d);
}