Skip to content

Commit b99a430

Browse files
committed
Improve revise settings parameter in built-in menu
- Revise fixed value with settings.width.max in built-in menu. - Revise 'h_padding' parameter to align with the offical definition ub built-in menu. Signed-off-by: gujie <[email protected]>
1 parent 595eb48 commit b99a430

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/draw.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ static int calculate_menu_per_row(const struct colored_layout *cl)
750750
return 0;
751751
}
752752

753-
int menu_count = 300 / menu_width;
753+
int menu_count = settings.width.max / menu_width;
754754
menu_count = MIN(settings.menu_max_per_row, menu_count);
755755
return menu_count;
756756
}
@@ -804,7 +804,7 @@ static void draw_built_in_menu(cairo_t *c, struct colored_layout *cl, int area_x
804804

805805
for (int row = 0; row < rows; row++) {
806806
int buttons_in_row = MIN(buttons - row * max_per_row, max_per_row);
807-
base_button_width = (area_width - settings.padding * (buttons_in_row + 1)) / buttons_in_row;
807+
base_button_width = (area_width - settings.h_padding * (buttons_in_row + 1)) / buttons_in_row;
808808

809809
for (int col = 0; col < buttons_in_row; col++) {
810810
int button_index = row * max_per_row + col;
@@ -815,7 +815,7 @@ static void draw_built_in_menu(cairo_t *c, struct colored_layout *cl, int area_x
815815
if (!label)
816816
continue;
817817

818-
int x = area_x + settings.padding + col * (base_button_width + settings.padding);
818+
int x = area_x + settings.h_padding + col * (base_button_width + settings.h_padding);
819819
int y = area_y + row * (settings.menu_height + settings.padding);
820820
menu_set_position(cl->n, button_index, x, y, base_button_width, settings.menu_height);
821821

0 commit comments

Comments
 (0)