fix: make login screen use asterisks instead of bullets, bump >6 app limit in Files
This commit is contained in:
@@ -60,9 +60,9 @@ struct FileManagerState {
|
|||||||
|
|
||||||
// Apps view
|
// Apps view
|
||||||
bool at_apps_view;
|
bool at_apps_view;
|
||||||
int app_map[16]; // entry index -> external_apps[] index
|
int app_map[64]; // entry index -> external_apps[] index
|
||||||
SvgIcon app_icons_lg[16]; // 48x48 icons for grid view
|
SvgIcon app_icons_lg[64]; // 48x48 icons for grid view
|
||||||
SvgIcon app_icons_sm[16]; // 16x16 icons for list view
|
SvgIcon app_icons_sm[64]; // 16x16 icons for list view
|
||||||
int app_icon_count;
|
int app_icon_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ void filemanager_read_apps(FileManagerState* fm) {
|
|||||||
/*
|
/*
|
||||||
TODO: Fix crash if 16-app ceiling is removed and remove ceiling
|
TODO: Fix crash if 16-app ceiling is removed and remove ceiling
|
||||||
*/
|
*/
|
||||||
for (int i = 0; i < count && fm->entry_count < 16; i++) {
|
for (int i = 0; i < count && fm->entry_count < 64; i++) {
|
||||||
const char* raw = entries[i];
|
const char* raw = entries[i];
|
||||||
// Strip "apps/" prefix
|
// Strip "apps/" prefix
|
||||||
if (raw[0] == 'a' && raw[1] == 'p' && raw[2] == 'p' && raw[3] == 's' && raw[4] == '/')
|
if (raw[0] == 'a' && raw[1] == 'p' && raw[2] == 'p' && raw[3] == 's' && raw[4] == '/')
|
||||||
|
|||||||
@@ -102,8 +102,6 @@ inline constexpr int FIELD_GAP = 12;
|
|||||||
inline constexpr int POWER_BTN_W = 104;
|
inline constexpr int POWER_BTN_W = 104;
|
||||||
inline constexpr int POWER_BTN_GAP = 8;
|
inline constexpr int POWER_BTN_GAP = 8;
|
||||||
inline constexpr int FOOTER_PAD = 16;
|
inline constexpr int FOOTER_PAD = 16;
|
||||||
inline constexpr int PASSWORD_MASK_CODEPOINT = 0x2022;
|
|
||||||
|
|
||||||
struct LoginLayout {
|
struct LoginLayout {
|
||||||
gui::Rect card;
|
gui::Rect card;
|
||||||
gui::Rect titlebar;
|
gui::Rect titlebar;
|
||||||
|
|||||||
@@ -53,69 +53,8 @@ void draw_text_slice(Framebuffer& fb, int x, int y, const char* text,
|
|||||||
else draw_text(fb, x, y, tmp, fg);
|
else draw_text(fb, x, y, tmp, fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PasswordMaskGlyph {
|
|
||||||
bool initialized;
|
|
||||||
bool use_system_font;
|
|
||||||
int width, height;
|
|
||||||
int xoff, yoff;
|
|
||||||
int ascent;
|
|
||||||
int line_height;
|
|
||||||
uint8_t* bitmap;
|
|
||||||
};
|
|
||||||
|
|
||||||
PasswordMaskGlyph& password_mask_glyph() {
|
|
||||||
static PasswordMaskGlyph glyph = {};
|
|
||||||
if (glyph.initialized) return glyph;
|
|
||||||
|
|
||||||
glyph.initialized = true;
|
|
||||||
if (!fonts::system_font || !fonts::system_font->valid) return glyph;
|
|
||||||
|
|
||||||
GlyphCache* gc = fonts::system_font->get_cache(fonts::UI_SIZE);
|
|
||||||
glyph.ascent = gc->ascent;
|
|
||||||
glyph.line_height = gc->line_height;
|
|
||||||
|
|
||||||
int x0, y0, x1, y1;
|
|
||||||
stbtt_GetCodepointBitmapBox(&fonts::system_font->info, PASSWORD_MASK_CODEPOINT,
|
|
||||||
gc->scale, gc->scale, &x0, &y0, &x1, &y1);
|
|
||||||
glyph.width = x1 - x0;
|
|
||||||
glyph.height = y1 - y0;
|
|
||||||
glyph.xoff = x0;
|
|
||||||
glyph.yoff = y0;
|
|
||||||
|
|
||||||
if (glyph.width > 0 && glyph.height > 0) {
|
|
||||||
glyph.bitmap = (uint8_t*)montauk::malloc(glyph.width * glyph.height);
|
|
||||||
if (glyph.bitmap) {
|
|
||||||
stbtt_MakeCodepointBitmap(&fonts::system_font->info, glyph.bitmap,
|
|
||||||
glyph.width, glyph.height, glyph.width,
|
|
||||||
gc->scale, gc->scale, PASSWORD_MASK_CODEPOINT);
|
|
||||||
glyph.use_system_font = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return glyph;
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw_password_mask_char(Framebuffer& fb, int x, int y, Color fg,
|
void draw_password_mask_char(Framebuffer& fb, int x, int y, Color fg,
|
||||||
bool highlight = false, Color bg = colors::TRANSPARENT) {
|
bool highlight = false, Color bg = colors::TRANSPARENT) {
|
||||||
PasswordMaskGlyph& glyph = password_mask_glyph();
|
|
||||||
int advance = password_mask_advance();
|
|
||||||
|
|
||||||
if (glyph.use_system_font && glyph.bitmap) {
|
|
||||||
if (highlight) fb.fill_rect(x, y, advance, glyph.line_height, bg);
|
|
||||||
int baseline = y + glyph.ascent;
|
|
||||||
int gx = x + glyph.xoff;
|
|
||||||
int gy = baseline + glyph.yoff;
|
|
||||||
for (int row = 0; row < glyph.height; row++) {
|
|
||||||
for (int col = 0; col < glyph.width; col++) {
|
|
||||||
uint8_t alpha = glyph.bitmap[row * glyph.width + col];
|
|
||||||
if (!alpha) continue;
|
|
||||||
Color c = {fg.r, fg.g, fg.b, alpha};
|
|
||||||
fb.put_pixel_alpha(gx + col, gy + row, c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (highlight) draw_text_bg(fb, x, y, "*", fg, bg);
|
if (highlight) draw_text_bg(fb, x, y, "*", fg, bg);
|
||||||
else draw_text(fb, x, y, "*", fg);
|
else draw_text(fb, x, y, "*", fg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,17 +145,6 @@ void delete_field_selection(char* buf, int* len, FieldEditState* edit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int password_mask_advance() {
|
int password_mask_advance() {
|
||||||
if (fonts::system_font && fonts::system_font->valid) {
|
|
||||||
GlyphCache* gc = fonts::system_font->get_cache(fonts::UI_SIZE);
|
|
||||||
int advance = 0;
|
|
||||||
int lsb = 0;
|
|
||||||
stbtt_GetCodepointHMetrics(&fonts::system_font->info,
|
|
||||||
PASSWORD_MASK_CODEPOINT,
|
|
||||||
&advance, &lsb);
|
|
||||||
(void)lsb;
|
|
||||||
int scaled = (int)(advance * gc->scale);
|
|
||||||
if (scaled > 0) return scaled;
|
|
||||||
}
|
|
||||||
return text_width("*");
|
return text_width("*");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user