Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dadigang
Ventoy
Commits
f2bb3667
Commit
f2bb3667
authored
Apr 01, 2022
by
longpanda
Browse files
Support specify menu_tip position and color per theme.
parent
791da486
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
25 deletions
+42
-25
GRUB2/MOD_SRC/grub-2.04/grub-core/gfxmenu/theme_loader.c
GRUB2/MOD_SRC/grub-2.04/grub-core/gfxmenu/theme_loader.c
+42
-25
No files found.
GRUB2/MOD_SRC/grub-2.04/grub-core/gfxmenu/theme_loader.c
View file @
f2bb3667
...
...
@@ -163,6 +163,12 @@ theme_set_string (grub_gfxmenu_view_t view,
grub_video_parse_color
(
value
,
&
view
->
message_color
);
else
if
(
!
grub_strcmp
(
"message-bg-color"
,
name
))
grub_video_parse_color
(
value
,
&
view
->
message_bg_color
);
else
if
(
!
grub_strcmp
(
"menu-tip-left"
,
name
))
grub_env_set
(
"VTOY_TIP_LEFT"
,
value
);
else
if
(
!
grub_strcmp
(
"menu-tip-top"
,
name
))
grub_env_set
(
"VTOY_TIP_TOP"
,
value
);
else
if
(
!
grub_strcmp
(
"menu-tip-color"
,
name
))
grub_env_set
(
"VTOY_TIP_COLOR"
,
value
);
else
if
(
!
grub_strcmp
(
"desktop-image"
,
name
))
{
struct
grub_video_bitmap
*
raw_bitmap
;
...
...
@@ -740,6 +746,7 @@ extern int g_menu_update_mode;
grub_err_t
grub_gfxmenu_view_load_theme
(
grub_gfxmenu_view_t
view
,
const
char
*
theme_path
)
{
int
flag
=
0
;
grub_file_t
file
;
struct
parsebuf
p
;
...
...
@@ -783,32 +790,7 @@ grub_gfxmenu_view_load_theme (grub_gfxmenu_view_t view, const char *theme_path)
}
}
{
const
char
*
tip
=
grub_env_get
(
"VTOY_MENU_TIP_ENABLE"
);
if
(
tip
&&
tip
[
0
]
==
'1'
)
{
char
tmpmsg
[
512
];
grub_memset
(
tmpmsg
,
'w'
,
500
);
tmpmsg
[
500
]
=
0
;
g_menu_update_mode
=
1
;
p
.
len
+=
grub_snprintf
(
p
.
buf
+
p
.
len
,
4096
,
"
\n
+ vbox{
\n
left = %s
\n
top = %s
\n
"
"+ label { id=
\"
VTOY_MENU_TIP_1
\"
text =
\"
%s
\"
color =
\"
%s
\"
align =
\"
%s
\"
}
\n
"
"+ label { id=
\"
VTOY_MENU_TIP_2
\"
text =
\"
%s
\"
color =
\"
%s
\"
align =
\"
%s
\"
}
\n
"
"}
\n
"
,
grub_env_get
(
"VTOY_TIP_LEFT"
),
grub_env_get
(
"VTOY_TIP_TOP"
),
tmpmsg
,
grub_env_get
(
"VTOY_TIP_COLOR"
),
grub_env_get
(
"VTOY_TIP_ALIGN"
),
tmpmsg
,
grub_env_get
(
"VTOY_TIP_COLOR"
),
grub_env_get
(
"VTOY_TIP_ALIGN"
)
);
}
}
if
(
view
->
canvas
)
view
->
canvas
->
component
.
ops
->
destroy
(
view
->
canvas
);
...
...
@@ -820,6 +802,7 @@ grub_gfxmenu_view_load_theme (grub_gfxmenu_view_t view, const char *theme_path)
->
ops
->
set_bounds
((
grub_gui_component_t
)
view
->
canvas
,
&
view
->
screen
);
parse:
while
(
has_more
(
&
p
))
{
/* Skip comments (lines beginning with #). */
...
...
@@ -848,6 +831,40 @@ grub_gfxmenu_view_load_theme (grub_gfxmenu_view_t view, const char *theme_path)
goto
fail
;
}
if
(
flag
==
0
)
{
const
char
*
tip
=
grub_env_get
(
"VTOY_MENU_TIP_ENABLE"
);
if
(
tip
&&
tip
[
0
]
==
'1'
)
{
char
tmpmsg
[
512
];
grub_memset
(
tmpmsg
,
'w'
,
500
);
tmpmsg
[
500
]
=
0
;
g_menu_update_mode
=
1
;
p
.
len
+=
grub_snprintf
(
p
.
buf
+
p
.
len
,
4096
,
"
\n
+ vbox{
\n
left = %s
\n
top = %s
\n
"
"+ label { id=
\"
VTOY_MENU_TIP_1
\"
text =
\"
%s
\"
color =
\"
%s
\"
align =
\"
%s
\"
}
\n
"
"+ label { id=
\"
VTOY_MENU_TIP_2
\"
text =
\"
%s
\"
color =
\"
%s
\"
align =
\"
%s
\"
}
\n
"
"}
\n
"
,
grub_env_get
(
"VTOY_TIP_LEFT"
),
grub_env_get
(
"VTOY_TIP_TOP"
),
tmpmsg
,
grub_env_get
(
"VTOY_TIP_COLOR"
),
grub_env_get
(
"VTOY_TIP_ALIGN"
),
tmpmsg
,
grub_env_get
(
"VTOY_TIP_COLOR"
),
grub_env_get
(
"VTOY_TIP_ALIGN"
)
);
flag
=
1
;
goto
parse
;
}
}
/* Set the new theme path. */
grub_free
(
view
->
theme_path
);
view
->
theme_path
=
grub_strdup
(
theme_path
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment