Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/kernel_chooser/nGUI2.c b/kernel_chooser/nGUI2.c
- index 602e57f..17dc57c 100644
- --- a/kernel_chooser/nGUI2.c
- +++ b/kernel_chooser/nGUI2.c
- @@ -5,6 +5,8 @@
- #include <stdlib.h>
- #include <errno.h>
- #include <wait.h>
- +#include <linux/input.h>
- +#include <stdint.h>
- #include "common3.h"
- #include "menu3.h"
- @@ -284,6 +286,8 @@ int nc_compute_menu(menu_entry *list)
- /* Print title */
- mvprintw(0,0,"%s",HEADER_LEFT);
- mvprintw(0,COLS-strlen(HEADER_RIGHT),"%s",HEADER_RIGHT);
- + refresh();
- + fb_crefresh(0,0,COLS,1);
- /* Create the window to be associated with the menu */
- menu_window = newwin( menu_sizey, menu_sizex, 5, (COLS-menu_sizex)/2);
- @@ -333,9 +337,12 @@ int nc_compute_menu(menu_entry *list)
- attroff(COLOR_PAIR(COLOR_MENU_BORDER));
- attron(COLOR_PAIR(COLOR_LOG_ERROR));
- - mvprintw(7+menu_sizey,(COLS-ARRAY_SIZE(HELP_MESSAGE))/2,HELP_MESSAGE);
- + mvprintw(7+menu_sizey,(COLS-strlen(HELP_MESSAGE))/2,HELP_MESSAGE);
- attroff(COLOR_PAIR(COLOR_LOG_ERROR));
- refresh();
- + fb_crefresh((COLS-strlen(HELP_MESSAGE))/2,7+menu_sizey,strlen(HELP_MESSAGE),1);
- +
- + //fb_crefresh(0,0,COLS,LINES); //redraw the whole background
- return 0;
- error:
- @@ -393,7 +400,7 @@ void nc_help_popup()
- unpost_menu(menu[menu_i]); // E_POSTED from nc_get_user_choice
- attron(COLOR_PAIR(COLOR_POPUP));
- - create_box( menu_sizey+3, menu_sizex*(3/4)+1, y-1, x-2);
- + create_box( menu_sizey+3, menu_sizex+1, y-1, x-2);
- for(i=0;strings[i];i++)
- {
- mvprintw(y+i,x,strings[i]);
- @@ -421,6 +428,8 @@ int nc_get_user_choice()
- wrefresh(messages_win);
- refresh();
- + //fb_crefresh((COLS-menu_sizex)/2-1, 2, menu_sizex+2, menu_sizey+4);
- +
- while((c = wgetch(menu_window)) != 10)
- {
- DEBUG("key %i (%c)\n", c, c);
- @@ -440,17 +449,18 @@ int nc_get_user_choice()
- case KEY_PPAGE:
- menu_driver(menu[menu_i], REQ_SCR_UPAGE);
- break;
- + case KEY_POWER:
- case HELP_KEY:
- nc_help_popup();
- goto post_menu;
- - case 'r':
- + case MENU_TOGGLE_KEY:
- unpost_menu(menu[menu_i]);
- if (menu_i == MENU_POWER)
- menu_i = MENU_MAIN;
- else
- menu_i = MENU_POWER;
- goto post_menu;
- - case '=':
- + case SCREENSHOT_KEY:
- return MENU_SCREENSHOT;
- }
- wrefresh(menu_window);
- @@ -475,6 +485,7 @@ int nc_get_user_choice()
- int nc_push_message(int i, char *prefix, char *fmt,...)
- {
- va_list ap;
- + int sizex, sizey;
- if(!messages_win)
- return ERR;
- @@ -486,6 +497,11 @@ int nc_push_message(int i, char *prefix, char *fmt,...)
- vwprintw(messages_win,fmt,ap);
- wrefresh(messages_win);
- va_end(ap);
- +
- + sizey = (LINES * MSG_HEIGHT_PERC)/100;
- + sizex = (COLS * MSG_WIDTH_PERC)/100;
- + fb_crefresh(0,(LINES-sizey)+2,sizex,sizey-2);
- +
- return 0;
- }
- @@ -509,10 +525,12 @@ void nc_status(char *msg)
- */
- int nc_wait_for_keypress(void)
- {
- - int x,y,timeout;
- + int x,y,timeout,len;
- +
- + len = snprintf(NULL,0,WAIT_MESSAGE,0);
- y = (LINES/2)-1;
- - x = (COLS - snprintf(NULL,0,WAIT_MESSAGE,0))/2;
- + x = (COLS - len)/2;
- /* this set an internal timeout for the getch() call.
- * 'man 3 timeout' for more info.
- @@ -523,6 +541,7 @@ int nc_wait_for_keypress(void)
- for (timeout=TIMEOUT_BOOT; timeout>0; timeout--) {
- mvprintw(y,x,WAIT_MESSAGE, timeout);
- refresh();
- + fb_crefresh(x,y,len,1);
- if (getch() != ERR) {
- mvprintw(y,x,"%*s",COLS-x-1," ");
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment