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

Issues #381 #384 #322 #193: volume no longer resets audio; AppBars keep their edge

Eternity070628caf032bf8660
diff --git a/src/ajustes/main.cpp b/src/ajustes/main.cpp
index 85cc91d..e94d5bf 100644
--- a/src/ajustes/main.cpp
+++ b/src/ajustes/main.cpp
@@ -1215,7 +1215,8 @@ void DrawSidebar(aj::Ctx& c, const Pal& pal, float H) {
aj::Text(c, std::wstring(1, (wchar_t)0xE77B), D2D1::RectF(m.x - 17, m.y - 17, m.x + 17, m.y + 17), g_tfGlyph, D2D1::ColorF(1, 1, 1, 1));
}
aj::Text(c, inf.fullName, D2D1::RectF(54, y + 8, SIDE_W - 12, y + 26), g_tfBold, pal.text);
- aj::Text(c, L"Conta do Windows", D2D1::RectF(54, y + 25, SIDE_W - 12, y + 41), g_tfBody, pal.text2);
+ // issue #193: com "Ocultar menções ao Windows" (ocultar_windows=1), só "Conta"
+ aj::Text(c, aj::Setting(L"ocultar_windows", L"0") == L"1" ? std::wstring(L"Conta") : std::wstring(L"Conta do Windows"), D2D1::RectF(54, y + 25, SIDE_W - 12, y + 41), g_tfBody, pal.text2);
g_hits.push_back({ H_ACCOUNT, ar });
y += ACCOUNT_H + 10;
} else y = SEARCH_Y + SEARCH_H + 14 - g_sideScroll;
diff --git a/src/shell/central.cpp b/src/shell/central.cpp
index 7484e0a..41abd82 100644
--- a/src/shell/central.cpp
+++ b/src/shell/central.cpp
@@ -2192,10 +2192,17 @@ void VolWorker() {
HRESULT ci = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
IAudioEndpointVolume* e = Endpoint();
float v;
+ // issue #381: o mudo só vai quando muda de verdade, e o volume no máximo a cada 16 ms. Antes cada passo do arrasto
+ // mandava também SetMute(FALSE); com alguns drivers e processadores de som (APO) cada SetMute reinicia o som, o
+ // YouTube mostrava "Audio Renderer error" e era preciso reiniciar o serviço Áudio do Windows
+ BOOL mudo = FALSE;
+ if (e && FAILED(e->GetMute(&mudo))) mudo = -1;
while ((v = g_volWant.exchange(-1)) >= 0) {
if (!e) break;
e->SetMasterVolumeLevelScalar(v, &CTX_SHELL_VOL);
- e->SetMute(v <= 0.001f, &CTX_SHELL_VOL);
+ BOOL quer = v <= 0.001f;
+ if (quer != mudo) { e->SetMute(quer, &CTX_SHELL_VOL); mudo = quer; }
+ Sleep(16);
}
if (e) e->Release();
if (SUCCEEDED(ci)) CoUninitialize();
diff --git a/src/shell/janelas.cpp b/src/shell/janelas.cpp
index e39e187..eebb911 100644
--- a/src/shell/janelas.cpp
+++ b/src/shell/janelas.cpp
@@ -46,6 +46,8 @@ const wchar_t* EXCLUDED_EXE[] = {
// SolidWorks (issue #369): com a DLL, o painel de propriedades da esquerda (PropertyManager) não aparecia ao usar uma
// ferramenta; a árvore ficava no lugar dele
L"sldworks.exe",
+ // Outlook clássico (issue #322): com a DLL, o cabeçalho da mensagem (De, Para, Assunto) sumia do Painel de Leitura
+ L"outlook.exe",
L"explorer.exe", L"dwm.exe", L"shell.exe", L"arquivos.exe", L"ajustes.exe", L"monitoratividade.exe", L"terminal.exe", L"calculadora.exe", L"notas.exe",
L"wacosshell.exe", L"wacosfinder.exe", L"wacossettings.exe", L"wacosactivitymonitor.exe", L"wacosterminal.exe", L"wacoscalculator.exe", L"wacosnotes.exe", L"wacoswindow32host.exe", L"searchhost.exe", L"startmenuexperiencehost.exe",
L"snippingtool.exe", L"screenclippinghost.exe", // Ferramenta de Captura (gravação de tela parava: prints do Discord, 19/11/2026)
diff --git a/src/shell/main.cpp b/src/shell/main.cpp
index 555a9cd..233eab0 100644
--- a/src/shell/main.cpp
+++ b/src/shell/main.cpp
@@ -843,6 +843,16 @@ RECT shell::WorkAreaFor(HMONITOR hm) {
else if (dock::Posicao() == 2) want.right -= r;
else want.bottom -= std::max(r, menubar::ReservedBottom(hm)); // barra embaixo: com o Dock oculto, a altura dela
}
+ // issue #384: a borda que outro programa reservou (AppBar, como o SideDesk) continua dele
+ for (auto& ab : tray::AppBars()) {
+ RECT r;
+ if (!IsWindowVisible(ab.hwnd) || !GetWindowRect(ab.hwnd, &r) || MonitorFromWindow(ab.hwnd, MONITOR_DEFAULTTONULL) != hm) continue;
+ if (ab.edge == 0 && r.left <= mi.rcMonitor.left + 2) want.left = std::max(want.left, r.right);
+ else if (ab.edge == 2 && r.right >= mi.rcMonitor.right - 2) want.right = std::min(want.right, r.left);
+ else if (ab.edge == 1 && r.top <= mi.rcMonitor.top + 2) want.top = std::max(want.top, r.bottom);
+ else if (ab.edge == 3 && r.bottom >= mi.rcMonitor.bottom - 2) want.bottom = std::min(want.bottom, r.top);
+ }
+ if (want.right - want.left < 200 || want.bottom - want.top < 200) { want = mi.rcMonitor; want.top += menubar::ReservedOn(hm); } // conta errada: como antes
return want;
}
diff --git a/src/shell/shell.h b/src/shell/shell.h
index f8be57f..de3e3c5 100644
--- a/src/shell/shell.h
+++ b/src/shell/shell.h
@@ -243,7 +243,11 @@ void Click(int index, UINT button, POINT screenPt); // WM_LBUTTONUP / WM_RBUTTO
void Keepalive(); // mantém o nosso Shell_TrayWnd na frente
// O ícone "<app> está usando o microfone/a câmera" do próprio Windows (guid 7820AE82-...): não vai para a barra de
// menus (lá fica a bolinha laranja/verde, como no Mac) e é o sinal de uso; 1 microfone, 2 câmera (pelo texto)
-bool IsPrivacy(const TrayIcon& t);
+bool IsPrivacy(const TrayIcon& t);
+// issue #384: barras de outros programas que reservam uma borda da tela (AppBar: SideDesk, docks laterais). O pedido
+// passa pela nossa Shell_TrayWnd (SHAppBarMessage); WorkAreaFor desconta a janela delas da borda pedida
+struct AppBar { HWND hwnd; UINT edge; }; // edge: ABE_LEFT 0, ABE_TOP 1, ABE_RIGHT 2, ABE_BOTTOM 3
+std::vector<AppBar> AppBars();
int PrivacyBits();
}
diff --git a/src/shell/som.cpp b/src/shell/som.cpp
index 27a553e..ef46e2a 100644
--- a/src/shell/som.cpp
+++ b/src/shell/som.cpp
@@ -227,10 +227,16 @@ void VolWorker() {
HRESULT ci = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
IAudioEndpointVolume* e = Endpoint();
float v;
+ // issue #381: o mudo só vai quando muda de verdade (no zero, mudo: o ícone vira o alto-falante cortado, como no Mac),
+ // e o volume no máximo a cada 16 ms. SetMute repetido a cada passo reinicia o som em alguns drivers/APO
+ BOOL mudo = FALSE;
+ if (e && FAILED(e->GetMute(&mudo))) mudo = -1;
while ((v = g_volWant.exchange(-1)) >= 0) {
if (!e) break;
e->SetMasterVolumeLevelScalar(v, &CTX_SHELL);
- e->SetMute(v <= 0.001f, &CTX_SHELL); // no zero, mudo (o ícone vira o alto-falante cortado, como no Mac)
+ BOOL quer = v <= 0.001f;
+ if (quer != mudo) { e->SetMute(quer, &CTX_SHELL); mudo = quer; }
+ Sleep(16);
}
if (e) e->Release();
if (SUCCEEDED(ci)) CoUninitialize();
diff --git a/src/shell/tray.cpp b/src/shell/tray.cpp
index 36d7bd1..a84f547 100644
--- a/src/shell/tray.cpp
+++ b/src/shell/tray.cpp
@@ -103,9 +103,33 @@ static LRESULT Forward(UINT m, WPARAM w, LPARAM l) {
return SendMessageTimeoutW(ex, m, w, l, SMTO_ABORTIFHUNG | SMTO_NORMAL, 300, &r) ? (LRESULT)r : 0;
}
+// issue #384: SHAppBarMessage chega como WM_COPYDATA com dwData 0 (APPBARMSGDATA3264: hWnd em 32 bits no byte 4,
+// uEdge no byte 12, a mensagem ABM_* no byte 40). O Explorador (escondido) continua tratando; o Shell só anota quem
+// reserva qual borda, porque a área de trabalho é refeita por ele (shell::WorkAreaFor) e apagava a reserva
+static std::vector<tray::AppBar> g_appbars;
+static void AnotaAppBar(const COPYDATASTRUCT* cd) {
+ if (!cd->lpData || cd->cbData < 44) return;
+ const BYTE* b = (const BYTE*)cd->lpData;
+ HWND hw = (HWND)(ULONG_PTR)*(const DWORD*)(b + 4);
+ UINT edge = *(const UINT*)(b + 12), msg = *(const DWORD*)(b + 40);
+ if (!IsWindow(hw) || apps::IsShellWindow(hw)) return;
+ auto it = std::find_if(g_appbars.begin(), g_appbars.end(), [&](const tray::AppBar& a) { return a.hwnd == hw; });
+ if (msg == ABM_REMOVE) { if (it != g_appbars.end()) { g_appbars.erase(it); Log(L"appbar: saiu %p", hw); } }
+ else if (msg == ABM_SETPOS && edge <= ABE_BOTTOM) {
+ if (it == g_appbars.end()) { g_appbars.push_back({ hw, edge }); Log(L"appbar: %p reserva a borda %u", hw, edge); }
+ else it->edge = edge;
+ } else return;
+ SetTimer(g_tray, 384, 400, [](HWND h, UINT, UINT_PTR id, DWORD) { KillTimer(h, id); shell::ApplyWorkArea(); }); // depois de o app se pôr no lugar
+}
+std::vector<tray::AppBar> tray::AppBars() {
+ g_appbars.erase(std::remove_if(g_appbars.begin(), g_appbars.end(), [](const tray::AppBar& a) { return !IsWindow(a.hwnd); }), g_appbars.end());
+ return g_appbars;
+}
+
static LRESULT CALLBACK TrayProc(HWND h, UINT m, WPARAM w, LPARAM l) {
if (m == WM_COPYDATA && l) {
auto* cd = (COPYDATASTRUCT*)l;
+ if (cd->dwData == 0) AnotaAppBar(cd);
if (cd->dwData == 1 && cd->cbData >= 8 + offsetof(NotifyIconData32, szTip)) {
auto* td = (ShellTrayData*)cd->lpData;
NotifyIconData32 n{};