gui_server_api/
consts.rs

1// SPDX-FileCopyrightText: 2023 Foundation Devices, Inc. <hello@foundation.xyz>
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4pub const CONTROL_CENTER_HEIGHT_COLLAPSED_PX: usize = 40;
5pub const CONTROL_CENTER_HEIGHT_EXPANDED_PX: usize = 400;
6
7/// The minimal height of the Control Center when dragged down
8pub const CONTROL_CENTER_MIN_HEIGHT_PX: usize =
9    CONTROL_CENTER_HEIGHT_COLLAPSED_PX + CONTROL_CENTER_DRAG_MARGIN_PX + 12;
10
11/// Number of pixels on the lower part of the Control Center where user can grab and drag
12/// it
13pub const CONTROL_CENTER_DRAG_MARGIN_PX: usize = 42;
14
15pub const CONTROL_CENTER_BG_COLOR: u32 = 0xd3d2d0;
16
17pub const DEFAULT_KEYBOARD_HEIGHT: usize = 396;
18pub const KEYBOARD_TOP_BAR_MARGIN: usize = 90;
19pub const KEYBOARD_BG_COLOR: u32 = 0x332824;
20
21pub const SCREEN_WIDTH: usize = 480;
22pub const SCREEN_HEIGHT: usize = 800;
23
24/// Size of a full-screen framebuffer in bytes (SCREEN_WIDTH * SCREEN_HEIGHT * 4 bytes per pixel).
25pub const FB_SIZE: usize = SCREEN_WIDTH * SCREEN_HEIGHT * 4;
26
27pub const FPS: usize = 40;
28
29/// Max height of the modal (popup) window.
30pub const MODAL_HEIGHT: usize = 600;
31
32/// Height of the area around modal top drag bar where the modal will get dragged if touched
33pub const MODAL_DRAG_BAR_MARGIN_PX: usize = 32;
34
35// Simulator consts
36// Native (1x) size of the device-frame artwork (assets/device.png). The window
37// is sized DEVICE_WIDTH/HEIGHT * scale_factor, and the composite buffers derive
38// from these, so updating them here covers every scale mode.
39pub const DEVICE_WIDTH: u32 = 592;
40pub const DEVICE_HEIGHT: u32 = 1114;
41// Origin of the inset screen within the device-frame artwork, in native (1x)
42// pixels. The whole device composite is scaled by the scale factor afterward,
43// so this offset stays aligned at every scale. Both the rendered screen and the
44// touch area (TOUCH_AREA_X/Y) derive from these, so they move together.
45pub const LCD_X: u32 = 56;
46pub const LCD_Y: u32 = 138;
47
48// Physical coordinates of the virtual touch button area (as they come from the hardware)
49pub const VIRT_BUTTON_PHYS_ORIGIN_X: usize = 0;
50pub const VIRT_BUTTON_PHYS_ORIGIN_Y: usize = 850;
51pub const VIRT_BUTTON_PHYS_WIDTH: usize = 200;
52pub const VIRT_BUTTON_PHYS_HEIGHT: usize = 121;
53
54pub const CLOSE_TIMEOUT_EXIT_CODE: u32 = 2525;