]> git.mdlowis.com Git - proto/labwc.git/commitdiff
osd: refactor to remove get_osd_height()
authorJohan Malm <jgm323@gmail.com>
Sat, 12 Aug 2023 18:59:46 +0000 (19:59 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sun, 20 Aug 2023 08:56:49 +0000 (09:56 +0100)
src/osd.c

index 6bce6fe67122e6610cfd96c145e6c63e7a35e852..de7f3009c58801278a956421eb9b620ae6bd3de5 100644 (file)
--- 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;