Option to combine top bar with the app switcher
This commit is contained in:
1 parent
eab839f811
commit
756e21feb8
19 files changed
+462
-168
No files matched your search
@@ -71,7 +71,7 @@ import { loadPersistedOpenApps, savePersistedOpenApps } from "../ui/shell/open-a
|
||||
import { appViewportRect, isOnSwitcherEdge, sidebarStripVisible, type WindowHeightMode } from "../ui/shell/geometry";
|
||||
import { type LayerActions, type TextSettingsEditToggle } from "../ui/layers";
|
||||
import { type KeyboardInputSession } from "../ui/shell/keyboard-input";
|
||||
import { appSwitcherPositionSetting, assistantAllowProactiveSetting, assistantBackendSetting, assistantBridgeHostSetting, assistantBridgePortSetting, assistantBridgeTokenSetting, getBrightnessPreferences, displayModeSetting, navigateDisplayModeSetting, navigateVerticalPositionSetting, terminalDisplayModeSetting, terminalVerticalPositionSetting, elevenLabsApiKeySetting, getStringSettingById, openAiApiKeySetting, nightscoutApiTokenSetting, firmwareDebugFlagsSetting, lockScreenEnabledSetting, nightscoutSiteUrlSetting, onAnySettingChanged, previewColorSetting, ringConnectionModeSetting, saveVoiceRecordingsSetting, sonioxApiKeySetting, screenTimeoutSetting, screenTimeoutSettingToMs, suspendEvenHubWhenScreenOffSetting, verticalPositionSetting, voiceProviderSetting, wakeWordActionSetting, type ConfigSettingString } from "../ui/dashboard-settings";
|
||||
import { appSwitcherPositionSetting, statusBarPositionSetting, assistantAllowProactiveSetting, assistantBackendSetting, assistantBridgeHostSetting, assistantBridgePortSetting, assistantBridgeTokenSetting, getBrightnessPreferences, displayModeSetting, navigateDisplayModeSetting, navigateVerticalPositionSetting, terminalDisplayModeSetting, terminalVerticalPositionSetting, elevenLabsApiKeySetting, getStringSettingById, openAiApiKeySetting, nightscoutApiTokenSetting, firmwareDebugFlagsSetting, lockScreenEnabledSetting, nightscoutSiteUrlSetting, onAnySettingChanged, previewColorSetting, ringConnectionModeSetting, saveVoiceRecordingsSetting, sonioxApiKeySetting, screenTimeoutSetting, screenTimeoutSettingToMs, suspendEvenHubWhenScreenOffSetting, verticalPositionSetting, voiceProviderSetting, wakeWordActionSetting, type ConfigSettingString } from "../ui/dashboard-settings";
|
||||
import { isIgnoringBatteryOptimizations, requestIgnoreBatteryOptimizations } from "../native/battery-optimization";
|
||||
import {
|
||||
getInstalledEvenHubAppById,
|
||||
@@ -182,11 +182,14 @@ const EVEN_APP_DETECTED_MESSAGE =
|
||||
const LAUNCHABLE_APPS = ALL_APPS.filter((app) => app.showInLauncher !== false);
|
||||
|
||||
/**
|
||||
* The global settings window viewport sizes depend on: the display mode, and
|
||||
* whether the app switcher takes width beside windows or height below them.
|
||||
* The global settings window viewport sizes depend on: the display mode,
|
||||
* whether the app switcher takes width beside windows or height below them,
|
||||
* and, below them, whether the status bar joins it (dropping the top bar).
|
||||
*/
|
||||
function viewportSizesKey(): string {
|
||||
return `${displayModeSetting.get()}|${appSwitcherPositionSetting.get() === "bottom" ? "row" : "strip"}`;
|
||||
const switcher = appSwitcherPositionSetting.get() !== "bottom" ? "strip"
|
||||
: statusBarPositionSetting.get() === "switcher" ? "row+status" : "row";
|
||||
return `${displayModeSetting.get()}|${switcher}`;
|
||||
}
|
||||
|
||||
/** The global settings that move window surfaces without resizing them. */
|
||||
|
||||
@@ -26,7 +26,7 @@ export type FirmwareInfo = {
|
||||
};
|
||||
|
||||
/** The Faceclaw firmware revision this build of the app needs. */
|
||||
export const REQUIRED_FACECLAW_FIRMWARE_VERSION = 35;
|
||||
export const REQUIRED_FACECLAW_FIRMWARE_VERSION = 36;
|
||||
|
||||
const FACECLAW_PREFIX = "Faceclaw/";
|
||||
const LEGACY_PREFIX = "EVENCFW";
|
||||
|
||||
@@ -19,7 +19,7 @@ export type FirmwarePatchSet = {
|
||||
export const CFW_PATCH_SET: FirmwarePatchSet = {
|
||||
"base": "g2_2.3.0.24.bin",
|
||||
"baseSha256": "187ccf2bcc5c17a212106e8a376745511e8289c4232b634a7ea94b9bf25a0979",
|
||||
"outputSha256": "354f23f88a4aaf9c56cf62078bf13e814faa25b1fbb4dc69a7754110d6502386",
|
||||
"outputSha256": "0c262bee7ee38b3387426933a8abd631cd6caed9896ababfcd881224686631f8",
|
||||
"patches": [
|
||||
{
|
||||
"offset": 1045797,
|
||||
@@ -210,43 +210,43 @@ export const CFW_PATCH_SET: FirmwarePatchSet = {
|
||||
{
|
||||
"offset": 4537963,
|
||||
"old": "",
|
||||
"new": "b0b581ea00039b0701d0034637e0c2b110f0030315d000f1010ca2f1010e0023cc5c9e45c45403f1010404d0634413f003032346f4d121440319121b102a14d302e00346102a10d3d1f800c0d1f804e0cc688d68103adc609d60c3f804e043f810cb0f2a01f11001eed8042a07d300bf51f8045b043a032a43f8045bf8d8002a08bfb0bd0139013b11f8015f013a03f8015ff9d1b0bd00bf884218bf002a00d1704710b50b1a38bf431a934207d288420ad281ea00039b0726d0034669e0fff79fffbde81040704781ea000300eb020c9b0701eb020e42d15fea8c732bd0a0f1010c00bf8b1813f801ec8418531e04f801ec04d0624412f003021a46f2d101eb030e00eb030c17e0830736d0a2f1010c00f1010e002300bfcc5c9c45c45403f1010404d0734413f003032346f4d1121b2144031922e01346042b0ed3aef10402acf1040152f80449043b032b41f80449f8d802f1040e01f1040c1a4653b1aef10101acf1010300bf11f80149013a03f80149f9d1bde8104070470346042a06d351f8044b043a032a43f8044bf8d8002af0d00139013b00bf11f8014f013a03f8014ff9d1e6e700bf80b5002a18bf10f0030301d186460ce000f1010c864600bf013a0ef8011b04d01cf003030cf1010cf6d1102a11d35ffa81fc4ff001330cfb03fc00bf103acef80cc0cef808c0cef804c04ef810cb0f2af4d8042a0bd35ffa81fc4ff001330cfb03fc00bf043a032a4ef804cbfad8002a08bf80bdaef10103013a03f8011ffbd180bd00bf2de9f04fc7b04ff29c5bc2f2290b4ff6ff754ff47d7400274ff0010847f67f7a7f261191cde90f3007e000bf48f2a351c0f24501bff32f8f8847dbf80090bff35f8fdbf800000321cff680710140b1f1005fbff35f8f0bd101684ef66c62ccf2ff02914204d14068b0f57d7f00f096804ff47d7006f0c8fc002800f0c8814ff60c41cff6ff7100bf42182e3182f8f47382f8f57382f8f67382f8f77382f8f87382f8f97382f8fa7382f8fb7382f8fc7382f8fd7382f8fe7382f8ff7382f8007482f8017482f8027482f8037482f8047482f8057482f8067482f8077482f8087482f8097482f80a7482f80b7482f80c7482f80d7482f80e7482f80f7482f8107482f8117482f8127482f8137482f8147482f8157482f8167482f8177482f8187482f8197482f81a7482f81b7482f81c7482f81d7482f81e7482f81f7482f8207482f82174a0d14ef66c61ccf2ff010160446080f80e80a0f8c4a180f8c361058445848584c584058545858585c585058645868586c586058745878587c5875be8001f49457ff452afbff35f8f4be8000121b15be8001f4945f8d047e74ff47d7800274ff0010a47f67f797f2607e000bf48f2a351c0f24501bff32f8f8847dbf80040bff35f8fdbf800000321cff680710140b1f1005fbff35f8f0bd101684ef66c62ccf2ff02914204d14168b1f57d7f00f098804ff47d7006f006fc002800f006814ff60c41cff6ff7100bf42182e3182f8f47382f8f57382f8f67382f8f77382f8f87382f8f97382f8fa7382f8fb7382f8fc7382f8fd7382f8fe7382f8ff7382f8007482f8017482f8027482f8037482f8047482f8057482f8067482f8077482f8087482f8097482f80a7482f80b7482f80c7482f80d7482f80e7482f80f7482f8107482f8117482f8127482f8137482f8147482f8157482f8167482f8177482f8187482f8197482f81a7482f81b7482f81c7482f81d7482f81e7482f81f7482f8207482f82174a0d14ef66c61ccf2ff010160c0f8048080f80ea0a0f8c49180f8c361058445848584c584058545858585c585058645868586c586058745878587c5875be8001fa1427ff451afbff35f8f00bf4be8000121b15be8001fa142f8d045e7d0f8944242f6f76ac0f2440a002cbff35f8f4bd00af19a0220464ff0ff314ff0ff379047002840f09081119800285fd010980778a7f11700022859d811980c2840f07d81109b58789978084300f07781d8780138022800f272819a79d9795e7a42ea0122197a187942ea014242ea06619a7ade7a93f805c0192f42ea062200f0c981172f40f0df81002a40f05881fe2800f03e86812800f03086002840f045865cea010040f04b8100f092be04460020d047d0b104f5257151e8004f5cb9bff35f8f00bf41e80002002a00f0e38051e8004f002cf6d00021bff32f8f0029bff35f8f00f0d380044694e74ff0ff372ce147f6df40c0f24f000e94804700274ff47d784ff0010947f67f744ff07f0a1397adf8507007e000bf48f2a351c0f24501bff32f8f8847dbf80060bff35f8fdbf800000321cff680710140b1f1005fbff35f8f0bd101684ef66c62ccf2ff02914204d14168b1f57d7f00f09f804ff47d7006f0c0fa002800f097804ff60c41cff6ff7100bf42182e3182f8f47382f8f57382f8f67382f8f77382f8f87382f8f97382f8fa7382f8fb7382f8fc7382f8fd7382f8fe7382f8ff7382f8007482f8017482f8027482f8037482f8047482f8057482f8067482f8077482f8087482f8097482f80a7482f80b7482f80c7482f80d7482f80e7482f80f7482f8107482f8117482f8127482f8137482f8147482f8157482f8167482f8177482f8187482f8197482f81a7482f81b7482f81c7482f81d7482f81e7482f81f7482f8207482f82174a0d14ef66c61ccf2ff010160c0f8048080f80e90a0f8c44180f8c3a1058445848584c584058545858585c585058645868586c586058745878587c5875be8001fb1427ff451afbff35f8f00bf4be8000159b15be8001fb142f8d045e70af5a9718847bfe6012121e70020109f42f6f76ac0f2440a9fb1119989b1397801f07f02b2f10b0418bf0124b2f11c0618bf01268a2928dc0b292ad01c2928d041e00f9012a803f037ff4ff0ff374ff001080e9c9df85100002812a818bf4ff0ff3704f04ff8b8f1000f054608d19df8500028b94af21f30c0f247004c3080470f98002818bf056115e09c2901d08b2919d168b14af21f31c0f247010746884797f8681121b997f824133846109f51b10e9c4ff0ff370af5807120468847384647b0bde8f08f0f9012a804ea060803f0f3fe387800f07f041e2c05d11199384607f048fe0746b4e71d2c00f07e0018bf1a2819d1dbf800100322cff680720a40b2f1005fbff35f8f12d10a684ef66c63ccf2ff039a420bd14a68b2f57d7f04bf002281f8a12303e0a4f115010129e1d90f2c12dc092c00f31781052c00f0c982072c40f0c183cdf8348000274ff0010947f67f764ff07f0852e0142c00f3ea81102c00f08083112c40f0ae8311980e9c022806d13878112803d17878002800f09a864ff0ff3765e7bcf1000f4ff0ff3708bf00298fd11328bff48daf102a4ff0000138bf01211228b2fa82f218bf510901297ff480af00f0c5bc182f4ff0ff3708bfbcf1000f7ff476af00297ff473af352800f34284002800f09c84012800f0aLine truncated
|
||||
"new": "b0b581ea00039b0701d0034637e0c2b110f0030315d000f1010ca2f1010e0023cc5c9e45c45403f1010404d0634413f003032346f4d121440319121b102a14d302e00346102a10d3d1f800c0d1f804e0cc688d68103adc609d60c3f804e043f810cb0f2a01f11001eed8042a07d300bf51f8045b043a032a43f8045bf8d8002a08bfb0bd0139013b11f8015f013a03f8015ff9d1b0bd00bf884218bf002a00d1704710b50b1a38bf431a934207d288420ad281ea00039b0726d0034669e0fff79fffbde81040704781ea000300eb020c9b0701eb020e42d15fea8c732bd0a0f1010c00bf8b1813f801ec8418531e04f801ec04d0624412f003021a46f2d101eb030e00eb030c17e0830736d0a2f1010c00f1010e002300bfcc5c9c45c45403f1010404d0734413f003032346f4d1121b2144031922e01346042b0ed3aef10402acf1040152f80449043b032b41f80449f8d802f1040e01f1040c1a4653b1aef10101acf1010300bf11f80149013a03f80149f9d1bde8104070470346042a06d351f8044b043a032a43f8044bf8d8002af0d00139013b00bf11f8014f013a03f8014ff9d1e6e700bf80b5002a18bf10f0030301d186460ce000f1010c864600bf013a0ef8011b04d01cf003030cf1010cf6d1102a11d35ffa81fc4ff001330cfb03fc00bf103acef80cc0cef808c0cef804c04ef810cb0f2af4d8042a0bd35ffa81fc4ff001330cfb03fc00bf043a032a4ef804cbfad8002a08bf80bdaef10103013a03f8011ffbd180bd00bf2de9f04fc7b04ff29c5bc2f2290b4ff6ff754ff47d7400274ff0010847f67f7a7f261191cde90f3007e000bf48f2a351c0f24501bff32f8f8847dbf80090bff35f8fdbf800000321cff680710140b1f1005fbff35f8f0bd101684ef66c62ccf2ff02914204d14068b0f57d7f00f096804ff47d7006f0c8fc002800f0c8814ff60c41cff6ff7100bf42182e3182f8f47382f8f57382f8f67382f8f77382f8f87382f8f97382f8fa7382f8fb7382f8fc7382f8fd7382f8fe7382f8ff7382f8007482f8017482f8027482f8037482f8047482f8057482f8067482f8077482f8087482f8097482f80a7482f80b7482f80c7482f80d7482f80e7482f80f7482f8107482f8117482f8127482f8137482f8147482f8157482f8167482f8177482f8187482f8197482f81a7482f81b7482f81c7482f81d7482f81e7482f81f7482f8207482f82174a0d14ef66c61ccf2ff010160446080f80e80a0f8c4a180f8c361058445848584c584058545858585c585058645868586c586058745878587c5875be8001f49457ff452afbff35f8f4be8000121b15be8001f4945f8d047e74ff47d7800274ff0010a47f67f797f2607e000bf48f2a351c0f24501bff32f8f8847dbf80040bff35f8fdbf800000321cff680710140b1f1005fbff35f8f0bd101684ef66c62ccf2ff02914204d14168b1f57d7f00f098804ff47d7006f006fc002800f006814ff60c41cff6ff7100bf42182e3182f8f47382f8f57382f8f67382f8f77382f8f87382f8f97382f8fa7382f8fb7382f8fc7382f8fd7382f8fe7382f8ff7382f8007482f8017482f8027482f8037482f8047482f8057482f8067482f8077482f8087482f8097482f80a7482f80b7482f80c7482f80d7482f80e7482f80f7482f8107482f8117482f8127482f8137482f8147482f8157482f8167482f8177482f8187482f8197482f81a7482f81b7482f81c7482f81d7482f81e7482f81f7482f8207482f82174a0d14ef66c61ccf2ff010160c0f8048080f80ea0a0f8c49180f8c361058445848584c584058545858585c585058645868586c586058745878587c5875be8001fa1427ff451afbff35f8f00bf4be8000121b15be8001fa142f8d045e7d0f8944242f6f76ac0f2440a002cbff35f8f4bd00af19a0220464ff0ff314ff0ff379047002840f09081119800285fd010980778a7f11700022859d811980c2840f07d81109b58789978084300f07781d8780138022800f272819a79d9795e7a42ea0122197a187942ea014242ea06619a7ade7a93f805c0192f42ea062200f0c981172f40f0df81002a40f05881fe2800f03e86812800f03086002840f045865cea010040f04b8100f092be04460020d047d0b104f5257151e8004f5cb9bff35f8f00bf41e80002002a00f0e38051e8004f002cf6d00021bff32f8f0029bff35f8f00f0d380044694e74ff0ff372ce147f6df40c0f24f000e94804700274ff47d784ff0010947f67f744ff07f0a1397adf8507007e000bf48f2a351c0f24501bff32f8f8847dbf80060bff35f8fdbf800000321cff680710140b1f1005fbff35f8f0bd101684ef66c62ccf2ff02914204d14168b1f57d7f00f09f804ff47d7006f0c0fa002800f097804ff60c41cff6ff7100bf42182e3182f8f47382f8f57382f8f67382f8f77382f8f87382f8f97382f8fa7382f8fb7382f8fc7382f8fd7382f8fe7382f8ff7382f8007482f8017482f8027482f8037482f8047482f8057482f8067482f8077482f8087482f8097482f80a7482f80b7482f80c7482f80d7482f80e7482f80f7482f8107482f8117482f8127482f8137482f8147482f8157482f8167482f8177482f8187482f8197482f81a7482f81b7482f81c7482f81d7482f81e7482f81f7482f8207482f82174a0d14ef66c61ccf2ff010160c0f8048080f80e90a0f8c44180f8c3a1058445848584c584058545858585c585058645868586c586058745878587c5875be8001fb1427ff451afbff35f8f00bf4be8000159b15be8001fb142f8d045e70af5a9718847bfe6012121e70020109f42f6f76ac0f2440a9fb1119989b1397801f07f02b2f10b0418bf0124b2f11c0618bf01268a2928dc0b292ad01c2928d041e00f9012a803f037ff4ff0ff374ff001080e9c9df85100002812a818bf4ff0ff3704f04ff8b8f1000f054608d19df8500028b94af21f30c0f247004c3080470f98002818bf056115e09c2901d08b2919d168b14af21f31c0f247010746884797f8681121b997f824133846109f51b10e9c4ff0ff370af5807120468847384647b0bde8f08f0f9012a804ea060803f0f3fe387800f07f041e2c05d11199384607f048fe0746b4e71d2c00f07e0018bf1a2819d1dbf800100322cff680720a40b2f1005fbff35f8f12d10a684ef66c63ccf2ff039a420bd14a68b2f57d7f04bf002281f8a12303e0a4f115010129e1d90f2c12dc092c00f31781052c00f0c982072c40f0c183cdf8348000274ff0010947f67f764ff07f0852e0142c00f3ea81102c00f08083112c40f0ae8311980e9c022806d13878112803d17878002800f09a864ff0ff3765e7bcf1000f4ff0ff3708bf00298fd11328bff48daf102a4ff0000138bf01211228b2fa82f218bf510901297ff480af00f0c5bc182f4ff0ff3708bfbcf1000f7ff476af00297ff473af352800f34284002800f09c84012800f0aLine truncated
|
||||
"desc": "append injected blobs to main-app payload"
|
||||
},
|
||||
{
|
||||
"offset": 779123,
|
||||
"old": "805a3900",
|
||||
"new": "186e3a00",
|
||||
"new": "a86f3a00",
|
||||
"desc": "main-app subheader payload size (ps)"
|
||||
},
|
||||
{
|
||||
"offset": 152,
|
||||
"old": "005b3900",
|
||||
"new": "986e3a00",
|
||||
"new": "28703a00",
|
||||
"desc": "main-app TOC entry size (ps + 128)"
|
||||
},
|
||||
{
|
||||
"offset": 779243,
|
||||
"old": "805a3904",
|
||||
"new": "186e3a04",
|
||||
"new": "a86f3a04",
|
||||
"desc": "main-app preamble length (low 24 bits)"
|
||||
},
|
||||
{
|
||||
"offset": 779247,
|
||||
"old": "effdbcea",
|
||||
"new": "cbb2ae81",
|
||||
"new": "a65bcd38",
|
||||
"desc": "[5] ota/s200_firmware_ota.bin preamble crc32"
|
||||
},
|
||||
{
|
||||
"offset": 156,
|
||||
"old": "c0c6322a",
|
||||
"new": "35dc5a11",
|
||||
"new": "27573dd4",
|
||||
"desc": "[5] ota/s200_firmware_ota.bin component crc32c (TOC)"
|
||||
},
|
||||
{
|
||||
"offset": 779127,
|
||||
"old": "c0c6322a",
|
||||
"new": "35dc5a11",
|
||||
"new": "27573dd4",
|
||||
"desc": "[5] ota/s200_firmware_ota.bin component crc32c (subheader)"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -11,11 +11,18 @@ export const DrawOp = { RECT_COPY: 2, IMAGE: 4, ROUNDED_RECT: 8, CLEAR: 9, DRAWS
|
||||
export const DISPLAY_LIST_RECORD = 7;
|
||||
/** Bridge opcode bit: a clip rect follows the call's depth. */
|
||||
const CLIPPED = 128;
|
||||
/** Bridge sentinel for a rounded rect without an outside color. */
|
||||
const NO_OUTSIDE = 16;
|
||||
export type ListImage = { readonly width: number; readonly height: number; readonly pixels: Uint8Array };
|
||||
/** Revision 35: a call draws only inside its clip, in list coordinates (and moves with its depth). */
|
||||
export type ListClip = { readonly x: number; readonly y: number; readonly width: number; readonly height: number };
|
||||
export type ListCall = (
|
||||
| { op: typeof DrawOp.ROUNDED_RECT; x: DrawValue; y: DrawValue; width: number; height: number; radius: number; background: number; border: number }
|
||||
/**
|
||||
* The background max-blends (0 leaves the interior alone); border 16 draws no
|
||||
* outline. `outside` (revision 36) colors the box's pixels outside the
|
||||
* rounded shape, cutting what is underneath to the corners.
|
||||
*/
|
||||
| { op: typeof DrawOp.ROUNDED_RECT; x: DrawValue; y: DrawValue; width: number; height: number; radius: number; background: number; border: number; outside?: number }
|
||||
| { op: typeof DrawOp.IMAGE; resource: number; x: number; y: number; transparent: boolean }
|
||||
| { op: typeof DrawOp.RECT_COPY; resource: number; x: DrawValue; y: DrawValue; width: number; height: number; dx: DrawValue; dy: DrawValue }
|
||||
/** Fill with a 4-bit color: the clip rect when there is one, else the whole screen. */
|
||||
@@ -88,6 +95,7 @@ export function encodeDisplayList(placed: PlacedDisplayList, now = Date.now()):
|
||||
out.raw(encodeValue(call.x)); out.raw(encodeValue(call.y));
|
||||
out.u16(integer(call.width, 1, 640)); out.u16(integer(call.height, 1, 480)); out.u16(call.radius);
|
||||
out.u8(integer(call.background, 0, 15)); out.u8(integer(call.border, 0, 16));
|
||||
out.u8(call.outside === undefined ? NO_OUTSIDE : integer(call.outside, 0, 15));
|
||||
} else if (call.op === DrawOp.CLEAR) {
|
||||
out.u8(integer(call.color, 0, 15));
|
||||
} else if (call.op === DrawOp.DRAWS) {
|
||||
@@ -127,7 +135,11 @@ export function readDisplayList(bytes: Uint8Array, offset: number, now = Date.no
|
||||
const header = r.u8(), op = header & ~CLIPPED, callDepth = r.i16();
|
||||
const clip = header & CLIPPED ? { x: r.i16(), y: r.i16(), width: r.u16(), height: r.u16() } : undefined;
|
||||
const common = clip ? { depth: callDepth, clip } : { depth: callDepth };
|
||||
if (op === DrawOp.ROUNDED_RECT) calls.push({ op, ...common, x: readValue(r), y: readValue(r), width: r.u16(), height: r.u16(), radius: r.u16(), background: r.u8(), border: r.u8() });
|
||||
if (op === DrawOp.ROUNDED_RECT) {
|
||||
const call = { op, ...common, x: readValue(r), y: readValue(r), width: r.u16(), height: r.u16(), radius: r.u16(), background: r.u8(), border: r.u8() };
|
||||
const outside = r.u8();
|
||||
calls.push(outside === NO_OUTSIDE ? call : { ...call, outside });
|
||||
}
|
||||
else if (op === DrawOp.IMAGE) calls.push({ op, ...common, resource: r.u16(), x: r.i16(), y: r.i16(), transparent: (r.u8() & 16) !== 0 });
|
||||
else if (op === DrawOp.RECT_COPY) calls.push({ op, ...common, resource: r.u16(), x: readValue(r), y: readValue(r), width: r.u16(), height: r.u16(), dx: readValue(r), dy: readValue(r) });
|
||||
else if (op === DrawOp.CLEAR) calls.push({ op, ...common, color: r.u8() });
|
||||
@@ -157,7 +169,8 @@ export function dimDisplayList(list: DisplayList, factor: number): DisplayList {
|
||||
if (list.calls.some(c => c.op === DrawOp.DRAWS)) return { ...list, calls: [] };
|
||||
const dim = (v: number) => v === 0 ? 0 : Math.max(1, Math.round(v * factor));
|
||||
return { ...list, resources: list.resources.map(r => ({ ...r, pixels: r.pixels.map(dim) })),
|
||||
calls: list.calls.map(c => c.op === DrawOp.ROUNDED_RECT ? { ...c, background: Math.min(15, Math.round(c.background * factor)), border: c.border === 16 ? 16 : Math.min(15, Math.round(c.border * factor)) }
|
||||
calls: list.calls.map(c => c.op === DrawOp.ROUNDED_RECT ? { ...c, background: Math.min(15, Math.round(c.background * factor)), border: c.border === 16 ? 16 : Math.min(15, Math.round(c.border * factor)),
|
||||
...(c.outside === undefined ? {} : { outside: Math.min(15, Math.round(c.outside * factor)) }) }
|
||||
: c.op === DrawOp.CLEAR ? { ...c, color: Math.min(15, Math.round(c.color * factor)) } : c) };
|
||||
}
|
||||
|
||||
@@ -191,8 +204,12 @@ export function paintDisplayList(output: Uint8Array, screen: Uint8Array, width:
|
||||
} else if (c.op === DrawOp.ROUNDED_RECT) {
|
||||
const x = placed.x + evaluate(c.x, elapsed, presentTime).value + shift, y = placed.y + evaluate(c.y, elapsed, presentTime).value;
|
||||
for (let yy = 0; yy < c.height; yy++) for (let xx = 0; xx < c.width; xx++) {
|
||||
if (!writable(x + xx, y + yy) || !inside(xx, yy, c.width, c.height, c.radius)) continue;
|
||||
if (!writable(x + xx, y + yy)) continue;
|
||||
const p = (y + yy) * width + x + xx;
|
||||
if (!inside(xx, yy, c.width, c.height, c.radius)) {
|
||||
if (c.outside !== undefined) output[p] = c.outside * 16;
|
||||
continue;
|
||||
}
|
||||
output[p] = c.border !== 16 && !inside(xx - 1, yy - 1, c.width - 2, c.height - 2, Math.max(0, c.radius - 1)) ? c.border * 16 : Math.max(output[p], c.background * 16);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -393,6 +393,25 @@ export const uiDepthSetting = new ConfigSettingEnum<UiDepth>({
|
||||
"Moves the whole display nearer (positive) or farther away (negative) by shifting it in opposite directions on the two lenses. Available with the app switcher at the bottom. Full-panel windows lose a sliver at the edges.",
|
||||
});
|
||||
|
||||
/**
|
||||
* Where the status bar (clock, notification icons, app widgets, batteries)
|
||||
* goes: the top bar over each window, or the right end of a bottom app
|
||||
* switcher's row (geometry.ts statusInSwitcherRow), where windows grow into
|
||||
* the top bar's height.
|
||||
*/
|
||||
export type StatusBarPosition = "top" | "switcher";
|
||||
|
||||
export const statusBarPositionSetting = new ConfigSettingEnum<StatusBarPosition>({
|
||||
id: "status-bar-position",
|
||||
label: "Status bar",
|
||||
storageKey: "display.statusBarPosition",
|
||||
defaultValue: "top",
|
||||
values: ["top", "switcher"],
|
||||
formatValue: (value) => value === "switcher" ? "With app switcher" : "Top",
|
||||
description:
|
||||
"Where the clock, notification icons, app widgets and battery indicators go. With app switcher puts them at the right end of the app switcher's row, and windows grow into the top bar's space. Available with the app switcher at the bottom; the full-panel display mode keeps the top bar. Changing it reopens open apps in the new size.",
|
||||
});
|
||||
|
||||
export const brightnessSetting = new ConfigSettingEnum<BrightnessSetting>({
|
||||
id: "brightness",
|
||||
label: "Brightness",
|
||||
|
||||
@@ -29,6 +29,7 @@ import { shell } from "../shell/shell";
|
||||
import {
|
||||
anthropicApiKeySetting,
|
||||
appSwitcherPositionSetting,
|
||||
statusBarPositionSetting,
|
||||
uiDepthSetting,
|
||||
assistantAllowProactiveSetting,
|
||||
assistantBackendSetting,
|
||||
@@ -243,6 +244,9 @@ function customizationRows(): () => MenuItem[] {
|
||||
const position = enumSettingMenuItem(appSwitcherPositionSetting);
|
||||
// The whole display's stereo depth; the shell sends it with its scene.
|
||||
const depth = enumSettingMenuItem(uiDepthSetting);
|
||||
// Top bar, or the right end of the switcher row; the dashboard controller
|
||||
// resizes windows on change.
|
||||
const statusBar = enumSettingMenuItem(statusBarPositionSetting);
|
||||
const rest = [
|
||||
// Submenu: top-bar battery indicator style plus per-device visibility.
|
||||
batteryIndicatorsMenuItem(),
|
||||
@@ -253,7 +257,7 @@ function customizationRows(): () => MenuItem[] {
|
||||
// Opens the modal font picker (face, weight, size) for UI text.
|
||||
uiFontPickerMenuItem(),
|
||||
];
|
||||
const withDepth = [position, depth, ...rest], withoutDepth = [position, ...rest];
|
||||
const withDepth = [position, depth, statusBar, ...rest], withoutDepth = [position, ...rest];
|
||||
return () => appSwitcherPositionSetting.get() === "bottom" ? withDepth : withoutDepth;
|
||||
}
|
||||
|
||||
|
||||
+149
-69
@@ -1,6 +1,7 @@
|
||||
import { shellCrop } from "../../graphics/shell-scene";
|
||||
import type { Plane } from "../../graphics/plane";
|
||||
import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage } from "../../graphics/image";
|
||||
import { DrawOp } from "../../graphics/display-list";
|
||||
import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage, grayToNibble } from "../../graphics/image";
|
||||
import { getDefaultMediumFont, getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { truncateText } from "../../graphics/textwrap";
|
||||
import { activeAmbientCards } from "./ambient-cards";
|
||||
@@ -31,11 +32,13 @@ import {
|
||||
SHELL_OPAQUE_BLACK,
|
||||
SIDEBAR_WIDTH,
|
||||
sidebarStripVisible,
|
||||
statusInSwitcherRow,
|
||||
SWITCHER_ROW_HEIGHT,
|
||||
switcherPosition,
|
||||
switcherRect,
|
||||
TOP_BAR_HEIGHT,
|
||||
windowFramed,
|
||||
windowHeaderHeight,
|
||||
windowTop,
|
||||
type WindowHeightMode,
|
||||
} from "./geometry";
|
||||
@@ -63,6 +66,21 @@ const LIST_HEIGHT = MIN_WINDOW_HEIGHT - TOP_BAR_HEIGHT - 2 * LIST_MARGIN;
|
||||
const ROW_ICON_SIZE = SWITCHER_ROW_HEIGHT - 4;
|
||||
const ROW_STEP = ROW_ICON_SIZE + ICON_SPACING;
|
||||
|
||||
// The status bar in the switcher row (geometry.ts statusInSwitcherRow) keeps
|
||||
// the top bar's layout, so every element sits as it does there: its 28 rows
|
||||
// (whose last is the divider, which the row has no use for) centred in the
|
||||
// row below its separator line.
|
||||
const ROW_STATUS_TOP = 1 + ((SWITCHER_ROW_HEIGHT - TOP_BAR_HEIGHT) >> 1);
|
||||
// Its clock ends this far from the row's right end, as the top bar's starts
|
||||
// from its left; batteries keep the top bar's clock-to-icons gap from it.
|
||||
const ROW_STATUS_EDGE_MARGIN = 10;
|
||||
const ROW_CLOCK_GAP = 16;
|
||||
// Between the windows' end of the row (its scroll chevron) and the status.
|
||||
const ROW_STATUS_GAP = 8;
|
||||
// Notification icons stop short of room for this many windows' slots (or
|
||||
// all of them, when there are fewer); the windows take whatever is left.
|
||||
const ROW_MIN_WINDOW_SLOTS = 3;
|
||||
|
||||
/** Icon rows that fit in one sidebar column. */
|
||||
function rowsPerColumn(variant: SidebarVariant): number {
|
||||
return Math.max(1, ((LIST_HEIGHT + ICON_SPACING) / (variant.iconSize + ICON_SPACING)) | 0);
|
||||
@@ -107,15 +125,20 @@ type SwitcherLayout = {
|
||||
cell: (slot: number) => SwitcherCell;
|
||||
};
|
||||
|
||||
/** Switcher geometry for the foreground window (a bottom row sits under it). */
|
||||
function switcherLayout(windowCount: number, heightMode: WindowHeightMode, appId?: string): SwitcherLayout {
|
||||
/**
|
||||
* Switcher geometry for the foreground window (a bottom row sits under it).
|
||||
* `windowsRight` is where a bottom row's window icons must end: short of
|
||||
* the status bar when it shares the row.
|
||||
*/
|
||||
function switcherLayout(windowCount: number, heightMode: WindowHeightMode, appId?: string, windowsRight?: number): SwitcherLayout {
|
||||
const position = switcherPosition();
|
||||
if (position === "bottom") {
|
||||
const row = switcherRect(heightMode, appId);
|
||||
const width = (windowsRight ?? row.x + row.width) - row.x;
|
||||
return {
|
||||
position,
|
||||
iconSize: ROW_ICON_SIZE,
|
||||
visibleCount: Math.max(1, ((row.width - 2 * LIST_MARGIN + ICON_SPACING) / ROW_STEP) | 0),
|
||||
visibleCount: Math.max(1, ((width - 2 * LIST_MARGIN + ICON_SPACING) / ROW_STEP) | 0),
|
||||
cell: (slot) => ({
|
||||
x: row.x + LIST_MARGIN - 2 + slot * ROW_STEP, y: row.y, width: ROW_ICON_SIZE + 4, height: SWITCHER_ROW_HEIGHT,
|
||||
atSeparator: true,
|
||||
@@ -280,18 +303,21 @@ export function makeImageWindowIcon(
|
||||
export class ShellChromeLayer implements Layer {
|
||||
// First switcher icon shown; adjusted each paint to keep the selection visible.
|
||||
private scrollRow = 0;
|
||||
// Where the last paint ended a bottom row's window icons, for hit testing.
|
||||
private rowWindowsRight: number | undefined;
|
||||
|
||||
constructor(private readonly getState: () => ShellChromeState) {}
|
||||
|
||||
paint(): GrayImage {
|
||||
const image = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
|
||||
const state = this.getState();
|
||||
const statusInRow = statusInSwitcherRow(state.foregroundAppId);
|
||||
// Full-panel mode: the strip is an overlay, present only while the user
|
||||
// is in it (the window underneath keeps its full width the rest of the time).
|
||||
if (sidebarStripVisible(state.focus, state.foregroundAppId)) {
|
||||
this.drawSidebar(image, state);
|
||||
this.drawSidebar(image, state, statusInRow ? image : undefined);
|
||||
}
|
||||
this.drawTopBar(image, state);
|
||||
if (!statusInRow) this.drawTopBar(image, state);
|
||||
const frame = windowFrameRect(state);
|
||||
if (frame) drawWindowFrame(image, frame);
|
||||
drawAmbientCards(image, topBarSpan(state).right);
|
||||
@@ -300,29 +326,32 @@ export class ShellChromeLayer implements Layer {
|
||||
|
||||
paintParts(): Plane[] {
|
||||
const state = this.getState(), parts: Plane[] = [];
|
||||
if (sidebarStripVisible(state.focus, state.foregroundAppId)) {
|
||||
const canvas = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
|
||||
this.drawSidebar(canvas, state);
|
||||
const strip = switcherRect(state.foregroundHeightMode, state.foregroundAppId);
|
||||
parts.push(shellCrop(canvas, strip.x, strip.y, strip.width, strip.height, 1));
|
||||
}
|
||||
const statusInRow = statusInSwitcherRow(state.foregroundAppId);
|
||||
const canvas = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
|
||||
this.drawTopBar(canvas, state);
|
||||
const bar = topBarSpan(state);
|
||||
parts.push({ ...shellCrop(canvas, bar.left, windowTop(state.foregroundHeightMode, state.foregroundAppId), bar.right - bar.left, TOP_BAR_HEIGHT, 2), depth: -2 });
|
||||
const frame = windowFrameRect(state);
|
||||
if (frame) {
|
||||
// Over the top bar, whose bottom row it shares, but at the screen's
|
||||
// own depth rather than the bar's -2, which on top of a -62 screen
|
||||
// depth would shift a side off the screen. Split into its two sides
|
||||
// (corners included) and the top between them, as one surface would
|
||||
// be almost all transparent.
|
||||
const frameCanvas = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
|
||||
drawWindowFrame(frameCanvas, frame);
|
||||
const [leftKey, rightKey, topKey] = windowFrameKeys(), sideHeight = frame.height - 1;
|
||||
parts.push(shellCrop(frameCanvas, frame.x, frame.y, FRAME_RADIUS, sideHeight, leftKey));
|
||||
parts.push(shellCrop(frameCanvas, frame.x + frame.width - FRAME_RADIUS, frame.y, FRAME_RADIUS, sideHeight, rightKey));
|
||||
parts.push(shellCrop(frameCanvas, frame.x + FRAME_RADIUS, frame.y, frame.width - 2 * FRAME_RADIUS, 1, topKey));
|
||||
if (!statusInRow) {
|
||||
this.drawTopBar(canvas, state);
|
||||
parts.push({ ...shellCrop(canvas, bar.left, windowTop(state.foregroundHeightMode, state.foregroundAppId), bar.right - bar.left, TOP_BAR_HEIGHT, 2), depth: -2 });
|
||||
}
|
||||
if (sidebarStripVisible(state.focus, state.foregroundAppId)) {
|
||||
const stripCanvas = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
|
||||
const statusLeft = this.drawSidebar(stripCanvas, state, statusInRow ? canvas : undefined);
|
||||
// The window frame rides on the switcher row, whose top edge is its
|
||||
// bottom side, and so replays after any top bar, whose bottom row is
|
||||
// its top. It plays at the screen's own depth rather than the bar's
|
||||
// -2, which on top of a -62 screen depth would shift a side off the
|
||||
// screen. (A framed window always has the row on screen.)
|
||||
const frame = windowFrameRect(state);
|
||||
if (frame) drawWindowFrame(stripCanvas, frame);
|
||||
const strip = switcherRect(state.foregroundHeightMode, state.foregroundAppId);
|
||||
parts.push(shellCrop(stripCanvas, strip.x, strip.y, strip.width, strip.height, 1));
|
||||
if (statusLeft !== null) {
|
||||
// The status bar keeps the top bar's surface and its depth, -2, over
|
||||
// the row's right end below its separator line, so the clock ticking
|
||||
// doesn't resend the window icons.
|
||||
const right = strip.x + strip.width;
|
||||
parts.push({ ...shellCrop(canvas, statusLeft, strip.y + 1, right - statusLeft, strip.height - 1, 2), depth: -2 });
|
||||
}
|
||||
}
|
||||
drawAmbientCards(canvas, bar.right, parts);
|
||||
return parts;
|
||||
@@ -341,7 +370,7 @@ export class ShellChromeLayer implements Layer {
|
||||
windowIndexAt(x: number, y: number, windowCount: number): number | null {
|
||||
if (windowCount === 0) return null;
|
||||
const state = this.getState();
|
||||
const layout = switcherLayout(windowCount, state.foregroundHeightMode, state.foregroundAppId);
|
||||
const layout = switcherLayout(windowCount, state.foregroundHeightMode, state.foregroundAppId, this.rowWindowsRight);
|
||||
const lastVisible = Math.min(windowCount, this.scrollRow + layout.visibleCount);
|
||||
for (let index = this.scrollRow; index < lastVisible; index++) {
|
||||
const cell = layout.cell(index - this.scrollRow);
|
||||
@@ -352,7 +381,13 @@ export class ShellChromeLayer implements Layer {
|
||||
return null;
|
||||
}
|
||||
|
||||
private drawSidebar(image: GrayImage, state: ShellChromeState): void {
|
||||
/**
|
||||
* Draw the switcher strip or row. Given `statusImage`, a bottom row shares
|
||||
* its right end with the status bar, drawn there (into that image, which
|
||||
* may be this one) first, and the window icons take what it leaves.
|
||||
* Returns the status bar's left edge, or null without one.
|
||||
*/
|
||||
private drawSidebar(image: GrayImage, state: ShellChromeState, statusImage?: GrayImage): number | null {
|
||||
// A side strip aligns with the app's preferred band (legacy tall
|
||||
// terminal sessions keep it at the global band position); a bottom row
|
||||
// sits under the foreground window.
|
||||
@@ -365,7 +400,11 @@ export class ShellChromeLayer implements Layer {
|
||||
// visible slot's column is decided by its position within the scrolled
|
||||
// window.
|
||||
const count = state.windows.length;
|
||||
const layout = switcherLayout(count, state.foregroundHeightMode, state.foregroundAppId);
|
||||
const statusLeft = statusImage && switcherPosition() === "bottom"
|
||||
? this.drawRowStatus(statusImage, state, strip, count) : null;
|
||||
const windowsRight = statusLeft === null ? strip.x + strip.width : statusLeft - ROW_STATUS_GAP;
|
||||
this.rowWindowsRight = windowsRight;
|
||||
const layout = switcherLayout(count, state.foregroundHeightMode, state.foregroundAppId, windowsRight);
|
||||
const { iconSize, position } = layout;
|
||||
this.scrollRow = scrollToKeepSelectionVisible(this.scrollRow, state.selectedIndex, layout.visibleCount, count);
|
||||
const lastVisible = Math.min(count, this.scrollRow + layout.visibleCount);
|
||||
@@ -410,15 +449,15 @@ export class ShellChromeLayer implements Layer {
|
||||
}
|
||||
|
||||
if (position === "bottom") {
|
||||
// Chevrons sit in the row's end margins, pointing off either end.
|
||||
// Chevrons sit in the margins at either end of the icons, pointing off them.
|
||||
const chevronY = strip.y + ((strip.height / 2) | 0);
|
||||
if (this.scrollRow > 0) {
|
||||
drawChevron(image, strip.x + 6, chevronY, "left");
|
||||
}
|
||||
if (lastVisible < count) {
|
||||
drawChevron(image, strip.x + strip.width - 6, chevronY, "right");
|
||||
drawChevron(image, windowsRight - 6, chevronY, "right");
|
||||
}
|
||||
return;
|
||||
return statusLeft;
|
||||
}
|
||||
// Chevrons center over the icon area, which in the one-column variant is
|
||||
// narrower than the sidebar strip.
|
||||
@@ -430,6 +469,45 @@ export class ShellChromeLayer implements Layer {
|
||||
if (lastVisible < count) {
|
||||
drawChevron(image, chevronX, strip.y + strip.height - 6, "down");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The status bar at the right end of the switcher row, right to left:
|
||||
* date and time, batteries, app widgets, then notification icons, each as
|
||||
* it sits in the top bar (see ROW_STATUS_TOP). Notification icons stop
|
||||
* short of room for a few window slots; the windows get the rest, and
|
||||
* whatever they leave over is free space between the two. Returns the
|
||||
* left edge of what it drew.
|
||||
*/
|
||||
private drawRowStatus(image: GrayImage, state: ShellChromeState, row: Rect, windowCount: number): number {
|
||||
image.fillRect(row.x, row.y + 1, row.width, row.height - 1, SHELL_OPAQUE_BLACK);
|
||||
const top = row.y + ROW_STATUS_TOP;
|
||||
const font = getDefaultMediumFont();
|
||||
const clock = clockText();
|
||||
const clockX = row.x + row.width - ROW_STATUS_EDGE_MARGIN - font.measureText(clock);
|
||||
image.drawText(font, clockX, top + Math.max(0, ((TOP_BAR_HEIGHT - font.lineHeight) / 2) | 0), clock, 210);
|
||||
// The battery block keeps its usual right margin inside the edge it's given.
|
||||
const batteryLeft = this.drawTopBarBatteries(image, state, top, clockX - ROW_CLOCK_GAP + BATTERY_BLOCK_RIGHT_MARGIN);
|
||||
const trayLeft = drawTrayIcons(image, state.trayIcons, batteryLeft, top);
|
||||
|
||||
// Right-aligned against the widgets, with the top bar's spacing.
|
||||
const slots = Math.min(windowCount, ROW_MIN_WINDOW_SLOTS);
|
||||
const windowsFloor = row.x + 2 * LIST_MARGIN + Math.max(0, slots * ROW_STEP - ICON_SPACING) + ROW_STATUS_GAP;
|
||||
const iconsRight = trayLeft - 8, step = NOTIFICATION_ICON_SIZE + 4;
|
||||
const maxIcons = Math.max(0, ((iconsRight - windowsFloor + 4) / step) | 0);
|
||||
if (maxIcons === 0) return trayLeft;
|
||||
const { icons, stale } = readActiveNotificationIcons(maxIcons, renderPassAllowsStaleData());
|
||||
if (stale) {
|
||||
noteStaleDataUsed();
|
||||
}
|
||||
if (!icons.length) return trayLeft;
|
||||
const iconsLeft = iconsRight - icons.length * step + 4;
|
||||
const iconY = top + (((TOP_BAR_HEIGHT - NOTIFICATION_ICON_SIZE) / 2) | 0);
|
||||
for (let index = 0; index < icons.length; index++) {
|
||||
image.drawImage(icons[index]!, iconsLeft + index * step, iconY);
|
||||
}
|
||||
return iconsLeft;
|
||||
}
|
||||
|
||||
private drawTopBar(image: GrayImage, state: ShellChromeState): void {
|
||||
@@ -447,8 +525,7 @@ export class ShellChromeLayer implements Layer {
|
||||
image.drawLine(barLeft, barTop + TOP_BAR_HEIGHT - 1, barRight - 1, barTop + TOP_BAR_HEIGHT - 1, BORDER_VALUE);
|
||||
}
|
||||
|
||||
const now = new Date();
|
||||
const clock = `${formatClockDate(now)} ${formatClockTime(now)}`;
|
||||
const clock = clockText();
|
||||
const clockX = barLeft + 10;
|
||||
const textY = barTop + Math.max(0, ((TOP_BAR_HEIGHT - font.lineHeight) / 2) | 0);
|
||||
image.drawText(font, clockX, textY, clock, 210);
|
||||
@@ -545,6 +622,12 @@ export class ShellChromeLayer implements Layer {
|
||||
|
||||
type BatteryItem = { label: string; device: BatteryDevice; percent: number; charging: boolean };
|
||||
|
||||
/** The status bar's date and time. */
|
||||
function clockText(): string {
|
||||
const now = new Date();
|
||||
return `${formatClockDate(now)} ${formatClockTime(now)}`;
|
||||
}
|
||||
|
||||
const BATTERY_BLOCK_RIGHT_MARGIN = 8;
|
||||
const BATTERY_LABEL_VALUE = 150;
|
||||
|
||||
@@ -629,7 +712,7 @@ const AMBIENT_MAX_LINES_PER_CARD = 3;
|
||||
/**
|
||||
* Paint the active ambient cards bottom-up: the oldest card sits at the very
|
||||
* bottom of the window band and newer ones stack above it. Cards that would
|
||||
* cross into the top bar are dropped rather than clipped. `right` is the
|
||||
* cross into the window header are dropped rather than clipped. `right` is the
|
||||
* top bar's right edge, which the cards align to.
|
||||
*/
|
||||
const ambientKeys = new Map<string, number>();
|
||||
@@ -647,7 +730,7 @@ function drawAmbientCards(image: GrayImage, right: number, parts?: Plane[]): voi
|
||||
const lines = [card.title, ...card.lines].slice(0, 1 + AMBIENT_MAX_LINES_PER_CARD);
|
||||
const height = 2 * AMBIENT_CARD_PADDING_Y + lines.length * lineStep(font);
|
||||
const y = bottom - height;
|
||||
if (y < bandTop + TOP_BAR_HEIGHT) break;
|
||||
if (y < bandTop + windowHeaderHeight()) break;
|
||||
const target = parts ? new GrayImage(image.width, image.height, 0) : image;
|
||||
target.fillRect(x, y, AMBIENT_CARD_WIDTH, height, SHELL_OPAQUE_BLACK);
|
||||
target.drawRect(x, y, AMBIENT_CARD_WIDTH, height, 90);
|
||||
@@ -701,12 +784,13 @@ type Rect = { x: number; y: number; width: number; height: number };
|
||||
const FRAME_RADIUS = 8;
|
||||
|
||||
/**
|
||||
* The rounded frame around the foreground window's content (below its top
|
||||
* bar), when it has one (geometry.ts windowFramed): one pixel all round.
|
||||
* The rounded frame around the foreground window's content (below its
|
||||
* header), when it has one (geometry.ts windowFramed): one pixel all round.
|
||||
* Its sides run down the pixel just outside each side of the window, and
|
||||
* its top is the top bar's bottom row, in place of the bar's divider. Its
|
||||
* bottom is the switcher row's top edge, where drawSeparator draws it so
|
||||
* the selection tab can divert it.
|
||||
* its top is the header's last row: the top bar's, in place of the bar's
|
||||
* divider, or the whole one-row header with the status bar in the switcher
|
||||
* row. Its bottom is the switcher row's top edge, where drawSeparator draws
|
||||
* it so the selection tab can divert it.
|
||||
*/
|
||||
function windowFrameRect(state: ShellChromeState): Rect | null {
|
||||
if (!windowFramed(state.foregroundAppId)) return null;
|
||||
@@ -714,34 +798,31 @@ function windowFrameRect(state: ShellChromeState): Rect | null {
|
||||
return { x: viewport.x - 1, y: viewport.y - 1, width: viewport.width + 2, height: viewport.height + 2 };
|
||||
}
|
||||
|
||||
/** Shell surface keys of the window frame's left side, right side and top. */
|
||||
let frameKeys: [number, number, number] | undefined;
|
||||
function windowFrameKeys(): [number, number, number] {
|
||||
if (!frameKeys) frameKeys = [LayerStack.allocateShellKey(), LayerStack.allocateShellKey(), LayerStack.allocateShellKey()];
|
||||
return frameKeys;
|
||||
/**
|
||||
* Draw the window frame (see windowFrameRect) as one retained firmware
|
||||
* rounded rect over whatever lies beneath it: no fill, so the window's
|
||||
* content shows through, and black outside the curve, cutting the content's
|
||||
* square corners to it. It is clipped short of its bottom row, which
|
||||
* drawSeparator draws with the selection tab's gap.
|
||||
*/
|
||||
function drawWindowFrame(image: GrayImage, frame: Rect): void {
|
||||
image.drawDisplayList({ resources: [], calls: [{
|
||||
op: DrawOp.ROUNDED_RECT, x: 0, y: 0, width: frame.width, height: frame.height, radius: FRAME_RADIUS,
|
||||
background: 0, border: grayToNibble(BORDER_VALUE), outside: 0,
|
||||
clip: { x: 0, y: 0, width: frame.width, height: frame.height - 1 },
|
||||
}] }, frame.x, frame.y, frame.width, frame.height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the window frame (see windowFrameRect) but for its bottom row,
|
||||
* stroked line by line like the selection tab's outline. Outside each
|
||||
* rounded corner it paints opaque black, so the window's square corners
|
||||
* don't show past the curve. Everything but the top's straight run lies
|
||||
* within FRAME_RADIUS of the sides.
|
||||
* How far in from the frame's sides its top and bottom rows start: the
|
||||
* first pixel whose centre passes the firmware's rounded-rect test, which
|
||||
* the separator must match to join the corners.
|
||||
*/
|
||||
function drawWindowFrame(image: GrayImage, frame: Rect): void {
|
||||
const { x, y, width, height } = frame;
|
||||
for (let i = 0; i < height - 1; i++) {
|
||||
const outer = tabInset(i, 0, height, FRAME_RADIUS);
|
||||
image.fillRect(x, y + i, outer, 1, SHELL_OPAQUE_BLACK);
|
||||
image.fillRect(x + width - outer, y + i, outer, 1, SHELL_OPAQUE_BLACK);
|
||||
if (i === 0) {
|
||||
image.fillRect(x + outer, y, width - 2 * outer, 1, BORDER_VALUE);
|
||||
continue;
|
||||
}
|
||||
const stroke = Math.max(1, 1 + tabInset(i, 1, height - 1, FRAME_RADIUS - 1) - outer);
|
||||
image.fillRect(x + outer, y + i, stroke, 1, BORDER_VALUE);
|
||||
image.fillRect(x + width - outer - stroke, y + i, stroke, 1, BORDER_VALUE);
|
||||
}
|
||||
function frameEdgeInset(): number {
|
||||
const r = FRAME_RADIUS, dy = 2 * r - 1;
|
||||
let inset = 0;
|
||||
while (inset < r && (2 * (r - inset) - 1) ** 2 + dy * dy > 4 * r * r) inset++;
|
||||
return inset;
|
||||
}
|
||||
|
||||
const TAB_RADIUS = 6;
|
||||
@@ -763,9 +844,8 @@ function drawSeparator(
|
||||
// Along the row's top edge: the full width of the row, or between the
|
||||
// corners of the window frame, whose bottom side this is.
|
||||
const frame = windowFrameRect(state);
|
||||
const inset = frame ? tabInset(frame.height - 1, 0, frame.height, FRAME_RADIUS) : 0;
|
||||
const left = frame ? frame.x + inset : strip.x;
|
||||
const right = frame ? frame.x + frame.width - 1 - inset : strip.x + strip.width - 1;
|
||||
const left = frame ? frame.x + frameEdgeInset() : strip.x;
|
||||
const right = frame ? frame.x + frame.width - 1 - frameEdgeInset() : strip.x + strip.width - 1;
|
||||
const y = strip.y;
|
||||
if (gap) {
|
||||
image.drawLine(left, y, gap.x, y, BORDER_VALUE);
|
||||
|
||||
+32
-13
@@ -9,6 +9,7 @@ import {
|
||||
navigateVerticalPositionSetting,
|
||||
terminalDisplayModeSetting,
|
||||
terminalVerticalPositionSetting,
|
||||
statusBarPositionSetting,
|
||||
uiDepthSetting,
|
||||
} from "../dashboard-settings";
|
||||
|
||||
@@ -112,14 +113,32 @@ export function switcherRect(heightMode: WindowHeightMode, appId?: string): { x:
|
||||
/**
|
||||
* Whether the foreground window's content gets a rounded frame (drawn by
|
||||
* the chrome layer): with a reserved bottom switcher row, whose top edge is
|
||||
* the frame's bottom side, as the top bar's divider is its top. Its left and right sides take the pixel just outside
|
||||
* the 576-wide window; there's no room in the full-panel mode, nor need
|
||||
* beside a side strip.
|
||||
* the frame's bottom side, as the window header's last row is its top. Its
|
||||
* left and right sides take the pixel just outside the 576-wide window;
|
||||
* there's no room in the full-panel mode, nor need beside a side strip.
|
||||
*/
|
||||
export function windowFramed(appId?: string): boolean {
|
||||
return switcherRowHeight(appId) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the status bar shares the bottom switcher row instead of topping
|
||||
* each window (Settings > Customization > Status bar): only beside a
|
||||
* reserved row, as the full-panel mode's row shows just while it has focus.
|
||||
*/
|
||||
export function statusInSwitcherRow(appId?: string): boolean {
|
||||
return windowFramed(appId) && statusBarPositionSetting.get() === "switcher";
|
||||
}
|
||||
|
||||
/**
|
||||
* Height of the header the shell draws over each window's content: the top
|
||||
* bar, or, with the status bar in the switcher row, just the row the
|
||||
* window frame's top runs along.
|
||||
*/
|
||||
export function windowHeaderHeight(appId?: string): number {
|
||||
return statusInSwitcherRow(appId) ? 1 : TOP_BAR_HEIGHT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a screen point lies on the switcher's side of the screen, for
|
||||
* touches on the phone's mirror: anywhere in a side strip's column, or from
|
||||
@@ -196,14 +215,14 @@ export const SHELL_OPAQUE_BLACK = 1;
|
||||
/**
|
||||
* Windows come in three heights. "min" covers the same 288px band the stock
|
||||
* firmware uses, leaving most of the field of view clear; "medium" is one
|
||||
* top bar taller, so the content area below the bar is a full 288px (the
|
||||
* header taller, so the content area below the header is a full 288px (the
|
||||
* EvenHub app surface height); "max" uses the whole 480px screen (terminal
|
||||
* views), less a bottom switcher row. All include a top bar drawn by the
|
||||
* shell at the window's top edge.
|
||||
* views), less a bottom switcher row. All include a header drawn by the
|
||||
* shell at the window's top edge (windowHeaderHeight).
|
||||
*/
|
||||
export type WindowHeightMode = "min" | "medium" | "max";
|
||||
|
||||
/** Total height (top bar + content) of a min-height window. */
|
||||
/** Total height (header + content) of a min-height window. */
|
||||
export const MIN_WINDOW_HEIGHT = 288;
|
||||
|
||||
/**
|
||||
@@ -214,13 +233,13 @@ function windowAreaHeight(appId?: string): number {
|
||||
return G2_LENS_HEIGHT - switcherRowHeight(appId);
|
||||
}
|
||||
|
||||
/** Total height (top bar + content) of a window's band in the given mode. */
|
||||
/** Total height (header + content) of a window's band in the given mode. */
|
||||
export function windowBandHeight(mode: WindowHeightMode, appId?: string): number {
|
||||
switch (effectiveHeightMode(mode, appId)) {
|
||||
case "max":
|
||||
return windowAreaHeight(appId);
|
||||
case "medium":
|
||||
return MIN_WINDOW_HEIGHT + TOP_BAR_HEIGHT;
|
||||
return MIN_WINDOW_HEIGHT + windowHeaderHeight(appId);
|
||||
default:
|
||||
return MIN_WINDOW_HEIGHT;
|
||||
}
|
||||
@@ -257,7 +276,7 @@ export function minWindowTop(appId?: string): number {
|
||||
}
|
||||
|
||||
/**
|
||||
* Top edge (y) of a window's top bar; max-height windows pin to the screen
|
||||
* Top edge (y) of a window's header; max-height windows pin to the screen
|
||||
* top. A bottom switcher row hangs under the band, so the band and row
|
||||
* together distribute the screen's slack.
|
||||
*/
|
||||
@@ -269,11 +288,11 @@ export function windowTop(mode: WindowHeightMode, appId?: string): number {
|
||||
export function appViewportSize(mode: WindowHeightMode, appId?: string): { width: number; height: number } {
|
||||
return {
|
||||
width: appViewportWidth(appId),
|
||||
height: windowBandHeight(mode, appId) - TOP_BAR_HEIGHT,
|
||||
height: windowBandHeight(mode, appId) - windowHeaderHeight(appId),
|
||||
};
|
||||
}
|
||||
|
||||
/** Screen rect of a window's app-content viewport (below its top bar). */
|
||||
/** Screen rect of a window's app-content viewport (below its header). */
|
||||
export function appViewportRect(mode: WindowHeightMode, appId?: string): {
|
||||
x: number;
|
||||
y: number;
|
||||
@@ -282,7 +301,7 @@ export function appViewportRect(mode: WindowHeightMode, appId?: string): {
|
||||
} {
|
||||
return {
|
||||
x: appViewportLeft(appId),
|
||||
y: windowTop(mode, appId) + TOP_BAR_HEIGHT,
|
||||
y: windowTop(mode, appId) + windowHeaderHeight(appId),
|
||||
...appViewportSize(mode, appId),
|
||||
};
|
||||
}
|
||||
@@ -41,6 +41,7 @@ import {
|
||||
brightnessSetting,
|
||||
onAnySettingChanged,
|
||||
openAiApiKeySetting,
|
||||
statusBarPositionSetting,
|
||||
timeFormatSetting,
|
||||
wakeWordActionSetting,
|
||||
} from "../dashboard-settings";
|
||||
@@ -337,7 +338,7 @@ const SWITCHER_SWIPES: Record<
|
||||
* string.
|
||||
*/
|
||||
function chromeSettingsKey(): string {
|
||||
return `${batteryIndicatorSettingsKey()}|${timeFormatSetting.get()}|${uiDepth()}`;
|
||||
return `${batteryIndicatorSettingsKey()}|${timeFormatSetting.get()}|${uiDepth()}|${statusBarPositionSetting.get()}`;
|
||||
}
|
||||
|
||||
class Shell {
|
||||
|
||||
@@ -21,3 +21,5 @@ const val CFW_TEXTURE_OPT_INVERSE = 32
|
||||
|
||||
/** Rounded-rectangle border sentinel, not a color or flag bit. */
|
||||
const val DRAW_ROUNDED_RECT_NO_BORDER = 16
|
||||
/** Revision 36: the rounded rectangle's optional outside color is absent (bridge sentinel). */
|
||||
const val DRAW_ROUNDED_RECT_NO_OUTSIDE = 16
|
||||
+8
-2
@@ -13,7 +13,7 @@ class DrawClip(val x: Int, val y: Int, val width: Int, val height: Int) {
|
||||
fun translated(dx: Int, dy: Int) = DrawClip(x + dx, y + dy, width, height)
|
||||
}
|
||||
|
||||
/** Revision 35 wire grammar, shared by scene planning and the local renderer. */
|
||||
/** Revision 36 wire grammar, shared by scene planning and the local renderer. */
|
||||
object DrawProtocol {
|
||||
/** Mirrors g2flash/patches/zlib_glue.c. */
|
||||
const val DRAW = CFW_MSG_DRAW_CALLS
|
||||
@@ -93,12 +93,17 @@ object DrawProtocol {
|
||||
border: Int = DRAW_ROUNDED_RECT_NO_BORDER, depth: Int? = null,
|
||||
): ByteArray = roundedRect(DrawValue.Integer(x), DrawValue.Integer(y), width, height, radius, background, border, depth)
|
||||
|
||||
/**
|
||||
* The background is max-blended, so 0 leaves the interior as it is. [outside] (revision 36),
|
||||
* when given, is the color for the bounding box's pixels outside the rounded shape.
|
||||
*/
|
||||
fun roundedRect(
|
||||
x: DrawValue, y: DrawValue, width: Int, height: Int, radius: Int, background: Int,
|
||||
border: Int = DRAW_ROUNDED_RECT_NO_BORDER, depth: Int? = null, clip: DrawClip? = null,
|
||||
outside: Int? = null,
|
||||
): ByteArray {
|
||||
require(width in 1..640 && height in 1..480 && radius in 0..65535)
|
||||
require(background in 0..15 && border in 0..DRAW_ROUNDED_RECT_NO_BORDER)
|
||||
require(background in 0..15 && border in 0..DRAW_ROUNDED_RECT_NO_BORDER && (outside == null || outside in 0..15))
|
||||
return call(DRAW_OP_ROUNDED_RECT, depth = depth, clip = clip) {
|
||||
writeExtended(x)
|
||||
writeExtended(y)
|
||||
@@ -107,6 +112,7 @@ object DrawProtocol {
|
||||
writeU16(radius)
|
||||
writeU8(background)
|
||||
writeU8(border)
|
||||
if (outside != null) writeU8(outside)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-1
@@ -487,16 +487,21 @@ class DisplayListRenderer(
|
||||
val radius = reader.readU16()
|
||||
val fill = reader.readU8()
|
||||
val border = reader.readU8()
|
||||
// Revision 36: an optional trailing color for the corners outside the shape.
|
||||
val outside = if (reader.remaining == 1) reader.readU8().also { require(it <= 15) } else DRAW_ROUNDED_RECT_NO_OUTSIDE
|
||||
reader.requireDone()
|
||||
require(width in 1..640 && height in 1..480 && fill <= 15 && border <= DRAW_ROUNDED_RECT_NO_BORDER)
|
||||
if (!walk.apply) return
|
||||
if (x < -width - target.shiftX || x >= target.width - target.shiftX ||
|
||||
y < -height || y >= target.height) return
|
||||
for (yy in 0 until height) for (xx in 0 until width) {
|
||||
if (!roundedContains(xx, yy, width, height, radius)) continue
|
||||
val tx = x + xx + target.shiftX
|
||||
val ty = y + yy
|
||||
if (tx !in 0 until target.width || ty !in 0 until target.height) continue
|
||||
if (!roundedContains(xx, yy, width, height, radius)) {
|
||||
if (outside != DRAW_ROUNDED_RECT_NO_OUTSIDE) target.put(x + xx, ty, outside)
|
||||
continue
|
||||
}
|
||||
val edge = !roundedContains(xx - 1, yy - 1, width - 2, height - 2, maxOf(0, radius - 1))
|
||||
val value = if (edge && border < DRAW_ROUNDED_RECT_NO_BORDER) border else maxOf(fill, target.get(tx, ty))
|
||||
target.put(x + xx, ty, value)
|
||||
|
||||
+4
-4
@@ -45,7 +45,7 @@ class FrameDisplayList private constructor(
|
||||
val clip = c.clip?.translated(x, y)
|
||||
when (c.op) {
|
||||
DRAW_OP_ROUNDED_RECT -> DrawProtocol.roundedRect(bind(c.x, elapsed, x), bind(c.y, elapsed, y),
|
||||
v[0], v[1], v[2], v[3], v[4], depth + c.depth, clip)
|
||||
v[0], v[1], v[2], v[3], v[4], depth + c.depth, clip, v[5].takeIf { it != DRAW_ROUNDED_RECT_NO_OUTSIDE })
|
||||
DRAW_OP_IMAGE -> DrawProtocol.image(resource(v[0]), bind(c.x, elapsed, x + v[1]), bind(c.y, elapsed, y + v[2]),
|
||||
v[3], depth = depth + c.depth, clip = clip)
|
||||
DRAW_OP_TEXT -> DrawProtocol.text(resource(v[0]), bind(c.x, elapsed, x + v[1]), bind(c.y, elapsed, y + v[2]),
|
||||
@@ -185,9 +185,9 @@ class FrameDisplayList private constructor(
|
||||
DRAW_OP_ROUNDED_RECT -> {
|
||||
val xx = value(); val yy = value()
|
||||
val w = r.readU16(); val h = r.readU16(); val radius = r.readU16()
|
||||
val background = r.readU8(); val border = r.readU8()
|
||||
require(w in 1..640 && h in 1..480 && background in 0..15 && border in 0..16)
|
||||
commands.add(Command(op, d, intArrayOf(w, h, radius, background, border), xx, yy, clip = clip))
|
||||
val background = r.readU8(); val border = r.readU8(); val outside = r.readU8()
|
||||
require(w in 1..640 && h in 1..480 && background in 0..15 && border in 0..16 && outside in 0..16)
|
||||
commands.add(Command(op, d, intArrayOf(w, h, radius, background, border, outside), xx, yy, clip = clip))
|
||||
}
|
||||
DRAW_OP_IMAGE -> {
|
||||
val id = resource(); require(id != DrawProtocol.SCREEN)
|
||||
|
||||
+142
-52
@@ -14,7 +14,7 @@ function geometry() {
|
||||
displayModeSetting: '576x288', verticalPositionSetting: 'middle',
|
||||
navigateDisplayModeSetting: 'global', navigateVerticalPositionSetting: 'global',
|
||||
terminalDisplayModeSetting: 'default', terminalVerticalPositionSetting: 'global',
|
||||
appSwitcherPositionSetting: 'left', uiDepthSetting: '0',
|
||||
appSwitcherPositionSetting: 'left', uiDepthSetting: '0', statusBarPositionSetting: 'top',
|
||||
}).map(([name, value]) => [name, { value, get() { return this.value; } }]));
|
||||
const context = { exports: {}, require: (name) => {
|
||||
if (name === '../../graphics/image') return { G2_LENS_WIDTH: 640, G2_LENS_HEIGHT: 480 };
|
||||
@@ -66,8 +66,9 @@ test('Terminal can disable its tall default, inherit position or override both d
|
||||
|
||||
test('all explicit size/position combinations stay within the display and align content below the bar', () => {
|
||||
const g = geometry();
|
||||
for (const switcher of ['left', 'right', 'bottom']) {
|
||||
for (const [switcher, statusBar] of [['left', 'top'], ['right', 'top'], ['bottom', 'top'], ['bottom', 'switcher'], ['left', 'switcher']]) {
|
||||
g.settings.appSwitcherPositionSetting.value = switcher;
|
||||
g.settings.statusBarPositionSetting.value = statusBar;
|
||||
for (const globalMode of ['576x288', '576x480', '640x480']) {
|
||||
g.settings.displayModeSetting.value = globalMode;
|
||||
for (const appId of ['navigate', 'terminal']) {
|
||||
@@ -79,8 +80,11 @@ test('all explicit size/position combinations stay within the display and align
|
||||
const rect = g.rect(heightMode, appId);
|
||||
const fullPanel = g.displayMode(appId) === '640x480';
|
||||
assert.equal(rect.x + rect.width, fullPanel ? 640 : { left: 640, right: 576, bottom: 608 }[switcher]);
|
||||
assert.equal(rect.y, g.windowTop(heightMode, appId) + g.TOP_BAR_HEIGHT);
|
||||
assert.ok(rect.y >= 28 && rect.y + rect.height <= 480 - g.switcherRowHeight(appId));
|
||||
const header = g.windowHeaderHeight(appId);
|
||||
assert.equal(header, g.statusInSwitcherRow(appId) ? 1 : g.TOP_BAR_HEIGHT);
|
||||
assert.equal(g.statusInSwitcherRow(appId), statusBar === 'switcher' && g.switcherRowHeight(appId) > 0);
|
||||
assert.equal(rect.y, g.windowTop(heightMode, appId) + header);
|
||||
assert.ok(rect.y >= header && rect.y + rect.height <= 480 - g.switcherRowHeight(appId));
|
||||
const row = g.switcherRect(heightMode, appId);
|
||||
assert.ok(row.y + row.height <= 480);
|
||||
// A reserved bottom row hangs right under the window, as wide as it.
|
||||
@@ -140,23 +144,32 @@ test('a bottom app switcher centres 576-wide windows and hangs one tall tab unde
|
||||
assert.equal(g.windowFramed(), false);
|
||||
});
|
||||
|
||||
test('a bottom app switcher frames the foreground window\'s content in a rounded border', () => {
|
||||
const g = geometry();
|
||||
g.settings.appSwitcherPositionSetting.value = 'bottom';
|
||||
g.settings.uiDepthSetting.value = '62';
|
||||
const graphics = require('../.test-build/app/graphics/image.js');
|
||||
const shellScene = require('../.test-build/app/graphics/shell-scene.js');
|
||||
const font = { lineHeight: 12, ascent: 10, measureText: (text) => text.length * 4, drawText() {} };
|
||||
// The real chrome layer over the given geometry, with platform pieces stubbed:
|
||||
// a 4px-per-character font that paints each character as a 2x6 block, up to
|
||||
// `notifications` 24px notification icons, and a phone battery at 80%.
|
||||
const graphics = require('../.test-build/app/graphics/image.js');
|
||||
const shellScene = require('../.test-build/app/graphics/shell-scene.js');
|
||||
const displayList = require('../.test-build/app/graphics/display-list.js');
|
||||
function chromeLayer(g, { notifications = 0, phoneBattery = null, windows = 1, trayIcons = [] } = {}) {
|
||||
const font = { lineHeight: 12, ascent: 10, measureText: (text) => text.length * 4,
|
||||
drawText: (image, x, y, text, value) => { for (let i = 0; i < text.length; i++) image.fillRect(x + i * 4, y + 2, 2, 6, value); } };
|
||||
let nextKey = 100;
|
||||
const requested = [];
|
||||
const settings = { get: () => 'always' };
|
||||
const modules = {
|
||||
'../../graphics/shell-scene': shellScene, '../../graphics/image': graphics,
|
||||
'../../graphics/ui-fonts': { getDefaultSmallFont: () => font, getDefaultMediumFont: () => font },
|
||||
'../../graphics/display-list': displayList, '../../graphics/ui-fonts': { getDefaultSmallFont: () => font, getDefaultMediumFont: () => font },
|
||||
'../../graphics/battery': require('../.test-build/app/graphics/battery.js'),
|
||||
'./ambient-cards': { activeAmbientCards: () => [] },
|
||||
'../../native/notification-icons': { readActiveNotificationIcons: () => ({ icons: [], stale: false }) },
|
||||
'../../native/phone-battery': { readPhoneBatteryState: () => ({ battery: null }) },
|
||||
'../../native/notification-icons': { readActiveNotificationIcons: (max) => {
|
||||
requested.push(max);
|
||||
return { icons: Array.from({ length: Math.min(max, notifications) }, () => new graphics.GrayImage(24, 24, 200)), stale: false };
|
||||
} },
|
||||
'../../native/phone-battery': { readPhoneBatteryState: () => ({ battery: phoneBattery, charging: false }) },
|
||||
'../../util/render-freshness': { renderPassAllowsStaleData: () => false },
|
||||
'../dashboard-settings': { batteryDisplayModeSetting: { get: () => 'icon' } },
|
||||
'../clock-format': { formatClockDate: () => '', formatClockTime: () => '' },
|
||||
'../dashboard-settings': { batteryDisplayModeSetting: { get: () => 'icon' }, phoneBatteryVisibilitySetting: settings,
|
||||
batteryIndicatorVisible: () => true },
|
||||
'../clock-format': { formatClockDate: () => 'Thu Oct 2', formatClockTime: () => '9:41' },
|
||||
'../layers': { LayerStack: { allocateShellKey: () => nextKey++ } },
|
||||
'../menu': { scrollToKeepSelectionVisible: () => 0 },
|
||||
'./geometry': g,
|
||||
@@ -164,51 +177,128 @@ test('a bottom app switcher frames the foreground window\'s content in a rounded
|
||||
const context = { exports: {}, require: (name) => modules[name] ?? {} };
|
||||
vm.runInNewContext(js(read('app/ui/shell/chrome-layer.ts')), context);
|
||||
const state = {
|
||||
windows: [{ attention: false, drawIcon() {} }], selectedIndex: 0, focus: 'window', foregroundHeightMode: 'min',
|
||||
battery: { headset: null, ring: null, watch: null }, trayIcons: [],
|
||||
windows: Array.from({ length: windows }, () => ({ attention: false, drawIcon: (image, x, y, size) => image.fillRect(x, y, size, size, 120) })),
|
||||
selectedIndex: 0, focus: 'window', foregroundHeightMode: 'min',
|
||||
battery: { headset: null, ring: null, watch: null }, trayIcons,
|
||||
};
|
||||
const chrome = new context.exports.ShellChromeLayer(() => state);
|
||||
return { chrome: new context.exports.ShellChromeLayer(() => state), state, requested };
|
||||
}
|
||||
|
||||
test('a bottom app switcher frames the foreground window\'s content in a rounded border', () => {
|
||||
const g = geometry();
|
||||
g.settings.appSwitcherPositionSetting.value = 'bottom';
|
||||
g.settings.uiDepthSetting.value = '62';
|
||||
const { chrome } = chromeLayer(g);
|
||||
const parts = chrome.paintParts();
|
||||
// The min band's content spans y=106..365, between the bar's bottom row
|
||||
// (the frame's top) at 105 and the row's top edge (its bottom) at 366.
|
||||
// Just the top bar and then the row: the frame is no surface of its own.
|
||||
const part = (key) => parts.find((p) => p.shellKey === key);
|
||||
const [left, right, top, strip] = [part(100), part(101), part(102), part(1)];
|
||||
assert.deepEqual([left.x, left.y, left.image.width, left.image.height], [31, 105, 8, 261]);
|
||||
assert.deepEqual([right.x, right.image.width], [601, 8]);
|
||||
assert.deepEqual([top.x, top.y, top.image.width, top.image.height], [39, 105, 562, 1]);
|
||||
assert.ok(!left.depth && !right.depth && !top.depth);
|
||||
const [bar, strip] = [part(2), part(1)];
|
||||
assert.deepEqual(Array.from(parts, (p) => p.shellKey), [2, 1]);
|
||||
// The min band's content spans y=106..365, between the bar's bottom row
|
||||
// (the frame's top) at 105 and the row's top edge (its bottom) at 366. The
|
||||
// frame is one rounded rect riding on the row, replayed after the bar.
|
||||
const frames = (image) => image.draws.filter((d) => d.presentation?.displayList);
|
||||
const [frame] = frames(strip.image);
|
||||
assert.deepEqual([strip.x + frame.x, strip.y + frame.y, frame.source.width, frame.source.height, frame.presentation.depth], [31, 105, 578, 262, 0]);
|
||||
assert.deepEqual(JSON.parse(JSON.stringify(frame.presentation.displayList.calls)), [{ op: displayList.DrawOp.ROUNDED_RECT, x: 0, y: 0, width: 578, height: 262,
|
||||
radius: 8, background: 0, border: 3, outside: 0, clip: { x: 0, y: 0, width: 578, height: 261 } }]);
|
||||
// Over a lit screen: the sides just outside the window, the top along the
|
||||
// bar's bottom row, the content's corners cut black, its interior left
|
||||
// alone, and the bottom row left to the separator.
|
||||
const lit = new Uint8Array(640 * 480).fill(255);
|
||||
displayList.paintDisplayList(lit, lit.slice(), 640, 480, { displayList: frame.presentation.displayList,
|
||||
x: strip.x + frame.x, y: strip.y + frame.y, width: 578, height: 262, depth: 0 });
|
||||
const px = (x, y) => lit[y * 640 + x];
|
||||
assert.deepEqual([px(31, 200), px(608, 200), px(300, 105)], [48, 48, 48]);
|
||||
assert.deepEqual([px(31, 105), px(32, 106), px(32, 365), px(607, 365)], [0, 0, 0, 0]);
|
||||
assert.deepEqual([px(36, 105), px(300, 200), px(300, 366), px(36, 366)], [48, 255, 255, 255]);
|
||||
const at = (p, x, y) => p.image.pixels[(y - p.y) * p.image.width + x - p.x];
|
||||
// Straight sides just outside the window; the top along the bar's bottom row.
|
||||
assert.equal(at(left, 31, 200), 40);
|
||||
assert.equal(at(right, 608, 200), 40);
|
||||
assert.equal(at(top, 300, 105), 40);
|
||||
// Rounded corners: black outside the curve, the window's own corner masked.
|
||||
assert.equal(at(left, 31, 105), 1);
|
||||
assert.equal(at(left, 36, 105), 40);
|
||||
assert.equal(at(left, 32, 106), 1);
|
||||
assert.equal(at(left, 32, 365), 1);
|
||||
assert.equal(at(right, 607, 365), 1);
|
||||
// The separator is the bottom side, starting where the corner's curve ends.
|
||||
assert.equal(at(strip, 35, 366), 1);
|
||||
assert.equal(at(strip, 36, 366), 40);
|
||||
assert.equal(at(strip, 603, 366), 40);
|
||||
assert.equal(at(strip, 604, 366), 1);
|
||||
// Parts after the -2 top bar, so the frame draws over it.
|
||||
assert.ok(parts.indexOf(part(2)) < parts.indexOf(left));
|
||||
assert.deepEqual([at(strip, 35, 366), at(strip, 36, 366), at(strip, 603, 366), at(strip, 604, 366)], [1, 40, 40, 1]);
|
||||
// The bar's own divider gives way to the frame's top.
|
||||
assert.equal(at(bar, 300, 105), 1);
|
||||
shellScene.encodeShellScene(parts, g.uiDepth());
|
||||
// The flat paint matches. The bar's own divider gives way to the frame's
|
||||
// top, and the frame stops short of the bar.
|
||||
// The flat paint carries the same frame.
|
||||
const image = chrome.paint();
|
||||
assert.equal(image.pixels[200 * 640 + 31], 40);
|
||||
assert.equal(image.pixels[200 * 640 + 608], 40);
|
||||
assert.equal(image.pixels[105 * 640 + 33], 1);
|
||||
assert.equal(image.pixels[105 * 640 + 300], 40);
|
||||
assert.equal(image.pixels[90 * 640 + 31], 0);
|
||||
const bar = part(2);
|
||||
assert.equal(bar.image.pixels[(105 - bar.y) * bar.image.width + 300 - bar.x], 1);
|
||||
assert.deepEqual(frames(image).map((d) => [d.x, d.y]), [[31, 105]]);
|
||||
// No frame in the full-panel mode.
|
||||
g.settings.displayModeSetting.value = '640x480';
|
||||
assert.equal(chrome.paintParts().filter((p) => p.shellKey >= 100).length, 0);
|
||||
assert.equal(chrome.paintParts().flatMap((p) => frames(p.image)).length, 0);
|
||||
});
|
||||
|
||||
test('the status bar can join a bottom app switcher, and windows grow into the top bar', () => {
|
||||
const g = geometry();
|
||||
g.settings.statusBarPositionSetting.value = 'switcher';
|
||||
// Only beside a reserved bottom row.
|
||||
assert.equal(g.statusInSwitcherRow(), false);
|
||||
g.settings.appSwitcherPositionSetting.value = 'bottom';
|
||||
assert.equal(g.statusInSwitcherRow(), true);
|
||||
// A one-row header (the frame's top) replaces the 28px top bar; medium
|
||||
// windows keep a 288px (EvenHub) content area.
|
||||
assert.equal(g.windowHeaderHeight(), 1);
|
||||
assert.deepEqual(g.rect('min'), { x: 32, y: 79, width: 576, height: 287 });
|
||||
assert.deepEqual(g.rect('medium'), { x: 32, y: 79, width: 576, height: 288 });
|
||||
assert.deepEqual(g.rect('max', 'terminal'), { x: 32, y: 1, width: 576, height: 443 });
|
||||
assert.deepEqual({ ...g.switcherRect('min') }, { x: 32, y: 366, width: 576, height: 36 });
|
||||
// The full-panel mode keeps the top bar: its row shows only while focused.
|
||||
g.settings.displayModeSetting.value = '640x480';
|
||||
assert.equal(g.statusInSwitcherRow(), false);
|
||||
assert.deepEqual(g.rect('max'), { x: 0, y: 28, width: 640, height: 452 });
|
||||
});
|
||||
|
||||
test('the switcher row lays out windows, free space, notifications, widgets, batteries and the clock', () => {
|
||||
const g = geometry();
|
||||
g.settings.appSwitcherPositionSetting.value = 'bottom';
|
||||
g.settings.statusBarPositionSetting.value = 'switcher';
|
||||
const tray = new graphics.GrayImage(30, 20, 180);
|
||||
const { chrome, requested } = chromeLayer(g, { notifications: 2, phoneBattery: 80, trayIcons: [tray] });
|
||||
const parts = chrome.paintParts();
|
||||
// No top bar: the row, then the status bar on the top bar's surface and depth.
|
||||
assert.deepEqual(Array.from(parts, (p) => [p.shellKey, p.depth ?? 0]), [[1, 0], [2, -2]]);
|
||||
const [row, status] = parts;
|
||||
// Right to left from the row's end (x=608), centred under its separator
|
||||
// line (y=366): "Thu Oct 2 9:41" (56px) 10px in; the battery block (label
|
||||
// 20 + gap 5 + gauge 21) 16px before it; the 30px widget 10px before that;
|
||||
// then the two notification icons, 8px clear of the widget.
|
||||
const clockX = 608 - 10 - 56, batteryLeft = clockX - 16 - 46, trayLeft = batteryLeft - 40, iconsLeft = trayLeft - 8 - 56 + 4;
|
||||
assert.deepEqual([status.x, status.y, status.image.width, status.image.height], [iconsLeft, 367, 608 - iconsLeft, 35]);
|
||||
const at = (p, x, y) => p.image.withDrawsBaked().pixels[(y - p.y) * p.image.width + x - p.x];
|
||||
// The clock's text runs 8 rows down the top bar's layout, which sits 5 rows into the row.
|
||||
assert.deepEqual([at(status, clockX, 366 + 5 + 8 + 2), at(status, trayLeft, 366 + 5 + 4), at(status, iconsLeft, 366 + 5 + 2)], [210, 180, 200]);
|
||||
assert.equal(at(status, batteryLeft, 366 + 5 + 8 + 2), 150, 'battery label');
|
||||
// Windows take what the status bar leaves; the rest is free space.
|
||||
assert.equal(at(row, 40 + 2, 366 + 2), 120, 'first window icon');
|
||||
assert.equal(chrome.windowIndexAt(45, 380, 1), 0);
|
||||
assert.equal(chrome.windowIndexAt(iconsLeft + 2, 380, 1), null);
|
||||
// Notification icons stop short of the one window slot's room (with the
|
||||
// row's margins and the gap to the status bar).
|
||||
assert.equal(requested.at(-1), Math.floor((trayLeft - 8 - (32 + 20 + 40 - 8 + 8) + 4) / 28));
|
||||
// No top bar, but the frame is still there, its top one row above the content.
|
||||
const [frame] = row.image.draws.filter((d) => d.presentation?.displayList);
|
||||
assert.deepEqual([row.x + frame.x, row.y + frame.y, frame.source.height], [31, 78, 289]);
|
||||
shellScene.encodeShellScene(parts, g.uiDepth());
|
||||
});
|
||||
|
||||
test('many windows scroll in what the notification icons leave them', () => {
|
||||
const g = geometry();
|
||||
g.settings.appSwitcherPositionSetting.value = 'bottom';
|
||||
g.settings.statusBarPositionSetting.value = 'switcher';
|
||||
const { chrome, requested } = chromeLayer(g, { notifications: 40, windows: 12 });
|
||||
const [row, status] = chrome.paintParts();
|
||||
// Clock only (no batteries or widgets): notifications end 8px before its
|
||||
// 8px lead-in, and stop where three window slots plus margins remain.
|
||||
const trayLeft = 608 - 10 - 56 - 8, floor = 32 + 20 + 3 * 40 - 8 + 8;
|
||||
const max = Math.floor((trayLeft - 8 - floor + 4) / 28);
|
||||
assert.equal(requested.at(-1), max);
|
||||
const iconsLeft = trayLeft - 8 - max * 28 + 4;
|
||||
assert.equal(status.x, iconsLeft);
|
||||
// Three windows fit before the status bar's gap; the rest scroll, with the
|
||||
// chevron at the end of the windows rather than of the row.
|
||||
assert.equal(chrome.windowIndexAt(32 + 10 + 2 * 40 + 4, 380, 12), 2);
|
||||
assert.equal(chrome.windowIndexAt(32 + 10 + 3 * 40 + 4, 380, 12), null);
|
||||
const windowsRight = iconsLeft - 8;
|
||||
const chevron = row.image.pixels.findIndex((v, i) => v === 140);
|
||||
assert.equal(chevron % row.image.width + row.x, windowsRight - 6);
|
||||
});
|
||||
|
||||
// Exercise the real worker message handler with platform work stubbed out.
|
||||
|
||||
@@ -5,7 +5,7 @@ const { DrawOp, SCREEN, encodeDisplayList, readDisplayList, paintDisplayList } =
|
||||
const { GrayImage } = require('../.test-build/app/graphics/image.js');
|
||||
const { encodePresentation } = require('../.test-build/app/graphics/presentation-wire.js');
|
||||
// Also consumed by FrameDisplayListTest.kt: bridge bytes, not independently rebuilt native calls.
|
||||
const MENU = '077e0000000300020002000200022a00000096000000010002000200ffffffff0200080000ff24017e30020000000001812c8001812c1611010017328001812c16103001812c3023414031ff24017c30020000000001812c8001812c1611010017328001812c16103001812c302341403102000200010001030400000000000000001f';
|
||||
const MENU = '077f0000000300020002000200022a00000096000000010002000200ffffffff0200080000ff24017e30020000000001812c8001812c1611010017328001812c16103001812c3023414031ff24017c30020000000001812c8001812c1611010017328001812c16103001812c30234140310200020001000103100400000000000000001f';
|
||||
const MULTI = '0744000000030002000400010002000000000000000002000200010000ff010001006003000400000000000000001f0200000100000001000100020002feffffff7f00010001007f00';
|
||||
|
||||
test('extended integers agree with firmware widths and sign extension', () => {
|
||||
@@ -90,9 +90,33 @@ test('frame submission supports resource-free lists and plain PRESENT-relative t
|
||||
// the font and image ids it registers: a clipped clear, a clipped rounded rect,
|
||||
// and replayed glyph + icon draws clipped while sliding up. REPLAY_PIXELS is
|
||||
// what the list paints over a nibble-1 screen, 16x8 at 4 bits per pixel.
|
||||
const REPLAY = '0780000000020003000800040000070000006400000000000300890000000000000600040002880000010001000200020000000400030000000510a00000000000000600040000ff2502000080c002000000000180c8800180c8161101001732800180c81610300180c830234031020000efbe4100000000000000ff01bebafeca04000100';
|
||||
const REPLAY = '078100000002000300080004000007000000640000000000030089000000000000060004000288000001000100020002000000040003000000051010a00000000000000600040000ff2502000080c002000000000180c8800180c8161101001732800180c81610300180c830234031020000efbe4100000000000000ff01bebafeca04000100';
|
||||
const REPLAY_PIXELS = '11111111111111111111111111111111111111111111111111fff28f111111111125522211111111112552221111111111222222111111111111111111111111';
|
||||
|
||||
// Also consumed by FrameDisplayListTest.kt: a window-frame rounded rect with no
|
||||
// fill, a border of 3 and black outside the curve (revision 36), clipped short
|
||||
// of its bottom row, and what it paints over a nibble-9 12x8 screen.
|
||||
const FRAME = '072b00000002000100080006000000000000000000000000010088000000000000080005000000080006000300000300';
|
||||
const FRAME_PIXELS = '999999999999990333333099993399993399993999999399993999999399993399993399999999999999999999999999';
|
||||
|
||||
test('a rounded rect outside color encodes, decodes and paints over the corners', () => {
|
||||
const placed = { x: 2, y: 1, width: 8, height: 6, depth: 0, displayList: { resources: [], calls: [
|
||||
{ op: DrawOp.ROUNDED_RECT, x: 0, y: 0, width: 8, height: 6, radius: 3, background: 0, border: 3, outside: 0, clip: { x: 0, y: 0, width: 8, height: 5 } },
|
||||
] } };
|
||||
assert.equal(Buffer.from(encodeDisplayList(placed, 0)).toString('hex'), FRAME);
|
||||
const output = new Uint8Array(12 * 8).fill(9 * 16);
|
||||
paintDisplayList(output, output.slice(), 12, 8, placed, false, 0);
|
||||
assert.equal(Array.from(output, (v) => (v >> 4).toString(16)).join(''), FRAME_PIXELS);
|
||||
const [rect] = readDisplayList(Buffer.from(FRAME, 'hex'), 0, 0).placed.displayList.calls;
|
||||
assert.equal(rect.outside, 0);
|
||||
// Without one, the call decodes without it and leaves the corners alone.
|
||||
const plain = { ...placed, displayList: { resources: [], calls: [{ ...placed.displayList.calls[0], outside: undefined }] } };
|
||||
assert.equal('outside' in readDisplayList(encodeDisplayList(plain, 0), 0, 0).placed.displayList.calls[0], false);
|
||||
const corners = new Uint8Array(12 * 8).fill(9 * 16);
|
||||
paintDisplayList(corners, corners.slice(), 12, 8, plain, false, 0);
|
||||
assert.deepEqual([corners[12 + 2] >> 4, corners[12 + 5] >> 4], [9, 3]);
|
||||
});
|
||||
|
||||
function replayList() {
|
||||
// 'A' is 3x2 ink one row below a 4px line top; the icon is 2x2.
|
||||
const font = { fingerprintId: 9001, atlasKey: 'stub-font', ascent: 3, lineHeight: 4 };
|
||||
|
||||
@@ -96,7 +96,9 @@ class DrawWireTest {
|
||||
renderer.execute(DrawProtocol.sequence(listOf(call)), target)
|
||||
screen.fill(0x12)
|
||||
val savedResources = resources.mapValues { it.value.copyOf() }
|
||||
val malformed = (0 until call.size).map { call.copyOf(it) } + listOf(call + byteArrayOf(0))
|
||||
// A rounded rect may end in one outside-color byte (revision 36), but not one past 15.
|
||||
val overlong = if (call[0].toInt() == DRAW_OP_ROUNDED_RECT) byteArrayOf(16) else byteArrayOf(0)
|
||||
val malformed = (0 until call.size).map { call.copyOf(it) } + listOf(call + overlong, call + byteArrayOf(0, 0))
|
||||
for (bad in malformed) {
|
||||
assertFails { renderer.execute(DrawProtocol.sequence(listOf(valid, bad, valid)), target) }
|
||||
assertContentEquals(ByteArray(16) { 0x12 }, screen)
|
||||
|
||||
@@ -4,13 +4,13 @@ import kotlin.test.*
|
||||
|
||||
class FrameDisplayListTest {
|
||||
// Golden records emitted by display-list-authoring.test.cjs.
|
||||
private val menu = "077e0000000300020002000200022a00000096000000010002000200ffffffff0200080000ff24017e30020000000001812c8001812c1611010017328001812c16103001812c3023414031ff24017c30020000000001812c8001812c1611010017328001812c16103001812c302341403102000200010001030400000000000000001f"
|
||||
private val menu = "077f0000000300020002000200022a00000096000000010002000200ffffffff0200080000ff24017e30020000000001812c8001812c1611010017328001812c16103001812c3023414031ff24017c30020000000001812c8001812c1611010017328001812c16103001812c30234140310200020001000103100400000000000000001f"
|
||||
private val multi = "0744000000030002000400010002000000000000000002000200010000ff010001006003000400000000000000001f0200000100000001000100020002feffffff7f00010001007f00"
|
||||
private val scroll = "078a000000030002000400020000070000009600000001000200040011223344556677880200020000000000ff250100300102300180f0800180f0161101001732800180f01610300180f0302341403101001102000200010008000000ff280101300100300180f0800180f0161101001732800180f01610300180f030234140310100170100160400020000000103"
|
||||
private val scroll = "078b000000030002000400020000070000009600000001000200040011223344556677880200020000000000ff250100300102300180f0800180f0161101001732800180f01610300180f0302341403101001102000200010008000000ff280101300100300180f0800180f0161101001732800180f01610300180f03023414031010017010016040002000000010310"
|
||||
// Clipped clear, clipped rounded rect, and replayed glyph + icon records with
|
||||
// placeholder atlas ids 0xbeef / 0xcafebabe, plus what they paint over a
|
||||
// nibble-1 16x8 screen (display-list-authoring.test.cjs).
|
||||
private val replay = "0780000000020003000800040000070000006400000000000300890000000000000600040002880000010001000200020000000400030000000510a00000000000000600040000ff2502000080c002000000000180c8800180c8161101001732800180c81610300180c830234031020000efbe4100000000000000ff01bebafeca04000100"
|
||||
private val replay = "078100000002000300080004000007000000640000000000030089000000000000060004000288000001000100020002000000040003000000051010a00000000000000600040000ff2502000080c002000000000180c8800180c8161101001732800180c81610300180c830234031020000efbe4100000000000000ff01bebafeca04000100"
|
||||
private val replayPixels = "11111111111111111111111111111111111111111111111111fff28f111111111125522211111111112552221111111111222222111111111111111111111111"
|
||||
private fun hex(s: String) = s.chunked(2).map { it.toInt(16).toByte() }.toByteArray()
|
||||
private fun read(bytes: ByteArray, now: Long = 1150): FrameDisplayList {
|
||||
@@ -141,6 +141,28 @@ class FrameDisplayListTest {
|
||||
assertEquals(replayPixels, nibbles)
|
||||
}
|
||||
|
||||
// A window-frame rounded rect (display-list-authoring.test.cjs): no fill, a
|
||||
// border of 3, black outside the curve (revision 36), clipped short of its
|
||||
// bottom row, over a nibble-9 12x8 screen.
|
||||
private val frame = "072b00000002000100080006000000000000000000000000010088000000000000080005000000080006000300000300"
|
||||
private val framePixels = "999999999999990333333099993399993399993999999399993999999399993399993399999999999999999999999999"
|
||||
|
||||
@Test fun roundedRectOutsideColorBridgesToTheTrailingByteAndPaintsLikeTheSoftwareRenderer() {
|
||||
val call = read(hex(frame)).calls(IntArray(0), 0).single()
|
||||
val plain = DrawProtocol.roundedRect(DrawValue.Integer(2), DrawValue.Integer(1), 8, 6, 3, 0, 3,
|
||||
depth = 0, clip = DrawClip(2, 1, 8, 5))
|
||||
assertContentEquals(plain + byteArrayOf(0), call)
|
||||
val target = DisplayListRenderer.Target(ByteArray(48) { 0x99.toByte() }, 12, 8)
|
||||
DisplayListRenderer(emptyMap()).execute(DrawProtocol.sequence(listOf(call)), target)
|
||||
assertEquals(framePixels, (0 until 96).joinToString("") { target.get(it % 12, it / 12).toString(16) })
|
||||
// Without the trailing byte the corners keep what was there; a color past 15 is rejected.
|
||||
val corners = DisplayListRenderer.Target(ByteArray(48) { 0x99.toByte() }, 12, 8)
|
||||
DisplayListRenderer(emptyMap()).execute(DrawProtocol.sequence(listOf(plain)), corners)
|
||||
assertEquals(9, corners.get(2, 1)); assertEquals(3, corners.get(5, 1))
|
||||
assertFails { DisplayListRenderer(emptyMap()).execute(DrawProtocol.sequence(listOf(plain + byteArrayOf(16))), corners) }
|
||||
assertFails { DrawProtocol.roundedRect(DrawValue.Integer(0), DrawValue.Integer(0), 8, 6, 3, 0, 3, outside = 16) }
|
||||
}
|
||||
|
||||
@Test fun replayWithAnUnknownRecordDrawsNothing() {
|
||||
val list = read(registeredReplay(imageKnown = false), 1100)
|
||||
assertTrue(list.resources.isEmpty())
|
||||
|
||||
@@ -73,7 +73,7 @@ test('system menu bridge shifts its surface and selected row together by +4',()=
|
||||
test('unselected sidebar icons retain -2 depth through shell cropping, including attention badges',()=>{
|
||||
const shellScene=require('../.test-build/app/graphics/shell-scene.js');
|
||||
const {ShellChromeLayer}=load('app/ui/shell/chrome-layer.ts',{
|
||||
'../../graphics/shell-scene':shellScene,'../../graphics/image':graphics,
|
||||
'../../graphics/shell-scene':shellScene,'../../graphics/image':graphics,'../../graphics/display-list':require('../.test-build/app/graphics/display-list.js'),
|
||||
'../../graphics/ui-fonts':{getDefaultSmallFont:()=>font,getDefaultMediumFont:()=>font},
|
||||
'../../graphics/textwrap':{},'./ambient-cards':{},'../../graphics/battery':{},
|
||||
'../../native/notification-icons':{},'../../native/phone-battery':{},'../../util/render-freshness':{},
|
||||
|
||||
@@ -11,7 +11,7 @@ const { MENU_BOUNCE_DURATION_MS, scrollOffsetExpression } = require('../.test-bu
|
||||
const { encodePresentation } = require('../.test-build/app/graphics/presentation-wire.js');
|
||||
const { setMenuAnimationReader } = require('../.test-build/app/ui/menu-animation-pref.js');
|
||||
// Also consumed by FrameDisplayListTest.kt.
|
||||
const SCROLL = '078a000000030002000400020000070000009600000001000200040011223344556677880200020000000000ff250100300102300180f0800180f0161101001732800180f01610300180f0302341403101001102000200010008000000ff280101300100300180f0800180f0161101001732800180f01610300180f030234140310100170100160400020000000103';
|
||||
const SCROLL = '078b000000030002000400020000070000009600000001000200040011223344556677880200020000000000ff250100300102300180f0800180f0161101001732800180f01610300180f0302341403101001102000200010008000000ff280101300100300180f0800180f0161101001732800180f01610300180f03023414031010017010016040002000000010310';
|
||||
|
||||
const BOX = { x: 10, y: 5, width: 40, height: 60 };
|
||||
const ITEMS = ['a', 'b', 'c', 'd', 'e', 'f', 'g'];
|
||||
|
||||
Reference in new issue
Block a user