[verified] fix: hide notification background only on screen wake

This commit is contained in:
MasterControl committed 2026-11-10 20:33:16 +00:00
1 parent 22df4d76d9
commit 9ddc864b0d
6 files changed
+75 -20

No files matched your search

+12 -8
View File
@@ -6,7 +6,7 @@ import { Layer, LayerActions, LayerContext, LayerStack, PaintBelow } from "../la
import { appViewportRect, appViewportSize, SHELL_OPAQUE_BLACK } from "./geometry";
// The modal box covers most of the min-height app viewport. Retained vector
// clears hide the app outside its opaque rect. Size and position are
// clears optionally hide the app outside its opaque rect. Size and position are
// computed per paint: the display-mode setting changes the viewport size at
// runtime, and the vertical position setting moves the band.
const MODAL_MARGIN = 14;
@@ -34,10 +34,10 @@ export function modalRect(): { x: number; y: number; width: number; height: numb
/**
* A shell overlay hosting an inner layer stack in a bordered box over the
* app viewport (used for new-notification popups). It replaces the shell's
* lower layers. Only the box is opaque, so its cropped image fits the 64 KiB
* resource limit; a resource-free retained list clears the outside margins
* over separate app surfaces. The inner stack paints at the modal's interior
* app viewport (used for new-notification popups). Normally the shell's lower
* layers stay visible. For a wake popup, only the box is opaque (keeping its
* image within 64 KiB), and a resource-free retained list clears the outside
* margins over separate app surfaces. The inner stack paints at the modal's interior
* size; inner value-0 pixels read as black, not transparent.
*/
export class ShellModalLayer implements Layer {
@@ -47,6 +47,8 @@ export class ShellModalLayer implements Layer {
baseLayer: Layer,
actions: LayerActions,
private readonly hooks: {
/** Arrival-time screen state: mask the background only for a wake popup. */
hideBackground?: boolean;
/** The modal left the shell stack, however it went. */
removed?: () => void;
/** Input reached the modal (before its inner stack handles it). */
@@ -60,9 +62,10 @@ export class ShellModalLayer implements Layer {
this.hooks.removed?.();
}
paint(ctx: LayerContext, _paintBelow: PaintBelow): GrayImage {
// Do not call paintBelow: retained chrome/menu animations must not remain
// beneath the notification. Leave the outer margins transparent so the
paint(ctx: LayerContext, paintBelow: PaintBelow): GrayImage {
// Wake popups omit lower chrome, but ordinary popups keep the usual overlay.
if (!this.hooks.hideBackground) paintBelow();
// Leave the outer margins transparent so the
// scene encoder crops to the resource-sized modal, not the whole display.
// Native dim=0 still preserves a 1/0 halftone; clipped CLEAR calls below
// instead produce literal black without changing shared dimming semantics.
@@ -87,6 +90,7 @@ export class ShellModalLayer implements Layer {
image.drawRect(rect.x, rect.y, rect.width, rect.height, 110);
image.bitBlt(inner, innerX, innerY, { transparentZero: true });
top.image.copyPresentationsInto(image, innerX + top.x, innerY + top.y);
if (!this.hooks.hideBackground) return image;
// ShellScene replays retained calls after the opaque box. Clear only the
// complement of that box, keeping the inner menu's presentation order.
// These are vector clips, not tiled image resources; no full-screen image