diff --git a/main.c b/main.c index 5f86ab1..a16aa63 100644 --- a/main.c +++ b/main.c @@ -270,7 +270,7 @@ static void set_keyboard_hidden(bool is_hidden) { lv_anim_t keyboard_anim; lv_anim_init(&keyboard_anim); lv_anim_set_var(&keyboard_anim, keyboard); - lv_anim_set_values(&keyboard_anim, is_hidden ? 0 : lv_obj_get_height(keyboard), is_hidden ? lv_obj_get_y(keyboard) : 0); + lv_anim_set_values(&keyboard_anim, is_hidden ? 0 : lv_obj_get_height(keyboard), is_hidden ? lv_obj_get_height(keyboard) : 0); lv_anim_set_path_cb(&keyboard_anim, lv_anim_path_ease_out); lv_anim_set_time(&keyboard_anim, 500); lv_anim_set_exec_cb(&keyboard_anim, keyboard_anim_y_cb); @@ -472,9 +472,10 @@ int main(int argc, char *argv[]) { lv_obj_clear_flag(lv_scr_act(), LV_OBJ_FLAG_SCROLLABLE); /* Figure out a few numbers for sizing and positioning */ - const int keyboard_height = ver_res > hor_res ? ver_res / 3 : ver_res / 2; - const int padding = keyboard_height / 8; - const int label_width = hor_res - 2 * padding; + const int base_keyboard_height = ver_res > hor_res ? ver_res / 3 : ver_res / 2; /* Height for 4 rows */ + const int keyboard_height = base_keyboard_height * 1.25; /* Add space for an extra top row */ + const int padding = keyboard_height / 10; + // const int label_width = hor_res - 2 * padding; const int textarea_container_max_width = LV_MIN(hor_res, ver_res); /* Main flexbox */ @@ -483,8 +484,9 @@ int main(int argc, char *argv[]) { lv_obj_set_flex_align(container, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); lv_obj_set_size(container, LV_PCT(100), ver_res - keyboard_height); lv_obj_set_pos(container, 0, 0); - lv_obj_set_style_pad_row(container, padding, LV_PART_MAIN); - lv_obj_set_style_pad_bottom(container, padding, LV_PART_MAIN); + // lv_obj_set_style_pad_row(container, padding, LV_PART_MAIN); + // lv_obj_set_style_pad_bottom(container, padding, LV_PART_MAIN); + lv_obj_clear_flag(container, LV_OBJ_FLAG_SCROLLABLE); /* Header flexbox */ lv_obj_t *header = lv_obj_create(container); @@ -526,31 +528,36 @@ int main(int argc, char *argv[]) { lv_label_set_text(shutdown_btn_label, LV_SYMBOL_POWER); lv_obj_center(shutdown_btn_label); + /* Flexible spacer */ + lv_obj_t *flexible_spacer = lv_obj_create(container); + lv_obj_set_size(flexible_spacer, LV_PCT(100), 0); + lv_obj_set_flex_grow(flexible_spacer, 1); + /* Label container */ - lv_obj_t *label_container = lv_obj_create(container); - lv_obj_set_size(label_container, label_width, LV_PCT(100)); - lv_obj_set_flex_grow(label_container, 1); + // lv_obj_t *label_container = lv_obj_create(container); + // lv_obj_set_size(label_container, label_width, LV_PCT(100)); + // lv_obj_set_flex_grow(label_container, 1); - /* Label */ - lv_obj_t *spangroup = lv_spangroup_create(label_container); - lv_spangroup_set_align(spangroup, LV_TEXT_ALIGN_CENTER); - lv_spangroup_set_mode(spangroup, LV_SPAN_MODE_BREAK); - lv_spangroup_set_overflow(spangroup, LV_SPAN_OVERFLOW_ELLIPSIS); - lv_span_t *span1 = lv_spangroup_new_span(spangroup); + // /* Label */ + // lv_obj_t *spangroup = lv_spangroup_create(label_container); + // lv_spangroup_set_align(spangroup, LV_TEXT_ALIGN_CENTER); + // lv_spangroup_set_mode(spangroup, LV_SPAN_MODE_BREAK); + // lv_spangroup_set_overflow(spangroup, LV_SPAN_OVERFLOW_ELLIPSIS); + // lv_span_t *span1 = lv_spangroup_new_span(spangroup); - /* Label text */ - const char *crypttab_tried = getenv("CRYPTTAB_TRIED"); - if (crypttab_tried && atoi(crypttab_tried) > 0) { - lv_span_set_text(span1, "Password incorrect"); - } else { - lv_span_set_text(span1, "Password required for booting"); - } + // /* Label text */ + // const char *crypttab_tried = getenv("CRYPTTAB_TRIED"); + // if (crypttab_tried && atoi(crypttab_tried) > 0) { + // lv_span_set_text(span1, "Password incorrect"); + // } else { + // lv_span_set_text(span1, "Password required for booting"); + // } - /* Size label to content */ - const lv_coord_t label_height = lv_spangroup_get_expand_height(spangroup, label_width); - lv_obj_set_style_max_height(spangroup, LV_PCT(100), LV_PART_MAIN); - lv_obj_set_size(spangroup, label_width, label_height); - lv_obj_set_align(spangroup, LV_ALIGN_BOTTOM_MID); + // /* Size label to content */ + // const lv_coord_t label_height = lv_spangroup_get_expand_height(spangroup, label_width); + // lv_obj_set_style_max_height(spangroup, LV_PCT(100), LV_PART_MAIN); + // lv_obj_set_size(spangroup, label_width, label_height); + // lv_obj_set_align(spangroup, LV_ALIGN_BOTTOM_MID); /* Textarea flexbox */ lv_obj_t *textarea_container = lv_obj_create(container); @@ -589,10 +596,14 @@ int main(int argc, char *argv[]) { lv_obj_set_size(toggle_kb_btn, dropwdown_height, dropwdown_height); lv_obj_set_size(shutdown_btn, dropwdown_height, dropwdown_height); - /* Hide label if it clips veritcally */ - if (label_height > lv_obj_get_height(label_container)) { - lv_obj_set_height(spangroup, 0); - } + /* Fixed spacer */ + lv_obj_t *fixed_spacer = lv_obj_create(container); + lv_obj_set_size(fixed_spacer, LV_PCT(100), padding); + + // /* Hide label if it clips veritcally */ + // if (label_height > lv_obj_get_height(label_container)) { + // lv_obj_set_height(spangroup, 0); + // } /* Keyboard (after textarea / label so that key popovers are not drawn over) */ keyboard = lv_keyboard_create(lv_scr_act()); diff --git a/screenshots/breezy-dark-1024x768.png b/screenshots/breezy-dark-1024x768.png index 0c08037..7252ba7 100644 Binary files a/screenshots/breezy-dark-1024x768.png and b/screenshots/breezy-dark-1024x768.png differ diff --git a/screenshots/breezy-dark-1280x800.png b/screenshots/breezy-dark-1280x800.png index 941c13e..e7997e0 100644 Binary files a/screenshots/breezy-dark-1280x800.png and b/screenshots/breezy-dark-1280x800.png differ diff --git a/screenshots/breezy-dark-1440x720.png b/screenshots/breezy-dark-1440x720.png index a2d59d5..fcbe6fd 100644 Binary files a/screenshots/breezy-dark-1440x720.png and b/screenshots/breezy-dark-1440x720.png differ diff --git a/screenshots/breezy-dark-1920x1080.png b/screenshots/breezy-dark-1920x1080.png index e167fd1..b9f746e 100644 Binary files a/screenshots/breezy-dark-1920x1080.png and b/screenshots/breezy-dark-1920x1080.png differ diff --git a/screenshots/breezy-dark-480x800.png b/screenshots/breezy-dark-480x800.png index 9f76ec1..d50a858 100644 Binary files a/screenshots/breezy-dark-480x800.png and b/screenshots/breezy-dark-480x800.png differ diff --git a/screenshots/breezy-dark-540x960.png b/screenshots/breezy-dark-540x960.png index 30cc40f..d4f754a 100644 Binary files a/screenshots/breezy-dark-540x960.png and b/screenshots/breezy-dark-540x960.png differ diff --git a/screenshots/breezy-dark-768x1024.png b/screenshots/breezy-dark-768x1024.png index 12e0d30..2e54e5c 100644 Binary files a/screenshots/breezy-dark-768x1024.png and b/screenshots/breezy-dark-768x1024.png differ diff --git a/screenshots/breezy-dark-800x480.png b/screenshots/breezy-dark-800x480.png index dc91c44..a76c18c 100644 Binary files a/screenshots/breezy-dark-800x480.png and b/screenshots/breezy-dark-800x480.png differ diff --git a/screenshots/breezy-dark-960x540.png b/screenshots/breezy-dark-960x540.png index 9ce648f..943e6dd 100644 Binary files a/screenshots/breezy-dark-960x540.png and b/screenshots/breezy-dark-960x540.png differ diff --git a/screenshots/breezy-light-1024x768.png b/screenshots/breezy-light-1024x768.png index 4c4efb1..5fd9e29 100644 Binary files a/screenshots/breezy-light-1024x768.png and b/screenshots/breezy-light-1024x768.png differ diff --git a/screenshots/breezy-light-1280x800.png b/screenshots/breezy-light-1280x800.png index 92cc5b1..17422e0 100644 Binary files a/screenshots/breezy-light-1280x800.png and b/screenshots/breezy-light-1280x800.png differ diff --git a/screenshots/breezy-light-1440x720.png b/screenshots/breezy-light-1440x720.png index d2ba1f7..cd2b4b6 100644 Binary files a/screenshots/breezy-light-1440x720.png and b/screenshots/breezy-light-1440x720.png differ diff --git a/screenshots/breezy-light-1920x1080.png b/screenshots/breezy-light-1920x1080.png index 9de2224..1d20a17 100644 Binary files a/screenshots/breezy-light-1920x1080.png and b/screenshots/breezy-light-1920x1080.png differ diff --git a/screenshots/breezy-light-480x800.png b/screenshots/breezy-light-480x800.png index 73e8a9d..95547af 100644 Binary files a/screenshots/breezy-light-480x800.png and b/screenshots/breezy-light-480x800.png differ diff --git a/screenshots/breezy-light-540x960.png b/screenshots/breezy-light-540x960.png index 6d69dee..d1e1df4 100644 Binary files a/screenshots/breezy-light-540x960.png and b/screenshots/breezy-light-540x960.png differ diff --git a/screenshots/breezy-light-768x1024.png b/screenshots/breezy-light-768x1024.png index e47f087..8629eac 100644 Binary files a/screenshots/breezy-light-768x1024.png and b/screenshots/breezy-light-768x1024.png differ diff --git a/screenshots/breezy-light-800x480.png b/screenshots/breezy-light-800x480.png index 8f4f82f..e439d57 100644 Binary files a/screenshots/breezy-light-800x480.png and b/screenshots/breezy-light-800x480.png differ diff --git a/screenshots/breezy-light-960x540.png b/screenshots/breezy-light-960x540.png index 7822ea8..8a08af5 100644 Binary files a/screenshots/breezy-light-960x540.png and b/screenshots/breezy-light-960x540.png differ diff --git a/screenshots/pmos-dark-1024x768.png b/screenshots/pmos-dark-1024x768.png index 3a3d9dd..ec64231 100644 Binary files a/screenshots/pmos-dark-1024x768.png and b/screenshots/pmos-dark-1024x768.png differ diff --git a/screenshots/pmos-dark-1280x800.png b/screenshots/pmos-dark-1280x800.png index 58075ea..905b936 100644 Binary files a/screenshots/pmos-dark-1280x800.png and b/screenshots/pmos-dark-1280x800.png differ diff --git a/screenshots/pmos-dark-1440x720.png b/screenshots/pmos-dark-1440x720.png index 08517c5..e60346c 100644 Binary files a/screenshots/pmos-dark-1440x720.png and b/screenshots/pmos-dark-1440x720.png differ diff --git a/screenshots/pmos-dark-1920x1080.png b/screenshots/pmos-dark-1920x1080.png index f51651f..72a1ed7 100644 Binary files a/screenshots/pmos-dark-1920x1080.png and b/screenshots/pmos-dark-1920x1080.png differ diff --git a/screenshots/pmos-dark-480x800.png b/screenshots/pmos-dark-480x800.png index 3202817..962a745 100644 Binary files a/screenshots/pmos-dark-480x800.png and b/screenshots/pmos-dark-480x800.png differ diff --git a/screenshots/pmos-dark-540x960.png b/screenshots/pmos-dark-540x960.png index 80fbef5..a09a7ef 100644 Binary files a/screenshots/pmos-dark-540x960.png and b/screenshots/pmos-dark-540x960.png differ diff --git a/screenshots/pmos-dark-768x1024.png b/screenshots/pmos-dark-768x1024.png index 34e9941..3949fff 100644 Binary files a/screenshots/pmos-dark-768x1024.png and b/screenshots/pmos-dark-768x1024.png differ diff --git a/screenshots/pmos-dark-800x480.png b/screenshots/pmos-dark-800x480.png index a0afc5b..9f9340d 100644 Binary files a/screenshots/pmos-dark-800x480.png and b/screenshots/pmos-dark-800x480.png differ diff --git a/screenshots/pmos-dark-960x540.png b/screenshots/pmos-dark-960x540.png index 3a886a4..9965433 100644 Binary files a/screenshots/pmos-dark-960x540.png and b/screenshots/pmos-dark-960x540.png differ diff --git a/screenshots/pmos-light-1024x768.png b/screenshots/pmos-light-1024x768.png index 237082a..645e568 100644 Binary files a/screenshots/pmos-light-1024x768.png and b/screenshots/pmos-light-1024x768.png differ diff --git a/screenshots/pmos-light-1280x800.png b/screenshots/pmos-light-1280x800.png index b8c2536..61de1fb 100644 Binary files a/screenshots/pmos-light-1280x800.png and b/screenshots/pmos-light-1280x800.png differ diff --git a/screenshots/pmos-light-1440x720.png b/screenshots/pmos-light-1440x720.png index 49a626d..99ea6a2 100644 Binary files a/screenshots/pmos-light-1440x720.png and b/screenshots/pmos-light-1440x720.png differ diff --git a/screenshots/pmos-light-1920x1080.png b/screenshots/pmos-light-1920x1080.png index 3cf97cd..48d38c6 100644 Binary files a/screenshots/pmos-light-1920x1080.png and b/screenshots/pmos-light-1920x1080.png differ diff --git a/screenshots/pmos-light-480x800.png b/screenshots/pmos-light-480x800.png index 2faee8a..7179e10 100644 Binary files a/screenshots/pmos-light-480x800.png and b/screenshots/pmos-light-480x800.png differ diff --git a/screenshots/pmos-light-540x960.png b/screenshots/pmos-light-540x960.png index 707f49d..abecdb6 100644 Binary files a/screenshots/pmos-light-540x960.png and b/screenshots/pmos-light-540x960.png differ diff --git a/screenshots/pmos-light-768x1024.png b/screenshots/pmos-light-768x1024.png index 66f7bdb..f01d022 100644 Binary files a/screenshots/pmos-light-768x1024.png and b/screenshots/pmos-light-768x1024.png differ diff --git a/screenshots/pmos-light-800x480.png b/screenshots/pmos-light-800x480.png index b5152db..3f6be13 100644 Binary files a/screenshots/pmos-light-800x480.png and b/screenshots/pmos-light-800x480.png differ diff --git a/screenshots/pmos-light-960x540.png b/screenshots/pmos-light-960x540.png index 4e60fa7..e32aac5 100644 Binary files a/screenshots/pmos-light-960x540.png and b/screenshots/pmos-light-960x540.png differ