* [PATCH] [8/11] [gfxmenu/list] scrollbar_thumb_offset
@ 2013-04-11 11:32 Vladimir Testov
0 siblings, 0 replies; only message in thread
From: Vladimir Testov @ 2013-04-11 11:32 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 317 bytes --]
I've found that I miss this options if I want to do something like scrollvar
thumb, rounded on the edges. (see screenshots)
tmp1 - the bottom position - before
tmp2 - the bottom position - after (with offsets)
--
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
[-- Attachment #2: grub-2.00-list-scrollbar-thumb-offset.patch --]
[-- Type: text/x-patch, Size: 1847 bytes --]
diff -Naur grub-new8/grub-core/gfxmenu/gui_list.c grub-new9/grub-core/gfxmenu/gui_list.c
--- grub-new8/grub-core/gfxmenu/gui_list.c 2013-03-26 20:50:56.171267835 +0400
+++ grub-new9/grub-core/gfxmenu/gui_list.c 2013-03-27 11:27:43.851690260 +0400
@@ -53,6 +53,8 @@
char *scrollbar_thumb_pattern;
grub_gfxmenu_box_t scrollbar_frame;
grub_gfxmenu_box_t scrollbar_thumb;
+ int thumb_top_offset;
+ int thumb_bottom_offset;
int scrollbar_width;
int scrollbar_left_pad;
int scrollbar_right_pad;
@@ -212,6 +214,11 @@
int tracktop = topy + frame->get_top_pad (frame);
int tracklen = height - frame_vertical_pad;
frame->set_content_size (frame, self->scrollbar_width, tracklen);
+ if (self->list_version > 0)
+ {
+ tracktop += self->thumb_top_offset;
+ tracklen += self->thumb_bottom_offset - self->thumb_top_offset;
+ }
int thumby = tracktop + tracklen * (value - min) / (max - min);
int thumbheight = tracklen * extent / (max - min) + 1;
thumb->set_content_size (thumb,
@@ -612,6 +619,14 @@
grub_free (self->scrollbar_thumb_pattern);
self->scrollbar_thumb_pattern = value ? grub_strdup (value) : 0;
}
+ else if (grub_strcmp (name, "thumb_top_offset") == 0)
+ {
+ self->thumb_top_offset = grub_strtol (value, 0, 10);
+ }
+ else if (grub_strcmp (name, "thumb_bottom_offset") == 0)
+ {
+ self->thumb_bottom_offset = grub_strtol (value, 0, 10);
+ }
else if (grub_strcmp (name, "scrollbar_width") == 0)
{
self->scrollbar_width = grub_strtol (value, 0, 10);
@@ -726,6 +741,8 @@
self->scrollbar_thumb = 0;
self->scrollbar_frame_pattern = 0;
self->scrollbar_thumb_pattern = 0;
+ self->thumb_top_offset = 0;
+ self->thumb_bottom_offset = 0;
self->scrollbar_width = 16;
self->scrollbar_left_pad = 2;
self->scrollbar_right_pad = 0;
[-- Attachment #3: tmp1.png --]
[-- Type: image/png, Size: 429 bytes --]
[-- Attachment #4: tmp2.png --]
[-- Type: image/png, Size: 423 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-04-11 11:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-11 11:32 [PATCH] [8/11] [gfxmenu/list] scrollbar_thumb_offset Vladimir Testov
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.