From: Vladimir Testov <vladimir.testov@rosalab.ru>
To: grub-devel@gnu.org
Subject: [PATCH] [7/11] [gfxmenu/list] scrollbar padding
Date: Thu, 11 Apr 2013 15:19:36 +0400 [thread overview]
Message-ID: <3893181.cedFTOVlW5@icedphoenix> (raw)
[-- Attachment #1: Type: text/plain, Size: 210 bytes --]
New options to manage scrollbar's padding.
Ask if it should be commented and supported with screenshots.
--
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
[-- Attachment #2: grub-2.00-list-scrollbar-padding.patch --]
[-- Type: text/x-patch, Size: 3558 bytes --]
diff -Naur grub-new7/grub-core/gfxmenu/gui_list.c grub-new8/grub-core/gfxmenu/gui_list.c
--- grub-new7/grub-core/gfxmenu/gui_list.c 2013-03-28 14:56:58.157916412 +0400
+++ grub-new8/grub-core/gfxmenu/gui_list.c 2013-04-03 17:46:21.953921226 +0400
@@ -54,6 +54,10 @@
grub_gfxmenu_box_t scrollbar_frame;
grub_gfxmenu_box_t scrollbar_thumb;
int scrollbar_width;
+ int scrollbar_left_pad;
+ int scrollbar_right_pad;
+ int scrollbar_top_pad;
+ int scrollbar_bottom_pad;
int first_shown_index;
@@ -254,7 +258,11 @@
oviewport.width - 2 * boxpad,
oviewport.height - 2 * boxpad);
- int cwidth = oviewport.width - 2 * boxpad - 2;
+ int cwidth;
+ if (self->list_version == 0)
+ cwidth = oviewport.width - 2 * boxpad - 2;
+ else
+ cwidth = oviewport.width - 2 * boxpad - self->scrollbar_left_pad;
if (selbox->get_border_width)
cwidth -= selbox->get_border_width (selbox);
if (self->list_version == 0)
@@ -381,6 +389,8 @@
int drawing_scrollbar = (self->draw_scrollbar
&& (num_shown_items < self->view->menu->size)
&& check_scrollbar (self));
+ if (!drawing_scrollbar)
+ self->scrollbar_left_pad = 0;
content_rect.x = box_left_pad;
content_rect.y = box_top_pad;
@@ -396,7 +406,7 @@
grub_gfxmenu_box_t frame = self->scrollbar_frame;
int frame_horizontal_pad = frame->get_left_pad (frame)
+ frame->get_right_pad (frame);
- content_rect.width -= frame_horizontal_pad + self->scrollbar_width;
+ content_rect.width -= frame_horizontal_pad + self->scrollbar_width - self->scrollbar_right_pad;
}
grub_gui_set_viewport (&content_rect, &vpsave2);
@@ -406,13 +416,22 @@
int rightx = self->bounds.width - box_right_pad;
if (self->list_version == 0)
rightx += self->scrollbar_width;
+ else
+ rightx -= self->scrollbar_right_pad;
+ int topy = box_top_pad;
+ int height = self->bounds.height - box_top_pad - box_bottom_pad;
+ if (self->list_version > 0)
+ {
+ topy += self->scrollbar_top_pad;
+ height -= self->scrollbar_top_pad + self->scrollbar_bottom_pad;
+ }
if (drawing_scrollbar)
draw_scrollbar (self,
self->first_shown_index, num_shown_items,
0, self->view->menu->size,
rightx,
- box_top_pad,
- self->bounds.height - box_top_pad - box_bottom_pad);
+ topy,
+ height);
}
grub_gui_restore_viewport (&vpsave);
@@ -599,6 +618,22 @@
{
self->scrollbar_width = grub_strtol (value, 0, 10);
}
+ else if (grub_strcmp (name, "scrollbar_left_pad") == 0)
+ {
+ self->scrollbar_left_pad = grub_strtol (value, 0, 10);
+ }
+ else if (grub_strcmp (name, "scrollbar_right_pad") == 0)
+ {
+ self->scrollbar_right_pad = grub_strtol (value, 0, 10);
+ }
+ else if (grub_strcmp (name, "scrollbar_top_pad") == 0)
+ {
+ self->scrollbar_top_pad = grub_strtol (value, 0, 10);
+ }
+ else if (grub_strcmp (name, "scrollbar_bottom_pad") == 0)
+ {
+ self->scrollbar_bottom_pad = grub_strtol (value, 0, 10);
+ }
else if (grub_strcmp (name, "scrollbar") == 0)
{
self->draw_scrollbar = grub_strcmp (value, "false") != 0;
@@ -694,6 +729,10 @@
self->scrollbar_frame_pattern = 0;
self->scrollbar_thumb_pattern = 0;
self->scrollbar_width = 16;
+ self->scrollbar_left_pad = 2;
+ self->scrollbar_right_pad = 0;
+ self->scrollbar_top_pad = 0;
+ self->scrollbar_bottom_pad = 0;
self->first_shown_index = 0;
reply other threads:[~2013-04-11 11:19 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=3893181.cedFTOVlW5@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.