* Re: fixed item-height, item-spacing, max-elements-shown etc
@ 2013-02-07 10:07 Vladimir Testov
2013-02-21 17:56 ` Andrey Borzenkov
0 siblings, 1 reply; 4+ messages in thread
From: Vladimir Testov @ 2013-02-07 10:07 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 3447 bytes --]
>I am not sure whether it is appropriate fix. After your patch "box
>effect" on selected item is effectively lost (it makes
>selected_item_box the same height as selected item itself).
About "box effect" - there is no "box effect" in menu_box. The menu's box is
drawn inside given area. So the idea of "box effect" was unclear to me. (Also,
the height of selected element (with box) is item_height + box_pad_top +
box_pad_bottom - 1... that "-1" makes the "box effect" totally unclear. My idea
was to make GRUB theme be countable to pixel. Also, with my patch (when we can
have a box for every unselected element) item_spacing loses it's meaning
totally. It has uncertain meaning in current GRUB state too.
I thought that idea of menu's box was more valuable because it has influence to
the code.
So, when we need to calculate exact values so the result will request our
expectations, the idea of item_height as total height is more acceptable.
Also I have in mind some more changes:
- width of scrollbar (similar but a little trickier)
- move scrollbar (small fix, now scrollbar will be drawn only if we have east
slice of the menu's bitmap.
- if we move scrollbar then we should cut a little items' width (also if
scrollbar's width is total scrollbar width (I mean if we use east and\or west
slices of scrollbar_thumb or scrollbar_frame) then it will be easier to
calculate)
- also if we move scrollbar then the total idea of the scrollbar will become
more intuitive (like if we work with something in a "window" and it's height
is too big then scrollbar will appear in the same "window" and cut the
"window's" width.) Mean the scrollbar will appear inside the "window" but not
outside.
- now the distance between right side of the selected item's box and the
scrollbar is exactly 2 pixels.
I see two solutions for the last problem.
1) make item_spacing be really space between elements and also the space
between menu_items and scrollbar
2) make additional option "scrollbar_spacing"
The first idea seems to me more adequate and simple.
So the idea of making item_height be total height is interconnected with other
ideas.
>The actual fix looks much simpler - get_num_shown_items() should
>additionally account for self->selected_item_box->get_op_pad().
Also we will need:
1) update menu_box (throuhout code) so it also will have "boxing effect"
2) update height of the selected element
because of menu's box update fix won't look much simplier
>Could you make available theme that demonstrates this problem?
Yep, here's the example. Item's height is 20, item's spacing is 10.
so in 110px height menu there will be exactly 4 items (20*4+10*(4-1) == 110)
Let's suppose that we install grub2 into /boot/grub2 directory.
1. unpack test.tar.gz to /boot/grub2/test/
2. set GRUB_THEME="/boot/grub2/themes/test/theme.txt" in /etc/default/grub
3. run update-grub2 (or grub-mkconfig -o /boot/grub2/grub.cfg)
4. add "dummy" entries in /boot/grub2/grub.cfg if needed
so we see result on test_2.png - when we move to the bottom - the box of the
selected item is not fully drawn
P.S.
Sorry, for the big message.
There are some more ideas how to make grub2 theming better. I really would
like to discuss (the ones I've mentioned and the ones I did not).
I have working solutions for the ideas I had mentioned.
--
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
[-- Attachment #2: test_1.png --]
[-- Type: image/png, Size: 47072 bytes --]
[-- Attachment #3: test_2.png --]
[-- Type: image/png, Size: 46949 bytes --]
[-- Attachment #4: test.tar.gz --]
[-- Type: application/x-compressed-tar, Size: 10895 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: fixed item-height, item-spacing, max-elements-shown etc
2013-02-07 10:07 fixed item-height, item-spacing, max-elements-shown etc Vladimir Testov
@ 2013-02-21 17:56 ` Andrey Borzenkov
2013-02-22 9:28 ` [PATCH] fix selected item's height Vladimir Testov
2013-02-22 9:32 ` fixed item-height, item-spacing, max-elements-shown etc Vladimir Testov
0 siblings, 2 replies; 4+ messages in thread
From: Andrey Borzenkov @ 2013-02-21 17:56 UTC (permalink / raw)
To: The development of GNU GRUB; +Cc: vladimir.testov
Sorry for delay.
В Thu, 07 Feb 2013 14:07:08 +0400
Vladimir Testov <vladimir.testov@rosalab.ru> пишет:
> >I am not sure whether it is appropriate fix. After your patch "box
> >effect" on selected item is effectively lost (it makes
> >selected_item_box the same height as selected item itself).
> About "box effect" - there is no "box effect" in menu_box. The menu's box is
> drawn inside given area. So the idea of "box effect" was unclear to me. (Also,
> the height of selected element (with box) is item_height + box_pad_top +
> box_pad_bottom - 1... that "-1" makes the "box effect" totally unclear. My idea
> was to make GRUB theme be countable to pixel.
But it is. You know exactly which size you need. But in practice most
themes would probably use dynamic sizing by specifying screen
size percentage. I am not sure if grub2 currently dynamically adjusts
size to ensure whole number of items fit into it.
> Also, with my patch (when we can
> have a box for every unselected element) item_spacing loses it's meaning
> totally. It has uncertain meaning in current GRUB state too.
>
It is pretty much certain meaning. Of course I agree that having more
detailed "style guide" for writing grub theme would definitely help.
As I understand current code, it lays out quite predictably
outer image top border
selected item box top border
item 1
inter-item space
item 2
iter-item space
...
item n
selected item box lower border
outer image lower border
selected item box itself is overlayed (or, rather, underlayed). It does
not change layout. So you, as theme author, has to ensure suitable
space to draw selected item box so that it fits without changing
existing layout.
Your patch changes text layout for selected item (by reducing available
space). As text is vertically aligned, this results in "jumping effect"
or part of text may be cut off.
In your example setting menu size to 118 provides for full 4 items +
selected item box.
> I thought that idea of menu's box was more valuable because it has influence to
> the code.
>
> So, when we need to calculate exact values so the result will request our
> expectations, the idea of item_height as total height is more acceptable.
>
selected item box is not really used to layout items. Only to adjust
where the first item is placed, to allow for full top border to be
displayed. Patch I just sent also adds space for lower border.
Anyway, this is just my 2c. Hopefully somebody with commit rights
or one of original theme authors can chime in :)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] fix selected item's height
2013-02-21 17:56 ` Andrey Borzenkov
@ 2013-02-22 9:28 ` Vladimir Testov
2013-02-22 9:32 ` fixed item-height, item-spacing, max-elements-shown etc Vladimir Testov
1 sibling, 0 replies; 4+ messages in thread
From: Vladimir Testov @ 2013-02-22 9:28 UTC (permalink / raw)
To: Andrey Borzenkov; +Cc: The development of GNU GRUB
[-- Attachment #1: Type: text/plain, Size: 525 bytes --]
> selected item box is not really used to layout items. Only to adjust
> where the first item is placed, to allow for full top border to be
> displayed. Patch I just sent also adds space for lower border.
By the way, your patch is not absolutely correct. We should correct selected
item's height. The formula you have presented do not consider the fact that
selected item's height is decreased by 1.
Patch included.
--
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
[-- Attachment #2: grub2-fix-selected-item-height.patch --]
[-- Type: text/x-patch, Size: 621 bytes --]
diff -Naur grub-2.00/grub-core/gfxmenu/gui_list.c grub-tmp/grub-core/gfxmenu/gui_list.c
--- grub-2.00/grub-core/gfxmenu/gui_list.c 2011-12-14 14:36:07.000000000 +0400
+++ grub-tmp/grub-core/gfxmenu/gui_list.c 2013-02-22 13:24:01.496967086 +0400
@@ -252,7 +252,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);
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: fixed item-height, item-spacing, max-elements-shown etc
2013-02-21 17:56 ` Andrey Borzenkov
2013-02-22 9:28 ` [PATCH] fix selected item's height Vladimir Testov
@ 2013-02-22 9:32 ` Vladimir Testov
1 sibling, 0 replies; 4+ messages in thread
From: Vladimir Testov @ 2013-02-22 9:32 UTC (permalink / raw)
To: Andrey Borzenkov; +Cc: The development of GNU GRUB
Thanks for the anwser! :)
On Thursday, February 21, 2013 09:56:07 PM Andrey Borzenkov wrote:
> It is pretty much certain meaning. Of course I agree that having more
> detailed "style guide" for writing grub theme would definitely help.
I'm just writing that kind of thing right now. With details and schemes. :) It
will take some time to finish.
--
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-02-22 9:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-07 10:07 fixed item-height, item-spacing, max-elements-shown etc Vladimir Testov
2013-02-21 17:56 ` Andrey Borzenkov
2013-02-22 9:28 ` [PATCH] fix selected item's height Vladimir Testov
2013-02-22 9:32 ` fixed item-height, item-spacing, max-elements-shown etc 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.