merge trunk

This commit is contained in:
Colin Watson 2011-04-21 11:07:10 +01:00
commit 1eb44ae37e
301 changed files with 8465 additions and 1449 deletions

View file

@ -37,7 +37,9 @@
#include <grub/gfxmenu_view.h>
#include <grub/time.h>
grub_gfxmenu_view_t cached_view;
GRUB_MOD_LICENSE ("GPLv3+");
static grub_gfxmenu_view_t cached_view;
static void
grub_gfxmenu_viewer_fini (void *data __attribute__ ((unused)))
@ -56,30 +58,15 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested)
theme_path = grub_env_get ("theme");
if (! theme_path)
{
grub_error_push ();
grub_gfxterm_fullscreen ();
grub_error_pop ();
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "no theme specified");
}
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "no theme specified");
instance = grub_zalloc (sizeof (*instance));
if (!instance)
{
grub_error_push ();
grub_gfxterm_fullscreen ();
grub_error_pop ();
return grub_errno;
}
return grub_errno;
err = grub_video_get_info (&mode_info);
if (err)
{
grub_error_push ();
grub_gfxterm_fullscreen ();
grub_error_pop ();
return err;
}
return err;
if (!cached_view || grub_strcmp (cached_view->theme_path, theme_path) != 0
|| cached_view->screen.width != mode_info.width
@ -94,9 +81,6 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested)
if (! cached_view)
{
grub_free (instance);
grub_error_push ();
grub_gfxterm_fullscreen ();
grub_error_pop ();
return grub_errno;
}

View file

@ -101,6 +101,9 @@ image_get_parent (void *vself)
static grub_err_t
rescale_image (grub_gui_image_t self)
{
signed width;
signed height;
if (! self->raw_bitmap)
{
if (self->bitmap)
@ -111,12 +114,12 @@ rescale_image (grub_gui_image_t self)
return grub_errno;
}
unsigned width = self->bounds.width;
unsigned height = self->bounds.height;
width = self->bounds.width;
height = self->bounds.height;
if (self->bitmap
&& (grub_video_bitmap_get_width (self->bitmap) == width)
&& (grub_video_bitmap_get_height (self->bitmap) == height))
&& ((signed) grub_video_bitmap_get_width (self->bitmap) == width)
&& ((signed) grub_video_bitmap_get_height (self->bitmap) == height))
{
/* Nothing to do; already the right size. */
return grub_errno;
@ -131,15 +134,15 @@ rescale_image (grub_gui_image_t self)
/* Create a scaled bitmap, unless the requested size is the same
as the raw size -- in that case a reference is made. */
if (grub_video_bitmap_get_width (self->raw_bitmap) == width
&& grub_video_bitmap_get_height (self->raw_bitmap) == height)
if ((signed) grub_video_bitmap_get_width (self->raw_bitmap) == width
&& (signed) grub_video_bitmap_get_height (self->raw_bitmap) == height)
{
self->bitmap = self->raw_bitmap;
return grub_errno;
}
/* Don't scale to an invalid size. */
if (width == 0 || height == 0)
if (width <= 0 || height <= 0)
return grub_errno;
/* Create the scaled bitmap. */

View file

@ -248,8 +248,10 @@ draw_menu (list_impl_t self, int num_shown_items)
if (is_selected)
{
selbox->set_content_size (selbox, oviewport.width - 2 * boxpad - 2,
item_height - 1);
int cwidth = oviewport.width - 2 * boxpad - 2;
if (selbox->get_border_width)
cwidth -= selbox->get_border_width (selbox);
selbox->set_content_size (selbox, cwidth, item_height - 1);
selbox->draw (selbox, 0,
item_top - sel_toppad);
}

View file

@ -257,7 +257,7 @@ grub_gfxmenu_icon_manager_get_icon (grub_gfxmenu_icon_manager_t mgr,
/* Try each class in succession. */
icon = 0;
for (c = entry->classes->next; c && ! icon; c = c->next)
for (c = entry->classes; c && ! icon; c = c->next)
icon = get_icon_by_class (mgr, c->name);
return icon;
}

View file

@ -178,6 +178,13 @@ set_content_size (grub_gfxmenu_box_t self,
return;
}
static int
get_border_width (grub_gfxmenu_box_t self)
{
return (get_width (self->raw_pixmaps[BOX_PIXMAP_E])
+ get_width (self->raw_pixmaps[BOX_PIXMAP_W]));
}
static int
get_left_pad (grub_gfxmenu_box_t self)
{
@ -288,6 +295,8 @@ grub_gfxmenu_create_box (const char *pixmaps_prefix,
box->draw = draw;
box->set_content_size = set_content_size;
box->get_border_width = get_border_width;
box->get_left_pad = get_left_pad;
box->get_top_pad = get_top_pad;
box->get_right_pad = get_right_pad;