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

Title bars: the strip over Chromium apps only covers the button corners

Eternity07062820c1f04225df
diff --git a/src/janelas/macjanela.cpp b/src/janelas/macjanela.cpp
index 1e1ca19..22e8047 100644
--- a/src/janelas/macjanela.cpp
+++ b/src/janelas/macjanela.cpp
@@ -907,6 +907,33 @@ void Paint(Info* in) {
POINT cc{ cur.left, cur.top }; ScreenToClient(in->owner, &cc);
if (cc.x != c.x || cc.y != c.y || cur.right - cur.left != w || cur.bottom - cur.top != h || GetWindow(in->owner, GW_CHILD) != in->overlay)
SetWindowPos(in->overlay, HWND_TOP, c.x, c.y, w, h, SWP_NOACTIVATE);
+ // a faixa filha só onde ela desenha. O Chromium desenha a linha das abas numa filha IRMÃ
+ // ("Intermediate D3D Window"), e o Windows corta da irmã de baixo o que a filha de cima cobre: a faixa da largura
+ // toda, transparente no meio, deixava a linha inteira escura (Edge com abas na horizontal: abas sumidas; com abas
+ // na vertical: a barra de endereço sumida). Agora a região da faixa é só o canto dos botões do Mac, o canto dos
+ // botões do app e as cópias (grupo, ˅); o resto da linha é do app (e o clique vai direto para ele).
+ if (in->custom) {
+ float s = Scale(in->owner);
+ RECT f = FrameRect(in->owner);
+ int ox = f.left - r.left, oy = f.top - r.top;
+ HRGN rg = CreateRectRgn(0, 0, std::min(w, (int)std::ceil(PatchLeft(in) * s)), h);
+ auto add = [&](int l, int t, int rr, int bb) {
+ l = std::max(0, l); t = std::max(0, t); rr = std::min(w, rr); bb = std::min(h, bb);
+ if (rr <= l || bb <= t) return;
+ HRGN p = CreateRectRgn(l, t, rr, bb);
+ CombineRgn(rg, rg, p, RGN_OR);
+ DeleteObject(p);
+ };
+ add(w - (int)std::ceil(PatchR(in) * s), 0, w, in->barH > 0 ? std::min(h, in->barH) : h); // a da direita: só a linha das abas
+ if (in->chunkW > 0) add(ox + in->chunkDst, oy + in->chunkTop, ox + in->chunkDst + in->chunkW, oy + in->chunkTop + in->chunkH);
+ if (in->setaW > 0) { int x0 = w - (int)std::lround(8 * s) - in->setaW; add(x0, oy + in->setaY, x0 + in->setaW, oy + in->setaY + in->setaH); }
+ if (in->grW > 0) { int x0 = w - (int)std::lround(10 * s) - in->grW; add(x0, oy + in->grTop, x0 + in->grW, oy + in->grTop + in->grH); }
+ HRGN old = CreateRectRgn(0, 0, 0, 0);
+ bool same = GetWindowRgn(in->overlay, old) != ERROR && EqualRgn(old, rg);
+ DeleteObject(old);
+ if (same) DeleteObject(rg);
+ else SetWindowRgn(in->overlay, rg, TRUE); // o Windows fica com a região
+ }
if (in->minis) // a janelinha das miniaturas: no lugar e do tamanho da faixa (o recorte é do Minis)
SetWindowPos(in->minis, nullptr, dst.x, dst.y, w, h, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER);
} else {