From: Vladimir Testov <vladimir.testov@rosalab.ru>
To: grub-devel@gnu.org
Subject: [PATCH] [2/?] grub-core/gfxmenu/gui_list.c - menu entry's width bug
Date: Thu, 11 Jul 2013 18:38:28 +0400 [thread overview]
Message-ID: <1868412.oolFDJMQUh@icedphoenix> (raw)
[-- Attachment #1: Type: text/plain, Size: 344 bytes --]
You can see a graphical bug while using pixmap styled box of the selected menu
entry.
If the line is long enough or the font size is big enough, then the text of
the selected menu entry will be drawn on the styled box.
See screenshots.
--
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
[-- Attachment #2: after-text-width-OK.png --]
[-- Type: image/png, Size: 4346 bytes --]
[-- Attachment #3: before-text-width-bug.png --]
[-- Type: image/png, Size: 7191 bytes --]
[-- Attachment #4: grub-list-entry-width-fix.patch --]
[-- Type: text/x-patch, Size: 2162 bytes --]
diff -Naur grub-new/grub-core/gfxmenu/gui_list.c grub-new2/grub-core/gfxmenu/gui_list.c
--- grub-new/grub-core/gfxmenu/gui_list.c 2013-07-09 15:27:35.337936761 +0400
+++ grub-new2/grub-core/gfxmenu/gui_list.c 2013-07-11 18:17:38.856943765 +0400
@@ -249,6 +249,19 @@
oviewport.width - 2 * boxpad,
oviewport.height - 2 * boxpad);
+ 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);
+
+ int string_left_offset = self->icon_width + icon_text_space;
+ int string_top_offset = (item_height - (ascent + descent)) / 2 + ascent;
+
+ grub_video_rect_t svpsave, sviewport;
+ sviewport.x = sel_leftpad + string_left_offset;
+ sviewport.width = cwidth - string_left_offset;
+ sviewport.height = item_height;
+
for (visible_index = 0, menu_index = self->first_shown_index;
visible_index < num_shown_items && menu_index < self->view->menu->size;
visible_index++, menu_index++)
@@ -258,10 +271,6 @@
if (is_selected)
{
- 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);
selbox->draw (selbox, 0,
item_top - sel_toppad);
}
@@ -283,12 +292,15 @@
((is_selected && self->selected_item_color_set)
? self->selected_item_color
: self->item_color);
+
+ sviewport.y = item_top;
+ grub_gui_set_viewport (&sviewport, &svpsave);
grub_font_draw_string (item_title,
font,
grub_video_map_rgba_color (text_color),
- sel_leftpad + self->icon_width + icon_text_space,
- (item_top + (item_height - (ascent + descent))
- / 2 + ascent));
+ 0,
+ string_top_offset);
+ grub_gui_restore_viewport (&svpsave);
item_top += item_height + item_vspace;
}
reply other threads:[~2013-07-11 14:38 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=1868412.oolFDJMQUh@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).