Add panel-wide styles and the Morph hub (#26)

Panel appearance now applies to the whole panel, with seven styles: Floating, Capsules, Notch, Edge to edge, Fused islands, Adaptive and Morph.

- Share composition, geometry, and motion through the renderer-independent `ferese-panel` crate, including native materials, input regions, and Settings previews.
- Add the Morph hub with media, calendar, notifications, controls, workspace previews, hover feedback, and attached mode. Keep recording and low-battery status visible and respect window clearance.
- Cache workspace preview geometry, draw thumbnails directly, centralize Morph transitions, and keep rendering settings local to each shell instance.
- Put Record Screen in the Morph header and show the display control only when an external monitor is connected. Update panel documentation, the desktop screenshot, and native check style names.

Local validation included 660 compositor tests, 191 shell tests, isolated preview-cache checks, GPU Morph captures at 1×/1.25×/1.5×, formatting, and Clippy with warnings denied. The final header change passed all 23 Morph tests. Release workflow jobs are skipped for this PR.
This commit is contained in:
Samuel Onoja authored and GitHub committed 2026-10-12 01:31:34 +01:00
1 parent 42c3b290dd
commit e22f0ebef9
131 files changed
+12562 -1634

No files matched your search

@@ -21,9 +21,10 @@ uniform vec4 tint;
varying vec2 v_coords;
//_CORNERS_
//_MATERIAL_CORNERS_
//_PANEL_MASK_
void main() {
float sdf = rounded_rect_corners_distance(gl_FragCoord.xy, visible_rect, material_radii);
float sdf = material_distance(gl_FragCoord.xy, visible_rect, material_radii);
float coverage = alpha * presentation_alpha * edge_coverage(sdf);
if (coverage <= 0.0) { gl_FragColor = vec4(0.0); return; }
vec2 coords = (gl_FragCoord.xy - capture_origin) / texture_size;
@@ -11,15 +11,16 @@ varying vec2 v_coords;
//_CORNERS_
//_MATERIAL_CORNERS_
//_PANEL_MASK_
void main() {
float sdf = rounded_rect_corners_distance(gl_FragCoord.xy, visible_rect, material_radii);
float sdf = material_distance(gl_FragCoord.xy, visible_rect, material_radii);
float coverage = edge_coverage(sdf);
if (paint_mode > 0.5) {
// The shadow pass is multiplied by (1 - coverage). Fully covered
// pixels need neither a second contour solve nor a Gaussian sample.
if (coverage >= 1.0) { gl_FragColor = vec4(0.0); return; }
float distance = max(rounded_rect_corners_distance(gl_FragCoord.xy, shadow_rect, material_radii), 0.0);
float distance = max(material_distance(gl_FragCoord.xy - (shadow_rect.xy - visible_rect.xy), visible_rect, material_radii), 0.0);
float sigma = max(shadow_values.x * 0.5, 0.5);
float opacity = exp(-0.5 * distance * distance / (sigma * sigma))
* shadow_values.y * (1.0 - coverage) * alpha;
@@ -0,0 +1,58 @@
// The same signed-distance mask is used by tint, blur and shadow. Shapes are
// bounded surface-local geometry transformed into framebuffer coordinates.
uniform float panel_count;
uniform float panel_fusion;
uniform mat3 panel_shapes[32];
float panel_box_distance(vec2 p, vec4 b) {
vec2 q = abs(p - b.xy - b.zw * 0.5) - b.zw * 0.5;
return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0);
}
float panel_round_distance(vec2 p, vec4 b, vec4 r) {
vec2 q = p - b.xy;
float d = panel_box_distance(p, b);
vec2 a = q;
if (r.x > 0.0 && a.x < r.x && a.y < r.x) d = max(d, length(a - r.x) - r.x);
a = vec2(b.z - q.x, q.y);
if (r.y > 0.0 && a.x < r.y && a.y < r.y) d = max(d, length(a - r.y) - r.y);
a = b.zw - q;
if (r.z > 0.0 && a.x < r.z && a.y < r.z) d = max(d, length(a - r.z) - r.z);
a = vec2(q.x, b.w - q.y);
if (r.w > 0.0 && a.x < r.w && a.y < r.w) d = max(d, length(a - r.w) - r.w);
return d;
}
float panel_smin(float a, float b) {
if (panel_fusion <= 0.0) return min(a, b);
float h = max(panel_fusion - abs(a - b), 0.0) / panel_fusion;
return min(a, b) - h * h * panel_fusion * 0.25;
}
float panel_distance(vec2 p) {
vec4 unions = vec4(1.0e8);
float cutout = 1.0e8;
for (int i = 0; i < 32; i++) {
if (float(i) >= panel_count) break;
mat3 m = panel_shapes[i];
vec4 b = vec4(m[0].xyz, m[1].x);
vec4 r = vec4(m[1].yz, m[2].xy);
float op = floor(m[2].z / 4.0);
float zone = mod(m[2].z, 4.0);
float d = panel_round_distance(p, b, r);
if (op > 1.5) {
vec2 c = b.xy;
if (op < 2.5) c.y += b.w;
else if (op < 3.5) c += b.zw;
else if (op < 4.5) c.x += b.z;
d = max(panel_box_distance(p, b), min(b.z, b.w) - length(p - c));
}
if (op > 0.5 && op < 1.5) cutout = min(cutout, d);
else if (zone < 0.5) unions.x = min(unions.x, d);
else if (zone < 1.5) unions.y = panel_smin(unions.y, d);
else if (zone < 2.5) unions.z = panel_smin(unions.z, d);
else unions.w = panel_smin(unions.w, d);
}
return max(min(min(unions.x, unions.y), min(unions.z, unions.w)), -cutout);
}
float material_distance(vec2 p, vec4 b, vec4 r) {
if (panel_count > 0.5) return panel_distance(p);
return rounded_rect_corners_distance(p, b, r);
}