11#ifndef AMALGAMATED_BUILD
2+ #include <string.h>
3+
24#include "../button_events.h"
35#include "../display.h"
46#include "../jade_assert.h"
@@ -47,6 +49,22 @@ static gui_view_node_t* make_home_screen_panel_item(const color_t color, home_me
4749 return item ;
4850}
4951
52+ static const char * get_home_screen_title (const char * device_name )
53+ {
54+ static const char prefix [] = "Jade " ;
55+ // Match the status-bar title column width from make_status_bar().
56+ const int title_width_percent = HOME_SCREEN_DEEP_STATUS_BAR ? 35 : 57 ;
57+ const int title_width = (CONFIG_DISPLAY_WIDTH * title_width_percent ) / 100 ;
58+
59+ display_set_font (GUI_TITLE_FONT );
60+ if (display_get_string_width (device_name ) <= title_width ) {
61+ return device_name ;
62+ }
63+
64+ return strncmp (device_name , prefix , sizeof (prefix ) - 1 ) == 0 ? device_name + sizeof (prefix ) - 1
65+ : device_name ;
66+ }
67+
5068gui_activity_t * make_home_screen_activity (const char * device_name , const char * firmware_version ,
5169 home_menu_entry_t * selected_entry , home_menu_entry_t * next_entry , gui_view_node_t * * status_light ,
5270 gui_view_node_t * * status_text , gui_view_node_t * * label )
@@ -62,7 +80,7 @@ gui_activity_t* make_home_screen_activity(const char* device_name, const char* f
6280 // NOTE: The home screen is created as an 'unmanaged' activity as
6381 // its lifetime is same as that of the entire application
6482 gui_activity_t * act = NULL ;
65- gui_make_activity_ex (& act , true, device_name , false);
83+ gui_make_activity_ex (& act , true, get_home_screen_title ( device_name ) , false);
6684 JADE_ASSERT (act );
6785
6886 gui_view_node_t * node ;
0 commit comments