/[grub]/grub2/util/console.c
ViewVC logotype

Diff of /grub2/util/console.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by okuji, Tue Feb 15 00:07:01 2005 UTC revision 1.7 by okuji, Sat Feb 19 20:56:07 2005 UTC
# Line 28  static int grub_console_attr = A_NORMAL; Line 28  static int grub_console_attr = A_NORMAL;
28  static void  static void
29  grub_ncurses_putchar (grub_uint32_t c)  grub_ncurses_putchar (grub_uint32_t c)
30  {  {
31      /* Better than nothing.  */
32      switch (c)
33        {
34        case GRUB_TERM_DISP_LEFT:
35          c = '<';
36          break;
37    
38        case GRUB_TERM_DISP_UP:
39          c = '^';
40          break;
41    
42        case GRUB_TERM_DISP_RIGHT:
43          c = '>';
44          break;
45    
46        case GRUB_TERM_DISP_DOWN:
47          c = 'v';
48          break;
49    
50        case GRUB_TERM_DISP_HLINE:
51          c = '-';
52          break;
53    
54        case GRUB_TERM_DISP_VLINE:
55          c = '|';
56          break;
57    
58        case GRUB_TERM_DISP_UL:
59        case GRUB_TERM_DISP_UR:
60        case GRUB_TERM_DISP_LL:
61        case GRUB_TERM_DISP_LR:
62          c = '+';
63          break;
64    
65        default:
66          break;
67        }
68      
69    addch (c | grub_console_attr);    addch (c | grub_console_attr);
70  }  }
71    
# Line 57  grub_ncurses_setcolor (grub_uint8_t norm Line 95  grub_ncurses_setcolor (grub_uint8_t norm
95    color_set (normal_color << 8 | highlight_color, 0);    color_set (normal_color << 8 | highlight_color, 0);
96  }  }
97    
98    static int saved_char = ERR;
99    
100  static int  static int
101  grub_ncurses_checkkey (void)  grub_ncurses_checkkey (void)
102  {  {
103    return 1;    int c;
104      
105      /* Check for SAVED_CHAR. This should not be true, because this
106         means checkkey is called twice continuously.  */
107      if (saved_char != ERR)
108        return 1;
109      
110      wtimeout (stdscr, 100);
111      c = getch ();
112      /* If C is not ERR, then put it back in the input queue.  */
113      if (c != ERR)
114        {
115          saved_char = c;
116          return 1;
117        }
118    
119      return 0;
120  }  }
121    
122  static int  static int
123  grub_ncurses_getkey (void)  grub_ncurses_getkey (void)
124  {  {
125    int c = getch ();    int c;
126      
127      /* If checkkey has already got a character, then return it.  */
128      if (saved_char != ERR)
129        {
130          c = saved_char;
131          saved_char = ERR;
132        }
133      else
134        {
135          wtimeout (stdscr, -1);
136          c = getch ();
137        }
138    
139    switch (c)    switch (c)
140      {      {
# Line 161  static grub_err_t Line 229  static grub_err_t
229  grub_ncurses_init (void)  grub_ncurses_init (void)
230  {  {
231    initscr ();    initscr ();
232    cbreak ();    raw ();
233    noecho ();    noecho ();
234    scrollok (stdscr, TRUE);    scrollok (stdscr, TRUE);
235    

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26