osd: move get_osd_height() closer to where it is called from

This commit is contained in:
Johan Malm 2023-07-05 19:52:01 +01:00 committed by Johan Malm
parent 2c66fa279f
commit b6dfffc782

View file

@ -54,34 +54,6 @@ get_formatted_app_id(struct view *view)
return s;
}
static int
get_osd_height(struct wl_list *node_list)
{
int height = 0;
struct view *view;
struct wlr_scene_node *node;
wl_list_for_each(node, node_list, link) {
if (!node->data) {
/* We found some non-view, most likely the region overlay */
continue;
}
view = node_view_from_node(node);
enum property skip = window_rules_get_property(view, "skipWindowSwitcher");
if (!isfocusable(view) || skip == LAB_PROP_TRUE) {
continue;
}
/* Include item border width */
height += rc.theme->osd_window_switcher_item_height
+ rc.theme->osd_border_width * 2;
}
/* Add OSD border width */
height += 2 * rc.theme->osd_border_width;
height += 2 * rc.theme->osd_window_switcher_padding;
return height;
}
static void
destroy_osd_nodes(struct output *output)
{
@ -430,6 +402,33 @@ render_osd(struct server *server, cairo_t *cairo, int w, int h,
cairo_surface_flush(surf);
}
static int
get_osd_height(struct wl_list *node_list)
{
int height = 0;
struct view *view;
struct wlr_scene_node *node;
wl_list_for_each(node, node_list, link) {
if (!node->data) {
/* We found some non-view, most likely the region overlay */
continue;
}
view = node_view_from_node(node);
enum property skip = window_rules_get_property(view, "skipWindowSwitcher");
if (!isfocusable(view) || skip == LAB_PROP_TRUE) {
continue;
}
/* Include item border width */
height += 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)
{