desktop-shell: Directly look up output panel view

We don't need to traverse the layer-view list to find our view for an
output's panel.

Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Daniel Stone 2023-07-12 12:21:55 +01:00 committed by Marius Vlad
parent e165f15219
commit a80a008479

View file

@ -240,6 +240,20 @@ shell_surface_update_child_surface_layers(struct shell_surface *shsurf);
static void
get_maximized_size(struct shell_surface *shsurf, int32_t *width, int32_t *height);
static struct shell_output *
find_shell_output_from_weston_output(struct desktop_shell *shell,
struct weston_output *output)
{
struct shell_output *shell_output;
wl_list_for_each(shell_output, &shell->output_list, link) {
if (shell_output->output == output)
return shell_output;
}
return NULL;
}
static bool
shsurf_is_max_or_fullscreen(struct shell_surface *shsurf)
{
@ -387,6 +401,7 @@ get_output_panel_size(struct desktop_shell *shell,
int *width,
int *height)
{
struct shell_output *sh_output;
struct weston_view *view;
*width = 0;
@ -395,16 +410,15 @@ get_output_panel_size(struct desktop_shell *shell,
if (!output)
return;
wl_list_for_each(view, &shell->panel_layer.view_list.link, layer_link.link) {
if (view->surface->output == output) {
weston_view_update_transform(view);
sh_output = find_shell_output_from_weston_output(shell, output);
assert(sh_output);
get_panel_size(shell, view, width, height);
return;
}
}
view = sh_output->panel_view;
if (!view || !weston_view_is_mapped(view))
return;
/* the correct view wasn't found */
weston_view_update_transform(view);
get_panel_size(shell, view, width, height);
}
void
@ -2816,21 +2830,6 @@ configure_static_view(struct weston_view *ev, struct weston_layer *layer,
weston_view_move_to_layer(ev, &layer->view_list);
}
static struct shell_output *
find_shell_output_from_weston_output(struct desktop_shell *shell,
struct weston_output *output)
{
struct shell_output *shell_output;
wl_list_for_each(shell_output, &shell->output_list, link) {
if (shell_output->output == output)
return shell_output;
}
return NULL;
}
static int
background_get_label(struct weston_surface *surface, char *buf, size_t len)
{