From: Vladimir Testov <vladimir.testov@rosalab.ru>
To: grub-devel@gnu.org
Subject: [PATCH] [1/?] grub-core/gfxmenu/gui_list.c - troubles with heights
Date: Tue, 09 Jul 2013 19:53:59 +0400 [thread overview]
Message-ID: <114454222.L1mFZj0FA6@icedphoenix> (raw)
[-- Attachment #1: Type: text/plain, Size: 1052 bytes --]
item_padding = 20
item_height = 30
item_spacing = 20
selected_item_pixmap_style = "inbox_*.png"
menu_pixmap_style = "menu_*.png"
heights of inbox_n.png, inbox_s.png, menu_n.png, menu_s.png equal 5
height option will be mentioned for each example
a) selected item's height is item_height - 1, not item_height
(see before-list-4-up.png attached)
b) get_num_shown_items can behave incorrectly
height = 235
(see before-list-4-down.png attached)
and
height = 230
(see before-list-4-down2.png attached)
c) get_minimal_size can behave incorrectly
height = 39
(see before-list-3-down.png attached)
After applying this patch:
item's height is item_height
height = 240 - everything is O.K.
(see after-list-4-up.png and after-list-4-down.png attached)
height = 239 - not enough for 4 entries - everything is O.K.
(see after-list-239.png attached)
height =39 - everything is O.K.
(see after-list-minimal-down.png and after-list-minimal-up.png attached)
--
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
[-- Attachment #2: before-list-4-up.png --]
[-- Type: image/png, Size: 6112 bytes --]
[-- Attachment #3: before-list-4-down.png --]
[-- Type: image/png, Size: 7979 bytes --]
[-- Attachment #4: before-list-4-down2.png --]
[-- Type: image/png, Size: 7932 bytes --]
[-- Attachment #5: before-list-3-down.png --]
[-- Type: image/png, Size: 7791 bytes --]
[-- Attachment #6: after-list-4-up.png --]
[-- Type: image/png, Size: 4014 bytes --]
[-- Attachment #7: after-list-4-down.png --]
[-- Type: image/png, Size: 5331 bytes --]
[-- Attachment #8: after-list-239.png --]
[-- Type: image/png, Size: 5181 bytes --]
[-- Attachment #9: after-list-minimal-down.png --]
[-- Type: image/png, Size: 5114 bytes --]
[-- Attachment #10: after-list-minimal-up.png --]
[-- Type: image/png, Size: 3717 bytes --]
[-- Attachment #11: grub-list-height-fix.patch --]
[-- Type: text/x-patch, Size: 1973 bytes --]
diff -Naur grub-2.01/grub-core/gfxmenu/gui_list.c grub-new/grub-core/gfxmenu/gui_list.c
--- grub-2.01/grub-core/gfxmenu/gui_list.c 2013-06-25 15:21:25.000000000 +0400
+++ grub-new/grub-core/gfxmenu/gui_list.c 2013-07-09 15:27:35.337936761 +0400
@@ -102,9 +102,13 @@
grub_gfxmenu_box_t box = self->menu_box;
int box_top_pad = box->get_top_pad (box);
int box_bottom_pad = box->get_bottom_pad (box);
+ grub_gfxmenu_box_t selbox = self->selected_item_box;
+ int sel_top_pad = selbox->get_top_pad (selbox);
+ int sel_bottom_pad = selbox->get_bottom_pad (selbox);
return (self->bounds.height + item_vspace - 2 * boxpad
- - box_top_pad - box_bottom_pad) / (item_height + item_vspace);
+ - sel_top_pad - sel_bottom_pad
+ - box_top_pad - box_bottom_pad) / (item_height + item_vspace);
}
static int
@@ -257,7 +261,7 @@
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->set_content_size (selbox, cwidth, item_height);
selbox->draw (selbox, 0,
item_top - sel_toppad);
}
@@ -397,7 +401,8 @@
unsigned width_s;
grub_gfxmenu_box_t selbox = self->selected_item_box;
- int sel_toppad = selbox->get_top_pad (selbox);
+ int sel_top_pad = selbox->get_top_pad (selbox);
+ int sel_bottom_pad = selbox->get_bottom_pad (selbox);
*width = grub_font_get_string_width (self->item_font, "Typical OS");
width_s = grub_font_get_string_width (self->selected_item_font,
@@ -411,7 +416,8 @@
*height = (item_height * num_items
+ item_vspace * (num_items - 1)
+ 2 * boxpad
- + box_top_pad + box_bottom_pad + sel_toppad);
+ + box_top_pad + box_bottom_pad
+ + sel_top_pad + sel_bottom_pad);
}
else
{
reply other threads:[~2013-07-09 15:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=114454222.L1mFZj0FA6@icedphoenix \
--to=vladimir.testov@rosalab.ru \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).