wip x2
This commit is contained in:
parent
46d94cf575
commit
a0fde4312e
@ -123,6 +123,7 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested)
|
||||
instance->fini = grub_gfxmenu_viewer_fini;
|
||||
instance->print_timeout = grub_gfxmenu_print_timeout;
|
||||
instance->clear_timeout = grub_gfxmenu_clear_timeout;
|
||||
instance->print_time = grub_gfxmenu_print_time;
|
||||
|
||||
grub_menu_register_viewer (instance);
|
||||
|
||||
|
||||
@ -264,9 +264,12 @@ update_menu_visit (grub_gui_component_t component,
|
||||
|
||||
struct grub_gfxmenu_time_notify * grub_gfxmenu_time_notification;
|
||||
|
||||
static void redraw_time(struct grub_gfxmenu_view *view)
|
||||
static void redraw_time(grub_gfxmenu_view_t view)
|
||||
{
|
||||
struct grub_gfxmenu_time_notify* cur = grub_gfxmenu_time_notification;
|
||||
if(!cur)
|
||||
return;
|
||||
cur->set_state(cur->self, 1, 0, 0, 0);
|
||||
grub_gui_label_t self = (grub_gui_label_t)cur->self;
|
||||
|
||||
struct grub_datetime datetime;
|
||||
@ -276,13 +279,23 @@ static void redraw_time(struct grub_gfxmenu_view *view)
|
||||
datetime.year, datetime.month, datetime.day,
|
||||
datetime.hour, datetime.minute, datetime.second,
|
||||
grub_get_weekday_name(&datetime));
|
||||
grub_video_rect_t before_bounds;
|
||||
cur->self->ops->get_bounds (cur->self, &before_bounds);
|
||||
grub_gfxmenu_view_redraw(view, &before_bounds);
|
||||
|
||||
grub_free(self->text);
|
||||
self->text = (char*)" ";
|
||||
grub_gfxmenu_view_redraw(view, &before_bounds);
|
||||
|
||||
self->text = valtmp;
|
||||
grub_video_rect_t bounds;
|
||||
cur->self->ops->get_bounds (cur->self, &bounds);
|
||||
grub_video_set_area_status (GRUB_VIDEO_AREA_ENABLED);
|
||||
grub_gfxmenu_view_redraw (view, &bounds);
|
||||
|
||||
grub_gfxmenu_view_redraw(view, &before_bounds);
|
||||
}
|
||||
|
||||
|
||||
void grub_gfxmenu_print_time(grub_gfxmenu_view_t view) {
|
||||
redraw_time(view);
|
||||
}
|
||||
/* Update any boot menu components with the current menu model and
|
||||
theme path. */
|
||||
static void
|
||||
@ -392,7 +405,6 @@ grub_gfxmenu_view_draw (grub_gfxmenu_view_t view)
|
||||
grub_video_set_area_status (GRUB_VIDEO_AREA_DISABLED);
|
||||
grub_gfxmenu_view_redraw (view, &view->screen);
|
||||
}
|
||||
redraw_time(view);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@ -384,6 +384,14 @@ menu_print_timeout (int timeout)
|
||||
cur->print_timeout (timeout, cur->data);
|
||||
}
|
||||
|
||||
static void
|
||||
menu_print_time(void) {
|
||||
struct grub_menu_viewer *cur;
|
||||
for (cur = viewers; cur; cur = cur->next)
|
||||
if(cur->print_time)
|
||||
cur->print_time (cur->data);
|
||||
}
|
||||
|
||||
static void
|
||||
menu_fini (void)
|
||||
{
|
||||
@ -668,7 +676,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot, int *notify_boot)
|
||||
|
||||
/* Initialize the time. */
|
||||
saved_time = grub_get_time_ms ();
|
||||
|
||||
menu_print_time();
|
||||
timeout = grub_menu_get_timeout ();
|
||||
|
||||
if (timeout > 0)
|
||||
@ -676,9 +684,14 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot, int *notify_boot)
|
||||
else
|
||||
clear_timeout ();
|
||||
|
||||
grub_uint64_t time_saved_time = saved_time;
|
||||
while (1)
|
||||
{
|
||||
|
||||
int c;
|
||||
if(has_second_elapsed (&time_saved_time)) {
|
||||
menu_print_time();
|
||||
}
|
||||
timeout = grub_menu_get_timeout ();
|
||||
|
||||
if (grub_normal_exit_level)
|
||||
|
||||
@ -582,6 +582,7 @@ grub_menu_try_text (struct grub_term_output *term,
|
||||
instance->print_timeout = menu_text_print_timeout;
|
||||
instance->clear_timeout = menu_text_clear_timeout;
|
||||
instance->fini = menu_text_fini;
|
||||
instance->print_time = NULL;
|
||||
|
||||
data->menu = menu;
|
||||
|
||||
|
||||
@ -57,6 +57,10 @@ grub_gfxmenu_view_redraw (grub_gfxmenu_view_t view,
|
||||
|
||||
void
|
||||
grub_gfxmenu_clear_timeout (void *data);
|
||||
void
|
||||
grub_gfxmenu_print_time(grub_gfxmenu_view_t view);
|
||||
|
||||
|
||||
void
|
||||
grub_gfxmenu_print_timeout (int timeout, void *data);
|
||||
void
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/menu.h>
|
||||
#include <grub/gfxmenu_view.h>
|
||||
#include <grub/term.h>
|
||||
|
||||
struct grub_menu_viewer
|
||||
@ -33,6 +34,7 @@ struct grub_menu_viewer
|
||||
void (*set_chosen_entry) (int entry, void *data);
|
||||
void (*print_timeout) (int timeout, void *data);
|
||||
void (*clear_timeout) (void *data);
|
||||
void (*print_time) (grub_gfxmenu_view_t view);
|
||||
void (*fini) (void *fini);
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user