Skip to content

Commit

Permalink
. 修正动画在 checkkey 时不能播放的问题。(issues #208)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaya committed Sep 9, 2019
1 parent 5616d7f commit 34ca1a9
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 13 deletions.
5 changes: 5 additions & 0 deletions ChangeLog_chenall.txt
@@ -1,4 +1,9 @@
更新说明:
2019-09-09(yaya)
1. setmenu 函数增加 --keyhelp-on* --keyhelp-off 参数。
2. 改进 setmenu --string 负数行设定,不随临时调整字体尺寸而变化。
3. 修正动画在 checkkey 时不能播放的问题。

2019-08-08(yaya)
菜单每秒动态更新日期时间。
1. 指定日期时间格式
Expand Down
21 changes: 20 additions & 1 deletion stage2/asm.S
Expand Up @@ -15170,7 +15170,26 @@ ENTRY(console_checkkey)

9:
cmpl $0xFFFFFFFF, %edx
je 1f
jne 3f
pushl $1
call defer
popl %eax
cmpb $0, beep_enable
jz 2f
call beep_func
2:
cmpb $0, string_enable
je 2f
call string_refresh
2:
cmpl $0, graphics_inited
je 1f
cmpb $0, animated_enable
je 1f
call animated
movl $0xFFFFFFFF, %edx
jmp 1f
3:
call remap_ascii_char /* ESI changed */
1:
mov %edx, %eax
Expand Down
25 changes: 20 additions & 5 deletions stage2/builtins.c
Expand Up @@ -16541,7 +16541,7 @@ setmenu_func(char *arg, int flags)
if (y_count_bottom == 0)
strings[i].start_y = val; //y
else
strings[i].start_y = current_term->max_lines - val - 1;
strings[i].start_y = -(val + 1);
}
arg++;
if (safe_parse_maxint (&arg, &val))
Expand All @@ -16560,9 +16560,9 @@ setmenu_func(char *arg, int flags)
if (x_horiz_center)
{
if (string_enable && !*arg)
strings[i].start_x = ((current_term->chars_per_line - 20) >> 1) - 1; //x
strings[i].start_x = ((current_term->chars_per_line - 20) >> 1); //x
else
strings[i].start_x = ((current_term->chars_per_line - num_text_char(arg)) >> 1) - 1; //x
strings[i].start_x = ((current_term->chars_per_line - num_text_char(arg)) >> 1); //x
}
string_width = parse_string(arg);
string_total += string_width;
Expand Down Expand Up @@ -16708,6 +16708,16 @@ setmenu_func(char *arg, int flags)
menu_tab |= 0x10;
arg += 16;
}
else if (grub_memcmp (arg, "--keyhelp-on", 12) == 0)
{
menu_tab &= 0xfb;
arg += 12;
}
else if (grub_memcmp (arg, "--keyhelp-off", 13) == 0)
{
menu_tab |= 4;
arg += 13;
}
else if (grub_memcmp (arg, "--box", 5) == 0)
{
arg = skip_to (0, arg);
Expand Down Expand Up @@ -16853,7 +16863,7 @@ static struct builtin builtin_setmenu =
"--ver-on* --ver-off --lang=en* --lang=zh --u (clear all)\n"
"--left-align* --right-align --middle-align\n"
"--auto-num-off* --auto-num-all-on --auto-num-on --triangle-on* --triangle-off\n"
"--highlight-short* --highlight-full\n"
"--highlight-short* --highlight-full --keyhelp-on* --keyhelp-off\n"
"--font-spacing=FONT:LINE. default 0\n"
"--string=[X]=[-]Y=COLOR=\"STRING\" max 16 commands.\n"
" If no X, text in middle.\n"
Expand Down Expand Up @@ -16921,12 +16931,17 @@ void string_refresh(void)
if (!refresh)
{
unsigned long date, time;
char y;

refresh = 250;
get_datetime(&date, &time);
unsigned long long col = current_color_64bit;
current_term->setcolorstate (COLOR_STATE_NORMAL);
gotoxy (strings[i].start_x, strings[i].start_y);
if (strings[i].start_y < 0)
y = strings[i].start_y + current_term->max_lines;
else
y = strings[i].start_y;
gotoxy (strings[i].start_x, y);
if ((strings[i].color & 0xffffffff00000000) == 0)
current_color_64bit = strings[i].color | (current_color_64bit & 0xffffffff00000000);
else
Expand Down
3 changes: 2 additions & 1 deletion stage2/shared.h
Expand Up @@ -499,7 +499,7 @@ struct string
{
unsigned char index;
unsigned char start_x;
unsigned char start_y;
char start_y;
unsigned long long color;
int addr;
} __attribute__ ((packed));
Expand Down Expand Up @@ -850,6 +850,7 @@ extern int use_config_file;
#define use_preset_menu *(unsigned long *)0x307FF8
/* print debug message on startup if the DEBUG_KEY is pressed. */
extern int debug_boot;
extern int console_checkkey (void);
extern int console_getkey (void);
extern int console_beep (void);
extern int beep_func(char *arg, int flags);
Expand Down
12 changes: 8 additions & 4 deletions stage2/stage2.c
Expand Up @@ -526,7 +526,7 @@ print_entry (int y, int highlight,int entryno, char *config_entries)
// else if (default_help_message_destoyed)
else
{
if(!(menu_border.menu_keyhelp_y_offset))
if(!(menu_border.menu_keyhelp_y_offset) && !(menu_tab & 4))
{
// if (current_term->setcolorstate)
// current_term->setcolorstate (COLOR_STATE_HELPTEXT);
Expand Down Expand Up @@ -909,6 +909,7 @@ run_menu (char *menu_entries, char *config_entries, /*int num_entries,*/ char *h
if (graphics_inited && graphics_mode > 0xff)/*vbe mode call rectangle_func*/
{
int i,j;
char y;
unsigned long long col = current_color_64bit;
for (i=0; i<16; i++)
{
Expand All @@ -920,15 +921,17 @@ run_menu (char *menu_entries, char *config_entries, /*int num_entries,*/ char *h

if (num_string)
{
int start_offcet = 0;
i = num_string;

for (j=0; j<i; j++)
{
if (strings[j].index == 0)
continue;
start_offcet = strings[j].start_x;
gotoxy (start_offcet, strings[j].start_y);
if (strings[j].start_y < 0)
y = strings[j].start_y + current_term->max_lines;
else
y = strings[j].start_y;
gotoxy (strings[j].start_x, y);
current_term->setcolorstate (COLOR_STATE_NORMAL);
if ((strings[j].color & 0xffffffff00000000) == 0)
current_color_64bit = strings[j].color | (current_color_64bit & 0xffffffff00000000);
Expand Down Expand Up @@ -1004,6 +1007,7 @@ run_menu (char *menu_entries, char *config_entries, /*int num_entries,*/ char *h
if (current_term->setcolorstate)
current_term->setcolorstate (COLOR_STATE_HELPTEXT);

if (!(menu_tab & 4))
print_default_help_message (config_entries);

if (current_term->flags & TERM_DUMB)
Expand Down
2 changes: 0 additions & 2 deletions stage2/term.h
Expand Up @@ -105,8 +105,6 @@ extern struct term_entry *current_term;
/* The console stuff. */
unsigned int console_putchar (unsigned int c, unsigned int max_width);

int console_checkkey (void);
int console_getkey (void);
int console_getxy (void);
void console_gotoxy (int x, int y);
void console_cls (void);
Expand Down

0 comments on commit 34ca1a9

Please sign in to comment.