From a9e123393cd50ebea3c35b2e201769389c5e4f92 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Sat, 12 Aug 2023 19:59:46 +0100 Subject: [PATCH] osd: refactor to remove get_osd_height() --- src/osd.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/osd.c b/src/osd.c index 6bce6fe6..de7f3009 100644 --- a/src/osd.c +++ b/src/osd.c @@ -392,21 +392,6 @@ render_osd(struct server *server, cairo_t *cairo, int w, int h, cairo_surface_flush(surf); } -static int -get_osd_height(struct server *server, struct wl_array *views) -{ - int height = 0; - - /* Includes item border width */ - size_t len = views->size / sizeof(struct view *); - height += len * rc.theme->osd_window_switcher_item_height; - - /* Add OSD border width */ - height += 2 * rc.theme->osd_border_width; - height += 2 * rc.theme->osd_window_switcher_padding; - return height; -} - static void display_osd(struct output *output) { @@ -426,7 +411,9 @@ display_osd(struct output *output) float scale = output->wlr_output->scale; int w = theme->osd_window_switcher_width; - int h = get_osd_height(server, &views); + int h = views.size / sizeof(struct view *) * rc.theme->osd_window_switcher_item_height + + 2 * rc.theme->osd_border_width + + 2 * rc.theme->osd_window_switcher_padding; if (show_workspace) { /* workspace indicator */ h += theme->osd_window_switcher_item_height; -- 2.52.0