Skip to content

Commit

Permalink
Add loading screen explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
konect-V committed Sep 22, 2024
1 parent 53a29dd commit 6ece291
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions sources/core/apps/explorer/source/core/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#define ICON_BORDER_FOCUS_COLOR (0x14bacb)
#define ICON_BORDER_MARGIN (5)
#define ICON_MARGIN (20)
#define LOADING_SIZE (18)

kfont_t font;

Expand Down Expand Up @@ -480,6 +481,13 @@ int reload_icons(){
return 0;
}

void show_loading_screen(){
memset(fb.buffer, 0, fb.size);
load_pen(font, &fb, 0, 0, LOADING_SIZE, 0, DATE_TIME_COLOR);
write_paragraph(font, 0, (fb.height - LOADING_SIZE) / 2, fb.width, PARAGRAPH_CENTER, "Loading...", -1);
draw_frame();
}

void get_input(){
static bool arrow_pressed = false;
static bool wait_release = false;
Expand Down Expand Up @@ -558,10 +566,12 @@ void get_input(){
focus_icon_row = 0;
focus_icon_column = 0;
current_page = 0;
show_loading_screen();
process_icons();
update_icon_page = true;
}else{
if(icons_executable_path[c] != NULL){
show_loading_screen();
pid_t p = fork();
if(p < 0){
perror("explorer: fork failed");
Expand All @@ -585,6 +595,7 @@ void get_input(){
reload_icons();
}
}else if(icons_try_to_execute[c]){
show_loading_screen();
pid_t p = fork();
if(p < 0){
perror("explorer: fork failed");
Expand Down Expand Up @@ -616,6 +627,7 @@ void get_input(){
}
}else if(key == 62 && pressed){
// open bash
show_loading_screen();
pid_t p = fork();
if(p < 0){
perror("desktop: fork failed");
Expand All @@ -641,6 +653,7 @@ void get_input(){
}
}else if(key == 61 && pressed){
// go back directory
show_loading_screen();
char* parent_directory = get_parent_directory(current_path);
free(current_path);
current_path = parent_directory;
Expand All @@ -655,6 +668,7 @@ void get_input(){
current_page++;
focus_icon_row = 0;
focus_icon_column = 0;
show_loading_screen();
process_icons();
update_icon_page = true;
}
Expand All @@ -664,6 +678,7 @@ void get_input(){
current_page--;
focus_icon_row = 0;
focus_icon_column = 0;
show_loading_screen();
process_icons();
update_icon_page = true;
}
Expand Down

0 comments on commit 6ece291

Please sign in to comment.