5/5 Graphical menu (gfxmenu)
PATCH 1/1 5/5 Graphical menu (gfxmenu)
This long-awaited patch adds graphical menu support to GRUB 2. It is largely the result of my work during the Google Summer of Code 2008.
The graphical menu system supports image-based themes, of which I have created several sample themes[1].
There are still a few important things that need to be done on gfxmenu before it is completely ready for end-users (off the top of my head):
- Need a good way to switch themes at runtime. I want to add a popup menu that lists the available themes and lets the user choose one. (Currently the keys 1, 2, 3, and 4 are hardcoded to switch between my sample themes...)
- gfxmenu interacts badly with gfxterm. Running commands from the terminal withing gfxmenu that switch the video mode ('videotest basic', for instance) cause a crash when the command returns. I think this has something to do with the interaction of video mode-switching and the GRUB output terminal.
The default theme is set in grub.cfg like so:
set theme="/boot/grub/themes/proto/theme.txt"
Also, pressing 't' currently switches between graphical and text mode menus, but by adding the following menu entries, it can be done from the menu:
menuentry "Switch to text menu" {
set menuviewer="terminal"
}
menuentry "Switch to graphical menu" {
set menuviewer="gfxmenu"
}
Regards,
Colin
[1] <http://grub.gibibit.com/Themes>
=== modified file 'conf/common.rmk'
common.rmk +29 -2
@@ -329,6 +329,7 @@ cmp.mod cat.mod help.mod search.mod \ loopback.mod fs_uuid.mod configfile.mod echo.mod \ terminfo.mod test.mod blocklist.mod hexdump.mod \ + gfxmenu.mod \ read.mod sleep.mod loadenv.mod crc.mod # For hello.mod.
@@ -336,6 +337,27 @@ hello_mod_CFLAGS = $(COMMON_CFLAGS) hello_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For gfxmenu.mod. +gfxmenu_mod_SOURCES = \ + gfxmenu/gfxmenu.c \ + gfxmenu/model.c \ + gfxmenu/view.c \ + gfxmenu/icon_manager.c \ + gfxmenu/theme_loader.c \ + gfxmenu/widget-box.c \ + gfxmenu/gui_canvas.c \ + gfxmenu/gui_circular_progress.c \ + gfxmenu/gui_box.c \ + gfxmenu/gui_label.c \ + gfxmenu/gui_list.c \ + gfxmenu/gui_image.c \ + gfxmenu/gui_progress_bar.c \ + gfxmenu/gui_util.c \ + gfxmenu/gui_string_util.c \ + gfxmenu/named_colors.c +gfxmenu_mod_CFLAGS = $(COMMON_CFLAGS) +gfxmenu_mod_LDFLAGS = $(COMMON_LDFLAGS) + # For boot.mod. boot_mod_SOURCES = commands/boot.c boot_mod_CFLAGS = $(COMMON_CFLAGS)
@@ -436,7 +458,7 @@ png.mod font.mod gfxterm.mod # For video.mod. -video_mod_SOURCES = video/video.c +video_mod_SOURCES = video/video.c video/setmode.c video_mod_CFLAGS = $(COMMON_CFLAGS) video_mod_LDFLAGS = $(COMMON_LDFLAGS)
@@ -476,7 +498,7 @@ gfxterm_mod_LDFLAGS = $(COMMON_LDFLAGS) # Misc. -pkglib_MODULES += gzio.mod bufio.mod elf.mod +pkglib_MODULES += gzio.mod bufio.mod elf.mod trig.mod # For elf.mod. elf_mod_SOURCES = kern/elf.c
@@ -492,3 +514,8 @@ bufio_mod_SOURCES = io/bufio.c bufio_mod_CFLAGS = $(COMMON_CFLAGS) bufio_mod_LDFLAGS = $(COMMON_LDFLAGS) + +# For trig.mod. +trig_mod_SOURCES = lib/trig.c +trig_mod_CFLAGS = $(COMMON_CFLAGS) +trig_mod_LDFLAGS = $(COMMON_LDFLAGS)
=== modified file 'conf/sparc64-ieee1275.rmk'
sparc64-ieee1275.rmk +1 -6
@@ -83,7 +83,7 @@ # Modules. #_linux.mod linux.mod pkglib_MODULES = fat.mod ufs.mod ext2.mod minix.mod \ - hfs.mod jfs.mod normal.mod hello.mod font.mod ls.mod \ + hfs.mod jfs.mod normal.mod hello.mod ls.mod \ boot.mod cmp.mod cat.mod terminal.mod fshelp.mod amiga.mod apple.mod \ pc.mod suspend.mod loopback.mod help.mod reboot.mod halt.mod sun.mod \ configfile.mod search.mod gzio.mod xfs.mod \
@@ -204,11 +204,6 @@ cat_mod_CFLAGS = $(COMMON_CFLAGS) cat_mod_LDFLAGS = $(COMMON_LDFLAGS) -# For font.mod. -font_mod_SOURCES = font/manager.c -font_mod_CFLAGS = $(COMMON_CFLAGS) -font_mod_LDFLAGS = $(COMMON_LDFLAGS) - # For amiga.mod amiga_mod_SOURCES = partmap/amiga.c amiga_mod_CFLAGS = $(COMMON_CFLAGS)
=== added file 'docs/gfxmenu-theme-example.txt'
gfxmenu-theme-example.txt +128 -0
128 lines not on this page · raw message
=== added file 'gentrigtables.py'
gentrigtables.py +58 -0
58 lines not on this page · raw message
=== added directory 'gfxmenu'
=== added file 'gfxmenu/gfxmenu.c'
gfxmenu.c +231 -0
231 lines not on this page · raw message
=== added file 'gfxmenu/gui_box.c'
gui_box.c +367 -0
367 lines not on this page · raw message
=== added file 'gfxmenu/gui_canvas.c'
gui_canvas.c +264 -0
264 lines not on this page · raw message
=== added file 'gfxmenu/gui_circular_progress.c'
gui_circular_progress.c +339 -0
339 lines not on this page · raw message
=== added file 'gfxmenu/gui_image.c'
gui_image.c +262 -0
262 lines not on this page · raw message
=== added file 'gfxmenu/gui_label.c'
gui_label.c +248 -0
248 lines not on this page · raw message
=== added file 'gfxmenu/gui_list.c'
gui_list.c +624 -0
624 lines not on this page · raw message
=== added file 'gfxmenu/gui_progress_bar.c'
gui_progress_bar.c +378 -0
378 lines not on this page · raw message
=== added file 'gfxmenu/gui_string_util.c'
gui_string_util.c +348 -0
24 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
=== added file 'gfxmenu/gui_util.c'
gui_util.c +101 -0
101 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
=== added file 'gfxmenu/icon_manager.c'
icon_manager.c +254 -0
254 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
=== added file 'gfxmenu/model.c'
model.c +191 -0
191 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
=== added file 'gfxmenu/named_colors.c'
named_colors.c +209 -0
209 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
=== added file 'gfxmenu/theme_loader.c'
theme_loader.c +609 -0
609 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
=== added file 'gfxmenu/view.c'
view.c +505 -0
505 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
=== added file 'gfxmenu/widget-box.c'
widget-box.c +271 -0
271 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
=== added file 'include/grub/gfxmenu_model.h'
grub/gfxmenu_model.h +59 -0
59 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
=== added file 'include/grub/gfxmenu_view.h'
grub/gfxmenu_view.h +92 -0
92 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
=== added file 'include/grub/gfxterm.h'
grub/gfxterm.h +41 -0
41 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
=== added file 'include/grub/gfxwidgets.h'
grub/gfxwidgets.h +49 -0
49 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
=== added file 'include/grub/gui.h'
grub/gui.h +165 -0
165 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
=== added file 'include/grub/gui_string_util.h'
grub/gui_string_util.h +39 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
=== added file 'include/grub/icon_manager.h'
grub/icon_manager.h +41 -0
41 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
=== modified file 'include/grub/menu_viewer.h'
grub/menu_viewer.h +5 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
=== modified file 'include/grub/misc.h'
grub/misc.h +4 -1
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
=== modified file 'include/grub/normal.h'
grub/normal.h +1 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
=== added file 'include/grub/trig.h'
grub/trig.h +44 -0
44 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
=== modified file 'include/grub/types.h'
grub/types.h +4 -2
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
=== modified file 'include/grub/video.h'
grub/video.h +8 -1
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
=== modified file 'kern/misc.c'
misc.c +47 -0
47 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
=== added file 'lib/trig.c'
trig.c +83 -0
83 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
=== modified file 'normal/main.c'
main.c +2 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
=== modified file 'normal/menu.c'
menu.c +22 -8
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
=== modified file 'normal/menu_viewer.c'
menu_viewer.c +42 -6
48 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
=== modified file 'term/gfxterm.c'
gfxterm.c +171 -267
438 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
=== added file 'video/setmode.c'
setmode.c +249 -0
249 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Hi,
As this patch is quite large and I am going go to sleep soon so I only comment your message on this run...
Quoted 2 lines · Colin D Bennett
This long-awaited patch adds graphical menu support to GRUB 2. It is largely the result of my work during the Google Summer of Code 2008.
And thanks for it!
Quoted 7 lines
There are still a few important things that need to be done on gfxmenu before it is completely ready for end-users (off the top of my head):
- Need a good way to switch themes at runtime. I want to add a popup menu that lists the available themes and lets the user choose one. (Currently the keys 1, 2, 3, and 4 are hardcoded to switch between my sample themes...)
I think switching would need to validate new theme before taking it to into use. When it is ok then it is safe to switch...
Quoted 5 lines
- gfxmenu interacts badly with gfxterm. Running commands from the terminal withing gfxmenu that switch the video mode ('videotest basic', for instance) cause a crash when the command returns. I think this has something to do with the interaction of video mode-switching and the GRUB output terminal.
I have thought about this for some years... but still haven't implemented it.
Basically it should work something like this:
state = grub_video_save_state()
change mode or what ever.
grub_video_restore_state(state);
State would have two parts. One is generic part that tells what video driver to load and then second part is driver specific so it can restore old video mode perhaps with same palette if in indexed color mode... but contents of display does not need to saved. If there is no need to perform any change on restore (eg. state matches) then no action is taken.
This should work also with text mode, so that at start before changing video mode grub_video_save_state() would be called which records text mdoe. And if graphical mode fails, then it would call restore with this state. Now if there was graphical mode before this it would restore to old working graphical mode.
Quoted 3 lines
The default theme is set in grub.cfg like so:
set theme="/boot/grub/themes/proto/theme.txt"
I think it would be wise to pick some other theme extension that .txt.
Quoted 2 lines · Colin D Bennett
This long-awaited patch adds graphical menu support to GRUB 2. It is largely the result of my work during the Google Summer of Code 2008.
:-)
common.rmk line 341
Quoted 2 lines
common.rmk +2
-0+# For gfxmenu.mod. +gfxmenu_mod_SOURCES = \
I think there's some patch/mod/hack for GRUB Legacy that is called like that.
Perhaps it'd be a good idea to use another name to avoid confusion.
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Quoted 6 lines · Colin D Bennett
This long-awaited patch adds graphical menu support to GRUB 2. It is largely the result of my work during the Google Summer of Code 2008.
The graphical menu system supports image-based themes, of which I have created several sample themes[1].
Quoted 7 lines
There are still a few important things that need to be done on gfxmenu before it is completely ready for end-users (off the top of my head):
- Need a good way to switch themes at runtime. I want to add a popup menu that lists the available themes and lets the user choose one. (Currently the keys 1, 2, 3, and 4 are hardcoded to switch between my sample themes...)
Switching themes on runtime is not a priority. It is a nice to have feature thou... but we can wait a bit with that.
Quoted 5 lines
- gfxmenu interacts badly with gfxterm. Running commands from the terminal withing gfxmenu that switch the video mode ('videotest basic', for instance) cause a crash when the command returns. I think this has something to do with the interaction of video mode-switching and the GRUB output terminal.
I think we can live with some oddities so I would propose that we get some version in. In fact it will make fixing bugs a bit more robust as others can also contribute...
So whats the status of your actions. I think some of the patches were already approved with some minor changes...