menu: fix breakage caused by f857aea8

This commit is contained in:
Johan Malm 2021-08-09 17:28:39 +01:00
parent 0e57c65393
commit 9a9cd609f6
3 changed files with 29 additions and 17 deletions

View file

@ -535,28 +535,39 @@ static void
render_rootmenu(struct output *output, pixman_region32_t *output_damage)
{
struct server *server = output->server;
struct theme *theme = server->theme;
float matrix[9];
struct wlr_output_layout *output_layout = server->output_layout;
double ox = 0, oy = 0;
wlr_output_layout_output_coords(output_layout, output->wlr_output,
&ox, &oy);
/* background */
render_rect(output, output_damage, &server->rootmenu->box,
theme->menu_items_bg_color);
/* items */
struct menuitem *menuitem;
wl_list_for_each (menuitem, &server->rootmenu->menuitems, link) {
struct wlr_texture *t;
t = menuitem->selected ? menuitem->texture.active :
menuitem->texture.inactive;
struct wlr_box box = {
.x = menuitem->box.x + ox + menuitem->texture.offset_x,
.y = menuitem->box.y + oy + menuitem->texture.offset_y,
.width = t->width,
.height = t->height,
.x = menuitem->box.x + menuitem->texture.offset_x + ox,
.y = menuitem->box.y + menuitem->texture.offset_y + oy,
.width = menuitem->texture.active->width,
.height = menuitem->texture.active->height,
};
scale_box(&box, output->wlr_output->scale);
wlr_matrix_project_box(matrix, &box, WL_OUTPUT_TRANSFORM_NORMAL,
0, output->wlr_output->transform_matrix);
render_texture(output->wlr_output, output_damage, t,
&box, matrix);
if (menuitem->selected) {
render_rect(output, output_damage, &menuitem->box,
theme->menu_items_active_bg_color);
render_texture(output->wlr_output, output_damage,
menuitem->texture.active, &box, matrix);
} else {
render_texture(output->wlr_output, output_damage,
menuitem->texture.inactive, &box, matrix);
}
}
}